@crmy/web 0.5.9 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
var dR=Object.defineProperty;var Rj=e=>{throw TypeError(e)};var fR=(e,t,n)=>t in e?dR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ee=(e,t,n)=>fR(e,typeof t!="symbol"?t+"":t,n),Kx=(e,t,n)=>t.has(e)||Rj("Cannot "+n);var G=(e,t,n)=>(Kx(e,t,"read from private field"),n?n.call(e):t.get(e)),Ve=(e,t,n)=>t.has(e)?Rj("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,r)=>(Kx(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),rt=(e,t,n)=>(Kx(e,t,"access private method"),n);var sh=(e,t,n,r)=>({set _(o){Se(e,t,o,n)},get _(){return G(e,t,r)}});function hR(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(r,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();function Jm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yx={exports:{}},gu={},Qx={exports:{}},ot={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Oj;function mR(){if(Oj)return ot;Oj=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.iterator;function g(V){return V===null||typeof V!="object"?null:(V=p&&V[p]||V["@@iterator"],typeof V=="function"?V:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function N(V,$,Y){this.props=V,this.context=$,this.refs=w,this.updater=Y||y}N.prototype.isReactComponent={},N.prototype.setState=function(V,$){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,$,"setState")},N.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function k(){}k.prototype=N.prototype;function j(V,$,Y){this.props=V,this.context=$,this.refs=w,this.updater=Y||y}var C=j.prototype=new k;C.constructor=j,b(C,N.prototype),C.isPureReactComponent=!0;var S=Array.isArray,E=Object.prototype.hasOwnProperty,P={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function I(V,$,Y){var X,ne={},ie=null,J=null;if($!=null)for(X in $.ref!==void 0&&(J=$.ref),$.key!==void 0&&(ie=""+$.key),$)E.call($,X)&&!D.hasOwnProperty(X)&&(ne[X]=$[X]);var re=arguments.length-2;if(re===1)ne.children=Y;else if(1<re){for(var ce=Array(re),fe=0;fe<re;fe++)ce[fe]=arguments[fe+2];ne.children=ce}if(V&&V.defaultProps)for(X in re=V.defaultProps,re)ne[X]===void 0&&(ne[X]=re[X]);return{$$typeof:e,type:V,key:ie,ref:J,props:ne,_owner:P.current}}function z(V,$){return{$$typeof:e,type:V.type,key:$,ref:V.ref,props:V.props,_owner:V._owner}}function K(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function q(V){var $={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(Y){return $[Y]})}var H=/\/+/g;function B(V,$){return typeof V=="object"&&V!==null&&V.key!=null?q(""+V.key):$.toString(36)}function R(V,$,Y,X,ne){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var J=!1;if(V===null)J=!0;else switch(ie){case"string":case"number":J=!0;break;case"object":switch(V.$$typeof){case e:case t:J=!0}}if(J)return J=V,ne=ne(J),V=X===""?"."+B(J,0):X,S(ne)?(Y="",V!=null&&(Y=V.replace(H,"$&/")+"/"),R(ne,$,Y,"",function(fe){return fe})):ne!=null&&(K(ne)&&(ne=z(ne,Y+(!ne.key||J&&J.key===ne.key?"":(""+ne.key).replace(H,"$&/")+"/")+V)),$.push(ne)),1;if(J=0,X=X===""?".":X+":",S(V))for(var re=0;re<V.length;re++){ie=V[re];var ce=X+B(ie,re);J+=R(ie,$,Y,ce,ne)}else if(ce=g(V),typeof ce=="function")for(V=ce.call(V),re=0;!(ie=V.next()).done;)ie=ie.value,ce=X+B(ie,re++),J+=R(ie,$,Y,ce,ne);else if(ie==="object")throw $=String(V),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return J}function M(V,$,Y){if(V==null)return V;var X=[],ne=0;return R(V,X,"","",function(ie){return $.call(Y,ie,ne++)}),X}function F(V){if(V._status===-1){var $=V._result;$=$(),$.then(function(Y){(V._status===0||V._status===-1)&&(V._status=1,V._result=Y)},function(Y){(V._status===0||V._status===-1)&&(V._status=2,V._result=Y)}),V._status===-1&&(V._status=0,V._result=$)}if(V._status===1)return V._result.default;throw V._result}var L={current:null},A={transition:null},O={ReactCurrentDispatcher:L,ReactCurrentBatchConfig:A,ReactCurrentOwner:P};function U(){throw Error("act(...) is not supported in production builds of React.")}return ot.Children={map:M,forEach:function(V,$,Y){M(V,function(){$.apply(this,arguments)},Y)},count:function(V){var $=0;return M(V,function(){$++}),$},toArray:function(V){return M(V,function($){return $})||[]},only:function(V){if(!K(V))throw Error("React.Children.only expected to receive a single React element child.");return V}},ot.Component=N,ot.Fragment=n,ot.Profiler=o,ot.PureComponent=j,ot.StrictMode=r,ot.Suspense=d,ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,ot.act=U,ot.cloneElement=function(V,$,Y){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var X=b({},V.props),ne=V.key,ie=V.ref,J=V._owner;if($!=null){if($.ref!==void 0&&(ie=$.ref,J=P.current),$.key!==void 0&&(ne=""+$.key),V.type&&V.type.defaultProps)var re=V.type.defaultProps;for(ce in $)E.call($,ce)&&!D.hasOwnProperty(ce)&&(X[ce]=$[ce]===void 0&&re!==void 0?re[ce]:$[ce])}var ce=arguments.length-2;if(ce===1)X.children=Y;else if(1<ce){re=Array(ce);for(var fe=0;fe<ce;fe++)re[fe]=arguments[fe+2];X.children=re}return{$$typeof:e,type:V.type,key:ne,ref:ie,props:X,_owner:J}},ot.createContext=function(V){return V={$$typeof:l,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},V.Provider={$$typeof:a,_context:V},V.Consumer=V},ot.createElement=I,ot.createFactory=function(V){var $=I.bind(null,V);return $.type=V,$},ot.createRef=function(){return{current:null}},ot.forwardRef=function(V){return{$$typeof:u,render:V}},ot.isValidElement=K,ot.lazy=function(V){return{$$typeof:m,_payload:{_status:-1,_result:V},_init:F}},ot.memo=function(V,$){return{$$typeof:f,type:V,compare:$===void 0?null:$}},ot.startTransition=function(V){var $=A.transition;A.transition={};try{V()}finally{A.transition=$}},ot.unstable_act=U,ot.useCallback=function(V,$){return L.current.useCallback(V,$)},ot.useContext=function(V){return L.current.useContext(V)},ot.useDebugValue=function(){},ot.useDeferredValue=function(V){return L.current.useDeferredValue(V)},ot.useEffect=function(V,$){return L.current.useEffect(V,$)},ot.useId=function(){return L.current.useId()},ot.useImperativeHandle=function(V,$,Y){return L.current.useImperativeHandle(V,$,Y)},ot.useInsertionEffect=function(V,$){return L.current.useInsertionEffect(V,$)},ot.useLayoutEffect=function(V,$){return L.current.useLayoutEffect(V,$)},ot.useMemo=function(V,$){return L.current.useMemo(V,$)},ot.useReducer=function(V,$,Y){return L.current.useReducer(V,$,Y)},ot.useRef=function(V){return L.current.useRef(V)},ot.useState=function(V){return L.current.useState(V)},ot.useSyncExternalStore=function(V,$,Y){return L.current.useSyncExternalStore(V,$,Y)},ot.useTransition=function(){return L.current.useTransition()},ot.version="18.3.1",ot}var Ij;function jd(){return Ij||(Ij=1,Qx.exports=mR()),Qx.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Lj;function pR(){if(Lj)return gu;Lj=1;var e=jd(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var m,p={},g=null,y=null;f!==void 0&&(g=""+f),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(y=d.ref);for(m in d)r.call(d,m)&&!a.hasOwnProperty(m)&&(p[m]=d[m]);if(u&&u.defaultProps)for(m in d=u.defaultProps,d)p[m]===void 0&&(p[m]=d[m]);return{$$typeof:t,type:u,key:g,ref:y,props:p,_owner:o.current}}return gu.Fragment=n,gu.jsx=l,gu.jsxs=l,gu}var Fj;function gR(){return Fj||(Fj=1,Yx.exports=pR()),Yx.exports}var s=gR(),x=jd();const be=Jm(x),ep=hR({__proto__:null,default:be},[x]);var oh={},Gx={exports:{}},Xn={},Xx={exports:{}},Zx={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var $j;function xR(){return $j||($j=1,(function(e){function t(A,O){var U=A.length;A.push(O);e:for(;0<U;){var V=U-1>>>1,$=A[V];if(0<o($,O))A[V]=O,A[U]=$,U=V;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var O=A[0],U=A.pop();if(U!==O){A[0]=U;e:for(var V=0,$=A.length,Y=$>>>1;V<Y;){var X=2*(V+1)-1,ne=A[X],ie=X+1,J=A[ie];if(0>o(ne,U))ie<$&&0>o(J,ne)?(A[V]=J,A[ie]=U,V=ie):(A[V]=ne,A[X]=U,V=X);else if(ie<$&&0>o(J,U))A[V]=J,A[ie]=U,V=ie;else break e}}return O}function o(A,O){var U=A.sortIndex-O.sortIndex;return U!==0?U:A.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],m=1,p=null,g=3,y=!1,b=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(A){for(var O=n(f);O!==null;){if(O.callback===null)r(f);else if(O.startTime<=A)r(f),O.sortIndex=O.expirationTime,t(d,O);else break;O=n(f)}}function S(A){if(w=!1,C(A),!b)if(n(d)!==null)b=!0,F(E);else{var O=n(f);O!==null&&L(S,O.startTime-A)}}function E(A,O){b=!1,w&&(w=!1,k(I),I=-1),y=!0;var U=g;try{for(C(O),p=n(d);p!==null&&(!(p.expirationTime>O)||A&&!q());){var V=p.callback;if(typeof V=="function"){p.callback=null,g=p.priorityLevel;var $=V(p.expirationTime<=O);O=e.unstable_now(),typeof $=="function"?p.callback=$:p===n(d)&&r(d),C(O)}else r(d);p=n(d)}if(p!==null)var Y=!0;else{var X=n(f);X!==null&&L(S,X.startTime-O),Y=!1}return Y}finally{p=null,g=U,y=!1}}var P=!1,D=null,I=-1,z=5,K=-1;function q(){return!(e.unstable_now()-K<z)}function H(){if(D!==null){var A=e.unstable_now();K=A;var O=!0;try{O=D(!0,A)}finally{O?B():(P=!1,D=null)}}else P=!1}var B;if(typeof j=="function")B=function(){j(H)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,M=R.port2;R.port1.onmessage=H,B=function(){M.postMessage(null)}}else B=function(){N(H,0)};function F(A){D=A,P||(P=!0,B())}function L(A,O){I=N(function(){A(e.unstable_now())},O)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_continueExecution=function(){b||y||(b=!0,F(E))},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(A){switch(g){case 1:case 2:case 3:var O=3;break;default:O=g}var U=g;g=O;try{return A()}finally{g=U}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(A,O){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var U=g;g=A;try{return O()}finally{g=U}},e.unstable_scheduleCallback=function(A,O,U){var V=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?V+U:V):U=V,A){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=U+$,A={id:m++,callback:O,priorityLevel:A,startTime:U,expirationTime:$,sortIndex:-1},U>V?(A.sortIndex=U,t(f,A),n(d)===null&&A===n(f)&&(w?(k(I),I=-1):w=!0,L(S,U-V))):(A.sortIndex=$,t(d,A),b||y||(b=!0,F(E))),A},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(A){var O=g;return function(){var U=g;g=O;try{return A.apply(this,arguments)}finally{g=U}}}})(Zx)),Zx}var Vj;function yR(){return Vj||(Vj=1,Xx.exports=xR()),Xx.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var zj;function vR(){if(zj)return Xn;zj=1;var e=jd(),t=yR();function n(i){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+i,h=1;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+i+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function a(i,c){l(i,c),l(i+"Capture",c)}function l(i,c){for(o[i]=c,i=0;i<c.length;i++)r.add(c[i])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,m={},p={};function g(i){return d.call(p,i)?!0:d.call(m,i)?!1:f.test(i)?p[i]=!0:(m[i]=!0,!1)}function y(i,c,h,v){if(h!==null&&h.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return v?!1:h!==null?!h.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function b(i,c,h,v){if(c===null||typeof c>"u"||y(i,c,h,v))return!0;if(v)return!1;if(h!==null)switch(h.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function w(i,c,h,v,_,T,W){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=v,this.attributeNamespace=_,this.mustUseProperty=h,this.propertyName=i,this.type=c,this.sanitizeURL=T,this.removeEmptyString=W}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){N[i]=new w(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var c=i[0];N[c]=new w(c,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){N[i]=new w(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){N[i]=new w(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){N[i]=new w(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){N[i]=new w(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){N[i]=new w(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){N[i]=new w(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){N[i]=new w(i,5,!1,i.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function j(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var c=i.replace(k,j);N[c]=new w(c,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var c=i.replace(k,j);N[c]=new w(c,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var c=i.replace(k,j);N[c]=new w(c,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){N[i]=new w(i,1,!1,i.toLowerCase(),null,!1,!1)}),N.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){N[i]=new w(i,1,!1,i.toLowerCase(),null,!0,!0)});function C(i,c,h,v){var _=N.hasOwnProperty(c)?N[c]:null;(_!==null?_.type!==0:v||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(b(c,h,_,v)&&(h=null),v||_===null?g(c)&&(h===null?i.removeAttribute(c):i.setAttribute(c,""+h)):_.mustUseProperty?i[_.propertyName]=h===null?_.type===3?!1:"":h:(c=_.attributeName,v=_.attributeNamespace,h===null?i.removeAttribute(c):(_=_.type,h=_===3||_===4&&h===!0?"":""+h,v?i.setAttributeNS(v,c,h):i.setAttribute(c,h))))}var S=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),P=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),K=Symbol.for("react.provider"),q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),A=Symbol.iterator;function O(i){return i===null||typeof i!="object"?null:(i=A&&i[A]||i["@@iterator"],typeof i=="function"?i:null)}var U=Object.assign,V;function $(i){if(V===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);V=c&&c[1]||""}return`
|
|
34
|
+
`+V+i}var Y=!1;function X(i,c){if(!i||Y)return"";Y=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(le){var v=le}Reflect.construct(i,[],c)}else{try{c.call()}catch(le){v=le}i.call(c.prototype)}else{try{throw Error()}catch(le){v=le}i()}}catch(le){if(le&&v&&typeof le.stack=="string"){for(var _=le.stack.split(`
|
|
35
|
+
`),T=v.stack.split(`
|
|
36
|
+
`),W=_.length-1,Q=T.length-1;1<=W&&0<=Q&&_[W]!==T[Q];)Q--;for(;1<=W&&0<=Q;W--,Q--)if(_[W]!==T[Q]){if(W!==1||Q!==1)do if(W--,Q--,0>Q||_[W]!==T[Q]){var Z=`
|
|
37
|
+
`+_[W].replace(" at new "," at ");return i.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",i.displayName)),Z}while(1<=W&&0<=Q);break}}}finally{Y=!1,Error.prepareStackTrace=h}return(i=i?i.displayName||i.name:"")?$(i):""}function ne(i){switch(i.tag){case 5:return $(i.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return i=X(i.type,!1),i;case 11:return i=X(i.type.render,!1),i;case 1:return i=X(i.type,!0),i;default:return""}}function ie(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case D:return"Fragment";case P:return"Portal";case z:return"Profiler";case I:return"StrictMode";case B:return"Suspense";case R:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case q:return(i.displayName||"Context")+".Consumer";case K:return(i._context.displayName||"Context")+".Provider";case H:var c=i.render;return i=i.displayName,i||(i=c.displayName||c.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case M:return c=i.displayName||null,c!==null?c:ie(i.type)||"Memo";case F:c=i._payload,i=i._init;try{return ie(i(c))}catch{}}return null}function J(i){var c=i.type;switch(i.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=c.render,i=i.displayName||i.name||"",c.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(c);case 8:return c===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function re(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ce(i){var c=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function fe(i){var c=ce(i)?"checked":"value",h=Object.getOwnPropertyDescriptor(i.constructor.prototype,c),v=""+i[c];if(!i.hasOwnProperty(c)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var _=h.get,T=h.set;return Object.defineProperty(i,c,{configurable:!0,get:function(){return _.call(this)},set:function(W){v=""+W,T.call(this,W)}}),Object.defineProperty(i,c,{enumerable:h.enumerable}),{getValue:function(){return v},setValue:function(W){v=""+W},stopTracking:function(){i._valueTracker=null,delete i[c]}}}}function pe(i){i._valueTracker||(i._valueTracker=fe(i))}function ye(i){if(!i)return!1;var c=i._valueTracker;if(!c)return!0;var h=c.getValue(),v="";return i&&(v=ce(i)?i.checked?"true":"false":i.value),i=v,i!==h?(c.setValue(i),!0):!1}function Ne(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Oe(i,c){var h=c.checked;return U({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??i._wrapperState.initialChecked})}function Xe(i,c){var h=c.defaultValue==null?"":c.defaultValue,v=c.checked!=null?c.checked:c.defaultChecked;h=re(c.value!=null?c.value:h),i._wrapperState={initialChecked:v,initialValue:h,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Le(i,c){c=c.checked,c!=null&&C(i,"checked",c,!1)}function st(i,c){Le(i,c);var h=re(c.value),v=c.type;if(h!=null)v==="number"?(h===0&&i.value===""||i.value!=h)&&(i.value=""+h):i.value!==""+h&&(i.value=""+h);else if(v==="submit"||v==="reset"){i.removeAttribute("value");return}c.hasOwnProperty("value")?ge(i,c.type,h):c.hasOwnProperty("defaultValue")&&ge(i,c.type,re(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(i.defaultChecked=!!c.defaultChecked)}function Nt(i,c,h){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var v=c.type;if(!(v!=="submit"&&v!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+i._wrapperState.initialValue,h||c===i.value||(i.value=c),i.defaultValue=c}h=i.name,h!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,h!==""&&(i.name=h)}function ge(i,c,h){(c!=="number"||Ne(i.ownerDocument)!==i)&&(h==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+h&&(i.defaultValue=""+h))}var De=Array.isArray;function $e(i,c,h,v){if(i=i.options,c){c={};for(var _=0;_<h.length;_++)c["$"+h[_]]=!0;for(h=0;h<i.length;h++)_=c.hasOwnProperty("$"+i[h].value),i[h].selected!==_&&(i[h].selected=_),_&&v&&(i[h].defaultSelected=!0)}else{for(h=""+re(h),c=null,_=0;_<i.length;_++){if(i[_].value===h){i[_].selected=!0,v&&(i[_].defaultSelected=!0);return}c!==null||i[_].disabled||(c=i[_])}c!==null&&(c.selected=!0)}}function et(i,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return U({},c,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function tt(i,c){var h=c.value;if(h==null){if(h=c.children,c=c.defaultValue,h!=null){if(c!=null)throw Error(n(92));if(De(h)){if(1<h.length)throw Error(n(93));h=h[0]}c=h}c==null&&(c=""),h=c}i._wrapperState={initialValue:re(h)}}function ht(i,c){var h=re(c.value),v=re(c.defaultValue);h!=null&&(h=""+h,h!==i.value&&(i.value=h),c.defaultValue==null&&i.defaultValue!==h&&(i.defaultValue=h)),v!=null&&(i.defaultValue=""+v)}function te(i){var c=i.textContent;c===i._wrapperState.initialValue&&c!==""&&c!==null&&(i.value=c)}function Ce(i){switch(i){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ze(i,c){return i==null||i==="http://www.w3.org/1999/xhtml"?Ce(c):i==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var at,oe=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,h,v,_){MSApp.execUnsafeLocalFunction(function(){return i(c,h,v,_)})}:i})(function(i,c){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=c;else{for(at=at||document.createElement("div"),at.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=at.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;c.firstChild;)i.appendChild(c.firstChild)}});function ke(i,c){if(c){var h=i.firstChild;if(h&&h===i.lastChild&&h.nodeType===3){h.nodeValue=c;return}}i.textContent=c}var ue={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},yt=["Webkit","ms","Moz","O"];Object.keys(ue).forEach(function(i){yt.forEach(function(c){c=c+i.charAt(0).toUpperCase()+i.substring(1),ue[c]=ue[i]})});function Mt(i,c,h){return c==null||typeof c=="boolean"||c===""?"":h||typeof c!="number"||c===0||ue.hasOwnProperty(i)&&ue[i]?(""+c).trim():c+"px"}function pn(i,c){i=i.style;for(var h in c)if(c.hasOwnProperty(h)){var v=h.indexOf("--")===0,_=Mt(h,c[h],v);h==="float"&&(h="cssFloat"),v?i.setProperty(h,_):i[h]=_}}var Un=U({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ln(i,c){if(c){if(Un[i]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(n(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(n(61))}if(c.style!=null&&typeof c.style!="object")throw Error(n(62))}}function zr(i,c){if(i.indexOf("-")===-1)return typeof c.is=="string";switch(i){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 Br=null;function xs(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ko=null,ys=null,Sr=null;function ar(i){if(i=tu(i)){if(typeof ko!="function")throw Error(n(280));var c=i.stateNode;c&&(c=vf(c),ko(i.stateNode,i.type,c))}}function Ui(i){ys?Sr?Sr.push(i):Sr=[i]:ys=i}function Ye(){if(ys){var i=ys,c=Sr;if(Sr=ys=null,ar(i),c)for(i=0;i<c.length;i++)ar(c[i])}}function ut(i,c){return i(c)}function vt(){}var gn=!1;function kn(i,c,h){if(gn)return i(c,h);gn=!0;try{return ut(i,c,h)}finally{gn=!1,(ys!==null||Sr!==null)&&(vt(),Ye())}}function Sn(i,c){var h=i.stateNode;if(h===null)return null;var v=vf(h);if(v===null)return null;h=v[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(i=i.type,v=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!v;break e;default:i=!1}if(i)return null;if(h&&typeof h!="function")throw Error(n(231,c,typeof h));return h}var ir=!1;if(u)try{var tn={};Object.defineProperty(tn,"passive",{get:function(){ir=!0}}),window.addEventListener("test",tn,tn),window.removeEventListener("test",tn,tn)}catch{ir=!1}function _r(i,c,h,v,_,T,W,Q,Z){var le=Array.prototype.slice.call(arguments,3);try{c.apply(h,le)}catch(me){this.onError(me)}}var $a=!1,qi=null,Ki=!1,Dc=null,sg={onError:function(i){$a=!0,qi=i}};function og(i,c,h,v,_,T,W,Q,Z){$a=!1,qi=null,_r.apply(sg,arguments)}function ag(i,c,h,v,_,T,W,Q,Z){if(og.apply(this,arguments),$a){if($a){var le=qi;$a=!1,qi=null}else throw Error(n(198));Ki||(Ki=!0,Dc=le)}}function vs(i){var c=i,h=i;if(i.alternate)for(;c.return;)c=c.return;else{i=c;do c=i,(c.flags&4098)!==0&&(h=c.return),i=c.return;while(i)}return c.tag===3?h:null}function Rc(i){if(i.tag===13){var c=i.memoizedState;if(c===null&&(i=i.alternate,i!==null&&(c=i.memoizedState)),c!==null)return c.dehydrated}return null}function Oc(i){if(vs(i)!==i)throw Error(n(188))}function ig(i){var c=i.alternate;if(!c){if(c=vs(i),c===null)throw Error(n(188));return c!==i?null:i}for(var h=i,v=c;;){var _=h.return;if(_===null)break;var T=_.alternate;if(T===null){if(v=_.return,v!==null){h=v;continue}break}if(_.child===T.child){for(T=_.child;T;){if(T===h)return Oc(_),i;if(T===v)return Oc(_),c;T=T.sibling}throw Error(n(188))}if(h.return!==v.return)h=_,v=T;else{for(var W=!1,Q=_.child;Q;){if(Q===h){W=!0,h=_,v=T;break}if(Q===v){W=!0,v=_,h=T;break}Q=Q.sibling}if(!W){for(Q=T.child;Q;){if(Q===h){W=!0,h=T,v=_;break}if(Q===v){W=!0,v=T,h=_;break}Q=Q.sibling}if(!W)throw Error(n(189))}}if(h.alternate!==v)throw Error(n(190))}if(h.tag!==3)throw Error(n(188));return h.stateNode.current===h?i:c}function Yd(i){return i=ig(i),i!==null?Qd(i):null}function Qd(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var c=Qd(i);if(c!==null)return c;i=i.sibling}return null}var Gd=t.unstable_scheduleCallback,Xd=t.unstable_cancelCallback,lg=t.unstable_shouldYield,Zd=t.unstable_requestPaint,Ot=t.unstable_now,cg=t.unstable_getCurrentPriorityLevel,Ic=t.unstable_ImmediatePriority,Jd=t.unstable_UserBlockingPriority,Yi=t.unstable_NormalPriority,ug=t.unstable_LowPriority,ef=t.unstable_IdlePriority,Va=null,Er=null;function dg(i){if(Er&&typeof Er.onCommitFiberRoot=="function")try{Er.onCommitFiberRoot(Va,i,void 0,(i.current.flags&128)===128)}catch{}}var lr=Math.clz32?Math.clz32:mg,fg=Math.log,hg=Math.LN2;function mg(i){return i>>>=0,i===0?32:31-(fg(i)/hg|0)|0}var Qi=64,Gi=4194304;function bs(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Xi(i,c){var h=i.pendingLanes;if(h===0)return 0;var v=0,_=i.suspendedLanes,T=i.pingedLanes,W=h&268435455;if(W!==0){var Q=W&~_;Q!==0?v=bs(Q):(T&=W,T!==0&&(v=bs(T)))}else W=h&~_,W!==0?v=bs(W):T!==0&&(v=bs(T));if(v===0)return 0;if(c!==0&&c!==v&&(c&_)===0&&(_=v&-v,T=c&-c,_>=T||_===16&&(T&4194240)!==0))return c;if((v&4)!==0&&(v|=h&16),c=i.entangledLanes,c!==0)for(i=i.entanglements,c&=v;0<c;)h=31-lr(c),_=1<<h,v|=i[h],c&=~_;return v}function tf(i,c){switch(i){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pg(i,c){for(var h=i.suspendedLanes,v=i.pingedLanes,_=i.expirationTimes,T=i.pendingLanes;0<T;){var W=31-lr(T),Q=1<<W,Z=_[W];Z===-1?((Q&h)===0||(Q&v)!==0)&&(_[W]=tf(Q,c)):Z<=c&&(i.expiredLanes|=Q),T&=~Q}}function Lc(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Zi(){var i=Qi;return Qi<<=1,(Qi&4194240)===0&&(Qi=64),i}function Fc(i){for(var c=[],h=0;31>h;h++)c.push(i);return c}function za(i,c,h){i.pendingLanes|=c,c!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,c=31-lr(c),i[c]=h}function nf(i,c){var h=i.pendingLanes&~c;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=c,i.mutableReadLanes&=c,i.entangledLanes&=c,c=i.entanglements;var v=i.eventTimes;for(i=i.expirationTimes;0<h;){var _=31-lr(h),T=1<<_;c[_]=0,v[_]=-1,i[_]=-1,h&=~T}}function gg(i,c){var h=i.entangledLanes|=c;for(i=i.entanglements;h;){var v=31-lr(h),_=1<<v;_&c|i[v]&c&&(i[v]|=c),h&=~_}}var bt=0;function f1(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var h1,xg,m1,p1,g1,yg=!1,rf=[],So=null,_o=null,Eo=null,$c=new Map,Vc=new Map,Po=[],D4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function x1(i,c){switch(i){case"focusin":case"focusout":So=null;break;case"dragenter":case"dragleave":_o=null;break;case"mouseover":case"mouseout":Eo=null;break;case"pointerover":case"pointerout":$c.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vc.delete(c.pointerId)}}function zc(i,c,h,v,_,T){return i===null||i.nativeEvent!==T?(i={blockedOn:c,domEventName:h,eventSystemFlags:v,nativeEvent:T,targetContainers:[_]},c!==null&&(c=tu(c),c!==null&&xg(c)),i):(i.eventSystemFlags|=v,c=i.targetContainers,_!==null&&c.indexOf(_)===-1&&c.push(_),i)}function R4(i,c,h,v,_){switch(c){case"focusin":return So=zc(So,i,c,h,v,_),!0;case"dragenter":return _o=zc(_o,i,c,h,v,_),!0;case"mouseover":return Eo=zc(Eo,i,c,h,v,_),!0;case"pointerover":var T=_.pointerId;return $c.set(T,zc($c.get(T)||null,i,c,h,v,_)),!0;case"gotpointercapture":return T=_.pointerId,Vc.set(T,zc(Vc.get(T)||null,i,c,h,v,_)),!0}return!1}function y1(i){var c=Ba(i.target);if(c!==null){var h=vs(c);if(h!==null){if(c=h.tag,c===13){if(c=Rc(h),c!==null){i.blockedOn=c,g1(i.priority,function(){m1(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){i.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}i.blockedOn=null}function sf(i){if(i.blockedOn!==null)return!1;for(var c=i.targetContainers;0<c.length;){var h=bg(i.domEventName,i.eventSystemFlags,c[0],i.nativeEvent);if(h===null){h=i.nativeEvent;var v=new h.constructor(h.type,h);Br=v,h.target.dispatchEvent(v),Br=null}else return c=tu(h),c!==null&&xg(c),i.blockedOn=h,!1;c.shift()}return!0}function v1(i,c,h){sf(i)&&h.delete(c)}function O4(){yg=!1,So!==null&&sf(So)&&(So=null),_o!==null&&sf(_o)&&(_o=null),Eo!==null&&sf(Eo)&&(Eo=null),$c.forEach(v1),Vc.forEach(v1)}function Bc(i,c){i.blockedOn===c&&(i.blockedOn=null,yg||(yg=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,O4)))}function Wc(i){function c(_){return Bc(_,i)}if(0<rf.length){Bc(rf[0],i);for(var h=1;h<rf.length;h++){var v=rf[h];v.blockedOn===i&&(v.blockedOn=null)}}for(So!==null&&Bc(So,i),_o!==null&&Bc(_o,i),Eo!==null&&Bc(Eo,i),$c.forEach(c),Vc.forEach(c),h=0;h<Po.length;h++)v=Po[h],v.blockedOn===i&&(v.blockedOn=null);for(;0<Po.length&&(h=Po[0],h.blockedOn===null);)y1(h),h.blockedOn===null&&Po.shift()}var Ji=S.ReactCurrentBatchConfig,of=!0;function I4(i,c,h,v){var _=bt,T=Ji.transition;Ji.transition=null;try{bt=1,vg(i,c,h,v)}finally{bt=_,Ji.transition=T}}function L4(i,c,h,v){var _=bt,T=Ji.transition;Ji.transition=null;try{bt=4,vg(i,c,h,v)}finally{bt=_,Ji.transition=T}}function vg(i,c,h,v){if(of){var _=bg(i,c,h,v);if(_===null)Lg(i,c,v,af,h),x1(i,v);else if(R4(_,i,c,h,v))v.stopPropagation();else if(x1(i,v),c&4&&-1<D4.indexOf(i)){for(;_!==null;){var T=tu(_);if(T!==null&&h1(T),T=bg(i,c,h,v),T===null&&Lg(i,c,v,af,h),T===_)break;_=T}_!==null&&v.stopPropagation()}else Lg(i,c,v,null,h)}}var af=null;function bg(i,c,h,v){if(af=null,i=xs(v),i=Ba(i),i!==null)if(c=vs(i),c===null)i=null;else if(h=c.tag,h===13){if(i=Rc(c),i!==null)return i;i=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;i=null}else c!==i&&(i=null);return af=i,null}function b1(i){switch(i){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cg()){case Ic:return 1;case Jd:return 4;case Yi:case ug:return 16;case ef:return 536870912;default:return 16}default:return 16}}var To=null,wg=null,lf=null;function w1(){if(lf)return lf;var i,c=wg,h=c.length,v,_="value"in To?To.value:To.textContent,T=_.length;for(i=0;i<h&&c[i]===_[i];i++);var W=h-i;for(v=1;v<=W&&c[h-v]===_[T-v];v++);return lf=_.slice(i,1<v?1-v:void 0)}function cf(i){var c=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&c===13&&(i=13)):i=c,i===10&&(i=13),32<=i||i===13?i:0}function uf(){return!0}function N1(){return!1}function cr(i){function c(h,v,_,T,W){this._reactName=h,this._targetInst=_,this.type=v,this.nativeEvent=T,this.target=W,this.currentTarget=null;for(var Q in i)i.hasOwnProperty(Q)&&(h=i[Q],this[Q]=h?h(T):T[Q]);return this.isDefaultPrevented=(T.defaultPrevented!=null?T.defaultPrevented:T.returnValue===!1)?uf:N1,this.isPropagationStopped=N1,this}return U(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=uf)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=uf)},persist:function(){},isPersistent:uf}),c}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ng=cr(el),Hc=U({},el,{view:0,detail:0}),F4=cr(Hc),jg,Cg,Uc,df=U({},Hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sg,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Uc&&(Uc&&i.type==="mousemove"?(jg=i.screenX-Uc.screenX,Cg=i.screenY-Uc.screenY):Cg=jg=0,Uc=i),jg)},movementY:function(i){return"movementY"in i?i.movementY:Cg}}),j1=cr(df),$4=U({},df,{dataTransfer:0}),V4=cr($4),z4=U({},Hc,{relatedTarget:0}),kg=cr(z4),B4=U({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),W4=cr(B4),H4=U({},el,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),U4=cr(H4),q4=U({},el,{data:0}),C1=cr(q4),K4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Y4={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"},Q4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function G4(i){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(i):(i=Q4[i])?!!c[i]:!1}function Sg(){return G4}var X4=U({},Hc,{key:function(i){if(i.key){var c=K4[i.key]||i.key;if(c!=="Unidentified")return c}return i.type==="keypress"?(i=cf(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Y4[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sg,charCode:function(i){return i.type==="keypress"?cf(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?cf(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Z4=cr(X4),J4=U({},df,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),k1=cr(J4),eD=U({},Hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sg}),tD=cr(eD),nD=U({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),rD=cr(nD),sD=U({},df,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),oD=cr(sD),aD=[9,13,27,32],_g=u&&"CompositionEvent"in window,qc=null;u&&"documentMode"in document&&(qc=document.documentMode);var iD=u&&"TextEvent"in window&&!qc,S1=u&&(!_g||qc&&8<qc&&11>=qc),_1=" ",E1=!1;function P1(i,c){switch(i){case"keyup":return aD.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function T1(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var tl=!1;function lD(i,c){switch(i){case"compositionend":return T1(c);case"keypress":return c.which!==32?null:(E1=!0,_1);case"textInput":return i=c.data,i===_1&&E1?null:i;default:return null}}function cD(i,c){if(tl)return i==="compositionend"||!_g&&P1(i,c)?(i=w1(),lf=wg=To=null,tl=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return S1&&c.locale!=="ko"?null:c.data;default:return null}}var uD={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 M1(i){var c=i&&i.nodeName&&i.nodeName.toLowerCase();return c==="input"?!!uD[i.type]:c==="textarea"}function A1(i,c,h,v){Ui(v),c=gf(c,"onChange"),0<c.length&&(h=new Ng("onChange","change",null,h,v),i.push({event:h,listeners:c}))}var Kc=null,Yc=null;function dD(i){G1(i,0)}function ff(i){var c=al(i);if(ye(c))return i}function fD(i,c){if(i==="change")return c}var D1=!1;if(u){var Eg;if(u){var Pg="oninput"in document;if(!Pg){var R1=document.createElement("div");R1.setAttribute("oninput","return;"),Pg=typeof R1.oninput=="function"}Eg=Pg}else Eg=!1;D1=Eg&&(!document.documentMode||9<document.documentMode)}function O1(){Kc&&(Kc.detachEvent("onpropertychange",I1),Yc=Kc=null)}function I1(i){if(i.propertyName==="value"&&ff(Yc)){var c=[];A1(c,Yc,i,xs(i)),kn(dD,c)}}function hD(i,c,h){i==="focusin"?(O1(),Kc=c,Yc=h,Kc.attachEvent("onpropertychange",I1)):i==="focusout"&&O1()}function mD(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return ff(Yc)}function pD(i,c){if(i==="click")return ff(c)}function gD(i,c){if(i==="input"||i==="change")return ff(c)}function xD(i,c){return i===c&&(i!==0||1/i===1/c)||i!==i&&c!==c}var Wr=typeof Object.is=="function"?Object.is:xD;function Qc(i,c){if(Wr(i,c))return!0;if(typeof i!="object"||i===null||typeof c!="object"||c===null)return!1;var h=Object.keys(i),v=Object.keys(c);if(h.length!==v.length)return!1;for(v=0;v<h.length;v++){var _=h[v];if(!d.call(c,_)||!Wr(i[_],c[_]))return!1}return!0}function L1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function F1(i,c){var h=L1(i);i=0;for(var v;h;){if(h.nodeType===3){if(v=i+h.textContent.length,i<=c&&v>=c)return{node:h,offset:c-i};i=v}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=L1(h)}}function $1(i,c){return i&&c?i===c?!0:i&&i.nodeType===3?!1:c&&c.nodeType===3?$1(i,c.parentNode):"contains"in i?i.contains(c):i.compareDocumentPosition?!!(i.compareDocumentPosition(c)&16):!1:!1}function V1(){for(var i=window,c=Ne();c instanceof i.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)i=c.contentWindow;else break;c=Ne(i.document)}return c}function Tg(i){var c=i&&i.nodeName&&i.nodeName.toLowerCase();return c&&(c==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||c==="textarea"||i.contentEditable==="true")}function yD(i){var c=V1(),h=i.focusedElem,v=i.selectionRange;if(c!==h&&h&&h.ownerDocument&&$1(h.ownerDocument.documentElement,h)){if(v!==null&&Tg(h)){if(c=v.start,i=v.end,i===void 0&&(i=c),"selectionStart"in h)h.selectionStart=c,h.selectionEnd=Math.min(i,h.value.length);else if(i=(c=h.ownerDocument||document)&&c.defaultView||window,i.getSelection){i=i.getSelection();var _=h.textContent.length,T=Math.min(v.start,_);v=v.end===void 0?T:Math.min(v.end,_),!i.extend&&T>v&&(_=v,v=T,T=_),_=F1(h,T);var W=F1(h,v);_&&W&&(i.rangeCount!==1||i.anchorNode!==_.node||i.anchorOffset!==_.offset||i.focusNode!==W.node||i.focusOffset!==W.offset)&&(c=c.createRange(),c.setStart(_.node,_.offset),i.removeAllRanges(),T>v?(i.addRange(c),i.extend(W.node,W.offset)):(c.setEnd(W.node,W.offset),i.addRange(c)))}}for(c=[],i=h;i=i.parentNode;)i.nodeType===1&&c.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<c.length;h++)i=c[h],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var vD=u&&"documentMode"in document&&11>=document.documentMode,nl=null,Mg=null,Gc=null,Ag=!1;function z1(i,c,h){var v=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Ag||nl==null||nl!==Ne(v)||(v=nl,"selectionStart"in v&&Tg(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),Gc&&Qc(Gc,v)||(Gc=v,v=gf(Mg,"onSelect"),0<v.length&&(c=new Ng("onSelect","select",null,c,h),i.push({event:c,listeners:v}),c.target=nl)))}function hf(i,c){var h={};return h[i.toLowerCase()]=c.toLowerCase(),h["Webkit"+i]="webkit"+c,h["Moz"+i]="moz"+c,h}var rl={animationend:hf("Animation","AnimationEnd"),animationiteration:hf("Animation","AnimationIteration"),animationstart:hf("Animation","AnimationStart"),transitionend:hf("Transition","TransitionEnd")},Dg={},B1={};u&&(B1=document.createElement("div").style,"AnimationEvent"in window||(delete rl.animationend.animation,delete rl.animationiteration.animation,delete rl.animationstart.animation),"TransitionEvent"in window||delete rl.transitionend.transition);function mf(i){if(Dg[i])return Dg[i];if(!rl[i])return i;var c=rl[i],h;for(h in c)if(c.hasOwnProperty(h)&&h in B1)return Dg[i]=c[h];return i}var W1=mf("animationend"),H1=mf("animationiteration"),U1=mf("animationstart"),q1=mf("transitionend"),K1=new Map,Y1="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Mo(i,c){K1.set(i,c),a(c,[i])}for(var Rg=0;Rg<Y1.length;Rg++){var Og=Y1[Rg],bD=Og.toLowerCase(),wD=Og[0].toUpperCase()+Og.slice(1);Mo(bD,"on"+wD)}Mo(W1,"onAnimationEnd"),Mo(H1,"onAnimationIteration"),Mo(U1,"onAnimationStart"),Mo("dblclick","onDoubleClick"),Mo("focusin","onFocus"),Mo("focusout","onBlur"),Mo(q1,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xc="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(" "),ND=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xc));function Q1(i,c,h){var v=i.type||"unknown-event";i.currentTarget=h,ag(v,c,void 0,i),i.currentTarget=null}function G1(i,c){c=(c&4)!==0;for(var h=0;h<i.length;h++){var v=i[h],_=v.event;v=v.listeners;e:{var T=void 0;if(c)for(var W=v.length-1;0<=W;W--){var Q=v[W],Z=Q.instance,le=Q.currentTarget;if(Q=Q.listener,Z!==T&&_.isPropagationStopped())break e;Q1(_,Q,le),T=Z}else for(W=0;W<v.length;W++){if(Q=v[W],Z=Q.instance,le=Q.currentTarget,Q=Q.listener,Z!==T&&_.isPropagationStopped())break e;Q1(_,Q,le),T=Z}}}if(Ki)throw i=Dc,Ki=!1,Dc=null,i}function Et(i,c){var h=c[Wg];h===void 0&&(h=c[Wg]=new Set);var v=i+"__bubble";h.has(v)||(X1(c,i,2,!1),h.add(v))}function Ig(i,c,h){var v=0;c&&(v|=4),X1(h,i,v,c)}var pf="_reactListening"+Math.random().toString(36).slice(2);function Zc(i){if(!i[pf]){i[pf]=!0,r.forEach(function(h){h!=="selectionchange"&&(ND.has(h)||Ig(h,!1,i),Ig(h,!0,i))});var c=i.nodeType===9?i:i.ownerDocument;c===null||c[pf]||(c[pf]=!0,Ig("selectionchange",!1,c))}}function X1(i,c,h,v){switch(b1(c)){case 1:var _=I4;break;case 4:_=L4;break;default:_=vg}h=_.bind(null,c,h,i),_=void 0,!ir||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(_=!0),v?_!==void 0?i.addEventListener(c,h,{capture:!0,passive:_}):i.addEventListener(c,h,!0):_!==void 0?i.addEventListener(c,h,{passive:_}):i.addEventListener(c,h,!1)}function Lg(i,c,h,v,_){var T=v;if((c&1)===0&&(c&2)===0&&v!==null)e:for(;;){if(v===null)return;var W=v.tag;if(W===3||W===4){var Q=v.stateNode.containerInfo;if(Q===_||Q.nodeType===8&&Q.parentNode===_)break;if(W===4)for(W=v.return;W!==null;){var Z=W.tag;if((Z===3||Z===4)&&(Z=W.stateNode.containerInfo,Z===_||Z.nodeType===8&&Z.parentNode===_))return;W=W.return}for(;Q!==null;){if(W=Ba(Q),W===null)return;if(Z=W.tag,Z===5||Z===6){v=T=W;continue e}Q=Q.parentNode}}v=v.return}kn(function(){var le=T,me=xs(h),xe=[];e:{var he=K1.get(i);if(he!==void 0){var _e=Ng,Te=i;switch(i){case"keypress":if(cf(h)===0)break e;case"keydown":case"keyup":_e=Z4;break;case"focusin":Te="focus",_e=kg;break;case"focusout":Te="blur",_e=kg;break;case"beforeblur":case"afterblur":_e=kg;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_e=j1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_e=V4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_e=tD;break;case W1:case H1:case U1:_e=W4;break;case q1:_e=rD;break;case"scroll":_e=F4;break;case"wheel":_e=oD;break;case"copy":case"cut":case"paste":_e=U4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_e=k1}var Ae=(c&4)!==0,qt=!Ae&&i==="scroll",se=Ae?he!==null?he+"Capture":null:he;Ae=[];for(var ee=le,ae;ee!==null;){ae=ee;var we=ae.stateNode;if(ae.tag===5&&we!==null&&(ae=we,se!==null&&(we=Sn(ee,se),we!=null&&Ae.push(Jc(ee,we,ae)))),qt)break;ee=ee.return}0<Ae.length&&(he=new _e(he,Te,null,h,me),xe.push({event:he,listeners:Ae}))}}if((c&7)===0){e:{if(he=i==="mouseover"||i==="pointerover",_e=i==="mouseout"||i==="pointerout",he&&h!==Br&&(Te=h.relatedTarget||h.fromElement)&&(Ba(Te)||Te[Ys]))break e;if((_e||he)&&(he=me.window===me?me:(he=me.ownerDocument)?he.defaultView||he.parentWindow:window,_e?(Te=h.relatedTarget||h.toElement,_e=le,Te=Te?Ba(Te):null,Te!==null&&(qt=vs(Te),Te!==qt||Te.tag!==5&&Te.tag!==6)&&(Te=null)):(_e=null,Te=le),_e!==Te)){if(Ae=j1,we="onMouseLeave",se="onMouseEnter",ee="mouse",(i==="pointerout"||i==="pointerover")&&(Ae=k1,we="onPointerLeave",se="onPointerEnter",ee="pointer"),qt=_e==null?he:al(_e),ae=Te==null?he:al(Te),he=new Ae(we,ee+"leave",_e,h,me),he.target=qt,he.relatedTarget=ae,we=null,Ba(me)===le&&(Ae=new Ae(se,ee+"enter",Te,h,me),Ae.target=ae,Ae.relatedTarget=qt,we=Ae),qt=we,_e&&Te)t:{for(Ae=_e,se=Te,ee=0,ae=Ae;ae;ae=sl(ae))ee++;for(ae=0,we=se;we;we=sl(we))ae++;for(;0<ee-ae;)Ae=sl(Ae),ee--;for(;0<ae-ee;)se=sl(se),ae--;for(;ee--;){if(Ae===se||se!==null&&Ae===se.alternate)break t;Ae=sl(Ae),se=sl(se)}Ae=null}else Ae=null;_e!==null&&Z1(xe,he,_e,Ae,!1),Te!==null&&qt!==null&&Z1(xe,qt,Te,Ae,!0)}}e:{if(he=le?al(le):window,_e=he.nodeName&&he.nodeName.toLowerCase(),_e==="select"||_e==="input"&&he.type==="file")var Re=fD;else if(M1(he))if(D1)Re=gD;else{Re=mD;var Ue=hD}else(_e=he.nodeName)&&_e.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Re=pD);if(Re&&(Re=Re(i,le))){A1(xe,Re,h,me);break e}Ue&&Ue(i,he,le),i==="focusout"&&(Ue=he._wrapperState)&&Ue.controlled&&he.type==="number"&&ge(he,"number",he.value)}switch(Ue=le?al(le):window,i){case"focusin":(M1(Ue)||Ue.contentEditable==="true")&&(nl=Ue,Mg=le,Gc=null);break;case"focusout":Gc=Mg=nl=null;break;case"mousedown":Ag=!0;break;case"contextmenu":case"mouseup":case"dragend":Ag=!1,z1(xe,h,me);break;case"selectionchange":if(vD)break;case"keydown":case"keyup":z1(xe,h,me)}var qe;if(_g)e:{switch(i){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else tl?P1(i,h)&&(Je="onCompositionEnd"):i==="keydown"&&h.keyCode===229&&(Je="onCompositionStart");Je&&(S1&&h.locale!=="ko"&&(tl||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&tl&&(qe=w1()):(To=me,wg="value"in To?To.value:To.textContent,tl=!0)),Ue=gf(le,Je),0<Ue.length&&(Je=new C1(Je,i,null,h,me),xe.push({event:Je,listeners:Ue}),qe?Je.data=qe:(qe=T1(h),qe!==null&&(Je.data=qe)))),(qe=iD?lD(i,h):cD(i,h))&&(le=gf(le,"onBeforeInput"),0<le.length&&(me=new C1("onBeforeInput","beforeinput",null,h,me),xe.push({event:me,listeners:le}),me.data=qe))}G1(xe,c)})}function Jc(i,c,h){return{instance:i,listener:c,currentTarget:h}}function gf(i,c){for(var h=c+"Capture",v=[];i!==null;){var _=i,T=_.stateNode;_.tag===5&&T!==null&&(_=T,T=Sn(i,h),T!=null&&v.unshift(Jc(i,T,_)),T=Sn(i,c),T!=null&&v.push(Jc(i,T,_))),i=i.return}return v}function sl(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function Z1(i,c,h,v,_){for(var T=c._reactName,W=[];h!==null&&h!==v;){var Q=h,Z=Q.alternate,le=Q.stateNode;if(Z!==null&&Z===v)break;Q.tag===5&&le!==null&&(Q=le,_?(Z=Sn(h,T),Z!=null&&W.unshift(Jc(h,Z,Q))):_||(Z=Sn(h,T),Z!=null&&W.push(Jc(h,Z,Q)))),h=h.return}W.length!==0&&i.push({event:c,listeners:W})}var jD=/\r\n?/g,CD=/\u0000|\uFFFD/g;function J1(i){return(typeof i=="string"?i:""+i).replace(jD,`
|
|
38
|
+
`).replace(CD,"")}function xf(i,c,h){if(c=J1(c),J1(i)!==c&&h)throw Error(n(425))}function yf(){}var Fg=null,$g=null;function Vg(i,c){return i==="textarea"||i==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var zg=typeof setTimeout=="function"?setTimeout:void 0,kD=typeof clearTimeout=="function"?clearTimeout:void 0,eN=typeof Promise=="function"?Promise:void 0,SD=typeof queueMicrotask=="function"?queueMicrotask:typeof eN<"u"?function(i){return eN.resolve(null).then(i).catch(_D)}:zg;function _D(i){setTimeout(function(){throw i})}function Bg(i,c){var h=c,v=0;do{var _=h.nextSibling;if(i.removeChild(h),_&&_.nodeType===8)if(h=_.data,h==="/$"){if(v===0){i.removeChild(_),Wc(c);return}v--}else h!=="$"&&h!=="$?"&&h!=="$!"||v++;h=_}while(h);Wc(c)}function Ao(i){for(;i!=null;i=i.nextSibling){var c=i.nodeType;if(c===1||c===3)break;if(c===8){if(c=i.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return i}function tN(i){i=i.previousSibling;for(var c=0;i;){if(i.nodeType===8){var h=i.data;if(h==="$"||h==="$!"||h==="$?"){if(c===0)return i;c--}else h==="/$"&&c++}i=i.previousSibling}return null}var ol=Math.random().toString(36).slice(2),ws="__reactFiber$"+ol,eu="__reactProps$"+ol,Ys="__reactContainer$"+ol,Wg="__reactEvents$"+ol,ED="__reactListeners$"+ol,PD="__reactHandles$"+ol;function Ba(i){var c=i[ws];if(c)return c;for(var h=i.parentNode;h;){if(c=h[Ys]||h[ws]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(i=tN(i);i!==null;){if(h=i[ws])return h;i=tN(i)}return c}i=h,h=i.parentNode}return null}function tu(i){return i=i[ws]||i[Ys],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function al(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function vf(i){return i[eu]||null}var Hg=[],il=-1;function Do(i){return{current:i}}function Pt(i){0>il||(i.current=Hg[il],Hg[il]=null,il--)}function Ct(i,c){il++,Hg[il]=i.current,i.current=c}var Ro={},_n=Do(Ro),qn=Do(!1),Wa=Ro;function ll(i,c){var h=i.type.contextTypes;if(!h)return Ro;var v=i.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===c)return v.__reactInternalMemoizedMaskedChildContext;var _={},T;for(T in h)_[T]=c[T];return v&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=c,i.__reactInternalMemoizedMaskedChildContext=_),_}function Kn(i){return i=i.childContextTypes,i!=null}function bf(){Pt(qn),Pt(_n)}function nN(i,c,h){if(_n.current!==Ro)throw Error(n(168));Ct(_n,c),Ct(qn,h)}function rN(i,c,h){var v=i.stateNode;if(c=c.childContextTypes,typeof v.getChildContext!="function")return h;v=v.getChildContext();for(var _ in v)if(!(_ in c))throw Error(n(108,J(i)||"Unknown",_));return U({},h,v)}function wf(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Ro,Wa=_n.current,Ct(_n,i),Ct(qn,qn.current),!0}function sN(i,c,h){var v=i.stateNode;if(!v)throw Error(n(169));h?(i=rN(i,c,Wa),v.__reactInternalMemoizedMergedChildContext=i,Pt(qn),Pt(_n),Ct(_n,i)):Pt(qn),Ct(qn,h)}var Qs=null,Nf=!1,Ug=!1;function oN(i){Qs===null?Qs=[i]:Qs.push(i)}function TD(i){Nf=!0,oN(i)}function Oo(){if(!Ug&&Qs!==null){Ug=!0;var i=0,c=bt;try{var h=Qs;for(bt=1;i<h.length;i++){var v=h[i];do v=v(!0);while(v!==null)}Qs=null,Nf=!1}catch(_){throw Qs!==null&&(Qs=Qs.slice(i+1)),Gd(Ic,Oo),_}finally{bt=c,Ug=!1}}return null}var cl=[],ul=0,jf=null,Cf=0,Pr=[],Tr=0,Ha=null,Gs=1,Xs="";function Ua(i,c){cl[ul++]=Cf,cl[ul++]=jf,jf=i,Cf=c}function aN(i,c,h){Pr[Tr++]=Gs,Pr[Tr++]=Xs,Pr[Tr++]=Ha,Ha=i;var v=Gs;i=Xs;var _=32-lr(v)-1;v&=~(1<<_),h+=1;var T=32-lr(c)+_;if(30<T){var W=_-_%5;T=(v&(1<<W)-1).toString(32),v>>=W,_-=W,Gs=1<<32-lr(c)+_|h<<_|v,Xs=T+i}else Gs=1<<T|h<<_|v,Xs=i}function qg(i){i.return!==null&&(Ua(i,1),aN(i,1,0))}function Kg(i){for(;i===jf;)jf=cl[--ul],cl[ul]=null,Cf=cl[--ul],cl[ul]=null;for(;i===Ha;)Ha=Pr[--Tr],Pr[Tr]=null,Xs=Pr[--Tr],Pr[Tr]=null,Gs=Pr[--Tr],Pr[Tr]=null}var ur=null,dr=null,At=!1,Hr=null;function iN(i,c){var h=Rr(5,null,null,0);h.elementType="DELETED",h.stateNode=c,h.return=i,c=i.deletions,c===null?(i.deletions=[h],i.flags|=16):c.push(h)}function lN(i,c){switch(i.tag){case 5:var h=i.type;return c=c.nodeType!==1||h.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(i.stateNode=c,ur=i,dr=Ao(c.firstChild),!0):!1;case 6:return c=i.pendingProps===""||c.nodeType!==3?null:c,c!==null?(i.stateNode=c,ur=i,dr=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(h=Ha!==null?{id:Gs,overflow:Xs}:null,i.memoizedState={dehydrated:c,treeContext:h,retryLane:1073741824},h=Rr(18,null,null,0),h.stateNode=c,h.return=i,i.child=h,ur=i,dr=null,!0):!1;default:return!1}}function Yg(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Qg(i){if(At){var c=dr;if(c){var h=c;if(!lN(i,c)){if(Yg(i))throw Error(n(418));c=Ao(h.nextSibling);var v=ur;c&&lN(i,c)?iN(v,h):(i.flags=i.flags&-4097|2,At=!1,ur=i)}}else{if(Yg(i))throw Error(n(418));i.flags=i.flags&-4097|2,At=!1,ur=i}}}function cN(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;ur=i}function kf(i){if(i!==ur)return!1;if(!At)return cN(i),At=!0,!1;var c;if((c=i.tag!==3)&&!(c=i.tag!==5)&&(c=i.type,c=c!=="head"&&c!=="body"&&!Vg(i.type,i.memoizedProps)),c&&(c=dr)){if(Yg(i))throw uN(),Error(n(418));for(;c;)iN(i,c),c=Ao(c.nextSibling)}if(cN(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,c=0;i;){if(i.nodeType===8){var h=i.data;if(h==="/$"){if(c===0){dr=Ao(i.nextSibling);break e}c--}else h!=="$"&&h!=="$!"&&h!=="$?"||c++}i=i.nextSibling}dr=null}}else dr=ur?Ao(i.stateNode.nextSibling):null;return!0}function uN(){for(var i=dr;i;)i=Ao(i.nextSibling)}function dl(){dr=ur=null,At=!1}function Gg(i){Hr===null?Hr=[i]:Hr.push(i)}var MD=S.ReactCurrentBatchConfig;function nu(i,c,h){if(i=h.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(n(309));var v=h.stateNode}if(!v)throw Error(n(147,i));var _=v,T=""+i;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===T?c.ref:(c=function(W){var Q=_.refs;W===null?delete Q[T]:Q[T]=W},c._stringRef=T,c)}if(typeof i!="string")throw Error(n(284));if(!h._owner)throw Error(n(290,i))}return i}function Sf(i,c){throw i=Object.prototype.toString.call(c),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":i))}function dN(i){var c=i._init;return c(i._payload)}function fN(i){function c(se,ee){if(i){var ae=se.deletions;ae===null?(se.deletions=[ee],se.flags|=16):ae.push(ee)}}function h(se,ee){if(!i)return null;for(;ee!==null;)c(se,ee),ee=ee.sibling;return null}function v(se,ee){for(se=new Map;ee!==null;)ee.key!==null?se.set(ee.key,ee):se.set(ee.index,ee),ee=ee.sibling;return se}function _(se,ee){return se=Wo(se,ee),se.index=0,se.sibling=null,se}function T(se,ee,ae){return se.index=ae,i?(ae=se.alternate,ae!==null?(ae=ae.index,ae<ee?(se.flags|=2,ee):ae):(se.flags|=2,ee)):(se.flags|=1048576,ee)}function W(se){return i&&se.alternate===null&&(se.flags|=2),se}function Q(se,ee,ae,we){return ee===null||ee.tag!==6?(ee=zx(ae,se.mode,we),ee.return=se,ee):(ee=_(ee,ae),ee.return=se,ee)}function Z(se,ee,ae,we){var Re=ae.type;return Re===D?me(se,ee,ae.props.children,we,ae.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===F&&dN(Re)===ee.type)?(we=_(ee,ae.props),we.ref=nu(se,ee,ae),we.return=se,we):(we=Gf(ae.type,ae.key,ae.props,null,se.mode,we),we.ref=nu(se,ee,ae),we.return=se,we)}function le(se,ee,ae,we){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ae.containerInfo||ee.stateNode.implementation!==ae.implementation?(ee=Bx(ae,se.mode,we),ee.return=se,ee):(ee=_(ee,ae.children||[]),ee.return=se,ee)}function me(se,ee,ae,we,Re){return ee===null||ee.tag!==7?(ee=Ja(ae,se.mode,we,Re),ee.return=se,ee):(ee=_(ee,ae),ee.return=se,ee)}function xe(se,ee,ae){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=zx(""+ee,se.mode,ae),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case E:return ae=Gf(ee.type,ee.key,ee.props,null,se.mode,ae),ae.ref=nu(se,null,ee),ae.return=se,ae;case P:return ee=Bx(ee,se.mode,ae),ee.return=se,ee;case F:var we=ee._init;return xe(se,we(ee._payload),ae)}if(De(ee)||O(ee))return ee=Ja(ee,se.mode,ae,null),ee.return=se,ee;Sf(se,ee)}return null}function he(se,ee,ae,we){var Re=ee!==null?ee.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Re!==null?null:Q(se,ee,""+ae,we);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case E:return ae.key===Re?Z(se,ee,ae,we):null;case P:return ae.key===Re?le(se,ee,ae,we):null;case F:return Re=ae._init,he(se,ee,Re(ae._payload),we)}if(De(ae)||O(ae))return Re!==null?null:me(se,ee,ae,we,null);Sf(se,ae)}return null}function _e(se,ee,ae,we,Re){if(typeof we=="string"&&we!==""||typeof we=="number")return se=se.get(ae)||null,Q(ee,se,""+we,Re);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case E:return se=se.get(we.key===null?ae:we.key)||null,Z(ee,se,we,Re);case P:return se=se.get(we.key===null?ae:we.key)||null,le(ee,se,we,Re);case F:var Ue=we._init;return _e(se,ee,ae,Ue(we._payload),Re)}if(De(we)||O(we))return se=se.get(ae)||null,me(ee,se,we,Re,null);Sf(ee,we)}return null}function Te(se,ee,ae,we){for(var Re=null,Ue=null,qe=ee,Je=ee=0,dn=null;qe!==null&&Je<ae.length;Je++){qe.index>Je?(dn=qe,qe=null):dn=qe.sibling;var mt=he(se,qe,ae[Je],we);if(mt===null){qe===null&&(qe=dn);break}i&&qe&&mt.alternate===null&&c(se,qe),ee=T(mt,ee,Je),Ue===null?Re=mt:Ue.sibling=mt,Ue=mt,qe=dn}if(Je===ae.length)return h(se,qe),At&&Ua(se,Je),Re;if(qe===null){for(;Je<ae.length;Je++)qe=xe(se,ae[Je],we),qe!==null&&(ee=T(qe,ee,Je),Ue===null?Re=qe:Ue.sibling=qe,Ue=qe);return At&&Ua(se,Je),Re}for(qe=v(se,qe);Je<ae.length;Je++)dn=_e(qe,se,Je,ae[Je],we),dn!==null&&(i&&dn.alternate!==null&&qe.delete(dn.key===null?Je:dn.key),ee=T(dn,ee,Je),Ue===null?Re=dn:Ue.sibling=dn,Ue=dn);return i&&qe.forEach(function(Ho){return c(se,Ho)}),At&&Ua(se,Je),Re}function Ae(se,ee,ae,we){var Re=O(ae);if(typeof Re!="function")throw Error(n(150));if(ae=Re.call(ae),ae==null)throw Error(n(151));for(var Ue=Re=null,qe=ee,Je=ee=0,dn=null,mt=ae.next();qe!==null&&!mt.done;Je++,mt=ae.next()){qe.index>Je?(dn=qe,qe=null):dn=qe.sibling;var Ho=he(se,qe,mt.value,we);if(Ho===null){qe===null&&(qe=dn);break}i&&qe&&Ho.alternate===null&&c(se,qe),ee=T(Ho,ee,Je),Ue===null?Re=Ho:Ue.sibling=Ho,Ue=Ho,qe=dn}if(mt.done)return h(se,qe),At&&Ua(se,Je),Re;if(qe===null){for(;!mt.done;Je++,mt=ae.next())mt=xe(se,mt.value,we),mt!==null&&(ee=T(mt,ee,Je),Ue===null?Re=mt:Ue.sibling=mt,Ue=mt);return At&&Ua(se,Je),Re}for(qe=v(se,qe);!mt.done;Je++,mt=ae.next())mt=_e(qe,se,Je,mt.value,we),mt!==null&&(i&&mt.alternate!==null&&qe.delete(mt.key===null?Je:mt.key),ee=T(mt,ee,Je),Ue===null?Re=mt:Ue.sibling=mt,Ue=mt);return i&&qe.forEach(function(uR){return c(se,uR)}),At&&Ua(se,Je),Re}function qt(se,ee,ae,we){if(typeof ae=="object"&&ae!==null&&ae.type===D&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case E:e:{for(var Re=ae.key,Ue=ee;Ue!==null;){if(Ue.key===Re){if(Re=ae.type,Re===D){if(Ue.tag===7){h(se,Ue.sibling),ee=_(Ue,ae.props.children),ee.return=se,se=ee;break e}}else if(Ue.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===F&&dN(Re)===Ue.type){h(se,Ue.sibling),ee=_(Ue,ae.props),ee.ref=nu(se,Ue,ae),ee.return=se,se=ee;break e}h(se,Ue);break}else c(se,Ue);Ue=Ue.sibling}ae.type===D?(ee=Ja(ae.props.children,se.mode,we,ae.key),ee.return=se,se=ee):(we=Gf(ae.type,ae.key,ae.props,null,se.mode,we),we.ref=nu(se,ee,ae),we.return=se,se=we)}return W(se);case P:e:{for(Ue=ae.key;ee!==null;){if(ee.key===Ue)if(ee.tag===4&&ee.stateNode.containerInfo===ae.containerInfo&&ee.stateNode.implementation===ae.implementation){h(se,ee.sibling),ee=_(ee,ae.children||[]),ee.return=se,se=ee;break e}else{h(se,ee);break}else c(se,ee);ee=ee.sibling}ee=Bx(ae,se.mode,we),ee.return=se,se=ee}return W(se);case F:return Ue=ae._init,qt(se,ee,Ue(ae._payload),we)}if(De(ae))return Te(se,ee,ae,we);if(O(ae))return Ae(se,ee,ae,we);Sf(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,ee!==null&&ee.tag===6?(h(se,ee.sibling),ee=_(ee,ae),ee.return=se,se=ee):(h(se,ee),ee=zx(ae,se.mode,we),ee.return=se,se=ee),W(se)):h(se,ee)}return qt}var fl=fN(!0),hN=fN(!1),_f=Do(null),Ef=null,hl=null,Xg=null;function Zg(){Xg=hl=Ef=null}function Jg(i){var c=_f.current;Pt(_f),i._currentValue=c}function ex(i,c,h){for(;i!==null;){var v=i.alternate;if((i.childLanes&c)!==c?(i.childLanes|=c,v!==null&&(v.childLanes|=c)):v!==null&&(v.childLanes&c)!==c&&(v.childLanes|=c),i===h)break;i=i.return}}function ml(i,c){Ef=i,Xg=hl=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&c)!==0&&(Yn=!0),i.firstContext=null)}function Mr(i){var c=i._currentValue;if(Xg!==i)if(i={context:i,memoizedValue:c,next:null},hl===null){if(Ef===null)throw Error(n(308));hl=i,Ef.dependencies={lanes:0,firstContext:i}}else hl=hl.next=i;return c}var qa=null;function tx(i){qa===null?qa=[i]:qa.push(i)}function mN(i,c,h,v){var _=c.interleaved;return _===null?(h.next=h,tx(c)):(h.next=_.next,_.next=h),c.interleaved=h,Zs(i,v)}function Zs(i,c){i.lanes|=c;var h=i.alternate;for(h!==null&&(h.lanes|=c),h=i,i=i.return;i!==null;)i.childLanes|=c,h=i.alternate,h!==null&&(h.childLanes|=c),h=i,i=i.return;return h.tag===3?h.stateNode:null}var Io=!1;function nx(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pN(i,c){i=i.updateQueue,c.updateQueue===i&&(c.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Js(i,c){return{eventTime:i,lane:c,tag:0,payload:null,callback:null,next:null}}function Lo(i,c,h){var v=i.updateQueue;if(v===null)return null;if(v=v.shared,(dt&2)!==0){var _=v.pending;return _===null?c.next=c:(c.next=_.next,_.next=c),v.pending=c,Zs(i,h)}return _=v.interleaved,_===null?(c.next=c,tx(v)):(c.next=_.next,_.next=c),v.interleaved=c,Zs(i,h)}function Pf(i,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194240)!==0)){var v=c.lanes;v&=i.pendingLanes,h|=v,c.lanes=h,gg(i,h)}}function gN(i,c){var h=i.updateQueue,v=i.alternate;if(v!==null&&(v=v.updateQueue,h===v)){var _=null,T=null;if(h=h.firstBaseUpdate,h!==null){do{var W={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};T===null?_=T=W:T=T.next=W,h=h.next}while(h!==null);T===null?_=T=c:T=T.next=c}else _=T=c;h={baseState:v.baseState,firstBaseUpdate:_,lastBaseUpdate:T,shared:v.shared,effects:v.effects},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=c:i.next=c,h.lastBaseUpdate=c}function Tf(i,c,h,v){var _=i.updateQueue;Io=!1;var T=_.firstBaseUpdate,W=_.lastBaseUpdate,Q=_.shared.pending;if(Q!==null){_.shared.pending=null;var Z=Q,le=Z.next;Z.next=null,W===null?T=le:W.next=le,W=Z;var me=i.alternate;me!==null&&(me=me.updateQueue,Q=me.lastBaseUpdate,Q!==W&&(Q===null?me.firstBaseUpdate=le:Q.next=le,me.lastBaseUpdate=Z))}if(T!==null){var xe=_.baseState;W=0,me=le=Z=null,Q=T;do{var he=Q.lane,_e=Q.eventTime;if((v&he)===he){me!==null&&(me=me.next={eventTime:_e,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Te=i,Ae=Q;switch(he=c,_e=h,Ae.tag){case 1:if(Te=Ae.payload,typeof Te=="function"){xe=Te.call(_e,xe,he);break e}xe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ae.payload,he=typeof Te=="function"?Te.call(_e,xe,he):Te,he==null)break e;xe=U({},xe,he);break e;case 2:Io=!0}}Q.callback!==null&&Q.lane!==0&&(i.flags|=64,he=_.effects,he===null?_.effects=[Q]:he.push(Q))}else _e={eventTime:_e,lane:he,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},me===null?(le=me=_e,Z=xe):me=me.next=_e,W|=he;if(Q=Q.next,Q===null){if(Q=_.shared.pending,Q===null)break;he=Q,Q=he.next,he.next=null,_.lastBaseUpdate=he,_.shared.pending=null}}while(!0);if(me===null&&(Z=xe),_.baseState=Z,_.firstBaseUpdate=le,_.lastBaseUpdate=me,c=_.shared.interleaved,c!==null){_=c;do W|=_.lane,_=_.next;while(_!==c)}else T===null&&(_.shared.lanes=0);Qa|=W,i.lanes=W,i.memoizedState=xe}}function xN(i,c,h){if(i=c.effects,c.effects=null,i!==null)for(c=0;c<i.length;c++){var v=i[c],_=v.callback;if(_!==null){if(v.callback=null,v=h,typeof _!="function")throw Error(n(191,_));_.call(v)}}}var ru={},Ns=Do(ru),su=Do(ru),ou=Do(ru);function Ka(i){if(i===ru)throw Error(n(174));return i}function rx(i,c){switch(Ct(ou,c),Ct(su,i),Ct(Ns,ru),i=c.nodeType,i){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:Ze(null,"");break;default:i=i===8?c.parentNode:c,c=i.namespaceURI||null,i=i.tagName,c=Ze(c,i)}Pt(Ns),Ct(Ns,c)}function pl(){Pt(Ns),Pt(su),Pt(ou)}function yN(i){Ka(ou.current);var c=Ka(Ns.current),h=Ze(c,i.type);c!==h&&(Ct(su,i),Ct(Ns,h))}function sx(i){su.current===i&&(Pt(Ns),Pt(su))}var It=Do(0);function Mf(i){for(var c=i;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===i)break;for(;c.sibling===null;){if(c.return===null||c.return===i)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var ox=[];function ax(){for(var i=0;i<ox.length;i++)ox[i]._workInProgressVersionPrimary=null;ox.length=0}var Af=S.ReactCurrentDispatcher,ix=S.ReactCurrentBatchConfig,Ya=0,Lt=null,nn=null,cn=null,Df=!1,au=!1,iu=0,AD=0;function En(){throw Error(n(321))}function lx(i,c){if(c===null)return!1;for(var h=0;h<c.length&&h<i.length;h++)if(!Wr(i[h],c[h]))return!1;return!0}function cx(i,c,h,v,_,T){if(Ya=T,Lt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Af.current=i===null||i.memoizedState===null?ID:LD,i=h(v,_),au){T=0;do{if(au=!1,iu=0,25<=T)throw Error(n(301));T+=1,cn=nn=null,c.updateQueue=null,Af.current=FD,i=h(v,_)}while(au)}if(Af.current=If,c=nn!==null&&nn.next!==null,Ya=0,cn=nn=Lt=null,Df=!1,c)throw Error(n(300));return i}function ux(){var i=iu!==0;return iu=0,i}function js(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Lt.memoizedState=cn=i:cn=cn.next=i,cn}function Ar(){if(nn===null){var i=Lt.alternate;i=i!==null?i.memoizedState:null}else i=nn.next;var c=cn===null?Lt.memoizedState:cn.next;if(c!==null)cn=c,nn=i;else{if(i===null)throw Error(n(310));nn=i,i={memoizedState:nn.memoizedState,baseState:nn.baseState,baseQueue:nn.baseQueue,queue:nn.queue,next:null},cn===null?Lt.memoizedState=cn=i:cn=cn.next=i}return cn}function lu(i,c){return typeof c=="function"?c(i):c}function dx(i){var c=Ar(),h=c.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=i;var v=nn,_=v.baseQueue,T=h.pending;if(T!==null){if(_!==null){var W=_.next;_.next=T.next,T.next=W}v.baseQueue=_=T,h.pending=null}if(_!==null){T=_.next,v=v.baseState;var Q=W=null,Z=null,le=T;do{var me=le.lane;if((Ya&me)===me)Z!==null&&(Z=Z.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),v=le.hasEagerState?le.eagerState:i(v,le.action);else{var xe={lane:me,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};Z===null?(Q=Z=xe,W=v):Z=Z.next=xe,Lt.lanes|=me,Qa|=me}le=le.next}while(le!==null&&le!==T);Z===null?W=v:Z.next=Q,Wr(v,c.memoizedState)||(Yn=!0),c.memoizedState=v,c.baseState=W,c.baseQueue=Z,h.lastRenderedState=v}if(i=h.interleaved,i!==null){_=i;do T=_.lane,Lt.lanes|=T,Qa|=T,_=_.next;while(_!==i)}else _===null&&(h.lanes=0);return[c.memoizedState,h.dispatch]}function fx(i){var c=Ar(),h=c.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=i;var v=h.dispatch,_=h.pending,T=c.memoizedState;if(_!==null){h.pending=null;var W=_=_.next;do T=i(T,W.action),W=W.next;while(W!==_);Wr(T,c.memoizedState)||(Yn=!0),c.memoizedState=T,c.baseQueue===null&&(c.baseState=T),h.lastRenderedState=T}return[T,v]}function vN(){}function bN(i,c){var h=Lt,v=Ar(),_=c(),T=!Wr(v.memoizedState,_);if(T&&(v.memoizedState=_,Yn=!0),v=v.queue,hx(jN.bind(null,h,v,i),[i]),v.getSnapshot!==c||T||cn!==null&&cn.memoizedState.tag&1){if(h.flags|=2048,cu(9,NN.bind(null,h,v,_,c),void 0,null),un===null)throw Error(n(349));(Ya&30)!==0||wN(h,c,_)}return _}function wN(i,c,h){i.flags|=16384,i={getSnapshot:c,value:h},c=Lt.updateQueue,c===null?(c={lastEffect:null,stores:null},Lt.updateQueue=c,c.stores=[i]):(h=c.stores,h===null?c.stores=[i]:h.push(i))}function NN(i,c,h,v){c.value=h,c.getSnapshot=v,CN(c)&&kN(i)}function jN(i,c,h){return h(function(){CN(c)&&kN(i)})}function CN(i){var c=i.getSnapshot;i=i.value;try{var h=c();return!Wr(i,h)}catch{return!0}}function kN(i){var c=Zs(i,1);c!==null&&Yr(c,i,1,-1)}function SN(i){var c=js();return typeof i=="function"&&(i=i()),c.memoizedState=c.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lu,lastRenderedState:i},c.queue=i,i=i.dispatch=OD.bind(null,Lt,i),[c.memoizedState,i]}function cu(i,c,h,v){return i={tag:i,create:c,destroy:h,deps:v,next:null},c=Lt.updateQueue,c===null?(c={lastEffect:null,stores:null},Lt.updateQueue=c,c.lastEffect=i.next=i):(h=c.lastEffect,h===null?c.lastEffect=i.next=i:(v=h.next,h.next=i,i.next=v,c.lastEffect=i)),i}function _N(){return Ar().memoizedState}function Rf(i,c,h,v){var _=js();Lt.flags|=i,_.memoizedState=cu(1|c,h,void 0,v===void 0?null:v)}function Of(i,c,h,v){var _=Ar();v=v===void 0?null:v;var T=void 0;if(nn!==null){var W=nn.memoizedState;if(T=W.destroy,v!==null&&lx(v,W.deps)){_.memoizedState=cu(c,h,T,v);return}}Lt.flags|=i,_.memoizedState=cu(1|c,h,T,v)}function EN(i,c){return Rf(8390656,8,i,c)}function hx(i,c){return Of(2048,8,i,c)}function PN(i,c){return Of(4,2,i,c)}function TN(i,c){return Of(4,4,i,c)}function MN(i,c){if(typeof c=="function")return i=i(),c(i),function(){c(null)};if(c!=null)return i=i(),c.current=i,function(){c.current=null}}function AN(i,c,h){return h=h!=null?h.concat([i]):null,Of(4,4,MN.bind(null,c,i),h)}function mx(){}function DN(i,c){var h=Ar();c=c===void 0?null:c;var v=h.memoizedState;return v!==null&&c!==null&&lx(c,v[1])?v[0]:(h.memoizedState=[i,c],i)}function RN(i,c){var h=Ar();c=c===void 0?null:c;var v=h.memoizedState;return v!==null&&c!==null&&lx(c,v[1])?v[0]:(i=i(),h.memoizedState=[i,c],i)}function ON(i,c,h){return(Ya&21)===0?(i.baseState&&(i.baseState=!1,Yn=!0),i.memoizedState=h):(Wr(h,c)||(h=Zi(),Lt.lanes|=h,Qa|=h,i.baseState=!0),c)}function DD(i,c){var h=bt;bt=h!==0&&4>h?h:4,i(!0);var v=ix.transition;ix.transition={};try{i(!1),c()}finally{bt=h,ix.transition=v}}function IN(){return Ar().memoizedState}function RD(i,c,h){var v=zo(i);if(h={lane:v,action:h,hasEagerState:!1,eagerState:null,next:null},LN(i))FN(c,h);else if(h=mN(i,c,h,v),h!==null){var _=On();Yr(h,i,v,_),$N(h,c,v)}}function OD(i,c,h){var v=zo(i),_={lane:v,action:h,hasEagerState:!1,eagerState:null,next:null};if(LN(i))FN(c,_);else{var T=i.alternate;if(i.lanes===0&&(T===null||T.lanes===0)&&(T=c.lastRenderedReducer,T!==null))try{var W=c.lastRenderedState,Q=T(W,h);if(_.hasEagerState=!0,_.eagerState=Q,Wr(Q,W)){var Z=c.interleaved;Z===null?(_.next=_,tx(c)):(_.next=Z.next,Z.next=_),c.interleaved=_;return}}catch{}finally{}h=mN(i,c,_,v),h!==null&&(_=On(),Yr(h,i,v,_),$N(h,c,v))}}function LN(i){var c=i.alternate;return i===Lt||c!==null&&c===Lt}function FN(i,c){au=Df=!0;var h=i.pending;h===null?c.next=c:(c.next=h.next,h.next=c),i.pending=c}function $N(i,c,h){if((h&4194240)!==0){var v=c.lanes;v&=i.pendingLanes,h|=v,c.lanes=h,gg(i,h)}}var If={readContext:Mr,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useInsertionEffect:En,useLayoutEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useMutableSource:En,useSyncExternalStore:En,useId:En,unstable_isNewReconciler:!1},ID={readContext:Mr,useCallback:function(i,c){return js().memoizedState=[i,c===void 0?null:c],i},useContext:Mr,useEffect:EN,useImperativeHandle:function(i,c,h){return h=h!=null?h.concat([i]):null,Rf(4194308,4,MN.bind(null,c,i),h)},useLayoutEffect:function(i,c){return Rf(4194308,4,i,c)},useInsertionEffect:function(i,c){return Rf(4,2,i,c)},useMemo:function(i,c){var h=js();return c=c===void 0?null:c,i=i(),h.memoizedState=[i,c],i},useReducer:function(i,c,h){var v=js();return c=h!==void 0?h(c):c,v.memoizedState=v.baseState=c,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:c},v.queue=i,i=i.dispatch=RD.bind(null,Lt,i),[v.memoizedState,i]},useRef:function(i){var c=js();return i={current:i},c.memoizedState=i},useState:SN,useDebugValue:mx,useDeferredValue:function(i){return js().memoizedState=i},useTransition:function(){var i=SN(!1),c=i[0];return i=DD.bind(null,i[1]),js().memoizedState=i,[c,i]},useMutableSource:function(){},useSyncExternalStore:function(i,c,h){var v=Lt,_=js();if(At){if(h===void 0)throw Error(n(407));h=h()}else{if(h=c(),un===null)throw Error(n(349));(Ya&30)!==0||wN(v,c,h)}_.memoizedState=h;var T={value:h,getSnapshot:c};return _.queue=T,EN(jN.bind(null,v,T,i),[i]),v.flags|=2048,cu(9,NN.bind(null,v,T,h,c),void 0,null),h},useId:function(){var i=js(),c=un.identifierPrefix;if(At){var h=Xs,v=Gs;h=(v&~(1<<32-lr(v)-1)).toString(32)+h,c=":"+c+"R"+h,h=iu++,0<h&&(c+="H"+h.toString(32)),c+=":"}else h=AD++,c=":"+c+"r"+h.toString(32)+":";return i.memoizedState=c},unstable_isNewReconciler:!1},LD={readContext:Mr,useCallback:DN,useContext:Mr,useEffect:hx,useImperativeHandle:AN,useInsertionEffect:PN,useLayoutEffect:TN,useMemo:RN,useReducer:dx,useRef:_N,useState:function(){return dx(lu)},useDebugValue:mx,useDeferredValue:function(i){var c=Ar();return ON(c,nn.memoizedState,i)},useTransition:function(){var i=dx(lu)[0],c=Ar().memoizedState;return[i,c]},useMutableSource:vN,useSyncExternalStore:bN,useId:IN,unstable_isNewReconciler:!1},FD={readContext:Mr,useCallback:DN,useContext:Mr,useEffect:hx,useImperativeHandle:AN,useInsertionEffect:PN,useLayoutEffect:TN,useMemo:RN,useReducer:fx,useRef:_N,useState:function(){return fx(lu)},useDebugValue:mx,useDeferredValue:function(i){var c=Ar();return nn===null?c.memoizedState=i:ON(c,nn.memoizedState,i)},useTransition:function(){var i=fx(lu)[0],c=Ar().memoizedState;return[i,c]},useMutableSource:vN,useSyncExternalStore:bN,useId:IN,unstable_isNewReconciler:!1};function Ur(i,c){if(i&&i.defaultProps){c=U({},c),i=i.defaultProps;for(var h in i)c[h]===void 0&&(c[h]=i[h]);return c}return c}function px(i,c,h,v){c=i.memoizedState,h=h(v,c),h=h==null?c:U({},c,h),i.memoizedState=h,i.lanes===0&&(i.updateQueue.baseState=h)}var Lf={isMounted:function(i){return(i=i._reactInternals)?vs(i)===i:!1},enqueueSetState:function(i,c,h){i=i._reactInternals;var v=On(),_=zo(i),T=Js(v,_);T.payload=c,h!=null&&(T.callback=h),c=Lo(i,T,_),c!==null&&(Yr(c,i,_,v),Pf(c,i,_))},enqueueReplaceState:function(i,c,h){i=i._reactInternals;var v=On(),_=zo(i),T=Js(v,_);T.tag=1,T.payload=c,h!=null&&(T.callback=h),c=Lo(i,T,_),c!==null&&(Yr(c,i,_,v),Pf(c,i,_))},enqueueForceUpdate:function(i,c){i=i._reactInternals;var h=On(),v=zo(i),_=Js(h,v);_.tag=2,c!=null&&(_.callback=c),c=Lo(i,_,v),c!==null&&(Yr(c,i,v,h),Pf(c,i,v))}};function VN(i,c,h,v,_,T,W){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(v,T,W):c.prototype&&c.prototype.isPureReactComponent?!Qc(h,v)||!Qc(_,T):!0}function zN(i,c,h){var v=!1,_=Ro,T=c.contextType;return typeof T=="object"&&T!==null?T=Mr(T):(_=Kn(c)?Wa:_n.current,v=c.contextTypes,T=(v=v!=null)?ll(i,_):Ro),c=new c(h,T),i.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Lf,i.stateNode=c,c._reactInternals=i,v&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=_,i.__reactInternalMemoizedMaskedChildContext=T),c}function BN(i,c,h,v){i=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,v),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,v),c.state!==i&&Lf.enqueueReplaceState(c,c.state,null)}function gx(i,c,h,v){var _=i.stateNode;_.props=h,_.state=i.memoizedState,_.refs={},nx(i);var T=c.contextType;typeof T=="object"&&T!==null?_.context=Mr(T):(T=Kn(c)?Wa:_n.current,_.context=ll(i,T)),_.state=i.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(px(i,c,T,h),_.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(c=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),c!==_.state&&Lf.enqueueReplaceState(_,_.state,null),Tf(i,h,_,v),_.state=i.memoizedState),typeof _.componentDidMount=="function"&&(i.flags|=4194308)}function gl(i,c){try{var h="",v=c;do h+=ne(v),v=v.return;while(v);var _=h}catch(T){_=`
|
|
39
|
+
Error generating stack: `+T.message+`
|
|
40
|
+
`+T.stack}return{value:i,source:c,stack:_,digest:null}}function xx(i,c,h){return{value:i,source:null,stack:h??null,digest:c??null}}function yx(i,c){try{console.error(c.value)}catch(h){setTimeout(function(){throw h})}}var $D=typeof WeakMap=="function"?WeakMap:Map;function WN(i,c,h){h=Js(-1,h),h.tag=3,h.payload={element:null};var v=c.value;return h.callback=function(){Hf||(Hf=!0,Dx=v),yx(i,c)},h}function HN(i,c,h){h=Js(-1,h),h.tag=3;var v=i.type.getDerivedStateFromError;if(typeof v=="function"){var _=c.value;h.payload=function(){return v(_)},h.callback=function(){yx(i,c)}}var T=i.stateNode;return T!==null&&typeof T.componentDidCatch=="function"&&(h.callback=function(){yx(i,c),typeof v!="function"&&($o===null?$o=new Set([this]):$o.add(this));var W=c.stack;this.componentDidCatch(c.value,{componentStack:W!==null?W:""})}),h}function UN(i,c,h){var v=i.pingCache;if(v===null){v=i.pingCache=new $D;var _=new Set;v.set(c,_)}else _=v.get(c),_===void 0&&(_=new Set,v.set(c,_));_.has(h)||(_.add(h),i=JD.bind(null,i,c,h),c.then(i,i))}function qN(i){do{var c;if((c=i.tag===13)&&(c=i.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return i;i=i.return}while(i!==null);return null}function KN(i,c,h,v,_){return(i.mode&1)===0?(i===c?i.flags|=65536:(i.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(c=Js(-1,1),c.tag=2,Lo(h,c,1))),h.lanes|=1),i):(i.flags|=65536,i.lanes=_,i)}var VD=S.ReactCurrentOwner,Yn=!1;function Rn(i,c,h,v){c.child=i===null?hN(c,null,h,v):fl(c,i.child,h,v)}function YN(i,c,h,v,_){h=h.render;var T=c.ref;return ml(c,_),v=cx(i,c,h,v,T,_),h=ux(),i!==null&&!Yn?(c.updateQueue=i.updateQueue,c.flags&=-2053,i.lanes&=~_,eo(i,c,_)):(At&&h&&qg(c),c.flags|=1,Rn(i,c,v,_),c.child)}function QN(i,c,h,v,_){if(i===null){var T=h.type;return typeof T=="function"&&!Vx(T)&&T.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(c.tag=15,c.type=T,GN(i,c,T,v,_)):(i=Gf(h.type,null,v,c,c.mode,_),i.ref=c.ref,i.return=c,c.child=i)}if(T=i.child,(i.lanes&_)===0){var W=T.memoizedProps;if(h=h.compare,h=h!==null?h:Qc,h(W,v)&&i.ref===c.ref)return eo(i,c,_)}return c.flags|=1,i=Wo(T,v),i.ref=c.ref,i.return=c,c.child=i}function GN(i,c,h,v,_){if(i!==null){var T=i.memoizedProps;if(Qc(T,v)&&i.ref===c.ref)if(Yn=!1,c.pendingProps=v=T,(i.lanes&_)!==0)(i.flags&131072)!==0&&(Yn=!0);else return c.lanes=i.lanes,eo(i,c,_)}return vx(i,c,h,v,_)}function XN(i,c,h){var v=c.pendingProps,_=v.children,T=i!==null?i.memoizedState:null;if(v.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ct(yl,fr),fr|=h;else{if((h&1073741824)===0)return i=T!==null?T.baseLanes|h:h,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:i,cachePool:null,transitions:null},c.updateQueue=null,Ct(yl,fr),fr|=i,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=T!==null?T.baseLanes:h,Ct(yl,fr),fr|=v}else T!==null?(v=T.baseLanes|h,c.memoizedState=null):v=h,Ct(yl,fr),fr|=v;return Rn(i,c,_,h),c.child}function ZN(i,c){var h=c.ref;(i===null&&h!==null||i!==null&&i.ref!==h)&&(c.flags|=512,c.flags|=2097152)}function vx(i,c,h,v,_){var T=Kn(h)?Wa:_n.current;return T=ll(c,T),ml(c,_),h=cx(i,c,h,v,T,_),v=ux(),i!==null&&!Yn?(c.updateQueue=i.updateQueue,c.flags&=-2053,i.lanes&=~_,eo(i,c,_)):(At&&v&&qg(c),c.flags|=1,Rn(i,c,h,_),c.child)}function JN(i,c,h,v,_){if(Kn(h)){var T=!0;wf(c)}else T=!1;if(ml(c,_),c.stateNode===null)$f(i,c),zN(c,h,v),gx(c,h,v,_),v=!0;else if(i===null){var W=c.stateNode,Q=c.memoizedProps;W.props=Q;var Z=W.context,le=h.contextType;typeof le=="object"&&le!==null?le=Mr(le):(le=Kn(h)?Wa:_n.current,le=ll(c,le));var me=h.getDerivedStateFromProps,xe=typeof me=="function"||typeof W.getSnapshotBeforeUpdate=="function";xe||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(Q!==v||Z!==le)&&BN(c,W,v,le),Io=!1;var he=c.memoizedState;W.state=he,Tf(c,v,W,_),Z=c.memoizedState,Q!==v||he!==Z||qn.current||Io?(typeof me=="function"&&(px(c,h,me,v),Z=c.memoizedState),(Q=Io||VN(c,h,Q,v,he,Z,le))?(xe||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(c.flags|=4194308)):(typeof W.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=v,c.memoizedState=Z),W.props=v,W.state=Z,W.context=le,v=Q):(typeof W.componentDidMount=="function"&&(c.flags|=4194308),v=!1)}else{W=c.stateNode,pN(i,c),Q=c.memoizedProps,le=c.type===c.elementType?Q:Ur(c.type,Q),W.props=le,xe=c.pendingProps,he=W.context,Z=h.contextType,typeof Z=="object"&&Z!==null?Z=Mr(Z):(Z=Kn(h)?Wa:_n.current,Z=ll(c,Z));var _e=h.getDerivedStateFromProps;(me=typeof _e=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(Q!==xe||he!==Z)&&BN(c,W,v,Z),Io=!1,he=c.memoizedState,W.state=he,Tf(c,v,W,_);var Te=c.memoizedState;Q!==xe||he!==Te||qn.current||Io?(typeof _e=="function"&&(px(c,h,_e,v),Te=c.memoizedState),(le=Io||VN(c,h,le,v,he,Te,Z)||!1)?(me||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(v,Te,Z),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(v,Te,Z)),typeof W.componentDidUpdate=="function"&&(c.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof W.componentDidUpdate!="function"||Q===i.memoizedProps&&he===i.memoizedState||(c.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||Q===i.memoizedProps&&he===i.memoizedState||(c.flags|=1024),c.memoizedProps=v,c.memoizedState=Te),W.props=v,W.state=Te,W.context=Z,v=le):(typeof W.componentDidUpdate!="function"||Q===i.memoizedProps&&he===i.memoizedState||(c.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||Q===i.memoizedProps&&he===i.memoizedState||(c.flags|=1024),v=!1)}return bx(i,c,h,v,T,_)}function bx(i,c,h,v,_,T){ZN(i,c);var W=(c.flags&128)!==0;if(!v&&!W)return _&&sN(c,h,!1),eo(i,c,T);v=c.stateNode,VD.current=c;var Q=W&&typeof h.getDerivedStateFromError!="function"?null:v.render();return c.flags|=1,i!==null&&W?(c.child=fl(c,i.child,null,T),c.child=fl(c,null,Q,T)):Rn(i,c,Q,T),c.memoizedState=v.state,_&&sN(c,h,!0),c.child}function ej(i){var c=i.stateNode;c.pendingContext?nN(i,c.pendingContext,c.pendingContext!==c.context):c.context&&nN(i,c.context,!1),rx(i,c.containerInfo)}function tj(i,c,h,v,_){return dl(),Gg(_),c.flags|=256,Rn(i,c,h,v),c.child}var wx={dehydrated:null,treeContext:null,retryLane:0};function Nx(i){return{baseLanes:i,cachePool:null,transitions:null}}function nj(i,c,h){var v=c.pendingProps,_=It.current,T=!1,W=(c.flags&128)!==0,Q;if((Q=W)||(Q=i!==null&&i.memoizedState===null?!1:(_&2)!==0),Q?(T=!0,c.flags&=-129):(i===null||i.memoizedState!==null)&&(_|=1),Ct(It,_&1),i===null)return Qg(c),i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((c.mode&1)===0?c.lanes=1:i.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(W=v.children,i=v.fallback,T?(v=c.mode,T=c.child,W={mode:"hidden",children:W},(v&1)===0&&T!==null?(T.childLanes=0,T.pendingProps=W):T=Xf(W,v,0,null),i=Ja(i,v,h,null),T.return=c,i.return=c,T.sibling=i,c.child=T,c.child.memoizedState=Nx(h),c.memoizedState=wx,i):jx(c,W));if(_=i.memoizedState,_!==null&&(Q=_.dehydrated,Q!==null))return zD(i,c,W,v,Q,_,h);if(T){T=v.fallback,W=c.mode,_=i.child,Q=_.sibling;var Z={mode:"hidden",children:v.children};return(W&1)===0&&c.child!==_?(v=c.child,v.childLanes=0,v.pendingProps=Z,c.deletions=null):(v=Wo(_,Z),v.subtreeFlags=_.subtreeFlags&14680064),Q!==null?T=Wo(Q,T):(T=Ja(T,W,h,null),T.flags|=2),T.return=c,v.return=c,v.sibling=T,c.child=v,v=T,T=c.child,W=i.child.memoizedState,W=W===null?Nx(h):{baseLanes:W.baseLanes|h,cachePool:null,transitions:W.transitions},T.memoizedState=W,T.childLanes=i.childLanes&~h,c.memoizedState=wx,v}return T=i.child,i=T.sibling,v=Wo(T,{mode:"visible",children:v.children}),(c.mode&1)===0&&(v.lanes=h),v.return=c,v.sibling=null,i!==null&&(h=c.deletions,h===null?(c.deletions=[i],c.flags|=16):h.push(i)),c.child=v,c.memoizedState=null,v}function jx(i,c){return c=Xf({mode:"visible",children:c},i.mode,0,null),c.return=i,i.child=c}function Ff(i,c,h,v){return v!==null&&Gg(v),fl(c,i.child,null,h),i=jx(c,c.pendingProps.children),i.flags|=2,c.memoizedState=null,i}function zD(i,c,h,v,_,T,W){if(h)return c.flags&256?(c.flags&=-257,v=xx(Error(n(422))),Ff(i,c,W,v)):c.memoizedState!==null?(c.child=i.child,c.flags|=128,null):(T=v.fallback,_=c.mode,v=Xf({mode:"visible",children:v.children},_,0,null),T=Ja(T,_,W,null),T.flags|=2,v.return=c,T.return=c,v.sibling=T,c.child=v,(c.mode&1)!==0&&fl(c,i.child,null,W),c.child.memoizedState=Nx(W),c.memoizedState=wx,T);if((c.mode&1)===0)return Ff(i,c,W,null);if(_.data==="$!"){if(v=_.nextSibling&&_.nextSibling.dataset,v)var Q=v.dgst;return v=Q,T=Error(n(419)),v=xx(T,v,void 0),Ff(i,c,W,v)}if(Q=(W&i.childLanes)!==0,Yn||Q){if(v=un,v!==null){switch(W&-W){case 4:_=2;break;case 16:_=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}_=(_&(v.suspendedLanes|W))!==0?0:_,_!==0&&_!==T.retryLane&&(T.retryLane=_,Zs(i,_),Yr(v,i,_,-1))}return $x(),v=xx(Error(n(421))),Ff(i,c,W,v)}return _.data==="$?"?(c.flags|=128,c.child=i.child,c=eR.bind(null,i),_._reactRetry=c,null):(i=T.treeContext,dr=Ao(_.nextSibling),ur=c,At=!0,Hr=null,i!==null&&(Pr[Tr++]=Gs,Pr[Tr++]=Xs,Pr[Tr++]=Ha,Gs=i.id,Xs=i.overflow,Ha=c),c=jx(c,v.children),c.flags|=4096,c)}function rj(i,c,h){i.lanes|=c;var v=i.alternate;v!==null&&(v.lanes|=c),ex(i.return,c,h)}function Cx(i,c,h,v,_){var T=i.memoizedState;T===null?i.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:v,tail:h,tailMode:_}:(T.isBackwards=c,T.rendering=null,T.renderingStartTime=0,T.last=v,T.tail=h,T.tailMode=_)}function sj(i,c,h){var v=c.pendingProps,_=v.revealOrder,T=v.tail;if(Rn(i,c,v.children,h),v=It.current,(v&2)!==0)v=v&1|2,c.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=c.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&rj(i,h,c);else if(i.tag===19)rj(i,h,c);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===c)break e;for(;i.sibling===null;){if(i.return===null||i.return===c)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}v&=1}if(Ct(It,v),(c.mode&1)===0)c.memoizedState=null;else switch(_){case"forwards":for(h=c.child,_=null;h!==null;)i=h.alternate,i!==null&&Mf(i)===null&&(_=h),h=h.sibling;h=_,h===null?(_=c.child,c.child=null):(_=h.sibling,h.sibling=null),Cx(c,!1,_,h,T);break;case"backwards":for(h=null,_=c.child,c.child=null;_!==null;){if(i=_.alternate,i!==null&&Mf(i)===null){c.child=_;break}i=_.sibling,_.sibling=h,h=_,_=i}Cx(c,!0,h,null,T);break;case"together":Cx(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function $f(i,c){(c.mode&1)===0&&i!==null&&(i.alternate=null,c.alternate=null,c.flags|=2)}function eo(i,c,h){if(i!==null&&(c.dependencies=i.dependencies),Qa|=c.lanes,(h&c.childLanes)===0)return null;if(i!==null&&c.child!==i.child)throw Error(n(153));if(c.child!==null){for(i=c.child,h=Wo(i,i.pendingProps),c.child=h,h.return=c;i.sibling!==null;)i=i.sibling,h=h.sibling=Wo(i,i.pendingProps),h.return=c;h.sibling=null}return c.child}function BD(i,c,h){switch(c.tag){case 3:ej(c),dl();break;case 5:yN(c);break;case 1:Kn(c.type)&&wf(c);break;case 4:rx(c,c.stateNode.containerInfo);break;case 10:var v=c.type._context,_=c.memoizedProps.value;Ct(_f,v._currentValue),v._currentValue=_;break;case 13:if(v=c.memoizedState,v!==null)return v.dehydrated!==null?(Ct(It,It.current&1),c.flags|=128,null):(h&c.child.childLanes)!==0?nj(i,c,h):(Ct(It,It.current&1),i=eo(i,c,h),i!==null?i.sibling:null);Ct(It,It.current&1);break;case 19:if(v=(h&c.childLanes)!==0,(i.flags&128)!==0){if(v)return sj(i,c,h);c.flags|=128}if(_=c.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Ct(It,It.current),v)break;return null;case 22:case 23:return c.lanes=0,XN(i,c,h)}return eo(i,c,h)}var oj,kx,aj,ij;oj=function(i,c){for(var h=c.child;h!==null;){if(h.tag===5||h.tag===6)i.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},kx=function(){},aj=function(i,c,h,v){var _=i.memoizedProps;if(_!==v){i=c.stateNode,Ka(Ns.current);var T=null;switch(h){case"input":_=Oe(i,_),v=Oe(i,v),T=[];break;case"select":_=U({},_,{value:void 0}),v=U({},v,{value:void 0}),T=[];break;case"textarea":_=et(i,_),v=et(i,v),T=[];break;default:typeof _.onClick!="function"&&typeof v.onClick=="function"&&(i.onclick=yf)}ln(h,v);var W;h=null;for(le in _)if(!v.hasOwnProperty(le)&&_.hasOwnProperty(le)&&_[le]!=null)if(le==="style"){var Q=_[le];for(W in Q)Q.hasOwnProperty(W)&&(h||(h={}),h[W]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(o.hasOwnProperty(le)?T||(T=[]):(T=T||[]).push(le,null));for(le in v){var Z=v[le];if(Q=_!=null?_[le]:void 0,v.hasOwnProperty(le)&&Z!==Q&&(Z!=null||Q!=null))if(le==="style")if(Q){for(W in Q)!Q.hasOwnProperty(W)||Z&&Z.hasOwnProperty(W)||(h||(h={}),h[W]="");for(W in Z)Z.hasOwnProperty(W)&&Q[W]!==Z[W]&&(h||(h={}),h[W]=Z[W])}else h||(T||(T=[]),T.push(le,h)),h=Z;else le==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,Q=Q?Q.__html:void 0,Z!=null&&Q!==Z&&(T=T||[]).push(le,Z)):le==="children"?typeof Z!="string"&&typeof Z!="number"||(T=T||[]).push(le,""+Z):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(o.hasOwnProperty(le)?(Z!=null&&le==="onScroll"&&Et("scroll",i),T||Q===Z||(T=[])):(T=T||[]).push(le,Z))}h&&(T=T||[]).push("style",h);var le=T;(c.updateQueue=le)&&(c.flags|=4)}},ij=function(i,c,h,v){h!==v&&(c.flags|=4)};function uu(i,c){if(!At)switch(i.tailMode){case"hidden":c=i.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?i.tail=null:h.sibling=null;break;case"collapsed":h=i.tail;for(var v=null;h!==null;)h.alternate!==null&&(v=h),h=h.sibling;v===null?c||i.tail===null?i.tail=null:i.tail.sibling=null:v.sibling=null}}function Pn(i){var c=i.alternate!==null&&i.alternate.child===i.child,h=0,v=0;if(c)for(var _=i.child;_!==null;)h|=_.lanes|_.childLanes,v|=_.subtreeFlags&14680064,v|=_.flags&14680064,_.return=i,_=_.sibling;else for(_=i.child;_!==null;)h|=_.lanes|_.childLanes,v|=_.subtreeFlags,v|=_.flags,_.return=i,_=_.sibling;return i.subtreeFlags|=v,i.childLanes=h,c}function WD(i,c,h){var v=c.pendingProps;switch(Kg(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pn(c),null;case 1:return Kn(c.type)&&bf(),Pn(c),null;case 3:return v=c.stateNode,pl(),Pt(qn),Pt(_n),ax(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(i===null||i.child===null)&&(kf(c)?c.flags|=4:i===null||i.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Hr!==null&&(Ix(Hr),Hr=null))),kx(i,c),Pn(c),null;case 5:sx(c);var _=Ka(ou.current);if(h=c.type,i!==null&&c.stateNode!=null)aj(i,c,h,v,_),i.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!v){if(c.stateNode===null)throw Error(n(166));return Pn(c),null}if(i=Ka(Ns.current),kf(c)){v=c.stateNode,h=c.type;var T=c.memoizedProps;switch(v[ws]=c,v[eu]=T,i=(c.mode&1)!==0,h){case"dialog":Et("cancel",v),Et("close",v);break;case"iframe":case"object":case"embed":Et("load",v);break;case"video":case"audio":for(_=0;_<Xc.length;_++)Et(Xc[_],v);break;case"source":Et("error",v);break;case"img":case"image":case"link":Et("error",v),Et("load",v);break;case"details":Et("toggle",v);break;case"input":Xe(v,T),Et("invalid",v);break;case"select":v._wrapperState={wasMultiple:!!T.multiple},Et("invalid",v);break;case"textarea":tt(v,T),Et("invalid",v)}ln(h,T),_=null;for(var W in T)if(T.hasOwnProperty(W)){var Q=T[W];W==="children"?typeof Q=="string"?v.textContent!==Q&&(T.suppressHydrationWarning!==!0&&xf(v.textContent,Q,i),_=["children",Q]):typeof Q=="number"&&v.textContent!==""+Q&&(T.suppressHydrationWarning!==!0&&xf(v.textContent,Q,i),_=["children",""+Q]):o.hasOwnProperty(W)&&Q!=null&&W==="onScroll"&&Et("scroll",v)}switch(h){case"input":pe(v),Nt(v,T,!0);break;case"textarea":pe(v),te(v);break;case"select":case"option":break;default:typeof T.onClick=="function"&&(v.onclick=yf)}v=_,c.updateQueue=v,v!==null&&(c.flags|=4)}else{W=_.nodeType===9?_:_.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ce(h)),i==="http://www.w3.org/1999/xhtml"?h==="script"?(i=W.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof v.is=="string"?i=W.createElement(h,{is:v.is}):(i=W.createElement(h),h==="select"&&(W=i,v.multiple?W.multiple=!0:v.size&&(W.size=v.size))):i=W.createElementNS(i,h),i[ws]=c,i[eu]=v,oj(i,c,!1,!1),c.stateNode=i;e:{switch(W=zr(h,v),h){case"dialog":Et("cancel",i),Et("close",i),_=v;break;case"iframe":case"object":case"embed":Et("load",i),_=v;break;case"video":case"audio":for(_=0;_<Xc.length;_++)Et(Xc[_],i);_=v;break;case"source":Et("error",i),_=v;break;case"img":case"image":case"link":Et("error",i),Et("load",i),_=v;break;case"details":Et("toggle",i),_=v;break;case"input":Xe(i,v),_=Oe(i,v),Et("invalid",i);break;case"option":_=v;break;case"select":i._wrapperState={wasMultiple:!!v.multiple},_=U({},v,{value:void 0}),Et("invalid",i);break;case"textarea":tt(i,v),_=et(i,v),Et("invalid",i);break;default:_=v}ln(h,_),Q=_;for(T in Q)if(Q.hasOwnProperty(T)){var Z=Q[T];T==="style"?pn(i,Z):T==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,Z!=null&&oe(i,Z)):T==="children"?typeof Z=="string"?(h!=="textarea"||Z!=="")&&ke(i,Z):typeof Z=="number"&&ke(i,""+Z):T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&T!=="autoFocus"&&(o.hasOwnProperty(T)?Z!=null&&T==="onScroll"&&Et("scroll",i):Z!=null&&C(i,T,Z,W))}switch(h){case"input":pe(i),Nt(i,v,!1);break;case"textarea":pe(i),te(i);break;case"option":v.value!=null&&i.setAttribute("value",""+re(v.value));break;case"select":i.multiple=!!v.multiple,T=v.value,T!=null?$e(i,!!v.multiple,T,!1):v.defaultValue!=null&&$e(i,!!v.multiple,v.defaultValue,!0);break;default:typeof _.onClick=="function"&&(i.onclick=yf)}switch(h){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}}v&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Pn(c),null;case 6:if(i&&c.stateNode!=null)ij(i,c,i.memoizedProps,v);else{if(typeof v!="string"&&c.stateNode===null)throw Error(n(166));if(h=Ka(ou.current),Ka(Ns.current),kf(c)){if(v=c.stateNode,h=c.memoizedProps,v[ws]=c,(T=v.nodeValue!==h)&&(i=ur,i!==null))switch(i.tag){case 3:xf(v.nodeValue,h,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&xf(v.nodeValue,h,(i.mode&1)!==0)}T&&(c.flags|=4)}else v=(h.nodeType===9?h:h.ownerDocument).createTextNode(v),v[ws]=c,c.stateNode=v}return Pn(c),null;case 13:if(Pt(It),v=c.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(At&&dr!==null&&(c.mode&1)!==0&&(c.flags&128)===0)uN(),dl(),c.flags|=98560,T=!1;else if(T=kf(c),v!==null&&v.dehydrated!==null){if(i===null){if(!T)throw Error(n(318));if(T=c.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(n(317));T[ws]=c}else dl(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Pn(c),T=!1}else Hr!==null&&(Ix(Hr),Hr=null),T=!0;if(!T)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=h,c):(v=v!==null,v!==(i!==null&&i.memoizedState!==null)&&v&&(c.child.flags|=8192,(c.mode&1)!==0&&(i===null||(It.current&1)!==0?rn===0&&(rn=3):$x())),c.updateQueue!==null&&(c.flags|=4),Pn(c),null);case 4:return pl(),kx(i,c),i===null&&Zc(c.stateNode.containerInfo),Pn(c),null;case 10:return Jg(c.type._context),Pn(c),null;case 17:return Kn(c.type)&&bf(),Pn(c),null;case 19:if(Pt(It),T=c.memoizedState,T===null)return Pn(c),null;if(v=(c.flags&128)!==0,W=T.rendering,W===null)if(v)uu(T,!1);else{if(rn!==0||i!==null&&(i.flags&128)!==0)for(i=c.child;i!==null;){if(W=Mf(i),W!==null){for(c.flags|=128,uu(T,!1),v=W.updateQueue,v!==null&&(c.updateQueue=v,c.flags|=4),c.subtreeFlags=0,v=h,h=c.child;h!==null;)T=h,i=v,T.flags&=14680066,W=T.alternate,W===null?(T.childLanes=0,T.lanes=i,T.child=null,T.subtreeFlags=0,T.memoizedProps=null,T.memoizedState=null,T.updateQueue=null,T.dependencies=null,T.stateNode=null):(T.childLanes=W.childLanes,T.lanes=W.lanes,T.child=W.child,T.subtreeFlags=0,T.deletions=null,T.memoizedProps=W.memoizedProps,T.memoizedState=W.memoizedState,T.updateQueue=W.updateQueue,T.type=W.type,i=W.dependencies,T.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),h=h.sibling;return Ct(It,It.current&1|2),c.child}i=i.sibling}T.tail!==null&&Ot()>vl&&(c.flags|=128,v=!0,uu(T,!1),c.lanes=4194304)}else{if(!v)if(i=Mf(W),i!==null){if(c.flags|=128,v=!0,h=i.updateQueue,h!==null&&(c.updateQueue=h,c.flags|=4),uu(T,!0),T.tail===null&&T.tailMode==="hidden"&&!W.alternate&&!At)return Pn(c),null}else 2*Ot()-T.renderingStartTime>vl&&h!==1073741824&&(c.flags|=128,v=!0,uu(T,!1),c.lanes=4194304);T.isBackwards?(W.sibling=c.child,c.child=W):(h=T.last,h!==null?h.sibling=W:c.child=W,T.last=W)}return T.tail!==null?(c=T.tail,T.rendering=c,T.tail=c.sibling,T.renderingStartTime=Ot(),c.sibling=null,h=It.current,Ct(It,v?h&1|2:h&1),c):(Pn(c),null);case 22:case 23:return Fx(),v=c.memoizedState!==null,i!==null&&i.memoizedState!==null!==v&&(c.flags|=8192),v&&(c.mode&1)!==0?(fr&1073741824)!==0&&(Pn(c),c.subtreeFlags&6&&(c.flags|=8192)):Pn(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function HD(i,c){switch(Kg(c),c.tag){case 1:return Kn(c.type)&&bf(),i=c.flags,i&65536?(c.flags=i&-65537|128,c):null;case 3:return pl(),Pt(qn),Pt(_n),ax(),i=c.flags,(i&65536)!==0&&(i&128)===0?(c.flags=i&-65537|128,c):null;case 5:return sx(c),null;case 13:if(Pt(It),i=c.memoizedState,i!==null&&i.dehydrated!==null){if(c.alternate===null)throw Error(n(340));dl()}return i=c.flags,i&65536?(c.flags=i&-65537|128,c):null;case 19:return Pt(It),null;case 4:return pl(),null;case 10:return Jg(c.type._context),null;case 22:case 23:return Fx(),null;case 24:return null;default:return null}}var Vf=!1,Tn=!1,UD=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function xl(i,c){var h=i.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(v){Vt(i,c,v)}else h.current=null}function Sx(i,c,h){try{h()}catch(v){Vt(i,c,v)}}var lj=!1;function qD(i,c){if(Fg=of,i=V1(),Tg(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var v=h.getSelection&&h.getSelection();if(v&&v.rangeCount!==0){h=v.anchorNode;var _=v.anchorOffset,T=v.focusNode;v=v.focusOffset;try{h.nodeType,T.nodeType}catch{h=null;break e}var W=0,Q=-1,Z=-1,le=0,me=0,xe=i,he=null;t:for(;;){for(var _e;xe!==h||_!==0&&xe.nodeType!==3||(Q=W+_),xe!==T||v!==0&&xe.nodeType!==3||(Z=W+v),xe.nodeType===3&&(W+=xe.nodeValue.length),(_e=xe.firstChild)!==null;)he=xe,xe=_e;for(;;){if(xe===i)break t;if(he===h&&++le===_&&(Q=W),he===T&&++me===v&&(Z=W),(_e=xe.nextSibling)!==null)break;xe=he,he=xe.parentNode}xe=_e}h=Q===-1||Z===-1?null:{start:Q,end:Z}}else h=null}h=h||{start:0,end:0}}else h=null;for($g={focusedElem:i,selectionRange:h},of=!1,Pe=c;Pe!==null;)if(c=Pe,i=c.child,(c.subtreeFlags&1028)!==0&&i!==null)i.return=c,Pe=i;else for(;Pe!==null;){c=Pe;try{var Te=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Ae=Te.memoizedProps,qt=Te.memoizedState,se=c.stateNode,ee=se.getSnapshotBeforeUpdate(c.elementType===c.type?Ae:Ur(c.type,Ae),qt);se.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ae=c.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(we){Vt(c,c.return,we)}if(i=c.sibling,i!==null){i.return=c.return,Pe=i;break}Pe=c.return}return Te=lj,lj=!1,Te}function du(i,c,h){var v=c.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var _=v=v.next;do{if((_.tag&i)===i){var T=_.destroy;_.destroy=void 0,T!==void 0&&Sx(c,h,T)}_=_.next}while(_!==v)}}function zf(i,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&i)===i){var v=h.create;h.destroy=v()}h=h.next}while(h!==c)}}function _x(i){var c=i.ref;if(c!==null){var h=i.stateNode;switch(i.tag){case 5:i=h;break;default:i=h}typeof c=="function"?c(i):c.current=i}}function cj(i){var c=i.alternate;c!==null&&(i.alternate=null,cj(c)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(c=i.stateNode,c!==null&&(delete c[ws],delete c[eu],delete c[Wg],delete c[ED],delete c[PD])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function uj(i){return i.tag===5||i.tag===3||i.tag===4}function dj(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||uj(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Ex(i,c,h){var v=i.tag;if(v===5||v===6)i=i.stateNode,c?h.nodeType===8?h.parentNode.insertBefore(i,c):h.insertBefore(i,c):(h.nodeType===8?(c=h.parentNode,c.insertBefore(i,h)):(c=h,c.appendChild(i)),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=yf));else if(v!==4&&(i=i.child,i!==null))for(Ex(i,c,h),i=i.sibling;i!==null;)Ex(i,c,h),i=i.sibling}function Px(i,c,h){var v=i.tag;if(v===5||v===6)i=i.stateNode,c?h.insertBefore(i,c):h.appendChild(i);else if(v!==4&&(i=i.child,i!==null))for(Px(i,c,h),i=i.sibling;i!==null;)Px(i,c,h),i=i.sibling}var xn=null,qr=!1;function Fo(i,c,h){for(h=h.child;h!==null;)fj(i,c,h),h=h.sibling}function fj(i,c,h){if(Er&&typeof Er.onCommitFiberUnmount=="function")try{Er.onCommitFiberUnmount(Va,h)}catch{}switch(h.tag){case 5:Tn||xl(h,c);case 6:var v=xn,_=qr;xn=null,Fo(i,c,h),xn=v,qr=_,xn!==null&&(qr?(i=xn,h=h.stateNode,i.nodeType===8?i.parentNode.removeChild(h):i.removeChild(h)):xn.removeChild(h.stateNode));break;case 18:xn!==null&&(qr?(i=xn,h=h.stateNode,i.nodeType===8?Bg(i.parentNode,h):i.nodeType===1&&Bg(i,h),Wc(i)):Bg(xn,h.stateNode));break;case 4:v=xn,_=qr,xn=h.stateNode.containerInfo,qr=!0,Fo(i,c,h),xn=v,qr=_;break;case 0:case 11:case 14:case 15:if(!Tn&&(v=h.updateQueue,v!==null&&(v=v.lastEffect,v!==null))){_=v=v.next;do{var T=_,W=T.destroy;T=T.tag,W!==void 0&&((T&2)!==0||(T&4)!==0)&&Sx(h,c,W),_=_.next}while(_!==v)}Fo(i,c,h);break;case 1:if(!Tn&&(xl(h,c),v=h.stateNode,typeof v.componentWillUnmount=="function"))try{v.props=h.memoizedProps,v.state=h.memoizedState,v.componentWillUnmount()}catch(Q){Vt(h,c,Q)}Fo(i,c,h);break;case 21:Fo(i,c,h);break;case 22:h.mode&1?(Tn=(v=Tn)||h.memoizedState!==null,Fo(i,c,h),Tn=v):Fo(i,c,h);break;default:Fo(i,c,h)}}function hj(i){var c=i.updateQueue;if(c!==null){i.updateQueue=null;var h=i.stateNode;h===null&&(h=i.stateNode=new UD),c.forEach(function(v){var _=tR.bind(null,i,v);h.has(v)||(h.add(v),v.then(_,_))})}}function Kr(i,c){var h=c.deletions;if(h!==null)for(var v=0;v<h.length;v++){var _=h[v];try{var T=i,W=c,Q=W;e:for(;Q!==null;){switch(Q.tag){case 5:xn=Q.stateNode,qr=!1;break e;case 3:xn=Q.stateNode.containerInfo,qr=!0;break e;case 4:xn=Q.stateNode.containerInfo,qr=!0;break e}Q=Q.return}if(xn===null)throw Error(n(160));fj(T,W,_),xn=null,qr=!1;var Z=_.alternate;Z!==null&&(Z.return=null),_.return=null}catch(le){Vt(_,c,le)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)mj(c,i),c=c.sibling}function mj(i,c){var h=i.alternate,v=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Kr(c,i),Cs(i),v&4){try{du(3,i,i.return),zf(3,i)}catch(Ae){Vt(i,i.return,Ae)}try{du(5,i,i.return)}catch(Ae){Vt(i,i.return,Ae)}}break;case 1:Kr(c,i),Cs(i),v&512&&h!==null&&xl(h,h.return);break;case 5:if(Kr(c,i),Cs(i),v&512&&h!==null&&xl(h,h.return),i.flags&32){var _=i.stateNode;try{ke(_,"")}catch(Ae){Vt(i,i.return,Ae)}}if(v&4&&(_=i.stateNode,_!=null)){var T=i.memoizedProps,W=h!==null?h.memoizedProps:T,Q=i.type,Z=i.updateQueue;if(i.updateQueue=null,Z!==null)try{Q==="input"&&T.type==="radio"&&T.name!=null&&Le(_,T),zr(Q,W);var le=zr(Q,T);for(W=0;W<Z.length;W+=2){var me=Z[W],xe=Z[W+1];me==="style"?pn(_,xe):me==="dangerouslySetInnerHTML"?oe(_,xe):me==="children"?ke(_,xe):C(_,me,xe,le)}switch(Q){case"input":st(_,T);break;case"textarea":ht(_,T);break;case"select":var he=_._wrapperState.wasMultiple;_._wrapperState.wasMultiple=!!T.multiple;var _e=T.value;_e!=null?$e(_,!!T.multiple,_e,!1):he!==!!T.multiple&&(T.defaultValue!=null?$e(_,!!T.multiple,T.defaultValue,!0):$e(_,!!T.multiple,T.multiple?[]:"",!1))}_[eu]=T}catch(Ae){Vt(i,i.return,Ae)}}break;case 6:if(Kr(c,i),Cs(i),v&4){if(i.stateNode===null)throw Error(n(162));_=i.stateNode,T=i.memoizedProps;try{_.nodeValue=T}catch(Ae){Vt(i,i.return,Ae)}}break;case 3:if(Kr(c,i),Cs(i),v&4&&h!==null&&h.memoizedState.isDehydrated)try{Wc(c.containerInfo)}catch(Ae){Vt(i,i.return,Ae)}break;case 4:Kr(c,i),Cs(i);break;case 13:Kr(c,i),Cs(i),_=i.child,_.flags&8192&&(T=_.memoizedState!==null,_.stateNode.isHidden=T,!T||_.alternate!==null&&_.alternate.memoizedState!==null||(Ax=Ot())),v&4&&hj(i);break;case 22:if(me=h!==null&&h.memoizedState!==null,i.mode&1?(Tn=(le=Tn)||me,Kr(c,i),Tn=le):Kr(c,i),Cs(i),v&8192){if(le=i.memoizedState!==null,(i.stateNode.isHidden=le)&&!me&&(i.mode&1)!==0)for(Pe=i,me=i.child;me!==null;){for(xe=Pe=me;Pe!==null;){switch(he=Pe,_e=he.child,he.tag){case 0:case 11:case 14:case 15:du(4,he,he.return);break;case 1:xl(he,he.return);var Te=he.stateNode;if(typeof Te.componentWillUnmount=="function"){v=he,h=he.return;try{c=v,Te.props=c.memoizedProps,Te.state=c.memoizedState,Te.componentWillUnmount()}catch(Ae){Vt(v,h,Ae)}}break;case 5:xl(he,he.return);break;case 22:if(he.memoizedState!==null){xj(xe);continue}}_e!==null?(_e.return=he,Pe=_e):xj(xe)}me=me.sibling}e:for(me=null,xe=i;;){if(xe.tag===5){if(me===null){me=xe;try{_=xe.stateNode,le?(T=_.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none"):(Q=xe.stateNode,Z=xe.memoizedProps.style,W=Z!=null&&Z.hasOwnProperty("display")?Z.display:null,Q.style.display=Mt("display",W))}catch(Ae){Vt(i,i.return,Ae)}}}else if(xe.tag===6){if(me===null)try{xe.stateNode.nodeValue=le?"":xe.memoizedProps}catch(Ae){Vt(i,i.return,Ae)}}else if((xe.tag!==22&&xe.tag!==23||xe.memoizedState===null||xe===i)&&xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===i)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===i)break e;me===xe&&(me=null),xe=xe.return}me===xe&&(me=null),xe.sibling.return=xe.return,xe=xe.sibling}}break;case 19:Kr(c,i),Cs(i),v&4&&hj(i);break;case 21:break;default:Kr(c,i),Cs(i)}}function Cs(i){var c=i.flags;if(c&2){try{e:{for(var h=i.return;h!==null;){if(uj(h)){var v=h;break e}h=h.return}throw Error(n(160))}switch(v.tag){case 5:var _=v.stateNode;v.flags&32&&(ke(_,""),v.flags&=-33);var T=dj(i);Px(i,T,_);break;case 3:case 4:var W=v.stateNode.containerInfo,Q=dj(i);Ex(i,Q,W);break;default:throw Error(n(161))}}catch(Z){Vt(i,i.return,Z)}i.flags&=-3}c&4096&&(i.flags&=-4097)}function KD(i,c,h){Pe=i,pj(i)}function pj(i,c,h){for(var v=(i.mode&1)!==0;Pe!==null;){var _=Pe,T=_.child;if(_.tag===22&&v){var W=_.memoizedState!==null||Vf;if(!W){var Q=_.alternate,Z=Q!==null&&Q.memoizedState!==null||Tn;Q=Vf;var le=Tn;if(Vf=W,(Tn=Z)&&!le)for(Pe=_;Pe!==null;)W=Pe,Z=W.child,W.tag===22&&W.memoizedState!==null?yj(_):Z!==null?(Z.return=W,Pe=Z):yj(_);for(;T!==null;)Pe=T,pj(T),T=T.sibling;Pe=_,Vf=Q,Tn=le}gj(i)}else(_.subtreeFlags&8772)!==0&&T!==null?(T.return=_,Pe=T):gj(i)}}function gj(i){for(;Pe!==null;){var c=Pe;if((c.flags&8772)!==0){var h=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Tn||zf(5,c);break;case 1:var v=c.stateNode;if(c.flags&4&&!Tn)if(h===null)v.componentDidMount();else{var _=c.elementType===c.type?h.memoizedProps:Ur(c.type,h.memoizedProps);v.componentDidUpdate(_,h.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var T=c.updateQueue;T!==null&&xN(c,T,v);break;case 3:var W=c.updateQueue;if(W!==null){if(h=null,c.child!==null)switch(c.child.tag){case 5:h=c.child.stateNode;break;case 1:h=c.child.stateNode}xN(c,W,h)}break;case 5:var Q=c.stateNode;if(h===null&&c.flags&4){h=Q;var Z=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":Z.autoFocus&&h.focus();break;case"img":Z.src&&(h.src=Z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var le=c.alternate;if(le!==null){var me=le.memoizedState;if(me!==null){var xe=me.dehydrated;xe!==null&&Wc(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Tn||c.flags&512&&_x(c)}catch(he){Vt(c,c.return,he)}}if(c===i){Pe=null;break}if(h=c.sibling,h!==null){h.return=c.return,Pe=h;break}Pe=c.return}}function xj(i){for(;Pe!==null;){var c=Pe;if(c===i){Pe=null;break}var h=c.sibling;if(h!==null){h.return=c.return,Pe=h;break}Pe=c.return}}function yj(i){for(;Pe!==null;){var c=Pe;try{switch(c.tag){case 0:case 11:case 15:var h=c.return;try{zf(4,c)}catch(Z){Vt(c,h,Z)}break;case 1:var v=c.stateNode;if(typeof v.componentDidMount=="function"){var _=c.return;try{v.componentDidMount()}catch(Z){Vt(c,_,Z)}}var T=c.return;try{_x(c)}catch(Z){Vt(c,T,Z)}break;case 5:var W=c.return;try{_x(c)}catch(Z){Vt(c,W,Z)}}}catch(Z){Vt(c,c.return,Z)}if(c===i){Pe=null;break}var Q=c.sibling;if(Q!==null){Q.return=c.return,Pe=Q;break}Pe=c.return}}var YD=Math.ceil,Bf=S.ReactCurrentDispatcher,Tx=S.ReactCurrentOwner,Dr=S.ReactCurrentBatchConfig,dt=0,un=null,Xt=null,yn=0,fr=0,yl=Do(0),rn=0,fu=null,Qa=0,Wf=0,Mx=0,hu=null,Qn=null,Ax=0,vl=1/0,to=null,Hf=!1,Dx=null,$o=null,Uf=!1,Vo=null,qf=0,mu=0,Rx=null,Kf=-1,Yf=0;function On(){return(dt&6)!==0?Ot():Kf!==-1?Kf:Kf=Ot()}function zo(i){return(i.mode&1)===0?1:(dt&2)!==0&&yn!==0?yn&-yn:MD.transition!==null?(Yf===0&&(Yf=Zi()),Yf):(i=bt,i!==0||(i=window.event,i=i===void 0?16:b1(i.type)),i)}function Yr(i,c,h,v){if(50<mu)throw mu=0,Rx=null,Error(n(185));za(i,h,v),((dt&2)===0||i!==un)&&(i===un&&((dt&2)===0&&(Wf|=h),rn===4&&Bo(i,yn)),Gn(i,v),h===1&&dt===0&&(c.mode&1)===0&&(vl=Ot()+500,Nf&&Oo()))}function Gn(i,c){var h=i.callbackNode;pg(i,c);var v=Xi(i,i===un?yn:0);if(v===0)h!==null&&Xd(h),i.callbackNode=null,i.callbackPriority=0;else if(c=v&-v,i.callbackPriority!==c){if(h!=null&&Xd(h),c===1)i.tag===0?TD(bj.bind(null,i)):oN(bj.bind(null,i)),SD(function(){(dt&6)===0&&Oo()}),h=null;else{switch(f1(v)){case 1:h=Ic;break;case 4:h=Jd;break;case 16:h=Yi;break;case 536870912:h=ef;break;default:h=Yi}h=Ej(h,vj.bind(null,i))}i.callbackPriority=c,i.callbackNode=h}}function vj(i,c){if(Kf=-1,Yf=0,(dt&6)!==0)throw Error(n(327));var h=i.callbackNode;if(bl()&&i.callbackNode!==h)return null;var v=Xi(i,i===un?yn:0);if(v===0)return null;if((v&30)!==0||(v&i.expiredLanes)!==0||c)c=Qf(i,v);else{c=v;var _=dt;dt|=2;var T=Nj();(un!==i||yn!==c)&&(to=null,vl=Ot()+500,Xa(i,c));do try{XD();break}catch(Q){wj(i,Q)}while(!0);Zg(),Bf.current=T,dt=_,Xt!==null?c=0:(un=null,yn=0,c=rn)}if(c!==0){if(c===2&&(_=Lc(i),_!==0&&(v=_,c=Ox(i,_))),c===1)throw h=fu,Xa(i,0),Bo(i,v),Gn(i,Ot()),h;if(c===6)Bo(i,v);else{if(_=i.current.alternate,(v&30)===0&&!QD(_)&&(c=Qf(i,v),c===2&&(T=Lc(i),T!==0&&(v=T,c=Ox(i,T))),c===1))throw h=fu,Xa(i,0),Bo(i,v),Gn(i,Ot()),h;switch(i.finishedWork=_,i.finishedLanes=v,c){case 0:case 1:throw Error(n(345));case 2:Za(i,Qn,to);break;case 3:if(Bo(i,v),(v&130023424)===v&&(c=Ax+500-Ot(),10<c)){if(Xi(i,0)!==0)break;if(_=i.suspendedLanes,(_&v)!==v){On(),i.pingedLanes|=i.suspendedLanes&_;break}i.timeoutHandle=zg(Za.bind(null,i,Qn,to),c);break}Za(i,Qn,to);break;case 4:if(Bo(i,v),(v&4194240)===v)break;for(c=i.eventTimes,_=-1;0<v;){var W=31-lr(v);T=1<<W,W=c[W],W>_&&(_=W),v&=~T}if(v=_,v=Ot()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*YD(v/1960))-v,10<v){i.timeoutHandle=zg(Za.bind(null,i,Qn,to),v);break}Za(i,Qn,to);break;case 5:Za(i,Qn,to);break;default:throw Error(n(329))}}}return Gn(i,Ot()),i.callbackNode===h?vj.bind(null,i):null}function Ox(i,c){var h=hu;return i.current.memoizedState.isDehydrated&&(Xa(i,c).flags|=256),i=Qf(i,c),i!==2&&(c=Qn,Qn=h,c!==null&&Ix(c)),i}function Ix(i){Qn===null?Qn=i:Qn.push.apply(Qn,i)}function QD(i){for(var c=i;;){if(c.flags&16384){var h=c.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var v=0;v<h.length;v++){var _=h[v],T=_.getSnapshot;_=_.value;try{if(!Wr(T(),_))return!1}catch{return!1}}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;else{if(c===i)break;for(;c.sibling===null;){if(c.return===null||c.return===i)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Bo(i,c){for(c&=~Mx,c&=~Wf,i.suspendedLanes|=c,i.pingedLanes&=~c,i=i.expirationTimes;0<c;){var h=31-lr(c),v=1<<h;i[h]=-1,c&=~v}}function bj(i){if((dt&6)!==0)throw Error(n(327));bl();var c=Xi(i,0);if((c&1)===0)return Gn(i,Ot()),null;var h=Qf(i,c);if(i.tag!==0&&h===2){var v=Lc(i);v!==0&&(c=v,h=Ox(i,v))}if(h===1)throw h=fu,Xa(i,0),Bo(i,c),Gn(i,Ot()),h;if(h===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=c,Za(i,Qn,to),Gn(i,Ot()),null}function Lx(i,c){var h=dt;dt|=1;try{return i(c)}finally{dt=h,dt===0&&(vl=Ot()+500,Nf&&Oo())}}function Ga(i){Vo!==null&&Vo.tag===0&&(dt&6)===0&&bl();var c=dt;dt|=1;var h=Dr.transition,v=bt;try{if(Dr.transition=null,bt=1,i)return i()}finally{bt=v,Dr.transition=h,dt=c,(dt&6)===0&&Oo()}}function Fx(){fr=yl.current,Pt(yl)}function Xa(i,c){i.finishedWork=null,i.finishedLanes=0;var h=i.timeoutHandle;if(h!==-1&&(i.timeoutHandle=-1,kD(h)),Xt!==null)for(h=Xt.return;h!==null;){var v=h;switch(Kg(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&bf();break;case 3:pl(),Pt(qn),Pt(_n),ax();break;case 5:sx(v);break;case 4:pl();break;case 13:Pt(It);break;case 19:Pt(It);break;case 10:Jg(v.type._context);break;case 22:case 23:Fx()}h=h.return}if(un=i,Xt=i=Wo(i.current,null),yn=fr=c,rn=0,fu=null,Mx=Wf=Qa=0,Qn=hu=null,qa!==null){for(c=0;c<qa.length;c++)if(h=qa[c],v=h.interleaved,v!==null){h.interleaved=null;var _=v.next,T=h.pending;if(T!==null){var W=T.next;T.next=_,v.next=W}h.pending=v}qa=null}return i}function wj(i,c){do{var h=Xt;try{if(Zg(),Af.current=If,Df){for(var v=Lt.memoizedState;v!==null;){var _=v.queue;_!==null&&(_.pending=null),v=v.next}Df=!1}if(Ya=0,cn=nn=Lt=null,au=!1,iu=0,Tx.current=null,h===null||h.return===null){rn=1,fu=c,Xt=null;break}e:{var T=i,W=h.return,Q=h,Z=c;if(c=yn,Q.flags|=32768,Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var le=Z,me=Q,xe=me.tag;if((me.mode&1)===0&&(xe===0||xe===11||xe===15)){var he=me.alternate;he?(me.updateQueue=he.updateQueue,me.memoizedState=he.memoizedState,me.lanes=he.lanes):(me.updateQueue=null,me.memoizedState=null)}var _e=qN(W);if(_e!==null){_e.flags&=-257,KN(_e,W,Q,T,c),_e.mode&1&&UN(T,le,c),c=_e,Z=le;var Te=c.updateQueue;if(Te===null){var Ae=new Set;Ae.add(Z),c.updateQueue=Ae}else Te.add(Z);break e}else{if((c&1)===0){UN(T,le,c),$x();break e}Z=Error(n(426))}}else if(At&&Q.mode&1){var qt=qN(W);if(qt!==null){(qt.flags&65536)===0&&(qt.flags|=256),KN(qt,W,Q,T,c),Gg(gl(Z,Q));break e}}T=Z=gl(Z,Q),rn!==4&&(rn=2),hu===null?hu=[T]:hu.push(T),T=W;do{switch(T.tag){case 3:T.flags|=65536,c&=-c,T.lanes|=c;var se=WN(T,Z,c);gN(T,se);break e;case 1:Q=Z;var ee=T.type,ae=T.stateNode;if((T.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&($o===null||!$o.has(ae)))){T.flags|=65536,c&=-c,T.lanes|=c;var we=HN(T,Q,c);gN(T,we);break e}}T=T.return}while(T!==null)}Cj(h)}catch(Re){c=Re,Xt===h&&h!==null&&(Xt=h=h.return);continue}break}while(!0)}function Nj(){var i=Bf.current;return Bf.current=If,i===null?If:i}function $x(){(rn===0||rn===3||rn===2)&&(rn=4),un===null||(Qa&268435455)===0&&(Wf&268435455)===0||Bo(un,yn)}function Qf(i,c){var h=dt;dt|=2;var v=Nj();(un!==i||yn!==c)&&(to=null,Xa(i,c));do try{GD();break}catch(_){wj(i,_)}while(!0);if(Zg(),dt=h,Bf.current=v,Xt!==null)throw Error(n(261));return un=null,yn=0,rn}function GD(){for(;Xt!==null;)jj(Xt)}function XD(){for(;Xt!==null&&!lg();)jj(Xt)}function jj(i){var c=_j(i.alternate,i,fr);i.memoizedProps=i.pendingProps,c===null?Cj(i):Xt=c,Tx.current=null}function Cj(i){var c=i;do{var h=c.alternate;if(i=c.return,(c.flags&32768)===0){if(h=WD(h,c,fr),h!==null){Xt=h;return}}else{if(h=HD(h,c),h!==null){h.flags&=32767,Xt=h;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{rn=6,Xt=null;return}}if(c=c.sibling,c!==null){Xt=c;return}Xt=c=i}while(c!==null);rn===0&&(rn=5)}function Za(i,c,h){var v=bt,_=Dr.transition;try{Dr.transition=null,bt=1,ZD(i,c,h,v)}finally{Dr.transition=_,bt=v}return null}function ZD(i,c,h,v){do bl();while(Vo!==null);if((dt&6)!==0)throw Error(n(327));h=i.finishedWork;var _=i.finishedLanes;if(h===null)return null;if(i.finishedWork=null,i.finishedLanes=0,h===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var T=h.lanes|h.childLanes;if(nf(i,T),i===un&&(Xt=un=null,yn=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||Uf||(Uf=!0,Ej(Yi,function(){return bl(),null})),T=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||T){T=Dr.transition,Dr.transition=null;var W=bt;bt=1;var Q=dt;dt|=4,Tx.current=null,qD(i,h),mj(h,i),yD($g),of=!!Fg,$g=Fg=null,i.current=h,KD(h),Zd(),dt=Q,bt=W,Dr.transition=T}else i.current=h;if(Uf&&(Uf=!1,Vo=i,qf=_),T=i.pendingLanes,T===0&&($o=null),dg(h.stateNode),Gn(i,Ot()),c!==null)for(v=i.onRecoverableError,h=0;h<c.length;h++)_=c[h],v(_.value,{componentStack:_.stack,digest:_.digest});if(Hf)throw Hf=!1,i=Dx,Dx=null,i;return(qf&1)!==0&&i.tag!==0&&bl(),T=i.pendingLanes,(T&1)!==0?i===Rx?mu++:(mu=0,Rx=i):mu=0,Oo(),null}function bl(){if(Vo!==null){var i=f1(qf),c=Dr.transition,h=bt;try{if(Dr.transition=null,bt=16>i?16:i,Vo===null)var v=!1;else{if(i=Vo,Vo=null,qf=0,(dt&6)!==0)throw Error(n(331));var _=dt;for(dt|=4,Pe=i.current;Pe!==null;){var T=Pe,W=T.child;if((Pe.flags&16)!==0){var Q=T.deletions;if(Q!==null){for(var Z=0;Z<Q.length;Z++){var le=Q[Z];for(Pe=le;Pe!==null;){var me=Pe;switch(me.tag){case 0:case 11:case 15:du(8,me,T)}var xe=me.child;if(xe!==null)xe.return=me,Pe=xe;else for(;Pe!==null;){me=Pe;var he=me.sibling,_e=me.return;if(cj(me),me===le){Pe=null;break}if(he!==null){he.return=_e,Pe=he;break}Pe=_e}}}var Te=T.alternate;if(Te!==null){var Ae=Te.child;if(Ae!==null){Te.child=null;do{var qt=Ae.sibling;Ae.sibling=null,Ae=qt}while(Ae!==null)}}Pe=T}}if((T.subtreeFlags&2064)!==0&&W!==null)W.return=T,Pe=W;else e:for(;Pe!==null;){if(T=Pe,(T.flags&2048)!==0)switch(T.tag){case 0:case 11:case 15:du(9,T,T.return)}var se=T.sibling;if(se!==null){se.return=T.return,Pe=se;break e}Pe=T.return}}var ee=i.current;for(Pe=ee;Pe!==null;){W=Pe;var ae=W.child;if((W.subtreeFlags&2064)!==0&&ae!==null)ae.return=W,Pe=ae;else e:for(W=ee;Pe!==null;){if(Q=Pe,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:zf(9,Q)}}catch(Re){Vt(Q,Q.return,Re)}if(Q===W){Pe=null;break e}var we=Q.sibling;if(we!==null){we.return=Q.return,Pe=we;break e}Pe=Q.return}}if(dt=_,Oo(),Er&&typeof Er.onPostCommitFiberRoot=="function")try{Er.onPostCommitFiberRoot(Va,i)}catch{}v=!0}return v}finally{bt=h,Dr.transition=c}}return!1}function kj(i,c,h){c=gl(h,c),c=WN(i,c,1),i=Lo(i,c,1),c=On(),i!==null&&(za(i,1,c),Gn(i,c))}function Vt(i,c,h){if(i.tag===3)kj(i,i,h);else for(;c!==null;){if(c.tag===3){kj(c,i,h);break}else if(c.tag===1){var v=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&($o===null||!$o.has(v))){i=gl(h,i),i=HN(c,i,1),c=Lo(c,i,1),i=On(),c!==null&&(za(c,1,i),Gn(c,i));break}}c=c.return}}function JD(i,c,h){var v=i.pingCache;v!==null&&v.delete(c),c=On(),i.pingedLanes|=i.suspendedLanes&h,un===i&&(yn&h)===h&&(rn===4||rn===3&&(yn&130023424)===yn&&500>Ot()-Ax?Xa(i,0):Mx|=h),Gn(i,c)}function Sj(i,c){c===0&&((i.mode&1)===0?c=1:(c=Gi,Gi<<=1,(Gi&130023424)===0&&(Gi=4194304)));var h=On();i=Zs(i,c),i!==null&&(za(i,c,h),Gn(i,h))}function eR(i){var c=i.memoizedState,h=0;c!==null&&(h=c.retryLane),Sj(i,h)}function tR(i,c){var h=0;switch(i.tag){case 13:var v=i.stateNode,_=i.memoizedState;_!==null&&(h=_.retryLane);break;case 19:v=i.stateNode;break;default:throw Error(n(314))}v!==null&&v.delete(c),Sj(i,h)}var _j;_j=function(i,c,h){if(i!==null)if(i.memoizedProps!==c.pendingProps||qn.current)Yn=!0;else{if((i.lanes&h)===0&&(c.flags&128)===0)return Yn=!1,BD(i,c,h);Yn=(i.flags&131072)!==0}else Yn=!1,At&&(c.flags&1048576)!==0&&aN(c,Cf,c.index);switch(c.lanes=0,c.tag){case 2:var v=c.type;$f(i,c),i=c.pendingProps;var _=ll(c,_n.current);ml(c,h),_=cx(null,c,v,i,_,h);var T=ux();return c.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Kn(v)?(T=!0,wf(c)):T=!1,c.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,nx(c),_.updater=Lf,c.stateNode=_,_._reactInternals=c,gx(c,v,i,h),c=bx(null,c,v,!0,T,h)):(c.tag=0,At&&T&&qg(c),Rn(null,c,_,h),c=c.child),c;case 16:v=c.elementType;e:{switch($f(i,c),i=c.pendingProps,_=v._init,v=_(v._payload),c.type=v,_=c.tag=rR(v),i=Ur(v,i),_){case 0:c=vx(null,c,v,i,h);break e;case 1:c=JN(null,c,v,i,h);break e;case 11:c=YN(null,c,v,i,h);break e;case 14:c=QN(null,c,v,Ur(v.type,i),h);break e}throw Error(n(306,v,""))}return c;case 0:return v=c.type,_=c.pendingProps,_=c.elementType===v?_:Ur(v,_),vx(i,c,v,_,h);case 1:return v=c.type,_=c.pendingProps,_=c.elementType===v?_:Ur(v,_),JN(i,c,v,_,h);case 3:e:{if(ej(c),i===null)throw Error(n(387));v=c.pendingProps,T=c.memoizedState,_=T.element,pN(i,c),Tf(c,v,null,h);var W=c.memoizedState;if(v=W.element,T.isDehydrated)if(T={element:v,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},c.updateQueue.baseState=T,c.memoizedState=T,c.flags&256){_=gl(Error(n(423)),c),c=tj(i,c,v,h,_);break e}else if(v!==_){_=gl(Error(n(424)),c),c=tj(i,c,v,h,_);break e}else for(dr=Ao(c.stateNode.containerInfo.firstChild),ur=c,At=!0,Hr=null,h=hN(c,null,v,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(dl(),v===_){c=eo(i,c,h);break e}Rn(i,c,v,h)}c=c.child}return c;case 5:return yN(c),i===null&&Qg(c),v=c.type,_=c.pendingProps,T=i!==null?i.memoizedProps:null,W=_.children,Vg(v,_)?W=null:T!==null&&Vg(v,T)&&(c.flags|=32),ZN(i,c),Rn(i,c,W,h),c.child;case 6:return i===null&&Qg(c),null;case 13:return nj(i,c,h);case 4:return rx(c,c.stateNode.containerInfo),v=c.pendingProps,i===null?c.child=fl(c,null,v,h):Rn(i,c,v,h),c.child;case 11:return v=c.type,_=c.pendingProps,_=c.elementType===v?_:Ur(v,_),YN(i,c,v,_,h);case 7:return Rn(i,c,c.pendingProps,h),c.child;case 8:return Rn(i,c,c.pendingProps.children,h),c.child;case 12:return Rn(i,c,c.pendingProps.children,h),c.child;case 10:e:{if(v=c.type._context,_=c.pendingProps,T=c.memoizedProps,W=_.value,Ct(_f,v._currentValue),v._currentValue=W,T!==null)if(Wr(T.value,W)){if(T.children===_.children&&!qn.current){c=eo(i,c,h);break e}}else for(T=c.child,T!==null&&(T.return=c);T!==null;){var Q=T.dependencies;if(Q!==null){W=T.child;for(var Z=Q.firstContext;Z!==null;){if(Z.context===v){if(T.tag===1){Z=Js(-1,h&-h),Z.tag=2;var le=T.updateQueue;if(le!==null){le=le.shared;var me=le.pending;me===null?Z.next=Z:(Z.next=me.next,me.next=Z),le.pending=Z}}T.lanes|=h,Z=T.alternate,Z!==null&&(Z.lanes|=h),ex(T.return,h,c),Q.lanes|=h;break}Z=Z.next}}else if(T.tag===10)W=T.type===c.type?null:T.child;else if(T.tag===18){if(W=T.return,W===null)throw Error(n(341));W.lanes|=h,Q=W.alternate,Q!==null&&(Q.lanes|=h),ex(W,h,c),W=T.sibling}else W=T.child;if(W!==null)W.return=T;else for(W=T;W!==null;){if(W===c){W=null;break}if(T=W.sibling,T!==null){T.return=W.return,W=T;break}W=W.return}T=W}Rn(i,c,_.children,h),c=c.child}return c;case 9:return _=c.type,v=c.pendingProps.children,ml(c,h),_=Mr(_),v=v(_),c.flags|=1,Rn(i,c,v,h),c.child;case 14:return v=c.type,_=Ur(v,c.pendingProps),_=Ur(v.type,_),QN(i,c,v,_,h);case 15:return GN(i,c,c.type,c.pendingProps,h);case 17:return v=c.type,_=c.pendingProps,_=c.elementType===v?_:Ur(v,_),$f(i,c),c.tag=1,Kn(v)?(i=!0,wf(c)):i=!1,ml(c,h),zN(c,v,_),gx(c,v,_,h),bx(null,c,v,!0,i,h);case 19:return sj(i,c,h);case 22:return XN(i,c,h)}throw Error(n(156,c.tag))};function Ej(i,c){return Gd(i,c)}function nR(i,c,h,v){this.tag=i,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rr(i,c,h,v){return new nR(i,c,h,v)}function Vx(i){return i=i.prototype,!(!i||!i.isReactComponent)}function rR(i){if(typeof i=="function")return Vx(i)?1:0;if(i!=null){if(i=i.$$typeof,i===H)return 11;if(i===M)return 14}return 2}function Wo(i,c){var h=i.alternate;return h===null?(h=Rr(i.tag,c,i.key,i.mode),h.elementType=i.elementType,h.type=i.type,h.stateNode=i.stateNode,h.alternate=i,i.alternate=h):(h.pendingProps=c,h.type=i.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=i.flags&14680064,h.childLanes=i.childLanes,h.lanes=i.lanes,h.child=i.child,h.memoizedProps=i.memoizedProps,h.memoizedState=i.memoizedState,h.updateQueue=i.updateQueue,c=i.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=i.sibling,h.index=i.index,h.ref=i.ref,h}function Gf(i,c,h,v,_,T){var W=2;if(v=i,typeof i=="function")Vx(i)&&(W=1);else if(typeof i=="string")W=5;else e:switch(i){case D:return Ja(h.children,_,T,c);case I:W=8,_|=8;break;case z:return i=Rr(12,h,c,_|2),i.elementType=z,i.lanes=T,i;case B:return i=Rr(13,h,c,_),i.elementType=B,i.lanes=T,i;case R:return i=Rr(19,h,c,_),i.elementType=R,i.lanes=T,i;case L:return Xf(h,_,T,c);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case K:W=10;break e;case q:W=9;break e;case H:W=11;break e;case M:W=14;break e;case F:W=16,v=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return c=Rr(W,h,c,_),c.elementType=i,c.type=v,c.lanes=T,c}function Ja(i,c,h,v){return i=Rr(7,i,v,c),i.lanes=h,i}function Xf(i,c,h,v){return i=Rr(22,i,v,c),i.elementType=L,i.lanes=h,i.stateNode={isHidden:!1},i}function zx(i,c,h){return i=Rr(6,i,null,c),i.lanes=h,i}function Bx(i,c,h){return c=Rr(4,i.children!==null?i.children:[],i.key,c),c.lanes=h,c.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},c}function sR(i,c,h,v,_){this.tag=c,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fc(0),this.expirationTimes=Fc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fc(0),this.identifierPrefix=v,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function Wx(i,c,h,v,_,T,W,Q,Z){return i=new sR(i,c,h,Q,Z),c===1?(c=1,T===!0&&(c|=8)):c=0,T=Rr(3,null,null,c),i.current=T,T.stateNode=i,T.memoizedState={element:v,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},nx(T),i}function oR(i,c,h){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:v==null?null:""+v,children:i,containerInfo:c,implementation:h}}function Pj(i){if(!i)return Ro;i=i._reactInternals;e:{if(vs(i)!==i||i.tag!==1)throw Error(n(170));var c=i;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Kn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(i.tag===1){var h=i.type;if(Kn(h))return rN(i,h,c)}return c}function Tj(i,c,h,v,_,T,W,Q,Z){return i=Wx(h,v,!0,i,_,T,W,Q,Z),i.context=Pj(null),h=i.current,v=On(),_=zo(h),T=Js(v,_),T.callback=c??null,Lo(h,T,_),i.current.lanes=_,za(i,_,v),Gn(i,v),i}function Zf(i,c,h,v){var _=c.current,T=On(),W=zo(_);return h=Pj(h),c.context===null?c.context=h:c.pendingContext=h,c=Js(T,W),c.payload={element:i},v=v===void 0?null:v,v!==null&&(c.callback=v),i=Lo(_,c,W),i!==null&&(Yr(i,_,W,T),Pf(i,_,W)),W}function Jf(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function Mj(i,c){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var h=i.retryLane;i.retryLane=h!==0&&h<c?h:c}}function Hx(i,c){Mj(i,c),(i=i.alternate)&&Mj(i,c)}function aR(){return null}var Aj=typeof reportError=="function"?reportError:function(i){console.error(i)};function Ux(i){this._internalRoot=i}eh.prototype.render=Ux.prototype.render=function(i){var c=this._internalRoot;if(c===null)throw Error(n(409));Zf(i,c,null,null)},eh.prototype.unmount=Ux.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var c=i.containerInfo;Ga(function(){Zf(null,i,null,null)}),c[Ys]=null}};function eh(i){this._internalRoot=i}eh.prototype.unstable_scheduleHydration=function(i){if(i){var c=p1();i={blockedOn:null,target:i,priority:c};for(var h=0;h<Po.length&&c!==0&&c<Po[h].priority;h++);Po.splice(h,0,i),h===0&&y1(i)}};function qx(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function th(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Dj(){}function iR(i,c,h,v,_){if(_){if(typeof v=="function"){var T=v;v=function(){var le=Jf(W);T.call(le)}}var W=Tj(c,v,i,0,null,!1,!1,"",Dj);return i._reactRootContainer=W,i[Ys]=W.current,Zc(i.nodeType===8?i.parentNode:i),Ga(),W}for(;_=i.lastChild;)i.removeChild(_);if(typeof v=="function"){var Q=v;v=function(){var le=Jf(Z);Q.call(le)}}var Z=Wx(i,0,!1,null,null,!1,!1,"",Dj);return i._reactRootContainer=Z,i[Ys]=Z.current,Zc(i.nodeType===8?i.parentNode:i),Ga(function(){Zf(c,Z,h,v)}),Z}function nh(i,c,h,v,_){var T=h._reactRootContainer;if(T){var W=T;if(typeof _=="function"){var Q=_;_=function(){var Z=Jf(W);Q.call(Z)}}Zf(c,W,i,_)}else W=iR(h,c,i,_,v);return Jf(W)}h1=function(i){switch(i.tag){case 3:var c=i.stateNode;if(c.current.memoizedState.isDehydrated){var h=bs(c.pendingLanes);h!==0&&(gg(c,h|1),Gn(c,Ot()),(dt&6)===0&&(vl=Ot()+500,Oo()))}break;case 13:Ga(function(){var v=Zs(i,1);if(v!==null){var _=On();Yr(v,i,1,_)}}),Hx(i,1)}},xg=function(i){if(i.tag===13){var c=Zs(i,134217728);if(c!==null){var h=On();Yr(c,i,134217728,h)}Hx(i,134217728)}},m1=function(i){if(i.tag===13){var c=zo(i),h=Zs(i,c);if(h!==null){var v=On();Yr(h,i,c,v)}Hx(i,c)}},p1=function(){return bt},g1=function(i,c){var h=bt;try{return bt=i,c()}finally{bt=h}},ko=function(i,c,h){switch(c){case"input":if(st(i,h),c=h.name,h.type==="radio"&&c!=null){for(h=i;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<h.length;c++){var v=h[c];if(v!==i&&v.form===i.form){var _=vf(v);if(!_)throw Error(n(90));ye(v),st(v,_)}}}break;case"textarea":ht(i,h);break;case"select":c=h.value,c!=null&&$e(i,!!h.multiple,c,!1)}},ut=Lx,vt=Ga;var lR={usingClientEntryPoint:!1,Events:[tu,al,vf,Ui,Ye,Lx]},pu={findFiberByHostInstance:Ba,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cR={bundleType:pu.bundleType,version:pu.version,rendererPackageName:pu.rendererPackageName,rendererConfig:pu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Yd(i),i===null?null:i.stateNode},findFiberByHostInstance:pu.findFiberByHostInstance||aR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rh.isDisabled&&rh.supportsFiber)try{Va=rh.inject(cR),Er=rh}catch{}}return Xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lR,Xn.createPortal=function(i,c){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!qx(c))throw Error(n(200));return oR(i,c,null,h)},Xn.createRoot=function(i,c){if(!qx(i))throw Error(n(299));var h=!1,v="",_=Aj;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onRecoverableError!==void 0&&(_=c.onRecoverableError)),c=Wx(i,1,!1,null,null,h,!1,v,_),i[Ys]=c.current,Zc(i.nodeType===8?i.parentNode:i),new Ux(c)},Xn.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var c=i._reactInternals;if(c===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=Yd(c),i=i===null?null:i.stateNode,i},Xn.flushSync=function(i){return Ga(i)},Xn.hydrate=function(i,c,h){if(!th(c))throw Error(n(200));return nh(null,i,c,!0,h)},Xn.hydrateRoot=function(i,c,h){if(!qx(i))throw Error(n(405));var v=h!=null&&h.hydratedSources||null,_=!1,T="",W=Aj;if(h!=null&&(h.unstable_strictMode===!0&&(_=!0),h.identifierPrefix!==void 0&&(T=h.identifierPrefix),h.onRecoverableError!==void 0&&(W=h.onRecoverableError)),c=Tj(c,null,i,1,h??null,_,!1,T,W),i[Ys]=c.current,Zc(i),v)for(i=0;i<v.length;i++)h=v[i],_=h._getVersion,_=_(h._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[h,_]:c.mutableSourceEagerHydrationData.push(h,_);return new eh(c)},Xn.render=function(i,c,h){if(!th(c))throw Error(n(200));return nh(null,i,c,!1,h)},Xn.unmountComponentAtNode=function(i){if(!th(i))throw Error(n(40));return i._reactRootContainer?(Ga(function(){nh(null,null,i,!1,function(){i._reactRootContainer=null,i[Ys]=null})}),!0):!1},Xn.unstable_batchedUpdates=Lx,Xn.unstable_renderSubtreeIntoContainer=function(i,c,h,v){if(!th(h))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return nh(i,c,h,!1,v)},Xn.version="18.3.1-next-f1338f8080-20240426",Xn}var Bj;function a_(){if(Bj)return Gx.exports;Bj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Gx.exports=vR(),Gx.exports}var Wj;function bR(){if(Wj)return oh;Wj=1;var e=a_();return oh.createRoot=e.createRoot,oh.hydrateRoot=e.hydrateRoot,oh}var wR=bR();const NR=Jm(wR);var yc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},jR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ra,q0,Q2,CR=(Q2=class{constructor(){Ve(this,ra,jR);Ve(this,q0,!1)}setTimeoutProvider(e){Se(this,ra,e)}setTimeout(e,t){return G(this,ra).setTimeout(e,t)}clearTimeout(e){G(this,ra).clearTimeout(e)}setInterval(e,t){return G(this,ra).setInterval(e,t)}clearInterval(e){G(this,ra).clearInterval(e)}},ra=new WeakMap,q0=new WeakMap,Q2),fi=new CR;function kR(e){setTimeout(e,0)}var Ai=typeof window>"u"||"Deno"in globalThis;function Ln(){}function SR(e,t){return typeof e=="function"?e(t):e}function dv(e){return typeof e=="number"&&e>=0&&e!==1/0}function i_(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pa(e,t){return typeof e=="function"?e(t):e}function Ir(e,t){return typeof e=="function"?e(t):e}function Hj(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:a,queryKey:l,stale:u}=e;if(l){if(r){if(t.queryHash!==K0(l,t.options))return!1}else if(!Uu(t.queryKey,l))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||o&&o!==t.state.fetchStatus||a&&!a(t))}function Uj(e,t){const{exact:n,status:r,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Di(t.options.mutationKey)!==Di(a))return!1}else if(!Uu(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function K0(e,t){return((t==null?void 0:t.queryKeyHashFn)||Di)(e)}function Di(e){return JSON.stringify(e,(t,n)=>fv(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Uu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Uu(e[n],t[n])):!1}var _R=Object.prototype.hasOwnProperty;function l_(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=qj(e)&&qj(t);if(!r&&!(fv(e)&&fv(t)))return t;const a=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),u=l.length,d=r?new Array(u):{};let f=0;for(let m=0;m<u;m++){const p=r?m:l[m],g=e[p],y=t[p];if(g===y){d[p]=g,(r?m<a:_R.call(e,p))&&f++;continue}if(g===null||y===null||typeof g!="object"||typeof y!="object"){d[p]=y;continue}const b=l_(g,y,n+1);d[p]=b,b===g&&f++}return a===u&&f===a?e:d}function cm(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function qj(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function fv(e){if(!Kj(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Kj(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Kj(e){return Object.prototype.toString.call(e)==="[object Object]"}function ER(e){return new Promise(t=>{fi.setTimeout(t,e)})}function hv(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?l_(e,t):t}function PR(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function TR(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Y0=Symbol();function c_(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Y0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Q0(e,t){return typeof e=="function"?e(...t):!!e}function MR(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var gi,sa,Wl,G2,AR=(G2=class extends yc{constructor(){super();Ve(this,gi);Ve(this,sa);Ve(this,Wl);Se(this,Wl,t=>{if(!Ai&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){G(this,sa)||this.setEventListener(G(this,Wl))}onUnsubscribe(){var t;this.hasListeners()||((t=G(this,sa))==null||t.call(this),Se(this,sa,void 0))}setEventListener(t){var n;Se(this,Wl,t),(n=G(this,sa))==null||n.call(this),Se(this,sa,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){G(this,gi)!==t&&(Se(this,gi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof G(this,gi)=="boolean"?G(this,gi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},gi=new WeakMap,sa=new WeakMap,Wl=new WeakMap,G2),G0=new AR;function mv(){let e,t;const n=new Promise((o,a)=>{e=o,t=a});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var DR=kR;function RR(){let e=[],t=0,n=u=>{u()},r=u=>{u()},o=DR;const a=u=>{t?e.push(u):o(()=>{n(u)})},l=()=>{const u=e;e=[],u.length&&o(()=>{r(()=>{u.forEach(d=>{n(d)})})})};return{batch:u=>{let d;t++;try{d=u()}finally{t--,t||l()}return d},batchCalls:u=>(...d)=>{a(()=>{u(...d)})},schedule:a,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{o=u}}}var on=RR(),Hl,oa,Ul,X2,OR=(X2=class extends yc{constructor(){super();Ve(this,Hl,!0);Ve(this,oa);Ve(this,Ul);Se(this,Ul,t=>{if(!Ai&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){G(this,oa)||this.setEventListener(G(this,Ul))}onUnsubscribe(){var t;this.hasListeners()||((t=G(this,oa))==null||t.call(this),Se(this,oa,void 0))}setEventListener(t){var n;Se(this,Ul,t),(n=G(this,oa))==null||n.call(this),Se(this,oa,t(this.setOnline.bind(this)))}setOnline(t){G(this,Hl)!==t&&(Se(this,Hl,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return G(this,Hl)}},Hl=new WeakMap,oa=new WeakMap,Ul=new WeakMap,X2),um=new OR;function IR(e){return Math.min(1e3*2**e,3e4)}function u_(e){return(e??"online")==="online"?um.isOnline():!0}var pv=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function d_(e){let t=!1,n=0,r;const o=mv(),a=()=>o.status!=="pending",l=w=>{var N;if(!a()){const k=new pv(w);g(k),(N=e.onCancel)==null||N.call(e,k)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>G0.isFocused()&&(e.networkMode==="always"||um.isOnline())&&e.canRun(),m=()=>u_(e.networkMode)&&e.canRun(),p=w=>{a()||(r==null||r(),o.resolve(w))},g=w=>{a()||(r==null||r(),o.reject(w))},y=()=>new Promise(w=>{var N;r=k=>{(a()||f())&&w(k)},(N=e.onPause)==null||N.call(e)}).then(()=>{var w;r=void 0,a()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(a())return;let w;const N=n===0?e.initialPromise:void 0;try{w=N??e.fn()}catch(k){w=Promise.reject(k)}Promise.resolve(w).then(p).catch(k=>{var P;if(a())return;const j=e.retry??(Ai?0:3),C=e.retryDelay??IR,S=typeof C=="function"?C(n,k):C,E=j===!0||typeof j=="number"&&n<j||typeof j=="function"&&j(n,k);if(t||!E){g(k);return}n++,(P=e.onFail)==null||P.call(e,n,k),ER(S).then(()=>f()?void 0:y()).then(()=>{t?g(k):b()})})};return{promise:o,status:()=>o.status,cancel:l,continue:()=>(r==null||r(),o),cancelRetry:u,continueRetry:d,canStart:m,start:()=>(m()?b():y().then(b),o)}}var xi,Z2,f_=(Z2=class{constructor(){Ve(this,xi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),dv(this.gcTime)&&Se(this,xi,fi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ai?1/0:300*1e3))}clearGcTimeout(){G(this,xi)&&(fi.clearTimeout(G(this,xi)),Se(this,xi,void 0))}},xi=new WeakMap,Z2),yi,ql,Or,vi,hn,yd,bi,Jr,oo,J2,LR=(J2=class extends f_{constructor(t){super();Ve(this,Jr);Ve(this,yi);Ve(this,ql);Ve(this,Or);Ve(this,vi);Ve(this,hn);Ve(this,yd);Ve(this,bi);Se(this,bi,!1),Se(this,yd,t.defaultOptions),this.setOptions(t.options),this.observers=[],Se(this,vi,t.client),Se(this,Or,G(this,vi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Se(this,yi,Qj(this.options)),this.state=t.state??G(this,yi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=G(this,hn))==null?void 0:t.promise}setOptions(t){if(this.options={...G(this,yd),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Qj(this.options);n.data!==void 0&&(this.setState(Yj(n.data,n.dataUpdatedAt)),Se(this,yi,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&G(this,Or).remove(this)}setData(t,n){const r=hv(this.state.data,t,this.options);return rt(this,Jr,oo).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){rt(this,Jr,oo).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=G(this,hn))==null?void 0:r.promise;return(o=G(this,hn))==null||o.cancel(t),n?n.then(Ln).catch(Ln):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(G(this,yi))}isActive(){return this.observers.some(t=>Ir(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Y0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>pa(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!i_(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=G(this,hn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=G(this,hn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),G(this,Or).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(G(this,hn)&&(G(this,bi)?G(this,hn).cancel({revert:!0}):G(this,hn).cancelRetry()),this.scheduleGc()),G(this,Or).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||rt(this,Jr,oo).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,m,p,g,y,b,w,N,k,j,C;if(this.state.fetchStatus!=="idle"&&((d=G(this,hn))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(G(this,hn))return G(this,hn).continueRetry(),G(this,hn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(E=>E.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(Se(this,bi,!0),r.signal)})},a=()=>{const S=c_(this.options,n),P=(()=>{const D={client:G(this,vi),queryKey:this.queryKey,meta:this.meta};return o(D),D})();return Se(this,bi,!1),this.options.persister?this.options.persister(S,P,this):S(P)},u=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:G(this,vi),state:this.state,fetchFn:a};return o(S),S})();(f=this.options.behavior)==null||f.onFetch(u,this),Se(this,ql,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=u.fetchOptions)==null?void 0:m.meta))&&rt(this,Jr,oo).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),Se(this,hn,d_({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:S=>{S instanceof pv&&S.revert&&this.setState({...G(this,ql),fetchStatus:"idle"}),r.abort()},onFail:(S,E)=>{rt(this,Jr,oo).call(this,{type:"failed",failureCount:S,error:E})},onPause:()=>{rt(this,Jr,oo).call(this,{type:"pause"})},onContinue:()=>{rt(this,Jr,oo).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const S=await G(this,hn).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(y=(g=G(this,Or).config).onSuccess)==null||y.call(g,S,this),(w=(b=G(this,Or).config).onSettled)==null||w.call(b,S,this.state.error,this),S}catch(S){if(S instanceof pv){if(S.silent)return G(this,hn).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw rt(this,Jr,oo).call(this,{type:"error",error:S}),(k=(N=G(this,Or).config).onError)==null||k.call(N,S,this),(C=(j=G(this,Or).config).onSettled)==null||C.call(j,this.state.data,S,this),S}finally{this.scheduleGc()}}},yi=new WeakMap,ql=new WeakMap,Or=new WeakMap,vi=new WeakMap,hn=new WeakMap,yd=new WeakMap,bi=new WeakMap,Jr=new WeakSet,oo=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...h_(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,...Yj(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,ql,t.manual?o:void 0),o;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),on.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),G(this,Or).notify({query:this,type:"updated",action:t})})},J2);function h_(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:u_(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Yj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Qj(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Jn,it,vd,In,wi,Kl,ao,aa,bd,Yl,Ql,Ni,ji,ia,Gl,xt,Eu,gv,xv,yv,vv,bv,wv,Nv,p_,e_,m_=(e_=class extends yc{constructor(t,n){super();Ve(this,xt);Ve(this,Jn);Ve(this,it);Ve(this,vd);Ve(this,In);Ve(this,wi);Ve(this,Kl);Ve(this,ao);Ve(this,aa);Ve(this,bd);Ve(this,Yl);Ve(this,Ql);Ve(this,Ni);Ve(this,ji);Ve(this,ia);Ve(this,Gl,new Set);this.options=n,Se(this,Jn,t),Se(this,aa,null),Se(this,ao,mv()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(G(this,it).addObserver(this),Gj(G(this,it),this.options)?rt(this,xt,Eu).call(this):this.updateResult(),rt(this,xt,vv).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return jv(G(this,it),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jv(G(this,it),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,rt(this,xt,bv).call(this),rt(this,xt,wv).call(this),G(this,it).removeObserver(this)}setOptions(t){const n=this.options,r=G(this,it);if(this.options=G(this,Jn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ir(this.options.enabled,G(this,it))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");rt(this,xt,Nv).call(this),G(this,it).setOptions(this.options),n._defaulted&&!cm(this.options,n)&&G(this,Jn).getQueryCache().notify({type:"observerOptionsUpdated",query:G(this,it),observer:this});const o=this.hasListeners();o&&Xj(G(this,it),r,this.options,n)&&rt(this,xt,Eu).call(this),this.updateResult(),o&&(G(this,it)!==r||Ir(this.options.enabled,G(this,it))!==Ir(n.enabled,G(this,it))||pa(this.options.staleTime,G(this,it))!==pa(n.staleTime,G(this,it)))&&rt(this,xt,gv).call(this);const a=rt(this,xt,xv).call(this);o&&(G(this,it)!==r||Ir(this.options.enabled,G(this,it))!==Ir(n.enabled,G(this,it))||a!==G(this,ia))&&rt(this,xt,yv).call(this,a)}getOptimisticResult(t){const n=G(this,Jn).getQueryCache().build(G(this,Jn),t),r=this.createResult(n,t);return $R(this,r)&&(Se(this,In,r),Se(this,Kl,this.options),Se(this,wi,G(this,it).state)),r}getCurrentResult(){return G(this,In)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&G(this,ao).status==="pending"&&G(this,ao).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(t){G(this,Gl).add(t)}getCurrentQuery(){return G(this,it)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=G(this,Jn).defaultQueryOptions(t),r=G(this,Jn).getQueryCache().build(G(this,Jn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return rt(this,xt,Eu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),G(this,In)))}createResult(t,n){var z;const r=G(this,it),o=this.options,a=G(this,In),l=G(this,wi),u=G(this,Kl),f=t!==r?t.state:G(this,vd),{state:m}=t;let p={...m},g=!1,y;if(n._optimisticResults){const K=this.hasListeners(),q=!K&&Gj(t,n),H=K&&Xj(t,r,n,o);(q||H)&&(p={...p,...h_(m.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:N}=p;y=p.data;let k=!1;if(n.placeholderData!==void 0&&y===void 0&&N==="pending"){let K;a!=null&&a.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(K=a.data,k=!0):K=typeof n.placeholderData=="function"?n.placeholderData((z=G(this,Ql))==null?void 0:z.state.data,G(this,Ql)):n.placeholderData,K!==void 0&&(N="success",y=hv(a==null?void 0:a.data,K,n),g=!0)}if(n.select&&y!==void 0&&!k)if(a&&y===(l==null?void 0:l.data)&&n.select===G(this,bd))y=G(this,Yl);else try{Se(this,bd,n.select),y=n.select(y),y=hv(a==null?void 0:a.data,y,n),Se(this,Yl,y),Se(this,aa,null)}catch(K){Se(this,aa,K)}G(this,aa)&&(b=G(this,aa),y=G(this,Yl),w=Date.now(),N="error");const j=p.fetchStatus==="fetching",C=N==="pending",S=N==="error",E=C&&j,P=y!==void 0,I={status:N,fetchStatus:p.fetchStatus,isPending:C,isSuccess:N==="success",isError:S,isInitialLoading:E,isLoading:E,data:y,dataUpdatedAt:p.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:j,isRefetching:j&&!C,isLoadingError:S&&!P,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:S&&P,isStale:X0(t,n),refetch:this.refetch,promise:G(this,ao),isEnabled:Ir(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const K=I.data!==void 0,q=I.status==="error"&&!K,H=M=>{q?M.reject(I.error):K&&M.resolve(I.data)},B=()=>{const M=Se(this,ao,I.promise=mv());H(M)},R=G(this,ao);switch(R.status){case"pending":t.queryHash===r.queryHash&&H(R);break;case"fulfilled":(q||I.data!==R.value)&&B();break;case"rejected":(!q||I.error!==R.reason)&&B();break}}return I}updateResult(){const t=G(this,In),n=this.createResult(G(this,it),this.options);if(Se(this,wi,G(this,it).state),Se(this,Kl,this.options),G(this,wi).data!==void 0&&Se(this,Ql,G(this,it)),cm(n,t))return;Se(this,In,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!G(this,Gl).size)return!0;const l=new Set(a??G(this,Gl));return this.options.throwOnError&&l.add("error"),Object.keys(G(this,In)).some(u=>{const d=u;return G(this,In)[d]!==t[d]&&l.has(d)})};rt(this,xt,p_).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&rt(this,xt,vv).call(this)}},Jn=new WeakMap,it=new WeakMap,vd=new WeakMap,In=new WeakMap,wi=new WeakMap,Kl=new WeakMap,ao=new WeakMap,aa=new WeakMap,bd=new WeakMap,Yl=new WeakMap,Ql=new WeakMap,Ni=new WeakMap,ji=new WeakMap,ia=new WeakMap,Gl=new WeakMap,xt=new WeakSet,Eu=function(t){rt(this,xt,Nv).call(this);let n=G(this,it).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ln)),n},gv=function(){rt(this,xt,bv).call(this);const t=pa(this.options.staleTime,G(this,it));if(Ai||G(this,In).isStale||!dv(t))return;const r=i_(G(this,In).dataUpdatedAt,t)+1;Se(this,Ni,fi.setTimeout(()=>{G(this,In).isStale||this.updateResult()},r))},xv=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(G(this,it)):this.options.refetchInterval)??!1},yv=function(t){rt(this,xt,wv).call(this),Se(this,ia,t),!(Ai||Ir(this.options.enabled,G(this,it))===!1||!dv(G(this,ia))||G(this,ia)===0)&&Se(this,ji,fi.setInterval(()=>{(this.options.refetchIntervalInBackground||G0.isFocused())&&rt(this,xt,Eu).call(this)},G(this,ia)))},vv=function(){rt(this,xt,gv).call(this),rt(this,xt,yv).call(this,rt(this,xt,xv).call(this))},bv=function(){G(this,Ni)&&(fi.clearTimeout(G(this,Ni)),Se(this,Ni,void 0))},wv=function(){G(this,ji)&&(fi.clearInterval(G(this,ji)),Se(this,ji,void 0))},Nv=function(){const t=G(this,Jn).getQueryCache().build(G(this,Jn),this.options);if(t===G(this,it))return;const n=G(this,it);Se(this,it,t),Se(this,vd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},p_=function(t){on.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(G(this,In))}),G(this,Jn).getQueryCache().notify({query:G(this,it),type:"observerResultsUpdated"})})},e_);function FR(e,t){return Ir(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Gj(e,t){return FR(e,t)||e.state.data!==void 0&&jv(e,t,t.refetchOnMount)}function jv(e,t,n){if(Ir(t.enabled,e)!==!1&&pa(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&X0(e,t)}return!1}function Xj(e,t,n,r){return(e!==t||Ir(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&X0(e,n)}function X0(e,t){return Ir(t.enabled,e)!==!1&&e.isStaleByTime(pa(t.staleTime,e))}function $R(e,t){return!cm(e.getCurrentResult(),t)}function dm(e){return{onFetch:(t,n)=>{var m,p,g,y,b;const r=t.options,o=(g=(p=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:p.fetchMore)==null?void 0:g.direction,a=((y=t.state.data)==null?void 0:y.pages)||[],l=((b=t.state.data)==null?void 0:b.pageParams)||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let w=!1;const N=C=>{MR(C,()=>t.signal,()=>w=!0)},k=c_(t.options,t.fetchOptions),j=async(C,S,E)=>{if(w)return Promise.reject();if(S==null&&C.pages.length)return Promise.resolve(C);const D=(()=>{const q={client:t.client,queryKey:t.queryKey,pageParam:S,direction:E?"backward":"forward",meta:t.options.meta};return N(q),q})(),I=await k(D),{maxPages:z}=t.options,K=E?TR:PR;return{pages:K(C.pages,I,z),pageParams:K(C.pageParams,S,z)}};if(o&&a.length){const C=o==="backward",S=C?g_:Cv,E={pages:a,pageParams:l},P=S(r,E);u=await j(E,P,C)}else{const C=e??a.length;do{const S=d===0?l[0]??r.initialPageParam:Cv(r,u);if(d>0&&S==null)break;u=await j(u,S),d++}while(d<C)}return u};t.options.persister?t.fetchFn=()=>{var w,N;return(N=(w=t.options).persister)==null?void 0:N.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Cv(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function g_(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function VR(e,t){return t?Cv(e,t)!=null:!1}function zR(e,t){return!t||!e.getPreviousPageParam?!1:g_(e,t)!=null}var BR=class extends m_{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:dm()})}getOptimisticResult(e){return e.behavior=dm(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var b,w;const{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:a,isError:l,isRefetchError:u}=r,d=(w=(b=n.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:w.direction,f=l&&d==="forward",m=o&&d==="forward",p=l&&d==="backward",g=o&&d==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:VR(t,n.data),hasPreviousPage:zR(t,n.data),isFetchNextPageError:f,isFetchingNextPage:m,isFetchPreviousPageError:p,isFetchingPreviousPage:g,isRefetchError:u&&!f&&!p,isRefetching:a&&!m&&!g}}},wd,Ss,Mn,Ci,_s,Zo,t_,WR=(t_=class extends f_{constructor(t){super();Ve(this,_s);Ve(this,wd);Ve(this,Ss);Ve(this,Mn);Ve(this,Ci);Se(this,wd,t.client),this.mutationId=t.mutationId,Se(this,Mn,t.mutationCache),Se(this,Ss,[]),this.state=t.state||x_(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){G(this,Ss).includes(t)||(G(this,Ss).push(t),this.clearGcTimeout(),G(this,Mn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Se(this,Ss,G(this,Ss).filter(n=>n!==t)),this.scheduleGc(),G(this,Mn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){G(this,Ss).length||(this.state.status==="pending"?this.scheduleGc():G(this,Mn).remove(this))}continue(){var t;return((t=G(this,Ci))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,u,d,f,m,p,g,y,b,w,N,k,j,C,S,E,P,D;const n=()=>{rt(this,_s,Zo).call(this,{type:"continue"})},r={client:G(this,wd),meta:this.options.meta,mutationKey:this.options.mutationKey};Se(this,Ci,d_({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(I,z)=>{rt(this,_s,Zo).call(this,{type:"failed",failureCount:I,error:z})},onPause:()=>{rt(this,_s,Zo).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>G(this,Mn).canRun(this)}));const o=this.state.status==="pending",a=!G(this,Ci).canStart();try{if(o)n();else{rt(this,_s,Zo).call(this,{type:"pending",variables:t,isPaused:a}),G(this,Mn).config.onMutate&&await G(this,Mn).config.onMutate(t,this,r);const z=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,r));z!==this.state.context&&rt(this,_s,Zo).call(this,{type:"pending",context:z,variables:t,isPaused:a})}const I=await G(this,Ci).start();return await((f=(d=G(this,Mn).config).onSuccess)==null?void 0:f.call(d,I,t,this.state.context,this,r)),await((p=(m=this.options).onSuccess)==null?void 0:p.call(m,I,t,this.state.context,r)),await((y=(g=G(this,Mn).config).onSettled)==null?void 0:y.call(g,I,null,this.state.variables,this.state.context,this,r)),await((w=(b=this.options).onSettled)==null?void 0:w.call(b,I,null,t,this.state.context,r)),rt(this,_s,Zo).call(this,{type:"success",data:I}),I}catch(I){try{await((k=(N=G(this,Mn).config).onError)==null?void 0:k.call(N,I,t,this.state.context,this,r))}catch(z){Promise.reject(z)}try{await((C=(j=this.options).onError)==null?void 0:C.call(j,I,t,this.state.context,r))}catch(z){Promise.reject(z)}try{await((E=(S=G(this,Mn).config).onSettled)==null?void 0:E.call(S,void 0,I,this.state.variables,this.state.context,this,r))}catch(z){Promise.reject(z)}try{await((D=(P=this.options).onSettled)==null?void 0:D.call(P,void 0,I,t,this.state.context,r))}catch(z){Promise.reject(z)}throw rt(this,_s,Zo).call(this,{type:"error",error:I}),I}finally{G(this,Mn).runNext(this)}}},wd=new WeakMap,Ss=new WeakMap,Mn=new WeakMap,Ci=new WeakMap,_s=new WeakSet,Zo=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),on.batch(()=>{G(this,Ss).forEach(r=>{r.onMutationUpdate(t)}),G(this,Mn).notify({mutation:this,type:"updated",action:t})})},t_);function x_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var io,es,Nd,n_,HR=(n_=class extends yc{constructor(t={}){super();Ve(this,io);Ve(this,es);Ve(this,Nd);this.config=t,Se(this,io,new Set),Se(this,es,new Map),Se(this,Nd,0)}build(t,n,r){const o=new WR({client:t,mutationCache:this,mutationId:++sh(this,Nd)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){G(this,io).add(t);const n=ah(t);if(typeof n=="string"){const r=G(this,es).get(n);r?r.push(t):G(this,es).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(G(this,io).delete(t)){const n=ah(t);if(typeof n=="string"){const r=G(this,es).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&G(this,es).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ah(t);if(typeof n=="string"){const r=G(this,es).get(n),o=r==null?void 0:r.find(a=>a.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=ah(t);if(typeof n=="string"){const o=(r=G(this,es).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){on.batch(()=>{G(this,io).forEach(t=>{this.notify({type:"removed",mutation:t})}),G(this,io).clear(),G(this,es).clear()})}getAll(){return Array.from(G(this,io))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Uj(n,r))}findAll(t={}){return this.getAll().filter(n=>Uj(t,n))}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return on.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ln))))}},io=new WeakMap,es=new WeakMap,Nd=new WeakMap,n_);function ah(e){var t;return(t=e.options.scope)==null?void 0:t.id}var lo,la,er,co,po,Lh,kv,r_,UR=(r_=class extends yc{constructor(n,r){super();Ve(this,po);Ve(this,lo);Ve(this,la);Ve(this,er);Ve(this,co);Se(this,lo,n),this.setOptions(r),this.bindMethods(),rt(this,po,Lh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=G(this,lo).defaultMutationOptions(n),cm(this.options,r)||G(this,lo).getMutationCache().notify({type:"observerOptionsUpdated",mutation:G(this,er),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Di(r.mutationKey)!==Di(this.options.mutationKey)?this.reset():((o=G(this,er))==null?void 0:o.state.status)==="pending"&&G(this,er).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=G(this,er))==null||n.removeObserver(this)}onMutationUpdate(n){rt(this,po,Lh).call(this),rt(this,po,kv).call(this,n)}getCurrentResult(){return G(this,la)}reset(){var n;(n=G(this,er))==null||n.removeObserver(this),Se(this,er,void 0),rt(this,po,Lh).call(this),rt(this,po,kv).call(this)}mutate(n,r){var o;return Se(this,co,r),(o=G(this,er))==null||o.removeObserver(this),Se(this,er,G(this,lo).getMutationCache().build(G(this,lo),this.options)),G(this,er).addObserver(this),G(this,er).execute(n)}},lo=new WeakMap,la=new WeakMap,er=new WeakMap,co=new WeakMap,po=new WeakSet,Lh=function(){var r;const n=((r=G(this,er))==null?void 0:r.state)??x_();Se(this,la,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},kv=function(n){on.batch(()=>{var r,o,a,l,u,d,f,m;if(G(this,co)&&this.hasListeners()){const p=G(this,la).variables,g=G(this,la).context,y={client:G(this,lo),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(o=(r=G(this,co)).onSuccess)==null||o.call(r,n.data,p,g,y)}catch(b){Promise.reject(b)}try{(l=(a=G(this,co)).onSettled)==null||l.call(a,n.data,null,p,g,y)}catch(b){Promise.reject(b)}}else if((n==null?void 0:n.type)==="error"){try{(d=(u=G(this,co)).onError)==null||d.call(u,n.error,p,g,y)}catch(b){Promise.reject(b)}try{(m=(f=G(this,co)).onSettled)==null||m.call(f,void 0,n.error,p,g,y)}catch(b){Promise.reject(b)}}}this.listeners.forEach(p=>{p(G(this,la))})})},r_),Es,s_,qR=(s_=class extends yc{constructor(t={}){super();Ve(this,Es);this.config=t,Se(this,Es,new Map)}build(t,n,r){const o=n.queryKey,a=n.queryHash??K0(o,n);let l=this.get(a);return l||(l=new LR({client:t,queryKey:o,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(l)),l}add(t){G(this,Es).has(t.queryHash)||(G(this,Es).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=G(this,Es).get(t.queryHash);n&&(t.destroy(),n===t&&G(this,Es).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){on.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return G(this,Es).get(t)}getAll(){return[...G(this,Es).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Hj(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Hj(t,r)):n}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){on.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Es=new WeakMap,s_),zt,ca,ua,Xl,Zl,da,Jl,ec,o_,KR=(o_=class{constructor(e={}){Ve(this,zt);Ve(this,ca);Ve(this,ua);Ve(this,Xl);Ve(this,Zl);Ve(this,da);Ve(this,Jl);Ve(this,ec);Se(this,zt,e.queryCache||new qR),Se(this,ca,e.mutationCache||new HR),Se(this,ua,e.defaultOptions||{}),Se(this,Xl,new Map),Se(this,Zl,new Map),Se(this,da,0)}mount(){sh(this,da)._++,G(this,da)===1&&(Se(this,Jl,G0.subscribe(async e=>{e&&(await this.resumePausedMutations(),G(this,zt).onFocus())})),Se(this,ec,um.subscribe(async e=>{e&&(await this.resumePausedMutations(),G(this,zt).onOnline())})))}unmount(){var e,t;sh(this,da)._--,G(this,da)===0&&((e=G(this,Jl))==null||e.call(this),Se(this,Jl,void 0),(t=G(this,ec))==null||t.call(this),Se(this,ec,void 0))}isFetching(e){return G(this,zt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return G(this,ca).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=G(this,zt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=G(this,zt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pa(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return G(this,zt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=G(this,zt).get(r.queryHash),a=o==null?void 0:o.state.data,l=SR(t,a);if(l!==void 0)return G(this,zt).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return on.batch(()=>G(this,zt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=G(this,zt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=G(this,zt);on.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=G(this,zt);return on.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=on.batch(()=>G(this,zt).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Ln).catch(Ln)}invalidateQueries(e,t={}){return on.batch(()=>(G(this,zt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=on.batch(()=>G(this,zt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let a=o.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ln)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ln)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=G(this,zt).build(this,t);return n.isStaleByTime(pa(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ln).catch(Ln)}fetchInfiniteQuery(e){return e.behavior=dm(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ln).catch(Ln)}ensureInfiniteQueryData(e){return e.behavior=dm(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return um.isOnline()?G(this,ca).resumePausedMutations():Promise.resolve()}getQueryCache(){return G(this,zt)}getMutationCache(){return G(this,ca)}getDefaultOptions(){return G(this,ua)}setDefaultOptions(e){Se(this,ua,e)}setQueryDefaults(e,t){G(this,Xl).set(Di(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...G(this,Xl).values()],n={};return t.forEach(r=>{Uu(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){G(this,Zl).set(Di(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...G(this,Zl).values()],n={};return t.forEach(r=>{Uu(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...G(this,ua).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=K0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Y0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...G(this,ua).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){G(this,zt).clear(),G(this,ca).clear()}},zt=new WeakMap,ca=new WeakMap,ua=new WeakMap,Xl=new WeakMap,Zl=new WeakMap,da=new WeakMap,Jl=new WeakMap,ec=new WeakMap,o_),y_=x.createContext(void 0),ze=e=>{const t=x.useContext(y_);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},YR=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(y_.Provider,{value:e,children:t})),v_=x.createContext(!1),QR=()=>x.useContext(v_);v_.Provider;function GR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var XR=x.createContext(GR()),ZR=()=>x.useContext(XR),JR=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Q0(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},eO=e=>{x.useEffect(()=>{e.clearReset()},[e])},tO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Q0(n,[e.error,r])),nO=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},rO=(e,t)=>e.isLoading&&e.isFetching&&!t,sO=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function b_(e,t,n){var g,y,b,w;const r=QR(),o=ZR(),a=ze(),l=a.defaultQueryOptions(e);(y=(g=a.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||y.call(g,l);const u=a.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",nO(l),JR(l,o,u),eO(o);const d=!a.getQueryCache().get(l.queryHash),[f]=x.useState(()=>new t(a,l)),m=f.getOptimisticResult(l),p=!r&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(N=>{const k=p?f.subscribe(on.batchCalls(N)):Ln;return f.updateResult(),k},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),x.useEffect(()=>{f.setOptions(l)},[l,f]),sO(l,m))throw Zj(l,f,o);if(tO({result:m,errorResetBoundary:o,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw m.error;if((w=(b=a.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||w.call(b,l,m),l.experimental_prefetchInRender&&!Ai&&rO(m,r)){const N=d?Zj(l,f,o):u==null?void 0:u.promise;N==null||N.catch(Ln).finally(()=>{f.updateResult()})}return l.notifyOnChangeProps?m:f.trackResult(m)}function St(e,t){return b_(e,m_)}function Fe(e,t){const n=ze(),[r]=x.useState(()=>new UR(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);const o=x.useSyncExternalStore(x.useCallback(l=>r.subscribe(on.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((l,u)=>{r.mutate(l,u).catch(Ln)},[r]);if(o.error&&Q0(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:a,mutateAsync:o.mutate}}function oO(e,t){return b_(e,BR)}var vc=a_();const w_=Jm(vc);/**
|
|
41
|
+
* @remix-run/router v1.23.2
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/function qu(){return qu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qu.apply(this,arguments)}var fa;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(fa||(fa={}));const Jj="popstate";function aO(e){e===void 0&&(e={});function t(r,o){let{pathname:a,search:l,hash:u}=r.location;return Sv("",{pathname:a,search:l,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:fm(o)}return lO(t,n,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Z0(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function iO(){return Math.random().toString(36).substr(2,8)}function eC(e,t){return{usr:e.state,key:e.key,idx:t}}function Sv(e,t,n,r){return n===void 0&&(n=null),qu({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?bc(t):t,{state:n,key:t&&t.key||r||iO()})}function fm(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function bc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function lO(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:a=!1}=r,l=o.history,u=fa.Pop,d=null,f=m();f==null&&(f=0,l.replaceState(qu({},l.state,{idx:f}),""));function m(){return(l.state||{idx:null}).idx}function p(){u=fa.Pop;let N=m(),k=N==null?null:N-f;f=N,d&&d({action:u,location:w.location,delta:k})}function g(N,k){u=fa.Push;let j=Sv(w.location,N,k);f=m()+1;let C=eC(j,f),S=w.createHref(j);try{l.pushState(C,"",S)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;o.location.assign(S)}a&&d&&d({action:u,location:w.location,delta:1})}function y(N,k){u=fa.Replace;let j=Sv(w.location,N,k);f=m();let C=eC(j,f),S=w.createHref(j);l.replaceState(C,"",S),a&&d&&d({action:u,location:w.location,delta:0})}function b(N){let k=o.location.origin!=="null"?o.location.origin:o.location.href,j=typeof N=="string"?N:fm(N);return j=j.replace(/ $/,"%20"),Qt(k,"No window.location.(origin|href) available to create URL for href: "+j),new URL(j,k)}let w={get action(){return u},get location(){return e(o,l)},listen(N){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(Jj,p),d=N,()=>{o.removeEventListener(Jj,p),d=null}},createHref(N){return t(o,N)},createURL:b,encodeLocation(N){let k=b(N);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(N){return l.go(N)}};return w}var tC;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(tC||(tC={}));function cO(e,t,n){return n===void 0&&(n="/"),uO(e,t,n)}function uO(e,t,n,r){let o=typeof t=="string"?bc(t):t,a=J0(o.pathname||"/",n);if(a==null)return null;let l=N_(e);dO(l);let u=null;for(let d=0;u==null&&d<l.length;++d){let f=jO(a);u=bO(l[d],f)}return u}function N_(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let o=(a,l,u)=>{let d={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};d.relativePath.startsWith("/")&&(Qt(d.relativePath.startsWith(r),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(r.length));let f=ga([r,d.relativePath]),m=n.concat(d);a.children&&a.children.length>0&&(Qt(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),N_(a.children,t,m,f)),!(a.path==null&&!a.index)&&t.push({path:f,score:yO(f,a.index),routesMeta:m})};return e.forEach((a,l)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))o(a,l);else for(let d of j_(a.path))o(a,l,d)}),t}function j_(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let l=j_(r.join("/")),u=[];return u.push(...l.map(d=>d===""?a:[a,d].join("/"))),o&&u.push(...l),u.map(d=>e.startsWith("/")&&d===""?"/":d)}function dO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:vO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const fO=/^:[\w-]+$/,hO=3,mO=2,pO=1,gO=10,xO=-2,nC=e=>e==="*";function yO(e,t){let n=e.split("/"),r=n.length;return n.some(nC)&&(r+=xO),t&&(r+=mO),n.filter(o=>!nC(o)).reduce((o,a)=>o+(fO.test(a)?hO:a===""?pO:gO),r)}function vO(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function bO(e,t,n){let{routesMeta:r}=e,o={},a="/",l=[];for(let u=0;u<r.length;++u){let d=r[u],f=u===r.length-1,m=a==="/"?t:t.slice(a.length)||"/",p=wO({path:d.relativePath,caseSensitive:d.caseSensitive,end:f},m),g=d.route;if(!p)return null;Object.assign(o,p.params),l.push({params:o,pathname:ga([a,p.pathname]),pathnameBase:EO(ga([a,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(a=ga([a,p.pathnameBase]))}return l}function wO(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=NO(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],l=a.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:r.reduce((f,m,p)=>{let{paramName:g,isOptional:y}=m;if(g==="*"){let w=u[p]||"";l=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const b=u[p];return y&&!b?f[g]=void 0:f[g]=(b||"").replace(/%2F/g,"/"),f},{}),pathname:a,pathnameBase:l,pattern:e}}function NO(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Z0(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,d)=>(r.push({paramName:u,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function jO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Z0(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function J0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const CO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kO=e=>CO.test(e);function SO(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?bc(e):e,a;if(n)if(kO(n))a=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Z0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?a=rC(n.substring(1),"/"):a=rC(n,t)}else a=t;return{pathname:a,search:PO(r),hash:TO(o)}}function rC(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Jx(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function _O(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function eb(e,t){let n=_O(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function tb(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=bc(e):(o=qu({},e),Qt(!o.pathname||!o.pathname.includes("?"),Jx("?","pathname","search",o)),Qt(!o.pathname||!o.pathname.includes("#"),Jx("#","pathname","hash",o)),Qt(!o.search||!o.search.includes("#"),Jx("#","search","hash",o)));let a=e===""||o.pathname==="",l=a?"/":o.pathname,u;if(l==null)u=n;else{let p=t.length-1;if(!r&&l.startsWith("..")){let g=l.split("/");for(;g[0]==="..";)g.shift(),p-=1;o.pathname=g.join("/")}u=p>=0?t[p]:"/"}let d=SO(o,u),f=l&&l!=="/"&&l.endsWith("/"),m=(a||l===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(f||m)&&(d.pathname+="/"),d}const ga=e=>e.join("/").replace(/\/\/+/g,"/"),EO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),PO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,TO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function MO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const C_=["post","put","patch","delete"];new Set(C_);const AO=["get",...C_];new Set(AO);/**
|
|
50
|
+
* React Router v6.30.3
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/function Ku(){return Ku=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ku.apply(this,arguments)}const nb=x.createContext(null),DO=x.createContext(null),Ta=x.createContext(null),tp=x.createContext(null),Ma=x.createContext({outlet:null,matches:[],isDataRoute:!1}),k_=x.createContext(null);function RO(e,t){let{relative:n}=t===void 0?{}:t;wc()||Qt(!1);let{basename:r,navigator:o}=x.useContext(Ta),{hash:a,pathname:l,search:u}=__(e,{relative:n}),d=l;return r!=="/"&&(d=l==="/"?r:ga([r,l])),o.createHref({pathname:d,search:u,hash:a})}function wc(){return x.useContext(tp)!=null}function Cr(){return wc()||Qt(!1),x.useContext(tp).location}function S_(e){x.useContext(Ta).static||x.useLayoutEffect(e)}function Cn(){let{isDataRoute:e}=x.useContext(Ma);return e?KO():OO()}function OO(){wc()||Qt(!1);let e=x.useContext(nb),{basename:t,future:n,navigator:r}=x.useContext(Ta),{matches:o}=x.useContext(Ma),{pathname:a}=Cr(),l=JSON.stringify(eb(o,n.v7_relativeSplatPath)),u=x.useRef(!1);return S_(()=>{u.current=!0}),x.useCallback(function(f,m){if(m===void 0&&(m={}),!u.current)return;if(typeof f=="number"){r.go(f);return}let p=tb(f,JSON.parse(l),a,m.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:ga([t,p.pathname])),(m.replace?r.replace:r.push)(p,m.state,m)},[t,r,l,a,e])}function __(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=x.useContext(Ta),{matches:o}=x.useContext(Ma),{pathname:a}=Cr(),l=JSON.stringify(eb(o,r.v7_relativeSplatPath));return x.useMemo(()=>tb(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function IO(e,t){return LO(e,t)}function LO(e,t,n,r){wc()||Qt(!1);let{navigator:o}=x.useContext(Ta),{matches:a}=x.useContext(Ma),l=a[a.length-1],u=l?l.params:{};l&&l.pathname;let d=l?l.pathnameBase:"/";l&&l.route;let f=Cr(),m;if(t){var p;let N=typeof t=="string"?bc(t):t;d==="/"||(p=N.pathname)!=null&&p.startsWith(d)||Qt(!1),m=N}else m=f;let g=m.pathname||"/",y=g;if(d!=="/"){let N=d.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(N.length).join("/")}let b=cO(e,{pathname:y}),w=BO(b&&b.map(N=>Object.assign({},N,{params:Object.assign({},u,N.params),pathname:ga([d,o.encodeLocation?o.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?d:ga([d,o.encodeLocation?o.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),a,n,r);return t&&w?x.createElement(tp.Provider,{value:{location:Ku({pathname:"/",search:"",hash:"",state:null,key:"default"},m),navigationType:fa.Pop}},w):w}function FO(){let e=qO(),t=MO(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:o},n):null,null)}const $O=x.createElement(FO,null);class VO extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(Ma.Provider,{value:this.props.routeContext},x.createElement(k_.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function zO(e){let{routeContext:t,match:n,children:r}=e,o=x.useContext(nb);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(Ma.Provider,{value:t},r)}function BO(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,u=(o=n)==null?void 0:o.errors;if(u!=null){let m=l.findIndex(p=>p.route.id&&(u==null?void 0:u[p.route.id])!==void 0);m>=0||Qt(!1),l=l.slice(0,Math.min(l.length,m+1))}let d=!1,f=-1;if(n&&r&&r.v7_partialHydration)for(let m=0;m<l.length;m++){let p=l[m];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=m),p.route.id){let{loaderData:g,errors:y}=n,b=p.route.loader&&g[p.route.id]===void 0&&(!y||y[p.route.id]===void 0);if(p.route.lazy||b){d=!0,f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}return l.reduceRight((m,p,g)=>{let y,b=!1,w=null,N=null;n&&(y=u&&p.route.id?u[p.route.id]:void 0,w=p.route.errorElement||$O,d&&(f<0&&g===0?(YO("route-fallback"),b=!0,N=null):f===g&&(b=!0,N=p.route.hydrateFallbackElement||null)));let k=t.concat(l.slice(0,g+1)),j=()=>{let C;return y?C=w:b?C=N:p.route.Component?C=x.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=m,x.createElement(zO,{match:p,routeContext:{outlet:m,matches:k,isDataRoute:n!=null},children:C})};return n&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?x.createElement(VO,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:j(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):j()},null)}var E_=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(E_||{}),P_=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(P_||{});function WO(e){let t=x.useContext(nb);return t||Qt(!1),t}function HO(e){let t=x.useContext(DO);return t||Qt(!1),t}function UO(e){let t=x.useContext(Ma);return t||Qt(!1),t}function T_(e){let t=UO(),n=t.matches[t.matches.length-1];return n.route.id||Qt(!1),n.route.id}function qO(){var e;let t=x.useContext(k_),n=HO(),r=T_();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function KO(){let{router:e}=WO(E_.UseNavigateStable),t=T_(P_.UseNavigateStable),n=x.useRef(!1);return S_(()=>{n.current=!0}),x.useCallback(function(o,a){a===void 0&&(a={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Ku({fromRouteId:t},a)))},[e,t])}const sC={};function YO(e,t,n){sC[e]||(sC[e]=!0)}function QO(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function ui(e){let{to:t,replace:n,state:r,relative:o}=e;wc()||Qt(!1);let{future:a,static:l}=x.useContext(Ta),{matches:u}=x.useContext(Ma),{pathname:d}=Cr(),f=Cn(),m=tb(t,eb(u,a.v7_relativeSplatPath),d,o==="path"),p=JSON.stringify(m);return x.useEffect(()=>f(JSON.parse(p),{replace:n,state:r,relative:o}),[f,p,o,n,r]),null}function ft(e){Qt(!1)}function GO(e){let{basename:t="/",children:n=null,location:r,navigationType:o=fa.Pop,navigator:a,static:l=!1,future:u}=e;wc()&&Qt(!1);let d=t.replace(/^\/*/,"/"),f=x.useMemo(()=>({basename:d,navigator:a,static:l,future:Ku({v7_relativeSplatPath:!1},u)}),[d,u,a,l]);typeof r=="string"&&(r=bc(r));let{pathname:m="/",search:p="",hash:g="",state:y=null,key:b="default"}=r,w=x.useMemo(()=>{let N=J0(m,d);return N==null?null:{location:{pathname:N,search:p,hash:g,state:y,key:b},navigationType:o}},[d,m,p,g,y,b,o]);return w==null?null:x.createElement(Ta.Provider,{value:f},x.createElement(tp.Provider,{children:n,value:w}))}function rb(e){let{children:t,location:n}=e;return IO(_v(t),n)}new Promise(()=>{});function _v(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,o)=>{if(!x.isValidElement(r))return;let a=[...t,o];if(r.type===x.Fragment){n.push.apply(n,_v(r.props.children,a));return}r.type!==ft&&Qt(!1),!r.props.index||!r.props.children||Qt(!1);let l={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=_v(r.props.children,a)),n.push(l)}),n}/**
|
|
59
|
+
* React Router DOM v6.30.3
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Remix Software Inc.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
65
|
+
*
|
|
66
|
+
* @license MIT
|
|
67
|
+
*/function Ev(){return Ev=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ev.apply(this,arguments)}function XO(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function ZO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JO(e,t){return e.button===0&&(!t||t==="_self")&&!ZO(e)}function Pv(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function eI(e,t){let n=Pv(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(a=>{n.append(o,a)})}),n}const tI=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],nI="6";try{window.__reactRouterVersion=nI}catch{}const rI="startTransition",oC=ep[rI];function sI(e){let{basename:t,children:n,future:r,window:o}=e,a=x.useRef();a.current==null&&(a.current=aO({window:o,v5Compat:!0}));let l=a.current,[u,d]=x.useState({action:l.action,location:l.location}),{v7_startTransition:f}=r||{},m=x.useCallback(p=>{f&&oC?oC(()=>d(p)):d(p)},[d,f]);return x.useLayoutEffect(()=>l.listen(m),[l,m]),x.useEffect(()=>QO(r),[r]),x.createElement(GO,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:l,future:r})}const oI=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aI=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hr=x.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:a,replace:l,state:u,target:d,to:f,preventScrollReset:m,viewTransition:p}=t,g=XO(t,tI),{basename:y}=x.useContext(Ta),b,w=!1;if(typeof f=="string"&&aI.test(f)&&(b=f,oI))try{let C=new URL(window.location.href),S=f.startsWith("//")?new URL(C.protocol+f):new URL(f),E=J0(S.pathname,y);S.origin===C.origin&&E!=null?f=E+S.search+S.hash:w=!0}catch{}let N=RO(f,{relative:o}),k=iI(f,{replace:l,state:u,target:d,preventScrollReset:m,relative:o,viewTransition:p});function j(C){r&&r(C),C.defaultPrevented||k(C)}return x.createElement("a",Ev({},g,{href:b||N,onClick:w||a?r:j,ref:n,target:d}))});var aC;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(aC||(aC={}));var iC;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(iC||(iC={}));function iI(e,t){let{target:n,replace:r,state:o,preventScrollReset:a,relative:l,viewTransition:u}=t===void 0?{}:t,d=Cn(),f=Cr(),m=__(e,{relative:l});return x.useCallback(p=>{if(JO(p,n)){p.preventDefault();let g=r!==void 0?r:fm(f)===fm(m);d(e,{replace:g,state:o,preventScrollReset:a,relative:l,viewTransition:u})}},[f,d,m,r,o,n,e,a,l,u])}function M_(e){let t=x.useRef(Pv(e)),n=x.useRef(!1),r=Cr(),o=x.useMemo(()=>eI(r.search,n.current?null:t.current),[r.search]),a=Cn(),l=x.useCallback((u,d)=>{const f=Pv(typeof u=="function"?u(o):u);n.current=!0,a("?"+f,d)},[a,o]);return[o,l]}var lI=e=>{switch(e){case"success":return dI;case"info":return hI;case"warning":return fI;case"error":return mI;default:return null}},cI=Array(12).fill(0),uI=({visible:e,className:t})=>be.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},be.createElement("div",{className:"sonner-spinner"},cI.map((n,r)=>be.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),dI=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),fI=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),hI=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),mI=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),pI=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},be.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),be.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),gI=()=>{let[e,t]=be.useState(document.hidden);return be.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Tv=1,xI=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,o=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Tv++,a=this.toasts.find(u=>u.id===o),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(u=>u.id===o?(this.publish({...u,...e,id:o,title:n}),{...u,...e,id:o,dismissible:l,title:n}):u):this.addToast({title:n,...r,dismissible:l,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),o=n!==void 0,a,l=r.then(async d=>{if(a=["resolve",d],be.isValidElement(d))o=!1,this.create({id:n,type:"default",message:d});else if(vI(d)&&!d.ok){o=!1;let f=typeof t.error=="function"?await t.error(`HTTP error! status: ${d.status}`):t.error,m=typeof t.description=="function"?await t.description(`HTTP error! status: ${d.status}`):t.description;this.create({id:n,type:"error",message:f,description:m})}else if(t.success!==void 0){o=!1;let f=typeof t.success=="function"?await t.success(d):t.success,m=typeof t.description=="function"?await t.description(d):t.description;this.create({id:n,type:"success",message:f,description:m})}}).catch(async d=>{if(a=["reject",d],t.error!==void 0){o=!1;let f=typeof t.error=="function"?await t.error(d):t.error,m=typeof t.description=="function"?await t.description(d):t.description;this.create({id:n,type:"error",message:f,description:m})}}).finally(()=>{var d;o&&(this.dismiss(n),n=void 0),(d=t.finally)==null||d.call(t)}),u=()=>new Promise((d,f)=>l.then(()=>a[0]==="reject"?f(a[1]):d(a[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:u}:Object.assign(n,{unwrap:u})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Tv++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},tr=new xI,yI=(e,t)=>{let n=(t==null?void 0:t.id)||Tv++;return tr.addToast({title:e,...t,id:n}),n},vI=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",bI=yI,wI=()=>tr.toasts,NI=()=>tr.getActiveToasts();Object.assign(bI,{success:tr.success,info:tr.info,warning:tr.warning,error:tr.error,custom:tr.custom,message:tr.message,promise:tr.promise,dismiss:tr.dismiss,loading:tr.loading},{getHistory:wI,getToasts:NI});function jI(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}jI(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
68
|
+
`);function ih(e){return e.label!==void 0}var CI=3,kI="32px",SI="16px",lC=4e3,_I=356,EI=14,PI=20,TI=200;function Qr(...e){return e.filter(Boolean).join(" ")}function MI(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var AI=e=>{var t,n,r,o,a,l,u,d,f,m,p;let{invert:g,toast:y,unstyled:b,interacting:w,setHeights:N,visibleToasts:k,heights:j,index:C,toasts:S,expanded:E,removeToast:P,defaultRichColors:D,closeButton:I,style:z,cancelButtonStyle:K,actionButtonStyle:q,className:H="",descriptionClassName:B="",duration:R,position:M,gap:F,loadingIcon:L,expandByDefault:A,classNames:O,icons:U,closeButtonAriaLabel:V="Close toast",pauseWhenPageIsHidden:$}=e,[Y,X]=be.useState(null),[ne,ie]=be.useState(null),[J,re]=be.useState(!1),[ce,fe]=be.useState(!1),[pe,ye]=be.useState(!1),[Ne,Oe]=be.useState(!1),[Xe,Le]=be.useState(!1),[st,Nt]=be.useState(0),[ge,De]=be.useState(0),$e=be.useRef(y.duration||R||lC),et=be.useRef(null),tt=be.useRef(null),ht=C===0,te=C+1<=k,Ce=y.type,Ze=y.dismissible!==!1,at=y.className||"",oe=y.descriptionClassName||"",ke=be.useMemo(()=>j.findIndex(Ye=>Ye.toastId===y.id)||0,[j,y.id]),ue=be.useMemo(()=>{var Ye;return(Ye=y.closeButton)!=null?Ye:I},[y.closeButton,I]),yt=be.useMemo(()=>y.duration||R||lC,[y.duration,R]),Mt=be.useRef(0),pn=be.useRef(0),Un=be.useRef(0),ln=be.useRef(null),[zr,Br]=M.split("-"),xs=be.useMemo(()=>j.reduce((Ye,ut,vt)=>vt>=ke?Ye:Ye+ut.height,0),[j,ke]),ko=gI(),ys=y.invert||g,Sr=Ce==="loading";pn.current=be.useMemo(()=>ke*F+xs,[ke,xs]),be.useEffect(()=>{$e.current=yt},[yt]),be.useEffect(()=>{re(!0)},[]),be.useEffect(()=>{let Ye=tt.current;if(Ye){let ut=Ye.getBoundingClientRect().height;return De(ut),N(vt=>[{toastId:y.id,height:ut,position:y.position},...vt]),()=>N(vt=>vt.filter(gn=>gn.toastId!==y.id))}},[N,y.id]),be.useLayoutEffect(()=>{if(!J)return;let Ye=tt.current,ut=Ye.style.height;Ye.style.height="auto";let vt=Ye.getBoundingClientRect().height;Ye.style.height=ut,De(vt),N(gn=>gn.find(kn=>kn.toastId===y.id)?gn.map(kn=>kn.toastId===y.id?{...kn,height:vt}:kn):[{toastId:y.id,height:vt,position:y.position},...gn])},[J,y.title,y.description,N,y.id]);let ar=be.useCallback(()=>{fe(!0),Nt(pn.current),N(Ye=>Ye.filter(ut=>ut.toastId!==y.id)),setTimeout(()=>{P(y)},TI)},[y,P,N,pn]);be.useEffect(()=>{if(y.promise&&Ce==="loading"||y.duration===1/0||y.type==="loading")return;let Ye;return E||w||$&&ko?(()=>{if(Un.current<Mt.current){let ut=new Date().getTime()-Mt.current;$e.current=$e.current-ut}Un.current=new Date().getTime()})():$e.current!==1/0&&(Mt.current=new Date().getTime(),Ye=setTimeout(()=>{var ut;(ut=y.onAutoClose)==null||ut.call(y,y),ar()},$e.current)),()=>clearTimeout(Ye)},[E,w,y,Ce,$,ko,ar]),be.useEffect(()=>{y.delete&&ar()},[ar,y.delete]);function Ui(){var Ye,ut,vt;return U!=null&&U.loading?be.createElement("div",{className:Qr(O==null?void 0:O.loader,(Ye=y==null?void 0:y.classNames)==null?void 0:Ye.loader,"sonner-loader"),"data-visible":Ce==="loading"},U.loading):L?be.createElement("div",{className:Qr(O==null?void 0:O.loader,(ut=y==null?void 0:y.classNames)==null?void 0:ut.loader,"sonner-loader"),"data-visible":Ce==="loading"},L):be.createElement(uI,{className:Qr(O==null?void 0:O.loader,(vt=y==null?void 0:y.classNames)==null?void 0:vt.loader),visible:Ce==="loading"})}return be.createElement("li",{tabIndex:0,ref:tt,className:Qr(H,at,O==null?void 0:O.toast,(t=y==null?void 0:y.classNames)==null?void 0:t.toast,O==null?void 0:O.default,O==null?void 0:O[Ce],(n=y==null?void 0:y.classNames)==null?void 0:n[Ce]),"data-sonner-toast":"","data-rich-colors":(r=y.richColors)!=null?r:D,"data-styled":!(y.jsx||y.unstyled||b),"data-mounted":J,"data-promise":!!y.promise,"data-swiped":Xe,"data-removed":ce,"data-visible":te,"data-y-position":zr,"data-x-position":Br,"data-index":C,"data-front":ht,"data-swiping":pe,"data-dismissible":Ze,"data-type":Ce,"data-invert":ys,"data-swipe-out":Ne,"data-swipe-direction":ne,"data-expanded":!!(E||A&&J),style:{"--index":C,"--toasts-before":C,"--z-index":S.length-C,"--offset":`${ce?st:pn.current}px`,"--initial-height":A?"auto":`${ge}px`,...z,...y.style},onDragEnd:()=>{ye(!1),X(null),ln.current=null},onPointerDown:Ye=>{Sr||!Ze||(et.current=new Date,Nt(pn.current),Ye.target.setPointerCapture(Ye.pointerId),Ye.target.tagName!=="BUTTON"&&(ye(!0),ln.current={x:Ye.clientX,y:Ye.clientY}))},onPointerUp:()=>{var Ye,ut,vt,gn;if(Ne||!Ze)return;ln.current=null;let kn=Number(((Ye=tt.current)==null?void 0:Ye.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Sn=Number(((ut=tt.current)==null?void 0:ut.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ir=new Date().getTime()-((vt=et.current)==null?void 0:vt.getTime()),tn=Y==="x"?kn:Sn,_r=Math.abs(tn)/ir;if(Math.abs(tn)>=PI||_r>.11){Nt(pn.current),(gn=y.onDismiss)==null||gn.call(y,y),ie(Y==="x"?kn>0?"right":"left":Sn>0?"down":"up"),ar(),Oe(!0),Le(!1);return}ye(!1),X(null)},onPointerMove:Ye=>{var ut,vt,gn,kn;if(!ln.current||!Ze||((ut=window.getSelection())==null?void 0:ut.toString().length)>0)return;let Sn=Ye.clientY-ln.current.y,ir=Ye.clientX-ln.current.x,tn=(vt=e.swipeDirections)!=null?vt:MI(M);!Y&&(Math.abs(ir)>1||Math.abs(Sn)>1)&&X(Math.abs(ir)>Math.abs(Sn)?"x":"y");let _r={x:0,y:0};Y==="y"?(tn.includes("top")||tn.includes("bottom"))&&(tn.includes("top")&&Sn<0||tn.includes("bottom")&&Sn>0)&&(_r.y=Sn):Y==="x"&&(tn.includes("left")||tn.includes("right"))&&(tn.includes("left")&&ir<0||tn.includes("right")&&ir>0)&&(_r.x=ir),(Math.abs(_r.x)>0||Math.abs(_r.y)>0)&&Le(!0),(gn=tt.current)==null||gn.style.setProperty("--swipe-amount-x",`${_r.x}px`),(kn=tt.current)==null||kn.style.setProperty("--swipe-amount-y",`${_r.y}px`)}},ue&&!y.jsx?be.createElement("button",{"aria-label":V,"data-disabled":Sr,"data-close-button":!0,onClick:Sr||!Ze?()=>{}:()=>{var Ye;ar(),(Ye=y.onDismiss)==null||Ye.call(y,y)},className:Qr(O==null?void 0:O.closeButton,(o=y==null?void 0:y.classNames)==null?void 0:o.closeButton)},(a=U==null?void 0:U.close)!=null?a:pI):null,y.jsx||x.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:be.createElement(be.Fragment,null,Ce||y.icon||y.promise?be.createElement("div",{"data-icon":"",className:Qr(O==null?void 0:O.icon,(l=y==null?void 0:y.classNames)==null?void 0:l.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||Ui():null,y.type!=="loading"?y.icon||(U==null?void 0:U[Ce])||lI(Ce):null):null,be.createElement("div",{"data-content":"",className:Qr(O==null?void 0:O.content,(u=y==null?void 0:y.classNames)==null?void 0:u.content)},be.createElement("div",{"data-title":"",className:Qr(O==null?void 0:O.title,(d=y==null?void 0:y.classNames)==null?void 0:d.title)},typeof y.title=="function"?y.title():y.title),y.description?be.createElement("div",{"data-description":"",className:Qr(B,oe,O==null?void 0:O.description,(f=y==null?void 0:y.classNames)==null?void 0:f.description)},typeof y.description=="function"?y.description():y.description):null),x.isValidElement(y.cancel)?y.cancel:y.cancel&&ih(y.cancel)?be.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||K,onClick:Ye=>{var ut,vt;ih(y.cancel)&&Ze&&((vt=(ut=y.cancel).onClick)==null||vt.call(ut,Ye),ar())},className:Qr(O==null?void 0:O.cancelButton,(m=y==null?void 0:y.classNames)==null?void 0:m.cancelButton)},y.cancel.label):null,x.isValidElement(y.action)?y.action:y.action&&ih(y.action)?be.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||q,onClick:Ye=>{var ut,vt;ih(y.action)&&((vt=(ut=y.action).onClick)==null||vt.call(ut,Ye),!Ye.defaultPrevented&&ar())},className:Qr(O==null?void 0:O.actionButton,(p=y==null?void 0:y.classNames)==null?void 0:p.actionButton)},y.action.label):null))};function cC(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function DI(e,t){let n={};return[e,t].forEach((r,o)=>{let a=o===1,l=a?"--mobile-offset":"--offset",u=a?SI:kI;function d(f){["top","right","bottom","left"].forEach(m=>{n[`${l}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${l}-${f}`]=u:n[`${l}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):d(u)}),n}var RI=x.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:u,offset:d,mobileOffset:f,theme:m="light",richColors:p,duration:g,style:y,visibleToasts:b=CI,toastOptions:w,dir:N=cC(),gap:k=EI,loadingIcon:j,icons:C,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:E}=e,[P,D]=be.useState([]),I=be.useMemo(()=>Array.from(new Set([r].concat(P.filter($=>$.position).map($=>$.position)))),[P,r]),[z,K]=be.useState([]),[q,H]=be.useState(!1),[B,R]=be.useState(!1),[M,F]=be.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=be.useRef(null),A=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=be.useRef(null),U=be.useRef(!1),V=be.useCallback($=>{D(Y=>{var X;return(X=Y.find(ne=>ne.id===$.id))!=null&&X.delete||tr.dismiss($.id),Y.filter(({id:ne})=>ne!==$.id)})},[]);return be.useEffect(()=>tr.subscribe($=>{if($.dismiss){D(Y=>Y.map(X=>X.id===$.id?{...X,delete:!0}:X));return}setTimeout(()=>{w_.flushSync(()=>{D(Y=>{let X=Y.findIndex(ne=>ne.id===$.id);return X!==-1?[...Y.slice(0,X),{...Y[X],...$},...Y.slice(X+1)]:[$,...Y]})})})}),[]),be.useEffect(()=>{if(m!=="system"){F(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?F("dark"):F("light")),typeof window>"u")return;let $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:Y})=>{F(Y?"dark":"light")})}catch{$.addListener(({matches:X})=>{try{F(X?"dark":"light")}catch(ne){console.error(ne)}})}},[m]),be.useEffect(()=>{P.length<=1&&H(!1)},[P]),be.useEffect(()=>{let $=Y=>{var X,ne;o.every(ie=>Y[ie]||Y.code===ie)&&(H(!0),(X=L.current)==null||X.focus()),Y.code==="Escape"&&(document.activeElement===L.current||(ne=L.current)!=null&&ne.contains(document.activeElement))&&H(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[o]),be.useEffect(()=>{if(L.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,U.current=!1)}},[L.current]),be.createElement("section",{ref:t,"aria-label":`${S} ${A}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map(($,Y)=>{var X;let[ne,ie]=$.split("-");return P.length?be.createElement("ol",{key:$,dir:N==="auto"?cC():N,tabIndex:-1,ref:L,className:u,"data-sonner-toaster":!0,"data-theme":M,"data-y-position":ne,"data-lifted":q&&P.length>1&&!a,"data-x-position":ie,style:{"--front-toast-height":`${((X=z[0])==null?void 0:X.height)||0}px`,"--width":`${_I}px`,"--gap":`${k}px`,...y,...DI(d,f)},onBlur:J=>{U.current&&!J.currentTarget.contains(J.relatedTarget)&&(U.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||U.current||(U.current=!0,O.current=J.relatedTarget)},onMouseEnter:()=>H(!0),onMouseMove:()=>H(!0),onMouseLeave:()=>{B||H(!1)},onDragEnd:()=>H(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},P.filter(J=>!J.position&&Y===0||J.position===$).map((J,re)=>{var ce,fe;return be.createElement(AI,{key:J.id,icons:C,index:re,toast:J,defaultRichColors:p,duration:(ce=w==null?void 0:w.duration)!=null?ce:g,className:w==null?void 0:w.className,descriptionClassName:w==null?void 0:w.descriptionClassName,invert:n,visibleToasts:b,closeButton:(fe=w==null?void 0:w.closeButton)!=null?fe:l,interacting:B,position:$,style:w==null?void 0:w.style,unstyled:w==null?void 0:w.unstyled,classNames:w==null?void 0:w.classNames,cancelButtonStyle:w==null?void 0:w.cancelButtonStyle,actionButtonStyle:w==null?void 0:w.actionButtonStyle,removeToast:V,toasts:P.filter(pe=>pe.position==J.position),heights:z.filter(pe=>pe.position==J.position),setHeights:K,expandByDefault:a,gap:k,loadingIcon:j,expanded:q,pauseWhenPageIsHidden:E,swipeDirections:e.swipeDirections})})):null}))});const OI=({...e})=>s.jsx(RI,{theme:"dark",className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e}),II=1,LI=1e6;let ey=0;function FI(){return ey=(ey+1)%Number.MAX_SAFE_INTEGER,ey.toString()}const ty=new Map,uC=e=>{if(ty.has(e))return;const t=setTimeout(()=>{ty.delete(e),Ou({type:"REMOVE_TOAST",toastId:e})},LI);ty.set(e,t)},$I=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,II)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?uC(n):e.toasts.forEach(r=>{uC(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Fh=[];let $h={toasts:[]};function Ou(e){$h=$I($h,e),Fh.forEach(t=>{t($h)})}function de({...e}){const t=FI(),n=o=>Ou({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>Ou({type:"DISMISS_TOAST",toastId:t});return Ou({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function VI(){const[e,t]=x.useState($h);return x.useEffect(()=>(Fh.push(t),()=>{const n=Fh.indexOf(t);n>-1&&Fh.splice(n,1)}),[e]),{...e,toast:de,dismiss:n=>Ou({type:"DISMISS_TOAST",toastId:n})}}function Ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function dC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vr(...e){return t=>{let n=!1;const r=e.map(o=>{const a=dC(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():dC(e[o],null)}}}}function pt(...e){return x.useCallback(Vr(...e),e)}function zI(e,t){const n=x.createContext(t),r=a=>{const{children:l,...u}=a,d=x.useMemo(()=>u,Object.values(u));return s.jsx(n.Provider,{value:d,children:l})};r.displayName=e+"Provider";function o(a){const l=x.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,o]}function wo(e,t=[]){let n=[];function r(a,l){const u=x.createContext(l),d=n.length;n=[...n,l];const f=p=>{var k;const{scope:g,children:y,...b}=p,w=((k=g==null?void 0:g[e])==null?void 0:k[d])||u,N=x.useMemo(()=>b,Object.values(b));return s.jsx(w.Provider,{value:N,children:y})};f.displayName=a+"Provider";function m(p,g){var w;const y=((w=g==null?void 0:g[e])==null?void 0:w[d])||u,b=x.useContext(y);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[f,m]}const o=()=>{const a=n.map(l=>x.createContext(l));return function(u){const d=(u==null?void 0:u[e])||a;return x.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return o.scopeName=e,[r,BI(o,...t)]}function BI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=r.reduce((u,{useScope:d,scopeName:f})=>{const p=d(a)[`__scope${f}`];return{...u,...p}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function fC(e){const t=WI(e),n=x.forwardRef((r,o)=>{const{children:a,...l}=r,u=x.Children.toArray(a),d=u.find(UI);if(d){const f=d.props.children,m=u.map(p=>p===d?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:o,children:x.isValidElement(f)?x.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function WI(e){const t=x.forwardRef((n,r)=>{const{children:o,...a}=n;if(x.isValidElement(o)){const l=KI(o),u=qI(a,o.props);return o.type!==x.Fragment&&(u.ref=r?Vr(r,l):l),x.cloneElement(o,u)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var HI=Symbol("radix.slottable");function UI(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HI}function qI(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...u)=>{const d=a(...u);return o(...u),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function KI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function A_(e){const t=e+"CollectionProvider",[n,r]=wo(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:N,children:k}=w,j=be.useRef(null),C=be.useRef(new Map).current;return s.jsx(o,{scope:N,itemMap:C,collectionRef:j,children:k})};l.displayName=t;const u=e+"CollectionSlot",d=fC(u),f=be.forwardRef((w,N)=>{const{scope:k,children:j}=w,C=a(u,k),S=pt(N,C.collectionRef);return s.jsx(d,{ref:S,children:j})});f.displayName=u;const m=e+"CollectionItemSlot",p="data-radix-collection-item",g=fC(m),y=be.forwardRef((w,N)=>{const{scope:k,children:j,...C}=w,S=be.useRef(null),E=pt(N,S),P=a(m,k);return be.useEffect(()=>(P.itemMap.set(S,{ref:S,...C}),()=>void P.itemMap.delete(S))),s.jsx(g,{[p]:"",ref:E,children:j})});y.displayName=m;function b(w){const N=a(e+"CollectionConsumer",w);return be.useCallback(()=>{const j=N.collectionRef.current;if(!j)return[];const C=Array.from(j.querySelectorAll(`[${p}]`));return Array.from(N.itemMap.values()).sort((P,D)=>C.indexOf(P.ref.current)-C.indexOf(D.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:l,Slot:f,ItemSlot:y},b,r]}function YI(e){const t=QI(e),n=x.forwardRef((r,o)=>{const{children:a,...l}=r,u=x.Children.toArray(a),d=u.find(XI);if(d){const f=d.props.children,m=u.map(p=>p===d?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:o,children:x.isValidElement(f)?x.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function QI(e){const t=x.forwardRef((n,r)=>{const{children:o,...a}=n;if(x.isValidElement(o)){const l=JI(o),u=ZI(a,o.props);return o.type!==x.Fragment&&(u.ref=r?Vr(r,l):l),x.cloneElement(o,u)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var GI=Symbol("radix.slottable");function XI(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===GI}function ZI(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...u)=>{const d=a(...u);return o(...u),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function JI(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var eL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ge=eL.reduce((e,t)=>{const n=YI(`Primitive.${t}`),r=x.forwardRef((o,a)=>{const{asChild:l,...u}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...u,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function D_(e,t){e&&vc.flushSync(()=>e.dispatchEvent(t))}function is(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function tL(e,t=globalThis==null?void 0:globalThis.document){const n=is(e);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var nL="DismissableLayer",Mv="dismissableLayer.update",rL="dismissableLayer.pointerDownOutside",sL="dismissableLayer.focusOutside",hC,R_=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Nc=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...d}=e,f=x.useContext(R_),[m,p]=x.useState(null),g=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=x.useState({}),b=pt(t,D=>p(D)),w=Array.from(f.layers),[N]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),j=m?w.indexOf(m):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,S=j>=k,E=aL(D=>{const I=D.target,z=[...f.branches].some(K=>K.contains(I));!S||z||(o==null||o(D),l==null||l(D),D.defaultPrevented||u==null||u())},g),P=iL(D=>{const I=D.target;[...f.branches].some(K=>K.contains(I))||(a==null||a(D),l==null||l(D),D.defaultPrevented||u==null||u())},g);return tL(D=>{j===f.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&u&&(D.preventDefault(),u()))},g),x.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(hC=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),mC(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=hC)}},[m,g,n,f]),x.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),mC())},[m,f]),x.useEffect(()=>{const D=()=>y({});return document.addEventListener(Mv,D),()=>document.removeEventListener(Mv,D)},[]),s.jsx(Ge.div,{...d,ref:b,style:{pointerEvents:C?S?"auto":"none":void 0,...e.style},onFocusCapture:Ke(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ke(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ke(e.onPointerDownCapture,E.onPointerDownCapture)})});Nc.displayName=nL;var oL="DismissableLayerBranch",O_=x.forwardRef((e,t)=>{const n=x.useContext(R_),r=x.useRef(null),o=pt(t,r);return x.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(Ge.div,{...e,ref:o})});O_.displayName=oL;function aL(e,t=globalThis==null?void 0:globalThis.document){const n=is(e),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const a=u=>{if(u.target&&!r.current){let d=function(){I_(rL,n,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function iL(e,t=globalThis==null?void 0:globalThis.document){const n=is(e),r=x.useRef(!1);return x.useEffect(()=>{const o=a=>{a.target&&!r.current&&I_(sL,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mC(){const e=new CustomEvent(Mv);document.dispatchEvent(e)}function I_(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?D_(o,a):o.dispatchEvent(a)}var lL=Nc,cL=O_,jn=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},uL="Portal",Cd=x.forwardRef((e,t)=>{var u;const{container:n,...r}=e,[o,a]=x.useState(!1);jn(()=>a(!0),[]);const l=n||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?w_.createPortal(s.jsx(Ge.div,{...r,ref:t}),l):null});Cd.displayName=uL;function dL(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var No=e=>{const{present:t,children:n}=e,r=fL(t),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),a=pt(r.ref,hL(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:a}):null};No.displayName="Presence";function fL(e){const[t,n]=x.useState(),r=x.useRef(null),o=x.useRef(e),a=x.useRef("none"),l=e?"mounted":"unmounted",[u,d]=dL(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const f=lh(r.current);a.current=u==="mounted"?f:"none"},[u]),jn(()=>{const f=r.current,m=o.current;if(m!==e){const g=a.current,y=lh(f);e?d("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(m&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),jn(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,p=y=>{const w=lh(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&w&&(d("ANIMATION_END"),!o.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},g=y=>{y.target===t&&(a.current=lh(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:x.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function lh(e){return(e==null?void 0:e.animationName)||"none"}function hL(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mL=ep[" useInsertionEffect ".trim().toString()]||jn;function Ri({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,l]=pL({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:o;{const m=x.useRef(e!==void 0);x.useEffect(()=>{const p=m.current;p!==u&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=u},[u,r])}const f=x.useCallback(m=>{var p;if(u){const g=gL(m)?m(e):m;g!==e&&((p=l.current)==null||p.call(l,g))}else a(m)},[u,e,a,l]);return[d,f]}function pL({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),o=x.useRef(n),a=x.useRef(t);return mL(()=>{a.current=t},[t]),x.useEffect(()=>{var l;o.current!==n&&((l=a.current)==null||l.call(a,n),o.current=n)},[n,o]),[n,r,a]}function gL(e){return typeof e=="function"}var L_=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),xL="VisuallyHidden",np=x.forwardRef((e,t)=>s.jsx(Ge.span,{...e,ref:t,style:{...L_,...e.style}}));np.displayName=xL;var yL=np,sb="ToastProvider",[ob,vL,bL]=A_("Toast"),[F_]=wo("Toast",[bL]),[wL,rp]=F_(sb),$_=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:a=50,children:l}=e,[u,d]=x.useState(null),[f,m]=x.useState(0),p=x.useRef(!1),g=x.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${sb}\`. Expected non-empty \`string\`.`),s.jsx(ob.Provider,{scope:t,children:s.jsx(wL,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:a,toastCount:f,viewport:u,onViewportChange:d,onToastAdd:x.useCallback(()=>m(y=>y+1),[]),onToastRemove:x.useCallback(()=>m(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:g,children:l})})};$_.displayName=sb;var V_="ToastViewport",NL=["F8"],Av="toast.viewportPause",Dv="toast.viewportResume",z_=x.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=NL,label:o="Notifications ({hotkey})",...a}=e,l=rp(V_,n),u=vL(n),d=x.useRef(null),f=x.useRef(null),m=x.useRef(null),p=x.useRef(null),g=pt(t,p,l.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;x.useEffect(()=>{const N=k=>{var C;r.length!==0&&r.every(S=>k[S]||k.code===S)&&((C=p.current)==null||C.focus())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[r]),x.useEffect(()=>{const N=d.current,k=p.current;if(b&&N&&k){const j=()=>{if(!l.isClosePausedRef.current){const P=new CustomEvent(Av);k.dispatchEvent(P),l.isClosePausedRef.current=!0}},C=()=>{if(l.isClosePausedRef.current){const P=new CustomEvent(Dv);k.dispatchEvent(P),l.isClosePausedRef.current=!1}},S=P=>{!N.contains(P.relatedTarget)&&C()},E=()=>{N.contains(document.activeElement)||C()};return N.addEventListener("focusin",j),N.addEventListener("focusout",S),N.addEventListener("pointermove",j),N.addEventListener("pointerleave",E),window.addEventListener("blur",j),window.addEventListener("focus",C),()=>{N.removeEventListener("focusin",j),N.removeEventListener("focusout",S),N.removeEventListener("pointermove",j),N.removeEventListener("pointerleave",E),window.removeEventListener("blur",j),window.removeEventListener("focus",C)}}},[b,l.isClosePausedRef]);const w=x.useCallback(({tabbingDirection:N})=>{const j=u().map(C=>{const S=C.ref.current,E=[S,...OL(S)];return N==="forwards"?E:E.reverse()});return(N==="forwards"?j.reverse():j).flat()},[u]);return x.useEffect(()=>{const N=p.current;if(N){const k=j=>{var E,P,D;const C=j.altKey||j.ctrlKey||j.metaKey;if(j.key==="Tab"&&!C){const I=document.activeElement,z=j.shiftKey;if(j.target===N&&z){(E=f.current)==null||E.focus();return}const H=w({tabbingDirection:z?"backwards":"forwards"}),B=H.findIndex(R=>R===I);ny(H.slice(B+1))?j.preventDefault():z?(P=f.current)==null||P.focus():(D=m.current)==null||D.focus()}};return N.addEventListener("keydown",k),()=>N.removeEventListener("keydown",k)}},[u,w]),s.jsxs(cL,{ref:d,role:"region","aria-label":o.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&s.jsx(Rv,{ref:f,onFocusFromOutsideViewport:()=>{const N=w({tabbingDirection:"forwards"});ny(N)}}),s.jsx(ob.Slot,{scope:n,children:s.jsx(Ge.ol,{tabIndex:-1,...a,ref:g})}),b&&s.jsx(Rv,{ref:m,onFocusFromOutsideViewport:()=>{const N=w({tabbingDirection:"backwards"});ny(N)}})]})});z_.displayName=V_;var B_="ToastFocusProxy",Rv=x.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,a=rp(B_,n);return s.jsx(np,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:l=>{var f;const u=l.relatedTarget;!((f=a.viewport)!=null&&f.contains(u))&&r()}})});Rv.displayName=B_;var kd="Toast",jL="toast.swipeStart",CL="toast.swipeMove",kL="toast.swipeCancel",SL="toast.swipeEnd",W_=x.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:a,...l}=e,[u,d]=Ri({prop:r,defaultProp:o??!0,onChange:a,caller:kd});return s.jsx(No,{present:n||u,children:s.jsx(PL,{open:u,...l,ref:t,onClose:()=>d(!1),onPause:is(e.onPause),onResume:is(e.onResume),onSwipeStart:Ke(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ke(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Ke(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ke(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});W_.displayName=kd;var[_L,EL]=F_(kd,{onClose(){}}),PL=x.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:a,onClose:l,onEscapeKeyDown:u,onPause:d,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:g,onSwipeEnd:y,...b}=e,w=rp(kd,n),[N,k]=x.useState(null),j=pt(t,R=>k(R)),C=x.useRef(null),S=x.useRef(null),E=o||w.duration,P=x.useRef(0),D=x.useRef(E),I=x.useRef(0),{onToastAdd:z,onToastRemove:K}=w,q=is(()=>{var M;(N==null?void 0:N.contains(document.activeElement))&&((M=w.viewport)==null||M.focus()),l()}),H=x.useCallback(R=>{!R||R===1/0||(window.clearTimeout(I.current),P.current=new Date().getTime(),I.current=window.setTimeout(q,R))},[q]);x.useEffect(()=>{const R=w.viewport;if(R){const M=()=>{H(D.current),f==null||f()},F=()=>{const L=new Date().getTime()-P.current;D.current=D.current-L,window.clearTimeout(I.current),d==null||d()};return R.addEventListener(Av,F),R.addEventListener(Dv,M),()=>{R.removeEventListener(Av,F),R.removeEventListener(Dv,M)}}},[w.viewport,E,d,f,H]),x.useEffect(()=>{a&&!w.isClosePausedRef.current&&H(E)},[a,E,w.isClosePausedRef,H]),x.useEffect(()=>(z(),()=>K()),[z,K]);const B=x.useMemo(()=>N?G_(N):null,[N]);return w.viewport?s.jsxs(s.Fragment,{children:[B&&s.jsx(TL,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:B}),s.jsx(_L,{scope:n,onClose:q,children:vc.createPortal(s.jsx(ob.ItemSlot,{scope:n,children:s.jsx(lL,{asChild:!0,onEscapeKeyDown:Ke(u,()=>{w.isFocusedToastEscapeKeyDownRef.current||q(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(Ge.li,{tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":w.swipeDirection,...b,ref:j,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ke(e.onKeyDown,R=>{R.key==="Escape"&&(u==null||u(R.nativeEvent),R.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:Ke(e.onPointerDown,R=>{R.button===0&&(C.current={x:R.clientX,y:R.clientY})}),onPointerMove:Ke(e.onPointerMove,R=>{if(!C.current)return;const M=R.clientX-C.current.x,F=R.clientY-C.current.y,L=!!S.current,A=["left","right"].includes(w.swipeDirection),O=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,U=A?O(0,M):0,V=A?0:O(0,F),$=R.pointerType==="touch"?10:2,Y={x:U,y:V},X={originalEvent:R,delta:Y};L?(S.current=Y,ch(CL,p,X,{discrete:!1})):pC(Y,w.swipeDirection,$)?(S.current=Y,ch(jL,m,X,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(M)>$||Math.abs(F)>$)&&(C.current=null)}),onPointerUp:Ke(e.onPointerUp,R=>{const M=S.current,F=R.target;if(F.hasPointerCapture(R.pointerId)&&F.releasePointerCapture(R.pointerId),S.current=null,C.current=null,M){const L=R.currentTarget,A={originalEvent:R,delta:M};pC(M,w.swipeDirection,w.swipeThreshold)?ch(SL,y,A,{discrete:!0}):ch(kL,g,A,{discrete:!0}),L.addEventListener("click",O=>O.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),TL=e=>{const{__scopeToast:t,children:n,...r}=e,o=rp(kd,t),[a,l]=x.useState(!1),[u,d]=x.useState(!1);return DL(()=>l(!0)),x.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),u?null:s.jsx(Cd,{asChild:!0,children:s.jsx(np,{...r,children:a&&s.jsxs(s.Fragment,{children:[o.label," ",n]})})})},ML="ToastTitle",H_=x.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(Ge.div,{...r,ref:t})});H_.displayName=ML;var AL="ToastDescription",U_=x.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(Ge.div,{...r,ref:t})});U_.displayName=AL;var q_="ToastAction",K_=x.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?s.jsx(Q_,{altText:n,asChild:!0,children:s.jsx(ab,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${q_}\`. Expected non-empty \`string\`.`),null)});K_.displayName=q_;var Y_="ToastClose",ab=x.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=EL(Y_,n);return s.jsx(Q_,{asChild:!0,children:s.jsx(Ge.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,o.onClose)})})});ab.displayName=Y_;var Q_=x.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return s.jsx(Ge.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function G_(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),RL(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!o)if(a){const l=r.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...G_(r))}}),t}function ch(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?D_(o,a):o.dispatchEvent(a)}var pC=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),a=r>o;return t==="left"||t==="right"?a&&r>n:!a&&o>n};function DL(e=()=>{}){const t=is(e);jn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function RL(e){return e.nodeType===e.ELEMENT_NODE}function OL(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ny(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var IL=$_,X_=z_,Z_=W_,J_=H_,e5=U_,t5=K_,n5=ab;function r5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=r5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function s5(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=r5(e))&&(r&&(r+=" "),r+=t);return r}const gC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xC=s5,ib=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return xC(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:a}=t,l=Object.keys(o).map(f=>{const m=n==null?void 0:n[f],p=a==null?void 0:a[f];if(m===null)return null;const g=gC(m)||gC(p);return o[f][g]}),u=n&&Object.entries(n).reduce((f,m)=>{let[p,g]=m;return g===void 0||(f[p]=g),f},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:g,...y}=m;return Object.entries(y).every(b=>{let[w,N]=b;return Array.isArray(N)?N.includes({...a,...u}[w]):{...a,...u}[w]===N})?[...f,p,g]:f},[]);return xC(e,l,d,n==null?void 0:n.class,n==null?void 0:n.className)};/**
|
|
69
|
+
* @license lucide-react v0.468.0 - ISC
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the ISC license.
|
|
72
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/const LL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o5=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
74
|
+
* @license lucide-react v0.468.0 - ISC
|
|
75
|
+
*
|
|
76
|
+
* This source code is licensed under the ISC license.
|
|
77
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
+
*/var FL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
79
|
+
* @license lucide-react v0.468.0 - ISC
|
|
80
|
+
*
|
|
81
|
+
* This source code is licensed under the ISC license.
|
|
82
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
+
*/const $L=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:a,iconNode:l,...u},d)=>x.createElement("svg",{ref:d,...FL,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:o5("lucide",o),...u},[...l.map(([f,m])=>x.createElement(f,m)),...Array.isArray(a)?a:[a]]));/**
|
|
84
|
+
* @license lucide-react v0.468.0 - ISC
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the ISC license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/const ve=(e,t)=>{const n=x.forwardRef(({className:r,...o},a)=>x.createElement($L,{ref:a,iconNode:t,className:o5(`lucide-${LL(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
|
|
89
|
+
* @license lucide-react v0.468.0 - ISC
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the ISC license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/const tc=ve("Activity",[["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"}]]);/**
|
|
94
|
+
* @license lucide-react v0.468.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/const VL=ve("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
|
|
99
|
+
* @license lucide-react v0.468.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/const Il=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
104
|
+
* @license lucide-react v0.468.0 - ISC
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the ISC license.
|
|
107
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/const zL=ve("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
|
|
109
|
+
* @license lucide-react v0.468.0 - ISC
|
|
110
|
+
*
|
|
111
|
+
* This source code is licensed under the ISC license.
|
|
112
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
+
*/const Ov=ve("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
114
|
+
* @license lucide-react v0.468.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/const zn=ve("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
|
119
|
+
* @license lucide-react v0.468.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/const ki=ve("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
124
|
+
* @license lucide-react v0.468.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/const Yu=ve("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
|
|
129
|
+
* @license lucide-react v0.468.0 - ISC
|
|
130
|
+
*
|
|
131
|
+
* This source code is licensed under the ISC license.
|
|
132
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
+
*/const hm=ve("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
|
|
134
|
+
* @license lucide-react v0.468.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/const BL=ve("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/**
|
|
139
|
+
* @license lucide-react v0.468.0 - ISC
|
|
140
|
+
*
|
|
141
|
+
* This source code is licensed under the ISC license.
|
|
142
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
+
*/const Sd=ve("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
144
|
+
* @license lucide-react v0.468.0 - ISC
|
|
145
|
+
*
|
|
146
|
+
* This source code is licensed under the ISC license.
|
|
147
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
+
*/const a5=ve("ChartColumn",[["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"}]]);/**
|
|
149
|
+
* @license lucide-react v0.468.0 - ISC
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the ISC license.
|
|
152
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
+
*/const _d=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
154
|
+
* @license lucide-react v0.468.0 - ISC
|
|
155
|
+
*
|
|
156
|
+
* This source code is licensed under the ISC license.
|
|
157
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
+
*/const Wn=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
159
|
+
* @license lucide-react v0.468.0 - ISC
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the ISC license.
|
|
162
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/const Aa=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
164
|
+
* @license lucide-react v0.468.0 - ISC
|
|
165
|
+
*
|
|
166
|
+
* This source code is licensed under the ISC license.
|
|
167
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
+
*/const $s=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
169
|
+
* @license lucide-react v0.468.0 - ISC
|
|
170
|
+
*
|
|
171
|
+
* This source code is licensed under the ISC license.
|
|
172
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
+
*/const ms=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
174
|
+
* @license lucide-react v0.468.0 - ISC
|
|
175
|
+
*
|
|
176
|
+
* This source code is licensed under the ISC license.
|
|
177
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
+
*/const mm=ve("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
179
|
+
* @license lucide-react v0.468.0 - ISC
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the ISC license.
|
|
182
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/const Gt=ve("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
184
|
+
* @license lucide-react v0.468.0 - ISC
|
|
185
|
+
*
|
|
186
|
+
* This source code is licensed under the ISC license.
|
|
187
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
+
*/const yC=ve("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
189
|
+
* @license lucide-react v0.468.0 - ISC
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the ISC license.
|
|
192
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
+
*/const WL=ve("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
|
|
194
|
+
* @license lucide-react v0.468.0 - ISC
|
|
195
|
+
*
|
|
196
|
+
* This source code is licensed under the ISC license.
|
|
197
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
+
*/const Vs=ve("CircleX",[["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"}]]);/**
|
|
199
|
+
* @license lucide-react v0.468.0 - ISC
|
|
200
|
+
*
|
|
201
|
+
* This source code is licensed under the ISC license.
|
|
202
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
203
|
+
*/const pm=ve("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
204
|
+
* @license lucide-react v0.468.0 - ISC
|
|
205
|
+
*
|
|
206
|
+
* This source code is licensed under the ISC license.
|
|
207
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
+
*/const zs=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
209
|
+
* @license lucide-react v0.468.0 - ISC
|
|
210
|
+
*
|
|
211
|
+
* This source code is licensed under the ISC license.
|
|
212
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
+
*/const i5=ve("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
214
|
+
* @license lucide-react v0.468.0 - ISC
|
|
215
|
+
*
|
|
216
|
+
* This source code is licensed under the ISC license.
|
|
217
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
+
*/const l5=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
|
|
219
|
+
* @license lucide-react v0.468.0 - ISC
|
|
220
|
+
*
|
|
221
|
+
* This source code is licensed under the ISC license.
|
|
222
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
+
*/const c5=ve("Copy",[["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"}]]);/**
|
|
224
|
+
* @license lucide-react v0.468.0 - ISC
|
|
225
|
+
*
|
|
226
|
+
* This source code is licensed under the ISC license.
|
|
227
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
+
*/const u5=ve("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
|
|
229
|
+
* @license lucide-react v0.468.0 - ISC
|
|
230
|
+
*
|
|
231
|
+
* This source code is licensed under the ISC license.
|
|
232
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
233
|
+
*/const lb=ve("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
|
|
234
|
+
* @license lucide-react v0.468.0 - ISC
|
|
235
|
+
*
|
|
236
|
+
* This source code is licensed under the ISC license.
|
|
237
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
238
|
+
*/const d5=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
239
|
+
* @license lucide-react v0.468.0 - ISC
|
|
240
|
+
*
|
|
241
|
+
* This source code is licensed under the ISC license.
|
|
242
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
243
|
+
*/const f5=ve("Eye",[["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"}]]);/**
|
|
244
|
+
* @license lucide-react v0.468.0 - ISC
|
|
245
|
+
*
|
|
246
|
+
* This source code is licensed under the ISC license.
|
|
247
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
248
|
+
*/const cb=ve("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
|
|
249
|
+
* @license lucide-react v0.468.0 - ISC
|
|
250
|
+
*
|
|
251
|
+
* This source code is licensed under the ISC license.
|
|
252
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
253
|
+
*/const ls=ve("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
254
|
+
* @license lucide-react v0.468.0 - ISC
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the ISC license.
|
|
257
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
258
|
+
*/const HL=ve("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
259
|
+
* @license lucide-react v0.468.0 - ISC
|
|
260
|
+
*
|
|
261
|
+
* This source code is licensed under the ISC license.
|
|
262
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
263
|
+
*/const Qu=ve("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
|
|
264
|
+
* @license lucide-react v0.468.0 - ISC
|
|
265
|
+
*
|
|
266
|
+
* This source code is licensed under the ISC license.
|
|
267
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
268
|
+
*/const UL=ve("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
|
|
269
|
+
* @license lucide-react v0.468.0 - ISC
|
|
270
|
+
*
|
|
271
|
+
* This source code is licensed under the ISC license.
|
|
272
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
273
|
+
*/const h5=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
274
|
+
* @license lucide-react v0.468.0 - ISC
|
|
275
|
+
*
|
|
276
|
+
* This source code is licensed under the ISC license.
|
|
277
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
+
*/const sp=ve("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
|
|
279
|
+
* @license lucide-react v0.468.0 - ISC
|
|
280
|
+
*
|
|
281
|
+
* This source code is licensed under the ISC license.
|
|
282
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
283
|
+
*/const Ed=ve("Inbox",[["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"}]]);/**
|
|
284
|
+
* @license lucide-react v0.468.0 - ISC
|
|
285
|
+
*
|
|
286
|
+
* This source code is licensed under the ISC license.
|
|
287
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
288
|
+
*/const qL=ve("KeyRound",[["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"}]]);/**
|
|
289
|
+
* @license lucide-react v0.468.0 - ISC
|
|
290
|
+
*
|
|
291
|
+
* This source code is licensed under the ISC license.
|
|
292
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
293
|
+
*/const Iu=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
|
|
294
|
+
* @license lucide-react v0.468.0 - ISC
|
|
295
|
+
*
|
|
296
|
+
* This source code is licensed under the ISC license.
|
|
297
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
298
|
+
*/const m5=ve("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
299
|
+
* @license lucide-react v0.468.0 - ISC
|
|
300
|
+
*
|
|
301
|
+
* This source code is licensed under the ISC license.
|
|
302
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
303
|
+
*/const KL=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
|
|
304
|
+
* @license lucide-react v0.468.0 - ISC
|
|
305
|
+
*
|
|
306
|
+
* This source code is licensed under the ISC license.
|
|
307
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
308
|
+
*/const jc=ve("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
309
|
+
* @license lucide-react v0.468.0 - ISC
|
|
310
|
+
*
|
|
311
|
+
* This source code is licensed under the ISC license.
|
|
312
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
313
|
+
*/const Lu=ve("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
314
|
+
* @license lucide-react v0.468.0 - ISC
|
|
315
|
+
*
|
|
316
|
+
* This source code is licensed under the ISC license.
|
|
317
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
318
|
+
*/const YL=ve("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
|
|
319
|
+
* @license lucide-react v0.468.0 - ISC
|
|
320
|
+
*
|
|
321
|
+
* This source code is licensed under the ISC license.
|
|
322
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
323
|
+
*/const QL=ve("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
|
|
324
|
+
* @license lucide-react v0.468.0 - ISC
|
|
325
|
+
*
|
|
326
|
+
* This source code is licensed under the ISC license.
|
|
327
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
328
|
+
*/const Da=ve("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
329
|
+
* @license lucide-react v0.468.0 - ISC
|
|
330
|
+
*
|
|
331
|
+
* This source code is licensed under the ISC license.
|
|
332
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
333
|
+
*/const gr=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
334
|
+
* @license lucide-react v0.468.0 - ISC
|
|
335
|
+
*
|
|
336
|
+
* This source code is licensed under the ISC license.
|
|
337
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
338
|
+
*/const p5=ve("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
339
|
+
* @license lucide-react v0.468.0 - ISC
|
|
340
|
+
*
|
|
341
|
+
* This source code is licensed under the ISC license.
|
|
342
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
343
|
+
*/const GL=ve("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
344
|
+
* @license lucide-react v0.468.0 - ISC
|
|
345
|
+
*
|
|
346
|
+
* This source code is licensed under the ISC license.
|
|
347
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
348
|
+
*/const ho=ve("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
|
|
349
|
+
* @license lucide-react v0.468.0 - ISC
|
|
350
|
+
*
|
|
351
|
+
* This source code is licensed under the ISC license.
|
|
352
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
353
|
+
*/const os=ve("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
354
|
+
* @license lucide-react v0.468.0 - ISC
|
|
355
|
+
*
|
|
356
|
+
* This source code is licensed under the ISC license.
|
|
357
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
358
|
+
*/const XL=ve("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
|
|
359
|
+
* @license lucide-react v0.468.0 - ISC
|
|
360
|
+
*
|
|
361
|
+
* This source code is licensed under the ISC license.
|
|
362
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
363
|
+
*/const g5=ve("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
364
|
+
* @license lucide-react v0.468.0 - ISC
|
|
365
|
+
*
|
|
366
|
+
* This source code is licensed under the ISC license.
|
|
367
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
368
|
+
*/const Vh=ve("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/**
|
|
369
|
+
* @license lucide-react v0.468.0 - ISC
|
|
370
|
+
*
|
|
371
|
+
* This source code is licensed under the ISC license.
|
|
372
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
373
|
+
*/const ZL=ve("Palette",[["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:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
|
374
|
+
* @license lucide-react v0.468.0 - ISC
|
|
375
|
+
*
|
|
376
|
+
* This source code is licensed under the ISC license.
|
|
377
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
378
|
+
*/const JL=ve("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
379
|
+
* @license lucide-react v0.468.0 - ISC
|
|
380
|
+
*
|
|
381
|
+
* This source code is licensed under the ISC license.
|
|
382
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
383
|
+
*/const eF=ve("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
384
|
+
* @license lucide-react v0.468.0 - ISC
|
|
385
|
+
*
|
|
386
|
+
* This source code is licensed under the ISC license.
|
|
387
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
388
|
+
*/const x5=ve("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
|
|
389
|
+
* @license lucide-react v0.468.0 - ISC
|
|
390
|
+
*
|
|
391
|
+
* This source code is licensed under the ISC license.
|
|
392
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
393
|
+
*/const br=ve("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
394
|
+
* @license lucide-react v0.468.0 - ISC
|
|
395
|
+
*
|
|
396
|
+
* This source code is licensed under the ISC license.
|
|
397
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
398
|
+
*/const Gu=ve("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
|
|
399
|
+
* @license lucide-react v0.468.0 - ISC
|
|
400
|
+
*
|
|
401
|
+
* This source code is licensed under the ISC license.
|
|
402
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
403
|
+
*/const tF=ve("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/**
|
|
404
|
+
* @license lucide-react v0.468.0 - ISC
|
|
405
|
+
*
|
|
406
|
+
* This source code is licensed under the ISC license.
|
|
407
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
408
|
+
*/const wa=ve("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
409
|
+
* @license lucide-react v0.468.0 - ISC
|
|
410
|
+
*
|
|
411
|
+
* This source code is licensed under the ISC license.
|
|
412
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
413
|
+
*/const or=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
414
|
+
* @license lucide-react v0.468.0 - ISC
|
|
415
|
+
*
|
|
416
|
+
* This source code is licensed under the ISC license.
|
|
417
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
418
|
+
*/const Iv=ve("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
419
|
+
* @license lucide-react v0.468.0 - ISC
|
|
420
|
+
*
|
|
421
|
+
* This source code is licensed under the ISC license.
|
|
422
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
423
|
+
*/const Lv=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
|
424
|
+
* @license lucide-react v0.468.0 - ISC
|
|
425
|
+
*
|
|
426
|
+
* This source code is licensed under the ISC license.
|
|
427
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
428
|
+
*/const nF=ve("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/**
|
|
429
|
+
* @license lucide-react v0.468.0 - ISC
|
|
430
|
+
*
|
|
431
|
+
* This source code is licensed under the ISC license.
|
|
432
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
433
|
+
*/const rF=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
434
|
+
* @license lucide-react v0.468.0 - ISC
|
|
435
|
+
*
|
|
436
|
+
* This source code is licensed under the ISC license.
|
|
437
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
438
|
+
*/const Oi=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
439
|
+
* @license lucide-react v0.468.0 - ISC
|
|
440
|
+
*
|
|
441
|
+
* This source code is licensed under the ISC license.
|
|
442
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
443
|
+
*/const Lr=ve("Send",[["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"}]]);/**
|
|
444
|
+
* @license lucide-react v0.468.0 - ISC
|
|
445
|
+
*
|
|
446
|
+
* This source code is licensed under the ISC license.
|
|
447
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
448
|
+
*/const ub=ve("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
449
|
+
* @license lucide-react v0.468.0 - ISC
|
|
450
|
+
*
|
|
451
|
+
* This source code is licensed under the ISC license.
|
|
452
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
453
|
+
*/const sF=ve("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
454
|
+
* @license lucide-react v0.468.0 - ISC
|
|
455
|
+
*
|
|
456
|
+
* This source code is licensed under the ISC license.
|
|
457
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
458
|
+
*/const oF=ve("Shield",[["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"}]]);/**
|
|
459
|
+
* @license lucide-react v0.468.0 - ISC
|
|
460
|
+
*
|
|
461
|
+
* This source code is licensed under the ISC license.
|
|
462
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
463
|
+
*/const an=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
464
|
+
* @license lucide-react v0.468.0 - ISC
|
|
465
|
+
*
|
|
466
|
+
* This source code is licensed under the ISC license.
|
|
467
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
468
|
+
*/const aF=ve("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/**
|
|
469
|
+
* @license lucide-react v0.468.0 - ISC
|
|
470
|
+
*
|
|
471
|
+
* This source code is licensed under the ISC license.
|
|
472
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
473
|
+
*/const iF=ve("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
474
|
+
* @license lucide-react v0.468.0 - ISC
|
|
475
|
+
*
|
|
476
|
+
* This source code is licensed under the ISC license.
|
|
477
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
478
|
+
*/const lF=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
479
|
+
* @license lucide-react v0.468.0 - ISC
|
|
480
|
+
*
|
|
481
|
+
* This source code is licensed under the ISC license.
|
|
482
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
483
|
+
*/const y5=ve("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
|
|
484
|
+
* @license lucide-react v0.468.0 - ISC
|
|
485
|
+
*
|
|
486
|
+
* This source code is licensed under the ISC license.
|
|
487
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
488
|
+
*/const v5=ve("Sun",[["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"}]]);/**
|
|
489
|
+
* @license lucide-react v0.468.0 - ISC
|
|
490
|
+
*
|
|
491
|
+
* This source code is licensed under the ISC license.
|
|
492
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
493
|
+
*/const b5=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
|
|
494
|
+
* @license lucide-react v0.468.0 - ISC
|
|
495
|
+
*
|
|
496
|
+
* This source code is licensed under the ISC license.
|
|
497
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
498
|
+
*/const cF=ve("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
|
|
499
|
+
* @license lucide-react v0.468.0 - ISC
|
|
500
|
+
*
|
|
501
|
+
* This source code is licensed under the ISC license.
|
|
502
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
503
|
+
*/const Bn=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
504
|
+
* @license lucide-react v0.468.0 - ISC
|
|
505
|
+
*
|
|
506
|
+
* This source code is licensed under the ISC license.
|
|
507
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
508
|
+
*/const uF=ve("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
|
|
509
|
+
* @license lucide-react v0.468.0 - ISC
|
|
510
|
+
*
|
|
511
|
+
* This source code is licensed under the ISC license.
|
|
512
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
513
|
+
*/const Bs=ve("TriangleAlert",[["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"}]]);/**
|
|
514
|
+
* @license lucide-react v0.468.0 - ISC
|
|
515
|
+
*
|
|
516
|
+
* This source code is licensed under the ISC license.
|
|
517
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
518
|
+
*/const Na=ve("User",[["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"}]]);/**
|
|
519
|
+
* @license lucide-react v0.468.0 - ISC
|
|
520
|
+
*
|
|
521
|
+
* This source code is licensed under the ISC license.
|
|
522
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
523
|
+
*/const op=ve("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
|
|
524
|
+
* @license lucide-react v0.468.0 - ISC
|
|
525
|
+
*
|
|
526
|
+
* This source code is licensed under the ISC license.
|
|
527
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
528
|
+
*/const ja=ve("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
529
|
+
* @license lucide-react v0.468.0 - ISC
|
|
530
|
+
*
|
|
531
|
+
* This source code is licensed under the ISC license.
|
|
532
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
533
|
+
*/const dF=ve("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
534
|
+
* @license lucide-react v0.468.0 - ISC
|
|
535
|
+
*
|
|
536
|
+
* This source code is licensed under the ISC license.
|
|
537
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
538
|
+
*/const fF=ve("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
|
|
539
|
+
* @license lucide-react v0.468.0 - ISC
|
|
540
|
+
*
|
|
541
|
+
* This source code is licensed under the ISC license.
|
|
542
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
543
|
+
*/const gm=ve("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
544
|
+
* @license lucide-react v0.468.0 - ISC
|
|
545
|
+
*
|
|
546
|
+
* This source code is licensed under the ISC license.
|
|
547
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
548
|
+
*/const Ht=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
549
|
+
* @license lucide-react v0.468.0 - ISC
|
|
550
|
+
*
|
|
551
|
+
* This source code is licensed under the ISC license.
|
|
552
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
553
|
+
*/const Fu=ve("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),db="-",hF=e=>{const t=pF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const u=l.split(db);return u[0]===""&&u.length!==1&&u.shift(),w5(u,t)||mF(l)},getConflictingClassGroupIds:(l,u)=>{const d=n[l]||[];return u&&r[l]?[...d,...r[l]]:d}}},w5=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?w5(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(db);return(l=t.validators.find(({validator:u})=>u(a)))==null?void 0:l.classGroupId},vC=/^\[(.+)\]$/,mF=e=>{if(vC.test(e)){const t=vC.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},pF=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return xF(Object.entries(e.classGroups),n).forEach(([a,l])=>{Fv(l,r,a,t)}),r},Fv=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:bC(t,o);a.classGroupId=n;return}if(typeof o=="function"){if(gF(o)){Fv(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,l])=>{Fv(l,bC(t,a),n,r)})})},bC=(e,t)=>{let n=e;return t.split(db).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},gF=e=>e.isThemeGetter,xF=(e,t)=>t?e.map(([n,r])=>{const o=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([l,u])=>[t+l,u])):a);return[n,o]}):e,yF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(a,l)=>{n.set(a,l),t++,t>e&&(t=0,r=n,n=new Map)};return{get(a){let l=n.get(a);if(l!==void 0)return l;if((l=r.get(a))!==void 0)return o(a,l),l},set(a,l){n.has(a)?n.set(a,l):o(a,l)}}},N5="!",vF=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],a=t.length,l=u=>{const d=[];let f=0,m=0,p;for(let N=0;N<u.length;N++){let k=u[N];if(f===0){if(k===o&&(r||u.slice(N,N+a)===t)){d.push(u.slice(m,N)),m=N+a;continue}if(k==="/"){p=N;continue}}k==="["?f++:k==="]"&&f--}const g=d.length===0?u:u.substring(m),y=g.startsWith(N5),b=y?g.substring(1):g,w=p&&p>m?p-m:void 0;return{modifiers:d,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:w}};return n?u=>n({className:u,parseClassName:l}):l},bF=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},wF=e=>({cache:yF(e.cacheSize),parseClassName:vF(e),...hF(e)}),NF=/\s+/,jF=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=[],l=e.trim().split(NF);let u="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let b=!!y,w=r(b?g.substring(0,y):g);if(!w){if(!b){u=f+(u.length>0?" "+u:u);continue}if(w=r(g),!w){u=f+(u.length>0?" "+u:u);continue}b=!1}const N=bF(m).join(":"),k=p?N+N5:N,j=k+w;if(a.includes(j))continue;a.push(j);const C=o(w,b);for(let S=0;S<C.length;++S){const E=C[S];a.push(k+E)}u=f+(u.length>0?" "+u:u)}return u};function CF(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=j5(t))&&(r&&(r+=" "),r+=n);return r}const j5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=j5(e[r]))&&(n&&(n+=" "),n+=t);return n};function kF(e,...t){let n,r,o,a=l;function l(d){const f=t.reduce((m,p)=>p(m),e());return n=wF(f),r=n.cache.get,o=n.cache.set,a=u,u(d)}function u(d){const f=r(d);if(f)return f;const m=jF(d,n);return o(d,m),m}return function(){return a(CF.apply(null,arguments))}}const Tt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},C5=/^\[(?:([a-z-]+):)?(.+)\]$/i,SF=/^\d+\/\d+$/,_F=new Set(["px","full","screen"]),EF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,TF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,no=e=>Ll(e)||_F.has(e)||SF.test(e),Uo=e=>Cc(e,"length",VF),Ll=e=>!!e&&!Number.isNaN(Number(e)),ry=e=>Cc(e,"number",Ll),xu=e=>!!e&&Number.isInteger(Number(e)),DF=e=>e.endsWith("%")&&Ll(e.slice(0,-1)),nt=e=>C5.test(e),qo=e=>EF.test(e),RF=new Set(["length","size","percentage"]),OF=e=>Cc(e,RF,k5),IF=e=>Cc(e,"position",k5),LF=new Set(["image","url"]),FF=e=>Cc(e,LF,BF),$F=e=>Cc(e,"",zF),yu=()=>!0,Cc=(e,t,n)=>{const r=C5.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},VF=e=>PF.test(e)&&!TF.test(e),k5=()=>!1,zF=e=>MF.test(e),BF=e=>AF.test(e),WF=()=>{const e=Tt("colors"),t=Tt("spacing"),n=Tt("blur"),r=Tt("brightness"),o=Tt("borderColor"),a=Tt("borderRadius"),l=Tt("borderSpacing"),u=Tt("borderWidth"),d=Tt("contrast"),f=Tt("grayscale"),m=Tt("hueRotate"),p=Tt("invert"),g=Tt("gap"),y=Tt("gradientColorStops"),b=Tt("gradientColorStopPositions"),w=Tt("inset"),N=Tt("margin"),k=Tt("opacity"),j=Tt("padding"),C=Tt("saturate"),S=Tt("scale"),E=Tt("sepia"),P=Tt("skew"),D=Tt("space"),I=Tt("translate"),z=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",nt,t],H=()=>[nt,t],B=()=>["",no,Uo],R=()=>["auto",Ll,nt],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],L=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],O=()=>["","0",nt],U=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[Ll,nt];return{cacheSize:500,separator:":",theme:{colors:[yu],spacing:[no,Uo],blur:["none","",qo,nt],brightness:V(),borderColor:[e],borderRadius:["none","","full",qo,nt],borderSpacing:H(),borderWidth:B(),contrast:V(),grayscale:O(),hueRotate:V(),invert:O(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[DF,Uo],inset:q(),margin:q(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:O(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",nt]}],container:["container"],columns:[{columns:[qo]}],"break-after":[{"break-after":U()}],"break-before":[{"break-before":U()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),nt]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xu,nt]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",nt]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",xu,nt]}],"grid-cols":[{"grid-cols":[yu]}],"col-start-end":[{col:["auto",{span:["full",xu,nt]},nt]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[yu]}],"row-start-end":[{row:["auto",{span:[xu,nt]},nt]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",nt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",nt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[N]}],mx:[{mx:[N]}],my:[{my:[N]}],ms:[{ms:[N]}],me:[{me:[N]}],mt:[{mt:[N]}],mr:[{mr:[N]}],mb:[{mb:[N]}],ml:[{ml:[N]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",nt,t]}],"min-w":[{"min-w":[nt,t,"min","max","fit"]}],"max-w":[{"max-w":[nt,t,"none","full","min","max","fit","prose",{screen:[qo]},qo]}],h:[{h:[nt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[nt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[nt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[nt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",qo,Uo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ry]}],"font-family":[{font:[yu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",nt]}],"line-clamp":[{"line-clamp":["none",Ll,ry]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",no,nt]}],"list-image":[{"list-image":["none",nt]}],"list-style-type":[{list:["none","disc","decimal",nt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",no,Uo]}],"underline-offset":[{"underline-offset":["auto",no,nt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",nt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),IF]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",OF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},FF]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:F()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[no,nt]}],"outline-w":[{outline:[no,Uo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[no,Uo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",qo,$F]}],"shadow-color":[{shadow:[yu]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...L(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":L()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",qo,nt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",nt]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",nt]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",nt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[xu,nt]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",nt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",nt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",nt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[no,Uo,ry]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},HF=kF(WF);function Ie(...e){return HF(s5(e))}const UF=IL,S5=x.forwardRef(({className:e,...t},n)=>s.jsx(X_,{ref:n,className:Ie("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));S5.displayName=X_.displayName;const qF=ib("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),_5=x.forwardRef(({className:e,variant:t,...n},r)=>s.jsx(Z_,{ref:r,className:Ie(qF({variant:t}),e),...n}));_5.displayName=Z_.displayName;const KF=x.forwardRef(({className:e,...t},n)=>s.jsx(t5,{ref:n,className:Ie("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));KF.displayName=t5.displayName;const E5=x.forwardRef(({className:e,...t},n)=>s.jsx(n5,{ref:n,className:Ie("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:s.jsx(Ht,{className:"h-4 w-4"})}));E5.displayName=n5.displayName;const P5=x.forwardRef(({className:e,...t},n)=>s.jsx(J_,{ref:n,className:Ie("text-sm font-semibold",e),...t}));P5.displayName=J_.displayName;const T5=x.forwardRef(({className:e,...t},n)=>s.jsx(e5,{ref:n,className:Ie("text-sm opacity-90",e),...t}));T5.displayName=e5.displayName;function YF(){const{toasts:e}=VI();return s.jsxs(UF,{children:[e.map(function({id:t,title:n,description:r,action:o,...a}){return s.jsxs(_5,{...a,children:[s.jsxs("div",{className:"grid gap-1",children:[n&&s.jsx(P5,{children:n}),r&&s.jsx(T5,{children:r})]}),o,s.jsx(E5,{})]},t)}),s.jsx(S5,{})]})}var QF=ep[" useId ".trim().toString()]||(()=>{}),GF=0;function xr(e){const[t,n]=x.useState(QF());return jn(()=>{n(r=>r??String(GF++))},[e]),t?`radix-${t}`:""}const XF=["top","right","bottom","left"],Ca=Math.min,mr=Math.max,xm=Math.round,uh=Math.floor,Is=e=>({x:e,y:e}),ZF={left:"right",right:"left",bottom:"top",top:"bottom"};function $v(e,t,n){return mr(e,Ca(t,n))}function go(e,t){return typeof e=="function"?e(t):e}function xo(e){return e.split("-")[0]}function kc(e){return e.split("-")[1]}function fb(e){return e==="x"?"y":"x"}function hb(e){return e==="y"?"height":"width"}function Rs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function mb(e){return fb(Rs(e))}function JF(e,t,n){n===void 0&&(n=!1);const r=kc(e),o=mb(e),a=hb(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=ym(l)),[l,ym(l)]}function e6(e){const t=ym(e);return[Vv(e),t,Vv(t)]}function Vv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wC=["left","right"],NC=["right","left"],t6=["top","bottom"],n6=["bottom","top"];function r6(e,t,n){switch(e){case"top":case"bottom":return n?t?NC:wC:t?wC:NC;case"left":case"right":return t?t6:n6;default:return[]}}function s6(e,t,n,r){const o=kc(e);let a=r6(xo(e),n==="start",r);return o&&(a=a.map(l=>l+"-"+o),t&&(a=a.concat(a.map(Vv)))),a}function ym(e){const t=xo(e);return ZF[t]+e.slice(t.length)}function o6(e){return{top:0,right:0,bottom:0,left:0,...e}}function M5(e){return typeof e!="number"?o6(e):{top:e,right:e,bottom:e,left:e}}function vm(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function jC(e,t,n){let{reference:r,floating:o}=e;const a=Rs(t),l=mb(t),u=hb(l),d=xo(t),f=a==="y",m=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,g=r[u]/2-o[u]/2;let y;switch(d){case"top":y={x:m,y:r.y-o.height};break;case"bottom":y={x:m,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-o.width,y:p};break;default:y={x:r.x,y:r.y}}switch(kc(t)){case"start":y[l]-=g*(n&&f?-1:1);break;case"end":y[l]+=g*(n&&f?-1:1);break}return y}async function a6(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:a,rects:l,elements:u,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:p="floating",altBoundary:g=!1,padding:y=0}=go(t,e),b=M5(y),N=u[g?p==="floating"?"reference":"floating":p],k=vm(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(N)))==null||n?N:N.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:f,rootBoundary:m,strategy:d})),j=p==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),S=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},E=vm(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:j,offsetParent:C,strategy:d}):j);return{top:(k.top-E.top+b.top)/S.y,bottom:(E.bottom-k.bottom+b.bottom)/S.y,left:(k.left-E.left+b.left)/S.x,right:(E.right-k.right+b.right)/S.x}}const i6=50,l6=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:a6},d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:p}=jC(f,r,d),g=r,y=0;const b={};for(let w=0;w<a.length;w++){const N=a[w];if(!N)continue;const{name:k,fn:j}=N,{x:C,y:S,data:E,reset:P}=await j({x:m,y:p,initialPlacement:r,placement:g,strategy:o,middlewareData:b,rects:f,platform:u,elements:{reference:e,floating:t}});m=C??m,p=S??p,b[k]={...b[k],...E},P&&y<i6&&(y++,typeof P=="object"&&(P.placement&&(g=P.placement),P.rects&&(f=P.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):P.rects),{x:m,y:p}=jC(f,g,d)),w=-1)}return{x:m,y:p,placement:g,strategy:o,middlewareData:b}},c6=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:l,elements:u,middlewareData:d}=t,{element:f,padding:m=0}=go(e,t)||{};if(f==null)return{};const p=M5(m),g={x:n,y:r},y=mb(o),b=hb(y),w=await l.getDimensions(f),N=y==="y",k=N?"top":"left",j=N?"bottom":"right",C=N?"clientHeight":"clientWidth",S=a.reference[b]+a.reference[y]-g[y]-a.floating[b],E=g[y]-a.reference[y],P=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let D=P?P[C]:0;(!D||!await(l.isElement==null?void 0:l.isElement(P)))&&(D=u.floating[C]||a.floating[b]);const I=S/2-E/2,z=D/2-w[b]/2-1,K=Ca(p[k],z),q=Ca(p[j],z),H=K,B=D-w[b]-q,R=D/2-w[b]/2+I,M=$v(H,R,B),F=!d.arrow&&kc(o)!=null&&R!==M&&a.reference[b]/2-(R<H?K:q)-w[b]/2<0,L=F?R<H?R-H:R-B:0;return{[y]:g[y]+L,data:{[y]:M,centerOffset:R-M-L,...F&&{alignmentOffset:L}},reset:F}}}),u6=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:l,initialPlacement:u,platform:d,elements:f}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...N}=go(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const k=xo(o),j=Rs(u),C=xo(u)===u,S=await(d.isRTL==null?void 0:d.isRTL(f.floating)),E=g||(C||!w?[ym(u)]:e6(u)),P=b!=="none";!g&&P&&E.push(...s6(u,w,b,S));const D=[u,...E],I=await d.detectOverflow(t,N),z=[];let K=((r=a.flip)==null?void 0:r.overflows)||[];if(m&&z.push(I[k]),p){const R=JF(o,l,S);z.push(I[R[0]],I[R[1]])}if(K=[...K,{placement:o,overflows:z}],!z.every(R=>R<=0)){var q,H;const R=(((q=a.flip)==null?void 0:q.index)||0)+1,M=D[R];if(M&&(!(p==="alignment"?j!==Rs(M):!1)||K.every(A=>Rs(A.placement)===j?A.overflows[0]>0:!0)))return{data:{index:R,overflows:K},reset:{placement:M}};let F=(H=K.filter(L=>L.overflows[0]<=0).sort((L,A)=>L.overflows[1]-A.overflows[1])[0])==null?void 0:H.placement;if(!F)switch(y){case"bestFit":{var B;const L=(B=K.filter(A=>{if(P){const O=Rs(A.placement);return O===j||O==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(O=>O>0).reduce((O,U)=>O+U,0)]).sort((A,O)=>A[1]-O[1])[0])==null?void 0:B[0];L&&(F=L);break}case"initialPlacement":F=u;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function CC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kC(e){return XF.some(t=>e[t]>=0)}const d6=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...a}=go(e,t);switch(o){case"referenceHidden":{const l=await r.detectOverflow(t,{...a,elementContext:"reference"}),u=CC(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:kC(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...a,altBoundary:!0}),u=CC(l,n.floating);return{data:{escapedOffsets:u,escaped:kC(u)}}}default:return{}}}}},A5=new Set(["left","top"]);async function f6(e,t){const{placement:n,platform:r,elements:o}=e,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=xo(n),u=kc(n),d=Rs(n)==="y",f=A5.has(l)?-1:1,m=a&&d?-1:1,p=go(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof b=="number"&&(y=u==="end"?b*-1:b),d?{x:y*m,y:g*f}:{x:g*f,y:y*m}}const h6=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:l,middlewareData:u}=t,d=await f6(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:a+d.y,data:{...d,placement:l}}}}},m6=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:a}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:k=>{let{x:j,y:C}=k;return{x:j,y:C}}},...f}=go(e,t),m={x:n,y:r},p=await a.detectOverflow(t,f),g=Rs(xo(o)),y=fb(g);let b=m[y],w=m[g];if(l){const k=y==="y"?"top":"left",j=y==="y"?"bottom":"right",C=b+p[k],S=b-p[j];b=$v(C,b,S)}if(u){const k=g==="y"?"top":"left",j=g==="y"?"bottom":"right",C=w+p[k],S=w-p[j];w=$v(C,w,S)}const N=d.fn({...t,[y]:b,[g]:w});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[y]:l,[g]:u}}}}}},p6=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=go(e,t),m={x:n,y:r},p=Rs(o),g=fb(p);let y=m[g],b=m[p];const w=go(u,t),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const C=g==="y"?"height":"width",S=a.reference[g]-a.floating[C]+N.mainAxis,E=a.reference[g]+a.reference[C]-N.mainAxis;y<S?y=S:y>E&&(y=E)}if(f){var k,j;const C=g==="y"?"width":"height",S=A5.has(xo(o)),E=a.reference[p]-a.floating[C]+(S&&((k=l.offset)==null?void 0:k[p])||0)+(S?0:N.crossAxis),P=a.reference[p]+a.reference[C]+(S?0:((j=l.offset)==null?void 0:j[p])||0)-(S?N.crossAxis:0);b<E?b=E:b>P&&(b=P)}return{[g]:y,[p]:b}}}},g6=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:l,elements:u}=t,{apply:d=()=>{},...f}=go(e,t),m=await l.detectOverflow(t,f),p=xo(o),g=kc(o),y=Rs(o)==="y",{width:b,height:w}=a.floating;let N,k;p==="top"||p==="bottom"?(N=p,k=g===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=p,N=g==="end"?"top":"bottom");const j=w-m.top-m.bottom,C=b-m.left-m.right,S=Ca(w-m[N],j),E=Ca(b-m[k],C),P=!t.middlewareData.shift;let D=S,I=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=j),P&&!g){const K=mr(m.left,0),q=mr(m.right,0),H=mr(m.top,0),B=mr(m.bottom,0);y?I=b-2*(K!==0||q!==0?K+q:mr(m.left,m.right)):D=w-2*(H!==0||B!==0?H+B:mr(m.top,m.bottom))}await d({...t,availableWidth:I,availableHeight:D});const z=await l.getDimensions(u.floating);return b!==z.width||w!==z.height?{reset:{rects:!0}}:{}}}};function ap(){return typeof window<"u"}function Sc(e){return D5(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Us(e){var t;return(t=(D5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function D5(e){return ap()?e instanceof Node||e instanceof yr(e).Node:!1}function cs(e){return ap()?e instanceof Element||e instanceof yr(e).Element:!1}function jo(e){return ap()?e instanceof HTMLElement||e instanceof yr(e).HTMLElement:!1}function SC(e){return!ap()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}function Pd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=us(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function x6(e){return/^(table|td|th)$/.test(Sc(e))}function ip(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const y6=/transform|translate|scale|rotate|perspective|filter/,v6=/paint|layout|strict|content/,ei=e=>!!e&&e!=="none";let sy;function pb(e){const t=cs(e)?us(e):e;return ei(t.transform)||ei(t.translate)||ei(t.scale)||ei(t.rotate)||ei(t.perspective)||!gb()&&(ei(t.backdropFilter)||ei(t.filter))||y6.test(t.willChange||"")||v6.test(t.contain||"")}function b6(e){let t=ka(e);for(;jo(t)&&!nc(t);){if(pb(t))return t;if(ip(t))return null;t=ka(t)}return null}function gb(){return sy==null&&(sy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),sy}function nc(e){return/^(html|body|#document)$/.test(Sc(e))}function us(e){return yr(e).getComputedStyle(e)}function lp(e){return cs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ka(e){if(Sc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||SC(e)&&e.host||Us(e);return SC(t)?t.host:t}function R5(e){const t=ka(e);return nc(t)?e.ownerDocument?e.ownerDocument.body:e.body:jo(t)&&Pd(t)?t:R5(t)}function Xu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=R5(e),a=o===((r=e.ownerDocument)==null?void 0:r.body),l=yr(o);if(a){const u=zv(l);return t.concat(l,l.visualViewport||[],Pd(o)?o:[],u&&n?Xu(u):[])}else return t.concat(o,Xu(o,[],n))}function zv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function O5(e){const t=us(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=jo(e),a=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=xm(n)!==a||xm(r)!==l;return u&&(n=a,r=l),{width:n,height:r,$:u}}function xb(e){return cs(e)?e:e.contextElement}function Fl(e){const t=xb(e);if(!jo(t))return Is(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=O5(t);let l=(a?xm(n.width):n.width)/r,u=(a?xm(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const w6=Is(0);function I5(e){const t=yr(e);return!gb()||!t.visualViewport?w6:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function N6(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Ii(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=xb(e);let l=Is(1);t&&(r?cs(r)&&(l=Fl(r)):l=Fl(e));const u=N6(a,n,r)?I5(a):Is(0);let d=(o.left+u.x)/l.x,f=(o.top+u.y)/l.y,m=o.width/l.x,p=o.height/l.y;if(a){const g=yr(a),y=r&&cs(r)?yr(r):r;let b=g,w=zv(b);for(;w&&r&&y!==b;){const N=Fl(w),k=w.getBoundingClientRect(),j=us(w),C=k.left+(w.clientLeft+parseFloat(j.paddingLeft))*N.x,S=k.top+(w.clientTop+parseFloat(j.paddingTop))*N.y;d*=N.x,f*=N.y,m*=N.x,p*=N.y,d+=C,f+=S,b=yr(w),w=zv(b)}}return vm({width:m,height:p,x:d,y:f})}function cp(e,t){const n=lp(e).scrollLeft;return t?t.left+n:Ii(Us(e)).left+n}function L5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-cp(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function j6(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a=o==="fixed",l=Us(r),u=t?ip(t.floating):!1;if(r===l||u&&a)return n;let d={scrollLeft:0,scrollTop:0},f=Is(1);const m=Is(0),p=jo(r);if((p||!p&&!a)&&((Sc(r)!=="body"||Pd(l))&&(d=lp(r)),p)){const y=Ii(r);f=Fl(r),m.x=y.x+r.clientLeft,m.y=y.y+r.clientTop}const g=l&&!p&&!a?L5(l,d):Is(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+m.x+g.x,y:n.y*f.y-d.scrollTop*f.y+m.y+g.y}}function C6(e){return Array.from(e.getClientRects())}function k6(e){const t=Us(e),n=lp(e),r=e.ownerDocument.body,o=mr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=mr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+cp(e);const u=-n.scrollTop;return us(r).direction==="rtl"&&(l+=mr(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:l,y:u}}const _C=25;function S6(e,t){const n=yr(e),r=Us(e),o=n.visualViewport;let a=r.clientWidth,l=r.clientHeight,u=0,d=0;if(o){a=o.width,l=o.height;const m=gb();(!m||m&&t==="fixed")&&(u=o.offsetLeft,d=o.offsetTop)}const f=cp(r);if(f<=0){const m=r.ownerDocument,p=m.body,g=getComputedStyle(p),y=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-y);b<=_C&&(a-=b)}else f<=_C&&(a+=f);return{width:a,height:l,x:u,y:d}}function _6(e,t){const n=Ii(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=jo(e)?Fl(e):Is(1),l=e.clientWidth*a.x,u=e.clientHeight*a.y,d=o*a.x,f=r*a.y;return{width:l,height:u,x:d,y:f}}function EC(e,t,n){let r;if(t==="viewport")r=S6(e,n);else if(t==="document")r=k6(Us(e));else if(cs(t))r=_6(t,n);else{const o=I5(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return vm(r)}function F5(e,t){const n=ka(e);return n===t||!cs(n)||nc(n)?!1:us(n).position==="fixed"||F5(n,t)}function E6(e,t){const n=t.get(e);if(n)return n;let r=Xu(e,[],!1).filter(u=>cs(u)&&Sc(u)!=="body"),o=null;const a=us(e).position==="fixed";let l=a?ka(e):e;for(;cs(l)&&!nc(l);){const u=us(l),d=pb(l);!d&&u.position==="fixed"&&(o=null),(a?!d&&!o:!d&&u.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Pd(l)&&!d&&F5(e,l))?r=r.filter(m=>m!==l):o=u,l=ka(l)}return t.set(e,r),r}function P6(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?ip(t)?[]:E6(t,this._c):[].concat(n),r],u=EC(t,l[0],o);let d=u.top,f=u.right,m=u.bottom,p=u.left;for(let g=1;g<l.length;g++){const y=EC(t,l[g],o);d=mr(y.top,d),f=Ca(y.right,f),m=Ca(y.bottom,m),p=mr(y.left,p)}return{width:f-p,height:m-d,x:p,y:d}}function T6(e){const{width:t,height:n}=O5(e);return{width:t,height:n}}function M6(e,t,n){const r=jo(t),o=Us(t),a=n==="fixed",l=Ii(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const d=Is(0);function f(){d.x=cp(o)}if(r||!r&&!a)if((Sc(t)!=="body"||Pd(o))&&(u=lp(t)),r){const y=Ii(t,!0,a,t);d.x=y.x+t.clientLeft,d.y=y.y+t.clientTop}else o&&f();a&&!r&&o&&f();const m=o&&!r&&!a?L5(o,u):Is(0),p=l.left+u.scrollLeft-d.x-m.x,g=l.top+u.scrollTop-d.y-m.y;return{x:p,y:g,width:l.width,height:l.height}}function oy(e){return us(e).position==="static"}function PC(e,t){if(!jo(e)||us(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Us(e)===n&&(n=n.ownerDocument.body),n}function $5(e,t){const n=yr(e);if(ip(e))return n;if(!jo(e)){let o=ka(e);for(;o&&!nc(o);){if(cs(o)&&!oy(o))return o;o=ka(o)}return n}let r=PC(e,t);for(;r&&x6(r)&&oy(r);)r=PC(r,t);return r&&nc(r)&&oy(r)&&!pb(r)?n:r||b6(e)||n}const A6=async function(e){const t=this.getOffsetParent||$5,n=this.getDimensions,r=await n(e.floating);return{reference:M6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function D6(e){return us(e).direction==="rtl"}const R6={convertOffsetParentRelativeRectToViewportRelativeRect:j6,getDocumentElement:Us,getClippingRect:P6,getOffsetParent:$5,getElementRects:A6,getClientRects:C6,getDimensions:T6,getScale:Fl,isElement:cs,isRTL:D6};function V5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function O6(e,t){let n=null,r;const o=Us(e);function a(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),a();const f=e.getBoundingClientRect(),{left:m,top:p,width:g,height:y}=f;if(u||t(),!g||!y)return;const b=uh(p),w=uh(o.clientWidth-(m+g)),N=uh(o.clientHeight-(p+y)),k=uh(m),C={rootMargin:-b+"px "+-w+"px "+-N+"px "+-k+"px",threshold:mr(0,Ca(1,d))||1};let S=!0;function E(P){const D=P[0].intersectionRatio;if(D!==d){if(!S)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!V5(f,e.getBoundingClientRect())&&l(),S=!1}try{n=new IntersectionObserver(E,{...C,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,C)}n.observe(e)}return l(!0),a}function I6(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=xb(e),m=o||a?[...f?Xu(f):[],...t?Xu(t):[]]:[];m.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const p=f&&u?O6(f,n):null;let g=-1,y=null;l&&(y=new ResizeObserver(k=>{let[j]=k;j&&j.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(t)})),n()}),f&&!d&&y.observe(f),t&&y.observe(t));let b,w=d?Ii(e):null;d&&N();function N(){const k=Ii(e);w&&!V5(w,k)&&n(),w=k,b=requestAnimationFrame(N)}return n(),()=>{var k;m.forEach(j=>{o&&j.removeEventListener("scroll",n),a&&j.removeEventListener("resize",n)}),p==null||p(),(k=y)==null||k.disconnect(),y=null,d&&cancelAnimationFrame(b)}}const L6=h6,F6=m6,$6=u6,V6=g6,z6=d6,TC=c6,B6=p6,W6=(e,t,n)=>{const r=new Map,o={platform:R6,...n},a={...o.platform,_c:r};return l6(e,t,{...o,platform:a})};var H6=typeof document<"u",U6=function(){},zh=H6?x.useLayoutEffect:U6;function bm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bm(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&e.$$typeof)&&!bm(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function z5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MC(e,t){const n=z5(e);return Math.round(t*n)/n}function ay(e){const t=x.useRef(e);return zh(()=>{t.current=e}),t}function q6(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:d,open:f}=e,[m,p]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=x.useState(r);bm(g,r)||y(r);const[b,w]=x.useState(null),[N,k]=x.useState(null),j=x.useCallback(A=>{A!==P.current&&(P.current=A,w(A))},[]),C=x.useCallback(A=>{A!==D.current&&(D.current=A,k(A))},[]),S=a||b,E=l||N,P=x.useRef(null),D=x.useRef(null),I=x.useRef(m),z=d!=null,K=ay(d),q=ay(o),H=ay(f),B=x.useCallback(()=>{if(!P.current||!D.current)return;const A={placement:t,strategy:n,middleware:g};q.current&&(A.platform=q.current),W6(P.current,D.current,A).then(O=>{const U={...O,isPositioned:H.current!==!1};R.current&&!bm(I.current,U)&&(I.current=U,vc.flushSync(()=>{p(U)}))})},[g,t,n,q,H]);zh(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,p(A=>({...A,isPositioned:!1})))},[f]);const R=x.useRef(!1);zh(()=>(R.current=!0,()=>{R.current=!1}),[]),zh(()=>{if(S&&(P.current=S),E&&(D.current=E),S&&E){if(K.current)return K.current(S,E,B);B()}},[S,E,B,K,z]);const M=x.useMemo(()=>({reference:P,floating:D,setReference:j,setFloating:C}),[j,C]),F=x.useMemo(()=>({reference:S,floating:E}),[S,E]),L=x.useMemo(()=>{const A={position:n,left:0,top:0};if(!F.floating)return A;const O=MC(F.floating,m.x),U=MC(F.floating,m.y);return u?{...A,transform:"translate("+O+"px, "+U+"px)",...z5(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:U}},[n,u,F.floating,m.x,m.y]);return x.useMemo(()=>({...m,update:B,refs:M,elements:F,floatingStyles:L}),[m,B,M,F,L])}const K6=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?TC({element:r.current,padding:o}).fn(n):{}:r?TC({element:r,padding:o}).fn(n):{}}}},Y6=(e,t)=>{const n=L6(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q6=(e,t)=>{const n=F6(e);return{name:n.name,fn:n.fn,options:[e,t]}},G6=(e,t)=>({fn:B6(e).fn,options:[e,t]}),X6=(e,t)=>{const n=$6(e);return{name:n.name,fn:n.fn,options:[e,t]}},Z6=(e,t)=>{const n=V6(e);return{name:n.name,fn:n.fn,options:[e,t]}},J6=(e,t)=>{const n=z6(e);return{name:n.name,fn:n.fn,options:[e,t]}},e$=(e,t)=>{const n=K6(e);return{name:n.name,fn:n.fn,options:[e,t]}};var t$="Arrow",B5=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return s.jsx(Ge.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});B5.displayName=t$;var n$=B5;function yb(e){const[t,n]=x.useState(void 0);return jn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let l,u;if("borderBoxSize"in a){const d=a.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vb="Popper",[W5,_c]=wo(vb),[r$,H5]=W5(vb),U5=e=>{const{__scopePopper:t,children:n}=e,[r,o]=x.useState(null);return s.jsx(r$,{scope:t,anchor:r,onAnchorChange:o,children:n})};U5.displayName=vb;var q5="PopperAnchor",K5=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=H5(q5,n),l=x.useRef(null),u=pt(t,l),d=x.useRef(null);return x.useEffect(()=>{const f=d.current;d.current=(r==null?void 0:r.current)||l.current,f!==d.current&&a.onAnchorChange(d.current)}),r?null:s.jsx(Ge.div,{...o,ref:u})});K5.displayName=q5;var bb="PopperContent",[s$,o$]=W5(bb),Y5=x.forwardRef((e,t)=>{var J,re,ce,fe,pe,ye;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:b,...w}=e,N=H5(bb,n),[k,j]=x.useState(null),C=pt(t,Ne=>j(Ne)),[S,E]=x.useState(null),P=yb(S),D=(P==null?void 0:P.width)??0,I=(P==null?void 0:P.height)??0,z=r+(a!=="center"?"-"+a:""),K=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},q=Array.isArray(f)?f:[f],H=q.length>0,B={padding:K,boundary:q.filter(i$),altBoundary:H},{refs:R,floatingStyles:M,placement:F,isPositioned:L,middlewareData:A}=q6({strategy:"fixed",placement:z,whileElementsMounted:(...Ne)=>I6(...Ne,{animationFrame:y==="always"}),elements:{reference:N.anchor},middleware:[Y6({mainAxis:o+I,alignmentAxis:l}),d&&Q6({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?G6():void 0,...B}),d&&X6({...B}),Z6({...B,apply:({elements:Ne,rects:Oe,availableWidth:Xe,availableHeight:Le})=>{const{width:st,height:Nt}=Oe.reference,ge=Ne.floating.style;ge.setProperty("--radix-popper-available-width",`${Xe}px`),ge.setProperty("--radix-popper-available-height",`${Le}px`),ge.setProperty("--radix-popper-anchor-width",`${st}px`),ge.setProperty("--radix-popper-anchor-height",`${Nt}px`)}}),S&&e$({element:S,padding:u}),l$({arrowWidth:D,arrowHeight:I}),g&&J6({strategy:"referenceHidden",...B})]}),[O,U]=X5(F),V=is(b);jn(()=>{L&&(V==null||V())},[L,V]);const $=(J=A.arrow)==null?void 0:J.x,Y=(re=A.arrow)==null?void 0:re.y,X=((ce=A.arrow)==null?void 0:ce.centerOffset)!==0,[ne,ie]=x.useState();return jn(()=>{k&&ie(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(fe=A.transformOrigin)==null?void 0:fe.x,(pe=A.transformOrigin)==null?void 0:pe.y].join(" "),...((ye=A.hide)==null?void 0:ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(s$,{scope:n,placedSide:O,onArrowChange:E,arrowX:$,arrowY:Y,shouldHideArrow:X,children:s.jsx(Ge.div,{"data-side":O,"data-align":U,...w,ref:C,style:{...w.style,animation:L?void 0:"none"}})})})});Y5.displayName=bb;var Q5="PopperArrow",a$={top:"bottom",right:"left",bottom:"top",left:"right"},G5=x.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,a=o$(Q5,r),l=a$[a.placedSide];return s.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:s.jsx(n$,{...o,ref:n,style:{...o.style,display:"block"}})})});G5.displayName=Q5;function i$(e){return e!==null}var l$=e=>({name:"transformOrigin",options:e,fn(t){var N,k,j;const{placement:n,rects:r,middlewareData:o}=t,l=((N=o.arrow)==null?void 0:N.centerOffset)!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,m]=X5(n),p={start:"0%",center:"50%",end:"100%"}[m],g=(((k=o.arrow)==null?void 0:k.x)??0)+u/2,y=(((j=o.arrow)==null?void 0:j.y)??0)+d/2;let b="",w="";return f==="bottom"?(b=l?p:`${g}px`,w=`${-d}px`):f==="top"?(b=l?p:`${g}px`,w=`${r.floating.height+d}px`):f==="right"?(b=`${-d}px`,w=l?p:`${y}px`):f==="left"&&(b=`${r.floating.width+d}px`,w=l?p:`${y}px`),{data:{x:b,y:w}}}});function X5(e){const[t,n="center"]=e.split("-");return[t,n]}var Z5=U5,up=K5,wb=Y5,Nb=G5,c$=Symbol("radix.slottable");function u$(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=c$,t}var[dp]=wo("Tooltip",[_c]),jb=_c(),J5="TooltipProvider",d$=700,AC="tooltip.open",[f$,eE]=dp(J5),tE=e=>{const{__scopeTooltip:t,delayDuration:n=d$,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:a}=e,l=x.useRef(!0),u=x.useRef(!1),d=x.useRef(0);return x.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),s.jsx(f$,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:x.useCallback(f=>{u.current=f},[]),disableHoverableContent:o,children:a})};tE.displayName=J5;var nE="Tooltip",[gae,fp]=dp(nE),Bv="TooltipTrigger",h$=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=fp(Bv,n),a=eE(Bv,n),l=jb(n),u=x.useRef(null),d=pt(t,u,o.onTriggerChange),f=x.useRef(!1),m=x.useRef(!1),p=x.useCallback(()=>f.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),s.jsx(up,{asChild:!0,...l,children:s.jsx(Ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:d,onPointerMove:Ke(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ke(e.onPointerLeave,()=>{o.onTriggerLeave(),m.current=!1}),onPointerDown:Ke(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ke(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:Ke(e.onBlur,o.onClose),onClick:Ke(e.onClick,o.onClose)})})});h$.displayName=Bv;var m$="TooltipPortal",[xae,p$]=dp(m$,{forceMount:void 0}),rc="TooltipContent",rE=x.forwardRef((e,t)=>{const n=p$(rc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...a}=e,l=fp(rc,e.__scopeTooltip);return s.jsx(No,{present:r||l.open,children:l.disableHoverableContent?s.jsx(sE,{side:o,...a,ref:t}):s.jsx(g$,{side:o,...a,ref:t})})}),g$=x.forwardRef((e,t)=>{const n=fp(rc,e.__scopeTooltip),r=eE(rc,e.__scopeTooltip),o=x.useRef(null),a=pt(t,o),[l,u]=x.useState(null),{trigger:d,onClose:f}=n,m=o.current,{onPointerInTransitChange:p}=r,g=x.useCallback(()=>{u(null),p(!1)},[p]),y=x.useCallback((b,w)=>{const N=b.currentTarget,k={x:b.clientX,y:b.clientY},j=w$(k,N.getBoundingClientRect()),C=N$(k,j),S=j$(w.getBoundingClientRect()),E=k$([...C,...S]);u(E),p(!0)},[p]);return x.useEffect(()=>()=>g(),[g]),x.useEffect(()=>{if(d&&m){const b=N=>y(N,m),w=N=>y(N,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",w)}}},[d,m,y,g]),x.useEffect(()=>{if(l){const b=w=>{const N=w.target,k={x:w.clientX,y:w.clientY},j=(d==null?void 0:d.contains(N))||(m==null?void 0:m.contains(N)),C=!C$(k,l);j?g():C&&(g(),f())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,f,g]),s.jsx(sE,{...e,ref:a})}),[x$,y$]=dp(nE,{isInside:!1}),v$=u$("TooltipContent"),sE=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:l,...u}=e,d=fp(rc,n),f=jb(n),{onClose:m}=d;return x.useEffect(()=>(document.addEventListener(AC,m),()=>document.removeEventListener(AC,m)),[m]),x.useEffect(()=>{if(d.trigger){const p=g=>{const y=g.target;y!=null&&y.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),s.jsx(Nc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:s.jsxs(wb,{"data-state":d.stateAttribute,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(v$,{children:r}),s.jsx(x$,{scope:n,isInside:!0,children:s.jsx(yL,{id:d.contentId,role:"tooltip",children:o||r})})]})})});rE.displayName=rc;var oE="TooltipArrow",b$=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=jb(n);return y$(oE,n).isInside?null:s.jsx(Nb,{...o,...r,ref:t})});b$.displayName=oE;function w$(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,o,a)){case a:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function N$(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function j$(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function C$(e,t){const{x:n,y:r}=e;let o=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],d=t[l],f=u.x,m=u.y,p=d.x,g=d.y;m>r!=g>r&&n<(p-f)*(r-m)/(g-m)+f&&(o=!o)}return o}function k$(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),S$(t)}function S$(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const a=t[t.length-1],l=t[t.length-2];if((a.x-l.x)*(o.y-l.y)>=(a.y-l.y)*(o.x-l.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const a=n[n.length-1],l=n[n.length-2];if((a.x-l.x)*(o.y-l.y)>=(a.y-l.y)*(o.x-l.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _$=tE,aE=rE;const E$=_$,P$=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(aE,{ref:r,sideOffset:t,className:Ie("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));P$.displayName=aE.displayName;const Cb=x.createContext({});function kb(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const T$=typeof window<"u",iE=T$?x.useLayoutEffect:x.useEffect,hp=x.createContext(null);function Sb(e,t){e.indexOf(t)===-1&&e.push(t)}function wm(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ws=(e,t,n)=>n>t?t:n<e?e:n;let _b=()=>{};const Sa={},lE=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function cE(e){return typeof e=="object"&&e!==null}const uE=e=>/^0[^.\s]+$/u.test(e);function dE(e){let t;return()=>(t===void 0&&(t=e()),t)}const $r=e=>e,M$=(e,t)=>n=>t(e(n)),Td=(...e)=>e.reduce(M$),Zu=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Eb{constructor(){this.subscriptions=[]}add(t){return Sb(this.subscriptions,t),()=>wm(this.subscriptions,t)}notify(t,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,r);else for(let a=0;a<o;a++){const l=this.subscriptions[a];l&&l(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const vr=e=>e*1e3,Fr=e=>e/1e3;function fE(e,t){return t?e*(1e3/t):0}const hE=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,A$=1e-7,D$=12;function R$(e,t,n,r,o){let a,l,u=0;do l=t+(n-t)/2,a=hE(l,r,o)-e,a>0?n=l:t=l;while(Math.abs(a)>A$&&++u<D$);return l}function Md(e,t,n,r){if(e===t&&n===r)return $r;const o=a=>R$(a,0,1,e,n);return a=>a===0||a===1?a:hE(o(a),t,r)}const mE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,pE=e=>t=>1-e(1-t),gE=Md(.33,1.53,.69,.99),Pb=pE(gE),xE=mE(Pb),yE=e=>e>=1?1:(e*=2)<1?.5*Pb(e):.5*(2-Math.pow(2,-10*(e-1))),Tb=e=>1-Math.sin(Math.acos(e)),vE=pE(Tb),bE=mE(Tb),O$=Md(.42,0,1,1),I$=Md(0,0,.58,1),wE=Md(.42,0,.58,1),L$=e=>Array.isArray(e)&&typeof e[0]!="number",NE=e=>Array.isArray(e)&&typeof e[0]=="number",F$={linear:$r,easeIn:O$,easeInOut:wE,easeOut:I$,circIn:Tb,circInOut:bE,circOut:vE,backIn:Pb,backInOut:xE,backOut:gE,anticipate:yE},$$=e=>typeof e=="string",DC=e=>{if(NE(e)){_b(e.length===4);const[t,n,r,o]=e;return Md(t,n,r,o)}else if($$(e))return F$[e];return e},dh=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function V$(e,t){let n=new Set,r=new Set,o=!1,a=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(m){l.has(m)&&(f.schedule(m),e()),m(u)}const f={schedule:(m,p=!1,g=!1)=>{const b=g&&o?n:r;return p&&l.add(m),b.add(m),m},cancel:m=>{r.delete(m),l.delete(m)},process:m=>{if(u=m,o){a=!0;return}o=!0;const p=n;n=r,r=p,n.forEach(d),n.clear(),o=!1,a&&(a=!1,f.process(m))}};return f}const z$=40;function jE(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,l=dh.reduce((C,S)=>(C[S]=V$(a),C),{}),{setup:u,read:d,resolveKeyframes:f,preUpdate:m,update:p,preRender:g,render:y,postRender:b}=l,w=()=>{const C=Sa.useManualTiming,S=C?o.timestamp:performance.now();n=!1,C||(o.delta=r?1e3/60:Math.max(Math.min(S-o.timestamp,z$),1)),o.timestamp=S,o.isProcessing=!0,u.process(o),d.process(o),f.process(o),m.process(o),p.process(o),g.process(o),y.process(o),b.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(w))},N=()=>{n=!0,r=!0,o.isProcessing||e(w)};return{schedule:dh.reduce((C,S)=>{const E=l[S];return C[S]=(P,D=!1,I=!1)=>(n||N(),E.schedule(P,D,I)),C},{}),cancel:C=>{for(let S=0;S<dh.length;S++)l[dh[S]].cancel(C)},state:o,steps:l}}const{schedule:kt,cancel:_a,state:bn,steps:iy}=jE(typeof requestAnimationFrame<"u"?requestAnimationFrame:$r,!0);let Bh;function B$(){Bh=void 0}const $n={now:()=>(Bh===void 0&&$n.set(bn.isProcessing||Sa.useManualTiming?bn.timestamp:performance.now()),Bh),set:e=>{Bh=e,queueMicrotask(B$)}},CE=e=>t=>typeof t=="string"&&t.startsWith(e),kE=CE("--"),W$=CE("var(--"),Mb=e=>W$(e)?H$.test(e.split("/*")[0].trim()):!1,H$=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function RC(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Ec={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ju={...Ec,transform:e=>Ws(0,1,e)},fh={...Ec,default:1},$u=e=>Math.round(e*1e5)/1e5,Ab=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function U$(e){return e==null}const q$=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Db=(e,t)=>n=>!!(typeof n=="string"&&q$.test(n)&&n.startsWith(e)||t&&!U$(n)&&Object.prototype.hasOwnProperty.call(n,t)),SE=(e,t,n)=>r=>{if(typeof r!="string")return r;const[o,a,l,u]=r.match(Ab);return{[e]:parseFloat(o),[t]:parseFloat(a),[n]:parseFloat(l),alpha:u!==void 0?parseFloat(u):1}},K$=e=>Ws(0,255,e),ly={...Ec,transform:e=>Math.round(K$(e))},hi={test:Db("rgb","red"),parse:SE("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+ly.transform(e)+", "+ly.transform(t)+", "+ly.transform(n)+", "+$u(Ju.transform(r))+")"};function Y$(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const Wv={test:Db("#"),parse:Y$,transform:hi.transform},Ad=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Jo=Ad("deg"),Ls=Ad("%"),Me=Ad("px"),Q$=Ad("vh"),G$=Ad("vw"),OC={...Ls,parse:e=>Ls.parse(e)/100,transform:e=>Ls.transform(e*100)},Ml={test:Db("hsl","hue"),parse:SE("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ls.transform($u(t))+", "+Ls.transform($u(n))+", "+$u(Ju.transform(r))+")"},Zt={test:e=>hi.test(e)||Wv.test(e)||Ml.test(e),parse:e=>hi.test(e)?hi.parse(e):Ml.test(e)?Ml.parse(e):Wv.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?hi.transform(e):Ml.transform(e),getAnimatableNone:e=>{const t=Zt.parse(e);return t.alpha=0,Zt.transform(t)}},X$=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Z$(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ab))==null?void 0:t.length)||0)+(((n=e.match(X$))==null?void 0:n.length)||0)>0}const _E="number",EE="color",J$="var",e8="var(",IC="${}",t8=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sc(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},o=[];let a=0;const u=t.replace(t8,d=>(Zt.test(d)?(r.color.push(a),o.push(EE),n.push(Zt.parse(d))):d.startsWith(e8)?(r.var.push(a),o.push(J$),n.push(d)):(r.number.push(a),o.push(_E),n.push(parseFloat(d))),++a,IC)).split(IC);return{values:n,split:u,indexes:r,types:o}}function n8(e){return sc(e).values}function PE({split:e,types:t}){const n=e.length;return r=>{let o="";for(let a=0;a<n;a++)if(o+=e[a],r[a]!==void 0){const l=t[a];l===_E?o+=$u(r[a]):l===EE?o+=Zt.transform(r[a]):o+=r[a]}return o}}function r8(e){return PE(sc(e))}const s8=e=>typeof e=="number"?0:Zt.test(e)?Zt.getAnimatableNone(e):e,o8=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:s8(e);function a8(e){const t=sc(e);return PE(t)(t.values.map((r,o)=>o8(r,t.split[o])))}const as={test:Z$,parse:n8,createTransformer:r8,getAnimatableNone:a8};function cy(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function i8({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let o=0,a=0,l=0;if(!t)o=a=l=n;else{const u=n<.5?n*(1+t):n+t-n*t,d=2*n-u;o=cy(d,u,e+1/3),a=cy(d,u,e),l=cy(d,u,e-1/3)}return{red:Math.round(o*255),green:Math.round(a*255),blue:Math.round(l*255),alpha:r}}function Nm(e,t){return n=>n>0?t:e}const Ft=(e,t,n)=>e+(t-e)*n,uy=(e,t,n)=>{const r=e*e,o=n*(t*t-r)+r;return o<0?0:Math.sqrt(o)},l8=[Wv,hi,Ml],c8=e=>l8.find(t=>t.test(e));function LC(e){const t=c8(e);if(!t)return!1;let n=t.parse(e);return t===Ml&&(n=i8(n)),n}const FC=(e,t)=>{const n=LC(e),r=LC(t);if(!n||!r)return Nm(e,t);const o={...n};return a=>(o.red=uy(n.red,r.red,a),o.green=uy(n.green,r.green,a),o.blue=uy(n.blue,r.blue,a),o.alpha=Ft(n.alpha,r.alpha,a),hi.transform(o))},Hv=new Set(["none","hidden"]);function u8(e,t){return Hv.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function d8(e,t){return n=>Ft(e,t,n)}function Rb(e){return typeof e=="number"?d8:typeof e=="string"?Mb(e)?Nm:Zt.test(e)?FC:m8:Array.isArray(e)?TE:typeof e=="object"?Zt.test(e)?FC:f8:Nm}function TE(e,t){const n=[...e],r=n.length,o=e.map((a,l)=>Rb(a)(a,t[l]));return a=>{for(let l=0;l<r;l++)n[l]=o[l](a);return n}}function f8(e,t){const n={...e,...t},r={};for(const o in n)e[o]!==void 0&&t[o]!==void 0&&(r[o]=Rb(e[o])(e[o],t[o]));return o=>{for(const a in r)n[a]=r[a](o);return n}}function h8(e,t){const n=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const a=t.types[o],l=e.indexes[a][r[a]],u=e.values[l]??0;n[o]=u,r[a]++}return n}const m8=(e,t)=>{const n=as.createTransformer(t),r=sc(e),o=sc(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Hv.has(e)&&!o.values.length||Hv.has(t)&&!r.values.length?u8(e,t):Td(TE(h8(r,o),o.values),n):Nm(e,t)};function ME(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ft(e,t,n):Rb(e)(e,t)}const p8=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>kt.update(t,n),stop:()=>_a(t),now:()=>bn.isProcessing?bn.timestamp:$n.now()}},AE=(e,t,n=10)=>{let r="";const o=Math.max(Math.round(t/n),2);for(let a=0;a<o;a++)r+=Math.round(e(a/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},jm=2e4;function Ob(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<jm;)t+=n,r=e.next(t);return t>=jm?1/0:t}function g8(e,t=100,n){const r=n({...e,keyframes:[0,t]}),o=Math.min(Ob(r),jm);return{type:"keyframes",ease:a=>r.next(o*a).value/t,duration:Fr(o)}}const Wt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Uv(e,t){return e*Math.sqrt(1-t*t)}const x8=12;function y8(e,t,n){let r=n;for(let o=1;o<x8;o++)r=r-e(r)/t(r);return r}const dy=.001;function v8({duration:e=Wt.duration,bounce:t=Wt.bounce,velocity:n=Wt.velocity,mass:r=Wt.mass}){let o,a,l=1-t;l=Ws(Wt.minDamping,Wt.maxDamping,l),e=Ws(Wt.minDuration,Wt.maxDuration,Fr(e)),l<1?(o=f=>{const m=f*l,p=m*e,g=m-n,y=Uv(f,l),b=Math.exp(-p);return dy-g/y*b},a=f=>{const p=f*l*e,g=p*n+n,y=Math.pow(l,2)*Math.pow(f,2)*e,b=Math.exp(-p),w=Uv(Math.pow(f,2),l);return(-o(f)+dy>0?-1:1)*((g-y)*b)/w}):(o=f=>{const m=Math.exp(-f*e),p=(f-n)*e+1;return-dy+m*p},a=f=>{const m=Math.exp(-f*e),p=(n-f)*(e*e);return m*p});const u=5/e,d=y8(o,a,u);if(e=vr(e),isNaN(d))return{stiffness:Wt.stiffness,damping:Wt.damping,duration:e};{const f=Math.pow(d,2)*r;return{stiffness:f,damping:l*2*Math.sqrt(r*f),duration:e}}}const b8=["duration","bounce"],w8=["stiffness","damping","mass"];function $C(e,t){return t.some(n=>e[n]!==void 0)}function N8(e){let t={velocity:Wt.velocity,stiffness:Wt.stiffness,damping:Wt.damping,mass:Wt.mass,isResolvedFromDuration:!1,...e};if(!$C(e,w8)&&$C(e,b8))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,a=2*Ws(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Wt.mass,stiffness:o,damping:a}}else{const n=v8({...e,velocity:0});t={...t,...n,mass:Wt.mass},t.isResolvedFromDuration=!0}return t}function Cm(e=Wt.visualDuration,t=Wt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=n;const a=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],u={done:!1,value:a},{stiffness:d,damping:f,mass:m,duration:p,velocity:g,isResolvedFromDuration:y}=N8({...n,velocity:-Fr(n.velocity||0)}),b=g||0,w=f/(2*Math.sqrt(d*m)),N=l-a,k=Fr(Math.sqrt(d/m)),j=Math.abs(N)<5;r||(r=j?Wt.restSpeed.granular:Wt.restSpeed.default),o||(o=j?Wt.restDelta.granular:Wt.restDelta.default);let C,S,E,P,D,I;if(w<1)E=Uv(k,w),P=(b+w*k*N)/E,C=K=>{const q=Math.exp(-w*k*K);return l-q*(P*Math.sin(E*K)+N*Math.cos(E*K))},D=w*k*P+N*E,I=w*k*N-P*E,S=K=>Math.exp(-w*k*K)*(D*Math.sin(E*K)+I*Math.cos(E*K));else if(w===1){C=q=>l-Math.exp(-k*q)*(N+(b+k*N)*q);const K=b+k*N;S=q=>Math.exp(-k*q)*(k*K*q-b)}else{const K=k*Math.sqrt(w*w-1);C=R=>{const M=Math.exp(-w*k*R),F=Math.min(K*R,300);return l-M*((b+w*k*N)*Math.sinh(F)+K*N*Math.cosh(F))/K};const q=(b+w*k*N)/K,H=w*k*q-N*K,B=w*k*N-q*K;S=R=>{const M=Math.exp(-w*k*R),F=Math.min(K*R,300);return M*(H*Math.sinh(F)+B*Math.cosh(F))}}const z={calculatedDuration:y&&p||null,velocity:K=>vr(S(K)),next:K=>{if(!y&&w<1){const H=Math.exp(-w*k*K),B=Math.sin(E*K),R=Math.cos(E*K),M=l-H*(P*B+N*R),F=vr(H*(D*B+I*R));return u.done=Math.abs(F)<=r&&Math.abs(l-M)<=o,u.value=u.done?l:M,u}const q=C(K);if(y)u.done=K>=p;else{const H=vr(S(K));u.done=Math.abs(H)<=r&&Math.abs(l-q)<=o}return u.value=u.done?l:q,u},toString:()=>{const K=Math.min(Ob(z),jm),q=AE(H=>z.next(K*H).value,K,30);return K+"ms "+q},toTransition:()=>{}};return z}Cm.applyToOptions=e=>{const t=g8(e,100,Cm);return e.ease=t.ease,e.duration=vr(t.duration),e.type="keyframes",e};const j8=5;function DE(e,t,n){const r=Math.max(t-j8,0);return fE(n-e(r),t-r)}function qv({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:a=500,modifyTarget:l,min:u,max:d,restDelta:f=.5,restSpeed:m}){const p=e[0],g={done:!1,value:p},y=I=>u!==void 0&&I<u||d!==void 0&&I>d,b=I=>u===void 0?d:d===void 0||Math.abs(u-I)<Math.abs(d-I)?u:d;let w=n*t;const N=p+w,k=l===void 0?N:l(N);k!==N&&(w=k-p);const j=I=>-w*Math.exp(-I/r),C=I=>k+j(I),S=I=>{const z=j(I),K=C(I);g.done=Math.abs(z)<=f,g.value=g.done?k:K};let E,P;const D=I=>{y(g.value)&&(E=I,P=Cm({keyframes:[g.value,b(g.value)],velocity:DE(C,I,g.value),damping:o,stiffness:a,restDelta:f,restSpeed:m}))};return D(0),{calculatedDuration:null,next:I=>{let z=!1;return!P&&E===void 0&&(z=!0,S(I),D(I)),E!==void 0&&I>=E?P.next(I-E):(!z&&S(I),g)}}}function C8(e,t,n){const r=[],o=n||Sa.mix||ME,a=e.length-1;for(let l=0;l<a;l++){let u=o(e[l],e[l+1]);if(t){const d=Array.isArray(t)?t[l]||$r:t;u=Td(d,u)}r.push(u)}return r}function k8(e,t,{clamp:n=!0,ease:r,mixer:o}={}){const a=e.length;if(_b(a===t.length),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const u=C8(t,r,o),d=u.length,f=m=>{if(l&&m<e[0])return t[0];let p=0;if(d>1)for(;p<e.length-2&&!(m<e[p+1]);p++);const g=Zu(e[p],e[p+1],m);return u[p](g)};return n?m=>f(Ws(e[0],e[a-1],m)):f}function S8(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=Zu(0,t,r);e.push(Ft(n,1,o))}}function _8(e){const t=[0];return S8(t,e.length-1),t}function E8(e,t){return e.map(n=>n*t)}function P8(e,t){return e.map(()=>t||wE).splice(0,e.length-1)}function Vu({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=L$(r)?r.map(DC):DC(r),a={done:!1,value:t[0]},l=E8(n&&n.length===t.length?n:_8(t),e),u=k8(l,t,{ease:Array.isArray(o)?o:P8(t,o)});return{calculatedDuration:e,next:d=>(a.value=u(d),a.done=d>=e,a)}}const T8=e=>e!==null;function mp(e,{repeat:t,repeatType:n="loop"},r,o=1){const a=e.filter(T8),u=o<0||t&&n!=="loop"&&t%2===1?0:a.length-1;return!u||r===void 0?a[u]:r}const M8={decay:qv,inertia:qv,tween:Vu,keyframes:Vu,spring:Cm};function RE(e){typeof e.type=="string"&&(e.type=M8[e.type])}class Ib{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const A8=e=>e/100;class km extends Ib{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,o;const{motionValue:n}=this.options;n&&n.updatedAt!==$n.now()&&this.tick($n.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(r=this.options).onStop)==null||o.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;RE(t);const{type:n=Vu,repeat:r=0,repeatDelay:o=0,repeatType:a,velocity:l=0}=t;let{keyframes:u}=t;const d=n||Vu;d!==Vu&&typeof u[0]!="number"&&(this.mixKeyframes=Td(A8,ME(u[0],u[1])),u=[0,100]);const f=d({...t,keyframes:u});a==="mirror"&&(this.mirroredGenerator=d({...t,keyframes:[...u].reverse(),velocity:-l})),f.calculatedDuration===null&&(f.calculatedDuration=Ob(f));const{calculatedDuration:m}=f;this.calculatedDuration=m,this.resolvedDuration=m+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=f}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:o,mixKeyframes:a,mirroredGenerator:l,resolvedDuration:u,calculatedDuration:d}=this;if(this.startTime===null)return r.next(0);const{delay:f=0,keyframes:m,repeat:p,repeatType:g,repeatDelay:y,type:b,onUpdate:w,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const k=this.currentTime-f*(this.playbackSpeed>=0?1:-1),j=this.playbackSpeed>=0?k<0:k>o;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let C=this.currentTime,S=r;if(p){const I=Math.min(this.currentTime,o)/u;let z=Math.floor(I),K=I%1;!K&&I>=1&&(K=1),K===1&&z--,z=Math.min(z,p+1),!!(z%2)&&(g==="reverse"?(K=1-K,y&&(K-=y/u)):g==="mirror"&&(S=l)),C=Ws(0,1,K)*u}let E;j?(this.delayState.value=m[0],E=this.delayState):E=S.next(C),a&&!j&&(E.value=a(E.value));let{done:P}=E;!j&&d!==null&&(P=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return D&&b!==qv&&(E.value=mp(m,this.options,N,this.speed)),w&&w(E.value),D&&this.finish(),E}then(t,n){return this.finished.then(t,n)}get duration(){return Fr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Fr(t)}get time(){return Fr(this.currentTime)}set time(t){t=vr(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return DE(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime($n.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Fr(this.currentTime))}play(){var o,a;if(this.isStopped)return;const{driver:t=p8,startTime:n}=this.options;this.driver||(this.driver=t(l=>this.tick(l))),(a=(o=this.options).onPlay)==null||a.call(o);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime($n.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function D8(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const mi=e=>e*180/Math.PI,Kv=e=>{const t=mi(Math.atan2(e[1],e[0]));return Yv(t)},R8={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Kv,rotateZ:Kv,skewX:e=>mi(Math.atan(e[1])),skewY:e=>mi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Yv=e=>(e=e%360,e<0&&(e+=360),e),VC=Kv,zC=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),BC=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),O8={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:zC,scaleY:BC,scale:e=>(zC(e)+BC(e))/2,rotateX:e=>Yv(mi(Math.atan2(e[6],e[5]))),rotateY:e=>Yv(mi(Math.atan2(-e[2],e[0]))),rotateZ:VC,rotate:VC,skewX:e=>mi(Math.atan(e[4])),skewY:e=>mi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qv(e){return e.includes("scale")?1:0}function Gv(e,t){if(!e||e==="none")return Qv(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=O8,o=n;else{const u=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=R8,o=u}if(!o)return Qv(t);const a=r[t],l=o[1].split(",").map(L8);return typeof a=="function"?a(l):l[a]}const I8=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Gv(n,t)};function L8(e){return parseFloat(e.trim())}const Pc=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tc=new Set(Pc),WC=e=>e===Ec||e===Me,F8=new Set(["x","y","z"]),$8=Pc.filter(e=>!F8.has(e));function V8(e){const t=[];return $8.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ha={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const o=e.max-e.min;return r==="border-box"?o:o-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const o=e.max-e.min;return r==="border-box"?o:o-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Gv(t,"x"),y:(e,{transform:t})=>Gv(t,"y")};ha.translateX=ha.x;ha.translateY=ha.y;const Si=new Set;let Xv=!1,Zv=!1,Jv=!1;function OE(){if(Zv){const e=Array.from(Si).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const o=V8(r);o.length&&(n.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([a,l])=>{var u;(u=r.getValue(a))==null||u.set(l)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Zv=!1,Xv=!1,Si.forEach(e=>e.complete(Jv)),Si.clear()}function IE(){Si.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Zv=!0)})}function z8(){Jv=!0,IE(),OE(),Jv=!1}class Lb{constructor(t,n,r,o,a,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=o,this.element=a,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Si.add(this),Xv||(Xv=!0,kt.read(IE),kt.resolveKeyframes(OE))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:o}=this;if(t[0]===null){const a=o==null?void 0:o.get(),l=t[t.length-1];if(a!==void 0)t[0]=a;else if(r&&n){const u=r.readValue(n,l);u!=null&&(t[0]=u)}t[0]===void 0&&(t[0]=l),o&&a===void 0&&o.set(t[0])}D8(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Si.delete(this)}cancel(){this.state==="scheduled"&&(Si.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const B8=e=>e.startsWith("--");function LE(e,t,n){B8(t)?e.style.setProperty(t,n):e.style[t]=n}const W8={};function FE(e,t){const n=dE(e);return()=>W8[t]??n()}const H8=FE(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),$E=FE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Pu=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,HC={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pu([0,.65,.55,1]),circOut:Pu([.55,0,1,.45]),backIn:Pu([.31,.01,.66,-.59]),backOut:Pu([.33,1.53,.69,.99])};function VE(e,t){if(e)return typeof e=="function"?$E()?AE(e,t):"ease-out":NE(e)?Pu(e):Array.isArray(e)?e.map(n=>VE(n,t)||HC.easeOut):HC[e]}function U8(e,t,n,{delay:r=0,duration:o=300,repeat:a=0,repeatType:l="loop",ease:u="easeOut",times:d}={},f=void 0){const m={[t]:n};d&&(m.offset=d);const p=VE(u,o);Array.isArray(p)&&(m.easing=p);const g={delay:r,duration:o,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:a+1,direction:l==="reverse"?"alternate":"normal"};return f&&(g.pseudoElement=f),e.animate(m,g)}function zE(e){return typeof e=="function"&&"applyToOptions"in e}function q8({type:e,...t}){return zE(e)&&$E()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class BE extends Ib{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:o,pseudoElement:a,allowFlatten:l=!1,finalKeyframe:u,onComplete:d}=t;this.isPseudoElement=!!a,this.allowFlatten=l,this.options=t,_b(typeof t.type!="string");const f=q8(t);this.animation=U8(n,r,o,f,a),f.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const m=mp(o,this.options,u,this.speed);this.updateMotionValue&&this.updateMotionValue(m),LE(n,r,m),this.animation.cancel()}d==null||d(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,o;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((o=(r=this.animation).commitStyles)==null||o.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Fr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Fr(t)}get time(){return Fr(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=vr(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:o}){var a;return this.allowFlatten&&((a=this.animation.effect)==null||a.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&H8()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),$r):o(this)}}const WE={anticipate:yE,backInOut:xE,circInOut:bE};function K8(e){return e in WE}function Y8(e){typeof e.ease=="string"&&K8(e.ease)&&(e.ease=WE[e.ease])}const fy=10;class Q8 extends BE{constructor(t){Y8(t),RE(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:o,element:a,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const u=new km({...l,autoplay:!1}),d=Math.max(fy,$n.now()-this.startTime),f=Ws(0,fy,d-fy),m=u.sample(d).value,{name:p}=this.options;a&&p&&LE(a,p,m),n.setWithVelocity(u.sample(Math.max(0,d-f)).value,m,f),u.stop()}}const UC=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(as.test(e)||e==="0")&&!e.startsWith("url("));function G8(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function X8(e,t,n,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const a=e[e.length-1],l=UC(o,t),u=UC(a,t);return!l||!u?!1:G8(e)||(n==="spring"||zE(n))&&r}function e0(e){e.duration=0,e.type="keyframes"}const HE=new Set(["opacity","clipPath","filter","transform"]),Z8=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function J8(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&Z8.test(e[t]))return!0;return!1}const e9=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),t9=dE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function n9(e){var p;const{motionValue:t,name:n,repeatDelay:r,repeatType:o,damping:a,type:l,keyframes:u}=e;if(!(((p=t==null?void 0:t.owner)==null?void 0:p.current)instanceof HTMLElement))return!1;const{onUpdate:f,transformTemplate:m}=t.owner.getProps();return t9()&&n&&(HE.has(n)||e9.has(n)&&J8(u))&&(n!=="transform"||!m)&&!f&&!r&&o!=="mirror"&&a!==0&&l!=="inertia"}const r9=40;class s9 extends Ib{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:l="loop",keyframes:u,name:d,motionValue:f,element:m,...p}){var b;super(),this.stop=()=>{var w,N;this._animation&&(this._animation.stop(),(w=this.stopTimeline)==null||w.call(this)),(N=this.keyframeResolver)==null||N.cancel()},this.createdAt=$n.now();const g={autoplay:t,delay:n,type:r,repeat:o,repeatDelay:a,repeatType:l,name:d,motionValue:f,element:m,...p},y=(m==null?void 0:m.KeyframeResolver)||Lb;this.keyframeResolver=new y(u,(w,N,k)=>this.onKeyframesResolved(w,N,g,!k),d,f,m),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(t,n,r,o){var k,j;this.keyframeResolver=void 0;const{name:a,type:l,velocity:u,delay:d,isHandoff:f,onUpdate:m}=r;this.resolvedAt=$n.now();let p=!0;X8(t,a,l,u)||(p=!1,(Sa.instantAnimations||!d)&&(m==null||m(mp(t,r,n))),t[0]=t[t.length-1],e0(r),r.repeat=0);const y={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>r9?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},b=p&&!f&&n9(y),w=(j=(k=y.motionValue)==null?void 0:k.owner)==null?void 0:j.current;let N;if(b)try{N=new Q8({...y,element:w})}catch{N=new km(y)}else N=new km(y);N.finished.then(()=>{this.notifyFinished()}).catch($r),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),z8()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function UE(e,t,n,r=0,o=1){const a=Array.from(e).sort((f,m)=>f.sortNodePosition(m)).indexOf(t),l=e.size,u=(l-1)*r;return typeof n=="function"?n(a,l):o===1?a*r:u-a*r}const o9=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function a9(e){const t=o9.exec(e);if(!t)return[,];const[,n,r,o]=t;return[`--${n??r}`,o]}function qE(e,t,n=1){const[r,o]=a9(e);if(!r)return;const a=window.getComputedStyle(t).getPropertyValue(r);if(a){const l=a.trim();return lE(l)?parseFloat(l):l}return Mb(o)?qE(o,t,n+1):o}const i9={type:"spring",stiffness:500,damping:25,restSpeed:10},l9=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),c9={type:"keyframes",duration:.8},u9={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},d9=(e,{keyframes:t})=>t.length>2?c9:Tc.has(e)?e.startsWith("scale")?l9(t[1]):i9:u9;function KE(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Fb(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?KE(n,e):n}const f9=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function h9(e){for(const t in e)if(!f9.has(t))return!0;return!1}const $b=(e,t,n,r={},o,a)=>l=>{const u=Fb(r,e)||{},d=u.delay||r.delay||0;let{elapsed:f=0}=r;f=f-vr(d);const m={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...u,delay:-f,onUpdate:g=>{t.set(g),u.onUpdate&&u.onUpdate(g)},onComplete:()=>{l(),u.onComplete&&u.onComplete()},name:e,motionValue:t,element:a?void 0:o};h9(u)||Object.assign(m,d9(e,m)),m.duration&&(m.duration=vr(m.duration)),m.repeatDelay&&(m.repeatDelay=vr(m.repeatDelay)),m.from!==void 0&&(m.keyframes[0]=m.from);let p=!1;if((m.type===!1||m.duration===0&&!m.repeatDelay)&&(e0(m),m.delay===0&&(p=!0)),(Sa.instantAnimations||Sa.skipAnimations||o!=null&&o.shouldSkipAnimations)&&(p=!0,e0(m),m.delay=0),m.allowFlatten=!u.type&&!u.ease,p&&!a&&t.get()!==void 0){const g=mp(m.keyframes,u);if(g!==void 0){kt.update(()=>{m.onUpdate(g),m.onComplete()});return}}return u.isSync?new km(m):new s9(m)};function qC(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Vb(e,t,n,r){if(typeof t=="function"){const[o,a]=qC(r);t=t(n!==void 0?n:e.custom,o,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,a]=qC(r);t=t(n!==void 0?n:e.custom,o,a)}return t}function _i(e,t,n){const r=e.getProps();return Vb(r,t,n!==void 0?n:r.custom,e)}const YE=new Set(["width","height","top","left","right","bottom",...Pc]),KC=30,m9=e=>!isNaN(parseFloat(e));class p9{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var a;const o=$n.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=$n.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=m9(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Eb);const r=this.events[t].add(n);return t==="change"?()=>{r(),kt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=$n.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>KC)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,KC);return fE(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function oc(e,t){return new p9(e,t)}const t0=e=>Array.isArray(e);function g9(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,oc(n))}function x9(e){return t0(e)?e[e.length-1]||0:e}function y9(e,t){const n=_i(e,t);let{transitionEnd:r={},transition:o={},...a}=n||{};a={...a,...r};for(const l in a){const u=x9(a[l]);g9(e,l,u)}}const Nn=e=>!!(e&&e.getVelocity);function v9(e){return!!(Nn(e)&&e.add)}function n0(e,t){const n=e.getValue("willChange");if(v9(n))return n.add(t);if(!n&&Sa.WillChange){const r=new Sa.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function zb(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const b9="framerAppearId",QE="data-"+zb(b9);function GE(e){return e.props[QE]}function w9({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function XE(e,t,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:a,transitionEnd:l,...u}=t;const d=e.getDefaultTransition();a=a?KE(a,d):d;const f=a==null?void 0:a.reduceMotion;r&&(a=r);const m=[],p=o&&e.animationState&&e.animationState.getState()[o];for(const g in u){const y=e.getValue(g,e.latestValues[g]??null),b=u[g];if(b===void 0||p&&w9(p,g))continue;const w={delay:n,...Fb(a||{},g)},N=y.get();if(N!==void 0&&!y.isAnimating&&!Array.isArray(b)&&b===N&&!w.velocity)continue;let k=!1;if(window.MotionHandoffAnimation){const S=GE(e);if(S){const E=window.MotionHandoffAnimation(S,g,kt);E!==null&&(w.startTime=E,k=!0)}}n0(e,g);const j=f??e.shouldReduceMotion;y.start($b(g,y,b,j&&YE.has(g)?{type:!1}:w,e,k));const C=y.animation;C&&m.push(C)}if(l){const g=()=>kt.update(()=>{l&&y9(e,l)});m.length?Promise.all(m).then(g):g()}return m}function r0(e,t,n={}){var d;const r=_i(e,t,n.type==="exit"?(d=e.presenceContext)==null?void 0:d.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const a=r?()=>Promise.all(XE(e,r,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:m=0,staggerChildren:p,staggerDirection:g}=o;return N9(e,t,f,m,p,g,n)}:()=>Promise.resolve(),{when:u}=o;if(u){const[f,m]=u==="beforeChildren"?[a,l]:[l,a];return f().then(()=>m())}else return Promise.all([a(),l(n.delay)])}function N9(e,t,n=0,r=0,o=0,a=1,l){const u=[];for(const d of e.variantChildren)d.notify("AnimationStart",t),u.push(r0(d,t,{...l,delay:n+(typeof r=="function"?0:r)+UE(e.variantChildren,d,r,o,a)}).then(()=>d.notify("AnimationComplete",t)));return Promise.all(u)}function j9(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const o=t.map(a=>r0(e,a,n));r=Promise.all(o)}else if(typeof t=="string")r=r0(e,t,n);else{const o=typeof t=="function"?_i(e,t,n.custom):t;r=Promise.all(XE(e,o,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const C9={test:e=>e==="auto",parse:e=>e},ZE=e=>t=>t.test(e),JE=[Ec,Me,Ls,Jo,G$,Q$,C9],YC=e=>JE.find(ZE(e));function k9(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||uE(e):!0}const S9=new Set(["brightness","contrast","saturate","opacity"]);function _9(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ab)||[];if(!r)return e;const o=n.replace(r,"");let a=S9.has(t)?1:0;return r!==n&&(a*=100),t+"("+a+o+")"}const E9=/\b([a-z-]*)\(.*?\)/gu,s0={...as,getAnimatableNone:e=>{const t=e.match(E9);return t?t.map(_9).join(" "):e}},o0={...as,getAnimatableNone:e=>{const t=as.parse(e);return as.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},QC={...Ec,transform:Math.round},P9={rotate:Jo,rotateX:Jo,rotateY:Jo,rotateZ:Jo,scale:fh,scaleX:fh,scaleY:fh,scaleZ:fh,skew:Jo,skewX:Jo,skewY:Jo,distance:Me,translateX:Me,translateY:Me,translateZ:Me,x:Me,y:Me,z:Me,perspective:Me,transformPerspective:Me,opacity:Ju,originX:OC,originY:OC,originZ:Me},Bb={borderWidth:Me,borderTopWidth:Me,borderRightWidth:Me,borderBottomWidth:Me,borderLeftWidth:Me,borderRadius:Me,borderTopLeftRadius:Me,borderTopRightRadius:Me,borderBottomRightRadius:Me,borderBottomLeftRadius:Me,width:Me,maxWidth:Me,height:Me,maxHeight:Me,top:Me,right:Me,bottom:Me,left:Me,inset:Me,insetBlock:Me,insetBlockStart:Me,insetBlockEnd:Me,insetInline:Me,insetInlineStart:Me,insetInlineEnd:Me,padding:Me,paddingTop:Me,paddingRight:Me,paddingBottom:Me,paddingLeft:Me,paddingBlock:Me,paddingBlockStart:Me,paddingBlockEnd:Me,paddingInline:Me,paddingInlineStart:Me,paddingInlineEnd:Me,margin:Me,marginTop:Me,marginRight:Me,marginBottom:Me,marginLeft:Me,marginBlock:Me,marginBlockStart:Me,marginBlockEnd:Me,marginInline:Me,marginInlineStart:Me,marginInlineEnd:Me,fontSize:Me,backgroundPositionX:Me,backgroundPositionY:Me,...P9,zIndex:QC,fillOpacity:Ju,strokeOpacity:Ju,numOctaves:QC},T9={...Bb,color:Zt,backgroundColor:Zt,outlineColor:Zt,fill:Zt,stroke:Zt,borderColor:Zt,borderTopColor:Zt,borderRightColor:Zt,borderBottomColor:Zt,borderLeftColor:Zt,filter:s0,WebkitFilter:s0,mask:o0,WebkitMask:o0},eP=e=>T9[e],M9=new Set([s0,o0]);function tP(e,t){let n=eP(e);return M9.has(n)||(n=as),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const A9=new Set(["auto","none","0"]);function D9(e,t,n){let r=0,o;for(;r<e.length&&!o;){const a=e[r];typeof a=="string"&&!A9.has(a)&&sc(a).values.length&&(o=e[r]),r++}if(o&&n)for(const a of t)e[a]=tP(n,o)}class R9 extends Lb{constructor(t,n,r,o,a){super(t,n,r,o,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let m=0;m<t.length;m++){let p=t[m];if(typeof p=="string"&&(p=p.trim(),Mb(p))){const g=qE(p,n.current);g!==void 0&&(t[m]=g),m===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!YE.has(r)||t.length!==2)return;const[o,a]=t,l=YC(o),u=YC(a),d=RC(o),f=RC(a);if(d!==f&&ha[r]){this.needsMeasurement=!0;return}if(l!==u)if(WC(l)&&WC(u))for(let m=0;m<t.length;m++){const p=t[m];typeof p=="string"&&(t[m]=parseFloat(p))}else ha[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let o=0;o<t.length;o++)(t[o]===null||k9(t[o]))&&r.push(o);r.length&&D9(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ha[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){var u;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const a=r.length-1,l=r[a];r[a]=ha[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),(u=this.removedTransforms)!=null&&u.length&&this.removedTransforms.forEach(([d,f])=>{t.getValue(d).set(f)}),this.resolveNoneKeyframes()}}function nP(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const o=(n==null?void 0:n[e])??r.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e).filter(r=>r!=null)}const rP=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Wh(e){return cE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Wb}=jE(queueMicrotask,!1),Xr={x:!1,y:!1};function sP(){return Xr.x||Xr.y}function O9(e){return e==="x"||e==="y"?Xr[e]?null:(Xr[e]=!0,()=>{Xr[e]=!1}):Xr.x||Xr.y?null:(Xr.x=Xr.y=!0,()=>{Xr.x=Xr.y=!1})}function oP(e,t){const n=nP(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[n,o,()=>r.abort()]}function I9(e){return!(e.pointerType==="touch"||sP())}function L9(e,t,n={}){const[r,o,a]=oP(e,n);return r.forEach(l=>{let u=!1,d=!1,f;const m=()=>{l.removeEventListener("pointerleave",b)},p=N=>{f&&(f(N),f=void 0),m()},g=N=>{u=!1,window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),d&&(d=!1,p(N))},y=()=>{u=!0,window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",g,o)},b=N=>{if(N.pointerType!=="touch"){if(u){d=!0;return}p(N)}},w=N=>{if(!I9(N))return;d=!1;const k=t(l,N);typeof k=="function"&&(f=k,l.addEventListener("pointerleave",b,o))};l.addEventListener("pointerenter",w,o),l.addEventListener("pointerdown",y,o)}),a}const aP=(e,t)=>t?e===t?!0:aP(e,t.parentElement):!1,Hb=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,F9=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function $9(e){return F9.has(e.tagName)||e.isContentEditable===!0}const V9=new Set(["INPUT","SELECT","TEXTAREA"]);function z9(e){return V9.has(e.tagName)||e.isContentEditable===!0}const Hh=new WeakSet;function GC(e){return t=>{t.key==="Enter"&&e(t)}}function hy(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const B9=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=GC(()=>{if(Hh.has(n))return;hy(n,"down");const o=GC(()=>{hy(n,"up")}),a=()=>hy(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function XC(e){return Hb(e)&&!sP()}const ZC=new WeakSet;function W9(e,t,n={}){const[r,o,a]=oP(e,n),l=u=>{const d=u.currentTarget;if(!XC(u)||ZC.has(u))return;Hh.add(d),n.stopPropagation&&ZC.add(u);const f=t(d,u),m=(y,b)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",g),Hh.has(d)&&Hh.delete(d),XC(y)&&typeof f=="function"&&f(y,{success:b})},p=y=>{m(y,d===window||d===document||n.useGlobalTarget||aP(d,y.target))},g=y=>{m(y,!1)};window.addEventListener("pointerup",p,o),window.addEventListener("pointercancel",g,o)};return r.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",l,o),Wh(u)&&(u.addEventListener("focus",f=>B9(f,o)),!$9(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),a}function Ub(e){return cE(e)&&"ownerSVGElement"in e}const Uh=new WeakMap;let ea;const iP=(e,t,n)=>(r,o)=>o&&o[0]?o[0][e+"Size"]:Ub(r)&&"getBBox"in r?r.getBBox()[t]:r[n],H9=iP("inline","width","offsetWidth"),U9=iP("block","height","offsetHeight");function q9({target:e,borderBoxSize:t}){var n;(n=Uh.get(e))==null||n.forEach(r=>{r(e,{get width(){return H9(e,t)},get height(){return U9(e,t)}})})}function K9(e){e.forEach(q9)}function Y9(){typeof ResizeObserver>"u"||(ea=new ResizeObserver(K9))}function Q9(e,t){ea||Y9();const n=nP(e);return n.forEach(r=>{let o=Uh.get(r);o||(o=new Set,Uh.set(r,o)),o.add(t),ea==null||ea.observe(r)}),()=>{n.forEach(r=>{const o=Uh.get(r);o==null||o.delete(t),o!=null&&o.size||ea==null||ea.unobserve(r)})}}const qh=new Set;let Al;function G9(){Al=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};qh.forEach(t=>t(e))},window.addEventListener("resize",Al)}function X9(e){return qh.add(e),Al||G9(),()=>{qh.delete(e),!qh.size&&typeof Al=="function"&&(window.removeEventListener("resize",Al),Al=void 0)}}function JC(e,t){return typeof e=="function"?X9(e):Q9(e,t)}function Z9(e){return Ub(e)&&e.tagName==="svg"}const J9=[...JE,Zt,as],eV=e=>J9.find(ZE(e)),ek=()=>({translate:0,scale:1,origin:0,originPoint:0}),Dl=()=>({x:ek(),y:ek()}),tk=()=>({min:0,max:0}),sn=()=>({x:tk(),y:tk()}),tV=new WeakMap;function pp(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function ed(e){return typeof e=="string"||Array.isArray(e)}const qb=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Kb=["initial",...qb];function gp(e){return pp(e.animate)||Kb.some(t=>ed(e[t]))}function lP(e){return!!(gp(e)||e.variants)}function nV(e,t,n){for(const r in t){const o=t[r],a=n[r];if(Nn(o))e.addValue(r,o);else if(Nn(a))e.addValue(r,oc(o,{owner:e}));else if(a!==o)if(e.hasValue(r)){const l=e.getValue(r);l.liveStyle===!0?l.jump(o):l.hasAnimated||l.set(o)}else{const l=e.getStaticValue(r);e.addValue(r,oc(l!==void 0?l:o,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const a0={current:null},cP={current:!1},rV=typeof window<"u";function sV(){if(cP.current=!0,!!rV)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>a0.current=e.matches;e.addEventListener("change",t),t()}else a0.current=!1}const nk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Sm={};function uP(e){Sm=e}function oV(){return Sm}class aV{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:o,skipAnimations:a,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Lb,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=$n.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,kt.render(this.render,!1,!0))};const{latestValues:f,renderState:m}=u;this.latestValues=f,this.baseTarget={...f},this.initialValues=n.initial?{...f}:{},this.renderState=m,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=a,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=gp(n),this.isVariantNode=lP(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const y in g){const b=g[y];f[y]!==void 0&&Nn(b)&&b.set(f[y])}}mount(t){var n,r;if(this.hasBeenMounted)for(const o in this.initialValues)(n=this.values.get(o))==null||n.jump(this.initialValues[o]),this.latestValues[o]=this.initialValues[o];this.current=t,tV.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,a)=>this.bindToMotionValue(a,o)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(cP.current||sV(),this.shouldReduceMotion=a0.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),_a(this.notifyUpdate),_a(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&HE.has(t)&&this.current instanceof HTMLElement){const{factory:l,keyframes:u,times:d,ease:f,duration:m}=n.accelerate,p=new BE({element:this.current,name:t,keyframes:u,times:d,ease:f,duration:vr(m)}),g=l(p);this.valueSubscriptions.set(t,()=>{g(),p.cancel()});return}const r=Tc.has(t);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&kt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Sm){const n=Sm[t];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[t]&&o&&r(this.props)&&(this.features[t]=new o(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):sn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<nk.length;r++){const o=nk[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const a="on"+o,l=t[a];l&&(this.propEventSubscriptions[o]=this.on(o,l))}this.prevMotionValues=nV(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=oc(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(lE(r)||uE(r))?r=parseFloat(r):!eV(r)&&as.test(n)&&(r=tP(t,n)),this.setBaseTarget(t,Nn(r)?r.get():r)),Nn(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var a;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const l=Vb(this.props,n,(a=this.presenceContext)==null?void 0:a.custom);l&&(r=l[t])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Nn(o)?o:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Eb),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Wb.render(this.render)}}class dP extends aV{constructor(){super(...arguments),this.KeyframeResolver=R9}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Nn(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Ra{constructor(t){this.isMounted=!1,this.node=t}update(){}}function fP({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function iV({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function lV(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function my(e){return e===void 0||e===1}function i0({scale:e,scaleX:t,scaleY:n}){return!my(e)||!my(t)||!my(n)}function ii(e){return i0(e)||hP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function hP(e){return rk(e.x)||rk(e.y)}function rk(e){return e&&e!=="0%"}function _m(e,t,n){const r=e-n,o=t*r;return n+o}function sk(e,t,n,r,o){return o!==void 0&&(e=_m(e,o,r)),_m(e,n,r)+t}function l0(e,t=0,n=1,r,o){e.min=sk(e.min,t,n,r,o),e.max=sk(e.max,t,n,r,o)}function mP(e,{x:t,y:n}){l0(e.x,t.translate,t.scale,t.originPoint),l0(e.y,n.translate,n.scale,n.originPoint)}const ok=.999999999999,ak=1.0000000000001;function cV(e,t,n,r=!1){var u;const o=n.length;if(!o)return;t.x=t.y=1;let a,l;for(let d=0;d<o;d++){a=n[d],l=a.projectionDelta;const{visualElement:f}=a.options;f&&f.props.style&&f.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Ps(e.x,-a.scroll.offset.x),Ps(e.y,-a.scroll.offset.y)),l&&(t.x*=l.x.scale,t.y*=l.y.scale,mP(e,l)),r&&ii(a.latestValues)&&Kh(e,a.latestValues,(u=a.layout)==null?void 0:u.layoutBox))}t.x<ak&&t.x>ok&&(t.x=1),t.y<ak&&t.y>ok&&(t.y=1)}function Ps(e,t){e.min+=t,e.max+=t}function ik(e,t,n,r,o=.5){const a=Ft(e.min,e.max,o);l0(e,t,n,a,r)}function lk(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Kh(e,t,n){const r=n??e;ik(e.x,lk(t.x,r.x),t.scaleX,t.scale,t.originX),ik(e.y,lk(t.y,r.y),t.scaleY,t.scale,t.originY)}function pP(e,t){return fP(lV(e.getBoundingClientRect(),t))}function uV(e,t,n){const r=pP(e,n),{scroll:o}=t;return o&&(Ps(r.x,o.offset.x),Ps(r.y,o.offset.y)),r}const dV={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fV=Pc.length;function hV(e,t,n){let r="",o=!0;for(let a=0;a<fV;a++){const l=Pc[a],u=e[l];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(l.startsWith("scale")?1:0);else{const f=parseFloat(u);d=l.startsWith("scale")?f===1:f===0}if(!d||n){const f=rP(u,Bb[l]);if(!d){o=!1;const m=dV[l]||l;r+=`${m}(${f}) `}n&&(t[l]=f)}}return r=r.trim(),n?r=n(t,o?"":r):o&&(r="none"),r}function Yb(e,t,n){const{style:r,vars:o,transformOrigin:a}=e;let l=!1,u=!1;for(const d in t){const f=t[d];if(Tc.has(d)){l=!0;continue}else if(kE(d)){o[d]=f;continue}else{const m=rP(f,Bb[d]);d.startsWith("origin")?(u=!0,a[d]=m):r[d]=m}}if(t.transform||(l||n?r.transform=hV(t,e.transform,n):r.transform&&(r.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:m=0}=a;r.transformOrigin=`${d} ${f} ${m}`}}function gP(e,{style:t,vars:n},r,o){const a=e.style;let l;for(l in t)a[l]=t[l];o==null||o.applyProjectionStyles(a,r);for(l in n)a.setProperty(l,n[l])}function ck(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const vu={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Me.test(e))e=parseFloat(e);else return e;const n=ck(e,t.target.x),r=ck(e,t.target.y);return`${n}% ${r}%`}},mV={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=as.parse(e);if(o.length>5)return r;const a=as.createTransformer(e),l=typeof o[0]!="number"?1:0,u=n.x.scale*t.x,d=n.y.scale*t.y;o[0+l]/=u,o[1+l]/=d;const f=Ft(u,d,.5);return typeof o[2+l]=="number"&&(o[2+l]/=f),typeof o[3+l]=="number"&&(o[3+l]/=f),a(o)}},c0={borderRadius:{...vu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vu,borderTopRightRadius:vu,borderBottomLeftRadius:vu,borderBottomRightRadius:vu,boxShadow:mV};function xP(e,{layout:t,layoutId:n}){return Tc.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!c0[e]||e==="opacity")}function Qb(e,t,n){var l;const r=e.style,o=t==null?void 0:t.style,a={};if(!r)return a;for(const u in r)(Nn(r[u])||o&&Nn(o[u])||xP(u,e)||((l=n==null?void 0:n.getValue(u))==null?void 0:l.liveStyle)!==void 0)&&(a[u]=r[u]);return a}function pV(e){return window.getComputedStyle(e)}class gV extends dP{constructor(){super(...arguments),this.type="html",this.renderInstance=gP}readValueFromInstance(t,n){var r;if(Tc.has(n))return(r=this.projection)!=null&&r.isProjecting?Qv(n):I8(t,n);{const o=pV(t),a=(kE(n)?o.getPropertyValue(n):o[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:n}){return pP(t,n)}build(t,n,r){Yb(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Qb(t,n,r)}}const xV={offset:"stroke-dashoffset",array:"stroke-dasharray"},yV={offset:"strokeDashoffset",array:"strokeDasharray"};function vV(e,t,n=1,r=0,o=!0){e.pathLength=1;const a=o?xV:yV;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}const bV=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function yP(e,{attrX:t,attrY:n,attrScale:r,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},d,f,m){if(Yb(e,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:g}=e;p.transform&&(g.transform=p.transform,delete p.transform),(g.transform||p.transformOrigin)&&(g.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),g.transform&&(g.transformBox=(m==null?void 0:m.transformBox)??"fill-box",delete p.transformBox);for(const y of bV)p[y]!==void 0&&(g[y]=p[y],delete p[y]);t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),o!==void 0&&vV(p,o,a,l,!1)}const vP=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),bP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function wV(e,t,n,r){gP(e,t,void 0,r);for(const o in t.attrs)e.setAttribute(vP.has(o)?o:zb(o),t.attrs[o])}function wP(e,t,n){const r=Qb(e,t,n);for(const o in e)if(Nn(e[o])||Nn(t[o])){const a=Pc.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[a]=e[o]}return r}class NV extends dP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=sn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Tc.has(n)){const r=eP(n);return r&&r.default||0}return n=vP.has(n)?n:zb(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return wP(t,n,r)}build(t,n,r){yP(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,o){wV(t,n,r,o)}mount(t){this.isSVGTag=bP(t.tagName),super.mount(t)}}const jV=Kb.length;function NP(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?NP(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<jV;n++){const r=Kb[n],o=e.props[r];(ed(o)||o===!1)&&(t[r]=o)}return t}function jP(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const CV=[...qb].reverse(),kV=qb.length;function SV(e){return t=>Promise.all(t.map(({animation:n,options:r})=>j9(e,n,r)))}function _V(e){let t=SV(e),n=uk(),r=!0,o=!1;const a=f=>(m,p)=>{var y;const g=_i(e,p,f==="exit"?(y=e.presenceContext)==null?void 0:y.custom:void 0);if(g){const{transition:b,transitionEnd:w,...N}=g;m={...m,...N,...w}}return m};function l(f){t=f(e)}function u(f){const{props:m}=e,p=NP(e.parent)||{},g=[],y=new Set;let b={},w=1/0;for(let k=0;k<kV;k++){const j=CV[k],C=n[j],S=m[j]!==void 0?m[j]:p[j],E=ed(S),P=j===f?C.isActive:null;P===!1&&(w=k);let D=S===p[j]&&S!==m[j]&&E;if(D&&(r||o)&&e.manuallyAnimateOnMount&&(D=!1),C.protectedKeys={...b},!C.isActive&&P===null||!S&&!C.prevProp||pp(S)||typeof S=="boolean")continue;if(j==="exit"&&C.isActive&&P!==!0){C.prevResolvedValues&&(b={...b,...C.prevResolvedValues});continue}const I=EV(C.prevProp,S);let z=I||j===f&&C.isActive&&!D&&E||k>w&&E,K=!1;const q=Array.isArray(S)?S:[S];let H=q.reduce(a(j),{});P===!1&&(H={});const{prevResolvedValues:B={}}=C,R={...B,...H},M=A=>{z=!0,y.has(A)&&(K=!0,y.delete(A)),C.needsAnimating[A]=!0;const O=e.getValue(A);O&&(O.liveStyle=!1)};for(const A in R){const O=H[A],U=B[A];if(b.hasOwnProperty(A))continue;let V=!1;t0(O)&&t0(U)?V=!jP(O,U):V=O!==U,V?O!=null?M(A):y.add(A):O!==void 0&&y.has(A)?M(A):C.protectedKeys[A]=!0}C.prevProp=S,C.prevResolvedValues=H,C.isActive&&(b={...b,...H}),(r||o)&&e.blockInitialAnimation&&(z=!1);const F=D&&I;z&&(!F||K)&&g.push(...q.map(A=>{const O={type:j};if(typeof A=="string"&&(r||o)&&!F&&e.manuallyAnimateOnMount&&e.parent){const{parent:U}=e,V=_i(U,A);if(U.enteringChildren&&V){const{delayChildren:$}=V.transition||{};O.delay=UE(U.enteringChildren,e,$)}}return{animation:A,options:O}}))}if(y.size){const k={};if(typeof m.initial!="boolean"){const j=_i(e,Array.isArray(m.initial)?m.initial[0]:m.initial);j&&j.transition&&(k.transition=j.transition)}y.forEach(j=>{const C=e.getBaseTarget(j),S=e.getValue(j);S&&(S.liveStyle=!0),k[j]=C??null}),g.push({animation:k})}let N=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!e.manuallyAnimateOnMount&&(N=!1),r=!1,o=!1,N?t(g):Promise.resolve()}function d(f,m){var g;if(n[f].isActive===m)return Promise.resolve();(g=e.variantChildren)==null||g.forEach(y=>{var b;return(b=y.animationState)==null?void 0:b.setActive(f,m)}),n[f].isActive=m;const p=u(f);for(const y in n)n[y].protectedKeys={};return p}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=uk(),o=!0}}}function EV(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!jP(t,e):!1}function ti(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function uk(){return{animate:ti(!0),whileInView:ti(),whileHover:ti(),whileTap:ti(),whileDrag:ti(),whileFocus:ti(),exit:ti()}}function u0(e,t){e.min=t.min,e.max=t.max}function Gr(e,t){u0(e.x,t.x),u0(e.y,t.y)}function dk(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const CP=1e-4,PV=1-CP,TV=1+CP,kP=.01,MV=0-kP,AV=0+kP;function Vn(e){return e.max-e.min}function DV(e,t,n){return Math.abs(e-t)<=n}function fk(e,t,n,r=.5){e.origin=r,e.originPoint=Ft(t.min,t.max,e.origin),e.scale=Vn(n)/Vn(t),e.translate=Ft(n.min,n.max,e.origin)-e.originPoint,(e.scale>=PV&&e.scale<=TV||isNaN(e.scale))&&(e.scale=1),(e.translate>=MV&&e.translate<=AV||isNaN(e.translate))&&(e.translate=0)}function zu(e,t,n,r){fk(e.x,t.x,n.x,r?r.originX:void 0),fk(e.y,t.y,n.y,r?r.originY:void 0)}function hk(e,t,n){e.min=n.min+t.min,e.max=e.min+Vn(t)}function RV(e,t,n){hk(e.x,t.x,n.x),hk(e.y,t.y,n.y)}function mk(e,t,n){e.min=t.min-n.min,e.max=e.min+Vn(t)}function Em(e,t,n){mk(e.x,t.x,n.x),mk(e.y,t.y,n.y)}function pk(e,t,n,r,o){return e-=t,e=_m(e,1/n,r),o!==void 0&&(e=_m(e,1/o,r)),e}function OV(e,t=0,n=1,r=.5,o,a=e,l=e){if(Ls.test(t)&&(t=parseFloat(t),t=Ft(l.min,l.max,t/100)-l.min),typeof t!="number")return;let u=Ft(a.min,a.max,r);e===a&&(u-=t),e.min=pk(e.min,t,n,u,o),e.max=pk(e.max,t,n,u,o)}function gk(e,t,[n,r,o],a,l){OV(e,t[n],t[r],t[o],t.scale,a,l)}const IV=["x","scaleX","originX"],LV=["y","scaleY","originY"];function xk(e,t,n,r){gk(e.x,t,IV,n?n.x:void 0,r?r.x:void 0),gk(e.y,t,LV,n?n.y:void 0,r?r.y:void 0)}function yk(e){return e.translate===0&&e.scale===1}function SP(e){return yk(e.x)&&yk(e.y)}function vk(e,t){return e.min===t.min&&e.max===t.max}function FV(e,t){return vk(e.x,t.x)&&vk(e.y,t.y)}function bk(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function _P(e,t){return bk(e.x,t.x)&&bk(e.y,t.y)}function wk(e){return Vn(e.x)/Vn(e.y)}function Nk(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ks(e){return[e("x"),e("y")]}function $V(e,t,n){let r="";const o=e.x.translate/t.x,a=e.y.translate/t.y,l=(n==null?void 0:n.z)||0;if((o||a||l)&&(r=`translate3d(${o}px, ${a}px, ${l}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:f,rotate:m,rotateX:p,rotateY:g,skewX:y,skewY:b}=n;f&&(r=`perspective(${f}px) ${r}`),m&&(r+=`rotate(${m}deg) `),p&&(r+=`rotateX(${p}deg) `),g&&(r+=`rotateY(${g}deg) `),y&&(r+=`skewX(${y}deg) `),b&&(r+=`skewY(${b}deg) `)}const u=e.x.scale*t.x,d=e.y.scale*t.y;return(u!==1||d!==1)&&(r+=`scale(${u}, ${d})`),r||"none"}const EP=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],VV=EP.length,jk=e=>typeof e=="string"?parseFloat(e):e,Ck=e=>typeof e=="number"||Me.test(e);function zV(e,t,n,r,o,a){o?(e.opacity=Ft(0,n.opacity??1,BV(r)),e.opacityExit=Ft(t.opacity??1,0,WV(r))):a&&(e.opacity=Ft(t.opacity??1,n.opacity??1,r));for(let l=0;l<VV;l++){const u=EP[l];let d=kk(t,u),f=kk(n,u);if(d===void 0&&f===void 0)continue;d||(d=0),f||(f=0),d===0||f===0||Ck(d)===Ck(f)?(e[u]=Math.max(Ft(jk(d),jk(f),r),0),(Ls.test(f)||Ls.test(d))&&(e[u]+="%")):e[u]=f}(t.rotate||n.rotate)&&(e.rotate=Ft(t.rotate||0,n.rotate||0,r))}function kk(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const BV=PP(0,.5,vE),WV=PP(.5,.95,$r);function PP(e,t,n){return r=>r<e?0:r>t?1:n(Zu(e,t,r))}function HV(e,t,n){const r=Nn(e)?e:oc(e);return r.start($b("",r,t,n)),r.animation}function td(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const UV=(e,t)=>e.depth-t.depth;class qV{constructor(){this.children=[],this.isDirty=!1}add(t){Sb(this.children,t),this.isDirty=!0}remove(t){wm(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(UV),this.isDirty=!1,this.children.forEach(t)}}function KV(e,t){const n=$n.now(),r=({timestamp:o})=>{const a=o-n;a>=t&&(_a(r),e(a-t))};return kt.setup(r,!0),()=>_a(r)}function Yh(e){return Nn(e)?e.get():e}class YV{constructor(){this.members=[]}add(t){Sb(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const o=r.instance;(!o||o.isConnected===!1)&&!r.snapshot&&(wm(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(wm(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const o=this.members[r];if(o.isPresent!==!1&&((n=o.instance)==null?void 0:n.isConnected)!==!1)return this.promote(o),!0}return!1}promote(t,n){var o;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:a}=r.options,{layoutDependency:l}=t.options;(a===void 0||a!==l)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(o=t.root)!=null&&o.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,o,a,l;(r=(n=t.options).onExitComplete)==null||r.call(n),(l=(o=t.resumingFrom)==null?void 0:(a=o.options).onExitComplete)==null||l.call(a)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const Qh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},py=["","X","Y","Z"],QV=1e3;let GV=0;function gy(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function TP(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=GE(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",kt,!(o||a))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&TP(r)}function MP({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(l={},u=t==null?void 0:t()){this.id=GV++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(JV),this.nodes.forEach(sz),this.nodes.forEach(oz),this.nodes.forEach(ez)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new qV)}addEventListener(l,u){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new Eb),this.eventHandlers.get(l).add(u)}notifyListeners(l,...u){const d=this.eventHandlers.get(l);d&&d.notify(...u)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=Ub(l)&&!Z9(l),this.instance=l;const{layoutId:u,layout:d,visualElement:f}=this.options;if(f&&!f.current&&f.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||u)&&(this.isLayoutDirty=!0),e){let m,p=0;const g=()=>this.root.updateBlockedByResize=!1;kt.read(()=>{p=window.innerWidth}),e(l,()=>{const y=window.innerWidth;y!==p&&(p=y,this.root.updateBlockedByResize=!0,m&&m(),m=KV(g,250),Qh.hasAnimatedSinceResize&&(Qh.hasAnimatedSinceResize=!1,this.nodes.forEach(Ek)))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&f&&(u||d)&&this.addEventListener("didUpdate",({delta:m,hasLayoutChanged:p,hasRelativeLayoutChanged:g,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||f.getDefaultTransition()||uz,{onLayoutAnimationStart:w,onLayoutAnimationComplete:N}=f.getProps(),k=!this.targetLayout||!_P(this.targetLayout,y),j=!p&&g;if(this.options.layoutRoot||this.resumeFrom||j||p&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...Fb(b,"layout"),onPlay:w,onComplete:N};(f.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(m,j)}else p||Ek(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),_a(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(az),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&TP(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let m=0;m<this.path.length;m++){const p=this.path[m];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:u,layout:d}=this.options;if(u===void 0&&!d)return;const f=this.getTransformTemplate();this.prevTransformTemplateValue=f?f(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Sk);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(_k);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(nz),this.nodes.forEach(rz),this.nodes.forEach(XV),this.nodes.forEach(ZV)):this.nodes.forEach(_k),this.clearAllSnapshots();const u=$n.now();bn.delta=Ws(0,1e3/60,u-bn.timestamp),bn.timestamp=u,bn.isProcessing=!0,iy.update.process(bn),iy.preRender.process(bn),iy.render.process(bn),bn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(tz),this.sharedNodes.forEach(iz)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,kt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){kt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Vn(this.snapshot.measuredBox.x)&&!Vn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=sn()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(u=!1),u&&this.instance){const d=r(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!o)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!SP(this.projectionDelta),d=this.getTransformTemplate(),f=d?d(this.latestValues,""):void 0,m=f!==this.prevTransformTemplateValue;l&&this.instance&&(u||ii(this.latestValues)||m)&&(o(this.instance,f),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const u=this.measurePageBox();let d=this.removeElementScroll(u);return l&&(d=this.removeTransform(d)),dz(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){var f;const{visualElement:l}=this.options;if(!l)return sn();const u=l.measureViewportBox();if(!(((f=this.scroll)==null?void 0:f.wasRoot)||this.path.some(fz))){const{scroll:m}=this.root;m&&(Ps(u.x,m.offset.x),Ps(u.y,m.offset.y))}return u}removeElementScroll(l){var d;const u=sn();if(Gr(u,l),(d=this.scroll)!=null&&d.wasRoot)return u;for(let f=0;f<this.path.length;f++){const m=this.path[f],{scroll:p,options:g}=m;m!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&Gr(u,l),Ps(u.x,p.offset.x),Ps(u.y,p.offset.y))}return u}applyTransform(l,u=!1,d){var m,p;const f=d||sn();Gr(f,l);for(let g=0;g<this.path.length;g++){const y=this.path[g];!u&&y.options.layoutScroll&&y.scroll&&y!==y.root&&(Ps(f.x,-y.scroll.offset.x),Ps(f.y,-y.scroll.offset.y)),ii(y.latestValues)&&Kh(f,y.latestValues,(m=y.layout)==null?void 0:m.layoutBox)}return ii(this.latestValues)&&Kh(f,this.latestValues,(p=this.layout)==null?void 0:p.layoutBox),f}removeTransform(l){var d;const u=sn();Gr(u,l);for(let f=0;f<this.path.length;f++){const m=this.path[f];if(!ii(m.latestValues))continue;let p;m.instance&&(i0(m.latestValues)&&m.updateSnapshot(),p=sn(),Gr(p,m.measurePageBox())),xk(u,m.latestValues,(d=m.snapshot)==null?void 0:d.layoutBox,p)}return ii(this.latestValues)&&xk(u,this.latestValues),u}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==bn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){var y;const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(l||d&&this.isSharedProjectionDirty||this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:m,layoutId:p}=this.options;if(!this.layout||!(m||p))return;this.resolvedRelativeTargetAt=bn.timestamp;const g=this.getClosestProjectingParent();g&&this.linkedParentVersion!==g.layoutVersion&&!g.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(g&&g.layout?this.createRelativeTarget(g,this.layout.layoutBox,g.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=sn(),this.targetWithTransforms=sn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),RV(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Gr(this.target,this.layout.layoutBox),mP(this.target,this.targetDelta)):Gr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?this.createRelativeTarget(g,this.target,g.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||i0(this.parent.latestValues)||hP(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,u,d){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=sn(),this.relativeTargetOrigin=sn(),Em(this.relativeTargetOrigin,u,d),Gr(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var b;const l=this.getLead(),u=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||(b=this.parent)!=null&&b.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===bn.timestamp&&(d=!1),d)return;const{layout:f,layoutId:m}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||m))return;Gr(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,g=this.treeScale.y;cV(this.layoutCorrected,this.treeScale,this.path,u),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=sn());const{target:y}=l;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(dk(this.prevProjectionDelta.x,this.projectionDelta.x),dk(this.prevProjectionDelta.y,this.projectionDelta.y)),zu(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==g||!Nk(this.projectionDelta.x,this.prevProjectionDelta.x)||!Nk(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){var u;if((u=this.options.visualElement)==null||u.scheduleRender(),l){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Dl(),this.projectionDelta=Dl(),this.projectionDeltaWithTransform=Dl()}setAnimationOrigin(l,u=!1){const d=this.snapshot,f=d?d.latestValues:{},m={...this.latestValues},p=Dl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const g=sn(),y=d?d.source:void 0,b=this.layout?this.layout.source:void 0,w=y!==b,N=this.getStack(),k=!N||N.members.length<=1,j=!!(w&&!k&&this.options.crossfade===!0&&!this.path.some(cz));this.animationProgress=0;let C;this.mixTargetDelta=S=>{const E=S/1e3;Pk(p.x,l.x,E),Pk(p.y,l.y,E),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Em(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),lz(this.relativeTarget,this.relativeTargetOrigin,g,E),C&&FV(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=sn()),Gr(C,this.relativeTarget)),w&&(this.animationValues=m,zV(m,f,this.latestValues,E,j,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){var u,d,f;this.notifyListeners("animationStart"),(u=this.currentAnimation)==null||u.stop(),(f=(d=this.resumingFrom)==null?void 0:d.currentAnimation)==null||f.stop(),this.pendingAnimation&&(_a(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kt.update(()=>{Qh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=oc(0)),this.motionValue.jump(0,!1),this.currentAnimation=HV(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:m=>{this.mixTargetDelta(m),l.onUpdate&&l.onUpdate(m)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(QV),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:u,target:d,layout:f,latestValues:m}=l;if(!(!u||!d||!f)){if(this!==l&&this.layout&&f&&AP(this.options.animationType,this.layout.layoutBox,f.layoutBox)){d=this.target||sn();const p=Vn(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+p;const g=Vn(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+g}Gr(u,d),Kh(u,m),zu(this.projectionDeltaWithTransform,this.layoutCorrected,u,m)}}registerSharedNode(l,u){this.sharedNodes.has(l)||this.sharedNodes.set(l,new YV),this.sharedNodes.get(l).add(u);const f=u.options.initialPromotionConfig;u.promote({transition:f?f.transition:void 0,preserveFollowOpacity:f&&f.shouldPreserveFollowOpacity?f.shouldPreserveFollowOpacity(u):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){var u;const{layoutId:l}=this.options;return l?((u=this.getStack())==null?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:l}=this.options;return l?(u=this.getStack())==null?void 0:u.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:u,preserveFollowOpacity:d}={}){const f=this.getStack();f&&f.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let u=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(u=!0),!u)return;const f={};d.z&&gy("z",l,f,this.animationValues);for(let m=0;m<py.length;m++)gy(`rotate${py[m]}`,l,f,this.animationValues),gy(`skew${py[m]}`,l,f,this.animationValues);l.render();for(const m in f)l.setStaticValue(m,f[m]),this.animationValues&&(this.animationValues[m]=f[m]);l.scheduleRender()}applyProjectionStyles(l,u){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Yh(u==null?void 0:u.pointerEvents)||"",l.transform=d?d(this.latestValues,""):"none";return}const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Yh(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!ii(this.latestValues)&&(l.transform=d?d({},""):"none",this.hasProjected=!1);return}l.visibility="";const m=f.animationValues||f.latestValues;this.applyTransformsToTarget();let p=$V(this.projectionDeltaWithTransform,this.treeScale,m);d&&(p=d(m,p)),l.transform=p;const{x:g,y}=this.projectionDelta;l.transformOrigin=`${g.origin*100}% ${y.origin*100}% 0`,f.animationValues?l.opacity=f===this?m.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:m.opacityExit:l.opacity=f===this?m.opacity!==void 0?m.opacity:"":m.opacityExit!==void 0?m.opacityExit:0;for(const b in c0){if(m[b]===void 0)continue;const{correct:w,applyTo:N,isCSSVariable:k}=c0[b],j=p==="none"?m[b]:w(m[b],f);if(N){const C=N.length;for(let S=0;S<C;S++)l[N[S]]=j}else k?this.options.visualElement.renderState.vars[b]=j:l[b]=j}this.options.layoutId&&(l.pointerEvents=f===this?Yh(u==null?void 0:u.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>{var u;return(u=l.currentAnimation)==null?void 0:u.stop()}),this.root.nodes.forEach(Sk),this.root.sharedNodes.clear()}}}function XV(e){e.updateLayout()}function ZV(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:o}=e.layout,{animationType:a}=e.options,l=t.source!==e.layout.source;if(a==="size")ks(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],y=Vn(g);g.min=r[p].min,g.max=g.min+y});else if(a==="x"||a==="y"){const p=a==="x"?"y":"x";u0(l?t.measuredBox[p]:t.layoutBox[p],r[p])}else AP(a,t.layoutBox,r)&&ks(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],y=Vn(r[p]);g.max=g.min+y,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+y)});const u=Dl();zu(u,r,t.layoutBox);const d=Dl();l?zu(d,e.applyTransform(o,!0),t.measuredBox):zu(d,r,t.layoutBox);const f=!SP(u);let m=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:y}=p;if(g&&y){const b=sn();Em(b,t.layoutBox,g.layoutBox);const w=sn();Em(w,r,y.layoutBox),_P(b,w)||(m=!0),p.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=b,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:d,layoutDelta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:m})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function JV(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ez(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function tz(e){e.clearSnapshot()}function Sk(e){e.clearMeasurements()}function _k(e){e.isLayoutDirty=!1}function nz(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function rz(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ek(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function sz(e){e.resolveTargetDelta()}function oz(e){e.calcProjection()}function az(e){e.resetSkewAndRotation()}function iz(e){e.removeLeadSnapshot()}function Pk(e,t,n){e.translate=Ft(t.translate,0,n),e.scale=Ft(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Tk(e,t,n,r){e.min=Ft(t.min,n.min,r),e.max=Ft(t.max,n.max,r)}function lz(e,t,n,r){Tk(e.x,t.x,n.x,r),Tk(e.y,t.y,n.y,r)}function cz(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const uz={duration:.45,ease:[.4,0,.1,1]},Mk=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ak=Mk("applewebkit/")&&!Mk("chrome/")?Math.round:$r;function Dk(e){e.min=Ak(e.min),e.max=Ak(e.max)}function dz(e){Dk(e.x),Dk(e.y)}function AP(e,t,n){return e==="position"||e==="preserve-aspect"&&!DV(wk(t),wk(n),.2)}function fz(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const hz=MP({attachResizeListener:(e,t)=>td(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),xy={current:void 0},DP=MP({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!xy.current){const e=new hz({});e.mount(window),e.setOptions({layoutScroll:!0}),xy.current=e}return xy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Gb=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Rk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mz(...e){return t=>{let n=!1;const r=e.map(o=>{const a=Rk(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():Rk(e[o],null)}}}}function pz(...e){return x.useCallback(mz(...e),e)}class gz extends x.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Wh(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,o=Wh(r)&&r.offsetWidth||0,a=Wh(r)&&r.offsetHeight||0,l=getComputedStyle(n),u=this.props.sizeRef.current;u.height=parseFloat(l.height),u.width=parseFloat(l.width),u.top=n.offsetTop,u.left=n.offsetLeft,u.right=o-u.width-u.left,u.bottom=a-u.height-u.top}return null}componentDidUpdate(){}render(){return this.props.children}}function xz({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:a}){var g;const l=x.useId(),u=x.useRef(null),d=x.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:f}=x.useContext(Gb),m=((g=e.props)==null?void 0:g.ref)??(e==null?void 0:e.ref),p=pz(u,m);return x.useInsertionEffect(()=>{const{width:y,height:b,top:w,left:N,right:k,bottom:j}=d.current;if(t||a===!1||!u.current||!y||!b)return;const C=n==="left"?`left: ${N}`:`right: ${k}`,S=r==="bottom"?`bottom: ${j}`:`top: ${w}`;u.current.dataset.motionPopId=l;const E=document.createElement("style");f&&(E.nonce=f);const P=o??document.head;return P.appendChild(E),E.sheet&&E.sheet.insertRule(`
|
|
554
|
+
[data-motion-pop-id="${l}"] {
|
|
555
|
+
position: absolute !important;
|
|
556
|
+
width: ${y}px !important;
|
|
557
|
+
height: ${b}px !important;
|
|
558
|
+
${C}px !important;
|
|
559
|
+
${S}px !important;
|
|
560
|
+
}
|
|
561
|
+
`),()=>{var D;(D=u.current)==null||D.removeAttribute("data-motion-pop-id"),P.contains(E)&&P.removeChild(E)}},[t]),s.jsx(gz,{isPresent:t,childRef:u,sizeRef:d,pop:a,children:a===!1?e:x.cloneElement(e,{ref:p})})}const yz=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:a,mode:l,anchorX:u,anchorY:d,root:f})=>{const m=kb(vz),p=x.useId();let g=!0,y=x.useMemo(()=>(g=!1,{id:p,initial:t,isPresent:n,custom:o,onExitComplete:b=>{m.set(b,!0);for(const w of m.values())if(!w)return;r&&r()},register:b=>(m.set(b,!1),()=>m.delete(b))}),[n,m,r]);return a&&g&&(y={...y}),x.useMemo(()=>{m.forEach((b,w)=>m.set(w,!1))},[n]),x.useEffect(()=>{!n&&!m.size&&r&&r()},[n]),e=s.jsx(xz,{pop:l==="popLayout",isPresent:n,anchorX:u,anchorY:d,root:f,children:e}),s.jsx(hp.Provider,{value:y,children:e})};function vz(){return new Map}function RP(e=!0){const t=x.useContext(hp);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,a=x.useId();x.useEffect(()=>{if(e)return o(a)},[e]);const l=x.useCallback(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,l]:[!0]}const hh=e=>e.key||"";function Ok(e){const t=[];return x.Children.forEach(e,n=>{x.isValidElement(n)&&t.push(n)}),t}const mn=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:a="sync",propagate:l=!1,anchorX:u="left",anchorY:d="top",root:f})=>{const[m,p]=RP(l),g=x.useMemo(()=>Ok(e),[e]),y=l&&!m?[]:g.map(hh),b=x.useRef(!0),w=x.useRef(g),N=kb(()=>new Map),k=x.useRef(new Set),[j,C]=x.useState(g),[S,E]=x.useState(g);iE(()=>{b.current=!1,w.current=g;for(let I=0;I<S.length;I++){const z=hh(S[I]);y.includes(z)?(N.delete(z),k.current.delete(z)):N.get(z)!==!0&&N.set(z,!1)}},[S,y.length,y.join("-")]);const P=[];if(g!==j){let I=[...g];for(let z=0;z<S.length;z++){const K=S[z],q=hh(K);y.includes(q)||(I.splice(z,0,K),P.push(K))}return a==="wait"&&P.length&&(I=P),E(Ok(I)),C(g),null}const{forceRender:D}=x.useContext(Cb);return s.jsx(s.Fragment,{children:S.map(I=>{const z=hh(I),K=l&&!m?!1:g===S||y.includes(z),q=()=>{if(k.current.has(z))return;if(N.has(z))k.current.add(z),N.set(z,!0);else return;let H=!0;N.forEach(B=>{B||(H=!1)}),H&&(D==null||D(),E(w.current),l&&(p==null||p()),r&&r())};return s.jsx(yz,{isPresent:K,initial:!b.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:a,root:f,onExitComplete:K?void 0:q,anchorX:u,anchorY:d,children:I},z)})})},OP=x.createContext({strict:!1}),Ik={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Lk=!1;function bz(){if(Lk)return;const e={};for(const t in Ik)e[t]={isEnabled:n=>Ik[t].some(r=>!!n[r])};uP(e),Lk=!0}function IP(){return bz(),oV()}function wz(e){const t=IP();for(const n in e)t[n]={...t[n],...e[n]};uP(t)}const Nz=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Pm(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Nz.has(e)}let LP=e=>!Pm(e);function jz(e){typeof e=="function"&&(LP=t=>t.startsWith("on")?!Pm(t):e(t))}try{jz(require("@emotion/is-prop-valid").default)}catch{}function Cz(e,t,n){const r={};for(const o in e)o==="values"&&typeof e.values=="object"||Nn(e[o])||(LP(o)||n===!0&&Pm(o)||!t&&!Pm(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}const xp=x.createContext({});function kz(e,t){if(gp(e)){const{initial:n,animate:r}=e;return{initial:n===!1||ed(n)?n:void 0,animate:ed(r)?r:void 0}}return e.inherit!==!1?t:{}}function Sz(e){const{initial:t,animate:n}=kz(e,x.useContext(xp));return x.useMemo(()=>({initial:t,animate:n}),[Fk(t),Fk(n)])}function Fk(e){return Array.isArray(e)?e.join(" "):e}const Xb=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function FP(e,t,n){for(const r in t)!Nn(t[r])&&!xP(r,n)&&(e[r]=t[r])}function _z({transformTemplate:e},t){return x.useMemo(()=>{const n=Xb();return Yb(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ez(e,t){const n=e.style||{},r={};return FP(r,n,e),Object.assign(r,_z(e,t)),r}function Pz(e,t){const n={},r=Ez(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const $P=()=>({...Xb(),attrs:{}});function Tz(e,t,n,r){const o=x.useMemo(()=>{const a=$P();return yP(a,t,bP(r),e.transformTemplate,e.style),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};FP(a,e.style,e),o.style={...a,...o.style}}return o}const Mz=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Zb(e){return typeof e!="string"||e.includes("-")?!1:!!(Mz.indexOf(e)>-1||/[A-Z]/u.test(e))}function Az(e,t,n,{latestValues:r},o,a=!1,l){const d=(l??Zb(e)?Tz:Pz)(t,r,o,e),f=Cz(t,typeof e=="string",a),m=e!==x.Fragment?{...f,...d,ref:n}:{},{children:p}=t,g=x.useMemo(()=>Nn(p)?p.get():p,[p]);return x.createElement(e,{...m,children:g})}function Dz({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:Rz(n,r,o,e),renderState:t()}}function Rz(e,t,n,r){const o={},a=r(e,{});for(const g in a)o[g]=Yh(a[g]);let{initial:l,animate:u}=e;const d=gp(e),f=lP(e);t&&f&&!d&&e.inherit!==!1&&(l===void 0&&(l=t.initial),u===void 0&&(u=t.animate));let m=n?n.initial===!1:!1;m=m||l===!1;const p=m?u:l;if(p&&typeof p!="boolean"&&!pp(p)){const g=Array.isArray(p)?p:[p];for(let y=0;y<g.length;y++){const b=Vb(e,g[y]);if(b){const{transitionEnd:w,transition:N,...k}=b;for(const j in k){let C=k[j];if(Array.isArray(C)){const S=m?C.length-1:0;C=C[S]}C!==null&&(o[j]=C)}for(const j in w)o[j]=w[j]}}}return o}const VP=e=>(t,n)=>{const r=x.useContext(xp),o=x.useContext(hp),a=()=>Dz(e,t,r,o);return n?a():kb(a)},Oz=VP({scrapeMotionValuesFromProps:Qb,createRenderState:Xb}),Iz=VP({scrapeMotionValuesFromProps:wP,createRenderState:$P}),Lz=Symbol.for("motionComponentSymbol");function Fz(e,t,n){const r=x.useRef(n);x.useInsertionEffect(()=>{r.current=n});const o=x.useRef(null);return x.useCallback(a=>{var u;a&&((u=e.onMount)==null||u.call(e,a));const l=r.current;if(typeof l=="function")if(a){const d=l(a);typeof d=="function"&&(o.current=d)}else o.current?(o.current(),o.current=null):l(a);else l&&(l.current=a);t&&(a?t.mount(a):t.unmount())},[t])}const zP=x.createContext({});function El(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function $z(e,t,n,r,o,a){var C,S;const{visualElement:l}=x.useContext(xp),u=x.useContext(OP),d=x.useContext(hp),f=x.useContext(Gb),m=f.reducedMotion,p=f.skipAnimations,g=x.useRef(null),y=x.useRef(!1);r=r||u.renderer,!g.current&&r&&(g.current=r(e,{visualState:t,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:m,skipAnimations:p,isSVG:a}),y.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const b=g.current,w=x.useContext(zP);b&&!b.projection&&o&&(b.type==="html"||b.type==="svg")&&Vz(g.current,n,o,w);const N=x.useRef(!1);x.useInsertionEffect(()=>{b&&N.current&&b.update(n,d)});const k=n[QE],j=x.useRef(!!k&&typeof window<"u"&&!((C=window.MotionHandoffIsComplete)!=null&&C.call(window,k))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,k)));return iE(()=>{y.current=!0,b&&(N.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),b.scheduleRenderMicrotask(),j.current&&b.animationState&&b.animationState.animateChanges())}),x.useEffect(()=>{b&&(!j.current&&b.animationState&&b.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,k)}),j.current=!1),b.enteringChildren=void 0)}),b}function Vz(e,t,n,r){const{layoutId:o,layout:a,drag:l,dragConstraints:u,layoutScroll:d,layoutRoot:f,layoutCrossfade:m}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:BP(e.parent)),e.projection.setOptions({layoutId:o,layout:a,alwaysMeasureLayout:!!l||u&&El(u),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:m,layoutScroll:d,layoutRoot:f})}function BP(e){if(e)return e.options.allowProjection!==!1?e.projection:BP(e.parent)}function yy(e,{forwardMotionProps:t=!1,type:n}={},r,o){r&&wz(r);const a=n?n==="svg":Zb(e),l=a?Iz:Oz;function u(f,m){let p;const g={...x.useContext(Gb),...f,layoutId:zz(f)},{isStatic:y}=g,b=Sz(f),w=l(f,y);if(!y&&typeof window<"u"){Bz();const N=Wz(g);p=N.MeasureLayout,b.visualElement=$z(e,w,g,o,N.ProjectionNode,a)}return s.jsxs(xp.Provider,{value:b,children:[p&&b.visualElement?s.jsx(p,{visualElement:b.visualElement,...g}):null,Az(e,f,Fz(w,b.visualElement,m),w,y,t,a)]})}u.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const d=x.forwardRef(u);return d[Lz]=e,d}function zz({layoutId:e}){const t=x.useContext(Cb).id;return t&&e!==void 0?t+"-"+e:e}function Bz(e,t){x.useContext(OP).strict}function Wz(e){const t=IP(),{drag:n,layout:r}=t;if(!n&&!r)return{};const o={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function Hz(e,t){if(typeof Proxy>"u")return yy;const n=new Map,r=(a,l)=>yy(a,l,e,t),o=(a,l)=>r(a,l);return new Proxy(o,{get:(a,l)=>l==="create"?r:(n.has(l)||n.set(l,yy(l,void 0,e,t)),n.get(l))})}const Uz=(e,t)=>t.isSVG??Zb(e)?new NV(t):new gV(t,{allowProjection:e!==x.Fragment});class qz extends Ra{constructor(t){super(t),t.animationState||(t.animationState=_V(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();pp(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Kz=0;class Yz extends Ra{constructor(){super(...arguments),this.id=Kz++,this.isExitComplete=!1}update(){var a;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:l,custom:u}=this.node.getProps();if(typeof l=="string"){const d=_i(this.node,l,u);if(d){const{transition:f,transitionEnd:m,...p}=d;for(const g in p)(a=this.node.getValue(g))==null||a.jump(p[g])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Qz={animation:{Feature:qz},exit:{Feature:Yz}};function Dd(e){return{point:{x:e.pageX,y:e.pageY}}}const Gz=e=>t=>Hb(t)&&e(t,Dd(t));function Bu(e,t,n,r){return td(e,t,Gz(n),r)}const WP=({current:e})=>e?e.ownerDocument.defaultView:null,$k=(e,t)=>Math.abs(e-t);function Xz(e,t){const n=$k(e.x,t.x),r=$k(e.y,t.y);return Math.sqrt(n**2+r**2)}const Vk=new Set(["auto","scroll"]);class HP{constructor(t,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:a=!1,distanceThreshold:l=3,element:u}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=y=>{this.handleScroll(y.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=mh(this.lastRawMoveEventInfo,this.transformPagePoint));const y=vy(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,w=Xz(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!b&&!w)return;const{point:N}=y,{timestamp:k}=bn;this.history.push({...N,timestamp:k});const{onStart:j,onMove:C}=this.handlers;b||(j&&j(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,y)},this.handlePointerMove=(y,b)=>{this.lastMoveEvent=y,this.lastRawMoveEventInfo=b,this.lastMoveEventInfo=mh(b,this.transformPagePoint),kt.update(this.updatePoint,!0)},this.handlePointerUp=(y,b)=>{this.end();const{onEnd:w,onSessionEnd:N,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=vy(y.type==="pointercancel"?this.lastMoveEventInfo:mh(b,this.transformPagePoint),this.history);this.startEvent&&w&&w(y,j),N&&N(y,j)},!Hb(t))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=l,this.contextWindow=o||window;const d=Dd(t),f=mh(d,this.transformPagePoint),{point:m}=f,{timestamp:p}=bn;this.history=[{...m,timestamp:p}];const{onSessionStart:g}=n;g&&g(t,vy(f,this.history)),this.removeListeners=Td(Bu(this.contextWindow,"pointermove",this.handlePointerMove),Bu(this.contextWindow,"pointerup",this.handlePointerUp),Bu(this.contextWindow,"pointercancel",this.handlePointerUp)),u&&this.startScrollTracking(u)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Vk.has(r.overflowX)||Vk.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},a={x:o.x-n.x,y:o.y-n.y};a.x===0&&a.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(t,o),kt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),_a(this.updatePoint)}}function mh(e,t){return t?{point:t(e.point)}:e}function zk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function vy({point:e},t){return{point:e,delta:zk(e,UP(t)),offset:zk(e,Zz(t)),velocity:Jz(t,.1)}}function Zz(e){return e[0]}function UP(e){return e[e.length-1]}function Jz(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=UP(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>vr(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&o.timestamp-r.timestamp>vr(t)*2&&(r=e[1]);const a=Fr(o.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const l={x:(o.x-r.x)/a,y:(o.y-r.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function eB(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Ft(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Ft(n,e,r.max):Math.min(e,n)),e}function Bk(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function tB(e,{top:t,left:n,bottom:r,right:o}){return{x:Bk(e.x,n,o),y:Bk(e.y,t,r)}}function Wk(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function nB(e,t){return{x:Wk(e.x,t.x),y:Wk(e.y,t.y)}}function rB(e,t){let n=.5;const r=Vn(e),o=Vn(t);return o>r?n=Zu(t.min,t.max-r,e.min):r>o&&(n=Zu(e.min,e.max-o,t.min)),Ws(0,1,n)}function sB(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const d0=.35;function oB(e=d0){return e===!1?e=0:e===!0&&(e=d0),{x:Hk(e,"left","right"),y:Hk(e,"top","bottom")}}function Hk(e,t,n){return{min:Uk(e,t),max:Uk(e,n)}}function Uk(e,t){return typeof e=="number"?e:e[t]||0}const aB=new WeakMap;class iB{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=sn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const a=p=>{n&&this.snapToCursor(Dd(p).point),this.stopAnimation()},l=(p,g)=>{const{drag:y,dragPropagation:b,onDragStart:w}=this.getProps();if(y&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=O9(y),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ks(k=>{let j=this.getAxisMotionValue(k).get()||0;if(Ls.test(j)){const{projection:C}=this.visualElement;if(C&&C.layout){const S=C.layout.layoutBox[k];S&&(j=Vn(S)*(parseFloat(j)/100))}}this.originPoint[k]=j}),w&&kt.update(()=>w(p,g),!1,!0),n0(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},u=(p,g)=>{this.latestPointerEvent=p,this.latestPanInfo=g;const{dragPropagation:y,dragDirectionLock:b,onDirectionLock:w,onDrag:N}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:k}=g;if(b&&this.currentDirection===null){this.currentDirection=cB(k),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",g.point,k),this.updateAxis("y",g.point,k),this.visualElement.render(),N&&kt.update(()=>N(p,g),!1,!0)},d=(p,g)=>{this.latestPointerEvent=p,this.latestPanInfo=g,this.stop(p,g),this.latestPointerEvent=null,this.latestPanInfo=null},f=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:m}=this.getProps();this.panSession=new HP(t,{onSessionStart:a,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:f},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,distanceThreshold:r,contextWindow:WP(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,o=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!o||!r)return;const{velocity:l}=o;this.startAnimation(l);const{onDragEnd:u}=this.getProps();u&&kt.postRender(()=>u(r,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!ph(t,o,this.currentDirection))return;const a=this.getAxisMotionValue(t);let l=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(l=eB(l,this.constraints[t],this.elastic[t])),a.set(l)}resolveConstraints(){var a;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,o=this.constraints;t&&El(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=tB(r.layoutBox,t):this.constraints=!1,this.elastic=oB(n),o!==this.constraints&&!El(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&ks(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=sB(r.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!El(t))return!1;const r=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const a=uV(r,o.root,this.visualElement.getTransformPagePoint());let l=nB(o.layout.layoutBox,a);if(n){const u=n(iV(l));this.hasMutatedConstraints=!!u,u&&(l=fP(u))}return l}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:a,dragSnapToOrigin:l,onDragTransitionEnd:u}=this.getProps(),d=this.constraints||{},f=ks(m=>{if(!ph(m,n,this.currentDirection))return;let p=d&&d[m]||{};(l===!0||l===m)&&(p={min:0,max:0});const g=o?200:1e6,y=o?40:1e7,b={type:"inertia",velocity:r?t[m]:0,bounceStiffness:g,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...a,...p};return this.startAxisValueAnimation(m,b)});return Promise.all(f).then(u)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return n0(this.visualElement,t),r.start($b(t,r,0,n,this.visualElement,!1))}stopAnimation(){ks(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){ks(n=>{const{drag:r}=this.getProps();if(!ph(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,a=this.getAxisMotionValue(n);if(o&&o.layout){const{min:l,max:u}=o.layout.layoutBox[n],d=a.get()||0;a.set(t[n]-Ft(l,u,.5)+d)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!El(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};ks(l=>{const u=this.getAxisMotionValue(l);if(u&&this.constraints!==!1){const d=u.get();o[l]=rB({min:d,max:d},this.constraints[l])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),ks(l=>{if(!ph(l,t,null))return;const u=this.getAxisMotionValue(l),{min:d,max:f}=this.constraints[l];u.set(Ft(d,f,o[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;aB.set(this.visualElement,this);const t=this.visualElement.current,n=Bu(t,"pointerdown",f=>{const{drag:m,dragListener:p=!0}=this.getProps(),g=f.target,y=g!==t&&z9(g);m&&p&&!y&&this.start(f)});let r;const o=()=>{const{dragConstraints:f}=this.getProps();El(f)&&f.current&&(this.constraints=this.resolveRefConstraints(),r||(r=lB(t,f.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,l=a.addEventListener("measure",o);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),kt.read(o);const u=td(window,"resize",()=>this.scalePositionWithinConstraints()),d=a.addEventListener("didUpdate",(({delta:f,hasLayoutChanged:m})=>{this.isDragging&&m&&(ks(p=>{const g=this.getAxisMotionValue(p);g&&(this.originPoint[p]+=f[p].translate,g.set(g.get()+f[p].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:a=!1,dragElastic:l=d0,dragMomentum:u=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:a,dragElastic:l,dragMomentum:u}}}function qk(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function lB(e,t,n){const r=JC(e,qk(n)),o=JC(t,qk(n));return()=>{r(),o()}}function ph(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function cB(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class uB extends Ra{constructor(t){super(t),this.removeGroupControls=$r,this.removeListeners=$r,this.controls=new iB(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||$r}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const by=e=>(t,n)=>{e&&kt.update(()=>e(t,n),!1,!0)};class dB extends Ra{constructor(){super(...arguments),this.removePointerDownListener=$r}onPointerDown(t){this.session=new HP(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:WP(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:by(t),onStart:by(n),onMove:by(r),onEnd:(a,l)=>{delete this.session,o&&kt.postRender(()=>o(a,l))}}}mount(){this.removePointerDownListener=Bu(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let wy=!1;class fB extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:a}=t;a&&(n.group&&n.group.add(a),r&&r.register&&o&&r.register(a),wy&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Qh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:a}=this.props,{projection:l}=r;return l&&(l.isPresent=a,t.layoutDependency!==n&&l.setOptions({...l.options,layoutDependency:n}),wy=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==a?l.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?l.promote():l.relegate()||kt.postRender(()=>{const u=l.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Wb.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;wy=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function qP(e){const[t,n]=RP(),r=x.useContext(Cb);return s.jsx(fB,{...e,layoutGroup:r,switchLayoutGroup:x.useContext(zP),isPresent:t,safeToRemove:n})}const hB={pan:{Feature:dB},drag:{Feature:uB,ProjectionNode:DP,MeasureLayout:qP}};function Kk(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,a=r[o];a&&kt.postRender(()=>a(t,Dd(t)))}class mB extends Ra{mount(){const{current:t}=this.node;t&&(this.unmount=L9(t,(n,r)=>(Kk(this.node,r,"Start"),o=>Kk(this.node,o,"End"))))}unmount(){}}class pB extends Ra{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Td(td(this.node.current,"focus",()=>this.onFocus()),td(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Yk(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),a=r[o];a&&kt.postRender(()=>a(t,Dd(t)))}class gB extends Ra{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=W9(t,(o,a)=>(Yk(this.node,a,"Start"),(l,{success:u})=>Yk(this.node,l,u?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const f0=new WeakMap,Ny=new WeakMap,xB=e=>{const t=f0.get(e.target);t&&t(e)},yB=e=>{e.forEach(xB)};function vB({root:e,...t}){const n=e||document;Ny.has(n)||Ny.set(n,{});const r=Ny.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(yB,{root:e,...t})),r[o]}function bB(e,t,n){const r=vB(t);return f0.set(e,n),r.observe(e),()=>{f0.delete(e),r.unobserve(e)}}const wB={some:0,all:1};class NB extends Ra{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var d;(d=this.stopObserver)==null||d.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:a}=t,l={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:wB[o]},u=f=>{const{isIntersecting:m}=f;if(this.isInView===m||(this.isInView=m,a&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),y=m?p:g;y&&y(f)};this.stopObserver=bB(this.node.current,l,u)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(jB(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function jB({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const CB={inView:{Feature:NB},tap:{Feature:gB},focus:{Feature:pB},hover:{Feature:mB}},kB={layout:{ProjectionNode:DP,MeasureLayout:qP}},SB={...Qz,...CB,...hB,...kB},We=Hz(SB,Uz),Qk=e=>{let t;const n=new Set,r=(f,m)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const g=t;t=m??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,g))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f))},d=t=e(r,o,u);return u},_B=(e=>e?Qk(e):Qk),EB=e=>e;function PB(e,t=EB){const n=be.useSyncExternalStore(e.subscribe,be.useCallback(()=>t(e.getState()),[e,t]),be.useCallback(()=>t(e.getInitialState()),[e,t]));return be.useDebugValue(n),n}const TB=e=>{const t=_B(e),n=r=>PB(t,r);return Object.assign(n,t),n},MB=(e=>TB);function AB(e,t){let n;try{n=e()}catch{return}return{getItem:o=>{var a;const l=d=>d===null?null:JSON.parse(d,void 0),u=(a=n.getItem(o))!=null?a:null;return u instanceof Promise?u.then(l):l(u)},setItem:(o,a)=>n.setItem(o,JSON.stringify(a,void 0)),removeItem:o=>n.removeItem(o)}}const h0=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return h0(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return h0(r)(n)}}}},DB=(e,t)=>(n,r,o)=>{let a={storage:AB(()=>window.localStorage),partialize:N=>N,version:0,merge:(N,k)=>({...k,...N}),...t},l=!1,u=0;const d=new Set,f=new Set;let m=a.storage;if(!m)return e((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...N)},r,o);const p=()=>{const N=a.partialize({...r()});return m.setItem(a.name,{state:N,version:a.version})},g=o.setState;o.setState=(N,k)=>(g(N,k),p());const y=e((...N)=>(n(...N),p()),r,o);o.getInitialState=()=>y;let b;const w=()=>{var N,k;if(!m)return;const j=++u;l=!1,d.forEach(S=>{var E;return S((E=r())!=null?E:y)});const C=((k=a.onRehydrateStorage)==null?void 0:k.call(a,(N=r())!=null?N:y))||void 0;return h0(m.getItem.bind(m))(a.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==a.version){if(a.migrate){const E=a.migrate(S.state,S.version);return E instanceof Promise?E.then(P=>[!0,P]):[!0,E]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var E;if(j!==u)return;const[P,D]=S;if(b=a.merge(D,(E=r())!=null?E:y),n(b,!0),P)return p()}).then(()=>{j===u&&(C==null||C(r(),void 0),b=r(),l=!0,f.forEach(S=>S(b)))}).catch(S=>{j===u&&(C==null||C(void 0,S))})};return o.persist={setOptions:N=>{a={...a,...N},N.storage&&(m=N.storage)},clearStorage:()=>{m==null||m.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>w(),hasHydrated:()=>l,onHydrate:N=>(d.add(N),()=>{d.delete(N)}),onFinishHydration:N=>(f.add(N),()=>{f.delete(N)})},a.skipHydration||w(),b||y},RB=DB,lt=MB()(RB(e=>({sidebarExpanded:!1,setSidebarExpanded:t=>e({sidebarExpanded:t}),toggleSidebar:()=>e(t=>({sidebarExpanded:!t.sidebarExpanded})),drawerOpen:!1,drawerType:null,drawerEntityId:null,drawerBriefing:!1,openDrawer:(t,n)=>e({drawerOpen:!0,drawerType:t,drawerEntityId:n??null,drawerBriefing:!1}),openDrawerBriefing:(t,n)=>e({drawerOpen:!0,drawerType:t,drawerEntityId:n,drawerBriefing:!0}),closeDrawer:()=>e({drawerOpen:!1,drawerType:null,drawerEntityId:null,drawerBriefing:!1}),commandPaletteOpen:!1,setCommandPaletteOpen:t=>e({commandPaletteOpen:t}),shortcutsOpen:!1,setShortcutsOpen:t=>e({shortcutsOpen:t}),zenMode:!1,toggleZenMode:()=>e(t=>({zenMode:!t.zenMode})),theme:"dark",setTheme:t=>{const n=document.documentElement;if(n.classList.remove("dark","light"),t==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";n.classList.add(r)}else n.classList.add(t);e({theme:t})},quickAddOpen:!1,quickAddType:null,openQuickAdd:t=>e({quickAddOpen:!0,quickAddType:t}),closeQuickAdd:()=>e({quickAddOpen:!1,quickAddType:null}),aiContext:null,openAIWithContext:t=>e({aiContext:t}),darkVariant:"warm",setDarkVariant:t=>e({darkVariant:t})}),{name:"crmy-app-store",partialize:e=>({sidebarExpanded:e.sidebarExpanded,theme:e.theme,darkVariant:e.darkVariant})})),OB="/api/v1";function IB(){return localStorage.getItem("crmy_token")}function LB(e){localStorage.setItem("crmy_token",e)}function KP(){localStorage.removeItem("crmy_token"),localStorage.removeItem("crmy_user")}function yp(){const e=localStorage.getItem("crmy_user");return e?JSON.parse(e):null}function FB(e){localStorage.setItem("crmy_user",JSON.stringify(e))}async function di(e,t={}){const n=IB(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);let o;try{o=await fetch(e.startsWith("/")?e:`${OB}/${e}`,{...t,headers:r})}catch{throw new Error("Unable to reach the server. Check your connection and try again.")}if(o.status===401)throw KP(),window.location.pathname.endsWith("/login")||(window.location.href="/app/login"),new Error("Unauthorized");if(!o.ok){const a=await o.json().catch(()=>({detail:o.statusText}));throw new Error(a.detail||`HTTP ${o.status}`)}if(o.status!==204)return o.json()}const je={get:e=>di(e),post:(e,t)=>di(e,{method:"POST",body:t?JSON.stringify(t):void 0}),put:(e,t)=>di(e,{method:"PUT",body:t?JSON.stringify(t):void 0}),patch:(e,t)=>di(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>di(e,{method:"DELETE"})},Gk={login:(e,t)=>di("/auth/login",{method:"POST",body:JSON.stringify({email:e,password:t})}),register:e=>di("/auth/register",{method:"POST",body:JSON.stringify(e)})};function Hn(e,t,n){const r=new URLSearchParams;n&&Object.entries(n).forEach(([a,l])=>{l!==void 0&&l!==""&&r.set(a,String(l))});const o=r.toString()?`${t}?${r}`:t;return St({queryKey:[e,n],queryFn:()=>je.get(o)})}function Jb(e){return Hn("contacts","contacts",e)}function $B(e){return St({queryKey:["contact",e],queryFn:()=>je.get(`contacts/${e}`),enabled:!!e})}function YP(){const e=ze();return Fe({mutationFn:t=>je.post("contacts",t),onSuccess:()=>e.invalidateQueries({queryKey:["contacts"]})})}function VB(e){const t=ze();return Fe({mutationFn:n=>je.patch(`contacts/${e}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:["contact",e]}),t.invalidateQueries({queryKey:["contacts"]})}})}function zB(e){const t=ze();return Fe({mutationFn:()=>je.delete(`contacts/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:["contacts"]})})}function vp(e){return Hn("accounts","accounts",e)}function BB(e){return St({queryKey:["account",e],queryFn:()=>je.get(`accounts/${e}`),enabled:!!e})}function QP(){const e=ze();return Fe({mutationFn:t=>je.post("accounts",t),onSuccess:()=>e.invalidateQueries({queryKey:["accounts"]})})}function WB(e){const t=ze();return Fe({mutationFn:n=>je.patch(`accounts/${e}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:["account",e]}),t.invalidateQueries({queryKey:["accounts"]})}})}function HB(e){const t=ze();return Fe({mutationFn:()=>je.delete(`accounts/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:["accounts"]})})}function bp(e){return Hn("opportunities","opportunities",e)}function UB(e){return St({queryKey:["opportunity",e],queryFn:()=>je.get(`opportunities/${e}`),enabled:!!e})}function GP(){const e=ze();return Fe({mutationFn:t=>je.post("opportunities",t),onSuccess:()=>e.invalidateQueries({queryKey:["opportunities"]})})}function qB(e){const t=ze();return Fe({mutationFn:n=>je.patch(`opportunities/${e}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:["opportunity",e]}),t.invalidateQueries({queryKey:["opportunities"]})}})}function KB(e){const t=ze();return Fe({mutationFn:()=>je.delete(`opportunities/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:["opportunities"]})})}function ew(e){return Hn("use-cases","use-cases",e)}function YB(e){return St({queryKey:["use-case",e],queryFn:()=>je.get(`use-cases/${e}`),enabled:!!e})}function XP(){const e=ze();return Fe({mutationFn:t=>je.post("use-cases",t),onSuccess:()=>e.invalidateQueries({queryKey:["use-cases"]})})}function QB(e){const t=ze();return Fe({mutationFn:n=>je.patch(`use-cases/${e}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:["use-case",e]}),t.invalidateQueries({queryKey:["use-cases"]})}})}function GB(e){const t=ze();return Fe({mutationFn:()=>je.delete(`use-cases/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:["use-cases"]})})}function XB(e){return St({queryKey:["use-case-timeline",e],queryFn:()=>je.get(`use-cases/${e}/timeline`),enabled:!!e})}function tw(e){return Hn("activities","activities",e)}function ZP(){const e=ze();return Fe({mutationFn:t=>je.post("activities",t),onSuccess:()=>e.invalidateQueries({queryKey:["activities"]})})}function nw(){return St({queryKey:["hitl"],queryFn:()=>je.get("hitl"),refetchInterval:1e4})}function JP(){const e=ze();return Fe({mutationFn:({id:t,...n})=>je.post(`hitl/${t}/resolve`,n),onSuccess:()=>e.invalidateQueries({queryKey:["hitl"]})})}function ZB(){return Hn("webhooks","webhooks")}function JB(){const e=ze();return Fe({mutationFn:t=>je.post("webhooks",t),onSuccess:()=>e.invalidateQueries({queryKey:["webhooks"]})})}function e7(){const e=ze();return Fe({mutationFn:t=>je.delete(`webhooks/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["webhooks"]})})}function Mc(e){return St({queryKey:["custom-fields",e],queryFn:()=>je.get(`custom-fields?object_type=${e}`),enabled:!!e})}function t7(){const e=ze();return Fe({mutationFn:t=>je.post("custom-fields",t),onSuccess:()=>e.invalidateQueries({queryKey:["custom-fields"]})})}function n7(){const e=ze();return Fe({mutationFn:({id:t,...n})=>je.patch(`custom-fields/${t}`,n),onSuccess:()=>e.invalidateQueries({queryKey:["custom-fields"]})})}function r7(){const e=ze();return Fe({mutationFn:t=>je.delete(`custom-fields/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["custom-fields"]})})}function s7(e){return St({queryKey:["search",e],queryFn:()=>je.get(`search?q=${encodeURIComponent(e)}`),enabled:e.length>=2})}function o7(e){return Hn("emails","emails",e)}function a7(e){return St({queryKey:["email",e],queryFn:()=>je.get(`emails/${e}`),enabled:!!e})}function i7(){const e=ze();return Fe({mutationFn:t=>je.post("emails",t),onSuccess:()=>e.invalidateQueries({queryKey:["emails"]})})}function wp(){return St({queryKey:["admin-users"],queryFn:()=>je.get("admin/users")})}function l7(){const e=ze();return Fe({mutationFn:t=>je.post("admin/users",t),onSuccess:()=>e.invalidateQueries({queryKey:["admin-users"]})})}function c7(){return St({queryKey:["admin-db-config"],queryFn:()=>je.get("admin/db-config")})}function u7(){return Fe({mutationFn:e=>je.post("admin/db-config/test",{connection_string:e})})}function d7(){const e=ze();return Fe({mutationFn:t=>je.patch("admin/db-config",{connection_string:t}),onSuccess:()=>e.invalidateQueries({queryKey:["admin-db-config"]})})}function e3(e){const t=e?`?actor_id=${e}`:"";return St({queryKey:["api-keys",e],queryFn:()=>je.get(`/auth/api-keys${t}`)})}function t3(){const e=ze();return Fe({mutationFn:t=>je.post("/auth/api-keys",t),onSuccess:()=>e.invalidateQueries({queryKey:["api-keys"]})})}function f7(){const e=ze();return Fe({mutationFn:({id:t,...n})=>je.patch(`/auth/api-keys/${t}`,n),onSuccess:()=>e.invalidateQueries({queryKey:["api-keys"]})})}function n3(){const e=ze();return Fe({mutationFn:t=>je.delete(`/auth/api-keys/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["api-keys"]})})}function h7(){return Fe({mutationFn:e=>je.patch("/auth/profile",e)})}function Rd(e){return Hn("actors","actors",e)}function m7(e){return St({queryKey:["actor",e],queryFn:()=>je.get(`actors/${e}`),enabled:!!e})}function p7(){const e=ze();return Fe({mutationFn:t=>je.post("actors",t),onSuccess:()=>e.invalidateQueries({queryKey:["actors"]})})}function r3(){const e=ze();return Fe({mutationFn:({id:t,...n})=>je.patch(`actors/${t}`,n),onSuccess:()=>{e.invalidateQueries({queryKey:["actors"]}),e.invalidateQueries({queryKey:["actor"]})}})}function s3(){return St({queryKey:["actor-whoami"],queryFn:()=>je.get("actors/whoami")})}function jy(e){return Hn("assignments","assignments",e)}function g7(e){return St({queryKey:["assignment",e],queryFn:()=>je.get(`assignments/${e}`),enabled:!!e})}function o3(){const e=ze();return Fe({mutationFn:t=>je.post("assignments",t),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function x7(e){const t=ze();return Fe({mutationFn:n=>je.patch(`assignments/${e}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:["assignment",e]}),t.invalidateQueries({queryKey:["assignments"]})}})}function rw(){const e=ze();return Fe({mutationFn:t=>je.post(`assignments/${t}/accept`,{}),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function sw(){const e=ze();return Fe({mutationFn:({id:t,...n})=>je.post(`assignments/${t}/complete`,n),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function ow(){const e=ze();return Fe({mutationFn:({id:t,...n})=>je.post(`assignments/${t}/decline`,n),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function Tm(e){return Hn("context-entries","context",e)}function y7(e){const t=(e==null?void 0:e.limit)??20;return oO({queryKey:["context-entries-infinite",e],queryFn:({pageParam:n})=>{const r=new URLSearchParams;return e!=null&&e.subject_type&&r.set("subject_type",e.subject_type),e!=null&&e.context_type&&r.set("context_type",e.context_type),(e==null?void 0:e.is_current)!==void 0&&r.set("is_current",String(e.is_current)),r.set("limit",String(t)),n&&r.set("cursor",n),je.get(`context?${r}`)},initialPageParam:void 0,getNextPageParam:n=>n.next_cursor??void 0})}function v7(){const e=ze();return Fe({mutationFn:t=>je.post("context",t),onSuccess:()=>e.invalidateQueries({queryKey:["context-entries"]})})}function a3(){const e=ze();return Fe({mutationFn:t=>je.post(`context/${t}/review`,{}),onSuccess:()=>{e.invalidateQueries({queryKey:["context-entries"]}),e.invalidateQueries({queryKey:["context-entries-infinite"]}),e.invalidateQueries({queryKey:["context-stale"]})}})}function b7(e){return Hn("context-stale","context/stale",e)}function aw(){const e=ze();return Fe({mutationFn:t=>je.post(`assignments/${t}/start`,{}),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function iw(){const e=ze();return Fe({mutationFn:({id:t,reason:n})=>je.post(`assignments/${t}/block`,{reason:n}),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function lw(){const e=ze();return Fe({mutationFn:({id:t,reason:n})=>je.post(`assignments/${t}/cancel`,{reason:n}),onSuccess:()=>e.invalidateQueries({queryKey:["assignments"]})})}function i3(e){return Hn("activity-types","activity-types",e)}function w7(){const e=ze();return Fe({mutationFn:t=>je.post("activity-types",t),onSuccess:()=>e.invalidateQueries({queryKey:["activity-types"]})})}function N7(){const e=ze();return Fe({mutationFn:t=>je.delete(`activity-types/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["activity-types"]})})}function l3(){return Hn("context-types","context-types")}function j7(){const e=ze();return Fe({mutationFn:t=>je.post("context-types",t),onSuccess:()=>e.invalidateQueries({queryKey:["context-types"]})})}function C7(){const e=ze();return Fe({mutationFn:t=>je.delete(`context-types/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["context-types"]})})}function k7(e){return Hn("workflows","workflows",e)}function S7(e){return St({queryKey:["workflow",e],queryFn:()=>je.get(`workflows/${e}`),enabled:!!e})}function _7(){const e=ze();return Fe({mutationFn:t=>je.post("workflows",t),onSuccess:()=>e.invalidateQueries({queryKey:["workflows"]})})}function E7(e){const t=ze();return Fe({mutationFn:n=>je.patch(`workflows/${e}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:["workflow",e]}),t.invalidateQueries({queryKey:["workflows"]})}})}function c3(){const e=ze();return Fe({mutationFn:t=>je.delete(`workflows/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["workflows"]})})}function P7(e,t){return St({queryKey:["workflow-runs",e,t],queryFn:()=>{const n=t!=null&&t.limit?`?limit=${t.limit}`:"";return je.get(`workflows/${e}/runs${n}`)},enabled:!!e})}function T7(e,t){return St({queryKey:["webhook-deliveries",e,t],queryFn:()=>{const n=t!=null&&t.limit?`?limit=${t.limit}`:"";return je.get(`webhooks/${e}/deliveries${n}`)},enabled:!!e})}function M7(e,t){const n=new URLSearchParams;return n.set("q",e),t&&Object.entries(t).forEach(([r,o])=>{o!==void 0&&o!==""&&n.set(r,String(o))}),St({queryKey:["context-semantic-search",e,t],queryFn:()=>je.get(`context/semantic-search?${n}`),enabled:e.length>=2,retry:!1})}function A7(){const e=ze();return Fe({mutationFn:t=>je.post("context/ingest",t),onSuccess:()=>{e.invalidateQueries({queryKey:["context-entries"]}),e.invalidateQueries({queryKey:["context-entries-infinite"]})}})}function D7(){var l,u;const{data:e}=s3(),t=e==null?void 0:e.actor_id,n=nw(),r=St({queryKey:["inbox-assignments",t],queryFn:()=>je.get(`assignments?assigned_to=${encodeURIComponent(t)}&limit=200`),enabled:!!t,refetchInterval:3e4}),o=(((l=n.data)==null?void 0:l.data)??[]).filter(d=>d.status==="pending").length,a=(((u=r.data)==null?void 0:u.assignments)??[]).filter(d=>["pending","accepted","in_progress","blocked"].includes(d.status)).length;return{total:o+a,hitlCount:o,assignCount:a}}function u3(e,t,n){const r=new URLSearchParams;n&&Object.entries(n).forEach(([l,u])=>{u!==void 0&&u!==""&&r.set(l,String(u))});const o=r.toString(),a=`briefing/${e}/${t}${o?`?${o}`:""}`;return St({queryKey:["briefing",e,t,n],queryFn:()=>je.get(a),enabled:!!e&&!!t})}function d3(){return St({queryKey:["agent-config"],queryFn:()=>je.get("agent/config")})}function R7(){const e=ze();return Fe({mutationFn:t=>je.put("agent/config",t),onSuccess:()=>e.invalidateQueries({queryKey:["agent-config"]})})}function O7(){return Fe({mutationFn:e=>je.post("agent/config/test",e)})}function I7(){return St({queryKey:["agent-sessions"],queryFn:()=>je.get("agent/sessions")})}function L7(){const e=ze();return Fe({mutationFn:t=>je.post("agent/sessions",t),onSuccess:()=>e.invalidateQueries({queryKey:["agent-sessions"]})})}function F7(){const e=ze();return Fe({mutationFn:({id:t,label:n})=>je.patch(`agent/sessions/${t}`,{label:n}),onSuccess:()=>e.invalidateQueries({queryKey:["agent-sessions"]})})}function $7(){const e=ze();return Fe({mutationFn:t=>je.delete(`agent/sessions/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:["agent-sessions"]})})}function V7(){const e=ze();return Fe({mutationFn:()=>je.delete("agent/sessions"),onSuccess:()=>e.invalidateQueries({queryKey:["agent-sessions"]})})}function z7(e){return St({queryKey:["agent-activity",e],queryFn:()=>{const t={};e!=null&&e.user_id&&(t.user_id=e.user_id),e!=null&&e.tool_name&&(t.tool_name=e.tool_name),(e==null?void 0:e.is_error)!==void 0&&(t.is_error=e.is_error),e!=null&&e.since&&(t.since=e.since),e!=null&&e.limit&&(t.limit=e.limit),e!=null&&e.cursor&&(t.cursor=e.cursor);const n=new URLSearchParams(Object.entries(t).filter(([,r])=>r!==void 0).map(([r,o])=>[r,String(o)])).toString();return je.get(`agent/activity${n?"?"+n:""}`)}})}function B7(){return St({queryKey:["email-provider"],queryFn:()=>je.get("email-provider")})}function W7(){const e=ze();return Fe({mutationFn:t=>je.put("email-provider",t),onSuccess:()=>e.invalidateQueries({queryKey:["email-provider"]})})}function H7(e){return Hn("messaging-channels","messaging-channels",e)}function U7(){const e=ze();return Fe({mutationFn:t=>je.post("messaging-channels",t),onSuccess:()=>e.invalidateQueries({queryKey:["messaging-channels"]})})}function q7(e){const t=ze();return Fe({mutationFn:n=>je.patch(`messaging-channels/${e}`,n),onSuccess:()=>t.invalidateQueries({queryKey:["messaging-channels"]})})}function K7(e){const t=ze();return Fe({mutationFn:()=>je.delete(`messaging-channels/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:["messaging-channels"]})})}const f3="/app/assets/crmy-logo-DWN0xBPW.png",Bt={dashboard:{text:"text-[#14b8a6]",bg:"bg-[#14b8a6]/15",bar:"bg-[#14b8a6]"},contacts:{text:"text-primary",bg:"bg-primary/15",bar:"bg-primary"},accounts:{text:"text-[#8b5cf6]",bg:"bg-[#8b5cf6]/15",bar:"bg-[#8b5cf6]"},opportunities:{text:"text-accent",bg:"bg-accent/15",bar:"bg-accent"},useCases:{text:"text-success",bg:"bg-success/15",bar:"bg-success"},activities:{text:"text-warning",bg:"bg-warning/15",bar:"bg-warning"},assignments:{text:"text-destructive",bg:"bg-destructive/15",bar:"bg-destructive"},agents:{text:"text-[#6366f1]",bg:"bg-[#6366f1]/15",bar:"bg-[#6366f1]"},workflows:{text:"text-amber-500",bg:"bg-amber-500/15",bar:"bg-amber-500"},emails:{text:"text-[#3b82f6]",bg:"bg-[#3b82f6]/15",bar:"bg-[#3b82f6]"}},Y7=[{icon:ki,label:"Workspace",path:"/",color:Bt.contacts},{icon:op,label:"Agents",path:"/actors",color:Bt.agents},{icon:Fu,label:"Workflows",path:"/workflows",color:Bt.workflows},{icon:Ed,label:"Handoffs",path:"/handoffs",color:Bt.assignments}],Q7=[{icon:ja,label:"Contacts",path:"/contacts",color:Bt.contacts},{icon:hm,label:"Accounts",path:"/accounts",color:Bt.accounts},{icon:Yu,label:"Opportunities",path:"/opportunities",color:Bt.opportunities},{icon:Qu,label:"Use Cases",path:"/use-cases",color:Bt.useCases},{icon:tc,label:"Activities",path:"/activities",color:Bt.activities},{icon:ho,label:"Emails",path:"/emails",color:Bt.emails}],G7=[{icon:ub,label:"Settings",path:"/settings"}];function Xk({item:e,active:t,badge:n}){const{sidebarExpanded:r}=lt();return s.jsxs(hr,{to:e.path,className:`group relative flex items-center gap-3 rounded-xl px-2.5 py-2.5 text-sm transition-all
|
|
562
|
+
${t?`${e.color.bg} ${e.color.text}`:"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}`,title:r?void 0:e.label,children:[s.jsx(e.icon,{className:"w-5 h-5 flex-shrink-0"}),s.jsx(mn,{children:r&&s.jsx(We.span,{initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},className:"whitespace-nowrap overflow-hidden font-medium flex-1",children:e.label})}),n!==void 0&&n>0&&s.jsx("span",{className:`flex-shrink-0 min-w-[18px] h-[18px] px-1 flex items-center justify-center rounded-full bg-destructive text-white text-[10px] font-bold ${r?"":"absolute -top-1 -right-1"}`,children:n>99?"99+":n}),t&&s.jsx(We.div,{layoutId:"sidebar-active",className:`absolute -left-2 top-2 w-[3px] h-6 ${e.color.bar} rounded-r-full`,transition:{type:"spring",damping:25,stiffness:300}}),!r&&s.jsx("div",{className:"absolute left-full ml-2 px-2.5 py-1.5 rounded-lg bg-popover text-popover-foreground text-xs shadow-lg opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-50 font-medium",children:e.label})]})}function X7(){const e=Cr(),{sidebarExpanded:t,setSidebarExpanded:n}=lt(),{hitlCount:r,assignCount:o}=D7();function a(u){return u==="/"?e.pathname==="/":e.pathname.startsWith(u)}function l(u){if(u==="/handoffs"){const d=(r??0)+(o??0);return d>0?d:void 0}}return s.jsxs(We.aside,{className:"hidden md:flex flex-col h-screen bg-sidebar border-r border-sidebar-border flex-shrink-0 overflow-hidden",animate:{width:t?220:56},transition:{duration:.2,ease:"easeInOut"},children:[s.jsxs("div",{className:"flex items-center h-16 px-3 gap-2 border-b border-sidebar-border",children:[s.jsx("img",{src:f3,alt:"CRMy",className:"w-8 h-8 flex-shrink-0 rounded-lg"}),s.jsx(mn,{children:t&&s.jsx(We.span,{initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},className:"font-brand font-bold text-lg text-sidebar-accent-foreground whitespace-nowrap overflow-hidden",children:"CRMy"})})]}),s.jsxs("nav",{className:"flex-1 flex flex-col py-3 gap-1 px-2 overflow-y-auto",children:[Y7.map(u=>s.jsx(Xk,{item:u,active:a(u.path),badge:l(u.path)},u.path)),s.jsxs("div",{className:"mt-2 mb-1",children:[s.jsx("div",{className:"border-t border-sidebar-border"}),s.jsx(mn,{children:t&&s.jsx(We.p,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"text-[10px] font-semibold text-muted-foreground/60 uppercase tracking-widest px-2.5 pt-2 pb-0.5",children:"Knowledge Base"})})]}),Q7.map(u=>s.jsx(Xk,{item:u,active:a(u.path)},u.path))]}),s.jsxs("div",{className:"flex flex-col gap-1 px-2 pb-3 border-t border-sidebar-border pt-3",children:[G7.map(u=>{const d=e.pathname.startsWith(u.path);return s.jsxs(hr,{to:u.path,className:`flex items-center gap-3 rounded-xl px-2.5 py-2.5 text-sm transition-all
|
|
563
|
+
${d?"bg-sidebar-primary/15 text-sidebar-primary":"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}`,title:t?void 0:u.label,children:[s.jsx(u.icon,{className:"w-5 h-5 flex-shrink-0"}),s.jsx(mn,{children:t&&s.jsx(We.span,{initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},className:"whitespace-nowrap overflow-hidden font-medium",children:u.label})})]},u.path)}),s.jsx("button",{onClick:()=>n(!t),className:"flex items-center justify-center w-8 h-8 rounded-lg text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground mx-auto mt-1 transition-colors",children:t?s.jsx(JL,{className:"w-4 h-4"}):s.jsx(eF,{className:"w-4 h-4"})})]})]})}const Z7=[{icon:ki,label:"Workspace",path:"/"},{icon:zn,label:"Agent",path:"/agent"},{icon:op,label:"Agents",path:"/actors"},{icon:Ed,label:"Handoffs",path:"/handoffs"}];function J7(){const e=Cr();return s.jsx("nav",{className:"md:hidden fixed bottom-0 left-0 right-0 z-40 flex items-center justify-around h-16 bg-card/95 backdrop-blur-md border-t border-border safe-area-bottom",children:Z7.map(t=>{const n=t.path==="/"?e.pathname==="/":e.pathname.startsWith(t.path);return s.jsxs(hr,{to:t.path,className:"relative flex flex-col items-center justify-center py-1 min-w-[44px] min-h-[44px]",children:[n&&s.jsx(We.div,{layoutId:"mobile-nav-pill",className:"absolute inset-x-0.5 -top-0.5 bottom-1 rounded-2xl bg-primary/10",transition:{type:"spring",damping:25,stiffness:300}}),s.jsx(t.icon,{className:`w-5 h-5 relative z-10 transition-colors ${n?"text-primary":"text-muted-foreground"}`}),n&&s.jsx(We.span,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},className:"text-[10px] font-display font-semibold text-primary relative z-10 mt-0.5",children:t.label})]},t.path)})})}var Zk=1,eW=.9,tW=.8,nW=.17,Cy=.1,ky=.999,rW=.9999,sW=.99,oW=/[\\\/_+.#"@\[\(\{&]/,aW=/[\\\/_+.#"@\[\(\{&]/g,iW=/[\s-]/,h3=/[\s-]/g;function m0(e,t,n,r,o,a,l){if(a===t.length)return o===e.length?Zk:sW;var u=`${o},${a}`;if(l[u]!==void 0)return l[u];for(var d=r.charAt(a),f=n.indexOf(d,o),m=0,p,g,y,b;f>=0;)p=m0(e,t,n,r,f+1,a+1,l),p>m&&(f===o?p*=Zk:oW.test(e.charAt(f-1))?(p*=tW,y=e.slice(o,f-1).match(aW),y&&o>0&&(p*=Math.pow(ky,y.length))):iW.test(e.charAt(f-1))?(p*=eW,b=e.slice(o,f-1).match(h3),b&&o>0&&(p*=Math.pow(ky,b.length))):(p*=nW,o>0&&(p*=Math.pow(ky,f-o))),e.charAt(f)!==t.charAt(a)&&(p*=rW)),(p<Cy&&n.charAt(f-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(f-1)!==r.charAt(a))&&(g=m0(e,t,n,r,f+1,a+2,l),g*Cy>p&&(p=g*Cy)),p>m&&(m=p),f=n.indexOf(d,f+1);return l[u]=m,m}function Jk(e){return e.toLowerCase().replace(h3," ")}function lW(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,m0(e,t,Jk(e),Jk(t),0,0,{})}var Sy="focusScope.autoFocusOnMount",_y="focusScope.autoFocusOnUnmount",eS={bubbles:!1,cancelable:!0},cW="FocusScope",Np=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[u,d]=x.useState(null),f=is(o),m=is(a),p=x.useRef(null),g=pt(t,w=>d(w)),y=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let w=function(C){if(y.paused||!u)return;const S=C.target;u.contains(S)?p.current=S:ta(p.current,{select:!0})},N=function(C){if(y.paused||!u)return;const S=C.relatedTarget;S!==null&&(u.contains(S)||ta(p.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&ta(u)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const j=new MutationObserver(k);return u&&j.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),j.disconnect()}}},[r,u,y.paused]),x.useEffect(()=>{if(u){nS.add(y);const w=document.activeElement;if(!u.contains(w)){const k=new CustomEvent(Sy,eS);u.addEventListener(Sy,f),u.dispatchEvent(k),k.defaultPrevented||(uW(pW(m3(u)),{select:!0}),document.activeElement===w&&ta(u))}return()=>{u.removeEventListener(Sy,f),setTimeout(()=>{const k=new CustomEvent(_y,eS);u.addEventListener(_y,m),u.dispatchEvent(k),k.defaultPrevented||ta(w??document.body,{select:!0}),u.removeEventListener(_y,m),nS.remove(y)},0)}}},[u,f,m,y]);const b=x.useCallback(w=>{if(!n&&!r||y.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(N&&k){const j=w.currentTarget,[C,S]=dW(j);C&&S?!w.shiftKey&&k===S?(w.preventDefault(),n&&ta(C,{select:!0})):w.shiftKey&&k===C&&(w.preventDefault(),n&&ta(S,{select:!0})):k===j&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(Ge.div,{tabIndex:-1,...l,ref:g,onKeyDown:b})});Np.displayName=cW;function uW(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ta(r,{select:t}),document.activeElement!==n)return}function dW(e){const t=m3(e),n=tS(t,e),r=tS(t.reverse(),e);return[n,r]}function m3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function tS(e,t){for(const n of e)if(!fW(n,{upTo:t}))return n}function fW(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function hW(e){return e instanceof HTMLInputElement&&"select"in e}function ta(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hW(e)&&t&&e.select()}}var nS=mW();function mW(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=rS(e,t),e.unshift(t)},remove(t){var n;e=rS(e,t),(n=e[0])==null||n.resume()}}}function rS(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pW(e){return e.filter(t=>t.tagName!=="A")}var Ey=0;function cw(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??sS()),document.body.insertAdjacentElement("beforeend",e[1]??sS()),Ey++,()=>{Ey===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ey--}},[])}function sS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ms=function(){return Ms=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Ms.apply(this,arguments)};function p3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function gW(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Gh="right-scroll-bar-position",Xh="width-before-scroll-bar",xW="with-scroll-bars-hidden",yW="--removed-body-scroll-bar-size";function Py(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vW(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var bW=typeof window<"u"?x.useLayoutEffect:x.useEffect,oS=new WeakMap;function wW(e,t){var n=vW(null,function(r){return e.forEach(function(o){return Py(o,r)})});return bW(function(){var r=oS.get(n);if(r){var o=new Set(r),a=new Set(e),l=n.current;o.forEach(function(u){a.has(u)||Py(u,null)}),a.forEach(function(u){o.has(u)||Py(u,l)})}oS.set(n,e)},[e]),n}function NW(e){return e}function jW(e,t){t===void 0&&(t=NW);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var d=function(){var m=l;l=[],m.forEach(a)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(m){l.push(m),f()},filter:function(m){return l=l.filter(m),n}}}};return o}function CW(e){e===void 0&&(e={});var t=jW(null);return t.options=Ms({async:!0,ssr:!1},e),t}var g3=function(e){var t=e.sideCar,n=p3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Ms({},n))};g3.isSideCarExport=!0;function kW(e,t){return e.useMedium(t),g3}var x3=CW(),Ty=function(){},jp=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Ty,onWheelCapture:Ty,onTouchMoveCapture:Ty}),o=r[0],a=r[1],l=e.forwardProps,u=e.children,d=e.className,f=e.removeScrollBar,m=e.enabled,p=e.shards,g=e.sideCar,y=e.noRelative,b=e.noIsolation,w=e.inert,N=e.allowPinchZoom,k=e.as,j=k===void 0?"div":k,C=e.gapMode,S=p3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,P=wW([n,t]),D=Ms(Ms({},S),o);return x.createElement(x.Fragment,null,m&&x.createElement(E,{sideCar:x3,removeScrollBar:f,shards:p,noRelative:y,noIsolation:b,inert:w,setCallbacks:a,allowPinchZoom:!!N,lockRef:n,gapMode:C}),l?x.cloneElement(x.Children.only(u),Ms(Ms({},D),{ref:P})):x.createElement(j,Ms({},D,{className:d,ref:P}),u))});jp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jp.classNames={fullWidth:Xh,zeroRight:Gh};var SW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function _W(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=SW();return t&&e.setAttribute("nonce",t),e}function EW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function PW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var TW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=_W())&&(EW(t,n),PW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},MW=function(){var e=TW();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},y3=function(){var e=MW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},AW={left:0,top:0,right:0,gap:0},My=function(e){return parseInt(e||"",10)||0},DW=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[My(n),My(r),My(o)]},RW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return AW;var t=DW(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},OW=y3(),$l="data-scroll-locked",IW=function(e,t,n,r){var o=e.left,a=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
564
|
+
.`.concat(xW,` {
|
|
565
|
+
overflow: hidden `).concat(r,`;
|
|
566
|
+
padding-right: `).concat(u,"px ").concat(r,`;
|
|
567
|
+
}
|
|
568
|
+
body[`).concat($l,`] {
|
|
569
|
+
overflow: hidden `).concat(r,`;
|
|
570
|
+
overscroll-behavior: contain;
|
|
571
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
572
|
+
padding-left: `.concat(o,`px;
|
|
573
|
+
padding-top: `).concat(a,`px;
|
|
574
|
+
padding-right: `).concat(l,`px;
|
|
575
|
+
margin-left:0;
|
|
576
|
+
margin-top:0;
|
|
577
|
+
margin-right: `).concat(u,"px ").concat(r,`;
|
|
578
|
+
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.`).concat(Gh,` {
|
|
582
|
+
right: `).concat(u,"px ").concat(r,`;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.`).concat(Xh,` {
|
|
586
|
+
margin-right: `).concat(u,"px ").concat(r,`;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.`).concat(Gh," .").concat(Gh,` {
|
|
590
|
+
right: 0 `).concat(r,`;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.`).concat(Xh," .").concat(Xh,` {
|
|
594
|
+
margin-right: 0 `).concat(r,`;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
body[`).concat($l,`] {
|
|
598
|
+
`).concat(yW,": ").concat(u,`px;
|
|
599
|
+
}
|
|
600
|
+
`)},aS=function(){var e=parseInt(document.body.getAttribute($l)||"0",10);return isFinite(e)?e:0},LW=function(){x.useEffect(function(){return document.body.setAttribute($l,(aS()+1).toString()),function(){var e=aS()-1;e<=0?document.body.removeAttribute($l):document.body.setAttribute($l,e.toString())}},[])},FW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;LW();var a=x.useMemo(function(){return RW(o)},[o]);return x.createElement(OW,{styles:IW(a,!t,o,n?"":"!important")})},p0=!1;if(typeof window<"u")try{var gh=Object.defineProperty({},"passive",{get:function(){return p0=!0,!0}});window.addEventListener("test",gh,gh),window.removeEventListener("test",gh,gh)}catch{p0=!1}var wl=p0?{passive:!1}:!1,$W=function(e){return e.tagName==="TEXTAREA"},v3=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$W(e)&&n[t]==="visible")},VW=function(e){return v3(e,"overflowY")},zW=function(e){return v3(e,"overflowX")},iS=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=b3(e,r);if(o){var a=w3(e,r),l=a[1],u=a[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},BW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},WW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},b3=function(e,t){return e==="v"?VW(t):zW(t)},w3=function(e,t){return e==="v"?BW(t):WW(t)},HW=function(e,t){return e==="h"&&t==="rtl"?-1:1},UW=function(e,t,n,r,o){var a=HW(e,window.getComputedStyle(t).direction),l=a*r,u=n.target,d=t.contains(u),f=!1,m=l>0,p=0,g=0;do{if(!u)break;var y=w3(e,u),b=y[0],w=y[1],N=y[2],k=w-N-a*b;(b||k)&&b3(e,u)&&(p+=k,g+=b);var j=u.parentNode;u=j&&j.nodeType===Node.DOCUMENT_FRAGMENT_NODE?j.host:j}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(m&&Math.abs(p)<1||!m&&Math.abs(g)<1)&&(f=!0),f},xh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lS=function(e){return[e.deltaX,e.deltaY]},cS=function(e){return e&&"current"in e?e.current:e},qW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KW=function(e){return`
|
|
601
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
602
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
603
|
+
`)},YW=0,Nl=[];function QW(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(YW++)[0],a=x.useState(y3)[0],l=x.useRef(e);x.useEffect(function(){l.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var w=gW([e.lockRef.current],(e.shards||[]).map(cS),!0).filter(Boolean);return w.forEach(function(N){return N.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,N){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!l.current.allowPinchZoom;var k=xh(w),j=n.current,C="deltaX"in w?w.deltaX:j[0]-k[0],S="deltaY"in w?w.deltaY:j[1]-k[1],E,P=w.target,D=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in w&&D==="h"&&P.type==="range")return!1;var I=window.getSelection(),z=I&&I.anchorNode,K=z?z===P||z.contains(P):!1;if(K)return!1;var q=iS(D,P);if(!q)return!0;if(q?E=D:(E=D==="v"?"h":"v",q=iS(D,P)),!q)return!1;if(!r.current&&"changedTouches"in w&&(C||S)&&(r.current=E),!E)return!0;var H=r.current||E;return UW(H,N,w,H==="h"?C:S)},[]),d=x.useCallback(function(w){var N=w;if(!(!Nl.length||Nl[Nl.length-1]!==a)){var k="deltaY"in N?lS(N):xh(N),j=t.current.filter(function(E){return E.name===N.type&&(E.target===N.target||N.target===E.shadowParent)&&qW(E.delta,k)})[0];if(j&&j.should){N.cancelable&&N.preventDefault();return}if(!j){var C=(l.current.shards||[]).map(cS).filter(Boolean).filter(function(E){return E.contains(N.target)}),S=C.length>0?u(N,C[0]):!l.current.noIsolation;S&&N.cancelable&&N.preventDefault()}}},[]),f=x.useCallback(function(w,N,k,j){var C={name:w,delta:N,target:k,should:j,shadowParent:GW(k)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(S){return S!==C})},1)},[]),m=x.useCallback(function(w){n.current=xh(w),r.current=void 0},[]),p=x.useCallback(function(w){f(w.type,lS(w),w.target,u(w,e.lockRef.current))},[]),g=x.useCallback(function(w){f(w.type,xh(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return Nl.push(a),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",d,wl),document.addEventListener("touchmove",d,wl),document.addEventListener("touchstart",m,wl),function(){Nl=Nl.filter(function(w){return w!==a}),document.removeEventListener("wheel",d,wl),document.removeEventListener("touchmove",d,wl),document.removeEventListener("touchstart",m,wl)}},[]);var y=e.removeScrollBar,b=e.inert;return x.createElement(x.Fragment,null,b?x.createElement(a,{styles:KW(o)}):null,y?x.createElement(FW,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const XW=kW(x3,QW);var Cp=x.forwardRef(function(e,t){return x.createElement(jp,Ms({},e,{ref:t,sideCar:XW}))});Cp.classNames=jp.classNames;var ZW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},jl=new WeakMap,yh=new WeakMap,vh={},Ay=0,N3=function(e){return e&&(e.host||N3(e.parentNode))},JW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=N3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},eH=function(e,t,n,r){var o=JW(t,Array.isArray(e)?e:[e]);vh[n]||(vh[n]=new WeakMap);var a=vh[n],l=[],u=new Set,d=new Set(o),f=function(p){!p||u.has(p)||(u.add(p),f(p.parentNode))};o.forEach(f);var m=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(g){if(u.has(g))m(g);else try{var y=g.getAttribute(r),b=y!==null&&y!=="false",w=(jl.get(g)||0)+1,N=(a.get(g)||0)+1;jl.set(g,w),a.set(g,N),l.push(g),w===1&&b&&yh.set(g,!0),N===1&&g.setAttribute(n,"true"),b||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return m(t),u.clear(),Ay++,function(){l.forEach(function(p){var g=jl.get(p)-1,y=a.get(p)-1;jl.set(p,g),a.set(p,y),g||(yh.has(p)||p.removeAttribute(r),yh.delete(p)),y||p.removeAttribute(n)}),Ay--,Ay||(jl=new WeakMap,jl=new WeakMap,yh=new WeakMap,vh={})}},uw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=ZW(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),eH(r,o,n,"aria-hidden")):function(){return null}};function tH(e){const t=nH(e),n=x.forwardRef((r,o)=>{const{children:a,...l}=r,u=x.Children.toArray(a),d=u.find(sH);if(d){const f=d.props.children,m=u.map(p=>p===d?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:o,children:x.isValidElement(f)?x.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function nH(e){const t=x.forwardRef((n,r)=>{const{children:o,...a}=n;if(x.isValidElement(o)){const l=aH(o),u=oH(a,o.props);return o.type!==x.Fragment&&(u.ref=r?Vr(r,l):l),x.cloneElement(o,u)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rH=Symbol("radix.slottable");function sH(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rH}function oH(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...u)=>{const d=a(...u);return o(...u),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function aH(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var kp="Dialog",[j3]=wo(kp),[iH,ps]=j3(kp),C3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,u=x.useRef(null),d=x.useRef(null),[f,m]=Ri({prop:r,defaultProp:o??!1,onChange:a,caller:kp});return s.jsx(iH,{scope:t,triggerRef:u,contentRef:d,contentId:xr(),titleId:xr(),descriptionId:xr(),open:f,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(p=>!p),[m]),modal:l,children:n})};C3.displayName=kp;var k3="DialogTrigger",lH=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ps(k3,n),a=pt(t,o.triggerRef);return s.jsx(Ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":hw(o.open),...r,ref:a,onClick:Ke(e.onClick,o.onOpenToggle)})});lH.displayName=k3;var dw="DialogPortal",[cH,S3]=j3(dw,{forceMount:void 0}),_3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=ps(dw,t);return s.jsx(cH,{scope:t,forceMount:n,children:x.Children.map(r,l=>s.jsx(No,{present:n||a.open,children:s.jsx(Cd,{asChild:!0,container:o,children:l})}))})};_3.displayName=dw;var Mm="DialogOverlay",E3=x.forwardRef((e,t)=>{const n=S3(Mm,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ps(Mm,e.__scopeDialog);return a.modal?s.jsx(No,{present:r||a.open,children:s.jsx(dH,{...o,ref:t})}):null});E3.displayName=Mm;var uH=tH("DialogOverlay.RemoveScroll"),dH=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ps(Mm,n);return s.jsx(Cp,{as:uH,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(Ge.div,{"data-state":hw(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Li="DialogContent",P3=x.forwardRef((e,t)=>{const n=S3(Li,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ps(Li,e.__scopeDialog);return s.jsx(No,{present:r||a.open,children:a.modal?s.jsx(fH,{...o,ref:t}):s.jsx(hH,{...o,ref:t})})});P3.displayName=Li;var fH=x.forwardRef((e,t)=>{const n=ps(Li,e.__scopeDialog),r=x.useRef(null),o=pt(t,n.contentRef,r);return x.useEffect(()=>{const a=r.current;if(a)return uw(a)},[]),s.jsx(T3,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ke(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Ke(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:Ke(e.onFocusOutside,a=>a.preventDefault())})}),hH=x.forwardRef((e,t)=>{const n=ps(Li,e.__scopeDialog),r=x.useRef(!1),o=x.useRef(!1);return s.jsx(T3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),T3=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,u=ps(Li,n),d=x.useRef(null),f=pt(t,d);return cw(),s.jsxs(s.Fragment,{children:[s.jsx(Np,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:s.jsx(Nc,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":hw(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(mH,{titleId:u.titleId}),s.jsx(gH,{contentRef:d,descriptionId:u.descriptionId})]})]})}),fw="DialogTitle",M3=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ps(fw,n);return s.jsx(Ge.h2,{id:o.titleId,...r,ref:t})});M3.displayName=fw;var A3="DialogDescription",D3=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ps(A3,n);return s.jsx(Ge.p,{id:o.descriptionId,...r,ref:t})});D3.displayName=A3;var R3="DialogClose",O3=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ps(R3,n);return s.jsx(Ge.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,()=>o.onOpenChange(!1))})});O3.displayName=R3;function hw(e){return e?"open":"closed"}var I3="DialogTitleWarning",[vae,L3]=zI(I3,{contentName:Li,titleName:fw,docsSlug:"dialog"}),mH=({titleId:e})=>{const t=L3(I3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
604
|
+
|
|
605
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
606
|
+
|
|
607
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},pH="DialogDescriptionWarning",gH=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${L3(pH).contentName}}.`;return x.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},F3=C3,$3=_3,mw=E3,pw=P3,V3=M3,z3=D3,xH=O3,bu='[cmdk-group=""]',Dy='[cmdk-group-items=""]',yH='[cmdk-group-heading=""]',B3='[cmdk-item=""]',uS=`${B3}:not([aria-disabled="true"])`,g0="cmdk-item-select",Pl="data-value",vH=(e,t,n)=>lW(e,t,n),W3=x.createContext(void 0),Od=()=>x.useContext(W3),H3=x.createContext(void 0),gw=()=>x.useContext(H3),U3=x.createContext(void 0),q3=x.forwardRef((e,t)=>{let n=Tl(()=>{var $,Y;return{search:"",value:(Y=($=e.value)!=null?$:e.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Tl(()=>new Set),o=Tl(()=>new Map),a=Tl(()=>new Map),l=Tl(()=>new Set),u=K3(e),{label:d,children:f,value:m,onValueChange:p,filter:g,shouldFilter:y,loop:b,disablePointerSelection:w=!1,vimBindings:N=!0,...k}=e,j=xr(),C=xr(),S=xr(),E=x.useRef(null),P=TH();Fi(()=>{if(m!==void 0){let $=m.trim();n.current.value=$,D.emit()}},[m]),Fi(()=>{P(6,B)},[]);let D=x.useMemo(()=>({subscribe:$=>(l.current.add($),()=>l.current.delete($)),snapshot:()=>n.current,setState:($,Y,X)=>{var ne,ie,J,re;if(!Object.is(n.current[$],Y)){if(n.current[$]=Y,$==="search")H(),K(),P(1,q);else if($==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ce=document.getElementById(S);ce?ce.focus():(ne=document.getElementById(j))==null||ne.focus()}if(P(7,()=>{var ce;n.current.selectedItemId=(ce=R())==null?void 0:ce.id,D.emit()}),X||P(5,B),((ie=u.current)==null?void 0:ie.value)!==void 0){let ce=Y??"";(re=(J=u.current).onValueChange)==null||re.call(J,ce);return}}D.emit()}},emit:()=>{l.current.forEach($=>$())}}),[]),I=x.useMemo(()=>({value:($,Y,X)=>{var ne;Y!==((ne=a.current.get($))==null?void 0:ne.value)&&(a.current.set($,{value:Y,keywords:X}),n.current.filtered.items.set($,z(Y,X)),P(2,()=>{K(),D.emit()}))},item:($,Y)=>(r.current.add($),Y&&(o.current.has(Y)?o.current.get(Y).add($):o.current.set(Y,new Set([$]))),P(3,()=>{H(),K(),n.current.value||q(),D.emit()}),()=>{a.current.delete($),r.current.delete($),n.current.filtered.items.delete($);let X=R();P(4,()=>{H(),(X==null?void 0:X.getAttribute("id"))===$&&q(),D.emit()})}),group:$=>(o.current.has($)||o.current.set($,new Set),()=>{a.current.delete($),o.current.delete($)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:j,inputId:S,labelId:C,listInnerRef:E}),[]);function z($,Y){var X,ne;let ie=(ne=(X=u.current)==null?void 0:X.filter)!=null?ne:vH;return $?ie($,n.current.search,Y):0}function K(){if(!n.current.search||u.current.shouldFilter===!1)return;let $=n.current.filtered.items,Y=[];n.current.filtered.groups.forEach(ne=>{let ie=o.current.get(ne),J=0;ie.forEach(re=>{let ce=$.get(re);J=Math.max(ce,J)}),Y.push([ne,J])});let X=E.current;M().sort((ne,ie)=>{var J,re;let ce=ne.getAttribute("id"),fe=ie.getAttribute("id");return((J=$.get(fe))!=null?J:0)-((re=$.get(ce))!=null?re:0)}).forEach(ne=>{let ie=ne.closest(Dy);ie?ie.appendChild(ne.parentElement===ie?ne:ne.closest(`${Dy} > *`)):X.appendChild(ne.parentElement===X?ne:ne.closest(`${Dy} > *`))}),Y.sort((ne,ie)=>ie[1]-ne[1]).forEach(ne=>{var ie;let J=(ie=E.current)==null?void 0:ie.querySelector(`${bu}[${Pl}="${encodeURIComponent(ne[0])}"]`);J==null||J.parentElement.appendChild(J)})}function q(){let $=M().find(X=>X.getAttribute("aria-disabled")!=="true"),Y=$==null?void 0:$.getAttribute(Pl);D.setState("value",Y||void 0)}function H(){var $,Y,X,ne;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ie=0;for(let J of r.current){let re=(Y=($=a.current.get(J))==null?void 0:$.value)!=null?Y:"",ce=(ne=(X=a.current.get(J))==null?void 0:X.keywords)!=null?ne:[],fe=z(re,ce);n.current.filtered.items.set(J,fe),fe>0&&ie++}for(let[J,re]of o.current)for(let ce of re)if(n.current.filtered.items.get(ce)>0){n.current.filtered.groups.add(J);break}n.current.filtered.count=ie}function B(){var $,Y,X;let ne=R();ne&&((($=ne.parentElement)==null?void 0:$.firstChild)===ne&&((X=(Y=ne.closest(bu))==null?void 0:Y.querySelector(yH))==null||X.scrollIntoView({block:"nearest"})),ne.scrollIntoView({block:"nearest"}))}function R(){var $;return($=E.current)==null?void 0:$.querySelector(`${B3}[aria-selected="true"]`)}function M(){var $;return Array.from((($=E.current)==null?void 0:$.querySelectorAll(uS))||[])}function F($){let Y=M()[$];Y&&D.setState("value",Y.getAttribute(Pl))}function L($){var Y;let X=R(),ne=M(),ie=ne.findIndex(re=>re===X),J=ne[ie+$];(Y=u.current)!=null&&Y.loop&&(J=ie+$<0?ne[ne.length-1]:ie+$===ne.length?ne[0]:ne[ie+$]),J&&D.setState("value",J.getAttribute(Pl))}function A($){let Y=R(),X=Y==null?void 0:Y.closest(bu),ne;for(;X&&!ne;)X=$>0?EH(X,bu):PH(X,bu),ne=X==null?void 0:X.querySelector(uS);ne?D.setState("value",ne.getAttribute(Pl)):L($)}let O=()=>F(M().length-1),U=$=>{$.preventDefault(),$.metaKey?O():$.altKey?A(1):L(1)},V=$=>{$.preventDefault(),$.metaKey?F(0):$.altKey?A(-1):L(-1)};return x.createElement(Ge.div,{ref:t,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:$=>{var Y;(Y=k.onKeyDown)==null||Y.call(k,$);let X=$.nativeEvent.isComposing||$.keyCode===229;if(!($.defaultPrevented||X))switch($.key){case"n":case"j":{N&&$.ctrlKey&&U($);break}case"ArrowDown":{U($);break}case"p":case"k":{N&&$.ctrlKey&&V($);break}case"ArrowUp":{V($);break}case"Home":{$.preventDefault(),F(0);break}case"End":{$.preventDefault(),O();break}case"Enter":{$.preventDefault();let ne=R();if(ne){let ie=new Event(g0);ne.dispatchEvent(ie)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:AH},d),Sp(e,$=>x.createElement(H3.Provider,{value:D},x.createElement(W3.Provider,{value:I},$))))}),bH=x.forwardRef((e,t)=>{var n,r;let o=xr(),a=x.useRef(null),l=x.useContext(U3),u=Od(),d=K3(e),f=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l==null?void 0:l.forceMount;Fi(()=>{if(!f)return u.item(o,l==null?void 0:l.id)},[f]);let m=Y3(o,a,[e.value,e.children,a],e.keywords),p=gw(),g=Ea(P=>P.value&&P.value===m.current),y=Ea(P=>f||u.filter()===!1?!0:P.search?P.filtered.items.get(o)>0:!0);x.useEffect(()=>{let P=a.current;if(!(!P||e.disabled))return P.addEventListener(g0,b),()=>P.removeEventListener(g0,b)},[y,e.onSelect,e.disabled]);function b(){var P,D;w(),(D=(P=d.current).onSelect)==null||D.call(P,m.current)}function w(){p.setState("value",m.current,!0)}if(!y)return null;let{disabled:N,value:k,onSelect:j,forceMount:C,keywords:S,...E}=e;return x.createElement(Ge.div,{ref:Vr(a,t),...E,id:o,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!g,"data-disabled":!!N,"data-selected":!!g,onPointerMove:N||u.getDisablePointerSelection()?void 0:w,onClick:N?void 0:b},e.children)}),wH=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,l=xr(),u=x.useRef(null),d=x.useRef(null),f=xr(),m=Od(),p=Ea(y=>o||m.filter()===!1?!0:y.search?y.filtered.groups.has(l):!0);Fi(()=>m.group(l),[]),Y3(l,u,[e.value,e.heading,d]);let g=x.useMemo(()=>({id:l,forceMount:o}),[o]);return x.createElement(Ge.div,{ref:Vr(u,t),...a,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&x.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Sp(e,y=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},x.createElement(U3.Provider,{value:g},y))))}),NH=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=x.useRef(null),a=Ea(l=>!l.search);return!n&&!a?null:x.createElement(Ge.div,{ref:Vr(o,t),...r,"cmdk-separator":"",role:"separator"})}),jH=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,a=gw(),l=Ea(f=>f.search),u=Ea(f=>f.selectedItemId),d=Od();return x.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),x.createElement(Ge.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:o?e.value:l,onChange:f=>{o||a.setState("search",f.target.value),n==null||n(f.target.value)}})}),CH=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=x.useRef(null),l=x.useRef(null),u=Ea(f=>f.selectedItemId),d=Od();return x.useEffect(()=>{if(l.current&&a.current){let f=l.current,m=a.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let y=f.offsetHeight;m.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return g.observe(f),()=>{cancelAnimationFrame(p),g.unobserve(f)}}},[]),x.createElement(Ge.div,{ref:Vr(a,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":r,id:d.listId},Sp(e,f=>x.createElement("div",{ref:Vr(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),kH=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:l,...u}=e;return x.createElement(F3,{open:n,onOpenChange:r},x.createElement($3,{container:l},x.createElement(mw,{"cmdk-overlay":"",className:o}),x.createElement(pw,{"aria-label":e.label,"cmdk-dialog":"",className:a},x.createElement(q3,{ref:t,...u}))))}),SH=x.forwardRef((e,t)=>Ea(n=>n.filtered.count===0)?x.createElement(Ge.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),_H=x.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return x.createElement(Ge.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Sp(e,l=>x.createElement("div",{"aria-hidden":!0},l)))}),fn=Object.assign(q3,{List:CH,Item:bH,Input:jH,Group:wH,Separator:NH,Dialog:kH,Empty:SH,Loading:_H});function EH(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function PH(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function K3(e){let t=x.useRef(e);return Fi(()=>{t.current=e}),t}var Fi=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Tl(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Ea(e){let t=gw(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function Y3(e,t,n,r=[]){let o=x.useRef(),a=Od();return Fi(()=>{var l;let u=(()=>{var f;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(f=m.current.textContent)==null?void 0:f.trim():o.current}})(),d=r.map(f=>f.trim());a.value(e,u,d),(l=t.current)==null||l.setAttribute(Pl,u),o.current=u}),o}var TH=()=>{let[e,t]=x.useState(),n=Tl(()=>new Map);return Fi(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function MH(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Sp({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(MH(t),{ref:t.ref},n(t.props.children)):n(t)}var AH={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const dS=[{bg:"#FB990C"},{bg:"#F8BB59"},{bg:"#C94408"},{bg:"#FDBA74",dark:!0},{bg:"#F59E0B"},{bg:"#EA580C"},{bg:"#FED7AA",dark:!0},{bg:"#FCF1C1",dark:!0}];function DH(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Math.abs(t)}function RH(e){var n;const t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():(((n=t[0])==null?void 0:n[0])??"?").toUpperCase()}function yo({name:e,className:t,textClassName:n}){const r=e||"?",o=dS[DH(r)%dS.length],a=RH(r);return s.jsx("div",{className:Ie("flex items-center justify-center flex-shrink-0 rounded-xl",t),style:{backgroundColor:o.bg},children:s.jsx("span",{className:Ie("font-display font-bold select-none",o.dark?"text-[#2A2A2E]":"text-white",n),children:r==="?"?"?":a})})}const Ry=768;function _p(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Ry-1}px)`),r=()=>{t(window.innerWidth<Ry)};return n.addEventListener("change",r),t(window.innerWidth<Ry),()=>n.removeEventListener("change",r)},[]),!!e}function OH(){const{commandPaletteOpen:e,setCommandPaletteOpen:t,openDrawer:n}=lt(),r=Cn(),o=x.useRef(null),a=_p(),[l,u]=x.useState(""),{data:d}=s7(l),f=(d==null?void 0:d.contacts)??[],m=(d==null?void 0:d.accounts)??[],p=(d==null?void 0:d.opportunities)??[],g=(d==null?void 0:d.activities)??[],y=(d==null?void 0:d.useCases)??[],b=(d==null?void 0:d.assignments)??[];x.useEffect(()=>{e?setTimeout(()=>{var j;return(j=o.current)==null?void 0:j.focus()},50):u("")},[e]);const w=j=>{j(),t(!1)},N=Ie("flex items-center gap-3 px-2 py-2 rounded-md text-sm text-foreground cursor-pointer","data-[selected=true]:bg-primary/15 data-[selected=true]:text-primary",a&&"py-3 px-3"),k=s.jsxs(fn,{className:"bg-card border-x border-border shadow-2xl overflow-hidden",shouldFilter:!1,children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 border-b border-border",children:[s.jsx(Oi,{className:"w-4 h-4 text-muted-foreground"}),s.jsx(fn.Input,{ref:o,value:l,onValueChange:u,placeholder:"Search contacts, opportunities, or type a command...",className:"flex-1 py-3 text-sm bg-transparent text-foreground placeholder:text-muted-foreground outline-none"})]}),s.jsxs(fn.List,{className:"max-h-[60vh] overflow-y-auto p-2",children:[s.jsx(fn.Empty,{className:"py-6 text-center text-sm text-muted-foreground",children:"No results found."}),!l&&s.jsx(fn.Group,{heading:"Pages",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:[{label:"Dashboard",icon:KL,path:"/",color:Bt.dashboard},{label:"Contacts",icon:ja,path:"/contacts",color:Bt.contacts},{label:"Accounts",icon:hm,path:"/accounts",color:Bt.accounts},{label:"Opportunities",icon:Yu,path:"/opportunities",color:Bt.opportunities},{label:"Use Cases",icon:Qu,path:"/use-cases",color:Bt.useCases},{label:"Activities",icon:tc,path:"/activities",color:Bt.activities},{label:"Handoffs",icon:pm,path:"/handoffs",color:Bt.assignments},{label:"Settings",icon:ub,path:"/settings",color:null}].map(j=>{var C;return s.jsxs(fn.Item,{value:j.label,onSelect:()=>w(()=>r(j.path)),className:N,children:[s.jsx(j.icon,{className:Ie("w-4 h-4",((C=j.color)==null?void 0:C.text)??"text-muted-foreground")}),j.label]},j.path)})}),f.length>0&&s.jsx(fn.Group,{heading:"Contacts",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:f.slice(0,5).map(j=>s.jsxs(fn.Item,{value:`${j.name} ${j.company} ${j.email}`,onSelect:()=>w(()=>{r("/contacts"),n("contact",j.id)}),className:N,children:[s.jsx(yo,{name:j.name,className:"w-5 h-5 rounded-full text-[8px]"}),s.jsx("span",{children:j.name}),j.company&&s.jsxs("span",{className:"text-muted-foreground text-xs",children:["— ",j.company]})]},j.id))}),m.length>0&&s.jsx(fn.Group,{heading:"Accounts",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:m.slice(0,5).map(j=>s.jsxs(fn.Item,{value:`${j.name} ${j.domain??""}`,onSelect:()=>w(()=>{r("/accounts"),n("account",j.id)}),className:N,children:[s.jsx(hm,{className:Ie("w-4 h-4",Bt.accounts.text)}),s.jsx("span",{children:j.name}),j.domain&&s.jsxs("span",{className:"text-muted-foreground text-xs",children:["— ",j.domain]})]},j.id))}),p.length>0&&s.jsx(fn.Group,{heading:"Opportunities",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:p.slice(0,5).map(j=>s.jsxs(fn.Item,{value:`${j.name} ${j.contact_name}`,onSelect:()=>w(()=>{r("/opportunities"),n("opportunity",j.id)}),className:N,children:[s.jsx(Yu,{className:Ie("w-4 h-4",Bt.opportunities.text)}),s.jsx("span",{children:j.name}),j.amount&&s.jsxs("span",{className:"text-muted-foreground text-xs ml-auto",children:["$",(j.amount/1e3).toFixed(0),"K"]})]},j.id))}),g.length>0&&s.jsx(fn.Group,{heading:"Activities",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:g.slice(0,5).map(j=>{var C;return s.jsxs(fn.Item,{value:`${j.body??""} ${j.activity_type??""}`,onSelect:()=>w(()=>r("/activities")),className:N,children:[s.jsx(tc,{className:Ie("w-4 h-4",Bt.activities.text)}),s.jsx("span",{className:"truncate",children:(C=j.body)==null?void 0:C.slice(0,60)})]},j.id)})}),y.length>0&&s.jsx(fn.Group,{heading:"Use Cases",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:y.slice(0,5).map(j=>s.jsxs(fn.Item,{value:`${j.name??""}`,onSelect:()=>w(()=>r("/use-cases")),className:N,children:[s.jsx(Qu,{className:Ie("w-4 h-4",Bt.useCases.text)}),s.jsx("span",{children:j.name})]},j.id))}),b.length>0&&s.jsx(fn.Group,{heading:"Assignments",className:"text-xs text-muted-foreground px-2 py-1.5 font-display",children:b.slice(0,5).map(j=>s.jsxs(fn.Item,{value:`${j.title??""}`,onSelect:()=>w(()=>r("/handoffs")),className:N,children:[s.jsx(pm,{className:Ie("w-4 h-4",Bt.assignments.text)}),s.jsx("span",{children:j.title})]},j.id))})]}),!a&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-t border-border text-xs text-muted-foreground",children:[s.jsx("span",{children:"Navigate with ↑↓ · Select with ↵"}),s.jsx("span",{children:"ESC to close"})]})]});return s.jsx(mn,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(We.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[70] bg-black/60 backdrop-blur-sm",onClick:()=>t(!1)}),a?s.jsxs(We.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed left-0 right-0 bottom-0 z-[70] flex flex-col max-h-[85vh]",children:[s.jsx("div",{className:"flex justify-center py-2 bg-card rounded-t-2xl border-t border-x border-border",children:s.jsx("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/20"})}),k]}):s.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center px-4 pointer-events-none",children:s.jsx(We.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15},className:"w-full max-w-2xl pointer-events-auto",children:s.jsx("div",{className:"rounded-2xl overflow-hidden border border-border shadow-2xl",children:k})})})]})})}const IH=[{group:"Global",items:[{keys:["⌘","K"],label:"Command palette"},{keys:["⌘","⇧","A"],label:"Workspace Agent panel"},{keys:["⌘","⇧","Z"],label:"Zen mode"},{keys:["?"],label:"Keyboard shortcuts"},{keys:["Esc"],label:"Close drawer / modal"}]},{group:"Navigation",items:[{keys:["G","H"],label:"Go to Dashboard"},{keys:["G","C"],label:"Go to Contacts"},{keys:["G","D"],label:"Go to Opportunities"}]}];function LH(){const{shortcutsOpen:e,setShortcutsOpen:t}=lt();return s.jsx(mn,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(We.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm",onClick:()=>t(!1)}),s.jsxs(We.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-full max-w-md bg-card border border-border rounded-lg shadow-2xl p-6",children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-4",children:"Keyboard Shortcuts"}),IH.map(n=>s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider mb-2",children:n.group}),s.jsx("div",{className:"space-y-2",children:n.items.map(r=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm text-foreground",children:r.label}),s.jsx("div",{className:"flex gap-1",children:r.keys.map(o=>s.jsx("kbd",{className:"px-1.5 py-0.5 text-xs font-mono bg-muted text-muted-foreground rounded border border-border",children:o},o))})]},r.label))})]},n.group)),s.jsxs("p",{className:"text-xs text-muted-foreground mt-4",children:["Press ",s.jsx("kbd",{className:"px-1 py-0.5 text-xs font-mono bg-muted rounded border border-border",children:"Esc"})," to close"]})]})]})})}function FH({children:e,title:t}){const{drawerOpen:n,closeDrawer:r}=lt();return s.jsx(mn,{children:n&&s.jsxs(s.Fragment,{children:[s.jsx(We.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[65] bg-foreground/20 backdrop-blur-sm",onClick:r}),s.jsxs(We.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"hidden md:flex fixed right-0 top-0 h-full w-[480px] z-[70] bg-card border-l border-border shadow-2xl flex-col rounded-l-2xl",children:[s.jsxs("div",{className:"flex items-center justify-between h-14 px-5 border-b border-border",children:[t&&s.jsx("h2",{className:"font-display font-bold text-foreground",children:t}),s.jsx("button",{onClick:r,className:"ml-auto p-2 rounded-xl hover:bg-muted text-muted-foreground transition-colors",children:s.jsx(Ht,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:e})]}),s.jsxs(We.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"md:hidden fixed left-0 right-0 bottom-0 z-[70] bg-card border-t border-border shadow-2xl flex flex-col rounded-t-3xl max-h-[90vh]",children:[s.jsx("div",{className:"flex justify-center py-2",children:s.jsx("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/20"})}),s.jsxs("div",{className:"flex items-center justify-between px-5 pb-3 border-b border-border",children:[t&&s.jsx("h2",{className:"font-display font-bold text-foreground",children:t}),s.jsx("button",{onClick:r,className:"ml-auto p-2 rounded-xl hover:bg-muted text-muted-foreground transition-colors",children:s.jsx(Ht,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto pb-safe",children:e})]})]})})}const Q3=x.createContext({enabled:!1,config:null,loading:!0,connectivity:"unknown"}),$H=300*1e3,VH="/api/v1/agent/config/test";function zH({children:e}){const{data:t,isLoading:n}=d3(),r=(t==null?void 0:t.data)??null,o=(r==null?void 0:r.enabled)??!1,[a,l]=x.useState("unknown"),u=x.useRef(0);return x.useEffect(()=>{if(!o||!(r!=null&&r.model)||!(r!=null&&r.base_url)){l("unknown");return}const d=async()=>{const m=localStorage.getItem("crmy_token");try{const p=await fetch(VH,{method:"POST",headers:{"Content-Type":"application/json",...m?{Authorization:`Bearer ${m}`}:{}},body:JSON.stringify({})});if(p.ok){const g=await p.json();l(g.ok?"online":"offline")}else l("offline")}catch{l("offline")}u.current=Date.now()};d();const f=setInterval(()=>d(),$H);return()=>clearInterval(f)},[o,r==null?void 0:r.model,r==null?void 0:r.base_url,r==null?void 0:r.provider]),s.jsx(Q3.Provider,{value:{enabled:o,config:r,loading:n,connectivity:a},children:e})}function kr(){return x.useContext(Q3)}function He(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function jt(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function wn(e,t){const n=He(e);return isNaN(t)?jt(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function ds(e,t){const n=He(e);if(isNaN(t))return jt(e,NaN);if(!t)return n;const r=n.getDate(),o=jt(e,n.getTime());o.setMonth(n.getMonth()+t+1,0);const a=o.getDate();return r>=a?o:(n.setFullYear(o.getFullYear(),o.getMonth(),r),n)}const xw=6048e5,BH=864e5,yw=6e4,vw=36e5,WH=1e3,bh=43200,fS=1440;let HH={};function Oa(){return HH}function wr(e,t){var u,d,f,m;const n=Oa(),r=(t==null?void 0:t.weekStartsOn)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((m=(f=n.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,o=He(e),a=o.getDay(),l=(a<r?7:0)+a-r;return o.setDate(o.getDate()-l),o.setHours(0,0,0,0),o}function vo(e){return wr(e,{weekStartsOn:1})}function G3(e){const t=He(e),n=t.getFullYear(),r=jt(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const o=vo(r),a=jt(e,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=vo(a);return t.getTime()>=o.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function ac(e){const t=He(e);return t.setHours(0,0,0,0),t}function Pa(e){const t=He(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Os(e,t){const n=ac(e),r=ac(t),o=+n-Pa(n),a=+r-Pa(r);return Math.round((o-a)/BH)}function UH(e){const t=G3(e),n=jt(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),vo(n)}function x0(e,t){const n=t*7;return wn(e,n)}function qH(e,t){return ds(e,t*12)}function KH(e){let t;return e.forEach(function(n){const r=He(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function YH(e){let t;return e.forEach(n=>{const r=He(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function Zh(e,t){const n=He(e),r=He(t),o=n.getTime()-r.getTime();return o<0?-1:o>0?1:o}function QH(e){return jt(e,Date.now())}function nr(e,t){const n=ac(e),r=ac(t);return+n==+r}function bw(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function ww(e){if(!bw(e)&&typeof e!="number")return!1;const t=He(e);return!isNaN(Number(t))}function ic(e,t){const n=He(e),r=He(t),o=n.getFullYear()-r.getFullYear(),a=n.getMonth()-r.getMonth();return o*12+a}function GH(e,t,n){const r=wr(e,n),o=wr(t,n),a=+r-Pa(r),l=+o-Pa(o);return Math.round((a-l)/xw)}function XH(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function ZH(e,t){return+He(e)-+He(t)}function JH(e){const t=He(e);return t.setHours(23,59,59,999),t}function Ep(e){const t=He(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function eU(e){const t=He(e);return+JH(t)==+Ep(t)}function tU(e,t){const n=He(e),r=He(t),o=Zh(n,r),a=Math.abs(ic(n,r));let l;if(a<1)l=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*a);let u=Zh(n,r)===-o;eU(He(e))&&a===1&&Zh(e,r)===1&&(u=!1),l=o*(a-Number(u))}return l===0?0:l}function nU(e,t,n){const r=ZH(e,t)/1e3;return XH(n==null?void 0:n.roundingMethod)(r)}function sr(e){const t=He(e);return t.setDate(1),t.setHours(0,0,0,0),t}function X3(e){const t=He(e),n=jt(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Nw(e,t){var u,d,f,m;const n=Oa(),r=(t==null?void 0:t.weekStartsOn)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((m=(f=n.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,o=He(e),a=o.getDay(),l=(a<r?-7:0)+6-(a-r);return o.setDate(o.getDate()+l),o.setHours(23,59,59,999),o}function Z3(e){return Nw(e,{weekStartsOn:1})}const rU={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},sU=(e,t,n)=>{let r;const o=rU[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Oy(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const oU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},aU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},iU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},lU={date:Oy({formats:oU,defaultWidth:"full"}),time:Oy({formats:aU,defaultWidth:"full"}),dateTime:Oy({formats:iU,defaultWidth:"full"})},cU={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},uU=(e,t,n,r)=>cU[e];function wu(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,u=n!=null&&n.width?String(n.width):l;o=e.formattingValues[u]||e.formattingValues[l]}else{const l=e.defaultWidth,u=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[u]||e.values[l]}const a=e.argumentCallback?e.argumentCallback(t):t;return o[a]}}const dU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},fU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},hU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},mU={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},pU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},gU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},xU=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},yU={ordinalNumber:xU,era:wu({values:dU,defaultWidth:"wide"}),quarter:wu({values:fU,defaultWidth:"wide",argumentCallback:e=>e-1}),month:wu({values:hU,defaultWidth:"wide"}),day:wu({values:mU,defaultWidth:"wide"}),dayPeriod:wu({values:pU,defaultWidth:"wide",formattingValues:gU,defaultFormattingWidth:"wide"})};function Nu(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const l=a[0],u=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(u)?bU(u,p=>p.test(l)):vU(u,p=>p.test(l));let f;f=e.valueCallback?e.valueCallback(d):d,f=n.valueCallback?n.valueCallback(f):f;const m=t.slice(l.length);return{value:f,rest:m}}}function vU(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function bU(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function wU(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],a=t.match(e.parsePattern);if(!a)return null;let l=e.valueCallback?e.valueCallback(a[0]):a[0];l=n.valueCallback?n.valueCallback(l):l;const u=t.slice(o.length);return{value:l,rest:u}}}const NU=/^(\d+)(th|st|nd|rd)?/i,jU=/\d+/i,CU={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kU={any:[/^b/i,/^(a|c)/i]},SU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},_U={any:[/1/i,/2/i,/3/i,/4/i]},EU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},PU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},TU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},MU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},AU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},DU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},RU={ordinalNumber:wU({matchPattern:NU,parsePattern:jU,valueCallback:e=>parseInt(e,10)}),era:Nu({matchPatterns:CU,defaultMatchWidth:"wide",parsePatterns:kU,defaultParseWidth:"any"}),quarter:Nu({matchPatterns:SU,defaultMatchWidth:"wide",parsePatterns:_U,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Nu({matchPatterns:EU,defaultMatchWidth:"wide",parsePatterns:PU,defaultParseWidth:"any"}),day:Nu({matchPatterns:TU,defaultMatchWidth:"wide",parsePatterns:MU,defaultParseWidth:"any"}),dayPeriod:Nu({matchPatterns:AU,defaultMatchWidth:"any",parsePatterns:DU,defaultParseWidth:"any"})},Pp={code:"en-US",formatDistance:sU,formatLong:lU,formatRelative:uU,localize:yU,match:RU,options:{weekStartsOn:0,firstWeekContainsDate:1}};function OU(e){const t=He(e);return Os(t,X3(t))+1}function jw(e){const t=He(e),n=+vo(t)-+UH(t);return Math.round(n/xw)+1}function Cw(e,t){var m,p,g,y;const n=He(e),r=n.getFullYear(),o=Oa(),a=(t==null?void 0:t.firstWeekContainsDate)??((p=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??o.firstWeekContainsDate??((y=(g=o.locale)==null?void 0:g.options)==null?void 0:y.firstWeekContainsDate)??1,l=jt(e,0);l.setFullYear(r+1,0,a),l.setHours(0,0,0,0);const u=wr(l,t),d=jt(e,0);d.setFullYear(r,0,a),d.setHours(0,0,0,0);const f=wr(d,t);return n.getTime()>=u.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function IU(e,t){var u,d,f,m;const n=Oa(),r=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((m=(f=n.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=Cw(e,t),a=jt(e,0);return a.setFullYear(o,0,r),a.setHours(0,0,0,0),wr(a,t)}function kw(e,t){const n=He(e),r=+wr(n,t)-+IU(n,t);return Math.round(r/xw)+1}function wt(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Ko={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return wt(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):wt(n+1,2)},d(e,t){return wt(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return wt(e.getHours()%12||12,t.length)},H(e,t){return wt(e.getHours(),t.length)},m(e,t){return wt(e.getMinutes(),t.length)},s(e,t){return wt(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return wt(o,t.length)}},Cl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},hS={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return Ko.y(e,t)},Y:function(e,t,n,r){const o=Cw(e,r),a=o>0?o:1-o;if(t==="YY"){const l=a%100;return wt(l,2)}return t==="Yo"?n.ordinalNumber(a,{unit:"year"}):wt(a,t.length)},R:function(e,t){const n=G3(e);return wt(n,t.length)},u:function(e,t){const n=e.getFullYear();return wt(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return wt(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return wt(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Ko.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return wt(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=kw(e,r);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):wt(o,t.length)},I:function(e,t,n){const r=jw(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):wt(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ko.d(e,t)},D:function(e,t,n){const r=OU(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):wt(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return wt(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return wt(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return wt(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(r===12?o=Cl.noon:r===0?o=Cl.midnight:o=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(r>=17?o=Cl.evening:r>=12?o=Cl.afternoon:r>=4?o=Cl.morning:o=Cl.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ko.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ko.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):wt(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):wt(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ko.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ko.s(e,t)},S:function(e,t){return Ko.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return pS(r);case"XXXX":case"XX":return li(r);case"XXXXX":case"XXX":default:return li(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return pS(r);case"xxxx":case"xx":return li(r);case"xxxxx":case"xxx":default:return li(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+mS(r,":");case"OOOO":default:return"GMT"+li(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+mS(r,":");case"zzzz":default:return"GMT"+li(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return wt(r,t.length)},T:function(e,t,n){const r=e.getTime();return wt(r,t.length)}};function mS(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),a=r%60;return a===0?n+String(o):n+String(o)+t+wt(a,2)}function pS(e,t){return e%60===0?(e>0?"-":"+")+wt(Math.abs(e)/60,2):li(e,t)}function li(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=wt(Math.trunc(r/60),2),a=wt(r%60,2);return n+o+t+a}const gS=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},J3=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},LU=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return gS(e,t);let a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",gS(r,t)).replace("{{time}}",J3(o,t))},y0={p:J3,P:LU},FU=/^D+$/,$U=/^Y+$/,VU=["D","DD","YY","YYYY"];function eT(e){return FU.test(e)}function tT(e){return $U.test(e)}function v0(e,t,n){const r=zU(e,t,n);if(console.warn(r),VU.includes(e))throw new RangeError(r)}function zU(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,WU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,HU=/^'([^]*?)'?$/,UU=/''/g,qU=/[a-zA-Z]/;function Nr(e,t,n){var m,p,g,y,b,w,N,k;const r=Oa(),o=(n==null?void 0:n.locale)??r.locale??Pp,a=(n==null?void 0:n.firstWeekContainsDate)??((p=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??r.firstWeekContainsDate??((y=(g=r.locale)==null?void 0:g.options)==null?void 0:y.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((w=(b=n==null?void 0:n.locale)==null?void 0:b.options)==null?void 0:w.weekStartsOn)??r.weekStartsOn??((k=(N=r.locale)==null?void 0:N.options)==null?void 0:k.weekStartsOn)??0,u=He(e);if(!ww(u))throw new RangeError("Invalid time value");let d=t.match(WU).map(j=>{const C=j[0];if(C==="p"||C==="P"){const S=y0[C];return S(j,o.formatLong)}return j}).join("").match(BU).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const C=j[0];if(C==="'")return{isToken:!1,value:KU(j)};if(hS[C])return{isToken:!0,value:j};if(C.match(qU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+C+"`");return{isToken:!1,value:j}});o.localize.preprocessor&&(d=o.localize.preprocessor(u,d));const f={firstWeekContainsDate:a,weekStartsOn:l,locale:o};return d.map(j=>{if(!j.isToken)return j.value;const C=j.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&tT(C)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&eT(C))&&v0(C,t,String(e));const S=hS[C[0]];return S(u,C,o.localize,f)}).join("")}function KU(e){const t=e.match(HU);return t?t[1].replace(UU,"'"):e}function YU(e,t,n){const r=Oa(),o=(n==null?void 0:n.locale)??r.locale??Pp,a=2520,l=Zh(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const u=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let d,f;l>0?(d=He(t),f=He(e)):(d=He(e),f=He(t));const m=nU(f,d),p=(Pa(f)-Pa(d))/1e3,g=Math.round((m-p)/60);let y;if(g<2)return n!=null&&n.includeSeconds?m<5?o.formatDistance("lessThanXSeconds",5,u):m<10?o.formatDistance("lessThanXSeconds",10,u):m<20?o.formatDistance("lessThanXSeconds",20,u):m<40?o.formatDistance("halfAMinute",0,u):m<60?o.formatDistance("lessThanXMinutes",1,u):o.formatDistance("xMinutes",1,u):g===0?o.formatDistance("lessThanXMinutes",1,u):o.formatDistance("xMinutes",g,u);if(g<45)return o.formatDistance("xMinutes",g,u);if(g<90)return o.formatDistance("aboutXHours",1,u);if(g<fS){const b=Math.round(g/60);return o.formatDistance("aboutXHours",b,u)}else{if(g<a)return o.formatDistance("xDays",1,u);if(g<bh){const b=Math.round(g/fS);return o.formatDistance("xDays",b,u)}else if(g<bh*2)return y=Math.round(g/bh),o.formatDistance("aboutXMonths",y,u)}if(y=tU(f,d),y<12){const b=Math.round(g/bh);return o.formatDistance("xMonths",b,u)}else{const b=y%12,w=Math.trunc(y/12);return b<3?o.formatDistance("aboutXYears",w,u):b<9?o.formatDistance("overXYears",w,u):o.formatDistance("almostXYears",w+1,u)}}function Id(e,t){return YU(e,QH(e),t)}function QU(e){const t=He(e),n=t.getFullYear(),r=t.getMonth(),o=jt(e,0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}function GU(){return Object.assign({},Oa())}function XU(e){let n=He(e).getDay();return n===0&&(n=7),n}function ZU(e){return Math.trunc(+He(e)/1e3)}function JU(e){const t=He(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function eq(e,t){return GH(JU(e),sr(e),t)+1}function nd(e,t){const n=He(e),r=He(t);return n.getTime()>r.getTime()}function Tp(e,t){const n=He(e),r=He(t);return+n<+r}function tq(e,t){const n=t instanceof Date?jt(t,0):new t(0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}const nq=10;class nT{constructor(){Ee(this,"subPriority",0)}validate(t,n){return!0}}class rq extends nT{constructor(t,n,r,o,a){super(),this.value=t,this.validateValue=n,this.setValue=r,this.priority=o,a&&(this.subPriority=a)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,r){return this.setValue(t,n,this.value,r)}}class sq extends nT{constructor(){super(...arguments);Ee(this,"priority",nq);Ee(this,"subPriority",-1)}set(n,r){return r.timestampIsSet?n:jt(n,tq(n,Date))}}class gt{run(t,n,r,o){const a=this.parse(t,n,r,o);return a?{setter:new rq(a.value,this.validate,this.set,this.priority,this.subPriority),rest:a.rest}:null}validate(t,n,r){return!0}}class oq extends gt{constructor(){super(...arguments);Ee(this,"priority",140);Ee(this,"incompatibleTokens",["R","u","t","T"])}parse(n,r,o){switch(r){case"G":case"GG":case"GGG":return o.era(n,{width:"abbreviated"})||o.era(n,{width:"narrow"});case"GGGGG":return o.era(n,{width:"narrow"});case"GGGG":default:return o.era(n,{width:"wide"})||o.era(n,{width:"abbreviated"})||o.era(n,{width:"narrow"})}}set(n,r,o){return r.era=o,n.setFullYear(o,0,1),n.setHours(0,0,0,0),n}}const Kt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},As={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Yt(e,t){return e&&{value:t(e.value),rest:e.rest}}function $t(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function Ds(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const r=n[1]==="+"?1:-1,o=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,l=n[5]?parseInt(n[5],10):0;return{value:r*(o*vw+a*yw+l*WH),rest:t.slice(n[0].length)}}function rT(e){return $t(Kt.anyDigitsSigned,e)}function Ut(e,t){switch(e){case 1:return $t(Kt.singleDigit,t);case 2:return $t(Kt.twoDigits,t);case 3:return $t(Kt.threeDigits,t);case 4:return $t(Kt.fourDigits,t);default:return $t(new RegExp("^\\d{1,"+e+"}"),t)}}function Am(e,t){switch(e){case 1:return $t(Kt.singleDigitSigned,t);case 2:return $t(Kt.twoDigitsSigned,t);case 3:return $t(Kt.threeDigitsSigned,t);case 4:return $t(Kt.fourDigitsSigned,t);default:return $t(new RegExp("^-?\\d{1,"+e+"}"),t)}}function Sw(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function sT(e,t){const n=t>0,r=n?t:1-t;let o;if(r<=50)o=e||100;else{const a=r+50,l=Math.trunc(a/100)*100,u=e>=a%100;o=e+l-(u?100:0)}return n?o:1-o}function oT(e){return e%400===0||e%4===0&&e%100!==0}class aq extends gt{constructor(){super(...arguments);Ee(this,"priority",130);Ee(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,r,o){const a=l=>({year:l,isTwoDigitYear:r==="yy"});switch(r){case"y":return Yt(Ut(4,n),a);case"yo":return Yt(o.ordinalNumber(n,{unit:"year"}),a);default:return Yt(Ut(r.length,n),a)}}validate(n,r){return r.isTwoDigitYear||r.year>0}set(n,r,o){const a=n.getFullYear();if(o.isTwoDigitYear){const u=sT(o.year,a);return n.setFullYear(u,0,1),n.setHours(0,0,0,0),n}const l=!("era"in r)||r.era===1?o.year:1-o.year;return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}}class iq extends gt{constructor(){super(...arguments);Ee(this,"priority",130);Ee(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,r,o){const a=l=>({year:l,isTwoDigitYear:r==="YY"});switch(r){case"Y":return Yt(Ut(4,n),a);case"Yo":return Yt(o.ordinalNumber(n,{unit:"year"}),a);default:return Yt(Ut(r.length,n),a)}}validate(n,r){return r.isTwoDigitYear||r.year>0}set(n,r,o,a){const l=Cw(n,a);if(o.isTwoDigitYear){const d=sT(o.year,l);return n.setFullYear(d,0,a.firstWeekContainsDate),n.setHours(0,0,0,0),wr(n,a)}const u=!("era"in r)||r.era===1?o.year:1-o.year;return n.setFullYear(u,0,a.firstWeekContainsDate),n.setHours(0,0,0,0),wr(n,a)}}class lq extends gt{constructor(){super(...arguments);Ee(this,"priority",130);Ee(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,r){return Am(r==="R"?4:r.length,n)}set(n,r,o){const a=jt(n,0);return a.setFullYear(o,0,4),a.setHours(0,0,0,0),vo(a)}}class cq extends gt{constructor(){super(...arguments);Ee(this,"priority",130);Ee(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,r){return Am(r==="u"?4:r.length,n)}set(n,r,o){return n.setFullYear(o,0,1),n.setHours(0,0,0,0),n}}class uq extends gt{constructor(){super(...arguments);Ee(this,"priority",120);Ee(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,r,o){switch(r){case"Q":case"QQ":return Ut(r.length,n);case"Qo":return o.ordinalNumber(n,{unit:"quarter"});case"QQQ":return o.quarter(n,{width:"abbreviated",context:"formatting"})||o.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return o.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return o.quarter(n,{width:"wide",context:"formatting"})||o.quarter(n,{width:"abbreviated",context:"formatting"})||o.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=1&&r<=4}set(n,r,o){return n.setMonth((o-1)*3,1),n.setHours(0,0,0,0),n}}class dq extends gt{constructor(){super(...arguments);Ee(this,"priority",120);Ee(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,r,o){switch(r){case"q":case"qq":return Ut(r.length,n);case"qo":return o.ordinalNumber(n,{unit:"quarter"});case"qqq":return o.quarter(n,{width:"abbreviated",context:"standalone"})||o.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return o.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return o.quarter(n,{width:"wide",context:"standalone"})||o.quarter(n,{width:"abbreviated",context:"standalone"})||o.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=1&&r<=4}set(n,r,o){return n.setMonth((o-1)*3,1),n.setHours(0,0,0,0),n}}class fq extends gt{constructor(){super(...arguments);Ee(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Ee(this,"priority",110)}parse(n,r,o){const a=l=>l-1;switch(r){case"M":return Yt($t(Kt.month,n),a);case"MM":return Yt(Ut(2,n),a);case"Mo":return Yt(o.ordinalNumber(n,{unit:"month"}),a);case"MMM":return o.month(n,{width:"abbreviated",context:"formatting"})||o.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return o.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return o.month(n,{width:"wide",context:"formatting"})||o.month(n,{width:"abbreviated",context:"formatting"})||o.month(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=11}set(n,r,o){return n.setMonth(o,1),n.setHours(0,0,0,0),n}}class hq extends gt{constructor(){super(...arguments);Ee(this,"priority",110);Ee(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,r,o){const a=l=>l-1;switch(r){case"L":return Yt($t(Kt.month,n),a);case"LL":return Yt(Ut(2,n),a);case"Lo":return Yt(o.ordinalNumber(n,{unit:"month"}),a);case"LLL":return o.month(n,{width:"abbreviated",context:"standalone"})||o.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return o.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return o.month(n,{width:"wide",context:"standalone"})||o.month(n,{width:"abbreviated",context:"standalone"})||o.month(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=0&&r<=11}set(n,r,o){return n.setMonth(o,1),n.setHours(0,0,0,0),n}}function mq(e,t,n){const r=He(e),o=kw(r,n)-t;return r.setDate(r.getDate()-o*7),r}class pq extends gt{constructor(){super(...arguments);Ee(this,"priority",100);Ee(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,r,o){switch(r){case"w":return $t(Kt.week,n);case"wo":return o.ordinalNumber(n,{unit:"week"});default:return Ut(r.length,n)}}validate(n,r){return r>=1&&r<=53}set(n,r,o,a){return wr(mq(n,o,a),a)}}function gq(e,t){const n=He(e),r=jw(n)-t;return n.setDate(n.getDate()-r*7),n}class xq extends gt{constructor(){super(...arguments);Ee(this,"priority",100);Ee(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,r,o){switch(r){case"I":return $t(Kt.week,n);case"Io":return o.ordinalNumber(n,{unit:"week"});default:return Ut(r.length,n)}}validate(n,r){return r>=1&&r<=53}set(n,r,o){return vo(gq(n,o))}}const yq=[31,28,31,30,31,30,31,31,30,31,30,31],vq=[31,29,31,30,31,30,31,31,30,31,30,31];class bq extends gt{constructor(){super(...arguments);Ee(this,"priority",90);Ee(this,"subPriority",1);Ee(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,r,o){switch(r){case"d":return $t(Kt.date,n);case"do":return o.ordinalNumber(n,{unit:"date"});default:return Ut(r.length,n)}}validate(n,r){const o=n.getFullYear(),a=oT(o),l=n.getMonth();return a?r>=1&&r<=vq[l]:r>=1&&r<=yq[l]}set(n,r,o){return n.setDate(o),n.setHours(0,0,0,0),n}}class wq extends gt{constructor(){super(...arguments);Ee(this,"priority",90);Ee(this,"subpriority",1);Ee(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,r,o){switch(r){case"D":case"DD":return $t(Kt.dayOfYear,n);case"Do":return o.ordinalNumber(n,{unit:"date"});default:return Ut(r.length,n)}}validate(n,r){const o=n.getFullYear();return oT(o)?r>=1&&r<=366:r>=1&&r<=365}set(n,r,o){return n.setMonth(0,o),n.setHours(0,0,0,0),n}}function _w(e,t,n){var p,g,y,b;const r=Oa(),o=(n==null?void 0:n.weekStartsOn)??((g=(p=n==null?void 0:n.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((b=(y=r.locale)==null?void 0:y.options)==null?void 0:b.weekStartsOn)??0,a=He(e),l=a.getDay(),d=(t%7+7)%7,f=7-o,m=t<0||t>6?t-(l+f)%7:(d+f)%7-(l+f)%7;return wn(a,m)}class Nq extends gt{constructor(){super(...arguments);Ee(this,"priority",90);Ee(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,r,o){switch(r){case"E":case"EE":case"EEE":return o.day(n,{width:"abbreviated",context:"formatting"})||o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return o.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return o.day(n,{width:"wide",context:"formatting"})||o.day(n,{width:"abbreviated",context:"formatting"})||o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=6}set(n,r,o,a){return n=_w(n,o,a),n.setHours(0,0,0,0),n}}class jq extends gt{constructor(){super(...arguments);Ee(this,"priority",90);Ee(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,r,o,a){const l=u=>{const d=Math.floor((u-1)/7)*7;return(u+a.weekStartsOn+6)%7+d};switch(r){case"e":case"ee":return Yt(Ut(r.length,n),l);case"eo":return Yt(o.ordinalNumber(n,{unit:"day"}),l);case"eee":return o.day(n,{width:"abbreviated",context:"formatting"})||o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"});case"eeeee":return o.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return o.day(n,{width:"wide",context:"formatting"})||o.day(n,{width:"abbreviated",context:"formatting"})||o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=6}set(n,r,o,a){return n=_w(n,o,a),n.setHours(0,0,0,0),n}}class Cq extends gt{constructor(){super(...arguments);Ee(this,"priority",90);Ee(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,r,o,a){const l=u=>{const d=Math.floor((u-1)/7)*7;return(u+a.weekStartsOn+6)%7+d};switch(r){case"c":case"cc":return Yt(Ut(r.length,n),l);case"co":return Yt(o.ordinalNumber(n,{unit:"day"}),l);case"ccc":return o.day(n,{width:"abbreviated",context:"standalone"})||o.day(n,{width:"short",context:"standalone"})||o.day(n,{width:"narrow",context:"standalone"});case"ccccc":return o.day(n,{width:"narrow",context:"standalone"});case"cccccc":return o.day(n,{width:"short",context:"standalone"})||o.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return o.day(n,{width:"wide",context:"standalone"})||o.day(n,{width:"abbreviated",context:"standalone"})||o.day(n,{width:"short",context:"standalone"})||o.day(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=0&&r<=6}set(n,r,o,a){return n=_w(n,o,a),n.setHours(0,0,0,0),n}}function kq(e,t){const n=He(e),r=XU(n),o=t-r;return wn(n,o)}class Sq extends gt{constructor(){super(...arguments);Ee(this,"priority",90);Ee(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,r,o){const a=l=>l===0?7:l;switch(r){case"i":case"ii":return Ut(r.length,n);case"io":return o.ordinalNumber(n,{unit:"day"});case"iii":return Yt(o.day(n,{width:"abbreviated",context:"formatting"})||o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"}),a);case"iiiii":return Yt(o.day(n,{width:"narrow",context:"formatting"}),a);case"iiiiii":return Yt(o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"}),a);case"iiii":default:return Yt(o.day(n,{width:"wide",context:"formatting"})||o.day(n,{width:"abbreviated",context:"formatting"})||o.day(n,{width:"short",context:"formatting"})||o.day(n,{width:"narrow",context:"formatting"}),a)}}validate(n,r){return r>=1&&r<=7}set(n,r,o){return n=kq(n,o),n.setHours(0,0,0,0),n}}class _q extends gt{constructor(){super(...arguments);Ee(this,"priority",80);Ee(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,r,o){switch(r){case"a":case"aa":case"aaa":return o.dayPeriod(n,{width:"abbreviated",context:"formatting"})||o.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return o.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return o.dayPeriod(n,{width:"wide",context:"formatting"})||o.dayPeriod(n,{width:"abbreviated",context:"formatting"})||o.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,o){return n.setHours(Sw(o),0,0,0),n}}class Eq extends gt{constructor(){super(...arguments);Ee(this,"priority",80);Ee(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,r,o){switch(r){case"b":case"bb":case"bbb":return o.dayPeriod(n,{width:"abbreviated",context:"formatting"})||o.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return o.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return o.dayPeriod(n,{width:"wide",context:"formatting"})||o.dayPeriod(n,{width:"abbreviated",context:"formatting"})||o.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,o){return n.setHours(Sw(o),0,0,0),n}}class Pq extends gt{constructor(){super(...arguments);Ee(this,"priority",80);Ee(this,"incompatibleTokens",["a","b","t","T"])}parse(n,r,o){switch(r){case"B":case"BB":case"BBB":return o.dayPeriod(n,{width:"abbreviated",context:"formatting"})||o.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return o.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return o.dayPeriod(n,{width:"wide",context:"formatting"})||o.dayPeriod(n,{width:"abbreviated",context:"formatting"})||o.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,o){return n.setHours(Sw(o),0,0,0),n}}class Tq extends gt{constructor(){super(...arguments);Ee(this,"priority",70);Ee(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,r,o){switch(r){case"h":return $t(Kt.hour12h,n);case"ho":return o.ordinalNumber(n,{unit:"hour"});default:return Ut(r.length,n)}}validate(n,r){return r>=1&&r<=12}set(n,r,o){const a=n.getHours()>=12;return a&&o<12?n.setHours(o+12,0,0,0):!a&&o===12?n.setHours(0,0,0,0):n.setHours(o,0,0,0),n}}class Mq extends gt{constructor(){super(...arguments);Ee(this,"priority",70);Ee(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,r,o){switch(r){case"H":return $t(Kt.hour23h,n);case"Ho":return o.ordinalNumber(n,{unit:"hour"});default:return Ut(r.length,n)}}validate(n,r){return r>=0&&r<=23}set(n,r,o){return n.setHours(o,0,0,0),n}}class Aq extends gt{constructor(){super(...arguments);Ee(this,"priority",70);Ee(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,r,o){switch(r){case"K":return $t(Kt.hour11h,n);case"Ko":return o.ordinalNumber(n,{unit:"hour"});default:return Ut(r.length,n)}}validate(n,r){return r>=0&&r<=11}set(n,r,o){return n.getHours()>=12&&o<12?n.setHours(o+12,0,0,0):n.setHours(o,0,0,0),n}}class Dq extends gt{constructor(){super(...arguments);Ee(this,"priority",70);Ee(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,r,o){switch(r){case"k":return $t(Kt.hour24h,n);case"ko":return o.ordinalNumber(n,{unit:"hour"});default:return Ut(r.length,n)}}validate(n,r){return r>=1&&r<=24}set(n,r,o){const a=o<=24?o%24:o;return n.setHours(a,0,0,0),n}}class Rq extends gt{constructor(){super(...arguments);Ee(this,"priority",60);Ee(this,"incompatibleTokens",["t","T"])}parse(n,r,o){switch(r){case"m":return $t(Kt.minute,n);case"mo":return o.ordinalNumber(n,{unit:"minute"});default:return Ut(r.length,n)}}validate(n,r){return r>=0&&r<=59}set(n,r,o){return n.setMinutes(o,0,0),n}}class Oq extends gt{constructor(){super(...arguments);Ee(this,"priority",50);Ee(this,"incompatibleTokens",["t","T"])}parse(n,r,o){switch(r){case"s":return $t(Kt.second,n);case"so":return o.ordinalNumber(n,{unit:"second"});default:return Ut(r.length,n)}}validate(n,r){return r>=0&&r<=59}set(n,r,o){return n.setSeconds(o,0),n}}class Iq extends gt{constructor(){super(...arguments);Ee(this,"priority",30);Ee(this,"incompatibleTokens",["t","T"])}parse(n,r){const o=a=>Math.trunc(a*Math.pow(10,-r.length+3));return Yt(Ut(r.length,n),o)}set(n,r,o){return n.setMilliseconds(o),n}}class Lq extends gt{constructor(){super(...arguments);Ee(this,"priority",10);Ee(this,"incompatibleTokens",["t","T","x"])}parse(n,r){switch(r){case"X":return Ds(As.basicOptionalMinutes,n);case"XX":return Ds(As.basic,n);case"XXXX":return Ds(As.basicOptionalSeconds,n);case"XXXXX":return Ds(As.extendedOptionalSeconds,n);case"XXX":default:return Ds(As.extended,n)}}set(n,r,o){return r.timestampIsSet?n:jt(n,n.getTime()-Pa(n)-o)}}class Fq extends gt{constructor(){super(...arguments);Ee(this,"priority",10);Ee(this,"incompatibleTokens",["t","T","X"])}parse(n,r){switch(r){case"x":return Ds(As.basicOptionalMinutes,n);case"xx":return Ds(As.basic,n);case"xxxx":return Ds(As.basicOptionalSeconds,n);case"xxxxx":return Ds(As.extendedOptionalSeconds,n);case"xxx":default:return Ds(As.extended,n)}}set(n,r,o){return r.timestampIsSet?n:jt(n,n.getTime()-Pa(n)-o)}}class $q extends gt{constructor(){super(...arguments);Ee(this,"priority",40);Ee(this,"incompatibleTokens","*")}parse(n){return rT(n)}set(n,r,o){return[jt(n,o*1e3),{timestampIsSet:!0}]}}class Vq extends gt{constructor(){super(...arguments);Ee(this,"priority",20);Ee(this,"incompatibleTokens","*")}parse(n){return rT(n)}set(n,r,o){return[jt(n,o),{timestampIsSet:!0}]}}const zq={G:new oq,y:new aq,Y:new iq,R:new lq,u:new cq,Q:new uq,q:new dq,M:new fq,L:new hq,w:new pq,I:new xq,d:new bq,D:new wq,E:new Nq,e:new jq,c:new Cq,i:new Sq,a:new _q,b:new Eq,B:new Pq,h:new Tq,H:new Mq,K:new Aq,k:new Dq,m:new Rq,s:new Oq,S:new Iq,X:new Lq,x:new Fq,t:new $q,T:new Vq},Bq=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Wq=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hq=/^'([^]*?)'?$/,Uq=/''/g,qq=/\S/,Kq=/[a-zA-Z]/;function Yq(e,t,n,r){var w,N,k,j;const o=GU(),a=o.locale??Pp,l=o.firstWeekContainsDate??((N=(w=o.locale)==null?void 0:w.options)==null?void 0:N.firstWeekContainsDate)??1,u=o.weekStartsOn??((j=(k=o.locale)==null?void 0:k.options)==null?void 0:j.weekStartsOn)??0,d={firstWeekContainsDate:l,weekStartsOn:u,locale:a},f=[new sq],m=t.match(Wq).map(C=>{const S=C[0];if(S in y0){const E=y0[S];return E(C,a.formatLong)}return C}).join("").match(Bq),p=[];for(let C of m){tT(C)&&v0(C,t,e),eT(C)&&v0(C,t,e);const S=C[0],E=zq[S];if(E){const{incompatibleTokens:P}=E;if(Array.isArray(P)){const I=p.find(z=>P.includes(z.token)||z.token===S);if(I)throw new RangeError(`The format string mustn't contain \`${I.fullToken}\` and \`${C}\` at the same time`)}else if(E.incompatibleTokens==="*"&&p.length>0)throw new RangeError(`The format string mustn't contain \`${C}\` and any other token at the same time`);p.push({token:S,fullToken:C});const D=E.run(e,C,a.match,d);if(!D)return jt(n,NaN);f.push(D.setter),e=D.rest}else{if(S.match(Kq))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");if(C==="''"?C="'":S==="'"&&(C=Qq(C)),e.indexOf(C)===0)e=e.slice(C.length);else return jt(n,NaN)}}if(e.length>0&&qq.test(e))return jt(n,NaN);const g=f.map(C=>C.priority).sort((C,S)=>S-C).filter((C,S,E)=>E.indexOf(C)===S).map(C=>f.filter(S=>S.priority===C).sort((S,E)=>E.subPriority-S.subPriority)).map(C=>C[0]);let y=He(n);if(isNaN(y.getTime()))return jt(n,NaN);const b={};for(const C of g){if(!C.validate(y,d))return jt(n,NaN);const S=C.set(y,b,d);Array.isArray(S)?(y=S[0],Object.assign(b,S[1])):y=S}return jt(n,y)}function Qq(e){return e.match(Hq)[1].replace(Uq,"'")}function Ld(e){return+He(e)<Date.now()}function Ew(e,t){const n=He(e),r=He(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Gq(e,t){const n=He(e),r=He(t);return n.getFullYear()===r.getFullYear()}function Iy(e,t){return wn(e,-t)}function Mp(e,t){const r=eK(e);let o;if(r.date){const d=tK(r.date,2);o=nK(d.restDateString,d.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);const a=o.getTime();let l=0,u;if(r.time&&(l=rK(r.time),isNaN(l)))return new Date(NaN);if(r.timezone){if(u=sK(r.timezone),isNaN(u))return new Date(NaN)}else{const d=new Date(a+l),f=new Date(0);return f.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),f.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),f}return new Date(a+l+u)}const wh={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Xq=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Zq=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Jq=/^([+-])(\d{2})(?::?(\d{2}))?$/;function eK(e){const t={},n=e.split(wh.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],wh.timeZoneDelimiter.test(t.date)&&(t.date=e.split(wh.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const o=wh.timezone.exec(r);o?(t.time=r.replace(o[1],""),t.timezone=o[1]):t.time=r}return t}function tK(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const o=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?o:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function nK(e,t){if(t===null)return new Date(NaN);const n=e.match(Xq);if(!n)return new Date(NaN);const r=!!n[4],o=ju(n[1]),a=ju(n[2])-1,l=ju(n[3]),u=ju(n[4]),d=ju(n[5])-1;if(r)return cK(t,u,d)?oK(t,u,d):new Date(NaN);{const f=new Date(0);return!iK(t,a,l)||!lK(t,o)?new Date(NaN):(f.setUTCFullYear(t,a,Math.max(o,l)),f)}}function ju(e){return e?parseInt(e):1}function rK(e){const t=e.match(Zq);if(!t)return NaN;const n=Ly(t[1]),r=Ly(t[2]),o=Ly(t[3]);return uK(n,r,o)?n*vw+r*yw+o*1e3:NaN}function Ly(e){return e&&parseFloat(e.replace(",","."))||0}function sK(e){if(e==="Z")return 0;const t=e.match(Jq);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),o=t[3]&&parseInt(t[3])||0;return dK(r,o)?n*(r*vw+o*yw):NaN}function oK(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const o=r.getUTCDay()||7,a=(t-1)*7+n+1-o;return r.setUTCDate(r.getUTCDate()+a),r}const aK=[31,null,31,30,31,30,31,31,30,31,30,31];function aT(e){return e%400===0||e%4===0&&e%100!==0}function iK(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(aK[t]||(aT(e)?29:28))}function lK(e,t){return t>=1&&t<=(aT(e)?366:365)}function cK(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function uK(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function dK(e,t){return t>=0&&t<=59}function Fy(e,t){const n=He(e),r=n.getFullYear(),o=n.getDate(),a=jt(e,0);a.setFullYear(r,t,15),a.setHours(0,0,0,0);const l=QU(a);return n.setMonth(t,Math.min(o,l)),n}function xS(e,t){const n=He(e);return isNaN(+n)?jt(e,NaN):(n.setFullYear(t),n)}var fK=Symbol.for("react.lazy"),Dm=ep[" use ".trim().toString()];function hK(e){return typeof e=="object"&&e!==null&&"then"in e}function iT(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===fK&&"_payload"in e&&hK(e._payload)}function mK(e){const t=gK(e),n=x.forwardRef((r,o)=>{let{children:a,...l}=r;iT(a)&&typeof Dm=="function"&&(a=Dm(a._payload));const u=x.Children.toArray(a),d=u.find(yK);if(d){const f=d.props.children,m=u.map(p=>p===d?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:o,children:x.isValidElement(f)?x.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}var pK=mK("Slot");function gK(e){const t=x.forwardRef((n,r)=>{let{children:o,...a}=n;if(iT(o)&&typeof Dm=="function"&&(o=Dm(o._payload)),x.isValidElement(o)){const l=bK(o),u=vK(a,o.props);return o.type!==x.Fragment&&(u.ref=r?Vr(r,l):l),x.cloneElement(o,u)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xK=Symbol("radix.slottable");function yK(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xK}function vK(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...u)=>{const d=a(...u);return o(...u),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function bK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const b0=ib("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Jt=x.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},a)=>{const l=r?pK:"button";return s.jsx(l,{className:Ie(b0({variant:t,size:n,className:e})),ref:a,...o})});Jt.displayName="Button";var Qe=function(){return Qe=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Qe.apply(this,arguments)};function wK(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function lT(e,t,n){for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function Fd(e){return e.mode==="multiple"}function $d(e){return e.mode==="range"}function Ap(e){return e.mode==="single"}var NK={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function jK(e,t){return Nr(e,"LLLL y",t)}function CK(e,t){return Nr(e,"d",t)}function kK(e,t){return Nr(e,"LLLL",t)}function SK(e){return"".concat(e)}function _K(e,t){return Nr(e,"cccccc",t)}function EK(e,t){return Nr(e,"yyyy",t)}var PK=Object.freeze({__proto__:null,formatCaption:jK,formatDay:CK,formatMonthCaption:kK,formatWeekNumber:SK,formatWeekdayName:_K,formatYearCaption:EK}),TK=function(e,t,n){return Nr(e,"do MMMM (EEEE)",n)},MK=function(){return"Month: "},AK=function(){return"Go to next month"},DK=function(){return"Go to previous month"},RK=function(e,t){return Nr(e,"cccc",t)},OK=function(e){return"Week n. ".concat(e)},IK=function(){return"Year: "},LK=Object.freeze({__proto__:null,labelDay:TK,labelMonthDropdown:MK,labelNext:AK,labelPrevious:DK,labelWeekNumber:OK,labelWeekday:RK,labelYearDropdown:IK});function FK(){var e="buttons",t=NK,n=Pp,r={},o={},a=1,l={},u=new Date;return{captionLayout:e,classNames:t,formatters:PK,labels:LK,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:a,styles:l,today:u,mode:"default"}}function $K(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,a=e.fromDate,l=e.toDate;return r?a=sr(r):t&&(a=new Date(t,0,1)),o?l=Ep(o):n&&(l=new Date(n,11,31)),{fromDate:a?ac(a):void 0,toDate:l?ac(l):void 0}}var cT=x.createContext(void 0);function VK(e){var t,n=e.initialProps,r=FK(),o=$K(n),a=o.fromDate,l=o.toDate,u=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;u!=="buttons"&&(!a||!l)&&(u="buttons");var d;(Ap(n)||Fd(n)||$d(n))&&(d=n.onSelect);var f=Qe(Qe(Qe({},r),n),{captionLayout:u,classNames:Qe(Qe({},r.classNames),n.classNames),components:Qe({},n.components),formatters:Qe(Qe({},r.formatters),n.formatters),fromDate:a,labels:Qe(Qe({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Qe(Qe({},r.modifiers),n.modifiers),modifiersClassNames:Qe(Qe({},r.modifiersClassNames),n.modifiersClassNames),onSelect:d,styles:Qe(Qe({},r.styles),n.styles),toDate:l});return s.jsx(cT.Provider,{value:f,children:e.children})}function _t(){var e=x.useContext(cT);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function uT(e){var t=_t(),n=t.locale,r=t.classNames,o=t.styles,a=t.formatters.formatCaption;return s.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:a(e.displayMonth,{locale:n})})}function zK(e){return s.jsx("svg",Qe({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:s.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function dT(e){var t,n,r=e.onChange,o=e.value,a=e.children,l=e.caption,u=e.className,d=e.style,f=_t(),m=(n=(t=f.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:zK;return s.jsxs("div",{className:u,style:d,children:[s.jsx("span",{className:f.classNames.vhidden,children:e["aria-label"]}),s.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:f.classNames.dropdown,style:f.styles.dropdown,value:o,onChange:r,children:a}),s.jsxs("div",{className:f.classNames.caption_label,style:f.styles.caption_label,"aria-hidden":"true",children:[l,s.jsx(m,{className:f.classNames.dropdown_icon,style:f.styles.dropdown_icon})]})]})}function BK(e){var t,n=_t(),r=n.fromDate,o=n.toDate,a=n.styles,l=n.locale,u=n.formatters.formatMonthCaption,d=n.classNames,f=n.components,m=n.labels.labelMonthDropdown;if(!r)return s.jsx(s.Fragment,{});if(!o)return s.jsx(s.Fragment,{});var p=[];if(Gq(r,o))for(var g=sr(r),y=r.getMonth();y<=o.getMonth();y++)p.push(Fy(g,y));else for(var g=sr(new Date),y=0;y<=11;y++)p.push(Fy(g,y));var b=function(N){var k=Number(N.target.value),j=Fy(sr(e.displayMonth),k);e.onChange(j)},w=(t=f==null?void 0:f.Dropdown)!==null&&t!==void 0?t:dT;return s.jsx(w,{name:"months","aria-label":m(),className:d.dropdown_month,style:a.dropdown_month,onChange:b,value:e.displayMonth.getMonth(),caption:u(e.displayMonth,{locale:l}),children:p.map(function(N){return s.jsx("option",{value:N.getMonth(),children:u(N,{locale:l})},N.getMonth())})})}function WK(e){var t,n=e.displayMonth,r=_t(),o=r.fromDate,a=r.toDate,l=r.locale,u=r.styles,d=r.classNames,f=r.components,m=r.formatters.formatYearCaption,p=r.labels.labelYearDropdown,g=[];if(!o)return s.jsx(s.Fragment,{});if(!a)return s.jsx(s.Fragment,{});for(var y=o.getFullYear(),b=a.getFullYear(),w=y;w<=b;w++)g.push(xS(X3(new Date),w));var N=function(j){var C=xS(sr(n),Number(j.target.value));e.onChange(C)},k=(t=f==null?void 0:f.Dropdown)!==null&&t!==void 0?t:dT;return s.jsx(k,{name:"years","aria-label":p(),className:d.dropdown_year,style:u.dropdown_year,onChange:N,value:n.getFullYear(),caption:m(n,{locale:l}),children:g.map(function(j){return s.jsx("option",{value:j.getFullYear(),children:m(j,{locale:l})},j.getFullYear())})})}function HK(e,t){var n=x.useState(e),r=n[0],o=n[1],a=t===void 0?r:t;return[a,o]}function UK(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,a=e.toDate,l=e.fromDate,u=e.numberOfMonths,d=u===void 0?1:u;if(a&&ic(a,o)<0){var f=-1*(d-1);o=ds(a,f)}return l&&ic(o,l)<0&&(o=l),sr(o)}function qK(){var e=_t(),t=UK(e),n=HK(t,e.month),r=n[0],o=n[1],a=function(l){var u;if(!e.disableNavigation){var d=sr(l);o(d),(u=e.onMonthChange)===null||u===void 0||u.call(e,d)}};return[r,a]}function KK(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=sr(e),a=sr(ds(o,r)),l=ic(a,o),u=[],d=0;d<l;d++){var f=ds(o,d);u.push(f)}return n&&(u=u.reverse()),u}function YK(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,l=r?a:1,u=sr(e);if(!n)return ds(u,l);var d=ic(n,e);if(!(d<a))return ds(u,l)}}function QK(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,l=r?a:1,u=sr(e);if(!n)return ds(u,-l);var d=ic(u,n);if(!(d<=0))return ds(u,-l)}}var fT=x.createContext(void 0);function GK(e){var t=_t(),n=qK(),r=n[0],o=n[1],a=KK(r,t),l=YK(r,t),u=QK(r,t),d=function(p){return a.some(function(g){return Ew(p,g)})},f=function(p,g){d(p)||(g&&Tp(p,g)?o(ds(p,1+t.numberOfMonths*-1)):o(p))},m={currentMonth:r,displayMonths:a,goToMonth:o,goToDate:f,previousMonth:u,nextMonth:l,isDateDisplayed:d};return s.jsx(fT.Provider,{value:m,children:e.children})}function Vd(){var e=x.useContext(fT);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function yS(e){var t,n=_t(),r=n.classNames,o=n.styles,a=n.components,l=Vd().goToMonth,u=function(m){l(ds(m,e.displayIndex?-e.displayIndex:0))},d=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:uT,f=s.jsx(d,{id:e.id,displayMonth:e.displayMonth});return s.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[s.jsx("div",{className:r.vhidden,children:f}),s.jsx(BK,{onChange:u,displayMonth:e.displayMonth}),s.jsx(WK,{onChange:u,displayMonth:e.displayMonth})]})}function XK(e){return s.jsx("svg",Qe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function ZK(e){return s.jsx("svg",Qe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Rm=x.forwardRef(function(e,t){var n=_t(),r=n.classNames,o=n.styles,a=[r.button_reset,r.button];e.className&&a.push(e.className);var l=a.join(" "),u=Qe(Qe({},o.button_reset),o.button);return e.style&&Object.assign(u,e.style),s.jsx("button",Qe({},e,{ref:t,type:"button",className:l,style:u}))});function JK(e){var t,n,r=_t(),o=r.dir,a=r.locale,l=r.classNames,u=r.styles,d=r.labels,f=d.labelPrevious,m=d.labelNext,p=r.components;if(!e.nextMonth&&!e.previousMonth)return s.jsx(s.Fragment,{});var g=f(e.previousMonth,{locale:a}),y=[l.nav_button,l.nav_button_previous].join(" "),b=m(e.nextMonth,{locale:a}),w=[l.nav_button,l.nav_button_next].join(" "),N=(t=p==null?void 0:p.IconRight)!==null&&t!==void 0?t:ZK,k=(n=p==null?void 0:p.IconLeft)!==null&&n!==void 0?n:XK;return s.jsxs("div",{className:l.nav,style:u.nav,children:[!e.hidePrevious&&s.jsx(Rm,{name:"previous-month","aria-label":g,className:y,style:u.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?s.jsx(N,{className:l.nav_icon,style:u.nav_icon}):s.jsx(k,{className:l.nav_icon,style:u.nav_icon})}),!e.hideNext&&s.jsx(Rm,{name:"next-month","aria-label":b,className:w,style:u.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?s.jsx(k,{className:l.nav_icon,style:u.nav_icon}):s.jsx(N,{className:l.nav_icon,style:u.nav_icon})})]})}function vS(e){var t=_t().numberOfMonths,n=Vd(),r=n.previousMonth,o=n.nextMonth,a=n.goToMonth,l=n.displayMonths,u=l.findIndex(function(b){return Ew(e.displayMonth,b)}),d=u===0,f=u===l.length-1,m=t>1&&(d||!f),p=t>1&&(f||!d),g=function(){r&&a(r)},y=function(){o&&a(o)};return s.jsx(JK,{displayMonth:e.displayMonth,hideNext:m,hidePrevious:p,nextMonth:o,previousMonth:r,onPreviousClick:g,onNextClick:y})}function eY(e){var t,n=_t(),r=n.classNames,o=n.disableNavigation,a=n.styles,l=n.captionLayout,u=n.components,d=(t=u==null?void 0:u.CaptionLabel)!==null&&t!==void 0?t:uT,f;return o?f=s.jsx(d,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?f=s.jsx(yS,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?f=s.jsxs(s.Fragment,{children:[s.jsx(yS,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),s.jsx(vS,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):f=s.jsxs(s.Fragment,{children:[s.jsx(d,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(vS,{displayMonth:e.displayMonth,id:e.id})]}),s.jsx("div",{className:r.caption,style:a.caption,children:f})}function tY(e){var t=_t(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?s.jsx("tfoot",{className:o,style:r.tfoot,children:s.jsx("tr",{children:s.jsx("td",{colSpan:8,children:n})})}):s.jsx(s.Fragment,{})}function nY(e,t,n){for(var r=n?vo(new Date):wr(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var l=wn(r,a);o.push(l)}return o}function rY(){var e=_t(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,a=e.weekStartsOn,l=e.ISOWeek,u=e.formatters.formatWeekdayName,d=e.labels.labelWeekday,f=nY(o,a,l);return s.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&s.jsx("td",{style:n.head_cell,className:t.head_cell}),f.map(function(m,p){return s.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":d(m,{locale:o}),children:u(m,{locale:o})},p)})]})}function sY(){var e,t=_t(),n=t.classNames,r=t.styles,o=t.components,a=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:rY;return s.jsx("thead",{style:r.head,className:n.head,children:s.jsx(a,{})})}function oY(e){var t=_t(),n=t.locale,r=t.formatters.formatDay;return s.jsx(s.Fragment,{children:r(e.date,{locale:n})})}var Pw=x.createContext(void 0);function aY(e){if(!Fd(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return s.jsx(Pw.Provider,{value:t,children:e.children})}return s.jsx(iY,{initialProps:e.initialProps,children:e.children})}function iY(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,a=t.max,l=function(f,m,p){var g,y;(g=t.onDayClick)===null||g===void 0||g.call(t,f,m,p);var b=!!(m.selected&&o&&(r==null?void 0:r.length)===o);if(!b){var w=!!(!m.selected&&a&&(r==null?void 0:r.length)===a);if(!w){var N=r?lT([],r):[];if(m.selected){var k=N.findIndex(function(j){return nr(f,j)});N.splice(k,1)}else N.push(f);(y=t.onSelect)===null||y===void 0||y.call(t,N,f,m,p)}}},u={disabled:[]};r&&u.disabled.push(function(f){var m=a&&r.length>a-1,p=r.some(function(g){return nr(g,f)});return!!(m&&!p)});var d={selected:r,onDayClick:l,modifiers:u};return s.jsx(Pw.Provider,{value:d,children:n})}function Tw(){var e=x.useContext(Pw);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function lY(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?nr(o,e)&&nr(r,e)?void 0:nr(o,e)?{from:o,to:void 0}:nr(r,e)?void 0:nd(r,e)?{from:e,to:o}:{from:r,to:e}:o?nd(e,o)?{from:o,to:e}:{from:e,to:o}:r?Tp(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var Mw=x.createContext(void 0);function cY(e){if(!$d(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return s.jsx(Mw.Provider,{value:t,children:e.children})}return s.jsx(uY,{initialProps:e.initialProps,children:e.children})}function uY(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},a=o.from,l=o.to,u=t.min,d=t.max,f=function(y,b,w){var N,k;(N=t.onDayClick)===null||N===void 0||N.call(t,y,b,w);var j=lY(y,r);(k=t.onSelect)===null||k===void 0||k.call(t,j,y,b,w)},m={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(m.range_start=[a],l?(m.range_end=[l],nr(a,l)||(m.range_middle=[{after:a,before:l}])):m.range_end=[a]):l&&(m.range_start=[l],m.range_end=[l]),u&&(a&&!l&&m.disabled.push({after:Iy(a,u-1),before:wn(a,u-1)}),a&&l&&m.disabled.push({after:a,before:wn(a,u-1)}),!a&&l&&m.disabled.push({after:Iy(l,u-1),before:wn(l,u-1)})),d){if(a&&!l&&(m.disabled.push({before:wn(a,-d+1)}),m.disabled.push({after:wn(a,d-1)})),a&&l){var p=Os(l,a)+1,g=d-p;m.disabled.push({before:Iy(a,g)}),m.disabled.push({after:wn(l,g)})}!a&&l&&(m.disabled.push({before:wn(l,-d+1)}),m.disabled.push({after:wn(l,d-1)}))}return s.jsx(Mw.Provider,{value:{selected:r,onDayClick:f,modifiers:m},children:n})}function Aw(){var e=x.useContext(Mw);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Jh(e){return Array.isArray(e)?lT([],e):e!==void 0?[e]:[]}function dY(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=Jh(o)}),t}var fs;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(fs||(fs={}));var fY=fs.Selected,ro=fs.Disabled,hY=fs.Hidden,mY=fs.Today,$y=fs.RangeEnd,Vy=fs.RangeMiddle,zy=fs.RangeStart,pY=fs.Outside;function gY(e,t,n){var r,o=(r={},r[fY]=Jh(e.selected),r[ro]=Jh(e.disabled),r[hY]=Jh(e.hidden),r[mY]=[e.today],r[$y]=[],r[Vy]=[],r[zy]=[],r[pY]=[],r);return e.fromDate&&o[ro].push({before:e.fromDate}),e.toDate&&o[ro].push({after:e.toDate}),Fd(e)?o[ro]=o[ro].concat(t.modifiers[ro]):$d(e)&&(o[ro]=o[ro].concat(n.modifiers[ro]),o[zy]=n.modifiers[zy],o[Vy]=n.modifiers[Vy],o[$y]=n.modifiers[$y]),o}var hT=x.createContext(void 0);function xY(e){var t=_t(),n=Tw(),r=Aw(),o=gY(t,n,r),a=dY(t.modifiers),l=Qe(Qe({},o),a);return s.jsx(hT.Provider,{value:l,children:e.children})}function mT(){var e=x.useContext(hT);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function yY(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function vY(e){return!!(e&&typeof e=="object"&&"from"in e)}function bY(e){return!!(e&&typeof e=="object"&&"after"in e)}function wY(e){return!!(e&&typeof e=="object"&&"before"in e)}function NY(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function jY(e,t){var n,r=t.from,o=t.to;if(r&&o){var a=Os(o,r)<0;a&&(n=[o,r],r=n[0],o=n[1]);var l=Os(e,r)>=0&&Os(o,e)>=0;return l}return o?nr(o,e):r?nr(r,e):!1}function CY(e){return bw(e)}function kY(e){return Array.isArray(e)&&e.every(bw)}function SY(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(CY(n))return nr(e,n);if(kY(n))return n.includes(e);if(vY(n))return jY(e,n);if(NY(n))return n.dayOfWeek.includes(e.getDay());if(yY(n)){var r=Os(n.before,e),o=Os(n.after,e),a=r>0,l=o<0,u=nd(n.before,n.after);return u?l&&a:a||l}return bY(n)?Os(e,n.after)>0:wY(n)?Os(n.before,e)>0:typeof n=="function"?n(e):!1})}function Dw(e,t,n){var r=Object.keys(t).reduce(function(a,l){var u=t[l];return SY(e,u)&&a.push(l),a},[]),o={};return r.forEach(function(a){return o[a]=!0}),n&&!Ew(e,n)&&(o.outside=!0),o}function _Y(e,t){for(var n=sr(e[0]),r=Ep(e[e.length-1]),o,a,l=n;l<=r;){var u=Dw(l,t),d=!u.disabled&&!u.hidden;if(!d){l=wn(l,1);continue}if(u.selected)return l;u.today&&!a&&(a=l),o||(o=l),l=wn(l,1)}return a||o}var EY=365;function pT(e,t){var n=t.moveBy,r=t.direction,o=t.context,a=t.modifiers,l=t.retry,u=l===void 0?{count:0,lastFocused:e}:l,d=o.weekStartsOn,f=o.fromDate,m=o.toDate,p=o.locale,g={day:wn,week:x0,month:ds,year:qH,startOfWeek:function(N){return o.ISOWeek?vo(N):wr(N,{locale:p,weekStartsOn:d})},endOfWeek:function(N){return o.ISOWeek?Z3(N):Nw(N,{locale:p,weekStartsOn:d})}},y=g[n](e,r==="after"?1:-1);r==="before"&&f?y=KH([f,y]):r==="after"&&m&&(y=YH([m,y]));var b=!0;if(a){var w=Dw(y,a);b=!w.disabled&&!w.hidden}return b?y:u.count>EY?u.lastFocused:pT(y,{moveBy:n,direction:r,context:o,modifiers:a,retry:Qe(Qe({},u),{count:u.count+1})})}var gT=x.createContext(void 0);function PY(e){var t=Vd(),n=mT(),r=x.useState(),o=r[0],a=r[1],l=x.useState(),u=l[0],d=l[1],f=_Y(t.displayMonths,n),m=o??(u&&t.isDateDisplayed(u))?u:f,p=function(){d(o),a(void 0)},g=function(N){a(N)},y=_t(),b=function(N,k){if(o){var j=pT(o,{moveBy:N,direction:k,context:y,modifiers:n});nr(o,j)||(t.goToDate(j,o),g(j))}},w={focusedDay:o,focusTarget:m,blur:p,focus:g,focusDayAfter:function(){return b("day","after")},focusDayBefore:function(){return b("day","before")},focusWeekAfter:function(){return b("week","after")},focusWeekBefore:function(){return b("week","before")},focusMonthBefore:function(){return b("month","before")},focusMonthAfter:function(){return b("month","after")},focusYearBefore:function(){return b("year","before")},focusYearAfter:function(){return b("year","after")},focusStartOfWeek:function(){return b("startOfWeek","before")},focusEndOfWeek:function(){return b("endOfWeek","after")}};return s.jsx(gT.Provider,{value:w,children:e.children})}function Rw(){var e=x.useContext(gT);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function TY(e,t){var n=mT(),r=Dw(e,n,t);return r}var Ow=x.createContext(void 0);function MY(e){if(!Ap(e.initialProps)){var t={selected:void 0};return s.jsx(Ow.Provider,{value:t,children:e.children})}return s.jsx(AY,{initialProps:e.initialProps,children:e.children})}function AY(e){var t=e.initialProps,n=e.children,r=function(a,l,u){var d,f,m;if((d=t.onDayClick)===null||d===void 0||d.call(t,a,l,u),l.selected&&!t.required){(f=t.onSelect)===null||f===void 0||f.call(t,void 0,a,l,u);return}(m=t.onSelect)===null||m===void 0||m.call(t,a,a,l,u)},o={selected:t.selected,onDayClick:r};return s.jsx(Ow.Provider,{value:o,children:n})}function xT(){var e=x.useContext(Ow);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function DY(e,t){var n=_t(),r=xT(),o=Tw(),a=Aw(),l=Rw(),u=l.focusDayAfter,d=l.focusDayBefore,f=l.focusWeekAfter,m=l.focusWeekBefore,p=l.blur,g=l.focus,y=l.focusMonthBefore,b=l.focusMonthAfter,w=l.focusYearBefore,N=l.focusYearAfter,k=l.focusStartOfWeek,j=l.focusEndOfWeek,C=function(L){var A,O,U,V;Ap(n)?(A=r.onDayClick)===null||A===void 0||A.call(r,e,t,L):Fd(n)?(O=o.onDayClick)===null||O===void 0||O.call(o,e,t,L):$d(n)?(U=a.onDayClick)===null||U===void 0||U.call(a,e,t,L):(V=n.onDayClick)===null||V===void 0||V.call(n,e,t,L)},S=function(L){var A;g(e),(A=n.onDayFocus)===null||A===void 0||A.call(n,e,t,L)},E=function(L){var A;p(),(A=n.onDayBlur)===null||A===void 0||A.call(n,e,t,L)},P=function(L){var A;(A=n.onDayMouseEnter)===null||A===void 0||A.call(n,e,t,L)},D=function(L){var A;(A=n.onDayMouseLeave)===null||A===void 0||A.call(n,e,t,L)},I=function(L){var A;(A=n.onDayPointerEnter)===null||A===void 0||A.call(n,e,t,L)},z=function(L){var A;(A=n.onDayPointerLeave)===null||A===void 0||A.call(n,e,t,L)},K=function(L){var A;(A=n.onDayTouchCancel)===null||A===void 0||A.call(n,e,t,L)},q=function(L){var A;(A=n.onDayTouchEnd)===null||A===void 0||A.call(n,e,t,L)},H=function(L){var A;(A=n.onDayTouchMove)===null||A===void 0||A.call(n,e,t,L)},B=function(L){var A;(A=n.onDayTouchStart)===null||A===void 0||A.call(n,e,t,L)},R=function(L){var A;(A=n.onDayKeyUp)===null||A===void 0||A.call(n,e,t,L)},M=function(L){var A;switch(L.key){case"ArrowLeft":L.preventDefault(),L.stopPropagation(),n.dir==="rtl"?u():d();break;case"ArrowRight":L.preventDefault(),L.stopPropagation(),n.dir==="rtl"?d():u();break;case"ArrowDown":L.preventDefault(),L.stopPropagation(),f();break;case"ArrowUp":L.preventDefault(),L.stopPropagation(),m();break;case"PageUp":L.preventDefault(),L.stopPropagation(),L.shiftKey?w():y();break;case"PageDown":L.preventDefault(),L.stopPropagation(),L.shiftKey?N():b();break;case"Home":L.preventDefault(),L.stopPropagation(),k();break;case"End":L.preventDefault(),L.stopPropagation(),j();break}(A=n.onDayKeyDown)===null||A===void 0||A.call(n,e,t,L)},F={onClick:C,onFocus:S,onBlur:E,onKeyDown:M,onKeyUp:R,onMouseEnter:P,onMouseLeave:D,onPointerEnter:I,onPointerLeave:z,onTouchCancel:K,onTouchEnd:q,onTouchMove:H,onTouchStart:B};return F}function RY(){var e=_t(),t=xT(),n=Tw(),r=Aw(),o=Ap(e)?t.selected:Fd(e)?n.selected:$d(e)?r.selected:void 0;return o}function OY(e){return Object.values(fs).includes(e)}function IY(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)n.push(o);else if(OY(r)){var a=e.classNames["day_".concat(r)];a&&n.push(a)}}),n}function LY(e,t){var n=Qe({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=Qe(Qe({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function FY(e,t,n){var r,o,a,l=_t(),u=Rw(),d=TY(e,t),f=DY(e,d),m=RY(),p=!!(l.onDayClick||l.mode!=="default");x.useEffect(function(){var P;d.outside||u.focusedDay&&p&&nr(u.focusedDay,e)&&((P=n.current)===null||P===void 0||P.focus())},[u.focusedDay,e,n,p,d.outside]);var g=IY(l,d).join(" "),y=LY(l,d),b=!!(d.outside&&!l.showOutsideDays||d.hidden),w=(a=(o=l.components)===null||o===void 0?void 0:o.DayContent)!==null&&a!==void 0?a:oY,N=s.jsx(w,{date:e,displayMonth:t,activeModifiers:d}),k={style:y,className:g,children:N,role:"gridcell"},j=u.focusTarget&&nr(u.focusTarget,e)&&!d.outside,C=u.focusedDay&&nr(u.focusedDay,e),S=Qe(Qe(Qe({},k),(r={disabled:d.disabled,role:"gridcell"},r["aria-selected"]=d.selected,r.tabIndex=C||j?0:-1,r)),f),E={isButton:p,isHidden:b,activeModifiers:d,selectedDays:m,buttonProps:S,divProps:k};return E}function $Y(e){var t=x.useRef(null),n=FY(e.date,e.displayMonth,t);return n.isHidden?s.jsx("div",{role:"gridcell"}):n.isButton?s.jsx(Rm,Qe({name:"day",ref:t},n.buttonProps)):s.jsx("div",Qe({},n.divProps))}function VY(e){var t=e.number,n=e.dates,r=_t(),o=r.onWeekNumberClick,a=r.styles,l=r.classNames,u=r.locale,d=r.labels.labelWeekNumber,f=r.formatters.formatWeekNumber,m=f(Number(t),{locale:u});if(!o)return s.jsx("span",{className:l.weeknumber,style:a.weeknumber,children:m});var p=d(Number(t),{locale:u}),g=function(y){o(t,n,y)};return s.jsx(Rm,{name:"week-number","aria-label":p,className:l.weeknumber,style:a.weeknumber,onClick:g,children:m})}function zY(e){var t,n,r=_t(),o=r.styles,a=r.classNames,l=r.showWeekNumber,u=r.components,d=(t=u==null?void 0:u.Day)!==null&&t!==void 0?t:$Y,f=(n=u==null?void 0:u.WeekNumber)!==null&&n!==void 0?n:VY,m;return l&&(m=s.jsx("td",{className:a.cell,style:o.cell,children:s.jsx(f,{number:e.weekNumber,dates:e.dates})})),s.jsxs("tr",{className:a.row,style:o.row,children:[m,e.dates.map(function(p){return s.jsx("td",{className:a.cell,style:o.cell,role:"presentation",children:s.jsx(d,{displayMonth:e.displayMonth,date:p})},ZU(p))})]})}function bS(e,t,n){for(var r=n!=null&&n.ISOWeek?Z3(t):Nw(t,n),o=n!=null&&n.ISOWeek?vo(e):wr(e,n),a=Os(r,o),l=[],u=0;u<=a;u++)l.push(wn(o,u));var d=l.reduce(function(f,m){var p=n!=null&&n.ISOWeek?jw(m):kw(m,n),g=f.find(function(y){return y.weekNumber===p});return g?(g.dates.push(m),f):(f.push({weekNumber:p,dates:[m]}),f)},[]);return d}function BY(e,t){var n=bS(sr(e),Ep(e),t);if(t!=null&&t.useFixedWeeks){var r=eq(e,t);if(r<6){var o=n[n.length-1],a=o.dates[o.dates.length-1],l=x0(a,6-r),u=bS(x0(a,1),l,t);n.push.apply(n,u)}}return n}function WY(e){var t,n,r,o=_t(),a=o.locale,l=o.classNames,u=o.styles,d=o.hideHead,f=o.fixedWeeks,m=o.components,p=o.weekStartsOn,g=o.firstWeekContainsDate,y=o.ISOWeek,b=BY(e.displayMonth,{useFixedWeeks:!!f,ISOWeek:y,locale:a,weekStartsOn:p,firstWeekContainsDate:g}),w=(t=m==null?void 0:m.Head)!==null&&t!==void 0?t:sY,N=(n=m==null?void 0:m.Row)!==null&&n!==void 0?n:zY,k=(r=m==null?void 0:m.Footer)!==null&&r!==void 0?r:tY;return s.jsxs("table",{id:e.id,className:l.table,style:u.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!d&&s.jsx(w,{}),s.jsx("tbody",{className:l.tbody,style:u.tbody,children:b.map(function(j){return s.jsx(N,{displayMonth:e.displayMonth,dates:j.dates,weekNumber:j.weekNumber},j.weekNumber)})}),s.jsx(k,{displayMonth:e.displayMonth})]})}function HY(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var UY=HY()?x.useLayoutEffect:x.useEffect,By=!1,qY=0;function wS(){return"react-day-picker-".concat(++qY)}function KY(e){var t,n=e??(By?wS():null),r=x.useState(n),o=r[0],a=r[1];return UY(function(){o===null&&a(wS())},[]),x.useEffect(function(){By===!1&&(By=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function YY(e){var t,n,r=_t(),o=r.dir,a=r.classNames,l=r.styles,u=r.components,d=Vd().displayMonths,f=KY(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),m=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,p=[a.month],g=l.month,y=e.displayIndex===0,b=e.displayIndex===d.length-1,w=!y&&!b;o==="rtl"&&(t=[y,b],b=t[0],y=t[1]),y&&(p.push(a.caption_start),g=Qe(Qe({},g),l.caption_start)),b&&(p.push(a.caption_end),g=Qe(Qe({},g),l.caption_end)),w&&(p.push(a.caption_between),g=Qe(Qe({},g),l.caption_between));var N=(n=u==null?void 0:u.Caption)!==null&&n!==void 0?n:eY;return s.jsxs("div",{className:p.join(" "),style:g,children:[s.jsx(N,{id:f,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(WY,{id:m,"aria-labelledby":f,displayMonth:e.displayMonth})]},e.displayIndex)}function QY(e){var t=_t(),n=t.classNames,r=t.styles;return s.jsx("div",{className:n.months,style:r.months,children:e.children})}function GY(e){var t,n,r=e.initialProps,o=_t(),a=Rw(),l=Vd(),u=x.useState(!1),d=u[0],f=u[1];x.useEffect(function(){o.initialFocus&&a.focusTarget&&(d||(a.focus(a.focusTarget),f(!0)))},[o.initialFocus,d,a.focus,a.focusTarget,a]);var m=[o.classNames.root,o.className];o.numberOfMonths>1&&m.push(o.classNames.multiple_months),o.showWeekNumber&&m.push(o.classNames.with_weeknumber);var p=Qe(Qe({},o.styles.root),o.style),g=Object.keys(r).filter(function(b){return b.startsWith("data-")}).reduce(function(b,w){var N;return Qe(Qe({},b),(N={},N[w]=r[w],N))},{}),y=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:QY;return s.jsx("div",Qe({className:m.join(" "),style:p,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},g,{children:s.jsx(y,{children:l.displayMonths.map(function(b,w){return s.jsx(YY,{displayIndex:w,displayMonth:b},w)})})}))}function XY(e){var t=e.children,n=wK(e,["children"]);return s.jsx(VK,{initialProps:n,children:s.jsx(GK,{children:s.jsx(MY,{initialProps:n,children:s.jsx(aY,{initialProps:n,children:s.jsx(cY,{initialProps:n,children:s.jsx(xY,{children:s.jsx(PY,{children:t})})})})})})})}function ZY(e){return s.jsx(XY,Qe({},e,{children:s.jsx(GY,{initialProps:e})}))}function Iw({className:e,classNames:t,showOutsideDays:n=!0,...r}){return s.jsx(ZY,{showOutsideDays:n,className:Ie("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Ie(b0({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Ie(b0({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"font-bold text-primary",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...o})=>s.jsx(Aa,{className:"h-4 w-4"}),IconRight:({...o})=>s.jsx($s,{className:"h-4 w-4"})},...r})}Iw.displayName="Calendar";function JY(e){const t=eQ(e),n=x.forwardRef((r,o)=>{const{children:a,...l}=r,u=x.Children.toArray(a),d=u.find(nQ);if(d){const f=d.props.children,m=u.map(p=>p===d?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:o,children:x.isValidElement(f)?x.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function eQ(e){const t=x.forwardRef((n,r)=>{const{children:o,...a}=n;if(x.isValidElement(o)){const l=sQ(o),u=rQ(a,o.props);return o.type!==x.Fragment&&(u.ref=r?Vr(r,l):l),x.cloneElement(o,u)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tQ=Symbol("radix.slottable");function nQ(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tQ}function rQ(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...u)=>{const d=a(...u);return o(...u),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function sQ(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Dp="Popover",[yT]=wo(Dp,[_c]),zd=_c(),[oQ,Ia]=yT(Dp),vT=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:l=!1}=e,u=zd(t),d=x.useRef(null),[f,m]=x.useState(!1),[p,g]=Ri({prop:r,defaultProp:o??!1,onChange:a,caller:Dp});return s.jsx(Z5,{...u,children:s.jsx(oQ,{scope:t,contentId:xr(),triggerRef:d,open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(y=>!y),[g]),hasCustomAnchor:f,onCustomAnchorAdd:x.useCallback(()=>m(!0),[]),onCustomAnchorRemove:x.useCallback(()=>m(!1),[]),modal:l,children:n})})};vT.displayName=Dp;var bT="PopoverAnchor",aQ=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ia(bT,n),a=zd(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=o;return x.useEffect(()=>(l(),()=>u()),[l,u]),s.jsx(up,{...a,...r,ref:t})});aQ.displayName=bT;var wT="PopoverTrigger",NT=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ia(wT,n),a=zd(n),l=pt(t,o.triggerRef),u=s.jsx(Ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_T(o.open),...r,ref:l,onClick:Ke(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?u:s.jsx(up,{asChild:!0,...a,children:u})});NT.displayName=wT;var Lw="PopoverPortal",[iQ,lQ]=yT(Lw,{forceMount:void 0}),jT=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,a=Ia(Lw,t);return s.jsx(iQ,{scope:t,forceMount:n,children:s.jsx(No,{present:n||a.open,children:s.jsx(Cd,{asChild:!0,container:o,children:r})})})};jT.displayName=Lw;var lc="PopoverContent",CT=x.forwardRef((e,t)=>{const n=lQ(lc,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,a=Ia(lc,e.__scopePopover);return s.jsx(No,{present:r||a.open,children:a.modal?s.jsx(uQ,{...o,ref:t}):s.jsx(dQ,{...o,ref:t})})});CT.displayName=lc;var cQ=JY("PopoverContent.RemoveScroll"),uQ=x.forwardRef((e,t)=>{const n=Ia(lc,e.__scopePopover),r=x.useRef(null),o=pt(t,r),a=x.useRef(!1);return x.useEffect(()=>{const l=r.current;if(l)return uw(l)},[]),s.jsx(Cp,{as:cQ,allowPinchZoom:!0,children:s.jsx(kT,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ke(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),a.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Ke(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;a.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Ke(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),dQ=x.forwardRef((e,t)=>{const n=Ia(lc,e.__scopePopover),r=x.useRef(!1),o=x.useRef(!1);return s.jsx(kT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),kT=x.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,...p}=e,g=Ia(lc,n),y=zd(n);return cw(),s.jsx(Np,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:s.jsx(Nc,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>g.onOpenChange(!1),children:s.jsx(wb,{"data-state":_T(g.open),role:"dialog",id:g.contentId,...y,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ST="PopoverClose",fQ=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ia(ST,n);return s.jsx(Ge.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,()=>o.onOpenChange(!1))})});fQ.displayName=ST;var hQ="PopoverArrow",mQ=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=zd(n);return s.jsx(Nb,{...o,...r,ref:t})});mQ.displayName=hQ;function _T(e){return e?"open":"closed"}var pQ=vT,gQ=NT,xQ=jT,ET=CT;const Om=pQ,Im=gQ,rd=x.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>s.jsx(xQ,{children:s.jsx(ET,{ref:o,align:t,sideOffset:n,className:Ie("z-[200] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));rd.displayName=ET.displayName;function An({value:e,onChange:t,placeholder:n="Pick a date",disabled:r=!1,required:o=!1,minDate:a,maxDate:l,size:u="default",className:d}){const[f,m]=x.useState(!1),p=x.useMemo(()=>{if(!e)return;const N=Yq(e,"yyyy-MM-dd",new Date);return ww(N)?N:void 0},[e]),g=x.useCallback(N=>!!(a&&Tp(N,a)||l&&nd(N,l)),[a,l]),y=N=>{t(N?Nr(N,"yyyy-MM-dd"):""),m(!1)},b=N=>{N.stopPropagation(),t("")},w=u==="sm";return s.jsxs(Om,{open:f,onOpenChange:r?void 0:m,children:[s.jsx(Im,{asChild:!0,children:s.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":f,"aria-required":o,disabled:r,className:Ie("inline-flex w-full items-center gap-2 rounded-md border border-border bg-background","text-foreground outline-none transition-colors","hover:border-ring/60 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",w?"h-8 px-2 text-xs":"h-10 px-3 text-sm",d),children:[s.jsx(Sd,{className:Ie("shrink-0 text-muted-foreground",w?"h-3.5 w-3.5":"h-4 w-4")}),s.jsx("span",{className:Ie("flex-1 text-left",!p&&"text-muted-foreground"),children:p?Nr(p,"MMM d, yyyy"):n}),p&&!o&&s.jsx(Ht,{onClick:b,"aria-label":"Clear date",className:Ie("shrink-0 text-muted-foreground hover:text-foreground",w?"h-3 w-3":"h-3.5 w-3.5")})]})}),s.jsx(rd,{className:"w-auto p-0 rounded-xl shadow-xl",align:"start",children:s.jsx(Iw,{mode:"single",selected:p,onSelect:y,disabled:g,showOutsideDays:!1,initialFocus:!0})})]})}const yQ=Array.from({length:12},(e,t)=>t+1),vQ=[0,5,10,15,20,25,30,35,40,45,50,55];function bQ({value:e,onChange:t,placeholder:n="Pick date & time",disabled:r=!1,required:o=!1,minDate:a,maxDate:l,size:u="default",className:d}){const[f,m]=x.useState(!1),p=x.useMemo(()=>{if(!e)return;const D=new Date(e);return ww(D)?D:void 0},[e]),g=D=>{t(Nr(D,"yyyy-MM-dd'T'HH:mm:00"))},y=(p==null?void 0:p.getHours())??12,b=y%12||12,w=(p==null?void 0:p.getMinutes())??0,N=y>=12?"PM":"AM",k=D=>{if(!D){t("");return}const I=p?new Date(p):new Date;I.setFullYear(D.getFullYear(),D.getMonth(),D.getDate()),p||I.setHours(12,0,0,0),g(I)},j=(D,I)=>{const z=p?new Date(p):(()=>{const K=new Date;return K.setSeconds(0,0),K})();if(D==="hour"){const K=parseInt(I,10);z.setHours(N==="PM"?K===12?12:K+12:K===12?0:K)}else if(D==="minute")z.setMinutes(parseInt(I,10));else{const K=z.getHours();I==="AM"&&K>=12&&z.setHours(K-12),I==="PM"&&K<12&&z.setHours(K+12)}g(z)},C=x.useCallback(D=>!!(a&&Tp(D,a)||l&&nd(D,l)),[a,l]),S=p?Nr(p,"MMM d, yyyy 'at' h:mm a"):null,E=u==="sm",P="h-8 rounded-md border border-border bg-background text-foreground text-xs px-1.5 outline-none focus:ring-1 focus:ring-ring";return s.jsxs(Om,{open:f,onOpenChange:r?void 0:m,children:[s.jsx(Im,{asChild:!0,children:s.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":f,"aria-required":o,disabled:r,className:Ie("inline-flex w-full items-center gap-2 rounded-md border border-border bg-background","text-foreground outline-none transition-colors","hover:border-ring/60 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",E?"h-8 px-2 text-xs":"h-10 px-3 text-sm",d),children:[s.jsx(Sd,{className:Ie("shrink-0 text-muted-foreground",E?"h-3.5 w-3.5":"h-4 w-4")}),s.jsx("span",{className:Ie("flex-1 text-left",!p&&"text-muted-foreground"),children:S??n}),p&&!o&&s.jsx(Ht,{onClick:D=>{D.stopPropagation(),t("")},"aria-label":"Clear date and time",className:Ie("shrink-0 text-muted-foreground hover:text-foreground",E?"h-3 w-3":"h-3.5 w-3.5")})]})}),s.jsxs(rd,{className:"w-auto p-0 rounded-xl shadow-xl",align:"start",children:[s.jsx(Iw,{mode:"single",selected:p,onSelect:k,disabled:C,showOutsideDays:!1,initialFocus:!0}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border p-3",children:[s.jsx("span",{className:"mr-1 font-mono text-xs text-muted-foreground",children:"Time"}),s.jsx("select",{value:b,onChange:D=>j("hour",D.target.value),className:P,children:yQ.map(D=>s.jsx("option",{value:D,children:String(D).padStart(2,"0")},D))}),s.jsx("span",{className:"select-none text-sm text-muted-foreground",children:":"}),s.jsx("select",{value:w,onChange:D=>j("minute",D.target.value),className:P,children:vQ.map(D=>s.jsx("option",{value:D,children:String(D).padStart(2,"0")},D))}),s.jsxs("select",{value:N,onChange:D=>j("ampm",D.target.value),className:P,children:[s.jsx("option",{value:"AM",children:"AM"}),s.jsx("option",{value:"PM",children:"PM"})]})]}),s.jsx("div",{className:"px-3 pb-3",children:s.jsx(Jt,{size:"sm",className:"w-full",onClick:()=>m(!1),children:"Done"})})]})]})}const ma={contact:"Contact",opportunity:"Opportunity","use-case":"Use Case",activity:"Activity",account:"Account",assignment:"Assignment"},NS={contact:"Hi! Tell me about the new contact — name, email, company, and any other details.",opportunity:"Let's create a new opportunity! What's the name, amount, and who's the contact?","use-case":"Let's set up a new use case. What's the name and which client is it for?",activity:"Log an activity — tell me the type (call, email, meeting, note, demo, proposal, etc.), what it's about, and any outcome or notes.",account:"Let's add a new account. What's the company name and any other details?",assignment:"Let's create a new assignment. What's the title, type (call, email, research, etc.), and who should it be assigned to?"};function wQ(e,t){const n=e.toLowerCase(),r={},o=e.match(/(?:name(?:\s+is)?|called|named)\s+([A-Z][^\.,\n]+)/i)||e.match(/^([A-Z][a-z]+ [A-Z][a-z]+)/);o&&(r.name=o[1].trim());const a=e.match(/[\w.-]+@[\w.-]+\.\w+/);a&&(r.email=a[0]);const l=e.match(/\+?[\d\s\-().]{10,}/);l&&(r.phone=l[0].trim());const u=e.match(/(?:at|from|company|works at|with)\s+([A-Z][^\.,\n]+)/i);if(u&&(r.company=u[1].trim()),t==="opportunity"){const d=e.match(/\$?([\d,]+(?:\.\d+)?)\s*[kKmM]?/);if(d){let f=parseFloat(d[1].replace(",",""));(n.includes("k")||n.includes("thousand"))&&(f*=1e3),(n.includes("m")||n.includes("million"))&&(f*=1e6),r.amount=Math.round(f)}r.stage="prospecting"}if(t==="activity"){const f=["call","email","meeting","note","task","demo","proposal","research","handoff","status_update"].find(g=>n.includes(g.replace("_"," "))||n.includes(g));r.type=f??"note",r.description=e;const p=["connected","voicemail","positive","negative","neutral","no show","no_show","follow up needed","follow_up_needed"].find(g=>n.includes(g));p&&(r.outcome=p.replace(/ /g,"_"))}if(t==="use-case"&&(r.stage="discovery"),t==="assignment"){const f=["call","draft","email","follow_up","follow up","research","review","send"].find(m=>n.includes(m));if(f&&(r.assignment_type=f.replace(" ","_")),r.name)r.title=r.name,delete r.name;else{const m=e.split(/[.!?]/)[0].trim();m&&(r.title=m)}n.includes("urgent")?r.priority="urgent":n.includes("high priority")||n.includes("high-priority")?r.priority="high":n.includes("low priority")||n.includes("low-priority")?r.priority="low":r.priority="normal"}return r}function NQ({type:e,onClose:t}){const[n,r]=x.useState([{role:"assistant",content:NS[e]??NS.contact}]),[o,a]=x.useState(""),[l,u]=x.useState(!1),[d,f]=x.useState(null),[m,p]=x.useState(!1),[g,y]=x.useState(!1),b=x.useRef(null),w=x.useRef(null),N=YP(),k=QP(),j=GP(),C=XP(),S=ZP(),E=o3();x.useEffect(()=>{var q;(q=b.current)==null||q.scrollTo({top:b.current.scrollHeight,behavior:"smooth"})},[n]),x.useEffect(()=>{var q;(q=w.current)==null||q.focus()},[]);const P=()=>{if(!o.trim()||l)return;const q=o.trim();a(""),r(R=>[...R,{role:"user",content:q}]);const H=wQ(q,e);f(R=>({...R??{},...H}));const B=Object.entries({...d??{},...H}).filter(([,R])=>R!==void 0&&R!=="").map(([R,M])=>`• **${R}**: ${M}`).join(`
|
|
608
|
+
`);r(R=>[...R,{role:"assistant",content:B?`Got it! Here's what I'll create:
|
|
609
|
+
|
|
610
|
+
${B}
|
|
611
|
+
|
|
612
|
+
Does this look right? Reply "yes" to confirm or add more details.`:"Thanks! Can you share more details like name, email, or any other relevant information?"}])},D=async()=>{if(!(!d||l)){u(!0);try{e==="contact"?await N.mutateAsync(d):e==="account"?await k.mutateAsync(d):e==="opportunity"?await j.mutateAsync(d):e==="use-case"?await C.mutateAsync(d):e==="activity"?await S.mutateAsync(d):e==="assignment"&&await E.mutateAsync(d),p(!0),de({title:`${ma[e]} created!`,description:"Successfully added to your CRM."}),setTimeout(t,1200)}catch(q){de({title:`Failed to create ${ma[e]}`,description:q instanceof Error?q.message:"Please try again.",variant:"destructive"})}finally{u(!1)}}},I=n[n.length-1],z=(I==null?void 0:I.role)==="assistant"&&I.content.includes("Does this look right")&&d!==null&&!m,K=q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),o.toLowerCase().trim()==="yes"||o.toLowerCase().trim()==="confirm"?D():P())};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(an,{className:"w-4 h-4 text-accent"}),s.jsxs("span",{className:"font-display font-bold text-foreground",children:["New ",ma[e]]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>y(!g),className:`flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border transition-colors ${g?"border-border bg-muted text-foreground":"border-border/60 text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[s.jsx(ls,{className:"w-3 h-3"}),s.jsx("span",{children:"Form"})]}),s.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-muted transition-colors",children:s.jsx(Ht,{className:"w-4 h-4 text-muted-foreground"})})]})]}),g?s.jsx(PT,{type:e,onClose:t,onBack:()=>y(!1),backLabel:"Back to AI chat"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{ref:b,className:"flex-1 overflow-y-auto p-4 space-y-3",children:[n.map((q,H)=>s.jsx("div",{className:`flex ${q.role==="user"?"justify-end":"justify-start"}`,children:s.jsx("div",{className:`max-w-[85%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed whitespace-pre-wrap ${q.role==="user"?"bg-primary text-primary-foreground":"bg-muted text-foreground"}`,children:q.content})},H)),m&&s.jsx("div",{className:"flex justify-center",children:s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-full bg-success/15 text-success text-sm font-semibold",children:[s.jsx(_d,{className:"w-4 h-4"})," Created successfully!"]})})]}),z&&s.jsx("div",{className:"px-4 pb-2",children:s.jsx("button",{onClick:D,disabled:l,className:"w-full py-2.5 rounded-xl bg-success text-success-foreground text-sm font-semibold hover:bg-success/90 transition-colors disabled:opacity-50",children:l?"Creating...":`Confirm & Create ${ma[e]}`})}),s.jsxs("div",{className:"flex items-end gap-2 p-3 border-t border-border",children:[s.jsx("textarea",{ref:w,value:o,onChange:q=>a(q.target.value),onKeyDown:K,placeholder:"Type details or 'yes' to confirm...",rows:1,className:"flex-1 resize-none bg-muted rounded-xl px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-primary/30 min-h-[38px] max-h-28",style:{height:"auto"}}),s.jsx("button",{onClick:()=>{o.toLowerCase().trim()==="yes"||o.toLowerCase().trim()==="confirm"?D():P()},disabled:!o.trim()||l,className:"p-2 rounded-xl bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-40",children:s.jsx(Lr,{className:"w-4 h-4"})})]})]})]})}const jS={contact:[{key:"first_name",label:"First Name",placeholder:"First name",required:!0},{key:"last_name",label:"Last Name",placeholder:"Last name"},{key:"email",label:"Email",placeholder:"email@example.com",inputType:"email"},{key:"phone",label:"Phone",placeholder:"(555) 123-4567",inputType:"tel"},{key:"company_name",label:"Company",placeholder:"Company name"}],opportunity:[{key:"name",label:"Opportunity Name",placeholder:"e.g. Acme Enterprise",required:!0},{key:"amount",label:"Amount ($)",placeholder:"850000",inputType:"number"},{key:"close_date",label:"Close Date",inputType:"date"},{key:"description",label:"Description",placeholder:"Optional notes",fieldType:"textarea"}],"use-case":[{key:"name",label:"Name",placeholder:"e.g. Corporate Relocation",required:!0},{key:"account_id",label:"Account",fieldType:"account-select",required:!0},{key:"stage",label:"Stage",fieldType:"select",options:["discovery","poc","production","scaling","sunset"]},{key:"attributed_arr",label:"Attributed ARR ($)",placeholder:"120000",inputType:"number"},{key:"target_prod_date",label:"Target Prod Date",inputType:"date"},{key:"description",label:"Description",placeholder:"Any additional details",fieldType:"textarea"}],activity:[{key:"type",label:"Type",fieldType:"select",options:["call","email","meeting","note","task","demo","proposal","research","handoff","status_update"],required:!0},{key:"subject",label:"Subject",placeholder:"What was this activity about?",required:!0},{key:"subject_type",label:"Linked To",fieldType:"subject-type-select",placeholder:"Link to a CRM record (optional)"},{key:"subject_id",label:"Record",fieldType:"entity-select",dependsOn:{key:"subject_type"}},{key:"occurred_at",label:"When",inputType:"datetime-local",placeholder:"When did this happen?"},{key:"outcome",label:"Outcome",fieldType:"datalist",datalistId:"outcome-suggestions",suggestions:["connected","voicemail","positive","negative","neutral","no_show","follow_up_needed"],placeholder:"e.g. connected, positive, voicemail"},{key:"body",label:"Notes",placeholder:"Additional details...",fieldType:"textarea"}],account:[{key:"name",label:"Company Name",placeholder:"e.g. Acme Corp",required:!0},{key:"industry",label:"Industry",placeholder:"e.g. Real Estate, Technology"},{key:"website",label:"Website",placeholder:"https://acme.com",inputType:"url"},{key:"domain",label:"Domain",placeholder:"acme.com"}],assignment:[{key:"title",label:"Title",placeholder:"e.g. Follow up with Acme about contract",required:!0},{key:"assignment_type",label:"Type",fieldType:"select",options:["call","draft","email","follow_up","research","review","send"],required:!0},{key:"assigned_to",label:"Assign To",fieldType:"actor-select",required:!0},{key:"subject_type",label:"Linked To",fieldType:"subject-type-select"},{key:"subject_id",label:"Record",fieldType:"entity-select",dependsOn:{key:"subject_type"}},{key:"priority",label:"Priority",fieldType:"select",options:["low","normal","high","urgent"]},{key:"due_at",label:"Due Date",inputType:"date"},{key:"context",label:"Context",placeholder:"Brief context for the assignee",fieldType:"textarea"},{key:"description",label:"Description",placeholder:"Additional details",fieldType:"textarea"}]},jQ=[{value:"",label:"None (no link)"},{value:"contact",label:"Contact"},{value:"account",label:"Account"},{value:"opportunity",label:"Opportunity"},{value:"use_case",label:"Use Case"}];function CQ({subjectType:e,value:t,onChange:n}){const{data:r}=Jb(e==="contact"?{limit:100}:void 0),{data:o}=vp(e==="account"?{limit:100}:void 0),{data:a}=bp(e==="opportunity"?{limit:100}:void 0),{data:l}=ew(e==="use_case"?{limit:100}:void 0),u="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";let d=[];return e==="contact"?d=((r==null?void 0:r.data)??[]).map(f=>({id:f.id,label:`${f.first_name??""} ${f.last_name??""}`.trim()||f.email||f.id})):e==="account"?d=((o==null?void 0:o.data)??[]).map(f=>({id:f.id,label:f.name??f.id})):e==="opportunity"?d=((a==null?void 0:a.data)??[]).map(f=>({id:f.id,label:f.name??f.id})):e==="use_case"&&(d=((l==null?void 0:l.data)??[]).map(f=>({id:f.id,label:f.name??f.id}))),e?s.jsxs("select",{value:t,onChange:f=>n(f.target.value),className:`${u} pr-3`,children:[s.jsxs("option",{value:"",children:["Select ",e.replace("_"," "),"…"]}),d.map(f=>s.jsx("option",{value:f.id,children:f.label},f.id))]}):null}function kQ({value:e,onChange:t}){const{data:n}=Rd({limit:100,is_active:!0}),r=(n==null?void 0:n.data)??(n==null?void 0:n.actors)??[];return s.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring pr-3",children:[s.jsx("option",{value:"",children:"Select actor…"}),r.map(a=>s.jsxs("option",{value:a.id,children:[a.display_name," (",a.actor_type,")"]},a.id))]})}function PT({type:e,onClose:t,onBack:n,backLabel:r}){const[o,a]=x.useState({}),[l,u]=x.useState(!1),{data:d}=vp({limit:200}),f=(d==null?void 0:d.data)??[],m=YP(),p=QP(),g=GP(),y=XP(),b=ZP(),w=o3(),N=jS[e]??jS.contact,k=()=>{var P,D,I,z,K;return e==="contact"?!!((P=o.first_name)!=null&&P.trim()):e==="activity"?!!o.type&&!!((D=o.subject)!=null&&D.trim()):e==="use-case"?!!((I=o.name)!=null&&I.trim())&&!!o.account_id:e==="assignment"?!!((z=o.title)!=null&&z.trim())&&!!o.assignment_type&&!!o.assigned_to:!!((K=o.name)!=null&&K.trim())},j=(P,D)=>a(I=>({...I,[P]:D})),C=async()=>{if(!(!k()||l)){u(!0);try{const P={...o};e==="contact"&&delete P.name,e==="opportunity"&&(o.amount&&(P.amount=parseFloat(o.amount)||0),P.stage="prospecting"),e==="use-case"&&(P.stage||(P.stage="discovery"),o.attributed_arr&&(P.attributed_arr=parseFloat(o.attributed_arr)||0)),e==="account"&&o.website&&(P.website=o.website.startsWith("http")?o.website:`https://${o.website}`),e==="activity"&&(o.occurred_at&&(P.occurred_at=new Date(o.occurred_at).toISOString()),o.subject_type||(delete P.subject_type,delete P.subject_id),o.subject_id||delete P.subject_id,o.outcome||delete P.outcome,o.occurred_at||delete P.occurred_at),e==="assignment"&&(o.due_at&&(P.due_at=new Date(o.due_at+"T00:00:00").toISOString()),o.subject_type||(delete P.subject_type,delete P.subject_id),o.subject_id||delete P.subject_id,o.context||delete P.context,o.description||delete P.description,o.due_at||delete P.due_at,o.priority||(P.priority="normal")),e==="contact"?await m.mutateAsync(P):e==="account"?await p.mutateAsync(P):e==="opportunity"?await g.mutateAsync(P):e==="use-case"?await y.mutateAsync(P):e==="activity"?await b.mutateAsync(P):e==="assignment"&&await w.mutateAsync(P);const D=o.first_name??o.title??o.name??o.subject??ma[e];de({title:`${ma[e]} created`,description:`${D} has been added.`}),t()}catch(P){de({title:`Failed to create ${ma[e]}`,description:P instanceof Error?P.message:"Please try again.",variant:"destructive"})}finally{u(!1)}}},S="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",E=P=>{if(!P.dependsOn)return!0;const D=o[P.dependsOn.key];return D?P.dependsOn.values?P.dependsOn.values.includes(D):!0:!1};return s.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[s.jsx("button",{onClick:n,className:"flex items-center gap-1.5 text-xs text-accent hover:underline mb-5",children:r?s.jsxs(s.Fragment,{children:[s.jsx(an,{className:"w-3 h-3"})," ",r]}):s.jsxs(s.Fragment,{children:[s.jsx(Aa,{className:"w-3.5 h-3.5"})," Back"]})}),s.jsxs("div",{className:"space-y-4",children:[N.filter(E).map(P=>{var D;return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:[P.label,P.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),P.fieldType==="select"?s.jsxs("select",{value:o[P.key]||"",onChange:I=>j(P.key,I.target.value),className:`${S} pr-3`,children:[s.jsxs("option",{value:"",children:["Select ",P.label.toLowerCase(),"…"]}),(D=P.options)==null?void 0:D.map(I=>s.jsx("option",{value:I,children:I.replace(/_/g," ").replace(/\b\w/g,z=>z.toUpperCase())},I))]}):P.fieldType==="account-select"?s.jsxs("select",{value:o[P.key]||"",onChange:I=>j(P.key,I.target.value),className:`${S} pr-3`,children:[s.jsx("option",{value:"",children:"Select account…"}),f.map(I=>s.jsx("option",{value:I.id,children:I.name},I.id))]}):P.fieldType==="subject-type-select"?s.jsx("select",{value:o[P.key]||"",onChange:I=>{j(P.key,I.target.value),j("subject_id","")},className:`${S} pr-3`,children:jQ.map(I=>s.jsx("option",{value:I.value,children:I.label},I.value))}):P.fieldType==="entity-select"?s.jsx(CQ,{subjectType:o.subject_type||"",value:o[P.key]||"",onChange:I=>j(P.key,I)}):P.fieldType==="actor-select"?s.jsx(kQ,{value:o[P.key]||"",onChange:I=>j(P.key,I)}):P.fieldType==="datalist"?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:o[P.key]||"",onChange:I=>j(P.key,I.target.value),placeholder:P.placeholder,list:P.datalistId,className:`${S} pr-3`}),P.datalistId&&P.suggestions&&s.jsx("datalist",{id:P.datalistId,children:P.suggestions.map(I=>s.jsx("option",{value:I},I))})]}):P.fieldType==="textarea"?s.jsx("textarea",{value:o[P.key]||"",onChange:I=>j(P.key,I.target.value),placeholder:P.placeholder,rows:3,className:"w-full px-3 py-2 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring resize-none"}):P.inputType==="date"?s.jsx(An,{value:o[P.key]||"",onChange:I=>j(P.key,I),required:P.required}):P.inputType==="datetime-local"?s.jsx(bQ,{value:o[P.key]||"",onChange:I=>j(P.key,I),required:P.required}):s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:P.inputType??"text",value:o[P.key]||"",onChange:I=>j(P.key,I.target.value),placeholder:P.placeholder,className:`${S} pr-8`}),s.jsx(br,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/40 pointer-events-none"})]})]},P.key)}),s.jsx("button",{onClick:C,disabled:!k()||l,className:"w-full h-10 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-40 transition-colors mt-2",children:l?"Creating...":`Create ${ma[e]}`})]})]})}function SQ(){const{quickAddType:e,closeQuickAdd:t}=lt(),{enabled:n}=kr();return e?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-background/60 backdrop-blur-sm z-[80]",onClick:t}),s.jsx("div",{className:"fixed right-0 top-0 h-full w-full max-w-md bg-card border-l border-border z-[90] shadow-2xl flex flex-col animate-slide-in-right",children:n?s.jsx(NQ,{type:e,onClose:t}):s.jsx(PT,{type:e,onClose:t,onBack:t})})]}):null}const sd={prospecting:{label:"Prospecting",color:"#94a3b8"},qualification:{label:"Qualification",color:"#60a5fa"},proposal:{label:"Proposal",color:"#a78bfa"},negotiation:{label:"Negotiation",color:"#fb923c"},closed_won:{label:"Won",color:"#4ade80"},closed_lost:{label:"Lost",color:"#f87171"},lead:{label:"Lead",color:"#94a3b8"},prospect:{label:"Prospect",color:"#60a5fa"},customer:{label:"Customer",color:"#4ade80"},churned:{label:"Churned",color:"#f87171"}},xa={discovery:{label:"Discovery",color:"#94a3b8"},poc:{label:"PoC",color:"#60a5fa"},production:{label:"Production",color:"#4ade80"},scaling:{label:"Scaling",color:"#fb923c"},sunset:{label:"Sunset",color:"#f87171"}};function od({stage:e}){const t=sd[e]??{label:e,color:"#94a3b8"};return s.jsx("span",{className:"inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold",style:{backgroundColor:t.color+"18",color:t.color},children:t.label})}function _Q({score:e}){const t=e>=80?"hsl(152, 55%, 42%)":e>=50?"hsl(38, 92%, 50%)":"hsl(var(--muted-foreground))";return s.jsx("span",{className:"inline-flex items-center justify-center w-8 h-6 rounded-lg text-xs font-mono font-bold",style:{backgroundColor:t+"18",color:t},children:e})}function EQ(){const{connectivity:e}=kr();return e==="offline"?s.jsx("span",{title:"Agent offline — check provider settings",children:s.jsx(dF,{className:"w-3.5 h-3.5 text-destructive"})}):e==="unknown"?s.jsx("span",{title:"Agent status unknown",children:s.jsx(fF,{className:"w-3.5 h-3.5 text-muted-foreground/50"})}):s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-success animate-pulse-dot",title:"Agent online"})}function TT(e){switch(e){case"call":return s.jsx(Gu,{className:"w-3.5 h-3.5"});case"email":return s.jsx(ho,{className:"w-3.5 h-3.5"});case"meeting":return s.jsx(os,{className:"w-3.5 h-3.5"});case"task":return s.jsx(iF,{className:"w-3.5 h-3.5"});case"demo":return s.jsx(nF,{className:"w-3.5 h-3.5"});case"proposal":return s.jsx(ls,{className:"w-3.5 h-3.5"});case"research":return s.jsx(Oi,{className:"w-3.5 h-3.5"});case"handoff":return s.jsx(VL,{className:"w-3.5 h-3.5"});case"status_update":return s.jsx(tc,{className:"w-3.5 h-3.5"});case"stage_change":return s.jsx(rF,{className:"w-3.5 h-3.5"});case"health_update":return s.jsx(sp,{className:"w-3.5 h-3.5"});default:return s.jsx(y5,{className:"w-3.5 h-3.5"})}}const PQ={connected:"hsl(152, 55%, 42%)",positive:"hsl(152, 55%, 42%)",voicemail:"hsl(38, 92%, 50%)",neutral:"hsl(38, 92%, 50%)",follow_up_needed:"hsl(38, 92%, 50%)",negative:"hsl(var(--destructive))",no_show:"hsl(var(--destructive))"};function TQ({outcome:e}){const t=PQ[e]??"hsl(var(--muted-foreground))",n=e.replace(/_/g," ");return s.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-md text-[10px] font-medium capitalize",style:{backgroundColor:t+"18",color:t},children:n})}const MQ={contact:"Contact",account:"Account",opportunity:"Opp",use_case:"Use Case"},AQ={contact:"contact",account:"account",opportunity:"opportunity",use_case:"use-case"};function MT({limit:e,activities:t,filterWindow:n}){const{openDrawer:r}=lt(),o=n?100:e??20,{data:a,isLoading:l}=tw(t?void 0:{limit:o});let u=t??(a==null?void 0:a.data)??[];if(n){const f=new Date;n==="today"||f.setDate(f.getDate()-7),f.setHours(0,0,0,0),u=u.filter(m=>{const p=m.occurred_at??m.created_at??m.timestamp;return p?new Date(p)>=f:!1})}const d=e?u.slice(0,e):u;return l&&!t?s.jsx("div",{className:"space-y-3",children:[...Array(4)].map((f,m)=>s.jsxs("div",{className:"flex gap-3 animate-pulse",children:[s.jsx("div",{className:"w-7 h-7 rounded-xl bg-muted flex-shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 bg-muted rounded w-3/4"}),s.jsx("div",{className:"h-2.5 bg-muted rounded w-1/2"})]})]},m))}):d.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No activity yet."}):s.jsx("div",{className:"space-y-1",children:d.map(f=>{const m=f.contact_name??f.contactName??"",p=f.description??f.body??f.subject??"",g=f.occurred_at??f.created_at??f.timestamp??"",y=f.contact_id,b=f.subject_type&&f.subject_id,w=b||y,N=()=>{if(b){const j=AQ[f.subject_type];j&&r(j,f.subject_id)}else y&&r("contact",y)},k=[];return f.performer_name?k.push(f.performer_name):m&&k.push(m),g&&k.push(new Date(g).toLocaleDateString()),s.jsxs("div",{className:`flex gap-3 py-2 ${w?"cursor-pointer hover:bg-muted/40 rounded-xl px-2 -mx-2 transition-colors":""}`,onClick:w?N:void 0,children:[s.jsx("div",{className:"w-7 h-7 rounded-xl bg-muted flex items-center justify-center text-muted-foreground flex-shrink-0 mt-0.5",children:TT(f.type)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("p",{className:"text-sm text-foreground flex-1 min-w-0 truncate",children:p||`${f.type}${m?` with ${m}`:""}`}),f.outcome&&s.jsx(TQ,{outcome:f.outcome})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 flex-wrap",children:[b&&s.jsx("span",{className:"inline-flex items-center gap-0.5 text-[10px] font-medium text-primary/80 bg-primary/8 px-1.5 py-0.5 rounded",children:MQ[f.subject_type]??f.subject_type}),f.performer_name&&s.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[f.performed_by?s.jsx(zn,{className:"w-2.5 h-2.5"}):s.jsx(Na,{className:"w-2.5 h-2.5"}),f.performer_name]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:k.filter(Boolean).join(" · ")})]})]})]},f.id)})})}function DQ(e,t){if(t==null)return"—";if(e==="boolean")return t?"Yes":"No";if(e==="date")try{return new Date(String(t)).toLocaleDateString()}catch{return String(t)}return Array.isArray(t)?t.join(", "):String(t)}function Rp({objectType:e,values:t}){const[n,r]=x.useState(!1),{data:o}=Mc(e),a=(o==null?void 0:o.fields)??[];return a.length===0?null:s.jsxs("div",{className:"px-4 mx-4 mt-2 border-t border-border pt-3",children:[s.jsxs("button",{onClick:()=>r(!n),className:"flex items-center gap-1.5 w-full text-left",children:[s.jsxs("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide flex-1",children:["Custom Fields",s.jsxs("span",{className:"ml-1.5 font-mono font-normal text-muted-foreground/50",children:["(",a.length,")"]})]}),n?s.jsx(ms,{className:"w-3.5 h-3.5 text-muted-foreground"}):s.jsx(Wn,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),n&&s.jsx("div",{className:"mt-3 space-y-2",children:a.map(l=>{const u=t==null?void 0:t[l.field_key],d=u!=null&&u!=="";return s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[l.label,l.is_required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("span",{className:d?"text-sm text-foreground text-right":"text-xs text-muted-foreground/50",children:d?DQ(l.field_type,u):"—"})]},l.field_key)})})]})}const CS={connected:"hsl(152, 55%, 42%)",positive:"hsl(152, 55%, 42%)",voicemail:"hsl(38, 92%, 50%)",neutral:"hsl(38, 92%, 50%)",follow_up_needed:"hsl(38, 92%, 50%)",negative:"hsl(var(--destructive))",no_show:"hsl(var(--destructive))"},RQ={contact:"contact",account:"account",opportunity:"opportunity",use_case:"use-case"};function AT({activities:e,emptyMessage:t="No activity yet."}){const{openDrawer:n}=lt();return e.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:t}):s.jsx("div",{className:"space-y-1",children:e.map((r,o)=>{const a=r.description??r.body??r.note??r.subject??"",l=r.occurred_at??r.created_at??"",u=r.subject_type&&r.subject_id,d=u||!!r.contact_id,f=()=>{if(u){const m=RQ[r.subject_type];m&&n(m,r.subject_id)}else r.contact_id&&n("contact",r.contact_id)};return s.jsxs("div",{className:`flex gap-3 py-2 ${d?"cursor-pointer hover:bg-muted/40 rounded-xl px-2 -mx-2 transition-colors":""}`,onClick:d?f:void 0,children:[s.jsx("div",{className:"w-7 h-7 rounded-xl bg-muted flex items-center justify-center text-muted-foreground flex-shrink-0 mt-0.5",children:TT(r.type)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("p",{className:"text-sm text-foreground flex-1 min-w-0 truncate",children:a||r.type}),r.outcome&&s.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-md text-[10px] font-medium capitalize flex-shrink-0",style:{backgroundColor:(CS[r.outcome]??"hsl(var(--muted-foreground))")+"18",color:CS[r.outcome]??"hsl(var(--muted-foreground))"},children:r.outcome.replace(/_/g," ")})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 flex-wrap",children:[r.performer_name&&s.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[s.jsx(zn,{className:"w-2.5 h-2.5"}),r.performer_name]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:l?new Date(l).toLocaleDateString():""})]})]})]},r.id??o)})})}function Vl({view:e,onChange:t}){const n=[{key:"detail",label:"Detail",icon:Na},{key:"brief",label:"Brief",icon:ls},{key:"graph",label:"Graph",icon:UL}];return s.jsx("div",{className:"flex items-center gap-0.5 px-5 py-2 border-b border-border bg-muted/30",children:n.map(r=>s.jsxs("button",{onClick:()=>t(r.key),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold transition-all ${e===r.key?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[s.jsx(r.icon,{className:"w-3 h-3"}),r.label]},r.key))})}function en(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=en(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var OQ={value:()=>{}};function Op(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new em(n)}function em(e){this._=e}function IQ(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}em.prototype=Op.prototype={constructor:em,on:function(e,t){var n=this._,r=IQ(e+"",n),o,a=-1,l=r.length;if(arguments.length<2){for(;++a<l;)if((o=(e=r[a]).type)&&(o=LQ(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(o=(e=r[a]).type)n[o]=kS(n[o],e.name,t);else if(t==null)for(o in n)n[o]=kS(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new em(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,a;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],r=0,o=a.length;r<o;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,a=r.length;o<a;++o)r[o].value.apply(t,n)}};function LQ(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function kS(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=OQ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var w0="http://www.w3.org/1999/xhtml";const SS={svg:"http://www.w3.org/2000/svg",xhtml:w0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ip(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),SS.hasOwnProperty(t)?{space:SS[t],local:e}:e}function FQ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===w0&&t.documentElement.namespaceURI===w0?t.createElement(e):t.createElementNS(n,e)}}function $Q(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function DT(e){var t=Ip(e);return(t.local?$Q:FQ)(t)}function VQ(){}function Fw(e){return e==null?VQ:function(){return this.querySelector(e)}}function zQ(e){typeof e!="function"&&(e=Fw(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var a=t[o],l=a.length,u=r[o]=new Array(l),d,f,m=0;m<l;++m)(d=a[m])&&(f=e.call(d,d.__data__,m,a))&&("__data__"in d&&(f.__data__=d.__data__),u[m]=f);return new jr(r,this._parents)}function BQ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function WQ(){return[]}function RT(e){return e==null?WQ:function(){return this.querySelectorAll(e)}}function HQ(e){return function(){return BQ(e.apply(this,arguments))}}function UQ(e){typeof e=="function"?e=HQ(e):e=RT(e);for(var t=this._groups,n=t.length,r=[],o=[],a=0;a<n;++a)for(var l=t[a],u=l.length,d,f=0;f<u;++f)(d=l[f])&&(r.push(e.call(d,d.__data__,f,l)),o.push(d));return new jr(r,o)}function OT(e){return function(){return this.matches(e)}}function IT(e){return function(t){return t.matches(e)}}var qQ=Array.prototype.find;function KQ(e){return function(){return qQ.call(this.children,e)}}function YQ(){return this.firstElementChild}function QQ(e){return this.select(e==null?YQ:KQ(typeof e=="function"?e:IT(e)))}var GQ=Array.prototype.filter;function XQ(){return Array.from(this.children)}function ZQ(e){return function(){return GQ.call(this.children,e)}}function JQ(e){return this.selectAll(e==null?XQ:ZQ(typeof e=="function"?e:IT(e)))}function eG(e){typeof e!="function"&&(e=OT(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var a=t[o],l=a.length,u=r[o]=[],d,f=0;f<l;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&u.push(d);return new jr(r,this._parents)}function LT(e){return new Array(e.length)}function tG(){return new jr(this._enter||this._groups.map(LT),this._parents)}function Lm(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Lm.prototype={constructor:Lm,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function nG(e){return function(){return e}}function rG(e,t,n,r,o,a){for(var l=0,u,d=t.length,f=a.length;l<f;++l)(u=t[l])?(u.__data__=a[l],r[l]=u):n[l]=new Lm(e,a[l]);for(;l<d;++l)(u=t[l])&&(o[l]=u)}function sG(e,t,n,r,o,a,l){var u,d,f=new Map,m=t.length,p=a.length,g=new Array(m),y;for(u=0;u<m;++u)(d=t[u])&&(g[u]=y=l.call(d,d.__data__,u,t)+"",f.has(y)?o[u]=d:f.set(y,d));for(u=0;u<p;++u)y=l.call(e,a[u],u,a)+"",(d=f.get(y))?(r[u]=d,d.__data__=a[u],f.delete(y)):n[u]=new Lm(e,a[u]);for(u=0;u<m;++u)(d=t[u])&&f.get(g[u])===d&&(o[u]=d)}function oG(e){return e.__data__}function aG(e,t){if(!arguments.length)return Array.from(this,oG);var n=t?sG:rG,r=this._parents,o=this._groups;typeof e!="function"&&(e=nG(e));for(var a=o.length,l=new Array(a),u=new Array(a),d=new Array(a),f=0;f<a;++f){var m=r[f],p=o[f],g=p.length,y=iG(e.call(m,m&&m.__data__,f,r)),b=y.length,w=u[f]=new Array(b),N=l[f]=new Array(b),k=d[f]=new Array(g);n(m,p,w,N,k,y,t);for(var j=0,C=0,S,E;j<b;++j)if(S=w[j]){for(j>=C&&(C=j+1);!(E=N[C])&&++C<b;);S._next=E||null}}return l=new jr(l,r),l._enter=u,l._exit=d,l}function iG(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lG(){return new jr(this._exit||this._groups.map(LT),this._parents)}function cG(e,t,n){var r=this.enter(),o=this,a=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?a.remove():n(a),r&&o?r.merge(o).order():o}function uG(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,a=r.length,l=Math.min(o,a),u=new Array(o),d=0;d<l;++d)for(var f=n[d],m=r[d],p=f.length,g=u[d]=new Array(p),y,b=0;b<p;++b)(y=f[b]||m[b])&&(g[b]=y);for(;d<o;++d)u[d]=n[d];return new jr(u,this._parents)}function dG(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,a=r[o],l;--o>=0;)(l=r[o])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function fG(e){e||(e=hG);function t(p,g){return p&&g?e(p.__data__,g.__data__):!p-!g}for(var n=this._groups,r=n.length,o=new Array(r),a=0;a<r;++a){for(var l=n[a],u=l.length,d=o[a]=new Array(u),f,m=0;m<u;++m)(f=l[m])&&(d[m]=f);d.sort(t)}return new jr(o,this._parents).order()}function hG(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function mG(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pG(){return Array.from(this)}function gG(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,a=r.length;o<a;++o){var l=r[o];if(l)return l}return null}function xG(){let e=0;for(const t of this)++e;return e}function yG(){return!this.node()}function vG(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],a=0,l=o.length,u;a<l;++a)(u=o[a])&&e.call(u,u.__data__,a,o);return this}function bG(e){return function(){this.removeAttribute(e)}}function wG(e){return function(){this.removeAttributeNS(e.space,e.local)}}function NG(e,t){return function(){this.setAttribute(e,t)}}function jG(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function CG(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function kG(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function SG(e,t){var n=Ip(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?wG:bG:typeof t=="function"?n.local?kG:CG:n.local?jG:NG)(n,t))}function FT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function _G(e){return function(){this.style.removeProperty(e)}}function EG(e,t,n){return function(){this.style.setProperty(e,t,n)}}function PG(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function TG(e,t,n){return arguments.length>1?this.each((t==null?_G:typeof t=="function"?PG:EG)(e,t,n??"")):cc(this.node(),e)}function cc(e,t){return e.style.getPropertyValue(t)||FT(e).getComputedStyle(e,null).getPropertyValue(t)}function MG(e){return function(){delete this[e]}}function AG(e,t){return function(){this[e]=t}}function DG(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function RG(e,t){return arguments.length>1?this.each((t==null?MG:typeof t=="function"?DG:AG)(e,t)):this.node()[e]}function $T(e){return e.trim().split(/^|\s+/)}function $w(e){return e.classList||new VT(e)}function VT(e){this._node=e,this._names=$T(e.getAttribute("class")||"")}VT.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function zT(e,t){for(var n=$w(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function BT(e,t){for(var n=$w(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function OG(e){return function(){zT(this,e)}}function IG(e){return function(){BT(this,e)}}function LG(e,t){return function(){(t.apply(this,arguments)?zT:BT)(this,e)}}function FG(e,t){var n=$T(e+"");if(arguments.length<2){for(var r=$w(this.node()),o=-1,a=n.length;++o<a;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?LG:t?OG:IG)(n,t))}function $G(){this.textContent=""}function VG(e){return function(){this.textContent=e}}function zG(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function BG(e){return arguments.length?this.each(e==null?$G:(typeof e=="function"?zG:VG)(e)):this.node().textContent}function WG(){this.innerHTML=""}function HG(e){return function(){this.innerHTML=e}}function UG(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function qG(e){return arguments.length?this.each(e==null?WG:(typeof e=="function"?UG:HG)(e)):this.node().innerHTML}function KG(){this.nextSibling&&this.parentNode.appendChild(this)}function YG(){return this.each(KG)}function QG(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function GG(){return this.each(QG)}function XG(e){var t=typeof e=="function"?e:DT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ZG(){return null}function JG(e,t){var n=typeof e=="function"?e:DT(e),r=t==null?ZG:typeof t=="function"?t:Fw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function eX(){var e=this.parentNode;e&&e.removeChild(this)}function tX(){return this.each(eX)}function nX(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rX(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sX(e){return this.select(e?rX:nX)}function oX(e){return arguments.length?this.property("__data__",e):this.node().__data__}function aX(e){return function(t){e.call(this,t,this.__data__)}}function iX(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function lX(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,a;n<o;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function cX(e,t,n){return function(){var r=this.__on,o,a=aX(t);if(r){for(var l=0,u=r.length;l<u;++l)if((o=r[l]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=a,o.options=n),o.value=t;return}}this.addEventListener(e.type,a,n),o={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(o):this.__on=[o]}}function uX(e,t,n){var r=iX(e+""),o,a=r.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,f=u.length,m;d<f;++d)for(o=0,m=u[d];o<a;++o)if((l=r[o]).type===m.type&&l.name===m.name)return m.value}return}for(u=t?cX:lX,o=0;o<a;++o)this.each(u(r[o],t,n));return this}function WT(e,t,n){var r=FT(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function dX(e,t){return function(){return WT(this,e,t)}}function fX(e,t){return function(){return WT(this,e,t.apply(this,arguments))}}function hX(e,t){return this.each((typeof t=="function"?fX:dX)(e,t))}function*mX(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,a=r.length,l;o<a;++o)(l=r[o])&&(yield l)}var HT=[null];function jr(e,t){this._groups=e,this._parents=t}function Bd(){return new jr([[document.documentElement]],HT)}function pX(){return this}jr.prototype=Bd.prototype={constructor:jr,select:zQ,selectAll:UQ,selectChild:QQ,selectChildren:JQ,filter:eG,data:aG,enter:tG,exit:lG,join:cG,merge:uG,selection:pX,order:dG,sort:fG,call:mG,nodes:pG,node:gG,size:xG,empty:yG,each:vG,attr:SG,style:TG,property:RG,classed:FG,text:BG,html:qG,raise:YG,lower:GG,append:XG,insert:JG,remove:tX,clone:sX,datum:oX,on:uX,dispatch:hX,[Symbol.iterator]:mX};function pr(e){return typeof e=="string"?new jr([[document.querySelector(e)]],[document.documentElement]):new jr([[e]],HT)}function gX(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ts(e,t){if(e=gX(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const xX={passive:!1},ad={capture:!0,passive:!1};function Wy(e){e.stopImmediatePropagation()}function zl(e){e.preventDefault(),e.stopImmediatePropagation()}function UT(e){var t=e.document.documentElement,n=pr(e).on("dragstart.drag",zl,ad);"onselectstart"in t?n.on("selectstart.drag",zl,ad):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function qT(e,t){var n=e.document.documentElement,r=pr(e).on("dragstart.drag",null);t&&(r.on("click.drag",zl,ad),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Nh=e=>()=>e;function N0(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:a,x:l,y:u,dx:d,dy:f,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:m}})}N0.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yX(e){return!e.ctrlKey&&!e.button}function vX(){return this.parentNode}function bX(e,t){return t??{x:e.x,y:e.y}}function wX(){return navigator.maxTouchPoints||"ontouchstart"in this}function KT(){var e=yX,t=vX,n=bX,r=wX,o={},a=Op("start","drag","end"),l=0,u,d,f,m,p=0;function g(S){S.on("mousedown.drag",y).filter(r).on("touchstart.drag",N).on("touchmove.drag",k,xX).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(S,E){if(!(m||!e.call(this,S,E))){var P=C(this,t.call(this,S,E),S,E,"mouse");P&&(pr(S.view).on("mousemove.drag",b,ad).on("mouseup.drag",w,ad),UT(S.view),Wy(S),f=!1,u=S.clientX,d=S.clientY,P("start",S))}}function b(S){if(zl(S),!f){var E=S.clientX-u,P=S.clientY-d;f=E*E+P*P>p}o.mouse("drag",S)}function w(S){pr(S.view).on("mousemove.drag mouseup.drag",null),qT(S.view,f),zl(S),o.mouse("end",S)}function N(S,E){if(e.call(this,S,E)){var P=S.changedTouches,D=t.call(this,S,E),I=P.length,z,K;for(z=0;z<I;++z)(K=C(this,D,S,E,P[z].identifier,P[z]))&&(Wy(S),K("start",S,P[z]))}}function k(S){var E=S.changedTouches,P=E.length,D,I;for(D=0;D<P;++D)(I=o[E[D].identifier])&&(zl(S),I("drag",S,E[D]))}function j(S){var E=S.changedTouches,P=E.length,D,I;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),D=0;D<P;++D)(I=o[E[D].identifier])&&(Wy(S),I("end",S,E[D]))}function C(S,E,P,D,I,z){var K=a.copy(),q=ts(z||P,E),H,B,R;if((R=n.call(S,new N0("beforestart",{sourceEvent:P,target:g,identifier:I,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:K}),D))!=null)return H=R.x-q[0]||0,B=R.y-q[1]||0,function M(F,L,A){var O=q,U;switch(F){case"start":o[I]=M,U=l++;break;case"end":delete o[I],--l;case"drag":q=ts(A||L,E),U=l;break}K.call(F,S,new N0(F,{sourceEvent:L,subject:R,target:g,identifier:I,active:U,x:q[0]+H,y:q[1]+B,dx:q[0]-O[0],dy:q[1]-O[1],dispatch:K}),D)}}return g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Nh(!!S),g):e},g.container=function(S){return arguments.length?(t=typeof S=="function"?S:Nh(S),g):t},g.subject=function(S){return arguments.length?(n=typeof S=="function"?S:Nh(S),g):n},g.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:Nh(!!S),g):r},g.on=function(){var S=a.on.apply(a,arguments);return S===a?g:S},g.clickDistance=function(S){return arguments.length?(p=(S=+S)*S,g):Math.sqrt(p)},g}function Vw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function YT(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Wd(){}var id=.7,Fm=1/id,Bl="\\s*([+-]?\\d+)\\s*",ld="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NX=/^#([0-9a-f]{3,8})$/,jX=new RegExp(`^rgb\\(${Bl},${Bl},${Bl}\\)$`),CX=new RegExp(`^rgb\\(${Fs},${Fs},${Fs}\\)$`),kX=new RegExp(`^rgba\\(${Bl},${Bl},${Bl},${ld}\\)$`),SX=new RegExp(`^rgba\\(${Fs},${Fs},${Fs},${ld}\\)$`),_X=new RegExp(`^hsl\\(${ld},${Fs},${Fs}\\)$`),EX=new RegExp(`^hsla\\(${ld},${Fs},${Fs},${ld}\\)$`),_S={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vw(Wd,$i,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ES,formatHex:ES,formatHex8:PX,formatHsl:TX,formatRgb:PS,toString:PS});function ES(){return this.rgb().formatHex()}function PX(){return this.rgb().formatHex8()}function TX(){return QT(this).formatHsl()}function PS(){return this.rgb().formatRgb()}function $i(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=NX.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?TS(t):n===3?new rr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?jh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?jh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=jX.exec(e))?new rr(t[1],t[2],t[3],1):(t=CX.exec(e))?new rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kX.exec(e))?jh(t[1],t[2],t[3],t[4]):(t=SX.exec(e))?jh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_X.exec(e))?DS(t[1],t[2]/100,t[3]/100,1):(t=EX.exec(e))?DS(t[1],t[2]/100,t[3]/100,t[4]):_S.hasOwnProperty(e)?TS(_S[e]):e==="transparent"?new rr(NaN,NaN,NaN,0):null}function TS(e){return new rr(e>>16&255,e>>8&255,e&255,1)}function jh(e,t,n,r){return r<=0&&(e=t=n=NaN),new rr(e,t,n,r)}function MX(e){return e instanceof Wd||(e=$i(e)),e?(e=e.rgb(),new rr(e.r,e.g,e.b,e.opacity)):new rr}function j0(e,t,n,r){return arguments.length===1?MX(e):new rr(e,t,n,r??1)}function rr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Vw(rr,j0,YT(Wd,{brighter(e){return e=e==null?Fm:Math.pow(Fm,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?id:Math.pow(id,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rr(Ei(this.r),Ei(this.g),Ei(this.b),$m(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:MS,formatHex:MS,formatHex8:AX,formatRgb:AS,toString:AS}));function MS(){return`#${pi(this.r)}${pi(this.g)}${pi(this.b)}`}function AX(){return`#${pi(this.r)}${pi(this.g)}${pi(this.b)}${pi((isNaN(this.opacity)?1:this.opacity)*255)}`}function AS(){const e=$m(this.opacity);return`${e===1?"rgb(":"rgba("}${Ei(this.r)}, ${Ei(this.g)}, ${Ei(this.b)}${e===1?")":`, ${e})`}`}function $m(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ei(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function pi(e){return e=Ei(e),(e<16?"0":"")+e.toString(16)}function DS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ns(e,t,n,r)}function QT(e){if(e instanceof ns)return new ns(e.h,e.s,e.l,e.opacity);if(e instanceof Wd||(e=$i(e)),!e)return new ns;if(e instanceof ns)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),a=Math.max(t,n,r),l=NaN,u=a-o,d=(a+o)/2;return u?(t===a?l=(n-r)/u+(n<r)*6:n===a?l=(r-t)/u+2:l=(t-n)/u+4,u/=d<.5?a+o:2-a-o,l*=60):u=d>0&&d<1?0:l,new ns(l,u,d,e.opacity)}function DX(e,t,n,r){return arguments.length===1?QT(e):new ns(e,t,n,r??1)}function ns(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vw(ns,DX,YT(Wd,{brighter(e){return e=e==null?Fm:Math.pow(Fm,e),new ns(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?id:Math.pow(id,e),new ns(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new rr(Hy(e>=240?e-240:e+120,o,r),Hy(e,o,r),Hy(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ns(RS(this.h),Ch(this.s),Ch(this.l),$m(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=$m(this.opacity);return`${e===1?"hsl(":"hsla("}${RS(this.h)}, ${Ch(this.s)*100}%, ${Ch(this.l)*100}%${e===1?")":`, ${e})`}`}}));function RS(e){return e=(e||0)%360,e<0?e+360:e}function Ch(e){return Math.max(0,Math.min(1,e||0))}function Hy(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const zw=e=>()=>e;function RX(e,t){return function(n){return e+n*t}}function OX(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function IX(e){return(e=+e)==1?GT:function(t,n){return n-t?OX(t,n,e):zw(isNaN(t)?n:t)}}function GT(e,t){var n=t-e;return n?RX(e,n):zw(isNaN(e)?t:e)}const Vm=(function e(t){var n=IX(t);function r(o,a){var l=n((o=j0(o)).r,(a=j0(a)).r),u=n(o.g,a.g),d=n(o.b,a.b),f=GT(o.opacity,a.opacity);return function(m){return o.r=l(m),o.g=u(m),o.b=d(m),o.opacity=f(m),o+""}}return r.gamma=e,r})(1);function LX(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(a){for(o=0;o<n;++o)r[o]=e[o]*(1-a)+t[o]*a;return r}}function FX(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $X(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),a=new Array(n),l;for(l=0;l<r;++l)o[l]=Wu(e[l],t[l]);for(;l<n;++l)a[l]=t[l];return function(u){for(l=0;l<r;++l)a[l]=o[l](u);return a}}function VX(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ts(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zX(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Wu(e[o],t[o]):r[o]=t[o];return function(a){for(o in n)r[o]=n[o](a);return r}}var C0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Uy=new RegExp(C0.source,"g");function BX(e){return function(){return e}}function WX(e){return function(t){return e(t)+""}}function XT(e,t){var n=C0.lastIndex=Uy.lastIndex=0,r,o,a,l=-1,u=[],d=[];for(e=e+"",t=t+"";(r=C0.exec(e))&&(o=Uy.exec(t));)(a=o.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(r=r[0])===(o=o[0])?u[l]?u[l]+=o:u[++l]=o:(u[++l]=null,d.push({i:l,x:Ts(r,o)})),n=Uy.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?d[0]?WX(d[0].x):BX(t):(t=d.length,function(f){for(var m=0,p;m<t;++m)u[(p=d[m]).i]=p.x(f);return u.join("")})}function Wu(e,t){var n=typeof t,r;return t==null||n==="boolean"?zw(t):(n==="number"?Ts:n==="string"?(r=$i(t))?(t=r,Vm):XT:t instanceof $i?Vm:t instanceof Date?VX:FX(t)?LX:Array.isArray(t)?$X:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zX:Ts)(e,t)}var OS=180/Math.PI,k0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ZT(e,t,n,r,o,a){var l,u,d;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,d/=u),e*r<t*n&&(e=-e,t=-t,d=-d,l=-l),{translateX:o,translateY:a,rotate:Math.atan2(t,e)*OS,skewX:Math.atan(d)*OS,scaleX:l,scaleY:u}}var kh;function HX(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?k0:ZT(t.a,t.b,t.c,t.d,t.e,t.f)}function UX(e){return e==null||(kh||(kh=document.createElementNS("http://www.w3.org/2000/svg","g")),kh.setAttribute("transform",e),!(e=kh.transform.baseVal.consolidate()))?k0:(e=e.matrix,ZT(e.a,e.b,e.c,e.d,e.e,e.f))}function JT(e,t,n,r){function o(f){return f.length?f.pop()+" ":""}function a(f,m,p,g,y,b){if(f!==p||m!==g){var w=y.push("translate(",null,t,null,n);b.push({i:w-4,x:Ts(f,p)},{i:w-2,x:Ts(m,g)})}else(p||g)&&y.push("translate("+p+t+g+n)}function l(f,m,p,g){f!==m?(f-m>180?m+=360:m-f>180&&(f+=360),g.push({i:p.push(o(p)+"rotate(",null,r)-2,x:Ts(f,m)})):m&&p.push(o(p)+"rotate("+m+r)}function u(f,m,p,g){f!==m?g.push({i:p.push(o(p)+"skewX(",null,r)-2,x:Ts(f,m)}):m&&p.push(o(p)+"skewX("+m+r)}function d(f,m,p,g,y,b){if(f!==p||m!==g){var w=y.push(o(y)+"scale(",null,",",null,")");b.push({i:w-4,x:Ts(f,p)},{i:w-2,x:Ts(m,g)})}else(p!==1||g!==1)&&y.push(o(y)+"scale("+p+","+g+")")}return function(f,m){var p=[],g=[];return f=e(f),m=e(m),a(f.translateX,f.translateY,m.translateX,m.translateY,p,g),l(f.rotate,m.rotate,p,g),u(f.skewX,m.skewX,p,g),d(f.scaleX,f.scaleY,m.scaleX,m.scaleY,p,g),f=m=null,function(y){for(var b=-1,w=g.length,N;++b<w;)p[(N=g[b]).i]=N.x(y);return p.join("")}}}var qX=JT(HX,"px, ","px)","deg)"),KX=JT(UX,", ",")",")"),YX=1e-12;function IS(e){return((e=Math.exp(e))+1/e)/2}function QX(e){return((e=Math.exp(e))-1/e)/2}function GX(e){return((e=Math.exp(2*e))-1)/(e+1)}const tm=(function e(t,n,r){function o(a,l){var u=a[0],d=a[1],f=a[2],m=l[0],p=l[1],g=l[2],y=m-u,b=p-d,w=y*y+b*b,N,k;if(w<YX)k=Math.log(g/f)/t,N=function(D){return[u+D*y,d+D*b,f*Math.exp(t*D*k)]};else{var j=Math.sqrt(w),C=(g*g-f*f+r*w)/(2*f*n*j),S=(g*g-f*f-r*w)/(2*g*n*j),E=Math.log(Math.sqrt(C*C+1)-C),P=Math.log(Math.sqrt(S*S+1)-S);k=(P-E)/t,N=function(D){var I=D*k,z=IS(E),K=f/(n*j)*(z*GX(t*I+E)-QX(E));return[u+K*y,d+K*b,f*z/IS(t*I+E)]}}return N.duration=k*1e3*t/Math.SQRT2,N}return o.rho=function(a){var l=Math.max(.001,+a),u=l*l,d=u*u;return e(l,u,d)},o})(Math.SQRT2,2,4);var uc=0,Tu=0,Cu=0,eM=1e3,zm,Mu,Bm=0,Vi=0,Lp=0,cd=typeof performance=="object"&&performance.now?performance:Date,tM=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bw(){return Vi||(tM(XX),Vi=cd.now()+Lp)}function XX(){Vi=0}function Wm(){this._call=this._time=this._next=null}Wm.prototype=nM.prototype={constructor:Wm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bw():+n)+(t==null?0:+t),!this._next&&Mu!==this&&(Mu?Mu._next=this:zm=this,Mu=this),this._call=e,this._time=n,S0()},stop:function(){this._call&&(this._call=null,this._time=1/0,S0())}};function nM(e,t,n){var r=new Wm;return r.restart(e,t,n),r}function ZX(){Bw(),++uc;for(var e=zm,t;e;)(t=Vi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--uc}function LS(){Vi=(Bm=cd.now())+Lp,uc=Tu=0;try{ZX()}finally{uc=0,eZ(),Vi=0}}function JX(){var e=cd.now(),t=e-Bm;t>eM&&(Lp-=t,Bm=e)}function eZ(){for(var e,t=zm,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:zm=n);Mu=e,S0(r)}function S0(e){if(!uc){Tu&&(Tu=clearTimeout(Tu));var t=e-Vi;t>24?(e<1/0&&(Tu=setTimeout(LS,e-cd.now()-Lp)),Cu&&(Cu=clearInterval(Cu))):(Cu||(Bm=cd.now(),Cu=setInterval(JX,eM)),uc=1,tM(LS))}}function FS(e,t,n){var r=new Wm;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var tZ=Op("start","end","cancel","interrupt"),nZ=[],rM=0,$S=1,_0=2,nm=3,VS=4,E0=5,rm=6;function Fp(e,t,n,r,o,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;rZ(e,n,{name:t,index:r,group:o,on:tZ,tween:nZ,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:rM})}function Ww(e,t){var n=gs(e,t);if(n.state>rM)throw new Error("too late; already scheduled");return n}function qs(e,t){var n=gs(e,t);if(n.state>nm)throw new Error("too late; already running");return n}function gs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function rZ(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=nM(a,0,n.time);function a(f){n.state=$S,n.timer.restart(l,n.delay,n.time),n.delay<=f&&l(f-n.delay)}function l(f){var m,p,g,y;if(n.state!==$S)return d();for(m in r)if(y=r[m],y.name===n.name){if(y.state===nm)return FS(l);y.state===VS?(y.state=rm,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[m]):+m<t&&(y.state=rm,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[m])}if(FS(function(){n.state===nm&&(n.state=VS,n.timer.restart(u,n.delay,n.time),u(f))}),n.state=_0,n.on.call("start",e,e.__data__,n.index,n.group),n.state===_0){for(n.state=nm,o=new Array(g=n.tween.length),m=0,p=-1;m<g;++m)(y=n.tween[m].value.call(e,e.__data__,n.index,n.group))&&(o[++p]=y);o.length=p+1}}function u(f){for(var m=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(d),n.state=E0,1),p=-1,g=o.length;++p<g;)o[p].call(e,m);n.state===E0&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=rm,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function sm(e,t){var n=e.__transition,r,o,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){a=!1;continue}o=r.state>_0&&r.state<E0,r.state=rm,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}a&&delete e.__transition}}function sZ(e){return this.each(function(){sm(this,e)})}function oZ(e,t){var n,r;return function(){var o=qs(this,e),a=o.tween;if(a!==n){r=n=a;for(var l=0,u=r.length;l<u;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}o.tween=r}}function aZ(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var a=qs(this,e),l=a.tween;if(l!==r){o=(r=l).slice();for(var u={name:t,value:n},d=0,f=o.length;d<f;++d)if(o[d].name===t){o[d]=u;break}d===f&&o.push(u)}a.tween=o}}function iZ(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=gs(this.node(),n).tween,o=0,a=r.length,l;o<a;++o)if((l=r[o]).name===e)return l.value;return null}return this.each((t==null?oZ:aZ)(n,e,t))}function Hw(e,t,n){var r=e._id;return e.each(function(){var o=qs(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return gs(o,r).value[t]}}function sM(e,t){var n;return(typeof t=="number"?Ts:t instanceof $i?Vm:(n=$i(t))?(t=n,Vm):XT)(e,t)}function lZ(e){return function(){this.removeAttribute(e)}}function cZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uZ(e,t,n){var r,o=n+"",a;return function(){var l=this.getAttribute(e);return l===o?null:l===r?a:a=t(r=l,n)}}function dZ(e,t,n){var r,o=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===o?null:l===r?a:a=t(r=l,n)}}function fZ(e,t,n){var r,o,a;return function(){var l,u=n(this),d;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=u+"",l===d?null:l===r&&d===o?a:(o=d,a=t(r=l,u)))}}function hZ(e,t,n){var r,o,a;return function(){var l,u=n(this),d;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=u+"",l===d?null:l===r&&d===o?a:(o=d,a=t(r=l,u)))}}function mZ(e,t){var n=Ip(e),r=n==="transform"?KX:sM;return this.attrTween(e,typeof t=="function"?(n.local?hZ:fZ)(n,r,Hw(this,"attr."+e,t)):t==null?(n.local?cZ:lZ)(n):(n.local?dZ:uZ)(n,r,t))}function pZ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function gZ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function xZ(e,t){var n,r;function o(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&gZ(e,a)),n}return o._value=t,o}function yZ(e,t){var n,r;function o(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&pZ(e,a)),n}return o._value=t,o}function vZ(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Ip(e);return this.tween(n,(r.local?xZ:yZ)(r,t))}function bZ(e,t){return function(){Ww(this,e).delay=+t.apply(this,arguments)}}function wZ(e,t){return t=+t,function(){Ww(this,e).delay=t}}function NZ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bZ:wZ)(t,e)):gs(this.node(),t).delay}function jZ(e,t){return function(){qs(this,e).duration=+t.apply(this,arguments)}}function CZ(e,t){return t=+t,function(){qs(this,e).duration=t}}function kZ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jZ:CZ)(t,e)):gs(this.node(),t).duration}function SZ(e,t){if(typeof t!="function")throw new Error;return function(){qs(this,e).ease=t}}function _Z(e){var t=this._id;return arguments.length?this.each(SZ(t,e)):gs(this.node(),t).ease}function EZ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;qs(this,e).ease=n}}function PZ(e){if(typeof e!="function")throw new Error;return this.each(EZ(this._id,e))}function TZ(e){typeof e!="function"&&(e=OT(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var a=t[o],l=a.length,u=r[o]=[],d,f=0;f<l;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&u.push(d);return new bo(r,this._parents,this._name,this._id)}function MZ(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,a=Math.min(r,o),l=new Array(r),u=0;u<a;++u)for(var d=t[u],f=n[u],m=d.length,p=l[u]=new Array(m),g,y=0;y<m;++y)(g=d[y]||f[y])&&(p[y]=g);for(;u<r;++u)l[u]=t[u];return new bo(l,this._parents,this._name,this._id)}function AZ(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function DZ(e,t,n){var r,o,a=AZ(t)?Ww:qs;return function(){var l=a(this,e),u=l.on;u!==r&&(o=(r=u).copy()).on(t,n),l.on=o}}function RZ(e,t){var n=this._id;return arguments.length<2?gs(this.node(),n).on.on(e):this.each(DZ(n,e,t))}function OZ(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function IZ(){return this.on("end.remove",OZ(this._id))}function LZ(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Fw(e));for(var r=this._groups,o=r.length,a=new Array(o),l=0;l<o;++l)for(var u=r[l],d=u.length,f=a[l]=new Array(d),m,p,g=0;g<d;++g)(m=u[g])&&(p=e.call(m,m.__data__,g,u))&&("__data__"in m&&(p.__data__=m.__data__),f[g]=p,Fp(f[g],t,n,g,f,gs(m,n)));return new bo(a,this._parents,t,n)}function FZ(e){var t=this._name,n=this._id;typeof e!="function"&&(e=RT(e));for(var r=this._groups,o=r.length,a=[],l=[],u=0;u<o;++u)for(var d=r[u],f=d.length,m,p=0;p<f;++p)if(m=d[p]){for(var g=e.call(m,m.__data__,p,d),y,b=gs(m,n),w=0,N=g.length;w<N;++w)(y=g[w])&&Fp(y,t,n,w,g,b);a.push(g),l.push(m)}return new bo(a,l,t,n)}var $Z=Bd.prototype.constructor;function VZ(){return new $Z(this._groups,this._parents)}function zZ(e,t){var n,r,o;return function(){var a=cc(this,e),l=(this.style.removeProperty(e),cc(this,e));return a===l?null:a===n&&l===r?o:o=t(n=a,r=l)}}function oM(e){return function(){this.style.removeProperty(e)}}function BZ(e,t,n){var r,o=n+"",a;return function(){var l=cc(this,e);return l===o?null:l===r?a:a=t(r=l,n)}}function WZ(e,t,n){var r,o,a;return function(){var l=cc(this,e),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(e),cc(this,e))),l===d?null:l===r&&d===o?a:(o=d,a=t(r=l,u))}}function HZ(e,t){var n,r,o,a="style."+t,l="end."+a,u;return function(){var d=qs(this,e),f=d.on,m=d.value[a]==null?u||(u=oM(t)):void 0;(f!==n||o!==m)&&(r=(n=f).copy()).on(l,o=m),d.on=r}}function UZ(e,t,n){var r=(e+="")=="transform"?qX:sM;return t==null?this.styleTween(e,zZ(e,r)).on("end.style."+e,oM(e)):typeof t=="function"?this.styleTween(e,WZ(e,r,Hw(this,"style."+e,t))).each(HZ(this._id,e)):this.styleTween(e,BZ(e,r,t),n).on("end.style."+e,null)}function qZ(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function KZ(e,t,n){var r,o;function a(){var l=t.apply(this,arguments);return l!==o&&(r=(o=l)&&qZ(e,l,n)),r}return a._value=t,a}function YZ(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,KZ(e,t,n??""))}function QZ(e){return function(){this.textContent=e}}function GZ(e){return function(){var t=e(this);this.textContent=t??""}}function XZ(e){return this.tween("text",typeof e=="function"?GZ(Hw(this,"text",e)):QZ(e==null?"":e+""))}function ZZ(e){return function(t){this.textContent=e.call(this,t)}}function JZ(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&ZZ(o)),t}return r._value=e,r}function eJ(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,JZ(e))}function tJ(){for(var e=this._name,t=this._id,n=aM(),r=this._groups,o=r.length,a=0;a<o;++a)for(var l=r[a],u=l.length,d,f=0;f<u;++f)if(d=l[f]){var m=gs(d,t);Fp(d,e,n,f,l,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new bo(r,this._parents,e,n)}function nJ(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(a,l){var u={value:l},d={value:function(){--o===0&&a()}};n.each(function(){var f=qs(this,r),m=f.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(d)),f.on=t}),o===0&&a()})}var rJ=0;function bo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function aM(){return++rJ}var so=Bd.prototype;bo.prototype={constructor:bo,select:LZ,selectAll:FZ,selectChild:so.selectChild,selectChildren:so.selectChildren,filter:TZ,merge:MZ,selection:VZ,transition:tJ,call:so.call,nodes:so.nodes,node:so.node,size:so.size,empty:so.empty,each:so.each,on:RZ,attr:mZ,attrTween:vZ,style:UZ,styleTween:YZ,text:XZ,textTween:eJ,remove:IZ,tween:iZ,delay:NZ,duration:kZ,ease:_Z,easeVarying:PZ,end:nJ,[Symbol.iterator]:so[Symbol.iterator]};function sJ(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var oJ={time:null,delay:0,duration:250,ease:sJ};function aJ(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function iJ(e){var t,n;e instanceof bo?(t=e._id,e=e._name):(t=aM(),(n=oJ).time=Bw(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,a=0;a<o;++a)for(var l=r[a],u=l.length,d,f=0;f<u;++f)(d=l[f])&&Fp(d,e,t,f,l,n||aJ(d,t));return new bo(r,this._parents,e,t)}Bd.prototype.interrupt=sZ;Bd.prototype.transition=iJ;const Sh=e=>()=>e;function lJ(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function uo(e,t,n){this.k=e,this.x=t,this.y=n}uo.prototype={constructor:uo,scale:function(e){return e===1?this:new uo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new uo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $p=new uo(1,0,0);iM.prototype=uo.prototype;function iM(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $p;return e.__zoom}function qy(e){e.stopImmediatePropagation()}function ku(e){e.preventDefault(),e.stopImmediatePropagation()}function cJ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function uJ(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function zS(){return this.__zoom||$p}function dJ(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fJ(){return navigator.maxTouchPoints||"ontouchstart"in this}function hJ(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function lM(){var e=cJ,t=uJ,n=hJ,r=dJ,o=fJ,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,d=tm,f=Op("start","zoom","end"),m,p,g,y=500,b=150,w=0,N=10;function k(R){R.property("__zoom",zS).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",K).filter(o).on("touchstart.zoom",q).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(R,M,F,L){var A=R.selection?R.selection():R;A.property("__zoom",zS),R!==A?E(R,M,F,L):A.interrupt().each(function(){P(this,arguments).event(L).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},k.scaleBy=function(R,M,F,L){k.scaleTo(R,function(){var A=this.__zoom.k,O=typeof M=="function"?M.apply(this,arguments):M;return A*O},F,L)},k.scaleTo=function(R,M,F,L){k.transform(R,function(){var A=t.apply(this,arguments),O=this.__zoom,U=F==null?S(A):typeof F=="function"?F.apply(this,arguments):F,V=O.invert(U),$=typeof M=="function"?M.apply(this,arguments):M;return n(C(j(O,$),U,V),A,l)},F,L)},k.translateBy=function(R,M,F,L){k.transform(R,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof F=="function"?F.apply(this,arguments):F),t.apply(this,arguments),l)},null,L)},k.translateTo=function(R,M,F,L,A){k.transform(R,function(){var O=t.apply(this,arguments),U=this.__zoom,V=L==null?S(O):typeof L=="function"?L.apply(this,arguments):L;return n($p.translate(V[0],V[1]).scale(U.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof F=="function"?-F.apply(this,arguments):-F),O,l)},L,A)};function j(R,M){return M=Math.max(a[0],Math.min(a[1],M)),M===R.k?R:new uo(M,R.x,R.y)}function C(R,M,F){var L=M[0]-F[0]*R.k,A=M[1]-F[1]*R.k;return L===R.x&&A===R.y?R:new uo(R.k,L,A)}function S(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function E(R,M,F,L){R.on("start.zoom",function(){P(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(L).end()}).tween("zoom",function(){var A=this,O=arguments,U=P(A,O).event(L),V=t.apply(A,O),$=F==null?S(V):typeof F=="function"?F.apply(A,O):F,Y=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),X=A.__zoom,ne=typeof M=="function"?M.apply(A,O):M,ie=d(X.invert($).concat(Y/X.k),ne.invert($).concat(Y/ne.k));return function(J){if(J===1)J=ne;else{var re=ie(J),ce=Y/re[2];J=new uo(ce,$[0]-re[0]*ce,$[1]-re[1]*ce)}U.zoom(null,J)}})}function P(R,M,F){return!F&&R.__zooming||new D(R,M)}function D(R,M){this.that=R,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,M),this.taps=0}D.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,M){return this.mouse&&R!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var M=pr(this.that).datum();f.call(R,this.that,new lJ(R,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:f}),M)}};function I(R,...M){if(!e.apply(this,arguments))return;var F=P(this,M).event(R),L=this.__zoom,A=Math.max(a[0],Math.min(a[1],L.k*Math.pow(2,r.apply(this,arguments)))),O=ts(R);if(F.wheel)(F.mouse[0][0]!==O[0]||F.mouse[0][1]!==O[1])&&(F.mouse[1]=L.invert(F.mouse[0]=O)),clearTimeout(F.wheel);else{if(L.k===A)return;F.mouse=[O,L.invert(O)],sm(this),F.start()}ku(R),F.wheel=setTimeout(U,b),F.zoom("mouse",n(C(j(L,A),F.mouse[0],F.mouse[1]),F.extent,l));function U(){F.wheel=null,F.end()}}function z(R,...M){if(g||!e.apply(this,arguments))return;var F=R.currentTarget,L=P(this,M,!0).event(R),A=pr(R.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",Y,!0),O=ts(R,F),U=R.clientX,V=R.clientY;UT(R.view),qy(R),L.mouse=[O,this.__zoom.invert(O)],sm(this),L.start();function $(X){if(ku(X),!L.moved){var ne=X.clientX-U,ie=X.clientY-V;L.moved=ne*ne+ie*ie>w}L.event(X).zoom("mouse",n(C(L.that.__zoom,L.mouse[0]=ts(X,F),L.mouse[1]),L.extent,l))}function Y(X){A.on("mousemove.zoom mouseup.zoom",null),qT(X.view,L.moved),ku(X),L.event(X).end()}}function K(R,...M){if(e.apply(this,arguments)){var F=this.__zoom,L=ts(R.changedTouches?R.changedTouches[0]:R,this),A=F.invert(L),O=F.k*(R.shiftKey?.5:2),U=n(C(j(F,O),L,A),t.apply(this,M),l);ku(R),u>0?pr(this).transition().duration(u).call(E,U,L,R):pr(this).call(k.transform,U,L,R)}}function q(R,...M){if(e.apply(this,arguments)){var F=R.touches,L=F.length,A=P(this,M,R.changedTouches.length===L).event(R),O,U,V,$;for(qy(R),U=0;U<L;++U)V=F[U],$=ts(V,this),$=[$,this.__zoom.invert($),V.identifier],A.touch0?!A.touch1&&A.touch0[2]!==$[2]&&(A.touch1=$,A.taps=0):(A.touch0=$,O=!0,A.taps=1+!!m);m&&(m=clearTimeout(m)),O&&(A.taps<2&&(p=$[0],m=setTimeout(function(){m=null},y)),sm(this),A.start())}}function H(R,...M){if(this.__zooming){var F=P(this,M).event(R),L=R.changedTouches,A=L.length,O,U,V,$;for(ku(R),O=0;O<A;++O)U=L[O],V=ts(U,this),F.touch0&&F.touch0[2]===U.identifier?F.touch0[0]=V:F.touch1&&F.touch1[2]===U.identifier&&(F.touch1[0]=V);if(U=F.that.__zoom,F.touch1){var Y=F.touch0[0],X=F.touch0[1],ne=F.touch1[0],ie=F.touch1[1],J=(J=ne[0]-Y[0])*J+(J=ne[1]-Y[1])*J,re=(re=ie[0]-X[0])*re+(re=ie[1]-X[1])*re;U=j(U,Math.sqrt(J/re)),V=[(Y[0]+ne[0])/2,(Y[1]+ne[1])/2],$=[(X[0]+ie[0])/2,(X[1]+ie[1])/2]}else if(F.touch0)V=F.touch0[0],$=F.touch0[1];else return;F.zoom("touch",n(C(U,V,$),F.extent,l))}}function B(R,...M){if(this.__zooming){var F=P(this,M).event(R),L=R.changedTouches,A=L.length,O,U;for(qy(R),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),O=0;O<A;++O)U=L[O],F.touch0&&F.touch0[2]===U.identifier?delete F.touch0:F.touch1&&F.touch1[2]===U.identifier&&delete F.touch1;if(F.touch1&&!F.touch0&&(F.touch0=F.touch1,delete F.touch1),F.touch0)F.touch0[1]=this.__zoom.invert(F.touch0[0]);else if(F.end(),F.taps===2&&(U=ts(U,this),Math.hypot(p[0]-U[0],p[1]-U[1])<N)){var V=pr(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return k.wheelDelta=function(R){return arguments.length?(r=typeof R=="function"?R:Sh(+R),k):r},k.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Sh(!!R),k):e},k.touchable=function(R){return arguments.length?(o=typeof R=="function"?R:Sh(!!R),k):o},k.extent=function(R){return arguments.length?(t=typeof R=="function"?R:Sh([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),k):t},k.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],k):[a[0],a[1]]},k.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(R){return arguments.length?(n=R,k):n},k.duration=function(R){return arguments.length?(u=+R,k):u},k.interpolate=function(R){return arguments.length?(d=R,k):d},k.on=function(){var R=f.on.apply(f,arguments);return R===f?k:R},k.clickDistance=function(R){return arguments.length?(w=(R=+R)*R,k):Math.sqrt(w)},k.tapDistance=function(R){return arguments.length?(N=+R,k):N},k}const Hs={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ud=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],cM=["Enter"," ","Escape"],uM={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var dc;(function(e){e.Strict="strict",e.Loose="loose"})(dc||(dc={}));var Pi;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pi||(Pi={}));var dd;(function(e){e.Partial="partial",e.Full="full"})(dd||(dd={}));const dM={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var na;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(na||(na={}));var Hm;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Hm||(Hm={}));var Be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Be||(Be={}));const BS={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top};function fM(e){return e===null?null:e?"valid":"invalid"}const hM=e=>"id"in e&&"source"in e&&"target"in e,mJ=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Uw=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Hd=(e,t=[0,0])=>{const{width:n,height:r}=Co(e),o=e.origin??t,a=n*o[0],l=r*o[1];return{x:e.position.x-a,y:e.position.y-l}},pJ=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const a=typeof o=="string";let l=!t.nodeLookup&&!a?o:void 0;t.nodeLookup&&(l=a?t.nodeLookup.get(o):Uw(o)?o:t.nodeLookup.get(o.id));const u=l?Um(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Vp(r,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zp(n)},Ud=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Vp(n,Um(o)),r=!0)}),r?zp(n):{x:0,y:0,width:0,height:0}},qw=(e,t,[n,r,o]=[0,0,1],a=!1,l=!1)=>{const u={...Kd(t,[n,r,o]),width:t.width/o,height:t.height/o},d=[];for(const f of e.values()){const{measured:m,selectable:p=!0,hidden:g=!1}=f;if(l&&!p||g)continue;const y=m.width??f.width??f.initialWidth??null,b=m.height??f.height??f.initialHeight??null,w=fd(u,hc(f)),N=(y??0)*(b??0),k=a&&w>0;(!f.internals.handleBounds||k||w>=N||f.dragging)&&d.push(f)}return d},gJ=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function xJ(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function yJ({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:a},l){if(e.size===0)return Promise.resolve(!0);const u=xJ(e,l),d=Ud(u),f=Kw(d,t,n,(l==null?void 0:l.minZoom)??o,(l==null?void 0:l.maxZoom)??a,(l==null?void 0:l.padding)??.1);return await r.setViewport(f,{duration:l==null?void 0:l.duration,ease:l==null?void 0:l.ease,interpolate:l==null?void 0:l.interpolate}),Promise.resolve(!0)}function mM({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:a}){const l=n.get(e),u=l.parentId?n.get(l.parentId):void 0,{x:d,y:f}=u?u.internals.positionAbsolute:{x:0,y:0},m=l.origin??r;let p=l.extent||o;if(l.extent==="parent"&&!l.expandParent)if(!u)a==null||a("005",Hs.error005());else{const y=u.measured.width,b=u.measured.height;y&&b&&(p=[[d,f],[d+y,f+b]])}else u&&mc(l.extent)&&(p=[[l.extent[0][0]+d,l.extent[0][1]+f],[l.extent[1][0]+d,l.extent[1][1]+f]]);const g=mc(p)?zi(t,p,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&(a==null||a("015",Hs.error015())),{position:{x:g.x-d+(l.measured.width??0)*m[0],y:g.y-f+(l.measured.height??0)*m[1]},positionAbsolute:g}}async function vJ({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const a=new Set(e.map(g=>g.id)),l=[];for(const g of n){if(g.deletable===!1)continue;const y=a.has(g.id),b=!y&&g.parentId&&l.find(w=>w.id===g.parentId);(y||b)&&l.push(g)}const u=new Set(t.map(g=>g.id)),d=r.filter(g=>g.deletable!==!1),m=gJ(l,d);for(const g of d)u.has(g.id)&&!m.find(b=>b.id===g.id)&&m.push(g);if(!o)return{edges:m,nodes:l};const p=await o({nodes:l,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:l}:{edges:[],nodes:[]}:p}const fc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),zi=(e={x:0,y:0},t,n)=>({x:fc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:fc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function pM(e,t,n){const{width:r,height:o}=Co(n),{x:a,y:l}=n.internals.positionAbsolute;return zi(e,[[a,l],[a+r,l+o]],t)}const WS=(e,t,n)=>e<t?fc(Math.abs(e-t),1,t)/t:e>n?-fc(Math.abs(e-n),1,t)/t:0,gM=(e,t,n=15,r=40)=>{const o=WS(e.x,r,t.width-r)*n,a=WS(e.y,r,t.height-r)*n;return[o,a]},Vp=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),P0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zp=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),hc=(e,t=[0,0])=>{var o,a;const{x:n,y:r}=Uw(e)?e.internals.positionAbsolute:Hd(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Um=(e,t=[0,0])=>{var o,a;const{x:n,y:r}=Uw(e)?e.internals.positionAbsolute:Hd(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},xM=(e,t)=>zp(Vp(P0(e),P0(t))),fd=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},HS=e=>rs(e.width)&&rs(e.height)&&rs(e.x)&&rs(e.y),rs=e=>!isNaN(e)&&isFinite(e),bJ=(e,t)=>{},qd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Kd=({x:e,y:t},[n,r,o],a=!1,l=[1,1])=>{const u={x:(e-n)/o,y:(t-r)/o};return a?qd(u,l):u},qm=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function kl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wJ(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=kl(e,n),o=kl(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=kl(e.top??e.y??0,n),o=kl(e.bottom??e.y??0,n),a=kl(e.left??e.x??0,t),l=kl(e.right??e.x??0,t);return{top:r,right:l,bottom:o,left:a,x:a+l,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function NJ(e,t,n,r,o,a){const{x:l,y:u}=qm(e,[t,n,r]),{x:d,y:f}=qm({x:e.x+e.width,y:e.y+e.height},[t,n,r]),m=o-d,p=a-f;return{left:Math.floor(l),top:Math.floor(u),right:Math.floor(m),bottom:Math.floor(p)}}const Kw=(e,t,n,r,o,a)=>{const l=wJ(a,t,n),u=(t-l.x)/e.width,d=(n-l.y)/e.height,f=Math.min(u,d),m=fc(f,r,o),p=e.x+e.width/2,g=e.y+e.height/2,y=t/2-p*m,b=n/2-g*m,w=NJ(e,y,b,m,t,n),N={left:Math.min(w.left-l.left,0),top:Math.min(w.top-l.top,0),right:Math.min(w.right-l.right,0),bottom:Math.min(w.bottom-l.bottom,0)};return{x:y-N.left+N.right,y:b-N.top+N.bottom,zoom:m}},hd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function mc(e){return e!=null&&e!=="parent"}function Co(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function yM(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function vM(e,t={width:0,height:0},n,r,o){const a={...e},l=r.get(n);if(l){const u=l.origin||o;a.x+=l.internals.positionAbsolute.x-(t.width??0)*u[0],a.y+=l.internals.positionAbsolute.y-(t.height??0)*u[1]}return a}function US(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function jJ(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function CJ(e){return{...uM,...e||{}}}function Hu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:a,y:l}=ss(e),u=Kd({x:a-((o==null?void 0:o.left)??0),y:l-((o==null?void 0:o.top)??0)},r),{x:d,y:f}=n?qd(u,t):u;return{xSnapped:d,ySnapped:f,...u}}const Yw=e=>({width:e.offsetWidth,height:e.offsetHeight}),bM=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},kJ=["INPUT","SELECT","TEXTAREA"];function wM(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:kJ.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const NM=e=>"clientX"in e,ss=(e,t)=>{var a,l;const n=NM(e),r=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,o=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},qS=(e,t,n,r,o)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:o,position:l.getAttribute("data-handlepos"),x:(u.left-n.left)/r,y:(u.top-n.top)/r,...Yw(l)}})};function jM({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:a,targetControlX:l,targetControlY:u}){const d=e*.125+o*.375+l*.375+n*.125,f=t*.125+a*.375+u*.375+r*.125,m=Math.abs(d-e),p=Math.abs(f-t);return[d,f,m,p]}function _h(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function KS({pos:e,x1:t,y1:n,x2:r,y2:o,c:a}){switch(e){case Be.Left:return[t-_h(t-r,a),n];case Be.Right:return[t+_h(r-t,a),n];case Be.Top:return[t,n-_h(n-o,a)];case Be.Bottom:return[t,n+_h(o-n,a)]}}function CM({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:o,targetPosition:a=Be.Top,curvature:l=.25}){const[u,d]=KS({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[f,m]=KS({pos:a,x1:r,y1:o,x2:e,y2:t,c:l}),[p,g,y,b]=jM({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:u,sourceControlY:d,targetControlX:f,targetControlY:m});return[`M${e},${t} C${u},${d} ${f},${m} ${r},${o}`,p,g,y,b]}function kM({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,a=n<e?n+o:n-o,l=Math.abs(r-t)/2,u=r<t?r+l:r-l;return[a,u,o,l]}function SJ({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:a="basic"}){if(a==="manual")return r;const l=o&&n?r+1e3:r,u=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return l+u}function _J({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const a=Vp(Um(e),Um(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const l={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return fd(l,zp(a))>0}const EJ=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,PJ=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),TJ=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||EJ;let o;return hM(e)?o={...e}:o={...e,id:r(e)},PJ(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function SM({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,a,l,u]=kM({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,a,l,u]}const YS={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}},MJ=({source:e,sourcePosition:t=Be.Bottom,target:n})=>t===Be.Left||t===Be.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},QS=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function AJ({source:e,sourcePosition:t=Be.Bottom,target:n,targetPosition:r=Be.Top,center:o,offset:a,stepPosition:l}){const u=YS[t],d=YS[r],f={x:e.x+u.x*a,y:e.y+u.y*a},m={x:n.x+d.x*a,y:n.y+d.y*a},p=MJ({source:f,sourcePosition:t,target:m}),g=p.x!==0?"x":"y",y=p[g];let b=[],w,N;const k={x:0,y:0},j={x:0,y:0},[,,C,S]=kM({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[g]*d[g]===-1){g==="x"?(w=o.x??f.x+(m.x-f.x)*l,N=o.y??(f.y+m.y)/2):(w=o.x??(f.x+m.x)/2,N=o.y??f.y+(m.y-f.y)*l);const I=[{x:w,y:f.y},{x:w,y:m.y}],z=[{x:f.x,y:N},{x:m.x,y:N}];u[g]===y?b=g==="x"?I:z:b=g==="x"?z:I}else{const I=[{x:f.x,y:m.y}],z=[{x:m.x,y:f.y}];if(g==="x"?b=u.x===y?z:I:b=u.y===y?I:z,t===r){const R=Math.abs(e[g]-n[g]);if(R<=a){const M=Math.min(a-1,a-R);u[g]===y?k[g]=(f[g]>e[g]?-1:1)*M:j[g]=(m[g]>n[g]?-1:1)*M}}if(t!==r){const R=g==="x"?"y":"x",M=u[g]===d[R],F=f[R]>m[R],L=f[R]<m[R];(u[g]===1&&(!M&&F||M&&L)||u[g]!==1&&(!M&&L||M&&F))&&(b=g==="x"?I:z)}const K={x:f.x+k.x,y:f.y+k.y},q={x:m.x+j.x,y:m.y+j.y},H=Math.max(Math.abs(K.x-b[0].x),Math.abs(q.x-b[0].x)),B=Math.max(Math.abs(K.y-b[0].y),Math.abs(q.y-b[0].y));H>=B?(w=(K.x+q.x)/2,N=b[0].y):(w=b[0].x,N=(K.y+q.y)/2)}const E={x:f.x+k.x,y:f.y+k.y},P={x:m.x+j.x,y:m.y+j.y};return[[e,...E.x!==b[0].x||E.y!==b[0].y?[E]:[],...b,...P.x!==b[b.length-1].x||P.y!==b[b.length-1].y?[P]:[],n],w,N,C,S]}function DJ(e,t,n,r){const o=Math.min(QS(e,t)/2,QS(t,n)/2,r),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const f=e.x<n.x?-1:1,m=e.y<n.y?1:-1;return`L ${a+o*f},${l}Q ${a},${l} ${a},${l+o*m}`}const u=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${a},${l+o*d}Q ${a},${l} ${a+o*u},${l}`}function T0({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:o,targetPosition:a=Be.Top,borderRadius:l=5,centerX:u,centerY:d,offset:f=20,stepPosition:m=.5}){const[p,g,y,b,w]=AJ({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:a,center:{x:u,y:d},offset:f,stepPosition:m});let N=`M${p[0].x} ${p[0].y}`;for(let k=1;k<p.length-1;k++)N+=DJ(p[k-1],p[k],p[k+1],l);return N+=`L${p[p.length-1].x} ${p[p.length-1].y}`,[N,g,y,b,w]}function GS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function RJ(e){var p;const{sourceNode:t,targetNode:n}=e;if(!GS(t)||!GS(n))return null;const r=t.internals.handleBounds||XS(t.handles),o=n.internals.handleBounds||XS(n.handles),a=ZS((r==null?void 0:r.source)??[],e.sourceHandle),l=ZS(e.connectionMode===dc.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!a||!l)return(p=e.onError)==null||p.call(e,"008",Hs.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const u=(a==null?void 0:a.position)||Be.Bottom,d=(l==null?void 0:l.position)||Be.Top,f=Bi(t,a,u),m=Bi(n,l,d);return{sourceX:f.x,sourceY:f.y,targetX:m.x,targetY:m.y,sourcePosition:u,targetPosition:d}}function XS(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Bi(e,t,n=Be.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,a=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:l,height:u}=t??Co(e);if(r)return{x:o+l/2,y:a+u/2};switch((t==null?void 0:t.position)??n){case Be.Top:return{x:o+l/2,y:a};case Be.Right:return{x:o+l,y:a+u/2};case Be.Bottom:return{x:o+l/2,y:a+u};case Be.Left:return{x:o,y:a+u/2}}}function ZS(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function M0(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function OJ(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const a=new Set;return e.reduce((l,u)=>([u.markerStart||r,u.markerEnd||o].forEach(d=>{if(d&&typeof d=="object"){const f=M0(d,t);a.has(f)||(l.push({id:f,color:d.color||n,...d}),a.add(f))}}),l),[]).sort((l,u)=>l.id.localeCompare(u.id))}const _M=1e3,IJ=10,Qw={nodeOrigin:[0,0],nodeExtent:ud,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},LJ={...Qw,checkEquality:!0};function Gw(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function FJ(e,t,n){const r=Gw(Qw,n);for(const o of e.values())if(o.parentId)Zw(o,e,t,r);else{const a=Hd(o,r.nodeOrigin),l=mc(o.extent)?o.extent:r.nodeExtent,u=zi(a,l,Co(o));o.internals.positionAbsolute=u}}function $J(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const a={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(a):o.type==="target"&&r.push(a)}return{source:n,target:r}}function Xw(e){return e==="manual"}function A0(e,t,n,r={}){var m,p;const o=Gw(LJ,r),a={i:0},l=new Map(t),u=o!=null&&o.elevateNodesOnSelect&&!Xw(o.zIndexMode)?_M:0;let d=e.length>0,f=!1;t.clear(),n.clear();for(const g of e){let y=l.get(g.id);if(o.checkEquality&&g===(y==null?void 0:y.internals.userNode))t.set(g.id,y);else{const b=Hd(g,o.nodeOrigin),w=mc(g.extent)?g.extent:o.nodeExtent,N=zi(b,w,Co(g));y={...o.defaults,...g,measured:{width:(m=g.measured)==null?void 0:m.width,height:(p=g.measured)==null?void 0:p.height},internals:{positionAbsolute:N,handleBounds:$J(g,y),z:EM(g,u,o.zIndexMode),userNode:g}},t.set(g.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(d=!1),g.parentId&&Zw(y,t,n,r,a),f||(f=g.selected??!1)}return{nodesInitialized:d,hasSelectedNodes:f}}function VJ(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Zw(e,t,n,r,o){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u,zIndexMode:d}=Gw(Qw,r),f=e.parentId,m=t.get(f);if(!m){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}VJ(e,n),o&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++o.i,m.internals.z=m.internals.z+o.i*IJ),o&&m.internals.rootParentIndex!==void 0&&(o.i=m.internals.rootParentIndex);const p=a&&!Xw(d)?_M:0,{x:g,y,z:b}=zJ(e,m,l,u,p,d),{positionAbsolute:w}=e.internals,N=g!==w.x||y!==w.y;(N||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:N?{x:g,y}:w,z:b}})}function EM(e,t,n){const r=rs(e.zIndex)?e.zIndex:0;return Xw(n)?r:r+(e.selected?t:0)}function zJ(e,t,n,r,o,a){const{x:l,y:u}=t.internals.positionAbsolute,d=Co(e),f=Hd(e,n),m=mc(e.extent)?zi(f,e.extent,d):f;let p=zi({x:l+m.x,y:u+m.y},r,d);e.extent==="parent"&&(p=pM(p,d,t));const g=EM(e,o,a),y=t.internals.z??0;return{x:p.x,y:p.y,z:y>=g?y+1:g}}function Jw(e,t,n,r=[0,0]){var l;const o=[],a=new Map;for(const u of e){const d=t.get(u.parentId);if(!d)continue;const f=((l=a.get(u.parentId))==null?void 0:l.expandedRect)??hc(d),m=xM(f,u.rect);a.set(u.parentId,{expandedRect:m,parent:d})}return a.size>0&&a.forEach(({expandedRect:u,parent:d},f)=>{var C;const m=d.internals.positionAbsolute,p=Co(d),g=d.origin??r,y=u.x<m.x?Math.round(Math.abs(m.x-u.x)):0,b=u.y<m.y?Math.round(Math.abs(m.y-u.y)):0,w=Math.max(p.width,Math.round(u.width)),N=Math.max(p.height,Math.round(u.height)),k=(w-p.width)*g[0],j=(N-p.height)*g[1];(y>0||b>0||k||j)&&(o.push({id:f,type:"position",position:{x:d.position.x-y+k,y:d.position.y-b+j}}),(C=n.get(f))==null||C.forEach(S=>{e.some(E=>E.id===S.id)||o.push({id:S.id,type:"position",position:{x:S.position.x+y,y:S.position.y+b}})})),(p.width<u.width||p.height<u.height||y||b)&&o.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:w+(y?g[0]*y-k:0),height:N+(b?g[1]*b-j:0)}})}),o}function BJ(e,t,n,r,o,a,l){const u=r==null?void 0:r.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const f=[],m=window.getComputedStyle(u),{m22:p}=new window.DOMMatrixReadOnly(m.transform),g=[];for(const y of e.values()){const b=t.get(y.id);if(!b)continue;if(b.hidden){t.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),d=!0;continue}const w=Yw(y.nodeElement),N=b.measured.width!==w.width||b.measured.height!==w.height;if(!!(w.width&&w.height&&(N||!b.internals.handleBounds||y.force))){const j=y.nodeElement.getBoundingClientRect(),C=mc(b.extent)?b.extent:a;let{positionAbsolute:S}=b.internals;b.parentId&&b.extent==="parent"?S=pM(S,w,t.get(b.parentId)):C&&(S=zi(S,C,w));const E={...b,measured:w,internals:{...b.internals,positionAbsolute:S,handleBounds:{source:qS("source",y.nodeElement,j,p,b.id),target:qS("target",y.nodeElement,j,p,b.id)}}};t.set(b.id,E),b.parentId&&Zw(E,t,n,{nodeOrigin:o,zIndexMode:l}),d=!0,N&&(f.push({id:b.id,type:"dimensions",dimensions:w}),b.expandParent&&b.parentId&&g.push({id:b.id,parentId:b.parentId,rect:hc(E,o)}))}}if(g.length>0){const y=Jw(g,t,n,o);f.push(...y)}return{changes:f,updatedInternals:d}}async function WJ({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,a]],r),u=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(u)}function JS(e,t,n,r,o,a){let l=o;const u=r.get(l)||new Map;r.set(l,u.set(n,t)),l=`${o}-${e}`;const d=r.get(l)||new Map;if(r.set(l,d.set(n,t)),a){l=`${o}-${e}-${a}`;const f=r.get(l)||new Map;r.set(l,f.set(n,t))}}function PM(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:a,sourceHandle:l=null,targetHandle:u=null}=r,d={edgeId:r.id,source:o,target:a,sourceHandle:l,targetHandle:u},f=`${o}-${l}--${a}-${u}`,m=`${a}-${u}--${o}-${l}`;JS("source",d,m,e,o,l),JS("target",d,f,e,a,u),t.set(r.id,r)}}function TM(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:TM(n,t):!1}function e2(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function HJ(e,t,n,r){const o=new Map;for(const[a,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!TM(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const u=e.get(a);u&&o.set(a,{id:a,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return o}function Ky({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var l,u,d;const o=[];for(const[f,m]of t){const p=(l=n.get(f))==null?void 0:l.internals.userNode;p&&o.push({...p,position:m.position,dragging:r})}if(!e)return[o[0],o];const a=(u=n.get(e))==null?void 0:u.internals.userNode;return[a?{...a,position:((d=t.get(e))==null?void 0:d.position)||a.position,dragging:r}:o[0],o]}function UJ({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const a={x:n-o.distance.x,y:r-o.distance.y},l=qd(a,t);return{x:l.x-a.x,y:l.y-a.y}}function qJ({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let a={x:null,y:null},l=0,u=new Map,d=!1,f={x:0,y:0},m=null,p=!1,g=null,y=!1,b=!1,w=null;function N({noDragClassName:j,handleSelector:C,domNode:S,isSelectable:E,nodeId:P,nodeClickDistance:D=0}){g=pr(S);function I({x:H,y:B}){const{nodeLookup:R,nodeExtent:M,snapGrid:F,snapToGrid:L,nodeOrigin:A,onNodeDrag:O,onSelectionDrag:U,onError:V,updateNodePositions:$}=t();a={x:H,y:B};let Y=!1;const X=u.size>1,ne=X&&M?P0(Ud(u)):null,ie=X&&L?UJ({dragItems:u,snapGrid:F,x:H,y:B}):null;for(const[J,re]of u){if(!R.has(J))continue;let ce={x:H-re.distance.x,y:B-re.distance.y};L&&(ce=ie?{x:Math.round(ce.x+ie.x),y:Math.round(ce.y+ie.y)}:qd(ce,F));let fe=null;if(X&&M&&!re.extent&&ne){const{positionAbsolute:Ne}=re.internals,Oe=Ne.x-ne.x+M[0][0],Xe=Ne.x+re.measured.width-ne.x2+M[1][0],Le=Ne.y-ne.y+M[0][1],st=Ne.y+re.measured.height-ne.y2+M[1][1];fe=[[Oe,Le],[Xe,st]]}const{position:pe,positionAbsolute:ye}=mM({nodeId:J,nextPosition:ce,nodeLookup:R,nodeExtent:fe||M,nodeOrigin:A,onError:V});Y=Y||re.position.x!==pe.x||re.position.y!==pe.y,re.position=pe,re.internals.positionAbsolute=ye}if(b=b||Y,!!Y&&($(u,!0),w&&(r||O||!P&&U))){const[J,re]=Ky({nodeId:P,dragItems:u,nodeLookup:R});r==null||r(w,u,J,re),O==null||O(w,J,re),P||U==null||U(w,re)}}async function z(){if(!m)return;const{transform:H,panBy:B,autoPanSpeed:R,autoPanOnNodeDrag:M}=t();if(!M){d=!1,cancelAnimationFrame(l);return}const[F,L]=gM(f,m,R);(F!==0||L!==0)&&(a.x=(a.x??0)-F/H[2],a.y=(a.y??0)-L/H[2],await B({x:F,y:L})&&I(a)),l=requestAnimationFrame(z)}function K(H){var X;const{nodeLookup:B,multiSelectionActive:R,nodesDraggable:M,transform:F,snapGrid:L,snapToGrid:A,selectNodesOnDrag:O,onNodeDragStart:U,onSelectionDragStart:V,unselectNodesAndEdges:$}=t();p=!0,(!O||!E)&&!R&&P&&((X=B.get(P))!=null&&X.selected||$()),E&&O&&P&&(e==null||e(P));const Y=Hu(H.sourceEvent,{transform:F,snapGrid:L,snapToGrid:A,containerBounds:m});if(a=Y,u=HJ(B,M,Y,P),u.size>0&&(n||U||!P&&V)){const[ne,ie]=Ky({nodeId:P,dragItems:u,nodeLookup:B});n==null||n(H.sourceEvent,u,ne,ie),U==null||U(H.sourceEvent,ne,ie),P||V==null||V(H.sourceEvent,ie)}}const q=KT().clickDistance(D).on("start",H=>{const{domNode:B,nodeDragThreshold:R,transform:M,snapGrid:F,snapToGrid:L}=t();m=(B==null?void 0:B.getBoundingClientRect())||null,y=!1,b=!1,w=H.sourceEvent,R===0&&K(H),a=Hu(H.sourceEvent,{transform:M,snapGrid:F,snapToGrid:L,containerBounds:m}),f=ss(H.sourceEvent,m)}).on("drag",H=>{const{autoPanOnNodeDrag:B,transform:R,snapGrid:M,snapToGrid:F,nodeDragThreshold:L,nodeLookup:A}=t(),O=Hu(H.sourceEvent,{transform:R,snapGrid:M,snapToGrid:F,containerBounds:m});if(w=H.sourceEvent,(H.sourceEvent.type==="touchmove"&&H.sourceEvent.touches.length>1||P&&!A.has(P))&&(y=!0),!y){if(!d&&B&&p&&(d=!0,z()),!p){const U=ss(H.sourceEvent,m),V=U.x-f.x,$=U.y-f.y;Math.sqrt(V*V+$*$)>L&&K(H)}(a.x!==O.xSnapped||a.y!==O.ySnapped)&&u&&p&&(f=ss(H.sourceEvent,m),I(O))}}).on("end",H=>{if(!(!p||y)&&(d=!1,p=!1,cancelAnimationFrame(l),u.size>0)){const{nodeLookup:B,updateNodePositions:R,onNodeDragStop:M,onSelectionDragStop:F}=t();if(b&&(R(u,!1),b=!1),o||M||!P&&F){const[L,A]=Ky({nodeId:P,dragItems:u,nodeLookup:B,dragging:!1});o==null||o(H.sourceEvent,u,L,A),M==null||M(H.sourceEvent,L,A),P||F==null||F(H.sourceEvent,A)}}}).filter(H=>{const B=H.target;return!H.button&&(!j||!e2(B,`.${j}`,S))&&(!C||e2(B,C,S))});g.call(q)}function k(){g==null||g.on(".drag",null)}return{update:N,destroy:k}}function KJ(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())fd(o,hc(a))>0&&r.push(a);return r}const YJ=250;function QJ(e,t,n,r){var u,d;let o=[],a=1/0;const l=KJ(e,n,t+YJ);for(const f of l){const m=[...((u=f.internals.handleBounds)==null?void 0:u.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const p of m){if(r.nodeId===p.nodeId&&r.type===p.type&&r.id===p.id)continue;const{x:g,y}=Bi(f,p,p.position,!0),b=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(y-e.y,2));b>t||(b<a?(o=[{...p,x:g,y}],a=b):b===a&&o.push({...p,x:g,y}))}}if(!o.length)return null;if(o.length>1){const f=r.type==="source"?"target":"source";return o.find(m=>m.type===f)??o[0]}return o[0]}function MM(e,t,n,r,o,a=!1){var f,m,p;const l=r.get(e);if(!l)return null;const u=o==="strict"?(f=l.internals.handleBounds)==null?void 0:f[t]:[...((m=l.internals.handleBounds)==null?void 0:m.source)??[],...((p=l.internals.handleBounds)==null?void 0:p.target)??[]],d=(n?u==null?void 0:u.find(g=>g.id===n):u==null?void 0:u[0])??null;return d&&a?{...d,...Bi(l,d,d.position,!0)}:d}function AM(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function GJ(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const DM=()=>!0;function XJ(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:a,isTarget:l,domNode:u,nodeLookup:d,lib:f,autoPanOnConnect:m,flowId:p,panBy:g,cancelConnection:y,onConnectStart:b,onConnect:w,onConnectEnd:N,isValidConnection:k=DM,onReconnectEnd:j,updateConnection:C,getTransform:S,getFromHandle:E,autoPanSpeed:P,dragThreshold:D=1,handleDomNode:I}){const z=bM(e.target);let K=0,q;const{x:H,y:B}=ss(e),R=AM(a,I),M=u==null?void 0:u.getBoundingClientRect();let F=!1;if(!M||!R)return;const L=MM(o,R,r,d,t);if(!L)return;let A=ss(e,M),O=!1,U=null,V=!1,$=null;function Y(){if(!m||!M)return;const[pe,ye]=gM(A,M,P);g({x:pe,y:ye}),K=requestAnimationFrame(Y)}const X={...L,nodeId:o,type:R,position:L.position},ne=d.get(o);let J={inProgress:!0,isValid:null,from:Bi(ne,X,Be.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ne,to:A,toHandle:null,toPosition:BS[X.position],toNode:null,pointer:A};function re(){F=!0,C(J),b==null||b(e,{nodeId:o,handleId:r,handleType:R})}D===0&&re();function ce(pe){if(!F){const{x:st,y:Nt}=ss(pe),ge=st-H,De=Nt-B;if(!(ge*ge+De*De>D*D))return;re()}if(!E()||!X){fe(pe);return}const ye=S();A=ss(pe,M),q=QJ(Kd(A,ye,!1,[1,1]),n,d,X),O||(Y(),O=!0);const Ne=RM(pe,{handle:q,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:l?"target":"source",isValidConnection:k,doc:z,lib:f,flowId:p,nodeLookup:d});$=Ne.handleDomNode,U=Ne.connection,V=GJ(!!q,Ne.isValid);const Oe=d.get(o),Xe=Oe?Bi(Oe,X,Be.Left,!0):J.from,Le={...J,from:Xe,isValid:V,to:Ne.toHandle&&V?qm({x:Ne.toHandle.x,y:Ne.toHandle.y},ye):A,toHandle:Ne.toHandle,toPosition:V&&Ne.toHandle?Ne.toHandle.position:BS[X.position],toNode:Ne.toHandle?d.get(Ne.toHandle.nodeId):null,pointer:A};C(Le),J=Le}function fe(pe){if(!("touches"in pe&&pe.touches.length>0)){if(F){(q||$)&&U&&V&&(w==null||w(U));const{inProgress:ye,...Ne}=J,Oe={...Ne,toPosition:J.toHandle?J.toPosition:null};N==null||N(pe,Oe),a&&(j==null||j(pe,Oe))}y(),cancelAnimationFrame(K),O=!1,V=!1,U=null,$=null,z.removeEventListener("mousemove",ce),z.removeEventListener("mouseup",fe),z.removeEventListener("touchmove",ce),z.removeEventListener("touchend",fe)}}z.addEventListener("mousemove",ce),z.addEventListener("mouseup",fe),z.addEventListener("touchmove",ce),z.addEventListener("touchend",fe)}function RM(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:a,doc:l,lib:u,flowId:d,isValidConnection:f=DM,nodeLookup:m}){const p=a==="target",g=t?l.querySelector(`.${u}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:b}=ss(e),w=l.elementFromPoint(y,b),N=w!=null&&w.classList.contains(`${u}-flow__handle`)?w:g,k={handleDomNode:N,isValid:!1,connection:null,toHandle:null};if(N){const j=AM(void 0,N),C=N.getAttribute("data-nodeid"),S=N.getAttribute("data-handleid"),E=N.classList.contains("connectable"),P=N.classList.contains("connectableend");if(!C||!j)return k;const D={source:p?C:r,sourceHandle:p?S:o,target:p?r:C,targetHandle:p?o:S};k.connection=D;const z=E&&P&&(n===dc.Strict?p&&j==="source"||!p&&j==="target":C!==r||S!==o);k.isValid=z&&f(D),k.toHandle=MM(C,j,S,m,n,!0)}return k}const D0={onPointerDown:XJ,isValid:RM};function ZJ({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=pr(e);function a({translateExtent:u,width:d,height:f,zoomStep:m=1,pannable:p=!0,zoomable:g=!0,inversePan:y=!1}){const b=C=>{if(C.sourceEvent.type!=="wheel"||!t)return;const S=n(),E=C.sourceEvent.ctrlKey&&hd()?10:1,P=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*m,D=S[2]*Math.pow(2,P*E);t.scaleTo(D)};let w=[0,0];const N=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(w=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},k=C=>{const S=n();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!t)return;const E=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],P=[E[0]-w[0],E[1]-w[1]];w=E;const D=r()*Math.max(S[2],Math.log(S[2]))*(y?-1:1),I={x:S[0]-P[0]*D,y:S[1]-P[1]*D},z=[[0,0],[d,f]];t.setViewportConstrained({x:I.x,y:I.y,zoom:S[2]},z,u)},j=lM().on("start",N).on("zoom",p?k:null).on("zoom.wheel",g?b:null);o.call(j,{})}function l(){o.on("zoom",null)}return{update:a,destroy:l,pointer:ts}}const Bp=e=>({x:e.x,y:e.y,zoom:e.k}),Yy=({x:e,y:t,zoom:n})=>$p.translate(e,t).scale(n),Rl=(e,t)=>e.target.closest(`.${t}`),OM=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),JJ=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Qy=(e,t=0,n=JJ,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},IM=e=>{const t=e.ctrlKey&&hd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function eee({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:l,onPanZoomStart:u,onPanZoom:d,onPanZoomEnd:f}){return m=>{if(Rl(m,t))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=n.property("__zoom").k||1;if(m.ctrlKey&&l){const N=ts(m),k=IM(m),j=p*Math.pow(2,k);r.scaleTo(n,j,N,m);return}const g=m.deltaMode===1?20:1;let y=o===Pi.Vertical?0:m.deltaX*g,b=o===Pi.Horizontal?0:m.deltaY*g;!hd()&&m.shiftKey&&o!==Pi.Vertical&&(y=m.deltaY*g,b=0),r.translateBy(n,-(y/p)*a,-(b/p)*a,{internal:!0});const w=Bp(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(m,w),e.panScrollTimeout=setTimeout(()=>{f==null||f(m,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,u==null||u(m,w))}}function tee({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const a=r.type==="wheel",l=!t&&a&&!r.ctrlKey,u=Rl(r,e);if(r.ctrlKey&&a&&u&&r.preventDefault(),l||u)return null;r.preventDefault(),n.call(this,r,o)}}function nee({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var a,l,u;if((a=r.sourceEvent)!=null&&a.internal)return;const o=Bp(r.transform);e.mouseButton=((l=r.sourceEvent)==null?void 0:l.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((u=r.sourceEvent)==null?void 0:u.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function ree({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return a=>{var l,u;e.usedRightMouseButton=!!(n&&OM(t,e.mouseButton??0)),(l=a.sourceEvent)!=null&&l.sync||r([a.transform.x,a.transform.y,a.transform.k]),o&&!((u=a.sourceEvent)!=null&&u.internal)&&(o==null||o(a.sourceEvent,Bp(a.transform)))}}function see({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:a}){return l=>{var u;if(!((u=l.sourceEvent)!=null&&u.internal)&&(e.isZoomingOrPanning=!1,a&&OM(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&a(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const d=Bp(l.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(l.sourceEvent,d)},n?150:0)}}}function oee({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:l,noWheelClassName:u,noPanClassName:d,lib:f,connectionInProgress:m}){return p=>{var N;const g=e||t,y=n&&p.ctrlKey,b=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(Rl(p,`${f}-flow__node`)||Rl(p,`${f}-flow__edge`)))return!0;if(!r&&!g&&!o&&!a&&!n||l||m&&!b||Rl(p,u)&&b||Rl(p,d)&&(!b||o&&b&&!e)||!n&&p.ctrlKey&&b)return!1;if(!n&&p.type==="touchstart"&&((N=p.touches)==null?void 0:N.length)>1)return p.preventDefault(),!1;if(!g&&!o&&!y&&b||!r&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(r)&&!r.includes(p.button)&&p.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||b)&&w}}function aee({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:u,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=lM().scaleExtent([t,n]).translateExtent(r),g=pr(e).call(p);j({x:o.x,y:o.y,zoom:fc(o.zoom,t,n)},[[0,0],[m.width,m.height]],r);const y=g.on("wheel.zoom"),b=g.on("dblclick.zoom");p.wheelDelta(IM);function w(q,H){return g?new Promise(B=>{p==null||p.interpolate((H==null?void 0:H.interpolate)==="linear"?Wu:tm).transform(Qy(g,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>B(!0)),q)}):Promise.resolve(!1)}function N({noWheelClassName:q,noPanClassName:H,onPaneContextMenu:B,userSelectionActive:R,panOnScroll:M,panOnDrag:F,panOnScrollMode:L,panOnScrollSpeed:A,preventScrolling:O,zoomOnPinch:U,zoomOnScroll:V,zoomOnDoubleClick:$,zoomActivationKeyPressed:Y,lib:X,onTransformChange:ne,connectionInProgress:ie,paneClickDistance:J,selectionOnDrag:re}){R&&!f.isZoomingOrPanning&&k();const ce=M&&!Y&&!R;p.clickDistance(re?1/0:!rs(J)||J<0?0:J);const fe=ce?eee({zoomPanValues:f,noWheelClassName:q,d3Selection:g,d3Zoom:p,panOnScrollMode:L,panOnScrollSpeed:A,zoomOnPinch:U,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:u}):tee({noWheelClassName:q,preventScrolling:O,d3ZoomHandler:y});if(g.on("wheel.zoom",fe,{passive:!1}),!R){const ye=nee({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});p.on("start",ye);const Ne=ree({zoomPanValues:f,panOnDrag:F,onPaneContextMenu:!!B,onPanZoom:a,onTransformChange:ne});p.on("zoom",Ne);const Oe=see({zoomPanValues:f,panOnDrag:F,panOnScroll:M,onPaneContextMenu:B,onPanZoomEnd:u,onDraggingChange:d});p.on("end",Oe)}const pe=oee({zoomActivationKeyPressed:Y,panOnDrag:F,zoomOnScroll:V,panOnScroll:M,zoomOnDoubleClick:$,zoomOnPinch:U,userSelectionActive:R,noPanClassName:H,noWheelClassName:q,lib:X,connectionInProgress:ie});p.filter(pe),$?g.on("dblclick.zoom",b):g.on("dblclick.zoom",null)}function k(){p.on("zoom",null)}async function j(q,H,B){const R=Yy(q),M=p==null?void 0:p.constrain()(R,H,B);return M&&await w(M),new Promise(F=>F(M))}async function C(q,H){const B=Yy(q);return await w(B,H),new Promise(R=>R(B))}function S(q){if(g){const H=Yy(q),B=g.property("__zoom");(B.k!==q.zoom||B.x!==q.x||B.y!==q.y)&&(p==null||p.transform(g,H,null,{sync:!0}))}}function E(){const q=g?iM(g.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function P(q,H){return g?new Promise(B=>{p==null||p.interpolate((H==null?void 0:H.interpolate)==="linear"?Wu:tm).scaleTo(Qy(g,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>B(!0)),q)}):Promise.resolve(!1)}function D(q,H){return g?new Promise(B=>{p==null||p.interpolate((H==null?void 0:H.interpolate)==="linear"?Wu:tm).scaleBy(Qy(g,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>B(!0)),q)}):Promise.resolve(!1)}function I(q){p==null||p.scaleExtent(q)}function z(q){p==null||p.translateExtent(q)}function K(q){const H=!rs(q)||q<0?0:q;p==null||p.clickDistance(H)}return{update:N,destroy:k,setViewport:C,setViewportConstrained:j,getViewport:E,scaleTo:P,scaleBy:D,setScaleExtent:I,setTranslateExtent:z,syncViewport:S,setClickDistance:K}}var pc;(function(e){e.Line="line",e.Handle="handle"})(pc||(pc={}));function iee({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:a}){const l=e-t,u=n-r,d=[l>0?1:l<0?-1:0,u>0?1:u<0?-1:0];return l&&o&&(d[0]=d[0]*-1),u&&a&&(d[1]=d[1]*-1),d}function t2(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Yo(e,t){return Math.max(0,t-e)}function Qo(e,t){return Math.max(0,e-t)}function Eh(e,t,n){return Math.max(0,t-e,e-n)}function n2(e,t){return e?!t:t}function lee(e,t,n,r,o,a,l,u){let{affectsX:d,affectsY:f}=t;const{isHorizontal:m,isVertical:p}=t,g=m&&p,{xSnapped:y,ySnapped:b}=n,{minWidth:w,maxWidth:N,minHeight:k,maxHeight:j}=r,{x:C,y:S,width:E,height:P,aspectRatio:D}=e;let I=Math.floor(m?y-e.pointerX:0),z=Math.floor(p?b-e.pointerY:0);const K=E+(d?-I:I),q=P+(f?-z:z),H=-a[0]*E,B=-a[1]*P;let R=Eh(K,w,N),M=Eh(q,k,j);if(l){let A=0,O=0;d&&I<0?A=Yo(C+I+H,l[0][0]):!d&&I>0&&(A=Qo(C+K+H,l[1][0])),f&&z<0?O=Yo(S+z+B,l[0][1]):!f&&z>0&&(O=Qo(S+q+B,l[1][1])),R=Math.max(R,A),M=Math.max(M,O)}if(u){let A=0,O=0;d&&I>0?A=Qo(C+I,u[0][0]):!d&&I<0&&(A=Yo(C+K,u[1][0])),f&&z>0?O=Qo(S+z,u[0][1]):!f&&z<0&&(O=Yo(S+q,u[1][1])),R=Math.max(R,A),M=Math.max(M,O)}if(o){if(m){const A=Eh(K/D,k,j)*D;if(R=Math.max(R,A),l){let O=0;!d&&!f||d&&!f&&g?O=Qo(S+B+K/D,l[1][1])*D:O=Yo(S+B+(d?I:-I)/D,l[0][1])*D,R=Math.max(R,O)}if(u){let O=0;!d&&!f||d&&!f&&g?O=Yo(S+K/D,u[1][1])*D:O=Qo(S+(d?I:-I)/D,u[0][1])*D,R=Math.max(R,O)}}if(p){const A=Eh(q*D,w,N)/D;if(M=Math.max(M,A),l){let O=0;!d&&!f||f&&!d&&g?O=Qo(C+q*D+H,l[1][0])/D:O=Yo(C+(f?z:-z)*D+H,l[0][0])/D,M=Math.max(M,O)}if(u){let O=0;!d&&!f||f&&!d&&g?O=Yo(C+q*D,u[1][0])/D:O=Qo(C+(f?z:-z)*D,u[0][0])/D,M=Math.max(M,O)}}}z=z+(z<0?M:-M),I=I+(I<0?R:-R),o&&(g?K>q*D?z=(n2(d,f)?-I:I)/D:I=(n2(d,f)?-z:z)*D:m?(z=I/D,f=d):(I=z*D,d=f));const F=d?C+I:C,L=f?S+z:S;return{width:E+(d?-I:I),height:P+(f?-z:z),x:a[0]*I*(d?-1:1)+F,y:a[1]*z*(f?-1:1)+L}}const LM={width:0,height:0,x:0,y:0},cee={...LM,pointerX:0,pointerY:0,aspectRatio:1};function uee(e){return[[0,0],[e.measured.width,e.measured.height]]}function dee(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,a=e.measured.width??0,l=e.measured.height??0,u=n[0]*a,d=n[1]*l;return[[r-u,o-d],[r+a-u,o+l-d]]}function fee({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const a=pr(e);let l={controlDirection:t2("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:f,boundaries:m,keepAspectRatio:p,resizeDirection:g,onResizeStart:y,onResize:b,onResizeEnd:w,shouldResize:N}){let k={...LM},j={...cee};l={boundaries:m,resizeDirection:g,keepAspectRatio:p,controlDirection:t2(f)};let C,S=null,E=[],P,D,I,z=!1;const K=KT().on("start",q=>{const{nodeLookup:H,transform:B,snapGrid:R,snapToGrid:M,nodeOrigin:F,paneDomNode:L}=n();if(C=H.get(t),!C)return;S=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:O}=Hu(q.sourceEvent,{transform:B,snapGrid:R,snapToGrid:M,containerBounds:S});k={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},j={...k,pointerX:A,pointerY:O,aspectRatio:k.width/k.height},P=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(P=H.get(C.parentId),D=P&&C.extent==="parent"?uee(P):void 0),E=[],I=void 0;for(const[U,V]of H)if(V.parentId===t&&(E.push({id:U,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const $=dee(V,C,V.origin??F);I?I=[[Math.min($[0][0],I[0][0]),Math.min($[0][1],I[0][1])],[Math.max($[1][0],I[1][0]),Math.max($[1][1],I[1][1])]]:I=$}y==null||y(q,{...k})}).on("drag",q=>{const{transform:H,snapGrid:B,snapToGrid:R,nodeOrigin:M}=n(),F=Hu(q.sourceEvent,{transform:H,snapGrid:B,snapToGrid:R,containerBounds:S}),L=[];if(!C)return;const{x:A,y:O,width:U,height:V}=k,$={},Y=C.origin??M,{width:X,height:ne,x:ie,y:J}=lee(j,l.controlDirection,F,l.boundaries,l.keepAspectRatio,Y,D,I),re=X!==U,ce=ne!==V,fe=ie!==A&&re,pe=J!==O&&ce;if(!fe&&!pe&&!re&&!ce)return;if((fe||pe||Y[0]===1||Y[1]===1)&&($.x=fe?ie:k.x,$.y=pe?J:k.y,k.x=$.x,k.y=$.y,E.length>0)){const Xe=ie-A,Le=J-O;for(const st of E)st.position={x:st.position.x-Xe+Y[0]*(X-U),y:st.position.y-Le+Y[1]*(ne-V)},L.push(st)}if((re||ce)&&($.width=re&&(!l.resizeDirection||l.resizeDirection==="horizontal")?X:k.width,$.height=ce&&(!l.resizeDirection||l.resizeDirection==="vertical")?ne:k.height,k.width=$.width,k.height=$.height),P&&C.expandParent){const Xe=Y[0]*($.width??0);$.x&&$.x<Xe&&(k.x=Xe,j.x=j.x-($.x-Xe));const Le=Y[1]*($.height??0);$.y&&$.y<Le&&(k.y=Le,j.y=j.y-($.y-Le))}const ye=iee({width:k.width,prevWidth:U,height:k.height,prevHeight:V,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),Ne={...k,direction:ye};(N==null?void 0:N(q,Ne))!==!1&&(z=!0,b==null||b(q,Ne),r($,L))}).on("end",q=>{z&&(w==null||w(q,{...k}),o==null||o({...k}),z=!1)});a.call(K)}function d(){a.on(".drag",null)}return{update:u,destroy:d}}var Gy={exports:{}},Xy={},Zy={exports:{}},Jy={};/**
|
|
613
|
+
* @license React
|
|
614
|
+
* use-sync-external-store-shim.production.js
|
|
615
|
+
*
|
|
616
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
617
|
+
*
|
|
618
|
+
* This source code is licensed under the MIT license found in the
|
|
619
|
+
* LICENSE file in the root directory of this source tree.
|
|
620
|
+
*/var r2;function hee(){if(r2)return Jy;r2=1;var e=jd();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(p,g){var y=g(),b=r({inst:{value:y,getSnapshot:g}}),w=b[0].inst,N=b[1];return a(function(){w.value=y,w.getSnapshot=g,d(w)&&N({inst:w})},[p,y,g]),o(function(){return d(w)&&N({inst:w}),p(function(){d(w)&&N({inst:w})})},[p]),l(y),y}function d(p){var g=p.getSnapshot;p=p.value;try{var y=g();return!n(p,y)}catch{return!0}}function f(p,g){return g()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return Jy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Jy}var s2;function mee(){return s2||(s2=1,Zy.exports=hee()),Zy.exports}/**
|
|
621
|
+
* @license React
|
|
622
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
623
|
+
*
|
|
624
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
625
|
+
*
|
|
626
|
+
* This source code is licensed under the MIT license found in the
|
|
627
|
+
* LICENSE file in the root directory of this source tree.
|
|
628
|
+
*/var o2;function pee(){if(o2)return Xy;o2=1;var e=jd(),t=mee();function n(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return Xy.useSyncExternalStoreWithSelector=function(f,m,p,g,y){var b=a(null);if(b.current===null){var w={hasValue:!1,value:null};b.current=w}else w=b.current;b=u(function(){function k(P){if(!j){if(j=!0,C=P,P=g(P),y!==void 0&&w.hasValue){var D=w.value;if(y(D,P))return S=D}return S=P}if(D=S,r(C,P))return D;var I=g(P);return y!==void 0&&y(D,I)?(C=P,D):(C=P,S=I)}var j=!1,C,S,E=p===void 0?null:p;return[function(){return k(m())},E===null?void 0:function(){return k(E())}]},[m,p,g,y]);var N=o(f,b[0],b[1]);return l(function(){w.hasValue=!0,w.value=N},[N]),d(N),N},Xy}var a2;function gee(){return a2||(a2=1,Gy.exports=pee()),Gy.exports}var xee=gee();const yee=Jm(xee),vee={},i2=e=>{let t;const n=new Set,r=(m,p)=>{const g=typeof m=="function"?m(t):m;if(!Object.is(g,t)){const y=t;t=p??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(b=>b(t,y))}},o=()=>t,d={setState:r,getState:o,getInitialState:()=>f,subscribe:m=>(n.add(m),()=>n.delete(m)),destroy:()=>{(vee?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,o,d);return d},bee=e=>e?i2(e):i2,{useDebugValue:wee}=be,{useSyncExternalStoreWithSelector:Nee}=yee,jee=e=>e;function FM(e,t=jee,n){const r=Nee(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wee(r),r}const l2=(e,t)=>{const n=bee(e),r=(o,a=t)=>FM(n,o,a);return Object.assign(r,n),r},Cee=(e,t)=>e?l2(e,t):l2;function Dt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Wp=x.createContext(null),kee=Wp.Provider,$M=Hs.error001();function ct(e,t){const n=x.useContext(Wp);if(n===null)throw new Error($M);return FM(n,e,t)}function Rt(){const e=x.useContext(Wp);if(e===null)throw new Error($M);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const c2={display:"none"},See={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},VM="react-flow__node-desc",zM="react-flow__edge-desc",_ee="react-flow__aria-live",Eee=e=>e.ariaLiveMessage,Pee=e=>e.ariaLabelConfig;function Tee({rfId:e}){const t=ct(Eee);return s.jsx("div",{id:`${_ee}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:See,children:t})}function Mee({rfId:e,disableKeyboardA11y:t}){const n=ct(Pee);return s.jsxs(s.Fragment,{children:[s.jsx("div",{id:`${VM}-${e}`,style:c2,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),s.jsx("div",{id:`${zM}-${e}`,style:c2,children:n["edge.a11yDescription.default"]}),!t&&s.jsx(Tee,{rfId:e})]})}const Hp=x.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},a)=>{const l=`${e}`.split("-");return s.jsx("div",{className:en(["react-flow__panel",n,...l]),style:r,ref:a,...o,children:t})});Hp.displayName="Panel";function Aee({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:s.jsx(Hp,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:s.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Dee=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Ph=e=>e.id;function Ree(e,t){return Dt(e.selectedNodes.map(Ph),t.selectedNodes.map(Ph))&&Dt(e.selectedEdges.map(Ph),t.selectedEdges.map(Ph))}function Oee({onSelectionChange:e}){const t=Rt(),{selectedNodes:n,selectedEdges:r}=ct(Dee,Ree);return x.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,r,e]),null}const Iee=e=>!!e.onSelectionChangeHandlers;function Lee({onSelectionChange:e}){const t=ct(Iee);return e||t?s.jsx(Oee,{onSelectionChange:e}):null}const R0=typeof window<"u"?x.useLayoutEffect:x.useEffect,BM=[0,0],Fee={x:0,y:0,zoom:1},$ee=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],u2=[...$ee,"rfId"],Vee=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),d2={translateExtent:ud,nodeOrigin:BM,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function zee(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:l,reset:u,setDefaultNodesAndEdges:d}=ct(Vee,Dt),f=Rt();R0(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=d2,u()}),[]);const m=x.useRef(d2);return R0(()=>{for(const p of u2){const g=e[p],y=m.current[p];g!==y&&(typeof e[p]>"u"||(p==="nodes"?t(g):p==="edges"?n(g):p==="minZoom"?r(g):p==="maxZoom"?o(g):p==="translateExtent"?a(g):p==="nodeExtent"?l(g):p==="ariaLabelConfig"?f.setState({ariaLabelConfig:CJ(g)}):p==="fitView"?f.setState({fitViewQueued:g}):p==="fitViewOptions"?f.setState({fitViewOptions:g}):f.setState({[p]:g})))}m.current=e},u2.map(p=>e[p])),null}function f2(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Bee(e){var r;const[t,n]=x.useState(e==="system"?null:e);return x.useEffect(()=>{if(e!=="system"){n(e);return}const o=f2(),a=()=>n(o!=null&&o.matches?"dark":"light");return a(),o==null||o.addEventListener("change",a),()=>{o==null||o.removeEventListener("change",a)}},[e]),t!==null?t:(r=f2())!=null&&r.matches?"dark":"light"}const h2=typeof document<"u"?document:null;function md(e=null,t={target:h2,actInsideInputWithModifier:!0}){const[n,r]=x.useState(!1),o=x.useRef(!1),a=x.useRef(new Set([])),[l,u]=x.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
|
|
629
|
+
`).replace(`
|
|
630
|
+
|
|
631
|
+
`,`
|
|
632
|
+
+`).split(`
|
|
633
|
+
`)),m=f.reduce((p,g)=>p.concat(...g),[]);return[f,m]}return[[],[]]},[e]);return x.useEffect(()=>{const d=(t==null?void 0:t.target)??h2,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const m=y=>{var N,k;if(o.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!o.current||o.current&&!f)&&wM(y))return!1;const w=p2(y.code,u);if(a.current.add(y[w]),m2(l,a.current,!1)){const j=((k=(N=y.composedPath)==null?void 0:N.call(y))==null?void 0:k[0])||y.target,C=(j==null?void 0:j.nodeName)==="BUTTON"||(j==null?void 0:j.nodeName)==="A";t.preventDefault!==!1&&(o.current||!C)&&y.preventDefault(),r(!0)}},p=y=>{const b=p2(y.code,u);m2(l,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(y[b]),y.key==="Meta"&&a.current.clear(),o.current=!1},g=()=>{a.current.clear(),r(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",p),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",p),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function m2(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function p2(e,t){return t.includes(e)?"code":"key"}const Wee=()=>{const e=Rt();return x.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,a],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:a,maxZoom:l,panZoom:u}=e.getState(),d=Kw(t,r,o,a,l,(n==null?void 0:n.padding)??.1);return u?(await u.setViewport(d,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:a,domNode:l}=e.getState();if(!l)return t;const{x:u,y:d}=l.getBoundingClientRect(),f={x:t.x-u,y:t.y-d},m=n.snapGrid??o,p=n.snapToGrid??a;return Kd(f,r,p,m)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:a}=r.getBoundingClientRect(),l=qm(t,n);return{x:l.x+o,y:l.y+a}}}),[])};function WM(e,t){const n=[],r=new Map,o=[];for(const a of e)if(a.type==="add"){o.push(a);continue}else if(a.type==="remove"||a.type==="replace")r.set(a.id,[a]);else{const l=r.get(a.id);l?l.push(a):r.set(a.id,[a])}for(const a of t){const l=r.get(a.id);if(!l){n.push(a);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const u={...a};for(const d of l)Hee(d,u);n.push(u)}return o.length&&o.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function Hee(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function HM(e,t){return WM(e,t)}function UM(e,t){return WM(e,t)}function ci(e,t){return{id:e,type:"select",selected:t}}function Ol(e,t=new Set,n=!1){const r=[];for(const[o,a]of e){const l=t.has(o);!(a.selected===void 0&&!l)&&a.selected!==l&&(n&&(a.selected=l),r.push(ci(a.id,l)))}return r}function g2({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,l]of e.entries()){const u=t.get(l.id),d=((o=u==null?void 0:u.internals)==null?void 0:o.userNode)??u;d!==void 0&&d!==l&&n.push({id:l.id,item:l,type:"replace"}),d===void 0&&n.push({item:l,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function x2(e){return{id:e.id,type:"remove"}}const y2=e=>mJ(e),Uee=e=>hM(e);function qM(e){return x.forwardRef(e)}function v2(e){const[t,n]=x.useState(BigInt(0)),[r]=x.useState(()=>qee(()=>n(o=>o+BigInt(1))));return R0(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function qee(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const KM=x.createContext(null);function Kee({children:e}){const t=Rt(),n=x.useCallback(u=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:m,onNodesChange:p,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:b}=t.getState();let w=d;for(const k of u)w=typeof k=="function"?k(w):k;let N=g2({items:w,lookup:g});for(const k of b.values())N=k(N);m&&f(w),N.length>0?p==null||p(N):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:k,nodes:j,setNodes:C}=t.getState();k&&C(j)})},[]),r=v2(n),o=x.useCallback(u=>{const{edges:d=[],setEdges:f,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:g}=t.getState();let y=d;for(const b of u)y=typeof b=="function"?b(y):b;m?f(y):p&&p(g2({items:y,lookup:g}))},[]),a=v2(o),l=x.useMemo(()=>({nodeQueue:r,edgeQueue:a}),[]);return s.jsx(KM.Provider,{value:l,children:e})}function Yee(){const e=x.useContext(KM);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Qee=e=>!!e.panZoom;function e1(){const e=Wee(),t=Rt(),n=Yee(),r=ct(Qee),o=x.useMemo(()=>{const a=p=>t.getState().nodeLookup.get(p),l=p=>{n.nodeQueue.push(p)},u=p=>{n.edgeQueue.push(p)},d=p=>{var k,j;const{nodeLookup:g,nodeOrigin:y}=t.getState(),b=y2(p)?p:g.get(p.id),w=b.parentId?vM(b.position,b.measured,b.parentId,g,y):b.position,N={...b,position:w,width:((k=b.measured)==null?void 0:k.width)??b.width,height:((j=b.measured)==null?void 0:j.height)??b.height};return hc(N)},f=(p,g,y={replace:!1})=>{l(b=>b.map(w=>{if(w.id===p){const N=typeof g=="function"?g(w):g;return y.replace&&y2(N)?N:{...w,...N}}return w}))},m=(p,g,y={replace:!1})=>{u(b=>b.map(w=>{if(w.id===p){const N=typeof g=="function"?g(w):g;return y.replace&&Uee(N)?N:{...w,...N}}return w}))};return{getNodes:()=>t.getState().nodes.map(p=>({...p})),getNode:p=>{var g;return(g=a(p))==null?void 0:g.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:p=[]}=t.getState();return p.map(g=>({...g}))},getEdge:p=>t.getState().edgeLookup.get(p),setNodes:l,setEdges:u,addNodes:p=>{const g=Array.isArray(p)?p:[p];n.nodeQueue.push(y=>[...y,...g])},addEdges:p=>{const g=Array.isArray(p)?p:[p];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:p=[],edges:g=[],transform:y}=t.getState(),[b,w,N]=y;return{nodes:p.map(k=>({...k})),edges:g.map(k=>({...k})),viewport:{x:b,y:w,zoom:N}}},deleteElements:async({nodes:p=[],edges:g=[]})=>{const{nodes:y,edges:b,onNodesDelete:w,onEdgesDelete:N,triggerNodeChanges:k,triggerEdgeChanges:j,onDelete:C,onBeforeDelete:S}=t.getState(),{nodes:E,edges:P}=await vJ({nodesToRemove:p,edgesToRemove:g,nodes:y,edges:b,onBeforeDelete:S}),D=P.length>0,I=E.length>0;if(D){const z=P.map(x2);N==null||N(P),j(z)}if(I){const z=E.map(x2);w==null||w(E),k(z)}return(I||D)&&(C==null||C({nodes:E,edges:P})),{deletedNodes:E,deletedEdges:P}},getIntersectingNodes:(p,g=!0,y)=>{const b=HS(p),w=b?p:d(p),N=y!==void 0;return w?(y||t.getState().nodes).filter(k=>{const j=t.getState().nodeLookup.get(k.id);if(j&&!b&&(k.id===p.id||!j.internals.positionAbsolute))return!1;const C=hc(N?k:j),S=fd(C,w);return g&&S>0||S>=C.width*C.height||S>=w.width*w.height}):[]},isNodeIntersecting:(p,g,y=!0)=>{const w=HS(p)?p:d(p);if(!w)return!1;const N=fd(w,g);return y&&N>0||N>=g.width*g.height||N>=w.width*w.height},updateNode:f,updateNodeData:(p,g,y={replace:!1})=>{f(p,b=>{const w=typeof g=="function"?g(b):g;return y.replace?{...b,data:w}:{...b,data:{...b.data,...w}}},y)},updateEdge:m,updateEdgeData:(p,g,y={replace:!1})=>{m(p,b=>{const w=typeof g=="function"?g(b):g;return y.replace?{...b,data:w}:{...b,data:{...b.data,...w}}},y)},getNodesBounds:p=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return pJ(p,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:p,id:g,nodeId:y})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${y}-${p}${g?`-${g}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:p,handleId:g,nodeId:y})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${y}${p?g?`-${p}-${g}`:`-${p}`:""}`))==null?void 0:b.values())??[])},fitView:async p=>{const g=t.getState().fitViewResolver??jJ();return t.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return x.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const b2=e=>e.selected,Gee=typeof window<"u"?window:void 0;function Xee({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Rt(),{deleteElements:r}=e1(),o=md(e,{actInsideInputWithModifier:!1}),a=md(t,{target:Gee});x.useEffect(()=>{if(o){const{edges:l,nodes:u}=n.getState();r({nodes:u.filter(b2),edges:l.filter(b2)}),n.setState({nodesSelectionActive:!1})}},[o]),x.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function Zee(e){const t=Rt();x.useEffect(()=>{const n=()=>{var o,a,l,u;if(!e.current||!(((a=(o=e.current).checkVisibility)==null?void 0:a.call(o))??!0))return!1;const r=Yw(e.current);(r.height===0||r.width===0)&&((u=(l=t.getState()).onError)==null||u.call(l,"004",Hs.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Up={position:"absolute",width:"100%",height:"100%",top:0,left:0},Jee=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ete({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:a=Pi.Free,zoomOnDoubleClick:l=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:f,minZoom:m,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:y=!0,children:b,noWheelClassName:w,noPanClassName:N,onViewportChange:k,isControlledViewport:j,paneClickDistance:C,selectionOnDrag:S}){const E=Rt(),P=x.useRef(null),{userSelectionActive:D,lib:I,connectionInProgress:z}=ct(Jee,Dt),K=md(g),q=x.useRef();Zee(P);const H=x.useCallback(B=>{k==null||k({x:B[0],y:B[1],zoom:B[2]}),j||E.setState({transform:B})},[k,j]);return x.useEffect(()=>{if(P.current){q.current=aee({domNode:P.current,minZoom:m,maxZoom:p,translateExtent:f,viewport:d,onDraggingChange:F=>E.setState(L=>L.paneDragging===F?L:{paneDragging:F}),onPanZoomStart:(F,L)=>{const{onViewportChangeStart:A,onMoveStart:O}=E.getState();O==null||O(F,L),A==null||A(L)},onPanZoom:(F,L)=>{const{onViewportChange:A,onMove:O}=E.getState();O==null||O(F,L),A==null||A(L)},onPanZoomEnd:(F,L)=>{const{onViewportChangeEnd:A,onMoveEnd:O}=E.getState();O==null||O(F,L),A==null||A(L)}});const{x:B,y:R,zoom:M}=q.current.getViewport();return E.setState({panZoom:q.current,transform:[B,R,M],domNode:P.current.closest(".react-flow")}),()=>{var F;(F=q.current)==null||F.destroy()}}},[]),x.useEffect(()=>{var B;(B=q.current)==null||B.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:u,zoomActivationKeyPressed:K,preventScrolling:y,noPanClassName:N,userSelectionActive:D,noWheelClassName:w,lib:I,onTransformChange:H,connectionInProgress:z,selectionOnDrag:S,paneClickDistance:C})},[e,t,n,r,o,a,l,u,K,y,N,D,w,I,H,z,S,C]),s.jsx("div",{className:"react-flow__renderer",ref:P,style:Up,children:b})}const tte=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function nte(){const{userSelectionActive:e,userSelectionRect:t}=ct(tte,Dt);return e&&t?s.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ev=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},rte=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function ste({isSelecting:e,selectionKeyPressed:t,selectionMode:n=dd.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:f,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:g,onPaneMouseLeave:y,children:b}){const w=Rt(),{userSelectionActive:N,elementsSelectable:k,dragging:j,connectionInProgress:C}=ct(rte,Dt),S=k&&(e||N),E=x.useRef(null),P=x.useRef(),D=x.useRef(new Set),I=x.useRef(new Set),z=x.useRef(!1),K=A=>{if(z.current||C){z.current=!1;return}d==null||d(A),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},q=A=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){A.preventDefault();return}f==null||f(A)},H=m?A=>m(A):void 0,B=A=>{z.current&&(A.stopPropagation(),z.current=!1)},R=A=>{var ne,ie;const{domNode:O}=w.getState();if(P.current=O==null?void 0:O.getBoundingClientRect(),!P.current)return;const U=A.target===E.current;if(!U&&!!A.target.closest(".nokey")||!e||!(a&&U||t)||A.button!==0||!A.isPrimary)return;(ie=(ne=A.target)==null?void 0:ne.setPointerCapture)==null||ie.call(ne,A.pointerId),z.current=!1;const{x:Y,y:X}=ss(A.nativeEvent,P.current);w.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:X,x:Y,y:X}}),U||(A.stopPropagation(),A.preventDefault())},M=A=>{const{userSelectionRect:O,transform:U,nodeLookup:V,edgeLookup:$,connectionLookup:Y,triggerNodeChanges:X,triggerEdgeChanges:ne,defaultEdgeOptions:ie,resetSelectedElements:J}=w.getState();if(!P.current||!O)return;const{x:re,y:ce}=ss(A.nativeEvent,P.current),{startX:fe,startY:pe}=O;if(!z.current){const Le=t?0:o;if(Math.hypot(re-fe,ce-pe)<=Le)return;J(),l==null||l(A)}z.current=!0;const ye={startX:fe,startY:pe,x:re<fe?re:fe,y:ce<pe?ce:pe,width:Math.abs(re-fe),height:Math.abs(ce-pe)},Ne=D.current,Oe=I.current;D.current=new Set(qw(V,ye,U,n===dd.Partial,!0).map(Le=>Le.id)),I.current=new Set;const Xe=(ie==null?void 0:ie.selectable)??!0;for(const Le of D.current){const st=Y.get(Le);if(st)for(const{edgeId:Nt}of st.values()){const ge=$.get(Nt);ge&&(ge.selectable??Xe)&&I.current.add(Nt)}}if(!US(Ne,D.current)){const Le=Ol(V,D.current,!0);X(Le)}if(!US(Oe,I.current)){const Le=Ol($,I.current);ne(Le)}w.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},F=A=>{var O,U;A.button===0&&((U=(O=A.target)==null?void 0:O.releasePointerCapture)==null||U.call(O,A.pointerId),!N&&A.target===E.current&&w.getState().userSelectionRect&&(K==null||K(A)),w.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(u==null||u(A),w.setState({nodesSelectionActive:D.current.size>0})))},L=r===!0||Array.isArray(r)&&r.includes(0);return s.jsxs("div",{className:en(["react-flow__pane",{draggable:L,dragging:j,selection:e}]),onClick:S?void 0:ev(K,E),onContextMenu:ev(q,E),onWheel:ev(H,E),onPointerEnter:S?void 0:p,onPointerMove:S?M:g,onPointerUp:S?F:void 0,onPointerDownCapture:S?R:void 0,onClickCapture:S?B:void 0,onPointerLeave:y,ref:E,style:Up,children:[b,s.jsx(nte,{})]})}function O0({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:u,onError:d}=t.getState(),f=u.get(e);if(!f){d==null||d("012",Hs.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&l)&&(a({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var m;return(m=r==null?void 0:r.current)==null?void 0:m.blur()})):o([e])}function YM({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:a,nodeClickDistance:l}){const u=Rt(),[d,f]=x.useState(!1),m=x.useRef();return x.useEffect(()=>{m.current=qJ({getStoreItems:()=>u.getState(),onNodeMouseDown:p=>{O0({id:p,store:u,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),x.useEffect(()=>{if(!(t||!e.current||!m.current))return m.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:o,nodeClickDistance:l}),()=>{var p;(p=m.current)==null||p.destroy()}},[n,r,t,a,e,o,l]),d}const ote=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function QM(){const e=Rt();return x.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:a,nodesDraggable:l,onError:u,updateNodePositions:d,nodeLookup:f,nodeOrigin:m}=e.getState(),p=new Map,g=ote(l),y=o?a[0]:5,b=o?a[1]:5,w=n.direction.x*y*n.factor,N=n.direction.y*b*n.factor;for(const[,k]of f){if(!g(k))continue;let j={x:k.internals.positionAbsolute.x+w,y:k.internals.positionAbsolute.y+N};o&&(j=qd(j,a));const{position:C,positionAbsolute:S}=mM({nodeId:k.id,nextPosition:j,nodeLookup:f,nodeExtent:r,nodeOrigin:m,onError:u});k.position=C,k.internals.positionAbsolute=S,p.set(k.id,k)}d(p)},[])}const t1=x.createContext(null),ate=t1.Provider;t1.Consumer;const GM=()=>x.useContext(t1),ite=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lte=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:a,connection:l}=r,{fromHandle:u,toHandle:d,isValid:f}=l,m=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.type)===n;return{connectingFrom:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n,connectingTo:m,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:a===dc.Strict?(u==null?void 0:u.type)!==n:e!==(u==null?void 0:u.nodeId)||t!==(u==null?void 0:u.id),connectionInProcess:!!u,clickConnectionInProcess:!!o,valid:m&&f}};function cte({type:e="source",position:t=Be.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:d,className:f,onMouseDown:m,onTouchStart:p,...g},y){var M,F;const b=l||null,w=e==="target",N=Rt(),k=GM(),{connectOnClick:j,noPanClassName:C,rfId:S}=ct(ite,Dt),{connectingFrom:E,connectingTo:P,clickConnecting:D,isPossibleEndHandle:I,connectionInProcess:z,clickConnectionInProcess:K,valid:q}=ct(lte(k,b,e),Dt);k||(F=(M=N.getState()).onError)==null||F.call(M,"010",Hs.error010());const H=L=>{const{defaultEdgeOptions:A,onConnect:O,hasDefaultEdges:U}=N.getState(),V={...A,...L};if(U){const{edges:$,setEdges:Y}=N.getState();Y(TJ(V,$))}O==null||O(V),u==null||u(V)},B=L=>{if(!k)return;const A=NM(L.nativeEvent);if(o&&(A&&L.button===0||!A)){const O=N.getState();D0.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:w,handleId:b,nodeId:k,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...U)=>{var V,$;return($=(V=N.getState()).onConnectEnd)==null?void 0:$.call(V,...U)},updateConnection:O.updateConnection,onConnect:H,isValidConnection:n||((...U)=>{var V,$;return(($=(V=N.getState()).isValidConnection)==null?void 0:$.call(V,...U))??!0}),getTransform:()=>N.getState().transform,getFromHandle:()=>N.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}A?m==null||m(L):p==null||p(L)},R=L=>{const{onClickConnectStart:A,onClickConnectEnd:O,connectionClickStartHandle:U,connectionMode:V,isValidConnection:$,lib:Y,rfId:X,nodeLookup:ne,connection:ie}=N.getState();if(!k||!U&&!o)return;if(!U){A==null||A(L.nativeEvent,{nodeId:k,handleId:b,handleType:e}),N.setState({connectionClickStartHandle:{nodeId:k,type:e,id:b}});return}const J=bM(L.target),re=n||$,{connection:ce,isValid:fe}=D0.isValid(L.nativeEvent,{handle:{nodeId:k,id:b,type:e},connectionMode:V,fromNodeId:U.nodeId,fromHandleId:U.id||null,fromType:U.type,isValidConnection:re,flowId:X,doc:J,lib:Y,nodeLookup:ne});fe&&ce&&H(ce);const pe=structuredClone(ie);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,O==null||O(L,pe),N.setState({connectionClickStartHandle:null})};return s.jsx("div",{"data-handleid":b,"data-nodeid":k,"data-handlepos":t,"data-id":`${S}-${k}-${b}-${e}`,className:en(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,f,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:a,clickconnecting:D,connectingfrom:E,connectingto:P,valid:q,connectionindicator:r&&(!z||I)&&(z||K?a:o)}]),onMouseDown:B,onTouchStart:B,onClick:j?R:void 0,ref:y,...g,children:d})}const Km=x.memo(qM(cte));function ute({data:e,isConnectable:t,sourcePosition:n=Be.Bottom}){return s.jsxs(s.Fragment,{children:[e==null?void 0:e.label,s.jsx(Km,{type:"source",position:n,isConnectable:t})]})}function dte({data:e,isConnectable:t,targetPosition:n=Be.Top,sourcePosition:r=Be.Bottom}){return s.jsxs(s.Fragment,{children:[s.jsx(Km,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,s.jsx(Km,{type:"source",position:r,isConnectable:t})]})}function fte(){return null}function hte({data:e,isConnectable:t,targetPosition:n=Be.Top}){return s.jsxs(s.Fragment,{children:[s.jsx(Km,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ym={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},w2={input:ute,default:dte,output:hte,group:fte};function mte(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const pte=e=>{const{width:t,height:n,x:r,y:o}=Ud(e.nodeLookup,{filter:a=>!!a.selected});return{width:rs(t)?t:null,height:rs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function gte({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Rt(),{width:o,height:a,transformString:l,userSelectionActive:u}=ct(pte,Dt),d=QM(),f=x.useRef(null);x.useEffect(()=>{var y;n||(y=f.current)==null||y.focus({preventScroll:!0})},[n]);const m=!u&&o!==null&&a!==null;if(YM({nodeRef:f,disabled:!m}),!m)return null;const p=e?y=>{const b=r.getState().nodes.filter(w=>w.selected);e(y,b)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Ym,y.key)&&(y.preventDefault(),d({direction:Ym[y.key],factor:y.shiftKey?4:1}))};return s.jsx("div",{className:en(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:s.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:a}})})}const N2=typeof window<"u"?window:void 0,xte=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function XM({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:u,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:m,selectionMode:p,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:b,panActivationKeyCode:w,zoomActivationKeyCode:N,elementsSelectable:k,zoomOnScroll:j,zoomOnPinch:C,panOnScroll:S,panOnScrollSpeed:E,panOnScrollMode:P,zoomOnDoubleClick:D,panOnDrag:I,defaultViewport:z,translateExtent:K,minZoom:q,maxZoom:H,preventScrolling:B,onSelectionContextMenu:R,noWheelClassName:M,noPanClassName:F,disableKeyboardA11y:L,onViewportChange:A,isControlledViewport:O}){const{nodesSelectionActive:U,userSelectionActive:V}=ct(xte,Dt),$=md(f,{target:N2}),Y=md(w,{target:N2}),X=Y||I,ne=Y||S,ie=m&&X!==!0,J=$||V||ie;return Xee({deleteKeyCode:d,multiSelectionKeyCode:b}),s.jsx(ete,{onPaneContextMenu:a,elementsSelectable:k,zoomOnScroll:j,zoomOnPinch:C,panOnScroll:ne,panOnScrollSpeed:E,panOnScrollMode:P,zoomOnDoubleClick:D,panOnDrag:!$&&X,defaultViewport:z,translateExtent:K,minZoom:q,maxZoom:H,zoomActivationKeyCode:N,preventScrolling:B,noWheelClassName:M,noPanClassName:F,onViewportChange:A,isControlledViewport:O,paneClickDistance:u,selectionOnDrag:ie,children:s.jsxs(ste,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:X,isSelecting:!!J,selectionMode:p,selectionKeyPressed:$,paneClickDistance:u,selectionOnDrag:ie,children:[e,U&&s.jsx(gte,{onSelectionContextMenu:R,noPanClassName:F,disableKeyboardA11y:L})]})})}XM.displayName="FlowRenderer";const yte=x.memo(XM),vte=e=>t=>e?qw(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function bte(e){return ct(x.useCallback(vte(e),[e]),Dt)}const wte=e=>e.updateNodeInternals;function Nte(){const e=ct(wte),[t]=x.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const a=o.target.getAttribute("data-id");r.set(a,{id:a,nodeElement:o.target,force:!0})}),e(r)}));return x.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function jte({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=Rt(),a=x.useRef(null),l=x.useRef(null),u=x.useRef(e.sourcePosition),d=x.useRef(e.targetPosition),f=x.useRef(t),m=n&&!!e.internals.handleBounds;return x.useEffect(()=>{a.current&&!e.hidden&&(!m||l.current!==a.current)&&(l.current&&(r==null||r.unobserve(l.current)),r==null||r.observe(a.current),l.current=a.current)},[m,e.hidden]),x.useEffect(()=>()=>{l.current&&(r==null||r.unobserve(l.current),l.current=null)},[]),x.useEffect(()=>{if(a.current){const p=f.current!==t,g=u.current!==e.sourcePosition,y=d.current!==e.targetPosition;(p||g||y)&&(f.current=t,u.current=e.sourcePosition,d.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Cte({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:a,onDoubleClick:l,nodesDraggable:u,elementsSelectable:d,nodesConnectable:f,nodesFocusable:m,resizeObserver:p,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:b,rfId:w,nodeTypes:N,nodeClickDistance:k,onError:j}){const{node:C,internals:S,isParent:E}=ct(re=>{const ce=re.nodeLookup.get(e),fe=re.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:fe}},Dt);let P=C.type||"default",D=(N==null?void 0:N[P])||w2[P];D===void 0&&(j==null||j("003",Hs.error003(P)),P="default",D=(N==null?void 0:N.default)||w2.default);const I=!!(C.draggable||u&&typeof C.draggable>"u"),z=!!(C.selectable||d&&typeof C.selectable>"u"),K=!!(C.connectable||f&&typeof C.connectable>"u"),q=!!(C.focusable||m&&typeof C.focusable>"u"),H=Rt(),B=yM(C),R=jte({node:C,nodeType:P,hasDimensions:B,resizeObserver:p}),M=YM({nodeRef:R,disabled:C.hidden||!I,noDragClassName:g,handleSelector:C.dragHandle,nodeId:e,isSelectable:z,nodeClickDistance:k}),F=QM();if(C.hidden)return null;const L=Co(C),A=mte(C),O=z||I||t||n||r||o,U=n?re=>n(re,{...S.userNode}):void 0,V=r?re=>r(re,{...S.userNode}):void 0,$=o?re=>o(re,{...S.userNode}):void 0,Y=a?re=>a(re,{...S.userNode}):void 0,X=l?re=>l(re,{...S.userNode}):void 0,ne=re=>{const{selectNodesOnDrag:ce,nodeDragThreshold:fe}=H.getState();z&&(!ce||!I||fe>0)&&O0({id:e,store:H,nodeRef:R}),t&&t(re,{...S.userNode})},ie=re=>{if(!(wM(re.nativeEvent)||b)){if(cM.includes(re.key)&&z){const ce=re.key==="Escape";O0({id:e,store:H,unselect:ce,nodeRef:R})}else if(I&&C.selected&&Object.prototype.hasOwnProperty.call(Ym,re.key)){re.preventDefault();const{ariaLabelConfig:ce}=H.getState();H.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),F({direction:Ym[re.key],factor:re.shiftKey?4:1})}}},J=()=>{var Oe;if(b||!((Oe=R.current)!=null&&Oe.matches(":focus-visible")))return;const{transform:re,width:ce,height:fe,autoPanOnNodeFocus:pe,setCenter:ye}=H.getState();if(!pe)return;qw(new Map([[e,C]]),{x:0,y:0,width:ce,height:fe},re,!0).length>0||ye(C.position.x+L.width/2,C.position.y+L.height/2,{zoom:re[2]})};return s.jsx("div",{className:en(["react-flow__node",`react-flow__node-${P}`,{[y]:I},C.className,{selected:C.selected,selectable:z,parent:E,draggable:I,dragging:M}]),ref:R,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:B?"visible":"hidden",...C.style,...A},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:U,onMouseMove:V,onMouseLeave:$,onContextMenu:Y,onClick:ne,onDoubleClick:X,onKeyDown:q?ie:void 0,tabIndex:q?0:void 0,onFocus:q?J:void 0,role:C.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${VM}-${w}`,"aria-label":C.ariaLabel,...C.domAttributes,children:s.jsx(ate,{value:e,children:s.jsx(D,{id:e,data:C.data,type:P,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:C.selected??!1,selectable:z,draggable:I,deletable:C.deletable??!0,isConnectable:K,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:M,dragHandle:C.dragHandle,zIndex:S.z,parentId:C.parentId,...L})})})}var kte=x.memo(Cte);const Ste=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ZM(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:a}=ct(Ste,Dt),l=bte(e.onlyRenderVisibleElements),u=Nte();return s.jsx("div",{className:"react-flow__nodes",style:Up,children:l.map(d=>s.jsx(kte,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:a},d))})}ZM.displayName="NodeRenderer";const _te=x.memo(ZM);function Ete(e){return ct(x.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const a=n.nodeLookup.get(o.source),l=n.nodeLookup.get(o.target);a&&l&&_J({sourceNode:a,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),Dt)}const Pte=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return s.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Tte=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return s.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},j2={[Hm.Arrow]:Pte,[Hm.ArrowClosed]:Tte};function Mte(e){const t=Rt();return x.useMemo(()=>{var o,a;return Object.prototype.hasOwnProperty.call(j2,e)?j2[e]:((a=(o=t.getState()).onError)==null||a.call(o,"009",Hs.error009(e)),null)},[e])}const Ate=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const d=Mte(t);return d?s.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0",children:s.jsx(d,{color:n,strokeWidth:l})}):null},JM=({defaultColor:e,rfId:t})=>{const n=ct(a=>a.edges),r=ct(a=>a.defaultEdgeOptions),o=x.useMemo(()=>OJ(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?s.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:s.jsx("defs",{children:o.map(a=>s.jsx(Ate,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};JM.displayName="MarkerDefinitions";var Dte=x.memo(JM);function eA({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:a,labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:d,className:f,...m}){const[p,g]=x.useState({x:1,y:0,width:0,height:0}),y=en(["react-flow__edge-textwrapper",f]),b=x.useRef(null);return x.useEffect(()=>{if(b.current){const w=b.current.getBBox();g({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?s.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:y,visibility:p.width?"visible":"hidden",...m,children:[o&&s.jsx("rect",{width:p.width+2*l[0],x:-l[0],y:-l[1],height:p.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),s.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:b,style:r,children:n}),d]}):null}eA.displayName="EdgeText";const Rte=x.memo(eA);function qp({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:f=20,...m}){return s.jsxs(s.Fragment,{children:[s.jsx("path",{...m,d:e,fill:"none",className:en(["react-flow__edge-path",m.className])}),f?s.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&rs(t)&&rs(n)?s.jsx(Rte,{x:t,y:n,label:r,labelStyle:o,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function C2({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Be.Left||e===Be.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function tA({sourceX:e,sourceY:t,sourcePosition:n=Be.Bottom,targetX:r,targetY:o,targetPosition:a=Be.Top}){const[l,u]=C2({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=C2({pos:a,x1:r,y1:o,x2:e,y2:t}),[m,p,g,y]=jM({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${u} ${d},${f} ${r},${o}`,m,p,g,y]}function nA(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:a,sourcePosition:l,targetPosition:u,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:b,markerEnd:w,markerStart:N,interactionWidth:k})=>{const[j,C,S]=tA({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:a,targetPosition:u}),E=e.isInternal?void 0:t;return s.jsx(qp,{id:E,path:j,labelX:C,labelY:S,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:b,markerEnd:w,markerStart:N,interactionWidth:k})})}const Ote=nA({isInternal:!1}),rA=nA({isInternal:!0});Ote.displayName="SimpleBezierEdge";rA.displayName="SimpleBezierEdgeInternal";function sA(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:p,style:g,sourcePosition:y=Be.Bottom,targetPosition:b=Be.Top,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:j})=>{const[C,S,E]=T0({sourceX:n,sourceY:r,sourcePosition:y,targetX:o,targetY:a,targetPosition:b,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset,stepPosition:k==null?void 0:k.stepPosition}),P=e.isInternal?void 0:t;return s.jsx(qp,{id:P,path:C,labelX:S,labelY:E,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:N,interactionWidth:j})})}const oA=sA({isInternal:!1}),aA=sA({isInternal:!0});oA.displayName="SmoothStepEdge";aA.displayName="SmoothStepEdgeInternal";function iA(e){return x.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return s.jsx(oA,{...n,id:r,pathOptions:x.useMemo(()=>{var a;return{borderRadius:0,offset:(a=n.pathOptions)==null?void 0:a.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const Ite=iA({isInternal:!1}),lA=iA({isInternal:!0});Ite.displayName="StepEdge";lA.displayName="StepEdgeInternal";function cA(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:b,interactionWidth:w})=>{const[N,k,j]=SM({sourceX:n,sourceY:r,targetX:o,targetY:a}),C=e.isInternal?void 0:t;return s.jsx(qp,{id:C,path:N,labelX:k,labelY:j,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:b,interactionWidth:w})})}const Lte=cA({isInternal:!1}),uA=cA({isInternal:!0});Lte.displayName="StraightEdge";uA.displayName="StraightEdgeInternal";function dA(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:a,sourcePosition:l=Be.Bottom,targetPosition:u=Be.Top,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:b,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:j})=>{const[C,S,E]=CM({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:a,targetPosition:u,curvature:k==null?void 0:k.curvature}),P=e.isInternal?void 0:t;return s.jsx(qp,{id:P,path:C,labelX:S,labelY:E,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:b,markerEnd:w,markerStart:N,interactionWidth:j})})}const Fte=dA({isInternal:!1}),fA=dA({isInternal:!0});Fte.displayName="BezierEdge";fA.displayName="BezierEdgeInternal";const k2={default:fA,straight:uA,step:lA,smoothstep:aA,simplebezier:rA},S2={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},$te=(e,t,n)=>n===Be.Left?e-t:n===Be.Right?e+t:e,Vte=(e,t,n)=>n===Be.Top?e-t:n===Be.Bottom?e+t:e,_2="react-flow__edgeupdater";function E2({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:a,onMouseOut:l,type:u}){return s.jsx("circle",{onMouseDown:o,onMouseEnter:a,onMouseOut:l,className:en([_2,`${_2}-${u}`]),cx:$te(t,r,e),cy:Vte(n,r,e),r,stroke:"transparent",fill:"transparent"})}function zte({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:a,targetY:l,sourcePosition:u,targetPosition:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:p,setReconnecting:g,setUpdateHover:y}){const b=Rt(),w=(S,E)=>{if(S.button!==0)return;const{autoPanOnConnect:P,domNode:D,connectionMode:I,connectionRadius:z,lib:K,onConnectStart:q,cancelConnection:H,nodeLookup:B,rfId:R,panBy:M,updateConnection:F}=b.getState(),L=E.type==="target",A=(V,$)=>{g(!1),p==null||p(V,n,E.type,$)},O=V=>f==null?void 0:f(n,V),U=(V,$)=>{g(!0),m==null||m(S,n,E.type),q==null||q(V,$)};D0.onPointerDown(S.nativeEvent,{autoPanOnConnect:P,connectionMode:I,connectionRadius:z,domNode:D,handleId:E.id,nodeId:E.nodeId,nodeLookup:B,isTarget:L,edgeUpdaterType:E.type,lib:K,flowId:R,cancelConnection:H,panBy:M,isValidConnection:(...V)=>{var $,Y;return((Y=($=b.getState()).isValidConnection)==null?void 0:Y.call($,...V))??!0},onConnect:O,onConnectStart:U,onConnectEnd:(...V)=>{var $,Y;return(Y=($=b.getState()).onConnectEnd)==null?void 0:Y.call($,...V)},onReconnectEnd:A,updateConnection:F,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},N=S=>w(S,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),k=S=>w(S,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),j=()=>y(!0),C=()=>y(!1);return s.jsxs(s.Fragment,{children:[(e===!0||e==="source")&&s.jsx(E2,{position:u,centerX:r,centerY:o,radius:t,onMouseDown:N,onMouseEnter:j,onMouseOut:C,type:"source"}),(e===!0||e==="target")&&s.jsx(E2,{position:d,centerX:a,centerY:l,radius:t,onMouseDown:k,onMouseEnter:j,onMouseOut:C,type:"target"})]})}function Bte({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:a,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,reconnectRadius:m,onReconnect:p,onReconnectStart:g,onReconnectEnd:y,rfId:b,edgeTypes:w,noPanClassName:N,onError:k,disableKeyboardA11y:j}){let C=ct(ye=>ye.edgeLookup.get(e));const S=ct(ye=>ye.defaultEdgeOptions);C=S?{...S,...C}:C;let E=C.type||"default",P=(w==null?void 0:w[E])||k2[E];P===void 0&&(k==null||k("011",Hs.error011(E)),E="default",P=(w==null?void 0:w.default)||k2.default);const D=!!(C.focusable||t&&typeof C.focusable>"u"),I=typeof p<"u"&&(C.reconnectable||n&&typeof C.reconnectable>"u"),z=!!(C.selectable||r&&typeof C.selectable>"u"),K=x.useRef(null),[q,H]=x.useState(!1),[B,R]=x.useState(!1),M=Rt(),{zIndex:F,sourceX:L,sourceY:A,targetX:O,targetY:U,sourcePosition:V,targetPosition:$}=ct(x.useCallback(ye=>{const Ne=ye.nodeLookup.get(C.source),Oe=ye.nodeLookup.get(C.target);if(!Ne||!Oe)return{zIndex:C.zIndex,...S2};const Xe=RJ({id:e,sourceNode:Ne,targetNode:Oe,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:ye.connectionMode,onError:k});return{zIndex:SJ({selected:C.selected,zIndex:C.zIndex,sourceNode:Ne,targetNode:Oe,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Xe||S2}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),Dt),Y=x.useMemo(()=>C.markerStart?`url('#${M0(C.markerStart,b)}')`:void 0,[C.markerStart,b]),X=x.useMemo(()=>C.markerEnd?`url('#${M0(C.markerEnd,b)}')`:void 0,[C.markerEnd,b]);if(C.hidden||L===null||A===null||O===null||U===null)return null;const ne=ye=>{var Le;const{addSelectedEdges:Ne,unselectNodesAndEdges:Oe,multiSelectionActive:Xe}=M.getState();z&&(M.setState({nodesSelectionActive:!1}),C.selected&&Xe?(Oe({nodes:[],edges:[C]}),(Le=K.current)==null||Le.blur()):Ne([e])),o&&o(ye,C)},ie=a?ye=>{a(ye,{...C})}:void 0,J=l?ye=>{l(ye,{...C})}:void 0,re=u?ye=>{u(ye,{...C})}:void 0,ce=d?ye=>{d(ye,{...C})}:void 0,fe=f?ye=>{f(ye,{...C})}:void 0,pe=ye=>{var Ne;if(!j&&cM.includes(ye.key)&&z){const{unselectNodesAndEdges:Oe,addSelectedEdges:Xe}=M.getState();ye.key==="Escape"?((Ne=K.current)==null||Ne.blur(),Oe({edges:[C]})):Xe([e])}};return s.jsx("svg",{style:{zIndex:F},children:s.jsxs("g",{className:en(["react-flow__edge",`react-flow__edge-${E}`,C.className,N,{selected:C.selected,animated:C.animated,inactive:!z&&!o,updating:q,selectable:z}]),onClick:ne,onDoubleClick:ie,onContextMenu:J,onMouseEnter:re,onMouseMove:ce,onMouseLeave:fe,onKeyDown:D?pe:void 0,tabIndex:D?0:void 0,role:C.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":D?`${zM}-${b}`:void 0,ref:K,...C.domAttributes,children:[!B&&s.jsx(P,{id:e,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:z,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:L,sourceY:A,targetX:O,targetY:U,sourcePosition:V,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:Y,markerEnd:X,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),I&&s.jsx(zte,{edge:C,isReconnectable:I,reconnectRadius:m,onReconnect:p,onReconnectStart:g,onReconnectEnd:y,sourceX:L,sourceY:A,targetX:O,targetY:U,sourcePosition:V,targetPosition:$,setUpdateHover:H,setReconnecting:R})]})})}var Wte=x.memo(Bte);const Hte=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hA({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:m,reconnectRadius:p,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:b,disableKeyboardA11y:w}){const{edgesFocusable:N,edgesReconnectable:k,elementsSelectable:j,onError:C}=ct(Hte,Dt),S=Ete(t);return s.jsxs("div",{className:"react-flow__edges",children:[s.jsx(Dte,{defaultColor:e,rfId:n}),S.map(E=>s.jsx(Wte,{id:E,edgesFocusable:N,edgesReconnectable:k,elementsSelectable:j,noPanClassName:o,onReconnect:a,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onClick:m,reconnectRadius:p,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:b,rfId:n,onError:C,edgeTypes:r,disableKeyboardA11y:w},E))]})}hA.displayName="EdgeRenderer";const Ute=x.memo(hA),qte=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Kte({children:e}){const t=ct(qte);return s.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Yte(e){const t=e1(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Qte=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Gte(e){const t=ct(Qte),n=Rt();return x.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Xte(e){return e.connection.inProgress?{...e.connection,to:Kd(e.connection.to,e.transform)}:{...e.connection}}function Zte(e){return Xte}function Jte(e){const t=Zte();return ct(t,Dt)}const ene=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function tne({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:a,height:l,isValid:u,inProgress:d}=ct(ene,Dt);return!(a&&o&&d)?null:s.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:s.jsx("g",{className:en(["react-flow__connection",fM(u)]),children:s.jsx(mA,{style:t,type:n,CustomComponent:r,isValid:u})})})}const mA=({style:e,type:t=na.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:a,fromNode:l,fromHandle:u,fromPosition:d,to:f,toNode:m,toHandle:p,toPosition:g,pointer:y}=Jte();if(!o)return;if(n)return s.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:u,fromX:a.x,fromY:a.y,toX:f.x,toY:f.y,fromPosition:d,toPosition:g,connectionStatus:fM(r),toNode:m,toHandle:p,pointer:y});let b="";const w={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:g};switch(t){case na.Bezier:[b]=CM(w);break;case na.SimpleBezier:[b]=tA(w);break;case na.Step:[b]=T0({...w,borderRadius:0});break;case na.SmoothStep:[b]=T0(w);break;default:[b]=SM(w)}return s.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};mA.displayName="ConnectionLine";const nne={};function P2(e=nne){x.useRef(e),Rt(),x.useEffect(()=>{},[e])}function rne(){Rt(),x.useRef(!1),x.useEffect(()=>{},[])}function pA({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:p,onSelectionStart:g,onSelectionEnd:y,connectionLineType:b,connectionLineStyle:w,connectionLineComponent:N,connectionLineContainerStyle:k,selectionKeyCode:j,selectionOnDrag:C,selectionMode:S,multiSelectionKeyCode:E,panActivationKeyCode:P,zoomActivationKeyCode:D,deleteKeyCode:I,onlyRenderVisibleElements:z,elementsSelectable:K,defaultViewport:q,translateExtent:H,minZoom:B,maxZoom:R,preventScrolling:M,defaultMarkerColor:F,zoomOnScroll:L,zoomOnPinch:A,panOnScroll:O,panOnScrollSpeed:U,panOnScrollMode:V,zoomOnDoubleClick:$,panOnDrag:Y,onPaneClick:X,onPaneMouseEnter:ne,onPaneMouseMove:ie,onPaneMouseLeave:J,onPaneScroll:re,onPaneContextMenu:ce,paneClickDistance:fe,nodeClickDistance:pe,onEdgeContextMenu:ye,onEdgeMouseEnter:Ne,onEdgeMouseMove:Oe,onEdgeMouseLeave:Xe,reconnectRadius:Le,onReconnect:st,onReconnectStart:Nt,onReconnectEnd:ge,noDragClassName:De,noWheelClassName:$e,noPanClassName:et,disableKeyboardA11y:tt,nodeExtent:ht,rfId:te,viewport:Ce,onViewportChange:Ze}){return P2(e),P2(t),rne(),Yte(n),Gte(Ce),s.jsx(yte,{onPaneClick:X,onPaneMouseEnter:ne,onPaneMouseMove:ie,onPaneMouseLeave:J,onPaneContextMenu:ce,onPaneScroll:re,paneClickDistance:fe,deleteKeyCode:I,selectionKeyCode:j,selectionOnDrag:C,selectionMode:S,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:E,panActivationKeyCode:P,zoomActivationKeyCode:D,elementsSelectable:K,zoomOnScroll:L,zoomOnPinch:A,zoomOnDoubleClick:$,panOnScroll:O,panOnScrollSpeed:U,panOnScrollMode:V,panOnDrag:Y,defaultViewport:q,translateExtent:H,minZoom:B,maxZoom:R,onSelectionContextMenu:p,preventScrolling:M,noDragClassName:De,noWheelClassName:$e,noPanClassName:et,disableKeyboardA11y:tt,onViewportChange:Ze,isControlledViewport:!!Ce,children:s.jsxs(Kte,{children:[s.jsx(Ute,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:l,onReconnect:st,onReconnectStart:Nt,onReconnectEnd:ge,onlyRenderVisibleElements:z,onEdgeContextMenu:ye,onEdgeMouseEnter:Ne,onEdgeMouseMove:Oe,onEdgeMouseLeave:Xe,reconnectRadius:Le,defaultMarkerColor:F,noPanClassName:et,disableKeyboardA11y:tt,rfId:te}),s.jsx(tne,{style:w,type:b,component:N,containerStyle:k}),s.jsx("div",{className:"react-flow__edgelabel-renderer"}),s.jsx(_te,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,nodeClickDistance:pe,onlyRenderVisibleElements:z,noPanClassName:et,noDragClassName:De,disableKeyboardA11y:tt,nodeExtent:ht,rfId:te}),s.jsx("div",{className:"react-flow__viewport-portal"})]})})}pA.displayName="GraphView";const sne=x.memo(pA),T2=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:a,fitView:l,fitViewOptions:u,minZoom:d=.5,maxZoom:f=2,nodeOrigin:m,nodeExtent:p,zIndexMode:g="basic"}={})=>{const y=new Map,b=new Map,w=new Map,N=new Map,k=r??t??[],j=n??e??[],C=m??[0,0],S=p??ud;PM(w,N,k);const{nodesInitialized:E}=A0(j,y,b,{nodeOrigin:C,nodeExtent:S,zIndexMode:g});let P=[0,0,1];if(l&&o&&a){const D=Ud(y,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:I,y:z,zoom:K}=Kw(D,o,a,d,f,(u==null?void 0:u.padding)??.1);P=[I,z,K]}return{rfId:"1",width:o??0,height:a??0,transform:P,nodes:j,nodesInitialized:E,nodeLookup:y,parentLookup:b,edges:k,edgeLookup:N,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:ud,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:dc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:u,fitViewResolver:null,connection:{...dM},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:bJ,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:uM,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},one=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:m,nodeExtent:p,zIndexMode:g})=>Cee((y,b)=>{async function w(){const{nodeLookup:N,panZoom:k,fitViewOptions:j,fitViewResolver:C,width:S,height:E,minZoom:P,maxZoom:D}=b();k&&(await yJ({nodes:N,width:S,height:E,panZoom:k,minZoom:P,maxZoom:D},j),C==null||C.resolve(!0),y({fitViewResolver:null}))}return{...T2({nodes:e,edges:t,width:o,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:m,nodeExtent:p,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:N=>{const{nodeLookup:k,parentLookup:j,nodeOrigin:C,elevateNodesOnSelect:S,fitViewQueued:E,zIndexMode:P,nodesSelectionActive:D}=b(),{nodesInitialized:I,hasSelectedNodes:z}=A0(N,k,j,{nodeOrigin:C,nodeExtent:p,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:P}),K=D&&z;E&&I?(w(),y({nodes:N,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:K})):y({nodes:N,nodesInitialized:I,nodesSelectionActive:K})},setEdges:N=>{const{connectionLookup:k,edgeLookup:j}=b();PM(k,j,N),y({edges:N})},setDefaultNodesAndEdges:(N,k)=>{if(N){const{setNodes:j}=b();j(N),y({hasDefaultNodes:!0})}if(k){const{setEdges:j}=b();j(k),y({hasDefaultEdges:!0})}},updateNodeInternals:N=>{const{triggerNodeChanges:k,nodeLookup:j,parentLookup:C,domNode:S,nodeOrigin:E,nodeExtent:P,debug:D,fitViewQueued:I,zIndexMode:z}=b(),{changes:K,updatedInternals:q}=BJ(N,j,C,S,E,P,z);q&&(FJ(j,C,{nodeOrigin:E,nodeExtent:P,zIndexMode:z}),I?(w(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(K==null?void 0:K.length)>0&&(D&&console.log("React Flow: trigger node changes",K),k==null||k(K)))},updateNodePositions:(N,k=!1)=>{const j=[];let C=[];const{nodeLookup:S,triggerNodeChanges:E,connection:P,updateConnection:D,onNodesChangeMiddlewareMap:I}=b();for(const[z,K]of N){const q=S.get(z),H=!!(q!=null&&q.expandParent&&(q!=null&&q.parentId)&&(K!=null&&K.position)),B={id:z,type:"position",position:H?{x:Math.max(0,K.position.x),y:Math.max(0,K.position.y)}:K.position,dragging:k};if(q&&P.inProgress&&P.fromNode.id===q.id){const R=Bi(q,P.fromHandle,Be.Left,!0);D({...P,from:R})}H&&q.parentId&&j.push({id:z,parentId:q.parentId,rect:{...K.internals.positionAbsolute,width:K.measured.width??0,height:K.measured.height??0}}),C.push(B)}if(j.length>0){const{parentLookup:z,nodeOrigin:K}=b(),q=Jw(j,S,z,K);C.push(...q)}for(const z of I.values())C=z(C);E(C)},triggerNodeChanges:N=>{const{onNodesChange:k,setNodes:j,nodes:C,hasDefaultNodes:S,debug:E}=b();if(N!=null&&N.length){if(S){const P=HM(N,C);j(P)}E&&console.log("React Flow: trigger node changes",N),k==null||k(N)}},triggerEdgeChanges:N=>{const{onEdgesChange:k,setEdges:j,edges:C,hasDefaultEdges:S,debug:E}=b();if(N!=null&&N.length){if(S){const P=UM(N,C);j(P)}E&&console.log("React Flow: trigger edge changes",N),k==null||k(N)}},addSelectedNodes:N=>{const{multiSelectionActive:k,edgeLookup:j,nodeLookup:C,triggerNodeChanges:S,triggerEdgeChanges:E}=b();if(k){const P=N.map(D=>ci(D,!0));S(P);return}S(Ol(C,new Set([...N]),!0)),E(Ol(j))},addSelectedEdges:N=>{const{multiSelectionActive:k,edgeLookup:j,nodeLookup:C,triggerNodeChanges:S,triggerEdgeChanges:E}=b();if(k){const P=N.map(D=>ci(D,!0));E(P);return}E(Ol(j,new Set([...N]))),S(Ol(C,new Set,!0))},unselectNodesAndEdges:({nodes:N,edges:k}={})=>{const{edges:j,nodes:C,nodeLookup:S,triggerNodeChanges:E,triggerEdgeChanges:P}=b(),D=N||C,I=k||j,z=[];for(const q of D){if(!q.selected)continue;const H=S.get(q.id);H&&(H.selected=!1),z.push(ci(q.id,!1))}const K=[];for(const q of I)q.selected&&K.push(ci(q.id,!1));E(z),P(K)},setMinZoom:N=>{const{panZoom:k,maxZoom:j}=b();k==null||k.setScaleExtent([N,j]),y({minZoom:N})},setMaxZoom:N=>{const{panZoom:k,minZoom:j}=b();k==null||k.setScaleExtent([j,N]),y({maxZoom:N})},setTranslateExtent:N=>{var k;(k=b().panZoom)==null||k.setTranslateExtent(N),y({translateExtent:N})},resetSelectedElements:()=>{const{edges:N,nodes:k,triggerNodeChanges:j,triggerEdgeChanges:C,elementsSelectable:S}=b();if(!S)return;const E=k.reduce((D,I)=>I.selected?[...D,ci(I.id,!1)]:D,[]),P=N.reduce((D,I)=>I.selected?[...D,ci(I.id,!1)]:D,[]);j(E),C(P)},setNodeExtent:N=>{const{nodes:k,nodeLookup:j,parentLookup:C,nodeOrigin:S,elevateNodesOnSelect:E,nodeExtent:P,zIndexMode:D}=b();N[0][0]===P[0][0]&&N[0][1]===P[0][1]&&N[1][0]===P[1][0]&&N[1][1]===P[1][1]||(A0(k,j,C,{nodeOrigin:S,nodeExtent:N,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:D}),y({nodeExtent:N}))},panBy:N=>{const{transform:k,width:j,height:C,panZoom:S,translateExtent:E}=b();return WJ({delta:N,panZoom:S,transform:k,translateExtent:E,width:j,height:C})},setCenter:async(N,k,j)=>{const{width:C,height:S,maxZoom:E,panZoom:P}=b();if(!P)return Promise.resolve(!1);const D=typeof(j==null?void 0:j.zoom)<"u"?j.zoom:E;return await P.setViewport({x:C/2-N*D,y:S/2-k*D,zoom:D},{duration:j==null?void 0:j.duration,ease:j==null?void 0:j.ease,interpolate:j==null?void 0:j.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...dM}})},updateConnection:N=>{y({connection:N})},reset:()=>y({...T2()})}},Object.is);function ane({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:a,initialMinZoom:l,initialMaxZoom:u,initialFitViewOptions:d,fitView:f,nodeOrigin:m,nodeExtent:p,zIndexMode:g,children:y}){const[b]=x.useState(()=>one({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:a,fitView:f,minZoom:l,maxZoom:u,fitViewOptions:d,nodeOrigin:m,nodeExtent:p,zIndexMode:g}));return s.jsx(kee,{value:b,children:s.jsx(Kee,{children:y})})}function ine({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:f,maxZoom:m,nodeOrigin:p,nodeExtent:g,zIndexMode:y}){return x.useContext(Wp)?s.jsx(s.Fragment,{children:e}):s.jsx(ane,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:a,initialHeight:l,fitView:u,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:m,nodeOrigin:p,nodeExtent:g,zIndexMode:y,children:e})}const lne={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function cne({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:a,edgeTypes:l,onNodeClick:u,onEdgeClick:d,onInit:f,onMove:m,onMoveStart:p,onMoveEnd:g,onConnect:y,onConnectStart:b,onConnectEnd:w,onClickConnectStart:N,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:C,onNodeMouseLeave:S,onNodeContextMenu:E,onNodeDoubleClick:P,onNodeDragStart:D,onNodeDrag:I,onNodeDragStop:z,onNodesDelete:K,onEdgesDelete:q,onDelete:H,onSelectionChange:B,onSelectionDragStart:R,onSelectionDrag:M,onSelectionDragStop:F,onSelectionContextMenu:L,onSelectionStart:A,onSelectionEnd:O,onBeforeDelete:U,connectionMode:V,connectionLineType:$=na.Bezier,connectionLineStyle:Y,connectionLineComponent:X,connectionLineContainerStyle:ne,deleteKeyCode:ie="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:re=!1,selectionMode:ce=dd.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:pe=hd()?"Meta":"Control",zoomActivationKeyCode:ye=hd()?"Meta":"Control",snapToGrid:Ne,snapGrid:Oe,onlyRenderVisibleElements:Xe=!1,selectNodesOnDrag:Le,nodesDraggable:st,autoPanOnNodeFocus:Nt,nodesConnectable:ge,nodesFocusable:De,nodeOrigin:$e=BM,edgesFocusable:et,edgesReconnectable:tt,elementsSelectable:ht=!0,defaultViewport:te=Fee,minZoom:Ce=.5,maxZoom:Ze=2,translateExtent:at=ud,preventScrolling:oe=!0,nodeExtent:ke,defaultMarkerColor:ue="#b1b1b7",zoomOnScroll:yt=!0,zoomOnPinch:Mt=!0,panOnScroll:pn=!1,panOnScrollSpeed:Un=.5,panOnScrollMode:ln=Pi.Free,zoomOnDoubleClick:zr=!0,panOnDrag:Br=!0,onPaneClick:xs,onPaneMouseEnter:ko,onPaneMouseMove:ys,onPaneMouseLeave:Sr,onPaneScroll:ar,onPaneContextMenu:Ui,paneClickDistance:Ye=1,nodeClickDistance:ut=0,children:vt,onReconnect:gn,onReconnectStart:kn,onReconnectEnd:Sn,onEdgeContextMenu:ir,onEdgeDoubleClick:tn,onEdgeMouseEnter:_r,onEdgeMouseMove:$a,onEdgeMouseLeave:qi,reconnectRadius:Ki=10,onNodesChange:Dc,onEdgesChange:sg,noDragClassName:og="nodrag",noWheelClassName:ag="nowheel",noPanClassName:vs="nopan",fitView:Rc,fitViewOptions:Oc,connectOnClick:ig,attributionPosition:Yd,proOptions:Qd,defaultEdgeOptions:Gd,elevateNodesOnSelect:Xd=!0,elevateEdgesOnSelect:lg=!1,disableKeyboardA11y:Zd=!1,autoPanOnConnect:Ot,autoPanOnNodeDrag:cg,autoPanSpeed:Ic,connectionRadius:Jd,isValidConnection:Yi,onError:ug,style:ef,id:Va,nodeDragThreshold:Er,connectionDragThreshold:dg,viewport:lr,onViewportChange:fg,width:hg,height:mg,colorMode:Qi="light",debug:Gi,onScroll:bs,ariaLabelConfig:Xi,zIndexMode:tf="basic",...pg},Lc){const Zi=Va||"1",Fc=Bee(Qi),za=x.useCallback(nf=>{nf.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bs==null||bs(nf)},[bs]);return s.jsx("div",{"data-testid":"rf__wrapper",...pg,onScroll:za,style:{...ef,...lne},ref:Lc,className:en(["react-flow",o,Fc]),id:Va,role:"application",children:s.jsxs(ine,{nodes:e,edges:t,width:hg,height:mg,fitView:Rc,fitViewOptions:Oc,minZoom:Ce,maxZoom:Ze,nodeOrigin:$e,nodeExtent:ke,zIndexMode:tf,children:[s.jsx(zee,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:b,onConnectEnd:w,onClickConnectStart:N,onClickConnectEnd:k,nodesDraggable:st,autoPanOnNodeFocus:Nt,nodesConnectable:ge,nodesFocusable:De,edgesFocusable:et,edgesReconnectable:tt,elementsSelectable:ht,elevateNodesOnSelect:Xd,elevateEdgesOnSelect:lg,minZoom:Ce,maxZoom:Ze,nodeExtent:ke,onNodesChange:Dc,onEdgesChange:sg,snapToGrid:Ne,snapGrid:Oe,connectionMode:V,translateExtent:at,connectOnClick:ig,defaultEdgeOptions:Gd,fitView:Rc,fitViewOptions:Oc,onNodesDelete:K,onEdgesDelete:q,onDelete:H,onNodeDragStart:D,onNodeDrag:I,onNodeDragStop:z,onSelectionDrag:M,onSelectionDragStart:R,onSelectionDragStop:F,onMove:m,onMoveStart:p,onMoveEnd:g,noPanClassName:vs,nodeOrigin:$e,rfId:Zi,autoPanOnConnect:Ot,autoPanOnNodeDrag:cg,autoPanSpeed:Ic,onError:ug,connectionRadius:Jd,isValidConnection:Yi,selectNodesOnDrag:Le,nodeDragThreshold:Er,connectionDragThreshold:dg,onBeforeDelete:U,debug:Gi,ariaLabelConfig:Xi,zIndexMode:tf}),s.jsx(sne,{onInit:f,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:j,onNodeMouseMove:C,onNodeMouseLeave:S,onNodeContextMenu:E,onNodeDoubleClick:P,nodeTypes:a,edgeTypes:l,connectionLineType:$,connectionLineStyle:Y,connectionLineComponent:X,connectionLineContainerStyle:ne,selectionKeyCode:J,selectionOnDrag:re,selectionMode:ce,deleteKeyCode:ie,multiSelectionKeyCode:pe,panActivationKeyCode:fe,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Xe,defaultViewport:te,translateExtent:at,minZoom:Ce,maxZoom:Ze,preventScrolling:oe,zoomOnScroll:yt,zoomOnPinch:Mt,zoomOnDoubleClick:zr,panOnScroll:pn,panOnScrollSpeed:Un,panOnScrollMode:ln,panOnDrag:Br,onPaneClick:xs,onPaneMouseEnter:ko,onPaneMouseMove:ys,onPaneMouseLeave:Sr,onPaneScroll:ar,onPaneContextMenu:Ui,paneClickDistance:Ye,nodeClickDistance:ut,onSelectionContextMenu:L,onSelectionStart:A,onSelectionEnd:O,onReconnect:gn,onReconnectStart:kn,onReconnectEnd:Sn,onEdgeContextMenu:ir,onEdgeDoubleClick:tn,onEdgeMouseEnter:_r,onEdgeMouseMove:$a,onEdgeMouseLeave:qi,reconnectRadius:Ki,defaultMarkerColor:ue,noDragClassName:og,noWheelClassName:ag,noPanClassName:vs,rfId:Zi,disableKeyboardA11y:Zd,nodeExtent:ke,viewport:lr,onViewportChange:fg}),s.jsx(Lee,{onSelectionChange:B}),vt,s.jsx(Aee,{proOptions:Qd,position:Yd}),s.jsx(Mee,{rfId:Zi,disableKeyboardA11y:Zd})]})})}var une=qM(cne);function dne(e){const[t,n]=x.useState(e),r=x.useCallback(o=>n(a=>HM(o,a)),[]);return[t,n,r]}function fne(e){const[t,n]=x.useState(e),r=x.useCallback(o=>n(a=>UM(o,a)),[]);return[t,n,r]}function hne({dimensions:e,lineWidth:t,variant:n,className:r}){return s.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:en(["react-flow__background-pattern",n,r])})}function mne({radius:e,className:t}){return s.jsx("circle",{cx:e,cy:e,r:e,className:en(["react-flow__background-pattern","dots",t])})}var ya;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ya||(ya={}));const pne={[ya.Dots]:1,[ya.Lines]:1,[ya.Cross]:6},gne=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function gA({id:e,variant:t=ya.Dots,gap:n=20,size:r,lineWidth:o=1,offset:a=0,color:l,bgColor:u,style:d,className:f,patternClassName:m}){const p=x.useRef(null),{transform:g,patternId:y}=ct(gne,Dt),b=r||pne[t],w=t===ya.Dots,N=t===ya.Cross,k=Array.isArray(n)?n:[n,n],j=[k[0]*g[2]||1,k[1]*g[2]||1],C=b*g[2],S=Array.isArray(a)?a:[a,a],E=N?[C,C]:j,P=[S[0]*g[2]||1+E[0]/2,S[1]*g[2]||1+E[1]/2],D=`${y}${e||""}`;return s.jsxs("svg",{className:en(["react-flow__background",f]),style:{...d,...Up,"--xy-background-color-props":u,"--xy-background-pattern-color-props":l},ref:p,"data-testid":"rf__background",children:[s.jsx("pattern",{id:D,x:g[0]%j[0],y:g[1]%j[1],width:j[0],height:j[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:w?s.jsx(mne,{radius:C/2,className:m}):s.jsx(hne,{dimensions:E,lineWidth:o,variant:t,className:m})}),s.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}gA.displayName="Background";const xne=x.memo(gA);function yne(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:s.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function vne(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:s.jsx("path",{d:"M0 0h32v4.2H0z"})})}function bne(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:s.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function wne(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Nne(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Th({children:e,className:t,...n}){return s.jsx("button",{type:"button",className:en(["react-flow__controls-button",t]),...n,children:e})}const jne=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function xA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:d,className:f,children:m,position:p="bottom-left",orientation:g="vertical","aria-label":y}){const b=Rt(),{isInteractive:w,minZoomReached:N,maxZoomReached:k,ariaLabelConfig:j}=ct(jne,Dt),{zoomIn:C,zoomOut:S,fitView:E}=e1(),P=()=>{C(),a==null||a()},D=()=>{S(),l==null||l()},I=()=>{E(o),u==null||u()},z=()=>{b.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d==null||d(!w)},K=g==="horizontal"?"horizontal":"vertical";return s.jsxs(Hp,{className:en(["react-flow__controls",K,f]),position:p,style:e,"data-testid":"rf__controls","aria-label":y??j["controls.ariaLabel"],children:[t&&s.jsxs(s.Fragment,{children:[s.jsx(Th,{onClick:P,className:"react-flow__controls-zoomin",title:j["controls.zoomIn.ariaLabel"],"aria-label":j["controls.zoomIn.ariaLabel"],disabled:k,children:s.jsx(yne,{})}),s.jsx(Th,{onClick:D,className:"react-flow__controls-zoomout",title:j["controls.zoomOut.ariaLabel"],"aria-label":j["controls.zoomOut.ariaLabel"],disabled:N,children:s.jsx(vne,{})})]}),n&&s.jsx(Th,{className:"react-flow__controls-fitview",onClick:I,title:j["controls.fitView.ariaLabel"],"aria-label":j["controls.fitView.ariaLabel"],children:s.jsx(bne,{})}),r&&s.jsx(Th,{className:"react-flow__controls-interactive",onClick:z,title:j["controls.interactive.ariaLabel"],"aria-label":j["controls.interactive.ariaLabel"],children:w?s.jsx(Nne,{}):s.jsx(wne,{})}),m]})}xA.displayName="Controls";const Cne=x.memo(xA);function kne({id:e,x:t,y:n,width:r,height:o,style:a,color:l,strokeColor:u,strokeWidth:d,className:f,borderRadius:m,shapeRendering:p,selected:g,onClick:y}){const{background:b,backgroundColor:w}=a||{},N=l||b||w;return s.jsx("rect",{className:en(["react-flow__minimap-node",{selected:g},f]),x:t,y:n,rx:m,ry:m,width:r,height:o,style:{fill:N,stroke:u,strokeWidth:d},shapeRendering:p,onClick:y?k=>y(k,e):void 0})}const Sne=x.memo(kne),_ne=e=>e.nodes.map(t=>t.id),tv=e=>e instanceof Function?e:()=>e;function Ene({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:a=Sne,onClick:l}){const u=ct(_ne,Dt),d=tv(t),f=tv(e),m=tv(n),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return s.jsx(s.Fragment,{children:u.map(g=>s.jsx(Tne,{id:g,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:m,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:a,onClick:l,shapeRendering:p},g))})}function Pne({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:a,shapeRendering:l,NodeComponent:u,onClick:d}){const{node:f,x:m,y:p,width:g,height:y}=ct(b=>{const w=b.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const N=w.internals.userNode,{x:k,y:j}=w.internals.positionAbsolute,{width:C,height:S}=Co(N);return{node:N,x:k,y:j,width:C,height:S}},Dt);return!f||f.hidden||!yM(f)?null:s.jsx(u,{x:m,y:p,width:g,height:y,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:o,strokeColor:n(f),strokeWidth:a,shapeRendering:l,onClick:d,id:f.id})}const Tne=x.memo(Pne);var Mne=x.memo(Ene);const Ane=200,Dne=150,Rne=e=>!e.hidden,One=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?xM(Ud(e.nodeLookup,{filter:Rne}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ine="react-flow__minimap-desc";function yA({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:a=5,nodeStrokeWidth:l,nodeComponent:u,bgColor:d,maskColor:f,maskStrokeColor:m,maskStrokeWidth:p,position:g="bottom-right",onClick:y,onNodeClick:b,pannable:w=!1,zoomable:N=!1,ariaLabel:k,inversePan:j,zoomStep:C=1,offsetScale:S=5}){const E=Rt(),P=x.useRef(null),{boundingRect:D,viewBB:I,rfId:z,panZoom:K,translateExtent:q,flowWidth:H,flowHeight:B,ariaLabelConfig:R}=ct(One,Dt),M=(e==null?void 0:e.width)??Ane,F=(e==null?void 0:e.height)??Dne,L=D.width/M,A=D.height/F,O=Math.max(L,A),U=O*M,V=O*F,$=S*O,Y=D.x-(U-D.width)/2-$,X=D.y-(V-D.height)/2-$,ne=U+$*2,ie=V+$*2,J=`${Ine}-${z}`,re=x.useRef(0),ce=x.useRef();re.current=O,x.useEffect(()=>{if(P.current&&K)return ce.current=ZJ({domNode:P.current,panZoom:K,getTransform:()=>E.getState().transform,getViewScale:()=>re.current}),()=>{var Ne;(Ne=ce.current)==null||Ne.destroy()}},[K]),x.useEffect(()=>{var Ne;(Ne=ce.current)==null||Ne.update({translateExtent:q,width:H,height:B,inversePan:j,pannable:w,zoomStep:C,zoomable:N})},[w,N,j,C,q,H,B]);const fe=y?Ne=>{var Le;const[Oe,Xe]=((Le=ce.current)==null?void 0:Le.pointer(Ne))||[0,0];y(Ne,{x:Oe,y:Xe})}:void 0,pe=b?x.useCallback((Ne,Oe)=>{const Xe=E.getState().nodeLookup.get(Oe).internals.userNode;b(Ne,Xe)},[]):void 0,ye=k??R["minimap.ariaLabel"];return s.jsx(Hp,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:en(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:s.jsxs("svg",{width:M,height:F,viewBox:`${Y} ${X} ${ne} ${ie}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":J,ref:P,onClick:fe,children:[ye&&s.jsx("title",{id:J,children:ye}),s.jsx(Mne,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:u}),s.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-$},${X-$}h${ne+$*2}v${ie+$*2}h${-ne-$*2}z
|
|
634
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}yA.displayName="MiniMap";x.memo(yA);const Lne=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Fne={[pc.Line]:"right",[pc.Handle]:"bottom-right"};function $ne({nodeId:e,position:t,variant:n=pc.Handle,className:r,style:o=void 0,children:a,color:l,minWidth:u=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:y=!0,shouldResize:b,onResizeStart:w,onResize:N,onResizeEnd:k}){const j=GM(),C=typeof e=="string"?e:j,S=Rt(),E=x.useRef(null),P=n===pc.Handle,D=ct(x.useCallback(Lne(P&&y),[P,y]),Dt),I=x.useRef(null),z=t??Fne[n];x.useEffect(()=>{if(!(!E.current||!C))return I.current||(I.current=fee({domNode:E.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:q,transform:H,snapGrid:B,snapToGrid:R,nodeOrigin:M,domNode:F}=S.getState();return{nodeLookup:q,transform:H,snapGrid:B,snapToGrid:R,nodeOrigin:M,paneDomNode:F}},onChange:(q,H)=>{const{triggerNodeChanges:B,nodeLookup:R,parentLookup:M,nodeOrigin:F}=S.getState(),L=[],A={x:q.x,y:q.y},O=R.get(C);if(O&&O.expandParent&&O.parentId){const U=O.origin??F,V=q.width??O.measured.width??0,$=q.height??O.measured.height??0,Y={id:O.id,parentId:O.parentId,rect:{width:V,height:$,...vM({x:q.x??O.position.x,y:q.y??O.position.y},{width:V,height:$},O.parentId,R,U)}},X=Jw([Y],R,M,F);L.push(...X),A.x=q.x?Math.max(U[0]*V,q.x):void 0,A.y=q.y?Math.max(U[1]*$,q.y):void 0}if(A.x!==void 0&&A.y!==void 0){const U={id:C,type:"position",position:{...A}};L.push(U)}if(q.width!==void 0&&q.height!==void 0){const V={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};L.push(V)}for(const U of H){const V={...U,type:"position"};L.push(V)}B(L)},onEnd:({width:q,height:H})=>{const B={id:C,type:"dimensions",resizing:!1,dimensions:{width:q,height:H}};S.getState().triggerNodeChanges([B])}})),I.current.update({controlPosition:z,boundaries:{minWidth:u,minHeight:d,maxWidth:f,maxHeight:m},keepAspectRatio:p,resizeDirection:g,onResizeStart:w,onResize:N,onResizeEnd:k,shouldResize:b}),()=>{var q;(q=I.current)==null||q.destroy()}},[z,u,d,f,m,p,w,N,k,b]);const K=z.split("-");return s.jsx("div",{className:en(["react-flow__resize-control","nodrag",...K,n,r]),ref:E,style:{...o,scale:D,...l&&{[P?"backgroundColor":"borderColor"]:l}},children:a})}x.memo($ne);const vA={note:"#6366f1",research:"#8b5cf6",preference:"#ec4899",objection:"#ef4444",competitive_intel:"#f97316",relationship_map:"#14b8a6",meeting_notes:"#3b82f6",summary:"#06b6d4",transcript:"#64748b",agent_reasoning:"#a855f7"},Vne={note:"Manual note added by a user or agent",research:"Background research about this contact or account",preference:"Known preferences — communication style, product focus, etc.",objection:"Stated blockers or objections during the sales process",competitive_intel:"Insights about competing vendors or alternatives under evaluation",relationship_map:"Org chart details, key stakeholders, and internal dynamics",meeting_notes:"Notes captured during a call or meeting",summary:"AI-generated or manual summary of interactions",transcript:"Verbatim or edited call/meeting transcript",agent_reasoning:"Reasoning trace captured by an AI agent during a task"};function Kp({subjectType:e,subjectId:t}){const[n,r]=x.useState(!0),[o,a]=x.useState(null),{data:l,isLoading:u}=Tm({subject_type:e,subject_id:t,is_current:!0,limit:50}),{data:d}=b7({subject_type:e,subject_id:t,limit:10}),f=a3(),m=(l==null?void 0:l.data)??[],p=(d==null?void 0:d.data)??[],g=m.reduce((N,k)=>{const j=k.context_type??"note";return N[j]||(N[j]=[]),N[j].push(k),N},{}),y=Object.keys(g).sort(),b=o?g[o]??[]:m,w=async N=>{await f.mutateAsync(N),de({title:"Context entry reviewed"})};return u?s.jsxs("div",{className:"space-y-2 animate-pulse",children:[s.jsx("div",{className:"h-4 bg-muted rounded w-1/3"}),s.jsx("div",{className:"h-16 bg-muted rounded"}),s.jsx("div",{className:"h-16 bg-muted rounded"})]}):m.length===0&&p.length===0?null:s.jsxs("div",{className:"px-4 mx-4 mt-4",children:[s.jsxs("button",{onClick:()=>r(!n),className:"flex items-center gap-1.5 w-full text-left mb-2",children:[s.jsx(ki,{className:"w-3.5 h-3.5 text-primary"}),s.jsxs("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide flex-1",children:["Context",s.jsxs("span",{className:"ml-1.5 font-mono font-normal text-muted-foreground/50",children:["(",m.length,")"]})]}),p.length>0&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-warning font-medium",children:[s.jsx(Bs,{className:"w-3 h-3"})," ",p.length," stale"]}),n?s.jsx(ms,{className:"w-3.5 h-3.5 text-muted-foreground"}):s.jsx(Wn,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),n&&s.jsxs("div",{className:"space-y-3",children:[y.length>1&&s.jsxs("div",{className:"flex gap-1 flex-wrap",children:[s.jsx("button",{onClick:()=>a(null),className:`px-2 py-0.5 rounded-md text-[10px] font-semibold transition-all ${o?"bg-muted text-muted-foreground hover:text-foreground":"bg-primary/15 text-primary"}`,children:"All"}),y.map(N=>s.jsxs("button",{onClick:()=>a(o===N?null:N),className:`px-2 py-0.5 rounded-md text-[10px] font-semibold transition-all ${o===N?"bg-primary/15 text-primary":"bg-muted text-muted-foreground hover:text-foreground"}`,children:[N.replace(/_/g," "),s.jsx("span",{className:"ml-1 opacity-50",children:g[N].length})]},N))]}),p.length>0&&!o&&s.jsxs("div",{className:"rounded-xl border border-warning/30 bg-warning/5 p-3 space-y-2",children:[s.jsx("p",{className:"text-[10px] font-semibold text-warning uppercase tracking-wide",children:"Needs Review"}),p.map(N=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-foreground truncate",children:N.title??N.context_type}),s.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Expired ",N.valid_until?new Date(N.valid_until).toLocaleDateString():""]})]}),s.jsxs("button",{onClick:()=>w(N.id),disabled:f.isPending,className:"flex items-center gap-1 px-2 py-1 rounded-md text-[10px] font-medium bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:[s.jsx(Gt,{className:"w-3 h-3"})," Review"]})]},N.id))]}),b.map(N=>{const k=vA[N.context_type]??"#94a3b8",j=N.valid_until&&new Date(N.valid_until)<new Date;return s.jsxs("div",{className:`rounded-xl border p-3 space-y-1.5 ${j?"border-warning/30 bg-warning/5":"border-border bg-card"}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold capitalize cursor-help",style:{backgroundColor:k+"18",color:k},title:Vne[N.context_type]??N.context_type.replace(/_/g," "),children:N.context_type.replace(/_/g," ")}),N.confidence!=null&&s.jsx("span",{title:`${Math.round(N.confidence*100)}% confidence`,className:`text-[10px] font-semibold px-1 py-0.5 rounded cursor-help ${N.confidence>=.8?"text-green-500 bg-green-500/10":N.confidence>=.5?"text-amber-500 bg-amber-500/10":"text-muted-foreground bg-muted"}`,children:N.confidence>=.8?"Verified":N.confidence>=.5?"Likely":"Uncertain"}),s.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:new Date(N.created_at).toLocaleDateString()})]}),N.title&&s.jsx("p",{className:"text-sm font-medium text-foreground",children:N.title}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:N.body}),N.tags&&N.tags.length>0&&s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.jsx(b5,{className:"w-2.5 h-2.5 text-muted-foreground"}),N.tags.map(C=>s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-muted text-[10px] text-muted-foreground",children:C},C))]}),N.source&&s.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Source: ",N.source]})]},N.id)})]})]})}const zne={contact:"#6366f1",account:"#8b5cf6",opportunity:"#f59e0b",use_case:"#22c55e"};function nv(e,t,n,r,o){const a=2*Math.PI*r/o-Math.PI/2;return{x:e+n*Math.cos(a),y:t+n*Math.sin(a)}}function Bne(e,t,n){const r=[],o=[];r.push({id:"entity",position:{x:300,y:260},data:{label:n,color:zne[t]??"#6366f1",size:56},type:"entityNode"});const a=(e==null?void 0:e.context_entries)??{},l=Object.keys(a).slice(0,8),u=((e==null?void 0:e.activities)??[]).slice(0,5);return l.forEach((d,f)=>{const m=nv(300,260,165,f,Math.max(l.length,1)),p=vA[d]??"#94a3b8",g=`type-${d}`;r.push({id:g,position:m,data:{label:d.replace(/_/g," "),color:p,size:36},type:"clusterNode"}),o.push({id:`e-entity-${g}`,source:"entity",target:g,style:{stroke:p,strokeWidth:2,opacity:.6}});const y=a[d].slice(0,5);y.forEach((b,w)=>{const N=nv(m.x,m.y,80,w,Math.max(y.length,1)),k=`entry-${b.id}`;r.push({id:k,position:N,data:{label:(b.title??b.body??"").slice(0,22)||d,body:b.body,color:p,size:24},type:"leafNode"}),o.push({id:`e-${g}-${k}`,source:g,target:k,style:{stroke:p,strokeWidth:1,opacity:.4}})})}),u.forEach((d,f)=>{const m=nv(300,260,200,f+l.length+1,l.length+u.length+1),p=`activity-${d.id??f}`;r.push({id:p,position:m,data:{label:(d.type??d.activity_type??"activity").replace(/_/g," ").slice(0,18),body:d.body??d.description,color:"#64748b",size:22},type:"activityNode"}),o.push({id:`e-act-${p}`,source:p,target:"entity",style:{stroke:"#64748b",strokeWidth:1,strokeDasharray:"4 3",opacity:.35}})}),{nodes:r,edges:o}}function Wne({data:e}){return s.jsx("div",{className:"flex items-center justify-center rounded-2xl text-white text-xs font-bold shadow-lg select-none border-2 border-white/20",style:{width:e.size,height:e.size,backgroundColor:e.color,fontSize:10,padding:4,textAlign:"center",lineHeight:1.2},children:e.label.slice(0,12)})}function Hne({data:e}){return s.jsx("div",{className:"flex items-center justify-center rounded-xl text-white text-[9px] font-semibold shadow-md select-none capitalize",style:{width:e.size,height:e.size,backgroundColor:e.color+"cc",fontSize:9,padding:3,textAlign:"center",lineHeight:1.2},children:e.label.slice(0,10)})}function Une({data:e}){return s.jsx("div",{className:"flex items-center justify-center rounded-lg text-white text-[8px] font-medium shadow select-none",style:{width:e.size,height:e.size,backgroundColor:e.color+"99",fontSize:8,padding:2,textAlign:"center",lineHeight:1.2},children:e.label.slice(0,8)})}function qne({data:e}){return s.jsx("div",{className:"flex items-center justify-center rounded-lg text-white text-[8px] font-medium shadow select-none",style:{width:e.size,height:e.size,backgroundColor:"#64748b99",fontSize:8,padding:2,textAlign:"center",lineHeight:1.2},children:e.label.slice(0,8)})}const Kne={entityNode:Wne,clusterNode:Hne,leafNode:Une,activityNode:qne};function bA({subjectType:e,subjectId:t,subjectName:n}){const{data:r,isLoading:o}=u3(e,t),a=(r==null?void 0:r.briefing)??r,{nodes:l,edges:u}=x.useMemo(()=>Bne(a,e,n),[a,e,n]),[d,,f]=dne(l),[m,,p]=fne(u),[g,y]=x.useState(null);x.useEffect(()=>{},[a]);const b=(N,k)=>{const j=k.data;y({label:j.label,body:j.body})},w=!a||Object.keys((a==null?void 0:a.context_entries)??{}).length===0&&((a==null?void 0:a.activities)??[]).length===0;return o?s.jsxs("div",{className:"flex items-center justify-center h-[450px] text-muted-foreground gap-2 text-sm",children:[s.jsx(gr,{className:"w-4 h-4 animate-spin"})," Loading graph…"]}):w?s.jsxs("div",{className:"flex flex-col items-center justify-center h-[450px] text-center text-muted-foreground px-8",children:[s.jsx("div",{className:"text-5xl mb-4 opacity-20",children:"⬡"}),s.jsx("p",{className:"font-medium text-sm text-foreground",children:"No context data yet"}),s.jsxs("p",{className:"text-xs mt-1 max-w-xs",children:["Agents populate this graph as they interact with this ",e.replace("_"," "),". Context entries, activities, and briefings will appear here."]})]}):s.jsxs("div",{className:"relative",style:{height:450},children:[s.jsxs(une,{nodes:d,edges:m,onNodesChange:f,onEdgesChange:p,onNodeClick:b,nodeTypes:Kne,fitView:!0,fitViewOptions:{padding:.2},minZoom:.4,maxZoom:2,proOptions:{hideAttribution:!0},children:[s.jsx(xne,{color:"#94a3b8",gap:20,size:1,style:{opacity:.06}}),s.jsx(Cne,{showInteractive:!1,className:"!bottom-3 !left-3"})]},t),g&&s.jsxs("div",{className:"absolute bottom-3 right-3 w-64 bg-card border border-border rounded-xl shadow-lg p-3 z-10",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[s.jsx("p",{className:"text-xs font-semibold text-foreground capitalize leading-tight",children:g.label}),s.jsx("button",{onClick:()=>y(null),className:"text-muted-foreground hover:text-foreground flex-shrink-0",children:s.jsx(Ht,{className:"w-3 h-3"})})]}),g.body&&s.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-4 whitespace-pre-wrap",children:g.body})]})]})}function Yp({subjectType:e,subjectId:t,onClose:n}){var f,m,p;const[r,o]=x.useState(!0),{data:a,isLoading:l,error:u}=u3(e,t,{format:"json",include_stale:r});if(l)return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(rv,{onClose:n}),s.jsxs("div",{className:"flex-1 p-5 space-y-4 animate-pulse",children:[s.jsx("div",{className:"h-6 bg-muted rounded w-1/2"}),s.jsx("div",{className:"h-20 bg-muted rounded"}),s.jsx("div",{className:"h-20 bg-muted rounded"}),s.jsx("div",{className:"h-20 bg-muted rounded"})]})]});if(u)return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(rv,{onClose:n}),s.jsx("div",{className:"p-5 text-sm text-destructive",children:"Failed to load briefing."})]});const d=(a==null?void 0:a.briefing)??a;return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(rv,{onClose:n}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[((f=d==null?void 0:d.staleness_warnings)==null?void 0:f.length)>0&&s.jsx(Mh,{icon:s.jsx(Bs,{className:"w-3.5 h-3.5 text-warning"}),title:"Stale Context",defaultOpen:!0,children:s.jsx("div",{className:"space-y-2",children:d.staleness_warnings.map(g=>s.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[s.jsx(Bs,{className:"w-3 h-3 text-warning flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:g.title??g.context_type}),s.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["expired ",g.valid_until?new Date(g.valid_until).toLocaleDateString():""]})]})]},g.id))})}),((m=d==null?void 0:d.activities)==null?void 0:m.length)>0&&s.jsx(Mh,{icon:s.jsx(tc,{className:"w-3.5 h-3.5 text-primary"}),title:`Recent Activities (${d.activities.length})`,defaultOpen:!0,children:s.jsx("div",{className:"space-y-1.5",children:d.activities.slice(0,10).map(g=>s.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[s.jsx("span",{className:"w-16 flex-shrink-0 text-muted-foreground",children:new Date(g.occurred_at??g.created_at).toLocaleDateString()}),s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-muted text-[10px] font-medium capitalize flex-shrink-0",children:(g.type??g.activity_type??"").replace(/_/g," ")}),s.jsx("span",{className:"text-foreground truncate",children:g.description??g.body??""})]},g.id))})}),((p=d==null?void 0:d.open_assignments)==null?void 0:p.length)>0&&s.jsx(Mh,{icon:s.jsx(pm,{className:"w-3.5 h-3.5 text-primary"}),title:`Open Assignments (${d.open_assignments.length})`,defaultOpen:!0,children:s.jsx("div",{className:"space-y-1.5",children:d.open_assignments.map(g=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx(Yne,{status:g.status}),s.jsx("span",{className:"text-foreground flex-1 truncate",children:g.title}),s.jsx(Qne,{priority:g.priority})]},g.id))})}),(d==null?void 0:d.context_entries)&&Object.keys(d.context_entries).length>0&&s.jsx(Mh,{icon:s.jsx(ki,{className:"w-3.5 h-3.5 text-primary"}),title:"Context",defaultOpen:!0,children:s.jsx("div",{className:"space-y-3",children:Object.entries(d.context_entries).map(([g,y])=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:g.replace(/_/g," ")}),s.jsx("div",{className:"space-y-1.5",children:y.map(b=>s.jsxs("div",{className:"rounded-lg bg-muted/50 p-2",children:[b.title&&s.jsx("p",{className:"text-xs font-medium text-foreground",children:b.title}),s.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-2",children:b.body})]},b.id))})]},g))})}),s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:g=>o(g.target.checked),className:"w-3.5 h-3.5 rounded border-border accent-primary"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Include stale context"})]})]})]})}function rv({onClose:e}){return s.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-border",children:[s.jsx(ls,{className:"w-4 h-4 text-primary"}),s.jsx("h2",{className:"font-display font-bold text-foreground flex-1",children:"Briefing"}),s.jsx("button",{onClick:e,className:"p-1 rounded-lg hover:bg-muted transition-colors",children:s.jsx(Ht,{className:"w-4 h-4 text-muted-foreground"})})]})}function Mh({icon:e,title:t,children:n,defaultOpen:r=!1}){const[o,a]=x.useState(r);return s.jsxs("div",{className:"rounded-xl border border-border",children:[s.jsxs("button",{onClick:()=>a(!o),className:"flex items-center gap-2 w-full p-3 text-left",children:[e,s.jsx("span",{className:"text-xs font-display font-bold text-foreground flex-1",children:t}),o?s.jsx(ms,{className:"w-3.5 h-3.5 text-muted-foreground"}):s.jsx(Wn,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),o&&s.jsx("div",{className:"px-3 pb-3",children:n})]})}function Yne({status:e}){const n={pending:"#f59e0b",accepted:"#3b82f6",in_progress:"#8b5cf6",blocked:"#ef4444",completed:"#22c55e",declined:"#94a3b8",cancelled:"#94a3b8"}[e]??"#94a3b8";return s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium capitalize flex-shrink-0",style:{backgroundColor:n+"18",color:n},children:e.replace(/_/g," ")})}function Qne({priority:e}){const t={urgent:"#ef4444",high:"#f97316",normal:"#3b82f6",low:"#94a3b8"};return s.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:t[e]??"#94a3b8"},title:e})}const Go="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",ni="text-xs font-mono text-muted-foreground uppercase tracking-wider",Gne=["lead","prospect","customer","churned"];function Xne({contact:e,onSave:t,onCancel:n,onDelete:r,isSaving:o}){const[a,l]=x.useState(!1),[u,d]=x.useState({first_name:e.first_name??"",last_name:e.last_name??"",email:e.email??"",phone:e.phone??"",company_name:e.company_name??"",title:e.title??"",lifecycle_stage:e.lifecycle_stage??"lead",source:e.source??"",owner_id:e.owner_id??""}),[f,m]=x.useState(()=>{const j={};if(e.custom_fields)for(const[C,S]of Object.entries(e.custom_fields))j[C]=String(S??"");return j}),{data:p}=wp(),g=(p==null?void 0:p.data)??[],{data:y}=Mc("contact"),b=(y==null?void 0:y.fields)??[],w=(j,C)=>d(S=>({...S,[j]:C})),N=(j,C)=>m(S=>({...S,[j]:C})),k=()=>{const j={};for(const[S,E]of Object.entries(u))E!==""&&(j[S]=E);const C={};for(const S of b){const E=f[S.field_key]??"";E!==""&&(S.field_type==="number"?C[S.field_key]=Number(E):S.field_type==="boolean"?C[S.field_key]=E==="true":C[S.field_key]=E)}Object.keys(C).length>0&&(j.custom_fields=C),t(j)};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-border",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-accent hover:underline",children:[s.jsx(Aa,{className:"w-3.5 h-3.5"})," Back"]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Editing contact"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:ni,children:["First Name",s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("input",{type:"text",value:u.first_name,onChange:j=>w("first_name",j.target.value),placeholder:"First name",className:Go})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:ni,children:"Last Name"}),s.jsx("input",{type:"text",value:u.last_name,onChange:j=>w("last_name",j.target.value),placeholder:"Last name",className:Go})]})]}),[{key:"email",label:"Email",type:"email",placeholder:"email@example.com"},{key:"phone",label:"Phone",type:"tel",placeholder:"(555) 123-4567"},{key:"company_name",label:"Company",type:"text",placeholder:"Company name"},{key:"title",label:"Title",type:"text",placeholder:"Job title"},{key:"source",label:"Source",type:"text",placeholder:"e.g. inbound, referral"}].map(j=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:ni,children:j.label}),s.jsx("input",{type:j.type,value:u[j.key],onChange:C=>w(j.key,C.target.value),placeholder:j.placeholder,className:Go})]},j.key)),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:ni,children:"Stage"}),s.jsx("select",{value:u.lifecycle_stage,onChange:j=>w("lifecycle_stage",j.target.value),className:`${Go} pr-3`,children:Gne.map(j=>s.jsx("option",{value:j,children:j.charAt(0).toUpperCase()+j.slice(1)},j))})]}),g.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:ni,children:"Owner"}),s.jsxs("select",{value:u.owner_id,onChange:j=>w("owner_id",j.target.value),className:`${Go} pr-3`,children:[s.jsx("option",{value:"",children:"Unassigned"}),g.map(j=>s.jsx("option",{value:j.id,children:j.name||j.email},j.id))]})]}),b.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"border-t border-border pt-2",children:s.jsx("p",{className:ni,children:"Custom Fields"})}),b.map(j=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:ni,children:[j.label,j.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),(j.field_type==="text"||!j.field_type)&&s.jsx("input",{type:"text",value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:Go}),j.field_type==="number"&&s.jsx("input",{type:"number",value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:Go}),j.field_type==="date"&&s.jsx(An,{value:f[j.field_key]??"",onChange:C=>N(j.field_key,C),required:j.required}),j.field_type==="boolean"&&s.jsxs("div",{className:"flex items-center gap-2 h-10",children:[s.jsx("input",{type:"checkbox",checked:f[j.field_key]==="true",onChange:C=>N(j.field_key,C.target.checked?"true":"false"),className:"w-4 h-4 rounded border-border accent-primary"}),s.jsx("span",{className:"text-sm text-foreground",children:"Yes"})]}),(j.field_type==="select"||j.field_type==="multi_select")&&s.jsxs("select",{value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:`${Go} pr-3`,children:[s.jsx("option",{value:"",children:"Select…"}),(j.options??[]).map(C=>s.jsx("option",{value:C,children:C},C))]})]},j.field_key))]}),s.jsx("button",{onClick:k,disabled:!u.first_name.trim()||o,className:"w-full h-10 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-40 transition-colors",children:o?"Saving…":"Save Changes"}),a?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>l(!1),className:"flex-1 h-9 rounded-md border border-border text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:"Cancel"}),s.jsx("button",{onClick:r,className:"flex-1 h-9 rounded-md bg-destructive text-destructive-foreground text-sm font-medium hover:bg-destructive/90 transition-colors",children:"Confirm Delete"})]}):s.jsxs("button",{onClick:()=>l(!0),className:"w-full h-9 rounded-md border border-destructive/40 text-destructive text-sm font-medium hover:bg-destructive/10 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(Bn,{className:"w-3.5 h-3.5"})," Delete Contact"]})]})]})}function Zne(){const{drawerEntityId:e,openAIWithContext:t,closeDrawer:n,drawerBriefing:r}=lt(),{enabled:o}=kr(),a=Cn(),[l,u]=x.useState(!1),[d,f]=x.useState(r?"brief":"detail"),[m,p]=x.useState(!1),[g,y]=x.useState(""),b=x.useRef(null),{data:w,isLoading:N}=$B(e??""),{data:k}=tw({contact_id:e??void 0,limit:20}),j=(k==null?void 0:k.data)??[],{data:C}=Tm({subject_type:"contact",subject_id:e??"",context_type:"note",limit:20}),S=(C==null?void 0:C.data)??[],E=v7(),P=VB(e??""),D=zB(e??"");if(N)return s.jsx("div",{className:"flex flex-col gap-4 p-6 animate-pulse",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),s.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]})]})});if(!(w!=null&&w.contact))return s.jsx("div",{className:"p-4 text-muted-foreground",children:"Contact not found"});const I=w.contact,z=[I.first_name,I.last_name].filter(Boolean).join(" ")||I.email||"",K=I.company_name??"",q=I.lifecycle_stage??"",H=I.lead_score??0;return d==="brief"?s.jsxs(s.Fragment,{children:[s.jsx(Vl,{view:d,onChange:f}),s.jsx(Yp,{subjectType:"contact",subjectId:e,onClose:()=>f("detail")})]}):d==="graph"?s.jsxs(s.Fragment,{children:[s.jsx(Vl,{view:d,onChange:f}),s.jsx(bA,{subjectType:"contact",subjectId:e,subjectName:z})]}):l?s.jsx(Xne,{contact:I,onSave:async B=>{try{await P.mutateAsync(B),u(!1),de({title:"Contact updated"})}catch(R){de({title:"Failed to update contact",description:R instanceof Error?R.message:"Please try again.",variant:"destructive"})}},onCancel:()=>u(!1),onDelete:async()=>{try{await D.mutateAsync(),n(),de({title:"Contact deleted"})}catch(B){de({title:"Failed to delete contact",description:B instanceof Error?B.message:"Please try again.",variant:"destructive"})}},isSaving:P.isPending}):s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"p-6 border-b border-border",children:[s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx(yo,{name:z,className:"w-14 h-14 rounded-2xl text-lg"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h2",{className:"font-display font-extrabold text-xl text-foreground",children:z}),K&&s.jsx("p",{className:"text-sm text-muted-foreground",children:K}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[q&&s.jsx(od,{stage:q}),H>0&&s.jsx(_Q,{score:H})]})]})]}),s.jsxs("div",{className:"flex gap-2 mt-4",children:[I.phone&&s.jsxs("a",{href:`tel:${I.phone}`,className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-all press-scale",children:[s.jsx(Gu,{className:"w-3.5 h-3.5"})," Call"]}),I.email&&s.jsxs("a",{href:`mailto:${I.email}`,className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(ho,{className:"w-3.5 h-3.5"})," Email"]}),s.jsxs("button",{onClick:()=>{p(B=>!B),setTimeout(()=>{var B;return(B=b.current)==null?void 0:B.focus()},50)},className:`flex items-center gap-1.5 px-3.5 py-2 rounded-xl text-sm font-medium transition-all press-scale ${m?"bg-primary text-primary-foreground":"bg-muted text-foreground hover:bg-muted/80"}`,children:[s.jsx(y5,{className:"w-3.5 h-3.5"})," Note"]}),s.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(br,{className:"w-3.5 h-3.5"})," Edit"]}),o&&s.jsxs("button",{onClick:()=>{t({type:"contact",id:I.id,name:z,detail:K}),n(),a("/agent")},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl border border-accent/30 bg-accent/5 text-accent text-sm font-semibold hover:bg-accent/10 transition-all ml-auto press-scale",children:[s.jsx(an,{className:"w-3.5 h-3.5"})," Chat"]})]})]}),s.jsx(Vl,{view:d,onChange:f}),m&&s.jsxs("div",{className:"mx-4 mt-4 rounded-xl border border-border bg-card p-3 space-y-2",children:[s.jsx("textarea",{ref:b,value:g,onChange:B=>y(B.target.value),placeholder:"Write a note…",rows:3,className:"w-full px-3 py-2 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring resize-none"}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("button",{onClick:()=>{p(!1),y("")},className:"text-xs text-muted-foreground hover:text-foreground",children:"Cancel"}),s.jsxs("button",{disabled:!g.trim()||E.isPending,onClick:async()=>{await E.mutateAsync({subject_type:"contact",subject_id:e,context_type:"note",body:g.trim()}),y(""),p(!1),de({title:"Note saved"})},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold disabled:opacity-40 transition-colors",children:[s.jsx(Lr,{className:"w-3 h-3"})," Save"]})]})]}),S.length>0&&s.jsxs("div",{className:"p-4 mx-4 mt-4 space-y-3",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Notes"}),S.map(B=>{var R;return s.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[B.pinned&&s.jsx(tF,{className:"w-3 h-3 text-accent"}),s.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:new Date(B.created_at).toLocaleDateString()})]}),B.title&&s.jsx("p",{className:"text-xs font-medium text-foreground",children:B.title}),s.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:B.body}),((R=B.metadata)==null?void 0:R.author_type)&&s.jsx("p",{className:"text-[10px] text-muted-foreground capitalize",children:B.metadata.author_type==="agent"?"AI Agent":B.metadata.author_type})]},B.id)})]}),s.jsxs("div",{className:"p-4 mx-4 mt-4 space-y-3",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Details"}),[{label:"Email",value:I.email},{label:"Phone",value:I.phone},{label:"Company",value:K},{label:"Source",value:I.source},{label:"Last Contacted",value:I.last_contacted_at?new Date(I.last_contacted_at).toLocaleDateString():void 0},{label:"Created",value:I.created_at?new Date(I.created_at).toLocaleDateString():void 0}].filter(B=>B.value).map(B=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:B.label}),s.jsx("span",{className:"text-sm text-foreground",children:B.value})]},B.label)),I.tags&&I.tags.length>0&&s.jsx("div",{className:"flex items-center gap-1.5 flex-wrap mt-2",children:I.tags.map(B=>s.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-muted text-xs text-muted-foreground font-medium",children:B},B))})]}),s.jsx(Rp,{objectType:"contact",values:I.custom_fields??{}}),s.jsx(Kp,{subjectType:"contact",subjectId:e}),s.jsxs("div",{className:"p-4 mx-4 mt-4 mb-6",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide mb-3",children:"Timeline"}),s.jsx(AT,{activities:j})]})]})}const ri="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",si="text-xs font-mono text-muted-foreground uppercase tracking-wider",Jne=["prospecting","qualification","proposal","negotiation","closed_won","closed_lost"];function ere({opportunity:e,onSave:t,onCancel:n,onDelete:r,isSaving:o}){const[a,l]=x.useState(!1),[u,d]=x.useState({name:e.name??"",amount:e.amount!=null?String(e.amount):"",stage:e.stage??"prospecting",close_date:e.close_date?e.close_date.slice(0,10):"",probability:e.probability!=null?String(e.probability):"",description:e.description??"",owner_id:e.owner_id??""}),[f,m]=x.useState(()=>{const j={};if(e.custom_fields)for(const[C,S]of Object.entries(e.custom_fields))j[C]=String(S??"");return j}),{data:p}=wp(),g=(p==null?void 0:p.data)??[],{data:y}=Mc("opportunity"),b=(y==null?void 0:y.fields)??[],w=(j,C)=>d(S=>({...S,[j]:C})),N=(j,C)=>m(S=>({...S,[j]:C})),k=()=>{const j={};for(const[S,E]of Object.entries(u))E!==""&&(S==="amount"||S==="probability"?j[S]=Number(E)||0:j[S]=E);const C={};for(const S of b){const E=f[S.field_key]??"";E!==""&&(S.field_type==="number"?C[S.field_key]=Number(E):S.field_type==="boolean"?C[S.field_key]=E==="true":C[S.field_key]=E)}Object.keys(C).length>0&&(j.custom_fields=C),t(j)};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-border",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-accent hover:underline",children:[s.jsx(Aa,{className:"w-3.5 h-3.5"})," Back"]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Editing opportunity"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:si,children:["Opportunity Name",s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("input",{type:"text",value:u.name,onChange:j=>w("name",j.target.value),placeholder:"e.g. Acme Enterprise",className:ri})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:si,children:"Stage"}),s.jsx("select",{value:u.stage,onChange:j=>w("stage",j.target.value),className:`${ri} pr-3`,children:Jne.map(j=>s.jsx("option",{value:j,children:j.replace(/_/g," ").replace(/\b\w/g,C=>C.toUpperCase())},j))})]}),[{key:"amount",label:"Amount ($)",type:"number",placeholder:"50000"},{key:"close_date",label:"Close Date",type:"date",placeholder:""},{key:"probability",label:"Probability (%)",type:"number",placeholder:"50"}].map(j=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:si,children:j.label}),j.type==="date"?s.jsx(An,{value:u[j.key]??"",onChange:C=>w(j.key,C),placeholder:"Select close date"}):s.jsx("input",{type:j.type,value:u[j.key],onChange:C=>w(j.key,C.target.value),placeholder:j.placeholder,className:ri})]},j.key)),g.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:si,children:"Owner"}),s.jsxs("select",{value:u.owner_id,onChange:j=>w("owner_id",j.target.value),className:`${ri} pr-3`,children:[s.jsx("option",{value:"",children:"Unassigned"}),g.map(j=>s.jsx("option",{value:j.id,children:j.name||j.email},j.id))]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:si,children:"Description"}),s.jsx("textarea",{value:u.description,onChange:j=>w("description",j.target.value),placeholder:"Optional notes",rows:3,className:"w-full px-3 py-2 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring resize-none"})]}),b.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"border-t border-border pt-2",children:s.jsx("p",{className:si,children:"Custom Fields"})}),b.map(j=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:si,children:[j.label,j.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),(j.field_type==="text"||!j.field_type)&&s.jsx("input",{type:"text",value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:ri}),j.field_type==="number"&&s.jsx("input",{type:"number",value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:ri}),j.field_type==="date"&&s.jsx(An,{value:f[j.field_key]??"",onChange:C=>N(j.field_key,C),required:j.required}),j.field_type==="boolean"&&s.jsxs("div",{className:"flex items-center gap-2 h-10",children:[s.jsx("input",{type:"checkbox",checked:f[j.field_key]==="true",onChange:C=>N(j.field_key,C.target.checked?"true":"false"),className:"w-4 h-4 rounded border-border accent-primary"}),s.jsx("span",{className:"text-sm text-foreground",children:"Yes"})]}),(j.field_type==="select"||j.field_type==="multi_select")&&s.jsxs("select",{value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:`${ri} pr-3`,children:[s.jsx("option",{value:"",children:"Select…"}),(j.options??[]).map(C=>s.jsx("option",{value:C,children:C},C))]})]},j.field_key))]}),e.created_at&&s.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border mt-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Created"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.created_at).toLocaleDateString()})]}),s.jsx("button",{onClick:k,disabled:!u.name.trim()||o,className:"w-full h-10 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-40 transition-colors",children:o?"Saving…":"Save Changes"}),a?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>l(!1),className:"flex-1 h-9 rounded-md border border-border text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:"Cancel"}),s.jsx("button",{onClick:r,className:"flex-1 h-9 rounded-md bg-destructive text-destructive-foreground text-sm font-medium hover:bg-destructive/90 transition-colors",children:"Confirm Delete"})]}):s.jsxs("button",{onClick:()=>l(!0),className:"w-full h-9 rounded-md border border-destructive/40 text-destructive text-sm font-medium hover:bg-destructive/10 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(Bn,{className:"w-3.5 h-3.5"})," Delete Opportunity"]})]})]})}function tre(){const{drawerEntityId:e,openAIWithContext:t,closeDrawer:n}=lt(),{enabled:r}=kr(),o=Cn(),[a,l]=x.useState(!1),[u,d]=x.useState(!1),{data:f,isLoading:m}=UB(e??""),p=qB(e??""),g=KB(e??"");if(m)return s.jsxs("div",{className:"flex flex-col gap-4 p-6 animate-pulse",children:[s.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),s.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]});if(!(f!=null&&f.opportunity))return s.jsx("div",{className:"p-4 text-muted-foreground",children:"Opportunity not found"});const y=f.opportunity,b=y.name??"",w=y.amount??0,N=y.stage??"",k=y.probability??0,j=y.forecast_cat??"",C=y.close_date?new Date(y.close_date).toLocaleDateString():"—";return u?s.jsx(Yp,{subjectType:"opportunity",subjectId:e,onClose:()=>d(!1)}):a?s.jsx(ere,{opportunity:y,onSave:async S=>{try{await p.mutateAsync(S),l(!1),de({title:"Opportunity updated"})}catch(E){de({title:"Failed to update opportunity",description:E instanceof Error?E.message:"Please try again.",variant:"destructive"})}},onCancel:()=>l(!1),onDelete:async()=>{try{await g.mutateAsync(),n(),de({title:"Opportunity deleted"})}catch(S){de({title:"Failed to delete opportunity",description:S instanceof Error?S.message:"Please try again.",variant:"destructive"})}},isSaving:p.isPending}):s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"p-6 border-b border-border",children:[s.jsx("h2",{className:"font-display font-extrabold text-xl text-foreground",children:b}),s.jsxs("p",{className:"text-3xl font-display font-extrabold text-foreground mt-2",children:["$",w>=1e3?`${(w/1e3).toFixed(0)}K`:w]}),s.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[N&&s.jsx(od,{stage:N}),k>0&&s.jsxs("span",{className:"inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-accent/10 text-accent",children:[k,"% probability"]})]}),s.jsxs("div",{className:"flex gap-2 mt-4",children:[s.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(br,{className:"w-3.5 h-3.5"})," Edit"]}),s.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(ls,{className:"w-3.5 h-3.5"})," Brief"]}),r&&s.jsxs("button",{onClick:()=>{t({type:"opportunity",id:y.id,name:b,detail:`$${(w/1e3).toFixed(0)}K`}),n(),o("/agent")},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl border border-accent/30 bg-accent/5 text-accent text-sm font-semibold hover:bg-accent/10 transition-all ml-auto press-scale",children:[s.jsx(an,{className:"w-3.5 h-3.5"})," Chat"]})]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-3 p-4 mx-4 mt-4",children:[{icon:uF,label:"Probability",value:`${k}%`},{icon:Sd,label:"Close Date",value:C},{icon:Na,label:"Forecast",value:j||"—"}].map(S=>s.jsxs("div",{className:"bg-muted/50 rounded-xl p-3 text-center",children:[s.jsx(S.icon,{className:"w-4 h-4 text-muted-foreground mx-auto mb-1"}),s.jsx("p",{className:"text-sm font-display font-bold text-foreground truncate",children:S.value}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:S.label})]},S.label))}),s.jsxs("div",{className:"p-4 mx-4 mt-2 space-y-3",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Details"}),[{label:"Stage",value:N},{label:"Forecast",value:j||void 0},{label:"Created",value:y.created_at?new Date(y.created_at).toLocaleDateString():void 0}].filter(S=>S.value).map(S=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:S.label}),s.jsx("span",{className:"text-sm text-foreground",children:S.value})]},S.label)),y.notes&&s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Notes"}),s.jsx("p",{className:"text-sm text-foreground leading-relaxed",children:y.notes})]})]}),s.jsx(Rp,{objectType:"opportunity",values:y.custom_fields??{}}),s.jsx(Kp,{subjectType:"opportunity",subjectId:e})]})}const Zn="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",vn="text-xs font-mono text-muted-foreground uppercase tracking-wider",nre=["discovery","poc","production","scaling","sunset"];function rre({stage:e}){const t=xa[e]??{label:e,color:"#94a3b8"};return s.jsx("span",{className:"inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold",style:{backgroundColor:t.color+"18",color:t.color},children:t.label})}function sre({useCase:e,onSave:t,onCancel:n,onDelete:r,isSaving:o}){const[a,l]=x.useState(!1),[u,d]=x.useState({name:e.name??"",stage:e.stage??"discovery",description:e.description??"",attributed_arr:e.attributed_arr!=null?String(e.attributed_arr):"",currency_code:e.currency_code??"USD",expansion_potential:e.expansion_potential!=null?String(e.expansion_potential):"",unit_label:e.unit_label??"",consumption_unit:e.consumption_unit??"",consumption_capacity:e.consumption_capacity!=null?String(e.consumption_capacity):"",started_at:e.started_at?e.started_at.slice(0,10):"",target_prod_date:e.target_prod_date?e.target_prod_date.slice(0,10):"",sunset_date:e.sunset_date?e.sunset_date.slice(0,10):"",tags:Array.isArray(e.tags)?e.tags.join(", "):"",opportunity_id:e.opportunity_id??"",owner_id:e.owner_id??""}),[f,m]=x.useState(()=>{const E={};if(e.custom_fields)for(const[P,D]of Object.entries(e.custom_fields))E[P]=String(D??"");return E}),{data:p}=wp(),g=(p==null?void 0:p.data)??[],{data:y}=bp({limit:200}),b=(y==null?void 0:y.data)??[],{data:w}=Mc("use_case"),N=(w==null?void 0:w.fields)??[],k=(E,P)=>d(D=>({...D,[E]:P})),j=(E,P)=>m(D=>({...D,[E]:P})),C=()=>{const E={},P=["attributed_arr","expansion_potential","consumption_capacity"];for(const[z,K]of Object.entries(u))z!=="tags"&&K!==""&&(P.includes(z)?E[z]=Number(K)||0:E[z]=K);const D=u.tags.trim();E.tags=D?D.split(",").map(z=>z.trim()).filter(Boolean):[];const I={};for(const z of N){const K=f[z.field_key]??"";K!==""&&(z.field_type==="number"?I[z.field_key]=Number(K):z.field_type==="boolean"?I[z.field_key]=K==="true":I[z.field_key]=K)}Object.keys(I).length>0&&(E.custom_fields=I),t(E)},S=E=>s.jsx("div",{className:"border-t border-border pt-3 mt-1",children:s.jsx("p",{className:vn,children:E})});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-border",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-accent hover:underline",children:[s.jsx(Aa,{className:"w-3.5 h-3.5"})," Back"]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Editing use case"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:vn,children:["Name",s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("input",{type:"text",value:u.name,onChange:E=>k("name",E.target.value),placeholder:"Use case name",className:Zn})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Stage"}),s.jsx("select",{value:u.stage,onChange:E=>k("stage",E.target.value),className:`${Zn} pr-3`,children:nre.map(E=>{var P;return s.jsx("option",{value:E,children:((P=xa[E])==null?void 0:P.label)??E},E)})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Description"}),s.jsx("textarea",{value:u.description,onChange:E=>k("description",E.target.value),placeholder:"Optional description",rows:3,className:"w-full px-3 py-2 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring resize-none"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:vn,children:["Tags ",s.jsx("span",{className:"normal-case font-normal",children:"(comma-separated)"})]}),s.jsx("input",{type:"text",value:u.tags,onChange:E=>k("tags",E.target.value),placeholder:"e.g. ai, billing, high-priority",className:Zn})]}),S("Commercial"),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Attributed ARR ($)"}),s.jsx("input",{type:"number",value:u.attributed_arr,onChange:E=>k("attributed_arr",E.target.value),placeholder:"e.g. 120000",className:Zn})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Expansion Potential ($)"}),s.jsx("input",{type:"number",value:u.expansion_potential,onChange:E=>k("expansion_potential",E.target.value),placeholder:"e.g. 50000",className:Zn})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Currency"}),s.jsx("input",{type:"text",value:u.currency_code,onChange:E=>k("currency_code",E.target.value.toUpperCase().slice(0,3)),placeholder:"USD",maxLength:3,className:Zn})]}),S("Consumption"),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Unit Label"}),s.jsx("input",{type:"text",value:u.unit_label,onChange:E=>k("unit_label",E.target.value),placeholder:"e.g. API calls, seats, documents",className:Zn})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Consumption Unit"}),s.jsx("input",{type:"text",value:u.consumption_unit,onChange:E=>k("consumption_unit",E.target.value),placeholder:"e.g. calls/month",className:Zn})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Consumption Capacity"}),s.jsx("input",{type:"number",value:u.consumption_capacity,onChange:E=>k("consumption_capacity",E.target.value),placeholder:"e.g. 10000",className:Zn})]}),S("Timeline"),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Start Date"}),s.jsx(An,{value:u.started_at,onChange:E=>k("started_at",E),placeholder:"Select start date"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Production Date"}),s.jsx(An,{value:u.target_prod_date,onChange:E=>k("target_prod_date",E),placeholder:"Select production date"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Sunset Date"}),s.jsx(An,{value:u.sunset_date,onChange:E=>k("sunset_date",E),placeholder:"Select sunset date"})]}),S("Ownership"),b.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Linked Opportunity"}),s.jsxs("select",{value:u.opportunity_id,onChange:E=>k("opportunity_id",E.target.value),className:`${Zn} pr-3`,children:[s.jsx("option",{value:"",children:"None"}),b.map(E=>s.jsx("option",{value:E.id,children:E.name},E.id))]})]}),g.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:vn,children:"Owner"}),s.jsxs("select",{value:u.owner_id,onChange:E=>k("owner_id",E.target.value),className:`${Zn} pr-3`,children:[s.jsx("option",{value:"",children:"Unassigned"}),g.map(E=>s.jsx("option",{value:E.id,children:E.name||E.email},E.id))]})]}),N.length>0&&s.jsxs(s.Fragment,{children:[S("Custom Fields"),N.map(E=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:vn,children:[E.label,E.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),(E.field_type==="text"||!E.field_type)&&s.jsx("input",{type:"text",value:f[E.field_key]??"",onChange:P=>j(E.field_key,P.target.value),className:Zn}),E.field_type==="number"&&s.jsx("input",{type:"number",value:f[E.field_key]??"",onChange:P=>j(E.field_key,P.target.value),className:Zn}),E.field_type==="date"&&s.jsx(An,{value:f[E.field_key]??"",onChange:P=>j(E.field_key,P),required:E.required}),E.field_type==="boolean"&&s.jsxs("div",{className:"flex items-center gap-2 h-10",children:[s.jsx("input",{type:"checkbox",checked:f[E.field_key]==="true",onChange:P=>j(E.field_key,P.target.checked?"true":"false"),className:"w-4 h-4 rounded border-border accent-primary"}),s.jsx("span",{className:"text-sm text-foreground",children:"Yes"})]}),(E.field_type==="select"||E.field_type==="multi_select")&&s.jsxs("select",{value:f[E.field_key]??"",onChange:P=>j(E.field_key,P.target.value),className:`${Zn} pr-3`,children:[s.jsx("option",{value:"",children:"Select…"}),(E.options??[]).map(P=>s.jsx("option",{value:P,children:P},P))]})]},E.field_key))]}),e.created_at&&s.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border mt-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Created"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.created_at).toLocaleDateString()})]}),s.jsx("button",{onClick:C,disabled:!u.name.trim()||o,className:"w-full h-10 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-40 transition-colors",children:o?"Saving…":"Save Changes"}),a?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>l(!1),className:"flex-1 h-9 rounded-md border border-border text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:"Cancel"}),s.jsx("button",{onClick:r,className:"flex-1 h-9 rounded-md bg-destructive text-destructive-foreground text-sm font-medium hover:bg-destructive/90 transition-colors",children:"Confirm Delete"})]}):s.jsxs("button",{onClick:()=>l(!0),className:"w-full h-9 rounded-md border border-destructive/40 text-destructive text-sm font-medium hover:bg-destructive/10 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(Bn,{className:"w-3.5 h-3.5"})," Delete Use Case"]})]})]})}function ore(){var S,E;const{drawerEntityId:e,openAIWithContext:t,closeDrawer:n}=lt(),{enabled:r}=kr(),o=Cn(),[a,l]=x.useState(!1),[u,d]=x.useState(!1),{data:f,isLoading:m}=YB(e??""),{data:p}=XB(e??""),g=QB(e??""),y=GB(e??"");if(m)return s.jsxs("div",{className:"flex flex-col gap-4 p-6 animate-pulse",children:[s.jsx("div",{className:"h-6 bg-muted rounded w-3/4"}),s.jsx("div",{className:"h-4 bg-muted rounded w-1/2"})]});if(!(f!=null&&f.use_case))return s.jsx("div",{className:"p-4 text-muted-foreground",children:"Use case not found"});const b=f.use_case,w=b.name??"",N=b.stage??"",k=b.attributed_arr??0,j=b.health_score??0,C=(p==null?void 0:p.data)??p??[];return u?s.jsx(Yp,{subjectType:"use_case",subjectId:e,onClose:()=>d(!1)}):a?s.jsx(sre,{useCase:b,onSave:async P=>{try{await g.mutateAsync(P),l(!1),de({title:"Use case updated"})}catch(D){de({title:"Failed to update use case",description:D instanceof Error?D.message:"Please try again.",variant:"destructive"})}},onCancel:()=>l(!1),onDelete:async()=>{try{await y.mutateAsync(),n(),de({title:"Use case deleted"})}catch(P){de({title:"Failed to delete use case",description:P instanceof Error?P.message:"Please try again.",variant:"destructive"})}},isSaving:g.isPending}):s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"p-6 border-b border-border",children:[s.jsx("h2",{className:"font-display font-extrabold text-xl text-foreground",children:w}),s.jsx("div",{className:"flex items-center gap-2 mt-3",children:N&&s.jsx(rre,{stage:N})}),s.jsxs("div",{className:"flex gap-2 mt-4",children:[s.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(br,{className:"w-3.5 h-3.5"})," Edit"]}),s.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(ls,{className:"w-3.5 h-3.5"})," Brief"]}),r&&s.jsxs("button",{onClick:()=>{t({type:"use-case",id:b.id,name:w,detail:N}),n(),o("/agent")},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl border border-accent/30 bg-accent/5 text-accent text-sm font-semibold hover:bg-accent/10 transition-all ml-auto press-scale",children:[s.jsx(an,{className:"w-3.5 h-3.5"})," Chat"]})]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-3 p-4 mx-4 mt-4",children:[{icon:lb,label:"Attributed ARR",value:k?`$${(k/1e3).toFixed(0)}K`:"—"},{icon:Sd,label:"Stage",value:(((S=xa[N])==null?void 0:S.label)??N)||"—"},{icon:zn,label:"Health",value:j?String(j):"—"}].map(P=>s.jsxs("div",{className:"bg-muted/50 rounded-xl p-3 text-center",children:[s.jsx(P.icon,{className:"w-4 h-4 text-muted-foreground mx-auto mb-1"}),s.jsx("p",{className:"text-sm font-display font-bold text-foreground truncate",children:P.value}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:P.label})]},P.label))}),s.jsxs("div",{className:"p-4 mx-4 mt-2 space-y-3",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Details"}),[{label:"Stage",value:((E=xa[N])==null?void 0:E.label)??N},{label:"Health Score",value:j?String(j):void 0},{label:"Prod Date",value:b.target_prod_date?new Date(b.target_prod_date).toLocaleDateString():void 0},{label:"Created",value:b.created_at?new Date(b.created_at).toLocaleDateString():void 0}].filter(P=>P.value).map(P=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:P.label}),s.jsx("span",{className:"text-sm text-foreground",children:P.value})]},P.label))]}),s.jsx(Rp,{objectType:"use_case",values:b.custom_fields??{}}),s.jsx(Kp,{subjectType:"use_case",subjectId:e}),C.length>0&&s.jsxs("div",{className:"p-4 mx-4 mt-2 mb-6",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide mb-3",children:"Timeline"}),s.jsx(AT,{activities:C})]})]})}const Su="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",Ah="text-xs font-mono text-muted-foreground uppercase tracking-wider";function are({score:e}){const t=e>=80?"text-green-400 bg-green-500/15":e>=50?"text-yellow-400 bg-yellow-500/15":"text-red-400 bg-red-500/15";return s.jsxs("span",{className:`inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold ${t}`,children:[s.jsx(sp,{className:"w-3 h-3"})," ",e]})}function ire(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e}`}function lre({account:e,onSave:t,onCancel:n,onDelete:r,isSaving:o}){const[a,l]=x.useState(!1),[u,d]=x.useState({name:e.name??"",industry:e.industry??"",website:e.website??"",domain:e.domain??"",employee_count:e.employee_count!=null?String(e.employee_count):"",annual_revenue:e.annual_revenue!=null?String(e.annual_revenue):"",health_score:e.health_score!=null?String(e.health_score):"",owner_id:e.owner_id??""}),[f,m]=x.useState(()=>{const j={};if(e.custom_fields)for(const[C,S]of Object.entries(e.custom_fields))j[C]=String(S??"");return j}),{data:p}=wp(),g=(p==null?void 0:p.data)??[],{data:y}=Mc("account"),b=(y==null?void 0:y.fields)??[],w=(j,C)=>d(S=>({...S,[j]:C})),N=(j,C)=>m(S=>({...S,[j]:C})),k=()=>{const j={};for(const[S,E]of Object.entries(u))E!==""&&(S==="employee_count"||S==="annual_revenue"||S==="health_score"?j[S]=Number(E)||0:j[S]=E);const C={};for(const S of b){const E=f[S.field_key]??"";E!==""&&(S.field_type==="number"?C[S.field_key]=Number(E):S.field_type==="boolean"?C[S.field_key]=E==="true":C[S.field_key]=E)}Object.keys(C).length>0&&(j.custom_fields=C),t(j)};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-border",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-accent hover:underline",children:[s.jsx(Aa,{className:"w-3.5 h-3.5"})," Back"]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Editing account"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[[{key:"name",label:"Company Name",type:"text",placeholder:"e.g. Acme Corp",required:!0},{key:"industry",label:"Industry",type:"text",placeholder:"e.g. Technology"},{key:"website",label:"Website",type:"url",placeholder:"https://acme.com"},{key:"domain",label:"Domain",type:"text",placeholder:"acme.com"},{key:"employee_count",label:"Employees",type:"number",placeholder:"250"},{key:"annual_revenue",label:"Annual Revenue ($)",type:"number",placeholder:"5000000"},{key:"health_score",label:"Health Score (0–100)",type:"number",placeholder:"75"}].map(j=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:Ah,children:[j.label,j.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("input",{type:j.type,value:u[j.key],onChange:C=>w(j.key,C.target.value),placeholder:j.placeholder,className:Su})]},j.key)),g.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Ah,children:"Owner"}),s.jsxs("select",{value:u.owner_id,onChange:j=>w("owner_id",j.target.value),className:`${Su} pr-3`,children:[s.jsx("option",{value:"",children:"Unassigned"}),g.map(j=>s.jsx("option",{value:j.id,children:j.name||j.email},j.id))]})]}),b.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"border-t border-border pt-2",children:s.jsx("p",{className:Ah,children:"Custom Fields"})}),b.map(j=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:Ah,children:[j.label,j.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),(j.field_type==="text"||!j.field_type)&&s.jsx("input",{type:"text",value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:Su}),j.field_type==="number"&&s.jsx("input",{type:"number",value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:Su}),j.field_type==="date"&&s.jsx(An,{value:f[j.field_key]??"",onChange:C=>N(j.field_key,C),required:j.required}),j.field_type==="boolean"&&s.jsxs("div",{className:"flex items-center gap-2 h-10",children:[s.jsx("input",{type:"checkbox",checked:f[j.field_key]==="true",onChange:C=>N(j.field_key,C.target.checked?"true":"false"),className:"w-4 h-4 rounded border-border accent-primary"}),s.jsx("span",{className:"text-sm text-foreground",children:"Yes"})]}),(j.field_type==="select"||j.field_type==="multi_select")&&s.jsxs("select",{value:f[j.field_key]??"",onChange:C=>N(j.field_key,C.target.value),className:`${Su} pr-3`,children:[s.jsx("option",{value:"",children:"Select…"}),(j.options??[]).map(C=>s.jsx("option",{value:C,children:C},C))]})]},j.field_key))]}),s.jsx("button",{onClick:k,disabled:!u.name.trim()||o,className:"w-full h-10 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-40 transition-colors",children:o?"Saving…":"Save Changes"}),a?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>l(!1),className:"flex-1 h-9 rounded-md border border-border text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:"Cancel"}),s.jsx("button",{onClick:r,className:"flex-1 h-9 rounded-md bg-destructive text-destructive-foreground text-sm font-medium hover:bg-destructive/90 transition-colors",children:"Confirm Delete"})]}):s.jsxs("button",{onClick:()=>l(!0),className:"w-full h-9 rounded-md border border-destructive/40 text-destructive text-sm font-medium hover:bg-destructive/10 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(Bn,{className:"w-3.5 h-3.5"})," Delete Account"]})]})]})}function cre(){const{drawerEntityId:e,openAIWithContext:t,closeDrawer:n,drawerBriefing:r}=lt(),{enabled:o}=kr(),a=Cn(),[l,u]=x.useState(!1),[d,f]=x.useState(r?"brief":"detail"),{data:m,isLoading:p}=BB(e??""),g=WB(e??""),y=HB(e??"");if(p)return s.jsx("div",{className:"flex flex-col gap-4 p-6 animate-pulse",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),s.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]})]})});if(!(m!=null&&m.account))return s.jsx("div",{className:"p-4 text-muted-foreground",children:"Account not found"});const b=m.account,w=b.name??"",N=b.industry??"",k=b.website??"",j=b.annual_revenue??0,C=b.employee_count??0,S=b.health_score??0;return d==="brief"?s.jsxs(s.Fragment,{children:[s.jsx(Vl,{view:d,onChange:f}),s.jsx(Yp,{subjectType:"account",subjectId:e,onClose:()=>f("detail")})]}):d==="graph"?s.jsxs(s.Fragment,{children:[s.jsx(Vl,{view:d,onChange:f}),s.jsx(bA,{subjectType:"account",subjectId:e,subjectName:w})]}):l?s.jsx(lre,{account:b,onSave:async E=>{try{await g.mutateAsync(E),u(!1),de({title:"Account updated"})}catch(P){de({title:"Failed to update account",description:P instanceof Error?P.message:"Please try again.",variant:"destructive"})}},onCancel:()=>u(!1),onDelete:async()=>{try{await y.mutateAsync(),n(),de({title:"Account deleted"})}catch(E){de({title:"Failed to delete account",description:E instanceof Error?E.message:"Please try again.",variant:"destructive"})}},isSaving:g.isPending}):s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"p-6 border-b border-border",children:[s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx(yo,{name:w,className:"w-14 h-14 rounded-2xl text-lg"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h2",{className:"font-display font-extrabold text-xl text-foreground",children:w}),N&&s.jsx("p",{className:"text-sm text-muted-foreground",children:N}),s.jsx("div",{className:"flex items-center gap-2 mt-2",children:S>0&&s.jsx(are,{score:S})})]})]}),s.jsxs("div",{className:"flex gap-2 mt-4",children:[k&&s.jsxs("a",{href:k.startsWith("http")?k:`https://${k}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(h5,{className:"w-3.5 h-3.5"})," Website"]}),s.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(br,{className:"w-3.5 h-3.5"})," Edit"]}),o&&s.jsxs("button",{onClick:()=>{t({type:"account",id:b.id,name:w,detail:N}),n(),a("/agent")},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl border border-accent/30 bg-accent/5 text-accent text-sm font-semibold hover:bg-accent/10 transition-all ml-auto press-scale",children:[s.jsx(an,{className:"w-3.5 h-3.5"})," Chat"]})]})]}),s.jsx(Vl,{view:d,onChange:f}),s.jsx("div",{className:"grid grid-cols-3 gap-3 p-4 mx-4 mt-4",children:[{icon:lb,label:"Revenue",value:j?ire(j):"—"},{icon:ja,label:"Employees",value:C?String(C):"—"},{icon:sp,label:"Health",value:S?String(S):"—"}].map(E=>s.jsxs("div",{className:"bg-muted/50 rounded-xl p-3 text-center",children:[s.jsx(E.icon,{className:"w-4 h-4 text-muted-foreground mx-auto mb-1"}),s.jsx("p",{className:"text-sm font-display font-bold text-foreground",children:E.value}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:E.label})]},E.label))}),s.jsxs("div",{className:"p-4 mx-4 mt-2 space-y-3",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Details"}),[{label:"Industry",value:N},{label:"Website",value:k},{label:"Created",value:b.created_at?new Date(b.created_at).toLocaleDateString():void 0}].filter(E=>E.value).map(E=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:E.label}),s.jsx("span",{className:"text-sm text-foreground",children:E.value})]},E.label))]}),s.jsx(Rp,{objectType:"account",values:b.custom_fields??{}}),s.jsx(Kp,{subjectType:"account",subjectId:e}),b.description&&s.jsxs("div",{className:"p-4 mx-4 mt-2 mb-6",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide mb-2",children:"About"}),s.jsx("p",{className:"text-sm text-foreground leading-relaxed",children:b.description})]})]})}const oi="w-full h-10 px-3 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",Xo="text-xs font-mono text-muted-foreground uppercase tracking-wider",ure={pending:"#f59e0b",accepted:"#3b82f6",in_progress:"#8b5cf6",blocked:"#ef4444",completed:"#22c55e",declined:"#94a3b8",cancelled:"#94a3b8"},dre={urgent:"#ef4444",high:"#f97316",normal:"#3b82f6",low:"#94a3b8"},fre=["call","draft","email","follow_up","research","review","send"],hre=["urgent","high","normal","low"],mre=["contact","account","opportunity","use_case"];function M2({id:e}){const{data:t}=m7(e),n=t==null?void 0:t.actor;return n?s.jsxs("span",{className:"text-sm text-foreground",children:[n.display_name,s.jsxs("span",{className:"text-xs text-muted-foreground ml-1.5 capitalize",children:["(",n.actor_type,")"]})]}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}function pre({assignment:e,onSave:t,onCancel:n,isSaving:r}){const[o,a]=x.useState({title:e.title??"",assignment_type:e.assignment_type??"",priority:e.priority??"normal",due_at:e.due_at?e.due_at.split("T")[0]:"",context:e.context??"",description:e.description??"",subject_type:e.subject_type??"",subject_id:e.subject_id??""}),l=(d,f)=>a(m=>({...m,[d]:f})),u=()=>{const d={...o};d.due_at||delete d.due_at,d.context||delete d.context,d.description||delete d.description,d.subject_type?d.subject_id||delete d.subject_id:(delete d.subject_type,delete d.subject_id),d.due_at&&(d.due_at=new Date(d.due_at).toISOString()),t(d)};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-border",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-accent hover:underline",children:[s.jsx(Aa,{className:"w-3.5 h-3.5"})," Back"]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Editing assignment"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:Xo,children:["Title ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{type:"text",value:o.title,onChange:d=>l("title",d.target.value),placeholder:"e.g. Follow up with Acme about contract",className:oi})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:Xo,children:["Type ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsxs("select",{value:o.assignment_type,onChange:d=>l("assignment_type",d.target.value),className:`${oi} pr-3`,children:[s.jsx("option",{value:"",children:"Select type…"}),fre.map(d=>s.jsx("option",{value:d,children:d.replace(/_/g," ").replace(/\b\w/g,f=>f.toUpperCase())},d))]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Xo,children:"Priority"}),s.jsx("select",{value:o.priority,onChange:d=>l("priority",d.target.value),className:`${oi} pr-3`,children:hre.map(d=>s.jsx("option",{value:d,children:d.charAt(0).toUpperCase()+d.slice(1)},d))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Xo,children:"Due Date"}),s.jsx(An,{value:o.due_at,onChange:d=>l("due_at",d)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Xo,children:"Linked To"}),s.jsxs("select",{value:o.subject_type,onChange:d=>{l("subject_type",d.target.value),l("subject_id","")},className:`${oi} pr-3`,children:[s.jsx("option",{value:"",children:"None (no link)"}),mre.map(d=>s.jsx("option",{value:d,children:d.replace(/_/g," ").replace(/\b\w/g,f=>f.toUpperCase())},d))]})]}),o.subject_type&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Xo,children:"Subject ID"}),s.jsx("input",{type:"text",value:o.subject_id,onChange:d=>l("subject_id",d.target.value),placeholder:"Record ID",className:oi})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Xo,children:"Context"}),s.jsx("textarea",{value:o.context,onChange:d=>l("context",d.target.value),placeholder:"Brief context for the assignee",rows:3,className:`${oi} h-auto py-2 resize-none`})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:Xo,children:"Description"}),s.jsx("textarea",{value:o.description,onChange:d=>l("description",d.target.value),placeholder:"Additional details",rows:3,className:`${oi} h-auto py-2 resize-none`})]}),s.jsx("button",{onClick:u,disabled:!o.title.trim()||!o.assignment_type||r,className:"w-full h-10 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 disabled:opacity-40 transition-colors",children:r?"Saving…":"Save Changes"})]})]})}function gre(){const{drawerEntityId:e,openDrawer:t,closeDrawer:n}=lt(),[r,o]=x.useState(!1),{data:a,isLoading:l}=g7(e??""),u=x7(e??""),d=rw(),f=aw(),m=sw(),p=ow(),g=iw(),y=lw(),b=async E=>{if(e)try{switch(E){case"accept":await d.mutateAsync(e);break;case"start":await f.mutateAsync(e);break;case"complete":await m.mutateAsync({id:e});break;case"decline":await p.mutateAsync({id:e});break;case"block":await g.mutateAsync({id:e});break;case"cancel":await y.mutateAsync({id:e});break}de({title:`Assignment ${E}ed`})}catch(P){de({title:`Failed to ${E} assignment`,description:P instanceof Error?P.message:"Please try again.",variant:"destructive"})}};if(l)return s.jsx("div",{className:"flex flex-col gap-4 p-6 animate-pulse",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-4 bg-muted rounded w-1/3"}),s.jsx("div",{className:"h-5 bg-muted rounded w-3/4"})]})});const w=a==null?void 0:a.assignment;if(!w)return s.jsx("div",{className:"p-4 text-muted-foreground",children:"Assignment not found"});if(r)return s.jsx(pre,{assignment:w,onSave:async E=>{try{await u.mutateAsync(E),o(!1),de({title:"Assignment updated"})}catch(P){de({title:"Failed to update assignment",description:P instanceof Error?P.message:"Please try again.",variant:"destructive"})}},onCancel:()=>o(!1),isSaving:u.isPending});const N=ure[w.status]??"#94a3b8",k=dre[w.priority]??"#94a3b8",j=w.due_at&&new Date(w.due_at)<new Date&&!["completed","declined","cancelled"].includes(w.status),C=[];switch(w.status){case"pending":C.push({label:"Accept",action:"accept",icon:s.jsx(Gt,{className:"w-3.5 h-3.5"})}),C.push({label:"Decline",action:"decline",icon:s.jsx(Vs,{className:"w-3.5 h-3.5"}),variant:"muted"});break;case"accepted":C.push({label:"Start",action:"start",icon:s.jsx(wa,{className:"w-3.5 h-3.5"})}),C.push({label:"Block",action:"block",icon:s.jsx(Vh,{className:"w-3.5 h-3.5"}),variant:"warning"});break;case"in_progress":C.push({label:"Complete",action:"complete",icon:s.jsx(Gt,{className:"w-3.5 h-3.5"})}),C.push({label:"Block",action:"block",icon:s.jsx(Vh,{className:"w-3.5 h-3.5"}),variant:"warning"});break;case"blocked":C.push({label:"Resume",action:"start",icon:s.jsx(wa,{className:"w-3.5 h-3.5"})}),C.push({label:"Cancel",action:"cancel",icon:s.jsx(Ov,{className:"w-3.5 h-3.5"}),variant:"destructive"});break}["completed","declined","cancelled","blocked"].includes(w.status)||C.find(E=>E.action==="cancel")||C.push({label:"Cancel",action:"cancel",icon:s.jsx(Ov,{className:"w-3.5 h-3.5"}),variant:"destructive"});const S={contact:"contact",account:"account",opportunity:"opportunity",use_case:"use-case"};return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"p-6 border-b border-border",children:[s.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(pm,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-semibold capitalize",style:{backgroundColor:N+"18",color:N},children:w.status.replace(/_/g," ")}),s.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:k}}),s.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:w.priority})]}),s.jsx("h2",{className:"font-display font-extrabold text-xl text-foreground leading-snug",children:w.title}),w.assignment_type&&s.jsx("span",{className:"text-xs text-muted-foreground capitalize mt-1 inline-block",children:w.assignment_type.replace(/_/g," ")})]})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsxs("button",{onClick:()=>o(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-muted text-foreground text-sm font-medium hover:bg-muted/80 transition-all press-scale",children:[s.jsx(br,{className:"w-3.5 h-3.5"})," Edit"]}),C.map(E=>s.jsxs("button",{onClick:()=>b(E.action),className:`flex items-center gap-1.5 px-3.5 py-2 rounded-xl text-sm font-medium transition-all press-scale ${E.variant==="destructive"?"bg-destructive/10 text-destructive hover:bg-destructive/20":E.variant==="warning"?"bg-warning/10 text-warning hover:bg-warning/20":E.variant==="muted"?"bg-muted text-muted-foreground hover:bg-muted/80":"bg-primary/10 text-primary hover:bg-primary/20"}`,children:[E.icon," ",E.label]},E.action))]})]}),s.jsxs("div",{className:"p-4 mx-4 mt-4 space-y-3",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Details"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Assigned To"}),s.jsx(M2,{id:w.assigned_to})]}),w.assigned_by&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Assigned By"}),s.jsx(M2,{id:w.assigned_by})]}),w.due_at&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Due"}),s.jsxs("span",{className:`text-sm flex items-center gap-1 ${j?"text-destructive font-medium":"text-foreground"}`,children:[j&&s.jsx(Vh,{className:"w-3.5 h-3.5"}),new Date(w.due_at).toLocaleDateString()]})]}),w.subject_type&&S[w.subject_type]&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs text-muted-foreground capitalize",children:["Linked ",w.subject_type.replace(/_/g," ")]}),s.jsx("button",{onClick:()=>{t(S[w.subject_type],w.subject_id)},className:"text-sm text-primary hover:underline",children:"View"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Created"}),s.jsx("span",{className:"text-sm text-foreground",children:new Date(w.created_at).toLocaleDateString()})]})]}),w.context&&s.jsxs("div",{className:"p-4 mx-4 mt-2",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide mb-2",children:"Context"}),s.jsx("p",{className:"text-sm text-foreground leading-relaxed italic",children:w.context})]}),w.description&&s.jsxs("div",{className:"p-4 mx-4 mt-2 mb-6",children:[s.jsx("h3",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide mb-2",children:"Description"}),s.jsx("p",{className:"text-sm text-foreground leading-relaxed",children:w.description})]})]})}const xre=ib("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function mo({className:e,variant:t,...n}){return s.jsx("div",{className:Ie(xre({variant:t}),e),...n})}function A2(e,[t,n]){return Math.min(n,Math.max(t,e))}var yre=x.createContext(void 0);function vre(e){const t=x.useContext(yre);return e||t||"ltr"}function bre(e){const t=wre(e),n=x.forwardRef((r,o)=>{const{children:a,...l}=r,u=x.Children.toArray(a),d=u.find(jre);if(d){const f=d.props.children,m=u.map(p=>p===d?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:p);return s.jsx(t,{...l,ref:o,children:x.isValidElement(f)?x.cloneElement(f,void 0,m):null})}return s.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function wre(e){const t=x.forwardRef((n,r)=>{const{children:o,...a}=n;if(x.isValidElement(o)){const l=kre(o),u=Cre(a,o.props);return o.type!==x.Fragment&&(u.ref=r?Vr(r,l):l),x.cloneElement(o,u)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nre=Symbol("radix.slottable");function jre(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nre}function Cre(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...u)=>{const d=a(...u);return o(...u),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function kre(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function n1(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Sre=[" ","Enter","ArrowUp","ArrowDown"],_re=[" ","Enter"],Wi="Select",[Qp,Gp,Ere]=A_(Wi),[Ac]=wo(Wi,[Ere,_c]),Xp=_c(),[Pre,La]=Ac(Wi),[Tre,Mre]=Ac(Wi),wA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:l,defaultValue:u,onValueChange:d,dir:f,name:m,autoComplete:p,disabled:g,required:y,form:b}=e,w=Xp(t),[N,k]=x.useState(null),[j,C]=x.useState(null),[S,E]=x.useState(!1),P=vre(f),[D,I]=Ri({prop:r,defaultProp:o??!1,onChange:a,caller:Wi}),[z,K]=Ri({prop:l,defaultProp:u,onChange:d,caller:Wi}),q=x.useRef(null),H=N?b||!!N.closest("form"):!0,[B,R]=x.useState(new Set),M=Array.from(B).map(F=>F.props.value).join(";");return s.jsx(Z5,{...w,children:s.jsxs(Pre,{required:y,scope:t,trigger:N,onTriggerChange:k,valueNode:j,onValueNodeChange:C,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:xr(),value:z,onValueChange:K,open:D,onOpenChange:I,dir:P,triggerPointerDownPosRef:q,disabled:g,children:[s.jsx(Qp.Provider,{scope:t,children:s.jsx(Tre,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(F=>{R(L=>new Set(L).add(F))},[]),onNativeOptionRemove:x.useCallback(F=>{R(L=>{const A=new Set(L);return A.delete(F),A})},[]),children:n})}),H?s.jsxs(UA,{"aria-hidden":!0,required:y,tabIndex:-1,name:m,autoComplete:p,value:z,onChange:F=>K(F.target.value),disabled:g,form:b,children:[z===void 0?s.jsx("option",{value:""}):null,Array.from(B)]},M):null]})})};wA.displayName=Wi;var NA="SelectTrigger",jA=x.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=Xp(n),l=La(NA,n),u=l.disabled||r,d=pt(t,l.onTriggerChange),f=Gp(n),m=x.useRef("touch"),[p,g,y]=KA(w=>{const N=f().filter(C=>!C.disabled),k=N.find(C=>C.value===l.value),j=YA(N,w,k);j!==void 0&&l.onValueChange(j.value)}),b=w=>{u||(l.onOpenChange(!0),y()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(up,{asChild:!0,...a,children:s.jsx(Ge.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":qA(l.value)?"":void 0,...o,ref:d,onClick:Ke(o.onClick,w=>{w.currentTarget.focus(),m.current!=="mouse"&&b(w)}),onPointerDown:Ke(o.onPointerDown,w=>{m.current=w.pointerType;const N=w.target;N.hasPointerCapture(w.pointerId)&&N.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(b(w),w.preventDefault())}),onKeyDown:Ke(o.onKeyDown,w=>{const N=p.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&g(w.key),!(N&&w.key===" ")&&Sre.includes(w.key)&&(b(),w.preventDefault())})})})});jA.displayName=NA;var CA="SelectValue",kA=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:l="",...u}=e,d=La(CA,n),{onValueNodeHasChildrenChange:f}=d,m=a!==void 0,p=pt(t,d.onValueNodeChange);return jn(()=>{f(m)},[f,m]),s.jsx(Ge.span,{...u,ref:p,style:{pointerEvents:"none"},children:qA(d.value)?s.jsx(s.Fragment,{children:l}):a})});kA.displayName=CA;var Are="SelectIcon",SA=x.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return s.jsx(Ge.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});SA.displayName=Are;var Dre="SelectPortal",_A=e=>s.jsx(Cd,{asChild:!0,...e});_A.displayName=Dre;var Hi="SelectContent",EA=x.forwardRef((e,t)=>{const n=La(Hi,e.__scopeSelect),[r,o]=x.useState();if(jn(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?vc.createPortal(s.jsx(PA,{scope:e.__scopeSelect,children:s.jsx(Qp.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),a):null}return s.jsx(TA,{...e,ref:t})});EA.displayName=Hi;var Zr=10,[PA,Fa]=Ac(Hi),Rre="SelectContentImpl",Ore=bre("SelectContent.RemoveScroll"),TA=x.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:y,sticky:b,hideWhenDetached:w,avoidCollisions:N,...k}=e,j=La(Hi,n),[C,S]=x.useState(null),[E,P]=x.useState(null),D=pt(t,J=>S(J)),[I,z]=x.useState(null),[K,q]=x.useState(null),H=Gp(n),[B,R]=x.useState(!1),M=x.useRef(!1);x.useEffect(()=>{if(C)return uw(C)},[C]),cw();const F=x.useCallback(J=>{const[re,...ce]=H().map(ye=>ye.ref.current),[fe]=ce.slice(-1),pe=document.activeElement;for(const ye of J)if(ye===pe||(ye==null||ye.scrollIntoView({block:"nearest"}),ye===re&&E&&(E.scrollTop=0),ye===fe&&E&&(E.scrollTop=E.scrollHeight),ye==null||ye.focus(),document.activeElement!==pe))return},[H,E]),L=x.useCallback(()=>F([I,C]),[F,I,C]);x.useEffect(()=>{B&&L()},[B,L]);const{onOpenChange:A,triggerPointerDownPosRef:O}=j;x.useEffect(()=>{if(C){let J={x:0,y:0};const re=fe=>{var pe,ye;J={x:Math.abs(Math.round(fe.pageX)-(((pe=O.current)==null?void 0:pe.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((ye=O.current)==null?void 0:ye.y)??0))}},ce=fe=>{J.x<=10&&J.y<=10?fe.preventDefault():C.contains(fe.target)||A(!1),document.removeEventListener("pointermove",re),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",ce,{capture:!0})}}},[C,A,O]),x.useEffect(()=>{const J=()=>A(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[A]);const[U,V]=KA(J=>{const re=H().filter(pe=>!pe.disabled),ce=re.find(pe=>pe.ref.current===document.activeElement),fe=YA(re,J,ce);fe&&setTimeout(()=>fe.ref.current.focus())}),$=x.useCallback((J,re,ce)=>{const fe=!M.current&&!ce;(j.value!==void 0&&j.value===re||fe)&&(z(J),fe&&(M.current=!0))},[j.value]),Y=x.useCallback(()=>C==null?void 0:C.focus(),[C]),X=x.useCallback((J,re,ce)=>{const fe=!M.current&&!ce;(j.value!==void 0&&j.value===re||fe)&&q(J)},[j.value]),ne=r==="popper"?I0:MA,ie=ne===I0?{side:u,sideOffset:d,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:y,sticky:b,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(PA,{scope:n,content:C,viewport:E,onViewportChange:P,itemRefCallback:$,selectedItem:I,onItemLeave:Y,itemTextRefCallback:X,focusSelectedItem:L,selectedItemText:K,position:r,isPositioned:B,searchRef:U,children:s.jsx(Cp,{as:Ore,allowPinchZoom:!0,children:s.jsx(Np,{asChild:!0,trapped:j.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Ke(o,J=>{var re;(re=j.trigger)==null||re.focus({preventScroll:!0}),J.preventDefault()}),children:s.jsx(Nc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:s.jsx(ne,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:J=>J.preventDefault(),...k,...ie,onPlaced:()=>R(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Ke(k.onKeyDown,J=>{const re=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!re&&J.key.length===1&&V(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let fe=H().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(J.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const pe=J.target,ye=fe.indexOf(pe);fe=fe.slice(ye+1)}setTimeout(()=>F(fe)),J.preventDefault()}})})})})})})});TA.displayName=Rre;var Ire="SelectItemAlignedPosition",MA=x.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=La(Hi,n),l=Fa(Hi,n),[u,d]=x.useState(null),[f,m]=x.useState(null),p=pt(t,D=>m(D)),g=Gp(n),y=x.useRef(!1),b=x.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:j}=l,C=x.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&f&&w&&N&&k){const D=a.trigger.getBoundingClientRect(),I=f.getBoundingClientRect(),z=a.valueNode.getBoundingClientRect(),K=k.getBoundingClientRect();if(a.dir!=="rtl"){const pe=K.left-I.left,ye=z.left-pe,Ne=D.left-ye,Oe=D.width+Ne,Xe=Math.max(Oe,I.width),Le=window.innerWidth-Zr,st=A2(ye,[Zr,Math.max(Zr,Le-Xe)]);u.style.minWidth=Oe+"px",u.style.left=st+"px"}else{const pe=I.right-K.right,ye=window.innerWidth-z.right-pe,Ne=window.innerWidth-D.right-ye,Oe=D.width+Ne,Xe=Math.max(Oe,I.width),Le=window.innerWidth-Zr,st=A2(ye,[Zr,Math.max(Zr,Le-Xe)]);u.style.minWidth=Oe+"px",u.style.right=st+"px"}const q=g(),H=window.innerHeight-Zr*2,B=w.scrollHeight,R=window.getComputedStyle(f),M=parseInt(R.borderTopWidth,10),F=parseInt(R.paddingTop,10),L=parseInt(R.borderBottomWidth,10),A=parseInt(R.paddingBottom,10),O=M+F+B+A+L,U=Math.min(N.offsetHeight*5,O),V=window.getComputedStyle(w),$=parseInt(V.paddingTop,10),Y=parseInt(V.paddingBottom,10),X=D.top+D.height/2-Zr,ne=H-X,ie=N.offsetHeight/2,J=N.offsetTop+ie,re=M+F+J,ce=O-re;if(re<=X){const pe=q.length>0&&N===q[q.length-1].ref.current;u.style.bottom="0px";const ye=f.clientHeight-w.offsetTop-w.offsetHeight,Ne=Math.max(ne,ie+(pe?Y:0)+ye+L),Oe=re+Ne;u.style.height=Oe+"px"}else{const pe=q.length>0&&N===q[0].ref.current;u.style.top="0px";const Ne=Math.max(X,M+w.offsetTop+(pe?$:0)+ie)+ce;u.style.height=Ne+"px",w.scrollTop=re-X+w.offsetTop}u.style.margin=`${Zr}px 0`,u.style.minHeight=U+"px",u.style.maxHeight=H+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,u,f,w,N,k,a.dir,r]);jn(()=>C(),[C]);const[S,E]=x.useState();jn(()=>{f&&E(window.getComputedStyle(f).zIndex)},[f]);const P=x.useCallback(D=>{D&&b.current===!0&&(C(),j==null||j(),b.current=!1)},[C,j]);return s.jsx(Fre,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:y,onScrollButtonChange:P,children:s.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:s.jsx(Ge.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});MA.displayName=Ire;var Lre="SelectPopperPosition",I0=x.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Zr,...a}=e,l=Xp(n);return s.jsx(wb,{...l,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});I0.displayName=Lre;var[Fre,r1]=Ac(Hi,{}),L0="SelectViewport",AA=x.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=Fa(L0,n),l=r1(L0,n),u=pt(t,a.onViewportChange),d=x.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Qp.Slot,{scope:n,children:s.jsx(Ge.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ke(o.onScroll,f=>{const m=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:g}=l;if(g!=null&&g.current&&p){const y=Math.abs(d.current-m.scrollTop);if(y>0){const b=window.innerHeight-Zr*2,w=parseFloat(p.style.minHeight),N=parseFloat(p.style.height),k=Math.max(w,N);if(k<b){const j=k+y,C=Math.min(b,j),S=j-C;p.style.height=C+"px",p.style.bottom==="0px"&&(m.scrollTop=S>0?S:0,p.style.justifyContent="flex-end")}}}d.current=m.scrollTop})})})]})});AA.displayName=L0;var DA="SelectGroup",[$re,Vre]=Ac(DA),zre=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=xr();return s.jsx($re,{scope:n,id:o,children:s.jsx(Ge.div,{role:"group","aria-labelledby":o,...r,ref:t})})});zre.displayName=DA;var RA="SelectLabel",OA=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Vre(RA,n);return s.jsx(Ge.div,{id:o.id,...r,ref:t})});OA.displayName=RA;var Qm="SelectItem",[Bre,IA]=Ac(Qm),LA=x.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...l}=e,u=La(Qm,n),d=Fa(Qm,n),f=u.value===r,[m,p]=x.useState(a??""),[g,y]=x.useState(!1),b=pt(t,j=>{var C;return(C=d.itemRefCallback)==null?void 0:C.call(d,j,r,o)}),w=xr(),N=x.useRef("touch"),k=()=>{o||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(Bre,{scope:n,value:r,disabled:o,textId:w,isSelected:f,onItemTextChange:x.useCallback(j=>{p(C=>C||((j==null?void 0:j.textContent)??"").trim())},[]),children:s.jsx(Qp.ItemSlot,{scope:n,value:r,disabled:o,textValue:m,children:s.jsx(Ge.div,{role:"option","aria-labelledby":w,"data-highlighted":g?"":void 0,"aria-selected":f&&g,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:b,onFocus:Ke(l.onFocus,()=>y(!0)),onBlur:Ke(l.onBlur,()=>y(!1)),onClick:Ke(l.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:Ke(l.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:Ke(l.onPointerDown,j=>{N.current=j.pointerType}),onPointerMove:Ke(l.onPointerMove,j=>{var C;N.current=j.pointerType,o?(C=d.onItemLeave)==null||C.call(d):N.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ke(l.onPointerLeave,j=>{var C;j.currentTarget===document.activeElement&&((C=d.onItemLeave)==null||C.call(d))}),onKeyDown:Ke(l.onKeyDown,j=>{var S;((S=d.searchRef)==null?void 0:S.current)!==""&&j.key===" "||(_re.includes(j.key)&&k(),j.key===" "&&j.preventDefault())})})})})});LA.displayName=Qm;var Au="SelectItemText",FA=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,l=La(Au,n),u=Fa(Au,n),d=IA(Au,n),f=Mre(Au,n),[m,p]=x.useState(null),g=pt(t,k=>p(k),d.onItemTextChange,k=>{var j;return(j=u.itemTextRefCallback)==null?void 0:j.call(u,k,d.value,d.disabled)}),y=m==null?void 0:m.textContent,b=x.useMemo(()=>s.jsx("option",{value:d.value,disabled:d.disabled,children:y},d.value),[d.disabled,d.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:N}=f;return jn(()=>(w(b),()=>N(b)),[w,N,b]),s.jsxs(s.Fragment,{children:[s.jsx(Ge.span,{id:d.textId,...a,ref:g}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?vc.createPortal(a.children,l.valueNode):null]})});FA.displayName=Au;var $A="SelectItemIndicator",VA=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return IA($A,n).isSelected?s.jsx(Ge.span,{"aria-hidden":!0,...r,ref:t}):null});VA.displayName=$A;var F0="SelectScrollUpButton",zA=x.forwardRef((e,t)=>{const n=Fa(F0,e.__scopeSelect),r=r1(F0,e.__scopeSelect),[o,a]=x.useState(!1),l=pt(t,r.onScrollButtonChange);return jn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollTop>0;a(f)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),o?s.jsx(WA,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});zA.displayName=F0;var $0="SelectScrollDownButton",BA=x.forwardRef((e,t)=>{const n=Fa($0,e.__scopeSelect),r=r1($0,e.__scopeSelect),[o,a]=x.useState(!1),l=pt(t,r.onScrollButtonChange);return jn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollHeight-d.clientHeight,m=Math.ceil(d.scrollTop)<f;a(m)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),o?s.jsx(WA,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});BA.displayName=$0;var WA=x.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=Fa("SelectScrollButton",n),l=x.useRef(null),u=Gp(n),d=x.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return x.useEffect(()=>()=>d(),[d]),jn(()=>{var m;const f=u().find(p=>p.ref.current===document.activeElement);(m=f==null?void 0:f.ref.current)==null||m.scrollIntoView({block:"nearest"})},[u]),s.jsx(Ge.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Ke(o.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Ke(o.onPointerMove,()=>{var f;(f=a.onItemLeave)==null||f.call(a),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Ke(o.onPointerLeave,()=>{d()})})}),Wre="SelectSeparator",HA=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(Ge.div,{"aria-hidden":!0,...r,ref:t})});HA.displayName=Wre;var V0="SelectArrow",Hre=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Xp(n),a=La(V0,n),l=Fa(V0,n);return a.open&&l.position==="popper"?s.jsx(Nb,{...o,...r,ref:t}):null});Hre.displayName=V0;var Ure="SelectBubbleInput",UA=x.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=x.useRef(null),a=pt(r,o),l=n1(t);return x.useEffect(()=>{const u=o.current;if(!u)return;const d=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&m){const p=new Event("change",{bubbles:!0});m.call(u,t),u.dispatchEvent(p)}},[l,t]),s.jsx(Ge.select,{...n,style:{...L_,...n.style},ref:a,defaultValue:t})});UA.displayName=Ure;function qA(e){return e===""||e===void 0}function KA(e){const t=is(e),n=x.useRef(""),r=x.useRef(0),o=x.useCallback(l=>{const u=n.current+l;t(u),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),a=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function YA(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=qre(e,Math.max(a,0));o.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}function qre(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Kre=wA,QA=jA,Yre=kA,Qre=SA,Gre=_A,GA=EA,Xre=AA,XA=OA,ZA=LA,Zre=FA,Jre=VA,JA=zA,e4=BA,t4=HA;const pd=Kre,gd=Yre,gc=x.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(QA,{ref:r,className:Ie("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(Qre,{asChild:!0,children:s.jsx(Wn,{className:"h-4 w-4 opacity-50"})})]}));gc.displayName=QA.displayName;const n4=x.forwardRef(({className:e,...t},n)=>s.jsx(JA,{ref:n,className:Ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(ms,{className:"h-4 w-4"})}));n4.displayName=JA.displayName;const r4=x.forwardRef(({className:e,...t},n)=>s.jsx(e4,{ref:n,className:Ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Wn,{className:"h-4 w-4"})}));r4.displayName=e4.displayName;const xc=x.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>s.jsx(Gre,{children:s.jsxs(GA,{ref:o,className:Ie("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(n4,{}),s.jsx(Xre,{className:Ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(r4,{})]})}));xc.displayName=GA.displayName;const ese=x.forwardRef(({className:e,...t},n)=>s.jsx(XA,{ref:n,className:Ie("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ese.displayName=XA.displayName;const Ti=x.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(ZA,{ref:r,className:Ie("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Jre,{children:s.jsx(_d,{className:"h-4 w-4"})})}),s.jsx(Zre,{children:t})]}));Ti.displayName=ZA.displayName;const tse=x.forwardRef(({className:e,...t},n)=>s.jsx(t4,{ref:n,className:Ie("-mx-1 my-1 h-px bg-muted",e),...t}));tse.displayName=t4.displayName;const xd=[{value:"contact.created",label:"Contact created",group:"Contacts"},{value:"contact.updated",label:"Contact updated",group:"Contacts"},{value:"contact.stage_changed",label:"Contact stage changed",group:"Contacts"},{value:"contact.deleted",label:"Contact deleted",group:"Contacts"},{value:"account.created",label:"Account created",group:"Accounts"},{value:"account.updated",label:"Account updated",group:"Accounts"},{value:"account.deleted",label:"Account deleted",group:"Accounts"},{value:"opportunity.created",label:"Opportunity created",group:"Opportunities"},{value:"opportunity.updated",label:"Opportunity updated",group:"Opportunities"},{value:"opportunity.stage_changed",label:"Opportunity stage changed",group:"Opportunities"},{value:"opportunity.deleted",label:"Opportunity deleted",group:"Opportunities"},{value:"activity.created",label:"Activity created",group:"Activities"},{value:"activity.updated",label:"Activity updated",group:"Activities"},{value:"activity.completed",label:"Activity completed",group:"Activities"},{value:"assignment.created",label:"Assignment created",group:"Assignments"},{value:"assignment.completed",label:"Assignment completed",group:"Assignments"},{value:"use_case.created",label:"Use case created",group:"Use Cases"},{value:"use_case.updated",label:"Use case updated",group:"Use Cases"},{value:"use_case.stage_changed",label:"Use case stage changed",group:"Use Cases"}],va=[{value:"send_notification",label:"Send notification",configFields:[{key:"message",label:"Message",placeholder:"e.g. A new lead arrived",required:!0},{key:"channel_id",label:"Channel ID",placeholder:"UUID (uses default if empty)",required:!1},{key:"recipient",label:"Recipient",placeholder:"e.g. #channel or @user",required:!1}]},{value:"send_email",label:"Send email",configFields:[{key:"to_address",label:"To",placeholder:"recipient@example.com",required:!0},{key:"subject",label:"Subject",placeholder:"e.g. Welcome aboard!",required:!0},{key:"body_text",label:"Body",placeholder:"Email body text...",required:!0},{key:"require_approval",label:"Require approval",placeholder:"true or false",required:!1}]},{value:"create_note",label:"Create note",configFields:[{key:"body",label:"Note body",placeholder:"Note content…",required:!0}]},{value:"create_activity",label:"Create activity",configFields:[{key:"type",label:"Type",placeholder:"e.g. call, email, task",required:!0},{key:"subject",label:"Subject",placeholder:"Activity subject…",required:!0}]},{value:"add_tag",label:"Add tag",configFields:[{key:"tag",label:"Tag",placeholder:"e.g. hot-lead",required:!0}]},{value:"remove_tag",label:"Remove tag",configFields:[{key:"tag",label:"Tag",placeholder:"e.g. unqualified",required:!0}]},{value:"update_field",label:"Update field",configFields:[{key:"field",label:"Field name",placeholder:"e.g. lifecycle_stage",required:!0},{key:"value",label:"New value",placeholder:"e.g. customer",required:!0}]},{value:"assign_owner",label:"Assign owner",configFields:[{key:"owner_id",label:"Owner ID",placeholder:"User UUID",required:!0}]},{value:"webhook",label:"Call webhook",configFields:[{key:"url",label:"URL",placeholder:"https://hooks.example.com/crmy",required:!0}]}];function s4(e){const t=va.find(n=>n.value===e.type);return t?t.configFields.filter(n=>n.required).every(n=>(e.config[n.key]??"").trim()!==""):!1}const o4="w-full h-8 px-2.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",nse="w-full h-7 px-2 rounded border border-border bg-background text-xs text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";function rse({value:e,onChange:t}){const[n,r]=x.useState(!1),o=x.useRef(null),a=e.trim()?xd.filter(l=>l.value.includes(e.toLowerCase())||l.label.toLowerCase().includes(e.toLowerCase())):xd;return s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:o,value:e,onChange:l=>t(l.target.value),onFocus:()=>r(!0),onBlur:()=>setTimeout(()=>r(!1),120),placeholder:"e.g. contact.created",className:o4+" font-mono",autoComplete:"off"}),n&&a.length>0&&s.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 bg-popover border border-border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:a.map(l=>s.jsxs("button",{type:"button",onMouseDown:()=>{t(l.value),r(!1)},className:"w-full text-left px-3 py-2 text-xs hover:bg-muted transition-colors flex items-center justify-between gap-3",children:[s.jsx("span",{className:"font-mono text-foreground",children:l.value}),s.jsx("span",{className:"text-muted-foreground shrink-0",children:l.label})]},l.value))})]})}function sse({action:e,onChange:t,onRemove:n,canRemove:r}){const o=va.find(a=>a.value===e.type)??va[0];return s.jsxs("div",{className:"p-2.5 rounded-lg border border-border bg-muted/20 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(pd,{value:e.type,onValueChange:a=>t({type:a,config:{}}),children:[s.jsx(gc,{className:"h-7 text-xs flex-1",children:s.jsx(gd,{})}),s.jsx(xc,{children:va.map(a=>s.jsx(Ti,{value:a.value,children:a.label},a.value))})]}),r&&s.jsx("button",{type:"button",onClick:n,className:"p-1 rounded text-muted-foreground hover:text-destructive transition-colors shrink-0","aria-label":"Remove action",children:s.jsx(Ht,{className:"w-3 h-3"})})]}),o.configFields.map(a=>s.jsxs("div",{children:[s.jsxs("label",{className:"block text-[10px] font-medium text-muted-foreground mb-0.5",children:[a.label,a.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("input",{value:e.config[a.key]??"",onChange:l=>t({...e,config:{...e.config,[a.key]:l.target.value}}),placeholder:a.placeholder,className:nse+" font-mono"})]},a.key))]})}function ose(){const{drawerEntityId:e,closeDrawer:t}=lt(),n=e??"",{data:r,isLoading:o}=S7(n),a=E7(n),l=c3(),{data:u,isLoading:d}=P7(n,{limit:20}),[f,m]=x.useState(!1),[p,g]=x.useState(""),[y,b]=x.useState(""),[w,N]=x.useState([]),[k,j]=x.useState({}),[C,S]=x.useState("details"),E=(r==null?void 0:r.workflow)??r,P=(u==null?void 0:u.data)??(u==null?void 0:u.runs)??[];if(o||!E)return s.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});const D=()=>{g(E.name??""),b(E.trigger_event??"");const B=Array.isArray(E.actions)&&E.actions.length>0?E.actions.map(R=>({type:R.type??"send_notification",config:Object.fromEntries(Object.entries(R.config??{}).map(([M,F])=>[M,String(F)]))})):[{type:"send_notification",config:{}}];N(B),j({}),m(!0)},I=()=>{const B={};return p.trim()||(B.name="Name is required."),y.trim()||(B.trigger="Trigger event is required."),w.forEach((R,M)=>{s4(R)||(B[`action_${M}`]="Fill in all required fields.")}),j(B),Object.keys(B).length===0},z=async()=>{if(I())try{await a.mutateAsync({name:p.trim(),trigger_event:y.trim(),actions:w.map(B=>({type:B.type,config:Object.fromEntries(Object.entries(B.config).map(([R,M])=>[R,M.trim()]))}))}),m(!1),de({title:"Workflow updated"})}catch{de({title:"Update failed",variant:"destructive"})}},K=async()=>{try{await a.mutateAsync({is_active:!E.is_active}),de({title:E.is_active?"Workflow paused":"Workflow activated"})}catch{de({title:"Error",variant:"destructive"})}},q=async()=>{try{await l.mutateAsync(n),t(),de({title:"Workflow deleted"})}catch{de({title:"Error",variant:"destructive"})}},H=(B,R)=>{N(M=>M.map((F,L)=>L===B?R:F)),j(M=>{const F={...M};return delete F[`action_${B}`],F})};return s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fu,{className:"w-5 h-5 text-amber-500 shrink-0"}),s.jsx("h3",{className:"text-lg font-display font-bold text-foreground flex-1 truncate",children:E.name}),s.jsx(mo,{variant:E.is_active!==!1?"default":"secondary",className:"text-[10px] shrink-0",children:E.is_active!==!1?"Active":"Paused"})]}),s.jsx("div",{className:"flex rounded-lg border border-border overflow-hidden",children:["details","runs"].map(B=>s.jsx("button",{className:`flex-1 px-3 py-1.5 text-xs font-medium capitalize transition-colors ${C===B?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:text-foreground"}`,onClick:()=>S(B),children:B},B))}),C==="details"&&s.jsx("div",{className:"space-y-4",children:f?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Name"}),s.jsx("input",{value:p,onChange:B=>{g(B.target.value),j(R=>({...R,name:""}))},className:o4}),k.name&&s.jsx("p",{className:"text-xs text-destructive",children:k.name})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Trigger Event"}),s.jsx(rse,{value:y,onChange:B=>{b(B),j(R=>({...R,trigger:""}))}}),k.trigger&&s.jsx("p",{className:"text-xs text-destructive",children:k.trigger})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Actions"}),w.map((B,R)=>s.jsxs("div",{children:[s.jsx(sse,{action:B,onChange:M=>H(R,M),onRemove:()=>N(M=>M.filter((F,L)=>L!==R)),canRemove:w.length>1}),k[`action_${R}`]&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:k[`action_${R}`]})]},R)),w.length<5&&s.jsxs("button",{type:"button",onClick:()=>N(B=>[...B,{type:"send_notification",config:{}}]),className:"w-full py-1.5 rounded-lg border border-dashed border-border text-xs text-muted-foreground hover:text-foreground hover:border-foreground/30 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(or,{className:"w-3.5 h-3.5"})," Add action"]})]}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsxs(Jt,{size:"sm",onClick:z,disabled:a.isPending,className:"text-xs gap-1",children:[a.isPending&&s.jsx(gr,{className:"w-3 h-3 animate-spin"}),"Save changes"]}),s.jsx(Jt,{size:"sm",variant:"outline",onClick:()=>m(!1),className:"text-xs",children:"Cancel"})]})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:"Trigger Event"}),s.jsx("p",{className:"text-sm font-mono text-foreground",children:E.trigger_event}),(()=>{const B=xd.find(R=>R.value===E.trigger_event);return B?s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:B.label}):null})()]}),s.jsxs(Jt,{size:"sm",variant:"ghost",onClick:D,className:"text-xs gap-1 shrink-0",children:[s.jsx(br,{className:"w-3 h-3"})," Edit"]})]}),Array.isArray(E.actions)&&E.actions.length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:["Actions (",E.actions.length,")"]}),s.jsx("div",{className:"space-y-1.5",children:E.actions.map((B,R)=>{const M=va.find(F=>F.value===B.type);return s.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg border border-border bg-muted/20",children:[s.jsx("span",{className:"text-xs font-medium text-foreground min-w-0",children:(M==null?void 0:M.label)??B.type}),B.config&&Object.keys(B.config).length>0&&s.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate",children:Object.entries(B.config).map(([F,L])=>`${F}: ${L}`).join(" · ")})]},R)})})]}),s.jsxs("div",{className:"flex gap-2 pt-2 border-t border-border",children:[s.jsxs(Jt,{size:"sm",variant:"outline",onClick:K,disabled:a.isPending,className:"text-xs gap-1",children:[E.is_active!==!1?s.jsx(x5,{className:"w-3 h-3"}):s.jsx(wa,{className:"w-3 h-3"}),E.is_active!==!1?"Pause":"Activate"]}),s.jsxs(Jt,{size:"sm",variant:"outline",onClick:q,className:"text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",children:[s.jsx(Bn,{className:"w-3 h-3"})," Delete"]})]})]})}),C==="runs"&&s.jsx("div",{className:"space-y-2",children:d?s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:"Loading runs…"}):P.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(zs,{className:"w-8 h-8 text-muted-foreground/30 mx-auto mb-2"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"No runs yet. Waiting for the trigger event."})]}):P.map(B=>{const R=B.status==="completed"||B.status==="success",M=B.status==="failed"||B.status==="error";return s.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg border border-border bg-card",children:[R?s.jsx(Gt,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0 mt-0.5"}):M?s.jsx(Vs,{className:"w-3.5 h-3.5 text-destructive shrink-0 mt-0.5"}):s.jsx(zs,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(mo,{variant:R?"default":M?"destructive":"secondary",className:"text-[10px]",children:B.status}),B.actions_run!=null&&B.actions_total!=null&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[B.actions_run,"/",B.actions_total," actions"]}),B.duration_ms!=null&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[B.duration_ms,"ms"]})]}),B.error&&s.jsx("p",{className:"text-[10px] text-destructive truncate mt-0.5",children:B.error})]}),s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:B.started_at?new Date(B.started_at).toLocaleString():""})]},B.id)})})]})}const D2={draft:{label:"Draft",color:"bg-muted text-muted-foreground",icon:cb},pending_approval:{label:"Pending Approval",color:"bg-warning/15 text-warning",icon:zs},approved:{label:"Approved",color:"bg-emerald-500/15 text-emerald-500",icon:Gt},sending:{label:"Sending",color:"bg-blue-500/15 text-blue-500",icon:Lr},sent:{label:"Sent",color:"bg-emerald-500/15 text-emerald-500",icon:Gt},failed:{label:"Failed",color:"bg-destructive/15 text-destructive",icon:mm},rejected:{label:"Rejected",color:"bg-destructive/15 text-destructive",icon:Vs}};function ase(){const{drawerEntityId:e}=lt(),t=e??"",{data:n,isLoading:r}=a7(t),o=(n==null?void 0:n.email)??n;if(r||!o)return s.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});const a=D2[o.status]??D2.draft,l=a.icon;return s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(ho,{className:"w-5 h-5 text-blue-500 mt-0.5"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-display font-bold text-foreground",children:o.subject||"(no subject)"}),s.jsxs(mo,{variant:"outline",className:`text-[10px] mt-1 ${a.color}`,children:[s.jsx(l,{className:"w-3 h-3 mr-1"}),a.label]})]})]}),s.jsxs("div",{className:"space-y-2 border-t border-border pt-3",children:[o.to&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Na,{className:"w-3.5 h-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"To:"}),s.jsx("span",{className:"text-sm text-foreground",children:o.to})]}),o.from&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Na,{className:"w-3.5 h-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"From:"}),s.jsx("span",{className:"text-sm text-foreground",children:o.from})]}),o.created_at&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zs,{className:"w-3.5 h-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Created:"}),s.jsx("span",{className:"text-sm text-foreground",children:Nr(new Date(o.created_at),"PPp")})]}),o.sent_at&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"w-3.5 h-3.5 text-emerald-500"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Sent:"}),s.jsx("span",{className:"text-sm text-foreground",children:Nr(new Date(o.sent_at),"PPp")})]})]}),o.body&&s.jsxs("div",{className:"border-t border-border pt-3",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Body"}),s.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:s.jsx("pre",{className:"whitespace-pre-wrap text-sm text-foreground bg-muted/30 p-3 rounded-lg",children:o.body})})]})]})}function ise(){const e=Cn(),t=Cr(),{setCommandPaletteOpen:n,openDrawer:r,setShortcutsOpen:o,toggleZenMode:a,openQuickAdd:l}=lt(),u=x.useCallback(d=>{const f=d.target,m=f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.isContentEditable;if((d.metaKey||d.ctrlKey)&&d.key==="k"){d.preventDefault(),n(!0);return}if((d.metaKey||d.ctrlKey)&&d.key==="j"){d.preventDefault(),e("/agent");return}if((d.metaKey||d.ctrlKey)&&d.shiftKey&&d.key==="Z"){d.preventDefault(),a();return}if(d.key==="Escape"){if(t.pathname==="/agent"){d.preventDefault(),e(-1);return}lt.getState().closeDrawer(),lt.getState().closeQuickAdd(),n(!1),o(!1);return}if(!m){if(d.key==="?"){d.preventDefault(),o(!0);return}if((d.key==="n"||d.key==="N")&&t.pathname==="/contacts"){d.preventDefault(),l("contact");return}if(d.key==="d"&&!d.metaKey&&!d.ctrlKey&&t.pathname==="/opportunities"){d.preventDefault(),l("opportunity");return}if(d.key==="g"){const p=g=>{window.removeEventListener("keydown",p),g.key==="h"?e("/"):g.key==="c"?e("/contacts"):g.key==="d"&&e("/opportunities")};window.addEventListener("keydown",p),setTimeout(()=>window.removeEventListener("keydown",p),1e3);return}}},[e,t.pathname,n,r,o,a,l]);x.useEffect(()=>(window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)),[u])}function a4(){const{darkVariant:e}=lt(),[t,n]=x.useState(()=>{const o=localStorage.getItem("theme");return o||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});return x.useEffect(()=>{const o=document.documentElement;o.classList.toggle("dark",t==="dark"),o.classList.toggle("charcoal",e==="charcoal"),localStorage.setItem("theme",t)},[t,e]),{theme:t,setTheme:n,toggle:()=>n(o=>o==="dark"?"light":"dark")}}function lse(){const e=Cr(),t=Cn(),{enabled:n}=kr();return e.pathname==="/agent"?null:s.jsx(mn,{children:n&&s.jsxs(We.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},className:"fixed z-[60] bottom-20 md:bottom-6 right-4 md:right-6 flex flex-col items-center gap-1.5",children:[s.jsx(We.button,{onClick:()=>t("/agent"),whileHover:{scale:1.05},whileTap:{scale:.95},className:"w-14 h-14 rounded-2xl flex items-center justify-center shadow-lg bg-gradient-to-br from-primary to-accent text-primary-foreground animate-fab-glow",children:s.jsx(an,{className:"w-5 h-5"})}),s.jsxs("span",{className:"hidden md:inline-flex items-center gap-0.5 text-[10px] font-mono text-muted-foreground bg-card/80 backdrop-blur-sm border border-border px-1.5 py-0.5 rounded-md shadow-sm",children:[s.jsx(l5,{className:"w-2.5 h-2.5"}),"J"]})]})})}const fo=x.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:Ie("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));fo.displayName="Input";const i4=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:Ie("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));i4.displayName="Card";const l4=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:Ie("flex flex-col space-y-1.5 p-6",e),...t}));l4.displayName="CardHeader";const c4=x.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:Ie("text-2xl font-semibold leading-none tracking-tight",e),...t}));c4.displayName="CardTitle";const u4=x.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:Ie("text-sm text-muted-foreground",e),...t}));u4.displayName="CardDescription";const d4=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:Ie("p-6 pt-0",e),...t}));d4.displayName="CardContent";const cse=x.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:Ie("flex items-center p-6 pt-0",e),...t}));cse.displayName="CardFooter";const f4=[{label:"At least 8 characters",test:e=>e.length>=8},{label:"One uppercase letter",test:e=>/[A-Z]/.test(e)},{label:"One number",test:e=>/\d/.test(e)},{label:"One special character",test:e=>/[^A-Za-z0-9]/.test(e)}];function R2(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function O2(e){return f4.every(t=>t.test(e))}const use={"--background":"220 10% 32%","--card":"220 14% 18%","--card-foreground":"36 15% 92%","--popover":"220 14% 22%","--popover-foreground":"36 15% 92%","--muted":"220 10% 24%","--muted-foreground":"220 8% 62%","--input":"220 10% 32%","--border":"220 10% 28%","--foreground":"36 15% 92%"},dse={"--background":"15 25% 32%","--card":"15 22% 18%","--card-foreground":"25 100% 95%","--popover":"15 22% 22%","--popover-foreground":"25 100% 95%","--muted":"15 20% 24%","--muted-foreground":"20 15% 62%","--input":"15 20% 32%","--border":"15 20% 28%","--foreground":"25 100% 95%"};function fse(){const e=Cn(),{darkVariant:t}=lt(),n=t==="charcoal",[r,o]=x.useState("login"),[a,l]=x.useState(""),[u,d]=x.useState(""),[f,m]=x.useState(""),[p,g]=x.useState(""),[y,b]=x.useState(""),[w,N]=x.useState(!1),[k,j]=x.useState({}),[C,S]=x.useState(()=>document.documentElement.classList.contains("dark")),E=()=>{const F=!C;S(F),document.documentElement.classList.toggle("dark",F),localStorage.setItem("crmy_theme",F?"dark":"light")};if(localStorage.getItem("crmy_token"))return s.jsx(ui,{to:"/",replace:!0});const P=F=>j(L=>({...L,[F]:!0})),D=k.email&&!R2(a)?"Enter a valid email address":"",I=k.password&&r==="register"&&!O2(u)?"Password does not meet requirements":k.password&&!u?"Password is required":"",z=k.name&&r==="register"&&!f.trim()?"Name is required":"",K=k.tenantName&&r==="register"&&!p.trim()?"Organization name is required":"",q=async F=>{if(F.preventDefault(),j({email:!0,password:!0,name:!0,tenantName:!0}),!!R2(a)&&u&&!(r==="register"&&(!O2(u)||!f.trim()||!p.trim()))){b(""),N(!0);try{const L=r==="login"?await Gk.login(a,u):await Gk.register({email:a,password:u,name:f,tenant_name:p});LB(L.token),FB(L.user),e("/")}catch(L){b(L instanceof Error?L.message:"Authentication failed")}finally{N(!1)}}},H=F=>{o(F),j({}),b("")},B=C?"bg-background":n?"bg-[hsl(220_20%_93%)]":"bg-[hsl(30_25%_93%)]",R=n?"dark charcoal":"dark",M=C?void 0:n?use:dse;return s.jsxs("div",{className:`flex min-h-screen items-center justify-center p-4 ${B}`,children:[s.jsx("button",{onClick:E,className:"fixed top-4 right-4 p-2 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors","aria-label":"Toggle theme",children:C?s.jsx(v5,{className:"w-5 h-5"}):s.jsx(g5,{className:"w-5 h-5"})}),s.jsx("div",{className:`${R} w-full max-w-md`,style:M,children:s.jsxs(i4,{className:"w-full",children:[s.jsxs(l4,{className:"text-left",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[s.jsx("img",{src:f3,alt:"CRMy",className:"h-14 w-14 object-contain"}),s.jsx(c4,{className:"font-brand font-bold text-2xl flex-1",children:r==="login"?s.jsxs(s.Fragment,{children:["Sign in to ",s.jsx("span",{className:"text-primary",children:"CRMy"})]}):s.jsx(s.Fragment,{children:"Create your account"})}),r==="register"&&s.jsx("button",{onClick:()=>H("login"),className:"ml-auto p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors","aria-label":"Back to sign in",children:s.jsx(Ht,{className:"w-5 h-5"})})]}),r==="register"&&s.jsx(u4,{className:"text-center",children:"Set up a new tenant and admin account"})]}),s.jsxs(d4,{children:[s.jsxs("form",{onSubmit:q,className:"space-y-4",noValidate:!0,children:[r==="register"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("label",{className:"mb-1 block text-sm font-medium",children:["Your name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(fo,{value:f,onChange:F=>m(F.target.value),onBlur:()=>P("name"),"aria-invalid":!!z}),z&&s.jsx("p",{className:"mt-1 text-xs text-destructive",children:z})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"mb-1 block text-sm font-medium",children:["Organization name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(fo,{value:p,onChange:F=>g(F.target.value),onBlur:()=>P("tenantName"),"aria-invalid":!!K}),K&&s.jsx("p",{className:"mt-1 text-xs text-destructive",children:K})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"mb-1 block text-sm font-medium",children:["Email ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(fo,{type:"email",value:a,onChange:F=>l(F.target.value),onBlur:()=>P("email"),"aria-invalid":!!D}),D&&s.jsx("p",{className:"mt-1 text-xs text-destructive",children:D})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"mb-1 block text-sm font-medium",children:["Password ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(fo,{type:"password",value:u,onChange:F=>d(F.target.value),onBlur:()=>P("password"),"aria-invalid":!!I}),I&&r!=="register"&&s.jsx("p",{className:"mt-1 text-xs text-destructive",children:I}),r==="register"&&k.password&&s.jsx("ul",{className:"mt-2 space-y-1",children:f4.map(F=>{const L=F.test(u);return s.jsxs("li",{className:`flex items-center gap-1.5 text-xs ${L?"text-success":"text-muted-foreground"}`,children:[s.jsx(_d,{className:`w-3 h-3 ${L?"opacity-100":"opacity-30"}`}),F.label]},F.label)})})]}),y&&s.jsx("p",{className:"text-sm text-destructive",children:y}),s.jsx(Jt,{type:"submit",className:"w-full",disabled:w,children:w?"Please wait...":r==="login"?"Sign in":"Create account"})]}),s.jsx("div",{className:"mt-4 text-center text-sm text-muted-foreground",children:r==="login"?s.jsxs(s.Fragment,{children:["Don't have an account?"," ",s.jsx("button",{className:"text-primary hover:underline",onClick:()=>H("register"),children:"Register"})]}):s.jsxs(s.Fragment,{children:["Already have an account?"," ",s.jsx("button",{className:"text-primary hover:underline",onClick:()=>H("login"),children:"Sign in"})]})})]})]})})]})}var Zp="Checkbox",[hse]=wo(Zp),[mse,s1]=hse(Zp);function pse(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:a,form:l,name:u,onCheckedChange:d,required:f,value:m="on",internal_do_not_use_render:p}=e,[g,y]=Ri({prop:n,defaultProp:o??!1,onChange:d,caller:Zp}),[b,w]=x.useState(null),[N,k]=x.useState(null),j=x.useRef(!1),C=b?!!l||!!b.closest("form"):!0,S={checked:g,disabled:a,setChecked:y,control:b,setControl:w,name:u,form:l,value:m,hasConsumerStoppedPropagationRef:j,required:f,defaultChecked:ba(o)?!1:o,isFormControl:C,bubbleInput:N,setBubbleInput:k};return s.jsx(mse,{scope:t,...S,children:gse(p)?p(S):r})}var h4="CheckboxTrigger",m4=x.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:a,value:l,disabled:u,checked:d,required:f,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:g,isFormControl:y,bubbleInput:b}=s1(h4,e),w=pt(o,m),N=x.useRef(d);return x.useEffect(()=>{const k=a==null?void 0:a.form;if(k){const j=()=>p(N.current);return k.addEventListener("reset",j),()=>k.removeEventListener("reset",j)}},[a,p]),s.jsx(Ge.button,{type:"button",role:"checkbox","aria-checked":ba(d)?"mixed":d,"aria-required":f,"data-state":v4(d),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:w,onKeyDown:Ke(t,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:Ke(n,k=>{p(j=>ba(j)?!0:!j),b&&y&&(g.current=k.isPropagationStopped(),g.current||k.stopPropagation())})})});m4.displayName=h4;var o1=x.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:l,disabled:u,value:d,onCheckedChange:f,form:m,...p}=e;return s.jsx(pse,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:u,required:l,onCheckedChange:f,name:r,form:m,value:d,internal_do_not_use_render:({isFormControl:g})=>s.jsxs(s.Fragment,{children:[s.jsx(m4,{...p,ref:t,__scopeCheckbox:n}),g&&s.jsx(y4,{__scopeCheckbox:n})]})})});o1.displayName=Zp;var p4="CheckboxIndicator",g4=x.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=s1(p4,n);return s.jsx(No,{present:r||ba(a.checked)||a.checked===!0,children:s.jsx(Ge.span,{"data-state":v4(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});g4.displayName=p4;var x4="CheckboxBubbleInput",y4=x.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:l,required:u,disabled:d,name:f,value:m,form:p,bubbleInput:g,setBubbleInput:y}=s1(x4,e),b=pt(n,y),w=n1(a),N=yb(r);x.useEffect(()=>{const j=g;if(!j)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,P=!o.current;if(w!==a&&E){const D=new Event("click",{bubbles:P});j.indeterminate=ba(a),E.call(j,ba(a)?!1:a),j.dispatchEvent(D)}},[g,w,a,o]);const k=x.useRef(ba(a)?!1:a);return s.jsx(Ge.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??k.current,required:u,disabled:d,name:f,value:m,form:p,...t,tabIndex:-1,ref:b,style:{...t.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});y4.displayName=x4;function gse(e){return typeof e=="function"}function ba(e){return e==="indeterminate"}function v4(e){return ba(e)?"indeterminate":e?"checked":"unchecked"}const b4=x.forwardRef(({className:e,...t},n)=>s.jsx(o1,{ref:n,className:Ie("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:s.jsx(g4,{className:Ie("flex items-center justify-center text-current"),children:s.jsx(_d,{className:"h-4 w-4"})})}));b4.displayName=o1.displayName;const xse={contacts:"from-primary to-primary/80",accounts:"from-[#8b5cf6] to-[#8b5cf6]/80",opportunities:"from-accent to-accent/80","use cases":"from-success to-success/80",activities:"from-warning to-warning/80",assignments:"from-destructive to-destructive/80",workflows:"from-amber-500 to-amber-500/80",context:"from-[#0ea5e9] to-[#0ea5e9]/80",emails:"from-[#3b82f6] to-[#3b82f6]/80"};function Ks({searchValue:e,onSearchChange:t,searchPlaceholder:n="Search...",filters:r,activeFilters:o,onFilterChange:a,onClearFilters:l,sortOptions:u,currentSort:d,onSortChange:f,onAdd:m,addLabel:p,entityType:g}){var N;const y=xse[g]??"from-primary to-primary/80",b=x.useRef(null),w=Object.values(o).reduce((k,j)=>k+j.length,0);return x.useEffect(()=>{const k=j=>{var E;const C=j.target,S=C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable;j.key==="/"&&!S&&(j.preventDefault(),(E=b.current)==null||E.focus())};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]),s.jsxs("div",{className:"flex flex-col gap-2 px-4 md:px-6 py-2 md:py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1 min-w-0 max-w-sm",children:[s.jsx(Oi,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx("input",{ref:b,value:e,onChange:k=>t(k.target.value),placeholder:n,className:"w-full h-9 pl-9 pr-8 rounded-xl border border-border bg-card text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30 transition-all"}),e&&s.jsx("button",{onClick:()=>t(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1",children:s.jsx(Ht,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-foreground"})}),!e&&s.jsx("kbd",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 hidden md:inline-flex items-center px-1.5 py-0.5 rounded-md text-[10px] font-mono text-muted-foreground/50 bg-muted border border-border",children:"/"})]}),s.jsxs(Om,{children:[s.jsx(Im,{asChild:!0,children:s.jsxs("button",{className:"h-9 px-3 flex items-center gap-1.5 rounded-xl border border-border bg-card text-sm text-muted-foreground hover:text-foreground hover:border-primary/30 transition-all flex-shrink-0 press-scale",children:[s.jsx(HL,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:"Filter"}),w>0&&s.jsx("span",{className:"ml-0.5 px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground text-[10px] font-semibold",children:w})]})}),s.jsxs(rd,{className:"w-72 p-0 rounded-xl",align:"start",children:[s.jsxs("div",{className:"p-3 border-b border-border flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-display font-bold text-foreground",children:"Filters"}),w>0&&s.jsx("button",{onClick:l,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear all"})]}),s.jsx("div",{className:"p-2 max-h-80 overflow-y-auto space-y-1",children:r.map(k=>s.jsx(yse,{filter:k,selected:o[k.key]||[],onChange:j=>a(k.key,j)},k.key))})]})]}),s.jsxs(Om,{children:[s.jsx(Im,{asChild:!0,children:s.jsxs("button",{className:"h-9 px-3 flex items-center gap-1.5 rounded-xl border border-border bg-card text-sm text-muted-foreground hover:text-foreground hover:border-primary/30 transition-all flex-shrink-0 press-scale",children:[s.jsx(zL,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:d&&((N=u.find(k=>k.key===d.key))==null?void 0:N.label)||"Sort"}),d&&s.jsx("span",{className:"text-[10px] font-mono",children:d.dir==="asc"?"↑":"↓"})]})}),s.jsx(rd,{className:"w-48 p-1 rounded-xl",align:"start",children:u.map(k=>s.jsxs("button",{onClick:()=>f(k.key),className:`w-full text-left px-3 py-2.5 text-sm rounded-lg transition-colors ${(d==null?void 0:d.key)===k.key?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:[k.label,(d==null?void 0:d.key)===k.key&&s.jsx("span",{className:"ml-auto float-right text-[10px] font-mono",children:d.dir==="asc"?"↑":"↓"})]},k.key))})]}),s.jsxs("button",{onClick:m,className:`h-9 px-4 flex items-center gap-1.5 rounded-xl bg-gradient-to-r ${y} text-primary-foreground text-sm font-semibold hover:shadow-md transition-all flex-shrink-0 press-scale`,children:[s.jsx(or,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:p})]})]}),w>0&&s.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:Object.entries(o).map(([k,j])=>j.map(C=>{var P;const S=r.find(D=>D.key===k),E=((P=S==null?void 0:S.options.find(D=>D.value===C))==null?void 0:P.label)||C;return s.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-muted text-xs text-foreground",children:[s.jsxs("span",{className:"text-muted-foreground",children:[S==null?void 0:S.label,":"]})," ",E,s.jsx("button",{onClick:()=>a(k,j.filter(D=>D!==C)),className:"ml-0.5 hover:text-destructive p-0.5",children:s.jsx(Ht,{className:"w-3 h-3"})})]},`${k}-${C}`)}))})]})}function yse({filter:e,selected:t,onChange:n}){const[r,o]=x.useState(!0);return s.jsxs("div",{className:"rounded-lg",children:[s.jsxs("button",{onClick:()=>o(!r),className:"w-full flex items-center justify-between px-2 py-2 text-xs font-display font-semibold text-muted-foreground hover:text-foreground",children:[e.label,t.length>0&&s.jsx("span",{className:"text-primary font-sans",children:t.length}),s.jsx(Wn,{className:`w-3 h-3 transition-transform ${r?"":"-rotate-90"}`})]}),r&&s.jsx("div",{className:"space-y-0.5 pl-1 pb-1",children:e.options.map(a=>{const l=t.includes(a.value);return s.jsxs("label",{className:"flex items-center gap-2 px-2 py-2 text-sm text-foreground hover:bg-muted/50 rounded-lg cursor-pointer min-h-[40px]",children:[s.jsx(b4,{checked:l,onCheckedChange:()=>{n(l?t.filter(u=>u!==a.value):[...t,a.value])},className:"w-4 h-4"}),a.label]},a.value)})})]})}const a1=x.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:Ie("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));a1.displayName="Textarea";const i1=F3,vse=$3,w4=x.forwardRef(({className:e,...t},n)=>s.jsx(mw,{ref:n,className:Ie("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));w4.displayName=mw.displayName;const Jp=x.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(vse,{children:[s.jsx(w4,{}),s.jsxs(pw,{ref:r,className:Ie("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,s.jsxs(xH,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Ht,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jp.displayName=pw.displayName;const eg=({className:e,...t})=>s.jsx("div",{className:Ie("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});eg.displayName="DialogHeader";const tg=({className:e,...t})=>s.jsx("div",{className:Ie("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});tg.displayName="DialogFooter";const ng=x.forwardRef(({className:e,...t},n)=>s.jsx(V3,{ref:n,className:Ie("text-lg font-semibold leading-none tracking-tight",e),...t}));ng.displayName=V3.displayName;const N4=x.forwardRef(({className:e,...t},n)=>s.jsx(z3,{ref:n,className:Ie("text-sm text-muted-foreground",e),...t}));N4.displayName=z3.displayName;const bse=["contact","account","opportunity","use_case"];function wse({value:e}){if(e==null)return null;const t=Math.round(e*100),n=t>=80?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":t>=50?"bg-warning/15 text-warning":"bg-destructive/15 text-destructive";return s.jsxs("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold ${n}`,children:[t,"%"]})}function Nse({value:e}){if(e==null)return null;const t=Math.round(e*100),n=t>=80?"Strong match":t>=50?"Partial match":"Weak match",r=t>=80?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":t>=50?"bg-warning/15 text-warning":"bg-muted text-muted-foreground";return s.jsxs("span",{title:`${t}% similarity`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold ${r}`,children:[s.jsx(an,{className:"w-2.5 h-2.5"}),n]})}function jse({date:e}){if(!e)return null;const t=Ld(new Date(e));return s.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-medium ${t?"text-destructive":"text-muted-foreground"}`,children:[t&&s.jsx(Bs,{className:"w-3 h-3"}),t?"Expired ":"Valid until ",Id(new Date(e),{addSuffix:!0})]})}function z0(e){return e==="use_case"?"Use Case":e.charAt(0).toUpperCase()+e.slice(1)}function Cse({subjectType:e,selectedId:t,selectedLabel:n,onSelect:r}){const[o,a]=x.useState(""),[l,u]=x.useState(!1),{data:d}=Jb({q:o||void 0,limit:8}),{data:f}=vp({q:o||void 0,limit:8}),{data:m}=bp({q:o||void 0,limit:8}),{data:p}=ew({q:o||void 0,limit:8}),g=x.useMemo(()=>e==="contact"?((d==null?void 0:d.data)??[]).map(b=>({id:b.id,name:[b.first_name,b.last_name].filter(Boolean).join(" ")||b.email||"(unknown)",sub:b.email})):e==="account"?((f==null?void 0:f.data)??[]).map(b=>({id:b.id,name:b.name,sub:b.website})):e==="opportunity"?((m==null?void 0:m.data)??[]).map(b=>({id:b.id,name:b.name,sub:b.stage})):e==="use_case"?((p==null?void 0:p.data)??[]).map(b=>({id:b.id,name:b.name||b.title,sub:b.stage})):[],[e,d,f,m,p]),y="w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";return t?s.jsxs("div",{className:"flex items-center gap-2 h-9 px-3 rounded-lg border border-border bg-background text-sm flex-1",children:[s.jsx("span",{className:"flex-1 text-foreground truncate",children:n}),s.jsx("button",{type:"button",onClick:()=>{r("",""),a("")},className:"text-muted-foreground hover:text-foreground transition-colors flex-shrink-0","aria-label":"Clear selection",children:s.jsx(Ht,{className:"w-3.5 h-3.5"})})]}):s.jsxs("div",{className:"relative flex-1",children:[s.jsx("input",{value:o,onChange:b=>{a(b.target.value),u(!0)},onFocus:()=>u(!0),onBlur:()=>setTimeout(()=>u(!1),150),placeholder:`Search ${z0(e)}…`,className:y}),l&&g.length>0&&s.jsx("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-card border border-border rounded-lg shadow-lg overflow-hidden max-h-48 overflow-y-auto",children:g.map(b=>s.jsxs("button",{type:"button",onMouseDown:()=>{r(b.id,b.name),u(!1)},className:"w-full text-left px-3 py-2 hover:bg-muted transition-colors",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:b.name}),b.sub&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.sub})]},b.id))})]})}const kse=[{key:"created_at",label:"Date Created"},{key:"confidence_score",label:"Confidence"},{key:"valid_until",label:"Valid Until"}];function j4(){var Xe,Le,st,Nt;const[e,t]=M_(),[n,r]=x.useState(()=>{const ge={},De=e.get("subject_type");return De&&(ge.subject_type=[De]),e.get("stale")==="true"&&(ge.validity=["stale"]),ge}),[o,a]=x.useState(""),[l,u]=x.useState(null),[d,f]=x.useState("keyword"),[m,p]=x.useState(!1),[g,y]=x.useState(""),[b,w]=x.useState([{type:"",id:"",label:""}]),[N,k]=x.useState(""),[j,C]=x.useState(!1),S=a3(),E=A7(),{data:P}=l3(),D=x.useMemo(()=>((P==null?void 0:P.data)??[]).map(De=>De.type_name),[P]),I=["transcript","objection","summary","research","note","action_plan","competitor_intel","stakeholder_map"],z=D.length>0?D:I,K=((Xe=n.subject_type)==null?void 0:Xe[0])??"",q=((Le=n.context_type)==null?void 0:Le[0])??"",H=((st=n.validity)==null?void 0:st.includes("stale"))??!1,B=x.useMemo(()=>[{key:"subject_type",label:"Subject",options:[{value:"contact",label:"Contact"},{value:"account",label:"Account"},{value:"opportunity",label:"Opportunity"},{value:"use_case",label:"Use Case"}]},{key:"context_type",label:"Context type",options:z.map(ge=>({value:ge,label:ge.replace(/_/g," ")}))},{key:"validity",label:"Validity",options:[{value:"stale",label:"Stale / Expired"}]}],[z]),R=ge=>{const De=e.get("tab");t(De?{tab:De,...ge}:ge)},M=(ge,De)=>{r($e=>{const et={...$e};return De.length===0?delete et[ge]:et[ge]=De,et}),R({})},F=ge=>{u(De=>(De==null?void 0:De.key)===ge?{key:ge,dir:De.dir==="asc"?"desc":"asc"}:{key:ge,dir:"asc"})},L=()=>{r({}),a(""),R({})},A=x.useMemo(()=>({subject_type:K||void 0,context_type:q||void 0,is_current:H?!1:void 0,limit:20}),[K,q,H]),{data:O,isLoading:U,isFetchingNextPage:V,hasNextPage:$,fetchNextPage:Y}=y7(A),X=x.useMemo(()=>(O==null?void 0:O.pages.flatMap(ge=>ge.data??[]))??[],[O]),ne=((Nt=O==null?void 0:O.pages[0])==null?void 0:Nt.total)??0,ie=x.useMemo(()=>({subject_type:K||void 0,context_type:q||void 0,current_only:H?!1:void 0,limit:50}),[K,q,H]),{data:J,isLoading:re,isError:ce}=M7(d==="semantic"?o:"",ie),fe=(J==null?void 0:J.entries)??(J==null?void 0:J.data)??[],pe=x.useMemo(()=>{let ge=d==="semantic"?fe:X;if(d==="keyword"&&o.trim()){const De=o.toLowerCase();ge=ge.filter($e=>($e.title??"").toLowerCase().includes(De)||($e.body??"").toLowerCase().includes(De)||($e.tags??[]).some(et=>et.toLowerCase().includes(De)))}return l&&(ge=[...ge].sort((De,$e)=>{const et=String(De[l.key]??""),tt=String($e[l.key]??"");return l.dir==="asc"?et.localeCompare(tt):tt.localeCompare(et)})),ge},[X,fe,o,d,l]),ye=d==="keyword"?U:re,Ne=Object.keys(n).length>0||o,Oe=x.useCallback(async()=>{const ge=b.filter(De=>De.type&&De.id);if(!g.trim()||ge.length===0){de({title:"Missing fields",description:"Paste a document and select at least one subject.",variant:"destructive"});return}C(!0);try{const $e=(await Promise.all(ge.map(et=>E.mutateAsync({text:g,subject_type:et.type,subject_id:et.id,source:N||void 0})))).reduce((et,tt)=>et+((tt==null?void 0:tt.extracted_count)??0),0);$e>0?de({title:"Ingestion complete",description:`${$e} context ${$e===1?"entry":"entries"} extracted across ${ge.length===1?"1 subject":`${ge.length} subjects`}.`}):de({title:"Document saved",description:"No entries were extracted — the Workspace Agent may not be configured, or no extractable context types are defined.",variant:"destructive"}),p(!1),y(""),w([{type:"",id:"",label:""}]),k("")}catch(De){de({title:"Ingestion failed",description:De instanceof Error?De.message:"Try again.",variant:"destructive"})}finally{C(!1)}},[g,b,N,E]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"px-4 md:px-6 pt-3 pb-0 flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-0.5 bg-muted rounded-xl p-0.5",children:[s.jsxs("button",{onClick:()=>f("keyword"),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all ${d==="keyword"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[s.jsx(Oi,{className:"w-3 h-3"}),"Keyword"]}),s.jsxs("button",{onClick:()=>f("semantic"),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all ${d==="semantic"?"bg-violet-600 text-white shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[s.jsx(an,{className:"w-3 h-3"}),"Semantic"]})]}),ne>0&&d==="keyword"&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[ne.toLocaleString()," total"]})]}),s.jsx(Ks,{searchValue:o,onSearchChange:a,searchPlaceholder:d==="semantic"?"Ask a question about your context…":"Search title, body, tags…",filters:B,activeFilters:n,onFilterChange:M,onClearFilters:L,sortOptions:kse,currentSort:l,onSortChange:F,onAdd:()=>p(!0),addLabel:"Import",entityType:"context"}),s.jsx(We.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:`mx-4 md:mx-6 mt-2 mb-1 px-3 py-1.5 rounded-lg text-xs font-medium flex items-center gap-2 border ${d==="semantic"?"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20":"bg-muted text-muted-foreground border-border"}`,children:d==="semantic"?s.jsxs(s.Fragment,{children:[s.jsx(an,{className:"w-3.5 h-3.5 flex-shrink-0"})," Semantic search — AI-ranked by meaning, not keywords"]}):s.jsxs(s.Fragment,{children:[s.jsx(Oi,{className:"w-3.5 h-3.5 flex-shrink-0"})," Keyword search — matching titles, bodies, and tags"]})},d),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 pb-24 md:pb-6",children:[d==="semantic"&&ce&&s.jsxs(We.div,{initial:{opacity:0},animate:{opacity:1},className:"mb-4 px-3 py-2 bg-warning/10 border border-warning/30 rounded-lg text-xs text-warning flex items-center gap-2",children:[s.jsx(Bs,{className:"w-4 h-4 flex-shrink-0"}),s.jsxs("span",{children:["Semantic search requires pgvector. Set"," ",s.jsx("code",{className:"px-1 py-0.5 bg-warning/20 rounded",children:"ENABLE_PGVECTOR=true"})," ","and configure an embedding provider. Falling back to keyword search."]})]}),ye?s.jsxs("div",{className:"text-sm text-muted-foreground py-8 text-center flex items-center justify-center gap-2",children:[s.jsx(gr,{className:"w-4 h-4 animate-spin"}),d==="semantic"?"Searching semantically…":"Loading…"]}):pe.length===0?s.jsxs(We.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx(Lu,{className:"w-14 h-14 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-base font-display font-semibold text-foreground mb-1",children:Ne?"No entries match your filters":"No context entries yet"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:Ne?d==="semantic"?"Try rephrasing your question or adjusting filters.":"Try adjusting your search or filters.":"Agents write context entries after every interaction. They power the briefings returned by briefing_get."}),Ne&&s.jsx(Jt,{variant:"outline",size:"sm",className:"mt-4",onClick:L,children:"Clear filters"})]}):s.jsxs("div",{className:"space-y-2 pt-2",children:[pe.map((ge,De)=>{var et;const $e=ge.valid_until?Ld(new Date(ge.valid_until)):!1;return s.jsx(We.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:De*.02},className:`bg-card border rounded-xl p-4 transition-colors ${$e?"border-destructive/30":d==="semantic"?"border-border border-l-2 border-l-violet-500/50":"border-border"}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[ge.title&&s.jsx("span",{className:"text-sm font-semibold text-foreground truncate max-w-xs",children:ge.title}),ge.context_type&&s.jsx(mo,{variant:"outline",className:"text-[10px] capitalize",children:ge.context_type.replace(/_/g," ")}),ge.subject_type&&s.jsx(mo,{variant:"secondary",className:"text-[10px]",children:z0(ge.subject_type)}),ge.is_current===!1&&s.jsx(mo,{variant:"outline",className:"text-[10px] text-muted-foreground border-muted",children:"superseded"}),s.jsx(wse,{value:ge.confidence_score}),d==="semantic"&&s.jsx(Nse,{value:ge.similarity})]}),ge.body&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:ge.body}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[((et=ge.tags)==null?void 0:et.length)>0&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[s.jsx(b5,{className:"w-3 h-3"}),ge.tags.slice(0,4).join(", "),ge.tags.length>4&&` +${ge.tags.length-4}`]}),s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[s.jsx(zs,{className:"w-3 h-3"}),Id(new Date(ge.created_at),{addSuffix:!0})]}),s.jsx(jse,{date:ge.valid_until})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5 flex-shrink-0",children:[$e&&s.jsx(Jt,{variant:"outline",size:"sm",className:"h-6 text-[10px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>S.mutate(ge.id),disabled:S.isPending,children:"Mark reviewed"}),!$e&&ge.is_current&&s.jsx(Gt,{className:"w-4 h-4 text-emerald-500 mt-0.5"})]})]})},ge.id)}),d==="keyword"&&$&&s.jsx("div",{className:"flex justify-center pt-4 pb-2",children:s.jsxs(Jt,{variant:"outline",size:"sm",onClick:()=>Y(),disabled:V,className:"gap-2",children:[V&&s.jsx(gr,{className:"w-3.5 h-3.5 animate-spin"}),V?"Loading…":`Load more (${ne-X.length} remaining)`]})})]})]}),s.jsx(i1,{open:m,onOpenChange:p,children:s.jsxs(Jp,{className:"sm:max-w-lg",children:[s.jsxs(eg,{children:[s.jsxs(ng,{className:"flex items-center gap-2",children:[s.jsx(ls,{className:"w-5 h-5 text-[#0ea5e9]"}),"Import context"]}),s.jsx(N4,{children:"Paste a document (meeting transcript, research notes, etc.) and CRMy will auto-extract structured context entries."})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(a1,{placeholder:"Paste document text here…",value:g,onChange:ge=>y(ge.target.value),className:"min-h-[160px] text-sm"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Subjects ",s.jsx("span",{className:"font-normal",children:"(context will be extracted once per subject)"})]}),b.map((ge,De)=>s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs(pd,{value:ge.type,onValueChange:$e=>w(et=>et.map((tt,ht)=>ht===De?{type:$e,id:"",label:""}:tt)),children:[s.jsx(gc,{className:"h-9 w-36 flex-shrink-0 text-sm",children:s.jsx(gd,{placeholder:"Type"})}),s.jsx(xc,{children:bse.map($e=>s.jsx(Ti,{value:$e,children:z0($e)},$e))})]}),ge.type?s.jsx(Cse,{subjectType:ge.type,selectedId:ge.id,selectedLabel:ge.label,onSelect:($e,et)=>w(tt=>tt.map((ht,te)=>te===De?{...ht,id:$e,label:et}:ht))}):s.jsx("div",{className:"flex-1 h-9 px-3 rounded-lg border border-border bg-muted/40 text-sm text-muted-foreground flex items-center",children:"Select a type first"}),b.length>1&&s.jsx("button",{type:"button",onClick:()=>w($e=>$e.filter((et,tt)=>tt!==De)),className:"flex-shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remove subject",children:s.jsx(Ht,{className:"w-4 h-4"})})]},De)),b.length<5&&s.jsxs("button",{type:"button",onClick:()=>w(ge=>[...ge,{type:"",id:"",label:""}]),className:"flex items-center gap-1.5 text-xs text-primary hover:underline",children:[s.jsx(or,{className:"w-3.5 h-3.5"}),"Add subject"]})]}),s.jsx(fo,{placeholder:"Source label (optional, e.g. 'Q1 review call')",value:N,onChange:ge=>k(ge.target.value),className:"h-9 text-sm"})]}),s.jsxs(tg,{children:[s.jsx(Jt,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),s.jsxs(Jt,{onClick:Oe,disabled:j,className:"gap-1.5",children:[j&&s.jsx(gr,{className:"w-3.5 h-3.5 animate-spin"}),"Extract & Import"]})]})]})})]})}function Dn({title:e,icon:t,iconClassName:n,description:r,badge:o,children:a}){const{setCommandPaletteOpen:l}=lt(),{theme:u,toggle:d}=a4(),f=Cn(),m=()=>{KP(),f("/login")};return s.jsxs("header",{className:"sticky top-0 z-30 flex items-center justify-between h-16 px-4 md:px-6 border-b border-border bg-background/80 backdrop-blur-md gap-2",children:[s.jsxs("div",{className:"hidden md:flex flex-col justify-center min-w-0 shrink",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx(t,{className:`w-4.5 h-4.5 flex-shrink-0 ${n??"text-foreground"}`}),s.jsx("h1",{className:"font-display font-bold text-lg text-foreground truncate",children:e}),o]}),r&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:r})]}),s.jsxs("div",{className:"flex items-center gap-1.5 md:ml-auto w-full md:w-auto",children:[a,s.jsx("button",{onClick:d,className:"p-2 rounded-xl text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:u==="dark"?"Switch to light mode":"Switch to dark mode",children:u==="dark"?s.jsx(v5,{className:"w-4 h-4"}):s.jsx(g5,{className:"w-4 h-4"})}),s.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 flex-1 md:flex-none px-3 py-1.5 rounded-xl bg-muted text-muted-foreground text-sm hover:bg-muted/80 transition-colors min-h-[36px] md:min-h-0",children:[s.jsx(Oi,{className:"w-4 h-4 md:w-3.5 md:h-3.5 flex-shrink-0"}),s.jsx("span",{className:"text-left flex-1 md:flex-none",children:"Search..."}),s.jsxs("kbd",{className:"hidden md:inline-flex items-center gap-0.5 text-xs font-mono bg-background px-1.5 py-0.5 rounded-md border border-border",children:[s.jsx(l5,{className:"w-3 h-3"}),"K"]})]}),s.jsx("button",{onClick:m,className:"p-2 rounded-xl text-muted-foreground hover:text-destructive hover:bg-muted transition-colors",title:"Sign out",children:s.jsx(GL,{className:"w-4 h-4"})})]})]})}function Sse(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function sv({icon:e,label:t,value:n,sub:r,color:o,href:a,delay:l}){return s.jsx(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:l},children:s.jsxs(hr,{to:a,className:"flex items-start gap-3 p-4 rounded-2xl bg-card border border-border shadow-sm hover:shadow-md hover:border-border/80 transition-all press-scale group",children:[s.jsx("div",{className:`w-9 h-9 rounded-xl ${o} flex items-center justify-center flex-shrink-0 mt-0.5`,children:s.jsx(e,{className:"w-4 h-4"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:t}),s.jsx("p",{className:"text-2xl font-display font-bold text-foreground leading-tight",children:n}),r&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:r})]}),s.jsx(Il,{className:"w-4 h-4 text-muted-foreground/40 group-hover:text-muted-foreground ml-auto mt-1 transition-colors"})]})})}function _se(){var S;const e=Cn(),[t,n]=M_(),r=t.get("tab")??"overview",[o,a]=x.useState("today"),[l,u]=x.useState({}),{data:d}=nw(),f=JP(),{data:m}=Tm({limit:1}),{data:p}=Tm({is_current:!1,limit:200}),{data:g}=Rd({limit:200}),b=((d==null?void 0:d.data)??[]).filter(E=>E.status==="pending"),w=(m==null?void 0:m.total)??0,N=((S=p==null?void 0:p.data)==null?void 0:S.length)??0,k=(g==null?void 0:g.data)??[],j=k.filter(E=>E.is_active),C=k.filter(E=>E.actor_type==="agent");return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Workspace",icon:ki,iconClassName:"text-primary",description:"Agent memory — context entries, handoffs, and active agents at a glance.",children:s.jsxs("div",{className:"hidden md:flex items-center gap-0.5 bg-muted rounded-xl p-0.5",children:[s.jsxs("button",{onClick:()=>n({}),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all ${r==="overview"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[s.jsx(ki,{className:"w-3 h-3"})," Overview"]}),s.jsxs("button",{onClick:()=>n({tab:"knowledge"}),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all ${r==="knowledge"?"bg-[#0ea5e9]/15 text-[#0ea5e9] shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[s.jsx(Lu,{className:"w-3 h-3"})," Knowledge"]})]})}),s.jsxs("div",{className:"md:hidden flex items-center gap-0.5 bg-muted rounded-xl p-0.5 mx-4 mt-3 mb-1",children:[s.jsxs("button",{onClick:()=>n({}),className:`flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-lg text-xs font-medium transition-all ${r==="overview"?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:[s.jsx(ki,{className:"w-3 h-3"})," Overview"]}),s.jsxs("button",{onClick:()=>n({tab:"knowledge"}),className:`flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-lg text-xs font-medium transition-all ${r==="knowledge"?"bg-[#0ea5e9]/15 text-[#0ea5e9] shadow-sm":"text-muted-foreground"}`,children:[s.jsx(Lu,{className:"w-3 h-3"})," Knowledge"]})]}),r==="knowledge"?s.jsx(j4,{}):s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6 pb-24 md:pb-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-6 mb-4 md:mb-6",children:[s.jsx(sv,{icon:Ed,label:"Open handoffs",value:"—",sub:"view assignments",color:"bg-amber-500/15 text-amber-500",href:"/handoffs",delay:.04}),s.jsx(sv,{icon:m5,label:"Context entries",value:w,sub:N>0?`${N} stale`:"all current",color:"bg-[#0ea5e9]/15 text-[#0ea5e9]",href:"/?tab=knowledge",delay:.07}),s.jsx(sv,{icon:op,label:"Active actors",value:j.length,sub:k.length>0?`of ${k.length} registered`:"none registered",color:"bg-[#6366f1]/15 text-[#6366f1]",href:"/actors",delay:.1})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 md:gap-6",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-4 md:space-y-5",children:[s.jsx(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.1},children:s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("h2",{className:"font-display font-bold text-foreground flex items-center gap-2",children:[s.jsx(sF,{className:"w-4 h-4 text-destructive"}),"Pending handoffs"]}),b.length>0&&s.jsxs(hr,{to:"/handoffs",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all ",s.jsx(Il,{className:"w-3 h-3"})]})]}),b.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(Gt,{className:"w-10 h-10 text-emerald-500 mb-2"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"No pending approvals"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Your agents are running autonomously"})]}):s.jsxs("div",{className:"space-y-3",children:[b.slice(0,3).map(E=>s.jsxs("div",{className:"rounded-xl border border-border bg-surface p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(mo,{variant:"outline",className:"text-[11px]",children:E.action_type}),s.jsx("span",{className:"text-xs text-muted-foreground",children:E.agent_id??E.created_by??"agent"}),s.jsxs("span",{className:"text-xs text-muted-foreground ml-auto flex items-center gap-1",children:[s.jsx(zs,{className:"w-3 h-3"}),Sse(E.created_at)]})]}),s.jsx("p",{className:"text-sm text-foreground line-clamp-2",children:E.action_summary}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(fo,{placeholder:"Note (optional)",value:l[E.id]??"",onChange:P=>u({...l,[E.id]:P.target.value}),className:"flex-1 h-7 text-xs"}),s.jsx(Jt,{variant:"destructive",size:"sm",className:"h-7 text-xs",onClick:()=>f.mutate({id:E.id,status:"rejected",note:l[E.id]}),disabled:f.isPending,children:"Reject"}),s.jsx(Jt,{size:"sm",className:"h-7 text-xs",onClick:()=>f.mutate({id:E.id,status:"approved",note:l[E.id]}),disabled:f.isPending,children:"Approve"})]})]},E.id)),b.length>3&&s.jsxs("button",{onClick:()=>e("/handoffs"),className:"w-full text-xs text-primary hover:underline py-1",children:["+",b.length-3," more — view all handoffs"]})]})]})}),s.jsx(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.15},children:s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"font-display font-bold text-foreground",children:"Agent activity"}),s.jsxs("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:[s.jsx("button",{onClick:()=>a("today"),className:`px-2.5 py-1 rounded-md text-[11px] font-semibold transition-all ${o==="today"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Today"}),s.jsx("button",{onClick:()=>a("week"),className:`px-2.5 py-1 rounded-md text-[11px] font-semibold transition-all ${o==="week"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"This Week"})]})]}),s.jsx(MT,{limit:8,filterWindow:o})]})})]}),s.jsxs("div",{className:"space-y-4 md:space-y-5",children:[s.jsx(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.08},children:s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("h3",{className:"font-display font-bold text-foreground flex items-center gap-2",children:[s.jsx(zn,{className:"w-4 h-4 text-[#6366f1]"}),"Agents"]}),s.jsxs(hr,{to:"/actors",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Manage ",s.jsx(Il,{className:"w-3 h-3"})]})]}),C.length===0?s.jsxs("div",{className:"text-center py-6",children:[s.jsx(zn,{className:"w-8 h-8 text-muted-foreground/40 mx-auto mb-2"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents registered yet."}),s.jsx(hr,{to:"/actors",className:"text-xs text-primary hover:underline mt-1 inline-block",children:"Register your first agent"})]}):s.jsxs("div",{className:"space-y-2",children:[C.slice(0,5).map(E=>s.jsxs("div",{className:"flex items-center gap-2.5 py-1.5",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#6366f1]/15 flex items-center justify-center flex-shrink-0",children:s.jsx(zn,{className:"w-3.5 h-3.5 text-[#6366f1]"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-semibold text-foreground truncate",children:E.display_name}),E.agent_model&&s.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:E.agent_model})]}),s.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${E.is_active?"bg-emerald-500":"bg-muted-foreground/30"}`})]},E.id)),C.length>5&&s.jsxs(hr,{to:"/actors",className:"text-xs text-muted-foreground hover:text-primary block text-center pt-1",children:["+",C.length-5," more"]})]})]})}),s.jsx(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.11},children:s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("h3",{className:"font-display font-bold text-foreground flex items-center gap-2",children:[s.jsx(Lu,{className:"w-4 h-4 text-[#0ea5e9]"}),"Context health"]}),s.jsxs(hr,{to:"/?tab=knowledge",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Browse ",s.jsx(Il,{className:"w-3 h-3"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Total entries"}),s.jsx("span",{className:"text-sm font-bold text-foreground",children:w})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[N>0&&s.jsx(mm,{className:"w-3 h-3 text-destructive"}),"Stale / expired"]}),s.jsx("span",{className:`text-sm font-bold ${N>0?"text-destructive":"text-foreground"}`,children:N})]}),N>0&&s.jsxs(hr,{to:"/?tab=knowledge&stale=true",className:"flex items-center gap-1 text-xs text-destructive hover:underline",children:[s.jsx(mm,{className:"w-3 h-3"}),"Review stale entries"]}),w===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:"Agents write context entries after each interaction."})]})]})})]})]})]})]})}const Ese=[25,50,100];function Pse(e,t){if(t<=7)return Array.from({length:t},(r,o)=>o+1);const n=[1];e>3&&n.push("...");for(let r=Math.max(2,e-1);r<=Math.min(t-1,e+1);r++)n.push(r);return e<t-2&&n.push("..."),n.push(t),n}function hs({page:e,pageSize:t,total:n,onPageChange:r,onPageSizeChange:o,className:a}){if(n<=t)return null;const l=Math.ceil(n/t),u=(e-1)*t+1,d=Math.min(e*t,n),f=Pse(e,l);return s.jsxs("div",{className:Ie("flex flex-wrap items-center justify-between gap-3 pt-3 pb-1",a),children:[s.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["Showing ",u,"–",d," of ",n]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx("button",{onClick:()=>r(e-1),disabled:e===1,className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Previous page",children:s.jsx(Aa,{className:"w-4 h-4"})}),f.map((m,p)=>m==="..."?s.jsx("span",{className:"w-8 text-center text-xs text-muted-foreground select-none",children:"…"},`ellipsis-${p}`):s.jsx("button",{onClick:()=>r(m),className:Ie("w-8 h-8 rounded-lg text-xs font-semibold transition-colors",e===m?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:m},m)),s.jsx("button",{onClick:()=>r(e+1),disabled:e===l,className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Next page",children:s.jsx($s,{className:"w-4 h-4"})})]}),o&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Per page:"}),s.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:Ese.map(m=>s.jsx("button",{onClick:()=>{o(m),r(1)},className:Ie("px-2 py-1 rounded-md text-xs font-medium transition-colors",t===m?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:m},m))})]})]})}const Tse=[{key:"lifecycle_stage",label:"Stage",options:Object.entries(sd).map(([e,t])=>({value:e,label:t.label}))}],Mse=[{key:"name",label:"Name"},{key:"company",label:"Company"},{key:"created_at",label:"Created"},{key:"lifecycle_stage",label:"Stage"}];function Sl(e){const t=[e.first_name,e.last_name].filter(Boolean);return t.length>0?t.join(" "):e.email||e.company_name||"Unknown"}function Ase(){const e=Cn(),t=_p(),[n,r]=x.useState("table"),o=t?"cards":n,{openDrawer:a,openQuickAdd:l,openAIWithContext:u,openDrawerBriefing:d}=lt(),{enabled:f}=kr(),[m,p]=x.useState(""),[g,y]=x.useState({}),[b,w]=x.useState(null),[N,k]=x.useState(1),[j,C]=x.useState(25),{data:S,isLoading:E}=Jb({q:m||void 0,limit:200}),P=(S==null?void 0:S.data)??[],D=(H,B)=>{y(R=>{const M={...R};return B.length===0?delete M[H]:M[H]=B,M})},I=H=>{w(B=>(B==null?void 0:B.key)===H?{key:H,dir:B.dir==="asc"?"desc":"asc"}:{key:H,dir:"asc"})},z=x.useMemo(()=>{var B;let H=[...P];return(B=g.lifecycle_stage)!=null&&B.length&&(H=H.filter(R=>g.lifecycle_stage.includes(R.lifecycle_stage))),b&&H.sort((R,M)=>{const F=R[b.key]??"",L=M[b.key]??"";return typeof F=="number"&&typeof L=="number"?b.dir==="asc"?F-L:L-F:b.dir==="asc"?String(F).localeCompare(String(L)):String(L).localeCompare(String(F))}),H},[P,g,b]);x.useEffect(()=>{k(1)},[m,g,b]);const K=z.slice((N-1)*j,N*j),q=({label:H,sortKey:B})=>s.jsx("th",{onClick:()=>I(B),className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors select-none",children:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[H,(b==null?void 0:b.key)===B?b.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}):null]})});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Contacts",icon:ja,iconClassName:"text-primary",description:"People and leads across your CRM.",children:s.jsxs("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[s.jsx("button",{onClick:()=>r("table"),className:`p-1.5 rounded-lg text-sm transition-all ${n==="table"?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(Da,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>r("cards"),className:`p-1.5 rounded-lg text-sm transition-all ${n==="cards"?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(jc,{className:"w-4 h-4"})})]})}),s.jsx(Ks,{searchValue:m,onSearchChange:p,searchPlaceholder:"Search contacts...",filters:Tse,activeFilters:g,onFilterChange:D,onClearFilters:()=>y({}),sortOptions:Mse,currentSort:b,onSortChange:I,onAdd:()=>l("contact"),addLabel:"New Contact",entityType:"contacts"}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 pb-24 md:pb-6",children:E?s.jsx("div",{className:"space-y-2 pt-2",children:[...Array(5)].map((H,B)=>s.jsx("div",{className:"h-14 bg-muted/50 rounded-xl animate-pulse"},B))}):z.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[s.jsx("p",{className:"text-sm",children:"No contacts found."}),s.jsx("button",{onClick:()=>{p(""),y({})},className:"mt-2 text-xs text-primary font-semibold hover:underline",children:"Clear all filters"})]}):o==="table"?s.jsxs("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx(q,{label:"Name",sortKey:"name"}),s.jsx(q,{label:"Company",sortKey:"company"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Phone"}),s.jsx(q,{label:"Stage",sortKey:"lifecycle_stage"}),s.jsx("th",{className:"px-2 py-3 w-16"})]})}),s.jsx("tbody",{children:K.map((H,B)=>s.jsxs("tr",{onClick:()=>a("contact",H.id),className:`border-b border-border last:border-0 hover:bg-primary/5 cursor-pointer group transition-colors ${B%2===1?"bg-surface-sunken/30":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(yo,{name:Sl(H),className:"w-8 h-8 text-xs"}),s.jsx("span",{className:"font-semibold text-foreground",children:Sl(H)})]})}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:H.company_name||"—"}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground text-xs",children:H.phone||"—"}),s.jsx("td",{className:"px-4 py-3",children:H.lifecycle_stage?s.jsx(od,{stage:H.lifecycle_stage}):"—"}),s.jsx("td",{className:"px-2 py-3",children:s.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-all",children:[s.jsx("button",{onClick:R=>{R.stopPropagation(),d("contact",H.id)},className:"p-1.5 rounded-lg hover:bg-primary/10 transition-colors",title:"View briefing",children:s.jsx(ls,{className:"w-3.5 h-3.5 text-primary"})}),f&&s.jsx("button",{onClick:R=>{R.stopPropagation(),u({type:"contact",id:H.id,name:Sl(H),detail:H.company_name}),e("/agent")},className:"p-1.5 rounded-lg hover:bg-accent/10 transition-colors",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})]})})]},H.id))})]})}),s.jsx("div",{className:"px-4",children:s.jsx(hs,{page:N,pageSize:j,total:z.length,onPageChange:k,onPageSizeChange:C})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:K.map((H,B)=>s.jsxs(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:B*.02},onClick:()=>a("contact",H.id),className:"bg-card border border-border rounded-2xl p-4 cursor-pointer hover:shadow-lg hover:border-primary/20 transition-all press-scale group relative",children:[s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-0.5 md:opacity-0 md:group-hover:opacity-100 transition-all",children:[s.jsx("button",{onClick:R=>{R.stopPropagation(),d("contact",H.id)},className:"p-1.5 rounded-lg hover:bg-primary/10 transition-colors",title:"View briefing",children:s.jsx(ls,{className:"w-3.5 h-3.5 text-primary"})}),f&&s.jsx("button",{onClick:R=>{R.stopPropagation(),u({type:"contact",id:H.id,name:Sl(H),detail:H.company_name}),e("/agent")},className:"p-1.5 rounded-lg hover:bg-accent/10 transition-colors",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})]}),s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx(yo,{name:Sl(H),className:"w-11 h-11 rounded-2xl text-sm"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-display font-bold text-foreground",children:Sl(H)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:H.company_name||"Individual"})]})]}),s.jsx("div",{className:"flex items-center gap-2 mb-2",children:H.lifecycle_stage&&s.jsx(od,{stage:H.lifecycle_stage})}),H.email&&s.jsx("p",{className:"text-xs text-muted-foreground",children:H.email})]},H.id))}),s.jsx(hs,{page:N,pageSize:j,total:z.length,onPageChange:k,onPageSizeChange:C})]})})]})}const Dse=[{value:"healthy",label:"Healthy (≥ 80)"},{value:"at-risk",label:"At risk (50 – 79)"},{value:"poor",label:"Poor (< 50)"}],Rse=[{value:"small",label:"Small (< 50)"},{value:"mid",label:"Mid-market (50–500)"},{value:"enterprise",label:"Enterprise (500+)"}],Ose=[{key:"name",label:"Name"},{key:"annual_revenue",label:"Revenue"},{key:"health_score",label:"Health"},{key:"employee_count",label:"Employees"}];function I2({score:e}){const t=e>=80?"bg-green-500/15 text-green-400":e>=50?"bg-yellow-500/15 text-yellow-400":"bg-red-500/15 text-red-400";return s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold ${t}`,children:[s.jsx(sp,{className:"w-3 h-3"}),e]})}function L2(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e}`}function Ise(){const e=_p(),[t,n]=x.useState("table"),r=e?"cards":t,{openDrawer:o,openQuickAdd:a,openAIWithContext:l,openDrawerBriefing:u}=lt(),{enabled:d}=kr(),f=Cn(),[m,p]=x.useState(""),[g,y]=x.useState({}),[b,w]=x.useState(null),[N,k]=x.useState(1),[j,C]=x.useState(25),{data:S,isLoading:E}=vp({q:m||void 0,limit:200}),P=(S==null?void 0:S.data)??[],D=x.useRef(new Set),z=[{key:"industry",label:"Industry",options:x.useMemo(()=>(P.forEach(M=>{M.industry&&D.current.add(M.industry)}),Array.from(D.current).sort().map(M=>({value:M,label:M}))),[P])},{key:"health",label:"Health",options:Dse},{key:"emp_size",label:"Employee size",options:Rse}],K=(M,F)=>{y(L=>{const A={...L};return F.length===0?delete A[M]:A[M]=F,A})},q=M=>{w(F=>(F==null?void 0:F.key)===M?{key:M,dir:F.dir==="asc"?"desc":"asc"}:{key:M,dir:"asc"})},H=x.useMemo(()=>{var F,L,A;let M=[...P];return(F=g.industry)!=null&&F.length&&(M=M.filter(O=>g.industry.includes(O.industry))),(L=g.health)!=null&&L.length&&(M=M.filter(O=>{const U=O.health_score;return U==null?!1:g.health.some(V=>V==="healthy"?U>=80:V==="at-risk"?U>=50&&U<80:U<50)})),(A=g.emp_size)!=null&&A.length&&(M=M.filter(O=>{const U=O.employee_count;return U==null?!1:g.emp_size.some(V=>V==="small"?U<50:V==="mid"?U>=50&&U<500:U>=500)})),b&&M.sort((O,U)=>{const V=O[b.key]??"",$=U[b.key]??"";return typeof V=="number"&&typeof $=="number"?b.dir==="asc"?V-$:$-V:b.dir==="asc"?String(V).localeCompare(String($)):String($).localeCompare(String(V))}),M},[P,g,b]);x.useEffect(()=>{k(1)},[m,g,b]);const B=H.slice((N-1)*j,N*j),R=({label:M,sortKey:F})=>s.jsx("th",{onClick:()=>q(F),className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors select-none",children:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[M,(b==null?void 0:b.key)===F?b.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}):null]})});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Accounts",icon:hm,iconClassName:"text-[#8b5cf6]",description:"Companies and organizations.",children:s.jsxs("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[s.jsx("button",{onClick:()=>n("table"),className:`p-1.5 rounded-lg text-sm transition-all ${t==="table"?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(Da,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>n("cards"),className:`p-1.5 rounded-lg text-sm transition-all ${t==="cards"?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(jc,{className:"w-4 h-4"})})]})}),s.jsx(Ks,{searchValue:m,onSearchChange:p,searchPlaceholder:"Search accounts...",filters:z,activeFilters:g,onFilterChange:K,onClearFilters:()=>y({}),sortOptions:Ose,currentSort:b,onSortChange:q,onAdd:()=>a("account"),addLabel:"New Account",entityType:"accounts"}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 pb-24 md:pb-6",children:E?s.jsx("div",{className:"space-y-2 pt-2",children:[...Array(5)].map((M,F)=>s.jsx("div",{className:"h-14 bg-muted/50 rounded-xl animate-pulse"},F))}):H.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[s.jsx("p",{className:"text-sm",children:"No accounts found."}),s.jsx("button",{onClick:()=>{p(""),y({})},className:"mt-2 text-xs text-primary font-semibold hover:underline",children:"Clear all filters"})]}):r==="table"?s.jsxs("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx(R,{label:"Name",sortKey:"name"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Industry"}),s.jsx(R,{label:"Revenue",sortKey:"annual_revenue"}),s.jsx(R,{label:"Employees",sortKey:"employee_count"}),s.jsx(R,{label:"Health",sortKey:"health_score"}),s.jsx("th",{className:"px-2 py-3 w-16"})]})}),s.jsx("tbody",{children:B.map((M,F)=>s.jsxs("tr",{onClick:()=>o("account",M.id),className:`border-b border-border last:border-0 hover:bg-primary/5 cursor-pointer group transition-colors ${F%2===1?"bg-surface-sunken/30":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(yo,{name:M.name,className:"w-8 h-8 text-xs"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-semibold text-foreground",children:M.name}),M.website&&s.jsx("p",{className:"text-xs text-muted-foreground",children:M.website})]})]})}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:M.industry||"—"}),s.jsx("td",{className:"px-4 py-3 text-foreground font-medium",children:M.annual_revenue?L2(M.annual_revenue):"—"}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:M.employee_count||"—"}),s.jsx("td",{className:"px-4 py-3",children:M.health_score?s.jsx(I2,{score:M.health_score}):"—"}),s.jsx("td",{className:"px-2 py-3",children:s.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-all",children:[s.jsx("button",{onClick:L=>{L.stopPropagation(),u("account",M.id)},className:"p-1.5 rounded-lg hover:bg-primary/10 transition-colors",title:"View briefing",children:s.jsx(ls,{className:"w-3.5 h-3.5 text-primary"})}),d&&s.jsx("button",{onClick:L=>{L.stopPropagation(),l({type:"account",id:M.id,name:M.name,detail:M.industry}),f("/agent")},className:"p-1.5 rounded-lg hover:bg-accent/10 transition-colors",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})]})})]},M.id))})]})}),s.jsx("div",{className:"px-4",children:s.jsx(hs,{page:N,pageSize:j,total:H.length,onPageChange:k,onPageSizeChange:C})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:B.map((M,F)=>s.jsxs(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:F*.02},onClick:()=>o("account",M.id),className:"bg-card border border-border rounded-2xl p-4 cursor-pointer hover:shadow-lg hover:border-primary/20 transition-all press-scale group relative",children:[s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-0.5 md:opacity-0 md:group-hover:opacity-100 transition-all",children:[s.jsx("button",{onClick:L=>{L.stopPropagation(),u("account",M.id)},className:"p-1.5 rounded-lg hover:bg-primary/10 transition-colors",title:"View briefing",children:s.jsx(ls,{className:"w-3.5 h-3.5 text-primary"})}),d&&s.jsx("button",{onClick:L=>{L.stopPropagation(),l({type:"account",id:M.id,name:M.name,detail:M.industry}),f("/agent")},className:"p-1.5 rounded-lg hover:bg-accent/10 transition-colors",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})]}),s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx(yo,{name:M.name,className:"w-11 h-11 rounded-2xl text-sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-display font-bold text-foreground truncate",children:M.name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:M.industry||"—"})]})]}),s.jsx("div",{className:"flex items-center gap-2 mb-3",children:M.health_score&&s.jsx(I2,{score:M.health_score})}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[M.annual_revenue&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(lb,{className:"w-3 h-3"}),L2(M.annual_revenue)]}),M.website&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(h5,{className:"w-3 h-3"}),M.website]})]})]},M.id))}),s.jsx(hs,{page:N,pageSize:j,total:H.length,onPageChange:k,onPageSizeChange:C})]})})]})}const om=["prospecting","qualification","proposal","negotiation","closed_won","closed_lost"],Lse=[{value:"all",label:"All"},{value:"today",label:"Today"},{value:"this_week",label:"This Week"},{value:"this_month",label:"This Month"},{value:"this_quarter",label:"This Quarter"},{value:"custom",label:"Custom"}];function Fse(e){if(e==="all")return null;const t=new Date;if(e==="today"){const n=new Date(t);n.setHours(0,0,0,0);const r=new Date(t);return r.setHours(23,59,59,999),{start:n,end:r}}if(e==="this_week"){const n=new Date(t),r=n.getDay();n.setDate(n.getDate()+(r===0?-6:1-r)),n.setHours(0,0,0,0);const o=new Date(n);return o.setDate(n.getDate()+6),o.setHours(23,59,59,999),{start:n,end:o}}if(e==="this_month"){const n=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59,999);return{start:n,end:r}}if(e==="this_quarter"){const n=Math.floor(t.getMonth()/3),r=new Date(t.getFullYear(),n*3,1),o=new Date(t.getFullYear(),n*3+3,0,23,59,59,999);return{start:r,end:o}}return null}const $se=[{key:"stage",label:"Stage",options:om.map(e=>{var t;return{value:e,label:((t=sd[e])==null?void 0:t.label)??e}})}],Vse=[{key:"name",label:"Opportunity Name"},{key:"amount",label:"Amount"},{key:"stage",label:"Stage"},{key:"probability",label:"Probability"},{key:"created_at",label:"Created"}];function zse(){const e=Cn(),[t,n]=x.useState("table"),{openDrawer:r,openQuickAdd:o,openAIWithContext:a}=lt(),{enabled:l}=kr(),[u,d]=x.useState(""),[f,m]=x.useState({}),[p,g]=x.useState(null),[y,b]=x.useState("this_quarter"),[w,N]=x.useState(1),[k,j]=x.useState(25),[C,S]=x.useState(""),[E,P]=x.useState(""),{data:D,isLoading:I}=bp({q:u||void 0,limit:200}),z=(D==null?void 0:D.data)??[],K=(M,F)=>{m(L=>{const A={...L};return F.length===0?delete A[M]:A[M]=F,A})},q=M=>{g(F=>(F==null?void 0:F.key)===M?{key:M,dir:F.dir==="asc"?"desc":"asc"}:{key:M,dir:"asc"})},H=x.useMemo(()=>{var F;let M=[...z];if((F=f.stage)!=null&&F.length&&(M=M.filter(L=>f.stage.includes(L.stage))),y!=="all"){let L,A;if(y==="custom")L=C?new Date(C+"T00:00:00"):new Date(0),A=E?new Date(E+"T23:59:59"):new Date(864e13);else{const O=Fse(y);O?(L=O.start,A=O.end):(L=new Date(0),A=new Date(864e13))}M=M.filter(O=>{if(!O.close_date)return!1;const U=new Date(O.close_date);return U>=L&&U<=A})}return p&&M.sort((L,A)=>{const O=L[p.key]??"",U=A[p.key]??"";return typeof O=="number"&&typeof U=="number"?p.dir==="asc"?O-U:U-O:p.dir==="asc"?String(O).localeCompare(String(U)):String(U).localeCompare(String(O))}),M},[z,f,p]);x.useEffect(()=>{N(1)},[u,f,p,y,C,E]);const B=H.slice((w-1)*k,w*k),R=({label:M,sortKey:F})=>s.jsx("th",{onClick:()=>q(F),className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors select-none",children:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[M,(p==null?void 0:p.key)===F&&(p.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}))]})});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Opportunities",icon:Yu,iconClassName:"text-accent",description:"Deals and revenue pipeline.",children:s.jsx("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[{mode:"kanban",icon:i5},{mode:"table",icon:Da},{mode:"forecast",icon:a5}].map(({mode:M,icon:F})=>s.jsx("button",{onClick:()=>n(M),className:`p-1.5 rounded-lg text-sm transition-all ${t===M?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(F,{className:"w-4 h-4"})},M))})}),s.jsxs("div",{className:"px-4 md:px-6 pt-3 pb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground font-semibold",children:"Close Date:"}),s.jsx("div",{className:"inline-flex rounded-xl border border-border bg-muted/40 p-0.5 gap-0.5",children:Lse.map(M=>s.jsx("button",{onClick:()=>b(M.value),className:["px-3 py-1.5 text-xs font-medium rounded-lg transition-all",y===M.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"].join(" "),children:M.label},M.value))}),y==="custom"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(An,{value:C,onChange:S,size:"sm",placeholder:"From",className:"w-36"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"to"}),s.jsx(An,{value:E,onChange:P,size:"sm",placeholder:"To",className:"w-36"})]})]}),s.jsx(Ks,{searchValue:u,onSearchChange:d,searchPlaceholder:"Search opportunities...",filters:$se,activeFilters:f,onFilterChange:K,onClearFilters:()=>m({}),sortOptions:Vse,currentSort:p,onSortChange:q,onAdd:()=>o("opportunity"),addLabel:"New Opportunity",entityType:"opportunities"}),s.jsx("div",{className:"flex-1 overflow-y-auto pb-24 md:pb-6",children:I?s.jsx("div",{className:"flex gap-4 px-4 md:px-6 pt-2",children:[...Array(4)].map((M,F)=>s.jsx("div",{className:"flex-shrink-0 w-72 h-64 bg-muted/50 rounded-2xl animate-pulse"},F))}):t==="kanban"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"border-t border-border mb-4"}),s.jsx("div",{className:"flex gap-3 md:gap-4 px-4 md:px-6 pb-4 overflow-x-auto min-h-full snap-x snap-mandatory md:snap-none no-scrollbar",children:om.map(M=>{const F=sd[M]??{label:M,color:"#94a3b8"},L=H.filter(O=>O.stage===M),A=L.reduce((O,U)=>O+(U.amount||0),0);return s.jsxs("div",{className:"flex-shrink-0 w-[280px] md:w-72 flex flex-col snap-center",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"px-2.5 py-1 rounded-lg text-xs font-semibold",style:{backgroundColor:F.color+"20",color:F.color},children:F.label}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:L.length})]}),s.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["$",(A/1e3).toFixed(0),"K"]})]}),s.jsxs("div",{className:"flex-1 space-y-2",children:[L.map((O,U)=>{const V=O.contact_name??O.contactName??"",$=O.amount??0,Y=O.days_in_stage??O.daysInStage??0;return s.jsxs(We.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:U*.03},onClick:()=>r("opportunity",O.id),className:"bg-card border border-border rounded-2xl p-3.5 cursor-pointer hover:border-primary/30 hover:shadow-md transition-all press-scale group",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsx("p",{className:"text-sm font-display font-bold text-foreground",children:O.name}),l&&s.jsx("button",{onClick:X=>{X.stopPropagation(),a({type:"opportunity",id:O.id,name:O.name,detail:`$${($/1e3).toFixed(0)}K`}),e("/agent")},className:"p-0.5 rounded-lg md:opacity-0 md:group-hover:opacity-100 hover:bg-accent/10 transition-all",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})]}),V&&s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsx(yo,{name:V,className:"w-5 h-5 rounded-full text-[8px]"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:V})]}),s.jsxs("div",{className:"flex items-center justify-between mt-2.5",children:[s.jsxs("span",{className:"text-sm font-display font-extrabold text-foreground",children:["$",$>=1e3?`${($/1e3).toFixed(0)}K`:$]}),Y>0&&(Y>14?s.jsxs("span",{className:"px-2 py-0.5 rounded-lg text-xs bg-destructive/15 text-destructive font-semibold",children:[Y,"d"]}):s.jsxs("span",{className:"text-xs text-muted-foreground",children:[Y,"d"]}))]})]},O.id)}),s.jsxs("button",{onClick:()=>o("opportunity"),className:"w-full flex items-center justify-center gap-1 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 rounded-xl transition-colors press-scale",children:[s.jsx(or,{className:"w-3.5 h-3.5"})," Add Opportunity"]})]})]},M)})})]}):t==="table"?s.jsx("div",{className:"px-4 md:px-6",children:H.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[s.jsx("p",{className:"text-sm",children:"No opportunities match your filters."}),s.jsx("button",{onClick:()=>{d(""),m({}),b("all")},className:"mt-2 text-xs text-primary font-semibold hover:underline",children:"Clear all filters"})]}):s.jsxs("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx(R,{label:"Opportunity",sortKey:"name"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Contact"}),s.jsx(R,{label:"Amount",sortKey:"amount"}),s.jsx(R,{label:"Stage",sortKey:"stage"}),s.jsx(R,{label:"Probability",sortKey:"probability"}),s.jsx(R,{label:"Created",sortKey:"created_at"}),l&&s.jsx("th",{className:"px-2 py-3 w-8"})]})}),s.jsx("tbody",{children:B.map((M,F)=>{const L=M.contact_name??M.contactName??"",A=M.amount??0;return s.jsxs("tr",{onClick:()=>r("opportunity",M.id),className:`border-b border-border last:border-0 hover:bg-primary/5 cursor-pointer transition-colors group ${F%2===1?"bg-surface-sunken/30":""}`,children:[s.jsx("td",{className:"px-4 py-3 font-display font-bold text-foreground",children:M.name}),s.jsx("td",{className:"px-4 py-3",children:L&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yo,{name:L,className:"w-5 h-5 rounded-full text-[8px]"}),s.jsx("span",{className:"text-muted-foreground",children:L})]})}),s.jsxs("td",{className:"px-4 py-3 font-display font-bold text-foreground",children:["$",A>=1e3?`${(A/1e3).toFixed(0)}K`:A]}),s.jsx("td",{className:"px-4 py-3",children:M.stage&&s.jsx(od,{stage:M.stage})}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:M.probability?`${M.probability}%`:"—"}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground text-xs",children:M.created_at?new Date(M.created_at).toLocaleDateString():"—"}),l&&s.jsx("td",{className:"px-2 py-3",children:s.jsx("button",{onClick:O=>{O.stopPropagation(),a({type:"opportunity",id:M.id,name:M.name,detail:`$${(A/1e3).toFixed(0)}K`}),e("/agent")},className:"p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-accent/10 transition-all",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})})]},M.id)})})]})}),s.jsx("div",{className:"px-4",children:s.jsx(hs,{page:w,pageSize:k,total:H.length,onPageChange:N,onPageSizeChange:j})})]})}):s.jsxs("div",{className:"px-4 md:px-6",children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-6",children:[{label:"Weighted Pipeline",value:H.filter(M=>M.stage!=="closed_won"&&M.stage!=="closed_lost").reduce((M,F)=>M+(F.amount||0)*(F.probability||0)/100,0)},{label:"Best Case",value:H.filter(M=>M.stage!=="closed_lost").reduce((M,F)=>M+(F.amount||0),0)},{label:"Closed Won",value:H.filter(M=>M.stage==="closed_won").reduce((M,F)=>M+(F.amount||0),0)}].map(M=>s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsx("p",{className:"text-xs text-muted-foreground font-display font-semibold",children:M.label}),s.jsxs("p",{className:"text-2xl font-display font-extrabold text-foreground mt-1",children:["$",M.value>=1e6?`${(M.value/1e6).toFixed(2)}M`:`${(M.value/1e3).toFixed(0)}K`]})]},M.label))}),s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsx("h3",{className:"font-display font-bold text-foreground mb-4",children:"Pipeline by stage"}),s.jsx("div",{className:"space-y-4",children:om.filter(M=>M!=="closed_lost").map(M=>{const F=sd[M]??{label:M,color:"#94a3b8"},L=H.filter(O=>O.stage===M).reduce((O,U)=>O+(U.amount||0),0),A=Math.max(...om.map(O=>H.filter(U=>U.stage===O).reduce((U,V)=>U+(V.amount||0),0)),1);return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs w-28 truncate font-semibold",style:{color:F.color},children:F.label}),s.jsx("div",{className:"flex-1 h-8 bg-muted rounded-xl overflow-hidden",children:s.jsx(We.div,{initial:{width:0},animate:{width:`${L/A*100}%`},transition:{duration:.8,ease:"easeOut"},className:"h-full rounded-xl flex items-center px-3",style:{backgroundColor:F.color+"30"},children:s.jsxs("span",{className:"text-xs font-display font-bold",style:{color:F.color},children:["$",(L/1e3).toFixed(0),"K"]})})})]},M)})})]})]})})]})}const am=["discovery","poc","production","scaling","sunset"],Bse=[{value:"all",label:"All"},{value:"today",label:"Today"},{value:"this_week",label:"This Week"},{value:"this_month",label:"This Month"},{value:"this_quarter",label:"This Quarter"},{value:"custom",label:"Custom"}];function Wse(e){if(e==="all")return null;const t=new Date;if(e==="today"){const n=new Date(t);n.setHours(0,0,0,0);const r=new Date(t);return r.setHours(23,59,59,999),{start:n,end:r}}if(e==="this_week"){const n=new Date(t),r=n.getDay();n.setDate(n.getDate()+(r===0?-6:1-r)),n.setHours(0,0,0,0);const o=new Date(n);return o.setDate(n.getDate()+6),o.setHours(23,59,59,999),{start:n,end:o}}if(e==="this_month"){const n=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59,999);return{start:n,end:r}}if(e==="this_quarter"){const n=Math.floor(t.getMonth()/3),r=new Date(t.getFullYear(),n*3,1),o=new Date(t.getFullYear(),n*3+3,0,23,59,59,999);return{start:r,end:o}}return null}const Hse=[{key:"stage",label:"Stage",options:am.map(e=>{var t;return{value:e,label:((t=xa[e])==null?void 0:t.label)??e}})}],Use=[{key:"name",label:"Name"},{key:"stage",label:"Stage"},{key:"attributed_arr",label:"ARR"},{key:"health_score",label:"Health"},{key:"target_prod_date",label:"Prod Date"},{key:"created_at",label:"Created"}];function qse(){const{openDrawer:e,openQuickAdd:t,openAIWithContext:n}=lt(),{enabled:r}=kr(),o=Cn(),[a,l]=x.useState("table"),[u,d]=x.useState(""),[f,m]=x.useState({}),[p,g]=x.useState(null),[y,b]=x.useState("all"),[w,N]=x.useState(""),[k,j]=x.useState(""),[C,S]=x.useState(1),[E,P]=x.useState(25),{data:D,isLoading:I}=ew({q:u||void 0,limit:200}),z=(D==null?void 0:D.data)??[],K=(M,F)=>{m(L=>{const A={...L};return F.length===0?delete A[M]:A[M]=F,A})},q=M=>{g(F=>(F==null?void 0:F.key)===M?{key:M,dir:F.dir==="asc"?"desc":"asc"}:{key:M,dir:"asc"})},H=x.useMemo(()=>{var F;let M=[...z];if((F=f.stage)!=null&&F.length&&(M=M.filter(L=>f.stage.includes(L.stage))),y!=="all"){let L,A;if(y==="custom")L=w?new Date(w+"T00:00:00"):new Date(0),A=k?new Date(k+"T23:59:59"):new Date(864e13);else{const O=Wse(y);O?(L=O.start,A=O.end):(L=new Date(0),A=new Date(864e13))}M=M.filter(O=>{if(!O.target_prod_date)return!0;const U=new Date(O.target_prod_date);return U>=L&&U<=A})}return p&&M.sort((L,A)=>{const O=L[p.key]??"",U=A[p.key]??"";return typeof O=="number"&&typeof U=="number"?p.dir==="asc"?O-U:U-O:p.dir==="asc"?String(O).localeCompare(String(U)):String(U).localeCompare(String(O))}),M},[z,f,p,y,w,k]);x.useEffect(()=>{S(1)},[u,f,p,y,w,k]);const B=H.slice((C-1)*E,C*E),R=({label:M,sortKey:F})=>s.jsx("th",{onClick:()=>q(F),className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors select-none",children:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[M,(p==null?void 0:p.key)===F&&(p.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}))]})});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Use Cases",icon:Qu,iconClassName:"text-success",description:"Customer use cases and deployment tracking.",children:s.jsx("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[{mode:"kanban",icon:i5},{mode:"table",icon:Da},{mode:"dashboard",icon:a5}].map(({mode:M,icon:F})=>s.jsx("button",{onClick:()=>l(M),className:`p-1.5 rounded-lg text-sm transition-all ${a===M?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(F,{className:"w-4 h-4"})},M))})}),s.jsxs("div",{className:"px-4 md:px-6 pt-3 pb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground font-semibold",children:"Prod Date:"}),s.jsx("div",{className:"inline-flex rounded-xl border border-border bg-muted/40 p-0.5 gap-0.5",children:Bse.map(M=>s.jsx("button",{onClick:()=>b(M.value),className:["px-3 py-1.5 text-xs font-medium rounded-lg transition-all",y===M.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"].join(" "),children:M.label},M.value))}),y==="custom"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(An,{value:w,onChange:N,size:"sm",placeholder:"From",className:"w-36"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"to"}),s.jsx(An,{value:k,onChange:j,size:"sm",placeholder:"To",className:"w-36"})]})]}),s.jsx(Ks,{searchValue:u,onSearchChange:d,searchPlaceholder:"Search use cases...",filters:Hse,activeFilters:f,onFilterChange:K,onClearFilters:()=>{m({}),b("all")},sortOptions:Use,currentSort:p,onSortChange:q,onAdd:()=>t("use-case"),addLabel:"New Use Case",entityType:"use cases"}),s.jsx("div",{className:"flex-1 overflow-y-auto pb-24 md:pb-6",children:I?s.jsx("div",{className:"flex gap-4 px-4 md:px-6 pt-2",children:[...Array(4)].map((M,F)=>s.jsx("div",{className:"flex-shrink-0 w-72 h-64 bg-muted/50 rounded-2xl animate-pulse"},F))}):a==="kanban"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"border-t border-border mb-4"}),s.jsx("div",{className:"flex gap-3 md:gap-4 px-4 md:px-6 pb-4 overflow-x-auto min-h-full snap-x snap-mandatory md:snap-none no-scrollbar",children:am.map(M=>{const F=xa[M]??{label:M,color:"#94a3b8"},L=H.filter(O=>O.stage===M),A=L.reduce((O,U)=>O+(U.attributed_arr||0),0);return s.jsxs("div",{className:"flex-shrink-0 w-[280px] md:w-72 flex flex-col snap-center",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"px-2.5 py-1 rounded-lg text-xs font-semibold",style:{backgroundColor:F.color+"20",color:F.color},children:F.label}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:L.length})]}),A>0&&s.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["$",(A/1e3).toFixed(0),"K ARR"]})]}),s.jsxs("div",{className:"flex-1 space-y-2",children:[L.map((O,U)=>{const V=O.account_name??O.client??"",$=O.attributed_arr??0,Y=O.health_score??0;return s.jsxs(We.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:U*.03},onClick:()=>e("use-case",O.id),className:"bg-card border border-border rounded-2xl p-3.5 cursor-pointer hover:border-primary/30 hover:shadow-md transition-all press-scale group",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsx("p",{className:"text-sm font-display font-bold text-foreground",children:O.name}),r&&s.jsx("button",{onClick:X=>{X.stopPropagation(),n({type:"use-case",id:O.id,name:O.name,detail:V}),o("/agent")},className:"p-0.5 rounded-lg md:opacity-0 md:group-hover:opacity-100 hover:bg-accent/10 transition-all",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})]}),V&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:V}),s.jsxs("div",{className:"flex items-center justify-between mt-2.5",children:[$>0?s.jsxs("span",{className:"text-sm font-display font-extrabold text-foreground",children:["$",$>=1e3?`${($/1e3).toFixed(0)}K`:$]}):s.jsx("span",{}),Y>0&&s.jsx("span",{className:`px-2 py-0.5 rounded-lg text-xs font-semibold ${Y>=80?"bg-green-500/15 text-green-400":Y>=50?"bg-yellow-500/15 text-yellow-400":"bg-red-500/15 text-red-400"}`,children:Y})]})]},O.id)}),s.jsxs("button",{onClick:()=>t("use-case"),className:"w-full flex items-center justify-center gap-1 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 rounded-xl transition-colors press-scale",children:[s.jsx(or,{className:"w-3.5 h-3.5"})," Add Use Case"]})]})]},M)})})]}):a==="table"?s.jsx("div",{className:"px-4 md:px-6",children:H.length===0?s.jsxs(We.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx(Qu,{className:"w-14 h-14 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-base font-display font-semibold text-foreground mb-1",children:z.length===0?"No use cases yet":"No matches"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:z.length===0?"Create a use case to track customer deployments and adoption.":"Try adjusting your search, filters, or date range."}),(u||Object.keys(f).length>0||y!=="all")&&s.jsx("button",{onClick:()=>{d(""),m({}),b("all")},className:"mt-3 text-xs text-primary font-semibold hover:underline",children:"Clear all filters"})]}):s.jsxs("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx(R,{label:"Use Case",sortKey:"name"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Client"}),s.jsx(R,{label:"Stage",sortKey:"stage"}),s.jsx(R,{label:"ARR",sortKey:"attributed_arr"}),s.jsx(R,{label:"Health",sortKey:"health_score"}),s.jsx(R,{label:"Prod Date",sortKey:"target_prod_date"}),s.jsx(R,{label:"Created",sortKey:"created_at"}),r&&s.jsx("th",{className:"px-2 py-3 w-8"})]})}),s.jsx("tbody",{children:B.map((M,F)=>{const L=M.stage??"",A=xa[L]??{label:L,color:"#94a3b8"},O=M.attributed_arr??0,U=M.health_score??0,V=M.account_name??M.client??"";return s.jsxs("tr",{onClick:()=>e("use-case",M.id),className:`border-b border-border last:border-0 hover:bg-primary/5 cursor-pointer transition-colors group ${F%2===1?"bg-surface-sunken/30":""}`,children:[s.jsx("td",{className:"px-4 py-3 font-display font-bold text-foreground",children:M.name}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:V||"—"}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:"inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold",style:{backgroundColor:A.color+"18",color:A.color},children:A.label})}),s.jsx("td",{className:"px-4 py-3 font-display font-bold text-foreground",children:O>0?`$${(O/1e3).toFixed(0)}K`:"—"}),s.jsx("td",{className:"px-4 py-3",children:U>0?s.jsx("span",{className:`px-2 py-0.5 rounded-lg text-xs font-semibold ${U>=80?"bg-green-500/15 text-green-400":U>=50?"bg-yellow-500/15 text-yellow-400":"bg-red-500/15 text-red-400"}`,children:U}):"—"}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground text-xs",children:M.target_prod_date?new Date(M.target_prod_date).toLocaleDateString():"—"}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground text-xs",children:M.created_at?new Date(M.created_at).toLocaleDateString():"—"}),r&&s.jsx("td",{className:"px-2 py-3",children:s.jsx("button",{onClick:$=>{$.stopPropagation(),n({type:"use-case",id:M.id,name:M.name,detail:V}),o("/agent")},className:"p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-accent/10 transition-all",children:s.jsx(an,{className:"w-3.5 h-3.5 text-accent"})})})]},M.id)})})]})}),s.jsx("div",{className:"px-4",children:s.jsx(hs,{page:C,pageSize:E,total:H.length,onPageChange:S,onPageSizeChange:P})})]})}):s.jsxs("div",{className:"px-4 md:px-6",children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-6",children:[{label:"Total ARR",value:H.filter(M=>M.stage!=="sunset").reduce((M,F)=>M+(F.attributed_arr||0),0),isCount:!1},{label:"Production ARR",value:H.filter(M=>M.stage==="production"||M.stage==="scaling").reduce((M,F)=>M+(F.attributed_arr||0),0),isCount:!1},{label:"Active Use Cases",value:H.filter(M=>M.stage!=="sunset").length,isCount:!0}].map(M=>s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsx("p",{className:"text-xs text-muted-foreground font-display font-semibold",children:M.label}),s.jsx("p",{className:"text-2xl font-display font-extrabold text-foreground mt-1",children:M.isCount?M.value:M.value>=1e6?`$${(M.value/1e6).toFixed(2)}M`:`$${(M.value/1e3).toFixed(0)}K`})]},M.label))}),s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 shadow-sm",children:[s.jsx("h3",{className:"font-display font-bold text-foreground mb-4",children:"ARR by stage"}),s.jsx("div",{className:"space-y-4",children:am.map(M=>{const F=xa[M]??{label:M,color:"#94a3b8"},L=H.filter(U=>U.stage===M).reduce((U,V)=>U+(V.attributed_arr||0),0),A=H.filter(U=>U.stage===M).length,O=Math.max(...am.map(U=>H.filter(V=>V.stage===U).reduce((V,$)=>V+($.attributed_arr||0),0)),1);return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs w-24 truncate font-semibold",style:{color:F.color},children:F.label}),s.jsx("div",{className:"flex-1 h-8 bg-muted rounded-xl overflow-hidden",children:s.jsx(We.div,{initial:{width:0},animate:{width:L>0?`${L/O*100}%`:"0%"},transition:{duration:.8,ease:"easeOut"},className:"h-full rounded-xl flex items-center px-3",style:{backgroundColor:F.color+"30"},children:L>0&&s.jsxs("span",{className:"text-xs font-display font-bold",style:{color:F.color},children:["$",(L/1e3).toFixed(0),"K"]})})}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono w-6 text-right",children:A})]},M)})})]})]})})]})}const F2=[{value:"call",label:"Call"},{value:"email",label:"Email"},{value:"meeting",label:"Meeting"},{value:"note",label:"Note"},{value:"task",label:"Task"},{value:"demo",label:"Demo"},{value:"proposal",label:"Proposal"},{value:"research",label:"Research"},{value:"handoff",label:"Handoff"},{value:"status_update",label:"Status Update"}],Kse=[{value:"contact",label:"Contact"},{value:"account",label:"Account"},{value:"opportunity",label:"Opportunity"},{value:"use_case",label:"Use Case"}],Yse=[{value:"connected",label:"Connected"},{value:"voicemail",label:"Voicemail"},{value:"positive",label:"Positive"},{value:"negative",label:"Negative"},{value:"neutral",label:"Neutral"},{value:"no_show",label:"No Show"},{value:"follow_up_needed",label:"Follow-up Needed"}],Qse=[{key:"occurred_at",label:"When"},{key:"created_at",label:"Logged"},{key:"type",label:"Type"},{key:"outcome",label:"Outcome"}],Gse=[{value:"today",label:"Today"},{value:"this_week",label:"This Week"},{value:"this_month",label:"This Month"},{value:"this_quarter",label:"This Quarter"},{value:"custom",label:"Custom"}];function Xse(e){const t=new Date,n=new Date(t);if(n.setHours(23,59,59,999),e==="today"){const r=new Date(t);return r.setHours(0,0,0,0),{start:r,end:n}}if(e==="this_week"){const r=new Date(t),o=r.getDay(),a=o===0?-6:1-o;return r.setDate(r.getDate()+a),r.setHours(0,0,0,0),{start:r,end:n}}if(e==="this_month")return{start:new Date(t.getFullYear(),t.getMonth(),1,0,0,0,0),end:n};if(e==="this_quarter"){const r=Math.floor(t.getMonth()/3);return{start:new Date(t.getFullYear(),r*3,1,0,0,0,0),end:n}}return{start:new Date(0),end:n}}function Zse(){const{openQuickAdd:e}=lt(),[t,n]=x.useState(""),[r,o]=x.useState({}),[a,l]=x.useState(null),[u,d]=x.useState("this_week"),[f,m]=x.useState(""),[p,g]=x.useState(""),[y,b]=x.useState(1),w=50,{data:N}=i3(),k=x.useMemo(()=>{const z=((N==null?void 0:N.data)??[]).map(H=>({value:H.type_name,label:H.label||H.type_name})),K=new Set(F2.map(H=>H.value)),q=z.filter(H=>!K.has(H.value));return[{key:"type",label:"Type",options:[...F2,...q]},{key:"subject_type",label:"Subject",options:Kse},{key:"outcome",label:"Outcome",options:Yse}]},[N]),{data:j,isLoading:C}=tw({limit:200}),S=(j==null?void 0:j.data)??[],E=(z,K)=>{o(q=>{const H={...q};return K.length===0?delete H[z]:H[z]=K,H})},P=z=>{l(K=>(K==null?void 0:K.key)===z?{key:z,dir:K.dir==="asc"?"desc":"asc"}:{key:z,dir:"desc"})},D=x.useMemo(()=>{var H,B,R;let z=[...S],K,q;if(u==="custom"?(K=f?new Date(f+"T00:00:00"):new Date(0),q=p?new Date(p+"T23:59:59"):new Date(864e13)):{start:K,end:q}=Xse(u),z=z.filter(M=>{const F=new Date(M.occurred_at??M.created_at);return F>=K&&F<=q}),t){const M=t.toLowerCase();z=z.filter(F=>{const L=(F.description??F.body??F.subject??"").toLowerCase(),A=(F.contact_name??"").toLowerCase(),O=(F.outcome??"").toLowerCase(),U=(F.subject_type??"").replace(/_/g," ").toLowerCase();return L.includes(M)||A.includes(M)||O.includes(M)||U.includes(M)})}return(H=r.type)!=null&&H.length&&(z=z.filter(M=>r.type.includes(M.type))),(B=r.subject_type)!=null&&B.length&&(z=z.filter(M=>r.subject_type.includes(M.subject_type))),(R=r.outcome)!=null&&R.length&&(z=z.filter(M=>r.outcome.includes(M.outcome))),a&&z.sort((M,F)=>{let L,A;return a.key==="occurred_at"?(L=M.occurred_at??M.created_at??"",A=F.occurred_at??F.created_at??""):(L=M[a.key]??"",A=F[a.key]??""),a.dir==="asc"?L.localeCompare(A):A.localeCompare(L)}),z},[S,t,r,a,u,f,p]);x.useEffect(()=>{b(1)},[t,r,a,u,f,p]);const I=D.slice((y-1)*w,y*w);return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Activities",icon:tc,iconClassName:"text-warning",description:"Calls, emails, meetings, and tasks."}),s.jsxs("div",{className:"px-4 md:px-6 pt-3 pb-1 flex flex-wrap items-center gap-2",children:[s.jsx("div",{className:"inline-flex rounded-xl border border-border bg-muted/40 p-0.5 gap-0.5",children:Gse.map(z=>s.jsx("button",{onClick:()=>d(z.value),className:["px-3 py-1.5 text-xs font-medium rounded-lg transition-all",u===z.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"].join(" "),children:z.label},z.value))}),u==="custom"&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(An,{value:f,onChange:m,size:"sm",placeholder:"From",className:"w-36"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"to"}),s.jsx(An,{value:p,onChange:g,size:"sm",placeholder:"To",className:"w-36"})]})]}),s.jsx(Ks,{searchValue:t,onSearchChange:n,searchPlaceholder:"Search activities...",filters:k,activeFilters:r,onFilterChange:E,onClearFilters:()=>o({}),sortOptions:Qse,currentSort:a,onSortChange:P,onAdd:()=>e("activity"),addLabel:"Log Activity",entityType:"activities"}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 pb-24 md:pb-6",children:C?s.jsx("div",{className:"space-y-3 pt-2",children:[...Array(6)].map((z,K)=>s.jsx("div",{className:"h-12 bg-muted/50 rounded-xl animate-pulse"},K))}):s.jsxs("div",{className:"bg-card border border-border rounded-2xl p-4 shadow-sm",children:[s.jsx(MT,{activities:I}),s.jsx(hs,{page:y,pageSize:w,total:D.length,onPageChange:b})]})})]})}const Jse={contact:Na,opportunity:Yu,"use-case":m5,account:BL},B0={contact:"Contact",opportunity:"Opportunity","use-case":"Use Case",account:"Account"};async function eoe(e,t,n,r){const o=localStorage.getItem("crmy_token"),a=await fetch(`/api/v1/agent/sessions/${e}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...o?{Authorization:`Bearer ${o}`}:{}},body:JSON.stringify({message:t}),signal:r});if(!a.ok){const f=await a.json().catch(()=>({error:a.statusText}));throw new Error(f.error||f.detail||`HTTP ${a.status}`)}const l=a.body.getReader(),u=new TextDecoder;let d="";for(;;){const{done:f,value:m}=await l.read();if(f)break;d+=u.decode(m,{stream:!0});const p=d.split(`
|
|
635
|
+
`);d=p.pop();for(const g of p)if(g.startsWith("data: "))try{const y=JSON.parse(g.slice(6));n(y)}catch{}}}function toe({session:e,isActive:t,onSelect:n,onRenamed:r,onDeleted:o}){const[a,l]=x.useState(!1),[u,d]=x.useState(e.label??""),[f,m]=x.useState(!1),p=x.useRef(null),g=F7(),y=$7(),b=x.useRef(null),w=j=>{j.stopPropagation(),d(e.label??""),l(!0),setTimeout(()=>{var C;return(C=b.current)==null?void 0:C.select()},0)},N=async()=>{u.trim()&&u.trim()!==e.label&&(await g.mutateAsync({id:e.id,label:u.trim()}),r()),l(!1)},k=async j=>{if(j.stopPropagation(),!f){m(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>m(!1),3e3);return}p.current&&clearTimeout(p.current),await y.mutateAsync(e.id),o()};return s.jsxs("div",{className:`group relative flex items-start gap-2 px-3 py-2.5 rounded-xl cursor-pointer transition-colors ${t?"bg-primary/8 border border-primary/20":"hover:bg-muted/50 border border-transparent"}`,onClick:a?void 0:n,children:[s.jsx(zs,{className:"w-3.5 h-3.5 text-muted-foreground mt-0.5 flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[a?s.jsx("input",{ref:b,value:u,onChange:j=>d(j.target.value),onKeyDown:j=>{j.key==="Enter"&&N(),j.key==="Escape"&&l(!1)},onBlur:N,className:"w-full text-xs bg-transparent border-b border-primary outline-none text-foreground",onClick:j=>j.stopPropagation()}):s.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors line-clamp-2",children:e.label||"Untitled conversation"}),e.context_name&&s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 truncate block mt-0.5",children:[B0[e.context_type??""]??e.context_type," · ",e.context_name]})]}),!a&&s.jsxs("div",{className:`flex items-center gap-1 transition-opacity flex-shrink-0 ${f?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:[s.jsx("button",{onClick:w,className:"p-0.5 rounded hover:bg-muted transition-colors",title:"Rename",children:s.jsx(br,{className:"w-3 h-3 text-muted-foreground"})}),s.jsx("button",{onClick:k,className:`p-0.5 rounded transition-colors ${f?"text-destructive hover:bg-destructive/10":"hover:bg-muted text-muted-foreground"}`,title:f?"Click again to confirm delete":"Delete session",children:f?s.jsx(_d,{className:"w-3 h-3"}):s.jsx(Bn,{className:"w-3 h-3"})})]})]})}function noe(){var K,q,H;const[e,t]=x.useState([]),[n,r]=x.useState(""),[o,a]=x.useState(!1),[l,u]=x.useState(null),[d,f]=x.useState(null),m=x.useRef(null),p=x.useRef(null),{aiContext:g}=lt(),{enabled:y,loading:b,connectivity:w}=kr(),{data:N,refetch:k}=I7(),j=L7(),C=(N==null?void 0:N.data)??[];x.useEffect(()=>{var B;(B=m.current)==null||B.scrollIntoView({behavior:"smooth"})},[e]),x.useEffect(()=>{g&&(u(g),r(""),t([{kind:"assistant",content:`I'm ready to help with **${g.name}**${g.detail?` (${g.detail})`:""}. What would you like to do?`}]),f(null),lt.setState({aiContext:null}))},[g]);const S=x.useCallback(async B=>{f(B.id),u(B.context_type?{type:B.context_type,id:B.context_id??"",name:B.context_name??""}:null);const R=localStorage.getItem("crmy_token");try{const M=await fetch(`/api/v1/agent/sessions/${B.id}`,{headers:R?{Authorization:`Bearer ${R}`}:{}});if(M.ok){const{data:F}=await M.json(),L=[];for(const A of F.messages)A.role!=="system"&&(A.role==="user"&&L.push({kind:"user",content:A.content}),A.role==="assistant"&&A.content&&L.push({kind:"assistant",content:A.content}));t(L)}}catch{}},[]),E=x.useCallback(()=>{f(null),t([]),u(null),r("")},[]),P=x.useCallback(async()=>{const B=n.trim();if(!B||o)return;r(""),t(A=>[...A,{kind:"user",content:B}]),a(!0);const R=new AbortController;p.current=R;let M=!1,F=!1,L=null;try{let A=d;A||(A=(await j.mutateAsync({context_type:l==null?void 0:l.type,context_id:l==null?void 0:l.id,context_name:l==null?void 0:l.name})).data.id,f(A)),L=A;let O="";await eoe(A,B,U=>{switch(U.type){case"delta":{O+=U.content,M=!0;const V=O;t($=>{const Y=$[$.length-1];return(Y==null?void 0:Y.kind)==="assistant"?[...$.slice(0,-1),{kind:"assistant",content:V}]:[...$,{kind:"assistant",content:V}]});break}case"tool_status":O="",t(V=>{let $=-1;for(let X=V.length-1;X>=0;X--){const ne=V[X];if(ne.kind==="tool_status"&&ne.id===U.id){$=X;break}}const Y={kind:"tool_status",id:U.id,name:U.name,status:U.status};if($>=0){const X=[...V];return X[$]=Y,X}return[...V,Y]});break;case"tool_call":break;case"tool_result":t(V=>V.map($=>$.kind==="tool_status"&&$.id===U.id?{...$,status:U.is_error?`Error from ${$.name.replace(/_/g," ")}`:$.status.replace("…"," ✓")}:$));break;case"error":t(V=>[...V,{kind:"error",message:U.message}]);break;case"done":F=!0,k();break}},R.signal)}catch(A){A.name!=="AbortError"&&t(O=>[...O,{kind:"error",message:A.message}])}finally{if(a(!1),p.current=null,!M&&!F&&L){const A=L,O=localStorage.getItem("crmy_token");fetch(`/api/v1/agent/sessions/${A}`,{headers:O?{Authorization:`Bearer ${O}`}:{}}).then(U=>U.ok?U.json():null).then(U=>{var $;if(!(($=U==null?void 0:U.data)!=null&&$.messages))return;const V=[];for(const Y of U.data.messages)Y.role!=="system"&&(Y.role==="user"&&V.push({kind:"user",content:Y.content}),Y.role==="assistant"&&Y.content&&V.push({kind:"assistant",content:Y.content}));V.length>0&&t(V)}).catch(()=>{})}}},[n,o,d,l,j,k]),D=l?[`Summarize ${((K=B0[l.type])==null?void 0:K.toLowerCase())??"record"}`,"Recent activities","Draft follow-up"]:["Summarize pipeline","Deals needing attention","List my open activities"],I=l?Jse[l.type]:null,z=w==="online"?"Workspace Agent online":w==="offline"?"Agent offline":"Workspace Agent";return b?s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Workspace Agent"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(gr,{className:"w-6 h-6 animate-spin text-muted-foreground/40"})})]}):y?s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Workspace Agent"}),s.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsx("div",{className:"px-4 py-3 border-b border-border bg-gradient-to-r from-primary/5 to-accent/5",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(EQ,{}),s.jsx("span",{className:`text-sm font-display font-bold ${w==="offline"?"text-destructive":"text-foreground"}`,children:z}),o&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-primary ml-2",children:[s.jsx(gr,{className:"w-3 h-3 animate-spin"})," Thinking…"]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o&&s.jsx("button",{onClick:()=>{var B;return(B=p.current)==null?void 0:B.abort()},className:"text-[10px] text-destructive bg-destructive/10 px-2 py-0.5 rounded-full hover:bg-destructive/20 transition-colors",children:"Stop"}),s.jsx("button",{onClick:E,className:"text-[10px] text-muted-foreground bg-muted px-2 py-0.5 rounded-full hover:bg-muted/80 transition-colors",children:"New chat"})]})]})}),s.jsx(mn,{children:l&&I&&s.jsx(We.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"px-4 py-2.5 border-b border-border bg-accent/5",children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-accent/15 flex items-center justify-center",children:s.jsx(I,{className:"w-3.5 h-3.5 text-accent"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:B0[l.type]}),s.jsxs("p",{className:"text-sm font-display font-bold text-foreground truncate",children:[l.name,l.detail&&s.jsxs("span",{className:"font-normal text-muted-foreground ml-1.5",children:["· ",l.detail]})]})]}),s.jsx("button",{onClick:()=>u(null),className:"p-1 rounded-md hover:bg-muted transition-colors",children:s.jsx(Ht,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})},"context-banner")}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 pb-24 md:pb-4",children:[e.length===0&&s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(zn,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),s.jsx("p",{className:"text-sm",children:"Ask your workspace agent anything about your CRM."})]}),e.map((B,R)=>s.jsx(ooe,{msg:B,index:R},R)),o&&((q=e[e.length-1])==null?void 0:q.kind)!=="assistant"&&((H=e[e.length-1])==null?void 0:H.kind)!=="tool_status"&&s.jsx(roe,{}),s.jsx("div",{ref:m})]}),e.length===0&&s.jsx("div",{className:"px-4 flex gap-2 flex-wrap",children:D.map(B=>s.jsx("button",{onClick:()=>r(B),className:"px-3.5 py-2 rounded-xl text-xs bg-card border border-border text-muted-foreground hover:bg-primary/5 hover:text-primary hover:border-primary/30 transition-all press-scale",children:B},B))}),s.jsx("div",{className:"p-4 pb-20 md:pb-4",children:s.jsxs("div",{className:"flex gap-2 items-end bg-card border border-border rounded-2xl p-2 shadow-sm focus-within:border-primary/40 transition-colors",children:[s.jsx("textarea",{value:n,onChange:B=>r(B.target.value),onKeyDown:B=>B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),P()),placeholder:"Ask your workspace agent…",rows:1,disabled:o,className:"flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none px-2 py-1.5 disabled:opacity-50"}),s.jsx("button",{onClick:P,disabled:!n.trim()||o,className:"p-2.5 rounded-xl bg-gradient-to-br from-primary to-primary/80 text-primary-foreground hover:shadow-md disabled:opacity-40 transition-all press-scale",children:o?s.jsx(gr,{className:"w-4 h-4 animate-spin"}):s.jsx(Lr,{className:"w-4 h-4"})})]})})]}),s.jsxs("div",{className:"hidden lg:flex flex-col w-72 border-l border-border bg-surface",children:[s.jsxs("div",{className:"px-4 pt-4 pb-2 flex items-center justify-between",children:[s.jsxs("h3",{className:"font-display font-bold text-foreground text-sm flex items-center gap-1.5",children:[s.jsx(os,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Sessions"]}),s.jsx("button",{onClick:E,className:"text-[10px] text-primary hover:underline",children:"+ New"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[C.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:"No conversations yet."}),s.jsx("div",{className:"space-y-1",children:C.map(B=>s.jsx(toe,{session:B,isActive:d===B.id,onSelect:()=>S(B),onRenamed:()=>k(),onDeleted:()=>{d===B.id&&E(),k()}},B.id))})]})]})]})]}):s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Workspace Agent"}),s.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md space-y-3",children:[s.jsx(zn,{className:"w-12 h-12 mx-auto text-muted-foreground/40"}),s.jsx("h2",{className:"text-lg font-display font-bold text-foreground",children:"Workspace Agent is not enabled"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["An administrator needs to enable the agent and configure an LLM provider in"," ",s.jsx("span",{className:"text-foreground font-medium",children:"Settings → Local Workspace Agent"}),"."]})]})})]})}function roe(){return s.jsxs(We.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:4},className:"flex justify-start",children:[s.jsx("div",{className:"w-8 h-8 rounded-xl bg-gradient-to-br from-primary/20 to-accent/20 flex items-center justify-center mr-2 flex-shrink-0 mt-1",children:s.jsx(zn,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{className:"bg-card border border-border rounded-2xl rounded-bl-md px-4 py-3.5 shadow-sm flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-primary/50 animate-bounce [animation-delay:0ms]"}),s.jsx("span",{className:"w-2 h-2 rounded-full bg-primary/50 animate-bounce [animation-delay:150ms]"}),s.jsx("span",{className:"w-2 h-2 rounded-full bg-primary/50 animate-bounce [animation-delay:300ms]"})]})]})}function soe({msg:e}){const[t,n]=x.useState(!1),r=e.status.endsWith("✓"),o=e.status.startsWith("Error");return s.jsxs(We.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},className:"flex items-start gap-2 px-3 py-1.5 text-xs text-muted-foreground group",children:[s.jsx(gm,{className:`w-3 h-3 mt-0.5 flex-shrink-0 ${o?"text-destructive":r?"text-success":"text-primary animate-pulse"}`}),s.jsx("span",{className:o?"text-destructive":r?"text-muted-foreground":"text-foreground/70",children:e.status}),s.jsxs("button",{onClick:()=>n(a=>!a),className:"ml-auto opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-0.5 text-[10px] text-muted-foreground/60 hover:text-muted-foreground",children:[s.jsx("code",{className:"font-mono bg-muted px-1 rounded",children:e.name}),t?s.jsx(Wn,{className:"w-2.5 h-2.5"}):s.jsx($s,{className:"w-2.5 h-2.5"})]})]})}function ooe({msg:e,index:t}){if(e.kind==="tool_status")return s.jsx(soe,{msg:e});if(e.kind==="tool_call"||e.kind==="tool_result")return null;if(e.kind==="error")return s.jsx(We.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},className:"px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm",children:e.message});const n=e.kind==="user";return s.jsxs(We.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:Math.min(t*.03,.3)},className:`flex ${n?"justify-end":"justify-start"}`,children:[!n&&s.jsx("div",{className:"w-8 h-8 rounded-xl bg-gradient-to-br from-primary/20 to-accent/20 flex items-center justify-center mr-2 flex-shrink-0 mt-1",children:s.jsx(zn,{className:"w-4 h-4 text-primary"})}),s.jsx("div",{className:`max-w-[75%] rounded-2xl px-4 py-3 text-sm whitespace-pre-wrap
|
|
636
|
+
${n?"bg-gradient-to-br from-primary to-primary/80 text-primary-foreground rounded-br-md":"bg-card border border-border text-foreground rounded-bl-md shadow-sm"}`,children:e.content})]})}function aoe(e){return e===null?"":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ioe(e){const t=new Date(e),r=Date.now()-t.getTime();return r<6e4?"just now":r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:t.toLocaleDateString()}function loe({entry:e}){const[t,n]=x.useState(!1);return s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden mb-2",children:[s.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-muted/50 transition-colors",onClick:()=>n(r=>!r),children:[s.jsx("span",{className:"text-muted-foreground",children:t?s.jsx(Wn,{className:"w-4 h-4"}):s.jsx($s,{className:"w-4 h-4"})}),s.jsxs("span",{className:`flex items-center gap-1.5 font-mono text-sm font-medium ${e.is_error?"text-destructive":"text-foreground"}`,children:[e.is_error?s.jsx(Bs,{className:"w-3.5 h-3.5 shrink-0"}):s.jsx(gm,{className:"w-3.5 h-3.5 shrink-0 text-muted-foreground"}),e.tool_name]}),s.jsx("span",{className:"flex-1"}),s.jsxs("span",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.session_label&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(XL,{className:"w-3 h-3"}),s.jsx("span",{className:"max-w-[120px] truncate",children:e.session_label})]}),e.user_name&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Na,{className:"w-3 h-3"}),e.user_name]}),e.duration_ms!==null&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(zs,{className:"w-3 h-3"}),aoe(e.duration_ms)]}),s.jsx("span",{title:new Date(e.created_at).toLocaleString(),children:ioe(e.created_at)})]})]}),t&&s.jsxs("div",{className:"border-t border-border bg-muted/30 px-4 py-3 space-y-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Arguments"}),s.jsx("pre",{className:"text-xs font-mono bg-background border border-border rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:JSON.stringify(e.tool_args,null,2)})]}),e.tool_result!==null&&s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:e.is_error?"Error":"Result"}),s.jsx("pre",{className:`text-xs font-mono border rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto ${e.is_error?"bg-destructive/5 border-destructive/30 text-destructive":"bg-background border-border"}`,children:JSON.stringify(e.tool_result,null,2)})]})]})]})}const coe=["contact_get","contact_search","contact_create","contact_update","account_get","account_search","account_create","opportunity_get","opportunity_list","opportunity_create","opportunity_update","activity_create","activity_complete","activity_update","context_add","context_list","context_extract","context_supersede","briefing_get","assignment_create","assignment_list"];function uoe(){const[e,t]=x.useState({}),[n,r]=x.useState(""),[o,a]=x.useState("all"),[l,u]=x.useState(""),d={...e,tool_name:n||void 0,is_error:o==="errors"?!0:void 0,since:l||void 0,limit:50},{data:f,isLoading:m,isError:p}=z7(d),g=(f==null?void 0:f.data)??[],y=(f==null?void 0:f.total)??0;return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Agent Activity",icon:gm,iconClassName:"text-[#6366f1]",description:"Real-time agent tool usage and performance."}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-4xl mx-auto w-full",children:[s.jsxs("div",{className:"flex flex-wrap gap-3 mb-6",children:[s.jsxs("select",{className:"h-9 px-3 rounded-md border border-input bg-background text-sm",value:n,onChange:b=>r(b.target.value),children:[s.jsx("option",{value:"",children:"All tools"}),coe.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{className:"h-9 px-3 rounded-md border border-input bg-background text-sm",value:o,onChange:b=>a(b.target.value),children:[s.jsx("option",{value:"all",children:"All results"}),s.jsx("option",{value:"errors",children:"Errors only"})]}),s.jsx("input",{type:"date",className:"h-9 px-3 rounded-md border border-input bg-background text-sm",value:l,onChange:b=>u(b.target.value?new Date(b.target.value).toISOString():""),placeholder:"Since date"}),(n||o!=="all"||l)&&s.jsx("button",{className:"h-9 px-3 rounded-md border border-input bg-background text-sm text-muted-foreground hover:text-foreground",onClick:()=>{r(""),a("all"),u("")},children:"Clear filters"}),s.jsxs("span",{className:"ml-auto self-center text-sm text-muted-foreground",children:[y.toLocaleString()," tool call",y!==1?"s":""]})]}),m?s.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((b,w)=>s.jsx("div",{className:"h-12 rounded-lg bg-muted animate-pulse"},w))}):p?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(Bs,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),s.jsx("p",{children:"Failed to load activity log."})]}):g.length===0?s.jsxs("div",{className:"text-center py-20 text-muted-foreground",children:[s.jsx(gm,{className:"w-10 h-10 mx-auto mb-3 opacity-20"}),s.jsx("p",{className:"text-sm",children:"No agent tool calls recorded yet."}),s.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Activity appears here as the agent uses tools in chat sessions."})]}):s.jsxs(s.Fragment,{children:[g.map(b=>s.jsx(loe,{entry:b},b.id)),(f==null?void 0:f.next_cursor)&&s.jsx("button",{className:"w-full mt-2 py-2 text-sm text-muted-foreground hover:text-foreground border border-dashed border-border rounded-lg",onClick:()=>t(b=>({...b,cursor:f.next_cursor})),children:"Load more"})]})]})]})}var rg="Switch",[doe]=wo(rg),[foe,hoe]=doe(rg),C4=x.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:l,disabled:u,value:d="on",onCheckedChange:f,form:m,...p}=e,[g,y]=x.useState(null),b=pt(t,C=>y(C)),w=x.useRef(!1),N=g?m||!!g.closest("form"):!0,[k,j]=Ri({prop:o,defaultProp:a??!1,onChange:f,caller:rg});return s.jsxs(foe,{scope:n,checked:k,disabled:u,children:[s.jsx(Ge.button,{type:"button",role:"switch","aria-checked":k,"aria-required":l,"data-state":E4(k),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:b,onClick:Ke(e.onClick,C=>{j(S=>!S),N&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),N&&s.jsx(_4,{control:g,bubbles:!w.current,name:r,value:d,checked:k,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"}})]})});C4.displayName=rg;var k4="SwitchThumb",S4=x.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=hoe(k4,n);return s.jsx(Ge.span,{"data-state":E4(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});S4.displayName=k4;var moe="SwitchBubbleInput",_4=x.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},a)=>{const l=x.useRef(null),u=pt(l,a),d=n1(n),f=yb(t);return x.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&y){const b=new Event("click",{bubbles:r});y.call(m,n),m.dispatchEvent(b)}},[d,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:u,style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_4.displayName=moe;function E4(e){return e?"checked":"unchecked"}var P4=C4,poe=S4;const Du=x.forwardRef(({className:e,...t},n)=>s.jsx(P4,{className:Ie("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:n,children:s.jsx(poe,{className:Ie("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Du.displayName=P4.displayName;const im=[{id:"anthropic",label:"Anthropic",baseUrl:"https://api.anthropic.com/v1",dotColor:"bg-orange-400",requiresKey:!0,models:[{id:"claude-opus-4-20250514",label:"Claude Opus 4",inputPricePerM:15,outputPricePerM:75},{id:"claude-sonnet-4-20250514",label:"Claude Sonnet 4",inputPricePerM:3,outputPricePerM:15},{id:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",inputPricePerM:.8,outputPricePerM:4}]},{id:"openai",label:"OpenAI",baseUrl:"https://api.openai.com/v1",dotColor:"bg-green-500",requiresKey:!0,models:[{id:"gpt-4o",label:"GPT-4o",inputPricePerM:2.5,outputPricePerM:10},{id:"gpt-4o-mini",label:"GPT-4o mini",inputPricePerM:.15,outputPricePerM:.6},{id:"o3-mini",label:"o3-mini",inputPricePerM:1.1,outputPricePerM:4.4},{id:"o1",label:"o1",inputPricePerM:15,outputPricePerM:60},{id:"o1-mini",label:"o1-mini",inputPricePerM:3,outputPricePerM:12}]},{id:"openrouter",label:"OpenRouter",baseUrl:"https://openrouter.ai/api/v1",dotColor:"bg-violet-500",requiresKey:!0,models:[{id:"openrouter/auto",label:"Auto (best available)"},{id:"anthropic/claude-sonnet-4",label:"Claude Sonnet 4",inputPricePerM:3,outputPricePerM:15},{id:"anthropic/claude-opus-4",label:"Claude Opus 4",inputPricePerM:15,outputPricePerM:75},{id:"openai/gpt-4o",label:"GPT-4o",inputPricePerM:2.5,outputPricePerM:10},{id:"google/gemini-2.0-flash",label:"Gemini 2.0 Flash",inputPricePerM:.1,outputPricePerM:.4},{id:"deepseek/deepseek-chat",label:"DeepSeek V3",inputPricePerM:.27,outputPricePerM:1.1},{id:"meta-llama/llama-3.3-70b-instruct",label:"Llama 3.3 70B",inputPricePerM:.12,outputPricePerM:.3}]},{id:"ollama",label:"Ollama (local)",baseUrl:"http://localhost:11434/v1",dotColor:"bg-blue-400",requiresKey:!1,models:[{id:"llama3.2",label:"Llama 3.2 (8B)",inputPricePerM:0,outputPricePerM:0},{id:"llama3.2:1b",label:"Llama 3.2 (1B)",inputPricePerM:0,outputPricePerM:0},{id:"mistral",label:"Mistral 7B",inputPricePerM:0,outputPricePerM:0},{id:"phi3",label:"Phi-3 Mini",inputPricePerM:0,outputPricePerM:0},{id:"codellama",label:"Code Llama",inputPricePerM:0,outputPricePerM:0},{id:"gemma2",label:"Gemma 2 (9B)",inputPricePerM:0,outputPricePerM:0},{id:"deepseek-r1",label:"DeepSeek R1",inputPricePerM:0,outputPricePerM:0}]},{id:"custom",label:"Custom / Other",baseUrl:"",dotColor:"bg-slate-400",requiresKey:!1,models:[]}],_l="__custom__";function Ru(e){return im.find(t=>t.id===e)??im[im.length-1]}function goe(e,t){const r=Ru(e).models.find(o=>o.id===t);if(!(!r||r.inputPricePerM===void 0||r.outputPricePerM===void 0))return{inputPricePerM:r.inputPricePerM,outputPricePerM:r.outputPricePerM}}function xoe(e,t,n){if(t===0&&n===0)return"Free (running locally)";const r=e*1.5,o=e*.6,a=(r*t+o*n)/1e6;return a<1e-4?"< $0.0001 / turn":a<.01?`~$${a.toFixed(4)} / turn`:`~$${a.toFixed(3)} / turn`}const Dh=`You are a CRMy workspace assistant with direct API access to the CRM.
|
|
637
|
+
|
|
638
|
+
CORE RULES:
|
|
639
|
+
1. Use your tools to complete every task directly — never tell the user to use the UI instead.
|
|
640
|
+
2. Search for a record first (e.g. contact_search) to obtain its UUID before updating it.
|
|
641
|
+
3. After making a change, confirm what was updated and show the new value.
|
|
642
|
+
4. For potentially destructive changes (deletes, bulk edits) state what you are about to do before calling the tool.
|
|
643
|
+
5. If a tool call fails, explain the error and suggest a correction.`,Rh="w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",$2="px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",ov="px-3 py-1.5 rounded-lg border border-border text-xs font-semibold text-muted-foreground hover:text-foreground hover:border-foreground/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",V2="px-3 py-1.5 rounded-lg bg-destructive text-destructive-foreground text-xs font-semibold hover:bg-destructive/90 transition-colors disabled:opacity-40";function yoe(){const{data:e,isLoading:t}=d3(),n=R7(),r=O7(),o=V7(),a=e==null?void 0:e.data,[l,u]=x.useState(!1),[d,f]=x.useState("anthropic"),[m,p]=x.useState(Ru("anthropic").baseUrl),[g,y]=x.useState(""),[b,w]=x.useState(!1),[N,k]=x.useState(null),[j,C]=x.useState(!1),[S,E]=x.useState(""),[P,D]=x.useState(""),[I,z]=x.useState(""),[K,q]=x.useState(""),[H,B]=x.useState("unknown"),[R,M]=x.useState("idle"),[F,L]=x.useState(""),[A,O]=x.useState(90),[U,V]=x.useState(Dh),[$,Y]=x.useState(!1),[X,ne]=x.useState(Dh),[ie,J]=x.useState(4e3),[re,ce]=x.useState(!0),[fe,pe]=x.useState(!0),[ye,Ne]=x.useState(!1),Oe=x.useRef(null),[Xe,Le]=x.useState(!1),[st,Nt]=x.useState("");x.useEffect(()=>{if(!a)return;u(a.enabled),f(a.provider),p(a.base_url),C(a.api_key_configured??!1),k(a.api_key_hint??null),Ru(a.provider).models.find(Mt=>Mt.id===a.model)?(E(a.model),D("")):(E(_l),D(a.model??"")),O(a.history_retention_days),V(a.system_prompt??Dh),ne(a.system_prompt??Dh),J(a.max_tokens_per_turn),ce(a.can_create_assignments),pe(a.can_log_activities),Ne(a.can_write_objects)},[a]),x.useEffect(()=>{$&&Oe.current&&Oe.current.focus()},[$]),x.useEffect(()=>{const yt=S===_l||d==="custom"?P:S;if(!yt){B("unknown");return}if(d==="ollama"){z("0"),q("0"),B("free");return}const Mt=goe(d,yt);if(Mt?(z(String(Mt.inputPricePerM)),q(String(Mt.outputPricePerM)),B(d==="openrouter"?"openrouter":"default")):B("unknown"),d==="openrouter"&&yt!=="openrouter/auto"){let pn=!1;return fetch("https://openrouter.ai/api/v1/models").then(Un=>Un.ok?Un.json():null).then(Un=>{if(pn||!(Un!=null&&Un.data))return;const ln=Un.data.find(xs=>xs.id===yt);if(!(ln!=null&&ln.pricing))return;const zr=parseFloat(ln.pricing.prompt??"0")*1e6,Br=parseFloat(ln.pricing.completion??"0")*1e6;isFinite(zr)&&isFinite(Br)&&(z(zr.toFixed(zr<1?4:2)),q(Br.toFixed(Br<1?4:2)),B("openrouter"))}).catch(()=>{}),()=>{pn=!0}}},[d,S,P]);const ge=Ru(d),De=S===_l||d==="custom",$e=De?P:S,et=ge.requiresKey?!!(j&&$e&&m):!!($e&&m),tt=()=>{M("idle"),L("")},ht=ue=>{var pn;f(ue);const yt=Ru(ue);p(yt.baseUrl);const Mt=((pn=yt.models[0])==null?void 0:pn.id)??"";E(Mt||_l),D(""),y(""),tt()},te=async ue=>{if(!(ue&&!et)){u(ue);try{await n.mutateAsync({enabled:ue}),de({title:ue?"Agent enabled":"Agent disabled"})}catch{u(!ue),de({title:"Failed to update",variant:"destructive"})}}},Ce=async()=>{M("testing"),L("");try{const ue={provider:d,base_url:m,model:$e};g.trim()&&(ue.api_key=g.trim());const yt=await r.mutateAsync(ue);yt.ok?M("ok"):(M("fail"),L(yt.error??"Check your settings and try again."))}catch(ue){M("fail"),L(ue instanceof Error?ue.message:"Connection failed")}},Ze=async()=>{const ue={provider:d,base_url:m,model:$e,system_prompt:U,max_tokens_per_turn:ie,history_retention_days:A,can_write_objects:ye,can_log_activities:fe,can_create_assignments:re};g.trim()&&(ue.api_key=g.trim());try{await n.mutateAsync(ue),y(""),de({title:"Settings saved",description:"Agent configuration updated."})}catch{de({title:"Save failed",variant:"destructive"})}},at=async()=>{Le(!1),Nt("");try{await o.mutateAsync({}),de({title:"Chat histories cleared",description:"All agent chat histories have been deleted."})}catch{de({title:"Failed to clear histories",variant:"destructive"})}};if(t)return s.jsxs("div",{className:"space-y-5 max-w-2xl",children:[s.jsx("div",{className:"h-8 bg-muted rounded animate-pulse"}),s.jsx("div",{className:"h-48 bg-muted rounded animate-pulse"})]});const oe=l?"":"opacity-40 pointer-events-none",ke=j?`••••••••${N??"••••"}`:"Paste your API key…";return s.jsxs("div",{className:"space-y-5 max-w-2xl",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-1",children:"Local Workspace Agent"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the workspace agent for your team."})]}),s.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-amber-500/10 flex items-center justify-center",children:s.jsx(an,{className:"w-4 h-4 text-amber-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Enable Local Workspace Agent"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Toggle AI features on or off for this workspace"})]})]}),s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx(Du,{checked:l,onCheckedChange:te,disabled:!et&&!l,"aria-label":"Enable Local Workspace Agent"}),!et&&!l&&s.jsx("p",{className:"text-[10px] text-muted-foreground text-right max-w-[160px]",children:"Configure and test your provider first"})]})]}),s.jsx("div",{className:"px-5 py-4 text-sm text-muted-foreground leading-relaxed",children:"The Local Workspace Agent connects your CRM to an LLM of your choice — running on your own infrastructure or a provider you control. Once enabled, team members can chat with the agent to search records, log activities, update opportunities, and run bulk actions without leaving the workspace. The agent only has access to data within your tenant and operates under the permission scopes you configure below."})]}),s.jsxs("div",{className:`rounded-xl border border-border bg-card overflow-hidden transition-opacity ${oe}`,"aria-disabled":!l,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-blue-500/10 flex items-center justify-center",children:s.jsx(qL,{className:"w-4 h-4 text-blue-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Provider & model"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect to an LLM gateway or direct provider"})]})]}),j&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Key configured",N?` (…${N})`:""]})]})]}),s.jsxs("div",{className:"divide-y divide-border px-5",children:[s.jsxs("div",{className:"py-4 space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Provider"}),s.jsxs(pd,{value:d,onValueChange:ue=>ht(ue),children:[s.jsx(gc,{className:"w-full h-9 text-sm",children:s.jsx(gd,{placeholder:"Select provider…"})}),s.jsx(xc,{children:im.map(ue=>s.jsx(Ti,{value:ue.id,children:s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${ue.dotColor}`}),ue.label]})},ue.id))})]})]}),s.jsxs("div",{className:"py-4 space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Base URL"}),s.jsx("input",{value:m,onChange:ue=>{p(ue.target.value),tt()},placeholder:ge.baseUrl||"https://…",className:Rh})]}),ge.requiresKey?s.jsxs("div",{className:"py-4 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"API Key"}),j&&!g&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Enter a new key to replace the stored one"})]}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:b?"text":"password",value:g,onChange:ue=>{y(ue.target.value),tt()},placeholder:ke,className:Rh+" pr-10",autoComplete:"new-password"}),s.jsx("button",{type:"button",onClick:()=>w(ue=>!ue),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":b?"Hide API key":"Show API key",children:b?s.jsx(d5,{className:"w-3.5 h-3.5"}):s.jsx(f5,{className:"w-3.5 h-3.5"})})]})]}):s.jsx("div",{className:"py-4",children:s.jsx("p",{className:"text-xs text-muted-foreground italic",children:d==="ollama"?"Ollama runs locally — no API key required.":"No API key required for this provider."})}),s.jsxs("div",{className:"py-4 space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Model"}),d==="custom"?s.jsx("input",{value:P,onChange:ue=>{D(ue.target.value),tt()},placeholder:"e.g. my-custom-model",className:Rh}):s.jsxs("div",{className:"space-y-2",children:[s.jsxs(pd,{value:S,onValueChange:ue=>{E(ue),ue!==_l&&D(""),tt()},children:[s.jsx(gc,{className:"w-full h-9 text-sm",children:s.jsx(gd,{placeholder:"Select model…"})}),s.jsxs(xc,{children:[ge.models.map(ue=>s.jsx(Ti,{value:ue.id,children:ue.label},ue.id)),s.jsx(Ti,{value:_l,children:s.jsx("span",{className:"text-muted-foreground italic",children:"Custom model ID…"})})]})]}),De&&s.jsx("input",{value:P,onChange:ue=>{D(ue.target.value),tt()},placeholder:"Enter model ID exactly as required by the API",className:Rh,autoFocus:!0})]})]}),s.jsxs("div",{className:"py-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("button",{onClick:Ce,disabled:R==="testing"||!$e||!m,className:ov,children:R==="testing"?"Testing…":"Test connection"}),s.jsx("button",{onClick:Ze,disabled:R!=="ok"||n.isPending,className:$2,title:R!=="ok"?"Run a successful test first":void 0,children:n.isPending?"Saving…":"Save changes"})]}),R==="ok"&&s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[s.jsx(Gt,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Connected successfully — you can now save."})]}),R==="fail"&&s.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-destructive",children:[s.jsx(Vs,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),s.jsx("span",{children:F||"Connection failed. Check your key, URL, and model."})]}),R==="idle"&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Test your connection before saving to confirm the key works."})]})]})]}),s.jsxs("div",{className:`rounded-xl border border-border bg-card overflow-hidden transition-opacity ${oe}`,"aria-disabled":!l,children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-purple-500/10 flex items-center justify-center",children:s.jsx(ja,{className:"w-4 h-4 text-purple-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Per-user agent behaviour"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Fine-tune how the agent behaves for this workspace"})]})]}),s.jsxs("div",{className:"divide-y divide-border px-5",children:[s.jsxs("div",{className:"flex items-center justify-between py-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Chat history retention"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"How long to keep conversation history"})]}),s.jsxs("select",{value:A,onChange:ue=>O(Number(ue.target.value)),className:"h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground outline-none focus:ring-1 focus:ring-ring cursor-pointer",children:[s.jsx("option",{value:30,children:"30 days"}),s.jsx("option",{value:90,children:"90 days"}),s.jsx("option",{value:180,children:"180 days"}),s.jsx("option",{value:0,children:"Forever"})]})]}),s.jsxs("div",{className:"py-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"System prompt"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Instructions sent to the agent at the start of every conversation"})]}),s.jsx("button",{onClick:()=>{ne(U),Y(!0)},className:"text-xs font-semibold text-primary hover:underline whitespace-nowrap",children:"Edit prompt →"})]}),s.jsx("div",{className:"p-3 rounded-lg bg-muted/30 border border-border",children:s.jsx("p",{className:"text-xs text-muted-foreground font-mono leading-relaxed line-clamp-2",children:U})})]}),s.jsxs("div",{className:"py-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Max tokens per turn"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Maximum tokens the model can generate per response"})]}),s.jsxs("select",{value:ie,onChange:ue=>J(Number(ue.target.value)),className:"h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground outline-none focus:ring-1 focus:ring-ring cursor-pointer",children:[s.jsx("option",{value:1e3,children:"1,000"}),s.jsx("option",{value:4e3,children:"4,000"}),s.jsx("option",{value:8e3,children:"8,000"}),s.jsx("option",{value:16e3,children:"16,000"})]})]}),s.jsxs("div",{className:"p-3 rounded-lg bg-muted/30 border border-border space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"text-xs font-medium text-foreground",children:["Token pricing ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(USD per million tokens)"})]}),H==="openrouter"&&s.jsx("span",{className:"text-[10px] text-violet-500 font-medium",children:"Live from OpenRouter"}),H==="default"&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Default for model"}),H==="user"&&s.jsx("span",{className:"text-[10px] text-primary font-medium",children:"Custom"}),H==="free"&&s.jsx("span",{className:"text-[10px] text-green-600 font-medium",children:"Free (local)"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:"Input ($/M)"}),s.jsx("input",{type:"number",min:"0",step:"0.01",value:I,onChange:ue=>{z(ue.target.value),B("user")},placeholder:"e.g. 3.00",className:"w-full h-8 px-2.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:"Output ($/M)"}),s.jsx("input",{type:"number",min:"0",step:"0.01",value:K,onChange:ue=>{q(ue.target.value),B("user")},placeholder:"e.g. 15.00",className:"w-full h-8 px-2.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})]}),(I!==""||K!=="")&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:[xoe(ie,parseFloat(I||"0"),parseFloat(K||"0")),H!=="free"&&s.jsx("span",{className:"ml-1 text-[10px]",children:"· estimated (1.5× input, 0.6× output of max tokens)"})]}),H==="unknown"&&I===""&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Select a known model above to auto-fill prices, or enter them manually."})]})]}),s.jsxs("div",{className:"flex items-center justify-between py-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Allow agent to create assignments"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent can assign tasks to users and actors"})]}),s.jsx(Du,{checked:re,onCheckedChange:async ue=>{ce(ue);try{await n.mutateAsync({can_create_assignments:ue})}catch{ce(!ue),de({title:"Failed to save",variant:"destructive"})}},"aria-label":"Allow agent to create assignments"})]}),s.jsxs("div",{className:"flex items-center justify-between py-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Allow agent to log activities"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent can record calls, notes, and emails"})]}),s.jsx(Du,{checked:fe,onCheckedChange:async ue=>{pe(ue);try{await n.mutateAsync({can_log_activities:ue})}catch{pe(!ue),de({title:"Failed to save",variant:"destructive"})}},"aria-label":"Allow agent to log activities"})]}),s.jsxs("div",{className:"py-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Allow agent to write CRM objects"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent can create and edit contacts, accounts, and opportunities"})]}),s.jsx(Du,{checked:ye,onCheckedChange:async ue=>{Ne(ue);try{await n.mutateAsync({can_write_objects:ue})}catch{Ne(!ue),de({title:"Failed to save",variant:"destructive"})}},"aria-label":"Allow agent to write CRM objects"})]}),ye&&s.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[s.jsx(Bs,{className:"w-3.5 h-3.5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:"Granting write access means the agent can modify CRM records autonomously. Review agent actions regularly."})]})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary/10 flex items-center justify-center",children:s.jsx(aF,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Observability"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Review what the agent has been doing across the workspace"})]})]}),s.jsx("div",{className:"px-5 py-3",children:s.jsxs(hr,{to:"/agent/activity",className:"flex items-center justify-between py-1 group",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Agent activity log"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Browse every tool call the agent has made — with arguments, results, session, and timing"})]}),s.jsx(Il,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors shrink-0 ml-4"})]})})]}),s.jsxs("div",{className:"rounded-xl border border-red-200 dark:border-red-900/50 bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-red-200 dark:border-red-900/50",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-red-500/10 flex items-center justify-center",children:s.jsx(Bs,{className:"w-4 h-4 text-red-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-red-600 dark:text-red-400",children:"Danger zone"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Irreversible actions — proceed with care"})]})]}),s.jsx("div",{className:"divide-y divide-red-100 dark:divide-red-900/30 px-5",children:s.jsxs("div",{className:"flex items-center justify-between py-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Clear all chat histories"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Permanently delete all agent conversation history for this workspace"})]}),s.jsx("button",{onClick:()=>Le(!0),className:V2+" whitespace-nowrap",children:"Clear all histories"})]})})]}),$&&s.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-foreground/20 backdrop-blur-sm",children:s.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 max-w-2xl w-full mx-4 shadow-xl space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:"Edit system prompt"}),s.jsx("button",{onClick:()=>Y(!1),className:"text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Ht,{className:"w-4 h-4"})})]}),s.jsx("textarea",{ref:Oe,value:X,onChange:ue=>ne(ue.target.value),rows:10,className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring font-mono resize-none"}),s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsx("button",{onClick:()=>Y(!1),className:ov,children:"Cancel"}),s.jsx("button",{onClick:()=>{V(X),Y(!1),de({title:"System prompt updated"})},className:$2,children:"Save prompt"})]})]})}),Xe&&s.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-foreground/20 backdrop-blur-sm",children:s.jsxs("div",{className:"bg-card border border-border rounded-xl p-6 max-w-sm w-full mx-4 shadow-xl space-y-4",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:"Clear all chat histories?"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["This is irreversible. Type ",s.jsx("code",{className:"font-mono bg-muted px-1 rounded",children:"CLEAR"})," to confirm."]}),s.jsx("input",{value:st,onChange:ue=>Nt(ue.target.value),placeholder:"CLEAR",className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm font-mono outline-none focus:ring-1 focus:ring-ring"}),s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsx("button",{onClick:()=>{Le(!1),Nt("")},className:ov,children:"Cancel"}),s.jsx("button",{disabled:st!=="CLEAR",onClick:at,className:V2+" disabled:opacity-40",children:"Clear histories"})]})]})})]})}const voe=[{value:"slack",label:"Slack",icon:os},{value:"teams",label:"Teams",icon:os},{value:"discord",label:"Discord",icon:os},{value:"whatsapp",label:"WhatsApp",icon:Gu}],z2={owner:"Owner",admin:"Admin",member:"Member"},Oh={owner:"bg-accent/15 text-accent border-accent/30",admin:"bg-primary/15 text-primary border-primary/30",member:"bg-muted text-muted-foreground border-border"},B2={human:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30",agent:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/30"},boe=[{label:"General",scopes:[{value:"read",label:"Read",desc:"Read all CRM data"},{value:"write",label:"Write",desc:"Create and modify CRM data"}]},{label:"Contacts",scopes:[{value:"contacts:read",label:"Read contacts"},{value:"contacts:write",label:"Write contacts"}]},{label:"Accounts",scopes:[{value:"accounts:read",label:"Read accounts"},{value:"accounts:write",label:"Write accounts"}]},{label:"Opportunities",scopes:[{value:"opportunities:read",label:"Read opportunities"},{value:"opportunities:write",label:"Write opportunities"}]},{label:"Activities",scopes:[{value:"activities:read",label:"Read activities"},{value:"activities:write",label:"Write activities"}]},{label:"Assignments",scopes:[{value:"assignments:create",label:"Create assignments"},{value:"assignments:update",label:"Update assignments"}]},{label:"Context",scopes:[{value:"context:read",label:"Read context"},{value:"context:write",label:"Write context"}]}];function W2({actor:e,onClose:t}){const n=r3(),{data:r,isLoading:o}=e3(e.id),a=t3(),l=n3(),[u,d]=x.useState(""),[f,m]=x.useState(null),[p,g]=x.useState(!1),[y,b]=x.useState(!1),[w,N]=x.useState(e.scopes??[]),k=(r==null?void 0:r.data)??[],j=async()=>{if(u.trim())try{const D=await a.mutateAsync({label:u.trim(),scopes:e.scopes??["read"],actor_id:e.id});m(D.key??null),d(""),g(!1),de({title:"API key created",description:"Copy it now — it won't be shown again."})}catch{de({title:"Error",description:"Failed to create API key.",variant:"destructive"})}},C=async D=>{try{await l.mutateAsync(D),de({title:"API key revoked"})}catch{de({title:"Error",description:"Failed to revoke key.",variant:"destructive"})}},S=D=>{N(I=>I.includes(D)?I.filter(z=>z!==D):[...I,D])},E=async()=>{try{await n.mutateAsync({id:e.id,scopes:w}),b(!1),de({title:"Permissions updated"})}catch{de({title:"Error",description:"Failed to update permissions.",variant:"destructive"})}};return s.jsx(We.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:s.jsxs("div",{className:"px-4 py-4 bg-muted/20 border-t border-border space-y-4",children:[s.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oF,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Permissions"}),s.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border",children:[(e.scopes??[]).length," scopes"]})]}),y?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:E,disabled:n.isPending,className:"px-2.5 py-1 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40",children:n.isPending?"Saving…":"Save"}),s.jsx("button",{onClick:()=>b(!1),className:"px-2.5 py-1 rounded-lg border border-border text-xs font-semibold text-muted-foreground hover:text-foreground",children:"Cancel"})]}):s.jsx("button",{onClick:()=>{b(!0),N(e.scopes??[])},className:"text-xs font-semibold text-primary hover:underline",children:"Edit"})]}),s.jsx("div",{className:"px-4 py-3",children:y?s.jsx("div",{className:"space-y-3",children:boe.map(D=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:D.label}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:D.scopes.map(I=>{const z=w.includes(I.value);return s.jsx("button",{onClick:()=>S(I.value),className:`px-2.5 py-1 rounded-md text-xs font-medium border transition-colors ${z?"bg-primary/10 text-primary border-primary/30":"bg-muted/50 border-border text-muted-foreground hover:text-foreground"}`,children:I.label},I.value)})})]},D.label))}):s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(e.scopes??[]).length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:"No permissions assigned."}):(e.scopes??[]).map(D=>s.jsx("span",{className:"px-2 py-0.5 rounded-md text-[11px] font-medium bg-primary/10 text-primary border border-primary/20",children:D},D))})})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Iu,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm font-semibold text-foreground",children:"API Keys"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border",children:k.length})]}),s.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90",children:[s.jsx(or,{className:"w-3 h-3"})," New Key"]})]}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[f&&s.jsxs("div",{className:"p-3 rounded-lg border border-green-500/30 bg-green-500/5 space-y-2",children:[s.jsx("p",{className:"text-xs font-semibold text-green-600 dark:text-green-400",children:"Copy this key now — it won't be shown again:"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"flex-1 text-xs font-mono bg-background rounded px-2 py-1.5 border border-border truncate",children:f}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText(f),de({title:"Copied!"})},className:"p-1.5 rounded-lg hover:bg-muted transition-colors flex-shrink-0",children:s.jsx(c5,{className:"w-3.5 h-3.5 text-muted-foreground"})})]}),s.jsx("button",{onClick:()=>m(null),className:"text-xs text-muted-foreground hover:text-foreground",children:"Dismiss"})]}),p&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{value:u,onChange:D=>d(D.target.value),placeholder:"Key label (e.g. Production)",className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring"+" max-w-xs",onKeyDown:D=>D.key==="Enter"&&j()}),s.jsx("button",{onClick:j,disabled:!u.trim()||a.isPending,className:"px-2.5 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40",children:"Create"}),s.jsx("button",{onClick:()=>{g(!1),d("")},className:"px-2.5 py-1.5 rounded-lg border border-border text-xs font-semibold text-muted-foreground",children:"Cancel"})]}),o?s.jsx("div",{className:"h-8 bg-muted/50 rounded animate-pulse"}):k.length===0&&!p?s.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"No API keys. Create one to allow this actor to authenticate."}):k.map(D=>s.jsxs("div",{className:"flex items-center gap-3 py-2 border-b border-border last:border-0",children:[s.jsx(Iu,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-semibold text-foreground",children:D.label}),s.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[D.last_used_at?`Last used ${new Date(D.last_used_at).toLocaleDateString()}`:"Never used"," · Created ",new Date(D.created_at).toLocaleDateString()]})]}),s.jsx("button",{onClick:()=>C(D.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors flex-shrink-0",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]},D.id))]})]}),s.jsx("div",{className:"flex justify-end",children:s.jsx("button",{onClick:t,className:"px-3 py-1.5 rounded-lg border border-border text-xs font-semibold text-muted-foreground hover:text-foreground hover:border-foreground/30 transition-colors",children:"Close details"})})]})})}function H2({actor:e,size:t="sm"}){const n=t==="lg"?"w-10 h-10 text-sm":"w-8 h-8 text-xs";if(e.actor_type==="agent")return s.jsx("div",{className:`${n} rounded-xl bg-blue-500/15 flex items-center justify-center flex-shrink-0`,children:s.jsx(zn,{className:t==="lg"?"w-5 h-5 text-blue-500":"w-3.5 h-3.5 text-blue-500"})});const r=e.display_name.trim().split(/\s+/).map(o=>o[0]).slice(0,2).join("").toUpperCase()||"?";return s.jsx("div",{className:`${n} rounded-xl bg-amber-500/15 flex items-center justify-center flex-shrink-0`,children:s.jsx("span",{className:"font-display font-bold text-amber-600 dark:text-amber-400",children:r})})}function _u(e){const t=e==null?void 0:e.contact_channels;return Array.isArray(t)?t:[]}function av({channels:e,onChange:t}){const n=()=>{t([...e,{channel_type:"slack",handle:"",primary:!1}])},r=a=>{t(e.filter((l,u)=>u!==a))},o=(a,l)=>{t(e.map((u,d)=>d===a?{...u,...l}:u))};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Messaging Channels"}),s.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 font-medium",children:[s.jsx(or,{className:"w-3 h-3"})," Add channel"]})]}),e.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground/60 italic",children:"No messaging channels configured"}),s.jsx(mn,{children:e.map((a,l)=>s.jsxs(We.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex items-center gap-2",children:[s.jsx("select",{value:a.channel_type,onChange:u=>o(l,{channel_type:u.target.value}),className:"h-8 px-2 rounded-lg border border-border bg-background text-xs text-foreground outline-none focus:ring-1 focus:ring-ring w-28",children:voe.map(u=>s.jsx("option",{value:u.value,children:u.label},u.value))}),s.jsx("input",{value:a.handle,onChange:u=>o(l,{handle:u.target.value}),placeholder:"@handle or ID",className:"flex-1 h-8 px-2 rounded-lg border border-border bg-background text-xs text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring"}),s.jsx("button",{onClick:()=>r(l),className:"p-1 rounded text-muted-foreground hover:text-destructive transition-colors",children:s.jsx(Ht,{className:"w-3.5 h-3.5"})})]},l))})]})}const iv=()=>({name:"",email:"",phone:"",role:"member",password:"",channels:[],createAuthUser:!0}),lv=()=>({display_name:"",agent_identifier:"",agent_model:""});function T4({view:e,onViewChange:t}={}){const n=yp(),r=_p(),[o,a]=x.useState("table"),l=e??o,u=te=>{a(te),t==null||t(te)},d=r?"cards":l,{data:f,isLoading:m}=Rd({limit:200}),p=(f==null?void 0:f.data)??[],g=p7(),y=r3(),b=l7(),[w,N]=x.useState("all"),[k,j]=x.useState(""),[C,S]=x.useState({}),[E,P]=x.useState(null),[D,I]=x.useState(1),[z,K]=x.useState(25),[q,H]=x.useState(null),[B,R]=x.useState(null),[M,F]=x.useState(iv()),[L,A]=x.useState(lv()),[O,U]=x.useState(null),[V,$]=x.useState(""),[Y,X]=x.useState(""),[ne,ie]=x.useState(""),[J,re]=x.useState([]),ce=x.useMemo(()=>{var Ce,Ze;let te=[...p];if(w!=="all"&&(te=te.filter(at=>at.actor_type===w)),(Ce=C.status)!=null&&Ce.length){const at=C.status.includes("active"),oe=C.status.includes("inactive");at&&!oe&&(te=te.filter(ke=>ke.is_active)),oe&&!at&&(te=te.filter(ke=>!ke.is_active))}if((Ze=C.role)!=null&&Ze.length&&(te=te.filter(at=>at.role&&C.role.includes(at.role))),k){const at=k.toLowerCase();te=te.filter(oe=>oe.display_name.toLowerCase().includes(at)||(oe.email??"").toLowerCase().includes(at)||(oe.phone??"").toLowerCase().includes(at)||(oe.agent_identifier??"").toLowerCase().includes(at))}return E&&te.sort((at,oe)=>{const ke=String(at[E.key]??""),ue=String(oe[E.key]??"");return E.dir==="asc"?ke.localeCompare(ue):ue.localeCompare(ke)}),te},[p,w,k,C,E]);x.useEffect(()=>{I(1)},[w,k,C,E]);const fe=ce.slice((D-1)*z,D*z),pe=p.filter(te=>te.actor_type==="human").length,ye=p.filter(te=>te.actor_type==="agent").length,Ne=[{key:"status",label:"Status",options:[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"}]},{key:"role",label:"Role",options:[{value:"owner",label:"Owner"},{value:"admin",label:"Admin"},{value:"member",label:"Member"}]}],Oe=[{key:"display_name",label:"Name"},{key:"email",label:"Email"},{key:"actor_type",label:"Type"},{key:"created_at",label:"Created"}],Xe=(te,Ce)=>{S(Ze=>{const at={...Ze};return Ce.length===0?delete at[te]:at[te]=Ce,at})},Le=te=>{P(Ce=>(Ce==null?void 0:Ce.key)===te?{key:te,dir:Ce.dir==="asc"?"desc":"asc"}:{key:te,dir:"asc"})},st=async()=>{if(!(!M.name.trim()||!M.email.trim()))try{if(M.createAuthUser&&M.password)await b.mutateAsync({name:M.name.trim(),email:M.email.trim(),password:M.password,role:M.role});else{const te={};M.channels.length>0&&(te.contact_channels=M.channels.filter(Ce=>Ce.handle.trim())),await g.mutateAsync({actor_type:"human",display_name:M.name.trim(),email:M.email.trim(),phone:M.phone.trim()||void 0,role:M.role,metadata:te})}R(null),F(iv()),de({title:"Human actor created"})}catch(te){de({title:"Error",description:te instanceof Error?te.message:"Failed to create",variant:"destructive"})}},Nt=async()=>{if(L.display_name.trim())try{await g.mutateAsync({actor_type:"agent",display_name:L.display_name.trim(),agent_identifier:L.agent_identifier.trim()||void 0,agent_model:L.agent_model.trim()||void 0,metadata:{}}),R(null),A(lv()),de({title:"Agent registered"})}catch(te){de({title:"Error",description:te instanceof Error?te.message:"Failed to register",variant:"destructive"})}},ge=te=>{U(te.id),ie(te.display_name),$(te.phone??""),X(te.role??"member"),re(_u(te.metadata))},De=async()=>{if(O)try{const te={};J.length>0&&(te.contact_channels=J.filter(Ce=>Ce.handle.trim())),await y.mutateAsync({id:O,display_name:ne.trim(),phone:V.trim()||null,role:Y||null,metadata:te}),U(null),de({title:"Actor updated"})}catch(te){de({title:"Error",description:te instanceof Error?te.message:"Failed to update",variant:"destructive"})}},$e=te=>{H(Ce=>Ce===te?null:te)},et=async te=>{try{await y.mutateAsync({id:te.id,is_active:!te.is_active}),de({title:te.is_active?"Actor deactivated":"Actor activated"})}catch(Ce){de({title:"Error",description:Ce instanceof Error?Ce.message:"Failed",variant:"destructive"})}},tt=({label:te,sortKey:Ce})=>s.jsx("th",{onClick:()=>Le(Ce),className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors select-none",children:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[te,(E==null?void 0:E.key)===Ce?E.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}):null]})}),ht="w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";return s.jsxs("div",{className:"-mx-6 -my-6 flex flex-col",children:[!e&&s.jsx("div",{className:"flex items-center justify-end px-6 pt-4 pb-2",children:s.jsxs("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[s.jsx("button",{onClick:()=>u("table"),className:`p-1.5 rounded-lg text-sm transition-all ${l==="table"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.jsx(Da,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>u("cards"),className:`p-1.5 rounded-lg text-sm transition-all ${l==="cards"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.jsx(jc,{className:"w-4 h-4"})})]})}),s.jsx("div",{className:"flex items-center gap-1 px-6 pt-4 pb-2",children:[{key:"all",label:"All",count:p.length},{key:"human",label:"Humans",count:pe,icon:ja},{key:"agent",label:"Agents",count:ye,icon:zn}].map(te=>s.jsxs("button",{onClick:()=>N(te.key),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold transition-colors ${w===te.key?"bg-primary/15 text-primary":"bg-muted/50 text-muted-foreground hover:text-foreground"}`,children:["icon"in te&&te.icon&&s.jsx(te.icon,{className:"w-3 h-3"}),te.label,s.jsx("span",{className:"text-[10px] opacity-60",children:te.count})]},te.key))}),s.jsx(Ks,{searchValue:k,onSearchChange:j,searchPlaceholder:"Search actors...",filters:Ne,activeFilters:C,onFilterChange:Xe,onClearFilters:()=>S({}),sortOptions:Oe,currentSort:E,onSortChange:Le,onAdd:()=>R(w==="agent"?"agent":"human"),addLabel:w==="agent"?"Register Agent":"Add Human",entityType:"actors"}),s.jsxs("div",{className:"px-4 md:px-6 pb-8 space-y-3 mt-1",children:[s.jsxs(mn,{children:[B==="human"&&s.jsxs(We.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"p-4 rounded-xl border border-border bg-muted/30 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider",children:"New Human Actor"}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:M.createAuthUser,onChange:te=>F(Ce=>({...Ce,createAuthUser:te.target.checked})),className:"rounded"}),"Create login account"]})})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{value:M.name,onChange:te=>F(Ce=>({...Ce,name:te.target.value})),placeholder:"Jane Smith",className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Email ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{type:"email",value:M.email,onChange:te=>F(Ce=>({...Ce,email:te.target.value})),placeholder:"jane@company.com",className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Phone"}),s.jsx("input",{value:M.phone,onChange:te=>F(Ce=>({...Ce,phone:te.target.value})),placeholder:"+1 (555) 123-4567",className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),s.jsxs("select",{value:M.role,onChange:te=>F(Ce=>({...Ce,role:te.target.value})),className:`${ht} cursor-pointer`,children:[s.jsx("option",{value:"member",children:"Member"}),s.jsx("option",{value:"admin",children:"Admin"}),(n==null?void 0:n.role)==="owner"&&s.jsx("option",{value:"owner",children:"Owner"})]})]})]}),M.createAuthUser&&s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Password ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{type:"password",value:M.password,onChange:te=>F(Ce=>({...Ce,password:te.target.value})),placeholder:"Min. 8 characters",className:ht})]})}),s.jsx(av,{channels:M.channels,onChange:te=>F(Ce=>({...Ce,channels:te}))}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:st,disabled:g.isPending||b.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:g.isPending||b.isPending?"Creating...":"Create Human Actor"}),s.jsx("button",{onClick:()=>{R(null),F(iv())},className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]}),B==="agent"&&s.jsxs(We.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"p-4 rounded-xl border border-border bg-muted/30 space-y-4",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider",children:"Register Agent"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Display Name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{value:L.display_name,onChange:te=>A(Ce=>({...Ce,display_name:te.target.value})),placeholder:"Outreach Bot",className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Identifier"}),s.jsx("input",{value:L.agent_identifier,onChange:te=>A(Ce=>({...Ce,agent_identifier:te.target.value})),placeholder:"custom/outreach-v1",className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Model"}),s.jsx("input",{value:L.agent_model,onChange:te=>A(Ce=>({...Ce,agent_model:te.target.value})),placeholder:"claude-sonnet-4-20250514",className:ht})]})]}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:Nt,disabled:g.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:g.isPending?"Registering...":"Register Agent"}),s.jsx("button",{onClick:()=>{R(null),A(lv())},className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]})]}),m?s.jsx("div",{className:"space-y-2",children:[...Array(5)].map((te,Ce)=>s.jsx("div",{className:"h-14 bg-muted/50 rounded-xl animate-pulse"},Ce))}):ce.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[s.jsx(ja,{className:"w-8 h-8 mb-3 opacity-30"}),s.jsx("p",{className:"text-sm",children:"No actors found."}),(k||Object.keys(C).length>0||w!=="all")&&s.jsx("button",{onClick:()=>{j(""),S({}),N("all")},className:"mt-2 text-xs text-primary font-semibold hover:underline",children:"Clear filters"})]}):d==="table"?s.jsxs("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx(tt,{label:"Name",sortKey:"display_name"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Type"}),s.jsx(tt,{label:"Email",sortKey:"email"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Contact"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Role / Model"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Status"}),s.jsx("th",{className:"px-2 py-3 w-20"})]})}),s.jsx("tbody",{children:fe.map((te,Ce)=>s.jsx(be.Fragment,{children:O===te.id?s.jsx("tr",{children:s.jsxs("td",{colSpan:7,className:"p-4 bg-muted/20 border-b border-border last:border-0",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider mb-3",children:"Edit Actor"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),s.jsx("input",{value:ne,onChange:Ze=>ie(Ze.target.value),className:ht})]}),te.actor_type==="human"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Phone"}),s.jsx("input",{value:V,onChange:Ze=>$(Ze.target.value),placeholder:"+1 (555) 123-4567",className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),s.jsxs("select",{value:Y,onChange:Ze=>X(Ze.target.value),className:`${ht} cursor-pointer`,children:[s.jsx("option",{value:"member",children:"Member"}),s.jsx("option",{value:"admin",children:"Admin"}),(n==null?void 0:n.role)==="owner"&&s.jsx("option",{value:"owner",children:"Owner"})]})]})]})]}),te.actor_type==="human"&&s.jsx(av,{channels:J,onChange:re}),s.jsxs("div",{className:"flex gap-2 pt-3",children:[s.jsx("button",{onClick:De,disabled:y.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:y.isPending?"Saving...":"Save Changes"}),s.jsx("button",{onClick:()=>U(null),className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("tr",{className:`border-b border-border last:border-0 hover:bg-primary/5 transition-colors group cursor-pointer ${Ce%2===1?"bg-surface-sunken/30":""}`,onClick:()=>$e(te.id),children:[s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(H2,{actor:te}),s.jsxs("div",{children:[s.jsx("span",{className:"font-semibold text-foreground",children:te.display_name}),te.user_id&&s.jsx("span",{className:"ml-1.5 text-[10px] font-mono bg-muted text-muted-foreground px-1 py-0.5 rounded",children:"auth"})]})]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded border capitalize ${B2[te.actor_type]}`,children:te.actor_type})}),s.jsx("td",{className:"px-4 py-3 text-muted-foreground text-xs",children:te.email||"—"}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[te.phone&&s.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(Gu,{className:"w-3 h-3"})," ",te.phone]}),_u(te.metadata).slice(0,2).map((Ze,at)=>s.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(os,{className:"w-3 h-3"})," ",Ze.channel_type,": ",Ze.handle]},at)),!te.phone&&_u(te.metadata).length===0&&s.jsx("span",{className:"text-xs text-muted-foreground/40",children:"—"})]})}),s.jsx("td",{className:"px-4 py-3",children:te.actor_type==="human"?te.role?s.jsx("span",{className:`text-[11px] font-semibold px-2 py-0.5 rounded-full border ${Oh[te.role]??Oh.member}`,children:z2[te.role]??te.role}):s.jsx("span",{className:"text-xs text-muted-foreground/40",children:"—"}):s.jsxs("div",{className:"text-xs text-muted-foreground",children:[te.agent_identifier&&s.jsx("div",{className:"font-mono",children:te.agent_identifier}),te.agent_model&&s.jsx("div",{className:"text-muted-foreground/60",children:te.agent_model}),!te.agent_identifier&&!te.agent_model&&"—"]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-semibold px-1.5 py-0.5 rounded border ${te.is_active?"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30":"bg-muted text-muted-foreground border-border"}`,children:[s.jsx(yC,{className:"w-2.5 h-2.5"}),te.is_active?"Active":"Inactive"]})}),s.jsx("td",{className:"px-2 py-3",onClick:Ze=>Ze.stopPropagation(),children:s.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[s.jsx("button",{onClick:()=>$e(te.id),className:`p-1.5 rounded-lg transition-colors ${q===te.id?"text-primary bg-primary/10":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:"Permissions & Keys",children:s.jsx($s,{className:`w-3.5 h-3.5 transition-transform ${q===te.id?"rotate-90":""}`})}),s.jsx("button",{onClick:()=>ge(te),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors opacity-0 group-hover:opacity-100",title:"Edit",children:s.jsx(br,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>et(te),className:`p-1.5 rounded-lg transition-colors opacity-0 group-hover:opacity-100 ${te.is_active?"text-muted-foreground hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-green-600 hover:bg-green-500/10"}`,title:te.is_active?"Deactivate":"Activate",children:te.is_active?s.jsx(Iv,{className:"w-3.5 h-3.5"}):s.jsx(Lv,{className:"w-3.5 h-3.5"})})]})})]}),s.jsx(mn,{children:q===te.id&&s.jsx("tr",{children:s.jsx("td",{colSpan:7,children:s.jsx(W2,{actor:te,onClose:()=>H(null)})})})})]})},te.id))})]})}),s.jsx(hs,{page:D,pageSize:z,total:ce.length,onPageChange:I,onPageSizeChange:K,className:"px-4"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:fe.map((te,Ce)=>O===te.id?s.jsxs(We.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"col-span-full bg-card border border-border rounded-2xl p-4 space-y-4",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider",children:"Edit Actor"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),s.jsx("input",{value:ne,onChange:Ze=>ie(Ze.target.value),className:ht})]}),te.actor_type==="human"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Phone"}),s.jsx("input",{value:V,onChange:Ze=>$(Ze.target.value),className:ht})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),s.jsxs("select",{value:Y,onChange:Ze=>X(Ze.target.value),className:`${ht} cursor-pointer`,children:[s.jsx("option",{value:"member",children:"Member"}),s.jsx("option",{value:"admin",children:"Admin"}),(n==null?void 0:n.role)==="owner"&&s.jsx("option",{value:"owner",children:"Owner"})]})]})]})]}),te.actor_type==="human"&&s.jsx(av,{channels:J,onChange:re}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:De,disabled:y.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:y.isPending?"Saving...":"Save Changes"}),s.jsx("button",{onClick:()=>U(null),className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]},te.id):s.jsxs(We.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:Ce*.02},className:`bg-card border rounded-2xl p-4 hover:shadow-md transition-all group relative ${te.is_active?"border-border hover:border-primary/20":"border-border/50 opacity-60"}`,children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(H2,{actor:te,size:"lg"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("p",{className:"font-display font-bold text-foreground",children:te.display_name}),s.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded border capitalize ${B2[te.actor_type]}`,children:te.actor_type}),te.user_id&&s.jsx("span",{className:"text-[10px] font-mono bg-muted text-muted-foreground px-1 py-0.5 rounded",children:"auth"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:te.email||(te.agent_identifier??"No email")})]})]}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("button",{onClick:()=>$e(te.id),className:`p-1.5 rounded-lg transition-colors ${q===te.id?"text-primary bg-primary/10":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:"Permissions & Keys",children:s.jsx($s,{className:`w-3.5 h-3.5 transition-transform ${q===te.id?"rotate-90":""}`})}),s.jsx("button",{onClick:()=>ge(te),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors md:opacity-0 md:group-hover:opacity-100",children:s.jsx(br,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>et(te),className:`p-1.5 rounded-lg transition-colors md:opacity-0 md:group-hover:opacity-100 ${te.is_active?"text-muted-foreground hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-green-600 hover:bg-green-500/10"}`,children:te.is_active?s.jsx(Iv,{className:"w-3.5 h-3.5"}):s.jsx(Lv,{className:"w-3.5 h-3.5"})})]})]}),s.jsxs("div",{className:"mt-3 flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[te.actor_type==="human"&&te.role&&s.jsx("span",{className:`text-[11px] font-semibold px-2 py-0.5 rounded-full border ${Oh[te.role]??Oh.member}`,children:z2[te.role]??te.role}),te.actor_type==="agent"&&te.agent_model&&s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:te.agent_model}),s.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-semibold px-1.5 py-0.5 rounded border ${te.is_active?"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30":"bg-muted text-muted-foreground border-border"}`,children:[s.jsx(yC,{className:"w-2.5 h-2.5"}),te.is_active?"Active":"Inactive"]})]}),te.created_at&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(te.created_at).toLocaleDateString()})]}),(te.phone||_u(te.metadata).length>0)&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-border flex flex-wrap gap-x-3 gap-y-1",children:[te.phone&&s.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(Gu,{className:"w-3 h-3"})," ",te.phone]}),_u(te.metadata).map((Ze,at)=>s.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(os,{className:"w-3 h-3"})," ",Ze.channel_type,": ",Ze.handle]},at))]}),s.jsx(mn,{children:q===te.id&&s.jsx("div",{className:"mt-3 -mx-4 -mb-4",children:s.jsx(W2,{actor:te,onClose:()=>H(null)})})})]},te.id))}),s.jsx(hs,{page:D,pageSize:z,total:ce.length,onPageChange:I,onPageSizeChange:K})]})]})]})}const cv={smtp:{label:"SMTP",icon:ho,fields:[{key:"host",label:"SMTP Host",type:"text",placeholder:"smtp.gmail.com",required:!0},{key:"port",label:"Port",type:"number",placeholder:"587",required:!0},{key:"secure",label:"Use TLS/SSL",type:"boolean"},{key:"auth.user",label:"Username",type:"text",placeholder:"user@example.com",required:!0},{key:"auth.pass",label:"Password",type:"password",placeholder:"********",required:!0}]},resend:{label:"Resend",icon:Lr,fields:[{key:"api_key",label:"API Key",type:"password",placeholder:"re_...",required:!0}]},postmark:{label:"Postmark",icon:Lr,fields:[{key:"server_token",label:"Server Token",type:"password",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",required:!0},{key:"message_stream",label:"Message Stream",type:"text",placeholder:"outbound"}]},sendgrid:{label:"SendGrid",icon:Lr,fields:[{key:"api_key",label:"API Key",type:"password",placeholder:"SG....",required:!0}]},ses:{label:"Amazon SES",icon:Lr,fields:[{key:"region",label:"AWS Region",type:"text",placeholder:"us-east-1",required:!0},{key:"access_key_id",label:"Access Key ID",type:"text",placeholder:"AKIA...",required:!0},{key:"secret_access_key",label:"Secret Access Key",type:"password",placeholder:"••••••••",required:!0}]},mailgun:{label:"Mailgun",icon:Lr,fields:[{key:"api_key",label:"API Key",type:"password",placeholder:"key-...",required:!0},{key:"domain",label:"Domain",type:"text",placeholder:"mg.example.com",required:!0},{key:"url",label:"API URL",type:"text",placeholder:"https://api.mailgun.net"}]}},lm={slack:{label:"Slack",icon:os,fields:[{key:"webhook_url",label:"Webhook URL",type:"password",placeholder:"https://hooks.slack.com/services/...",required:!0},{key:"channel",label:"Default Channel",type:"text",placeholder:"#general"}]}},Mi="w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",l1="px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 disabled:opacity-40",W0="px-3 py-1.5 rounded-lg border border-border text-sm font-medium text-foreground hover:bg-muted";function H0(e,t){return t.split(".").reduce((n,r)=>n==null?void 0:n[r],e)}function Gm(e,t,n){const r={...e},o=t.split(".");if(o.length===1)r[o[0]]=n;else{const[a,...l]=o;r[a]=Gm(r[a]??{},l.join("."),n)}return r}function U2(e){return typeof e=="string"&&/^\*+$/.test(e)}function c1({fields:e,values:t,onChange:n}){const[r,o]=x.useState(new Set);return s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e.map(a=>{const l=H0(t,a.key);if(a.type==="boolean")return s.jsxs("label",{className:"flex items-center gap-2 col-span-1 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:!!l,onChange:f=>n(Gm(t,a.key,f.target.checked)),className:"rounded border-border"}),s.jsx("span",{className:"text-sm text-foreground",children:a.label})]},a.key);const u=a.type==="password",d=r.has(a.key);return s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:a.label}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:u&&!d?"password":a.type==="number"?"number":"text",value:l!=null?String(l):"",placeholder:a.placeholder,onChange:f=>{const m=a.type==="number"?Number(f.target.value)||0:f.target.value;n(Gm(t,a.key,m))},className:`${Mi} ${u?"pr-9":""}`}),u&&s.jsx("button",{type:"button",onClick:()=>o(f=>{const m=new Set(f);return m.has(a.key)?m.delete(a.key):m.add(a.key),m}),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(d5,{className:"w-4 h-4"}):s.jsx(f5,{className:"w-4 h-4"})})]})]},a.key)})})}function woe(){var j;const{data:e,isLoading:t}=B7(),n=W7(),[r,o]=x.useState("smtp"),[a,l]=x.useState(""),[u,d]=x.useState(""),[f,m]=x.useState({}),[p,g]=x.useState(!1),[y,b]=x.useState({});x.useEffect(()=>{if(!e)return;const C=e.email_provider;if(C){o(C.provider??"smtp"),l(C.from_name??""),d(C.from_email??"");const S=C.config??{};m(S),b(S)}},[e]);const w=async()=>{var P;const C=((P=cv[r])==null?void 0:P.fields)??[];let S={...f};for(const D of C)if(D.type==="password"){const I=H0(S,D.key),z=H0(y,D.key);U2(I)&&U2(z)&&(S=Gm(S,D.key,void 0))}const E=D=>{const I={};for(const[z,K]of Object.entries(D))if(K!==void 0)if(typeof K=="object"&&K!==null&&!Array.isArray(K)){const q=E(K);Object.keys(q).length>0&&(I[z]=q)}else I[z]=K;return I};S=E(S);try{await n.mutateAsync({provider:r,config:S,from_name:a,from_email:u}),g(!1),de({title:"Email provider saved"})}catch(D){de({title:"Error",description:D.message??"Failed to save.",variant:"destructive"})}},N=!!(e!=null&&e.email_provider),k=((j=cv[r])==null?void 0:j.fields)??[];return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-blue-500/15 flex items-center justify-center",children:s.jsx(ho,{className:"w-5 h-5 text-blue-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Email Provider"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure outbound email delivery for CRM emails and sequences."})]}),s.jsx("div",{className:"ml-auto",children:N?s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-emerald-500 font-medium",children:[s.jsx(Gt,{className:"w-3.5 h-3.5"})," Configured"]}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"Not configured"})})]}),t?s.jsx("div",{className:"text-sm text-muted-foreground py-4",children:"Loading..."}):s.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Provider"}),s.jsx("select",{value:r,onChange:C=>{o(C.target.value),m({}),g(!0)},className:Mi,children:Object.entries(cv).map(([C,S])=>s.jsx("option",{value:C,children:S.label},C))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"From Name"}),s.jsx("input",{type:"text",value:a,placeholder:"CRMy",onChange:C=>{l(C.target.value),g(!0)},className:Mi})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"From Email"}),s.jsx("input",{type:"email",value:u,placeholder:"noreply@example.com",onChange:C=>{d(C.target.value),g(!0)},className:Mi})]})]}),s.jsxs("div",{className:"border-t border-border pt-4",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3",children:"Connection"}),s.jsx(c1,{fields:k,values:f,onChange:C=>{m(C),g(!0)}})]}),s.jsx("div",{className:"flex justify-end pt-2",children:s.jsx("button",{onClick:w,disabled:n.isPending,className:l1,children:n.isPending?"Saving...":"Save Email Provider"})})]})]})}function Noe({channel:e,onDelete:t}){const n=e.id,r=q7(n),o=K7(n),[a,l]=x.useState(!1),[u,d]=x.useState(!1),[f,m]=x.useState({}),[p,g]=x.useState(""),y=e.provider,b=lm[y],w=(b==null?void 0:b.icon)??os;x.useEffect(()=>{a&&(m(e.config??{}),g(e.name??""))},[a,e]);const N=async()=>{try{await r.mutateAsync({is_active:!e.is_active})}catch{de({title:"Error",description:"Failed to update channel.",variant:"destructive"})}},k=async()=>{try{await r.mutateAsync({is_default:!e.is_default})}catch{de({title:"Error",description:"Failed to update channel.",variant:"destructive"})}},j=async()=>{try{await r.mutateAsync({name:p,config:f}),l(!1),de({title:"Channel updated"})}catch{de({title:"Error",description:"Failed to update channel.",variant:"destructive"})}},C=async()=>{try{await o.mutateAsync(),t(),de({title:"Channel deleted"})}catch{de({title:"Error",description:"Failed to delete channel.",variant:"destructive"})}};return s.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-muted flex items-center justify-center",children:s.jsx(w,{className:"w-4 h-4 text-muted-foreground"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:e.name}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border uppercase",children:(b==null?void 0:b.label)??y}),e.is_default&&s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-500 border border-amber-500/20 font-semibold",children:"Default"})]})}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:k,title:e.is_default?"Remove as default":"Set as default",className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-amber-500 transition-colors",children:s.jsx(lF,{className:`w-4 h-4 ${e.is_default?"fill-amber-500 text-amber-500":""}`})}),s.jsx("button",{onClick:N,title:e.is_active?"Deactivate":"Activate",className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground transition-colors",children:e.is_active?s.jsx(Lv,{className:"w-4 h-4 text-emerald-500"}):s.jsx(Iv,{className:"w-4 h-4 text-destructive"})}),s.jsx("button",{onClick:()=>l(!a),title:"Edit",className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(br,{className:"w-4 h-4"})}),u?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:C,className:"text-xs font-semibold text-destructive hover:underline",children:"Delete"}),s.jsx("button",{onClick:()=>d(!1),className:"p-1 text-muted-foreground hover:text-foreground",children:s.jsx(Ht,{className:"w-3.5 h-3.5"})})]}):s.jsx("button",{onClick:()=>d(!0),title:"Delete",className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-destructive transition-colors",children:s.jsx(Bn,{className:"w-4 h-4"})})]})]}),s.jsx(mn,{children:a&&s.jsx(We.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:s.jsxs("div",{className:"px-4 py-4 border-t border-border bg-muted/20 space-y-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Channel Name"}),s.jsx("input",{type:"text",value:p,onChange:S=>g(S.target.value),className:Mi})]}),b&&s.jsx(c1,{fields:b.fields,values:f,onChange:m}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>l(!1),className:W0,children:"Cancel"}),s.jsx("button",{onClick:j,disabled:r.isPending,className:l1,children:r.isPending?"Saving...":"Save"})]})]})})})]})}function joe(){const{data:e,isLoading:t}=H7(),n=U7(),[r,o]=x.useState(!1),[a,l]=x.useState(""),[u,d]=x.useState("slack"),[f,m]=x.useState({}),[p,g]=x.useState(!1),y=(e==null?void 0:e.data)??[],b=async()=>{try{await n.mutateAsync({name:a,provider:u,config:f,is_default:p}),o(!1),l(""),m({}),g(!1),de({title:"Channel created"})}catch(w){de({title:"Error",description:w.message??"Failed to create channel.",variant:"destructive"})}};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-purple-500/15 flex items-center justify-center",children:s.jsx(Lr,{className:"w-5 h-5 text-purple-500"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Notification Channels"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure Slack, Teams, or other notification channels for workflows and alerts."})]}),s.jsxs("button",{onClick:()=>o(!r),className:`${W0} flex items-center gap-1.5`,children:[r?s.jsx(Ht,{className:"w-4 h-4"}):s.jsx(or,{className:"w-4 h-4"}),r?"Cancel":"Add Channel"]})]}),s.jsx(mn,{children:r&&s.jsx(We.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:s.jsxs("div",{className:"rounded-lg border border-primary/30 bg-card p-4 space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Provider"}),s.jsx("select",{value:u,onChange:w=>{d(w.target.value),m({})},className:Mi,children:Object.entries(lm).map(([w,N])=>s.jsx("option",{value:w,children:N.label},w))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Channel Name"}),s.jsx("input",{type:"text",value:a,placeholder:"e.g. Slack - Sales Alerts",onChange:w=>l(w.target.value),className:Mi})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer h-9",children:[s.jsx("input",{type:"checkbox",checked:p,onChange:w=>g(w.target.checked),className:"rounded border-border"}),s.jsx("span",{className:"text-sm text-foreground",children:"Set as default"})]})})]}),lm[u]&&s.jsx(c1,{fields:lm[u].fields,values:f,onChange:m}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>o(!1),className:W0,children:"Cancel"}),s.jsx("button",{onClick:b,disabled:n.isPending||!a.trim(),className:l1,children:n.isPending?"Creating...":"Create Channel"})]})]})})}),t?s.jsx("div",{className:"text-sm text-muted-foreground py-4",children:"Loading..."}):y.length===0&&!r?s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:[s.jsx(os,{className:"w-8 h-8 text-muted-foreground/30 mx-auto mb-2"}),s.jsx("p",{className:"text-sm font-semibold text-foreground mb-1",children:"No channels configured"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a Slack or other notification channel to enable workflow notifications."})]}):s.jsx("div",{className:"space-y-2",children:y.map(w=>s.jsx(Noe,{channel:w,onDelete:()=>{}},w.id))})]})}function Coe(){return s.jsxs("div",{className:"space-y-8 max-w-3xl",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-1",children:"Messaging"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure email delivery and notification channels for your CRM."})]}),s.jsx(woe,{}),s.jsx("div",{className:"border-t border-border"}),s.jsx(joe,{})]})}const koe=[{icon:WL,label:"Profile",path:"/settings",roles:["member","admin","owner"]},{icon:ZL,label:"Appearance",path:"/settings/appearance",roles:["member","admin","owner"]},{icon:p5,label:"API Keys",path:"/settings/api-keys",roles:["member","admin","owner"]},{icon:YL,label:"Webhooks",path:"/settings/webhooks",roles:["admin","owner"]},{icon:QL,label:"Custom Fields",path:"/settings/custom-fields",roles:["admin","owner"]},{icon:ja,label:"Agents",path:"/settings/actors",roles:["admin","owner"]},{icon:cF,label:"Registries",path:"/settings/registries",roles:["admin","owner"]},{icon:os,label:"Messaging",path:"/settings/messaging",roles:["admin","owner"]},{icon:zn,label:"Local Agent",path:"/settings/agent",roles:["admin","owner"]},{icon:u5,label:"Database",path:"/settings/database",roles:["admin","owner"]}];function Soe(){return s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground",children:[s.jsx(p5,{className:"w-8 h-8 opacity-25"}),s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Access restricted"}),s.jsx("p",{className:"text-xs",children:"You don't have permission to view this section."})]})}function ai({roles:e,children:t}){const n=yp();return!n||!e.includes(n.role)?s.jsx(Soe,{}):s.jsx(s.Fragment,{children:t})}function _oe(){const e=yp(),t=h7(),[n,r]=x.useState((e==null?void 0:e.name)??""),[o,a]=x.useState((e==null?void 0:e.email)??""),[l,u]=x.useState(""),[d,f]=x.useState(""),[m,p]=x.useState(""),[g,y]=x.useState(!1),[b,w]=x.useState(!1),N=(e==null?void 0:e.role)==="owner",k=(e==null?void 0:e.role)==="admin"||N,j="w-full h-10 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring transition-colors",C="w-full h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-sm text-foreground",S=async()=>{if(d&&d!==m){de({title:"Passwords do not match",variant:"destructive"});return}if(d&&d.length<8){de({title:"Password too short",description:"Must be at least 8 characters.",variant:"destructive"});return}try{const P={};if(n.trim()&&n.trim()!==(e==null?void 0:e.name)&&(P.name=n.trim()),o.trim()&&o.trim()!==(e==null?void 0:e.email)&&(P.email=o.trim()),d&&(P.current_password=l,P.new_password=d),Object.keys(P).length===0){de({title:"No changes to save"});return}const D=await t.mutateAsync(P),I=localStorage.getItem("crmy_user");if(I){const z=JSON.parse(I);localStorage.setItem("crmy_user",JSON.stringify({...z,name:D.name,email:D.email}))}u(""),f(""),p(""),w(!0),setTimeout(()=>w(!1),3e3),de({title:"Profile updated"})}catch(P){de({title:"Failed to update profile",description:P instanceof Error?P.message:"Please try again.",variant:"destructive"})}},E={owner:"bg-accent/15 text-accent border-accent/30",admin:"bg-primary/15 text-primary border-primary/30",member:"bg-muted text-muted-foreground border-border"};return s.jsxs("div",{className:"max-w-lg",children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-1",children:"Profile"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Update your name, email, and password."}),s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Role"}),s.jsx("div",{className:C,children:s.jsx("span",{className:`text-[11px] font-semibold px-2 py-0.5 rounded-full border capitalize ${E[(e==null?void 0:e.role)??"member"]??E.member}`,children:(e==null?void 0:e.role)??"—"})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Name"}),s.jsx("input",{value:n,onChange:P=>r(P.target.value),className:j,placeholder:"Your full name"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2",children:["Email",!k&&s.jsx("span",{className:"text-[10px] text-muted-foreground/60 normal-case font-normal",children:"contact an admin to change"})]}),k?s.jsx("input",{type:"email",value:o,onChange:P=>a(P.target.value),className:j,placeholder:"you@example.com"}):s.jsx("div",{className:C,children:e==null?void 0:e.email})]}),s.jsxs("div",{className:"pt-2 border-t border-border space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Change Password"}),s.jsx("button",{onClick:()=>y(P=>!P),className:"text-xs text-primary hover:underline",children:g?"Cancel":"Change"})]}),g&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Current Password"}),s.jsx("input",{type:"password",value:l,onChange:P=>u(P.target.value),className:j,placeholder:"Enter current password"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"New Password"}),s.jsx("input",{type:"password",value:d,onChange:P=>f(P.target.value),className:j,placeholder:"Min. 8 characters"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Confirm New Password"}),s.jsx("input",{type:"password",value:m,onChange:P=>p(P.target.value),className:j,placeholder:"Repeat new password",onKeyDown:P=>P.key==="Enter"&&S()}),d&&m&&d!==m&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:"Passwords do not match"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[s.jsx("button",{onClick:S,disabled:t.isPending,className:"px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:t.isPending?"Saving…":"Save Changes"}),b&&s.jsxs("span",{className:"text-xs text-success flex items-center gap-1",children:[s.jsx(Gt,{className:"w-3.5 h-3.5"})," Saved"]})]})]})]})}function Eoe(){const{darkVariant:e,setDarkVariant:t}=lt(),n=[{key:"warm",label:"Warm Brown",description:"Dark theme with warm, earthy brown tones",preview:"bg-[hsl(15,25%,7%)]"},{key:"charcoal",label:"Charcoal",description:"Dark theme with cool, navy-charcoal tones",preview:"bg-[hsl(220,16%,8%)]"}];return s.jsxs("div",{children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-2",children:"Appearance"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Choose your preferred dark mode style."}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-md",children:n.map(r=>s.jsxs("button",{onClick:()=>t(r.key),className:`flex flex-col gap-3 p-4 rounded-xl border-2 transition-all text-left ${e===r.key?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/30"}`,children:[s.jsx("div",{className:`w-full h-16 rounded-lg ${r.preview} border border-border/30 flex items-end p-2`,children:s.jsxs("div",{className:"flex gap-1",children:[s.jsx("div",{className:"w-6 h-2 rounded-full bg-[hsl(24,95%,53%)]"}),s.jsx("div",{className:"w-4 h-2 rounded-full bg-white/20"})]})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:r.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r.description})]})]},r.key))})]})}const U0=[{label:"General",scopes:[{value:"read",label:"Read all"},{value:"write",label:"Write all"}]},{label:"Contacts",scopes:[{value:"contacts:read",label:"Read"},{value:"contacts:write",label:"Write"}]},{label:"Accounts",scopes:[{value:"accounts:read",label:"Read"},{value:"accounts:write",label:"Write"}]},{label:"Opportunities",scopes:[{value:"opportunities:read",label:"Read"},{value:"opportunities:write",label:"Write"}]},{label:"Activities",scopes:[{value:"activities:read",label:"Read"},{value:"activities:write",label:"Write"}]},{label:"Assignments",scopes:[{value:"assignments:create",label:"Create"},{value:"assignments:update",label:"Update"}]},{label:"Context",scopes:[{value:"context:read",label:"Read"},{value:"context:write",label:"Write"}]}],Poe=U0.flatMap(e=>e.scopes);function Toe(){const{data:e,isLoading:t}=e3(),{data:n}=Rd({is_active:!0,limit:100}),r=t3(),o=f7(),a=n3(),[l,u]=x.useState("table"),[d,f]=x.useState(""),[m,p]=x.useState(""),[g,y]=x.useState("all"),[b,w]=x.useState({key:"created_at",dir:"desc"}),[N,k]=x.useState(1),[j,C]=x.useState(!1),[S,E]=x.useState(""),[P,D]=x.useState(["read","write"]),[I,z]=x.useState(""),[K,q]=x.useState(""),[H,B]=x.useState(null),[R,M]=x.useState(null),[F,L]=x.useState(null),[A,O]=x.useState(null),[U,V]=x.useState(""),[$,Y]=x.useState(""),[X,ne]=x.useState(""),[ie,J]=x.useState([]),[re,ce]=x.useState(null),fe=10,pe=(e==null?void 0:e.data)??[],ye=(n==null?void 0:n.data)??[],Ne=x.useMemo(()=>{let oe=[...pe];if(d){const ke=d.toLowerCase();oe=oe.filter(ue=>{var yt,Mt;return((yt=ue.label)==null?void 0:yt.toLowerCase().includes(ke))||((Mt=ue.actor_name)==null?void 0:Mt.toLowerCase().includes(ke))})}return m&&(oe=oe.filter(ke=>{var ue;return(ue=ke.scopes)==null?void 0:ue.includes(m)})),g==="used"&&(oe=oe.filter(ke=>!!ke.last_used_at)),g==="never"&&(oe=oe.filter(ke=>!ke.last_used_at)),oe.sort((ke,ue)=>{const yt=b.key==="label"?ke.label??"":ke[b.key]??"",Mt=b.key==="label"?ue.label??"":ue[b.key]??"";return b.dir==="asc"?yt.localeCompare(Mt):Mt.localeCompare(yt)}),oe},[pe,d,m,g,b]),Oe=Ne.slice((N-1)*fe,N*fe),Xe=()=>{C(!1),E(""),D(["read","write"]),z(""),q("")},Le=async()=>{if(!(!S.trim()||P.length===0))try{const oe={label:S.trim(),scopes:P};I&&(oe.actor_id=I),K&&(oe.expires_at=new Date(K).toISOString());const ke=await r.mutateAsync(oe);B(ke.key??null),Xe(),de({title:"API key created",description:"Copy and store it safely — it won't be shown again."})}catch(oe){de({title:"Failed to create API key",description:oe instanceof Error?oe.message:"Please try again.",variant:"destructive"})}},st=async oe=>{try{await a.mutateAsync(oe),M(null),de({title:"API key revoked"})}catch(ke){de({title:"Failed to revoke key",description:ke instanceof Error?ke.message:"Please try again.",variant:"destructive"})}},Nt=oe=>{O(oe.id),V(oe.label??""),Y(oe.actor_id??""),ne(oe.expires_at?new Date(oe.expires_at).toISOString().slice(0,10):""),L(null)},ge=()=>{O(null)},De=async()=>{if(!(!A||!U.trim()))try{const oe={id:A,label:U.trim()};oe.actor_id=$||null,oe.expires_at=X?new Date(X).toISOString():null,await o.mutateAsync(oe),O(null),de({title:"API key updated"})}catch(oe){de({title:"Failed to update API key",description:oe instanceof Error?oe.message:"Please try again.",variant:"destructive"})}},$e=oe=>{ce(oe.id),J(oe.scopes??[])},et=async oe=>{try{await o.mutateAsync({id:oe,scopes:ie}),ce(null),de({title:"Scopes updated"})}catch(ke){de({title:"Failed to update scopes",description:ke instanceof Error?ke.message:"Please try again.",variant:"destructive"})}},tt=oe=>D(ke=>ke.includes(oe)?ke.filter(ue=>ue!==oe):[...ke,oe]),ht=oe=>J(ke=>ke.includes(oe)?ke.filter(ue=>ue!==oe):[...ke,oe]),te=oe=>oe?new Date(oe).toLocaleDateString():null,Ce=oe=>{if(!oe)return"Never used";const ke=Math.floor((Date.now()-new Date(oe).getTime())/864e5);return ke===0?"Used today":ke===1?"Used yesterday":ke<30?`Used ${ke}d ago`:`Used ${te(oe)}`},Ze=({sk:oe,label:ke})=>s.jsxs("button",{onClick:()=>{w(ue=>ue.key===oe?{key:oe,dir:ue.dir==="asc"?"desc":"asc"}:{key:oe,dir:"desc"}),k(1)},className:"flex items-center gap-1 text-xs font-mono text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors",children:[ke,b.key===oe&&(b.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}))]}),at=({name:oe,type:ke})=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-sm text-foreground truncate",children:oe}),s.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border capitalize flex-shrink-0 ${ke==="agent"?"bg-blue-500/10 text-blue-500 border-blue-500/30":"bg-amber-500/10 text-amber-600 border-amber-500/30"}`,children:ke})]});return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground",children:"API Keys"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage access tokens for the CRMy REST API and MCP server."})]}),H&&s.jsxs("div",{className:"p-4 rounded-xl border border-success/30 bg-success/5",children:[s.jsx("p",{className:"text-xs font-semibold text-success mb-2",children:"Your new API key — copy it now, it won't be shown again:"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"flex-1 text-xs font-mono bg-background rounded px-2 py-1.5 border border-border truncate",children:H}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText(H),de({title:"Copied!"})},className:"p-1.5 rounded-lg hover:bg-muted transition-colors flex-shrink-0",children:s.jsx(c5,{className:"w-3.5 h-3.5 text-muted-foreground"})})]}),s.jsx("button",{onClick:()=>B(null),className:"mt-2 text-xs text-muted-foreground hover:text-foreground",children:"Dismiss"})]}),j&&s.jsxs("div",{className:"p-5 rounded-xl border border-border bg-card space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Create new API key"}),s.jsx("button",{onClick:Xe,className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground transition-colors",children:s.jsx(Ht,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:["Label ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{value:S,onChange:oe=>E(oe.target.value),placeholder:"e.g. Production, CI/CD",className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",onKeyDown:oe=>oe.key==="Enter"&&Le(),autoFocus:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:"Bind to Actor (optional)"}),s.jsxs("select",{value:I,onChange:oe=>z(oe.target.value),className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground outline-none focus:ring-1 focus:ring-ring",children:[s.jsx("option",{value:"",children:"No actor binding"}),ye.map(oe=>s.jsxs("option",{value:oe.id,children:[oe.display_name," (",oe.actor_type,")"]},oe.id))]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:"Expires (optional)"}),s.jsx("input",{type:"date",value:K,onChange:oe=>q(oe.target.value),className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground outline-none focus:ring-1 focus:ring-ring"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:["Scopes ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3",children:U0.map(oe=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"text-xs font-semibold text-muted-foreground",children:oe.label}),oe.scopes.map(ke=>s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:P.includes(ke.value),onChange:()=>tt(ke.value),className:"w-3.5 h-3.5 rounded border-border accent-primary"}),s.jsx("span",{className:"text-xs text-foreground",children:ke.label})]},ke.value))]},oe.label))})]}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:Le,disabled:!S.trim()||P.length===0||r.isPending,className:"px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:r.isPending?"Creating…":"Create Key"}),s.jsx("button",{onClick:Xe,className:"px-4 py-2 rounded-lg border border-border text-sm text-muted-foreground hover:bg-muted transition-colors",children:"Cancel"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("div",{className:"relative flex-1 min-w-0 max-w-xs",children:[s.jsx(Oi,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx("input",{value:d,onChange:oe=>{f(oe.target.value),k(1)},placeholder:"Search keys…",className:"w-full h-9 pl-9 pr-3 rounded-xl border border-border bg-card text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30 transition-all"})]}),s.jsxs("select",{value:m,onChange:oe=>{p(oe.target.value),k(1)},className:"h-9 px-3 rounded-xl border border-border bg-card text-sm text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30 flex-shrink-0",children:[s.jsx("option",{value:"",children:"All scopes"}),Poe.map(oe=>s.jsx("option",{value:oe.value,children:oe.label},oe.value))]}),s.jsxs("select",{value:g,onChange:oe=>{y(oe.target.value),k(1)},className:"h-9 px-3 rounded-xl border border-border bg-card text-sm text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30 flex-shrink-0",children:[s.jsx("option",{value:"all",children:"All usage"}),s.jsx("option",{value:"used",children:"Used"}),s.jsx("option",{value:"never",children:"Never used"})]}),s.jsxs("select",{value:`${b.key}_${b.dir}`,onChange:oe=>{const[ke,ue]=oe.target.value.split("_");w({key:ke,dir:ue}),k(1)},className:"h-9 px-3 rounded-xl border border-border bg-card text-sm text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30 flex-shrink-0",children:[s.jsx("option",{value:"created_at_desc",children:"Newest first"}),s.jsx("option",{value:"created_at_asc",children:"Oldest first"}),s.jsx("option",{value:"label_asc",children:"Label A–Z"}),s.jsx("option",{value:"label_desc",children:"Label Z–A"}),s.jsx("option",{value:"last_used_at_desc",children:"Recently used"}),s.jsx("option",{value:"last_used_at_asc",children:"Least used"})]}),s.jsxs("div",{className:"flex items-center border border-border rounded-xl overflow-hidden flex-shrink-0",children:[s.jsx("button",{onClick:()=>u("table"),className:`p-2 transition-colors ${l==="table"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:s.jsx(Da,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>u("card"),className:`p-2 transition-colors ${l==="card"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:s.jsx(jc,{className:"w-4 h-4"})})]}),s.jsxs("button",{onClick:()=>C(!0),disabled:j,className:"h-9 px-4 flex items-center gap-1.5 rounded-xl bg-gradient-to-r from-primary to-primary/80 text-primary-foreground text-sm font-semibold hover:shadow-md transition-all flex-shrink-0 press-scale disabled:opacity-50",children:[s.jsx(or,{className:"w-4 h-4"})," New Key"]})]}),t?s.jsx("div",{className:"space-y-2",children:[...Array(3)].map((oe,ke)=>s.jsx("div",{className:"h-14 bg-muted/50 rounded-2xl animate-pulse"},ke))}):Ne.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[s.jsx(Iu,{className:"w-8 h-8 text-muted-foreground/30 mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:pe.length===0?"No API keys yet. Create one to get started.":"No keys match your filters."}),pe.length===0&&s.jsx("button",{onClick:()=>C(!0),className:"mt-3 text-xs text-primary hover:underline",children:"Create your first key"})]}):l==="table"?s.jsx("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:s.jsx(Ze,{sk:"label",label:"Label"})}),s.jsx("th",{className:"text-left px-4 py-3 hidden md:table-cell text-xs font-display font-semibold text-muted-foreground",children:"Scopes"}),s.jsx("th",{className:"text-left px-4 py-3 hidden lg:table-cell text-xs font-display font-semibold text-muted-foreground",children:"Actor"}),s.jsx("th",{className:"text-left px-4 py-3 hidden sm:table-cell text-xs font-display font-semibold text-muted-foreground",children:s.jsx(Ze,{sk:"last_used_at",label:"Last Used"})}),s.jsx("th",{className:"text-left px-4 py-3 hidden lg:table-cell text-xs font-display font-semibold text-muted-foreground",children:s.jsx(Ze,{sk:"created_at",label:"Created"})}),s.jsx("th",{className:"px-2 py-3 w-20"})]})}),s.jsx("tbody",{children:Oe.map((oe,ke)=>s.jsx(be.Fragment,{children:A===oe.id?s.jsx("tr",{className:"border-b border-border",children:s.jsxs("td",{colSpan:6,className:"p-4 bg-muted/20",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider mb-3",children:"Edit API Key"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Label ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{value:U,onChange:ue=>V(ue.target.value),className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",autoFocus:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Bind to Actor"}),s.jsxs("select",{value:$,onChange:ue=>Y(ue.target.value),className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground outline-none focus:ring-1 focus:ring-ring",children:[s.jsx("option",{value:"",children:"No actor binding"}),ye.map(ue=>s.jsxs("option",{value:ue.id,children:[ue.display_name," (",ue.actor_type,")"]},ue.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Expires"}),s.jsx("input",{type:"date",value:X,onChange:ue=>ne(ue.target.value),className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground outline-none focus:ring-1 focus:ring-ring"})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:De,disabled:!U.trim()||o.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:o.isPending?"Saving…":"Save Changes"}),s.jsx("button",{onClick:ge,className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]})}):s.jsxs(s.Fragment,{children:[s.jsxs("tr",{className:`border-b border-border last:border-0 hover:bg-primary/5 transition-colors group cursor-pointer ${ke%2===1?"bg-surface-sunken/30":""}`,onClick:()=>{L(ue=>ue===oe.id?null:oe.id),ce(null)},children:[s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Iu,{className:"w-3.5 h-3.5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-foreground",children:oe.label}),s.jsxs("p",{className:"text-[10px] font-mono text-muted-foreground",children:[oe.id.slice(0,14),"…"]})]})]})}),s.jsx("td",{className:"px-4 py-3 hidden md:table-cell",onClick:ue=>ue.stopPropagation(),children:s.jsxs("button",{onClick:()=>{L(ue=>ue===oe.id?null:oe.id),ce(null)},className:"flex items-center gap-1.5 hover:text-foreground transition-colors",children:[s.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border font-mono",children:[(oe.scopes??[]).length," scope",(oe.scopes??[]).length!==1?"s":""]}),s.jsx($s,{className:`w-3 h-3 text-muted-foreground transition-transform ${F===oe.id?"rotate-90":""}`})]})}),s.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:oe.actor_name?s.jsx(at,{name:oe.actor_name,type:oe.actor_type}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),s.jsx("td",{className:"px-4 py-3 hidden sm:table-cell",children:s.jsx("span",{className:`text-xs ${oe.last_used_at?"text-foreground":"text-muted-foreground"}`,children:Ce(oe.last_used_at)})}),s.jsxs("td",{className:"px-4 py-3 hidden lg:table-cell",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:te(oe.created_at)}),oe.expires_at&&s.jsxs("p",{className:`text-[10px] mt-0.5 ${new Date(oe.expires_at)<new Date?"text-destructive":"text-muted-foreground"}`,children:["Exp: ",te(oe.expires_at)]})]}),s.jsx("td",{className:"px-2 py-3",onClick:ue=>ue.stopPropagation(),children:s.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[R===oe.id?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Revoke?"}),s.jsx("button",{onClick:()=>st(oe.id),className:"px-2 py-1 rounded bg-destructive text-destructive-foreground text-xs font-semibold hover:bg-destructive/90 transition-colors",children:"Yes"}),s.jsx("button",{onClick:()=>M(null),className:"px-2 py-1 rounded bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors",children:"No"})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>Nt(oe),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors opacity-0 group-hover:opacity-100",title:"Edit",children:s.jsx(br,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>M(oe.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100",title:"Revoke",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]}),s.jsx("button",{onClick:()=>{L(ue=>ue===oe.id?null:oe.id),ce(null)},className:`p-1.5 rounded-lg transition-colors ${F===oe.id?"text-primary bg-primary/10":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:s.jsx($s,{className:`w-3.5 h-3.5 transition-transform ${F===oe.id?"rotate-90":""}`})})]})})]}),s.jsx(mn,{children:F===oe.id&&s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"p-0 border-b border-border last:border-0",children:s.jsx(We.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:s.jsx("div",{className:"px-4 py-4 bg-muted/20",children:s.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Scopes"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border",children:(oe.scopes??[]).length})]}),re!==oe.id?s.jsx("button",{onClick:()=>$e(oe),className:"text-xs font-semibold text-primary hover:underline",children:"Edit"}):s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>et(oe.id),disabled:o.isPending,className:"px-2.5 py-1 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40",children:o.isPending?"Saving…":"Save"}),s.jsx("button",{onClick:()=>ce(null),className:"px-2.5 py-1 rounded-lg border border-border text-xs font-semibold text-muted-foreground hover:text-foreground",children:"Cancel"})]})]}),s.jsx("div",{className:"px-4 py-3",children:re===oe.id?s.jsx("div",{className:"space-y-3",children:U0.map(ue=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:ue.label}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ue.scopes.map(yt=>{const Mt=ie.includes(yt.value);return s.jsx("button",{onClick:()=>ht(yt.value),className:`px-2.5 py-1 rounded-md text-xs font-medium border transition-colors ${Mt?"bg-primary/10 text-primary border-primary/30":"bg-muted/50 border-border text-muted-foreground hover:text-foreground"}`,children:yt.label},yt.value)})})]},ue.label))}):s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(oe.scopes??[]).length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:"No scopes assigned."}):(oe.scopes??[]).map(ue=>s.jsx("span",{className:"px-2 py-0.5 rounded-md text-[11px] font-medium bg-primary/10 text-primary border border-primary/20",children:ue},ue))})})]})})})})})})]})},oe.id))})]})})}):s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Oe.map(oe=>s.jsxs("div",{className:"bg-card border border-border rounded-xl p-4 space-y-3 hover:shadow-md transition-shadow group",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Iu,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:oe.label}),s.jsxs("p",{className:"text-[10px] font-mono text-muted-foreground",children:[oe.id.slice(0,14),"…"]})]})]}),R===oe.id?s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("button",{onClick:()=>st(oe.id),className:"px-2 py-0.5 rounded bg-destructive text-destructive-foreground text-[10px] font-semibold",children:"Revoke"}),s.jsx("button",{onClick:()=>M(null),className:"px-2 py-0.5 rounded bg-muted text-muted-foreground text-[10px]",children:"✕"})]}):s.jsx("button",{onClick:()=>M(oe.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100 flex-shrink-0",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:(oe.scopes??[]).map(ke=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-muted text-muted-foreground border border-border",children:ke},ke))}),s.jsxs("div",{className:"space-y-1.5 pt-2 border-t border-border",children:[oe.actor_name&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground w-16 flex-shrink-0",children:"Actor"}),s.jsx(at,{name:oe.actor_name,type:oe.actor_type})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground w-16 flex-shrink-0",children:"Last used"}),s.jsx("span",{className:`text-xs ${oe.last_used_at?"text-foreground":"text-muted-foreground"}`,children:Ce(oe.last_used_at)})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground w-16 flex-shrink-0",children:"Created"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:te(oe.created_at)})]}),oe.expires_at&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground w-16 flex-shrink-0",children:"Expires"}),s.jsx("span",{className:`text-xs ${new Date(oe.expires_at)<new Date?"text-destructive font-medium":"text-foreground"}`,children:te(oe.expires_at)})]})]})]},oe.id))}),s.jsx(hs,{page:N,pageSize:fe,total:Ne.length,onPageChange:k})]})}function Moe({webhookId:e}){const{data:t,isLoading:n}=T7(e,{limit:10}),r=(t==null?void 0:t.data)??[];return n?s.jsx("div",{className:"py-2 pl-4",children:s.jsx("div",{className:"h-6 w-32 bg-muted/50 rounded animate-pulse"})}):r.length===0?s.jsx("p",{className:"text-xs text-muted-foreground py-2 pl-4",children:"No deliveries yet."}):s.jsx("div",{className:"pl-4 space-y-1 py-2",children:r.map(o=>{const a=o.status_code>=200&&o.status_code<300,l=o.status==="failed";return s.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[s.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded font-semibold ${a?"bg-emerald-500/15 text-emerald-500":l?"bg-destructive/15 text-destructive":"bg-warning/15 text-warning"}`,children:o.status_code??o.status}),s.jsx("span",{className:"text-muted-foreground font-mono",children:o.event_type??o.event??"—"}),o.duration_ms!=null&&s.jsxs("span",{className:"text-muted-foreground",children:[o.duration_ms,"ms"]}),s.jsx("span",{className:"text-muted-foreground ml-auto",children:o.created_at?new Date(o.created_at).toLocaleString():""})]},o.id)})})}function Aoe(){const{data:e,isLoading:t}=ZB(),n=JB(),r=e7(),[o,a]=x.useState(!1),[l,u]=x.useState(""),[d,f]=x.useState(null),m=(e==null?void 0:e.data)??[],p=async()=>{if(l.trim())try{await n.mutateAsync({url:l.trim(),events:["contact.created","opportunity.updated"]}),u(""),a(!1),de({title:"Webhook created"})}catch{de({title:"Error",description:"Failed to create webhook.",variant:"destructive"})}},g=async y=>{try{await r.mutateAsync(y),de({title:"Webhook deleted"})}catch{de({title:"Error",description:"Failed to delete webhook.",variant:"destructive"})}};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground",children:"Webhooks"}),s.jsxs("button",{onClick:()=>a(!0),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 transition-colors",children:[s.jsx(or,{className:"w-3.5 h-3.5"})," New Webhook"]})]}),o&&s.jsxs("div",{className:"mb-4 p-4 rounded-xl border border-border bg-muted/30 flex items-center gap-2 max-w-lg",children:[s.jsx("input",{value:l,onChange:y=>u(y.target.value),placeholder:"https://your-server.com/webhook",className:"flex-1 h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",onKeyDown:y=>y.key==="Enter"&&p()}),s.jsx("button",{onClick:p,disabled:!l.trim()||n.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:"Create"}),s.jsx("button",{onClick:()=>{a(!1),u("")},className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold",children:"Cancel"})]}),s.jsx("div",{className:"space-y-2 max-w-2xl",children:t?s.jsx("div",{className:"space-y-2",children:[...Array(2)].map((y,b)=>s.jsx("div",{className:"h-14 bg-muted/50 rounded-xl animate-pulse"},b))}):m.length===0?s.jsx("p",{className:"text-sm text-muted-foreground py-4",children:"No webhooks configured."}):m.map(y=>s.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 cursor-pointer hover:bg-muted/30 transition-colors",onClick:()=>f(d===y.id?null:y.id),children:[s.jsx($s,{className:`w-3.5 h-3.5 text-muted-foreground transition-transform ${d===y.id?"rotate-90":""}`}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:y.url}),y.events&&s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:y.events.map(b=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-muted text-muted-foreground",children:b},b))})]}),s.jsx("button",{onClick:b=>{b.stopPropagation(),g(y.id)},className:"p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]}),d===y.id&&s.jsxs("div",{className:"border-t border-border bg-muted/10",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider px-4 pt-2",children:"Recent deliveries"}),s.jsx(Moe,{webhookId:y.id})]})]},y.id))})]})}const Doe=[{key:"contact",label:"Contact"},{key:"account",label:"Account"},{key:"opportunity",label:"Opportunity"},{key:"use_case",label:"Use Case"},{key:"activity",label:"Activity"}],u1=[{value:"text",label:"Text",color:"bg-blue-500/10 text-blue-400 border-blue-500/20"},{value:"number",label:"Number",color:"bg-purple-500/10 text-purple-400 border-purple-500/20"},{value:"boolean",label:"Checkbox",color:"bg-green-500/10 text-green-400 border-green-500/20"},{value:"date",label:"Date",color:"bg-orange-500/10 text-orange-400 border-orange-500/20"},{value:"select",label:"Dropdown",color:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20"},{value:"multi_select",label:"Multi-select",color:"bg-pink-500/10 text-pink-400 border-pink-500/20"}];function Roe(e){var t;return((t=u1.find(n=>n.value===e))==null?void 0:t.color)??"bg-muted text-muted-foreground border-border"}function Ooe(e){var t;return((t=u1.find(n=>n.value===e))==null?void 0:t.label)??e}function q2(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Ioe(){const[e,t]=x.useState("contact"),[n,r]=x.useState(!1),[o,a]=x.useState(""),[l,u]=x.useState("text"),[d,f]=x.useState(!1),[m,p]=x.useState(""),[g,y]=x.useState(null),[b,w]=x.useState(""),[N,k]=x.useState(!1),[j,C]=x.useState(""),[S,E]=x.useState(null),{data:P,isLoading:D}=Mc(e),I=t7(),z=n7(),K=r7(),q=(P==null?void 0:P.fields)??[],H=async()=>{if(o.trim())try{const A=(l==="select"||l==="multi_select")&&m.trim()?m.split(",").map(O=>O.trim()).filter(Boolean):void 0;await I.mutateAsync({label:o.trim(),field_name:q2(o),field_type:l,object_type:e,required:d,...A?{options:A}:{}}),a(""),u("text"),f(!1),p(""),r(!1),de({title:"Custom field created"})}catch{de({title:"Error",description:"Failed to create field.",variant:"destructive"})}},B=L=>{y(L.id),w(L.label??""),k(L.is_required??!1),C(Array.isArray(L.options)?L.options.join(", "):""),r(!1)},R=async()=>{if(!(!g||!b.trim()))try{const L=q.find(U=>U.id===g),O=((L==null?void 0:L.field_type)==="select"||(L==null?void 0:L.field_type)==="multi_select")&&j.trim()?j.split(",").map(U=>U.trim()).filter(Boolean):void 0;await z.mutateAsync({id:g,label:b.trim(),required:N,...O!==void 0?{options:O}:{}}),y(null),de({title:"Custom field updated"})}catch{de({title:"Error",description:"Failed to update field.",variant:"destructive"})}},M=async L=>{try{await K.mutateAsync(L),E(null),de({title:"Custom field deleted"})}catch{de({title:"Error",description:"Failed to delete field.",variant:"destructive"})}},F="w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground",children:"Custom Fields"}),s.jsxs("button",{onClick:()=>{r(!0),y(null),E(null)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 transition-colors",children:[s.jsx(or,{className:"w-3.5 h-3.5"})," New Field"]})]}),s.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:"Define custom fields per object type. Values are type-checked and required fields are enforced by the server."}),s.jsx("div",{className:"flex gap-1 mb-5 overflow-x-auto no-scrollbar bg-muted rounded-xl p-0.5",children:Doe.map(L=>s.jsx("button",{onClick:()=>{t(L.key),r(!1),y(null),E(null)},className:`px-3 py-1.5 rounded-lg text-xs font-semibold whitespace-nowrap transition-all ${e===L.key?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:L.label},L.key))}),n&&s.jsxs("div",{className:"mb-5 p-4 rounded-xl border border-border bg-muted/30 space-y-3 max-w-lg",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider",children:"New Field"}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Label ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{value:o,onChange:L=>a(L.target.value),placeholder:"e.g. Preferred Language",className:F,onKeyDown:L=>L.key==="Enter"&&H()}),o.trim()&&s.jsxs("p",{className:"text-[11px] text-muted-foreground font-mono",children:["key: ",q2(o)]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Type"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:u1.map(L=>s.jsx("button",{onClick:()=>u(L.value),className:`px-2.5 py-1 rounded-md text-xs font-medium border transition-colors ${l===L.value?L.color:"bg-muted/50 border-border text-muted-foreground hover:text-foreground"}`,children:L.label},L.value))})]}),(l==="select"||l==="multi_select")&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Options ",s.jsx("span",{className:"text-muted-foreground font-normal",children:"(comma-separated)"})]}),s.jsx("input",{value:m,onChange:L=>p(L.target.value),placeholder:"Option A, Option B, Option C",className:F})]}),s.jsxs("button",{type:"button",onClick:()=>f(!d),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg border text-xs font-semibold transition-all ${d?"bg-primary/10 border-primary/40 text-primary":"bg-muted border-border text-muted-foreground hover:text-foreground"}`,children:[s.jsx("span",{className:`w-3.5 h-3.5 rounded-sm border flex items-center justify-center flex-shrink-0 transition-all ${d?"bg-primary border-primary":"border-border"}`,children:d&&s.jsx("svg",{viewBox:"0 0 10 8",className:"w-2.5 h-2.5 fill-none stroke-white stroke-[1.5]",children:s.jsx("polyline",{points:"1,4 4,7 9,1"})})}),"Required field"]}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:H,disabled:!o.trim()||I.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:I.isPending?"Creating…":"Create Field"}),s.jsx("button",{onClick:()=>{r(!1),a(""),f(!1),p("")},className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]}),s.jsx("div",{className:"space-y-2 max-w-2xl",children:D?s.jsx("div",{className:"space-y-2",children:[...Array(3)].map((L,A)=>s.jsx("div",{className:"h-14 bg-muted/50 rounded-xl animate-pulse"},A))}):q.length===0?s.jsx("p",{className:"text-sm text-muted-foreground py-4",children:"No custom fields for this object type yet."}):q.map(L=>s.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:g===L.id?s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider",children:"Edit Field"}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx("input",{value:b,onChange:A=>w(A.target.value),className:F})]}),(L.field_type==="select"||L.field_type==="multi_select")&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Options ",s.jsx("span",{className:"text-muted-foreground font-normal",children:"(comma-separated)"})]}),s.jsx("input",{value:j,onChange:A=>C(A.target.value),placeholder:"Option A, Option B",className:F})]}),s.jsxs("button",{type:"button",onClick:()=>k(!N),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg border text-xs font-semibold transition-all ${N?"bg-primary/10 border-primary/40 text-primary":"bg-muted border-border text-muted-foreground hover:text-foreground"}`,children:[s.jsx("span",{className:`w-3.5 h-3.5 rounded-sm border flex items-center justify-center flex-shrink-0 transition-all ${N?"bg-primary border-primary":"border-border"}`,children:N&&s.jsx("svg",{viewBox:"0 0 10 8",className:"w-2.5 h-2.5 fill-none stroke-white stroke-[1.5]",children:s.jsx("polyline",{points:"1,4 4,7 9,1"})})}),"Required field"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:R,disabled:!b.trim()||z.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:z.isPending?"Saving…":"Save"}),s.jsx("button",{onClick:()=>y(null),className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]})]}):S===L.id?s.jsxs("div",{className:"p-4 flex items-center gap-3 flex-wrap",children:[s.jsxs("p",{className:"text-sm text-foreground flex-1",children:["Delete ",s.jsx("strong",{children:L.label}),"? Existing values will remain but won't be validated."]}),s.jsx("button",{onClick:()=>M(L.id),disabled:K.isPending,className:"px-3 py-1.5 rounded-lg bg-destructive text-destructive-foreground text-xs font-semibold hover:bg-destructive/90 disabled:opacity-40 transition-colors",children:K.isPending?"Deleting…":"Confirm Delete"}),s.jsx("button",{onClick:()=>E(null),className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold",children:"Cancel"})]}):s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:L.label}),L.is_required&&s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded border bg-destructive/10 text-destructive border-destructive/20 font-semibold",children:"Required"})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[s.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border font-mono font-medium ${Roe(L.field_type)}`,children:Ooe(L.field_type)}),s.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:L.field_key}),Array.isArray(L.options)&&L.options.length>0&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[L.options.slice(0,3).join(", "),L.options.length>3?` +${L.options.length-3}`:""]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("button",{onClick:()=>{B(L),E(null)},className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:s.jsx(br,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>{E(L.id),y(null)},className:"p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]})},L.id))})]})}function Loe(){const{data:e,isLoading:t}=c7(),n=u7(),r=d7(),[o,a]=x.useState(!1),[l,u]=x.useState(""),[d,f]=x.useState("idle"),[m,p]=x.useState(""),[g,y]=x.useState(""),b=e,w=async()=>{f("testing"),p(""),y("");try{await n.mutateAsync(l),f("ok")}catch(k){f("fail"),p(k instanceof Error?k.message:"Connection failed")}},N=async()=>{try{const k=await r.mutateAsync(l);y(k.message),a(!1),u(""),f("idle"),de({title:"Database config saved",description:k.message})}catch(k){de({title:"Error",description:k instanceof Error?k.message:"Failed to save",variant:"destructive"})}};return s.jsxs("div",{children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-2",children:"Database Connection"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["View and update the PostgreSQL database connection. Changes are saved to ",s.jsx("code",{className:"text-xs font-mono bg-muted px-1 py-0.5 rounded",children:".env.db"})," and take effect after a server restart."]}),s.jsxs("div",{className:"space-y-4 max-w-lg",children:[t?s.jsx("div",{className:"space-y-2",children:[...Array(3)].map((k,j)=>s.jsx("div",{className:"h-10 bg-muted/50 rounded-lg animate-pulse"},j))}):s.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card space-y-3",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Current Connection"}),[{label:"Host",value:(b==null?void 0:b.host)||"—"},{label:"Port",value:(b==null?void 0:b.port)||"—"},{label:"Database",value:(b==null?void 0:b.database)||"—"},{label:"User",value:(b==null?void 0:b.user)||"—"},{label:"SSL",value:(b==null?void 0:b.ssl)||"default"}].map(k=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground w-20 flex-shrink-0",children:k.label}),s.jsx("code",{className:"text-sm font-mono text-foreground",children:k.value})]},k.label))]}),g&&s.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-xl border border-success/30 bg-success/5 text-sm text-success",children:[s.jsx(Gt,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:g})]}),o?s.jsxs("div",{className:"space-y-3 p-4 rounded-xl border border-border bg-muted/30",children:[s.jsx("p",{className:"text-xs font-display font-semibold text-muted-foreground uppercase tracking-wider",children:"New Connection String"}),s.jsx("input",{value:l,onChange:k=>{u(k.target.value),f("idle"),p("")},placeholder:"postgresql://user:password@host:5432/dbname",className:"w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground font-mono outline-none focus:ring-1 focus:ring-ring"}),d==="ok"&&s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-success",children:[s.jsx(Gt,{className:"w-3.5 h-3.5"})," Connection successful"]}),d==="fail"&&s.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-destructive",children:[s.jsx(Vs,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"})," ",m]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("button",{onClick:w,disabled:!l.trim()||n.isPending,className:"px-3 py-1.5 rounded-lg border border-border text-xs font-semibold text-muted-foreground hover:text-foreground hover:border-foreground/30 disabled:opacity-40 transition-colors",children:n.isPending?"Testing...":"Test Connection"}),s.jsx("button",{onClick:N,disabled:!l.trim()||d!=="ok"||r.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:r.isPending?"Saving...":"Save"}),s.jsx("button",{onClick:()=>{a(!1),u(""),f("idle"),p("")},className:"px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs font-semibold hover:bg-muted/80 transition-colors",children:"Cancel"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Test the connection before saving. Save is only enabled after a successful test."})]}):s.jsxs("button",{onClick:()=>{a(!0),y(""),f("idle")},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 transition-colors",children:[s.jsx(u5,{className:"w-3.5 h-3.5"})," Edit Connection"]})]})]})}const Foe=[{type_name:"note",label:"Note"},{type_name:"transcript",label:"Transcript"},{type_name:"summary",label:"Summary"},{type_name:"research",label:"Research"},{type_name:"preference",label:"Preference"},{type_name:"decision",label:"Decision"},{type_name:"relationship_map",label:"Relationship Map"},{type_name:"agent_reasoning",label:"Agent Reasoning"},{type_name:"sentiment_analysis",label:"Sentiment Analysis"},{type_name:"commitment",label:"Commitment"},{type_name:"next_step",label:"Next Step"},{type_name:"stakeholder",label:"Stakeholder"},{type_name:"deal_risk",label:"Deal Risk"},{type_name:"competitive_intel",label:"Competitive Intel"},{type_name:"objection",label:"Objection"},{type_name:"meeting_notes",label:"Meeting Notes"},{type_name:"key_fact",label:"Key Fact"}],$oe=[{type_name:"outreach_email",label:"Email Sent",category:"outreach"},{type_name:"outreach_call",label:"Call Made",category:"outreach"},{type_name:"outreach_sms",label:"SMS Sent",category:"outreach"},{type_name:"outreach_social",label:"Social Touch",category:"outreach"},{type_name:"meeting_scheduled",label:"Meeting Scheduled",category:"meeting"},{type_name:"meeting_held",label:"Meeting Held",category:"meeting"},{type_name:"meeting_cancelled",label:"Meeting Cancelled",category:"meeting"},{type_name:"proposal_drafted",label:"Proposal Drafted",category:"proposal"},{type_name:"proposal_sent",label:"Proposal Sent",category:"proposal"},{type_name:"proposal_viewed",label:"Proposal Viewed",category:"proposal"},{type_name:"contract_sent",label:"Contract Sent",category:"contract"},{type_name:"contract_signed",label:"Contract Signed",category:"contract"},{type_name:"note_added",label:"Note Added",category:"internal"},{type_name:"research_completed",label:"Research Completed",category:"internal"},{type_name:"stage_change",label:"Stage Changed",category:"lifecycle"},{type_name:"field_update",label:"Field Updated",category:"lifecycle"},{type_name:"task_completed",label:"Task Completed",category:"internal"},{type_name:"handoff_initiated",label:"Handoff Initiated",category:"handoff"},{type_name:"handoff_accepted",label:"Handoff Accepted",category:"handoff"}];function Voe(){const{data:e,isLoading:t}=l3(),n=j7(),r=C7(),{data:o,isLoading:a}=i3(),l=w7(),u=N7(),[d,f]=x.useState(""),[m,p]=x.useState(""),[g,y]=x.useState(""),[b,w]=x.useState(""),[N,k]=x.useState(""),[j,C]=x.useState(""),[S,E]=x.useState(""),[P,D]=x.useState(null),I=(e==null?void 0:e.data)??[],z=(o==null?void 0:o.data)??[],K=async()=>{if(!(!d.trim()||!m.trim()))try{await n.mutateAsync({type_name:d.trim(),label:m.trim(),description:g.trim()||void 0}),f(""),p(""),y(""),de({title:"Context type added"})}catch{de({title:"Error",variant:"destructive"})}},q=async()=>{if(!(!b.trim()||!N.trim()||!j.trim()))try{await l.mutateAsync({type_name:b.trim(),label:N.trim(),category:j.trim(),description:S.trim()||void 0}),w(""),k(""),C(""),E(""),de({title:"Activity type added"})}catch{de({title:"Error",variant:"destructive"})}},H="h-8 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";return s.jsxs("div",{className:"max-w-2xl",children:[s.jsx("h2",{className:"font-display font-bold text-lg text-foreground mb-1",children:"Type Registries"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Context types classify the knowledge your agents store — objections, next steps, competitive intel, and more. Activity types categorize what happened — calls, emails, meetings, handoffs. Both registries come with system defaults and can be extended with custom types to match your workflow."}),s.jsxs("div",{className:"mb-8",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Context Types"}),s.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Each context entry is tagged with a type. Types control how context is prioritized in briefings, how confidence decays over time, and which entries the extraction pipeline produces automatically."}),s.jsxs("div",{className:"mb-3",children:[s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"System"}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:Foe.map(B=>s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-medium bg-muted text-muted-foreground",children:B.label},B.type_name))})]}),s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Custom"}),s.jsx("div",{className:"space-y-1.5 mb-3 mt-1.5",children:t?s.jsx("div",{className:"h-8 bg-muted/50 rounded animate-pulse"}):I.length===0?s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No custom context types added yet."}):I.map(B=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border bg-card",children:[s.jsx("span",{className:"text-sm font-medium text-foreground flex-1",children:B.label||B.type_name}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:B.type_name}),B.description&&s.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline truncate max-w-[200px]",children:B.description}),s.jsx("button",{onClick:()=>{P===B.type_name?r.mutate(B.type_name,{onSuccess:()=>{de({title:"Removed"}),D(null)}}):(D(B.type_name),setTimeout(()=>D(null),3e3))},className:"p-1 rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",children:s.jsx(Bn,{className:"w-3 h-3"})})]},B.type_name))}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("input",{value:d,onChange:B=>f(B.target.value),placeholder:"type_name (slug)",className:`${H} w-36`}),s.jsx("input",{value:m,onChange:B=>p(B.target.value),placeholder:"Label",className:`${H} w-32`}),s.jsx("input",{value:g,onChange:B=>y(B.target.value),placeholder:"Description (optional)",className:`${H} flex-1 min-w-[120px]`}),s.jsxs("button",{onClick:K,disabled:!d.trim()||!m.trim()||n.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:[s.jsx(or,{className:"w-3 h-3 inline mr-1"}),"Add"]})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Activity Types"}),s.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Activities represent things that happened — calls made, emails sent, meetings held. Each type belongs to a category (outreach, meeting, proposal, contract, internal, lifecycle, handoff) which drives filtering, timeline grouping, and reporting."}),s.jsxs("div",{className:"mb-3",children:[s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"System"}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:$oe.map(B=>s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-medium bg-muted text-muted-foreground",children:[B.label,s.jsx("span",{className:"text-[9px] opacity-60",children:B.category})]},B.type_name))})]}),s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Custom"}),s.jsx("div",{className:"space-y-1.5 mb-3 mt-1.5",children:a?s.jsx("div",{className:"h-8 bg-muted/50 rounded animate-pulse"}):z.length===0?s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No custom activity types added yet."}):z.map(B=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border bg-card",children:[s.jsx("span",{className:"text-sm font-medium text-foreground flex-1",children:B.label||B.type_name}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:B.type_name}),B.category&&s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground",children:B.category}),s.jsx("button",{onClick:()=>{P===B.type_name?u.mutate(B.type_name,{onSuccess:()=>{de({title:"Removed"}),D(null)}}):(D(B.type_name),setTimeout(()=>D(null),3e3))},className:"p-1 rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",children:s.jsx(Bn,{className:"w-3 h-3"})})]},B.type_name))}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("input",{value:b,onChange:B=>w(B.target.value),placeholder:"type_name (slug)",className:`${H} w-36`}),s.jsx("input",{value:N,onChange:B=>k(B.target.value),placeholder:"Label",className:`${H} w-32`}),s.jsx("input",{value:j,onChange:B=>C(B.target.value),placeholder:"Category",className:`${H} w-28`}),s.jsx("input",{value:S,onChange:B=>E(B.target.value),placeholder:"Description (optional)",className:`${H} flex-1 min-w-[120px]`}),s.jsxs("button",{onClick:q,disabled:!b.trim()||!N.trim()||!j.trim()||l.isPending,className:"px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:bg-primary/90 disabled:opacity-40 transition-colors",children:[s.jsx(or,{className:"w-3 h-3 inline mr-1"}),"Add"]})]})]})]})}function zoe(){const e=Cr(),t=yp(),n=(t==null?void 0:t.role)??"member",r=koe.filter(a=>a.roles.includes(n)),{enabled:o}=kr();return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Settings",icon:ub,iconClassName:"text-muted-foreground",description:"Manage your account, team, and integrations."}),s.jsx("div",{className:"md:hidden flex gap-1 overflow-x-auto no-scrollbar px-4 pt-3 pb-1 border-b border-border",children:r.map(a=>{const l=a.path==="/settings"?e.pathname==="/settings":e.pathname.startsWith(a.path);return s.jsxs(hr,{to:a.path,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold whitespace-nowrap transition-colors ${l?"bg-primary/15 text-primary":"bg-muted text-muted-foreground"}`,children:[s.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label,a.path==="/settings/agent"&&s.jsx("span",{className:`w-2 h-2 rounded-full ${o?"bg-amber-500":"bg-muted-foreground/40"}`})]},a.path)})}),s.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[s.jsx("nav",{className:"hidden md:flex flex-col w-48 border-r border-border bg-muted p-2 gap-0.5",children:r.map(a=>{const l=a.path==="/settings"?e.pathname==="/settings":e.pathname.startsWith(a.path);return s.jsxs(hr,{to:a.path,className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors ${l?"bg-primary/15 text-primary":"text-foreground/60 hover:bg-muted hover:text-foreground"}`,children:[s.jsx(a.icon,{className:"w-4 h-4"}),a.label,a.path==="/settings/agent"&&s.jsx("span",{className:`ml-auto w-2 h-2 rounded-full ${o?"bg-amber-500":"bg-muted-foreground/40"}`})]},a.path)})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6 pb-20 md:pb-6",children:s.jsxs(rb,{children:[s.jsx(ft,{index:!0,element:s.jsx(_oe,{})}),s.jsx(ft,{path:"appearance",element:s.jsx(Eoe,{})}),s.jsx(ft,{path:"api-keys",element:s.jsx(Toe,{})}),s.jsx(ft,{path:"webhooks",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(Aoe,{})})}),s.jsx(ft,{path:"custom-fields",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(Ioe,{})})}),s.jsx(ft,{path:"registries",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(Voe,{})})}),s.jsx(ft,{path:"actors",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(T4,{})})}),s.jsx(ft,{path:"messaging",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(Coe,{})})}),s.jsx(ft,{path:"agent",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(yoe,{})})}),s.jsx(ft,{path:"database",element:s.jsx(ai,{roles:["admin","owner"],children:s.jsx(Loe,{})})})]})})]})]})}const Boe=()=>{const e=Cr();return x.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),s.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),s.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},Xm={urgent:"bg-destructive/15 text-destructive",high:"bg-orange-500/15 text-orange-500",normal:"bg-primary/10 text-primary",low:"bg-muted text-muted-foreground"},M4={pending:"bg-amber-500/15 text-amber-600",accepted:"bg-blue-500/15 text-blue-600",in_progress:"bg-violet-500/15 text-violet-600",blocked:"bg-destructive/15 text-destructive",completed:"bg-success/15 text-success",declined:"bg-muted text-muted-foreground",cancelled:"bg-muted text-muted-foreground"},Zm=["pending","accepted","in_progress","blocked"],Woe=[{key:"needs_attention",label:"Needs Attention"},{key:"delegated",label:"Delegated"},{key:"all",label:"All"}],Hoe=[{key:"status",label:"Status",options:[{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"completed",label:"Completed"},{value:"declined",label:"Declined"},{value:"cancelled",label:"Cancelled"}]},{key:"priority",label:"Priority",options:[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"normal",label:"Normal"},{value:"low",label:"Low"}]},{key:"assignment_type",label:"Type",options:[{value:"call",label:"Call"},{value:"draft",label:"Draft"},{value:"email",label:"Email"},{value:"follow_up",label:"Follow Up"},{value:"research",label:"Research"},{value:"review",label:"Review"},{value:"send",label:"Send"}]}],Uoe=[{key:"created_at",label:"Created"},{key:"due_at",label:"Due Date"},{key:"priority",label:"Priority"},{key:"status",label:"Status"},{key:"title",label:"Title"}],Ih={urgent:0,high:1,normal:2,low:3};function d1(e){try{return Id(Mp(e),{addSuffix:!0})}catch{return""}}function qoe(e){if(!e)return null;try{const t=Mp(e);return Ld(t)?{label:"Expired",urgent:!0}:{label:`Expires ${Id(t,{addSuffix:!0})}`,urgent:t.getTime()-Date.now()<1800*1e3}}catch{return null}}function Koe({req:e}){const t=JP(),[n,r]=x.useState(""),[o,a]=x.useState(!1),[l,u]=x.useState(null),d=qoe(e.expires_at);async function f(m){u(m==="approved"?"approve":"reject");try{await t.mutateAsync({id:e.id,status:m,note:n.trim()||void 0}),de({title:m==="approved"?"Approved":"Rejected",description:e.action_summary})}catch{de({title:"Error",description:"Could not resolve request.",variant:"destructive"})}finally{u(null)}}return s.jsxs("div",{className:"bg-card border border-border rounded-2xl shadow-sm overflow-hidden",children:[s.jsxs("div",{className:"flex items-start gap-3 p-4",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-violet-500/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:s.jsx(zn,{className:"w-4 h-4 text-violet-500"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-violet-500/15 text-violet-600",children:"Approval Request"}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground font-mono",children:e.action_type}),d&&s.jsxs("span",{className:`text-xs flex items-center gap-1 ${d.urgent?"text-destructive":"text-muted-foreground"}`,children:[s.jsx(zs,{className:"w-3 h-3"}),d.label]})]}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:e.action_summary}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:d1(e.created_at)})]})]}),s.jsxs("div",{className:"px-4 pb-2",children:[s.jsxs("button",{onClick:()=>a(!o),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx($s,{className:`w-3.5 h-3.5 transition-transform ${o?"rotate-90":""}`}),"View payload"]}),s.jsx(mn,{children:o&&s.jsx(We.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:"overflow-hidden",children:s.jsx("pre",{className:"mt-2 p-3 rounded-xl bg-muted/50 text-xs text-muted-foreground overflow-x-auto max-h-48",children:JSON.stringify(e.action_payload,null,2)})})})]}),s.jsxs("div",{className:"border-t border-border p-3 flex flex-col sm:flex-row gap-2 items-end bg-surface-sunken/30",children:[s.jsx("input",{value:n,onChange:m=>r(m.target.value),placeholder:"Add a note (optional)...",className:"flex-1 h-8 px-3 rounded-lg border border-border bg-card text-xs text-foreground placeholder:text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30"}),s.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[s.jsx(Fn,{label:"Reject",icon:s.jsx(Vs,{className:"w-3.5 h-3.5"}),onClick:()=>f("rejected"),loading:l==="reject",color:"destructive"}),s.jsx(Fn,{label:"Approve",icon:s.jsx(Gt,{className:"w-3.5 h-3.5"}),onClick:()=>f("approved"),loading:l==="approve",color:"success"})]})]})]})}function Yoe({task:e,actorMap:t}){const n=rw(),r=aw(),o=sw(),a=ow(),l=iw(),u=lw(),[d,f]=x.useState(null);async function m(y){f(y);try{y==="accept"?await n.mutateAsync(e.id):y==="start"?await r.mutateAsync(e.id):y==="complete"?await o.mutateAsync({id:e.id}):y==="decline"?await a.mutateAsync({id:e.id}):y==="block"?await l.mutateAsync({id:e.id}):y==="cancel"&&await u.mutateAsync({id:e.id}),de({title:`Assignment ${y}ed`})}catch{de({title:"Error",description:`Could not ${y} assignment.`,variant:"destructive"})}finally{f(null)}}const p=e.due_at&&Ld(Mp(e.due_at))&&!["completed","cancelled","declined"].includes(e.status),g=t.get(e.assigned_by)??e.assigned_by.slice(0,8)+"…";return s.jsxs("div",{className:"bg-card border border-border rounded-2xl shadow-sm overflow-hidden",children:[s.jsxs("div",{className:"flex items-start gap-3 p-4",children:[s.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:s.jsx(Na,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full ${Xm[e.priority]??Xm.normal}`,children:e.priority}),s.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${M4[e.status]??"bg-muted text-muted-foreground"}`,children:e.status.replace("_"," ")}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground font-mono",children:e.assignment_type.replace("_"," ")}),p&&s.jsxs("span",{className:"text-xs flex items-center gap-1 text-destructive",children:[s.jsx(Bs,{className:"w-3 h-3"}),"Overdue"]})]}),s.jsx("p",{className:"text-sm font-medium text-foreground leading-snug",children:e.title}),s.jsxs("div",{className:"flex items-center gap-3 mt-1 flex-wrap",children:[s.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(Il,{className:"w-3 h-3"}),"from ",g]}),e.due_at&&s.jsxs("span",{className:`text-xs flex items-center gap-1 ${p?"text-destructive":"text-muted-foreground"}`,children:[s.jsx(Sd,{className:"w-3 h-3"}),d1(e.due_at)]})]}),e.context&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.context})]})]}),Zm.includes(e.status)&&s.jsxs("div",{className:"border-t border-border px-3 py-2 flex gap-2 flex-wrap bg-surface-sunken/30",children:[e.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsx(Fn,{label:"Accept",icon:s.jsx(Gt,{className:"w-3.5 h-3.5"}),onClick:()=>m("accept"),loading:d==="accept",color:"success"}),s.jsx(Fn,{label:"Decline",icon:s.jsx(Vs,{className:"w-3.5 h-3.5"}),onClick:()=>m("decline"),loading:d==="decline",color:"destructive"})]}),e.status==="accepted"&&s.jsxs(s.Fragment,{children:[s.jsx(Fn,{label:"Start",icon:s.jsx(wa,{className:"w-3.5 h-3.5"}),onClick:()=>m("start"),loading:d==="start",color:"primary"}),s.jsx(Fn,{label:"Decline",icon:s.jsx(Vs,{className:"w-3.5 h-3.5"}),onClick:()=>m("decline"),loading:d==="decline",color:"ghost"})]}),e.status==="in_progress"&&s.jsxs(s.Fragment,{children:[s.jsx(Fn,{label:"Complete",icon:s.jsx(Gt,{className:"w-3.5 h-3.5"}),onClick:()=>m("complete"),loading:d==="complete",color:"success"}),s.jsx(Fn,{label:"Block",icon:s.jsx(Ov,{className:"w-3.5 h-3.5"}),onClick:()=>m("block"),loading:d==="block",color:"warning"})]}),e.status==="blocked"&&s.jsxs(s.Fragment,{children:[s.jsx(Fn,{label:"Resume",icon:s.jsx(wa,{className:"w-3.5 h-3.5"}),onClick:()=>m("start"),loading:d==="start",color:"primary"}),s.jsx(Fn,{label:"Cancel",icon:s.jsx(Vh,{className:"w-3.5 h-3.5"}),onClick:()=>m("cancel"),loading:d==="cancel",color:"ghost"})]})]})]})}function Fn({label:e,icon:t,onClick:n,loading:r,color:o}){const a={success:"bg-success text-white hover:bg-success/90",destructive:"border border-destructive/30 text-destructive hover:bg-destructive/10",primary:"bg-primary text-primary-foreground hover:bg-primary/90",warning:"border border-amber-500/30 text-amber-600 hover:bg-amber-500/10",ghost:"border border-border text-muted-foreground hover:bg-muted/50"};return s.jsxs("button",{onClick:n,disabled:r,className:`h-7 px-2.5 flex items-center gap-1.5 rounded-lg text-xs font-semibold transition-all disabled:opacity-50 ${a[o]}`,children:[r?s.jsx(gr,{className:"w-3.5 h-3.5 animate-spin"}):t,e]})}function Qoe({task:e,actorMap:t,index:n}){const r=rw(),o=aw(),a=sw(),l=ow(),u=iw(),d=lw(),[f,m]=x.useState(null);async function p(w){m(w);try{w==="accept"?await r.mutateAsync(e.id):w==="start"?await o.mutateAsync(e.id):w==="complete"?await a.mutateAsync({id:e.id}):w==="decline"?await l.mutateAsync({id:e.id}):w==="block"?await u.mutateAsync({id:e.id}):w==="cancel"&&await d.mutateAsync({id:e.id}),de({title:`Assignment ${w}ed`})}catch{de({title:"Error",description:`Could not ${w} assignment.`,variant:"destructive"})}finally{m(null)}}const g=e.due_at&&Ld(Mp(e.due_at))&&!["completed","cancelled","declined"].includes(e.status),y=t.get(e.assigned_by)??e.assigned_by.slice(0,8)+"…",b=t.get(e.assigned_to)??e.assigned_to.slice(0,8)+"…";return s.jsxs("tr",{className:`border-b border-border hover:bg-primary/5 transition-colors group ${n%2===1?"bg-surface-sunken/30":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full ${Xm[e.priority]??Xm.normal}`,children:e.priority})}),s.jsxs("td",{className:"px-4 py-3 max-w-xs",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:e.title}),e.context&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:e.context})]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground font-mono",children:e.assignment_type.replace("_"," ")})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded-full ${M4[e.status]??"bg-muted text-muted-foreground"}`,children:e.status.replace("_"," ")})}),s.jsx("td",{className:"px-4 py-3 text-xs text-muted-foreground",children:b}),s.jsx("td",{className:"px-4 py-3 text-xs text-muted-foreground",children:y}),s.jsx("td",{className:`px-4 py-3 text-xs ${g?"text-destructive font-medium":"text-muted-foreground"}`,children:e.due_at?d1(e.due_at):"—"}),s.jsx("td",{className:"px-4 py-3",children:Zm.includes(e.status)&&s.jsxs("div",{className:"flex gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsx(Fn,{label:"Accept",icon:s.jsx(Gt,{className:"w-3 h-3"}),onClick:()=>p("accept"),loading:f==="accept",color:"success"}),s.jsx(Fn,{label:"Decline",icon:s.jsx(Vs,{className:"w-3 h-3"}),onClick:()=>p("decline"),loading:f==="decline",color:"ghost"})]}),e.status==="accepted"&&s.jsx(Fn,{label:"Start",icon:s.jsx(wa,{className:"w-3 h-3"}),onClick:()=>p("start"),loading:f==="start",color:"primary"}),e.status==="in_progress"&&s.jsx(Fn,{label:"Complete",icon:s.jsx(Gt,{className:"w-3 h-3"}),onClick:()=>p("complete"),loading:f==="complete",color:"success"}),e.status==="blocked"&&s.jsx(Fn,{label:"Resume",icon:s.jsx(wa,{className:"w-3 h-3"}),onClick:()=>p("start"),loading:f==="start",color:"primary"})]})})]})}function K2({tab:e}){const t={needs_attention:{title:"All clear!",sub:"No approvals or tasks waiting for your action."},delegated:{title:"Nothing delegated",sub:"Assignments you create will appear here."},all:{title:"Nothing here yet",sub:"Assignments will appear as they are created."}};return s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center mb-4",children:s.jsx(Ed,{className:"w-7 h-7 text-muted-foreground/50"})}),s.jsx("p",{className:"text-base font-semibold text-foreground",children:t[e].title}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t[e].sub})]})}function Goe(){var U,V,$;const[e,t]=x.useState("needs_attention"),[n,r]=x.useState("card"),[o,a]=x.useState(""),[l,u]=x.useState({}),[d,f]=x.useState({key:"created_at",dir:"desc"}),[m,p]=x.useState(1),g=25,{openQuickAdd:y}=lt(),{data:b}=s3(),w=b==null?void 0:b.actor_id,N=nw(),k=jy(w?{assigned_to:w,limit:200}:void 0),j=jy(w?{assigned_by:w,limit:200}:void 0),C=jy({limit:200}),S=Rd({limit:100}),E=x.useMemo(()=>{var X,ne;const Y=new Map;return(((X=S.data)==null?void 0:X.actors)??((ne=S.data)==null?void 0:ne.data)??[]).forEach(ie=>{Y.set(ie.id,ie.display_name??ie.name??ie.email??ie.id)}),Y},[S.data]),P=x.useMemo(()=>{var Y;return(((Y=N.data)==null?void 0:Y.data)??[]).filter(X=>X.status==="pending")},[N.data]),D=((U=k.data)==null?void 0:U.assignments)??[],I=((V=j.data)==null?void 0:V.assignments)??[],z=(($=C.data)==null?void 0:$.assignments)??[],K=x.useMemo(()=>D.filter(Y=>Zm.includes(Y.status)),[D]),q=x.useMemo(()=>I.filter(Y=>Zm.includes(Y.status)&&Y.assigned_to!==w),[I,w]),H=x.useMemo(()=>e==="needs_attention"?K:e==="delegated"?q:z,[e,K,q,z]),B=x.useMemo(()=>{var X,ne,ie;let Y=[...H];if(o.trim()){const J=o.toLowerCase();Y=Y.filter(re=>re.title.toLowerCase().includes(J)||(re.context??"").toLowerCase().includes(J)||(re.description??"").toLowerCase().includes(J))}return(X=l.status)!=null&&X.length&&(Y=Y.filter(J=>l.status.includes(J.status))),(ne=l.priority)!=null&&ne.length&&(Y=Y.filter(J=>l.priority.includes(J.priority))),(ie=l.assignment_type)!=null&&ie.length&&(Y=Y.filter(J=>l.assignment_type.includes(J.assignment_type))),d&&Y.sort((J,re)=>{if(d.key==="priority")return d.dir==="asc"?(Ih[J.priority]??2)-(Ih[re.priority]??2):(Ih[re.priority]??2)-(Ih[J.priority]??2);const ce=J[d.key]??"",fe=re[d.key]??"";return d.dir==="asc"?String(ce).localeCompare(String(fe)):String(fe).localeCompare(String(ce))}),Y},[H,o,l,d]);x.useEffect(()=>{p(1)},[e,o,l,d]);const R=B.slice((m-1)*g,m*g),M=P.length+K.length,F=N.isLoading||k.isLoading||C.isLoading,L=(Y,X)=>{u(ne=>{const ie={...ne};return X.length===0?delete ie[Y]:ie[Y]=X,ie})},A=Y=>{f(X=>(X==null?void 0:X.key)===Y?{key:Y,dir:X.dir==="asc"?"desc":"asc"}:{key:Y,dir:"asc"})},O=({label:Y,sortKey:X})=>s.jsx("th",{onClick:()=>A(X),className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground cursor-pointer hover:text-foreground transition-colors select-none",children:s.jsxs("span",{className:"inline-flex items-center gap-1",children:[Y,(d==null?void 0:d.key)===X&&(d.dir==="asc"?s.jsx(ms,{className:"w-3 h-3"}):s.jsx(Wn,{className:"w-3 h-3"}))]})});return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsx(Dn,{title:"Handoffs",icon:Ed,iconClassName:"text-destructive",description:"Review and respond to agent requests and assignments.",children:s.jsx("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[{mode:"card",icon:jc},{mode:"table",icon:Da}].map(({mode:Y,icon:X})=>s.jsx("button",{onClick:()=>r(Y),className:`p-1.5 rounded-lg transition-all ${n===Y?"bg-card text-foreground shadow-sm":"text-muted-foreground"}`,children:s.jsx(X,{className:"w-4 h-4"})},Y))})}),s.jsx("div",{className:"px-4 md:px-6 pt-3 pb-1 flex flex-wrap items-center gap-2",children:s.jsx("div",{className:"inline-flex rounded-xl border border-border bg-muted/40 p-0.5 gap-0.5",children:Woe.map(Y=>s.jsxs("button",{onClick:()=>t(Y.key),className:["px-3 py-1.5 text-xs font-medium rounded-lg transition-all flex items-center gap-1.5",e===Y.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"].join(" "),children:[Y.label,Y.key==="needs_attention"&&M>0&&s.jsx("span",{className:`min-w-[16px] h-4 px-1 rounded-full text-[10px] font-bold flex items-center justify-center ${e===Y.key?"bg-destructive text-white":"bg-muted-foreground/20 text-muted-foreground"}`,children:M})]},Y.key))})}),s.jsx(Ks,{searchValue:o,onSearchChange:a,searchPlaceholder:"Search assignments...",filters:Hoe,activeFilters:l,onFilterChange:L,onClearFilters:()=>u({}),sortOptions:Uoe,currentSort:d,onSortChange:A,onAdd:()=>y("assignment"),addLabel:"New Assignment",entityType:"assignments"}),s.jsx("div",{className:"flex-1 overflow-y-auto pb-24 md:pb-6",children:F?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(gr,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):s.jsxs(s.Fragment,{children:[e==="needs_attention"&&P.length>0&&s.jsxs("div",{className:"px-4 md:px-6 pt-4 pb-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"Approval Requests"}),s.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground text-[10px] font-semibold",children:P.length}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:P.map(Y=>s.jsx(Koe,{req:Y},Y.id))})]}),R.length===0&&P.length===0?s.jsx(K2,{tab:e}):R.length===0&&e==="needs_attention"?null:R.length===0?s.jsx(K2,{tab:e}):n==="card"?s.jsxs("div",{className:"px-4 md:px-6 pt-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:[e==="needs_attention"&&R.length>0&&s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"text-xs font-display font-bold text-muted-foreground uppercase tracking-wide",children:"My Tasks"}),s.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground text-[10px] font-semibold",children:R.length}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),R.map(Y=>s.jsx(Yoe,{task:Y,actorMap:E},Y.id))]}):s.jsx("div",{className:"px-4 md:px-6 pt-4 overflow-x-auto",children:s.jsx("div",{className:"bg-card border border-border rounded-2xl overflow-hidden shadow-sm",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-surface-sunken/50",children:[s.jsx(O,{label:"Priority",sortKey:"priority"}),s.jsx(O,{label:"Title",sortKey:"title"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Type"}),s.jsx(O,{label:"Status",sortKey:"status"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Assigned To"}),s.jsx("th",{className:"text-left px-4 py-3 text-xs font-display font-semibold text-muted-foreground",children:"Assigned By"}),s.jsx(O,{label:"Due",sortKey:"due_at"}),s.jsx("th",{className:"px-4 py-3"})]})}),s.jsx("tbody",{children:R.map((Y,X)=>s.jsx(Qoe,{task:Y,actorMap:E,index:X},Y.id))})]})})}),B.length>g&&s.jsx("div",{className:"px-4 md:px-6 pt-4",children:s.jsx(hs,{page:m,pageSize:g,total:B.length,onPageChange:p,onPageSizeChange:()=>{}})})]})})]})}function Xoe(){return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Context",icon:Lu,iconClassName:"text-[#0ea5e9]",description:"Structured memory written by agents after every interaction. Used to power briefings."}),s.jsx(j4,{})]})}const Zoe=[{key:"status",label:"Status",options:[{value:"active",label:"Active"},{value:"paused",label:"Paused"}]}],Joe=[{key:"name",label:"Name"},{key:"trigger_event",label:"Trigger Event"},{key:"updated_at",label:"Last Updated"},{key:"created_at",label:"Date Created"}],A4="w-full h-9 px-3 rounded-lg border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",eae="w-full h-8 px-2 rounded-md border border-border bg-background text-xs text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring";function tae({value:e,onChange:t}){const[n,r]=x.useState(!1),o=x.useRef(null),a=e.trim()?xd.filter(l=>l.value.includes(e.toLowerCase())||l.label.toLowerCase().includes(e.toLowerCase())):xd;return s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:o,value:e,onChange:l=>t(l.target.value),onFocus:()=>r(!0),onBlur:()=>setTimeout(()=>r(!1),120),placeholder:"e.g. contact.created",className:A4+" font-mono",autoComplete:"off"}),n&&a.length>0&&s.jsx("div",{className:"absolute z-50 left-0 right-0 mt-1 bg-popover border border-border rounded-lg shadow-lg max-h-52 overflow-y-auto",children:a.map(l=>s.jsxs("button",{type:"button",onMouseDown:()=>{t(l.value),r(!1)},className:"w-full text-left px-3 py-2 text-xs hover:bg-muted transition-colors flex items-center justify-between gap-3",children:[s.jsx("span",{className:"font-mono text-foreground",children:l.value}),s.jsx("span",{className:"text-muted-foreground shrink-0",children:l.label})]},l.value))})]})}function nae({action:e,onChange:t,onRemove:n,canRemove:r}){const o=va.find(a=>a.value===e.type)??va[0];return s.jsxs("div",{className:"p-3 rounded-lg border border-border bg-muted/20 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(pd,{value:e.type,onValueChange:a=>t({type:a,config:{}}),children:[s.jsx(gc,{className:"h-8 text-xs flex-1",children:s.jsx(gd,{})}),s.jsx(xc,{children:va.map(a=>s.jsx(Ti,{value:a.value,children:a.label},a.value))})]}),r&&s.jsx("button",{type:"button",onClick:n,className:"p-1 rounded text-muted-foreground hover:text-destructive transition-colors shrink-0","aria-label":"Remove action",children:s.jsx(Ht,{className:"w-3.5 h-3.5"})})]}),o.configFields.map(a=>s.jsxs("div",{children:[s.jsxs("label",{className:"block text-[10px] font-medium text-muted-foreground mb-1",children:[a.label,a.required&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.jsx("input",{value:e.config[a.key]??"",onChange:l=>t({...e,config:{...e.config,[a.key]:l.target.value}}),placeholder:a.placeholder,className:eae+" font-mono"})]},a.key))]})}const uv={type:"send_notification",config:{}};function rae(){const{openDrawer:e}=lt(),[t,n]=x.useState(""),[r,o]=x.useState({}),[a,l]=x.useState(null),[u,d]=x.useState(!1),[f,m]=x.useState(null),[p,g]=x.useState(""),[y,b]=x.useState(""),[w,N]=x.useState([{...uv}]),[k,j]=x.useState({}),{data:C,isLoading:S}=k7(),E=_7(),P=c3(),D=(C==null?void 0:C.data)??[],I=()=>{const A={};return p.trim()||(A.name="Name is required."),y.trim()||(A.trigger="Trigger event is required."),w.forEach((O,U)=>{s4(O)||(A[`action_${U}`]="Fill in all required fields.")}),j(A),Object.keys(A).length===0},z=(A,O)=>{o(U=>{const V={...U};return O.length===0?delete V[A]:V[A]=O,V})},K=A=>{l(O=>(O==null?void 0:O.key)===A?{key:A,dir:O.dir==="asc"?"desc":"asc"}:{key:A,dir:"asc"})},q=()=>{g(""),b(""),N([{...uv}]),j({})},H=()=>{q(),d(!0)},B=async()=>{if(I())try{await E.mutateAsync({name:p.trim(),trigger_event:y.trim(),trigger_filter:{},is_active:!0,actions:w.map(A=>({type:A.type,config:Object.fromEntries(Object.entries(A.config).map(([O,U])=>[O,U.trim()]))}))}),q(),d(!1),de({title:"Workflow created"})}catch{de({title:"Error",description:"Failed to create workflow.",variant:"destructive"})}},R=async A=>{try{await P.mutateAsync(A),m(null),de({title:"Workflow deleted"})}catch{de({title:"Error",description:"Failed to delete workflow.",variant:"destructive"})}},M=(A,O)=>{N(U=>U.map((V,$)=>$===A?O:V)),j(U=>{const V={...U};return delete V[`action_${A}`],V})},F=A=>{N(O=>O.filter((U,V)=>V!==A))},L=x.useMemo(()=>{var O;let A=[...D];if(t.trim()){const U=t.toLowerCase();A=A.filter(V=>(V.name??"").toLowerCase().includes(U)||(V.trigger_event??"").toLowerCase().includes(U))}return(O=r.status)!=null&&O.length&&(A=A.filter(U=>{const V=U.is_active!==!1;return r.status.includes("active")&&V||r.status.includes("paused")&&!V})),a&&A.sort((U,V)=>{const $=String(U[a.key]??""),Y=String(V[a.key]??"");return a.dir==="asc"?$.localeCompare(Y):Y.localeCompare($)}),A},[D,t,r,a]);return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Workflows",icon:Fu,iconClassName:"text-amber-500",description:"Event-driven automations that trigger on CRM events and execute a chain of actions.",badge:D.length>0?s.jsxs("span",{className:"text-xs text-muted-foreground",children:[D.length," total"]}):void 0}),s.jsx(Ks,{searchValue:t,onSearchChange:n,searchPlaceholder:"Search workflows…",filters:Zoe,activeFilters:r,onFilterChange:z,onClearFilters:()=>o({}),sortOptions:Joe,currentSort:a,onSortChange:K,onAdd:H,addLabel:"New Workflow",entityType:"workflows"}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 pb-24 md:pb-6",children:S?s.jsx("div",{className:"space-y-2 pt-2",children:[...Array(4)].map((A,O)=>s.jsx("div",{className:"h-16 bg-muted/50 rounded-xl animate-pulse"},O))}):L.length===0?s.jsxs(We.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx(Fu,{className:"w-14 h-14 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-base font-display font-semibold text-foreground mb-1",children:D.length===0?"No workflows yet":"No matches"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:D.length===0?"Create your first workflow to automate CRM actions on events.":"Try adjusting your search or filter."})]}):s.jsx("div",{className:"space-y-2 pt-2",children:L.map((A,O)=>s.jsxs(We.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:O*.02},className:"flex items-center gap-3 p-4 bg-card border border-border rounded-xl cursor-pointer hover:border-primary/30 transition-colors",onClick:()=>e("workflow",A.id),children:[s.jsx("div",{className:"flex-shrink-0",children:A.is_active!==!1?s.jsx(wa,{className:"w-4 h-4 text-emerald-500"}):s.jsx(x5,{className:"w-4 h-4 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:A.name}),s.jsx(mo,{variant:A.is_active!==!1?"default":"secondary",className:"text-[10px]",children:A.is_active!==!1?"Active":"Paused"})]}),s.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-mono",children:A.trigger_event}),Array.isArray(A.actions)&&A.actions.length>0&&s.jsxs("span",{children:[A.actions.length," action",A.actions.length!==1?"s":""]}),A.updated_at&&s.jsxs("span",{children:["· ",new Date(A.updated_at).toLocaleDateString()]})]})]}),s.jsx("button",{onClick:U=>{U.stopPropagation(),f===A.id?R(A.id):(m(A.id),setTimeout(()=>m(null),3e3))},className:`p-1.5 rounded-lg transition-colors ${f===A.id?"text-destructive bg-destructive/10":"text-muted-foreground hover:text-destructive hover:bg-destructive/10"}`,title:f===A.id?"Click again to confirm":"Delete",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]},A.id))})}),s.jsx(i1,{open:u,onOpenChange:A=>{A||q(),d(A)},children:s.jsxs(Jp,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(eg,{children:s.jsxs(ng,{className:"flex items-center gap-2",children:[s.jsx(Fu,{className:"w-5 h-5 text-amber-500"}),"New Workflow"]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{value:p,onChange:A=>{g(A.target.value),j(O=>({...O,name:""}))},placeholder:"e.g. Notify on new deal",className:A4,autoFocus:!0}),k.name&&s.jsx("p",{className:"text-xs text-destructive",children:k.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Trigger Event ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(tae,{value:y,onChange:A=>{b(A),j(O=>({...O,trigger:""}))}}),k.trigger?s.jsx("p",{className:"text-xs text-destructive",children:k.trigger}):s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Start typing to filter known events, or enter a custom event name."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Actions ",s.jsx("span",{className:"text-destructive",children:"*"})]}),w.map((A,O)=>s.jsxs("div",{children:[s.jsx(nae,{action:A,onChange:U=>M(O,U),onRemove:()=>F(O),canRemove:w.length>1}),k[`action_${O}`]&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:k[`action_${O}`]})]},O)),w.length<5&&s.jsxs("button",{type:"button",onClick:()=>N(A=>[...A,{...uv}]),className:"w-full py-2 rounded-lg border border-dashed border-border text-xs text-muted-foreground hover:text-foreground hover:border-foreground/30 transition-colors flex items-center justify-center gap-1.5",children:[s.jsx(or,{className:"w-3.5 h-3.5"})," Add another action"]})]})]}),s.jsxs(tg,{children:[s.jsx(Jt,{variant:"outline",onClick:()=>{q(),d(!1)},children:"Cancel"}),s.jsxs(Jt,{onClick:B,disabled:E.isPending,className:"gap-1.5",children:[E.isPending&&s.jsx(gr,{className:"w-3.5 h-3.5 animate-spin"}),"Create Workflow"]})]})]})})]})}const Y2={draft:{label:"Draft",color:"bg-muted text-muted-foreground",icon:cb},pending_approval:{label:"Pending Approval",color:"bg-warning/15 text-warning",icon:zs},approved:{label:"Approved",color:"bg-emerald-500/15 text-emerald-500",icon:Gt},sending:{label:"Sending",color:"bg-blue-500/15 text-blue-500",icon:Lr},sent:{label:"Sent",color:"bg-emerald-500/15 text-emerald-500",icon:Gt},failed:{label:"Failed",color:"bg-destructive/15 text-destructive",icon:mm},rejected:{label:"Rejected",color:"bg-destructive/15 text-destructive",icon:Vs}},sae=[{key:"status",label:"Status",options:[{value:"draft",label:"Draft"},{value:"pending_approval",label:"Pending Approval"},{value:"approved",label:"Approved"},{value:"sending",label:"Sending"},{value:"sent",label:"Sent"},{value:"failed",label:"Failed"},{value:"rejected",label:"Rejected"}]}],oae=[{key:"created_at",label:"Date Created"},{key:"subject",label:"Subject"},{key:"to_email",label:"Recipient"}];function aae(){var P;const{openDrawer:e}=lt(),[t,n]=x.useState(""),[r,o]=x.useState({}),[a,l]=x.useState(null),[u,d]=x.useState(!1),[f,m]=x.useState(""),[p,g]=x.useState(""),[y,b]=x.useState(""),w=((P=r.status)==null?void 0:P[0])??"",{data:N,isLoading:k}=o7({status:w||void 0}),j=i7(),C=(N==null?void 0:N.data)??[],S=x.useMemo(()=>{let D=C;if(t.trim()){const I=t.toLowerCase();D=D.filter(z=>(z.subject??"").toLowerCase().includes(I)||(z.to_email??"").toLowerCase().includes(I))}return a&&(D=[...D].sort((I,z)=>{const K=String(I[a.key]??""),q=String(z[a.key]??"");return a.dir==="asc"?K.localeCompare(q):q.localeCompare(K)})),D},[C,t,a]),E=async D=>{if(!f.trim()||!p.trim()){de({title:"Missing fields",description:"To and subject are required.",variant:"destructive"});return}try{await j.mutateAsync({to_address:f.trim(),subject:p.trim(),body_text:y.trim(),require_approval:D==="pending_approval"}),m(""),g(""),b(""),d(!1),de({title:D==="draft"?"Draft saved":"Submitted for approval"})}catch{de({title:"Error",description:"Failed to create email.",variant:"destructive"})}};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Emails",icon:ho,iconClassName:"text-blue-500",description:"Drafted, pending, and sent emails across the CRM.",badge:C.length>0?s.jsxs("span",{className:"text-xs text-muted-foreground",children:[C.length," total"]}):void 0}),s.jsx(Ks,{searchValue:t,onSearchChange:n,searchPlaceholder:"Search by subject or recipient…",filters:sae,activeFilters:r,onFilterChange:(D,I)=>o(z=>{const K={...z};return I.length===0?delete K[D]:K[D]=I,K}),onClearFilters:()=>{o({}),n("")},sortOptions:oae,currentSort:a,onSortChange:D=>l(I=>(I==null?void 0:I.key)===D?{key:D,dir:I.dir==="asc"?"desc":"asc"}:{key:D,dir:"asc"}),onAdd:()=>d(!0),addLabel:"Compose",entityType:"emails"}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 pb-24 md:pb-6",children:k?s.jsxs("div",{className:"text-sm text-muted-foreground py-8 text-center flex items-center justify-center gap-2",children:[s.jsx(gr,{className:"w-4 h-4 animate-spin"}),"Loading…"]}):S.length===0?s.jsxs(We.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx(ho,{className:"w-14 h-14 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-base font-display font-semibold text-foreground mb-1",children:C.length===0?"No emails yet":"No matches"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:C.length===0?"Compose an email or let an agent draft one for approval.":"Try adjusting your search or filter."})]}):s.jsx("div",{className:"space-y-2",children:S.map((D,I)=>{const z=Y2[D.status]??Y2.draft,K=z.icon;return s.jsxs(We.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:I*.02},className:"flex items-center gap-3 p-4 bg-card border border-border rounded-xl cursor-pointer hover:border-primary/30 transition-colors",onClick:()=>e("email",D.id),children:[s.jsx(K,{className:"w-4 h-4 flex-shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:D.subject||"(no subject)"}),s.jsx(mo,{variant:"outline",className:`text-[10px] ${z.color}`,children:z.label})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[D.to_email&&s.jsxs("span",{className:"truncate max-w-[200px]",children:["To: ",D.to_email]}),D.created_at&&s.jsxs("span",{children:["· ",Id(new Date(D.created_at),{addSuffix:!0})]})]})]})]},D.id)})})}),s.jsx(i1,{open:u,onOpenChange:d,children:s.jsxs(Jp,{className:"sm:max-w-lg",children:[s.jsx(eg,{children:s.jsxs(ng,{className:"flex items-center gap-2",children:[s.jsx(ho,{className:"w-5 h-5 text-blue-500"}),"Compose Email"]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"To"}),s.jsx(fo,{placeholder:"recipient@example.com",value:f,onChange:D=>m(D.target.value),className:"h-9 text-sm"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Subject"}),s.jsx(fo,{placeholder:"Email subject",value:p,onChange:D=>g(D.target.value),className:"h-9 text-sm"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Body"}),s.jsx(a1,{placeholder:"Write your email…",value:y,onChange:D=>b(D.target.value),className:"min-h-[140px] text-sm"})]})]}),s.jsxs(tg,{className:"gap-2",children:[s.jsx(Jt,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),s.jsxs(Jt,{variant:"outline",onClick:()=>E("draft"),disabled:j.isPending,className:"gap-1.5",children:[s.jsx(cb,{className:"w-3.5 h-3.5"}),"Save Draft"]}),s.jsxs(Jt,{onClick:()=>E("pending_approval"),disabled:j.isPending,className:"gap-1.5",children:[j.isPending&&s.jsx(gr,{className:"w-3.5 h-3.5 animate-spin"}),s.jsx(Lr,{className:"w-3.5 h-3.5"}),"Send for Approval"]})]})]})})]})}function iae(){const[e,t]=x.useState("table");return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx(Dn,{title:"Agents",icon:op,iconClassName:"text-[#6366f1]",description:"Manage humans and AI agents with access to your CRMy workspace.",children:s.jsxs("div",{className:"hidden md:flex items-center gap-1 bg-muted rounded-xl p-0.5",children:[s.jsx("button",{onClick:()=>t("table"),className:`p-1.5 rounded-lg text-sm transition-all ${e==="table"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.jsx(Da,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>t("cards"),className:`p-1.5 rounded-lg text-sm transition-all ${e==="cards"?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.jsx(jc,{className:"w-4 h-4"})})]})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6 pb-24 md:pb-6",children:s.jsx(T4,{view:e,onViewChange:t})})]})}function lae(){const{darkVariant:e}=lt();return a4(),x.useEffect(()=>{const t=document.documentElement;e==="charcoal"?t.classList.add("charcoal"):t.classList.remove("charcoal")},[e]),null}function cae({children:e}){return localStorage.getItem("crmy_token")?s.jsx(s.Fragment,{children:e}):s.jsx(ui,{to:"/login",replace:!0})}function uae(){const e=Cr();return s.jsx(mn,{mode:"wait",children:s.jsx(We.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15,ease:"easeOut"},className:"flex-1 flex flex-col overflow-hidden",children:s.jsxs(rb,{location:e,children:[s.jsx(ft,{path:"/",element:s.jsx(_se,{})}),s.jsx(ft,{path:"/contacts",element:s.jsx(Ase,{})}),s.jsx(ft,{path:"/accounts",element:s.jsx(Ise,{})}),s.jsx(ft,{path:"/opportunities",element:s.jsx(zse,{})}),s.jsx(ft,{path:"/use-cases",element:s.jsx(qse,{})}),s.jsx(ft,{path:"/activities",element:s.jsx(Zse,{})}),s.jsx(ft,{path:"/handoffs",element:s.jsx(Goe,{})}),s.jsx(ft,{path:"/assignments",element:s.jsx(ui,{to:"/handoffs",replace:!0})}),s.jsx(ft,{path:"/inbox",element:s.jsx(ui,{to:"/handoffs",replace:!0})}),s.jsx(ft,{path:"/approvals",element:s.jsx(ui,{to:"/handoffs",replace:!0})}),s.jsx(ft,{path:"/hitl",element:s.jsx(ui,{to:"/handoffs",replace:!0})}),s.jsx(ft,{path:"/context",element:s.jsx(Xoe,{})}),s.jsx(ft,{path:"/workflows",element:s.jsx(rae,{})}),s.jsx(ft,{path:"/emails",element:s.jsx(aae,{})}),s.jsx(ft,{path:"/actors",element:s.jsx(iae,{})}),s.jsx(ft,{path:"/agents",element:s.jsx(ui,{to:"/actors",replace:!0})}),s.jsx(ft,{path:"/agent",element:s.jsx(noe,{})}),s.jsx(ft,{path:"/agent/activity",element:s.jsx(uoe,{})}),s.jsx(ft,{path:"/settings/*",element:s.jsx(zoe,{})}),s.jsx(ft,{path:"*",element:s.jsx(Boe,{})})]})},e.pathname)})}function dae(){ise();const{drawerType:e,zenMode:t}=lt(),n=e==="contact"?"Contact Details":e==="opportunity"?"Opportunity Details":e==="use-case"?"Use Case Details":e==="account"?"Account Details":e==="assignment"?"Assignment Details":e==="workflow"?"Workflow Details":e==="email"?"Email Details":"";return s.jsxs("div",{className:"flex h-screen w-full overflow-hidden",children:[!t&&s.jsx(X7,{}),s.jsx("main",{className:"flex-1 flex flex-col overflow-hidden",children:s.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:s.jsx(uae,{})})}),!t&&s.jsx(J7,{}),s.jsxs(FH,{title:n,children:[e==="contact"&&s.jsx(Zne,{}),e==="opportunity"&&s.jsx(tre,{}),e==="use-case"&&s.jsx(ore,{}),e==="account"&&s.jsx(cre,{}),e==="assignment"&&s.jsx(gre,{}),e==="workflow"&&s.jsx(ose,{}),e==="email"&&s.jsx(ase,{})]}),s.jsx(OH,{}),s.jsx(LH,{}),s.jsx(SQ,{}),s.jsx(lse,{})]})}function fae(){return s.jsx(zH,{children:s.jsxs(E$,{children:[s.jsx(YF,{}),s.jsx(OI,{}),s.jsxs(sI,{basename:"/app",children:[s.jsx(lae,{}),s.jsxs(rb,{children:[s.jsx(ft,{path:"/login",element:s.jsx(fse,{})}),s.jsx(ft,{path:"/*",element:s.jsx(cae,{children:s.jsx(dae,{})})})]})]})]})})}const hae=new KR({defaultOptions:{queries:{staleTime:3e4,retry:1}}});NR.createRoot(document.getElementById("root")).render(s.jsx(be.StrictMode,{children:s.jsx(YR,{client:hae,children:s.jsx(fae,{})})}));
|