channelkit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +829 -0
- package/config.example.yaml +37 -0
- package/dist/api/middleware/auth.d.ts +14 -0
- package/dist/api/middleware/auth.d.ts.map +1 -0
- package/dist/api/middleware/auth.js +130 -0
- package/dist/api/middleware/auth.js.map +1 -0
- package/dist/api/routes/config.d.ts +4 -0
- package/dist/api/routes/config.d.ts.map +1 -0
- package/dist/api/routes/config.js +794 -0
- package/dist/api/routes/config.js.map +1 -0
- package/dist/api/routes/dashboard.d.ts +4 -0
- package/dist/api/routes/dashboard.d.ts.map +1 -0
- package/dist/api/routes/dashboard.js +89 -0
- package/dist/api/routes/dashboard.js.map +1 -0
- package/dist/api/routes/inbound.d.ts +4 -0
- package/dist/api/routes/inbound.d.ts.map +1 -0
- package/dist/api/routes/inbound.js +293 -0
- package/dist/api/routes/inbound.js.map +1 -0
- package/dist/api/routes/logs.d.ts +4 -0
- package/dist/api/routes/logs.d.ts.map +1 -0
- package/dist/api/routes/logs.js +49 -0
- package/dist/api/routes/logs.js.map +1 -0
- package/dist/api/routes/mcp.d.ts +4 -0
- package/dist/api/routes/mcp.d.ts.map +1 -0
- package/dist/api/routes/mcp.js +100 -0
- package/dist/api/routes/mcp.js.map +1 -0
- package/dist/api/routes/restart.d.ts +4 -0
- package/dist/api/routes/restart.d.ts.map +1 -0
- package/dist/api/routes/restart.js +11 -0
- package/dist/api/routes/restart.js.map +1 -0
- package/dist/api/routes/send.d.ts +4 -0
- package/dist/api/routes/send.d.ts.map +1 -0
- package/dist/api/routes/send.js +66 -0
- package/dist/api/routes/send.js.map +1 -0
- package/dist/api/routes/settings.d.ts +4 -0
- package/dist/api/routes/settings.d.ts.map +1 -0
- package/dist/api/routes/settings.js +133 -0
- package/dist/api/routes/settings.js.map +1 -0
- package/dist/api/routes/tunnel.d.ts +4 -0
- package/dist/api/routes/tunnel.d.ts.map +1 -0
- package/dist/api/routes/tunnel.js +209 -0
- package/dist/api/routes/tunnel.js.map +1 -0
- package/dist/api/routes/twilio.d.ts +4 -0
- package/dist/api/routes/twilio.d.ts.map +1 -0
- package/dist/api/routes/twilio.js +138 -0
- package/dist/api/routes/twilio.js.map +1 -0
- package/dist/api/routes/update.d.ts +4 -0
- package/dist/api/routes/update.d.ts.map +1 -0
- package/dist/api/routes/update.js +42 -0
- package/dist/api/routes/update.js.map +1 -0
- package/dist/api/server.d.ts +52 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +415 -0
- package/dist/api/server.js.map +1 -0
- package/dist/api/types.d.ts +61 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +3 -0
- package/dist/api/types.js.map +1 -0
- package/dist/channels/base.d.ts +15 -0
- package/dist/channels/base.d.ts.map +1 -0
- package/dist/channels/base.js +20 -0
- package/dist/channels/base.js.map +1 -0
- package/dist/channels/email/gmail.d.ts +36 -0
- package/dist/channels/email/gmail.d.ts.map +1 -0
- package/dist/channels/email/gmail.js +351 -0
- package/dist/channels/email/gmail.js.map +1 -0
- package/dist/channels/email/index.d.ts +3 -0
- package/dist/channels/email/index.d.ts.map +1 -0
- package/dist/channels/email/index.js +8 -0
- package/dist/channels/email/index.js.map +1 -0
- package/dist/channels/email/resend.d.ts +29 -0
- package/dist/channels/email/resend.d.ts.map +1 -0
- package/dist/channels/email/resend.js +155 -0
- package/dist/channels/email/resend.js.map +1 -0
- package/dist/channels/endpoint/index.d.ts +21 -0
- package/dist/channels/endpoint/index.d.ts.map +1 -0
- package/dist/channels/endpoint/index.js +80 -0
- package/dist/channels/endpoint/index.js.map +1 -0
- package/dist/channels/sms/index.d.ts +37 -0
- package/dist/channels/sms/index.d.ts.map +1 -0
- package/dist/channels/sms/index.js +163 -0
- package/dist/channels/sms/index.js.map +1 -0
- package/dist/channels/telegram/index.d.ts +24 -0
- package/dist/channels/telegram/index.d.ts.map +1 -0
- package/dist/channels/telegram/index.js +231 -0
- package/dist/channels/telegram/index.js.map +1 -0
- package/dist/channels/voice/index.d.ts +62 -0
- package/dist/channels/voice/index.d.ts.map +1 -0
- package/dist/channels/voice/index.js +286 -0
- package/dist/channels/voice/index.js.map +1 -0
- package/dist/channels/whatsapp/index.d.ts +31 -0
- package/dist/channels/whatsapp/index.d.ts.map +1 -0
- package/dist/channels/whatsapp/index.js +383 -0
- package/dist/channels/whatsapp/index.js.map +1 -0
- package/dist/cli/commands/demo.d.ts +4 -0
- package/dist/cli/commands/demo.d.ts.map +1 -0
- package/dist/cli/commands/demo.js +55 -0
- package/dist/cli/commands/demo.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +254 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install-skill.d.ts +4 -0
- package/dist/cli/commands/install-skill.d.ts.map +1 -0
- package/dist/cli/commands/install-skill.js +60 -0
- package/dist/cli/commands/install-skill.js.map +1 -0
- package/dist/cli/commands/send.d.ts +5 -0
- package/dist/cli/commands/send.d.ts.map +1 -0
- package/dist/cli/commands/send.js +46 -0
- package/dist/cli/commands/send.js.map +1 -0
- package/dist/cli/commands/start.d.ts +5 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +129 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/helpers.d.ts +26 -0
- package/dist/cli/helpers.d.ts.map +1 -0
- package/dist/cli/helpers.js +120 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +282 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/wizards/channel.d.ts +4 -0
- package/dist/cli/wizards/channel.d.ts.map +1 -0
- package/dist/cli/wizards/channel.js +285 -0
- package/dist/cli/wizards/channel.js.map +1 -0
- package/dist/cli/wizards/provision.d.ts +4 -0
- package/dist/cli/wizards/provision.d.ts.map +1 -0
- package/dist/cli/wizards/provision.js +213 -0
- package/dist/cli/wizards/provision.js.map +1 -0
- package/dist/cli/wizards/service.d.ts +5 -0
- package/dist/cli/wizards/service.d.ts.map +1 -0
- package/dist/cli/wizards/service.js +212 -0
- package/dist/cli/wizards/service.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/parser.d.ts +6 -0
- package/dist/config/parser.d.ts.map +1 -0
- package/dist/config/parser.js +37 -0
- package/dist/config/parser.js.map +1 -0
- package/dist/config/types.d.ts +170 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/core/apiServer.d.ts +2 -0
- package/dist/core/apiServer.d.ts.map +1 -0
- package/dist/core/apiServer.js +7 -0
- package/dist/core/apiServer.js.map +1 -0
- package/dist/core/groupStore.d.ts +19 -0
- package/dist/core/groupStore.d.ts.map +1 -0
- package/dist/core/groupStore.js +48 -0
- package/dist/core/groupStore.js.map +1 -0
- package/dist/core/logger.d.ts +42 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +142 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/messageHandler.d.ts +15 -0
- package/dist/core/messageHandler.d.ts.map +1 -0
- package/dist/core/messageHandler.js +309 -0
- package/dist/core/messageHandler.js.map +1 -0
- package/dist/core/restart.d.ts +3 -0
- package/dist/core/restart.d.ts.map +1 -0
- package/dist/core/restart.js +35 -0
- package/dist/core/restart.js.map +1 -0
- package/dist/core/router.d.ts +56 -0
- package/dist/core/router.d.ts.map +1 -0
- package/dist/core/router.js +168 -0
- package/dist/core/router.js.map +1 -0
- package/dist/core/tunnel.d.ts +16 -0
- package/dist/core/tunnel.d.ts.map +1 -0
- package/dist/core/tunnel.js +99 -0
- package/dist/core/tunnel.js.map +1 -0
- package/dist/core/types.d.ts +54 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +3 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/updater.d.ts +44 -0
- package/dist/core/updater.d.ts.map +1 -0
- package/dist/core/updater.js +264 -0
- package/dist/core/updater.js.map +1 -0
- package/dist/core/webhook.d.ts +26 -0
- package/dist/core/webhook.d.ts.map +1 -0
- package/dist/core/webhook.js +224 -0
- package/dist/core/webhook.js.map +1 -0
- package/dist/dashboard/assets/browser-D_-rzKir.js +8 -0
- package/dist/dashboard/assets/index-CNa084vI.js +88 -0
- package/dist/dashboard/assets/index-CRvIEyjF.css +1 -0
- package/dist/dashboard/index.html +17 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +551 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +45 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +197 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +16 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +502 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/media/formatter.d.ts +12 -0
- package/dist/media/formatter.d.ts.map +1 -0
- package/dist/media/formatter.js +147 -0
- package/dist/media/formatter.js.map +1 -0
- package/dist/media/processor.d.ts +33 -0
- package/dist/media/processor.d.ts.map +1 -0
- package/dist/media/processor.js +145 -0
- package/dist/media/processor.js.map +1 -0
- package/dist/media/stt.d.ts +16 -0
- package/dist/media/stt.d.ts.map +1 -0
- package/dist/media/stt.js +298 -0
- package/dist/media/stt.js.map +1 -0
- package/dist/media/tts.d.ts +19 -0
- package/dist/media/tts.d.ts.map +1 -0
- package/dist/media/tts.js +135 -0
- package/dist/media/tts.js.map +1 -0
- package/dist/onboarding/index.d.ts +28 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/onboarding/index.js +144 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/paths.d.ts +9 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +14 -0
- package/dist/paths.js.map +1 -0
- package/dist/provisioning/twilio.d.ts +51 -0
- package/dist/provisioning/twilio.d.ts.map +1 -0
- package/dist/provisioning/twilio.js +175 -0
- package/dist/provisioning/twilio.js.map +1 -0
- package/echo-server.js +163 -0
- package/package.json +79 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const S of document.querySelectorAll('link[rel="modulepreload"]'))d(S);new MutationObserver(S=>{for(const E of S)if(E.type==="childList")for(const w of E.addedNodes)w.tagName==="LINK"&&w.rel==="modulepreload"&&d(w)}).observe(document,{childList:!0,subtree:!0});function y(S){const E={};return S.integrity&&(E.integrity=S.integrity),S.referrerPolicy&&(E.referrerPolicy=S.referrerPolicy),S.crossOrigin==="use-credentials"?E.credentials="include":S.crossOrigin==="anonymous"?E.credentials="omit":E.credentials="same-origin",E}function d(S){if(S.ep)return;S.ep=!0;const E=y(S);fetch(S.href,E)}})();function bp(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Bu={exports:{}},si={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and 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 Gf;function gp(){if(Gf)return si;Gf=1;var o=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function y(d,S,E){var w=null;if(E!==void 0&&(w=""+E),S.key!==void 0&&(w=""+S.key),"key"in S){E={};for(var M in S)M!=="key"&&(E[M]=S[M])}else E=S;return S=E.ref,{$$typeof:o,type:d,key:w,ref:S!==void 0?S:null,props:E}}return si.Fragment=r,si.jsx=y,si.jsxs=y,si}var Yf;function yp(){return Yf||(Yf=1,Bu.exports=gp()),Bu.exports}var i=yp(),Lu={exports:{}},ci={},Gu={exports:{}},Yu={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and 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 qf;function vp(){return qf||(qf=1,(function(o){function r(_,L){var I=_.length;_.push(L);e:for(;0<I;){var V=I-1>>>1,ne=_[V];if(0<S(ne,L))_[V]=L,_[I]=ne,I=V;else break e}}function y(_){return _.length===0?null:_[0]}function d(_){if(_.length===0)return null;var L=_[0],I=_.pop();if(I!==L){_[0]=I;e:for(var V=0,ne=_.length,m=ne>>>1;V<m;){var U=2*(V+1)-1,X=_[U],J=U+1,se=_[J];if(0>S(X,I))J<ne&&0>S(se,X)?(_[V]=se,_[J]=I,V=J):(_[V]=X,_[U]=I,V=U);else if(J<ne&&0>S(se,I))_[V]=se,_[J]=I,V=J;else break e}}return L}function S(_,L){var I=_.sortIndex-L.sortIndex;return I!==0?I:_.id-L.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var E=performance;o.unstable_now=function(){return E.now()}}else{var w=Date,M=w.now();o.unstable_now=function(){return w.now()-M}}var b=[],x=[],k=1,v=null,j=3,D=!1,G=!1,z=!1,de=!1,ie=typeof setTimeout=="function"?setTimeout:null,ae=typeof clearTimeout=="function"?clearTimeout:null,ee=typeof setImmediate<"u"?setImmediate:null;function W(_){for(var L=y(x);L!==null;){if(L.callback===null)d(x);else if(L.startTime<=_)d(x),L.sortIndex=L.expirationTime,r(b,L);else break;L=y(x)}}function Y(_){if(z=!1,W(_),!G)if(y(b)!==null)G=!0,Q||(Q=!0,pe());else{var L=y(x);L!==null&&fe(Y,L.startTime-_)}}var Q=!1,Z=-1,oe=5,$=-1;function ze(){return de?!0:!(o.unstable_now()-$<oe)}function ye(){if(de=!1,Q){var _=o.unstable_now();$=_;var L=!0;try{e:{G=!1,z&&(z=!1,ae(Z),Z=-1),D=!0;var I=j;try{t:{for(W(_),v=y(b);v!==null&&!(v.expirationTime>_&&ze());){var V=v.callback;if(typeof V=="function"){v.callback=null,j=v.priorityLevel;var ne=V(v.expirationTime<=_);if(_=o.unstable_now(),typeof ne=="function"){v.callback=ne,W(_),L=!0;break t}v===y(b)&&d(b),W(_)}else d(b);v=y(b)}if(v!==null)L=!0;else{var m=y(x);m!==null&&fe(Y,m.startTime-_),L=!1}}break e}finally{v=null,j=I,D=!1}L=void 0}}finally{L?pe():Q=!1}}}var pe;if(typeof ee=="function")pe=function(){ee(ye)};else if(typeof MessageChannel<"u"){var Ae=new MessageChannel,K=Ae.port2;Ae.port1.onmessage=ye,pe=function(){K.postMessage(null)}}else pe=function(){ie(ye,0)};function fe(_,L){Z=ie(function(){_(o.unstable_now())},L)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(_){_.callback=null},o.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<_?Math.floor(1e3/_):5},o.unstable_getCurrentPriorityLevel=function(){return j},o.unstable_next=function(_){switch(j){case 1:case 2:case 3:var L=3;break;default:L=j}var I=j;j=L;try{return _()}finally{j=I}},o.unstable_requestPaint=function(){de=!0},o.unstable_runWithPriority=function(_,L){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var I=j;j=_;try{return L()}finally{j=I}},o.unstable_scheduleCallback=function(_,L,I){var V=o.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?V+I:V):I=V,_){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=I+ne,_={id:k++,callback:L,priorityLevel:_,startTime:I,expirationTime:ne,sortIndex:-1},I>V?(_.sortIndex=I,r(x,_),y(b)===null&&_===y(x)&&(z?(ae(Z),Z=-1):z=!0,fe(Y,I-V))):(_.sortIndex=ne,r(b,_),G||D||(G=!0,Q||(Q=!0,pe()))),_},o.unstable_shouldYield=ze,o.unstable_wrapCallback=function(_){var L=j;return function(){var I=j;j=L;try{return _.apply(this,arguments)}finally{j=I}}}})(Yu)),Yu}var Qf;function Sp(){return Qf||(Qf=1,Gu.exports=vp()),Gu.exports}var qu={exports:{}},he={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and 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 Xf;function jp(){if(Xf)return he;Xf=1;var o=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),w=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),j=Symbol.iterator;function D(m){return m===null||typeof m!="object"?null:(m=j&&m[j]||m["@@iterator"],typeof m=="function"?m:null)}var G={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,de={};function ie(m,U,X){this.props=m,this.context=U,this.refs=de,this.updater=X||G}ie.prototype.isReactComponent={},ie.prototype.setState=function(m,U){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,U,"setState")},ie.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function ae(){}ae.prototype=ie.prototype;function ee(m,U,X){this.props=m,this.context=U,this.refs=de,this.updater=X||G}var W=ee.prototype=new ae;W.constructor=ee,z(W,ie.prototype),W.isPureReactComponent=!0;var Y=Array.isArray;function Q(){}var Z={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function $(m,U,X){var J=X.ref;return{$$typeof:o,type:m,key:U,ref:J!==void 0?J:null,props:X}}function ze(m,U){return $(m.type,U,m.props)}function ye(m){return typeof m=="object"&&m!==null&&m.$$typeof===o}function pe(m){var U={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(X){return U[X]})}var Ae=/\/+/g;function K(m,U){return typeof m=="object"&&m!==null&&m.key!=null?pe(""+m.key):U.toString(36)}function fe(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(Q,Q):(m.status="pending",m.then(function(U){m.status==="pending"&&(m.status="fulfilled",m.value=U)},function(U){m.status==="pending"&&(m.status="rejected",m.reason=U)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function _(m,U,X,J,se){var me=typeof m;(me==="undefined"||me==="boolean")&&(m=null);var be=!1;if(m===null)be=!0;else switch(me){case"bigint":case"string":case"number":be=!0;break;case"object":switch(m.$$typeof){case o:case r:be=!0;break;case k:return be=m._init,_(be(m._payload),U,X,J,se)}}if(be)return se=se(m),be=J===""?"."+K(m,0):J,Y(se)?(X="",be!=null&&(X=be.replace(Ae,"$&/")+"/"),_(se,U,X,"",function(St){return St})):se!=null&&(ye(se)&&(se=ze(se,X+(se.key==null||m&&m.key===se.key?"":(""+se.key).replace(Ae,"$&/")+"/")+be)),U.push(se)),1;be=0;var Je=J===""?".":J+":";if(Y(m))for(var Ee=0;Ee<m.length;Ee++)J=m[Ee],me=Je+K(J,Ee),be+=_(J,U,X,me,se);else if(Ee=D(m),typeof Ee=="function")for(m=Ee.call(m),Ee=0;!(J=m.next()).done;)J=J.value,me=Je+K(J,Ee++),be+=_(J,U,X,me,se);else if(me==="object"){if(typeof m.then=="function")return _(fe(m),U,X,J,se);throw U=String(m),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return be}function L(m,U,X){if(m==null)return m;var J=[],se=0;return _(m,J,"","",function(me){return U.call(X,me,se++)}),J}function I(m){if(m._status===-1){var U=m._result;U=U(),U.then(function(X){(m._status===0||m._status===-1)&&(m._status=1,m._result=X)},function(X){(m._status===0||m._status===-1)&&(m._status=2,m._result=X)}),m._status===-1&&(m._status=0,m._result=U)}if(m._status===1)return m._result.default;throw m._result}var V=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},ne={map:L,forEach:function(m,U,X){L(m,function(){U.apply(this,arguments)},X)},count:function(m){var U=0;return L(m,function(){U++}),U},toArray:function(m){return L(m,function(U){return U})||[]},only:function(m){if(!ye(m))throw Error("React.Children.only expected to receive a single React element child.");return m}};return he.Activity=v,he.Children=ne,he.Component=ie,he.Fragment=y,he.Profiler=S,he.PureComponent=ee,he.StrictMode=d,he.Suspense=b,he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,he.__COMPILER_RUNTIME={__proto__:null,c:function(m){return Z.H.useMemoCache(m)}},he.cache=function(m){return function(){return m.apply(null,arguments)}},he.cacheSignal=function(){return null},he.cloneElement=function(m,U,X){if(m==null)throw Error("The argument must be a React element, but you passed "+m+".");var J=z({},m.props),se=m.key;if(U!=null)for(me in U.key!==void 0&&(se=""+U.key),U)!oe.call(U,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&U.ref===void 0||(J[me]=U[me]);var me=arguments.length-2;if(me===1)J.children=X;else if(1<me){for(var be=Array(me),Je=0;Je<me;Je++)be[Je]=arguments[Je+2];J.children=be}return $(m.type,se,J)},he.createContext=function(m){return m={$$typeof:w,_currentValue:m,_currentValue2:m,_threadCount:0,Provider:null,Consumer:null},m.Provider=m,m.Consumer={$$typeof:E,_context:m},m},he.createElement=function(m,U,X){var J,se={},me=null;if(U!=null)for(J in U.key!==void 0&&(me=""+U.key),U)oe.call(U,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(se[J]=U[J]);var be=arguments.length-2;if(be===1)se.children=X;else if(1<be){for(var Je=Array(be),Ee=0;Ee<be;Ee++)Je[Ee]=arguments[Ee+2];se.children=Je}if(m&&m.defaultProps)for(J in be=m.defaultProps,be)se[J]===void 0&&(se[J]=be[J]);return $(m,me,se)},he.createRef=function(){return{current:null}},he.forwardRef=function(m){return{$$typeof:M,render:m}},he.isValidElement=ye,he.lazy=function(m){return{$$typeof:k,_payload:{_status:-1,_result:m},_init:I}},he.memo=function(m,U){return{$$typeof:x,type:m,compare:U===void 0?null:U}},he.startTransition=function(m){var U=Z.T,X={};Z.T=X;try{var J=m(),se=Z.S;se!==null&&se(X,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(Q,V)}catch(me){V(me)}finally{U!==null&&X.types!==null&&(U.types=X.types),Z.T=U}},he.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},he.use=function(m){return Z.H.use(m)},he.useActionState=function(m,U,X){return Z.H.useActionState(m,U,X)},he.useCallback=function(m,U){return Z.H.useCallback(m,U)},he.useContext=function(m){return Z.H.useContext(m)},he.useDebugValue=function(){},he.useDeferredValue=function(m,U){return Z.H.useDeferredValue(m,U)},he.useEffect=function(m,U){return Z.H.useEffect(m,U)},he.useEffectEvent=function(m){return Z.H.useEffectEvent(m)},he.useId=function(){return Z.H.useId()},he.useImperativeHandle=function(m,U,X){return Z.H.useImperativeHandle(m,U,X)},he.useInsertionEffect=function(m,U){return Z.H.useInsertionEffect(m,U)},he.useLayoutEffect=function(m,U){return Z.H.useLayoutEffect(m,U)},he.useMemo=function(m,U){return Z.H.useMemo(m,U)},he.useOptimistic=function(m,U){return Z.H.useOptimistic(m,U)},he.useReducer=function(m,U,X){return Z.H.useReducer(m,U,X)},he.useRef=function(m){return Z.H.useRef(m)},he.useState=function(m){return Z.H.useState(m)},he.useSyncExternalStore=function(m,U,X){return Z.H.useSyncExternalStore(m,U,X)},he.useTransition=function(){return Z.H.useTransition()},he.version="19.2.4",he}var Vf;function Zu(){return Vf||(Vf=1,qu.exports=jp()),qu.exports}var Qu={exports:{}},yt={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and 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 Zf;function Np(){if(Zf)return yt;Zf=1;var o=Zu();function r(b){var x="https://react.dev/errors/"+b;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var k=2;k<arguments.length;k++)x+="&args[]="+encodeURIComponent(arguments[k])}return"Minified React error #"+b+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function y(){}var d={d:{f:y,r:function(){throw Error(r(522))},D:y,C:y,L:y,m:y,X:y,S:y,M:y},p:0,findDOMNode:null},S=Symbol.for("react.portal");function E(b,x,k){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:S,key:v==null?null:""+v,children:b,containerInfo:x,implementation:k}}var w=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(b,x){if(b==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=d,yt.createPortal=function(b,x){var k=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(r(299));return E(b,x,null,k)},yt.flushSync=function(b){var x=w.T,k=d.p;try{if(w.T=null,d.p=2,b)return b()}finally{w.T=x,d.p=k,d.d.f()}},yt.preconnect=function(b,x){typeof b=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,d.d.C(b,x))},yt.prefetchDNS=function(b){typeof b=="string"&&d.d.D(b)},yt.preinit=function(b,x){if(typeof b=="string"&&x&&typeof x.as=="string"){var k=x.as,v=M(k,x.crossOrigin),j=typeof x.integrity=="string"?x.integrity:void 0,D=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;k==="style"?d.d.S(b,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:v,integrity:j,fetchPriority:D}):k==="script"&&d.d.X(b,{crossOrigin:v,integrity:j,fetchPriority:D,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},yt.preinitModule=function(b,x){if(typeof b=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var k=M(x.as,x.crossOrigin);d.d.M(b,{crossOrigin:k,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0})}}else x==null&&d.d.M(b)},yt.preload=function(b,x){if(typeof b=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var k=x.as,v=M(k,x.crossOrigin);d.d.L(b,k,{crossOrigin:v,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},yt.preloadModule=function(b,x){if(typeof b=="string")if(x){var k=M(x.as,x.crossOrigin);d.d.m(b,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:k,integrity:typeof x.integrity=="string"?x.integrity:void 0})}else d.d.m(b)},yt.requestFormReset=function(b){d.d.r(b)},yt.unstable_batchedUpdates=function(b,x){return b(x)},yt.useFormState=function(b,x,k){return w.H.useFormState(b,x,k)},yt.useFormStatus=function(){return w.H.useHostTransitionStatus()},yt.version="19.2.4",yt}var Kf;function Tp(){if(Kf)return Qu.exports;Kf=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(r){console.error(r)}}return o(),Qu.exports=Np(),Qu.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var Jf;function Ep(){if(Jf)return ci;Jf=1;var o=Sp(),r=Zu(),y=Tp();function d(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function S(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function E(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function w(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function M(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(E(e)!==e)throw Error(d(188))}function x(e){var t=e.alternate;if(!t){if(t=E(e),t===null)throw Error(d(188));return t!==e?null:e}for(var l=e,a=t;;){var n=l.return;if(n===null)break;var s=n.alternate;if(s===null){if(a=n.return,a!==null){l=a;continue}break}if(n.child===s.child){for(s=n.child;s;){if(s===l)return b(n),e;if(s===a)return b(n),t;s=s.sibling}throw Error(d(188))}if(l.return!==a.return)l=n,a=s;else{for(var c=!1,u=n.child;u;){if(u===l){c=!0,l=n,a=s;break}if(u===a){c=!0,a=n,l=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===l){c=!0,l=s,a=n;break}if(u===a){c=!0,a=s,l=n;break}u=u.sibling}if(!c)throw Error(d(189))}}if(l.alternate!==a)throw Error(d(190))}if(l.tag!==3)throw Error(d(188));return l.stateNode.current===l?e:t}function k(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=k(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,j=Symbol.for("react.element"),D=Symbol.for("react.transitional.element"),G=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),de=Symbol.for("react.strict_mode"),ie=Symbol.for("react.profiler"),ae=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),ze=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=ye&&e[ye]||e["@@iterator"],typeof e=="function"?e:null)}var Ae=Symbol.for("react.client.reference");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case z:return"Fragment";case ie:return"Profiler";case de:return"StrictMode";case Y:return"Suspense";case Q:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case G:return"Portal";case ee:return e.displayName||"Context";case ae:return(e._context.displayName||"Context")+".Consumer";case W:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return t=e.displayName||null,t!==null?t:K(e.type)||"Memo";case oe:t=e._payload,e=e._init;try{return K(e(t))}catch{}}return null}var fe=Array.isArray,_=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=y.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},V=[],ne=-1;function m(e){return{current:e}}function U(e){0>ne||(e.current=V[ne],V[ne]=null,ne--)}function X(e,t){ne++,V[ne]=e.current,e.current=t}var J=m(null),se=m(null),me=m(null),be=m(null);function Je(e,t){switch(X(me,t),X(se,e),X(J,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?of(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=of(t),e=rf(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(J),X(J,e)}function Ee(){U(J),U(se),U(me)}function St(e){e.memoizedState!==null&&X(be,e);var t=J.current,l=rf(t,e.type);t!==l&&(X(se,e),X(J,l))}function ht(e){se.current===e&&(U(J),U(se)),be.current===e&&(U(be),li._currentValue=I)}var ue,Xe;function De(e){if(ue===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||"",Xe=-1<l.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+ue+e+Xe}var pt=!1;function zt(e,t){if(!e||pt)return"";pt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var H=function(){throw Error()};if(Object.defineProperty(H.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(H,[])}catch(A){var C=A}Reflect.construct(e,[],H)}else{try{H.call()}catch(A){C=A}e.call(H.prototype)}}else{try{throw Error()}catch(A){C=A}(H=e())&&typeof H.catch=="function"&&H.catch(function(){})}}catch(A){if(A&&C&&typeof A.stack=="string")return[A.stack,C.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=a.DetermineComponentFrameRoot(),c=s[0],u=s[1];if(c&&u){var f=c.split(`
|
|
44
|
+
`),T=u.split(`
|
|
45
|
+
`);for(n=a=0;a<f.length&&!f[a].includes("DetermineComponentFrameRoot");)a++;for(;n<T.length&&!T[n].includes("DetermineComponentFrameRoot");)n++;if(a===f.length||n===T.length)for(a=f.length-1,n=T.length-1;1<=a&&0<=n&&f[a]!==T[n];)n--;for(;1<=a&&0<=n;a--,n--)if(f[a]!==T[n]){if(a!==1||n!==1)do if(a--,n--,0>n||f[a]!==T[n]){var O=`
|
|
46
|
+
`+f[a].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),O}while(1<=a&&0<=n);break}}}finally{pt=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?De(l):""}function oa(e,t){switch(e.tag){case 26:case 27:case 5:return De(e.type);case 16:return De("Lazy");case 13:return e.child!==t&&t!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return zt(e.type,!1);case 11:return zt(e.type.render,!1);case 1:return zt(e.type,!0);case 31:return De("Activity");default:return""}}function al(e){try{var t="",l=null;do t+=oa(e,l),l=e,e=e.return;while(e);return t}catch(a){return`
|
|
47
|
+
Error generating stack: `+a.message+`
|
|
48
|
+
`+a.stack}}var Rl=Object.prototype.hasOwnProperty,dl=o.unstable_scheduleCallback,kl=o.unstable_cancelCallback,fl=o.unstable_shouldYield,Hl=o.unstable_requestPaint,at=o.unstable_now,_a=o.unstable_getCurrentPriorityLevel,Oe=o.unstable_ImmediatePriority,nl=o.unstable_UserBlockingPriority,Ft=o.unstable_NormalPriority,Cs=o.unstable_LowPriority,fi=o.unstable_IdlePriority,_s=o.log,As=o.unstable_setDisableYieldValue,ml=null,xt=null;function It(e){if(typeof _s=="function"&&As(e),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(ml,e)}catch{}}var bt=Math.clz32?Math.clz32:We,B=Math.log,q=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(B(e)/q|0)|0}var ct=256,gt=262144,il=4194304;function Lt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function hl(e,t,l){var a=e.pendingLanes;if(a===0)return 0;var n=0,s=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var u=a&134217727;return u!==0?(a=u&~s,a!==0?n=Lt(a):(c&=u,c!==0?n=Lt(c):l||(l=u&~e,l!==0&&(n=Lt(l))))):(u=a&~s,u!==0?n=Lt(u):c!==0?n=Lt(c):l||(l=a&~e,l!==0&&(n=Lt(l)))),n===0?0:t!==0&&t!==n&&(t&s)===0&&(s=n&-n,l=t&-t,s>=l||s===32&&(l&4194048)!==0)?t:n}function Pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sl(){var e=il;return il<<=1,(il&62914560)===0&&(il=4194304),e}function Aa(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Bl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mi(e,t,l,a,n,s){var c=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var u=e.entanglements,f=e.expirationTimes,T=e.hiddenUpdates;for(l=c&~l;0<l;){var O=31-bt(l),H=1<<O;u[O]=0,f[O]=-1;var C=T[O];if(C!==null)for(T[O]=null,O=0;O<C.length;O++){var A=C[O];A!==null&&(A.lane&=-536870913)}l&=~H}a!==0&&hn(e,a,0),s!==0&&n===0&&e.tag!==0&&(e.suspendedLanes|=s&~(c&~t))}function hn(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-bt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|l&261930}function pn(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var a=31-bt(l),n=1<<a;n&t|e[a]&t&&(e[a]|=t),l&=~n}}function xn(e,t){var l=t&-t;return l=(l&42)!==0?1:Re(l),(l&(e.suspendedLanes|t))!==0?0:l}function Re(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nt(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Gt(){var e=L.p;return e!==0?e:(e=window.event,e===void 0?32:Mf(e.type))}function Ku(e,t){var l=L.p;try{return L.p=e,t()}finally{L.p=l}}var Ll=Math.random().toString(36).slice(2),ut="__reactFiber$"+Ll,Nt="__reactProps$"+Ll,wa="__reactContainer$"+Ll,ws="__reactEvents$"+Ll,sm="__reactListeners$"+Ll,cm="__reactHandles$"+Ll,Ju="__reactResources$"+Ll,bn="__reactMarker$"+Ll;function zs(e){delete e[ut],delete e[Nt],delete e[ws],delete e[sm],delete e[cm]}function za(e){var t=e[ut];if(t)return t;for(var l=e.parentNode;l;){if(t=l[wa]||l[ut]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=bf(e);e!==null;){if(l=e[ut])return l;e=bf(e)}return t}e=l,l=e.parentNode}return null}function Oa(e){if(e=e[ut]||e[wa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(d(33))}function Ua(e){var t=e[Ju];return t||(t=e[Ju]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function it(e){e[bn]=!0}var Wu=new Set,$u={};function ra(e,t){Ma(e,t),Ma(e+"Capture",t)}function Ma(e,t){for($u[e]=t,e=0;e<t.length;e++)Wu.add(t[e])}var um=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Fu={},Iu={};function om(e){return Rl.call(Iu,e)?!0:Rl.call(Fu,e)?!1:um.test(e)?Iu[e]=!0:(Fu[e]=!0,!1)}function hi(e,t,l){if(om(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function pi(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function pl(e,t,l,a){if(a===null)e.removeAttribute(l);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+a)}}function Yt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rm(e,t,l){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var n=a.get,s=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(c){l=""+c,s.call(this,c)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(c){l=""+c},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Os(e){if(!e._valueTracker){var t=Pu(e)?"checked":"value";e._valueTracker=rm(e,t,""+e[t])}}function eo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),a="";return e&&(a=Pu(e)?e.checked?"true":"false":e.value),e=a,e!==l?(t.setValue(e),!0):!1}function xi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var dm=/[\n"\\]/g;function qt(e){return e.replace(dm,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Us(e,t,l,a,n,s,c,u){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),t!=null?c==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Yt(t)):e.value!==""+Yt(t)&&(e.value=""+Yt(t)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),t!=null?Ms(e,c,Yt(t)):l!=null?Ms(e,c,Yt(l)):a!=null&&e.removeAttribute("value"),n==null&&s!=null&&(e.defaultChecked=!!s),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"?e.name=""+Yt(u):e.removeAttribute("name")}function to(e,t,l,a,n,s,c,u){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||l!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){Os(e);return}l=l!=null?""+Yt(l):"",t=t!=null?""+Yt(t):l,u||t===e.value||(e.value=t),e.defaultValue=t}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=u?e.checked:!!a,e.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),Os(e)}function Ms(e,t,l){t==="number"&&xi(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Da(e,t,l,a){if(e=e.options,t){t={};for(var n=0;n<l.length;n++)t["$"+l[n]]=!0;for(l=0;l<e.length;l++)n=t.hasOwnProperty("$"+e[l].value),e[l].selected!==n&&(e[l].selected=n),n&&a&&(e[l].defaultSelected=!0)}else{for(l=""+Yt(l),t=null,n=0;n<e.length;n++){if(e[n].value===l){e[n].selected=!0,a&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function lo(e,t,l){if(t!=null&&(t=""+Yt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Yt(l):""}function ao(e,t,l,a){if(t==null){if(a!=null){if(l!=null)throw Error(d(92));if(fe(a)){if(1<a.length)throw Error(d(93));a=a[0]}l=a}l==null&&(l=""),t=l}l=Yt(t),e.defaultValue=l,a=e.textContent,a===l&&a!==""&&a!==null&&(e.value=a),Os(e)}function Ra(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var fm=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function no(e,t,l){var a=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,l):typeof l!="number"||l===0||fm.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function io(e,t,l){if(t!=null&&typeof t!="object")throw Error(d(62));if(e=e.style,l!=null){for(var a in l)!l.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var n in t)a=t[n],t.hasOwnProperty(n)&&l[n]!==a&&no(e,n,a)}else for(var s in t)t.hasOwnProperty(s)&&no(e,s,t[s])}function Ds(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mm=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),hm=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bi(e){return hm.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xl(){}var Rs=null;function ks(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ka=null,Ha=null;function so(e){var t=Oa(e);if(t&&(e=t.stateNode)){var l=e[Nt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Us(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+qt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var a=l[t];if(a!==e&&a.form===e.form){var n=a[Nt]||null;if(!n)throw Error(d(90));Us(a,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<l.length;t++)a=l[t],a.form===e.form&&eo(a)}break e;case"textarea":lo(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Da(e,!!l.multiple,t,!1)}}}var Hs=!1;function co(e,t,l){if(Hs)return e(t,l);Hs=!0;try{var a=e(t);return a}finally{if(Hs=!1,(ka!==null||Ha!==null)&&(ns(),ka&&(t=ka,e=Ha,Ha=ka=null,so(t),e)))for(t=0;t<e.length;t++)so(e[t])}}function yn(e,t){var l=e.stateNode;if(l===null)return null;var a=l[Nt]||null;if(a===null)return null;l=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(d(231,t,typeof l));return l}var bl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bs=!1;if(bl)try{var vn={};Object.defineProperty(vn,"passive",{get:function(){Bs=!0}}),window.addEventListener("test",vn,vn),window.removeEventListener("test",vn,vn)}catch{Bs=!1}var Gl=null,Ls=null,gi=null;function uo(){if(gi)return gi;var e,t=Ls,l=t.length,a,n="value"in Gl?Gl.value:Gl.textContent,s=n.length;for(e=0;e<l&&t[e]===n[e];e++);var c=l-e;for(a=1;a<=c&&t[l-a]===n[s-a];a++);return gi=n.slice(e,1<a?1-a:void 0)}function yi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function vi(){return!0}function oo(){return!1}function Tt(e){function t(l,a,n,s,c){this._reactName=l,this._targetInst=n,this.type=a,this.nativeEvent=s,this.target=c,this.currentTarget=null;for(var u in e)e.hasOwnProperty(u)&&(l=e[u],this[u]=l?l(s):s[u]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?vi:oo,this.isPropagationStopped=oo,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=vi)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=vi)},persist:function(){},isPersistent:vi}),t}var da={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Si=Tt(da),Sn=v({},da,{view:0,detail:0}),pm=Tt(Sn),Gs,Ys,jn,ji=v({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qs,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==jn&&(jn&&e.type==="mousemove"?(Gs=e.screenX-jn.screenX,Ys=e.screenY-jn.screenY):Ys=Gs=0,jn=e),Gs)},movementY:function(e){return"movementY"in e?e.movementY:Ys}}),ro=Tt(ji),xm=v({},ji,{dataTransfer:0}),bm=Tt(xm),gm=v({},Sn,{relatedTarget:0}),qs=Tt(gm),ym=v({},da,{animationName:0,elapsedTime:0,pseudoElement:0}),vm=Tt(ym),Sm=v({},da,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jm=Tt(Sm),Nm=v({},da,{data:0}),fo=Tt(Nm),Tm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Em={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"},Cm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _m(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cm[e])?!!t[e]:!1}function Qs(){return _m}var Am=v({},Sn,{key:function(e){if(e.key){var t=Tm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=yi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Em[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qs,charCode:function(e){return e.type==="keypress"?yi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?yi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wm=Tt(Am),zm=v({},ji,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mo=Tt(zm),Om=v({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qs}),Um=Tt(Om),Mm=v({},da,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dm=Tt(Mm),Rm=v({},ji,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),km=Tt(Rm),Hm=v({},da,{newState:0,oldState:0}),Bm=Tt(Hm),Lm=[9,13,27,32],Xs=bl&&"CompositionEvent"in window,Nn=null;bl&&"documentMode"in document&&(Nn=document.documentMode);var Gm=bl&&"TextEvent"in window&&!Nn,ho=bl&&(!Xs||Nn&&8<Nn&&11>=Nn),po=" ",xo=!1;function bo(e,t){switch(e){case"keyup":return Lm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function go(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ba=!1;function Ym(e,t){switch(e){case"compositionend":return go(t);case"keypress":return t.which!==32?null:(xo=!0,po);case"textInput":return e=t.data,e===po&&xo?null:e;default:return null}}function qm(e,t){if(Ba)return e==="compositionend"||!Xs&&bo(e,t)?(e=uo(),gi=Ls=Gl=null,Ba=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ho&&t.locale!=="ko"?null:t.data;default:return null}}var Qm={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 yo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Qm[e.type]:t==="textarea"}function vo(e,t,l,a){ka?Ha?Ha.push(a):Ha=[a]:ka=a,t=ds(t,"onChange"),0<t.length&&(l=new Si("onChange","change",null,l,a),e.push({event:l,listeners:t}))}var Tn=null,En=null;function Xm(e){lf(e,0)}function Ni(e){var t=gn(e);if(eo(t))return e}function So(e,t){if(e==="change")return t}var jo=!1;if(bl){var Vs;if(bl){var Zs="oninput"in document;if(!Zs){var No=document.createElement("div");No.setAttribute("oninput","return;"),Zs=typeof No.oninput=="function"}Vs=Zs}else Vs=!1;jo=Vs&&(!document.documentMode||9<document.documentMode)}function To(){Tn&&(Tn.detachEvent("onpropertychange",Eo),En=Tn=null)}function Eo(e){if(e.propertyName==="value"&&Ni(En)){var t=[];vo(t,En,e,ks(e)),co(Xm,t)}}function Vm(e,t,l){e==="focusin"?(To(),Tn=t,En=l,Tn.attachEvent("onpropertychange",Eo)):e==="focusout"&&To()}function Zm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ni(En)}function Km(e,t){if(e==="click")return Ni(t)}function Jm(e,t){if(e==="input"||e==="change")return Ni(t)}function Wm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ot=typeof Object.is=="function"?Object.is:Wm;function Cn(e,t){if(Ot(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),a=Object.keys(t);if(l.length!==a.length)return!1;for(a=0;a<l.length;a++){var n=l[a];if(!Rl.call(t,n)||!Ot(e[n],t[n]))return!1}return!0}function Co(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _o(e,t){var l=Co(e);e=0;for(var a;l;){if(l.nodeType===3){if(a=e+l.textContent.length,e<=t&&a>=t)return{node:l,offset:t-e};e=a}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Co(l)}}function Ao(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ao(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wo(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xi(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=xi(e.document)}return t}function Ks(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var $m=bl&&"documentMode"in document&&11>=document.documentMode,La=null,Js=null,_n=null,Ws=!1;function zo(e,t,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ws||La==null||La!==xi(a)||(a=La,"selectionStart"in a&&Ks(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),_n&&Cn(_n,a)||(_n=a,a=ds(Js,"onSelect"),0<a.length&&(t=new Si("onSelect","select",null,t,l),e.push({event:t,listeners:a}),t.target=La)))}function fa(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ga={animationend:fa("Animation","AnimationEnd"),animationiteration:fa("Animation","AnimationIteration"),animationstart:fa("Animation","AnimationStart"),transitionrun:fa("Transition","TransitionRun"),transitionstart:fa("Transition","TransitionStart"),transitioncancel:fa("Transition","TransitionCancel"),transitionend:fa("Transition","TransitionEnd")},$s={},Oo={};bl&&(Oo=document.createElement("div").style,"AnimationEvent"in window||(delete Ga.animationend.animation,delete Ga.animationiteration.animation,delete Ga.animationstart.animation),"TransitionEvent"in window||delete Ga.transitionend.transition);function ma(e){if($s[e])return $s[e];if(!Ga[e])return e;var t=Ga[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Oo)return $s[e]=t[l];return e}var Uo=ma("animationend"),Mo=ma("animationiteration"),Do=ma("animationstart"),Fm=ma("transitionrun"),Im=ma("transitionstart"),Pm=ma("transitioncancel"),Ro=ma("transitionend"),ko=new Map,Fs="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Fs.push("scrollEnd");function el(e,t){ko.set(e,t),ra(t,[e])}var Ti=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qt=[],Ya=0,Is=0;function Ei(){for(var e=Ya,t=Is=Ya=0;t<e;){var l=Qt[t];Qt[t++]=null;var a=Qt[t];Qt[t++]=null;var n=Qt[t];Qt[t++]=null;var s=Qt[t];if(Qt[t++]=null,a!==null&&n!==null){var c=a.pending;c===null?n.next=n:(n.next=c.next,c.next=n),a.pending=n}s!==0&&Ho(l,n,s)}}function Ci(e,t,l,a){Qt[Ya++]=e,Qt[Ya++]=t,Qt[Ya++]=l,Qt[Ya++]=a,Is|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Ps(e,t,l,a){return Ci(e,t,l,a),_i(e)}function ha(e,t){return Ci(e,null,null,t),_i(e)}function Ho(e,t,l){e.lanes|=l;var a=e.alternate;a!==null&&(a.lanes|=l);for(var n=!1,s=e.return;s!==null;)s.childLanes|=l,a=s.alternate,a!==null&&(a.childLanes|=l),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(n=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,n&&t!==null&&(n=31-bt(l),e=s.hiddenUpdates,a=e[n],a===null?e[n]=[t]:a.push(t),t.lane=l|536870912),s):null}function _i(e){if(50<Wn)throw Wn=0,uu=null,Error(d(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var qa={};function eh(e,t,l,a){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ut(e,t,l,a){return new eh(e,t,l,a)}function ec(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gl(e,t){var l=e.alternate;return l===null?(l=Ut(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Bo(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ai(e,t,l,a,n,s){var c=0;if(a=e,typeof e=="function")ec(e)&&(c=1);else if(typeof e=="string")c=ip(e,l,J.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=Ut(31,l,t,n),e.elementType=$,e.lanes=s,e;case z:return pa(l.children,n,s,t);case de:c=8,n|=24;break;case ie:return e=Ut(12,l,t,n|2),e.elementType=ie,e.lanes=s,e;case Y:return e=Ut(13,l,t,n),e.elementType=Y,e.lanes=s,e;case Q:return e=Ut(19,l,t,n),e.elementType=Q,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:c=10;break e;case ae:c=9;break e;case W:c=11;break e;case Z:c=14;break e;case oe:c=16,a=null;break e}c=29,l=Error(d(130,e===null?"null":typeof e,"")),a=null}return t=Ut(c,l,t,n),t.elementType=e,t.type=a,t.lanes=s,t}function pa(e,t,l,a){return e=Ut(7,e,a,t),e.lanes=l,e}function tc(e,t,l){return e=Ut(6,e,null,t),e.lanes=l,e}function Lo(e){var t=Ut(18,null,null,0);return t.stateNode=e,t}function lc(e,t,l){return t=Ut(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Go=new WeakMap;function Xt(e,t){if(typeof e=="object"&&e!==null){var l=Go.get(e);return l!==void 0?l:(t={value:e,source:t,stack:al(t)},Go.set(e,t),t)}return{value:e,source:t,stack:al(t)}}var Qa=[],Xa=0,wi=null,An=0,Vt=[],Zt=0,Yl=null,cl=1,ul="";function yl(e,t){Qa[Xa++]=An,Qa[Xa++]=wi,wi=e,An=t}function Yo(e,t,l){Vt[Zt++]=cl,Vt[Zt++]=ul,Vt[Zt++]=Yl,Yl=e;var a=cl;e=ul;var n=32-bt(a)-1;a&=~(1<<n),l+=1;var s=32-bt(t)+n;if(30<s){var c=n-n%5;s=(a&(1<<c)-1).toString(32),a>>=c,n-=c,cl=1<<32-bt(t)+n|l<<n|a,ul=s+e}else cl=1<<s|l<<n|a,ul=e}function ac(e){e.return!==null&&(yl(e,1),Yo(e,1,0))}function nc(e){for(;e===wi;)wi=Qa[--Xa],Qa[Xa]=null,An=Qa[--Xa],Qa[Xa]=null;for(;e===Yl;)Yl=Vt[--Zt],Vt[Zt]=null,ul=Vt[--Zt],Vt[Zt]=null,cl=Vt[--Zt],Vt[Zt]=null}function qo(e,t){Vt[Zt++]=cl,Vt[Zt++]=ul,Vt[Zt++]=Yl,cl=t.id,ul=t.overflow,Yl=e}var ot=null,Ye=null,Te=!1,ql=null,Kt=!1,ic=Error(d(519));function Ql(e){var t=Error(d(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wn(Xt(t,e)),ic}function Qo(e){var t=e.stateNode,l=e.type,a=e.memoizedProps;switch(t[ut]=e,t[Nt]=a,l){case"dialog":Se("cancel",t),Se("close",t);break;case"iframe":case"object":case"embed":Se("load",t);break;case"video":case"audio":for(l=0;l<Fn.length;l++)Se(Fn[l],t);break;case"source":Se("error",t);break;case"img":case"image":case"link":Se("error",t),Se("load",t);break;case"details":Se("toggle",t);break;case"input":Se("invalid",t),to(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Se("invalid",t);break;case"textarea":Se("invalid",t),ao(t,a.value,a.defaultValue,a.children)}l=a.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||a.suppressHydrationWarning===!0||cf(t.textContent,l)?(a.popover!=null&&(Se("beforetoggle",t),Se("toggle",t)),a.onScroll!=null&&Se("scroll",t),a.onScrollEnd!=null&&Se("scrollend",t),a.onClick!=null&&(t.onclick=xl),t=!0):t=!1,t||Ql(e,!0)}function Xo(e){for(ot=e.return;ot;)switch(ot.tag){case 5:case 31:case 13:Kt=!1;return;case 27:case 3:Kt=!0;return;default:ot=ot.return}}function Va(e){if(e!==ot)return!1;if(!Te)return Xo(e),Te=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Nu(e.type,e.memoizedProps)),l=!l),l&&Ye&&Ql(e),Xo(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(d(317));Ye=xf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(d(317));Ye=xf(e)}else t===27?(t=Ye,aa(e.type)?(e=Au,Au=null,Ye=e):Ye=t):Ye=ot?Wt(e.stateNode.nextSibling):null;return!0}function xa(){Ye=ot=null,Te=!1}function sc(){var e=ql;return e!==null&&(At===null?At=e:At.push.apply(At,e),ql=null),e}function wn(e){ql===null?ql=[e]:ql.push(e)}var cc=m(null),ba=null,vl=null;function Xl(e,t,l){X(cc,t._currentValue),t._currentValue=l}function Sl(e){e._currentValue=cc.current,U(cc)}function uc(e,t,l){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===l)break;e=e.return}}function oc(e,t,l,a){var n=e.child;for(n!==null&&(n.return=e);n!==null;){var s=n.dependencies;if(s!==null){var c=n.child;s=s.firstContext;e:for(;s!==null;){var u=s;s=n;for(var f=0;f<t.length;f++)if(u.context===t[f]){s.lanes|=l,u=s.alternate,u!==null&&(u.lanes|=l),uc(s.return,l,e),a||(c=null);break e}s=u.next}}else if(n.tag===18){if(c=n.return,c===null)throw Error(d(341));c.lanes|=l,s=c.alternate,s!==null&&(s.lanes|=l),uc(c,l,e),c=null}else c=n.child;if(c!==null)c.return=n;else for(c=n;c!==null;){if(c===e){c=null;break}if(n=c.sibling,n!==null){n.return=c.return,c=n;break}c=c.return}n=c}}function Za(e,t,l,a){e=null;for(var n=t,s=!1;n!==null;){if(!s){if((n.flags&524288)!==0)s=!0;else if((n.flags&262144)!==0)break}if(n.tag===10){var c=n.alternate;if(c===null)throw Error(d(387));if(c=c.memoizedProps,c!==null){var u=n.type;Ot(n.pendingProps.value,c.value)||(e!==null?e.push(u):e=[u])}}else if(n===be.current){if(c=n.alternate,c===null)throw Error(d(387));c.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(e!==null?e.push(li):e=[li])}n=n.return}e!==null&&oc(t,e,l,a),t.flags|=262144}function zi(e){for(e=e.firstContext;e!==null;){if(!Ot(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ga(e){ba=e,vl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rt(e){return Vo(ba,e)}function Oi(e,t){return ba===null&&ga(e),Vo(e,t)}function Vo(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},vl===null){if(e===null)throw Error(d(308));vl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vl=vl.next=t;return l}var th=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},lh=o.unstable_scheduleCallback,ah=o.unstable_NormalPriority,Ie={$$typeof:ee,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rc(){return{controller:new th,data:new Map,refCount:0}}function zn(e){e.refCount--,e.refCount===0&&lh(ah,function(){e.controller.abort()})}var On=null,dc=0,Ka=0,Ja=null;function nh(e,t){if(On===null){var l=On=[];dc=0,Ka=hu(),Ja={status:"pending",value:void 0,then:function(a){l.push(a)}}}return dc++,t.then(Zo,Zo),t}function Zo(){if(--dc===0&&On!==null){Ja!==null&&(Ja.status="fulfilled");var e=On;On=null,Ka=0,Ja=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ih(e,t){var l=[],a={status:"pending",value:null,reason:null,then:function(n){l.push(n)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var n=0;n<l.length;n++)(0,l[n])(t)},function(n){for(a.status="rejected",a.reason=n,n=0;n<l.length;n++)(0,l[n])(void 0)}),a}var Ko=_.S;_.S=function(e,t){zd=at(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&nh(e,t),Ko!==null&&Ko(e,t)};var ya=m(null);function fc(){var e=ya.current;return e!==null?e:Le.pooledCache}function Ui(e,t){t===null?X(ya,ya.current):X(ya,t.pool)}function Jo(){var e=fc();return e===null?null:{parent:Ie._currentValue,pool:e}}var Wa=Error(d(460)),mc=Error(d(474)),Mi=Error(d(542)),Di={then:function(){}};function Wo(e){return e=e.status,e==="fulfilled"||e==="rejected"}function $o(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(xl,xl),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Io(e),e;default:if(typeof t.status=="string")t.then(xl,xl);else{if(e=Le,e!==null&&100<e.shellSuspendCounter)throw Error(d(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var n=t;n.status="fulfilled",n.value=a}},function(a){if(t.status==="pending"){var n=t;n.status="rejected",n.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Io(e),e}throw Sa=t,Wa}}function va(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Sa=l,Wa):l}}var Sa=null;function Fo(){if(Sa===null)throw Error(d(459));var e=Sa;return Sa=null,e}function Io(e){if(e===Wa||e===Mi)throw Error(d(483))}var $a=null,Un=0;function Ri(e){var t=Un;return Un+=1,$a===null&&($a=[]),$o($a,e,t)}function Mn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ki(e,t){throw t.$$typeof===j?Error(d(525)):(e=Object.prototype.toString.call(t),Error(d(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Po(e){function t(g,p){if(e){var N=g.deletions;N===null?(g.deletions=[p],g.flags|=16):N.push(p)}}function l(g,p){if(!e)return null;for(;p!==null;)t(g,p),p=p.sibling;return null}function a(g){for(var p=new Map;g!==null;)g.key!==null?p.set(g.key,g):p.set(g.index,g),g=g.sibling;return p}function n(g,p){return g=gl(g,p),g.index=0,g.sibling=null,g}function s(g,p,N){return g.index=N,e?(N=g.alternate,N!==null?(N=N.index,N<p?(g.flags|=67108866,p):N):(g.flags|=67108866,p)):(g.flags|=1048576,p)}function c(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function u(g,p,N,R){return p===null||p.tag!==6?(p=tc(N,g.mode,R),p.return=g,p):(p=n(p,N),p.return=g,p)}function f(g,p,N,R){var ce=N.type;return ce===z?O(g,p,N.props.children,R,N.key):p!==null&&(p.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===oe&&va(ce)===p.type)?(p=n(p,N.props),Mn(p,N),p.return=g,p):(p=Ai(N.type,N.key,N.props,null,g.mode,R),Mn(p,N),p.return=g,p)}function T(g,p,N,R){return p===null||p.tag!==4||p.stateNode.containerInfo!==N.containerInfo||p.stateNode.implementation!==N.implementation?(p=lc(N,g.mode,R),p.return=g,p):(p=n(p,N.children||[]),p.return=g,p)}function O(g,p,N,R,ce){return p===null||p.tag!==7?(p=pa(N,g.mode,R,ce),p.return=g,p):(p=n(p,N),p.return=g,p)}function H(g,p,N){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=tc(""+p,g.mode,N),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case D:return N=Ai(p.type,p.key,p.props,null,g.mode,N),Mn(N,p),N.return=g,N;case G:return p=lc(p,g.mode,N),p.return=g,p;case oe:return p=va(p),H(g,p,N)}if(fe(p)||pe(p))return p=pa(p,g.mode,N,null),p.return=g,p;if(typeof p.then=="function")return H(g,Ri(p),N);if(p.$$typeof===ee)return H(g,Oi(g,p),N);ki(g,p)}return null}function C(g,p,N,R){var ce=p!==null?p.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return ce!==null?null:u(g,p,""+N,R);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case D:return N.key===ce?f(g,p,N,R):null;case G:return N.key===ce?T(g,p,N,R):null;case oe:return N=va(N),C(g,p,N,R)}if(fe(N)||pe(N))return ce!==null?null:O(g,p,N,R,null);if(typeof N.then=="function")return C(g,p,Ri(N),R);if(N.$$typeof===ee)return C(g,p,Oi(g,N),R);ki(g,N)}return null}function A(g,p,N,R,ce){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return g=g.get(N)||null,u(p,g,""+R,ce);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case D:return g=g.get(R.key===null?N:R.key)||null,f(p,g,R,ce);case G:return g=g.get(R.key===null?N:R.key)||null,T(p,g,R,ce);case oe:return R=va(R),A(g,p,N,R,ce)}if(fe(R)||pe(R))return g=g.get(N)||null,O(p,g,R,ce,null);if(typeof R.then=="function")return A(g,p,N,Ri(R),ce);if(R.$$typeof===ee)return A(g,p,N,Oi(p,R),ce);ki(p,R)}return null}function P(g,p,N,R){for(var ce=null,Ce=null,le=p,ge=p=0,Ne=null;le!==null&&ge<N.length;ge++){le.index>ge?(Ne=le,le=null):Ne=le.sibling;var _e=C(g,le,N[ge],R);if(_e===null){le===null&&(le=Ne);break}e&&le&&_e.alternate===null&&t(g,le),p=s(_e,p,ge),Ce===null?ce=_e:Ce.sibling=_e,Ce=_e,le=Ne}if(ge===N.length)return l(g,le),Te&&yl(g,ge),ce;if(le===null){for(;ge<N.length;ge++)le=H(g,N[ge],R),le!==null&&(p=s(le,p,ge),Ce===null?ce=le:Ce.sibling=le,Ce=le);return Te&&yl(g,ge),ce}for(le=a(le);ge<N.length;ge++)Ne=A(le,g,ge,N[ge],R),Ne!==null&&(e&&Ne.alternate!==null&&le.delete(Ne.key===null?ge:Ne.key),p=s(Ne,p,ge),Ce===null?ce=Ne:Ce.sibling=Ne,Ce=Ne);return e&&le.forEach(function(ua){return t(g,ua)}),Te&&yl(g,ge),ce}function re(g,p,N,R){if(N==null)throw Error(d(151));for(var ce=null,Ce=null,le=p,ge=p=0,Ne=null,_e=N.next();le!==null&&!_e.done;ge++,_e=N.next()){le.index>ge?(Ne=le,le=null):Ne=le.sibling;var ua=C(g,le,_e.value,R);if(ua===null){le===null&&(le=Ne);break}e&&le&&ua.alternate===null&&t(g,le),p=s(ua,p,ge),Ce===null?ce=ua:Ce.sibling=ua,Ce=ua,le=Ne}if(_e.done)return l(g,le),Te&&yl(g,ge),ce;if(le===null){for(;!_e.done;ge++,_e=N.next())_e=H(g,_e.value,R),_e!==null&&(p=s(_e,p,ge),Ce===null?ce=_e:Ce.sibling=_e,Ce=_e);return Te&&yl(g,ge),ce}for(le=a(le);!_e.done;ge++,_e=N.next())_e=A(le,g,ge,_e.value,R),_e!==null&&(e&&_e.alternate!==null&&le.delete(_e.key===null?ge:_e.key),p=s(_e,p,ge),Ce===null?ce=_e:Ce.sibling=_e,Ce=_e);return e&&le.forEach(function(xp){return t(g,xp)}),Te&&yl(g,ge),ce}function Be(g,p,N,R){if(typeof N=="object"&&N!==null&&N.type===z&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case D:e:{for(var ce=N.key;p!==null;){if(p.key===ce){if(ce=N.type,ce===z){if(p.tag===7){l(g,p.sibling),R=n(p,N.props.children),R.return=g,g=R;break e}}else if(p.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===oe&&va(ce)===p.type){l(g,p.sibling),R=n(p,N.props),Mn(R,N),R.return=g,g=R;break e}l(g,p);break}else t(g,p);p=p.sibling}N.type===z?(R=pa(N.props.children,g.mode,R,N.key),R.return=g,g=R):(R=Ai(N.type,N.key,N.props,null,g.mode,R),Mn(R,N),R.return=g,g=R)}return c(g);case G:e:{for(ce=N.key;p!==null;){if(p.key===ce)if(p.tag===4&&p.stateNode.containerInfo===N.containerInfo&&p.stateNode.implementation===N.implementation){l(g,p.sibling),R=n(p,N.children||[]),R.return=g,g=R;break e}else{l(g,p);break}else t(g,p);p=p.sibling}R=lc(N,g.mode,R),R.return=g,g=R}return c(g);case oe:return N=va(N),Be(g,p,N,R)}if(fe(N))return P(g,p,N,R);if(pe(N)){if(ce=pe(N),typeof ce!="function")throw Error(d(150));return N=ce.call(N),re(g,p,N,R)}if(typeof N.then=="function")return Be(g,p,Ri(N),R);if(N.$$typeof===ee)return Be(g,p,Oi(g,N),R);ki(g,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,p!==null&&p.tag===6?(l(g,p.sibling),R=n(p,N),R.return=g,g=R):(l(g,p),R=tc(N,g.mode,R),R.return=g,g=R),c(g)):l(g,p)}return function(g,p,N,R){try{Un=0;var ce=Be(g,p,N,R);return $a=null,ce}catch(le){if(le===Wa||le===Mi)throw le;var Ce=Ut(29,le,null,g.mode);return Ce.lanes=R,Ce.return=g,Ce}finally{}}}var ja=Po(!0),er=Po(!1),Vl=!1;function hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Zl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Kl(e,t,l){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(we&2)!==0){var n=a.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),a.pending=t,t=_i(e),Ho(e,null,l),t}return Ci(e,a,t,l),_i(e)}function Dn(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,pn(e,l)}}function xc(e,t){var l=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,s=null;if(l=l.firstBaseUpdate,l!==null){do{var c={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};s===null?n=s=c:s=s.next=c,l=l.next}while(l!==null);s===null?n=s=t:s=s.next=t}else n=s=t;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:s,shared:a.shared,callbacks:a.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var bc=!1;function Rn(){if(bc){var e=Ja;if(e!==null)throw e}}function kn(e,t,l,a){bc=!1;var n=e.updateQueue;Vl=!1;var s=n.firstBaseUpdate,c=n.lastBaseUpdate,u=n.shared.pending;if(u!==null){n.shared.pending=null;var f=u,T=f.next;f.next=null,c===null?s=T:c.next=T,c=f;var O=e.alternate;O!==null&&(O=O.updateQueue,u=O.lastBaseUpdate,u!==c&&(u===null?O.firstBaseUpdate=T:u.next=T,O.lastBaseUpdate=f))}if(s!==null){var H=n.baseState;c=0,O=T=f=null,u=s;do{var C=u.lane&-536870913,A=C!==u.lane;if(A?(je&C)===C:(a&C)===C){C!==0&&C===Ka&&(bc=!0),O!==null&&(O=O.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});e:{var P=e,re=u;C=t;var Be=l;switch(re.tag){case 1:if(P=re.payload,typeof P=="function"){H=P.call(Be,H,C);break e}H=P;break e;case 3:P.flags=P.flags&-65537|128;case 0:if(P=re.payload,C=typeof P=="function"?P.call(Be,H,C):P,C==null)break e;H=v({},H,C);break e;case 2:Vl=!0}}C=u.callback,C!==null&&(e.flags|=64,A&&(e.flags|=8192),A=n.callbacks,A===null?n.callbacks=[C]:A.push(C))}else A={lane:C,tag:u.tag,payload:u.payload,callback:u.callback,next:null},O===null?(T=O=A,f=H):O=O.next=A,c|=C;if(u=u.next,u===null){if(u=n.shared.pending,u===null)break;A=u,u=A.next,A.next=null,n.lastBaseUpdate=A,n.shared.pending=null}}while(!0);O===null&&(f=H),n.baseState=f,n.firstBaseUpdate=T,n.lastBaseUpdate=O,s===null&&(n.shared.lanes=0),Il|=c,e.lanes=c,e.memoizedState=H}}function tr(e,t){if(typeof e!="function")throw Error(d(191,e));e.call(t)}function lr(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)tr(l[e],t)}var Fa=m(null),Hi=m(0);function ar(e,t){e=zl,X(Hi,e),X(Fa,t),zl=e|t.baseLanes}function gc(){X(Hi,zl),X(Fa,Fa.current)}function yc(){zl=Hi.current,U(Fa),U(Hi)}var Mt=m(null),Jt=null;function Jl(e){var t=e.alternate;X($e,$e.current&1),X(Mt,e),Jt===null&&(t===null||Fa.current!==null||t.memoizedState!==null)&&(Jt=e)}function vc(e){X($e,$e.current),X(Mt,e),Jt===null&&(Jt=e)}function nr(e){e.tag===22?(X($e,$e.current),X(Mt,e),Jt===null&&(Jt=e)):Wl()}function Wl(){X($e,$e.current),X(Mt,Mt.current)}function Dt(e){U(Mt),Jt===e&&(Jt=null),U($e)}var $e=m(0);function Bi(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Cu(l)||_u(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var jl=0,xe=null,ke=null,Pe=null,Li=!1,Ia=!1,Na=!1,Gi=0,Hn=0,Pa=null,sh=0;function Ze(){throw Error(d(321))}function Sc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Ot(e[l],t[l]))return!1;return!0}function jc(e,t,l,a,n,s){return jl=s,xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_.H=e===null||e.memoizedState===null?Yr:Hc,Na=!1,s=l(a,n),Na=!1,Ia&&(s=sr(t,l,a,n)),ir(e),s}function ir(e){_.H=Gn;var t=ke!==null&&ke.next!==null;if(jl=0,Pe=ke=xe=null,Li=!1,Hn=0,Pa=null,t)throw Error(d(300));e===null||et||(e=e.dependencies,e!==null&&zi(e)&&(et=!0))}function sr(e,t,l,a){xe=e;var n=0;do{if(Ia&&(Pa=null),Hn=0,Ia=!1,25<=n)throw Error(d(301));if(n+=1,Pe=ke=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}_.H=qr,s=t(l,a)}while(Ia);return s}function ch(){var e=_.H,t=e.useState()[0];return t=typeof t.then=="function"?Bn(t):t,e=e.useState()[0],(ke!==null?ke.memoizedState:null)!==e&&(xe.flags|=1024),t}function Nc(){var e=Gi!==0;return Gi=0,e}function Tc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Ec(e){if(Li){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Li=!1}jl=0,Pe=ke=xe=null,Ia=!1,Hn=Gi=0,Pa=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pe===null?xe.memoizedState=Pe=e:Pe=Pe.next=e,Pe}function Fe(){if(ke===null){var e=xe.alternate;e=e!==null?e.memoizedState:null}else e=ke.next;var t=Pe===null?xe.memoizedState:Pe.next;if(t!==null)Pe=t,ke=e;else{if(e===null)throw xe.alternate===null?Error(d(467)):Error(d(310));ke=e,e={memoizedState:ke.memoizedState,baseState:ke.baseState,baseQueue:ke.baseQueue,queue:ke.queue,next:null},Pe===null?xe.memoizedState=Pe=e:Pe=Pe.next=e}return Pe}function Yi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bn(e){var t=Hn;return Hn+=1,Pa===null&&(Pa=[]),e=$o(Pa,e,t),t=xe,(Pe===null?t.memoizedState:Pe.next)===null&&(t=t.alternate,_.H=t===null||t.memoizedState===null?Yr:Hc),e}function qi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Bn(e);if(e.$$typeof===ee)return rt(e)}throw Error(d(438,String(e)))}function Cc(e){var t=null,l=xe.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var a=xe.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(n){return n.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=Yi(),xe.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),a=0;a<e;a++)l[a]=ze;return t.index++,l}function Nl(e,t){return typeof t=="function"?t(e):t}function Qi(e){var t=Fe();return _c(t,ke,e)}function _c(e,t,l){var a=e.queue;if(a===null)throw Error(d(311));a.lastRenderedReducer=l;var n=e.baseQueue,s=a.pending;if(s!==null){if(n!==null){var c=n.next;n.next=s.next,s.next=c}t.baseQueue=n=s,a.pending=null}if(s=e.baseState,n===null)e.memoizedState=s;else{t=n.next;var u=c=null,f=null,T=t,O=!1;do{var H=T.lane&-536870913;if(H!==T.lane?(je&H)===H:(jl&H)===H){var C=T.revertLane;if(C===0)f!==null&&(f=f.next={lane:0,revertLane:0,gesture:null,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null}),H===Ka&&(O=!0);else if((jl&C)===C){T=T.next,C===Ka&&(O=!0);continue}else H={lane:0,revertLane:T.revertLane,gesture:null,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null},f===null?(u=f=H,c=s):f=f.next=H,xe.lanes|=C,Il|=C;H=T.action,Na&&l(s,H),s=T.hasEagerState?T.eagerState:l(s,H)}else C={lane:H,revertLane:T.revertLane,gesture:T.gesture,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null},f===null?(u=f=C,c=s):f=f.next=C,xe.lanes|=H,Il|=H;T=T.next}while(T!==null&&T!==t);if(f===null?c=s:f.next=u,!Ot(s,e.memoizedState)&&(et=!0,O&&(l=Ja,l!==null)))throw l;e.memoizedState=s,e.baseState=c,e.baseQueue=f,a.lastRenderedState=s}return n===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Ac(e){var t=Fe(),l=t.queue;if(l===null)throw Error(d(311));l.lastRenderedReducer=e;var a=l.dispatch,n=l.pending,s=t.memoizedState;if(n!==null){l.pending=null;var c=n=n.next;do s=e(s,c.action),c=c.next;while(c!==n);Ot(s,t.memoizedState)||(et=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),l.lastRenderedState=s}return[s,a]}function cr(e,t,l){var a=xe,n=Fe(),s=Te;if(s){if(l===void 0)throw Error(d(407));l=l()}else l=t();var c=!Ot((ke||n).memoizedState,l);if(c&&(n.memoizedState=l,et=!0),n=n.queue,Oc(rr.bind(null,a,n,e),[e]),n.getSnapshot!==t||c||Pe!==null&&Pe.memoizedState.tag&1){if(a.flags|=2048,en(9,{destroy:void 0},or.bind(null,a,n,l,t),null),Le===null)throw Error(d(349));s||(jl&127)!==0||ur(a,t,l)}return l}function ur(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=xe.updateQueue,t===null?(t=Yi(),xe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function or(e,t,l,a){t.value=l,t.getSnapshot=a,dr(t)&&fr(e)}function rr(e,t,l){return l(function(){dr(t)&&fr(e)})}function dr(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Ot(e,l)}catch{return!0}}function fr(e){var t=ha(e,2);t!==null&&wt(t,e,2)}function wc(e){var t=jt();if(typeof e=="function"){var l=e;if(e=l(),Na){It(!0);try{l()}finally{It(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:e},t}function mr(e,t,l,a){return e.baseState=l,_c(e,ke,typeof a=="function"?a:Nl)}function uh(e,t,l,a,n){if(Zi(e))throw Error(d(485));if(e=t.action,e!==null){var s={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(c){s.listeners.push(c)}};_.T!==null?l(!0):s.isTransition=!1,a(s),l=t.pending,l===null?(s.next=t.pending=s,hr(t,s)):(s.next=l.next,t.pending=l.next=s)}}function hr(e,t){var l=t.action,a=t.payload,n=e.state;if(t.isTransition){var s=_.T,c={};_.T=c;try{var u=l(n,a),f=_.S;f!==null&&f(c,u),pr(e,t,u)}catch(T){zc(e,t,T)}finally{s!==null&&c.types!==null&&(s.types=c.types),_.T=s}}else try{s=l(n,a),pr(e,t,s)}catch(T){zc(e,t,T)}}function pr(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(a){xr(e,t,a)},function(a){return zc(e,t,a)}):xr(e,t,l)}function xr(e,t,l){t.status="fulfilled",t.value=l,br(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,hr(e,l)))}function zc(e,t,l){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=l,br(t),t=t.next;while(t!==a)}e.action=null}function br(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function gr(e,t){return t}function yr(e,t){if(Te){var l=Le.formState;if(l!==null){e:{var a=xe;if(Te){if(Ye){t:{for(var n=Ye,s=Kt;n.nodeType!==8;){if(!s){n=null;break t}if(n=Wt(n.nextSibling),n===null){n=null;break t}}s=n.data,n=s==="F!"||s==="F"?n:null}if(n){Ye=Wt(n.nextSibling),a=n.data==="F!";break e}}Ql(a)}a=!1}a&&(t=l[0])}}return l=jt(),l.memoizedState=l.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:t},l.queue=a,l=Br.bind(null,xe,a),a.dispatch=l,a=wc(!1),s=kc.bind(null,xe,!1,a.queue),a=jt(),n={state:t,dispatch:null,action:e,pending:null},a.queue=n,l=uh.bind(null,xe,n,s,l),n.dispatch=l,a.memoizedState=e,[t,l,!1]}function vr(e){var t=Fe();return Sr(t,ke,e)}function Sr(e,t,l){if(t=_c(e,t,gr)[0],e=Qi(Nl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Bn(t)}catch(c){throw c===Wa?Mi:c}else a=t;t=Fe();var n=t.queue,s=n.dispatch;return l!==t.memoizedState&&(xe.flags|=2048,en(9,{destroy:void 0},oh.bind(null,n,l),null)),[a,s,e]}function oh(e,t){e.action=t}function jr(e){var t=Fe(),l=ke;if(l!==null)return Sr(t,l,e);Fe(),t=t.memoizedState,l=Fe();var a=l.queue.dispatch;return l.memoizedState=e,[t,a,!1]}function en(e,t,l,a){return e={tag:e,create:l,deps:a,inst:t,next:null},t=xe.updateQueue,t===null&&(t=Yi(),xe.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(a=l.next,l.next=e,e.next=a,t.lastEffect=e),e}function Nr(){return Fe().memoizedState}function Xi(e,t,l,a){var n=jt();xe.flags|=e,n.memoizedState=en(1|t,{destroy:void 0},l,a===void 0?null:a)}function Vi(e,t,l,a){var n=Fe();a=a===void 0?null:a;var s=n.memoizedState.inst;ke!==null&&a!==null&&Sc(a,ke.memoizedState.deps)?n.memoizedState=en(t,s,l,a):(xe.flags|=e,n.memoizedState=en(1|t,s,l,a))}function Tr(e,t){Xi(8390656,8,e,t)}function Oc(e,t){Vi(2048,8,e,t)}function rh(e){xe.flags|=4;var t=xe.updateQueue;if(t===null)t=Yi(),xe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Er(e){var t=Fe().memoizedState;return rh({ref:t,nextImpl:e}),function(){if((we&2)!==0)throw Error(d(440));return t.impl.apply(void 0,arguments)}}function Cr(e,t){return Vi(4,2,e,t)}function _r(e,t){return Vi(4,4,e,t)}function Ar(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wr(e,t,l){l=l!=null?l.concat([e]):null,Vi(4,4,Ar.bind(null,t,e),l)}function Uc(){}function zr(e,t){var l=Fe();t=t===void 0?null:t;var a=l.memoizedState;return t!==null&&Sc(t,a[1])?a[0]:(l.memoizedState=[e,t],e)}function Or(e,t){var l=Fe();t=t===void 0?null:t;var a=l.memoizedState;if(t!==null&&Sc(t,a[1]))return a[0];if(a=e(),Na){It(!0);try{e()}finally{It(!1)}}return l.memoizedState=[a,t],a}function Mc(e,t,l){return l===void 0||(jl&1073741824)!==0&&(je&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Ud(),xe.lanes|=e,Il|=e,l)}function Ur(e,t,l,a){return Ot(l,t)?l:Fa.current!==null?(e=Mc(e,l,a),Ot(e,t)||(et=!0),e):(jl&42)===0||(jl&1073741824)!==0&&(je&261930)===0?(et=!0,e.memoizedState=l):(e=Ud(),xe.lanes|=e,Il|=e,t)}function Mr(e,t,l,a,n){var s=L.p;L.p=s!==0&&8>s?s:8;var c=_.T,u={};_.T=u,kc(e,!1,t,l);try{var f=n(),T=_.S;if(T!==null&&T(u,f),f!==null&&typeof f=="object"&&typeof f.then=="function"){var O=ih(f,a);Ln(e,t,O,Ht(e))}else Ln(e,t,a,Ht(e))}catch(H){Ln(e,t,{then:function(){},status:"rejected",reason:H},Ht())}finally{L.p=s,c!==null&&u.types!==null&&(c.types=u.types),_.T=c}}function dh(){}function Dc(e,t,l,a){if(e.tag!==5)throw Error(d(476));var n=Dr(e).queue;Mr(e,n,t,I,l===null?dh:function(){return Rr(e),l(a)})}function Dr(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:I},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Rr(e){var t=Dr(e);t.next===null&&(t=e.alternate.memoizedState),Ln(e,t.next.queue,{},Ht())}function Rc(){return rt(li)}function kr(){return Fe().memoizedState}function Hr(){return Fe().memoizedState}function fh(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Ht();e=Zl(l);var a=Kl(t,e,l);a!==null&&(wt(a,t,l),Dn(a,t,l)),t={cache:rc()},e.payload=t;return}t=t.return}}function mh(e,t,l){var a=Ht();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Zi(e)?Lr(t,l):(l=Ps(e,t,l,a),l!==null&&(wt(l,e,a),Gr(l,t,a)))}function Br(e,t,l){var a=Ht();Ln(e,t,l,a)}function Ln(e,t,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Zi(e))Lr(t,n);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var c=t.lastRenderedState,u=s(c,l);if(n.hasEagerState=!0,n.eagerState=u,Ot(u,c))return Ci(e,t,n,0),Le===null&&Ei(),!1}catch{}finally{}if(l=Ps(e,t,n,a),l!==null)return wt(l,e,a),Gr(l,t,a),!0}return!1}function kc(e,t,l,a){if(a={lane:2,revertLane:hu(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zi(e)){if(t)throw Error(d(479))}else t=Ps(e,l,a,2),t!==null&&wt(t,e,2)}function Zi(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function Lr(e,t){Ia=Li=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Gr(e,t,l){if((l&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,pn(e,l)}}var Gn={readContext:rt,use:qi,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useLayoutEffect:Ze,useInsertionEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useSyncExternalStore:Ze,useId:Ze,useHostTransitionStatus:Ze,useFormState:Ze,useActionState:Ze,useOptimistic:Ze,useMemoCache:Ze,useCacheRefresh:Ze};Gn.useEffectEvent=Ze;var Yr={readContext:rt,use:qi,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:Tr,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Xi(4194308,4,Ar.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Xi(4194308,4,e,t)},useInsertionEffect:function(e,t){Xi(4,2,e,t)},useMemo:function(e,t){var l=jt();t=t===void 0?null:t;var a=e();if(Na){It(!0);try{e()}finally{It(!1)}}return l.memoizedState=[a,t],a},useReducer:function(e,t,l){var a=jt();if(l!==void 0){var n=l(t);if(Na){It(!0);try{l(t)}finally{It(!1)}}}else n=t;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=mh.bind(null,xe,e),[a.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=wc(e);var t=e.queue,l=Br.bind(null,xe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Uc,useDeferredValue:function(e,t){var l=jt();return Mc(l,e,t)},useTransition:function(){var e=wc(!1);return e=Mr.bind(null,xe,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var a=xe,n=jt();if(Te){if(l===void 0)throw Error(d(407));l=l()}else{if(l=t(),Le===null)throw Error(d(349));(je&127)!==0||ur(a,t,l)}n.memoizedState=l;var s={value:l,getSnapshot:t};return n.queue=s,Tr(rr.bind(null,a,s,e),[e]),a.flags|=2048,en(9,{destroy:void 0},or.bind(null,a,s,l,t),null),l},useId:function(){var e=jt(),t=Le.identifierPrefix;if(Te){var l=ul,a=cl;l=(a&~(1<<32-bt(a)-1)).toString(32)+l,t="_"+t+"R_"+l,l=Gi++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=sh++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Rc,useFormState:yr,useActionState:yr,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=kc.bind(null,xe,!0,l),l.dispatch=t,[e,t]},useMemoCache:Cc,useCacheRefresh:function(){return jt().memoizedState=fh.bind(null,xe)},useEffectEvent:function(e){var t=jt(),l={impl:e};return t.memoizedState=l,function(){if((we&2)!==0)throw Error(d(440));return l.impl.apply(void 0,arguments)}}},Hc={readContext:rt,use:qi,useCallback:zr,useContext:rt,useEffect:Oc,useImperativeHandle:wr,useInsertionEffect:Cr,useLayoutEffect:_r,useMemo:Or,useReducer:Qi,useRef:Nr,useState:function(){return Qi(Nl)},useDebugValue:Uc,useDeferredValue:function(e,t){var l=Fe();return Ur(l,ke.memoizedState,e,t)},useTransition:function(){var e=Qi(Nl)[0],t=Fe().memoizedState;return[typeof e=="boolean"?e:Bn(e),t]},useSyncExternalStore:cr,useId:kr,useHostTransitionStatus:Rc,useFormState:vr,useActionState:vr,useOptimistic:function(e,t){var l=Fe();return mr(l,ke,e,t)},useMemoCache:Cc,useCacheRefresh:Hr};Hc.useEffectEvent=Er;var qr={readContext:rt,use:qi,useCallback:zr,useContext:rt,useEffect:Oc,useImperativeHandle:wr,useInsertionEffect:Cr,useLayoutEffect:_r,useMemo:Or,useReducer:Ac,useRef:Nr,useState:function(){return Ac(Nl)},useDebugValue:Uc,useDeferredValue:function(e,t){var l=Fe();return ke===null?Mc(l,e,t):Ur(l,ke.memoizedState,e,t)},useTransition:function(){var e=Ac(Nl)[0],t=Fe().memoizedState;return[typeof e=="boolean"?e:Bn(e),t]},useSyncExternalStore:cr,useId:kr,useHostTransitionStatus:Rc,useFormState:jr,useActionState:jr,useOptimistic:function(e,t){var l=Fe();return ke!==null?mr(l,ke,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Cc,useCacheRefresh:Hr};qr.useEffectEvent=Er;function Bc(e,t,l,a){t=e.memoizedState,l=l(a,t),l=l==null?t:v({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Lc={enqueueSetState:function(e,t,l){e=e._reactInternals;var a=Ht(),n=Zl(a);n.payload=t,l!=null&&(n.callback=l),t=Kl(e,n,a),t!==null&&(wt(t,e,a),Dn(t,e,a))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var a=Ht(),n=Zl(a);n.tag=1,n.payload=t,l!=null&&(n.callback=l),t=Kl(e,n,a),t!==null&&(wt(t,e,a),Dn(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Ht(),a=Zl(l);a.tag=2,t!=null&&(a.callback=t),t=Kl(e,a,l),t!==null&&(wt(t,e,l),Dn(t,e,l))}};function Qr(e,t,l,a,n,s,c){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,s,c):t.prototype&&t.prototype.isPureReactComponent?!Cn(l,a)||!Cn(n,s):!0}function Xr(e,t,l,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,a),t.state!==e&&Lc.enqueueReplaceState(t,t.state,null)}function Ta(e,t){var l=t;if("ref"in t){l={};for(var a in t)a!=="ref"&&(l[a]=t[a])}if(e=e.defaultProps){l===t&&(l=v({},l));for(var n in e)l[n]===void 0&&(l[n]=e[n])}return l}function Vr(e){Ti(e)}function Zr(e){console.error(e)}function Kr(e){Ti(e)}function Ki(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Jr(e,t,l){try{var a=e.onCaughtError;a(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function Gc(e,t,l){return l=Zl(l),l.tag=3,l.payload={element:null},l.callback=function(){Ki(e,t)},l}function Wr(e){return e=Zl(e),e.tag=3,e}function $r(e,t,l,a){var n=l.type.getDerivedStateFromError;if(typeof n=="function"){var s=a.value;e.payload=function(){return n(s)},e.callback=function(){Jr(t,l,a)}}var c=l.stateNode;c!==null&&typeof c.componentDidCatch=="function"&&(e.callback=function(){Jr(t,l,a),typeof n!="function"&&(Pl===null?Pl=new Set([this]):Pl.add(this));var u=a.stack;this.componentDidCatch(a.value,{componentStack:u!==null?u:""})})}function hh(e,t,l,a,n){if(l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=l.alternate,t!==null&&Za(t,l,n,!0),l=Mt.current,l!==null){switch(l.tag){case 31:case 13:return Jt===null?is():l.alternate===null&&Ke===0&&(Ke=3),l.flags&=-257,l.flags|=65536,l.lanes=n,a===Di?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([a]):t.add(a),du(e,a,n)),!1;case 22:return l.flags|=65536,a===Di?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([a]):l.add(a)),du(e,a,n)),!1}throw Error(d(435,l.tag))}return du(e,a,n),is(),!1}if(Te)return t=Mt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=n,a!==ic&&(e=Error(d(422),{cause:a}),wn(Xt(e,l)))):(a!==ic&&(t=Error(d(423),{cause:a}),wn(Xt(t,l))),e=e.current.alternate,e.flags|=65536,n&=-n,e.lanes|=n,a=Xt(a,l),n=Gc(e.stateNode,a,n),xc(e,n),Ke!==4&&(Ke=2)),!1;var s=Error(d(520),{cause:a});if(s=Xt(s,l),Jn===null?Jn=[s]:Jn.push(s),Ke!==4&&(Ke=2),t===null)return!0;a=Xt(a,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=n&-n,l.lanes|=e,e=Gc(l.stateNode,a,e),xc(l,e),!1;case 1:if(t=l.type,s=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(Pl===null||!Pl.has(s))))return l.flags|=65536,n&=-n,l.lanes|=n,n=Wr(n),$r(n,e,l,a),xc(l,n),!1}l=l.return}while(l!==null);return!1}var Yc=Error(d(461)),et=!1;function dt(e,t,l,a){t.child=e===null?er(t,null,l,a):ja(t,e.child,l,a)}function Fr(e,t,l,a,n){l=l.render;var s=t.ref;if("ref"in a){var c={};for(var u in a)u!=="ref"&&(c[u]=a[u])}else c=a;return ga(t),a=jc(e,t,l,c,s,n),u=Nc(),e!==null&&!et?(Tc(e,t,n),Tl(e,t,n)):(Te&&u&&ac(t),t.flags|=1,dt(e,t,a,n),t.child)}function Ir(e,t,l,a,n){if(e===null){var s=l.type;return typeof s=="function"&&!ec(s)&&s.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=s,Pr(e,t,s,a,n)):(e=Ai(l.type,null,a,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!Wc(e,n)){var c=s.memoizedProps;if(l=l.compare,l=l!==null?l:Cn,l(c,a)&&e.ref===t.ref)return Tl(e,t,n)}return t.flags|=1,e=gl(s,a),e.ref=t.ref,e.return=t,t.child=e}function Pr(e,t,l,a,n){if(e!==null){var s=e.memoizedProps;if(Cn(s,a)&&e.ref===t.ref)if(et=!1,t.pendingProps=a=s,Wc(e,n))(e.flags&131072)!==0&&(et=!0);else return t.lanes=e.lanes,Tl(e,t,n)}return qc(e,t,l,a,n)}function ed(e,t,l,a){var n=a.children,s=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(s=s!==null?s.baseLanes|l:l,e!==null){for(a=t.child=e.child,n=0;a!==null;)n=n|a.lanes|a.childLanes,a=a.sibling;a=n&~s}else a=0,t.child=null;return td(e,t,s,l,a)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ui(t,s!==null?s.cachePool:null),s!==null?ar(t,s):gc(),nr(t);else return a=t.lanes=536870912,td(e,t,s!==null?s.baseLanes|l:l,l,a)}else s!==null?(Ui(t,s.cachePool),ar(t,s),Wl(),t.memoizedState=null):(e!==null&&Ui(t,null),gc(),Wl());return dt(e,t,n,l),t.child}function Yn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function td(e,t,l,a,n){var s=fc();return s=s===null?null:{parent:Ie._currentValue,pool:s},t.memoizedState={baseLanes:l,cachePool:s},e!==null&&Ui(t,null),gc(),nr(t),e!==null&&Za(e,t,a,!0),t.childLanes=n,null}function Ji(e,t){return t=$i({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ld(e,t,l){return ja(t,e.child,null,l),e=Ji(t,t.pendingProps),e.flags|=2,Dt(t),t.memoizedState=null,e}function ph(e,t,l){var a=t.pendingProps,n=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Te){if(a.mode==="hidden")return e=Ji(t,a),t.lanes=536870912,Yn(null,e);if(vc(t),(e=Ye)?(e=pf(e,Kt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yl!==null?{id:cl,overflow:ul}:null,retryLane:536870912,hydrationErrors:null},l=Lo(e),l.return=t,t.child=l,ot=t,Ye=null)):e=null,e===null)throw Ql(t);return t.lanes=536870912,null}return Ji(t,a)}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(vc(t),n)if(t.flags&256)t.flags&=-257,t=ld(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(d(558));else if(et||Za(e,t,l,!1),n=(l&e.childLanes)!==0,et||n){if(a=Le,a!==null&&(c=xn(a,l),c!==0&&c!==s.retryLane))throw s.retryLane=c,ha(e,c),wt(a,e,c),Yc;is(),t=ld(e,t,l)}else e=s.treeContext,Ye=Wt(c.nextSibling),ot=t,Te=!0,ql=null,Kt=!1,e!==null&&qo(t,e),t=Ji(t,a),t.flags|=4096;return t}return e=gl(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Wi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(d(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function qc(e,t,l,a,n){return ga(t),l=jc(e,t,l,a,void 0,n),a=Nc(),e!==null&&!et?(Tc(e,t,n),Tl(e,t,n)):(Te&&a&&ac(t),t.flags|=1,dt(e,t,l,n),t.child)}function ad(e,t,l,a,n,s){return ga(t),t.updateQueue=null,l=sr(t,a,l,n),ir(e),a=Nc(),e!==null&&!et?(Tc(e,t,s),Tl(e,t,s)):(Te&&a&&ac(t),t.flags|=1,dt(e,t,l,s),t.child)}function nd(e,t,l,a,n){if(ga(t),t.stateNode===null){var s=qa,c=l.contextType;typeof c=="object"&&c!==null&&(s=rt(c)),s=new l(a,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Lc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=a,s.state=t.memoizedState,s.refs={},hc(t),c=l.contextType,s.context=typeof c=="object"&&c!==null?rt(c):qa,s.state=t.memoizedState,c=l.getDerivedStateFromProps,typeof c=="function"&&(Bc(t,l,c,a),s.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(c=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),c!==s.state&&Lc.enqueueReplaceState(s,s.state,null),kn(t,a,s,n),Rn(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){s=t.stateNode;var u=t.memoizedProps,f=Ta(l,u);s.props=f;var T=s.context,O=l.contextType;c=qa,typeof O=="object"&&O!==null&&(c=rt(O));var H=l.getDerivedStateFromProps;O=typeof H=="function"||typeof s.getSnapshotBeforeUpdate=="function",u=t.pendingProps!==u,O||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u||T!==c)&&Xr(t,s,a,c),Vl=!1;var C=t.memoizedState;s.state=C,kn(t,a,s,n),Rn(),T=t.memoizedState,u||C!==T||Vl?(typeof H=="function"&&(Bc(t,l,H,a),T=t.memoizedState),(f=Vl||Qr(t,l,f,a,C,T,c))?(O||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=T),s.props=a,s.state=T,s.context=c,a=f):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{s=t.stateNode,pc(e,t),c=t.memoizedProps,O=Ta(l,c),s.props=O,H=t.pendingProps,C=s.context,T=l.contextType,f=qa,typeof T=="object"&&T!==null&&(f=rt(T)),u=l.getDerivedStateFromProps,(T=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(c!==H||C!==f)&&Xr(t,s,a,f),Vl=!1,C=t.memoizedState,s.state=C,kn(t,a,s,n),Rn();var A=t.memoizedState;c!==H||C!==A||Vl||e!==null&&e.dependencies!==null&&zi(e.dependencies)?(typeof u=="function"&&(Bc(t,l,u,a),A=t.memoizedState),(O=Vl||Qr(t,l,O,a,C,A,f)||e!==null&&e.dependencies!==null&&zi(e.dependencies))?(T||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(a,A,f),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(a,A,f)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||c===e.memoizedProps&&C===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&C===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=A),s.props=a,s.state=A,s.context=f,a=O):(typeof s.componentDidUpdate!="function"||c===e.memoizedProps&&C===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&C===e.memoizedState||(t.flags|=1024),a=!1)}return s=a,Wi(e,t),a=(t.flags&128)!==0,s||a?(s=t.stateNode,l=a&&typeof l.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&a?(t.child=ja(t,e.child,null,n),t.child=ja(t,null,l,n)):dt(e,t,l,n),t.memoizedState=s.state,e=t.child):e=Tl(e,t,n),e}function id(e,t,l,a){return xa(),t.flags|=256,dt(e,t,l,a),t.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(e){return{baseLanes:e,cachePool:Jo()}}function Vc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=kt),e}function sd(e,t,l){var a=t.pendingProps,n=!1,s=(t.flags&128)!==0,c;if((c=s)||(c=e!==null&&e.memoizedState===null?!1:($e.current&2)!==0),c&&(n=!0,t.flags&=-129),c=(t.flags&32)!==0,t.flags&=-33,e===null){if(Te){if(n?Jl(t):Wl(),(e=Ye)?(e=pf(e,Kt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yl!==null?{id:cl,overflow:ul}:null,retryLane:536870912,hydrationErrors:null},l=Lo(e),l.return=t,t.child=l,ot=t,Ye=null)):e=null,e===null)throw Ql(t);return _u(e)?t.lanes=32:t.lanes=536870912,null}var u=a.children;return a=a.fallback,n?(Wl(),n=t.mode,u=$i({mode:"hidden",children:u},n),a=pa(a,n,l,null),u.return=t,a.return=t,u.sibling=a,t.child=u,a=t.child,a.memoizedState=Xc(l),a.childLanes=Vc(e,c,l),t.memoizedState=Qc,Yn(null,a)):(Jl(t),Zc(t,u))}var f=e.memoizedState;if(f!==null&&(u=f.dehydrated,u!==null)){if(s)t.flags&256?(Jl(t),t.flags&=-257,t=Kc(e,t,l)):t.memoizedState!==null?(Wl(),t.child=e.child,t.flags|=128,t=null):(Wl(),u=a.fallback,n=t.mode,a=$i({mode:"visible",children:a.children},n),u=pa(u,n,l,null),u.flags|=2,a.return=t,u.return=t,a.sibling=u,t.child=a,ja(t,e.child,null,l),a=t.child,a.memoizedState=Xc(l),a.childLanes=Vc(e,c,l),t.memoizedState=Qc,t=Yn(null,a));else if(Jl(t),_u(u)){if(c=u.nextSibling&&u.nextSibling.dataset,c)var T=c.dgst;c=T,a=Error(d(419)),a.stack="",a.digest=c,wn({value:a,source:null,stack:null}),t=Kc(e,t,l)}else if(et||Za(e,t,l,!1),c=(l&e.childLanes)!==0,et||c){if(c=Le,c!==null&&(a=xn(c,l),a!==0&&a!==f.retryLane))throw f.retryLane=a,ha(e,a),wt(c,e,a),Yc;Cu(u)||is(),t=Kc(e,t,l)}else Cu(u)?(t.flags|=192,t.child=e.child,t=null):(e=f.treeContext,Ye=Wt(u.nextSibling),ot=t,Te=!0,ql=null,Kt=!1,e!==null&&qo(t,e),t=Zc(t,a.children),t.flags|=4096);return t}return n?(Wl(),u=a.fallback,n=t.mode,f=e.child,T=f.sibling,a=gl(f,{mode:"hidden",children:a.children}),a.subtreeFlags=f.subtreeFlags&65011712,T!==null?u=gl(T,u):(u=pa(u,n,l,null),u.flags|=2),u.return=t,a.return=t,a.sibling=u,t.child=a,Yn(null,a),a=t.child,u=e.child.memoizedState,u===null?u=Xc(l):(n=u.cachePool,n!==null?(f=Ie._currentValue,n=n.parent!==f?{parent:f,pool:f}:n):n=Jo(),u={baseLanes:u.baseLanes|l,cachePool:n}),a.memoizedState=u,a.childLanes=Vc(e,c,l),t.memoizedState=Qc,Yn(e.child,a)):(Jl(t),l=e.child,e=l.sibling,l=gl(l,{mode:"visible",children:a.children}),l.return=t,l.sibling=null,e!==null&&(c=t.deletions,c===null?(t.deletions=[e],t.flags|=16):c.push(e)),t.child=l,t.memoizedState=null,l)}function Zc(e,t){return t=$i({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function $i(e,t){return e=Ut(22,e,null,t),e.lanes=0,e}function Kc(e,t,l){return ja(t,e.child,null,l),e=Zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cd(e,t,l){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),uc(e.return,t,l)}function Jc(e,t,l,a,n,s){var c=e.memoizedState;c===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:l,tailMode:n,treeForkCount:s}:(c.isBackwards=t,c.rendering=null,c.renderingStartTime=0,c.last=a,c.tail=l,c.tailMode=n,c.treeForkCount=s)}function ud(e,t,l){var a=t.pendingProps,n=a.revealOrder,s=a.tail;a=a.children;var c=$e.current,u=(c&2)!==0;if(u?(c=c&1|2,t.flags|=128):c&=1,X($e,c),dt(e,t,a,l),a=Te?An:0,!u&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cd(e,l,t);else if(e.tag===19)cd(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(n){case"forwards":for(l=t.child,n=null;l!==null;)e=l.alternate,e!==null&&Bi(e)===null&&(n=l),l=l.sibling;l=n,l===null?(n=t.child,t.child=null):(n=l.sibling,l.sibling=null),Jc(t,!1,n,l,s,a);break;case"backwards":case"unstable_legacy-backwards":for(l=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&Bi(e)===null){t.child=n;break}e=n.sibling,n.sibling=l,l=n,n=e}Jc(t,!0,l,null,s,a);break;case"together":Jc(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function Tl(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Il|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Za(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(d(153));if(t.child!==null){for(e=t.child,l=gl(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=gl(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Wc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&zi(e)))}function xh(e,t,l){switch(t.tag){case 3:Je(t,t.stateNode.containerInfo),Xl(t,Ie,e.memoizedState.cache),xa();break;case 27:case 5:St(t);break;case 4:Je(t,t.stateNode.containerInfo);break;case 10:Xl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,vc(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Jl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?sd(e,t,l):(Jl(t),e=Tl(e,t,l),e!==null?e.sibling:null);Jl(t);break;case 19:var n=(e.flags&128)!==0;if(a=(l&t.childLanes)!==0,a||(Za(e,t,l,!1),a=(l&t.childLanes)!==0),n){if(a)return ud(e,t,l);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),X($e,$e.current),a)break;return null;case 22:return t.lanes=0,ed(e,t,l,t.pendingProps);case 24:Xl(t,Ie,e.memoizedState.cache)}return Tl(e,t,l)}function od(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)et=!0;else{if(!Wc(e,l)&&(t.flags&128)===0)return et=!1,xh(e,t,l);et=(e.flags&131072)!==0}else et=!1,Te&&(t.flags&1048576)!==0&&Yo(t,An,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=va(t.elementType),t.type=e,typeof e=="function")ec(e)?(a=Ta(e,a),t.tag=1,t=nd(null,t,e,a,l)):(t.tag=0,t=qc(null,t,e,a,l));else{if(e!=null){var n=e.$$typeof;if(n===W){t.tag=11,t=Fr(null,t,e,a,l);break e}else if(n===Z){t.tag=14,t=Ir(null,t,e,a,l);break e}}throw t=K(e)||e,Error(d(306,t,""))}}return t;case 0:return qc(e,t,t.type,t.pendingProps,l);case 1:return a=t.type,n=Ta(a,t.pendingProps),nd(e,t,a,n,l);case 3:e:{if(Je(t,t.stateNode.containerInfo),e===null)throw Error(d(387));a=t.pendingProps;var s=t.memoizedState;n=s.element,pc(e,t),kn(t,a,null,l);var c=t.memoizedState;if(a=c.cache,Xl(t,Ie,a),a!==s.cache&&oc(t,[Ie],l,!0),Rn(),a=c.element,s.isDehydrated)if(s={element:a,isDehydrated:!1,cache:c.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=id(e,t,a,l);break e}else if(a!==n){n=Xt(Error(d(424)),t),wn(n),t=id(e,t,a,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ye=Wt(e.firstChild),ot=t,Te=!0,ql=null,Kt=!0,l=er(t,null,a,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(xa(),a===n){t=Tl(e,t,l);break e}dt(e,t,a,l)}t=t.child}return t;case 26:return Wi(e,t),e===null?(l=Sf(t.type,null,t.pendingProps,null))?t.memoizedState=l:Te||(l=t.type,e=t.pendingProps,a=fs(me.current).createElement(l),a[ut]=t,a[Nt]=e,ft(a,l,e),it(a),t.stateNode=a):t.memoizedState=Sf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return St(t),e===null&&Te&&(a=t.stateNode=gf(t.type,t.pendingProps,me.current),ot=t,Kt=!0,n=Ye,aa(t.type)?(Au=n,Ye=Wt(a.firstChild)):Ye=n),dt(e,t,t.pendingProps.children,l),Wi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Te&&((n=a=Ye)&&(a=Zh(a,t.type,t.pendingProps,Kt),a!==null?(t.stateNode=a,ot=t,Ye=Wt(a.firstChild),Kt=!1,n=!0):n=!1),n||Ql(t)),St(t),n=t.type,s=t.pendingProps,c=e!==null?e.memoizedProps:null,a=s.children,Nu(n,s)?a=null:c!==null&&Nu(n,c)&&(t.flags|=32),t.memoizedState!==null&&(n=jc(e,t,ch,null,null,l),li._currentValue=n),Wi(e,t),dt(e,t,a,l),t.child;case 6:return e===null&&Te&&((e=l=Ye)&&(l=Kh(l,t.pendingProps,Kt),l!==null?(t.stateNode=l,ot=t,Ye=null,e=!0):e=!1),e||Ql(t)),null;case 13:return sd(e,t,l);case 4:return Je(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=ja(t,null,a,l):dt(e,t,a,l),t.child;case 11:return Fr(e,t,t.type,t.pendingProps,l);case 7:return dt(e,t,t.pendingProps,l),t.child;case 8:return dt(e,t,t.pendingProps.children,l),t.child;case 12:return dt(e,t,t.pendingProps.children,l),t.child;case 10:return a=t.pendingProps,Xl(t,t.type,a.value),dt(e,t,a.children,l),t.child;case 9:return n=t.type._context,a=t.pendingProps.children,ga(t),n=rt(n),a=a(n),t.flags|=1,dt(e,t,a,l),t.child;case 14:return Ir(e,t,t.type,t.pendingProps,l);case 15:return Pr(e,t,t.type,t.pendingProps,l);case 19:return ud(e,t,l);case 31:return ph(e,t,l);case 22:return ed(e,t,l,t.pendingProps);case 24:return ga(t),a=rt(Ie),e===null?(n=fc(),n===null&&(n=Le,s=rc(),n.pooledCache=s,s.refCount++,s!==null&&(n.pooledCacheLanes|=l),n=s),t.memoizedState={parent:a,cache:n},hc(t),Xl(t,Ie,n)):((e.lanes&l)!==0&&(pc(e,t),kn(t,null,null,l),Rn()),n=e.memoizedState,s=t.memoizedState,n.parent!==a?(n={parent:a,cache:a},t.memoizedState=n,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=n),Xl(t,Ie,a)):(a=s.cache,Xl(t,Ie,a),a!==n.cache&&oc(t,[Ie],l,!0))),dt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(d(156,t.tag))}function El(e){e.flags|=4}function $c(e,t,l,a,n){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(n&335544128)===n)if(e.stateNode.complete)e.flags|=8192;else if(kd())e.flags|=8192;else throw Sa=Di,mc}else e.flags&=-16777217}function rd(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Cf(t))if(kd())e.flags|=8192;else throw Sa=Di,mc}function Fi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?sl():536870912,e.lanes|=t,nn|=t)}function qn(e,t){if(!Te)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var a=null;l!==null;)l.alternate!==null&&(a=l),l=l.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,a=0;if(t)for(var n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags&65011712,a|=n.flags&65011712,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags,a|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=a,e.childLanes=l,t}function bh(e,t,l){var a=t.pendingProps;switch(nc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qe(t),null;case 1:return qe(t),null;case 3:return l=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Sl(Ie),Ee(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Va(t)?El(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,sc())),qe(t),null;case 26:var n=t.type,s=t.memoizedState;return e===null?(El(t),s!==null?(qe(t),rd(t,s)):(qe(t),$c(t,n,null,a,l))):s?s!==e.memoizedState?(El(t),qe(t),rd(t,s)):(qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&El(t),qe(t),$c(t,n,e,a,l)),null;case 27:if(ht(t),l=me.current,n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&El(t);else{if(!a){if(t.stateNode===null)throw Error(d(166));return qe(t),null}e=J.current,Va(t)?Qo(t):(e=gf(n,a,l),t.stateNode=e,El(t))}return qe(t),null;case 5:if(ht(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&El(t);else{if(!a){if(t.stateNode===null)throw Error(d(166));return qe(t),null}if(s=J.current,Va(t))Qo(t);else{var c=fs(me.current);switch(s){case 1:s=c.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:s=c.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":s=c.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":s=c.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":s=c.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?s.multiple=!0:a.size&&(s.size=a.size);break;default:s=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}s[ut]=t,s[Nt]=a;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)s.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=s;e:switch(ft(s,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&El(t)}}return qe(t),$c(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&El(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(d(166));if(e=me.current,Va(t)){if(e=t.stateNode,l=t.memoizedProps,a=null,n=ot,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}e[ut]=t,e=!!(e.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||cf(e.nodeValue,l)),e||Ql(t,!0)}else e=fs(e).createTextNode(a),e[ut]=t,t.stateNode=e}return qe(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(a=Va(t),l!==null){if(e===null){if(!a)throw Error(d(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(d(557));e[ut]=t}else xa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;qe(t),e=!1}else l=sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(Dt(t),t):(Dt(t),null);if((t.flags&128)!==0)throw Error(d(558))}return qe(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=Va(t),a!==null&&a.dehydrated!==null){if(e===null){if(!n)throw Error(d(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(d(317));n[ut]=t}else xa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;qe(t),n=!1}else n=sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(Dt(t),t):(Dt(t),null)}return Dt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=a!==null,e=e!==null&&e.memoizedState!==null,l&&(a=t.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==n&&(a.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Fi(t,t.updateQueue),qe(t),null);case 4:return Ee(),e===null&&gu(t.stateNode.containerInfo),qe(t),null;case 10:return Sl(t.type),qe(t),null;case 19:if(U($e),a=t.memoizedState,a===null)return qe(t),null;if(n=(t.flags&128)!==0,s=a.rendering,s===null)if(n)qn(a,!1);else{if(Ke!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Bi(e),s!==null){for(t.flags|=128,qn(a,!1),e=s.updateQueue,t.updateQueue=e,Fi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Bo(l,e),l=l.sibling;return X($e,$e.current&1|2),Te&&yl(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&at()>ls&&(t.flags|=128,n=!0,qn(a,!1),t.lanes=4194304)}else{if(!n)if(e=Bi(s),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,Fi(t,e),qn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!s.alternate&&!Te)return qe(t),null}else 2*at()-a.renderingStartTime>ls&&l!==536870912&&(t.flags|=128,n=!0,qn(a,!1),t.lanes=4194304);a.isBackwards?(s.sibling=t.child,t.child=s):(e=a.last,e!==null?e.sibling=s:t.child=s,a.last=s)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=at(),e.sibling=null,l=$e.current,X($e,n?l&1|2:l&1),Te&&yl(t,a.treeForkCount),e):(qe(t),null);case 22:case 23:return Dt(t),yc(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(l&536870912)!==0&&(t.flags&128)===0&&(qe(t),t.subtreeFlags&6&&(t.flags|=8192)):qe(t),l=t.updateQueue,l!==null&&Fi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==l&&(t.flags|=2048),e!==null&&U(ya),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Sl(Ie),qe(t),null;case 25:return null;case 30:return null}throw Error(d(156,t.tag))}function gh(e,t){switch(nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sl(Ie),Ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ht(t),null;case 31:if(t.memoizedState!==null){if(Dt(t),t.alternate===null)throw Error(d(340));xa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Dt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(d(340));xa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U($e),null;case 4:return Ee(),null;case 10:return Sl(t.type),null;case 22:case 23:return Dt(t),yc(),e!==null&&U(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sl(Ie),null;case 25:return null;default:return null}}function dd(e,t){switch(nc(t),t.tag){case 3:Sl(Ie),Ee();break;case 26:case 27:case 5:ht(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&Dt(t);break;case 13:Dt(t);break;case 19:U($e);break;case 10:Sl(t.type);break;case 22:case 23:Dt(t),yc(),e!==null&&U(ya);break;case 24:Sl(Ie)}}function Qn(e,t){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&e)===e){a=void 0;var s=l.create,c=l.inst;a=s(),c.destroy=a}l=l.next}while(l!==n)}}catch(u){Me(t,t.return,u)}}function $l(e,t,l){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var s=n.next;a=s;do{if((a.tag&e)===e){var c=a.inst,u=c.destroy;if(u!==void 0){c.destroy=void 0,n=t;var f=l,T=u;try{T()}catch(O){Me(n,f,O)}}}a=a.next}while(a!==s)}}catch(O){Me(t,t.return,O)}}function fd(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{lr(t,l)}catch(a){Me(e,e.return,a)}}}function md(e,t,l){l.props=Ta(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(a){Me(e,t,a)}}function Xn(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof l=="function"?e.refCleanup=l(a):l.current=a}}catch(n){Me(e,t,n)}}function ol(e,t){var l=e.ref,a=e.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){Me(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){Me(e,t,n)}else l.current=null}function hd(e){var t=e.type,l=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break e;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){Me(e,e.return,n)}}function Fc(e,t,l){try{var a=e.stateNode;Gh(a,e.type,l,t),a[Nt]=t}catch(n){Me(e,e.return,n)}}function pd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&aa(e.type)||e.tag===4}function Ic(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&aa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Pc(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=xl));else if(a!==4&&(a===27&&aa(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Pc(e,t,l),e=e.sibling;e!==null;)Pc(e,t,l),e=e.sibling}function Ii(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(a!==4&&(a===27&&aa(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Ii(e,t,l),e=e.sibling;e!==null;)Ii(e,t,l),e=e.sibling}function xd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var a=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);ft(t,a,l),t[ut]=e,t[Nt]=l}catch(s){Me(e,e.return,s)}}var Cl=!1,tt=!1,eu=!1,bd=typeof WeakSet=="function"?WeakSet:Set,st=null;function yh(e,t){if(e=e.containerInfo,Su=ys,e=wo(e),Ks(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,s=a.focusNode;a=a.focusOffset;try{l.nodeType,s.nodeType}catch{l=null;break e}var c=0,u=-1,f=-1,T=0,O=0,H=e,C=null;t:for(;;){for(var A;H!==l||n!==0&&H.nodeType!==3||(u=c+n),H!==s||a!==0&&H.nodeType!==3||(f=c+a),H.nodeType===3&&(c+=H.nodeValue.length),(A=H.firstChild)!==null;)C=H,H=A;for(;;){if(H===e)break t;if(C===l&&++T===n&&(u=c),C===s&&++O===a&&(f=c),(A=H.nextSibling)!==null)break;H=C,C=H.parentNode}H=A}l=u===-1||f===-1?null:{start:u,end:f}}else l=null}l=l||{start:0,end:0}}else l=null;for(ju={focusedElem:e,selectionRange:l},ys=!1,st=t;st!==null;)if(t=st,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,st=e;else for(;st!==null;){switch(t=st,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)n=e[l],n.ref.impl=n.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&s!==null){e=void 0,l=t,n=s.memoizedProps,s=s.memoizedState,a=l.stateNode;try{var P=Ta(l.type,n);e=a.getSnapshotBeforeUpdate(P,s),a.__reactInternalSnapshotBeforeUpdate=e}catch(re){Me(l,l.return,re)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Eu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Eu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(d(163))}if(e=t.sibling,e!==null){e.return=t.return,st=e;break}st=t.return}}function gd(e,t,l){var a=l.flags;switch(l.tag){case 0:case 11:case 15:Al(e,l),a&4&&Qn(5,l);break;case 1:if(Al(e,l),a&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(c){Me(l,l.return,c)}else{var n=Ta(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(c){Me(l,l.return,c)}}a&64&&fd(l),a&512&&Xn(l,l.return);break;case 3:if(Al(e,l),a&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{lr(e,t)}catch(c){Me(l,l.return,c)}}break;case 27:t===null&&a&4&&xd(l);case 26:case 5:Al(e,l),t===null&&a&4&&hd(l),a&512&&Xn(l,l.return);break;case 12:Al(e,l);break;case 31:Al(e,l),a&4&&Sd(e,l);break;case 13:Al(e,l),a&4&&jd(e,l),a&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Ah.bind(null,l),Jh(e,l))));break;case 22:if(a=l.memoizedState!==null||Cl,!a){t=t!==null&&t.memoizedState!==null||tt,n=Cl;var s=tt;Cl=a,(tt=t)&&!s?wl(e,l,(l.subtreeFlags&8772)!==0):Al(e,l),Cl=n,tt=s}break;case 30:break;default:Al(e,l)}}function yd(e){var t=e.alternate;t!==null&&(e.alternate=null,yd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zs(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Qe=null,Et=!1;function _l(e,t,l){for(l=l.child;l!==null;)vd(e,t,l),l=l.sibling}function vd(e,t,l){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(ml,l)}catch{}switch(l.tag){case 26:tt||ol(l,t),_l(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:tt||ol(l,t);var a=Qe,n=Et;aa(l.type)&&(Qe=l.stateNode,Et=!1),_l(e,t,l),Pn(l.stateNode),Qe=a,Et=n;break;case 5:tt||ol(l,t);case 6:if(a=Qe,n=Et,Qe=null,_l(e,t,l),Qe=a,Et=n,Qe!==null)if(Et)try{(Qe.nodeType===9?Qe.body:Qe.nodeName==="HTML"?Qe.ownerDocument.body:Qe).removeChild(l.stateNode)}catch(s){Me(l,t,s)}else try{Qe.removeChild(l.stateNode)}catch(s){Me(l,t,s)}break;case 18:Qe!==null&&(Et?(e=Qe,mf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),mn(e)):mf(Qe,l.stateNode));break;case 4:a=Qe,n=Et,Qe=l.stateNode.containerInfo,Et=!0,_l(e,t,l),Qe=a,Et=n;break;case 0:case 11:case 14:case 15:$l(2,l,t),tt||$l(4,l,t),_l(e,t,l);break;case 1:tt||(ol(l,t),a=l.stateNode,typeof a.componentWillUnmount=="function"&&md(l,t,a)),_l(e,t,l);break;case 21:_l(e,t,l);break;case 22:tt=(a=tt)||l.memoizedState!==null,_l(e,t,l),tt=a;break;default:_l(e,t,l)}}function Sd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mn(e)}catch(l){Me(t,t.return,l)}}}function jd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mn(e)}catch(l){Me(t,t.return,l)}}function vh(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new bd),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new bd),t;default:throw Error(d(435,e.tag))}}function Pi(e,t){var l=vh(e);t.forEach(function(a){if(!l.has(a)){l.add(a);var n=wh.bind(null,e,a);a.then(n,n)}})}function Ct(e,t){var l=t.deletions;if(l!==null)for(var a=0;a<l.length;a++){var n=l[a],s=e,c=t,u=c;e:for(;u!==null;){switch(u.tag){case 27:if(aa(u.type)){Qe=u.stateNode,Et=!1;break e}break;case 5:Qe=u.stateNode,Et=!1;break e;case 3:case 4:Qe=u.stateNode.containerInfo,Et=!0;break e}u=u.return}if(Qe===null)throw Error(d(160));vd(s,c,n),Qe=null,Et=!1,s=n.alternate,s!==null&&(s.return=null),n.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Nd(t,e),t=t.sibling}var tl=null;function Nd(e,t){var l=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ct(t,e),_t(e),a&4&&($l(3,e,e.return),Qn(3,e),$l(5,e,e.return));break;case 1:Ct(t,e),_t(e),a&512&&(tt||l===null||ol(l,l.return)),a&64&&Cl&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?a:l.concat(a))));break;case 26:var n=tl;if(Ct(t,e),_t(e),a&512&&(tt||l===null||ol(l,l.return)),a&4){var s=l!==null?l.memoizedState:null;if(a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null){e:{a=e.type,l=e.memoizedProps,n=n.ownerDocument||n;t:switch(a){case"title":s=n.getElementsByTagName("title")[0],(!s||s[bn]||s[ut]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=n.createElement(a),n.head.insertBefore(s,n.querySelector("head > title"))),ft(s,a,l),s[ut]=e,it(s),a=s;break e;case"link":var c=Tf("link","href",n).get(a+(l.href||""));if(c){for(var u=0;u<c.length;u++)if(s=c[u],s.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&s.getAttribute("rel")===(l.rel==null?null:l.rel)&&s.getAttribute("title")===(l.title==null?null:l.title)&&s.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){c.splice(u,1);break t}}s=n.createElement(a),ft(s,a,l),n.head.appendChild(s);break;case"meta":if(c=Tf("meta","content",n).get(a+(l.content||""))){for(u=0;u<c.length;u++)if(s=c[u],s.getAttribute("content")===(l.content==null?null:""+l.content)&&s.getAttribute("name")===(l.name==null?null:l.name)&&s.getAttribute("property")===(l.property==null?null:l.property)&&s.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&s.getAttribute("charset")===(l.charSet==null?null:l.charSet)){c.splice(u,1);break t}}s=n.createElement(a),ft(s,a,l),n.head.appendChild(s);break;default:throw Error(d(468,a))}s[ut]=e,it(s),a=s}e.stateNode=a}else Ef(n,e.type,e.stateNode);else e.stateNode=Nf(n,a,e.memoizedProps);else s!==a?(s===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):s.count--,a===null?Ef(n,e.type,e.stateNode):Nf(n,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Fc(e,e.memoizedProps,l.memoizedProps)}break;case 27:Ct(t,e),_t(e),a&512&&(tt||l===null||ol(l,l.return)),l!==null&&a&4&&Fc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Ct(t,e),_t(e),a&512&&(tt||l===null||ol(l,l.return)),e.flags&32){n=e.stateNode;try{Ra(n,"")}catch(P){Me(e,e.return,P)}}a&4&&e.stateNode!=null&&(n=e.memoizedProps,Fc(e,n,l!==null?l.memoizedProps:n)),a&1024&&(eu=!0);break;case 6:if(Ct(t,e),_t(e),a&4){if(e.stateNode===null)throw Error(d(162));a=e.memoizedProps,l=e.stateNode;try{l.nodeValue=a}catch(P){Me(e,e.return,P)}}break;case 3:if(ps=null,n=tl,tl=ms(t.containerInfo),Ct(t,e),tl=n,_t(e),a&4&&l!==null&&l.memoizedState.isDehydrated)try{mn(t.containerInfo)}catch(P){Me(e,e.return,P)}eu&&(eu=!1,Td(e));break;case 4:a=tl,tl=ms(e.stateNode.containerInfo),Ct(t,e),_t(e),tl=a;break;case 12:Ct(t,e),_t(e);break;case 31:Ct(t,e),_t(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Pi(e,a)));break;case 13:Ct(t,e),_t(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ts=at()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Pi(e,a)));break;case 22:n=e.memoizedState!==null;var f=l!==null&&l.memoizedState!==null,T=Cl,O=tt;if(Cl=T||n,tt=O||f,Ct(t,e),tt=O,Cl=T,_t(e),a&8192)e:for(t=e.stateNode,t._visibility=n?t._visibility&-2:t._visibility|1,n&&(l===null||f||Cl||tt||Ea(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){f=l=t;try{if(s=f.stateNode,n)c=s.style,typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none";else{u=f.stateNode;var H=f.memoizedProps.style,C=H!=null&&H.hasOwnProperty("display")?H.display:null;u.style.display=C==null||typeof C=="boolean"?"":(""+C).trim()}}catch(P){Me(f,f.return,P)}}}else if(t.tag===6){if(l===null){f=t;try{f.stateNode.nodeValue=n?"":f.memoizedProps}catch(P){Me(f,f.return,P)}}}else if(t.tag===18){if(l===null){f=t;try{var A=f.stateNode;n?hf(A,!0):hf(f.stateNode,!1)}catch(P){Me(f,f.return,P)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(l=a.retryQueue,l!==null&&(a.retryQueue=null,Pi(e,l))));break;case 19:Ct(t,e),_t(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Pi(e,a)));break;case 30:break;case 21:break;default:Ct(t,e),_t(e)}}function _t(e){var t=e.flags;if(t&2){try{for(var l,a=e.return;a!==null;){if(pd(a)){l=a;break}a=a.return}if(l==null)throw Error(d(160));switch(l.tag){case 27:var n=l.stateNode,s=Ic(e);Ii(e,s,n);break;case 5:var c=l.stateNode;l.flags&32&&(Ra(c,""),l.flags&=-33);var u=Ic(e);Ii(e,u,c);break;case 3:case 4:var f=l.stateNode.containerInfo,T=Ic(e);Pc(e,T,f);break;default:throw Error(d(161))}}catch(O){Me(e,e.return,O)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Td(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Td(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Al(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gd(e,t.alternate,t),t=t.sibling}function Ea(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:$l(4,t,t.return),Ea(t);break;case 1:ol(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&md(t,t.return,l),Ea(t);break;case 27:Pn(t.stateNode);case 26:case 5:ol(t,t.return),Ea(t);break;case 22:t.memoizedState===null&&Ea(t);break;case 30:Ea(t);break;default:Ea(t)}e=e.sibling}}function wl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,n=e,s=t,c=s.flags;switch(s.tag){case 0:case 11:case 15:wl(n,s,l),Qn(4,s);break;case 1:if(wl(n,s,l),a=s,n=a.stateNode,typeof n.componentDidMount=="function")try{n.componentDidMount()}catch(T){Me(a,a.return,T)}if(a=s,n=a.updateQueue,n!==null){var u=a.stateNode;try{var f=n.shared.hiddenCallbacks;if(f!==null)for(n.shared.hiddenCallbacks=null,n=0;n<f.length;n++)tr(f[n],u)}catch(T){Me(a,a.return,T)}}l&&c&64&&fd(s),Xn(s,s.return);break;case 27:xd(s);case 26:case 5:wl(n,s,l),l&&a===null&&c&4&&hd(s),Xn(s,s.return);break;case 12:wl(n,s,l);break;case 31:wl(n,s,l),l&&c&4&&Sd(n,s);break;case 13:wl(n,s,l),l&&c&4&&jd(n,s);break;case 22:s.memoizedState===null&&wl(n,s,l),Xn(s,s.return);break;case 30:break;default:wl(n,s,l)}t=t.sibling}}function tu(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&zn(l))}function lu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zn(e))}function ll(e,t,l,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ed(e,t,l,a),t=t.sibling}function Ed(e,t,l,a){var n=t.flags;switch(t.tag){case 0:case 11:case 15:ll(e,t,l,a),n&2048&&Qn(9,t);break;case 1:ll(e,t,l,a);break;case 3:ll(e,t,l,a),n&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zn(e)));break;case 12:if(n&2048){ll(e,t,l,a),e=t.stateNode;try{var s=t.memoizedProps,c=s.id,u=s.onPostCommit;typeof u=="function"&&u(c,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(f){Me(t,t.return,f)}}else ll(e,t,l,a);break;case 31:ll(e,t,l,a);break;case 13:ll(e,t,l,a);break;case 23:break;case 22:s=t.stateNode,c=t.alternate,t.memoizedState!==null?s._visibility&2?ll(e,t,l,a):Vn(e,t):s._visibility&2?ll(e,t,l,a):(s._visibility|=2,tn(e,t,l,a,(t.subtreeFlags&10256)!==0||!1)),n&2048&&tu(c,t);break;case 24:ll(e,t,l,a),n&2048&&lu(t.alternate,t);break;default:ll(e,t,l,a)}}function tn(e,t,l,a,n){for(n=n&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,c=t,u=l,f=a,T=c.flags;switch(c.tag){case 0:case 11:case 15:tn(s,c,u,f,n),Qn(8,c);break;case 23:break;case 22:var O=c.stateNode;c.memoizedState!==null?O._visibility&2?tn(s,c,u,f,n):Vn(s,c):(O._visibility|=2,tn(s,c,u,f,n)),n&&T&2048&&tu(c.alternate,c);break;case 24:tn(s,c,u,f,n),n&&T&2048&&lu(c.alternate,c);break;default:tn(s,c,u,f,n)}t=t.sibling}}function Vn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,a=t,n=a.flags;switch(a.tag){case 22:Vn(l,a),n&2048&&tu(a.alternate,a);break;case 24:Vn(l,a),n&2048&&lu(a.alternate,a);break;default:Vn(l,a)}t=t.sibling}}var Zn=8192;function ln(e,t,l){if(e.subtreeFlags&Zn)for(e=e.child;e!==null;)Cd(e,t,l),e=e.sibling}function Cd(e,t,l){switch(e.tag){case 26:ln(e,t,l),e.flags&Zn&&e.memoizedState!==null&&sp(l,tl,e.memoizedState,e.memoizedProps);break;case 5:ln(e,t,l);break;case 3:case 4:var a=tl;tl=ms(e.stateNode.containerInfo),ln(e,t,l),tl=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=Zn,Zn=16777216,ln(e,t,l),Zn=a):ln(e,t,l));break;default:ln(e,t,l)}}function _d(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Kn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];st=a,wd(a,e)}_d(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ad(e),e=e.sibling}function Ad(e){switch(e.tag){case 0:case 11:case 15:Kn(e),e.flags&2048&&$l(9,e,e.return);break;case 3:Kn(e);break;case 12:Kn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,es(e)):Kn(e);break;default:Kn(e)}}function es(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];st=a,wd(a,e)}_d(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$l(8,t,t.return),es(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,es(t));break;default:es(t)}e=e.sibling}}function wd(e,t){for(;st!==null;){var l=st;switch(l.tag){case 0:case 11:case 15:$l(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var a=l.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:zn(l.memoizedState.cache)}if(a=l.child,a!==null)a.return=l,st=a;else e:for(l=e;st!==null;){a=st;var n=a.sibling,s=a.return;if(yd(a),a===l){st=null;break e}if(n!==null){n.return=s,st=n;break e}st=s}}}var Sh={getCacheForType:function(e){var t=rt(Ie),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return rt(Ie).controller.signal}},jh=typeof WeakMap=="function"?WeakMap:Map,we=0,Le=null,ve=null,je=0,Ue=0,Rt=null,Fl=!1,an=!1,au=!1,zl=0,Ke=0,Il=0,Ca=0,nu=0,kt=0,nn=0,Jn=null,At=null,iu=!1,ts=0,zd=0,ls=1/0,as=null,Pl=null,lt=0,ea=null,sn=null,Ol=0,su=0,cu=null,Od=null,Wn=0,uu=null;function Ht(){return(we&2)!==0&&je!==0?je&-je:_.T!==null?hu():Gt()}function Ud(){if(kt===0)if((je&536870912)===0||Te){var e=gt;gt<<=1,(gt&3932160)===0&&(gt=262144),kt=e}else kt=536870912;return e=Mt.current,e!==null&&(e.flags|=32),kt}function wt(e,t,l){(e===Le&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)&&(cn(e,0),ta(e,je,kt,!1)),Bl(e,l),((we&2)===0||e!==Le)&&(e===Le&&((we&2)===0&&(Ca|=l),Ke===4&&ta(e,je,kt,!1)),rl(e))}function Md(e,t,l){if((we&6)!==0)throw Error(d(327));var a=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Pt(e,t),n=a?Eh(e,t):ru(e,t,!0),s=a;do{if(n===0){an&&!a&&ta(e,t,0,!1);break}else{if(l=e.current.alternate,s&&!Nh(l)){n=ru(e,t,!1),s=!1;continue}if(n===2){if(s=t,e.errorRecoveryDisabledLanes&s)var c=0;else c=e.pendingLanes&-536870913,c=c!==0?c:c&536870912?536870912:0;if(c!==0){t=c;e:{var u=e;n=Jn;var f=u.current.memoizedState.isDehydrated;if(f&&(cn(u,c).flags|=256),c=ru(u,c,!1),c!==2){if(au&&!f){u.errorRecoveryDisabledLanes|=s,Ca|=s,n=4;break e}s=At,At=n,s!==null&&(At===null?At=s:At.push.apply(At,s))}n=c}if(s=!1,n!==2)continue}}if(n===1){cn(e,0),ta(e,t,0,!0);break}e:{switch(a=e,s=n,s){case 0:case 1:throw Error(d(345));case 4:if((t&4194048)!==t)break;case 6:ta(a,t,kt,!Fl);break e;case 2:At=null;break;case 3:case 5:break;default:throw Error(d(329))}if((t&62914560)===t&&(n=ts+300-at(),10<n)){if(ta(a,t,kt,!Fl),hl(a,0,!0)!==0)break e;Ol=t,a.timeoutHandle=df(Dd.bind(null,a,l,At,as,iu,t,kt,Ca,nn,Fl,s,"Throttled",-0,0),n);break e}Dd(a,l,At,as,iu,t,kt,Ca,nn,Fl,s,null,-0,0)}}break}while(!0);rl(e)}function Dd(e,t,l,a,n,s,c,u,f,T,O,H,C,A){if(e.timeoutHandle=-1,H=t.subtreeFlags,H&8192||(H&16785408)===16785408){H={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xl},Cd(t,s,H);var P=(s&62914560)===s?ts-at():(s&4194048)===s?zd-at():0;if(P=cp(H,P),P!==null){Ol=s,e.cancelPendingCommit=P(qd.bind(null,e,t,s,l,a,n,c,u,f,O,H,null,C,A)),ta(e,s,c,!T);return}}qd(e,t,s,l,a,n,c,u,f)}function Nh(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var a=0;a<l.length;a++){var n=l[a],s=n.getSnapshot;n=n.value;try{if(!Ot(s(),n))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ta(e,t,l,a){t&=~nu,t&=~Ca,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var n=t;0<n;){var s=31-bt(n),c=1<<s;a[s]=-1,n&=~c}l!==0&&hn(e,l,t)}function ns(){return(we&6)===0?($n(0),!1):!0}function ou(){if(ve!==null){if(Ue===0)var e=ve.return;else e=ve,vl=ba=null,Ec(e),$a=null,Un=0,e=ve;for(;e!==null;)dd(e.alternate,e),e=e.return;ve=null}}function cn(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Qh(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Ol=0,ou(),Le=e,ve=l=gl(e.current,null),je=t,Ue=0,Rt=null,Fl=!1,an=Pt(e,t),au=!1,nn=kt=nu=Ca=Il=Ke=0,At=Jn=null,iu=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var n=31-bt(a),s=1<<n;t|=e[n],a&=~s}return zl=t,Ei(),l}function Rd(e,t){xe=null,_.H=Gn,t===Wa||t===Mi?(t=Fo(),Ue=3):t===mc?(t=Fo(),Ue=4):Ue=t===Yc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Rt=t,ve===null&&(Ke=1,Ki(e,Xt(t,e.current)))}function kd(){var e=Mt.current;return e===null?!0:(je&4194048)===je?Jt===null:(je&62914560)===je||(je&536870912)!==0?e===Jt:!1}function Hd(){var e=_.H;return _.H=Gn,e===null?Gn:e}function Bd(){var e=_.A;return _.A=Sh,e}function is(){Ke=4,Fl||(je&4194048)!==je&&Mt.current!==null||(an=!0),(Il&134217727)===0&&(Ca&134217727)===0||Le===null||ta(Le,je,kt,!1)}function ru(e,t,l){var a=we;we|=2;var n=Hd(),s=Bd();(Le!==e||je!==t)&&(as=null,cn(e,t)),t=!1;var c=Ke;e:do try{if(Ue!==0&&ve!==null){var u=ve,f=Rt;switch(Ue){case 8:ou(),c=6;break e;case 3:case 2:case 9:case 6:Mt.current===null&&(t=!0);var T=Ue;if(Ue=0,Rt=null,un(e,u,f,T),l&&an){c=0;break e}break;default:T=Ue,Ue=0,Rt=null,un(e,u,f,T)}}Th(),c=Ke;break}catch(O){Rd(e,O)}while(!0);return t&&e.shellSuspendCounter++,vl=ba=null,we=a,_.H=n,_.A=s,ve===null&&(Le=null,je=0,Ei()),c}function Th(){for(;ve!==null;)Ld(ve)}function Eh(e,t){var l=we;we|=2;var a=Hd(),n=Bd();Le!==e||je!==t?(as=null,ls=at()+500,cn(e,t)):an=Pt(e,t);e:do try{if(Ue!==0&&ve!==null){t=ve;var s=Rt;t:switch(Ue){case 1:Ue=0,Rt=null,un(e,t,s,1);break;case 2:case 9:if(Wo(s)){Ue=0,Rt=null,Gd(t);break}t=function(){Ue!==2&&Ue!==9||Le!==e||(Ue=7),rl(e)},s.then(t,t);break e;case 3:Ue=7;break e;case 4:Ue=5;break e;case 7:Wo(s)?(Ue=0,Rt=null,Gd(t)):(Ue=0,Rt=null,un(e,t,s,7));break;case 5:var c=null;switch(ve.tag){case 26:c=ve.memoizedState;case 5:case 27:var u=ve;if(c?Cf(c):u.stateNode.complete){Ue=0,Rt=null;var f=u.sibling;if(f!==null)ve=f;else{var T=u.return;T!==null?(ve=T,ss(T)):ve=null}break t}}Ue=0,Rt=null,un(e,t,s,5);break;case 6:Ue=0,Rt=null,un(e,t,s,6);break;case 8:ou(),Ke=6;break e;default:throw Error(d(462))}}Ch();break}catch(O){Rd(e,O)}while(!0);return vl=ba=null,_.H=a,_.A=n,we=l,ve!==null?0:(Le=null,je=0,Ei(),Ke)}function Ch(){for(;ve!==null&&!fl();)Ld(ve)}function Ld(e){var t=od(e.alternate,e,zl);e.memoizedProps=e.pendingProps,t===null?ss(e):ve=t}function Gd(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=ad(l,t,t.pendingProps,t.type,void 0,je);break;case 11:t=ad(l,t,t.pendingProps,t.type.render,t.ref,je);break;case 5:Ec(t);default:dd(l,t),t=ve=Bo(t,zl),t=od(l,t,zl)}e.memoizedProps=e.pendingProps,t===null?ss(e):ve=t}function un(e,t,l,a){vl=ba=null,Ec(t),$a=null,Un=0;var n=t.return;try{if(hh(e,n,t,l,je)){Ke=1,Ki(e,Xt(l,e.current)),ve=null;return}}catch(s){if(n!==null)throw ve=n,s;Ke=1,Ki(e,Xt(l,e.current)),ve=null;return}t.flags&32768?(Te||a===1?e=!0:an||(je&536870912)!==0?e=!1:(Fl=e=!0,(a===2||a===9||a===3||a===6)&&(a=Mt.current,a!==null&&a.tag===13&&(a.flags|=16384))),Yd(t,e)):ss(t)}function ss(e){var t=e;do{if((t.flags&32768)!==0){Yd(t,Fl);return}e=t.return;var l=bh(t.alternate,t,zl);if(l!==null){ve=l;return}if(t=t.sibling,t!==null){ve=t;return}ve=t=e}while(t!==null);Ke===0&&(Ke=5)}function Yd(e,t){do{var l=gh(e.alternate,e);if(l!==null){l.flags&=32767,ve=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){ve=e;return}ve=e=l}while(e!==null);Ke=6,ve=null}function qd(e,t,l,a,n,s,c,u,f){e.cancelPendingCommit=null;do cs();while(lt!==0);if((we&6)!==0)throw Error(d(327));if(t!==null){if(t===e.current)throw Error(d(177));if(s=t.lanes|t.childLanes,s|=Is,mi(e,l,s,c,u,f),e===Le&&(ve=Le=null,je=0),sn=t,ea=e,Ol=l,su=s,cu=n,Od=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zh(Ft,function(){return Kd(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=_.T,_.T=null,n=L.p,L.p=2,c=we,we|=4;try{yh(e,t,l)}finally{we=c,L.p=n,_.T=a}}lt=1,Qd(),Xd(),Vd()}}function Qd(){if(lt===1){lt=0;var e=ea,t=sn,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=_.T,_.T=null;var a=L.p;L.p=2;var n=we;we|=4;try{Nd(t,e);var s=ju,c=wo(e.containerInfo),u=s.focusedElem,f=s.selectionRange;if(c!==u&&u&&u.ownerDocument&&Ao(u.ownerDocument.documentElement,u)){if(f!==null&&Ks(u)){var T=f.start,O=f.end;if(O===void 0&&(O=T),"selectionStart"in u)u.selectionStart=T,u.selectionEnd=Math.min(O,u.value.length);else{var H=u.ownerDocument||document,C=H&&H.defaultView||window;if(C.getSelection){var A=C.getSelection(),P=u.textContent.length,re=Math.min(f.start,P),Be=f.end===void 0?re:Math.min(f.end,P);!A.extend&&re>Be&&(c=Be,Be=re,re=c);var g=_o(u,re),p=_o(u,Be);if(g&&p&&(A.rangeCount!==1||A.anchorNode!==g.node||A.anchorOffset!==g.offset||A.focusNode!==p.node||A.focusOffset!==p.offset)){var N=H.createRange();N.setStart(g.node,g.offset),A.removeAllRanges(),re>Be?(A.addRange(N),A.extend(p.node,p.offset)):(N.setEnd(p.node,p.offset),A.addRange(N))}}}}for(H=[],A=u;A=A.parentNode;)A.nodeType===1&&H.push({element:A,left:A.scrollLeft,top:A.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<H.length;u++){var R=H[u];R.element.scrollLeft=R.left,R.element.scrollTop=R.top}}ys=!!Su,ju=Su=null}finally{we=n,L.p=a,_.T=l}}e.current=t,lt=2}}function Xd(){if(lt===2){lt=0;var e=ea,t=sn,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=_.T,_.T=null;var a=L.p;L.p=2;var n=we;we|=4;try{gd(e,t.alternate,t)}finally{we=n,L.p=a,_.T=l}}lt=3}}function Vd(){if(lt===4||lt===3){lt=0,Hl();var e=ea,t=sn,l=Ol,a=Od;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?lt=5:(lt=0,sn=ea=null,Zd(e,e.pendingLanes));var n=e.pendingLanes;if(n===0&&(Pl=null),nt(l),t=t.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(ml,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=_.T,n=L.p,L.p=2,_.T=null;try{for(var s=e.onRecoverableError,c=0;c<a.length;c++){var u=a[c];s(u.value,{componentStack:u.stack})}}finally{_.T=t,L.p=n}}(Ol&3)!==0&&cs(),rl(e),n=e.pendingLanes,(l&261930)!==0&&(n&42)!==0?e===uu?Wn++:(Wn=0,uu=e):Wn=0,$n(0)}}function Zd(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,zn(t)))}function cs(){return Qd(),Xd(),Vd(),Kd()}function Kd(){if(lt!==5)return!1;var e=ea,t=su;su=0;var l=nt(Ol),a=_.T,n=L.p;try{L.p=32>l?32:l,_.T=null,l=cu,cu=null;var s=ea,c=Ol;if(lt=0,sn=ea=null,Ol=0,(we&6)!==0)throw Error(d(331));var u=we;if(we|=4,Ad(s.current),Ed(s,s.current,c,l),we=u,$n(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(ml,s)}catch{}return!0}finally{L.p=n,_.T=a,Zd(e,t)}}function Jd(e,t,l){t=Xt(l,t),t=Gc(e.stateNode,t,2),e=Kl(e,t,2),e!==null&&(Bl(e,2),rl(e))}function Me(e,t,l){if(e.tag===3)Jd(e,e,l);else for(;t!==null;){if(t.tag===3){Jd(t,e,l);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Pl===null||!Pl.has(a))){e=Xt(l,e),l=Wr(2),a=Kl(t,l,2),a!==null&&($r(l,a,t,e),Bl(a,2),rl(a));break}}t=t.return}}function du(e,t,l){var a=e.pingCache;if(a===null){a=e.pingCache=new jh;var n=new Set;a.set(t,n)}else n=a.get(t),n===void 0&&(n=new Set,a.set(t,n));n.has(l)||(au=!0,n.add(l),e=_h.bind(null,e,t,l),t.then(e,e))}function _h(e,t,l){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Le===e&&(je&l)===l&&(Ke===4||Ke===3&&(je&62914560)===je&&300>at()-ts?(we&2)===0&&cn(e,0):nu|=l,nn===je&&(nn=0)),rl(e)}function Wd(e,t){t===0&&(t=sl()),e=ha(e,t),e!==null&&(Bl(e,t),rl(e))}function Ah(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Wd(e,l)}function wh(e,t){var l=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(d(314))}a!==null&&a.delete(t),Wd(e,l)}function zh(e,t){return dl(e,t)}var us=null,on=null,fu=!1,os=!1,mu=!1,la=0;function rl(e){e!==on&&e.next===null&&(on===null?us=on=e:on=on.next=e),os=!0,fu||(fu=!0,Uh())}function $n(e,t){if(!mu&&os){mu=!0;do for(var l=!1,a=us;a!==null;){if(e!==0){var n=a.pendingLanes;if(n===0)var s=0;else{var c=a.suspendedLanes,u=a.pingedLanes;s=(1<<31-bt(42|e)+1)-1,s&=n&~(c&~u),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(l=!0,Pd(a,s))}else s=je,s=hl(a,a===Le?s:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(s&3)===0||Pt(a,s)||(l=!0,Pd(a,s));a=a.next}while(l);mu=!1}}function Oh(){$d()}function $d(){os=fu=!1;var e=0;la!==0&&qh()&&(e=la);for(var t=at(),l=null,a=us;a!==null;){var n=a.next,s=Fd(a,t);s===0?(a.next=null,l===null?us=n:l.next=n,n===null&&(on=l)):(l=a,(e!==0||(s&3)!==0)&&(os=!0)),a=n}lt!==0&<!==5||$n(e),la!==0&&(la=0)}function Fd(e,t){for(var l=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var c=31-bt(s),u=1<<c,f=n[c];f===-1?((u&l)===0||(u&a)!==0)&&(n[c]=Ve(u,t)):f<=t&&(e.expiredLanes|=u),s&=~u}if(t=Le,l=je,l=hl(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,l===0||e===t&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&kl(a),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Pt(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(a!==null&&kl(a),nt(l)){case 2:case 8:l=nl;break;case 32:l=Ft;break;case 268435456:l=fi;break;default:l=Ft}return a=Id.bind(null,e),l=dl(l,a),e.callbackPriority=t,e.callbackNode=l,t}return a!==null&&a!==null&&kl(a),e.callbackPriority=2,e.callbackNode=null,2}function Id(e,t){if(lt!==0&<!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(cs()&&e.callbackNode!==l)return null;var a=je;return a=hl(e,e===Le?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Md(e,a,t),Fd(e,at()),e.callbackNode!=null&&e.callbackNode===l?Id.bind(null,e):null)}function Pd(e,t){if(cs())return null;Md(e,t,!0)}function Uh(){Xh(function(){(we&6)!==0?dl(Oe,Oh):$d()})}function hu(){if(la===0){var e=Ka;e===0&&(e=ct,ct<<=1,(ct&261888)===0&&(ct=256)),la=e}return la}function ef(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bi(""+e)}function tf(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Mh(e,t,l,a,n){if(t==="submit"&&l&&l.stateNode===n){var s=ef((n[Nt]||null).action),c=a.submitter;c&&(t=(t=c[Nt]||null)?ef(t.formAction):c.getAttribute("formAction"),t!==null&&(s=t,c=null));var u=new Si("action","action",null,a,n);e.push({event:u,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(la!==0){var f=c?tf(n,c):new FormData(n);Dc(l,{pending:!0,data:f,method:n.method,action:s},null,f)}}else typeof s=="function"&&(u.preventDefault(),f=c?tf(n,c):new FormData(n),Dc(l,{pending:!0,data:f,method:n.method,action:s},s,f))},currentTarget:n}]})}}for(var pu=0;pu<Fs.length;pu++){var xu=Fs[pu],Dh=xu.toLowerCase(),Rh=xu[0].toUpperCase()+xu.slice(1);el(Dh,"on"+Rh)}el(Uo,"onAnimationEnd"),el(Mo,"onAnimationIteration"),el(Do,"onAnimationStart"),el("dblclick","onDoubleClick"),el("focusin","onFocus"),el("focusout","onBlur"),el(Fm,"onTransitionRun"),el(Im,"onTransitionStart"),el(Pm,"onTransitionCancel"),el(Ro,"onTransitionEnd"),Ma("onMouseEnter",["mouseout","mouseover"]),Ma("onMouseLeave",["mouseout","mouseover"]),Ma("onPointerEnter",["pointerout","pointerover"]),Ma("onPointerLeave",["pointerout","pointerover"]),ra("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ra("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ra("onBeforeInput",["compositionend","keypress","textInput","paste"]),ra("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fn="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(" "),kh=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fn));function lf(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var a=e[l],n=a.event;a=a.listeners;e:{var s=void 0;if(t)for(var c=a.length-1;0<=c;c--){var u=a[c],f=u.instance,T=u.currentTarget;if(u=u.listener,f!==s&&n.isPropagationStopped())break e;s=u,n.currentTarget=T;try{s(n)}catch(O){Ti(O)}n.currentTarget=null,s=f}else for(c=0;c<a.length;c++){if(u=a[c],f=u.instance,T=u.currentTarget,u=u.listener,f!==s&&n.isPropagationStopped())break e;s=u,n.currentTarget=T;try{s(n)}catch(O){Ti(O)}n.currentTarget=null,s=f}}}}function Se(e,t){var l=t[ws];l===void 0&&(l=t[ws]=new Set);var a=e+"__bubble";l.has(a)||(af(t,e,2,!1),l.add(a))}function bu(e,t,l){var a=0;t&&(a|=4),af(l,e,a,t)}var rs="_reactListening"+Math.random().toString(36).slice(2);function gu(e){if(!e[rs]){e[rs]=!0,Wu.forEach(function(l){l!=="selectionchange"&&(kh.has(l)||bu(l,!1,e),bu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[rs]||(t[rs]=!0,bu("selectionchange",!1,t))}}function af(e,t,l,a){switch(Mf(t)){case 2:var n=rp;break;case 8:n=dp;break;default:n=Mu}l=n.bind(null,t,l,e),n=void 0,!Bs||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),a?n!==void 0?e.addEventListener(t,l,{capture:!0,passive:n}):e.addEventListener(t,l,!0):n!==void 0?e.addEventListener(t,l,{passive:n}):e.addEventListener(t,l,!1)}function yu(e,t,l,a,n){var s=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var c=a.tag;if(c===3||c===4){var u=a.stateNode.containerInfo;if(u===n)break;if(c===4)for(c=a.return;c!==null;){var f=c.tag;if((f===3||f===4)&&c.stateNode.containerInfo===n)return;c=c.return}for(;u!==null;){if(c=za(u),c===null)return;if(f=c.tag,f===5||f===6||f===26||f===27){a=s=c;continue e}u=u.parentNode}}a=a.return}co(function(){var T=s,O=ks(l),H=[];e:{var C=ko.get(e);if(C!==void 0){var A=Si,P=e;switch(e){case"keypress":if(yi(l)===0)break e;case"keydown":case"keyup":A=wm;break;case"focusin":P="focus",A=qs;break;case"focusout":P="blur",A=qs;break;case"beforeblur":case"afterblur":A=qs;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":A=ro;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":A=bm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":A=Um;break;case Uo:case Mo:case Do:A=vm;break;case Ro:A=Dm;break;case"scroll":case"scrollend":A=pm;break;case"wheel":A=km;break;case"copy":case"cut":case"paste":A=jm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":A=mo;break;case"toggle":case"beforetoggle":A=Bm}var re=(t&4)!==0,Be=!re&&(e==="scroll"||e==="scrollend"),g=re?C!==null?C+"Capture":null:C;re=[];for(var p=T,N;p!==null;){var R=p;if(N=R.stateNode,R=R.tag,R!==5&&R!==26&&R!==27||N===null||g===null||(R=yn(p,g),R!=null&&re.push(In(p,R,N))),Be)break;p=p.return}0<re.length&&(C=new A(C,P,null,l,O),H.push({event:C,listeners:re}))}}if((t&7)===0){e:{if(C=e==="mouseover"||e==="pointerover",A=e==="mouseout"||e==="pointerout",C&&l!==Rs&&(P=l.relatedTarget||l.fromElement)&&(za(P)||P[wa]))break e;if((A||C)&&(C=O.window===O?O:(C=O.ownerDocument)?C.defaultView||C.parentWindow:window,A?(P=l.relatedTarget||l.toElement,A=T,P=P?za(P):null,P!==null&&(Be=E(P),re=P.tag,P!==Be||re!==5&&re!==27&&re!==6)&&(P=null)):(A=null,P=T),A!==P)){if(re=ro,R="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(re=mo,R="onPointerLeave",g="onPointerEnter",p="pointer"),Be=A==null?C:gn(A),N=P==null?C:gn(P),C=new re(R,p+"leave",A,l,O),C.target=Be,C.relatedTarget=N,R=null,za(O)===T&&(re=new re(g,p+"enter",P,l,O),re.target=N,re.relatedTarget=Be,R=re),Be=R,A&&P)t:{for(re=Hh,g=A,p=P,N=0,R=g;R;R=re(R))N++;R=0;for(var ce=p;ce;ce=re(ce))R++;for(;0<N-R;)g=re(g),N--;for(;0<R-N;)p=re(p),R--;for(;N--;){if(g===p||p!==null&&g===p.alternate){re=g;break t}g=re(g),p=re(p)}re=null}else re=null;A!==null&&nf(H,C,A,re,!1),P!==null&&Be!==null&&nf(H,Be,P,re,!0)}}e:{if(C=T?gn(T):window,A=C.nodeName&&C.nodeName.toLowerCase(),A==="select"||A==="input"&&C.type==="file")var Ce=So;else if(yo(C))if(jo)Ce=Jm;else{Ce=Zm;var le=Vm}else A=C.nodeName,!A||A.toLowerCase()!=="input"||C.type!=="checkbox"&&C.type!=="radio"?T&&Ds(T.elementType)&&(Ce=So):Ce=Km;if(Ce&&(Ce=Ce(e,T))){vo(H,Ce,l,O);break e}le&&le(e,C,T),e==="focusout"&&T&&C.type==="number"&&T.memoizedProps.value!=null&&Ms(C,"number",C.value)}switch(le=T?gn(T):window,e){case"focusin":(yo(le)||le.contentEditable==="true")&&(La=le,Js=T,_n=null);break;case"focusout":_n=Js=La=null;break;case"mousedown":Ws=!0;break;case"contextmenu":case"mouseup":case"dragend":Ws=!1,zo(H,l,O);break;case"selectionchange":if($m)break;case"keydown":case"keyup":zo(H,l,O)}var ge;if(Xs)e:{switch(e){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Ba?bo(e,l)&&(Ne="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ne="onCompositionStart");Ne&&(ho&&l.locale!=="ko"&&(Ba||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Ba&&(ge=uo()):(Gl=O,Ls="value"in Gl?Gl.value:Gl.textContent,Ba=!0)),le=ds(T,Ne),0<le.length&&(Ne=new fo(Ne,e,null,l,O),H.push({event:Ne,listeners:le}),ge?Ne.data=ge:(ge=go(l),ge!==null&&(Ne.data=ge)))),(ge=Gm?Ym(e,l):qm(e,l))&&(Ne=ds(T,"onBeforeInput"),0<Ne.length&&(le=new fo("onBeforeInput","beforeinput",null,l,O),H.push({event:le,listeners:Ne}),le.data=ge)),Mh(H,e,T,l,O)}lf(H,t)})}function In(e,t,l){return{instance:e,listener:t,currentTarget:l}}function ds(e,t){for(var l=t+"Capture",a=[];e!==null;){var n=e,s=n.stateNode;if(n=n.tag,n!==5&&n!==26&&n!==27||s===null||(n=yn(e,l),n!=null&&a.unshift(In(e,n,s)),n=yn(e,t),n!=null&&a.push(In(e,n,s))),e.tag===3)return a;e=e.return}return[]}function Hh(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function nf(e,t,l,a,n){for(var s=t._reactName,c=[];l!==null&&l!==a;){var u=l,f=u.alternate,T=u.stateNode;if(u=u.tag,f!==null&&f===a)break;u!==5&&u!==26&&u!==27||T===null||(f=T,n?(T=yn(l,s),T!=null&&c.unshift(In(l,T,f))):n||(T=yn(l,s),T!=null&&c.push(In(l,T,f)))),l=l.return}c.length!==0&&e.push({event:t,listeners:c})}var Bh=/\r\n?/g,Lh=/\u0000|\uFFFD/g;function sf(e){return(typeof e=="string"?e:""+e).replace(Bh,`
|
|
49
|
+
`).replace(Lh,"")}function cf(e,t){return t=sf(t),sf(e)===t}function He(e,t,l,a,n,s){switch(l){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||Ra(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&Ra(e,""+a);break;case"className":pi(e,"class",a);break;case"tabIndex":pi(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":pi(e,l,a);break;case"style":io(e,a,s);break;case"data":if(t!=="object"){pi(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=bi(""+a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof s=="function"&&(l==="formAction"?(t!=="input"&&He(e,t,"name",n.name,n,null),He(e,t,"formEncType",n.formEncType,n,null),He(e,t,"formMethod",n.formMethod,n,null),He(e,t,"formTarget",n.formTarget,n,null)):(He(e,t,"encType",n.encType,n,null),He(e,t,"method",n.method,n,null),He(e,t,"target",n.target,n,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=bi(""+a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=xl);break;case"onScroll":a!=null&&Se("scroll",e);break;case"onScrollEnd":a!=null&&Se("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(d(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(d(60));e.innerHTML=l}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=bi(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""+a):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":Se("beforetoggle",e),Se("toggle",e),hi(e,"popover",a);break;case"xlinkActuate":pl(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":pl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":pl(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":pl(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":pl(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":pl(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":pl(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":pl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":pl(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":hi(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=mm.get(l)||l,hi(e,l,a))}}function vu(e,t,l,a,n,s){switch(l){case"style":io(e,a,s);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(d(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(d(60));e.innerHTML=l}}break;case"children":typeof a=="string"?Ra(e,a):(typeof a=="number"||typeof a=="bigint")&&Ra(e,""+a);break;case"onScroll":a!=null&&Se("scroll",e);break;case"onScrollEnd":a!=null&&Se("scrollend",e);break;case"onClick":a!=null&&(e.onclick=xl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$u.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(n=l.endsWith("Capture"),t=l.slice(2,n?l.length-7:void 0),s=e[Nt]||null,s=s!=null?s[l]:null,typeof s=="function"&&e.removeEventListener(t,s,n),typeof a=="function")){typeof s!="function"&&s!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,a,n);break e}l in e?e[l]=a:a===!0?e.setAttribute(l,""):hi(e,l,a)}}}function ft(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Se("error",e),Se("load",e);var a=!1,n=!1,s;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];if(c!=null)switch(s){case"src":a=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(d(137,t));default:He(e,t,s,c,l,null)}}n&&He(e,t,"srcSet",l.srcSet,l,null),a&&He(e,t,"src",l.src,l,null);return;case"input":Se("invalid",e);var u=s=c=n=null,f=null,T=null;for(a in l)if(l.hasOwnProperty(a)){var O=l[a];if(O!=null)switch(a){case"name":n=O;break;case"type":c=O;break;case"checked":f=O;break;case"defaultChecked":T=O;break;case"value":s=O;break;case"defaultValue":u=O;break;case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(d(137,t));break;default:He(e,t,a,O,l,null)}}to(e,s,u,f,T,c,n,!1);return;case"select":Se("invalid",e),a=c=s=null;for(n in l)if(l.hasOwnProperty(n)&&(u=l[n],u!=null))switch(n){case"value":s=u;break;case"defaultValue":c=u;break;case"multiple":a=u;default:He(e,t,n,u,l,null)}t=s,l=c,e.multiple=!!a,t!=null?Da(e,!!a,t,!1):l!=null&&Da(e,!!a,l,!0);return;case"textarea":Se("invalid",e),s=n=a=null;for(c in l)if(l.hasOwnProperty(c)&&(u=l[c],u!=null))switch(c){case"value":a=u;break;case"defaultValue":n=u;break;case"children":s=u;break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(d(91));break;default:He(e,t,c,u,l,null)}ao(e,a,n,s);return;case"option":for(f in l)if(l.hasOwnProperty(f)&&(a=l[f],a!=null))switch(f){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:He(e,t,f,a,l,null)}return;case"dialog":Se("beforetoggle",e),Se("toggle",e),Se("cancel",e),Se("close",e);break;case"iframe":case"object":Se("load",e);break;case"video":case"audio":for(a=0;a<Fn.length;a++)Se(Fn[a],e);break;case"image":Se("error",e),Se("load",e);break;case"details":Se("toggle",e);break;case"embed":case"source":case"link":Se("error",e),Se("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(T in l)if(l.hasOwnProperty(T)&&(a=l[T],a!=null))switch(T){case"children":case"dangerouslySetInnerHTML":throw Error(d(137,t));default:He(e,t,T,a,l,null)}return;default:if(Ds(t)){for(O in l)l.hasOwnProperty(O)&&(a=l[O],a!==void 0&&vu(e,t,O,a,l,void 0));return}}for(u in l)l.hasOwnProperty(u)&&(a=l[u],a!=null&&He(e,t,u,a,l,null))}function Gh(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,s=null,c=null,u=null,f=null,T=null,O=null;for(A in l){var H=l[A];if(l.hasOwnProperty(A)&&H!=null)switch(A){case"checked":break;case"value":break;case"defaultValue":f=H;default:a.hasOwnProperty(A)||He(e,t,A,null,a,H)}}for(var C in a){var A=a[C];if(H=l[C],a.hasOwnProperty(C)&&(A!=null||H!=null))switch(C){case"type":s=A;break;case"name":n=A;break;case"checked":T=A;break;case"defaultChecked":O=A;break;case"value":c=A;break;case"defaultValue":u=A;break;case"children":case"dangerouslySetInnerHTML":if(A!=null)throw Error(d(137,t));break;default:A!==H&&He(e,t,C,A,a,H)}}Us(e,c,u,f,T,O,s,n);return;case"select":A=c=u=C=null;for(s in l)if(f=l[s],l.hasOwnProperty(s)&&f!=null)switch(s){case"value":break;case"multiple":A=f;default:a.hasOwnProperty(s)||He(e,t,s,null,a,f)}for(n in a)if(s=a[n],f=l[n],a.hasOwnProperty(n)&&(s!=null||f!=null))switch(n){case"value":C=s;break;case"defaultValue":u=s;break;case"multiple":c=s;default:s!==f&&He(e,t,n,s,a,f)}t=u,l=c,a=A,C!=null?Da(e,!!l,C,!1):!!a!=!!l&&(t!=null?Da(e,!!l,t,!0):Da(e,!!l,l?[]:"",!1));return;case"textarea":A=C=null;for(u in l)if(n=l[u],l.hasOwnProperty(u)&&n!=null&&!a.hasOwnProperty(u))switch(u){case"value":break;case"children":break;default:He(e,t,u,null,a,n)}for(c in a)if(n=a[c],s=l[c],a.hasOwnProperty(c)&&(n!=null||s!=null))switch(c){case"value":C=n;break;case"defaultValue":A=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(d(91));break;default:n!==s&&He(e,t,c,n,a,s)}lo(e,C,A);return;case"option":for(var P in l)if(C=l[P],l.hasOwnProperty(P)&&C!=null&&!a.hasOwnProperty(P))switch(P){case"selected":e.selected=!1;break;default:He(e,t,P,null,a,C)}for(f in a)if(C=a[f],A=l[f],a.hasOwnProperty(f)&&C!==A&&(C!=null||A!=null))switch(f){case"selected":e.selected=C&&typeof C!="function"&&typeof C!="symbol";break;default:He(e,t,f,C,a,A)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var re in l)C=l[re],l.hasOwnProperty(re)&&C!=null&&!a.hasOwnProperty(re)&&He(e,t,re,null,a,C);for(T in a)if(C=a[T],A=l[T],a.hasOwnProperty(T)&&C!==A&&(C!=null||A!=null))switch(T){case"children":case"dangerouslySetInnerHTML":if(C!=null)throw Error(d(137,t));break;default:He(e,t,T,C,a,A)}return;default:if(Ds(t)){for(var Be in l)C=l[Be],l.hasOwnProperty(Be)&&C!==void 0&&!a.hasOwnProperty(Be)&&vu(e,t,Be,void 0,a,C);for(O in a)C=a[O],A=l[O],!a.hasOwnProperty(O)||C===A||C===void 0&&A===void 0||vu(e,t,O,C,a,A);return}}for(var g in l)C=l[g],l.hasOwnProperty(g)&&C!=null&&!a.hasOwnProperty(g)&&He(e,t,g,null,a,C);for(H in a)C=a[H],A=l[H],!a.hasOwnProperty(H)||C===A||C==null&&A==null||He(e,t,H,C,a,A)}function uf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Yh(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var n=l[a],s=n.transferSize,c=n.initiatorType,u=n.duration;if(s&&u&&uf(c)){for(c=0,u=n.responseEnd,a+=1;a<l.length;a++){var f=l[a],T=f.startTime;if(T>u)break;var O=f.transferSize,H=f.initiatorType;O&&uf(H)&&(f=f.responseEnd,c+=O*(f<u?1:(u-T)/(f-T)))}if(--a,t+=8*(s+c)/(n.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Su=null,ju=null;function fs(e){return e.nodeType===9?e:e.ownerDocument}function of(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function rf(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Nu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Tu=null;function qh(){var e=window.event;return e&&e.type==="popstate"?e===Tu?!1:(Tu=e,!0):(Tu=null,!1)}var df=typeof setTimeout=="function"?setTimeout:void 0,Qh=typeof clearTimeout=="function"?clearTimeout:void 0,ff=typeof Promise=="function"?Promise:void 0,Xh=typeof queueMicrotask=="function"?queueMicrotask:typeof ff<"u"?function(e){return ff.resolve(null).then(e).catch(Vh)}:df;function Vh(e){setTimeout(function(){throw e})}function aa(e){return e==="head"}function mf(e,t){var l=t,a=0;do{var n=l.nextSibling;if(e.removeChild(l),n&&n.nodeType===8)if(l=n.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(n),mn(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")Pn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Pn(l);for(var s=l.firstChild;s;){var c=s.nextSibling,u=s.nodeName;s[bn]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&s.rel.toLowerCase()==="stylesheet"||l.removeChild(s),s=c}}else l==="body"&&Pn(e.ownerDocument.body);l=n}while(l);mn(t)}function hf(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function Eu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Eu(l),zs(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Zh(e,t,l,a){for(;e.nodeType===1;){var n=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[bn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=Wt(e.nextSibling),e===null)break}return null}function Kh(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Wt(e.nextSibling),e===null))return null;return e}function pf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Wt(e.nextSibling),e===null))return null;return e}function Cu(e){return e.data==="$?"||e.data==="$~"}function _u(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Jh(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function Wt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Au=null;function xf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Wt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function bf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function gf(e,t,l){switch(t=fs(l),e){case"html":if(e=t.documentElement,!e)throw Error(d(452));return e;case"head":if(e=t.head,!e)throw Error(d(453));return e;case"body":if(e=t.body,!e)throw Error(d(454));return e;default:throw Error(d(451))}}function Pn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zs(e)}var $t=new Map,yf=new Set;function ms(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ul=L.d;L.d={f:Wh,r:$h,D:Fh,C:Ih,L:Ph,m:ep,X:lp,S:tp,M:ap};function Wh(){var e=Ul.f(),t=ns();return e||t}function $h(e){var t=Oa(e);t!==null&&t.tag===5&&t.type==="form"?Rr(t):Ul.r(e)}var rn=typeof document>"u"?null:document;function vf(e,t,l){var a=rn;if(a&&typeof t=="string"&&t){var n=qt(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),yf.has(n)||(yf.add(n),e={rel:e,crossOrigin:l,href:t},a.querySelector(n)===null&&(t=a.createElement("link"),ft(t,"link",e),it(t),a.head.appendChild(t)))}}function Fh(e){Ul.D(e),vf("dns-prefetch",e,null)}function Ih(e,t){Ul.C(e,t),vf("preconnect",e,t)}function Ph(e,t,l){Ul.L(e,t,l);var a=rn;if(a&&e&&t){var n='link[rel="preload"][as="'+qt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+qt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+qt(l.imageSizes)+'"]')):n+='[href="'+qt(e)+'"]';var s=n;switch(t){case"style":s=dn(e);break;case"script":s=fn(e)}$t.has(s)||(e=v({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),$t.set(s,e),a.querySelector(n)!==null||t==="style"&&a.querySelector(ei(s))||t==="script"&&a.querySelector(ti(s))||(t=a.createElement("link"),ft(t,"link",e),it(t),a.head.appendChild(t)))}}function ep(e,t){Ul.m(e,t);var l=rn;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+qt(a)+'"][href="'+qt(e)+'"]',s=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=fn(e)}if(!$t.has(s)&&(e=v({rel:"modulepreload",href:e},t),$t.set(s,e),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ti(s)))return}a=l.createElement("link"),ft(a,"link",e),it(a),l.head.appendChild(a)}}}function tp(e,t,l){Ul.S(e,t,l);var a=rn;if(a&&e){var n=Ua(a).hoistableStyles,s=dn(e);t=t||"default";var c=n.get(s);if(!c){var u={loading:0,preload:null};if(c=a.querySelector(ei(s)))u.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},l),(l=$t.get(s))&&wu(e,l);var f=c=a.createElement("link");it(f),ft(f,"link",e),f._p=new Promise(function(T,O){f.onload=T,f.onerror=O}),f.addEventListener("load",function(){u.loading|=1}),f.addEventListener("error",function(){u.loading|=2}),u.loading|=4,hs(c,t,a)}c={type:"stylesheet",instance:c,count:1,state:u},n.set(s,c)}}}function lp(e,t){Ul.X(e,t);var l=rn;if(l&&e){var a=Ua(l).hoistableScripts,n=fn(e),s=a.get(n);s||(s=l.querySelector(ti(n)),s||(e=v({src:e,async:!0},t),(t=$t.get(n))&&zu(e,t),s=l.createElement("script"),it(s),ft(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},a.set(n,s))}}function ap(e,t){Ul.M(e,t);var l=rn;if(l&&e){var a=Ua(l).hoistableScripts,n=fn(e),s=a.get(n);s||(s=l.querySelector(ti(n)),s||(e=v({src:e,async:!0,type:"module"},t),(t=$t.get(n))&&zu(e,t),s=l.createElement("script"),it(s),ft(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},a.set(n,s))}}function Sf(e,t,l,a){var n=(n=me.current)?ms(n):null;if(!n)throw Error(d(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=dn(l.href),l=Ua(n).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=dn(l.href);var s=Ua(n).hoistableStyles,c=s.get(e);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,c),(s=n.querySelector(ei(e)))&&!s._p&&(c.instance=s,c.state.loading=5),$t.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},$t.set(e,l),s||np(n,e,l,c.state))),t&&a===null)throw Error(d(528,""));return c}if(t&&a!==null)throw Error(d(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fn(l),l=Ua(n).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(d(444,e))}}function dn(e){return'href="'+qt(e)+'"'}function ei(e){return'link[rel="stylesheet"]['+e+"]"}function jf(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function np(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),ft(t,"link",l),it(t),e.head.appendChild(t))}function fn(e){return'[src="'+qt(e)+'"]'}function ti(e){return"script[async]"+e}function Nf(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+qt(l.href)+'"]');if(a)return t.instance=a,it(a),a;var n=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),it(a),ft(a,"style",n),hs(a,l.precedence,e),t.instance=a;case"stylesheet":n=dn(l.href);var s=e.querySelector(ei(n));if(s)return t.state.loading|=4,t.instance=s,it(s),s;a=jf(l),(n=$t.get(n))&&wu(a,n),s=(e.ownerDocument||e).createElement("link"),it(s);var c=s;return c._p=new Promise(function(u,f){c.onload=u,c.onerror=f}),ft(s,"link",a),t.state.loading|=4,hs(s,l.precedence,e),t.instance=s;case"script":return s=fn(l.src),(n=e.querySelector(ti(s)))?(t.instance=n,it(n),n):(a=l,(n=$t.get(s))&&(a=v({},l),zu(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),it(n),ft(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(d(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,hs(a,l.precedence,e));return t.instance}function hs(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,s=n,c=0;c<a.length;c++){var u=a[c];if(u.dataset.precedence===t)s=u;else if(s!==n)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function wu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ps=null;function Tf(e,t,l){if(ps===null){var a=new Map,n=ps=new Map;n.set(l,a)}else n=ps,a=n.get(l),a||(a=new Map,n.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),n=0;n<l.length;n++){var s=l[n];if(!(s[bn]||s[ut]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var c=s.getAttribute(t)||"";c=e+c;var u=a.get(c);u?u.push(s):a.set(c,[s])}}return a}function Ef(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function ip(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Cf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function sp(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=dn(a.href),s=t.querySelector(ei(n));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=xs.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=s,it(s);return}s=t.ownerDocument||t,a=jf(a),(n=$t.get(n))&&wu(a,n),s=s.createElement("link"),it(s);var c=s;c._p=new Promise(function(u,f){c.onload=u,c.onerror=f}),ft(s,"link",a),l.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=xs.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Ou=0;function cp(e,t){return e.stylesheets&&e.count===0&&gs(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&gs(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Ou===0&&(Ou=62500*Yh());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gs(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Ou?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function xs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var bs=null;function gs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,bs=new Map,t.forEach(up,e),bs=null,xs.call(e))}function up(e,t){if(!(t.state.loading&4)){var l=bs.get(e);if(l)var a=l.get(null);else{l=new Map,bs.set(e,l);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<n.length;s++){var c=n[s];(c.nodeName==="LINK"||c.getAttribute("media")!=="not all")&&(l.set(c.dataset.precedence,c),a=c)}a&&l.set(null,a)}n=t.instance,c=n.getAttribute("data-precedence"),s=l.get(c)||a,s===a&&l.set(null,n),l.set(c,n),this.count++,a=xs.bind(this),n.addEventListener("load",a),n.addEventListener("error",a),s?s.parentNode.insertBefore(n,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var li={$$typeof:ee,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function op(e,t,l,a,n,s,c,u,f){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Aa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Aa(0),this.hiddenUpdates=Aa(null),this.identifierPrefix=a,this.onUncaughtError=n,this.onCaughtError=s,this.onRecoverableError=c,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=f,this.incompleteTransitions=new Map}function _f(e,t,l,a,n,s,c,u,f,T,O,H){return e=new op(e,t,l,c,f,T,O,H,u),t=1,s===!0&&(t|=24),s=Ut(3,null,null,t),e.current=s,s.stateNode=e,t=rc(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:a,isDehydrated:l,cache:t},hc(s),e}function Af(e){return e?(e=qa,e):qa}function wf(e,t,l,a,n,s){n=Af(n),a.context===null?a.context=n:a.pendingContext=n,a=Zl(t),a.payload={element:l},s=s===void 0?null:s,s!==null&&(a.callback=s),l=Kl(e,a,t),l!==null&&(wt(l,e,t),Dn(l,e,t))}function zf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Uu(e,t){zf(e,t),(e=e.alternate)&&zf(e,t)}function Of(e){if(e.tag===13||e.tag===31){var t=ha(e,67108864);t!==null&&wt(t,e,67108864),Uu(e,67108864)}}function Uf(e){if(e.tag===13||e.tag===31){var t=Ht();t=Re(t);var l=ha(e,t);l!==null&&wt(l,e,t),Uu(e,t)}}var ys=!0;function rp(e,t,l,a){var n=_.T;_.T=null;var s=L.p;try{L.p=2,Mu(e,t,l,a)}finally{L.p=s,_.T=n}}function dp(e,t,l,a){var n=_.T;_.T=null;var s=L.p;try{L.p=8,Mu(e,t,l,a)}finally{L.p=s,_.T=n}}function Mu(e,t,l,a){if(ys){var n=Du(a);if(n===null)yu(e,t,a,vs,l),Df(e,a);else if(mp(n,e,t,l,a))a.stopPropagation();else if(Df(e,a),t&4&&-1<fp.indexOf(e)){for(;n!==null;){var s=Oa(n);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var c=Lt(s.pendingLanes);if(c!==0){var u=s;for(u.pendingLanes|=2,u.entangledLanes|=2;c;){var f=1<<31-bt(c);u.entanglements[1]|=f,c&=~f}rl(s),(we&6)===0&&(ls=at()+500,$n(0))}}break;case 31:case 13:u=ha(s,2),u!==null&&wt(u,s,2),ns(),Uu(s,2)}if(s=Du(a),s===null&&yu(e,t,a,vs,l),s===n)break;n=s}n!==null&&a.stopPropagation()}else yu(e,t,a,null,l)}}function Du(e){return e=ks(e),Ru(e)}var vs=null;function Ru(e){if(vs=null,e=za(e),e!==null){var t=E(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=w(t),e!==null)return e;e=null}else if(l===31){if(e=M(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vs=e,null}function Mf(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_a()){case Oe:return 2;case nl:return 8;case Ft:case Cs:return 32;case fi:return 268435456;default:return 32}default:return 32}}var ku=!1,na=null,ia=null,sa=null,ai=new Map,ni=new Map,ca=[],fp="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Df(e,t){switch(e){case"focusin":case"focusout":na=null;break;case"dragenter":case"dragleave":ia=null;break;case"mouseover":case"mouseout":sa=null;break;case"pointerover":case"pointerout":ai.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ni.delete(t.pointerId)}}function ii(e,t,l,a,n,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:s,targetContainers:[n]},t!==null&&(t=Oa(t),t!==null&&Of(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function mp(e,t,l,a,n){switch(t){case"focusin":return na=ii(na,e,t,l,a,n),!0;case"dragenter":return ia=ii(ia,e,t,l,a,n),!0;case"mouseover":return sa=ii(sa,e,t,l,a,n),!0;case"pointerover":var s=n.pointerId;return ai.set(s,ii(ai.get(s)||null,e,t,l,a,n)),!0;case"gotpointercapture":return s=n.pointerId,ni.set(s,ii(ni.get(s)||null,e,t,l,a,n)),!0}return!1}function Rf(e){var t=za(e.target);if(t!==null){var l=E(t);if(l!==null){if(t=l.tag,t===13){if(t=w(l),t!==null){e.blockedOn=t,Ku(e.priority,function(){Uf(l)});return}}else if(t===31){if(t=M(l),t!==null){e.blockedOn=t,Ku(e.priority,function(){Uf(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ss(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Du(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);Rs=a,l.target.dispatchEvent(a),Rs=null}else return t=Oa(l),t!==null&&Of(t),e.blockedOn=l,!1;t.shift()}return!0}function kf(e,t,l){Ss(e)&&l.delete(t)}function hp(){ku=!1,na!==null&&Ss(na)&&(na=null),ia!==null&&Ss(ia)&&(ia=null),sa!==null&&Ss(sa)&&(sa=null),ai.forEach(kf),ni.forEach(kf)}function js(e,t){e.blockedOn===t&&(e.blockedOn=null,ku||(ku=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,hp)))}var Ns=null;function Hf(e){Ns!==e&&(Ns=e,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){Ns===e&&(Ns=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],n=e[t+2];if(typeof a!="function"){if(Ru(a||l)===null)continue;break}var s=Oa(l);s!==null&&(e.splice(t,3),t-=3,Dc(s,{pending:!0,data:n,method:l.method,action:a},a,n))}}))}function mn(e){function t(f){return js(f,e)}na!==null&&js(na,e),ia!==null&&js(ia,e),sa!==null&&js(sa,e),ai.forEach(t),ni.forEach(t);for(var l=0;l<ca.length;l++){var a=ca[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<ca.length&&(l=ca[0],l.blockedOn===null);)Rf(l),l.blockedOn===null&&ca.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var n=l[a],s=l[a+1],c=n[Nt]||null;if(typeof s=="function")c||Hf(l);else if(c){var u=null;if(s&&s.hasAttribute("formAction")){if(n=s,c=s[Nt]||null)u=c.formAction;else if(Ru(n)!==null)continue}else u=c.action;typeof u=="function"?l[a+1]=u:(l.splice(a,3),a-=3),Hf(l)}}}function Bf(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(c){return n=c})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),a||setTimeout(l,20)}function l(){if(!a&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),n!==null&&(n(),n=null)}}}function Hu(e){this._internalRoot=e}Ts.prototype.render=Hu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(d(409));var l=t.current,a=Ht();wf(l,a,e,t,null,null)},Ts.prototype.unmount=Hu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wf(e.current,2,null,e,null,null),ns(),t[wa]=null}};function Ts(e){this._internalRoot=e}Ts.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gt();e={blockedOn:null,target:e,priority:t};for(var l=0;l<ca.length&&t!==0&&t<ca[l].priority;l++);ca.splice(l,0,e),l===0&&Rf(e)}};var Lf=r.version;if(Lf!=="19.2.4")throw Error(d(527,Lf,"19.2.4"));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(d(188)):(e=Object.keys(e).join(","),Error(d(268,e)));return e=x(t),e=e!==null?k(e):null,e=e===null?null:e.stateNode,e};var pp={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Es=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Es.isDisabled&&Es.supportsFiber)try{ml=Es.inject(pp),xt=Es}catch{}}return ci.createRoot=function(e,t){if(!S(e))throw Error(d(299));var l=!1,a="",n=Vr,s=Zr,c=Kr;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=_f(e,1,!1,null,null,l,a,null,n,s,c,Bf),e[wa]=t.current,gu(e),new Hu(t)},ci.hydrateRoot=function(e,t,l){if(!S(e))throw Error(d(299));var a=!1,n="",s=Vr,c=Zr,u=Kr,f=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(s=l.onUncaughtError),l.onCaughtError!==void 0&&(c=l.onCaughtError),l.onRecoverableError!==void 0&&(u=l.onRecoverableError),l.formState!==void 0&&(f=l.formState)),t=_f(e,1,!0,t,l??null,a,n,f,s,c,u,Bf),t.context=Af(null),l=t.current,a=Ht(),a=Re(a),n=Zl(a),n.callback=null,Kl(l,n,a),l=a,t.current.lanes=l,Bl(t,l),rl(t),e[wa]=t.current,gu(e),new Ts(t)},ci.version="19.2.4",ci}var Wf;function Cp(){if(Wf)return Lu.exports;Wf=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(r){console.error(r)}}return o(),Lu.exports=Ep(),Lu.exports}var _p=Cp(),h=Zu();const Ap=bp(h),wp={entries:[],serverLogLines:[],channels:{},services:{},settings:{},tunnelActive:!1,tunnelUrl:null,tunnelHasToken:!1,mcpActive:!1,mcpUrl:null,mcpExpose:!1,mcpHasSecret:!1,tunnelExposeDashboard:!1,hasSmsWebhookChannels:!1,baileysAvailable:!0,twilioDefaults:{sid:"",tok:""},stats:{total:0,errorCount:0,avgLatency:0,uptime:0},wsConnected:!1,configChanged:!1,qrMessage:null,smsListenMessage:null};function zp(o,r){switch(r.type){case"SET_ENTRIES":return{...o,entries:r.payload};case"ADD_ENTRY":return{...o,entries:[r.payload,...o.entries].slice(0,1e3)};case"SET_SERVER_LOGS":return{...o,serverLogLines:r.payload};case"ADD_SERVER_LOG":{const y=[...o.serverLogLines,r.payload];return y.length>500&&y.shift(),{...o,serverLogLines:y}}case"SET_CONFIG":return{...o,channels:r.payload.channels||o.channels,services:r.payload.services||o.services,baileysAvailable:r.payload.baileysAvailable??o.baileysAvailable,hasSmsWebhookChannels:Object.values(r.payload.channels||{}).some(y=>y.type==="sms"&&!y.poll_interval)};case"SET_SETTINGS":return{...o,settings:r.payload};case"SET_TUNNEL":return{...o,tunnelActive:r.payload.active??o.tunnelActive,tunnelUrl:r.payload.url??o.tunnelUrl,tunnelExposeDashboard:r.payload.exposeDashboard??o.tunnelExposeDashboard};case"SET_MCP":return{...o,mcpActive:r.payload.active??o.mcpActive,mcpUrl:r.payload.url??o.mcpUrl,mcpExpose:r.payload.exposeMcp??o.mcpExpose,mcpHasSecret:r.payload.hasSecret??o.mcpHasSecret};case"SET_TUNNEL_HAS_TOKEN":return{...o,tunnelHasToken:r.payload};case"SET_STATS":return{...o,stats:{...o.stats,...r.payload}};case"SET_WS_CONNECTED":return{...o,wsConnected:r.payload};case"SET_CONFIG_CHANGED":return{...o,configChanged:r.payload};case"SET_TWILIO_DEFAULTS":return{...o,twilioDefaults:r.payload};case"SET_QR_MESSAGE":return{...o,qrMessage:r.payload};case"SET_SMS_LISTEN":return{...o,smsListenMessage:r.payload};case"SET_CHANNEL_STATUS":{const{channel:y,connected:d,statusMessage:S}=r.payload,E=o.channels[y];return E?{...o,channels:{...o.channels,[y]:{...E,connected:d,statusMessage:S||null}}}:o}default:return o}}const lm=h.createContext(null),am=h.createContext(null);function Op({children:o}){const[r,y]=h.useReducer(zp,wp);return i.jsx(lm.Provider,{value:r,children:i.jsx(am.Provider,{value:y,children:o})})}function mt(){return h.useContext(lm)}function Dl(){return h.useContext(am)}const F=window.location.origin,$f=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`;function ri(){return localStorage.getItem("ck_token")||""}function Up(o){localStorage.setItem("ck_token",o)}function Mp(){localStorage.removeItem("ck_token")}function Dp(o={}){const r=ri();return{...o,...r?{Authorization:`Bearer ${r}`}:{}}}function te(o,r={}){const y=Dp(r.headers||{});return fetch(o,{...r,headers:y})}function Rp(o){const r=h.useRef(null),y=h.useRef(!1);h.useEffect(()=>{const d=setInterval(()=>{const S=r.current;if(S&&S.readyState===WebSocket.CLOSED)return;const E=ri(),w=(S==null?void 0:S._url)||(S==null?void 0:S.url)||"",M=E?`token=${encodeURIComponent(E)}`:"";S&&S.readyState===WebSocket.OPEN&&M&&!w.includes(M)&&S.close()},1e3);return()=>clearInterval(d)},[]),h.useEffect(()=>{y.current=!1;function d(){if(y.current)return;const S=ri(),E=S?`${$f}?token=${encodeURIComponent(S)}`:$f,w=new WebSocket(E);r.current=w,w.onopen=()=>{o({type:"SET_WS_CONNECTED",payload:!0})},w.onclose=M=>{o({type:"SET_WS_CONNECTED",payload:!1}),M.code===4401&&console.warn("[ws] Unauthorized — check API secret / token"),y.current||setTimeout(d,3e3)},w.onmessage=M=>{try{const b=JSON.parse(M.data);b.type==="newEntry"&&o({type:"ADD_ENTRY",payload:b.entry}),b.type==="serverLog"&&o({type:"ADD_SERVER_LOG",payload:b}),b.type==="tunnelStatus"&&o({type:"SET_TUNNEL",payload:{active:b.active,url:b.url||null,exposeDashboard:b.exposeDashboard}}),b.type==="mcpStatus"&&o({type:"SET_MCP",payload:{active:b.active,url:b.url||null,exposeMcp:b.exposeMcp,hasSecret:b.hasSecret}}),b.type==="configChanged"&&o({type:"SET_CONFIG_CHANGED",payload:!0}),b.type==="channelStatus"&&o({type:"SET_CHANNEL_STATUS",payload:{channel:b.channel,connected:b.connected,statusMessage:b.statusMessage}}),(b.type==="whatsapp-qr"||b.type==="whatsapp-paired"||b.type==="whatsapp-pair-error"||b.type==="gmail-auth-url"||b.type==="gmail-auth-success"||b.type==="gmail-auth-error")&&o({type:"SET_QR_MESSAGE",payload:b}),(b.type==="sms-listen"||b.type==="sms-listen-error"||b.type==="sms-listen-stopped")&&o({type:"SET_SMS_LISTEN",payload:b})}catch{}}}return d(),()=>{y.current=!0,r.current&&r.current.close()}},[o])}function kp(o){h.useEffect(()=>{function r(){te(F+"/api/logs/stats").then(d=>d.json()).then(d=>o({type:"SET_STATS",payload:d})).catch(()=>{})}r();const y=setInterval(r,3e4);return()=>clearInterval(y)},[o])}function Hp(){const{wsConnected:o,tunnelActive:r,tunnelUrl:y,mcpActive:d,mcpUrl:S}=mt(),E=Dl(),[w,M]=h.useState(!1),[b,x]=h.useState(!1),[k,v]=h.useState(null);h.useEffect(()=>{if(!k)return;const G=setTimeout(()=>v(null),5e3);return()=>clearTimeout(G)},[k]);async function j(){M(!0);try{if(r)await te(F+"/api/tunnel/stop",{method:"POST"}),E({type:"SET_TUNNEL",payload:{active:!1,url:null}});else{const G=await te(F+"/api/tunnel/start",{method:"POST"}),z=await G.json();G.ok?E({type:"SET_TUNNEL",payload:{active:!0,url:z.url}}):alert("Failed to start tunnel: "+(z.error||"Unknown error"))}}catch(G){alert("Tunnel error: "+G.message)}finally{M(!1)}}async function D(){x(!0);try{if(d)await te(F+"/api/mcp/stop",{method:"POST"}),E({type:"SET_MCP",payload:{active:!1,url:null}});else{const G=await te(F+"/api/mcp/start",{method:"POST"}),z=await G.json();G.ok?(E({type:"SET_MCP",payload:{active:!0,url:z.url}}),v(`MCP server is running on ${z.url}`)):alert("Failed to start MCP: "+(z.error||"Unknown error"))}}catch(G){alert("MCP error: "+G.message)}finally{x(!1)}}return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"flex items-center justify-between whitespace-nowrap border-b border-border bg-surface px-6 lg:px-10 py-3",children:[i.jsxs("div",{className:"flex items-center gap-8",children:[i.jsxs("div",{className:"flex items-center gap-3 text-primary",children:[i.jsx("div",{className:"size-8 flex items-center justify-center bg-primary/10 rounded-lg",children:i.jsx("span",{className:"material-symbols-outlined text-primary",children:"hub"})}),i.jsx("h2",{className:"text-text text-lg font-bold leading-tight tracking-tight",children:"ChannelKit"})]}),i.jsxs("div",{className:`hidden md:flex items-center gap-2 px-3 py-1 rounded-full border ${o?"bg-green-light text-green border-green/20":"bg-red-light text-red border-red/20"}`,children:[i.jsxs("span",{className:"relative flex h-2 w-2",children:[o&&i.jsx("span",{className:"animate-ping-dot absolute inline-flex h-full w-full rounded-full bg-green opacity-75"}),i.jsx("span",{className:`relative inline-flex rounded-full h-2 w-2 ${o?"bg-green":"bg-red"}`})]}),i.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",children:o?"Live":"Offline"})]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("label",{className:`hidden sm:flex items-center gap-2 px-4 h-9 rounded-lg text-sm font-medium cursor-pointer select-none transition-colors ${d?"bg-primary/10 text-primary border border-primary/30":"border border-border text-dim hover:text-primary hover:border-primary"} ${b?"opacity-50 cursor-not-allowed":""}`,children:[i.jsx("input",{type:"checkbox",checked:d,onChange:D,disabled:b,className:"accent-primary"}),i.jsx("span",{children:"MCP"})]}),i.jsxs("label",{className:`hidden sm:flex items-center gap-2 px-4 h-9 rounded-lg text-sm font-medium cursor-pointer select-none transition-colors ${r?"bg-primary/10 text-primary border border-primary/30":"border border-border text-dim hover:text-primary hover:border-primary"} ${w?"opacity-50 cursor-not-allowed":""}`,children:[i.jsx("input",{type:"checkbox",checked:r,onChange:j,disabled:w,className:"accent-primary"}),i.jsx("span",{children:"External"})]})]})]}),k&&i.jsxs("div",{className:"fixed bottom-6 right-6 z-50 flex items-center gap-3 px-4 py-3 bg-surface border border-primary/30 rounded-xl shadow-lg animate-slide-up",children:[i.jsx("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"check_circle"}),i.jsx("span",{className:"text-sm text-text",children:k}),i.jsx("button",{onClick:()=>v(null),className:"text-dim hover:text-text ml-2",children:i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]})}function nm(o){return new Date(o).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Bp(o){return new Date(o).toLocaleDateString("en-GB",{day:"2-digit",month:"short"})+" "+nm(o)}function Lp(o){if(!o||!isFinite(o))return"0s";const r=Math.floor(o/1e3);return r<60?r+"s":r<3600?Math.floor(r/60)+"m":r<86400?Math.floor(r/3600)+"h "+Math.floor(r%3600/60)+"m":Math.floor(r/86400)+"d "+Math.floor(r%86400/3600)+"h"}function Gp(o,r=60){return o?o.length>r?o.slice(0,r)+"…":o:"—"}function Yp(o){if(!o)return"—";try{return new URL(o).pathname}catch{return o}}function qp(o){return o?o.length>4?"••••"+o.slice(-4):"••••":""}function vt({icon:o,label:r,onClick:y,className:d="",danger:S,disabled:E,style:w}){const M=S?"text-red border-red/30 hover:bg-red-light":"text-primary border-primary/30 hover:bg-primary/5";return i.jsxs("span",{className:"tooltip-wrap inline-flex",children:[i.jsx("button",{onClick:y,disabled:E,className:`inline-flex items-center justify-center w-[28px] h-[28px] border rounded transition-colors ${M} ${E?"opacity-50 cursor-not-allowed":""} ${d}`,style:w,children:i.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"16px",lineHeight:1},children:o})}),i.jsx("span",{className:"tooltip-text",children:r})]})}const im={whatsapp:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#25D366",d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})}),telegram:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#26A5E4",d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),sms:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[i.jsx("path",{fill:"#6B7280",d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"}),i.jsx("path",{fill:"#6B7280",d:"M7 9h2v2H7zm4 0h2v2h-2zm4 0h2v2h-2z"})]}),voice:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#6B7280",d:"M20.01 15.38c-1.23 0-2.42-.2-3.53-.56a.977.977 0 0 0-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z"})}),email:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#6B7280",d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z"})}),endpoint:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#6B7280",d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})};function Qp(){const{stats:o}=mt(),r=[{label:"Messages",value:o.total>=1e3?(o.total/1e3).toFixed(1)+"k":o.total,icon:"mail",iconColor:"text-dim",change:o.total>0?"+12%":null,changeColor:"text-green bg-green-light"},{label:"Errors",value:o.errorCount||0,icon:"error",iconColor:"text-red",change:o.errorCount>0?`${o.errorCount}`:"0%",changeColor:o.errorCount>0?"text-red bg-red-light":"text-dim"},{label:"Latency",value:`${o.avgLatency||0}ms`,icon:"speed",iconColor:"text-orange",change:null,changeColor:""},{label:"Uptime",value:Lp(o.uptime),icon:"check_circle",iconColor:"text-green",change:"Stable",changeColor:"text-dim"}];return i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:r.map(y=>i.jsxs("div",{className:"bg-surface border border-border rounded-xl p-5 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("p",{className:"text-dim text-sm font-medium",children:y.label}),i.jsx("span",{className:`material-symbols-outlined ${y.iconColor}`,children:y.icon})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("p",{className:"text-text text-2xl font-bold tracking-tight",children:y.value}),y.change&&i.jsx("p",{className:`text-xs font-semibold ${y.changeColor} px-1.5 py-0.5 rounded`,children:y.change})]})]},y.label))})}const Ff=[{id:"http",label:"Streamable HTTP",desc:"Modern clients (Claude Code, Cursor, Windsurf)"},{id:"sse",label:"SSE",desc:"Legacy clients (Antigravity, older SDKs)"},{id:"stdio",label:"stdio",desc:"Claude Desktop, Cursor (via mcp-remote bridge)"}];function Xp(o){return o&&o.startsWith("http://")}function Vp(o,r,y){if(o==="stdio"){const S=["-y","mcp-remote",r];return Xp(r)&&S.push("--allow-http"),y&&S.push("--header",`Authorization:Bearer ${y}`),{mcpServers:{channelkit:{command:"npx",args:S}}}}const d={url:r};return y&&(d.headers={Authorization:`Bearer ${y}`}),{mcpServers:{channelkit:d}}}function Zp({onClose:o}){var G;const[r,y]=h.useState("http"),[d,S]=h.useState(!1),[E,w]=h.useState(null),[M,b]=h.useState(!1);if(h.useEffect(()=>{te(F+"/api/mcp/connection-info").then(z=>z.json()).then(z=>{w(z),z.publicUrl&&S(!0)}).catch(()=>{})},[]),!E)return null;const x=!!E.publicUrl,k=r==="sse"?d&&x?E.publicSseUrl:E.localSseUrl:d&&x?E.publicUrl:E.localUrl,v=Vp(r,k,E.secret),j=JSON.stringify(v,null,2);function D(){navigator.clipboard.writeText(j).then(()=>{b(!0),setTimeout(()=>b(!1),1500)})}return i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",onClick:z=>{z.target===z.currentTarget&&o()},children:i.jsxs("div",{className:"bg-surface rounded-xl p-7 max-w-xl w-[90%] shadow-2xl relative",role:"dialog","aria-modal":"true","aria-label":"MCP Connection Config",children:[i.jsx("button",{className:"absolute top-4 right-4 text-dim hover:text-text bg-transparent border-none cursor-pointer",onClick:o,title:"Close",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})}),i.jsxs("h2",{className:"text-base font-semibold text-text flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"material-symbols-outlined text-primary",children:"integration_instructions"}),"Connect to MCP"]}),i.jsx("p",{className:"text-xs text-dim mb-5",children:"Copy the config below into your AI agent's MCP settings."}),i.jsx("div",{className:"flex gap-2 mb-4",children:Ff.map(z=>i.jsx("button",{onClick:()=>y(z.id),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium border transition-colors cursor-pointer ${r===z.id?"bg-primary/10 text-primary border-primary/30":"border-border text-dim hover:text-text hover:border-primary/30"}`,title:z.desc,children:z.label},z.id))}),i.jsx("p",{className:"text-xs text-dim mb-3",children:(G=Ff.find(z=>z.id===r))==null?void 0:G.desc}),x&&i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-xs text-dim cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:d,onChange:z=>S(z.target.checked),className:"accent-primary"}),"Use public URL"]}),d&&i.jsx("span",{className:"text-[10px] text-primary bg-primary/10 px-2 py-0.5 rounded-full font-medium",children:"via tunnel"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("pre",{className:"bg-bg-light border border-border rounded-lg p-4 text-xs font-mono text-text overflow-x-auto max-h-64 overflow-y-auto leading-relaxed",children:j}),i.jsxs("button",{onClick:D,className:"absolute top-2 right-2 flex items-center gap-1 px-2 py-1 rounded-md text-[11px] font-medium bg-surface border border-border text-dim hover:text-text hover:bg-bg-light transition-colors cursor-pointer",children:[i.jsx("span",{className:"material-symbols-outlined text-[14px]",children:M?"check":"content_copy"}),M?"Copied":"Copy"]})]}),i.jsxs("div",{className:"mt-4 space-y-2",children:[!E.secret&&i.jsxs("div",{className:"flex items-start gap-2 text-xs text-orange",children:[i.jsx("span",{className:"material-symbols-outlined text-[14px] mt-0.5",children:"info"}),i.jsxs("span",{children:["No MCP secret configured. ",i.jsx("a",{href:"#settings",onClick:o,className:"text-primary underline",children:"Add one in Settings"})," to secure access."]})]}),r==="stdio"&&i.jsxs("div",{className:"flex items-start gap-2 text-xs text-dim",children:[i.jsx("span",{className:"material-symbols-outlined text-[14px] mt-0.5",children:"info"}),i.jsxs("span",{children:["Requires ",i.jsx("code",{className:"bg-bg-light px-1 py-0.5 rounded text-[11px]",children:"mcp-remote"})," package (auto-installed via npx)."]})]})]})]})})}function Kp(){const{tunnelActive:o,tunnelUrl:r,tunnelHasToken:y,hasSmsWebhookChannels:d,tunnelExposeDashboard:S,mcpActive:E,mcpExpose:w,mcpHasSecret:M,mcpUrl:b}=mt(),x=Dl(),[k,v]=h.useState(null),[j,D]=h.useState(!1),[G,z]=h.useState(!1),[de,ie]=h.useState(!1),[ae,ee]=h.useState(""),[W,Y]=h.useState(""),[Q,Z]=h.useState(!1),oe=o&&r;if(!oe&&!E)return null;const $=oe?r+"/dashboard":"",ze=oe?r+"/mcp":"",ye=oe&&w?ze:b;function pe(V,ne){navigator.clipboard.writeText(V).then(()=>{v(ne),setTimeout(()=>v(null),1500)})}async function Ae(){try{const V=await te(F+"/api/tunnel/update-webhooks",{method:"POST"}),ne=await V.json();if(!V.ok){alert("Failed: "+(ne.error||V.status));return}const m=[];ne.updated.length>0&&m.push("Updated: "+ne.updated.join(", ")),ne.errors.length>0&&m.push("Errors: "+ne.errors.map(U=>U.name+" — "+U.error).join("; ")),ne.updated.length===0&&ne.errors.length===0&&m.push("No SMS channels in webhook mode found."),alert(m.join(`
|
|
50
|
+
`))}catch(V){alert("Failed: "+V.message)}}function K(){D(!0),te(F+"/api/tunnel/config").then(V=>V.json()).then(V=>{V.token&&ee(V.token),V.public_url&&Y(V.public_url.replace(/^https?:\/\//,"")),Z(!!V.token)}).catch(()=>{})}async function fe(){const V=ae.trim();let ne=W.trim();if(!V||!ne){alert("Both tunnel token and public hostname are required.");return}ne.startsWith("http")||(ne="https://"+ne);const m=await te(F+"/api/tunnel/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:V,public_url:ne})});if(!m.ok){const U=await m.json();alert(U.error||"Failed to save");return}x({type:"SET_TUNNEL_HAS_TOKEN",payload:!0}),D(!1),o?(await te(F+"/api/tunnel/stop",{method:"POST"}),x({type:"SET_TUNNEL",payload:{active:!1,url:null}}),alert("Token saved. Click Externalize again to connect with your stable URL.")):alert("Token saved. Click Externalize to connect with your stable URL.")}async function _(){confirm("Remove the tunnel token? The next Externalize will use a random URL.")&&(await te(F+"/api/tunnel/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:null,public_url:null})}),x({type:"SET_TUNNEL_HAS_TOKEN",payload:!1}),ee(""),Y(""),D(!1))}async function L(V){await te(F+"/api/tunnel/expose-dashboard",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:V})}),x({type:"SET_TUNNEL",payload:{exposeDashboard:V}})}async function I(V){await te(F+"/api/mcp/expose",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:V})}),x({type:"SET_MCP",payload:{exposeMcp:V}})}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"rounded-xl border border-border bg-surface shadow-sm divide-y divide-border",children:[oe&&i.jsxs("div",{className:"flex items-center gap-4 px-5 h-14",children:[i.jsx("span",{className:"text-dim text-sm font-medium w-28 shrink-0",children:"Public URL"}),i.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full uppercase shrink-0 ${y?"bg-primary/10 text-primary":"bg-orange-light text-orange"}`,children:y?"Stable":"Temporary"}),i.jsx("span",{className:"text-text text-sm font-mono truncate flex-1 min-w-0",children:r}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsx("button",{onClick:()=>pe(r,"url"),className:"flex items-center justify-center rounded-lg h-8 w-8 bg-bg-light text-dim border border-border hover:bg-border transition-colors",title:"Copy URL",children:i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:k==="url"?"check":"content_copy"})}),i.jsx("a",{href:r,target:"_blank",rel:"noreferrer",className:"flex items-center justify-center rounded-lg h-8 w-8 bg-bg-light text-dim border border-border hover:bg-border transition-colors",title:"Open URL",children:i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"open_in_new"})})]})]}),oe&&i.jsxs("div",{className:"flex items-center gap-4 px-5 h-14",children:[i.jsx("span",{className:"text-dim text-sm font-medium w-28 shrink-0",children:"Dashboard"}),i.jsx("input",{type:"checkbox",className:"toggle-switch-sm shrink-0",checked:S,onChange:V=>L(V.target.checked)}),S?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-text text-sm font-mono truncate flex-1 min-w-0",children:$}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsx("button",{onClick:()=>pe($,"dashboard"),className:"flex items-center justify-center rounded-lg h-8 w-8 bg-bg-light text-dim border border-border hover:bg-border transition-colors",title:"Copy dashboard URL",children:i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:k==="dashboard"?"check":"content_copy"})}),i.jsx("a",{href:$,target:"_blank",rel:"noreferrer",className:"flex items-center justify-center rounded-lg h-8 w-8 bg-bg-light text-dim border border-border hover:bg-border transition-colors",title:"Open dashboard",children:i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"open_in_new"})})]})]}):i.jsx("span",{className:"text-dim/50 text-sm italic flex-1",children:"Disabled"})]}),E&&i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex items-center gap-4 px-5 h-14",children:[i.jsx("span",{className:"text-dim text-sm font-medium w-28 shrink-0",children:"MCP"}),oe?i.jsx("input",{type:"checkbox",className:"toggle-switch-sm shrink-0",checked:w,onChange:V=>I(V.target.checked),style:{width:36,height:20}}):i.jsx("span",{className:"w-[36px] shrink-0"}),i.jsx("span",{className:"text-text text-sm font-mono truncate flex-1 min-w-0",children:ye}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsx("button",{onClick:()=>pe(ye,"mcp"),className:"flex items-center justify-center rounded-lg h-8 w-8 bg-bg-light text-dim border border-border hover:bg-border transition-colors",title:"Copy MCP URL",children:i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:k==="mcp"?"check":"content_copy"})}),i.jsx("button",{onClick:()=>ie(!0),className:"flex items-center justify-center rounded-lg h-8 w-8 bg-bg-light text-dim border border-border hover:bg-border transition-colors",title:"Connection config",children:i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"integration_instructions"})})]})]}),!M&&i.jsxs("div",{className:"flex items-center gap-2 px-5 pb-3 text-xs text-orange",children:[i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"warning"}),i.jsxs("span",{children:["MCP is accessible without authentication. ",i.jsx("a",{href:"#settings",className:"text-primary underline",children:"Add a secret"})," in Settings to secure it."]})]})]})]}),oe&&(!y||!y&&d)&&i.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-xs text-dim mt-2",children:[!y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"material-symbols-outlined text-[16px] text-yellow",children:"warning"}),i.jsx("span",{children:"URL changes each restart."}),i.jsx("button",{onClick:K,className:"text-primary underline cursor-pointer bg-transparent border-none text-xs",children:"Set up stable URL"}),i.jsx("button",{onClick:()=>z(!0),className:"text-dim hover:text-text bg-transparent border-none cursor-pointer p-0",children:i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"help"})})]}),!y&&d&&i.jsxs("button",{onClick:Ae,className:"flex items-center gap-1 text-xs text-dim border border-border rounded-lg px-2 py-1 hover:bg-bg-light transition-colors bg-transparent cursor-pointer",children:[i.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"sync"}),"Update SMS endpoints"]})]}),j&&i.jsxs("div",{className:"bg-surface border border-border rounded-xl p-5 shadow-sm space-y-3 mt-3",children:[i.jsxs("p",{className:"text-sm text-dim",children:["For a stable URL, create a free"," ",i.jsx("a",{href:"https://one.dash.cloudflare.com",target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"Cloudflare Tunnel"}),", then paste the token and hostname below:"]}),i.jsxs("div",{className:"flex gap-3 flex-wrap",children:[i.jsx("input",{value:ae,onChange:V=>ee(V.target.value),placeholder:"Tunnel token (eyJh...)",className:"flex-[2] min-w-[200px] px-3 py-2 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary"}),i.jsx("input",{value:W,onChange:V=>Y(V.target.value),placeholder:"Public hostname (e.g. channelkit.example.com)",className:"flex-1 min-w-[180px] px-3 py-2 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:fe,className:"px-4 py-2 rounded-lg text-sm font-semibold bg-primary text-white hover:bg-primary-hover transition-colors",children:"Save"}),i.jsx("button",{onClick:()=>D(!1),className:"px-4 py-2 rounded-lg text-sm font-medium border border-border text-dim hover:bg-bg-light transition-colors",children:"Cancel"}),Q&&i.jsx("button",{onClick:_,className:"px-4 py-2 rounded-lg text-sm font-medium text-red border border-border hover:bg-red-light transition-colors",children:"Clear token"})]})]}),de&&i.jsx(Zp,{onClose:()=>ie(!1)}),G&&i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",onClick:V=>{V.target===V.currentTarget&&z(!1)},children:i.jsxs("div",{className:"bg-surface rounded-xl p-7 max-w-lg w-[90%] shadow-2xl relative",role:"dialog","aria-modal":"true","aria-label":"How to get a stable URL",children:[i.jsx("button",{className:"absolute top-4 right-4 text-dim hover:text-text bg-transparent border-none cursor-pointer",onClick:()=>z(!1),title:"Close",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})}),i.jsxs("h2",{className:"text-base font-semibold text-text flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"material-symbols-outlined text-primary",children:"lock"}),"Get a Stable Public URL"]}),i.jsx("p",{className:"text-sm text-dim mb-5",children:"Use a free Cloudflare Tunnel to keep the same URL across restarts."}),i.jsx("div",{className:"flex flex-col gap-4",children:[["Create a Cloudflare account",i.jsxs(i.Fragment,{children:["Go to ",i.jsx("a",{href:"https://one.dash.cloudflare.com",target:"_blank",rel:"noreferrer",className:"text-primary",children:"one.dash.cloudflare.com"})," and sign up for free."]})],["Add your domain to Cloudflare",i.jsxs(i.Fragment,{children:["Click ",i.jsx("strong",{children:"Add a site"}),", choose ",i.jsx("strong",{children:"Free"})," plan, update nameservers at your registrar."]})],["Create a tunnel",i.jsxs(i.Fragment,{children:["Go to ",i.jsx("strong",{children:"Zero Trust → Networks → Connectors"}),", click ",i.jsx("strong",{children:"Create a tunnel"}),", choose ",i.jsx("code",{className:"bg-bg-light px-1 py-0.5 rounded text-xs font-mono",children:"Cloudflared"}),"."]})],["Copy the tunnel token",i.jsxs(i.Fragment,{children:["Copy the long token after ",i.jsx("code",{className:"bg-bg-light px-1 py-0.5 rounded text-xs font-mono",children:"--token"})," (starts with ",i.jsx("code",{className:"bg-bg-light px-1 py-0.5 rounded text-xs font-mono",children:"eyJh…"}),")."]})],["Add a public hostname",i.jsxs(i.Fragment,{children:["Point it to ",i.jsx("code",{className:"bg-bg-light px-1 py-0.5 rounded text-xs font-mono",children:"localhost:4000"})," with HTTP service type."]})],["Paste token & hostname here",i.jsxs(i.Fragment,{children:["Click ",i.jsx("strong",{children:"Set up stable URL"}),", paste, save, then ",i.jsx("strong",{children:"Externalize"}),"."]})]].map(([V,ne],m)=>i.jsxs("div",{className:"flex gap-3 items-start",children:[i.jsx("div",{className:"min-w-6 h-6 rounded-full bg-primary text-white text-xs font-bold flex items-center justify-center mt-0.5",children:m+1}),i.jsxs("div",{className:"text-sm leading-relaxed",children:[i.jsx("strong",{className:"text-text",children:V}),i.jsx("br",{}),ne]})]},m))}),i.jsx("p",{className:"mt-5 text-xs text-dim",children:"The tunnel stays active as long as ChannelKit is running."})]})})]})}function Jp(){const{configChanged:o}=mt(),[r,y]=h.useState(""),[d,S]=h.useState(!1);if(!o)return null;async function E(){if(!confirm(`Restart ChannelKit now?
|
|
51
|
+
|
|
52
|
+
The process will restart and the dashboard will reload automatically.`))return;S(!0),y("");try{await te(F+"/api/restart",{method:"POST"})}catch{}y("Waiting for server…");let w=0;const M=setInterval(async()=>{if(w++,w>30){clearInterval(M),y("Restart timed out — reload manually");return}try{(await te(F+"/api/health")).ok&&(clearInterval(M),location.reload())}catch{}},1e3)}return i.jsxs("div",{className:"bg-yellow-light border border-yellow/20 text-yellow rounded-xl p-4 flex items-center gap-3 text-sm font-medium",children:[i.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"warning"}),i.jsx("span",{className:"flex-1",children:"Config changed — restart ChannelKit to apply changes"}),i.jsx("button",{onClick:E,disabled:d,className:"px-4 py-1.5 bg-yellow text-white rounded-lg text-xs font-bold hover:opacity-90 transition-opacity disabled:opacity-50",children:d?"Restarting…":"Restart Now"}),r&&i.jsx("span",{className:"text-xs",children:r})]})}function Wp(){const[o,r]=h.useState(null);h.useEffect(()=>{y();const S=setInterval(y,1800*1e3);return()=>clearInterval(S)},[]);async function y(){try{const E=await(await te(F+"/api/update/status")).json();E.updateAvailable?r(E):r(null)}catch{}}if(!o)return null;const d=o.mode==="npm"?"npm update -g channelkit":"git pull && npm run build";return i.jsxs("div",{className:"bg-primary/10 border border-primary/30 rounded-xl px-5 py-3 flex items-center justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-lg",children:"🆕"}),i.jsxs("div",{children:[i.jsxs("span",{className:"text-sm font-semibold text-text",children:["Update available: ",o.currentVersion," → ",o.latestVersion]}),i.jsxs("p",{className:"text-xs text-dim mt-0.5",children:["Auto-update is off. Run: ",i.jsx("code",{className:"bg-surface px-1.5 py-0.5 rounded text-[11px] font-mono",children:d})]})]})]}),i.jsx("button",{onClick:()=>r(null),className:"text-dim hover:text-text text-lg bg-transparent border-none cursor-pointer",children:"✕"})]})}function $p({tabs:o,active:r}){return i.jsx("div",{className:"border-b border-border",children:i.jsx("div",{className:"flex gap-8",children:o.map(y=>i.jsxs("a",{href:y.hash,className:`flex items-center gap-2 border-b-2 pb-3 px-1 transition-all text-sm ${r===y.hash?"border-primary text-text font-bold":"border-transparent text-dim hover:text-text font-medium"}`,onClick:d=>{d.preventDefault(),window.location.hash=y.hash},children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:y.icon}),i.jsx("span",{children:y.label})]},y.hash))})})}const ui=25;function Fp({status:o}){return o==="success"?i.jsxs("div",{className:"flex items-center gap-1.5 text-green",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),i.jsx("span",{className:"text-xs font-bold",children:"200 OK"})]}):o==="error"?i.jsxs("div",{className:"flex items-center gap-1.5 text-red",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),i.jsx("span",{className:"text-xs font-bold",children:"Error"})]}):o==="format-error"?i.jsxs("div",{className:"flex items-center gap-1.5 text-red",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"format_color_reset"}),i.jsx("span",{className:"text-xs font-bold",children:"Format Error"})]}):o==="blocked"?i.jsxs("div",{className:"flex items-center gap-1.5 text-yellow",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"block"}),i.jsx("span",{className:"text-xs font-bold",children:"Blocked"})]}):i.jsxs("div",{className:"flex items-center gap-1.5 text-orange",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"pending"}),i.jsx("span",{className:"text-xs font-bold",children:"Processing"})]})}function Ip(o){const r=o.replace(/@.*$/,"").replace(/[^0-9]/g,"");return r?"+"+r:o}function Pp({entry:o,onToast:r}){const[y,d]=h.useState(null),[S,E]=h.useState(!1),{channels:w,services:M}=mt(),b=Ip(o.from),x=Object.keys(w).find(D=>D===o.channel||w[D].type===o.channel),k=x?Object.entries(M).filter(([,D])=>D.channel===x):[];async function v(){if(x){d("channel");try{const G=[...w[x].allow_list||[],b];await te(F+"/api/config/channels/"+encodeURIComponent(x),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({allow_list:G})}),E(!0),r==null||r(`${b} added to ${x} allow list. Restart to apply changes.`)}catch{}d(null)}}async function j(D){const G=M[D];d(D);try{const z=[...G.allow_list||[],b];await te(F+"/api/config/services/"+encodeURIComponent(D),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhook:G.webhook,allow_list:z})}),E(!0),r==null||r(`${b} added to ${D} allow list. Restart to apply changes.`)}catch{}d(null)}return x?S?i.jsxs("div",{className:"flex items-center gap-2 text-green text-sm",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),i.jsxs("span",{className:"font-medium",children:[b," added to allow list"]})]}):i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm text-dim",children:"This number is not in the allow list. Add it to allow future messages:"}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs("button",{onClick:D=>{D.stopPropagation(),v()},disabled:!!y,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg border border-primary text-primary hover:bg-primary hover:text-white transition-colors disabled:opacity-50",children:[i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:y==="channel"?"hourglass_empty":"person_add"}),"Add to ",x," channel"]}),k.map(([D])=>i.jsxs("button",{onClick:G=>{G.stopPropagation(),j(D)},disabled:!!y,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg border border-border text-dim hover:border-primary hover:text-primary transition-colors disabled:opacity-50",children:[i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:y===D?"hourglass_empty":"person_add"}),"Add to ",D," service"]},D))]})]}):null}function ex({entry:o,isNew:r,onToast:y}){const[d,S]=h.useState(!1),E=im[o.channel]||null,w=o.type==="async-outbound"?i.jsx("span",{className:"text-primary text-[11px] font-semibold",children:"ASYNC ↗"}):null,M=(o.senderName||o.from||"?").charAt(0).toUpperCase();return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{className:`hover:bg-bg-light transition-colors cursor-pointer ${r?"animate-fade-in-row":""}`,onClick:()=>S(!d),children:[i.jsx("td",{className:"px-4 py-4 text-xs font-medium text-dim",children:nm(o.timestamp)}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"size-6 rounded-full bg-bg-light flex items-center justify-center text-[11px] font-semibold text-dim shrink-0",children:E?i.jsx("span",{className:"w-4 h-4",children:E}):M}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"text-sm font-semibold text-text",children:o.senderName||o.from||"Unknown"}),o.senderName&&o.from&&i.jsx("span",{className:"text-[11px] text-dim ml-1 font-mono",children:o.from})]})]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsxs("p",{className:"text-sm text-dim line-clamp-1",children:[w," ",Gp(o.text,80)]})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-bg-light text-dim border border-border",children:Yp(o.route)||"—"})}),i.jsx("td",{className:"px-4 py-4",children:i.jsx(Fp,{status:o.status})}),i.jsx("td",{className:"px-4 py-4 text-xs font-bold text-dim",children:o.latency!=null?o.latency+"ms":"—"})]}),d&&i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-4 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"ID"}),i.jsx("p",{className:"text-sm font-mono",children:o.id})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Timestamp"}),i.jsx("p",{className:"text-sm",children:Bp(o.timestamp)})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Channel"}),i.jsx("p",{className:"text-sm",children:o.channel})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"From"}),i.jsxs("p",{className:"text-sm",children:[o.senderName||""," (",o.from,")"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Type"}),i.jsx("p",{className:"text-sm",children:o.type})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Group"}),i.jsx("p",{className:"text-sm",children:o.groupName||o.groupId||"—"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Webhook"}),i.jsx("p",{className:"text-sm font-mono break-all",children:o.route||"—"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Status"}),i.jsx("p",{className:"text-sm",children:o.status})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-0.5",children:"Latency"}),i.jsx("p",{className:"text-sm",children:o.latency!=null?o.latency+"ms":"—"})]})]}),o.formatApplied&&o.formatOriginalText&&i.jsxs("div",{children:[i.jsxs("label",{className:"text-[11px] text-dim uppercase block mb-1",children:["Original Message ",i.jsx("span",{className:"text-primary font-normal normal-case",children:"(before formatting)"})]}),i.jsx("div",{className:"bg-surface border border-border rounded-lg p-3 text-sm whitespace-pre-wrap",children:o.formatOriginalText})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-1",children:o.formatApplied?i.jsxs(i.Fragment,{children:["Formatted Message ",i.jsx("span",{className:"inline-flex items-center ml-1.5 px-1.5 py-0.5 rounded text-[10px] font-bold bg-primary/10 text-primary border border-primary/20",children:"AI Formatted"})]}):"Full Message"}),i.jsx("div",{className:"bg-surface border border-border rounded-lg p-3 text-sm whitespace-pre-wrap",children:o.text||"—"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[11px] text-dim uppercase block mb-1",children:"Response"}),i.jsx("div",{className:"bg-surface border border-border rounded-lg p-3 text-sm whitespace-pre-wrap",children:o.responseText||"—"})]}),o.status==="blocked"&&i.jsx(Pp,{entry:o,onToast:y})]})})})]})}function tx({onSend:o}){const{entries:r}=mt(),y=Dl(),[d,S]=h.useState(""),[E,w]=h.useState(""),[M,b]=h.useState(1),x=h.useRef(null),[k,v]=h.useState(""),[j,D]=h.useState(null),G=h.useRef(null),z=h.useCallback(Y=>{D(Y),clearTimeout(G.current),G.current=setTimeout(()=>D(null),6e3)},[]);h.useEffect(()=>{te(F+"/api/logs").then(Y=>Y.json()).then(Y=>y({type:"SET_ENTRIES",payload:Y})).catch(()=>{})},[y]);const de=h.useCallback(Y=>{w(Y),b(1),clearTimeout(x.current),x.current=setTimeout(()=>v(Y),200)},[]);async function ie(){confirm("Clear all message logs? This cannot be undone.")&&(await te(F+"/api/logs",{method:"DELETE"}),y({type:"SET_ENTRIES",payload:[]}))}const ae=r.filter(Y=>{if(d&&Y.channel!==d)return!1;if(k){const Q=k.toLowerCase();return(Y.text||"").toLowerCase().includes(Q)||(Y.from||"").toLowerCase().includes(Q)||(Y.senderName||"").toLowerCase().includes(Q)||(Y.responseText||"").toLowerCase().includes(Q)}return!0}),ee=Math.ceil(ae.length/ui),W=ae.slice((M-1)*ui,M*ui);return i.jsxs("div",{className:"bg-surface border border-border rounded-xl shadow-sm overflow-hidden",children:[i.jsxs("div",{className:"p-4 border-b border-border flex flex-col sm:flex-row gap-4 justify-between items-center",children:[i.jsxs("div",{className:"flex gap-3 items-center w-full sm:w-auto",children:[i.jsxs("div",{className:"relative flex-1 sm:max-w-xs",children:[i.jsx("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-dim text-[18px]",children:"filter_list"}),i.jsx("input",{className:"w-full pl-10 pr-4 py-2 bg-bg-light border border-border rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary transition-all text-text placeholder:text-dim",placeholder:"Filter messages...",type:"text",value:E,onChange:Y=>de(Y.target.value)})]}),i.jsxs("select",{value:d,onChange:Y=>{S(Y.target.value),b(1)},className:"py-2 px-3 bg-bg-light border border-border rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-primary text-text",children:[i.jsx("option",{value:"",children:"All Channels"}),i.jsx("option",{value:"whatsapp",children:"WhatsApp"}),i.jsx("option",{value:"telegram",children:"Telegram"}),i.jsx("option",{value:"sms",children:"SMS"}),i.jsx("option",{value:"voice",children:"Voice"}),i.jsx("option",{value:"email",children:"Email"})]}),i.jsxs("button",{onClick:ie,className:"hidden sm:flex items-center gap-1 px-3 py-2 text-xs font-medium text-dim border border-border rounded-lg hover:bg-bg-light transition-colors",children:[i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"delete_sweep"}),"Clear"]})]}),i.jsxs("button",{onClick:o,className:"w-full sm:w-auto flex items-center justify-center gap-2 rounded-lg h-9 px-4 bg-primary text-white text-sm font-bold hover:bg-primary-hover transition-all",children:[i.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"send"}),i.jsx("span",{children:"Send Message"})]})]}),i.jsxs("div",{children:[i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-bg-light border-b border-border",children:[i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Time"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"From"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Message"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Webhook"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Status"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Latency"})]})}),i.jsx("tbody",{className:"divide-y divide-border/50",children:W.map((Y,Q)=>{var Z;return i.jsx(ex,{entry:Y,isNew:Q===0&&M===1&&((Z=r[0])==null?void 0:Z.id)===Y.id,onToast:z},Y.id||Q)})})]}),ae.length===0&&i.jsxs("div",{className:"text-center py-16 text-dim",children:[i.jsx("span",{className:"material-symbols-outlined text-5xl mb-3 block opacity-30",children:"mail"}),i.jsx("p",{className:"text-sm",children:"No messages yet. Waiting for traffic..."})]})]}),ae.length>0&&i.jsxs("div",{className:"px-4 py-4 bg-bg-light border-t border-border flex items-center justify-between",children:[i.jsxs("p",{className:"text-xs text-dim",children:["Showing ",Math.min((M-1)*ui+1,ae.length),"–",Math.min(M*ui,ae.length)," of ",ae.length.toLocaleString()," messages"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>b(Y=>Math.max(1,Y-1)),disabled:M<=1,className:"px-3 py-1 rounded border border-border text-xs font-medium text-dim hover:bg-surface transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),i.jsx("button",{onClick:()=>b(Y=>Math.min(ee,Y+1)),disabled:M>=ee,className:"px-3 py-1 rounded border border-border text-xs font-medium text-dim hover:bg-surface transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),j&&i.jsxs("div",{className:"fixed bottom-6 right-6 z-50 flex items-center gap-3 px-4 py-3 bg-surface border border-yellow/40 rounded-xl shadow-lg animate-slide-up",children:[i.jsx("span",{className:"material-symbols-outlined text-yellow text-[20px]",children:"restart_alt"}),i.jsx("span",{className:"text-sm text-text",children:j}),i.jsx("button",{onClick:async()=>{if(!confirm(`Restart ChannelKit now?
|
|
53
|
+
|
|
54
|
+
The process will restart and the dashboard will reload automatically.`))return;D("Restarting…");try{await te(F+"/api/restart",{method:"POST"})}catch{}let Y=0;const Q=setInterval(async()=>{if(Y++,Y>30){clearInterval(Q),D("Restart timed out — reload manually");return}try{(await te(F+"/api/health")).ok&&(clearInterval(Q),location.reload())}catch{}},1e3)},className:"px-3 py-1 bg-yellow text-white rounded-lg text-xs font-bold hover:opacity-90 transition-opacity whitespace-nowrap",children:"Restart Now"}),i.jsx("button",{onClick:()=>D(null),className:"text-dim hover:text-text",children:i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]})}const Ge="w-full py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",di="py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary",lx={openai:["gpt-4.1-nano","gpt-4.1-mini","gpt-4.1","gpt-4o","gpt-4o-mini","o3-mini","o4-mini"],anthropic:["claude-sonnet-4-20250514","claude-haiku-4-20250514","claude-opus-4-20250514"],google:["gemini-2.5-flash","gemini-3-flash","gemini-3.1-pro","gemini-2.0-flash-lite"]};function ax({value:o,onChange:r,provider:y}){const[d,S]=h.useState(!1),[E,w]=h.useState(-1),M=h.useRef(null),b=h.useRef(null),x=(lx[y]||[]).filter(v=>!o||v.toLowerCase().includes(o.toLowerCase()));h.useEffect(()=>{w(-1)},[o,y]),h.useEffect(()=>{function v(j){M.current&&!M.current.contains(j.target)&&S(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]),h.useEffect(()=>{if(E>=0&&b.current){const v=b.current.children[E];v&&v.scrollIntoView({block:"nearest"})}},[E]);function k(v){!d||x.length===0||(v.key==="ArrowDown"?(v.preventDefault(),w(j=>(j+1)%x.length)):v.key==="ArrowUp"?(v.preventDefault(),w(j=>(j-1+x.length)%x.length)):v.key==="Enter"&&E>=0?(v.preventDefault(),r(x[E]),S(!1)):v.key==="Escape"&&S(!1))}return i.jsxs("div",{ref:M,className:"relative",children:[i.jsx("input",{value:o,onChange:v=>{r(v.target.value),S(!0)},onFocus:()=>S(!0),onKeyDown:k,placeholder:"Model (optional, e.g. gpt-4o-mini)",className:Ge}),d&&x.length>0&&i.jsx("ul",{ref:b,className:"absolute z-10 left-0 right-0 mt-1 max-h-48 overflow-y-auto bg-surface border border-border rounded-lg shadow-lg py-1",children:x.map((v,j)=>i.jsx("li",{onMouseDown:()=>{r(v),S(!1)},onMouseEnter:()=>w(j),className:`px-3 py-1.5 text-sm cursor-pointer ${j===E?"bg-primary/10 text-primary":"text-text hover:bg-bg-light"}`,children:v},v))})]})}const nx={google:{label:"Google",key:"google_api_key"},whisper:{label:"Whisper (OpenAI)",key:"openai_api_key"},deepgram:{label:"Deepgram",key:"deepgram_api_key"}},ix={google:{label:"Google",key:"google_api_key"},elevenlabs:{label:"ElevenLabs",key:"elevenlabs_api_key"},openai:{label:"OpenAI",key:"openai_api_key"}},sx={openai:{label:"OpenAI",key:"openai_api_key"},anthropic:{label:"Anthropic (Claude)",key:"anthropic_api_key"},google:{label:"Google (Gemini)",key:"google_api_key"}};function Vu({map:o,value:r,onChange:y,settings:d}){return i.jsxs("select",{value:r,onChange:S=>y(S.target.value),className:di+" flex-1",children:[i.jsx("option",{value:"",children:"None"}),Object.entries(o).map(([S,E])=>{const w=!!d[E.key];return i.jsxs("option",{value:S,disabled:!w,children:[E.label,w?"":" (no API key)"]},S)})]})}function cx({name:o,svc:r,settings:y,onClose:d,loadConfig:S}){const E=r.stt||{},w=r.tts||{},[M,b]=h.useState(E.provider||""),[x,k]=h.useState(E.language||""),[v,j]=h.useState(!!E.forward_audio),[D,G]=h.useState(w.provider||""),[z,de]=h.useState(w.language||""),[ie,ae]=h.useState(w.voice||""),[ee,W]=h.useState("");async function Y(){const Q=M?{provider:M,...x&&{language:x},...v&&{forward_audio:!0}}:null,Z=D?{provider:D,...z&&{language:z},...ie&&{voice:ie}}:null;try{const oe=await te(F+"/api/config/services/"+encodeURIComponent(o),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhook:r.webhook,method:r.method||"POST",auth:r.auth||null,code:r.code||null,command:r.command||null,stt:Q,tts:Z,voice:r.voice||null,format:r.format||null})});if(!oe.ok)throw new Error((await oe.json().catch(()=>({}))).error||"Save failed");W("Saved"),setTimeout(()=>{d(),S()},600)}catch(oe){W(oe.message)}}return i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-6 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-4",children:[i.jsxs("div",{className:"text-sm font-semibold text-text",children:["Audio Settings — ",o]}),i.jsxs("div",{className:"flex gap-6 flex-wrap",children:[i.jsxs("div",{className:"flex-1 min-w-[220px] space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Speech-to-Text (incoming audio)"}),i.jsx(Vu,{map:nx,value:M,onChange:b,settings:y}),M&&i.jsx("input",{value:x,onChange:Q=>k(Q.target.value),placeholder:"Language (e.g. en-US, he-IL)",className:Ge}),M&&i.jsxs("label",{className:"flex items-center gap-2 text-xs text-dim cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:v,onChange:Q=>j(Q.target.checked)}),"Forward original audio to webhook"]})]}),i.jsxs("div",{className:"flex-1 min-w-[220px] space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Text-to-Speech (outgoing audio)"}),i.jsx(Vu,{map:ix,value:D,onChange:G,settings:y}),D&&i.jsx("input",{value:z,onChange:Q=>de(Q.target.value),placeholder:"Language (e.g. en-US, he-IL)",className:Ge}),D&&i.jsx("input",{value:ie,onChange:Q=>ae(Q.target.value),placeholder:"Voice (optional, e.g. alloy, Rachel)",className:Ge})]})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("button",{className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",onClick:Y,children:"Save"}),i.jsx("button",{onClick:d,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"}),ee&&i.jsx("span",{className:`text-xs ml-2 ${ee==="Saved"?"text-green":"text-red"}`,children:ee})]})]})})})}function ux({name:o,svc:r,onClose:y,loadConfig:d}){const S=r.voice||{},[E,w]=h.useState(S.greeting||""),[M,b]=h.useState(S.hold_message||""),[x,k]=h.useState(S.hold_music||""),[v,j]=h.useState(S.language||""),[D,G]=h.useState(S.voice_name||""),[z,de]=h.useState(S.max_record_seconds||30),[ie,ae]=h.useState(!!S.conversational),[ee,W]=h.useState("");async function Y(){const Q={...E&&{greeting:E},...M&&{hold_message:M},...x&&{hold_music:x},...v&&{language:v},...D&&{voice_name:D},...z&&z!==30&&{max_record_seconds:z},conversational:ie},Z=Object.keys(Q).some(oe=>Q[oe]);try{const oe=await te(F+"/api/config/services/"+encodeURIComponent(o),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhook:r.webhook,method:r.method||"POST",auth:r.auth||null,code:r.code||null,command:r.command||null,stt:r.stt||null,tts:r.tts||null,format:r.format||null,voice:Z?Q:null})});if(!oe.ok)throw new Error((await oe.json().catch(()=>({}))).error||"Save failed");W("Saved"),setTimeout(()=>{y(),d()},600)}catch(oe){W(oe.message)}}return i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-6 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-4",children:[i.jsxs("div",{className:"text-sm font-semibold text-text",children:["Voice Call Settings — ",o]}),i.jsx("div",{className:"text-xs text-dim",children:"Configure how phone calls are handled: greeting, hold behavior, and conversation mode."}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Greeting"}),i.jsx("textarea",{value:E,onChange:Q=>w(Q.target.value),placeholder:"Hello! Please speak after the beep.",rows:2,className:Ge+" resize-y"}),i.jsx("div",{className:"text-[11px] text-dim",children:"Spoken (or synthesized via TTS) when the call is answered."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Hold Message"}),i.jsx("input",{value:M,onChange:Q=>b(Q.target.value),placeholder:"Please wait while I process your request...",className:Ge}),i.jsx("div",{className:"text-[11px] text-dim",children:"Spoken while waiting for the webhook response. Leave empty for silence."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Hold Music URL"}),i.jsx("input",{value:x,onChange:Q=>k(Q.target.value),placeholder:"https://example.com/hold-music.mp3",className:Ge}),i.jsx("div",{className:"text-[11px] text-dim",children:"Played instead of hold message if set. Must be a public URL."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Max Recording (seconds)"}),i.jsx("input",{type:"number",value:z,onChange:Q=>de(parseInt(Q.target.value)||30),min:5,max:120,className:Ge})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"TwiML Language"}),i.jsx("input",{value:v,onChange:Q=>j(Q.target.value),placeholder:"en-US",className:Ge}),i.jsx("div",{className:"text-[11px] text-dim",children:"Language for Twilio's built-in Say voice (e.g. en-US, he-IL)."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"TwiML Voice"}),i.jsx("input",{value:D,onChange:Q=>G(Q.target.value),placeholder:"Polly.Joanna",className:Ge}),i.jsx("div",{className:"text-[11px] text-dim",children:"Twilio voice name for the greeting and hold message."})]})]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm text-text cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:ie,onChange:Q=>ae(Q.target.checked),className:"accent-primary"}),"Conversational mode — loop back to record after each response"]}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("button",{className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",onClick:Y,children:"Save"}),i.jsx("button",{onClick:y,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"}),ee&&i.jsx("span",{className:`text-xs ml-2 ${ee==="Saved"?"text-green":"text-red"}`,children:ee})]})]})})})}function ox({name:o,svc:r,settings:y,onClose:d,loadConfig:S}){const E=r.format||{},[w,M]=h.useState(E.provider||""),[b,x]=h.useState(E.model||""),[k,v]=h.useState(E.prompt||""),[j,D]=h.useState("");async function G(){const z=w?{provider:w,...b&&{model:b},prompt:k}:null;try{const de=await te(F+"/api/config/services/"+encodeURIComponent(o),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhook:r.webhook,method:r.method||"POST",auth:r.auth||null,code:r.code||null,command:r.command||null,stt:r.stt||null,tts:r.tts||null,voice:r.voice||null,format:z})});if(!de.ok)throw new Error((await de.json().catch(()=>({}))).error||"Save failed");D("Saved"),setTimeout(()=>{d(),S()},600)}catch(de){D(de.message)}}return i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-6 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-4",children:[i.jsxs("div",{className:"text-sm font-semibold text-text",children:["AI Format Settings — ",o]}),i.jsx("div",{className:"text-xs text-dim",children:"Run an AI model on incoming messages to transform or extract data before sending to the webhook."}),i.jsx(Vu,{map:sx,value:w,onChange:M,settings:y}),w&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(ax,{value:b,onChange:x,provider:w}),i.jsx("textarea",{value:k,onChange:z=>v(z.target.value),placeholder:"Prompt: instructions for how to format the message (e.g. Extract name and amount. Return JSON.)",rows:3,className:Ge+" resize-y"})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("button",{className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",onClick:G,children:"Save"}),i.jsx("button",{onClick:d,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"}),j&&i.jsx("span",{className:`text-xs ml-2 ${j==="Saved"?"text-green":"text-red"}`,children:j})]})]})})})}function rx({channelName:o,channelConfig:r,onClose:y}){const{tunnelActive:d,tunnelUrl:S}=mt(),[E,w]=h.useState("curl"),[M,b]=h.useState(!1),[x,k]=h.useState(!1),v=(r.method||"POST").toUpperCase(),D=`${M&&S?S.replace(/\/$/,""):window.location.origin}/inbound/endpoint/${encodeURIComponent(o)}`,G=r.secret||"",z=v==="GET",de=z?`${D}?text=Hello+from+cURL`:D,ie=[`curl -X ${v} "${de}"`,' -H "Content-Type: application/json"'];G&&ie.push(` -H "X-Channel-Secret: ${G}"`),z||ie.push(` -d '{"text": "Hello from cURL"}'`);const ae=ie.join(` \\
|
|
55
|
+
`),ee=[' "Content-Type": "application/json"',...G?[` "X-Channel-Secret": "${G}"`]:[]].join(`,
|
|
56
|
+
`),W=z?"":`,
|
|
57
|
+
body: JSON.stringify({ text: "Hello from Node.js" })`,Q=`const response = await fetch("${z?`${D}?text=Hello+from+Node.js`:D}", {
|
|
58
|
+
method: "${v}",
|
|
59
|
+
headers: {
|
|
60
|
+
${ee}
|
|
61
|
+
}${W}
|
|
62
|
+
});
|
|
63
|
+
const data = await response.json();`,Z=[' "Content-Type": "application/json"',...G?[` "X-Channel-Secret": "${G}"`]:[]].join(`,
|
|
64
|
+
`),ze=`import requests
|
|
65
|
+
|
|
66
|
+
response = requests.${v.toLowerCase()}(
|
|
67
|
+
"${D}",${z?`
|
|
68
|
+
params={"text": "Hello from Python"},`:`
|
|
69
|
+
json={"text": "Hello from Python"},`}
|
|
70
|
+
headers={
|
|
71
|
+
${Z},
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
data = response.json()`,ye=[{id:"curl",label:"cURL"},{id:"node",label:"Node.js"},{id:"python",label:"Python"}],pe={curl:ae,node:Q,python:ze};function Ae(){navigator.clipboard.writeText(pe[E]).then(()=>{k(!0),setTimeout(()=>k(!1),1500)})}return i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",onClick:K=>{K.target===K.currentTarget&&y()},children:i.jsxs("div",{className:"bg-surface rounded-xl p-7 max-w-lg w-[90%] shadow-2xl",children:[i.jsx("h3",{className:"text-base font-semibold text-text mb-1",children:"Endpoint Example"}),i.jsxs("p",{className:"text-xs text-dim mb-4",children:[v," ",i.jsxs("span",{className:"font-mono",children:["/inbound/endpoint/",o]}),r.response_mode==="async"&&i.jsx("span",{className:"ml-2 text-yellow",children:"(async)"})]}),i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("div",{className:"flex gap-1",children:ye.map(K=>i.jsx("button",{onClick:()=>w(K.id),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors ${E===K.id?"bg-primary text-white":"text-dim hover:bg-bg-light border border-border"}`,children:K.label},K.id))}),i.jsxs("button",{onClick:Ae,className:"flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-dim border border-border rounded-lg hover:bg-bg-light transition-colors",children:[i.jsx("span",{className:"material-symbols-outlined text-[14px]",children:x?"check":"content_copy"}),x?"Copied":"Copy"]})]}),i.jsx("pre",{className:"bg-bg-light border border-border rounded-lg p-3 text-[11px] overflow-x-auto whitespace-pre-wrap break-all leading-relaxed",children:i.jsx("code",{className:"font-mono",children:pe[E]})}),i.jsxs("div",{className:"flex items-center justify-between mt-4",children:[i.jsx("div",{children:d&&S&&i.jsxs("label",{className:"flex items-center gap-2 text-xs text-dim cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:M,onChange:K=>b(K.target.checked),className:"accent-primary"}),"Use public URL"]})}),i.jsx("button",{onClick:y,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Close"})]})]})})}function dx({name:o,svc:r,loadConfig:y,settings:d,audioTarget:S,setAudioTarget:E,formatTarget:w,setFormatTarget:M,voiceTarget:b,setVoiceTarget:x,channels:k}){var pt,zt,oa,al,Rl,dl,kl,fl,Hl,at,_a;const[v,j]=h.useState(!1),[D,G]=h.useState(r.webhook),[z,de]=h.useState(r.code||""),[ie,ae]=h.useState(r.command||""),[ee,W]=h.useState(r.method||"POST"),[Y,Q]=h.useState(((pt=r.auth)==null?void 0:pt.type)||""),[Z,oe]=h.useState(((zt=r.auth)==null?void 0:zt.token)||""),[$,ze]=h.useState(((oa=r.auth)==null?void 0:oa.header_name)||""),[ye,pe]=h.useState(((al=r.auth)==null?void 0:al.header_value)||""),[Ae,K]=h.useState(!!((Rl=r.allow_list)!=null&&Rl.length)),[fe,_]=h.useState((r.allow_list||[]).join(", ")),[L,I]=h.useState(!1),[V,ne]=h.useState(!1),{tunnelActive:m,tunnelUrl:U}=mt(),X=S===o,J=b===o,se=((dl=k[r.channel])==null?void 0:dl.type)==="endpoint",me=((kl=k[r.channel])==null?void 0:kl.type)==="voice",be=["whatsapp","sms","voice"].includes((fl=k[r.channel])==null?void 0:fl.type),Je=se?`${m&&U?U.replace(/\/$/,""):window.location.origin}/inbound/endpoint/${encodeURIComponent(r.channel)}`:"";function Ee(){navigator.clipboard.writeText(Je).then(()=>{ne(!0),setTimeout(()=>ne(!1),1500)})}function St(){return Y==="bearer"&&Z?{type:"bearer",token:Z}:Y==="header"&&$&&ye?{type:"header",header_name:$,header_value:ye}:null}async function ht(){if(!D){alert("Webhook URL is required");return}const Oe=Ae&&fe.trim()?fe.split(",").map(Ft=>Ft.trim()).filter(Boolean):[],nl=await te(F+"/api/config/services/"+encodeURIComponent(o),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhook:D,method:ee,auth:St(),code:z||null,command:ie||null,stt:r.stt||null,tts:r.tts||null,voice:r.voice||null,format:r.format||null,allow_list:Oe.length>0?Oe:null})});if(!nl.ok){const Ft=await nl.json().catch(()=>({}));alert(Ft.error||"Save failed");return}j(!1),y()}async function ue(){if(!confirm(`Remove service "${o}"?`))return;const Oe=await te(F+"/api/config/services/"+encodeURIComponent(o),{method:"DELETE"});if(!Oe.ok){const nl=await Oe.json().catch(()=>({}));alert(nl.error||"Remove failed");return}y()}const Xe=w===o,De=[];return r.stt&&De.push("STT: "+r.stt.provider+(r.stt.language?" ("+r.stt.language+")":"")),r.tts&&De.push("TTS: "+r.tts.provider+(r.tts.language?" ("+r.tts.language+")":"")),(Hl=r.voice)!=null&&Hl.greeting&&De.push("Greeting"),(at=r.voice)!=null&&at.conversational&&De.push("Conversational"),r.format&&De.push("Format: "+r.format.provider),(_a=r.allow_list)!=null&&_a.length&&De.push(r.allow_list.length+" allowed"),i.jsxs(i.Fragment,{children:[v?i.jsxs("tr",{className:"hover:bg-bg-light transition-colors",children:[i.jsx("td",{className:"px-4 py-4 font-medium text-sm text-text",children:o}),i.jsx("td",{className:"px-4 py-4 text-sm text-dim",children:r.channel}),i.jsxs("td",{className:"px-4 py-4 space-y-1",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("select",{value:ee,onChange:Oe=>W(Oe.target.value),className:di+" w-[90px] shrink-0",children:[i.jsx("option",{value:"POST",children:"POST"}),i.jsx("option",{value:"GET",children:"GET"}),i.jsx("option",{value:"PUT",children:"PUT"}),i.jsx("option",{value:"PATCH",children:"PATCH"})]}),i.jsx("input",{value:D,onChange:Oe=>G(Oe.target.value),placeholder:"Webhook URL",className:Ge,autoFocus:!0})]}),i.jsxs("div",{className:"space-y-1 pt-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-dim whitespace-nowrap",children:"Auth:"}),i.jsxs("select",{value:Y,onChange:Oe=>{Q(Oe.target.value)},className:di+" flex-1 text-xs",children:[i.jsx("option",{value:"",children:"None"}),i.jsx("option",{value:"bearer",children:"Bearer Token"}),i.jsx("option",{value:"header",children:"Custom Header"})]})]}),Y==="bearer"&&i.jsx("input",{value:Z,onChange:Oe=>oe(Oe.target.value),placeholder:"Bearer token",className:Ge+" text-xs"}),Y==="header"&&i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{value:$,onChange:Oe=>ze(Oe.target.value),placeholder:"Header name (e.g. X-API-Key)",className:Ge+" flex-1 text-xs"}),i.jsx("input",{value:ye,onChange:Oe=>pe(Oe.target.value),placeholder:"Header value",className:Ge+" flex-1 text-xs"})]})]})]}),i.jsxs("td",{className:"px-4 py-4 space-y-1",children:[i.jsx("input",{value:z,onChange:Oe=>de(Oe.target.value),placeholder:"Magic code",className:Ge}),i.jsx("input",{value:ie,onChange:Oe=>ae(Oe.target.value),placeholder:"Slash command",className:Ge}),be&&i.jsxs("div",{className:"space-y-1 pt-1",children:[i.jsxs("label",{className:"flex items-center gap-2 text-xs text-text cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:Ae,onChange:Oe=>K(Oe.target.checked),className:"accent-primary"}),"Allow list"]}),Ae&&i.jsx("textarea",{value:fe,onChange:Oe=>_(Oe.target.value),placeholder:"+972541234567, +12025551234",rows:2,className:Ge+" resize-y text-xs"})]})]}),i.jsxs("td",{className:"px-4 py-4 text-right whitespace-nowrap space-x-1",children:[i.jsx(vt,{icon:"check",label:"Save",onClick:ht}),i.jsx(vt,{icon:"close",label:"Cancel",onClick:()=>j(!1)})]})]}):i.jsxs("tr",{className:"hover:bg-bg-light transition-colors",children:[i.jsxs("td",{className:"px-4 py-4 text-sm font-medium text-text",children:[o,De.length>0&&i.jsx("div",{className:"mt-0.5 text-[11px] text-dim",children:De.join(" · ")})]}),i.jsx("td",{className:"px-4 py-4 text-sm text-dim",children:r.channel}),i.jsx("td",{className:"px-4 py-4 max-w-[280px]",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[r.method&&r.method!=="POST"&&i.jsx("span",{className:"shrink-0 px-1.5 py-0.5 text-[10px] font-bold rounded bg-primary/10 text-primary",children:r.method}),r.auth&&i.jsx("span",{className:"shrink-0 material-symbols-outlined text-[14px] text-dim",title:r.auth.type==="bearer"?"Bearer token":r.auth.header_name,children:"lock"}),i.jsx("span",{className:"block truncate text-xs text-dim font-mono",children:r.webhook})]})}),i.jsx("td",{className:"px-4 py-4 text-xs text-dim",children:r.code||r.command||"—"}),i.jsxs("td",{className:"px-4 py-4 text-right whitespace-nowrap space-x-1",children:[se&&i.jsx(vt,{icon:V?"check":"link",label:V?"Copied!":"Copy endpoint URL",onClick:Ee}),se&&i.jsx(vt,{icon:"code",label:"Example",onClick:()=>I(!0)}),i.jsx(vt,{icon:"graphic_eq",label:"Audio",onClick:()=>{E(X?null:o),M(null),x(null)}}),me&&i.jsx(vt,{icon:"call",label:"Voice Settings",onClick:()=>{x(J?null:o),E(null),M(null)}}),i.jsx(vt,{icon:"auto_fix_high",label:"Format",onClick:()=>{M(Xe?null:o),E(null),x(null)}}),i.jsx(vt,{icon:"edit",label:"Edit",onClick:()=>j(!0)}),i.jsx(vt,{icon:"delete",label:"Remove",onClick:ue,danger:!0})]})]}),X&&i.jsx(cx,{name:o,svc:r,settings:d,onClose:()=>E(null),loadConfig:y}),J&&i.jsx(ux,{name:o,svc:r,onClose:()=>x(null),loadConfig:y}),Xe&&i.jsx(ox,{name:o,svc:r,settings:d,onClose:()=>M(null),loadConfig:y}),L&&se&&i.jsx(rx,{channelName:r.channel,channelConfig:k[r.channel],onClose:()=>I(!1)})]})}function fx({loadConfig:o}){var Ee,St,ht;const{services:r,channels:y,settings:d}=mt(),S=Dl(),[E,w]=h.useState(null),[M,b]=h.useState(null),[x,k]=h.useState(null),[v,j]=h.useState("pick"),[D,G]=h.useState(""),[z,de]=h.useState(""),[ie,ae]=h.useState(""),[ee,W]=h.useState("POST"),[Y,Q]=h.useState(""),[Z,oe]=h.useState(""),[$,ze]=h.useState(""),[ye,pe]=h.useState(""),[Ae,K]=h.useState(""),[fe,_]=h.useState(""),[L,I]=h.useState(!1),[V,ne]=h.useState("");h.useEffect(()=>{o(),te(F+"/api/settings").then(ue=>ue.json()).then(ue=>S({type:"SET_SETTINGS",payload:ue.settings||{}})).catch(()=>{})},[o,S]);function m(ue){G(ue),j("form")}function U(){j("pick"),G(""),de(""),ae(""),W("POST"),Q(""),oe(""),ze(""),pe(""),K(""),_(""),I(!1),ne("")}function X(){return Y==="bearer"&&Z?{type:"bearer",token:Z}:Y==="header"&&$&&ye?{type:"header",header_name:$,header_value:ye}:null}async function J(){if(!z||!D||!ie){alert("Name, channel and webhook URL are required");return}const ue=L&&V.trim()?V.split(",").map(pt=>pt.trim()).filter(Boolean):void 0,Xe=X(),De=await te(F+"/api/config/services",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z,channel:D,webhook:ie,method:ee,...Xe&&{auth:Xe},...Ae&&{code:Ae},...fe&&{command:fe},...ue&&{allow_list:ue}})});if(!De.ok){const pt=await De.json();alert(pt.error||"Failed to add service");return}U(),o()}const se=((Ee=y[D])==null?void 0:Ee.mode)==="service",me=Object.entries(r),be=Object.keys(y),Je=new Set(be.filter(ue=>{var Xe;return((Xe=y[ue])==null?void 0:Xe.mode)==="service"&&me.some(([,De])=>De.channel===ue)}));return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"bg-surface border border-border rounded-xl shadow-sm overflow-hidden",children:i.jsx("div",{children:i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-bg-light border-b border-border",children:[i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Name"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Channel"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Webhook"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Code / Command"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider"})]})}),i.jsx("tbody",{className:"divide-y divide-border/50",children:me.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center text-dim py-8 text-sm",children:"No services configured"})}):me.map(([ue,Xe])=>i.jsx(dx,{name:ue,svc:Xe,loadConfig:o,settings:d,audioTarget:E,setAudioTarget:w,formatTarget:M,setFormatTarget:b,voiceTarget:x,setVoiceTarget:k,channels:y},ue))})]})})}),i.jsxs("div",{className:"bg-surface border border-border rounded-xl p-5 shadow-sm mt-4",children:[i.jsx("h3",{className:"text-sm font-semibold text-text mb-1",children:"Add Service"}),v==="pick"?i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-dim mb-4",children:"Choose which channel this service will use."}),be.length===0?i.jsx("p",{className:"text-sm text-dim text-center py-5",children:"No channels configured yet. Add a channel first."}):i.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(130px,1fr))] gap-3",children:be.map(ue=>{const Xe=y[ue],De=im[Xe.type]||null,pt=Xe.number||Xe.from_email||(Xe.bot_token?Xe.bot_token.slice(0,12)+"…":""),zt=Je.has(ue);return i.jsxs("div",{onClick:zt?void 0:()=>m(ue),className:`flex flex-col items-center gap-2 p-4 bg-bg-light border-2 border-border rounded-xl transition-all text-center ${zt?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-primary hover:bg-highlight"}`,children:[i.jsx("div",{className:"w-8 h-8 flex items-center justify-center text-[28px]",children:De}),i.jsx("div",{className:"text-sm font-medium text-text w-full break-words",children:ue}),i.jsxs("div",{className:"text-[11px] text-dim leading-tight w-full break-words",children:[Xe.type,pt?" · "+pt:""]}),zt&&i.jsx("div",{className:"text-[10px] text-dim leading-tight",children:"Service mode · already in use"})]},ue)})})]}):i.jsxs("div",{children:[i.jsxs("button",{onClick:U,className:"flex items-center gap-1 text-sm text-primary hover:underline mb-3 bg-transparent border-none cursor-pointer p-0",children:[i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_back"}),"Back to channels"]}),i.jsxs("p",{className:"text-xs text-dim mb-3",children:['Add a service for channel "',D,'"',(St=y[D])!=null&&St.type?` (${y[D].type.charAt(0).toUpperCase()+y[D].type.slice(1)})`:"","."]}),i.jsxs("div",{className:"flex gap-3 flex-wrap mb-3",children:[i.jsx("input",{value:z,onChange:ue=>de(ue.target.value),placeholder:"Service name (e.g. support)",className:Ge+" flex-1 min-w-[140px]",autoFocus:!0}),i.jsxs("div",{className:"flex gap-2 flex-1 min-w-[140px]",children:[i.jsxs("select",{value:ee,onChange:ue=>W(ue.target.value),className:di+" w-[90px] shrink-0",children:[i.jsx("option",{value:"POST",children:"POST"}),i.jsx("option",{value:"GET",children:"GET"}),i.jsx("option",{value:"PUT",children:"PUT"}),i.jsx("option",{value:"PATCH",children:"PATCH"})]}),i.jsx("input",{value:ie,onChange:ue=>ae(ue.target.value),placeholder:"Webhook URL (e.g. http://localhost:3000/support)",className:Ge+" flex-1"})]})]}),i.jsxs("div",{className:"flex gap-3 flex-wrap items-start mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-[140px]",children:[i.jsx("span",{className:"text-xs text-dim whitespace-nowrap",children:"Auth:"}),i.jsxs("select",{value:Y,onChange:ue=>Q(ue.target.value),className:di+" text-xs",children:[i.jsx("option",{value:"",children:"None"}),i.jsx("option",{value:"bearer",children:"Bearer Token"}),i.jsx("option",{value:"header",children:"Custom Header"})]})]}),Y==="bearer"&&i.jsx("input",{value:Z,onChange:ue=>oe(ue.target.value),placeholder:"Bearer token",className:Ge+" flex-1 min-w-[140px] text-xs"}),Y==="header"&&i.jsxs(i.Fragment,{children:[i.jsx("input",{value:$,onChange:ue=>ze(ue.target.value),placeholder:"Header name (e.g. X-API-Key)",className:Ge+" flex-1 min-w-[140px] text-xs"}),i.jsx("input",{value:ye,onChange:ue=>pe(ue.target.value),placeholder:"Header value",className:Ge+" flex-1 min-w-[140px] text-xs"})]})]}),!se&&i.jsxs("div",{className:"flex gap-3 flex-wrap mb-3",children:[i.jsx("input",{value:Ae,onChange:ue=>K(ue.target.value),placeholder:"Magic code — WhatsApp multi-service (optional)",className:Ge+" flex-1 min-w-[140px]"}),i.jsx("input",{value:fe,onChange:ue=>_(ue.target.value),placeholder:"Slash command — Telegram, e.g. /support (optional)",className:Ge+" flex-1 min-w-[140px]"})]}),["whatsapp","sms","voice"].includes((ht=y[D])==null?void 0:ht.type)&&i.jsxs("div",{className:"space-y-2 mb-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm text-text cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:L,onChange:ue=>I(ue.target.checked),className:"accent-primary"}),"Restrict to specific numbers (allow list)"]}),L&&i.jsx("textarea",{value:V,onChange:ue=>ne(ue.target.value),placeholder:"Comma-separated phone numbers, e.g. +972541234567, +12025551234",rows:2,className:Ge+" resize-y"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:J,className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",children:"Add Service"}),se&&i.jsx("span",{className:"text-xs text-dim",children:"Service mode — no code or command needed."})]})]})]})]})}const mx="modulepreload",hx=function(o){return"/dashboard/"+o},If={},px=function(r,y,d){let S=Promise.resolve();if(y&&y.length>0){let w=function(x){return Promise.all(x.map(k=>Promise.resolve(k).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const M=document.querySelector("meta[property=csp-nonce]"),b=(M==null?void 0:M.nonce)||(M==null?void 0:M.getAttribute("nonce"));S=w(y.map(x=>{if(x=hx(x),x in If)return;If[x]=!0;const k=x.endsWith(".css"),v=k?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${v}`))return;const j=document.createElement("link");if(j.rel=k?"stylesheet":mx,k||(j.as="script"),j.crossOrigin="",j.href=x,b&&j.setAttribute("nonce",b),document.head.appendChild(j),k)return new Promise((D,G)=>{j.addEventListener("load",D),j.addEventListener("error",()=>G(new Error(`Unable to preload CSS for ${x}`)))})}))}function E(w){const M=new Event("vite:preloadError",{cancelable:!0});if(M.payload=w,window.dispatchEvent(M),!M.defaultPrevented)throw w}return S.then(w=>{for(const M of w||[])M.status==="rejected"&&E(M.reason);return r().catch(E)})},Bt="w-full py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",Ml="w-full py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary",xx={whatsapp:{note:"After adding, you'll pair via QR code. Optionally buy a Twilio number below.",fields:[{key:"number",label:"Phone Number (optional)",placeholder:"+12025551234"}]},telegram:{note:"Create a bot at @BotFather and paste the token here.",fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF1234..."}]},"sms-twilio":{note:"Twilio console: Account SID and Auth Token from the dashboard.",fields:[{key:"account_sid",label:"Account SID",placeholder:"ACxxxxxxx"},{key:"auth_token",label:"Auth Token",placeholder:""},{key:"number",label:"Phone Number",placeholder:"+12025551234"}]},"voice-twilio":{note:"Same credentials as SMS. Voice and SMS can share credentials but need separate channels.",fields:[{key:"account_sid",label:"Account SID",placeholder:"ACxxxxxxx"},{key:"auth_token",label:"Auth Token",placeholder:""},{key:"number",label:"Phone Number",placeholder:"+12025551234"}]},"email-gmail":{note:"Create OAuth2 credentials (Desktop app) at console.cloud.google.com/apis/credentials. Enable the Gmail API.",fields:[{key:"client_id",label:"OAuth Client ID",placeholder:"xxxx.apps.googleusercontent.com"},{key:"client_secret",label:"OAuth Client Secret",placeholder:""}]},"email-resend":{note:"Get your API key from resend.com.",fields:[{key:"api_key",label:"API Key",placeholder:"re_xxxxxxx"},{key:"from_email",label:"From Email",placeholder:"support@yourdomain.com"}]},endpoint:{note:"Expose a URL that external systems can call.",fields:[{key:"method",label:"HTTP Method",placeholder:"POST"},{key:"secret",label:"Secret Key (optional)",placeholder:"A secret for X-Channel-Secret header"}]}},bx={whatsapp:"WhatsApp",telegram:"Telegram","sms-twilio":"SMS (Twilio)","voice-twilio":"Voice (Twilio)","email-gmail":"Email (Gmail)","email-resend":"Email (Resend)",endpoint:"Endpoint (Webhook)"},gx=[{code:"US",label:"United States (+1)"},{code:"GB",label:"United Kingdom (+44)"},{code:"CA",label:"Canada (+1)"},{code:"AU",label:"Australia (+61)"},{code:"DE",label:"Germany (+49)"},{code:"FR",label:"France (+33)"},{code:"IL",label:"Israel (+972)"},{code:"NL",label:"Netherlands (+31)"},{code:"SE",label:"Sweden (+46)"},{code:"ES",label:"Spain (+34)"},{code:"IT",label:"Italy (+39)"},{code:"BR",label:"Brazil (+55)"},{code:"JP",label:"Japan (+81)"},{code:"IN",label:"India (+91)"},{code:"PL",label:"Poland (+48)"}],Pf={whatsapp:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#25D366",d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})}),telegram:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#26A5E4",d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),sms:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[i.jsx("path",{fill:"#6B7280",d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"}),i.jsx("path",{fill:"#6B7280",d:"M7 9h2v2H7zm4 0h2v2h-2zm4 0h2v2h-2z"})]}),voice:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#6B7280",d:"M20.01 15.38c-1.23 0-2.42-.2-3.53-.56a.977.977 0 0 0-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z"})}),email:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#6B7280",d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z"})}),endpoint:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"#6B7280",d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})};function yx({channel:o,onClose:r}){const[y,d]=h.useState(60),[S,E]=h.useState("waiting"),[w,M]=h.useState(""),[b,x]=h.useState(null),k=h.useRef(null);h.useEffect(()=>{let j=!0;const D=async()=>{try{const z=await(await te(F+"/api/config/channels/"+encodeURIComponent(o)+"/pair-status")).json();if(!j)return;if(z.status==="paired"){E("paired");return}if(z.status==="error"){E("error"),M(z.error||"Pairing failed");return}z.qr&&(x(z.qr),E("qr"))}catch{}j&&setTimeout(D,1e3)};return D(),()=>{j=!1}},[o]),h.useEffect(()=>{!b||!k.current||px(()=>import("./browser-D_-rzKir.js").then(j=>j.b),[]).then(j=>{var G;const D=j.toCanvas||((G=j.default)==null?void 0:G.toCanvas);D&&k.current&&D(k.current,b,{width:280,margin:2}).catch(()=>{})}).catch(()=>{})},[b]),h.useEffect(()=>{const j=setInterval(()=>d(D=>Math.max(0,D-1)),1e3);return()=>clearInterval(j)},[]);let v;return S==="paired"?v=i.jsxs("div",{className:"py-10 text-center text-green text-base font-semibold",children:[i.jsx("span",{className:"material-symbols-outlined text-5xl mb-3 block",children:"check_circle"}),"WhatsApp paired successfully!",i.jsx("br",{}),i.jsx("span",{className:"text-xs font-normal text-dim",children:"Restart the server to start receiving messages."})]}):S==="error"?v=i.jsx("div",{className:"py-10 text-center text-red text-sm",children:w}):S==="qr"?v=i.jsx("div",{className:"bg-white rounded-xl p-3 inline-block mb-4",children:i.jsx("canvas",{ref:k})}):v=i.jsx("div",{className:"py-16 text-dim text-sm",children:"Waiting for QR code..."}),i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",children:i.jsxs("div",{className:"bg-surface rounded-xl p-8 max-w-md w-[90%] text-center shadow-2xl",children:[i.jsxs("h3",{className:"text-base font-semibold mb-1",children:["Pair WhatsApp — ",o]}),i.jsx("div",{className:"text-sm text-dim mb-5",children:"Open WhatsApp → Settings → Linked Devices → Link a Device"}),v,y>0&&S!=="paired"&&S!=="error"&&i.jsxs("div",{className:"text-xs text-dim mb-4",children:[y,"s remaining"]}),i.jsx("button",{onClick:r,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Close"})]})})}function vx({channel:o,qrMessage:r,onClose:y}){const[d,S]=h.useState(120),E=h.useRef(null);h.useEffect(()=>(E.current=setInterval(()=>S(M=>Math.max(0,M-1)),1e3),()=>clearInterval(E.current)),[]),h.useEffect(()=>{((r==null?void 0:r.type)==="gmail-auth-success"||(r==null?void 0:r.type)==="gmail-auth-error")&&clearInterval(E.current)},[r]),h.useEffect(()=>{(r==null?void 0:r.type)==="gmail-auth-url"&&r.channel===o&&r.authUrl&&window.open(r.authUrl,"_blank")},[r,o]);let w;return(r==null?void 0:r.type)==="gmail-auth-success"&&r.channel===o?w=i.jsxs("div",{className:"py-10 text-center text-green text-base font-semibold",children:[i.jsx("span",{className:"material-symbols-outlined text-5xl mb-3 block",children:"check_circle"}),"Gmail authenticated successfully!",i.jsx("br",{}),i.jsx("span",{className:"text-xs font-normal text-dim",children:"Restart the server to start receiving emails."})]}):(r==null?void 0:r.type)==="gmail-auth-error"&&r.channel===o?w=i.jsx("div",{className:"py-10 text-center text-red text-sm",children:r.error||"Authentication failed"}):(r==null?void 0:r.type)==="gmail-auth-url"&&r.channel===o?w=i.jsxs("div",{className:"py-6 space-y-4",children:[i.jsx("p",{className:"text-sm text-dim",children:"A browser window should have opened for Google authorization."}),i.jsx("p",{className:"text-xs text-dim",children:"If it didn't open automatically, click the button below:"}),i.jsx("a",{href:r.authUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-block px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors no-underline",children:"Open Google Authorization"})]}):w=i.jsx("div",{className:"py-16 text-dim text-sm",children:"Starting OAuth flow..."}),i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",children:i.jsxs("div",{className:"bg-surface rounded-xl p-8 max-w-md w-[90%] text-center shadow-2xl",children:[i.jsxs("h3",{className:"text-base font-semibold mb-1",children:["Gmail OAuth — ",o]}),i.jsx("div",{className:"text-sm text-dim mb-5",children:"Authorize ChannelKit to access your Gmail account"}),w,d>0&&(r==null?void 0:r.type)!=="gmail-auth-success"&&(r==null?void 0:r.type)!=="gmail-auth-error"&&i.jsxs("div",{className:"text-xs text-dim mb-4",children:[d,"s remaining"]}),i.jsx("button",{onClick:y,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Close"})]})})}function Sx({number:o,smsListenMessage:r,onClose:y}){const d=Dl(),[S,E]=h.useState([]),[w,M]=h.useState(""),[b,x]=h.useState(300),k=h.useRef(null),v=h.useRef(!1);h.useEffect(()=>(k.current=setInterval(()=>x(z=>z<=1?(clearInterval(k.current),0):z-1),1e3),()=>clearInterval(k.current)),[]),h.useEffect(()=>{!r||r.number!==o||(r.type==="sms-listen"?E(z=>z.some(ie=>ie.body===r.message.body&&ie.from===r.message.from&&ie.date===r.message.date)?z:[r.message,...z]):r.type==="sms-listen-error"?(M(r.error),clearInterval(k.current)):r.type==="sms-listen-stopped"&&(v.current=!0,clearInterval(k.current),x(0)))},[r,o]);function j(){te(F+"/api/twilio/stop-listen-sms",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({number:o})}).catch(()=>{}),d({type:"SET_SMS_LISTEN",payload:null}),y()}const D=Math.floor(b/60),G=b%60;return i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",children:i.jsxs("div",{className:"bg-surface rounded-xl p-8 max-w-lg w-[90%] shadow-2xl",children:[i.jsx("h3",{className:"text-base font-semibold mb-1",children:"Listening for SMS"}),i.jsxs("div",{className:"text-sm text-dim mb-4",children:["Messages arriving at ",i.jsx("span",{className:"font-mono font-medium text-text",children:o})]}),w&&i.jsx("div",{className:"p-3 rounded-lg text-xs text-red bg-red-light border border-red/20 mb-4",children:w}),S.length===0&&!w&&b>0&&i.jsxs("div",{className:"py-10 text-center text-dim text-sm",children:[i.jsx("div",{className:"inline-block w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin mb-3"}),i.jsx("div",{children:"Waiting for messages..."})]}),S.length>0&&i.jsx("div",{className:"max-h-60 overflow-y-auto border border-border rounded-lg mb-4 divide-y divide-border/50",children:S.map((z,de)=>i.jsxs("div",{className:"px-4 py-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:"font-mono text-xs font-medium text-text",children:z.from}),i.jsx("span",{className:"text-[10px] text-dim",children:new Date(z.date).toLocaleTimeString()})]}),i.jsx("div",{className:"text-sm text-text select-all",children:z.body})]},de))}),b===0&&S.length===0&&!w&&i.jsx("div",{className:"py-8 text-center text-dim text-sm",children:"Timed out — no messages received."}),i.jsxs("div",{className:"flex items-center justify-between",children:[b>0&&!w&&i.jsxs("span",{className:"text-xs text-dim",children:["Auto-stop in ",D,":",G.toString().padStart(2,"0")]}),(b===0||w)&&i.jsx("span",{}),i.jsx("button",{onClick:j,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:b>0&&!w?"Stop & Close":"Close"})]})]})})}function jx({name:o,currentMode:r,currentInterval:y,onClose:d,loadConfig:S}){const{tunnelActive:E}=mt(),[w,M]=h.useState(r),[b,x]=h.useState(y||60),[k,v]=h.useState(!1);async function j(){if(w==="webhook"&&!E){alert("Please externalize the service first.");return}v(!0);try{const D=await te(F+"/api/config/channels/"+encodeURIComponent(o)+"/sms-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({inbound_mode:w,...w==="polling"&&{poll_interval:parseInt(b)||60}})});if(!D.ok){const G=await D.json().catch(()=>({}));alert(G.error||"Failed"),v(!1);return}d(),S()}catch(D){alert(D.message),v(!1)}}return i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"px-6 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-3",children:[i.jsx("div",{className:"text-sm font-semibold text-text",children:"SMS Inbound Settings"}),i.jsxs("select",{value:w,onChange:D=>M(D.target.value),className:Ml,children:[i.jsx("option",{value:"polling",children:"Polling — fetch messages at regular intervals"}),i.jsx("option",{value:"webhook",children:"External Address — receive webhooks from Twilio"})]}),w==="polling"&&i.jsx("input",{type:"number",value:b,onChange:D=>x(D.target.value),min:"5",max:"3600",placeholder:"Poll interval in seconds",className:Bt}),w==="webhook"&&!E&&i.jsxs("div",{className:"p-3 rounded-lg text-xs bg-yellow-light text-yellow border border-yellow/20",children:["Service is not externalized. Please ",i.jsx("strong",{children:"Externalize"})," first."]}),w==="webhook"&&E&&i.jsx("div",{className:"p-3 rounded-lg text-xs bg-green-light text-green border border-green/20",children:"Twilio will send incoming SMS to your external address."}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("button",{onClick:j,disabled:k,className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors disabled:opacity-50",children:k?"Saving…":"Save"}),i.jsx("button",{onClick:d,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"})]})]})})})}function Nx({name:o,ch:r,onClose:y,loadConfig:d}){const{tunnelActive:S}=mt(),[E,w]=h.useState(r.from_email||""),M=r.poll_interval?"polling":"webhook",[b,x]=h.useState(M),[k,v]=h.useState(r.poll_interval||30),[j,D]=h.useState(!1);async function G(){if(!E.trim()){alert("From email is required");return}if(b==="webhook"&&!S){alert("Please externalize the service first.");return}D(!0);try{const z=await te(F+"/api/config/channels/"+encodeURIComponent(o)+"/email-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({inbound_mode:b,from_email:E.trim(),...b==="polling"&&{poll_interval:parseInt(k)||30}})});if(!z.ok){const de=await z.json().catch(()=>({}));alert(de.error||"Failed"),D(!1);return}y(),d()}catch(z){alert(z.message),D(!1)}}return i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"px-6 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-3",children:[i.jsxs("div",{className:"text-sm font-semibold text-text",children:["Email Settings — ",o]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"From Email"}),i.jsx("input",{value:E,onChange:z=>w(z.target.value),placeholder:"support@yourdomain.com",className:Bt}),i.jsx("div",{className:"text-[11px] text-dim",children:"Must be a verified domain in your Resend account."})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"text-xs font-semibold text-dim",children:"Inbound Mode"}),i.jsxs("select",{value:b,onChange:z=>x(z.target.value),className:Ml,children:[i.jsx("option",{value:"webhook",children:"Webhook — Resend forwards emails to your endpoint"}),i.jsx("option",{value:"polling",children:"Polling — fetch emails at regular intervals"})]})]}),b==="polling"&&i.jsx("input",{type:"number",value:k,onChange:z=>v(z.target.value),min:"5",max:"3600",placeholder:"Poll interval in seconds",className:Bt}),b==="webhook"&&!S&&i.jsxs("div",{className:"p-3 rounded-lg text-xs bg-yellow-light text-yellow border border-yellow/20",children:["Service is not externalized. Please ",i.jsx("strong",{children:"Externalize"})," first."]}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("button",{onClick:G,disabled:j,className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors disabled:opacity-50",children:j?"Saving…":"Save"}),i.jsx("button",{onClick:y,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"})]})]})})})}function Tx({typeKey:o,fieldValues:r,onNumberPurchased:y,onClose:d}){const{twilioDefaults:S}=mt(),E=o==="whatsapp",[w,M]=h.useState(""),[b,x]=h.useState(""),[k,v]=h.useState("US"),[j,D]=h.useState(o==="voice-twilio"?"local":"mobile"),[G,z]=h.useState(null),[de,ie]=h.useState(""),[ae,ee]=h.useState(""),[W,Y]=h.useState(!1);function Q(){var ye,pe;let $,ze;return E?($=w.trim(),ze=b.trim()):($=(ye=r.account_sid)==null?void 0:ye.trim(),ze=(pe=r.auth_token)==null?void 0:pe.trim()),!$&&S.sid&&($=S.sid),!ze&&S.tok&&(ze=S.tok),{sid:$,tok:ze}}async function Z(){var ye;const{sid:$,tok:ze}=Q();if(!$||!ze){ie("Account SID and Auth Token are required");return}Y(!0),ie("");try{const pe=await te(F+"/api/twilio/search-numbers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account_sid:$,auth_token:ze,country_code:k,type:j,limit:10})}),Ae=await pe.json();if(!pe.ok)throw new Error(Ae.error||"Search failed");if(!((ye=Ae.numbers)!=null&&ye.length))throw new Error("No numbers available. Try a different country or type.");z(Ae.numbers)}catch(pe){ie(pe.message)}finally{Y(!1)}}async function oe($){if(!confirm("Purchase "+$+" from Twilio? Your account will be charged."))return;const{sid:ze,tok:ye}=Q();ee("");try{const pe=await te(F+"/api/twilio/buy-number",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account_sid:ze,auth_token:ye,phone_number:$})}),Ae=await pe.json();if(!pe.ok)throw new Error(Ae.error||"Purchase failed");y(Ae.purchased.phoneNumber)}catch(pe){ee(pe.message)}}return i.jsxs("div",{className:"border border-border rounded-xl p-4 mb-3 bg-surface space-y-3",children:[i.jsx("div",{className:"text-sm font-semibold text-text",children:"Buy a Twilio Number"}),E?i.jsxs("div",{className:"space-y-2",children:[i.jsx("input",{value:w,onChange:$=>M($.target.value),placeholder:"Account SID — ACxxxxxxx",className:Bt}),i.jsx("input",{value:b,onChange:$=>x($.target.value),placeholder:"Auth Token",className:Bt})]}):i.jsx("div",{className:"text-xs text-dim",children:"Using the Account SID and Auth Token above."}),i.jsxs("div",{className:"flex gap-3 flex-wrap",children:[i.jsx("select",{value:k,onChange:$=>v($.target.value),className:Ml+" flex-1",children:gx.map($=>i.jsx("option",{value:$.code,children:$.label},$.code))}),i.jsxs("select",{value:j,onChange:$=>D($.target.value),className:Ml,children:[i.jsx("option",{value:"mobile",children:"Mobile"}),i.jsx("option",{value:"local",children:"Local"})]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:Z,disabled:W,className:"px-4 py-2 bg-primary text-white rounded-lg text-xs font-semibold hover:bg-primary-hover transition-colors disabled:opacity-50",children:W?"Searching…":"Search Numbers"}),i.jsx("button",{onClick:d,className:"px-4 py-2 border border-border rounded-lg text-xs text-dim hover:bg-bg-light transition-colors",children:"Cancel"})]}),de&&i.jsx("div",{className:"p-3 rounded-lg text-xs text-red bg-red-light border border-red/20",children:de}),G&&i.jsxs("div",{children:[i.jsx("div",{className:"text-xs font-semibold text-text mb-2",children:"Available Numbers"}),i.jsx("div",{className:"max-h-60 overflow-y-auto border border-border rounded-lg",children:i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-bg-light",children:[i.jsx("th",{className:"px-3 py-2 text-[10px] font-bold text-dim uppercase",children:"Number"}),i.jsx("th",{className:"px-3 py-2 text-[10px] font-bold text-dim uppercase",children:"Location"}),i.jsx("th",{className:"px-3 py-2 text-[10px] font-bold text-dim uppercase",children:"Capabilities"}),i.jsx("th",{className:"px-3 py-2 text-[10px] font-bold text-dim uppercase",children:"Price"}),i.jsx("th",{className:"px-3 py-2 w-[50px]"})]})}),i.jsx("tbody",{className:"divide-y divide-border/50",children:G.map($=>i.jsxs("tr",{className:"hover:bg-bg-light transition-colors",children:[i.jsx("td",{className:"px-3 py-2 font-mono text-xs font-medium",children:$.phoneNumber}),i.jsx("td",{className:"px-3 py-2 text-[11px] text-dim",children:[$.locality,$.region].filter(Boolean).join(", ")||$.isoCountry}),i.jsxs("td",{className:"px-3 py-2 space-x-1",children:[$.capabilities.sms&&i.jsx("span",{className:"inline-block bg-green-light text-green px-1.5 py-0.5 rounded text-[10px] font-semibold",children:"SMS"}),$.capabilities.voice&&i.jsx("span",{className:"inline-block bg-primary/10 text-primary px-1.5 py-0.5 rounded text-[10px] font-semibold",children:"Voice"}),$.capabilities.mms&&i.jsx("span",{className:"inline-block bg-orange-light text-orange px-1.5 py-0.5 rounded text-[10px] font-semibold",children:"MMS"})]}),i.jsx("td",{className:"px-3 py-2 text-[11px] text-dim whitespace-nowrap",children:$.price?`${($.priceUnit||"USD").toUpperCase()} $${parseFloat($.price).toFixed(2)}/mo`:""}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("button",{onClick:()=>oe($.phoneNumber),className:"px-2 py-1 bg-primary text-white rounded text-[11px] font-semibold hover:bg-primary-hover",children:"Buy"})})]},$.phoneNumber))})]})}),ae&&i.jsx("div",{className:"p-3 rounded-lg text-xs text-red bg-red-light border border-red/20 mt-2",children:ae})]})]})}function Ex({typeKey:o,fieldValues:r,channels:y,twilioDefaults:d,onSelect:S,onNumbersFetched:E}){const[w,M]=h.useState(null),[b,x]=h.useState(!1),[k,v]=h.useState("");function j(){var W,Y;let ae,ee;return o==="whatsapp"?(ae=d.sid,ee=d.tok):(ae=((W=r.account_sid)==null?void 0:W.trim())||d.sid,ee=((Y=r.auth_token)==null?void 0:Y.trim())||d.tok),{sid:ae,tok:ee}}const{sid:D,tok:G}=j(),z=!!(D&&G),de=new Set(Object.values(y).map(ae=>ae.number).filter(Boolean));async function ie(){var ae;x(!0),v(""),M(null);try{const ee=await te(F+"/api/twilio/list-numbers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account_sid:D,auth_token:G})}),W=await ee.json();if(!ee.ok)throw new Error(W.error||"Failed to fetch numbers");if(!((ae=W.numbers)!=null&&ae.length)){v("No phone numbers found in this Twilio account.");return}M(W.numbers),E&&E(W.numbers)}catch(ee){v(ee.message)}finally{x(!1)}}return i.jsxs("div",{className:"mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:ie,disabled:!z||b,className:"px-3 py-1.5 text-xs font-medium text-primary border border-primary/30 rounded-lg hover:bg-primary/5 transition-colors disabled:opacity-50",title:z?"Fetch phone numbers from your Twilio account":"Set Account SID and Auth Token first",children:b?"Fetching…":"Fetch my numbers"}),!z&&i.jsx("span",{className:"text-[11px] text-dim",children:o==="whatsapp"?"Set Twilio defaults in Settings to fetch numbers":"Enter Account SID and Auth Token above to fetch numbers"})]}),k&&i.jsx("div",{className:"text-xs text-red mt-2",children:k}),w&&i.jsx("div",{className:"mt-2 border border-border rounded-lg max-h-[200px] overflow-y-auto",children:i.jsx("table",{className:"w-full text-left border-collapse",children:i.jsx("tbody",{className:"divide-y divide-border/50",children:w.map(ae=>{const ee=de.has(ae.phoneNumber);return i.jsxs("tr",{className:`${ee?"opacity-60":"cursor-pointer hover:bg-bg-light"} transition-colors`,onClick:()=>{ee||S(ae.phoneNumber)},children:[i.jsxs("td",{className:"px-3 py-2 font-mono text-xs font-medium",children:[ae.phoneNumber,ee&&i.jsx("span",{className:"ml-2 text-[10px] font-semibold text-yellow bg-yellow-light px-1.5 py-0.5 rounded",children:"used"})]}),i.jsx("td",{className:"px-3 py-2 text-[11px] text-dim",children:ae.friendlyName}),i.jsxs("td",{className:"px-3 py-2 space-x-1",children:[ae.capabilities.sms&&i.jsx("span",{className:"inline-block bg-green-light text-green px-1.5 py-0.5 rounded text-[10px] font-semibold",children:"SMS"}),ae.capabilities.voice&&i.jsx("span",{className:"inline-block bg-primary/10 text-primary px-1.5 py-0.5 rounded text-[10px] font-semibold",children:"Voice"})]})]},ae.phoneNumber)})})})})]})}function Cx({loadConfig:o}){var bt;const{channels:r,services:y,twilioDefaults:d,tunnelActive:S,qrMessage:E,smsListenMessage:w,baileysAvailable:M}=mt(),b=Dl(),[x,k]=h.useState("pick"),[v,j]=h.useState(""),[D,G]=h.useState(""),[z,de]=h.useState({}),[ie,ae]=h.useState("service"),[ee,W]=h.useState("ignore"),[Y,Q]=h.useState("polling"),[Z,oe]=h.useState(60),[$,ze]=h.useState("webhook"),[ye,pe]=h.useState(30),[Ae,K]=h.useState(30),[fe,_]=h.useState(!1),[L,I]=h.useState(null),[V,ne]=h.useState(null),[m,U]=h.useState(null),[X,J]=h.useState(null),[se,me]=h.useState("sync"),[be,Je]=h.useState("30"),[Ee,St]=h.useState(!1),[ht,ue]=h.useState(""),[Xe,De]=h.useState(null),[pt,zt]=h.useState(null),[oa,al]=h.useState(null),[Rl,dl]=h.useState([]);h.useEffect(()=>{o()},[o]);function kl(B){j(B),k("form"),de({}),_(!1),dl([])}function fl(){k("pick"),j(""),G(""),de({}),ae("service"),St(!1),ue("")}function Hl(B,q){de(We=>({...We,[B]:q}))}function at(B){if((B.key==="account_sid"||B.key==="auth_token")&&d.sid){const q=B.key==="account_sid"?d.sid:d.tok;if(q)return B.label+" — Using default ("+qp(q)+")"}return B.label+(B.placeholder?" — "+B.placeholder:"")}async function _a(){var ct,gt,il,Lt,hl,Pt,Ve,sl,Aa,Bl,mi,hn,pn,xn;const B=D.trim();if(!B||!v){alert("Channel name and type are required");return}const q={name:B,mode:ie};if(ie==="groups"&&(q.unmatched=ee),Ee&&ht.trim()&&(q.allow_list=ht.split(",").map(Re=>Re.trim()).filter(Boolean)),v==="whatsapp"){const Re=(ct=z.number)==null?void 0:ct.trim();Object.assign(q,{type:"whatsapp",...Re&&{number:Re}})}else if(v==="telegram"){const Re=(gt=z.bot_token)==null?void 0:gt.trim();if(!Re){alert("Bot token is required");return}Object.assign(q,{type:"telegram",bot_token:Re})}else if(v==="sms-twilio"){const Re=((il=z.account_sid)==null?void 0:il.trim())||d.sid,nt=((Lt=z.auth_token)==null?void 0:Lt.trim())||d.tok,Gt=(hl=z.number)==null?void 0:hl.trim();if(!Re||!nt||!Gt){alert("Account SID, Auth Token and Phone Number are required");return}if(Y==="webhook"&&!S){alert("Please externalize first.");return}Object.assign(q,{type:"sms",provider:"twilio",account_sid:Re,auth_token:nt,number:Gt}),Y==="polling"&&(q.poll_interval=parseInt(Z)||60)}else if(v==="voice-twilio"){const Re=((Pt=z.account_sid)==null?void 0:Pt.trim())||d.sid,nt=((Ve=z.auth_token)==null?void 0:Ve.trim())||d.tok,Gt=(sl=z.number)==null?void 0:sl.trim();if(!Re||!nt||!Gt){alert("Account SID, Auth Token and Phone Number are required");return}Object.assign(q,{type:"voice",provider:"twilio",account_sid:Re,auth_token:nt,number:Gt})}else if(v==="email-gmail"){const Re=(Aa=z.client_id)==null?void 0:Aa.trim(),nt=(Bl=z.client_secret)==null?void 0:Bl.trim();if(!Re||!nt){alert("Client ID and Client Secret are required");return}Object.assign(q,{type:"email",provider:"gmail",client_id:Re,client_secret:nt});const Gt=parseInt(Ae);Gt&&Gt!==30&&(q.poll_interval=Gt)}else if(v==="email-resend"){const Re=(mi=z.api_key)==null?void 0:mi.trim(),nt=(hn=z.from_email)==null?void 0:hn.trim();if(!Re||!nt){alert("API Key and From Email are required");return}Object.assign(q,{type:"email",provider:"resend",api_key:Re,from_email:nt}),$==="polling"&&(q.poll_interval=parseInt(ye)||30)}else if(v==="endpoint"){const Re=((pn=z.method)==null?void 0:pn.trim().toUpperCase())||"POST",nt=(xn=z.secret)==null?void 0:xn.trim();Object.assign(q,{type:"endpoint",...Re!=="POST"&&{method:Re},...nt&&{secret:nt},response_mode:se,...se==="sync"&&be&&be!=="30"&&{response_timeout:parseInt(be)}})}const We=await te(F+"/api/config/channels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)});if(!We.ok){const Re=await We.json().catch(()=>({}));alert(Re.error||"Failed to add channel");return}if(v==="sms-twilio")try{await te(F+"/api/config/channels/"+encodeURIComponent(B)+"/sms-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({inbound_mode:Y,...Y==="polling"&&{poll_interval:parseInt(Z)||60}})})}catch{}if(v==="email-resend")try{await te(F+"/api/config/channels/"+encodeURIComponent(B)+"/email-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({inbound_mode:$,...$==="polling"&&{poll_interval:parseInt(ye)||30}})})}catch{}if(v==="whatsapp"){fl(),o(),nl(B);return}if(v==="email-gmail"){fl(),o(),Ft(B);return}fl(),o()}async function Oe(B){nl(B)}async function nl(B){I(B),b({type:"SET_QR_MESSAGE",payload:null});try{const q=await te(F+"/api/config/channels/"+encodeURIComponent(B)+"/pair",{method:"POST"});if(!q.ok){const We=await q.json().catch(()=>({}));b({type:"SET_QR_MESSAGE",payload:{type:"whatsapp-pair-error",channel:B,error:We.error||"Failed to start pairing"}})}}catch(q){b({type:"SET_QR_MESSAGE",payload:{type:"whatsapp-pair-error",channel:B,error:q.message}})}}async function Ft(B){ne(B),b({type:"SET_QR_MESSAGE",payload:null});try{const q=await te(F+"/api/config/channels/"+encodeURIComponent(B)+"/gmail-auth",{method:"POST"}),We=await q.json().catch(()=>({}));q.ok?We.already_authenticated&&b({type:"SET_QR_MESSAGE",payload:{type:"gmail-auth-success",channel:B}}):b({type:"SET_QR_MESSAGE",payload:{type:"gmail-auth-error",channel:B,error:We.error||"Failed to start OAuth"}})}catch(q){b({type:"SET_QR_MESSAGE",payload:{type:"gmail-auth-error",channel:B,error:q.message}})}}async function Cs(B,q){const We=q.length>0?`Remove channel "${B}"?
|
|
75
|
+
|
|
76
|
+
This will also remove these services:
|
|
77
|
+
• ${q.join(`
|
|
78
|
+
• `)}`:`Remove channel "${B}"?`;if(!confirm(We))return;const ct=await te(F+"/api/config/channels/"+encodeURIComponent(B),{method:"DELETE"});if(!ct.ok){const gt=await ct.json().catch(()=>({}));alert(gt.error||"Remove failed");return}o()}async function fi(B,q){await te(F+"/api/config/channels/"+encodeURIComponent(B),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({unmatched:q||null})})}async function _s(B,q){await te(F+"/api/config/channels/"+encodeURIComponent(B),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:q})}),o()}async function As(B){const q=d.sid,We=d.tok;if(!q||!We){alert("Set Twilio defaults in Settings first to listen for SMS.");return}al(B),b({type:"SET_SMS_LISTEN",payload:null});try{const ct=await te(F+"/api/twilio/listen-sms",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account_sid:q,auth_token:We,number:B})});if(!ct.ok){const gt=await ct.json().catch(()=>({}));alert(gt.error||"Failed to start SMS listener"),al(null)}}catch(ct){alert(ct.message),al(null)}}const ml=v==="sms-twilio"||v==="voice-twilio"||v==="whatsapp",xt=xx[v],It=Object.entries(r);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"bg-surface border border-border rounded-xl shadow-sm overflow-hidden",children:i.jsx("div",{children:i.jsxs("table",{className:"w-full text-left border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-bg-light border-b border-border",children:[i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Name"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Type"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Mode"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Details"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Services"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider",children:"Unmatched"}),i.jsx("th",{className:"px-4 py-3 text-[11px] font-bold text-dim uppercase tracking-wider"})]})}),i.jsx("tbody",{className:"divide-y divide-border/50",children:It.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"text-center text-dim py-8 text-sm",children:"No channels configured"})}):It.map(([B,q])=>{var Pt;const We=Object.entries(y).filter(([,Ve])=>Ve.channel===B).map(([Ve])=>Ve),ct=q.number||(q.bot_token?q.bot_token.slice(0,12)+"…":"")||q.from_email||"",gt=q.type==="sms",il=q.type==="email"&&q.provider==="resend",Lt=gt?q.poll_interval?"polling":"webhook":"",hl=gt?q.poll_interval?`Polling (${q.poll_interval}s)`:"External Address":"";return i.jsxs(Ap.Fragment,{children:[i.jsxs("tr",{className:"hover:bg-bg-light transition-colors",children:[i.jsx("td",{className:"px-4 py-4 text-sm font-medium text-text",children:i.jsxs("span",{className:"inline-flex items-center gap-2",children:[B,["whatsapp","voice"].includes(q.type)&&i.jsx("span",{title:q.connected?"Connected":q.statusMessage||"Disconnected",className:`inline-block w-2 h-2 rounded-full ${q.connected?"bg-green-400":"bg-red-400"}`})]})}),i.jsx("td",{className:"px-4 py-4 text-sm text-dim",children:q.type}),i.jsx("td",{className:"px-4 py-4",children:q.type==="endpoint"?i.jsx("span",{className:"text-xs text-dim",children:"—"}):i.jsxs("select",{value:q.mode||"service",onChange:Ve=>_s(B,Ve.target.value),className:"text-xs py-1 px-2 border border-border rounded bg-bg-light text-text focus:outline-none",children:[i.jsx("option",{value:"service",children:"Service"}),i.jsx("option",{value:"groups",children:"Groups"})]})}),i.jsxs("td",{className:"px-4 py-4 font-mono text-xs text-dim",children:[ct,gt&&i.jsx("div",{className:"mt-0.5 font-sans text-primary text-[11px]",children:hl}),((Pt=q.allow_list)==null?void 0:Pt.length)>0&&i.jsxs("div",{className:"mt-0.5 font-sans text-[11px] text-yellow",children:[q.allow_list.length," allowed number",q.allow_list.length>1?"s":""]})]}),i.jsx("td",{className:"px-4 py-4 text-xs text-dim",children:We.length>0?We.join(", "):"—"}),i.jsx("td",{className:"px-4 py-4",children:q.mode==="groups"||We.length>1?i.jsxs("select",{defaultValue:q.unmatched||"",onChange:Ve=>fi(B,Ve.target.value),className:"text-xs py-1 px-2 border border-border rounded bg-bg-light text-text focus:outline-none",children:[i.jsx("option",{value:"",children:"Ignore (default)"}),i.jsx("option",{value:"list",children:"List services"}),i.jsx("option",{value:"ignore",children:"Ignore"})]}):i.jsx("span",{className:"text-xs text-dim",children:"—"})}),i.jsxs("td",{className:"px-4 py-4 text-right whitespace-nowrap space-x-1",children:[q.type==="whatsapp"&&!q.connected&&i.jsx(vt,{icon:"link",label:"Connect",onClick:()=>Oe(B)}),["whatsapp","sms","voice"].includes(q.type)&&i.jsx(vt,{icon:"shield_person",label:"Allow List",onClick:()=>{var Ve;if(Xe===B){De(null);return}De(B),ue((q.allow_list||[]).join(", ")),St(!!((Ve=q.allow_list)!=null&&Ve.length))}}),gt&&i.jsx(vt,{icon:"settings",label:"Settings",onClick:()=>U(m===B?null:B)}),il&&i.jsx(vt,{icon:"settings",label:"Settings",onClick:()=>J(X===B?null:B)}),q.type==="email"&&q.provider==="gmail"&&i.jsx(vt,{icon:"key",label:"Authenticate",onClick:()=>Ft(B)}),q.type==="endpoint"&&q.secret&&i.jsx(vt,{icon:pt===B?"check":"content_copy",label:pt===B?"Copied!":"Copy Secret",onClick:async()=>{try{const sl=await(await te(F+"/api/config/channels/"+encodeURIComponent(B)+"/secret")).json();sl.secret&&(navigator.clipboard.writeText(sl.secret),zt(B),setTimeout(()=>zt(null),1500))}catch{}}}),i.jsx(vt,{icon:"delete",label:"Remove",onClick:()=>Cs(B,We),danger:!0})]})]}),m===B&&i.jsx(jx,{name:B,currentMode:Lt,currentInterval:q.poll_interval||60,onClose:()=>U(null),loadConfig:o}),X===B&&il&&i.jsx(Nx,{name:B,ch:q,onClose:()=>J(null),loadConfig:o}),Xe===B&&i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"px-6 py-4",children:i.jsxs("div",{className:"bg-bg-light border border-border rounded-lg p-4 space-y-3",children:[i.jsxs("div",{className:"text-sm font-semibold text-text",children:["Allow List — ",B]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm text-text cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:Ee,onChange:Ve=>St(Ve.target.checked),className:"accent-primary"}),"Restrict to specific numbers"]}),Ee&&i.jsx("textarea",{value:ht,onChange:Ve=>ue(Ve.target.value),placeholder:"Comma-separated phone numbers, e.g. +972541234567, +12025551234",rows:2,className:Bt+" resize-y"}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("button",{onClick:async()=>{const Ve=Ee&&ht.trim()?ht.split(",").map(sl=>sl.trim()).filter(Boolean):[];await te(F+"/api/config/channels/"+encodeURIComponent(B),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({unmatched:q.unmatched||null,allow_list:Ve.length>0?Ve:[]})}),De(null),o()},className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",children:"Save"}),i.jsx("button",{onClick:()=>De(null),className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"})]})]})})})]},B)})})]})})}),i.jsxs("div",{className:"bg-surface border border-border rounded-xl p-5 shadow-sm mt-4",children:[i.jsx("h3",{className:"text-sm font-semibold text-text mb-1",children:"Add Channel"}),x==="pick"?i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-dim mb-4",children:"Choose the type of channel to add."}),i.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(130px,1fr))] gap-3",children:[[{type:"whatsapp",label:"WhatsApp",sub:"Pair via QR code"},{type:"telegram",label:"Telegram",sub:"Bot via BotFather"},{type:"sms-twilio",label:"SMS",sub:"Twilio"},{type:"voice-twilio",label:"Voice",sub:"Twilio"},{type:"email-gmail",label:"Email",sub:"Gmail (OAuth2)"},{type:"email-resend",label:"Email",sub:"Resend"},{type:"endpoint",label:"Endpoint",sub:"HTTP Webhook"}].map(B=>{const q=B.type==="whatsapp"&&!M;return i.jsxs("div",{onClick:()=>!q&&kl(B.type),className:`flex flex-col items-center gap-2 p-4 border-2 rounded-xl text-center transition-all ${q?"bg-bg-light border-border opacity-50 cursor-not-allowed":"bg-bg-light border-border cursor-pointer hover:border-primary hover:bg-highlight"}`,children:[i.jsx("div",{className:"w-8 h-8 flex items-center justify-center",children:Pf[B.type.split("-")[0]]||Pf[B.type]}),i.jsx("div",{className:"text-sm font-medium text-text",children:B.label}),i.jsx("div",{className:"text-[11px] text-dim leading-tight",children:q?"Not installed":B.sub})]},B.type)}),!M&&i.jsxs("div",{className:"col-span-full mt-2 p-3 bg-bg-light border border-border rounded-lg",children:[i.jsxs("div",{className:"text-xs text-dim mb-2",children:["WhatsApp requires the ",i.jsx("code",{className:"px-1 py-0.5 rounded bg-surface text-text",children:"@whiskeysockets/baileys"})," package, which is not currently installed."]}),i.jsx("div",{className:"text-xs text-dim mb-2",children:"Run this in the directory you start ChannelKit from:"}),i.jsx("div",{className:"bg-surface border border-border rounded px-3 py-2 font-mono text-xs text-text select-all mb-2",children:"npm install @whiskeysockets/baileys"}),i.jsxs("div",{className:"text-xs text-dim mb-1",children:["If ChannelKit is installed globally, use ",i.jsx("code",{className:"px-1 py-0.5 rounded bg-surface text-text",children:"npm install -g @whiskeysockets/baileys"})," instead."]}),i.jsx("div",{className:"text-xs text-dim",children:"Then restart ChannelKit. Note: this package is licensed under GPL-3.0."})]})]})]}):i.jsxs("div",{children:[i.jsxs("button",{onClick:fl,className:"flex items-center gap-1 text-sm text-primary hover:underline mb-3 bg-transparent border-none cursor-pointer p-0",children:[i.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_back"}),"Back to channel types"]}),i.jsxs("p",{className:"text-xs text-dim mb-3",children:["Configure your new ",bx[v]||v," channel."]}),i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsx("input",{value:D,onChange:B=>G(B.target.value),placeholder:"Channel name (e.g. mywhatsapp)",className:Bt,autoFocus:!0}),xt.fields.map(B=>i.jsx("input",{value:z[B.key]||"",onChange:q=>Hl(B.key,q.target.value),placeholder:at(B),className:Bt},B.key))]}),ml&&i.jsx(Ex,{typeKey:v,fieldValues:z,channels:r,twilioDefaults:d,onSelect:B=>Hl("number",B),onNumbersFetched:B=>dl(B.map(q=>q.phoneNumber))}),ml&&!fe&&i.jsx("div",{className:"mb-3",children:i.jsx("button",{onClick:()=>_(!0),className:"text-xs text-primary underline bg-transparent border-none cursor-pointer p-0",children:"or buy a new number from Twilio"})}),ml&&fe&&i.jsx(Tx,{typeKey:v,fieldValues:z,onNumberPurchased:B=>{Hl("number",B),_(!1)},onClose:()=>_(!1)}),v==="whatsapp"&&((bt=z.number)==null?void 0:bt.trim())&&Rl.includes(z.number.trim())&&i.jsxs("div",{className:"mb-3 p-3 bg-bg-light border border-border rounded-lg flex items-center justify-between",children:[i.jsxs("div",{className:"text-xs text-dim",children:[i.jsx("span",{className:"font-mono font-medium text-text",children:z.number.trim()})," is in your Twilio account. Listen for incoming SMS to catch a verification code."]}),i.jsx("button",{onClick:()=>As(z.number.trim()),className:"ml-3 px-3 py-1.5 text-xs font-semibold text-white bg-primary rounded-lg hover:bg-primary-hover transition-colors whitespace-nowrap",children:"Listen to SMS"})]}),v==="sms-twilio"&&i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsxs("select",{value:Y,onChange:B=>Q(B.target.value),className:Ml,children:[i.jsx("option",{value:"polling",children:"Polling — fetch messages at regular intervals"}),i.jsx("option",{value:"webhook",children:"External Address — receive webhooks from Twilio"})]}),Y==="polling"&&i.jsx("input",{type:"number",value:Z,onChange:B=>oe(B.target.value),min:"5",max:"3600",placeholder:"Poll interval in seconds (default: 60)",className:Bt}),Y==="webhook"&&!S&&i.jsxs("div",{className:"p-3 rounded-lg text-xs bg-yellow-light text-yellow border border-yellow/20",children:["Service is not externalized. Please ",i.jsx("strong",{children:"Externalize"})," first."]})]}),v==="email-gmail"&&i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsx("input",{type:"number",value:Ae,onChange:B=>K(B.target.value),min:"5",max:"3600",placeholder:"Poll interval in seconds (default: 30)",className:Bt}),i.jsx("p",{className:"text-xs text-dim",children:"On first start, a browser window will open for OAuth consent."})]}),v==="email-resend"&&i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsxs("select",{value:$,onChange:B=>ze(B.target.value),className:Ml,children:[i.jsx("option",{value:"webhook",children:"Webhook — Resend forwards emails to your endpoint"}),i.jsx("option",{value:"polling",children:"Polling — fetch emails at regular intervals"})]}),$==="polling"&&i.jsx("input",{type:"number",value:ye,onChange:B=>pe(B.target.value),min:"5",max:"3600",placeholder:"Poll interval in seconds (default: 30)",className:Bt})]}),v==="endpoint"&&i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsxs("select",{value:se,onChange:B=>me(B.target.value),className:Ml,children:[i.jsx("option",{value:"sync",children:"Sync — wait for service response and return it"}),i.jsx("option",{value:"async",children:"Async — return 200 immediately (fire-and-forget)"})]}),se==="sync"&&i.jsx("input",{type:"number",value:be,onChange:B=>Je(B.target.value),min:"5",max:"120",placeholder:"Response timeout in seconds (default: 30)",className:Bt})]}),["whatsapp","sms-twilio","voice-twilio"].includes(v)&&i.jsxs("div",{className:"space-y-2 mb-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm text-text cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:Ee,onChange:B=>St(B.target.checked),className:"accent-primary"}),"Restrict to specific numbers (allow list)"]}),Ee&&i.jsx("textarea",{value:ht,onChange:B=>ue(B.target.value),placeholder:"Comma-separated phone numbers, e.g. +972541234567, +12025551234",rows:2,className:Bt+" resize-y"})]}),v!=="endpoint"&&i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsxs("select",{value:ie,onChange:B=>ae(B.target.value),className:Ml,children:[i.jsx("option",{value:"service",children:"Service mode — single service, no codes needed"}),i.jsx("option",{value:"groups",children:"Groups mode — multiple services via codes or commands"})]}),ie==="groups"&&i.jsxs("select",{value:ee,onChange:B=>W(B.target.value),className:Ml,children:[i.jsx("option",{value:"ignore",children:"Unmatched messages: Ignore silently"}),i.jsx("option",{value:"list",children:"Unmatched messages: Reply with service list"})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:_a,className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",children:"Add Channel"}),i.jsx("span",{className:"text-xs text-dim",children:xt.note})]})]})]}),L&&i.jsx(yx,{channel:L,onClose:()=>I(null)}),V&&i.jsx(vx,{channel:V,qrMessage:E,onClose:()=>ne(null)}),oa&&i.jsx(Sx,{number:oa,smsListenMessage:w,onClose:()=>al(null)})]})}function _x(){const{serverLogLines:o}=mt(),r=Dl(),[y,d]=h.useState(!0),S=h.useRef(null);h.useEffect(()=>{te(F+"/api/server-logs").then(w=>w.json()).then(w=>r({type:"SET_SERVER_LOGS",payload:w})).catch(()=>{})},[r]),h.useEffect(()=>{y&&S.current&&(S.current.scrollTop=S.current.scrollHeight)},[o,y]);async function E(){await te(F+"/api/server-logs",{method:"DELETE"}),r({type:"SET_SERVER_LOGS",payload:[]})}return i.jsxs("div",{className:"bg-surface border border-border rounded-xl shadow-sm overflow-hidden",children:[i.jsxs("div",{className:"px-5 py-3 flex items-center gap-4 border-b border-border",children:[i.jsx("button",{onClick:E,className:"px-3 py-1.5 text-xs font-medium border border-border rounded-lg text-dim hover:bg-bg-light transition-colors",children:"Clear"}),i.jsxs("label",{className:"flex items-center gap-2 text-xs text-dim cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:y,onChange:w=>d(w.target.checked),className:"rounded border-border text-primary focus:ring-primary"}),"Auto-scroll"]}),i.jsxs("span",{className:"text-xs text-dim",children:[o.length," lines"]})]}),i.jsx("div",{ref:S,className:"server-log-area bg-[#1e1e1e] text-[#d4d4d4] p-5 h-[calc(100vh-300px)] overflow-y-auto font-mono text-xs leading-relaxed",children:o.length===0?i.jsx("div",{className:"text-[#666]",children:"No log output captured yet."}):o.map((w,M)=>i.jsx("div",{className:`whitespace-pre-wrap break-all ${w.level==="stderr"?"text-[#f48771]":""}`,children:w.text},M))})]})}const oi=[{key:"twilio_account_sid",label:"Account SID",placeholder:"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",group:"twilio"},{key:"twilio_auth_token",label:"Auth Token",placeholder:"Auth Token",group:"twilio"},{key:"google_api_key",label:"Google API Key",placeholder:"AIza...",sub:"(STT & TTS)",group:"api"},{key:"elevenlabs_api_key",label:"ElevenLabs API Key",placeholder:"sk_...",sub:"(TTS)",group:"api"},{key:"openai_api_key",label:"OpenAI API Key",placeholder:"sk-...",sub:"(Whisper STT & TTS)",group:"api"},{key:"deepgram_api_key",label:"Deepgram API Key",placeholder:"Deepgram API key",sub:"(STT)",group:"api"},{key:"anthropic_api_key",label:"Anthropic API Key",placeholder:"sk-ant-...",sub:"(AI Formatting)",group:"api"},{key:"mcp_secret",label:"MCP Secret",placeholder:"Bearer token for MCP access",sub:"(required for external access)",group:"security"}];function Xu({label:o,placeholder:r,sub:y,value:d,onChange:S}){const[E,w]=h.useState(!1);return i.jsxs("div",{children:[i.jsxs("label",{className:"text-xs font-medium block mb-1 text-text",children:[o,y&&i.jsxs("span",{className:"text-dim font-normal",children:[" ",y]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:E?"text":"password",placeholder:r,value:d,onChange:M=>S(M.target.value),autoComplete:"off","data-1p-ignore":!0,className:"w-full py-2 pl-3 pr-14 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary"}),i.jsx("button",{onClick:()=>w(!E),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-dim hover:text-text bg-transparent border-none cursor-pointer px-2 py-1",children:E?"hide":"show"})]})]})}function Ax(){const{settings:o}=mt(),r=Dl(),[y,d]=h.useState({}),[S,E]=h.useState({}),[w,M]=h.useState(""),[b,x]=h.useState(""),[k,v]=h.useState(""),[j,D]=h.useState(""),[G,z]=h.useState(!0),[de,ie]=h.useState(!0),[ae,ee]=h.useState("");h.useEffect(()=>{W()},[]);async function W(){try{const fe=await(await te(F+"/api/settings")).json(),_=fe.settings||{};r({type:"SET_SETTINGS",payload:_});const L={};for(const ne of oi)L[ne.key]=_[ne.key]||"";d(L),E({...L}),oe(!!_.allow_local_webhooks),ze(!!_.allow_local_webhooks);const I=String(fe.port||4e3);v(I),D(I);const V=fe.autoUpdate!==!1;z(V),ie(V);try{const m=await(await te(F+"/api/update/status")).json();m.currentVersion&&ee(m.currentVersion)}catch{}}catch(K){console.error("Failed to load settings",K)}}async function Y(){const K={};for(const fe of oi){const _=(y[fe.key]||"").trim();_!==(S[fe.key]||"")&&(K[fe.key]=_)}if(Z!==$&&(K.allow_local_webhooks=Z),k!==j&&(K.port=parseInt(k,10)||4e3),G!==de&&(K.auto_update=G),Object.keys(K).length===0){M("No changes to save"),x("text-dim"),setTimeout(()=>M(""),2e3);return}try{const fe=await te(F+"/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)});if(!fe.ok)throw new Error((await fe.json()).error||"Save failed");const _=k!==j;M(_?"Saved — restart required for port change":"Saved"),x(_?"text-yellow-400":"text-green"),setTimeout(()=>M(""),_?5e3:2e3),W();try{const I=await(await te(F+"/api/settings/twilio-defaults")).json();r({type:"SET_TWILIO_DEFAULTS",payload:{sid:I.account_sid||"",tok:I.auth_token||""}})}catch{}}catch(fe){M(fe.message),x("text-red")}}function Q(K,fe){d(_=>({..._,[K]:fe}))}const[Z,oe]=h.useState(!1),[$,ze]=h.useState(!1),ye=oi.filter(K=>K.group==="twilio"),pe=oi.filter(K=>K.group==="api"),Ae=oi.filter(K=>K.group==="security");return i.jsx("div",{className:"max-w-xl mx-auto py-6",children:i.jsxs("div",{className:"bg-surface border border-border rounded-xl p-6 shadow-sm space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-text mb-1",children:"Server"}),i.jsx("p",{className:"text-xs text-dim mb-4",children:"General server configuration."}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"text-xs font-medium block mb-1 text-text",children:["Port ",i.jsx("span",{className:"text-dim font-normal",children:"(requires restart)"})]}),i.jsx("input",{type:"number",min:"1",max:"65535",placeholder:"4000",value:k,onChange:K=>v(K.target.value),className:"w-32 py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary"})]}),i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:G,onChange:K=>z(K.target.checked),className:"w-4 h-4 rounded border-border text-primary focus:ring-primary cursor-pointer"}),i.jsxs("div",{children:[i.jsxs("span",{className:"text-xs font-medium text-text",children:["Auto-update",ae&&i.jsxs("span",{className:"text-dim font-normal ml-2",children:["v",ae]})]}),i.jsx("p",{className:"text-[11px] text-dim mt-0.5",children:"Automatically check for and install new versions."})]})]})]})]}),i.jsxs("div",{className:"border-t border-border pt-6",children:[i.jsx("h3",{className:"text-sm font-semibold text-text mb-1",children:"Twilio Defaults"}),i.jsx("p",{className:"text-xs text-dim mb-4",children:"Default credentials used when adding SMS or Voice channels."}),i.jsx("div",{className:"space-y-3",children:ye.map(K=>i.jsx(Xu,{label:K.label,placeholder:K.placeholder,sub:K.sub,value:y[K.key]||"",onChange:fe=>Q(K.key,fe)},K.key))})]}),i.jsxs("div",{className:"border-t border-border pt-6",children:[i.jsx("h3",{className:"text-sm font-semibold text-text mb-1",children:"API Keys"}),i.jsx("p",{className:"text-xs text-dim mb-4",children:"Keys for speech-to-text and text-to-speech providers."}),i.jsx("div",{className:"space-y-3",children:pe.map(K=>i.jsx(Xu,{label:K.label,placeholder:K.placeholder,sub:K.sub,value:y[K.key]||"",onChange:fe=>Q(K.key,fe)},K.key))})]}),i.jsxs("div",{className:"border-t border-border pt-6",children:[i.jsx("h3",{className:"text-sm font-semibold text-text mb-1",children:"Security"}),i.jsx("p",{className:"text-xs text-dim mb-4",children:"Authentication for MCP server access. Clients must pass this as a Bearer token."}),i.jsx("div",{className:"space-y-3",children:Ae.map(K=>i.jsx(Xu,{label:K.label,placeholder:K.placeholder,sub:K.sub,value:y[K.key]||"",onChange:fe=>Q(K.key,fe)},K.key))}),i.jsxs("label",{className:"flex items-center gap-3 mt-4 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:Z,onChange:K=>oe(K.target.checked),className:"w-4 h-4 rounded border-border text-primary focus:ring-primary cursor-pointer"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-xs font-medium text-text",children:"Allow local webhooks"}),i.jsx("p",{className:"text-[11px] text-dim mt-0.5",children:"Allow webhooks to localhost and private IPs (e.g. 192.168.x.x, 10.x.x.x). Cloud metadata endpoints are always blocked."})]})]})]}),i.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[i.jsx("button",{onClick:Y,className:"px-5 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors",children:"Save Settings"}),w&&i.jsx("span",{className:`text-xs ${b}`,children:w})]})]})})}function em(o){return o.replace(/[^0-9]/g,"")+"@s.whatsapp.net"}function wx({onClose:o}){const[r,y]=h.useState([]),[d,S]=h.useState(""),[E,w]=h.useState(""),[M,b]=h.useState(""),[x,k]=h.useState(""),[v,j]=h.useState(""),[D,G]=h.useState(!1);h.useEffect(()=>{te(F+"/api/config").then(W=>W.json()).then(W=>{const Y=Object.entries(W.channels).filter(([,Z])=>Z.type==="whatsapp").map(([Z,oe])=>({name:Z,connected:oe.connected}));y(Y);const Q=Y.find(Z=>Z.connected);Q?S(Q.name):Y.length>0&&S(Y[0].name)}).catch(()=>{})},[]);async function z(){if(!d){k("Select a channel"),j("text-red");return}const W=r.find(Q=>Q.name===d);if(W&&!W.connected){k("Channel is not connected"),j("text-red");return}if(!E){k("Enter a phone number"),j("text-red");return}if(!M){k("Enter a message"),j("text-red");return}G(!0),k("Sending..."),j("text-dim");const Y=em(E);try{const Q=await te(F+"/api/send/"+encodeURIComponent(d)+"/"+encodeURIComponent(Y),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:M})}),Z=await Q.json();Q.ok?(k("Message sent!"),j("text-green"),b("")):(k(Z.error||"Failed to send"),j("text-red"))}catch(Q){k("Error: "+Q.message),j("text-red")}finally{G(!1)}}const de=em(E||"+972501234567"),ie=ri(),ae=`curl -X POST ${F}/api/send/${d||"whatsapp"}/${encodeURIComponent(de)} \\
|
|
79
|
+
-H "Content-Type: application/json" \\${ie?`
|
|
80
|
+
-H "Authorization: Bearer <your_api_secret>" \\`:""}
|
|
81
|
+
-d '{"text": "Hello from the API!"}'`,ee=`await fetch("${F}/api/send/${d||"whatsapp"}/${encodeURIComponent(de)}", {
|
|
82
|
+
method: "POST",
|
|
83
|
+
headers: {${ie?`
|
|
84
|
+
"Authorization": "Bearer <your_api_secret>",`:""}
|
|
85
|
+
"Content-Type": "application/json"
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify({ text: "Hello from the API!" })
|
|
88
|
+
});`;return i.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center",onClick:W=>{W.target===W.currentTarget&&o()},children:i.jsxs("div",{className:"bg-surface rounded-xl p-7 max-w-lg w-[90%] shadow-2xl",children:[i.jsx("h3",{className:"text-base font-semibold text-text mb-4",children:"Send WhatsApp Message"}),i.jsx("label",{className:"block text-[11px] font-semibold text-dim uppercase tracking-wider mb-1",children:"Channel"}),i.jsxs("select",{value:d,onChange:W=>S(W.target.value),className:"w-full mb-3 py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary",children:[r.length===0&&i.jsx("option",{value:"",children:"No WhatsApp channels"}),r.map(W=>i.jsxs("option",{value:W.name,disabled:!W.connected,children:[W.name,W.connected?"":" (disconnected)"]},W.name))]}),i.jsx("label",{className:"block text-[11px] font-semibold text-dim uppercase tracking-wider mb-1",children:"Phone number"}),i.jsx("input",{type:"tel",value:E,onChange:W=>w(W.target.value),placeholder:"+972501234567",autoFocus:!0,className:"w-full mb-3 py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary"}),i.jsx("label",{className:"block text-[11px] font-semibold text-dim uppercase tracking-wider mb-1",children:"Message"}),i.jsx("textarea",{value:M,onChange:W=>b(W.target.value),placeholder:"Type your message...",className:"w-full mb-4 py-2 px-3 border border-border rounded-lg text-sm bg-bg-light text-text focus:outline-none focus:border-primary resize-y min-h-[80px]"}),i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsx("button",{onClick:o,className:"px-4 py-2 border border-border rounded-lg text-sm text-dim hover:bg-bg-light transition-colors",children:"Cancel"}),i.jsx("button",{onClick:z,disabled:D,className:"px-5 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary-hover transition-colors disabled:opacity-50",children:"Send"})]}),x&&i.jsx("div",{className:`text-xs mt-3 min-h-[18px] ${v}`,children:x}),i.jsx("div",{className:"mt-4 border-t border-border pt-3",children:i.jsxs("details",{children:[i.jsx("summary",{className:"text-xs text-dim font-semibold cursor-pointer",children:"API Examples"}),i.jsx("h4",{className:"text-[11px] font-semibold text-dim mt-3 mb-1",children:"cURL"}),i.jsx("pre",{className:"bg-bg-light border border-border rounded-lg p-3 text-[11px] overflow-x-auto whitespace-pre-wrap break-all leading-relaxed",children:i.jsx("code",{className:"font-mono",children:ae})}),i.jsx("h4",{className:"text-[11px] font-semibold text-dim mt-3 mb-1",children:"JavaScript"}),i.jsx("pre",{className:"bg-bg-light border border-border rounded-lg p-3 text-[11px] overflow-x-auto whitespace-pre-wrap break-all leading-relaxed",children:i.jsx("code",{className:"font-mono",children:ee})}),i.jsxs("p",{className:"text-[11px] text-dim mt-2",children:["JID format: strip non-digits from phone number, append ",i.jsx("code",{className:"bg-bg-light px-1 py-0.5 rounded font-mono",children:"@s.whatsapp.net"})]})]})})]})})}function zx(){return i.jsxs("footer",{className:"mt-auto py-8 border-t border-border flex flex-col items-center justify-center gap-4 text-dim",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"hub"}),i.jsx("span",{className:"text-sm font-bold tracking-tight",children:"ChannelKit"})]}),i.jsxs("p",{className:"text-xs",children:["© ",new Date().getFullYear()," ChannelKit. All systems operational."]})]})}function Ox({onNavigate:o}){const{channels:r,services:y}=mt(),d=Object.keys(r||{}).length,S=Object.keys(y||{}).length;return d===0?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:i.jsx("div",{className:"w-full max-w-md rounded-xl border border-border bg-surface p-8 shadow-2xl",children:i.jsxs("div",{className:"text-center space-y-4",children:[i.jsx("span",{className:"text-4xl",children:"👋"}),i.jsx("h2",{className:"text-lg font-semibold text-text",children:"Welcome to ChannelKit!"}),i.jsx("p",{className:"text-sm text-dim",children:"You don't have any channels configured yet. Add your first channel to start receiving messages."}),i.jsx("button",{onClick:()=>o("#channels"),className:"w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-white hover:bg-primary-hover transition-colors",children:"Add a Channel"})]})})}):S===0?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:i.jsx("div",{className:"w-full max-w-md rounded-xl border border-border bg-surface p-8 shadow-2xl",children:i.jsxs("div",{className:"text-center space-y-4",children:[i.jsx("span",{className:"text-4xl",children:"🔗"}),i.jsx("h2",{className:"text-lg font-semibold text-text",children:"Almost there!"}),i.jsxs("p",{className:"text-sm text-dim",children:["You have ",d," channel",d>1?"s":""," configured but no services yet. Add a service to connect your channel to your app via webhook."]}),i.jsx("button",{onClick:()=>o("#services"),className:"w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-white hover:bg-primary-hover transition-colors",children:"Add a Service"}),i.jsx("button",{onClick:()=>o(null),className:"w-full rounded-lg border border-border px-4 py-2 text-sm text-dim hover:text-text transition-colors",children:"Skip for now"})]})})}):null}const Ux=[{hash:"#logs",label:"Messages",icon:"chat"},{hash:"#services",label:"Services",icon:"dns"},{hash:"#channels",label:"Channels",icon:"alt_route"},{hash:"#server-logs",label:"Server Log",icon:"terminal"},{hash:"#settings",label:"Settings",icon:"settings"}];function tm(){return window.location.hash||"#logs"}function Mx({onLogin:o}){const[r,y]=h.useState(""),[d,S]=h.useState(""),[E,w]=h.useState(!1),M=async b=>{b.preventDefault(),w(!0),S("");try{(await(await fetch(F+"/api/auth/check",{headers:{Authorization:`Bearer ${r}`}})).json()).valid?(Up(r),o()):S("Invalid secret")}catch{S("Connection failed")}w(!1)};return i.jsx("div",{className:"flex h-screen w-full items-center justify-center bg-bg-light",children:i.jsxs("form",{onSubmit:M,className:"w-full max-w-sm space-y-4 rounded-xl border border-border bg-bg p-8 shadow-lg",children:[i.jsx("h1",{className:"text-xl font-semibold text-text",children:"ChannelKit"}),i.jsx("p",{className:"text-sm text-text-muted",children:"Enter the API secret to access the dashboard."}),i.jsx("input",{type:"password",value:r,onChange:b=>y(b.target.value),placeholder:"api_secret",autoFocus:!0,className:"w-full rounded-lg border border-border bg-bg-light px-3 py-2 text-sm text-text outline-none focus:border-accent"}),d&&i.jsx("p",{className:"text-sm text-red-400",children:d}),i.jsx("button",{type:"submit",disabled:E||!r,className:"w-full rounded-lg bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:E?"Checking...":"Login"})]})})}function Dx(){const[o,r]=h.useState(tm),[y,d]=h.useState(!1),[S,E]=h.useState("checking"),[w,M]=h.useState(!1),b=Dl(),x=mt();h.useEffect(()=>{const j=ri();fetch(F+"/api/auth/check",{headers:j?{Authorization:`Bearer ${j}`}:{}}).then(D=>D.json()).then(D=>{D.required?D.valid?E("ok"):(Mp(),E("login")):E("ok")}).catch(()=>E("ok"))},[]),Rp(b),kp(b),h.useEffect(()=>{const j=()=>r(tm());return window.addEventListener("hashchange",j),()=>window.removeEventListener("hashchange",j)},[]),h.useEffect(()=>{!x.wsConnected||S!=="ok"||(te(F+"/api/settings/twilio-defaults").then(j=>j.json()).then(j=>b({type:"SET_TWILIO_DEFAULTS",payload:{sid:j.account_sid||"",tok:j.auth_token||""}})).catch(()=>{}),te(F+"/api/config").then(j=>j.json()).then(j=>{j.channels&&b({type:"SET_CONFIG",payload:{channels:j.channels,services:j.services,baileysAvailable:j.baileysAvailable}})}).catch(()=>{}),te(F+"/api/tunnel/status").then(j=>j.json()).then(j=>b({type:"SET_TUNNEL",payload:{active:j.active,url:j.url}})).catch(()=>{}),te(F+"/api/mcp/status").then(j=>j.json()).then(j=>b({type:"SET_MCP",payload:{active:j.active,url:j.url,exposeMcp:j.exposeMcp,hasSecret:j.hasSecret}})).catch(()=>{}),te(F+"/api/tunnel/config").then(j=>j.json()).then(j=>{b({type:"SET_TUNNEL_HAS_TOKEN",payload:!!j.token}),j.expose_dashboard!==void 0&&b({type:"SET_TUNNEL",payload:{exposeDashboard:j.expose_dashboard}})}).catch(()=>{}))},[x.wsConnected,S,b]),h.useEffect(()=>{x.configChanged&&te(F+"/api/config").then(j=>j.json()).then(j=>{b({type:"SET_CONFIG",payload:{channels:j.channels,services:j.services,baileysAvailable:j.baileysAvailable}})}).catch(()=>{})},[x.configChanged,b]);const k=h.useCallback(()=>te(F+"/api/config").then(j=>j.json()).then(j=>{b({type:"SET_CONFIG",payload:{channels:j.channels||{},services:j.services||{},baileysAvailable:j.baileysAvailable}})}).catch(()=>{}),[b]);if(S==="checking")return i.jsx("div",{className:"flex h-screen w-full items-center justify-center bg-bg-light text-text-muted",children:"Loading..."});if(S==="login")return i.jsx(Mx,{onLogin:()=>E("ok")});let v;switch(o){case"#services":v=i.jsx(fx,{loadConfig:k});break;case"#channels":v=i.jsx(Cx,{loadConfig:k});break;case"#server-logs":v=i.jsx(_x,{});break;case"#settings":v=i.jsx(Ax,{});break;default:v=i.jsx(tx,{onSend:()=>d(!0)})}return i.jsxs("div",{className:"relative flex h-auto min-h-screen w-full flex-col overflow-x-hidden bg-bg-light text-text",children:[i.jsx(Hp,{}),i.jsx("main",{className:"flex-1 flex flex-col items-center px-6 lg:px-10 py-6",children:i.jsxs("div",{className:"w-full max-w-7xl space-y-6",children:[i.jsx(Qp,{}),i.jsx(Wp,{}),i.jsx(Jp,{}),i.jsx(Kp,{}),i.jsx($p,{tabs:Ux,active:o}),v]})}),i.jsx(zx,{}),y&&i.jsx(wx,{onClose:()=>d(!1)}),!w&&i.jsx(Ox,{onNavigate:j=>{j&&(window.location.hash=j),M(!0)}})]})}_p.createRoot(document.getElementById("root")).render(i.jsx(Op,{children:i.jsx(Dx,{})}));export{bp as g};
|