orbitchat 3.10.9 → 3.11.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/bin/orbitchat.js +4 -0
- package/dist/assets/ChartRenderer-6ita77oC.js +97 -0
- package/dist/assets/{MermaidRenderer-yw6DgH3b.js → MermaidRenderer-B_R73JsW.js} +47 -47
- package/dist/assets/MusicRenderer-CPyadT-W.js +18 -0
- package/dist/assets/SVGRenderer-Cchy5MKU.js +6 -0
- package/dist/assets/architectureDiagram-3BPJPVTR-Bz1EN93N.js +36 -0
- package/dist/assets/{blockDiagram-GPEHLZMM-SCn-DUpY.js → blockDiagram-GPEHLZMM-CHYDm_Lr.js} +2 -2
- package/dist/assets/{c4Diagram-AAUBKEIU-CD0XXb4K.js → c4Diagram-AAUBKEIU-B_6S0PMo.js} +4 -4
- package/dist/assets/channel-CWHSY5eE.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-D1ecF70l.js → chunk-2J33WTMH-BV3EfJJt.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-BdC2_BbM.js → chunk-4BX2VUAB-BcKFg9ac.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-EK7W6T2M.js → chunk-55IACEB6-CxpA0yYo.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-CcXyDAeg.js → chunk-727SXJPM-C6ztUlOi.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-DW6XiznW.js → chunk-AQP2D5EJ-D0QacfL_.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-CPehXR20.js → chunk-FMBD7UC4-BpZP0Y5U.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-CSSdlZau.js → chunk-ND2GUHAM-CIMv0vkh.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-DqF1rB9S.js → chunk-QZHKN3VN-BLoQ7vNo.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-BwRqrNXe.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-BwRqrNXe.js +1 -0
- package/dist/assets/cose-bilkent-S5V4N54A-mbAzpJrA.js +1 -0
- package/dist/assets/dagre-BM42HDAG-BQ7-MHMw.js +4 -0
- package/dist/assets/diagram-2AECGRRQ-C0ZixFtN.js +43 -0
- package/dist/assets/diagram-5GNKFQAL-DBgq4hcl.js +10 -0
- package/dist/assets/{diagram-KO2AKTUF-PtoEeRz1.js → diagram-KO2AKTUF-CqwtJ8Ej.js} +2 -2
- package/dist/assets/diagram-LMA3HP47-D6J87aBh.js +24 -0
- package/dist/assets/diagram-OG6HWLK6-Bf54QS67.js +24 -0
- package/dist/assets/{erDiagram-TEJ5UH35-BsN2y1Xk.js → erDiagram-TEJ5UH35-qNkhON0R.js} +13 -13
- package/dist/assets/{flowDiagram-I6XJVG4X-Cq2OCvg1.js → flowDiagram-I6XJVG4X-BwQGcinJ.js} +2 -2
- package/dist/assets/{ganttDiagram-6RSMTGT7-jqEV7dNL.js → ganttDiagram-6RSMTGT7-B-WPdey_.js} +2 -2
- package/dist/assets/gitGraphDiagram-PVQCEYII-DFG0aAjb.js +106 -0
- package/dist/assets/index-DWeVNozJ.js +379 -0
- package/dist/assets/{index-ADlI5-NQ.css → index-UF7Fwxkp.css} +1 -1
- package/dist/assets/infoDiagram-5YYISTIA-C02VmOAb.js +2 -0
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-D9KfSIa7.js → ishikawaDiagram-YF4QCWOH-Btfoip0T.js} +2 -2
- package/dist/assets/{journeyDiagram-JHISSGLW-tDXNol4d.js → journeyDiagram-JHISSGLW-MVzNSI30.js} +4 -4
- package/dist/assets/{kanban-definition-UN3LZRKU-DBwlSBF_.js → kanban-definition-UN3LZRKU-BnLLL1jo.js} +9 -9
- package/dist/assets/{mindmap-definition-RKZ34NQL-DnqCIXkX.js → mindmap-definition-RKZ34NQL-tn7nCqb-.js} +2 -2
- package/dist/assets/pieDiagram-4H26LBE5-CHgnNebB.js +30 -0
- package/dist/assets/{quadrantDiagram-W4KKPZXB-CAZOzJOz.js → quadrantDiagram-W4KKPZXB-Bm7UohUT.js} +2 -2
- package/dist/assets/{requirementDiagram-4Y6WPE33-Ji0UfPIj.js → requirementDiagram-4Y6WPE33-BP-byfJK.js} +2 -2
- package/dist/assets/{sankeyDiagram-5OEKKPKP-Bw7GXHmh.js → sankeyDiagram-5OEKKPKP-CxvcmFYi.js} +2 -2
- package/dist/assets/{sequenceDiagram-3UESZ5HK-m5wt325o.js → sequenceDiagram-3UESZ5HK-BFEVEsXC.js} +14 -14
- package/dist/assets/stateDiagram-AJRCARHV-DEYpacKC.js +1 -0
- package/dist/assets/stateDiagram-v2-BHNVJYJU-BBm-kMbL.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-f8uHcy4Y.js → timeline-definition-PNZ67QCA-IXjMR4fY.js} +2 -2
- package/dist/assets/{vendor-auth-CF3lY_Q5.js → vendor-auth-BWxE55Ta.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-CuKQ09R1.js → vennDiagram-CIIHVFJN-DznHQ1BW.js} +2 -2
- package/dist/assets/{wardleyDiagram-YWT4CUSO-iQQlbl48.js → wardleyDiagram-YWT4CUSO-BV1onbUZ.js} +2 -2
- package/dist/assets/{xychartDiagram-2RQKCTM6-B4vp4-Xh.js → xychartDiagram-2RQKCTM6-45qjdQfn.js} +2 -2
- package/dist/index.html +3 -3
- package/package.json +5 -3
- package/dist/assets/ChartRenderer-Cbyse7LH.js +0 -105
- package/dist/assets/MusicRenderer-BSZsjBll.js +0 -18
- package/dist/assets/SVGRenderer-DfMpobkd.js +0 -6
- package/dist/assets/architectureDiagram-3BPJPVTR-e2_vf6sQ.js +0 -36
- package/dist/assets/channel-zV0lWbMa.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-CcqSZVcR.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-CcqSZVcR.js +0 -1
- package/dist/assets/cose-bilkent-S5V4N54A-eZksLHnB.js +0 -1
- package/dist/assets/dagre-BM42HDAG-28cMnF2H.js +0 -4
- package/dist/assets/diagram-2AECGRRQ-BO7iijXf.js +0 -43
- package/dist/assets/diagram-5GNKFQAL-DomATWxv.js +0 -10
- package/dist/assets/diagram-LMA3HP47-CASxB1FB.js +0 -24
- package/dist/assets/diagram-OG6HWLK6-CyXBWSCx.js +0 -24
- package/dist/assets/gitGraphDiagram-PVQCEYII-CZV87DUI.js +0 -106
- package/dist/assets/index-DJM2KXCF.js +0 -366
- package/dist/assets/infoDiagram-5YYISTIA-BTT1LXE4.js +0 -2
- package/dist/assets/pieDiagram-4H26LBE5-C4OTftBM.js +0 -30
- package/dist/assets/stateDiagram-AJRCARHV-BkfQ-aKY.js +0 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-CrYKygqF.js +0 -1
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MermaidRenderer-B_R73JsW.js","assets/vendor-markdown-BRX1CUPf.js","assets/vendor-syntax-DG6Vo7Ci.js","assets/purify.es-D6gMnemd.js","assets/isPrototype-DezZrpQP.js","assets/graphExportUtils-DrqBjeAI.js","assets/SVGRenderer-Cchy5MKU.js","assets/vendor-react-BAJBiXxk.js","assets/vendor-auth-BWxE55Ta.js","assets/ChartRenderer-6ita77oC.js","assets/band-CquvqAHh.js","assets/init-Dmth1JHB.js","assets/ordinal-DILIJJjt.js","assets/linear-BGneeY6s.js","assets/defaultLocale-DX6XiGOO.js","assets/time-DJ0lCX4i.js","assets/MusicRenderer-CPyadT-W.js","assets/papaparse.min-BWA-Odol.js","assets/docx-preview-CMb3nQfR.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var px=Object.defineProperty;var hx=(i,n,r)=>n in i?px(i,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[n]=r;var Sa=(i,n,r)=>hx(i,typeof n!="symbol"?n+"":n,r);import{a as qg,r as S,j as f,k as Gd,R as Rn,M as gx,b as Dh,d as bx,e as xx}from"./vendor-markdown-BRX1CUPf.js";import{r as Hg}from"./vendor-react-BAJBiXxk.js";import{_ as On,h as yx}from"./vendor-syntax-DG6Vo7Ci.js";import{u as Pd,a as Xd,b as vx,P as Sx,M as wx,A as kx}from"./vendor-auth-BWxE55Ta.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const m of u.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&l(m)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();var gd={exports:{}},ll={},bd={exports:{}},xd={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* scheduler.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var zh;function Ax(){return zh||(zh=1,(function(i){function n(E,I){var V=E.length;E.push(I);e:for(;0<V;){var le=V-1>>>1,ue=E[le];if(0<o(ue,I))E[le]=I,E[V]=ue,V=le;else break e}}function r(E){return E.length===0?null:E[0]}function l(E){if(E.length===0)return null;var I=E[0],V=E.pop();if(V!==I){E[0]=V;e:for(var le=0,ue=E.length,oe=ue>>>1;le<oe;){var de=2*(le+1)-1,ge=E[de],ee=de+1,ye=E[ee];if(0>o(ge,V))ee<ue&&0>o(ye,ge)?(E[le]=ye,E[ee]=V,le=ee):(E[le]=ge,E[de]=V,le=de);else if(ee<ue&&0>o(ye,V))E[le]=ye,E[ee]=V,le=ee;else break e}}return I}function o(E,I){var V=E.sortIndex-I.sortIndex;return V!==0?V:E.id-I.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;i.unstable_now=function(){return u.now()}}else{var m=Date,p=m.now();i.unstable_now=function(){return m.now()-p}}var h=[],b=[],y=1,x=null,w=3,v=!1,k=!1,_=!1,j=!1,R=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function M(E){for(var I=r(b);I!==null;){if(I.callback===null)l(b);else if(I.startTime<=E)l(b),I.sortIndex=I.expirationTime,n(h,I);else break;I=r(b)}}function B(E){if(_=!1,M(E),!k)if(r(h)!==null)k=!0,H||(H=!0,J());else{var I=r(b);I!==null&&G(B,I.startTime-E)}}var H=!1,F=-1,C=5,Q=-1;function U(){return j?!0:!(i.unstable_now()-Q<C)}function Y(){if(j=!1,H){var E=i.unstable_now();Q=E;var I=!0;try{e:{k=!1,_&&(_=!1,P(F),F=-1),v=!0;var V=w;try{t:{for(M(E),x=r(h);x!==null&&!(x.expirationTime>E&&U());){var le=x.callback;if(typeof le=="function"){x.callback=null,w=x.priorityLevel;var ue=le(x.expirationTime<=E);if(E=i.unstable_now(),typeof ue=="function"){x.callback=ue,M(E),I=!0;break t}x===r(h)&&l(h),M(E)}else l(h);x=r(h)}if(x!==null)I=!0;else{var oe=r(b);oe!==null&&G(B,oe.startTime-E),I=!1}}break e}finally{x=null,w=V,v=!1}I=void 0}}finally{I?J():H=!1}}}var J;if(typeof z=="function")J=function(){z(Y)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ie=ae.port2;ae.port1.onmessage=Y,J=function(){ie.postMessage(null)}}else J=function(){R(Y,0)};function G(E,I){F=R(function(){E(i.unstable_now())},I)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(E){E.callback=null},i.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<E?Math.floor(1e3/E):5},i.unstable_getCurrentPriorityLevel=function(){return w},i.unstable_next=function(E){switch(w){case 1:case 2:case 3:var I=3;break;default:I=w}var V=w;w=I;try{return E()}finally{w=V}},i.unstable_requestPaint=function(){j=!0},i.unstable_runWithPriority=function(E,I){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var V=w;w=E;try{return I()}finally{w=V}},i.unstable_scheduleCallback=function(E,I,V){var le=i.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?le+V:le):V=le,E){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=V+ue,E={id:y++,callback:I,priorityLevel:E,startTime:V,expirationTime:ue,sortIndex:-1},V>le?(E.sortIndex=V,n(b,E),r(h)===null&&E===r(b)&&(_?(P(F),F=-1):_=!0,G(B,V-le))):(E.sortIndex=ue,n(h,E),k||v||(k=!0,H||(H=!0,J()))),E},i.unstable_shouldYield=U,i.unstable_wrapCallback=function(E){var I=w;return function(){var V=w;w=I;try{return E.apply(this,arguments)}finally{w=V}}}})(xd)),xd}var Rh;function _x(){return Rh||(Rh=1,bd.exports=Ax()),bd.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-dom-client.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var Oh;function Cx(){if(Oh)return ll;Oh=1;var i=_x(),n=qg(),r=Hg();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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 o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(u(e)!==e)throw Error(l(188))}function b(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,s=t;;){var c=a.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){a=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===a)return h(c),e;if(d===s)return h(c),t;d=d.sibling}throw Error(l(188))}if(a.return!==s.return)a=c,s=d;else{for(var g=!1,A=c.child;A;){if(A===a){g=!0,a=c,s=d;break}if(A===s){g=!0,s=c,a=d;break}A=A.sibling}if(!g){for(A=d.child;A;){if(A===a){g=!0,a=d,s=c;break}if(A===s){g=!0,s=d,a=c;break}A=A.sibling}if(!g)throw Error(l(189))}}if(a.alternate!==s)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,w=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),z=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=Y&&e[Y]||e["@@iterator"],typeof e=="function"?e:null)}var ae=Symbol.for("react.client.reference");function ie(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 _:return"Fragment";case R:return"Profiler";case j:return"StrictMode";case B:return"Suspense";case H:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case z:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case M:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case C:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var G=Array.isArray,E=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function oe(e){return{current:e}}function de(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function ge(e,t){ue++,le[ue]=e.current,e.current=t}var ee=oe(null),ye=oe(null),fe=oe(null),ve=oe(null);function ke(e,t){switch(ge(fe,t),ge(ye,e),ge(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ah(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ah(t),e=nh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}de(ee),ge(ee,e)}function Ee(){de(ee),de(ye),de(fe)}function Ze(e){e.memoizedState!==null&&ge(ve,e);var t=ee.current,a=nh(t,e.type);t!==a&&(ge(ye,e),ge(ee,a))}function ce(e){ye.current===e&&(de(ee),de(ye)),ve.current===e&&(de(ve),nl._currentValue=V)}var pe,we;function Ue(e){if(pe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||"",we=-1<a.stack.indexOf(`
|
|
19
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
+
`+pe+e+we}var Ce=!1;function he(e,t){if(!e||Ce)return"";Ce=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(X){var q=X}Reflect.construct(e,[],W)}else{try{W.call()}catch(X){q=X}e.call(W.prototype)}}else{try{throw Error()}catch(X){q=X}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(X){if(X&&q&&typeof X.stack=="string")return[X.stack,q.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),g=d[0],A=d[1];if(g&&A){var T=g.split(`
|
|
21
|
+
`),$=A.split(`
|
|
22
|
+
`);for(c=s=0;s<T.length&&!T[s].includes("DetermineComponentFrameRoot");)s++;for(;c<$.length&&!$[c].includes("DetermineComponentFrameRoot");)c++;if(s===T.length||c===$.length)for(s=T.length-1,c=$.length-1;1<=s&&0<=c&&T[s]!==$[c];)c--;for(;1<=s&&0<=c;s--,c--)if(T[s]!==$[c]){if(s!==1||c!==1)do if(s--,c--,0>c||T[s]!==$[c]){var K=`
|
|
23
|
+
`+T[s].replace(" at new "," at ");return e.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",e.displayName)),K}while(1<=s&&0<=c);break}}}finally{Ce=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ue(a):""}function Me(e,t){switch(e.tag){case 26:case 27:case 5:return Ue(e.type);case 16:return Ue("Lazy");case 13:return e.child!==t&&t!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return Ue("Activity");default:return""}}function He(e){try{var t="",a=null;do t+=Me(e,a),a=e,e=e.return;while(e);return t}catch(s){return`
|
|
24
|
+
Error generating stack: `+s.message+`
|
|
25
|
+
`+s.stack}}var De=Object.prototype.hasOwnProperty,wt=i.unstable_scheduleCallback,ut=i.unstable_cancelCallback,me=i.unstable_shouldYield,ze=i.unstable_requestPaint,rt=i.unstable_now,Be=i.unstable_getCurrentPriorityLevel,st=i.unstable_ImmediatePriority,fn=i.unstable_UserBlockingPriority,Lt=i.unstable_NormalPriority,ca=i.unstable_LowPriority,fs=i.unstable_IdlePriority,Oa=i.log,An=i.unstable_setDisableYieldValue,Ua=null,ht=null;function Jt(e){if(typeof Oa=="function"&&An(e),ht&&typeof ht.setStrictMode=="function")try{ht.setStrictMode(Ua,e)}catch{}}var Rt=Math.clz32?Math.clz32:$a,Qe=Math.log,ua=Math.LN2;function $a(e){return e>>>=0,e===0?32:31-(Qe(e)/ua|0)|0}var Te=256,Ke=262144,dt=4194304;function be(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 da(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var A=s&134217727;return A!==0?(s=A&~d,s!==0?c=be(s):(g&=A,g!==0?c=be(g):a||(a=A&~e,a!==0&&(c=be(a))))):(A=s&~d,A!==0?c=be(A):g!==0?c=be(g):a||(a=s&~e,a!==0&&(c=be(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function Ot(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ys(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 fa(){var e=dt;return dt<<=1,(dt&62914560)===0&&(dt=4194304),e}function $n(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function _n(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ms(e,t,a,s,c,d){var g=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var A=e.entanglements,T=e.expirationTimes,$=e.hiddenUpdates;for(a=g&~a;0<a;){var K=31-Rt(a),W=1<<K;A[K]=0,T[K]=-1;var q=$[K];if(q!==null)for($[K]=null,K=0;K<q.length;K++){var X=q[K];X!==null&&(X.lane&=-536870913)}a&=~W}s!==0&&Wt(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(g&~t))}function Wt(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Rt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Ks(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var s=31-Rt(a),c=1<<s;c&t|e[s]&t&&(e[s]|=t),a&=~c}}function Qs(e,t){var a=t&-t;return a=(a&42)!==0?1:Cn(a),(a&(e.suspendedLanes|t))!==0?0:a}function Cn(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 mn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ps(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:Ch(e.type))}function pn(e,t){var a=I.p;try{return I.p=e,t()}finally{I.p=a}}var Ut=Math.random().toString(36).slice(2),kt="__reactFiber$"+Ut,Kt="__reactProps$"+Ut,en="__reactContainer$"+Ut,hn="__reactEvents$"+Ut,gi="__reactListeners$"+Ut,Xt="__reactHandles$"+Ut,hs="__reactResources$"+Ut,Ia="__reactMarker$"+Ut;function gs(e){delete e[kt],delete e[Kt],delete e[hn],delete e[gi],delete e[Xt]}function ha(e){var t=e[kt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[en]||a[kt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=uh(e);e!==null;){if(a=e[kt])return a;e=uh(e)}return t}e=a,a=e.parentNode}return null}function Qt(e){if(e=e[kt]||e[en]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Fa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Tn(e){var t=e[hs];return t||(t=e[hs]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Mt(e){e[Ia]=!0}var Ba=new Set,Zs={};function qa(e,t){Ha(e,t),Ha(e+"Capture",t)}function Ha(e,t){for(Zs[e]=t,e=0;e<t.length;e++)Ba.add(t[e])}var Js=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]*$"),ne={},Ie={};function xe(e){return De.call(Ie,e)?!0:De.call(ne,e)?!1:Js.test(e)?Ie[e]=!0:(ne[e]=!0,!1)}function Pe(e,t,a){if(xe(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function ea(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function _t(e,t,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+s)}}function qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pc(e,t,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(g){a=""+g,d.call(this,g)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(g){a=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function In(e){if(!e._valueTracker){var t=Sl(e)?"checked":"value";e._valueTracker=pc(e,t,""+e[t])}}function bi(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),s="";return e&&(s=Sl(e)?e.checked?"true":"false":e.value),e=s,e!==a?(t.setValue(e),!0):!1}function bs(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 hc=/[\n"\\]/g;function ka(e){return e.replace(hc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function kr(e,t,a,s,c,d,g,A){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+qt(t)):e.value!==""+qt(t)&&(e.value=""+qt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Ar(e,g,qt(t)):a!=null?Ar(e,g,qt(a)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+qt(A):e.removeAttribute("name")}function wl(e,t,a,s,c,d,g,A){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){In(e);return}a=a!=null?""+qt(a):"",t=t!=null?""+qt(t):a,A||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=A?e.checked:!!s,e.defaultChecked=!!s,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),In(e)}function Ar(e,t,a){t==="number"&&bs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Aa(e,t,a,s){if(e=e.options,t){t={};for(var c=0;c<a.length;c++)t["$"+a[c]]=!0;for(a=0;a<e.length;a++)c=t.hasOwnProperty("$"+e[a].value),e[a].selected!==c&&(e[a].selected=c),c&&s&&(e[a].defaultSelected=!0)}else{for(a=""+qt(a),t=null,c=0;c<e.length;c++){if(e[c].value===a){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function kl(e,t,a){if(t!=null&&(t=""+qt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+qt(a):""}function xi(e,t,a,s){if(t==null){if(s!=null){if(a!=null)throw Error(l(92));if(G(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),t=a}a=qt(t),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),In(e)}function ga(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var gc=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 yi(e,t,a){var s=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,a):typeof a!="number"||a===0||gc.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function vi(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&a[c]!==s&&yi(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&yi(e,d,t[d])}function Fn(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 Si=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"]]),ba=/^[\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 Bn(e){return ba.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Va(){}var _r=null;function Nt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qn=null,gn=null;function xs(e){var t=Qt(e);if(t&&(e=t.stateNode)){var a=e[Kt]||null;e:switch(e=t.stateNode,t.type){case"input":if(kr(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+ka(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var s=a[t];if(s!==e&&s.form===e.form){var c=s[Kt]||null;if(!c)throw Error(l(90));kr(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<a.length;t++)s=a[t],s.form===e.form&&bi(s)}break e;case"textarea":kl(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Aa(e,!!a.multiple,t,!1)}}}var Cr=!1;function Ws(e,t,a){if(Cr)return e(t,a);Cr=!0;try{var s=e(t);return s}finally{if(Cr=!1,(qn!==null||gn!==null)&&(uo(),qn&&(t=qn,e=gn,gn=qn=null,xs(t),e)))for(t=0;t<e.length;t++)xs(e[t])}}function Hn(e,t){var a=e.stateNode;if(a===null)return null;var s=a[Kt]||null;if(s===null)return null;a=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var _a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),er=!1;if(_a)try{var Vn={};Object.defineProperty(Vn,"passive",{get:function(){er=!0}}),window.addEventListener("test",Vn,Vn),window.removeEventListener("test",Vn,Vn)}catch{er=!1}var Ga=null,ys=null,tr=null;function wi(){if(tr)return tr;var e,t=ys,a=t.length,s,c="value"in Ga?Ga.value:Ga.textContent,d=c.length;for(e=0;e<a&&t[e]===c[e];e++);var g=a-e;for(s=1;s<=g&&t[a-s]===c[d-s];s++);return tr=c.slice(e,1<s?1-s:void 0)}function Gn(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 Tr(){return!0}function Al(){return!1}function ma(e){function t(a,s,c,d,g){this._reactName=a,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=g,this.currentTarget=null;for(var A in e)e.hasOwnProperty(A)&&(a=e[A],this[A]=a?a(d):d[A]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Tr:Al,this.isPropagationStopped=Al,this}return x(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Tr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Tr)},persist:function(){},isPersistent:Tr}),t}var Pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nr=ma(Pn),vs=x({},Pn,{view:0,detail:0}),jr=ma(vs),ar,ki,nr,Er=x({},vs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nt,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!==nr&&(nr&&e.type==="mousemove"?(ar=e.screenX-nr.screenX,ki=e.screenY-nr.screenY):ki=ar=0,nr=e),ar)},movementY:function(e){return"movementY"in e?e.movementY:ki}}),_l=ma(Er),Cl=x({},Er,{dataTransfer:0}),bc=ma(Cl),Ai=x({},vs,{relatedTarget:0}),bn=ma(Ai),xc=x({},Pn,{animationName:0,elapsedTime:0,pseudoElement:0}),yc=ma(xc),Tl=x({},Pn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),N=ma(Tl),re=x({},Pn,{data:0}),Ne=ma(re),Fe={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ot={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"},ta={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ta[e])?!!t[e]:!1}function nt(){return gt}var Xn=x({},vs,{key:function(e){if(e.key){var t=Fe[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ot[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nt,charCode:function(e){return e.type==="keypress"?Gn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Pa=ma(Xn),Lr=x({},Er,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sr=ma(Lr),rr=x({},vs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nt}),Nl=ma(rr),xa=x({},Pn,{propertyName:0,elapsedTime:0,pseudoElement:0}),tn=ma(xa),xn=x({},Er,{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}),aa=ma(xn),vc=x({},Pn,{newState:0,oldState:0}),Sc=ma(vc),wc=[9,13,27,32],ya=_a&&"CompositionEvent"in window,Ca=null;_a&&"documentMode"in document&&(Ca=document.documentMode);var Ta=_a&&"TextEvent"in window&&!Ca,Ss=_a&&(!ya||Ca&&8<Ca&&11>=Ca),cf=" ",uf=!1;function df(e,t){switch(e){case"keyup":return wc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ff(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Mr=!1;function $0(e,t){switch(e){case"compositionend":return ff(t);case"keypress":return t.which!==32?null:(uf=!0,cf);case"textInput":return e=t.data,e===cf&&uf?null:e;default:return null}}function I0(e,t){if(Mr)return e==="compositionend"||!ya&&df(e,t)?(e=wi(),tr=ys=Ga=null,Mr=!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 Ss&&t.locale!=="ko"?null:t.data;default:return null}}var F0={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 mf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!F0[e.type]:t==="textarea"}function pf(e,t,a,s){qn?gn?gn.push(s):gn=[s]:qn=s,t=xo(t,"onChange"),0<t.length&&(a=new Nr("onChange","change",null,a,s),e.push({event:a,listeners:t}))}var _i=null,Ci=null;function B0(e){Qp(e,0)}function jl(e){var t=Fa(e);if(bi(t))return e}function hf(e,t){if(e==="change")return t}var gf=!1;if(_a){var kc;if(_a){var Ac="oninput"in document;if(!Ac){var bf=document.createElement("div");bf.setAttribute("oninput","return;"),Ac=typeof bf.oninput=="function"}kc=Ac}else kc=!1;gf=kc&&(!document.documentMode||9<document.documentMode)}function xf(){_i&&(_i.detachEvent("onpropertychange",yf),Ci=_i=null)}function yf(e){if(e.propertyName==="value"&&jl(Ci)){var t=[];pf(t,Ci,e,Nt(e)),Ws(B0,t)}}function q0(e,t,a){e==="focusin"?(xf(),_i=t,Ci=a,_i.attachEvent("onpropertychange",yf)):e==="focusout"&&xf()}function H0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jl(Ci)}function V0(e,t){if(e==="click")return jl(t)}function G0(e,t){if(e==="input"||e==="change")return jl(t)}function P0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xa=typeof Object.is=="function"?Object.is:P0;function Ti(e,t){if(Xa(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var c=a[s];if(!De.call(t,c)||!Xa(e[c],t[c]))return!1}return!0}function vf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sf(e,t){var a=vf(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=t&&s>=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=vf(a)}}function wf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=bs(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=bs(e.document)}return t}function _c(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 X0=_a&&"documentMode"in document&&11>=document.documentMode,Dr=null,Cc=null,Ni=null,Tc=!1;function Af(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tc||Dr==null||Dr!==bs(s)||(s=Dr,"selectionStart"in s&&_c(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ni&&Ti(Ni,s)||(Ni=s,s=xo(Cc,"onSelect"),0<s.length&&(t=new Nr("onSelect","select",null,t,a),e.push({event:t,listeners:s}),t.target=Dr)))}function ir(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var zr={animationend:ir("Animation","AnimationEnd"),animationiteration:ir("Animation","AnimationIteration"),animationstart:ir("Animation","AnimationStart"),transitionrun:ir("Transition","TransitionRun"),transitionstart:ir("Transition","TransitionStart"),transitioncancel:ir("Transition","TransitionCancel"),transitionend:ir("Transition","TransitionEnd")},Nc={},_f={};_a&&(_f=document.createElement("div").style,"AnimationEvent"in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),"TransitionEvent"in window||delete zr.transitionend.transition);function lr(e){if(Nc[e])return Nc[e];if(!zr[e])return e;var t=zr[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in _f)return Nc[e]=t[a];return e}var Cf=lr("animationend"),Tf=lr("animationiteration"),Nf=lr("animationstart"),Y0=lr("transitionrun"),K0=lr("transitionstart"),Q0=lr("transitioncancel"),jf=lr("transitionend"),Ef=new Map,jc="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(" ");jc.push("scrollEnd");function yn(e,t){Ef.set(e,t),qa(t,[e])}var El=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)},an=[],Rr=0,Ec=0;function Ll(){for(var e=Rr,t=Ec=Rr=0;t<e;){var a=an[t];an[t++]=null;var s=an[t];an[t++]=null;var c=an[t];an[t++]=null;var d=an[t];if(an[t++]=null,s!==null&&c!==null){var g=s.pending;g===null?c.next=c:(c.next=g.next,g.next=c),s.pending=c}d!==0&&Lf(a,c,d)}}function Ml(e,t,a,s){an[Rr++]=e,an[Rr++]=t,an[Rr++]=a,an[Rr++]=s,Ec|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Lc(e,t,a,s){return Ml(e,t,a,s),Dl(e)}function or(e,t){return Ml(e,null,null,t),Dl(e)}function Lf(e,t,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var c=!1,d=e.return;d!==null;)d.childLanes|=a,s=d.alternate,s!==null&&(s.childLanes|=a),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-Rt(a),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=a|536870912),d):null}function Dl(e){if(50<Qi)throw Qi=0,Fu=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Or={};function Z0(e,t,a,s){this.tag=e,this.key=a,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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ya(e,t,a,s){return new Z0(e,t,a,s)}function Mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Yn(e,t){var a=e.alternate;return a===null?(a=Ya(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Mf(e,t){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function zl(e,t,a,s,c,d){var g=0;if(s=e,typeof e=="function")Mc(e)&&(g=1);else if(typeof e=="string")g=ax(e,a,ee.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Ya(31,a,t,c),e.elementType=Q,e.lanes=d,e;case _:return cr(a.children,c,d,t);case j:g=8,c|=24;break;case R:return e=Ya(12,a,t,c|2),e.elementType=R,e.lanes=d,e;case B:return e=Ya(13,a,t,c),e.elementType=B,e.lanes=d,e;case H:return e=Ya(19,a,t,c),e.elementType=H,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:g=10;break e;case P:g=9;break e;case M:g=11;break e;case F:g=14;break e;case C:g=16,s=null;break e}g=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return t=Ya(g,a,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function cr(e,t,a,s){return e=Ya(7,e,s,t),e.lanes=a,e}function Dc(e,t,a){return e=Ya(6,e,null,t),e.lanes=a,e}function Df(e){var t=Ya(18,null,null,0);return t.stateNode=e,t}function zc(e,t,a){return t=Ya(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zf=new WeakMap;function nn(e,t){if(typeof e=="object"&&e!==null){var a=zf.get(e);return a!==void 0?a:(t={value:e,source:t,stack:He(t)},zf.set(e,t),t)}return{value:e,source:t,stack:He(t)}}var Ur=[],$r=0,Rl=null,ji=0,sn=[],rn=0,ws=null,Nn=1,jn="";function Kn(e,t){Ur[$r++]=ji,Ur[$r++]=Rl,Rl=e,ji=t}function Rf(e,t,a){sn[rn++]=Nn,sn[rn++]=jn,sn[rn++]=ws,ws=e;var s=Nn;e=jn;var c=32-Rt(s)-1;s&=~(1<<c),a+=1;var d=32-Rt(t)+c;if(30<d){var g=c-c%5;d=(s&(1<<g)-1).toString(32),s>>=g,c-=g,Nn=1<<32-Rt(t)+c|a<<c|s,jn=d+e}else Nn=1<<d|a<<c|s,jn=e}function Rc(e){e.return!==null&&(Kn(e,1),Rf(e,1,0))}function Oc(e){for(;e===Rl;)Rl=Ur[--$r],Ur[$r]=null,ji=Ur[--$r],Ur[$r]=null;for(;e===ws;)ws=sn[--rn],sn[rn]=null,jn=sn[--rn],sn[rn]=null,Nn=sn[--rn],sn[rn]=null}function Of(e,t){sn[rn++]=Nn,sn[rn++]=jn,sn[rn++]=ws,Nn=t.id,jn=t.overflow,ws=e}var na=null,Ct=null,at=!1,ks=null,ln=!1,Uc=Error(l(519));function As(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ei(nn(t,e)),Uc}function Uf(e){var t=e.stateNode,a=e.type,s=e.memoizedProps;switch(t[kt]=e,t[Kt]=s,a){case"dialog":We("cancel",t),We("close",t);break;case"iframe":case"object":case"embed":We("load",t);break;case"video":case"audio":for(a=0;a<Ji.length;a++)We(Ji[a],t);break;case"source":We("error",t);break;case"img":case"image":case"link":We("error",t),We("load",t);break;case"details":We("toggle",t);break;case"input":We("invalid",t),wl(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":We("invalid",t);break;case"textarea":We("invalid",t),xi(t,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||s.suppressHydrationWarning===!0||eh(t.textContent,a)?(s.popover!=null&&(We("beforetoggle",t),We("toggle",t)),s.onScroll!=null&&We("scroll",t),s.onScrollEnd!=null&&We("scrollend",t),s.onClick!=null&&(t.onclick=Va),t=!0):t=!1,t||As(e,!0)}function $f(e){for(na=e.return;na;)switch(na.tag){case 5:case 31:case 13:ln=!1;return;case 27:case 3:ln=!0;return;default:na=na.return}}function Ir(e){if(e!==na)return!1;if(!at)return $f(e),at=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||td(e.type,e.memoizedProps)),a=!a),a&&Ct&&As(e),$f(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ct=ch(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ct=ch(e)}else t===27?(t=Ct,$s(e.type)?(e=id,id=null,Ct=e):Ct=t):Ct=na?cn(e.stateNode.nextSibling):null;return!0}function ur(){Ct=na=null,at=!1}function $c(){var e=ks;return e!==null&&(La===null?La=e:La.push.apply(La,e),ks=null),e}function Ei(e){ks===null?ks=[e]:ks.push(e)}var Ic=oe(null),dr=null,Qn=null;function _s(e,t,a){ge(Ic,t._currentValue),t._currentValue=a}function Zn(e){e._currentValue=Ic.current,de(Ic)}function Fc(e,t,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===a)break;e=e.return}}function Bc(e,t,a,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var g=c.child;d=d.firstContext;e:for(;d!==null;){var A=d;d=c;for(var T=0;T<t.length;T++)if(A.context===t[T]){d.lanes|=a,A=d.alternate,A!==null&&(A.lanes|=a),Fc(d.return,a,e),s||(g=null);break e}d=A.next}}else if(c.tag===18){if(g=c.return,g===null)throw Error(l(341));g.lanes|=a,d=g.alternate,d!==null&&(d.lanes|=a),Fc(g,a,e),g=null}else g=c.child;if(g!==null)g.return=c;else for(g=c;g!==null;){if(g===e){g=null;break}if(c=g.sibling,c!==null){c.return=g.return,g=c;break}g=g.return}c=g}}function Fr(e,t,a,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var g=c.alternate;if(g===null)throw Error(l(387));if(g=g.memoizedProps,g!==null){var A=c.type;Xa(c.pendingProps.value,g.value)||(e!==null?e.push(A):e=[A])}}else if(c===ve.current){if(g=c.alternate,g===null)throw Error(l(387));g.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(nl):e=[nl])}c=c.return}e!==null&&Bc(t,e,a,s),t.flags|=262144}function Ol(e){for(e=e.firstContext;e!==null;){if(!Xa(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function fr(e){dr=e,Qn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function sa(e){return If(dr,e)}function Ul(e,t){return dr===null&&fr(e),If(e,t)}function If(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Qn===null){if(e===null)throw Error(l(308));Qn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Qn=Qn.next=t;return a}var J0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},W0=i.unstable_scheduleCallback,eb=i.unstable_NormalPriority,Ht={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qc(){return{controller:new J0,data:new Map,refCount:0}}function Li(e){e.refCount--,e.refCount===0&&W0(eb,function(){e.controller.abort()})}var Mi=null,Hc=0,Br=0,qr=null;function tb(e,t){if(Mi===null){var a=Mi=[];Hc=0,Br=Pu(),qr={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Hc++,t.then(Ff,Ff),t}function Ff(){if(--Hc===0&&Mi!==null){qr!==null&&(qr.status="fulfilled");var e=Mi;Mi=null,Br=0,qr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ab(e,t){var a=[],s={status:"pending",value:null,reason:null,then:function(c){a.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<a.length;c++)(0,a[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<a.length;c++)(0,a[c])(void 0)}),s}var Bf=E.S;E.S=function(e,t){Ap=rt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&tb(e,t),Bf!==null&&Bf(e,t)};var mr=oe(null);function Vc(){var e=mr.current;return e!==null?e:vt.pooledCache}function $l(e,t){t===null?ge(mr,mr.current):ge(mr,t.pool)}function qf(){var e=Vc();return e===null?null:{parent:Ht._currentValue,pool:e}}var Hr=Error(l(460)),Gc=Error(l(474)),Il=Error(l(542)),Fl={then:function(){}};function Hf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Vf(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Va,Va),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Pf(e),e;default:if(typeof t.status=="string")t.then(Va,Va);else{if(e=vt,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Pf(e),e}throw hr=t,Hr}}function pr(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(hr=a,Hr):a}}var hr=null;function Gf(){if(hr===null)throw Error(l(459));var e=hr;return hr=null,e}function Pf(e){if(e===Hr||e===Il)throw Error(l(483))}var Vr=null,Di=0;function Bl(e){var t=Di;return Di+=1,Vr===null&&(Vr=[]),Vf(Vr,e,t)}function zi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ql(e,t){throw t.$$typeof===w?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Xf(e){function t(D,L){if(e){var O=D.deletions;O===null?(D.deletions=[L],D.flags|=16):O.push(L)}}function a(D,L){if(!e)return null;for(;L!==null;)t(D,L),L=L.sibling;return null}function s(D){for(var L=new Map;D!==null;)D.key!==null?L.set(D.key,D):L.set(D.index,D),D=D.sibling;return L}function c(D,L){return D=Yn(D,L),D.index=0,D.sibling=null,D}function d(D,L,O){return D.index=O,e?(O=D.alternate,O!==null?(O=O.index,O<L?(D.flags|=67108866,L):O):(D.flags|=67108866,L)):(D.flags|=1048576,L)}function g(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function A(D,L,O,Z){return L===null||L.tag!==6?(L=Dc(O,D.mode,Z),L.return=D,L):(L=c(L,O),L.return=D,L)}function T(D,L,O,Z){var je=O.type;return je===_?K(D,L,O.props.children,Z,O.key):L!==null&&(L.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===C&&pr(je)===L.type)?(L=c(L,O.props),zi(L,O),L.return=D,L):(L=zl(O.type,O.key,O.props,null,D.mode,Z),zi(L,O),L.return=D,L)}function $(D,L,O,Z){return L===null||L.tag!==4||L.stateNode.containerInfo!==O.containerInfo||L.stateNode.implementation!==O.implementation?(L=zc(O,D.mode,Z),L.return=D,L):(L=c(L,O.children||[]),L.return=D,L)}function K(D,L,O,Z,je){return L===null||L.tag!==7?(L=cr(O,D.mode,Z,je),L.return=D,L):(L=c(L,O),L.return=D,L)}function W(D,L,O){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Dc(""+L,D.mode,O),L.return=D,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case v:return O=zl(L.type,L.key,L.props,null,D.mode,O),zi(O,L),O.return=D,O;case k:return L=zc(L,D.mode,O),L.return=D,L;case C:return L=pr(L),W(D,L,O)}if(G(L)||J(L))return L=cr(L,D.mode,O,null),L.return=D,L;if(typeof L.then=="function")return W(D,Bl(L),O);if(L.$$typeof===z)return W(D,Ul(D,L),O);ql(D,L)}return null}function q(D,L,O,Z){var je=L!==null?L.key:null;if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return je!==null?null:A(D,L,""+O,Z);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case v:return O.key===je?T(D,L,O,Z):null;case k:return O.key===je?$(D,L,O,Z):null;case C:return O=pr(O),q(D,L,O,Z)}if(G(O)||J(O))return je!==null?null:K(D,L,O,Z,null);if(typeof O.then=="function")return q(D,L,Bl(O),Z);if(O.$$typeof===z)return q(D,L,Ul(D,O),Z);ql(D,O)}return null}function X(D,L,O,Z,je){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return D=D.get(O)||null,A(L,D,""+Z,je);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:return D=D.get(Z.key===null?O:Z.key)||null,T(L,D,Z,je);case k:return D=D.get(Z.key===null?O:Z.key)||null,$(L,D,Z,je);case C:return Z=pr(Z),X(D,L,O,Z,je)}if(G(Z)||J(Z))return D=D.get(O)||null,K(L,D,Z,je,null);if(typeof Z.then=="function")return X(D,L,O,Bl(Z),je);if(Z.$$typeof===z)return X(D,L,O,Ul(L,Z),je);ql(L,Z)}return null}function Ae(D,L,O,Z){for(var je=null,it=null,_e=L,Xe=L=0,tt=null;_e!==null&&Xe<O.length;Xe++){_e.index>Xe?(tt=_e,_e=null):tt=_e.sibling;var lt=q(D,_e,O[Xe],Z);if(lt===null){_e===null&&(_e=tt);break}e&&_e&<.alternate===null&&t(D,_e),L=d(lt,L,Xe),it===null?je=lt:it.sibling=lt,it=lt,_e=tt}if(Xe===O.length)return a(D,_e),at&&Kn(D,Xe),je;if(_e===null){for(;Xe<O.length;Xe++)_e=W(D,O[Xe],Z),_e!==null&&(L=d(_e,L,Xe),it===null?je=_e:it.sibling=_e,it=_e);return at&&Kn(D,Xe),je}for(_e=s(_e);Xe<O.length;Xe++)tt=X(_e,D,Xe,O[Xe],Z),tt!==null&&(e&&tt.alternate!==null&&_e.delete(tt.key===null?Xe:tt.key),L=d(tt,L,Xe),it===null?je=tt:it.sibling=tt,it=tt);return e&&_e.forEach(function(Hs){return t(D,Hs)}),at&&Kn(D,Xe),je}function Oe(D,L,O,Z){if(O==null)throw Error(l(151));for(var je=null,it=null,_e=L,Xe=L=0,tt=null,lt=O.next();_e!==null&&!lt.done;Xe++,lt=O.next()){_e.index>Xe?(tt=_e,_e=null):tt=_e.sibling;var Hs=q(D,_e,lt.value,Z);if(Hs===null){_e===null&&(_e=tt);break}e&&_e&&Hs.alternate===null&&t(D,_e),L=d(Hs,L,Xe),it===null?je=Hs:it.sibling=Hs,it=Hs,_e=tt}if(lt.done)return a(D,_e),at&&Kn(D,Xe),je;if(_e===null){for(;!lt.done;Xe++,lt=O.next())lt=W(D,lt.value,Z),lt!==null&&(L=d(lt,L,Xe),it===null?je=lt:it.sibling=lt,it=lt);return at&&Kn(D,Xe),je}for(_e=s(_e);!lt.done;Xe++,lt=O.next())lt=X(_e,D,Xe,lt.value,Z),lt!==null&&(e&<.alternate!==null&&_e.delete(lt.key===null?Xe:lt.key),L=d(lt,L,Xe),it===null?je=lt:it.sibling=lt,it=lt);return e&&_e.forEach(function(mx){return t(D,mx)}),at&&Kn(D,Xe),je}function yt(D,L,O,Z){if(typeof O=="object"&&O!==null&&O.type===_&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case v:e:{for(var je=O.key;L!==null;){if(L.key===je){if(je=O.type,je===_){if(L.tag===7){a(D,L.sibling),Z=c(L,O.props.children),Z.return=D,D=Z;break e}}else if(L.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===C&&pr(je)===L.type){a(D,L.sibling),Z=c(L,O.props),zi(Z,O),Z.return=D,D=Z;break e}a(D,L);break}else t(D,L);L=L.sibling}O.type===_?(Z=cr(O.props.children,D.mode,Z,O.key),Z.return=D,D=Z):(Z=zl(O.type,O.key,O.props,null,D.mode,Z),zi(Z,O),Z.return=D,D=Z)}return g(D);case k:e:{for(je=O.key;L!==null;){if(L.key===je)if(L.tag===4&&L.stateNode.containerInfo===O.containerInfo&&L.stateNode.implementation===O.implementation){a(D,L.sibling),Z=c(L,O.children||[]),Z.return=D,D=Z;break e}else{a(D,L);break}else t(D,L);L=L.sibling}Z=zc(O,D.mode,Z),Z.return=D,D=Z}return g(D);case C:return O=pr(O),yt(D,L,O,Z)}if(G(O))return Ae(D,L,O,Z);if(J(O)){if(je=J(O),typeof je!="function")throw Error(l(150));return O=je.call(O),Oe(D,L,O,Z)}if(typeof O.then=="function")return yt(D,L,Bl(O),Z);if(O.$$typeof===z)return yt(D,L,Ul(D,O),Z);ql(D,O)}return typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint"?(O=""+O,L!==null&&L.tag===6?(a(D,L.sibling),Z=c(L,O),Z.return=D,D=Z):(a(D,L),Z=Dc(O,D.mode,Z),Z.return=D,D=Z),g(D)):a(D,L)}return function(D,L,O,Z){try{Di=0;var je=yt(D,L,O,Z);return Vr=null,je}catch(_e){if(_e===Hr||_e===Il)throw _e;var it=Ya(29,_e,null,D.mode);return it.lanes=Z,it.return=D,it}finally{}}}var gr=Xf(!0),Yf=Xf(!1),Cs=!1;function Pc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xc(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 Ts(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ns(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(ct&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Dl(e),Lf(e,null,a),t}return Ml(e,s,t,a),Dl(e)}function Ri(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Ks(e,a)}}function Yc(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var g={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=g:d=d.next=g,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Kc=!1;function Oi(){if(Kc){var e=qr;if(e!==null)throw e}}function Ui(e,t,a,s){Kc=!1;var c=e.updateQueue;Cs=!1;var d=c.firstBaseUpdate,g=c.lastBaseUpdate,A=c.shared.pending;if(A!==null){c.shared.pending=null;var T=A,$=T.next;T.next=null,g===null?d=$:g.next=$,g=T;var K=e.alternate;K!==null&&(K=K.updateQueue,A=K.lastBaseUpdate,A!==g&&(A===null?K.firstBaseUpdate=$:A.next=$,K.lastBaseUpdate=T))}if(d!==null){var W=c.baseState;g=0,K=$=T=null,A=d;do{var q=A.lane&-536870913,X=q!==A.lane;if(X?(et&q)===q:(s&q)===q){q!==0&&q===Br&&(Kc=!0),K!==null&&(K=K.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ae=e,Oe=A;q=t;var yt=a;switch(Oe.tag){case 1:if(Ae=Oe.payload,typeof Ae=="function"){W=Ae.call(yt,W,q);break e}W=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Oe.payload,q=typeof Ae=="function"?Ae.call(yt,W,q):Ae,q==null)break e;W=x({},W,q);break e;case 2:Cs=!0}}q=A.callback,q!==null&&(e.flags|=64,X&&(e.flags|=8192),X=c.callbacks,X===null?c.callbacks=[q]:X.push(q))}else X={lane:q,tag:A.tag,payload:A.payload,callback:A.callback,next:null},K===null?($=K=X,T=W):K=K.next=X,g|=q;if(A=A.next,A===null){if(A=c.shared.pending,A===null)break;X=A,A=X.next,X.next=null,c.lastBaseUpdate=X,c.shared.pending=null}}while(!0);K===null&&(T=W),c.baseState=T,c.firstBaseUpdate=$,c.lastBaseUpdate=K,d===null&&(c.shared.lanes=0),Ds|=g,e.lanes=g,e.memoizedState=W}}function Kf(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Qf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Kf(a[e],t)}var Gr=oe(null),Hl=oe(0);function Zf(e,t){e=is,ge(Hl,e),ge(Gr,t),is=e|t.baseLanes}function Qc(){ge(Hl,is),ge(Gr,Gr.current)}function Zc(){is=Hl.current,de(Gr),de(Hl)}var Ka=oe(null),on=null;function js(e){var t=e.alternate;ge($t,$t.current&1),ge(Ka,e),on===null&&(t===null||Gr.current!==null||t.memoizedState!==null)&&(on=e)}function Jc(e){ge($t,$t.current),ge(Ka,e),on===null&&(on=e)}function Jf(e){e.tag===22?(ge($t,$t.current),ge(Ka,e),on===null&&(on=e)):Es()}function Es(){ge($t,$t.current),ge(Ka,Ka.current)}function Qa(e){de(Ka),on===e&&(on=null),de($t)}var $t=oe(0);function Vl(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||sd(a)||rd(a)))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 Jn=0,Ge=null,bt=null,Vt=null,Gl=!1,Pr=!1,br=!1,Pl=0,$i=0,Xr=null,nb=0;function Dt(){throw Error(l(321))}function Wc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Xa(e[a],t[a]))return!1;return!0}function eu(e,t,a,s,c,d){return Jn=d,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Rm:hu,br=!1,d=a(s,c),br=!1,Pr&&(d=em(t,a,s,c)),Wf(e),d}function Wf(e){E.H=Bi;var t=bt!==null&&bt.next!==null;if(Jn=0,Vt=bt=Ge=null,Gl=!1,$i=0,Xr=null,t)throw Error(l(300));e===null||Gt||(e=e.dependencies,e!==null&&Ol(e)&&(Gt=!0))}function em(e,t,a,s){Ge=e;var c=0;do{if(Pr&&(Xr=null),$i=0,Pr=!1,25<=c)throw Error(l(301));if(c+=1,Vt=bt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=Om,d=t(a,s)}while(Pr);return d}function sb(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Ii(t):t,e=e.useState()[0],(bt!==null?bt.memoizedState:null)!==e&&(Ge.flags|=1024),t}function tu(){var e=Pl!==0;return Pl=0,e}function au(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function nu(e){if(Gl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Gl=!1}Jn=0,Vt=bt=Ge=null,Pr=!1,$i=Pl=0,Xr=null}function va(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ge.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function It(){if(bt===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=bt.next;var t=Vt===null?Ge.memoizedState:Vt.next;if(t!==null)Vt=t,bt=e;else{if(e===null)throw Ge.alternate===null?Error(l(467)):Error(l(310));bt=e,e={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Vt===null?Ge.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Xl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ii(e){var t=$i;return $i+=1,Xr===null&&(Xr=[]),e=Vf(Xr,e,t),t=Ge,(Vt===null?t.memoizedState:Vt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Rm:hu),e}function Yl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ii(e);if(e.$$typeof===z)return sa(e)}throw Error(l(438,String(e)))}function su(e){var t=null,a=Ge.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var s=Ge.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Xl(),Ge.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),s=0;s<e;s++)a[s]=U;return t.index++,a}function Wn(e,t){return typeof t=="function"?t(e):t}function Kl(e){var t=It();return ru(t,bt,e)}function ru(e,t,a){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=a;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var g=c.next;c.next=d.next,d.next=g}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var A=g=null,T=null,$=t,K=!1;do{var W=$.lane&-536870913;if(W!==$.lane?(et&W)===W:(Jn&W)===W){var q=$.revertLane;if(q===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),W===Br&&(K=!0);else if((Jn&q)===q){$=$.next,q===Br&&(K=!0);continue}else W={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},T===null?(A=T=W,g=d):T=T.next=W,Ge.lanes|=q,Ds|=q;W=$.action,br&&a(d,W),d=$.hasEagerState?$.eagerState:a(d,W)}else q={lane:W,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},T===null?(A=T=q,g=d):T=T.next=q,Ge.lanes|=W,Ds|=W;$=$.next}while($!==null&&$!==t);if(T===null?g=d:T.next=A,!Xa(d,e.memoizedState)&&(Gt=!0,K&&(a=qr,a!==null)))throw a;e.memoizedState=d,e.baseState=g,e.baseQueue=T,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function iu(e){var t=It(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var s=a.dispatch,c=a.pending,d=t.memoizedState;if(c!==null){a.pending=null;var g=c=c.next;do d=e(d,g.action),g=g.next;while(g!==c);Xa(d,t.memoizedState)||(Gt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),a.lastRenderedState=d}return[d,s]}function tm(e,t,a){var s=Ge,c=It(),d=at;if(d){if(a===void 0)throw Error(l(407));a=a()}else a=t();var g=!Xa((bt||c).memoizedState,a);if(g&&(c.memoizedState=a,Gt=!0),c=c.queue,cu(sm.bind(null,s,c,e),[e]),c.getSnapshot!==t||g||Vt!==null&&Vt.memoizedState.tag&1){if(s.flags|=2048,Yr(9,{destroy:void 0},nm.bind(null,s,c,a,t),null),vt===null)throw Error(l(349));d||(Jn&127)!==0||am(s,t,a)}return a}function am(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ge.updateQueue,t===null?(t=Xl(),Ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function nm(e,t,a,s){t.value=a,t.getSnapshot=s,rm(t)&&im(e)}function sm(e,t,a){return a(function(){rm(t)&&im(e)})}function rm(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Xa(e,a)}catch{return!0}}function im(e){var t=or(e,2);t!==null&&Ma(t,e,2)}function lu(e){var t=va();if(typeof e=="function"){var a=e;if(e=a(),br){Jt(!0);try{a()}finally{Jt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function lm(e,t,a,s){return e.baseState=a,ru(e,bt,typeof s=="function"?s:Wn)}function rb(e,t,a,s,c){if(Jl(e))throw Error(l(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){d.listeners.push(g)}};E.T!==null?a(!0):d.isTransition=!1,s(d),a=t.pending,a===null?(d.next=t.pending=d,om(t,d)):(d.next=a.next,t.pending=a.next=d)}}function om(e,t){var a=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,g={};E.T=g;try{var A=a(c,s),T=E.S;T!==null&&T(g,A),cm(e,t,A)}catch($){ou(e,t,$)}finally{d!==null&&g.types!==null&&(d.types=g.types),E.T=d}}else try{d=a(c,s),cm(e,t,d)}catch($){ou(e,t,$)}}function cm(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){um(e,t,s)},function(s){return ou(e,t,s)}):um(e,t,a)}function um(e,t,a){t.status="fulfilled",t.value=a,dm(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,om(e,a)))}function ou(e,t,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=a,dm(t),t=t.next;while(t!==s)}e.action=null}function dm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function fm(e,t){return t}function mm(e,t){if(at){var a=vt.formState;if(a!==null){e:{var s=Ge;if(at){if(Ct){t:{for(var c=Ct,d=ln;c.nodeType!==8;){if(!d){c=null;break t}if(c=cn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Ct=cn(c.nextSibling),s=c.data==="F!";break e}}As(s)}s=!1}s&&(t=a[0])}}return a=va(),a.memoizedState=a.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fm,lastRenderedState:t},a.queue=s,a=Mm.bind(null,Ge,s),s.dispatch=a,s=lu(!1),d=pu.bind(null,Ge,!1,s.queue),s=va(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,a=rb.bind(null,Ge,c,d,a),c.dispatch=a,s.memoizedState=e,[t,a,!1]}function pm(e){var t=It();return hm(t,bt,e)}function hm(e,t,a){if(t=ru(e,t,fm)[0],e=Kl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Ii(t)}catch(g){throw g===Hr?Il:g}else s=t;t=It();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(Ge.flags|=2048,Yr(9,{destroy:void 0},ib.bind(null,c,a),null)),[s,d,e]}function ib(e,t){e.action=t}function gm(e){var t=It(),a=bt;if(a!==null)return hm(t,a,e);It(),t=t.memoizedState,a=It();var s=a.queue.dispatch;return a.memoizedState=e,[t,s,!1]}function Yr(e,t,a,s){return e={tag:e,create:a,deps:s,inst:t,next:null},t=Ge.updateQueue,t===null&&(t=Xl(),Ge.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,t.lastEffect=e),e}function bm(){return It().memoizedState}function Ql(e,t,a,s){var c=va();Ge.flags|=e,c.memoizedState=Yr(1|t,{destroy:void 0},a,s===void 0?null:s)}function Zl(e,t,a,s){var c=It();s=s===void 0?null:s;var d=c.memoizedState.inst;bt!==null&&s!==null&&Wc(s,bt.memoizedState.deps)?c.memoizedState=Yr(t,d,a,s):(Ge.flags|=e,c.memoizedState=Yr(1|t,d,a,s))}function xm(e,t){Ql(8390656,8,e,t)}function cu(e,t){Zl(2048,8,e,t)}function lb(e){Ge.flags|=4;var t=Ge.updateQueue;if(t===null)t=Xl(),Ge.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function ym(e){var t=It().memoizedState;return lb({ref:t,nextImpl:e}),function(){if((ct&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function vm(e,t){return Zl(4,2,e,t)}function Sm(e,t){return Zl(4,4,e,t)}function wm(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function km(e,t,a){a=a!=null?a.concat([e]):null,Zl(4,4,wm.bind(null,t,e),a)}function uu(){}function Am(e,t){var a=It();t=t===void 0?null:t;var s=a.memoizedState;return t!==null&&Wc(t,s[1])?s[0]:(a.memoizedState=[e,t],e)}function _m(e,t){var a=It();t=t===void 0?null:t;var s=a.memoizedState;if(t!==null&&Wc(t,s[1]))return s[0];if(s=e(),br){Jt(!0);try{e()}finally{Jt(!1)}}return a.memoizedState=[s,t],s}function du(e,t,a){return a===void 0||(Jn&1073741824)!==0&&(et&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Cp(),Ge.lanes|=e,Ds|=e,a)}function Cm(e,t,a,s){return Xa(a,t)?a:Gr.current!==null?(e=du(e,a,s),Xa(e,t)||(Gt=!0),e):(Jn&42)===0||(Jn&1073741824)!==0&&(et&261930)===0?(Gt=!0,e.memoizedState=a):(e=Cp(),Ge.lanes|=e,Ds|=e,t)}function Tm(e,t,a,s,c){var d=I.p;I.p=d!==0&&8>d?d:8;var g=E.T,A={};E.T=A,pu(e,!1,t,a);try{var T=c(),$=E.S;if($!==null&&$(A,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var K=ab(T,s);Fi(e,t,K,Wa(e))}else Fi(e,t,s,Wa(e))}catch(W){Fi(e,t,{then:function(){},status:"rejected",reason:W},Wa())}finally{I.p=d,g!==null&&A.types!==null&&(g.types=A.types),E.T=g}}function ob(){}function fu(e,t,a,s){if(e.tag!==5)throw Error(l(476));var c=Nm(e).queue;Tm(e,c,t,V,a===null?ob:function(){return jm(e),a(s)})}function Nm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:V},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jm(e){var t=Nm(e);t.next===null&&(t=e.alternate.memoizedState),Fi(e,t.next.queue,{},Wa())}function mu(){return sa(nl)}function Em(){return It().memoizedState}function Lm(){return It().memoizedState}function cb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Wa();e=Ts(a);var s=Ns(t,e,a);s!==null&&(Ma(s,t,a),Ri(s,t,a)),t={cache:qc()},e.payload=t;return}t=t.return}}function ub(e,t,a){var s=Wa();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Jl(e)?Dm(t,a):(a=Lc(e,t,a,s),a!==null&&(Ma(a,e,s),zm(a,t,s)))}function Mm(e,t,a){var s=Wa();Fi(e,t,a,s)}function Fi(e,t,a,s){var c={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Jl(e))Dm(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var g=t.lastRenderedState,A=d(g,a);if(c.hasEagerState=!0,c.eagerState=A,Xa(A,g))return Ml(e,t,c,0),vt===null&&Ll(),!1}catch{}finally{}if(a=Lc(e,t,c,s),a!==null)return Ma(a,e,s),zm(a,t,s),!0}return!1}function pu(e,t,a,s){if(s={lane:2,revertLane:Pu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Jl(e)){if(t)throw Error(l(479))}else t=Lc(e,a,s,2),t!==null&&Ma(t,e,2)}function Jl(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Dm(e,t){Pr=Gl=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function zm(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Ks(e,a)}}var Bi={readContext:sa,use:Yl,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};Bi.useEffectEvent=Dt;var Rm={readContext:sa,use:Yl,useCallback:function(e,t){return va().memoizedState=[e,t===void 0?null:t],e},useContext:sa,useEffect:xm,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ql(4194308,4,wm.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ql(4194308,4,e,t)},useInsertionEffect:function(e,t){Ql(4,2,e,t)},useMemo:function(e,t){var a=va();t=t===void 0?null:t;var s=e();if(br){Jt(!0);try{e()}finally{Jt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=va();if(a!==void 0){var c=a(t);if(br){Jt(!0);try{a(t)}finally{Jt(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=ub.bind(null,Ge,e),[s.memoizedState,e]},useRef:function(e){var t=va();return e={current:e},t.memoizedState=e},useState:function(e){e=lu(e);var t=e.queue,a=Mm.bind(null,Ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:uu,useDeferredValue:function(e,t){var a=va();return du(a,e,t)},useTransition:function(){var e=lu(!1);return e=Tm.bind(null,Ge,e.queue,!0,!1),va().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=Ge,c=va();if(at){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),vt===null)throw Error(l(349));(et&127)!==0||am(s,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,xm(sm.bind(null,s,d,e),[e]),s.flags|=2048,Yr(9,{destroy:void 0},nm.bind(null,s,d,a,t),null),a},useId:function(){var e=va(),t=vt.identifierPrefix;if(at){var a=jn,s=Nn;a=(s&~(1<<32-Rt(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Pl++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=nb++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:mu,useFormState:mm,useActionState:mm,useOptimistic:function(e){var t=va();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=pu.bind(null,Ge,!0,a),a.dispatch=t,[e,t]},useMemoCache:su,useCacheRefresh:function(){return va().memoizedState=cb.bind(null,Ge)},useEffectEvent:function(e){var t=va(),a={impl:e};return t.memoizedState=a,function(){if((ct&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},hu={readContext:sa,use:Yl,useCallback:Am,useContext:sa,useEffect:cu,useImperativeHandle:km,useInsertionEffect:vm,useLayoutEffect:Sm,useMemo:_m,useReducer:Kl,useRef:bm,useState:function(){return Kl(Wn)},useDebugValue:uu,useDeferredValue:function(e,t){var a=It();return Cm(a,bt.memoizedState,e,t)},useTransition:function(){var e=Kl(Wn)[0],t=It().memoizedState;return[typeof e=="boolean"?e:Ii(e),t]},useSyncExternalStore:tm,useId:Em,useHostTransitionStatus:mu,useFormState:pm,useActionState:pm,useOptimistic:function(e,t){var a=It();return lm(a,bt,e,t)},useMemoCache:su,useCacheRefresh:Lm};hu.useEffectEvent=ym;var Om={readContext:sa,use:Yl,useCallback:Am,useContext:sa,useEffect:cu,useImperativeHandle:km,useInsertionEffect:vm,useLayoutEffect:Sm,useMemo:_m,useReducer:iu,useRef:bm,useState:function(){return iu(Wn)},useDebugValue:uu,useDeferredValue:function(e,t){var a=It();return bt===null?du(a,e,t):Cm(a,bt.memoizedState,e,t)},useTransition:function(){var e=iu(Wn)[0],t=It().memoizedState;return[typeof e=="boolean"?e:Ii(e),t]},useSyncExternalStore:tm,useId:Em,useHostTransitionStatus:mu,useFormState:gm,useActionState:gm,useOptimistic:function(e,t){var a=It();return bt!==null?lm(a,bt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:su,useCacheRefresh:Lm};Om.useEffectEvent=ym;function gu(e,t,a,s){t=e.memoizedState,a=a(s,t),a=a==null?t:x({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var bu={enqueueSetState:function(e,t,a){e=e._reactInternals;var s=Wa(),c=Ts(s);c.payload=t,a!=null&&(c.callback=a),t=Ns(e,c,s),t!==null&&(Ma(t,e,s),Ri(t,e,s))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var s=Wa(),c=Ts(s);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=Ns(e,c,s),t!==null&&(Ma(t,e,s),Ri(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Wa(),s=Ts(a);s.tag=2,t!=null&&(s.callback=t),t=Ns(e,s,a),t!==null&&(Ma(t,e,a),Ri(t,e,a))}};function Um(e,t,a,s,c,d,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,g):t.prototype&&t.prototype.isPureReactComponent?!Ti(a,s)||!Ti(c,d):!0}function $m(e,t,a,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,s),t.state!==e&&bu.enqueueReplaceState(t,t.state,null)}function xr(e,t){var a=t;if("ref"in t){a={};for(var s in t)s!=="ref"&&(a[s]=t[s])}if(e=e.defaultProps){a===t&&(a=x({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}function Im(e){El(e)}function Fm(e){console.error(e)}function Bm(e){El(e)}function Wl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function qm(e,t,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function xu(e,t,a){return a=Ts(a),a.tag=3,a.payload={element:null},a.callback=function(){Wl(e,t)},a}function Hm(e){return e=Ts(e),e.tag=3,e}function Vm(e,t,a,s){var c=a.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){qm(t,a,s)}}var g=a.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){qm(t,a,s),typeof c!="function"&&(zs===null?zs=new Set([this]):zs.add(this));var A=s.stack;this.componentDidCatch(s.value,{componentStack:A!==null?A:""})})}function db(e,t,a,s,c){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=a.alternate,t!==null&&Fr(t,a,c,!0),a=Ka.current,a!==null){switch(a.tag){case 31:case 13:return on===null?fo():a.alternate===null&&zt===0&&(zt=3),a.flags&=-257,a.flags|=65536,a.lanes=c,s===Fl?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([s]):t.add(s),Hu(e,s,c)),!1;case 22:return a.flags|=65536,s===Fl?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([s]):a.add(s)),Hu(e,s,c)),!1}throw Error(l(435,a.tag))}return Hu(e,s,c),fo(),!1}if(at)return t=Ka.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Uc&&(e=Error(l(422),{cause:s}),Ei(nn(e,a)))):(s!==Uc&&(t=Error(l(423),{cause:s}),Ei(nn(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=nn(s,a),c=xu(e.stateNode,s,c),Yc(e,c),zt!==4&&(zt=2)),!1;var d=Error(l(520),{cause:s});if(d=nn(d,a),Ki===null?Ki=[d]:Ki.push(d),zt!==4&&(zt=2),t===null)return!0;s=nn(s,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=xu(a.stateNode,s,e),Yc(a,e),!1;case 1:if(t=a.type,d=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(zs===null||!zs.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=Hm(c),Vm(c,e,a,s),Yc(a,c),!1}a=a.return}while(a!==null);return!1}var yu=Error(l(461)),Gt=!1;function ra(e,t,a,s){t.child=e===null?Yf(t,null,a,s):gr(t,e.child,a,s)}function Gm(e,t,a,s,c){a=a.render;var d=t.ref;if("ref"in s){var g={};for(var A in s)A!=="ref"&&(g[A]=s[A])}else g=s;return fr(t),s=eu(e,t,a,g,d,c),A=tu(),e!==null&&!Gt?(au(e,t,c),es(e,t,c)):(at&&A&&Rc(t),t.flags|=1,ra(e,t,s,c),t.child)}function Pm(e,t,a,s,c){if(e===null){var d=a.type;return typeof d=="function"&&!Mc(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,Xm(e,t,d,s,c)):(e=zl(a.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Tu(e,c)){var g=d.memoizedProps;if(a=a.compare,a=a!==null?a:Ti,a(g,s)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Yn(d,s),e.ref=t.ref,e.return=t,t.child=e}function Xm(e,t,a,s,c){if(e!==null){var d=e.memoizedProps;if(Ti(d,s)&&e.ref===t.ref)if(Gt=!1,t.pendingProps=s=d,Tu(e,c))(e.flags&131072)!==0&&(Gt=!0);else return t.lanes=e.lanes,es(e,t,c)}return vu(e,t,a,s,c)}function Ym(e,t,a,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|a:a,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return Km(e,t,d,a,s)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$l(t,d!==null?d.cachePool:null),d!==null?Zf(t,d):Qc(),Jf(t);else return s=t.lanes=536870912,Km(e,t,d!==null?d.baseLanes|a:a,a,s)}else d!==null?($l(t,d.cachePool),Zf(t,d),Es(),t.memoizedState=null):(e!==null&&$l(t,null),Qc(),Es());return ra(e,t,c,a),t.child}function qi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Km(e,t,a,s,c){var d=Vc();return d=d===null?null:{parent:Ht._currentValue,pool:d},t.memoizedState={baseLanes:a,cachePool:d},e!==null&&$l(t,null),Qc(),Jf(t),e!==null&&Fr(e,t,s,!0),t.childLanes=c,null}function eo(e,t){return t=ao({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qm(e,t,a){return gr(t,e.child,null,a),e=eo(t,t.pendingProps),e.flags|=2,Qa(t),t.memoizedState=null,e}function fb(e,t,a){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(at){if(s.mode==="hidden")return e=eo(t,s),t.lanes=536870912,qi(null,e);if(Jc(t),(e=Ct)?(e=oh(e,ln),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Nn,overflow:jn}:null,retryLane:536870912,hydrationErrors:null},a=Df(e),a.return=t,t.child=a,na=t,Ct=null)):e=null,e===null)throw As(t);return t.lanes=536870912,null}return eo(t,s)}var d=e.memoizedState;if(d!==null){var g=d.dehydrated;if(Jc(t),c)if(t.flags&256)t.flags&=-257,t=Qm(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(Gt||Fr(e,t,a,!1),c=(a&e.childLanes)!==0,Gt||c){if(s=vt,s!==null&&(g=Qs(s,a),g!==0&&g!==d.retryLane))throw d.retryLane=g,or(e,g),Ma(s,e,g),yu;fo(),t=Qm(e,t,a)}else e=d.treeContext,Ct=cn(g.nextSibling),na=t,at=!0,ks=null,ln=!1,e!==null&&Of(t,e),t=eo(t,s),t.flags|=4096;return t}return e=Yn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function to(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function vu(e,t,a,s,c){return fr(t),a=eu(e,t,a,s,void 0,c),s=tu(),e!==null&&!Gt?(au(e,t,c),es(e,t,c)):(at&&s&&Rc(t),t.flags|=1,ra(e,t,a,c),t.child)}function Zm(e,t,a,s,c,d){return fr(t),t.updateQueue=null,a=em(t,s,a,c),Wf(e),s=tu(),e!==null&&!Gt?(au(e,t,d),es(e,t,d)):(at&&s&&Rc(t),t.flags|=1,ra(e,t,a,d),t.child)}function Jm(e,t,a,s,c){if(fr(t),t.stateNode===null){var d=Or,g=a.contextType;typeof g=="object"&&g!==null&&(d=sa(g)),d=new a(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=bu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},Pc(t),g=a.contextType,d.context=typeof g=="object"&&g!==null?sa(g):Or,d.state=t.memoizedState,g=a.getDerivedStateFromProps,typeof g=="function"&&(gu(t,a,g,s),d.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(g=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),g!==d.state&&bu.enqueueReplaceState(d,d.state,null),Ui(t,s,d,c),Oi(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var A=t.memoizedProps,T=xr(a,A);d.props=T;var $=d.context,K=a.contextType;g=Or,typeof K=="object"&&K!==null&&(g=sa(K));var W=a.getDerivedStateFromProps;K=typeof W=="function"||typeof d.getSnapshotBeforeUpdate=="function",A=t.pendingProps!==A,K||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(A||$!==g)&&$m(t,d,s,g),Cs=!1;var q=t.memoizedState;d.state=q,Ui(t,s,d,c),Oi(),$=t.memoizedState,A||q!==$||Cs?(typeof W=="function"&&(gu(t,a,W,s),$=t.memoizedState),(T=Cs||Um(t,a,T,s,q,$,g))?(K||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=$),d.props=s,d.state=$,d.context=g,s=T):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,Xc(e,t),g=t.memoizedProps,K=xr(a,g),d.props=K,W=t.pendingProps,q=d.context,$=a.contextType,T=Or,typeof $=="object"&&$!==null&&(T=sa($)),A=a.getDerivedStateFromProps,($=typeof A=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==W||q!==T)&&$m(t,d,s,T),Cs=!1,q=t.memoizedState,d.state=q,Ui(t,s,d,c),Oi();var X=t.memoizedState;g!==W||q!==X||Cs||e!==null&&e.dependencies!==null&&Ol(e.dependencies)?(typeof A=="function"&&(gu(t,a,A,s),X=t.memoizedState),(K=Cs||Um(t,a,K,s,q,X,T)||e!==null&&e.dependencies!==null&&Ol(e.dependencies))?($||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,X,T),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,X,T)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=X),d.props=s,d.state=X,d.context=T,s=K):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,to(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=gr(t,e.child,null,c),t.child=gr(t,null,a,c)):ra(e,t,a,c),t.memoizedState=d.state,e=t.child):e=es(e,t,c),e}function Wm(e,t,a,s){return ur(),t.flags|=256,ra(e,t,a,s),t.child}var Su={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wu(e){return{baseLanes:e,cachePool:qf()}}function ku(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Ja),e}function ep(e,t,a){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,g;if((g=d)||(g=e!==null&&e.memoizedState===null?!1:($t.current&2)!==0),g&&(c=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(at){if(c?js(t):Es(),(e=Ct)?(e=oh(e,ln),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Nn,overflow:jn}:null,retryLane:536870912,hydrationErrors:null},a=Df(e),a.return=t,t.child=a,na=t,Ct=null)):e=null,e===null)throw As(t);return rd(e)?t.lanes=32:t.lanes=536870912,null}var A=s.children;return s=s.fallback,c?(Es(),c=t.mode,A=ao({mode:"hidden",children:A},c),s=cr(s,c,a,null),A.return=t,s.return=t,A.sibling=s,t.child=A,s=t.child,s.memoizedState=wu(a),s.childLanes=ku(e,g,a),t.memoizedState=Su,qi(null,s)):(js(t),Au(t,A))}var T=e.memoizedState;if(T!==null&&(A=T.dehydrated,A!==null)){if(d)t.flags&256?(js(t),t.flags&=-257,t=_u(e,t,a)):t.memoizedState!==null?(Es(),t.child=e.child,t.flags|=128,t=null):(Es(),A=s.fallback,c=t.mode,s=ao({mode:"visible",children:s.children},c),A=cr(A,c,a,null),A.flags|=2,s.return=t,A.return=t,s.sibling=A,t.child=s,gr(t,e.child,null,a),s=t.child,s.memoizedState=wu(a),s.childLanes=ku(e,g,a),t.memoizedState=Su,t=qi(null,s));else if(js(t),rd(A)){if(g=A.nextSibling&&A.nextSibling.dataset,g)var $=g.dgst;g=$,s=Error(l(419)),s.stack="",s.digest=g,Ei({value:s,source:null,stack:null}),t=_u(e,t,a)}else if(Gt||Fr(e,t,a,!1),g=(a&e.childLanes)!==0,Gt||g){if(g=vt,g!==null&&(s=Qs(g,a),s!==0&&s!==T.retryLane))throw T.retryLane=s,or(e,s),Ma(g,e,s),yu;sd(A)||fo(),t=_u(e,t,a)}else sd(A)?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,Ct=cn(A.nextSibling),na=t,at=!0,ks=null,ln=!1,e!==null&&Of(t,e),t=Au(t,s.children),t.flags|=4096);return t}return c?(Es(),A=s.fallback,c=t.mode,T=e.child,$=T.sibling,s=Yn(T,{mode:"hidden",children:s.children}),s.subtreeFlags=T.subtreeFlags&65011712,$!==null?A=Yn($,A):(A=cr(A,c,a,null),A.flags|=2),A.return=t,s.return=t,s.sibling=A,t.child=s,qi(null,s),s=t.child,A=e.child.memoizedState,A===null?A=wu(a):(c=A.cachePool,c!==null?(T=Ht._currentValue,c=c.parent!==T?{parent:T,pool:T}:c):c=qf(),A={baseLanes:A.baseLanes|a,cachePool:c}),s.memoizedState=A,s.childLanes=ku(e,g,a),t.memoizedState=Su,qi(e.child,s)):(js(t),a=e.child,e=a.sibling,a=Yn(a,{mode:"visible",children:s.children}),a.return=t,a.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=a,t.memoizedState=null,a)}function Au(e,t){return t=ao({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ao(e,t){return e=Ya(22,e,null,t),e.lanes=0,e}function _u(e,t,a){return gr(t,e.child,null,a),e=Au(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tp(e,t,a){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Fc(e.return,t,a)}function Cu(e,t,a,s,c,d){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:c,treeForkCount:d}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=s,g.tail=a,g.tailMode=c,g.treeForkCount=d)}function ap(e,t,a){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var g=$t.current,A=(g&2)!==0;if(A?(g=g&1|2,t.flags|=128):g&=1,ge($t,g),ra(e,t,s,a),s=at?ji:0,!A&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tp(e,a,t);else if(e.tag===19)tp(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(a=t.child,c=null;a!==null;)e=a.alternate,e!==null&&Vl(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),Cu(t,!1,c,a,d,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Vl(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}Cu(t,!0,a,null,d,s);break;case"together":Cu(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function es(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ds|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Fr(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=Yn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Yn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Tu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ol(e)))}function mb(e,t,a){switch(t.tag){case 3:ke(t,t.stateNode.containerInfo),_s(t,Ht,e.memoizedState.cache),ur();break;case 27:case 5:Ze(t);break;case 4:ke(t,t.stateNode.containerInfo);break;case 10:_s(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Jc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(js(t),t.flags|=128,null):(a&t.child.childLanes)!==0?ep(e,t,a):(js(t),e=es(e,t,a),e!==null?e.sibling:null);js(t);break;case 19:var c=(e.flags&128)!==0;if(s=(a&t.childLanes)!==0,s||(Fr(e,t,a,!1),s=(a&t.childLanes)!==0),c){if(s)return ap(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ge($t,$t.current),s)break;return null;case 22:return t.lanes=0,Ym(e,t,a,t.pendingProps);case 24:_s(t,Ht,e.memoizedState.cache)}return es(e,t,a)}function np(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Gt=!0;else{if(!Tu(e,a)&&(t.flags&128)===0)return Gt=!1,mb(e,t,a);Gt=(e.flags&131072)!==0}else Gt=!1,at&&(t.flags&1048576)!==0&&Rf(t,ji,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=pr(t.elementType),t.type=e,typeof e=="function")Mc(e)?(s=xr(e,s),t.tag=1,t=Jm(null,t,e,s,a)):(t.tag=0,t=vu(null,t,e,s,a));else{if(e!=null){var c=e.$$typeof;if(c===M){t.tag=11,t=Gm(null,t,e,s,a);break e}else if(c===F){t.tag=14,t=Pm(null,t,e,s,a);break e}}throw t=ie(e)||e,Error(l(306,t,""))}}return t;case 0:return vu(e,t,t.type,t.pendingProps,a);case 1:return s=t.type,c=xr(s,t.pendingProps),Jm(e,t,s,c,a);case 3:e:{if(ke(t,t.stateNode.containerInfo),e===null)throw Error(l(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,Xc(e,t),Ui(t,s,null,a);var g=t.memoizedState;if(s=g.cache,_s(t,Ht,s),s!==d.cache&&Bc(t,[Ht],a,!0),Oi(),s=g.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=Wm(e,t,s,a);break e}else if(s!==c){c=nn(Error(l(424)),t),Ei(c),t=Wm(e,t,s,a);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(Ct=cn(e.firstChild),na=t,at=!0,ks=null,ln=!0,a=Yf(t,null,s,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ur(),s===c){t=es(e,t,a);break e}ra(e,t,s,a)}t=t.child}return t;case 26:return to(e,t),e===null?(a=ph(t.type,null,t.pendingProps,null))?t.memoizedState=a:at||(a=t.type,e=t.pendingProps,s=yo(fe.current).createElement(a),s[kt]=t,s[Kt]=e,ia(s,a,e),Mt(s),t.stateNode=s):t.memoizedState=ph(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ze(t),e===null&&at&&(s=t.stateNode=dh(t.type,t.pendingProps,fe.current),na=t,ln=!0,c=Ct,$s(t.type)?(id=c,Ct=cn(s.firstChild)):Ct=c),ra(e,t,t.pendingProps.children,a),to(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&at&&((c=s=Ct)&&(s=Hb(s,t.type,t.pendingProps,ln),s!==null?(t.stateNode=s,na=t,Ct=cn(s.firstChild),ln=!1,c=!0):c=!1),c||As(t)),Ze(t),c=t.type,d=t.pendingProps,g=e!==null?e.memoizedProps:null,s=d.children,td(c,d)?s=null:g!==null&&td(c,g)&&(t.flags|=32),t.memoizedState!==null&&(c=eu(e,t,sb,null,null,a),nl._currentValue=c),to(e,t),ra(e,t,s,a),t.child;case 6:return e===null&&at&&((e=a=Ct)&&(a=Vb(a,t.pendingProps,ln),a!==null?(t.stateNode=a,na=t,Ct=null,e=!0):e=!1),e||As(t)),null;case 13:return ep(e,t,a);case 4:return ke(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=gr(t,null,s,a):ra(e,t,s,a),t.child;case 11:return Gm(e,t,t.type,t.pendingProps,a);case 7:return ra(e,t,t.pendingProps,a),t.child;case 8:return ra(e,t,t.pendingProps.children,a),t.child;case 12:return ra(e,t,t.pendingProps.children,a),t.child;case 10:return s=t.pendingProps,_s(t,t.type,s.value),ra(e,t,s.children,a),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,fr(t),c=sa(c),s=s(c),t.flags|=1,ra(e,t,s,a),t.child;case 14:return Pm(e,t,t.type,t.pendingProps,a);case 15:return Xm(e,t,t.type,t.pendingProps,a);case 19:return ap(e,t,a);case 31:return fb(e,t,a);case 22:return Ym(e,t,a,t.pendingProps);case 24:return fr(t),s=sa(Ht),e===null?(c=Vc(),c===null&&(c=vt,d=qc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:s,cache:c},Pc(t),_s(t,Ht,c)):((e.lanes&a)!==0&&(Xc(e,t),Ui(t,null,null,a),Oi()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),_s(t,Ht,s)):(s=d.cache,_s(t,Ht,s),s!==c.cache&&Bc(t,[Ht],a,!0))),ra(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function ts(e){e.flags|=4}function Nu(e,t,a,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Ep())e.flags|=8192;else throw hr=Fl,Gc}else e.flags&=-16777217}function sp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!yh(t))if(Ep())e.flags|=8192;else throw hr=Fl,Gc}function no(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?fa():536870912,e.lanes|=t,Jr|=t)}function Hi(e,t){if(!at)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Tt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(t)for(var c=e.child;c!==null;)a|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)a|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=a,t}function pb(e,t,a){var s=t.pendingProps;switch(Oc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tt(t),null;case 1:return Tt(t),null;case 3:return a=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Zn(Ht),Ee(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ir(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,$c())),Tt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ts(t),d!==null?(Tt(t),sp(t,d)):(Tt(t),Nu(t,c,null,s,a))):d?d!==e.memoizedState?(ts(t),Tt(t),sp(t,d)):(Tt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ts(t),Tt(t),Nu(t,c,e,s,a)),null;case 27:if(ce(t),a=fe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ts(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Tt(t),null}e=ee.current,Ir(t)?Uf(t):(e=dh(c,s,a),t.stateNode=e,ts(t))}return Tt(t),null;case 5:if(ce(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ts(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Tt(t),null}if(d=ee.current,Ir(t))Uf(t);else{var g=yo(fe.current);switch(d){case 1:d=g.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=g.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=g.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=g.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=g.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?g.createElement("select",{is:s.is}):g.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?g.createElement(c,{is:s.is}):g.createElement(c)}}d[kt]=t,d[Kt]=s;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)d.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=d;e:switch(ia(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ts(t)}}return Tt(t),Nu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ts(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=fe.current,Ir(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,c=na,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[kt]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||eh(e.nodeValue,a)),e||As(t,!0)}else e=yo(e).createTextNode(s),e[kt]=t,t.stateNode=e}return Tt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=Ir(t),a!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[kt]=t}else ur(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Tt(t),e=!1}else a=$c(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Qa(t),t):(Qa(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Tt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ir(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(l(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(l(317));c[kt]=t}else ur(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Tt(t),c=!1}else c=$c(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Qa(t),t):(Qa(t),null)}return Qa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),no(t,t.updateQueue),Tt(t),null);case 4:return Ee(),e===null&&Qu(t.stateNode.containerInfo),Tt(t),null;case 10:return Zn(t.type),Tt(t),null;case 19:if(de($t),s=t.memoizedState,s===null)return Tt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Hi(s,!1);else{if(zt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Vl(e),d!==null){for(t.flags|=128,Hi(s,!1),e=d.updateQueue,t.updateQueue=e,no(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Mf(a,e),a=a.sibling;return ge($t,$t.current&1|2),at&&Kn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&rt()>oo&&(t.flags|=128,c=!0,Hi(s,!1),t.lanes=4194304)}else{if(!c)if(e=Vl(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,no(t,e),Hi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!at)return Tt(t),null}else 2*rt()-s.renderingStartTime>oo&&a!==536870912&&(t.flags|=128,c=!0,Hi(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=rt(),e.sibling=null,a=$t.current,ge($t,c?a&1|2:a&1),at&&Kn(t,s.treeForkCount),e):(Tt(t),null);case 22:case 23:return Qa(t),Zc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(Tt(t),t.subtreeFlags&6&&(t.flags|=8192)):Tt(t),a=t.updateQueue,a!==null&&no(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&de(mr),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Zn(Ht),Tt(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function hb(e,t){switch(Oc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zn(Ht),Ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if(Qa(t),t.alternate===null)throw Error(l(340));ur()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Qa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));ur()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return de($t),null;case 4:return Ee(),null;case 10:return Zn(t.type),null;case 22:case 23:return Qa(t),Zc(),e!==null&&de(mr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zn(Ht),null;case 25:return null;default:return null}}function rp(e,t){switch(Oc(t),t.tag){case 3:Zn(Ht),Ee();break;case 26:case 27:case 5:ce(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&Qa(t);break;case 13:Qa(t);break;case 19:de($t);break;case 10:Zn(t.type);break;case 22:case 23:Qa(t),Zc(),e!==null&&de(mr);break;case 24:Zn(Ht)}}function Vi(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var c=s.next;a=c;do{if((a.tag&e)===e){s=void 0;var d=a.create,g=a.inst;s=d(),g.destroy=s}a=a.next}while(a!==c)}}catch(A){mt(t,t.return,A)}}function Ls(e,t,a){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var g=s.inst,A=g.destroy;if(A!==void 0){g.destroy=void 0,c=t;var T=a,$=A;try{$()}catch(K){mt(c,T,K)}}}s=s.next}while(s!==d)}}catch(K){mt(t,t.return,K)}}function ip(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Qf(t,a)}catch(s){mt(e,e.return,s)}}}function lp(e,t,a){a.props=xr(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){mt(e,t,s)}}function Gi(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(c){mt(e,t,c)}}function En(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(c){mt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){mt(e,t,c)}else a.current=null}function op(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(c){mt(e,e.return,c)}}function ju(e,t,a){try{var s=e.stateNode;Ub(s,e.type,a,t),s[Kt]=t}catch(c){mt(e,e.return,c)}}function cp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$s(e.type)||e.tag===4}function Eu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cp(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&&$s(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 Lu(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Va));else if(s!==4&&(s===27&&$s(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Lu(e,t,a),e=e.sibling;e!==null;)Lu(e,t,a),e=e.sibling}function so(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&$s(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(so(e,t,a),e=e.sibling;e!==null;)so(e,t,a),e=e.sibling}function up(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);ia(t,s,a),t[kt]=e,t[Kt]=a}catch(d){mt(e,e.return,d)}}var as=!1,Pt=!1,Mu=!1,dp=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function gb(e,t){if(e=e.containerInfo,Wu=Co,e=kf(e),_c(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var g=0,A=-1,T=-1,$=0,K=0,W=e,q=null;t:for(;;){for(var X;W!==a||c!==0&&W.nodeType!==3||(A=g+c),W!==d||s!==0&&W.nodeType!==3||(T=g+s),W.nodeType===3&&(g+=W.nodeValue.length),(X=W.firstChild)!==null;)q=W,W=X;for(;;){if(W===e)break t;if(q===a&&++$===c&&(A=g),q===d&&++K===s&&(T=g),(X=W.nextSibling)!==null)break;W=q,q=W.parentNode}W=X}a=A===-1||T===-1?null:{start:A,end:T}}else a=null}a=a||{start:0,end:0}}else a=null;for(ed={focusedElem:e,selectionRange:a},Co=!1,Zt=t;Zt!==null;)if(t=Zt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Zt=e;else for(;Zt!==null;){switch(t=Zt,d=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(a=0;a<e.length;a++)c=e[a],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,a=t,c=d.memoizedProps,d=d.memoizedState,s=a.stateNode;try{var Ae=xr(a.type,c);e=s.getSnapshotBeforeUpdate(Ae,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Oe){mt(a,a.return,Oe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)nd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":nd(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(l(163))}if(e=t.sibling,e!==null){e.return=t.return,Zt=e;break}Zt=t.return}}function fp(e,t,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:ss(e,a),s&4&&Vi(5,a);break;case 1:if(ss(e,a),s&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(g){mt(a,a.return,g)}else{var c=xr(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){mt(a,a.return,g)}}s&64&&ip(a),s&512&&Gi(a,a.return);break;case 3:if(ss(e,a),s&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Qf(e,t)}catch(g){mt(a,a.return,g)}}break;case 27:t===null&&s&4&&up(a);case 26:case 5:ss(e,a),t===null&&s&4&&op(a),s&512&&Gi(a,a.return);break;case 12:ss(e,a);break;case 31:ss(e,a),s&4&&hp(e,a);break;case 13:ss(e,a),s&4&&gp(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=_b.bind(null,a),Gb(e,a))));break;case 22:if(s=a.memoizedState!==null||as,!s){t=t!==null&&t.memoizedState!==null||Pt,c=as;var d=Pt;as=s,(Pt=t)&&!d?rs(e,a,(a.subtreeFlags&8772)!==0):ss(e,a),as=c,Pt=d}break;case 30:break;default:ss(e,a)}}function mp(e){var t=e.alternate;t!==null&&(e.alternate=null,mp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&gs(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 jt=null,Na=!1;function ns(e,t,a){for(a=a.child;a!==null;)pp(e,t,a),a=a.sibling}function pp(e,t,a){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(Ua,a)}catch{}switch(a.tag){case 26:Pt||En(a,t),ns(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Pt||En(a,t);var s=jt,c=Na;$s(a.type)&&(jt=a.stateNode,Na=!1),ns(e,t,a),el(a.stateNode),jt=s,Na=c;break;case 5:Pt||En(a,t);case 6:if(s=jt,c=Na,jt=null,ns(e,t,a),jt=s,Na=c,jt!==null)if(Na)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(a.stateNode)}catch(d){mt(a,t,d)}else try{jt.removeChild(a.stateNode)}catch(d){mt(a,t,d)}break;case 18:jt!==null&&(Na?(e=jt,ih(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ii(e)):ih(jt,a.stateNode));break;case 4:s=jt,c=Na,jt=a.stateNode.containerInfo,Na=!0,ns(e,t,a),jt=s,Na=c;break;case 0:case 11:case 14:case 15:Ls(2,a,t),Pt||Ls(4,a,t),ns(e,t,a);break;case 1:Pt||(En(a,t),s=a.stateNode,typeof s.componentWillUnmount=="function"&&lp(a,t,s)),ns(e,t,a);break;case 21:ns(e,t,a);break;case 22:Pt=(s=Pt)||a.memoizedState!==null,ns(e,t,a),Pt=s;break;default:ns(e,t,a)}}function hp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ii(e)}catch(a){mt(t,t.return,a)}}}function gp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ii(e)}catch(a){mt(t,t.return,a)}}function bb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new dp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new dp),t;default:throw Error(l(435,e.tag))}}function ro(e,t){var a=bb(e);t.forEach(function(s){if(!a.has(s)){a.add(s);var c=Cb.bind(null,e,s);s.then(c,c)}})}function ja(e,t){var a=t.deletions;if(a!==null)for(var s=0;s<a.length;s++){var c=a[s],d=e,g=t,A=g;e:for(;A!==null;){switch(A.tag){case 27:if($s(A.type)){jt=A.stateNode,Na=!1;break e}break;case 5:jt=A.stateNode,Na=!1;break e;case 3:case 4:jt=A.stateNode.containerInfo,Na=!0;break e}A=A.return}if(jt===null)throw Error(l(160));pp(d,g,c),jt=null,Na=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bp(t,e),t=t.sibling}var vn=null;function bp(e,t){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ja(t,e),Ea(e),s&4&&(Ls(3,e,e.return),Vi(3,e),Ls(5,e,e.return));break;case 1:ja(t,e),Ea(e),s&512&&(Pt||a===null||En(a,a.return)),s&64&&as&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var c=vn;if(ja(t,e),Ea(e),s&512&&(Pt||a===null||En(a,a.return)),s&4){var d=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Ia]||d[kt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),ia(d,s,a),d[kt]=e,Mt(d),s=d;break e;case"link":var g=bh("link","href",c).get(s+(a.href||""));if(g){for(var A=0;A<g.length;A++)if(d=g[A],d.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&d.getAttribute("rel")===(a.rel==null?null:a.rel)&&d.getAttribute("title")===(a.title==null?null:a.title)&&d.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){g.splice(A,1);break t}}d=c.createElement(s),ia(d,s,a),c.head.appendChild(d);break;case"meta":if(g=bh("meta","content",c).get(s+(a.content||""))){for(A=0;A<g.length;A++)if(d=g[A],d.getAttribute("content")===(a.content==null?null:""+a.content)&&d.getAttribute("name")===(a.name==null?null:a.name)&&d.getAttribute("property")===(a.property==null?null:a.property)&&d.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&d.getAttribute("charset")===(a.charSet==null?null:a.charSet)){g.splice(A,1);break t}}d=c.createElement(s),ia(d,s,a),c.head.appendChild(d);break;default:throw Error(l(468,s))}d[kt]=e,Mt(d),s=d}e.stateNode=s}else xh(c,e.type,e.stateNode);else e.stateNode=gh(c,s,e.memoizedProps);else d!==s?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,s===null?xh(c,e.type,e.stateNode):gh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&ju(e,e.memoizedProps,a.memoizedProps)}break;case 27:ja(t,e),Ea(e),s&512&&(Pt||a===null||En(a,a.return)),a!==null&&s&4&&ju(e,e.memoizedProps,a.memoizedProps);break;case 5:if(ja(t,e),Ea(e),s&512&&(Pt||a===null||En(a,a.return)),e.flags&32){c=e.stateNode;try{ga(c,"")}catch(Ae){mt(e,e.return,Ae)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,ju(e,c,a!==null?a.memoizedProps:c)),s&1024&&(Mu=!0);break;case 6:if(ja(t,e),Ea(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(Ae){mt(e,e.return,Ae)}}break;case 3:if(wo=null,c=vn,vn=vo(t.containerInfo),ja(t,e),vn=c,Ea(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{ii(t.containerInfo)}catch(Ae){mt(e,e.return,Ae)}Mu&&(Mu=!1,xp(e));break;case 4:s=vn,vn=vo(e.stateNode.containerInfo),ja(t,e),Ea(e),vn=s;break;case 12:ja(t,e),Ea(e);break;case 31:ja(t,e),Ea(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 13:ja(t,e),Ea(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(lo=rt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 22:c=e.memoizedState!==null;var T=a!==null&&a.memoizedState!==null,$=as,K=Pt;if(as=$||c,Pt=K||T,ja(t,e),Pt=K,as=$,Ea(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||T||as||Pt||yr(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){T=a=t;try{if(d=T.stateNode,c)g=d.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{A=T.stateNode;var W=T.memoizedProps.style,q=W!=null&&W.hasOwnProperty("display")?W.display:null;A.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(Ae){mt(T,T.return,Ae)}}}else if(t.tag===6){if(a===null){T=t;try{T.stateNode.nodeValue=c?"":T.memoizedProps}catch(Ae){mt(T,T.return,Ae)}}}else if(t.tag===18){if(a===null){T=t;try{var X=T.stateNode;c?lh(X,!0):lh(T.stateNode,!1)}catch(Ae){mt(T,T.return,Ae)}}}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;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,ro(e,a))));break;case 19:ja(t,e),Ea(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 30:break;case 21:break;default:ja(t,e),Ea(e)}}function Ea(e){var t=e.flags;if(t&2){try{for(var a,s=e.return;s!==null;){if(cp(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var c=a.stateNode,d=Eu(e);so(e,d,c);break;case 5:var g=a.stateNode;a.flags&32&&(ga(g,""),a.flags&=-33);var A=Eu(e);so(e,A,g);break;case 3:case 4:var T=a.stateNode.containerInfo,$=Eu(e);Lu(e,$,T);break;default:throw Error(l(161))}}catch(K){mt(e,e.return,K)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ss(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fp(e,t.alternate,t),t=t.sibling}function yr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ls(4,t,t.return),yr(t);break;case 1:En(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&lp(t,t.return,a),yr(t);break;case 27:el(t.stateNode);case 26:case 5:En(t,t.return),yr(t);break;case 22:t.memoizedState===null&&yr(t);break;case 30:yr(t);break;default:yr(t)}e=e.sibling}}function rs(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,g=d.flags;switch(d.tag){case 0:case 11:case 15:rs(c,d,a),Vi(4,d);break;case 1:if(rs(c,d,a),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch($){mt(s,s.return,$)}if(s=d,c=s.updateQueue,c!==null){var A=s.stateNode;try{var T=c.shared.hiddenCallbacks;if(T!==null)for(c.shared.hiddenCallbacks=null,c=0;c<T.length;c++)Kf(T[c],A)}catch($){mt(s,s.return,$)}}a&&g&64&&ip(d),Gi(d,d.return);break;case 27:up(d);case 26:case 5:rs(c,d,a),a&&s===null&&g&4&&op(d),Gi(d,d.return);break;case 12:rs(c,d,a);break;case 31:rs(c,d,a),a&&g&4&&hp(c,d);break;case 13:rs(c,d,a),a&&g&4&&gp(c,d);break;case 22:d.memoizedState===null&&rs(c,d,a),Gi(d,d.return);break;case 30:break;default:rs(c,d,a)}t=t.sibling}}function Du(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Li(a))}function zu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Li(e))}function Sn(e,t,a,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)yp(e,t,a,s),t=t.sibling}function yp(e,t,a,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Sn(e,t,a,s),c&2048&&Vi(9,t);break;case 1:Sn(e,t,a,s);break;case 3:Sn(e,t,a,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Li(e)));break;case 12:if(c&2048){Sn(e,t,a,s),e=t.stateNode;try{var d=t.memoizedProps,g=d.id,A=d.onPostCommit;typeof A=="function"&&A(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(T){mt(t,t.return,T)}}else Sn(e,t,a,s);break;case 31:Sn(e,t,a,s);break;case 13:Sn(e,t,a,s);break;case 23:break;case 22:d=t.stateNode,g=t.alternate,t.memoizedState!==null?d._visibility&2?Sn(e,t,a,s):Pi(e,t):d._visibility&2?Sn(e,t,a,s):(d._visibility|=2,Kr(e,t,a,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Du(g,t);break;case 24:Sn(e,t,a,s),c&2048&&zu(t.alternate,t);break;default:Sn(e,t,a,s)}}function Kr(e,t,a,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,g=t,A=a,T=s,$=g.flags;switch(g.tag){case 0:case 11:case 15:Kr(d,g,A,T,c),Vi(8,g);break;case 23:break;case 22:var K=g.stateNode;g.memoizedState!==null?K._visibility&2?Kr(d,g,A,T,c):Pi(d,g):(K._visibility|=2,Kr(d,g,A,T,c)),c&&$&2048&&Du(g.alternate,g);break;case 24:Kr(d,g,A,T,c),c&&$&2048&&zu(g.alternate,g);break;default:Kr(d,g,A,T,c)}t=t.sibling}}function Pi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,s=t,c=s.flags;switch(s.tag){case 22:Pi(a,s),c&2048&&Du(s.alternate,s);break;case 24:Pi(a,s),c&2048&&zu(s.alternate,s);break;default:Pi(a,s)}t=t.sibling}}var Xi=8192;function Qr(e,t,a){if(e.subtreeFlags&Xi)for(e=e.child;e!==null;)vp(e,t,a),e=e.sibling}function vp(e,t,a){switch(e.tag){case 26:Qr(e,t,a),e.flags&Xi&&e.memoizedState!==null&&nx(a,vn,e.memoizedState,e.memoizedProps);break;case 5:Qr(e,t,a);break;case 3:case 4:var s=vn;vn=vo(e.stateNode.containerInfo),Qr(e,t,a),vn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xi,Xi=16777216,Qr(e,t,a),Xi=s):Qr(e,t,a));break;default:Qr(e,t,a)}}function Sp(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 Yi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];Zt=s,kp(s,e)}Sp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)wp(e),e=e.sibling}function wp(e){switch(e.tag){case 0:case 11:case 15:Yi(e),e.flags&2048&&Ls(9,e,e.return);break;case 3:Yi(e);break;case 12:Yi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,io(e)):Yi(e);break;default:Yi(e)}}function io(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];Zt=s,kp(s,e)}Sp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ls(8,t,t.return),io(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,io(t));break;default:io(t)}e=e.sibling}}function kp(e,t){for(;Zt!==null;){var a=Zt;switch(a.tag){case 0:case 11:case 15:Ls(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Li(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,Zt=s;else e:for(a=e;Zt!==null;){s=Zt;var c=s.sibling,d=s.return;if(mp(s),s===a){Zt=null;break e}if(c!==null){c.return=d,Zt=c;break e}Zt=d}}}var xb={getCacheForType:function(e){var t=sa(Ht),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return sa(Ht).controller.signal}},yb=typeof WeakMap=="function"?WeakMap:Map,ct=0,vt=null,Je=null,et=0,ft=0,Za=null,Ms=!1,Zr=!1,Ru=!1,is=0,zt=0,Ds=0,vr=0,Ou=0,Ja=0,Jr=0,Ki=null,La=null,Uu=!1,lo=0,Ap=0,oo=1/0,co=null,zs=null,Yt=0,Rs=null,Wr=null,ls=0,$u=0,Iu=null,_p=null,Qi=0,Fu=null;function Wa(){return(ct&2)!==0&&et!==0?et&-et:E.T!==null?Pu():ps()}function Cp(){if(Ja===0)if((et&536870912)===0||at){var e=Ke;Ke<<=1,(Ke&3932160)===0&&(Ke=262144),Ja=e}else Ja=536870912;return e=Ka.current,e!==null&&(e.flags|=32),Ja}function Ma(e,t,a){(e===vt&&(ft===2||ft===9)||e.cancelPendingCommit!==null)&&(ei(e,0),Os(e,et,Ja,!1)),_n(e,a),((ct&2)===0||e!==vt)&&(e===vt&&((ct&2)===0&&(vr|=a),zt===4&&Os(e,et,Ja,!1)),Ln(e))}function Tp(e,t,a){if((ct&6)!==0)throw Error(l(327));var s=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ot(e,t),c=s?wb(e,t):qu(e,t,!0),d=s;do{if(c===0){Zr&&!s&&Os(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!vb(a)){c=qu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var A=e;c=Ki;var T=A.current.memoizedState.isDehydrated;if(T&&(ei(A,g).flags|=256),g=qu(A,g,!1),g!==2){if(Ru&&!T){A.errorRecoveryDisabledLanes|=d,vr|=d,c=4;break e}d=La,La=c,d!==null&&(La===null?La=d:La.push.apply(La,d))}c=g}if(d=!1,c!==2)continue}}if(c===1){ei(e,0),Os(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:Os(s,t,Ja,!Ms);break e;case 2:La=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(c=lo+300-rt(),10<c)){if(Os(s,t,Ja,!Ms),da(s,0,!0)!==0)break e;ls=t,s.timeoutHandle=sh(Np.bind(null,s,a,La,co,Uu,t,Ja,vr,Jr,Ms,d,"Throttled",-0,0),c);break e}Np(s,a,La,co,Uu,t,Ja,vr,Jr,Ms,d,null,-0,0)}}break}while(!0);Ln(e)}function Np(e,t,a,s,c,d,g,A,T,$,K,W,q,X){if(e.timeoutHandle=-1,W=t.subtreeFlags,W&8192||(W&16785408)===16785408){W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Va},vp(t,d,W);var Ae=(d&62914560)===d?lo-rt():(d&4194048)===d?Ap-rt():0;if(Ae=sx(W,Ae),Ae!==null){ls=d,e.cancelPendingCommit=Ae(Op.bind(null,e,t,d,a,s,c,g,A,T,K,W,null,q,X)),Os(e,d,g,!$);return}}Op(e,t,d,a,s,c,g,A,T)}function vb(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var c=a[s],d=c.getSnapshot;c=c.value;try{if(!Xa(d(),c))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Os(e,t,a,s){t&=~Ou,t&=~vr,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-Rt(c),g=1<<d;s[d]=-1,c&=~g}a!==0&&Wt(e,a,t)}function uo(){return(ct&6)===0?(Zi(0),!1):!0}function Bu(){if(Je!==null){if(ft===0)var e=Je.return;else e=Je,Qn=dr=null,nu(e),Vr=null,Di=0,e=Je;for(;e!==null;)rp(e.alternate,e),e=e.return;Je=null}}function ei(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Fb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ls=0,Bu(),vt=e,Je=a=Yn(e.current,null),et=t,ft=0,Za=null,Ms=!1,Zr=Ot(e,t),Ru=!1,Jr=Ja=Ou=vr=Ds=zt=0,La=Ki=null,Uu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-Rt(s),d=1<<c;t|=e[c],s&=~d}return is=t,Ll(),a}function jp(e,t){Ge=null,E.H=Bi,t===Hr||t===Il?(t=Gf(),ft=3):t===Gc?(t=Gf(),ft=4):ft=t===yu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Za=t,Je===null&&(zt=1,Wl(e,nn(t,e.current)))}function Ep(){var e=Ka.current;return e===null?!0:(et&4194048)===et?on===null:(et&62914560)===et||(et&536870912)!==0?e===on:!1}function Lp(){var e=E.H;return E.H=Bi,e===null?Bi:e}function Mp(){var e=E.A;return E.A=xb,e}function fo(){zt=4,Ms||(et&4194048)!==et&&Ka.current!==null||(Zr=!0),(Ds&134217727)===0&&(vr&134217727)===0||vt===null||Os(vt,et,Ja,!1)}function qu(e,t,a){var s=ct;ct|=2;var c=Lp(),d=Mp();(vt!==e||et!==t)&&(co=null,ei(e,t)),t=!1;var g=zt;e:do try{if(ft!==0&&Je!==null){var A=Je,T=Za;switch(ft){case 8:Bu(),g=6;break e;case 3:case 2:case 9:case 6:Ka.current===null&&(t=!0);var $=ft;if(ft=0,Za=null,ti(e,A,T,$),a&&Zr){g=0;break e}break;default:$=ft,ft=0,Za=null,ti(e,A,T,$)}}Sb(),g=zt;break}catch(K){jp(e,K)}while(!0);return t&&e.shellSuspendCounter++,Qn=dr=null,ct=s,E.H=c,E.A=d,Je===null&&(vt=null,et=0,Ll()),g}function Sb(){for(;Je!==null;)Dp(Je)}function wb(e,t){var a=ct;ct|=2;var s=Lp(),c=Mp();vt!==e||et!==t?(co=null,oo=rt()+500,ei(e,t)):Zr=Ot(e,t);e:do try{if(ft!==0&&Je!==null){t=Je;var d=Za;t:switch(ft){case 1:ft=0,Za=null,ti(e,t,d,1);break;case 2:case 9:if(Hf(d)){ft=0,Za=null,zp(t);break}t=function(){ft!==2&&ft!==9||vt!==e||(ft=7),Ln(e)},d.then(t,t);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:Hf(d)?(ft=0,Za=null,zp(t)):(ft=0,Za=null,ti(e,t,d,7));break;case 5:var g=null;switch(Je.tag){case 26:g=Je.memoizedState;case 5:case 27:var A=Je;if(g?yh(g):A.stateNode.complete){ft=0,Za=null;var T=A.sibling;if(T!==null)Je=T;else{var $=A.return;$!==null?(Je=$,mo($)):Je=null}break t}}ft=0,Za=null,ti(e,t,d,5);break;case 6:ft=0,Za=null,ti(e,t,d,6);break;case 8:Bu(),zt=6;break e;default:throw Error(l(462))}}kb();break}catch(K){jp(e,K)}while(!0);return Qn=dr=null,E.H=s,E.A=c,ct=a,Je!==null?0:(vt=null,et=0,Ll(),zt)}function kb(){for(;Je!==null&&!me();)Dp(Je)}function Dp(e){var t=np(e.alternate,e,is);e.memoizedProps=e.pendingProps,t===null?mo(e):Je=t}function zp(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Zm(a,t,t.pendingProps,t.type,void 0,et);break;case 11:t=Zm(a,t,t.pendingProps,t.type.render,t.ref,et);break;case 5:nu(t);default:rp(a,t),t=Je=Mf(t,is),t=np(a,t,is)}e.memoizedProps=e.pendingProps,t===null?mo(e):Je=t}function ti(e,t,a,s){Qn=dr=null,nu(t),Vr=null,Di=0;var c=t.return;try{if(db(e,c,t,a,et)){zt=1,Wl(e,nn(a,e.current)),Je=null;return}}catch(d){if(c!==null)throw Je=c,d;zt=1,Wl(e,nn(a,e.current)),Je=null;return}t.flags&32768?(at||s===1?e=!0:Zr||(et&536870912)!==0?e=!1:(Ms=e=!0,(s===2||s===9||s===3||s===6)&&(s=Ka.current,s!==null&&s.tag===13&&(s.flags|=16384))),Rp(t,e)):mo(t)}function mo(e){var t=e;do{if((t.flags&32768)!==0){Rp(t,Ms);return}e=t.return;var a=pb(t.alternate,t,is);if(a!==null){Je=a;return}if(t=t.sibling,t!==null){Je=t;return}Je=t=e}while(t!==null);zt===0&&(zt=5)}function Rp(e,t){do{var a=hb(e.alternate,e);if(a!==null){a.flags&=32767,Je=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Je=e;return}Je=e=a}while(e!==null);zt=6,Je=null}function Op(e,t,a,s,c,d,g,A,T){e.cancelPendingCommit=null;do po();while(Yt!==0);if((ct&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(d=t.lanes|t.childLanes,d|=Ec,ms(e,a,d,g,A,T),e===vt&&(Je=vt=null,et=0),Wr=t,Rs=e,ls=a,$u=d,Iu=c,_p=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Tb(Lt,function(){return Bp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=I.p,I.p=2,g=ct,ct|=4;try{gb(e,t,a)}finally{ct=g,I.p=c,E.T=s}}Yt=1,Up(),$p(),Ip()}}function Up(){if(Yt===1){Yt=0;var e=Rs,t=Wr,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=E.T,E.T=null;var s=I.p;I.p=2;var c=ct;ct|=4;try{bp(t,e);var d=ed,g=kf(e.containerInfo),A=d.focusedElem,T=d.selectionRange;if(g!==A&&A&&A.ownerDocument&&wf(A.ownerDocument.documentElement,A)){if(T!==null&&_c(A)){var $=T.start,K=T.end;if(K===void 0&&(K=$),"selectionStart"in A)A.selectionStart=$,A.selectionEnd=Math.min(K,A.value.length);else{var W=A.ownerDocument||document,q=W&&W.defaultView||window;if(q.getSelection){var X=q.getSelection(),Ae=A.textContent.length,Oe=Math.min(T.start,Ae),yt=T.end===void 0?Oe:Math.min(T.end,Ae);!X.extend&&Oe>yt&&(g=yt,yt=Oe,Oe=g);var D=Sf(A,Oe),L=Sf(A,yt);if(D&&L&&(X.rangeCount!==1||X.anchorNode!==D.node||X.anchorOffset!==D.offset||X.focusNode!==L.node||X.focusOffset!==L.offset)){var O=W.createRange();O.setStart(D.node,D.offset),X.removeAllRanges(),Oe>yt?(X.addRange(O),X.extend(L.node,L.offset)):(O.setEnd(L.node,L.offset),X.addRange(O))}}}}for(W=[],X=A;X=X.parentNode;)X.nodeType===1&&W.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<W.length;A++){var Z=W[A];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Co=!!Wu,ed=Wu=null}finally{ct=c,I.p=s,E.T=a}}e.current=t,Yt=2}}function $p(){if(Yt===2){Yt=0;var e=Rs,t=Wr,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=E.T,E.T=null;var s=I.p;I.p=2;var c=ct;ct|=4;try{fp(e,t.alternate,t)}finally{ct=c,I.p=s,E.T=a}}Yt=3}}function Ip(){if(Yt===4||Yt===3){Yt=0,ze();var e=Rs,t=Wr,a=ls,s=_p;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Yt=5:(Yt=0,Wr=Rs=null,Fp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(zs=null),mn(a),t=t.stateNode,ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(Ua,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=I.p,I.p=2,E.T=null;try{for(var d=e.onRecoverableError,g=0;g<s.length;g++){var A=s[g];d(A.value,{componentStack:A.stack})}}finally{E.T=t,I.p=c}}(ls&3)!==0&&po(),Ln(e),c=e.pendingLanes,(a&261930)!==0&&(c&42)!==0?e===Fu?Qi++:(Qi=0,Fu=e):Qi=0,Zi(0)}}function Fp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Li(t)))}function po(){return Up(),$p(),Ip(),Bp()}function Bp(){if(Yt!==5)return!1;var e=Rs,t=$u;$u=0;var a=mn(ls),s=E.T,c=I.p;try{I.p=32>a?32:a,E.T=null,a=Iu,Iu=null;var d=Rs,g=ls;if(Yt=0,Wr=Rs=null,ls=0,(ct&6)!==0)throw Error(l(331));var A=ct;if(ct|=4,wp(d.current),yp(d,d.current,g,a),ct=A,Zi(0,!1),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(Ua,d)}catch{}return!0}finally{I.p=c,E.T=s,Fp(e,t)}}function qp(e,t,a){t=nn(a,t),t=xu(e.stateNode,t,2),e=Ns(e,t,2),e!==null&&(_n(e,2),Ln(e))}function mt(e,t,a){if(e.tag===3)qp(e,e,a);else for(;t!==null;){if(t.tag===3){qp(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(zs===null||!zs.has(s))){e=nn(a,e),a=Hm(2),s=Ns(t,a,2),s!==null&&(Vm(a,s,t,e),_n(s,2),Ln(s));break}}t=t.return}}function Hu(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new yb;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(a)||(Ru=!0,c.add(a),e=Ab.bind(null,e,t,a),t.then(e,e))}function Ab(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,vt===e&&(et&a)===a&&(zt===4||zt===3&&(et&62914560)===et&&300>rt()-lo?(ct&2)===0&&ei(e,0):Ou|=a,Jr===et&&(Jr=0)),Ln(e)}function Hp(e,t){t===0&&(t=fa()),e=or(e,t),e!==null&&(_n(e,t),Ln(e))}function _b(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Hp(e,a)}function Cb(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(a=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),Hp(e,a)}function Tb(e,t){return wt(e,t)}var ho=null,ai=null,Vu=!1,go=!1,Gu=!1,Us=0;function Ln(e){e!==ai&&e.next===null&&(ai===null?ho=ai=e:ai=ai.next=e),go=!0,Vu||(Vu=!0,jb())}function Zi(e,t){if(!Gu&&go){Gu=!0;do for(var a=!1,s=ho;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var g=s.suspendedLanes,A=s.pingedLanes;d=(1<<31-Rt(42|e)+1)-1,d&=c&~(g&~A),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,Xp(s,d))}else d=et,d=da(s,s===vt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||Ot(s,d)||(a=!0,Xp(s,d));s=s.next}while(a);Gu=!1}}function Nb(){Vp()}function Vp(){go=Vu=!1;var e=0;Us!==0&&Ib()&&(e=Us);for(var t=rt(),a=null,s=ho;s!==null;){var c=s.next,d=Gp(s,t);d===0?(s.next=null,a===null?ho=c:a.next=c,c===null&&(ai=a)):(a=s,(e!==0||(d&3)!==0)&&(go=!0)),s=c}Yt!==0&&Yt!==5||Zi(e),Us!==0&&(Us=0)}function Gp(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var g=31-Rt(d),A=1<<g,T=c[g];T===-1?((A&a)===0||(A&s)!==0)&&(c[g]=Ys(A,t)):T<=t&&(e.expiredLanes|=A),d&=~A}if(t=vt,a=et,a=da(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===t&&(ft===2||ft===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ut(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ot(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(s!==null&&ut(s),mn(a)){case 2:case 8:a=fn;break;case 32:a=Lt;break;case 268435456:a=fs;break;default:a=Lt}return s=Pp.bind(null,e),a=wt(a,s),e.callbackPriority=t,e.callbackNode=a,t}return s!==null&&s!==null&&ut(s),e.callbackPriority=2,e.callbackNode=null,2}function Pp(e,t){if(Yt!==0&&Yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(po()&&e.callbackNode!==a)return null;var s=et;return s=da(e,e===vt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Tp(e,s,t),Gp(e,rt()),e.callbackNode!=null&&e.callbackNode===a?Pp.bind(null,e):null)}function Xp(e,t){if(po())return null;Tp(e,t,!0)}function jb(){Bb(function(){(ct&6)!==0?wt(st,Nb):Vp()})}function Pu(){if(Us===0){var e=Br;e===0&&(e=Te,Te<<=1,(Te&261888)===0&&(Te=256)),Us=e}return Us}function Yp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bn(""+e)}function Kp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Eb(e,t,a,s,c){if(t==="submit"&&a&&a.stateNode===c){var d=Yp((c[Kt]||null).action),g=s.submitter;g&&(t=(t=g[Kt]||null)?Yp(t.formAction):g.getAttribute("formAction"),t!==null&&(d=t,g=null));var A=new Nr("action","action",null,s,c);e.push({event:A,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Us!==0){var T=g?Kp(c,g):new FormData(c);fu(a,{pending:!0,data:T,method:c.method,action:d},null,T)}}else typeof d=="function"&&(A.preventDefault(),T=g?Kp(c,g):new FormData(c),fu(a,{pending:!0,data:T,method:c.method,action:d},d,T))},currentTarget:c}]})}}for(var Xu=0;Xu<jc.length;Xu++){var Yu=jc[Xu],Lb=Yu.toLowerCase(),Mb=Yu[0].toUpperCase()+Yu.slice(1);yn(Lb,"on"+Mb)}yn(Cf,"onAnimationEnd"),yn(Tf,"onAnimationIteration"),yn(Nf,"onAnimationStart"),yn("dblclick","onDoubleClick"),yn("focusin","onFocus"),yn("focusout","onBlur"),yn(Y0,"onTransitionRun"),yn(K0,"onTransitionStart"),yn(Q0,"onTransitionCancel"),yn(jf,"onTransitionEnd"),Ha("onMouseEnter",["mouseout","mouseover"]),Ha("onMouseLeave",["mouseout","mouseover"]),Ha("onPointerEnter",["pointerout","pointerover"]),Ha("onPointerLeave",["pointerout","pointerover"]),qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ji="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(" "),Db=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ji));function Qp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var g=s.length-1;0<=g;g--){var A=s[g],T=A.instance,$=A.currentTarget;if(A=A.listener,T!==d&&c.isPropagationStopped())break e;d=A,c.currentTarget=$;try{d(c)}catch(K){El(K)}c.currentTarget=null,d=T}else for(g=0;g<s.length;g++){if(A=s[g],T=A.instance,$=A.currentTarget,A=A.listener,T!==d&&c.isPropagationStopped())break e;d=A,c.currentTarget=$;try{d(c)}catch(K){El(K)}c.currentTarget=null,d=T}}}}function We(e,t){var a=t[hn];a===void 0&&(a=t[hn]=new Set);var s=e+"__bubble";a.has(s)||(Zp(t,e,2,!1),a.add(s))}function Ku(e,t,a){var s=0;t&&(s|=4),Zp(a,e,s,t)}var bo="_reactListening"+Math.random().toString(36).slice(2);function Qu(e){if(!e[bo]){e[bo]=!0,Ba.forEach(function(a){a!=="selectionchange"&&(Db.has(a)||Ku(a,!1,e),Ku(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bo]||(t[bo]=!0,Ku("selectionchange",!1,t))}}function Zp(e,t,a,s){switch(Ch(t)){case 2:var c=lx;break;case 8:c=ox;break;default:c=dd}a=c.bind(null,t,a,e),c=void 0,!er||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,a,{capture:!0,passive:c}):e.addEventListener(t,a,!0):c!==void 0?e.addEventListener(t,a,{passive:c}):e.addEventListener(t,a,!1)}function Zu(e,t,a,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var g=s.tag;if(g===3||g===4){var A=s.stateNode.containerInfo;if(A===c)break;if(g===4)for(g=s.return;g!==null;){var T=g.tag;if((T===3||T===4)&&g.stateNode.containerInfo===c)return;g=g.return}for(;A!==null;){if(g=ha(A),g===null)return;if(T=g.tag,T===5||T===6||T===26||T===27){s=d=g;continue e}A=A.parentNode}}s=s.return}Ws(function(){var $=d,K=Nt(a),W=[];e:{var q=Ef.get(e);if(q!==void 0){var X=Nr,Ae=e;switch(e){case"keypress":if(Gn(a)===0)break e;case"keydown":case"keyup":X=Pa;break;case"focusin":Ae="focus",X=bn;break;case"focusout":Ae="blur",X=bn;break;case"beforeblur":case"afterblur":X=bn;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=_l;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=bc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=Nl;break;case Cf:case Tf:case Nf:X=yc;break;case jf:X=tn;break;case"scroll":case"scrollend":X=jr;break;case"wheel":X=aa;break;case"copy":case"cut":case"paste":X=N;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=sr;break;case"toggle":case"beforetoggle":X=Sc}var Oe=(t&4)!==0,yt=!Oe&&(e==="scroll"||e==="scrollend"),D=Oe?q!==null?q+"Capture":null:q;Oe=[];for(var L=$,O;L!==null;){var Z=L;if(O=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||O===null||D===null||(Z=Hn(L,D),Z!=null&&Oe.push(Wi(L,Z,O))),yt)break;L=L.return}0<Oe.length&&(q=new X(q,Ae,null,a,K),W.push({event:q,listeners:Oe}))}}if((t&7)===0){e:{if(q=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",q&&a!==_r&&(Ae=a.relatedTarget||a.fromElement)&&(ha(Ae)||Ae[en]))break e;if((X||q)&&(q=K.window===K?K:(q=K.ownerDocument)?q.defaultView||q.parentWindow:window,X?(Ae=a.relatedTarget||a.toElement,X=$,Ae=Ae?ha(Ae):null,Ae!==null&&(yt=u(Ae),Oe=Ae.tag,Ae!==yt||Oe!==5&&Oe!==27&&Oe!==6)&&(Ae=null)):(X=null,Ae=$),X!==Ae)){if(Oe=_l,Z="onMouseLeave",D="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(Oe=sr,Z="onPointerLeave",D="onPointerEnter",L="pointer"),yt=X==null?q:Fa(X),O=Ae==null?q:Fa(Ae),q=new Oe(Z,L+"leave",X,a,K),q.target=yt,q.relatedTarget=O,Z=null,ha(K)===$&&(Oe=new Oe(D,L+"enter",Ae,a,K),Oe.target=O,Oe.relatedTarget=yt,Z=Oe),yt=Z,X&&Ae)t:{for(Oe=zb,D=X,L=Ae,O=0,Z=D;Z;Z=Oe(Z))O++;Z=0;for(var je=L;je;je=Oe(je))Z++;for(;0<O-Z;)D=Oe(D),O--;for(;0<Z-O;)L=Oe(L),Z--;for(;O--;){if(D===L||L!==null&&D===L.alternate){Oe=D;break t}D=Oe(D),L=Oe(L)}Oe=null}else Oe=null;X!==null&&Jp(W,q,X,Oe,!1),Ae!==null&&yt!==null&&Jp(W,yt,Ae,Oe,!0)}}e:{if(q=$?Fa($):window,X=q.nodeName&&q.nodeName.toLowerCase(),X==="select"||X==="input"&&q.type==="file")var it=hf;else if(mf(q))if(gf)it=G0;else{it=H0;var _e=q0}else X=q.nodeName,!X||X.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?$&&Fn($.elementType)&&(it=hf):it=V0;if(it&&(it=it(e,$))){pf(W,it,a,K);break e}_e&&_e(e,q,$),e==="focusout"&&$&&q.type==="number"&&$.memoizedProps.value!=null&&Ar(q,"number",q.value)}switch(_e=$?Fa($):window,e){case"focusin":(mf(_e)||_e.contentEditable==="true")&&(Dr=_e,Cc=$,Ni=null);break;case"focusout":Ni=Cc=Dr=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,Af(W,a,K);break;case"selectionchange":if(X0)break;case"keydown":case"keyup":Af(W,a,K)}var Xe;if(ya)e:{switch(e){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Mr?df(e,a)&&(tt="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(tt="onCompositionStart");tt&&(Ss&&a.locale!=="ko"&&(Mr||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Mr&&(Xe=wi()):(Ga=K,ys="value"in Ga?Ga.value:Ga.textContent,Mr=!0)),_e=xo($,tt),0<_e.length&&(tt=new Ne(tt,e,null,a,K),W.push({event:tt,listeners:_e}),Xe?tt.data=Xe:(Xe=ff(a),Xe!==null&&(tt.data=Xe)))),(Xe=Ta?$0(e,a):I0(e,a))&&(tt=xo($,"onBeforeInput"),0<tt.length&&(_e=new Ne("onBeforeInput","beforeinput",null,a,K),W.push({event:_e,listeners:tt}),_e.data=Xe)),Eb(W,e,$,a,K)}Qp(W,t)})}function Wi(e,t,a){return{instance:e,listener:t,currentTarget:a}}function xo(e,t){for(var a=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=Hn(e,a),c!=null&&s.unshift(Wi(e,c,d)),c=Hn(e,t),c!=null&&s.push(Wi(e,c,d))),e.tag===3)return s;e=e.return}return[]}function zb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Jp(e,t,a,s,c){for(var d=t._reactName,g=[];a!==null&&a!==s;){var A=a,T=A.alternate,$=A.stateNode;if(A=A.tag,T!==null&&T===s)break;A!==5&&A!==26&&A!==27||$===null||(T=$,c?($=Hn(a,d),$!=null&&g.unshift(Wi(a,$,T))):c||($=Hn(a,d),$!=null&&g.push(Wi(a,$,T)))),a=a.return}g.length!==0&&e.push({event:t,listeners:g})}var Rb=/\r\n?/g,Ob=/\u0000|\uFFFD/g;function Wp(e){return(typeof e=="string"?e:""+e).replace(Rb,`
|
|
26
|
+
`).replace(Ob,"")}function eh(e,t){return t=Wp(t),Wp(e)===t}function xt(e,t,a,s,c,d){switch(a){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||ga(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&ga(e,""+s);break;case"className":ea(e,"class",s);break;case"tabIndex":ea(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ea(e,a,s);break;case"style":vi(e,s,d);break;case"data":if(t!=="object"){ea(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Bn(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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 d=="function"&&(a==="formAction"?(t!=="input"&&xt(e,t,"name",c.name,c,null),xt(e,t,"formEncType",c.formEncType,c,null),xt(e,t,"formMethod",c.formMethod,c,null),xt(e,t,"formTarget",c.formTarget,c,null)):(xt(e,t,"encType",c.encType,c,null),xt(e,t,"method",c.method,c,null),xt(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Bn(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=Va);break;case"onScroll":s!=null&&We("scroll",e);break;case"onScrollEnd":s!=null&&We("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(c.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=Bn(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):e.removeAttribute(a);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":We("beforetoggle",e),We("toggle",e),Pe(e,"popover",s);break;case"xlinkActuate":_t(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":_t(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":_t(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":_t(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":_t(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":_t(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":_t(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":_t(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":_t(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Pe(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Si.get(a)||a,Pe(e,a,s))}}function Ju(e,t,a,s,c,d){switch(a){case"style":vi(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(c.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof s=="string"?ga(e,s):(typeof s=="number"||typeof s=="bigint")&&ga(e,""+s);break;case"onScroll":s!=null&&We("scroll",e);break;case"onScrollEnd":s!=null&&We("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Va);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zs.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(c=a.endsWith("Capture"),t=a.slice(2,c?a.length-7:void 0),d=e[Kt]||null,d=d!=null?d[a]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,s,c);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Pe(e,a,s)}}}function ia(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",e),We("load",e);var s=!1,c=!1,d;for(d in a)if(a.hasOwnProperty(d)){var g=a[d];if(g!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:xt(e,t,d,g,a,null)}}c&&xt(e,t,"srcSet",a.srcSet,a,null),s&&xt(e,t,"src",a.src,a,null);return;case"input":We("invalid",e);var A=d=g=c=null,T=null,$=null;for(s in a)if(a.hasOwnProperty(s)){var K=a[s];if(K!=null)switch(s){case"name":c=K;break;case"type":g=K;break;case"checked":T=K;break;case"defaultChecked":$=K;break;case"value":d=K;break;case"defaultValue":A=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(l(137,t));break;default:xt(e,t,s,K,a,null)}}wl(e,d,A,T,$,g,c,!1);return;case"select":We("invalid",e),s=g=d=null;for(c in a)if(a.hasOwnProperty(c)&&(A=a[c],A!=null))switch(c){case"value":d=A;break;case"defaultValue":g=A;break;case"multiple":s=A;default:xt(e,t,c,A,a,null)}t=d,a=g,e.multiple=!!s,t!=null?Aa(e,!!s,t,!1):a!=null&&Aa(e,!!s,a,!0);return;case"textarea":We("invalid",e),d=c=s=null;for(g in a)if(a.hasOwnProperty(g)&&(A=a[g],A!=null))switch(g){case"value":s=A;break;case"defaultValue":c=A;break;case"children":d=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(l(91));break;default:xt(e,t,g,A,a,null)}xi(e,s,c,d);return;case"option":for(T in a)if(a.hasOwnProperty(T)&&(s=a[T],s!=null))switch(T){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:xt(e,t,T,s,a,null)}return;case"dialog":We("beforetoggle",e),We("toggle",e),We("cancel",e),We("close",e);break;case"iframe":case"object":We("load",e);break;case"video":case"audio":for(s=0;s<Ji.length;s++)We(Ji[s],e);break;case"image":We("error",e),We("load",e);break;case"details":We("toggle",e);break;case"embed":case"source":case"link":We("error",e),We("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($ in a)if(a.hasOwnProperty($)&&(s=a[$],s!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:xt(e,t,$,s,a,null)}return;default:if(Fn(t)){for(K in a)a.hasOwnProperty(K)&&(s=a[K],s!==void 0&&Ju(e,t,K,s,a,void 0));return}}for(A in a)a.hasOwnProperty(A)&&(s=a[A],s!=null&&xt(e,t,A,s,a,null))}function Ub(e,t,a,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,g=null,A=null,T=null,$=null,K=null;for(X in a){var W=a[X];if(a.hasOwnProperty(X)&&W!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":T=W;default:s.hasOwnProperty(X)||xt(e,t,X,null,s,W)}}for(var q in s){var X=s[q];if(W=a[q],s.hasOwnProperty(q)&&(X!=null||W!=null))switch(q){case"type":d=X;break;case"name":c=X;break;case"checked":$=X;break;case"defaultChecked":K=X;break;case"value":g=X;break;case"defaultValue":A=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(l(137,t));break;default:X!==W&&xt(e,t,q,X,s,W)}}kr(e,g,A,T,$,K,d,c);return;case"select":X=g=A=q=null;for(d in a)if(T=a[d],a.hasOwnProperty(d)&&T!=null)switch(d){case"value":break;case"multiple":X=T;default:s.hasOwnProperty(d)||xt(e,t,d,null,s,T)}for(c in s)if(d=s[c],T=a[c],s.hasOwnProperty(c)&&(d!=null||T!=null))switch(c){case"value":q=d;break;case"defaultValue":A=d;break;case"multiple":g=d;default:d!==T&&xt(e,t,c,d,s,T)}t=A,a=g,s=X,q!=null?Aa(e,!!a,q,!1):!!s!=!!a&&(t!=null?Aa(e,!!a,t,!0):Aa(e,!!a,a?[]:"",!1));return;case"textarea":X=q=null;for(A in a)if(c=a[A],a.hasOwnProperty(A)&&c!=null&&!s.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:xt(e,t,A,null,s,c)}for(g in s)if(c=s[g],d=a[g],s.hasOwnProperty(g)&&(c!=null||d!=null))switch(g){case"value":q=c;break;case"defaultValue":X=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(l(91));break;default:c!==d&&xt(e,t,g,c,s,d)}kl(e,q,X);return;case"option":for(var Ae in a)if(q=a[Ae],a.hasOwnProperty(Ae)&&q!=null&&!s.hasOwnProperty(Ae))switch(Ae){case"selected":e.selected=!1;break;default:xt(e,t,Ae,null,s,q)}for(T in s)if(q=s[T],X=a[T],s.hasOwnProperty(T)&&q!==X&&(q!=null||X!=null))switch(T){case"selected":e.selected=q&&typeof q!="function"&&typeof q!="symbol";break;default:xt(e,t,T,q,s,X)}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 Oe in a)q=a[Oe],a.hasOwnProperty(Oe)&&q!=null&&!s.hasOwnProperty(Oe)&&xt(e,t,Oe,null,s,q);for($ in s)if(q=s[$],X=a[$],s.hasOwnProperty($)&&q!==X&&(q!=null||X!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(l(137,t));break;default:xt(e,t,$,q,s,X)}return;default:if(Fn(t)){for(var yt in a)q=a[yt],a.hasOwnProperty(yt)&&q!==void 0&&!s.hasOwnProperty(yt)&&Ju(e,t,yt,void 0,s,q);for(K in s)q=s[K],X=a[K],!s.hasOwnProperty(K)||q===X||q===void 0&&X===void 0||Ju(e,t,K,q,s,X);return}}for(var D in a)q=a[D],a.hasOwnProperty(D)&&q!=null&&!s.hasOwnProperty(D)&&xt(e,t,D,null,s,q);for(W in s)q=s[W],X=a[W],!s.hasOwnProperty(W)||q===X||q==null&&X==null||xt(e,t,W,q,s,X)}function th(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $b(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var c=a[s],d=c.transferSize,g=c.initiatorType,A=c.duration;if(d&&A&&th(g)){for(g=0,A=c.responseEnd,s+=1;s<a.length;s++){var T=a[s],$=T.startTime;if($>A)break;var K=T.transferSize,W=T.initiatorType;K&&th(W)&&(T=T.responseEnd,g+=K*(T<A?1:(A-$)/(T-$)))}if(--s,t+=8*(d+g)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Wu=null,ed=null;function yo(e){return e.nodeType===9?e:e.ownerDocument}function ah(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 nh(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 td(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 ad=null;function Ib(){var e=window.event;return e&&e.type==="popstate"?e===ad?!1:(ad=e,!0):(ad=null,!1)}var sh=typeof setTimeout=="function"?setTimeout:void 0,Fb=typeof clearTimeout=="function"?clearTimeout:void 0,rh=typeof Promise=="function"?Promise:void 0,Bb=typeof queueMicrotask=="function"?queueMicrotask:typeof rh<"u"?function(e){return rh.resolve(null).then(e).catch(qb)}:sh;function qb(e){setTimeout(function(){throw e})}function $s(e){return e==="head"}function ih(e,t){var a=t,s=0;do{var c=a.nextSibling;if(e.removeChild(a),c&&c.nodeType===8)if(a=c.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(c),ii(t);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")el(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,el(a);for(var d=a.firstChild;d;){var g=d.nextSibling,A=d.nodeName;d[Ia]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=g}}else a==="body"&&el(e.ownerDocument.body);a=c}while(a);ii(t)}function lh(e,t){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function nd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":nd(a),gs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Hb(e,t,a,s){for(;e.nodeType===1;){var c=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Ia])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=cn(e.nextSibling),e===null)break}return null}function Vb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=cn(e.nextSibling),e===null))return null;return e}function oh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=cn(e.nextSibling),e===null))return null;return e}function sd(e){return e.data==="$?"||e.data==="$~"}function rd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Gb(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var s=function(){t(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function cn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var id=null;function ch(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return cn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function uh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function dh(e,t,a){switch(t=yo(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function el(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);gs(e)}var un=new Map,fh=new Set;function vo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=I.d;I.d={f:Pb,r:Xb,D:Yb,C:Kb,L:Qb,m:Zb,X:Wb,S:Jb,M:ex};function Pb(){var e=os.f(),t=uo();return e||t}function Xb(e){var t=Qt(e);t!==null&&t.tag===5&&t.type==="form"?jm(t):os.r(e)}var ni=typeof document>"u"?null:document;function mh(e,t,a){var s=ni;if(s&&typeof t=="string"&&t){var c=ka(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),fh.has(c)||(fh.add(c),e={rel:e,crossOrigin:a,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),ia(t,"link",e),Mt(t),s.head.appendChild(t)))}}function Yb(e){os.D(e),mh("dns-prefetch",e,null)}function Kb(e,t){os.C(e,t),mh("preconnect",e,t)}function Qb(e,t,a){os.L(e,t,a);var s=ni;if(s&&e&&t){var c='link[rel="preload"][as="'+ka(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+ka(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+ka(a.imageSizes)+'"]')):c+='[href="'+ka(e)+'"]';var d=c;switch(t){case"style":d=si(e);break;case"script":d=ri(e)}un.has(d)||(e=x({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),un.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(tl(d))||t==="script"&&s.querySelector(al(d))||(t=s.createElement("link"),ia(t,"link",e),Mt(t),s.head.appendChild(t)))}}function Zb(e,t){os.m(e,t);var a=ni;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+ka(s)+'"][href="'+ka(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ri(e)}if(!un.has(d)&&(e=x({rel:"modulepreload",href:e},t),un.set(d,e),a.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(al(d)))return}s=a.createElement("link"),ia(s,"link",e),Mt(s),a.head.appendChild(s)}}}function Jb(e,t,a){os.S(e,t,a);var s=ni;if(s&&e){var c=Tn(s).hoistableStyles,d=si(e);t=t||"default";var g=c.get(d);if(!g){var A={loading:0,preload:null};if(g=s.querySelector(tl(d)))A.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},a),(a=un.get(d))&&ld(e,a);var T=g=s.createElement("link");Mt(T),ia(T,"link",e),T._p=new Promise(function($,K){T.onload=$,T.onerror=K}),T.addEventListener("load",function(){A.loading|=1}),T.addEventListener("error",function(){A.loading|=2}),A.loading|=4,So(g,t,s)}g={type:"stylesheet",instance:g,count:1,state:A},c.set(d,g)}}}function Wb(e,t){os.X(e,t);var a=ni;if(a&&e){var s=Tn(a).hoistableScripts,c=ri(e),d=s.get(c);d||(d=a.querySelector(al(c)),d||(e=x({src:e,async:!0},t),(t=un.get(c))&&od(e,t),d=a.createElement("script"),Mt(d),ia(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function ex(e,t){os.M(e,t);var a=ni;if(a&&e){var s=Tn(a).hoistableScripts,c=ri(e),d=s.get(c);d||(d=a.querySelector(al(c)),d||(e=x({src:e,async:!0,type:"module"},t),(t=un.get(c))&&od(e,t),d=a.createElement("script"),Mt(d),ia(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function ph(e,t,a,s){var c=(c=fe.current)?vo(c):null;if(!c)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=si(a.href),a=Tn(c).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=si(a.href);var d=Tn(c).hoistableStyles,g=d.get(e);if(g||(c=c.ownerDocument||c,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,g),(d=c.querySelector(tl(e)))&&!d._p&&(g.instance=d,g.state.loading=5),un.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},un.set(e,a),d||tx(c,e,a,g.state))),t&&s===null)throw Error(l(528,""));return g}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ri(a),a=Tn(c).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function si(e){return'href="'+ka(e)+'"'}function tl(e){return'link[rel="stylesheet"]['+e+"]"}function hh(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function tx(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),ia(t,"link",a),Mt(t),e.head.appendChild(t))}function ri(e){return'[src="'+ka(e)+'"]'}function al(e){return"script[async]"+e}function gh(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ka(a.href)+'"]');if(s)return t.instance=s,Mt(s),s;var c=x({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Mt(s),ia(s,"style",c),So(s,a.precedence,e),t.instance=s;case"stylesheet":c=si(a.href);var d=e.querySelector(tl(c));if(d)return t.state.loading|=4,t.instance=d,Mt(d),d;s=hh(a),(c=un.get(c))&&ld(s,c),d=(e.ownerDocument||e).createElement("link"),Mt(d);var g=d;return g._p=new Promise(function(A,T){g.onload=A,g.onerror=T}),ia(d,"link",s),t.state.loading|=4,So(d,a.precedence,e),t.instance=d;case"script":return d=ri(a.src),(c=e.querySelector(al(d)))?(t.instance=c,Mt(c),c):(s=a,(c=un.get(d))&&(s=x({},a),od(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Mt(c),ia(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,So(s,a.precedence,e));return t.instance}function So(e,t,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,g=0;g<s.length;g++){var A=s[g];if(A.dataset.precedence===t)d=A;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function ld(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function od(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var wo=null;function bh(e,t,a){if(wo===null){var s=new Map,c=wo=new Map;c.set(a,s)}else c=wo,s=c.get(a),s||(s=new Map,c.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),c=0;c<a.length;c++){var d=a[c];if(!(d[Ia]||d[kt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var g=d.getAttribute(t)||"";g=e+g;var A=s.get(g);A?A.push(d):s.set(g,[d])}}return s}function xh(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function ax(e,t,a){if(a===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 yh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function nx(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=si(s.href),d=t.querySelector(tl(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ko.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=d,Mt(d);return}d=t.ownerDocument||t,s=hh(s),(c=un.get(c))&&ld(s,c),d=d.createElement("link"),Mt(d);var g=d;g._p=new Promise(function(A,T){g.onload=A,g.onerror=T}),ia(d,"link",s),a.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=ko.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var cd=0;function sx(e,t){return e.stylesheets&&e.count===0&&_o(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&_o(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&cd===0&&(cd=62500*$b());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_o(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>cd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function ko(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_o(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ao=null;function _o(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ao=new Map,t.forEach(rx,e),Ao=null,ko.call(e))}function rx(e,t){if(!(t.state.loading&4)){var a=Ao.get(e);if(a)var s=a.get(null);else{a=new Map,Ao.set(e,a);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var g=c[d];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(a.set(g.dataset.precedence,g),s=g)}s&&a.set(null,s)}c=t.instance,g=c.getAttribute("data-precedence"),d=a.get(g)||s,d===s&&a.set(null,c),a.set(g,c),this.count++,s=ko.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var nl={$$typeof:z,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function ix(e,t,a,s,c,d,g,A,T){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=$n(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$n(0),this.hiddenUpdates=$n(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function vh(e,t,a,s,c,d,g,A,T,$,K,W){return e=new ix(e,t,a,g,T,$,K,W,A),t=1,d===!0&&(t|=24),d=Ya(3,null,null,t),e.current=d,d.stateNode=e,t=qc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:a,cache:t},Pc(d),e}function Sh(e){return e?(e=Or,e):Or}function wh(e,t,a,s,c,d){c=Sh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ts(t),s.payload={element:a},d=d===void 0?null:d,d!==null&&(s.callback=d),a=Ns(e,s,t),a!==null&&(Ma(a,e,t),Ri(a,e,t))}function kh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function ud(e,t){kh(e,t),(e=e.alternate)&&kh(e,t)}function Ah(e){if(e.tag===13||e.tag===31){var t=or(e,67108864);t!==null&&Ma(t,e,67108864),ud(e,67108864)}}function _h(e){if(e.tag===13||e.tag===31){var t=Wa();t=Cn(t);var a=or(e,t);a!==null&&Ma(a,e,t),ud(e,t)}}var Co=!0;function lx(e,t,a,s){var c=E.T;E.T=null;var d=I.p;try{I.p=2,dd(e,t,a,s)}finally{I.p=d,E.T=c}}function ox(e,t,a,s){var c=E.T;E.T=null;var d=I.p;try{I.p=8,dd(e,t,a,s)}finally{I.p=d,E.T=c}}function dd(e,t,a,s){if(Co){var c=fd(s);if(c===null)Zu(e,t,s,To,a),Th(e,s);else if(ux(c,e,t,a,s))s.stopPropagation();else if(Th(e,s),t&4&&-1<cx.indexOf(e)){for(;c!==null;){var d=Qt(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var g=be(d.pendingLanes);if(g!==0){var A=d;for(A.pendingLanes|=2,A.entangledLanes|=2;g;){var T=1<<31-Rt(g);A.entanglements[1]|=T,g&=~T}Ln(d),(ct&6)===0&&(oo=rt()+500,Zi(0))}}break;case 31:case 13:A=or(d,2),A!==null&&Ma(A,d,2),uo(),ud(d,2)}if(d=fd(s),d===null&&Zu(e,t,s,To,a),d===c)break;c=d}c!==null&&s.stopPropagation()}else Zu(e,t,s,null,a)}}function fd(e){return e=Nt(e),md(e)}var To=null;function md(e){if(To=null,e=ha(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=m(t),e!==null)return e;e=null}else if(a===31){if(e=p(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return To=e,null}function Ch(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(Be()){case st:return 2;case fn:return 8;case Lt:case ca:return 32;case fs:return 268435456;default:return 32}default:return 32}}var pd=!1,Is=null,Fs=null,Bs=null,sl=new Map,rl=new Map,qs=[],cx="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 Th(e,t){switch(e){case"focusin":case"focusout":Is=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":Bs=null;break;case"pointerover":case"pointerout":sl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":rl.delete(t.pointerId)}}function il(e,t,a,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:a,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=Qt(t),t!==null&&Ah(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function ux(e,t,a,s,c){switch(t){case"focusin":return Is=il(Is,e,t,a,s,c),!0;case"dragenter":return Fs=il(Fs,e,t,a,s,c),!0;case"mouseover":return Bs=il(Bs,e,t,a,s,c),!0;case"pointerover":var d=c.pointerId;return sl.set(d,il(sl.get(d)||null,e,t,a,s,c)),!0;case"gotpointercapture":return d=c.pointerId,rl.set(d,il(rl.get(d)||null,e,t,a,s,c)),!0}return!1}function Nh(e){var t=ha(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=m(a),t!==null){e.blockedOn=t,pn(e.priority,function(){_h(a)});return}}else if(t===31){if(t=p(a),t!==null){e.blockedOn=t,pn(e.priority,function(){_h(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function No(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=fd(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);_r=s,a.target.dispatchEvent(s),_r=null}else return t=Qt(a),t!==null&&Ah(t),e.blockedOn=a,!1;t.shift()}return!0}function jh(e,t,a){No(e)&&a.delete(t)}function dx(){pd=!1,Is!==null&&No(Is)&&(Is=null),Fs!==null&&No(Fs)&&(Fs=null),Bs!==null&&No(Bs)&&(Bs=null),sl.forEach(jh),rl.forEach(jh)}function jo(e,t){e.blockedOn===t&&(e.blockedOn=null,pd||(pd=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,dx)))}var Eo=null;function Eh(e){Eo!==e&&(Eo=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Eo===e&&(Eo=null);for(var t=0;t<e.length;t+=3){var a=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(md(s||a)===null)continue;break}var d=Qt(a);d!==null&&(e.splice(t,3),t-=3,fu(d,{pending:!0,data:c,method:a.method,action:s},s,c))}}))}function ii(e){function t(T){return jo(T,e)}Is!==null&&jo(Is,e),Fs!==null&&jo(Fs,e),Bs!==null&&jo(Bs,e),sl.forEach(t),rl.forEach(t);for(var a=0;a<qs.length;a++){var s=qs[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<qs.length&&(a=qs[0],a.blockedOn===null);)Nh(a),a.blockedOn===null&&qs.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var c=a[s],d=a[s+1],g=c[Kt]||null;if(typeof d=="function")g||Eh(a);else if(g){var A=null;if(d&&d.hasAttribute("formAction")){if(c=d,g=d[Kt]||null)A=g.formAction;else if(md(c)!==null)continue}else A=g.action;typeof A=="function"?a[s+1]=A:(a.splice(s,3),s-=3),Eh(a)}}}function Lh(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(g){return c=g})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function hd(e){this._internalRoot=e}Lo.prototype.render=hd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,s=Wa();wh(a,s,e,t,null,null)},Lo.prototype.unmount=hd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wh(e.current,2,null,e,null,null),uo(),t[en]=null}};function Lo(e){this._internalRoot=e}Lo.prototype.unstable_scheduleHydration=function(e){if(e){var t=ps();e={blockedOn:null,target:e,priority:t};for(var a=0;a<qs.length&&t!==0&&t<qs[a].priority;a++);qs.splice(a,0,e),a===0&&Nh(e)}};var Mh=n.version;if(Mh!=="19.2.7")throw Error(l(527,Mh,"19.2.7"));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=b(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var fx={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Mo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mo.isDisabled&&Mo.supportsFiber)try{Ua=Mo.inject(fx),ht=Mo}catch{}}return ll.createRoot=function(e,t){if(!o(e))throw Error(l(299));var a=!1,s="",c=Im,d=Fm,g=Bm;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=vh(e,1,!1,null,null,a,s,null,c,d,g,Lh),e[en]=t.current,Qu(e),new hd(t)},ll.hydrateRoot=function(e,t,a){if(!o(e))throw Error(l(299));var s=!1,c="",d=Im,g=Fm,A=Bm,T=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(g=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError),a.formState!==void 0&&(T=a.formState)),t=vh(e,1,!0,t,a??null,s,c,T,d,g,A,Lh),t.context=Sh(null),a=t.current,s=Wa(),s=Cn(s),c=Ts(s),c.callback=null,Ns(a,c,s),a=s,t.current.lanes=a,_n(t,a),Ln(t),e[en]=t.current,Qu(e),new Lo(t)},ll.version="19.2.7",ll}var Uh;function Tx(){if(Uh)return gd.exports;Uh=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),gd.exports=Cx(),gd.exports}var Nx=Tx();const Vg=S.createContext(void 0);function $h({children:i}){const[n,r]=S.useState(()=>{const m=localStorage.getItem("chat-theme");if(m){const p=JSON.parse(m);return{mode:p.mode||"dark",highContrast:!!p.highContrast}}return{mode:"dark",highContrast:!1}}),[l,o]=S.useState(!1);S.useEffect(()=>{const m=()=>{let p=!1;n.mode==="dark"?p=!0:n.mode==="light"?p=!1:p=window.matchMedia("(prefers-color-scheme: dark)").matches,o(p);const h=document.documentElement;p?h.classList.add("dark"):h.classList.remove("dark"),n.highContrast?h.classList.add("high-contrast"):h.classList.remove("high-contrast"),h.classList.remove("text-sm","text-lg"),h.classList.add("text-base")};if(m(),n.mode==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{m()};return p.addEventListener("change",h),()=>p.removeEventListener("change",h)}},[n]),S.useEffect(()=>{localStorage.setItem("chat-theme",JSON.stringify(n))},[n]);const u=m=>{r(p=>({...p,...m}))};return f.jsx(Vg.Provider,{value:{theme:n,updateTheme:u,isDark:l},children:i})}function mi(){const i=S.useContext(Vg);if(!i)throw new Error("useTheme must be used within ThemeProvider");return i}const Gg=S.createContext(void 0),yd={voiceEnabled:!1,soundEnabled:!1,autoSend:!1};function jx({children:i}){const[n,r]=S.useState(()=>{const o=localStorage.getItem("chat-settings");if(o)try{const u=JSON.parse(o);return{...yd,...u,voiceEnabled:!1}}catch{return yd}return yd});S.useEffect(()=>{localStorage.setItem("chat-settings",JSON.stringify(n))},[n]);const l=o=>{r(u=>({...u,...o}))};return f.jsx(Gg.Provider,{value:{settings:n,updateSettings:l},children:i})}function lc(){const i=S.useContext(Gg);if(!i)throw new Error("useSettings must be used within SettingsProvider");return i}const $e=i=>typeof i=="string",ol=()=>{let i,n;const r=new Promise((l,o)=>{i=l,n=o});return r.resolve=i,r.reject=n,r},Ih=i=>i==null?"":String(i),Ex=(i,n,r)=>{i.forEach(l=>{n[l]&&(r[l]=n[l])})},Lx=/###/g,Fh=i=>i&&i.includes("###")?i.replace(Lx,"."):i,Bh=i=>!i||$e(i),fl=(i,n,r)=>{const l=$e(n)?n.split("."):n;let o=0;for(;o<l.length-1;){if(Bh(i))return{};const u=Fh(l[o]);!i[u]&&r&&(i[u]=new r),Object.prototype.hasOwnProperty.call(i,u)?i=i[u]:i={},++o}return Bh(i)?{}:{obj:i,k:Fh(l[o])}},qh=(i,n,r)=>{const{obj:l,k:o}=fl(i,n,Object);if(l!==void 0||n.length===1){l[o]=r;return}let u=n[n.length-1],m=n.slice(0,n.length-1),p=fl(i,m,Object);for(;p.obj===void 0&&m.length;)u=`${m[m.length-1]}.${u}`,m=m.slice(0,m.length-1),p=fl(i,m,Object),p!=null&&p.obj&&typeof p.obj[`${p.k}.${u}`]<"u"&&(p.obj=void 0);p.obj[`${p.k}.${u}`]=r},Mx=(i,n,r,l)=>{const{obj:o,k:u}=fl(i,n,Object);o[u]=o[u]||[],o[u].push(r)},Qo=(i,n)=>{const{obj:r,k:l}=fl(i,n);if(r&&Object.prototype.hasOwnProperty.call(r,l))return r[l]},Dx=(i,n,r)=>{const l=Qo(i,r);return l!==void 0?l:Qo(n,r)},Pg=(i,n,r)=>{for(const l in n)l!=="__proto__"&&l!=="constructor"&&(Object.prototype.hasOwnProperty.call(i,l)?$e(i[l])||i[l]instanceof String||$e(n[l])||n[l]instanceof String?r&&(i[l]=n[l]):Pg(i[l],n[l],r):i[l]=n[l]);return i},cs=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),zx={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Rx=i=>$e(i)?i.replace(/[&<>"'\/]/g,n=>zx[n]):i;class Ox{constructor(n){this.capacity=n,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(n){const r=this.regExpMap.get(n);if(r!==void 0)return r;const l=new RegExp(n);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(n,l),this.regExpQueue.push(n),l}}const Ux=[" ",",","?","!",";"],$x=new Ox(20),Ix=(i,n,r)=>{n=n||"",r=r||"";const l=Ux.filter(m=>!n.includes(m)&&!r.includes(m));if(l.length===0)return!0;const o=$x.getRegExp(`(${l.map(m=>m==="?"?"\\?":m).join("|")})`);let u=!o.test(i);if(!u){const m=i.indexOf(r);m>0&&!o.test(i.substring(0,m))&&(u=!0)}return u},Md=(i,n,r=".")=>{if(!i)return;if(i[n])return Object.prototype.hasOwnProperty.call(i,n)?i[n]:void 0;const l=n.split(r);let o=i;for(let u=0;u<l.length;){if(!o||typeof o!="object")return;let m,p="";for(let h=u;h<l.length;++h)if(h!==u&&(p+=r),p+=l[h],m=o[p],m!==void 0){if(["string","number","boolean"].includes(typeof m)&&h<l.length-1)continue;u+=h-u+1;break}o=m}return o},gl=i=>i==null?void 0:i.replace(/_/g,"-"),Fx={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,n){var r,l;(l=(r=console==null?void 0:console[i])==null?void 0:r.apply)==null||l.call(r,console,n)}};class Zo{constructor(n,r={}){this.init(n,r)}init(n,r={}){this.prefix=r.prefix||"i18next:",this.logger=n||Fx,this.options=r,this.debug=r.debug}log(...n){return this.forward(n,"log","",!0)}warn(...n){return this.forward(n,"warn","",!0)}error(...n){return this.forward(n,"error","")}deprecate(...n){return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(n,r,l,o){return o&&!this.debug?null:(n=n.map(u=>$e(u)?u.replace(/[\r\n\x00-\x1F\x7F]/g," "):u),$e(n[0])&&(n[0]=`${l}${this.prefix} ${n[0]}`),this.logger[r](n))}create(n){return new Zo(this.logger,{prefix:`${this.prefix}:${n}:`,...this.options})}clone(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new Zo(this.logger,n)}}var Un=new Zo;class oc{constructor(){this.observers={}}on(n,r){return n.split(" ").forEach(l=>{this.observers[l]||(this.observers[l]=new Map);const o=this.observers[l].get(r)||0;this.observers[l].set(r,o+1)}),this}off(n,r){if(this.observers[n]){if(!r){delete this.observers[n];return}this.observers[n].delete(r)}}once(n,r){const l=(...o)=>{r(...o),this.off(n,l)};return this.on(n,l),this}emit(n,...r){this.observers[n]&&Array.from(this.observers[n].entries()).forEach(([o,u])=>{for(let m=0;m<u;m++)o(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,u])=>{for(let m=0;m<u;m++)o(n,...r)})}}class Hh extends oc{constructor(n,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=n||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(n){this.options.ns.includes(n)||this.options.ns.push(n)}removeNamespaces(n){const r=this.options.ns.indexOf(n);r>-1&&this.options.ns.splice(r,1)}getResource(n,r,l,o={}){var b,y;const u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,m=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let p;n.includes(".")?p=n.split("."):(p=[n,r],l&&(Array.isArray(l)?p.push(...l):$e(l)&&u?p.push(...l.split(u)):p.push(l)));const h=Qo(this.data,p);return!h&&!r&&!l&&n.includes(".")&&(n=p[0],r=p[1],l=p.slice(2).join(".")),h||!m||!$e(l)?h:Md((y=(b=this.data)==null?void 0:b[n])==null?void 0:y[r],l,u)}addResource(n,r,l,o,u={silent:!1}){const m=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator;let p=[n,r];l&&(p=p.concat(m?l.split(m):l)),n.includes(".")&&(p=n.split("."),o=r,r=p[1]),this.addNamespaces(r),qh(this.data,p,o),u.silent||this.emit("added",n,r,l,o)}addResources(n,r,l,o={silent:!1}){for(const u in l)($e(l[u])||Array.isArray(l[u]))&&this.addResource(n,r,u,l[u],{silent:!0});o.silent||this.emit("added",n,r,l)}addResourceBundle(n,r,l,o,u,m={silent:!1,skipCopy:!1}){let p=[n,r];n.includes(".")&&(p=n.split("."),o=l,l=r,r=p[1]),this.addNamespaces(r);let h=Qo(this.data,p)||{};m.skipCopy||(l=JSON.parse(JSON.stringify(l))),o?Pg(h,l,u):h={...h,...l},qh(this.data,p,h),m.silent||this.emit("added",n,r,l)}removeResourceBundle(n,r){this.hasResourceBundle(n,r)&&delete this.data[n][r],this.removeNamespaces(r),this.emit("removed",n,r)}hasResourceBundle(n,r){return this.getResource(n,r)!==void 0}getResourceBundle(n,r){return r||(r=this.options.defaultNS),this.getResource(n,r)}getDataByLanguage(n){return this.data[n]}hasLanguageSomeTranslations(n){const r=this.getDataByLanguage(n);return!!(r&&Object.keys(r)||[]).find(o=>r[o]&&Object.keys(r[o]).length>0)}toJSON(){return this.data}}var Xg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,n,r,l,o){return i.forEach(u=>{var m;n=((m=this.processors[u])==null?void 0:m.process(n,r,l,o))??n}),n}};const Yg=Symbol("i18next/PATH_KEY");function Bx(){const i=[],n=Object.create(null);let r;return n.get=(l,o)=>{var u;return(u=r==null?void 0:r.revoke)==null||u.call(r),o===Yg?i:(i.push(o),r=Proxy.revocable(l,n),r.proxy)},Proxy.revocable(Object.create(null),n).proxy}function di(i,n){const{[Yg]:r}=i(Bx()),l=(n==null?void 0:n.keySeparator)??".",o=(n==null?void 0:n.nsSeparator)??":",u=(n==null?void 0:n.enableSelector)==="strict";if(r.length>1&&o){const m=n==null?void 0:n.ns,p=u?Array.isArray(m)?m:m?[m]:null:Array.isArray(m)?m:null;if(p&&(u?p:p.length>1?p.slice(1):[]).includes(r[0]))return`${r[0]}${o}${r.slice(1).join(l)}`}return r.join(l)}const vd=i=>!$e(i)&&typeof i!="boolean"&&typeof i!="number";class Jo extends oc{constructor(n,r={}){super(),Ex(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Un.create("translator"),this.checkedLoadedFor={}}changeLanguage(n){n&&(this.language=n)}exists(n,r={interpolation:{}}){const l={...r};if(n==null)return!1;const o=this.resolve(n,l);if((o==null?void 0:o.res)===void 0)return!1;const u=vd(o.res);return!(l.returnObjects===!1&&u)}extractFromKey(n,r){let l=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;l===void 0&&(l=":");const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let u=r.ns||this.options.defaultNS||[];const m=l&&n.includes(l),p=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Ix(n,l,o);if(m&&!p){const h=n.match(this.interpolator.nestingRegexp);if(h&&h.length>0)return{key:n,namespaces:$e(u)?[u]:u};const b=n.split(l);(l!==o||l===o&&this.options.ns.includes(b[0]))&&(u=b.shift()),n=b.join(o)}return{key:n,namespaces:$e(u)?[u]:u}}translate(n,r,l){let o=typeof r=="object"?{...r}:r;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),n==null)return"";typeof n=="function"&&(n=di(n,{...this.options,...o})),Array.isArray(n)||(n=[String(n)]),n=n.map(ae=>typeof ae=="function"?di(ae,{...this.options,...o}):String(ae));const u=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,m=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:p,namespaces:h}=this.extractFromKey(n[n.length-1],o),b=h[h.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const x=o.lng||this.language,w=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((x==null?void 0:x.toLowerCase())==="cimode")return w?u?{res:`${b}${y}${p}`,usedKey:p,exactUsedKey:p,usedLng:x,usedNS:b,usedParams:this.getUsedParamsDetails(o)}:`${b}${y}${p}`:u?{res:p,usedKey:p,exactUsedKey:p,usedLng:x,usedNS:b,usedParams:this.getUsedParamsDetails(o)}:p;const v=this.resolve(n,o);let k=v==null?void 0:v.res;const _=(v==null?void 0:v.usedKey)||p,j=(v==null?void 0:v.exactUsedKey)||p,R=["[object Number]","[object Function]","[object RegExp]"],P=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,z=!this.i18nFormat||this.i18nFormat.handleAsObject,M=o.count!==void 0&&!$e(o.count),B=Jo.hasDefaultValue(o),H=M?this.pluralResolver.getSuffix(x,o.count,o):"",F=o.ordinal&&M?this.pluralResolver.getSuffix(x,o.count,{ordinal:!1}):"",C=M&&!o.ordinal&&o.count===0,Q=C&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${H}`]||o[`defaultValue${F}`]||o.defaultValue;let U=k;z&&!k&&B&&(U=Q);const Y=vd(U),J=Object.prototype.toString.apply(U);if(z&&U&&Y&&!R.includes(J)&&!($e(P)&&Array.isArray(U))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ae=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,U,{...o,ns:h}):`key '${p} (${this.language})' returned an object instead of string.`;return u?(v.res=ae,v.usedParams=this.getUsedParamsDetails(o),v):ae}if(m){const ae=Array.isArray(U),ie=ae?[]:{},G=ae?j:_;for(const E in U)if(Object.prototype.hasOwnProperty.call(U,E)){const I=`${G}${m}${E}`;B&&!k?ie[E]=this.translate(I,{...o,defaultValue:vd(Q)?Q[E]:void 0,joinArrays:!1,ns:h}):ie[E]=this.translate(I,{...o,joinArrays:!1,ns:h}),ie[E]===I&&(ie[E]=U[E])}k=ie}}else if(z&&$e(P)&&Array.isArray(k))k=k.join(P),k&&(k=this.extendTranslation(k,n,o,l));else{let ae=!1,ie=!1;!this.isValidLookup(k)&&B&&(ae=!0,k=Q),this.isValidLookup(k)||(ie=!0,k=p);const E=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ie?void 0:k,I=B&&Q!==k&&this.options.updateMissing;if(ie||ae||I){if(this.logger.log(I?"updateKey":"missingKey",x,b,M&&!I?`${p}${this.pluralResolver.getSuffix(x,o.count,o)}`:p,I?Q:k),m){const oe=this.resolve(p,{...o,keySeparator:!1});oe&&oe.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let V=[];const le=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&le&&le[0])for(let oe=0;oe<le.length;oe++)V.push(le[oe]);else this.options.saveMissingTo==="all"?V=this.languageUtils.toResolveHierarchy(o.lng||this.language):V.push(o.lng||this.language);const ue=(oe,de,ge)=>{var ye;const ee=B&&ge!==k?ge:E;this.options.missingKeyHandler?this.options.missingKeyHandler(oe,b,de,ee,I,o):(ye=this.backendConnector)!=null&&ye.saveMissing&&this.backendConnector.saveMissing(oe,b,de,ee,I,o),this.emit("missingKey",oe,b,de,k)};this.options.saveMissing&&(this.options.saveMissingPlurals&&M?V.forEach(oe=>{const de=this.pluralResolver.getSuffixes(oe,o);C&&o[`defaultValue${this.options.pluralSeparator}zero`]&&!de.includes(`${this.options.pluralSeparator}zero`)&&de.push(`${this.options.pluralSeparator}zero`),de.forEach(ge=>{ue([oe],p+ge,o[`defaultValue${ge}`]||Q)})}):ue(V,p,Q))}k=this.extendTranslation(k,n,o,v,l),ie&&k===p&&this.options.appendNamespaceToMissingKey&&(k=`${b}${y}${p}`),(ie||ae)&&this.options.parseMissingKeyHandler&&(k=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${b}${y}${p}`:p,ae?k:void 0,o))}return u?(v.res=k,v.usedParams=this.getUsedParamsDetails(o),v):k}extendTranslation(n,r,l,o,u){var h,b;if((h=this.i18nFormat)!=null&&h.parse)n=this.i18nFormat.parse(n,{...this.options.interpolation.defaultVariables,...l},l.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!l.skipInterpolation){l.interpolation&&this.interpolator.init({...l,interpolation:{...this.options.interpolation,...l.interpolation}});const y=$e(n)&&(((b=l==null?void 0:l.interpolation)==null?void 0:b.skipOnVariables)!==void 0?l.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let x;if(y){const v=n.match(this.interpolator.nestingRegexp);x=v&&v.length}let w=l.replace&&!$e(l.replace)?l.replace:l;if(this.options.interpolation.defaultVariables&&(w={...this.options.interpolation.defaultVariables,...w}),n=this.interpolator.interpolate(n,w,l.lng||this.language||o.usedLng,l),y){const v=n.match(this.interpolator.nestingRegexp),k=v&&v.length;x<k&&(l.nest=!1)}!l.lng&&o&&o.res&&(l.lng=this.language||o.usedLng),l.nest!==!1&&(n=this.interpolator.nest(n,(...v)=>(u==null?void 0:u[0])===v[0]&&!l.context?(this.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${r[0]}`),null):this.translate(...v,r),l)),l.interpolation&&this.interpolator.reset()}const m=l.postProcess||this.options.postProcess,p=$e(m)?[m]:m;return n!=null&&(p!=null&&p.length)&&l.applyPostProcessor!==!1&&(n=Xg.handle(p,n,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(l)},...l}:l,this)),n}resolve(n,r={}){let l,o,u,m,p;return $e(n)&&(n=[n]),Array.isArray(n)&&(n=n.map(h=>typeof h=="function"?di(h,{...this.options,...r}):h)),n.forEach(h=>{if(this.isValidLookup(l))return;const b=this.extractFromKey(h,r),y=b.key;o=y;let x=b.namespaces;this.options.fallbackNS&&(x=x.concat(this.options.fallbackNS));const w=r.count!==void 0&&!$e(r.count),v=w&&!r.ordinal&&r.count===0,k=r.context!==void 0&&($e(r.context)||typeof r.context=="number")&&r.context!=="",_=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);x.forEach(j=>{var R,P;this.isValidLookup(l)||(p=j,!this.checkedLoadedFor[`${_[0]}-${j}`]&&((R=this.utils)!=null&&R.hasLoadedNamespace)&&!((P=this.utils)!=null&&P.hasLoadedNamespace(p))&&(this.checkedLoadedFor[`${_[0]}-${j}`]=!0,this.logger.warn(`key "${o}" for languages "${_.join(", ")}" won't get resolved as namespace "${p}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(z=>{var H;if(this.isValidLookup(l))return;m=z;const M=[y];if((H=this.i18nFormat)!=null&&H.addLookupKeys)this.i18nFormat.addLookupKeys(M,y,z,j,r);else{let F;w&&(F=this.pluralResolver.getSuffix(z,r.count,r));const C=`${this.options.pluralSeparator}zero`,Q=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(w&&(r.ordinal&&F.startsWith(Q)&&M.push(y+F.replace(Q,this.options.pluralSeparator)),M.push(y+F),v&&M.push(y+C)),k){const U=`${y}${this.options.contextSeparator||"_"}${r.context}`;M.push(U),w&&(r.ordinal&&F.startsWith(Q)&&M.push(U+F.replace(Q,this.options.pluralSeparator)),M.push(U+F),v&&M.push(U+C))}}let B;for(;B=M.pop();)this.isValidLookup(l)||(u=B,l=this.getResource(z,j,B,r))}))})}),{res:l,usedKey:o,exactUsedKey:u,usedLng:m,usedNS:p}}isValidLookup(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}getResource(n,r,l,o={}){var u;return(u=this.i18nFormat)!=null&&u.getResource?this.i18nFormat.getResource(n,r,l,o):this.resourceStore.getResource(n,r,l,o)}getUsedParamsDetails(n={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],l=n.replace&&!$e(n.replace);let o=l?n.replace:n;if(l&&typeof n.count<"u"&&(o.count=n.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!l){o={...o};for(const u of r)delete o[u]}return o}static hasDefaultValue(n){const r="defaultValue";for(const l in n)if(Object.prototype.hasOwnProperty.call(n,l)&&l.startsWith(r)&&n[l]!==void 0)return!0;return!1}}class Vh{constructor(n){this.options=n,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Un.create("languageUtils")}getScriptPartFromCode(n){if(n=gl(n),!n||!n.includes("-"))return null;const r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(n){if(n=gl(n),!n||!n.includes("-"))return n;const r=n.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(n){if($e(n)&&n.includes("-")){let r;try{r=Intl.getCanonicalLocales(n)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?n.toLowerCase():n)}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}isSupportedCode(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(n)}getBestMatchFromCodes(n){if(!n)return null;let r;return n.forEach(l=>{if(r)return;const o=this.formatLanguageCode(l);(!this.options.supportedLngs||this.isSupportedCode(o))&&(r=o)}),!r&&this.options.supportedLngs&&n.forEach(l=>{if(r)return;const o=this.getScriptPartFromCode(l);if(this.isSupportedCode(o))return r=o;const u=this.getLanguagePartFromCode(l);if(this.isSupportedCode(u))return r=u;r=this.options.supportedLngs.find(m=>m===u?!0:!m.includes("-")&&!u.includes("-")?!1:!!(m.includes("-")&&!u.includes("-")&&m.slice(0,m.indexOf("-"))===u||m.startsWith(u)&&u.length>1))}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),$e(n)&&(n=[n]),Array.isArray(n))return n;if(!r)return n.default||[];let l=n[r];return l||(l=n[this.getScriptPartFromCode(r)]),l||(l=n[this.formatLanguageCode(r)]),l||(l=n[this.getLanguagePartFromCode(r)]),l||(l=n.default),l||[]}toResolveHierarchy(n,r){const l=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],n),o=[],u=m=>{m&&(this.isSupportedCode(m)?o.push(m):this.logger.warn(`rejecting language code not found in supportedLngs: ${m}`))};return $e(n)&&(n.includes("-")||n.includes("_"))?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):$e(n)&&u(this.formatLanguageCode(n)),l.forEach(m=>{o.includes(m)||u(this.formatLanguageCode(m))}),o}}const Gh={zero:0,one:1,two:2,few:3,many:4,other:5},Ph={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class qx{constructor(n,r={}){this.languageUtils=n,this.options=r,this.logger=Un.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(n,r={}){const l=gl(n==="dev"?"en":n),o=r.ordinal?"ordinal":"cardinal",u=JSON.stringify({cleanedCode:l,type:o});if(u in this.pluralRulesCache)return this.pluralRulesCache[u];let m;try{m=new Intl.PluralRules(l,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Ph;if(!n.match(/-|_/))return Ph;const h=this.languageUtils.getLanguagePartFromCode(n);m=this.getRule(h,r)}return this.pluralRulesCache[u]=m,m}needsPlural(n,r={}){let l=this.getRule(n,r);return l||(l=this.getRule("dev",r)),(l==null?void 0:l.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(n,r,l={}){return this.getSuffixes(n,l).map(o=>`${r}${o}`)}getSuffixes(n,r={}){let l=this.getRule(n,r);return l||(l=this.getRule("dev",r)),l?l.resolvedOptions().pluralCategories.sort((o,u)=>Gh[o]-Gh[u]).map(o=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(n,r,l={}){const o=this.getRule(n,l);return o?`${this.options.prepend}${l.ordinal?`ordinal${this.options.prepend}`:""}${o.select(r)}`:(this.logger.warn(`no plural rule found for: ${n}`),this.getSuffix("dev",r,l))}}const Xh=(i,n,r,l=".",o=!0)=>{let u=Dx(i,n,r);return!u&&o&&$e(r)&&(u=Md(i,r,l),u===void 0&&(u=Md(n,r,l))),u},Sd=i=>i.replace(/\$/g,"$$$$");class Yh{constructor(n={}){var r;this.logger=Un.create("interpolator"),this.options=n,this.format=((r=n==null?void 0:n.interpolation)==null?void 0:r.format)||(l=>l),this.init(n)}init(n={}){n.interpolation||(n.interpolation={escapeValue:!0});const{escape:r,escapeValue:l,useRawValueToEscape:o,prefix:u,prefixEscaped:m,suffix:p,suffixEscaped:h,formatSeparator:b,unescapeSuffix:y,unescapePrefix:x,nestingPrefix:w,nestingPrefixEscaped:v,nestingSuffix:k,nestingSuffixEscaped:_,nestingOptionsSeparator:j,maxReplaces:R,alwaysFormat:P}=n.interpolation;this.escape=r!==void 0?r:Rx,this.escapeValue=l!==void 0?l:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=u?cs(u):m||"{{",this.suffix=p?cs(p):h||"}}",this.formatSeparator=b||",",this.unescapePrefix=y?"":x?cs(x):"-",this.unescapeSuffix=this.unescapePrefix?"":y?cs(y):"",this.nestingPrefix=w?cs(w):v||cs("$t("),this.nestingSuffix=k?cs(k):_||cs(")"),this.nestingOptionsSeparator=j||",",this.maxReplaces=R||1e3,this.alwaysFormat=P!==void 0?P:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const n=(r,l)=>(r==null?void 0:r.source)===l?(r.lastIndex=0,r):new RegExp(l,"g");this.regexp=n(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=n(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=n(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(n,r,l,o){var v;let u,m,p;const h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},b=k=>{if(!k.includes(this.formatSeparator)){const P=Xh(r,h,k,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(P,void 0,l,{...o,...r,interpolationkey:k}):P}const _=k.split(this.formatSeparator),j=_.shift().trim(),R=_.join(this.formatSeparator).trim();return this.format(Xh(r,h,j,this.options.keySeparator,this.options.ignoreJSONStructure),R,l,{...o,...r,interpolationkey:j})};this.resetRegExp(),!this.escapeValue&&typeof n=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(n)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const y=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,x=((v=o==null?void 0:o.interpolation)==null?void 0:v.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:k=>Sd(k)},{regex:this.regexp,safeValue:k=>this.escapeValue?Sd(this.escape(k)):Sd(k)}].forEach(k=>{for(p=0;u=k.regex.exec(n);){const _=u[1].trim();if(m=b(_),m===void 0)if(typeof y=="function"){const R=y(n,u,o);m=$e(R)?R:""}else if(o&&Object.prototype.hasOwnProperty.call(o,_))m="";else if(x){m=u[0];continue}else this.logger.warn(`missed to pass in variable ${_} for interpolating ${n}`),m="";else!$e(m)&&!this.useRawValueToEscape&&(m=Ih(m));const j=k.safeValue(m);if(n=n.replace(u[0],j),x?(k.regex.lastIndex+=m.length,k.regex.lastIndex-=u[0].length):k.regex.lastIndex=0,p++,p>=this.maxReplaces)break}}),n}nest(n,r,l={}){let o,u,m;const p=(h,b)=>{const y=this.nestingOptionsSeparator;if(!h.includes(y))return h;const x=h.split(new RegExp(`${cs(y)}[ ]*{`));let w=`{${x[1]}`;h=x[0],w=this.interpolate(w,m);const v=w.match(/'/g),k=w.match(/"/g);(((v==null?void 0:v.length)??0)%2===0&&!k||((k==null?void 0:k.length)??0)%2!==0)&&(w=w.replace(/'/g,'"'));try{m=JSON.parse(w),b&&(m={...b,...m})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${h}`,_),`${h}${y}${w}`}return m.defaultValue&&m.defaultValue.includes(this.prefix)&&delete m.defaultValue,h};for(;o=this.nestingRegexp.exec(n);){let h=[];m={...l},m=m.replace&&!$e(m.replace)?m.replace:m,m.applyPostProcessor=!1,delete m.defaultValue;const b=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(b!==-1&&(h=o[1].slice(b).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,b)),u=r(p.call(this,o[1].trim(),m),m),u&&o[0]===n&&!$e(u))return u;$e(u)||(u=Ih(u)),u||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${n}`),u=""),h.length&&(u=h.reduce((y,x)=>this.format(y,x,l.lng,{...l,interpolationkey:o[1].trim()}),u.trim())),n=n.replace(o[0],u),this.regexp.lastIndex=0}return n}}const Hx=i=>{let n=i.toLowerCase().trim();const r={};if(i.includes("(")){const l=i.split("(");n=l[0].toLowerCase().trim();const o=l[1].slice(0,-1);n==="currency"&&!o.includes(":")?r.currency||(r.currency=o.trim()):n==="relativetime"&&!o.includes(":")?r.range||(r.range=o.trim()):o.split(";").forEach(m=>{if(m){const[p,...h]=m.split(":"),b=h.join(":").trim().replace(/^'+|'+$/g,""),y=p.trim();r[y]||(r[y]=b),b==="false"&&(r[y]=!1),b==="true"&&(r[y]=!0),isNaN(b)||(r[y]=parseInt(b,10))}})}return{formatName:n,formatOptions:r}},Kh=i=>{const n={};return(r,l,o)=>{let u=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(u={...u,[o.interpolationkey]:void 0});const m=l+JSON.stringify(u);let p=n[m];return p||(p=i(gl(l),o),n[m]=p),p(r)}},Vx=i=>(n,r,l)=>i(gl(r),l)(n);class Gx{constructor(n={}){this.logger=Un.create("formatter"),this.options=n,this.init(n)}init(n,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const l=r.cacheInBuiltFormats?Kh:Vx;this.formats={number:l((o,u)=>{const m=new Intl.NumberFormat(o,{...u});return p=>m.format(p)}),currency:l((o,u)=>{const m=new Intl.NumberFormat(o,{...u,style:"currency"});return p=>m.format(p)}),datetime:l((o,u)=>{const m=new Intl.DateTimeFormat(o,{...u});return p=>m.format(p)}),relativetime:l((o,u)=>{const m=new Intl.RelativeTimeFormat(o,{...u});return p=>m.format(p,u.range||"day")}),list:l((o,u)=>{const m=new Intl.ListFormat(o,{...u});return p=>m.format(p)})}}add(n,r){this.formats[n.toLowerCase().trim()]=r}addCached(n,r){this.formats[n.toLowerCase().trim()]=Kh(r)}format(n,r,l,o={}){if(!r||n==null)return n;const u=r.split(this.formatSeparator),m=[];for(let h=0;h<u.length;h++){let b=u[h];for(;b.indexOf("(")>-1&&!b.includes(")")&&h+1<u.length;)b=`${b}${this.formatSeparator}${u[++h]}`;m.push(b)}return m.reduce((h,b)=>{var w;const{formatName:y,formatOptions:x}=Hx(b);if(this.formats[y]){let v=h;try{const k=((w=o==null?void 0:o.formatParams)==null?void 0:w[o.interpolationkey])||{},_=k.locale||k.lng||o.locale||o.lng||l;v=this.formats[y](h,_,{...x,...o,...k})}catch(k){this.logger.warn(k)}return v}else this.logger.warn(`there was no format function for ${y}`);return h},n)}}const Px=(i,n)=>{i.pending[n]!==void 0&&(delete i.pending[n],i.pendingCount--)};class Xx extends oc{constructor(n,r,l,o={}){var u,m;super(),this.backend=n,this.store=r,this.services=l,this.languageUtils=l.languageUtils,this.options=o,this.logger=Un.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(m=(u=this.backend)==null?void 0:u.init)==null||m.call(u,l,o.backend,o)}queueLoad(n,r,l,o){const u={},m={},p={},h={};return n.forEach(b=>{let y=!0;r.forEach(x=>{const w=`${b}|${x}`;!l.reload&&this.store.hasResourceBundle(b,x)?this.state[w]=2:this.state[w]<0||(this.state[w]===1?m[w]===void 0&&(m[w]=!0):(this.state[w]=1,y=!1,m[w]===void 0&&(m[w]=!0),u[w]===void 0&&(u[w]=!0),h[x]===void 0&&(h[x]=!0)))}),y||(p[b]=!0)}),(Object.keys(u).length||Object.keys(m).length)&&this.queue.push({pending:m,pendingCount:Object.keys(m).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(u),pending:Object.keys(m),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(h)}}loaded(n,r,l){const o=n.split("|"),u=o[0],m=o[1];r&&this.emit("failedLoading",u,m,r),!r&&l&&this.store.addResourceBundle(u,m,l,void 0,void 0,{skipCopy:!0}),this.state[n]=r?-1:2,r&&l&&(this.state[n]=0);const p={};this.queue.forEach(h=>{Mx(h.loaded,[u],m),Px(h,n),r&&h.errors.push(r),h.pendingCount===0&&!h.done&&(Object.keys(h.loaded).forEach(b=>{p[b]||(p[b]={});const y=h.loaded[b];y.length&&y.forEach(x=>{p[b][x]===void 0&&(p[b][x]=!0)})}),h.done=!0,h.errors.length?h.callback(h.errors):h.callback())}),this.emit("loaded",p),this.queue=this.queue.filter(h=>!h.done)}read(n,r,l,o=0,u=this.retryTimeout,m){if(!n.length)return m(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:n,ns:r,fcName:l,tried:o,wait:u,callback:m});return}this.readingCalls++;const p=(b,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const x=this.waitingReads.shift();this.read(x.lng,x.ns,x.fcName,x.tried,x.wait,x.callback)}if(b&&y&&o<this.maxRetries){setTimeout(()=>{this.read(n,r,l,o+1,u*2,m)},u);return}m(b,y)},h=this.backend[l].bind(this.backend);if(h.length===2){try{const b=h(n,r);b&&typeof b.then=="function"?b.then(y=>p(null,y)).catch(p):p(null,b)}catch(b){p(b)}return}return h(n,r,p)}prepareLoading(n,r,l={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();$e(n)&&(n=this.languageUtils.toResolveHierarchy(n)),$e(r)&&(r=[r]);const u=this.queueLoad(n,r,l,o);if(!u.toLoad.length)return u.pending.length||o(),null;u.toLoad.forEach(m=>{this.loadOne(m)})}load(n,r,l){this.prepareLoading(n,r,{},l)}reload(n,r,l){this.prepareLoading(n,r,{reload:!0},l)}loadOne(n,r=""){const l=n.split("|"),o=l[0],u=l[1];this.read(o,u,"read",void 0,void 0,(m,p)=>{m&&this.logger.warn(`${r}loading namespace ${u} for language ${o} failed`,m),!m&&p&&this.logger.log(`${r}loaded namespace ${u} for language ${o}`,p),this.loaded(n,m,p)})}saveMissing(n,r,l,o,u,m={},p=()=>{}){var h,b,y,x,w;if((b=(h=this.services)==null?void 0:h.utils)!=null&&b.hasLoadedNamespace&&!((x=(y=this.services)==null?void 0:y.utils)!=null&&x.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${l}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(l==null||l==="")){if((w=this.backend)!=null&&w.create){const v={...m,isUpdate:u},k=this.backend.create.bind(this.backend);if(k.length<6)try{let _;k.length===5?_=k(n,r,l,o,v):_=k(n,r,l,o),_&&typeof _.then=="function"?_.then(j=>p(null,j)).catch(p):p(null,_)}catch(_){p(_)}else k(n,r,l,o,p,v)}!n||!n[0]||this.store.addResource(n[0],r,l,o)}}}const wd=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let n={};if(typeof i[1]=="object"&&(n=i[1]),$e(i[1])&&(n.defaultValue=i[1]),$e(i[2])&&(n.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(l=>{n[l]=r[l]})}return n},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Qh=i=>($e(i.ns)&&(i.ns=[i.ns]),$e(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),$e(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&!i.supportedLngs.includes("cimode")&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i),Do=()=>{},Yx=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})};class ml extends oc{constructor(n={},r){if(super(),this.options=Qh(n),this.services={},this.logger=Un,this.modules={external:[]},Yx(this),r&&!this.isInitialized&&!n.isClone){if(!this.options.initAsync)return this.init(n,r),this;setTimeout(()=>{this.init(n,r)},0)}}init(n={},r){this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),n.defaultNS==null&&n.ns&&($e(n.ns)?n.defaultNS=n.ns:n.ns.includes("translation")||(n.defaultNS=n.ns[0]));const l=wd();this.options={...l,...this.options,...Qh(n)},this.options.interpolation={...l.interpolation,...this.options.interpolation},n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=l.overloadTranslationOptionHandler);const o=b=>b?typeof b=="function"?new b:b:null;if(!this.options.isClone){this.modules.logger?Un.init(o(this.modules.logger),this.options):Un.init(null,this.options);let b;this.modules.formatter?b=this.modules.formatter:b=Gx;const y=new Vh(this.options);this.store=new Hh(this.options.resources,this.options);const x=this.services;x.logger=Un,x.resourceStore=this.store,x.languageUtils=y,x.pluralResolver=new qx(y,{prepend:this.options.pluralSeparator}),b&&(x.formatter=o(b),x.formatter.init&&x.formatter.init(x,this.options),this.options.interpolation.format=x.formatter.format.bind(x.formatter)),x.interpolator=new Yh(this.options),x.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},x.backendConnector=new Xx(o(this.modules.backend),x.resourceStore,x,this.options),x.backendConnector.on("*",(w,...v)=>{this.emit(w,...v)}),this.modules.languageDetector&&(x.languageDetector=o(this.modules.languageDetector),x.languageDetector.init&&x.languageDetector.init(x,this.options.detection,this.options)),this.modules.i18nFormat&&(x.i18nFormat=o(this.modules.i18nFormat),x.i18nFormat.init&&x.i18nFormat.init(this)),this.translator=new Jo(this.services,this.options),this.translator.on("*",(w,...v)=>{this.emit(w,...v)}),this.modules.external.forEach(w=>{w.init&&w.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Do),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const b=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);b.length>0&&b[0]!=="dev"&&(this.options.lng=b[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(b=>{this[b]=(...y)=>this.store[b](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(b=>{this[b]=(...y)=>(this.store[b](...y),this)});const p=ol(),h=()=>{const b=(y,x)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),p.resolve(x),r(y,x)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return b(null,this.t.bind(this));this.changeLanguage(this.options.lng,b)};return this.options.resources||!this.options.initAsync?h():setTimeout(h,0),p}loadResources(n,r=Do){var u,m;let l=r;const o=$e(n)?n:this.language;if(typeof n=="function"&&(l=n),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return l();const p=[],h=b=>{if(!b||b==="cimode")return;this.services.languageUtils.toResolveHierarchy(b).forEach(x=>{x!=="cimode"&&(p.includes(x)||p.push(x))})};o?h(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(y=>h(y)),(m=(u=this.options.preload)==null?void 0:u.forEach)==null||m.call(u,b=>h(b)),this.services.backendConnector.load(p,this.options.ns,b=>{!b&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),l(b)})}else l(null)}reloadResources(n,r,l){const o=ol();return typeof n=="function"&&(l=n,n=void 0),typeof r=="function"&&(l=r,r=void 0),n||(n=this.languages),r||(r=this.options.ns),l||(l=Do),this.services.backendConnector.reload(n,r,u=>{o.resolve(),l(u)}),o}use(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&Xg.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}setResolvedLanguage(n){if(!(!n||!this.languages)&&!["cimode","dev"].includes(n)){for(let r=0;r<this.languages.length;r++){const l=this.languages[r];if(!["cimode","dev"].includes(l)&&this.store.hasLanguageSomeTranslations(l)){this.resolvedLanguage=l;break}}!this.resolvedLanguage&&!this.languages.includes(n)&&this.store.hasLanguageSomeTranslations(n)&&(this.resolvedLanguage=n,this.languages.unshift(n))}}changeLanguage(n,r){this.isLanguageChangingTo=n;const l=ol();this.emit("languageChanging",n);const o=p=>{this.language=p,this.languages=this.services.languageUtils.toResolveHierarchy(p),this.resolvedLanguage=void 0,this.setResolvedLanguage(p)},u=(p,h)=>{h?this.isLanguageChangingTo===n&&(o(h),this.translator.changeLanguage(h),this.isLanguageChangingTo=void 0,this.emit("languageChanged",h),this.logger.log("languageChanged",h)):this.isLanguageChangingTo=void 0,l.resolve((...b)=>this.t(...b)),r&&r(p,(...b)=>this.t(...b))},m=p=>{var y,x;!n&&!p&&this.services.languageDetector&&(p=[]);const h=$e(p)?p:p&&p[0],b=this.store.hasLanguageSomeTranslations(h)?h:this.services.languageUtils.getBestMatchFromCodes($e(p)?[p]:p);b&&(this.language||o(b),this.translator.language||this.translator.changeLanguage(b),(x=(y=this.services.languageDetector)==null?void 0:y.cacheUserLanguage)==null||x.call(y,b)),this.loadResources(b,w=>{u(w,b)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?m(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(m):this.services.languageDetector.detect(m):m(n),l}getFixedT(n,r,l,o){const u=o==null?void 0:o.scopeNs,m=(p,h,...b)=>{let y;typeof h!="object"?y=this.options.overloadTranslationOptionHandler([p,h].concat(b)):y={...h},y.lng=y.lng||m.lng,y.lngs=y.lngs||m.lngs;const x=y.ns!==void 0&&y.ns!==null;y.ns=y.ns||m.ns,y.keyPrefix!==""&&(y.keyPrefix=y.keyPrefix||l||m.keyPrefix);const w={...this.options,...y};Array.isArray(u)&&!x&&(w.ns=u),typeof y.keyPrefix=="function"&&(y.keyPrefix=di(y.keyPrefix,w));const v=this.options.keySeparator||".";let k;return y.keyPrefix&&Array.isArray(p)?k=p.map(_=>(typeof _=="function"&&(_=di(_,w)),`${y.keyPrefix}${v}${_}`)):(typeof p=="function"&&(p=di(p,w)),k=y.keyPrefix?`${y.keyPrefix}${v}${p}`:p),this.t(k,y)};return $e(n)?m.lng=n:m.lngs=n,m.ns=r,m.keyPrefix=l,m}t(...n){var r;return(r=this.translator)==null?void 0:r.translate(...n)}exists(...n){var r;return(r=this.translator)==null?void 0:r.exists(...n)}setDefaultNamespace(n){this.options.defaultNS=n}hasLoadedNamespace(n,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const l=r.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,u=this.languages[this.languages.length-1];if(l.toLowerCase()==="cimode")return!0;const m=(p,h)=>{const b=this.services.backendConnector.state[`${p}|${h}`];return b===-1||b===0||b===2};if(r.precheck){const p=r.precheck(this,m);if(p!==void 0)return p}return!!(this.hasResourceBundle(l,n)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||m(l,n)&&(!o||m(u,n)))}loadNamespaces(n,r){const l=ol();return this.options.ns?($e(n)&&(n=[n]),n.forEach(o=>{this.options.ns.includes(o)||this.options.ns.push(o)}),this.loadResources(o=>{l.resolve(),r&&r(o)}),l):(r&&r(),Promise.resolve())}loadLanguages(n,r){const l=ol();$e(n)&&(n=[n]);const o=this.options.preload||[],u=n.filter(m=>!o.includes(m)&&this.services.languageUtils.isSupportedCode(m));return u.length?(this.options.preload=o.concat(u),this.loadResources(m=>{l.resolve(),r&&r(m)}),l):(r&&r(),Promise.resolve())}dir(n){var o,u;if(n||(n=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!n)return"rtl";try{const m=new Intl.Locale(n);if(m&&m.getTextInfo){const p=m.getTextInfo();if(p&&p.direction)return p.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],l=((u=this.services)==null?void 0:u.languageUtils)||new Vh(wd());return n.toLowerCase().indexOf("-latn")>1?"ltr":r.includes(l.getLanguagePartFromCode(n))||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(n={},r){const l=new ml(n,r);return l.createInstance=ml.createInstance,l}cloneInstance(n={},r=Do){const l=n.forkResourceStore;l&&delete n.forkResourceStore;const o={...this.options,...n,isClone:!0},u=new ml(o);if((n.debug!==void 0||n.prefix!==void 0)&&(u.logger=u.logger.clone(n)),["store","services","language"].forEach(p=>{u[p]=this[p]}),u.services={...this.services},u.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},l){const p=Object.keys(this.store.data).reduce((h,b)=>(h[b]={...this.store.data[b]},h[b]=Object.keys(h[b]).reduce((y,x)=>(y[x]={...h[b][x]},y),h[b]),h),{});u.store=new Hh(p,o),u.services.resourceStore=u.store}if(n.interpolation){const h={...wd().interpolation,...this.options.interpolation,...n.interpolation},b={...o,interpolation:h};u.services.interpolator=new Yh(b)}return u.translator=new Jo(u.services,o),u.translator.on("*",(p,...h)=>{u.emit(p,...h)}),u.init(o,r),u.translator.options=o,u.translator.backendConnector.services.utils={hasLoadedNamespace:u.hasLoadedNamespace.bind(u)},u}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const pa=ml.createInstance();pa.createInstance;pa.dir;pa.init;pa.loadResources;pa.reloadResources;pa.use;pa.changeLanguage;pa.getFixedT;pa.t;pa.exists;pa.setDefaultNamespace;pa.hasLoadedNamespace;pa.loadNamespaces;pa.loadLanguages;const Kx=(i,n,r,l)=>{var u,m,p,h;const o=[r,{code:n,...l||{}}];if((m=(u=i==null?void 0:i.services)==null?void 0:u.logger)!=null&&m.forward)return i.services.logger.forward(o,"warn","react-i18next::",!0);wr(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(h=(p=i==null?void 0:i.services)==null?void 0:p.logger)!=null&&h.warn?i.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},Zh={},Dd=(i,n,r,l)=>{wr(r)&&Zh[r]||(wr(r)&&(Zh[r]=new Date),Kx(i,n,r,l))},Kg=(i,n)=>()=>{if(i.isInitialized)n();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),n()};i.on("initialized",r)}},zd=(i,n,r)=>{i.loadNamespaces(n,Kg(i,r))},Jh=(i,n,r,l)=>{if(wr(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(n)>-1)return zd(i,r,l);r.forEach(o=>{i.options.ns.indexOf(o)<0&&i.options.ns.push(o)}),i.loadLanguages(n,Kg(i,l))},Qx=(i,n,r={})=>!n.languages||!n.languages.length?(Dd(n,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:n.languages}),!0):n.hasLoadedNamespace(i,{lng:r.lng,precheck:(l,o)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&l.services.backendConnector.backend&&l.isLanguageChangingTo&&!o(l.isLanguageChangingTo,i))return!1}}),wr=i=>typeof i=="string",Zx=i=>typeof i=="object"&&i!==null,Jx=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Wx={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ey=i=>Wx[i],ty=i=>i.replace(Jx,ey);let Rd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ty,transDefaultProps:void 0};const ay=(i={})=>{Rd={...Rd,...i}},ny=()=>Rd;let Qg;const sy=i=>{Qg=i},ry=()=>Qg,iy={type:"3rdParty",init(i){ay(i.options.react),sy(i)}},ly=S.createContext();class oy{constructor(){this.usedNamespaces={}}addUsedNamespaces(n){n.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var kd={exports:{}},Ad={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* use-sync-external-store-shim.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var Wh;function cy(){if(Wh)return Ad;Wh=1;var i=qg();function n(x,w){return x===w&&(x!==0||1/x===1/w)||x!==x&&w!==w}var r=typeof Object.is=="function"?Object.is:n,l=i.useState,o=i.useEffect,u=i.useLayoutEffect,m=i.useDebugValue;function p(x,w){var v=w(),k=l({inst:{value:v,getSnapshot:w}}),_=k[0].inst,j=k[1];return u(function(){_.value=v,_.getSnapshot=w,h(_)&&j({inst:_})},[x,v,w]),o(function(){return h(_)&&j({inst:_}),x(function(){h(_)&&j({inst:_})})},[x]),m(v),v}function h(x){var w=x.getSnapshot;x=x.value;try{var v=w();return!r(x,v)}catch{return!0}}function b(x,w){return w()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b:p;return Ad.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:y,Ad}var eg;function uy(){return eg||(eg=1,kd.exports=cy()),kd.exports}var dy=uy();const fy=(i,n)=>{if(wr(n))return n;if(Zx(n)&&wr(n.defaultValue))return n.defaultValue;if(typeof i=="function")return"";if(Array.isArray(i)){const r=i[i.length-1];return typeof r=="function"?"":r}return i},my={t:fy,ready:!1},py=()=>()=>{},pt=(i,n={})=>{var Q,U,Y;const{i18n:r}=n,{i18n:l,defaultNS:o}=S.useContext(ly)||{},u=r||l||ry();u&&!u.reportNamespaces&&(u.reportNamespaces=new oy),u||Dd(u,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const m=S.useMemo(()=>{var J;return{...ny(),...(J=u==null?void 0:u.options)==null?void 0:J.react,...n}},[u,n]),{useSuspense:p,keyPrefix:h}=m,b=o||((Q=u==null?void 0:u.options)==null?void 0:Q.defaultNS),y=wr(b)?[b]:b||["translation"],x=S.useMemo(()=>y,y);(Y=(U=u==null?void 0:u.reportNamespaces)==null?void 0:U.addUsedNamespaces)==null||Y.call(U,x);const w=S.useRef(0),v=S.useCallback(J=>{if(!u)return py;const{bindI18n:ae,bindI18nStore:ie}=m,G=()=>{w.current+=1,J()};return ae&&u.on(ae,G),ie&&u.store.on(ie,G),()=>{ae&&ae.split(" ").forEach(E=>u.off(E,G)),ie&&ie.split(" ").forEach(E=>u.store.off(E,G))}},[u,m]),k=S.useRef(),_=S.useCallback(()=>{if(!u)return my;const J=!!(u.isInitialized||u.initializedStoreOnce)&&x.every(V=>Qx(V,u,m)),ae=n.lng||u.language,ie=w.current,G=k.current;if(G&&G.ready===J&&G.lng===ae&&G.keyPrefix===h&&G.revision===ie)return G;const I={t:u.getFixedT(ae,m.nsMode==="fallback"?x:x[0],h,{scopeNs:x}),ready:J,lng:ae,keyPrefix:h,revision:ie};return k.current=I,I},[u,x,h,m,n.lng]),[j,R]=S.useState(0),{t:P,ready:z}=dy.useSyncExternalStore(v,_,_);S.useEffect(()=>{if(u&&!z&&!p){const J=()=>R(ae=>ae+1);n.lng?Jh(u,n.lng,x,J):zd(u,x,J)}},[u,n.lng,x,z,p,j]);const M=u||{},B=S.useRef(null),H=S.useRef(),F=J=>{const ae=Object.getOwnPropertyDescriptors(J);ae.__original&&delete ae.__original;const ie=Object.create(Object.getPrototypeOf(J),ae);if(!Object.prototype.hasOwnProperty.call(ie,"__original"))try{Object.defineProperty(ie,"__original",{value:J,writable:!1,enumerable:!1,configurable:!1})}catch{}return ie},C=S.useMemo(()=>{const J=M,ae=J==null?void 0:J.language;let ie=J;J&&(B.current&&B.current.__original===J?H.current!==ae?(ie=F(J),B.current=ie,H.current=ae):ie=B.current:(ie=F(J),B.current=ie,H.current=ae));const G=!z&&!p?(...I)=>(Dd(u,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),P(...I)):P,E=[G,ie,z];return E.t=G,E.i18n=ie,E.ready=z,E},[P,M,z,M.resolvedLanguage,M.language,M.languages]);if(u&&p&&!z)throw new Promise(J=>{const ae=()=>J();n.lng?Jh(u,n.lng,x,ae):zd(u,x,ae)});return C},hy={cancel:"Cancel",close:"Close",confirm:"Confirm",delete:"Delete",remove:"Remove",clear:"Clear",send:"Send",signIn:"Sign in",logOut:"Log out",download:"Download"},gy={sidebar:{openAriaLabel:"Open sidebar",openTitle:"Open sidebar"},menu:{closeAriaLabel:"Close menu"}},by={workspace:{ariaLabel:"Chat workspace"},error:{dismissAriaLabel:"Dismiss error"},mobile:{chatsButton:"Chats",openChatsMenuAriaLabel:"Open conversations menu",settingsButton:"Settings",openSettingsAriaLabel:"Open settings"},settings:{ariaLabel:"Settings",title:"Settings"},changeAgent:{button:"Change Agent",titleEnabled:"Switch to a different agent before starting this conversation",titleDisabled:"Agent cannot be changed after the conversation has started"},newConversation:{button:"New Conversation",tooltipCanStart:"Start a new conversation",tooltipGuestLimited:"Guest conversation limit reached. Sign in for more conversations.",tooltipCannotStart:"Finish your current conversation before starting a new one."},empty:{configuringAgent:"Configuring your agent…"},newChatTitle:"New Chat",updatedAt:"Updated {{time}}",docked:{placeholder:"Start a new topic..."}},xy={dialog:{closeOverlayAriaLabel:"Close settings overlay",title:"Settings",closeButtonAriaLabel:"Close settings"},appearance:{heading:"Appearance",themeLabel:"Theme",themeLight:"Light",themeDark:"Dark",themeSystem:"System"},language:{label:"Language"},chat:{heading:"Chat Preferences"},soundEffects:{label:"Sound Effects",description:"Play sounds for notifications and events",toggleAriaLabel:"Toggle sound effects"},dataManagement:{heading:"Data Management",description:"Clear all application data including conversations, and personalized settings."},reset:{button:"Reset Application",confirmTitle:"Reset application data?",confirmMessage:"This removes everything stored on this device and reloads the app.",confirmButton:"Reset"}},yy={selectAgent:{title:"Select an Agent"},deleteAllConversations:{title:"Delete all conversations",button:"Delete Conversations"},navAriaLabel:"Conversation sidebar",adapterConfigureFailed:"Failed to configure adapter",collapse:{ariaLabel:"Close sidebar",title:"Close sidebar"},search:{ariaLabel:"Search conversations",placeholder:"Search Conversations",clearAriaLabel:"Clear search"},resultsNone:"No results",results_one:"{{count}} result",results_other:"{{count}} results",conversations:{ariaLabel:"Conversations"},timeGroups:{today:"Today",yesterday:"Yesterday",thisWeek:"This Week",thisMonth:"This Month",earlier:"Earlier"},conversationCard:{openAriaLabel:"Open conversation: {{title}}",editAriaLabel:"Rename conversation: {{title}}",deleteAriaLabel:"Delete conversation: {{title}}",editInputAriaLabel:"Edit conversation title"},deleteConfirm:{title:"Delete Conversation",message:'Are you sure you want to delete "{{title}}"? This will clear the conversation history.',confirmText:"Delete"},clearAllConfirm:{title:"Clear All Conversations",message_one:"Are you sure you want to delete this conversation? This will clear all conversation history.",message_other:"Are you sure you want to delete all {{count}} conversations? This will clear all conversation history.",confirmText:"Clear All"}},vy={textarea:{ariaLabel:"Message input"},skillsHint:{ariaLabel:"Show available skills (or type a forward slash)",title:"Use a skill",text:"Skills"},selectedSkill:{removeAriaLabel:"Remove skill"},fileUpload:{attachAriaLabel:"Attach files",titleNotSupported:"File upload not supported by this adapter",titleLimitPerConversation:"Maximum of {{count}} files reached in this conversation. Start a new chat to upload more.",titleLimitWorkspace:"Workspace limit of {{count}} total files reached. Remove files from other conversations first.",titleUploading:"Files are uploading. Please wait...",titleAttached:"{{count}} file(s) attached"},voiceOutput:{titleEnabled:"Voice responses enabled - Click to disable",titleDisabled:"Enable voice responses (text-to-speech)",ariaLabelEnabled:"Disable voice responses",ariaLabelDisabled:"Enable voice responses"},voiceInput:{titleUploading:"Files are uploading. Please wait...",titleListening:"Stop recording",titleDisabled:"Start voice input",ariaLabelListening:"Stop recording",ariaLabelDisabled:"Start voice input"},agentInfo:{title:"About this agent",ariaLabel:"About this agent"},submit:{title:"Send message",ariaLabel:"Send message"},stop:{title:"Stop generating",ariaLabel:"Stop generating"},attachedFile:{uploadingStatus:"Uploading...",processingStatus:"Processing...",failedStatus:"Failed",removeTitleFailed:"Dismiss",removeTitleNormal:"Remove file"},uploadPanel:{headingAttach:"Attach files",headingUploading:"Uploading files",closeTitle:"Close"},uploadProgress:{statusUploading:"Uploading",statusProcessing:"Processing",statusCompleted:"Done",statusPending:"Pending"},listeningIndicator:"Listening...",fileDelete:{title:"Remove File",message:'Are you sure you want to remove "{{filename}}"? This will delete the file from both the server and this conversation. This action cannot be undone.',confirmText:"Remove"},agentInfoModal:{title:"About this agent",closeAriaLabel:"Close",confirmButton:"Got it"},placeholder:{filesUploading:"Files are uploading, please wait...",messageOrbit:"Message ORBIT or drop files here",guestLimitTotal:"Guest limit of {{count}} messages reached. Sign in for higher limits.",workspaceLimitTotal:"Workspace limit of {{count}} messages reached. Delete or archive old conversations to continue.",guestLimitPerConversation:"Guest limit of {{count}} messages reached. Sign in for higher limits.",conversationLimitReached:"This chat hit the {{count}} message limit. Start a new conversation to continue."},limitWarning:{guestTotalMessages:"Guest limit of {{count}} total messages reached. Sign in for higher limits, or delete conversations to start over.",workspaceTotalMessages:"Workspace limit of {{count}} total messages reached. Delete or export older conversations to continue.",guestPerConversation:"Guest limit of {{count}} messages per conversation reached. Sign in for higher limits, or delete conversations to start over.",conversationLimitReached:"This conversation reached the {{count}} message limit. Start a new conversation to keep chatting."},signInPrompt:{button:"Sign in for higher limits",message:"Sign in to unlock higher message limits and more conversations."},autocompletePanel:{ariaLabel:"Autocomplete suggestions"},uploadSuccess:{single:'File "{{filename}}" uploaded successfully',multiple:"{{count}} files uploaded successfully"},conversationNotFoundShort:"Conversation not found. Please select a conversation first.",fileRemoveFailed:"Failed to remove file",fileProcessingFailedTitle:"File processing failed"},Sy={signOutButton:{title:"Log out",ariaLabel:"Log out"}},wy={heading:"Sign in for more"},ky={statusBadge:"Service paused",heading:"Temporarily unavailable",retryButton:"Try again"},Ay={loadingLabel:"Clearing..."},_y={homeLinkAriaLabel:"Go to home page",logoAlt:"Logo",navLinksAriaLabel:"Header links"},Cy={navLinksAriaLabel:"Footer links"},Ty={configureMessage:"Configure this agent to see its capabilities.",startConversationAriaLabel:"Start conversation with {{name}}"},Ny={codeBlock:{copied:"Copied!",copyTitle:"Copy code",copyAriaLabel:"Copy code to clipboard",copyLabel:"Copy",loadingRenderer:"Loading renderer..."},diagram:{copyCodeAriaLabel:"Copy diagram code to clipboard",exportPngTitle:"Export as PNG",exportPngAriaLabel:"Export diagram as PNG image",errorTitle:"Mermaid Diagram Error"},music:{copyNotationAriaLabel:"Copy ABC notation to clipboard",exportPngTitle:"Export as PNG",exportPngAriaLabel:"Export music notation as PNG image",rendering:"Rendering notation..."},svg:{copyCodeAriaLabel:"Copy SVG code to clipboard",exportPngTitle:"Export as PNG",exportPngAriaLabel:"Export SVG as PNG image"},chart:{legendAriaLabel:"Chart legend",copyCodeAriaLabel:"Copy chart code to clipboard",exportPngTitle:"Export as PNG",exportPngAriaLabel:"Export chart as PNG image",errorTitle:"Chart Rendering Error",loadingAriaLabel:"Loading chart",showRawSource:"Show raw source"}},jy={defaultLabel:"Adapter",selectAnAgent:"Select an agent",loadingAgents:"Loading agents…",errorLoadingAgents:"Error loading agents",noAgentsAvailable:"No agents available",failedToLoad:"Failed to load adapters. Please check your connection."},Ey={searchPlaceholder:"Search agents",clearSearchAriaLabel:"Clear search",noAgentsAvailable:"No agents are available yet. Configure adapters in your middleware settings to continue.",noSearchResults:"No agents match your search.",unableToLoad:"Unable to load agents right now."},Ly={selectBeforeUpload:"Please select or create a conversation before uploading files.",conversationNotFound:"Conversation not found. Please try again.",maxFilesPerConversationError:"Maximum {{count}} files allowed per conversation. Please remove some files first.",maxFilesGuestLimitMessage:"You've reached the guest limit of {{count}} files per conversation. Sign in to upload more files.",maxTotalFilesError:"Maximum {{count}} total files allowed across all conversations. Please remove some files from other conversations first.",maxTotalFilesGuestLimitMessage:"You've reached the guest limit of {{count}} total files. Sign in to upload more files.",adapterNotConfigured:"Adapter not configured for this conversation. Please select an adapter first.",disabledAriaLabel:"File upload disabled",enabledAriaLabel:"Upload files",dragDropText:"Drop files or click to browse",draggingText:"Drop files here",fileTypesAndLimit:"PDF, DOCX, TXT, CSV, code files, images, audio · max {{count}} files",otherConversationsLabel:"Other conversations",uploadingStatus:"Uploading",processingStatus:"Processing",completedStatus:"Done",failedStatus:"Failed",processingFailedMessage:"Processing failed"},My={header:"Files ({{count}})",noFilesAttached:"No files attached",uploadFilesToUse:"Upload files to use them in this conversation",removeFileTooltip:"Remove file",confirmRemoveTitle:"Remove File",confirmRemoveMessage:'Are you sure you want to remove "{{filename}}"? This will delete the file from both the server and this conversation. This action cannot be undone.'},Dy={generatedDocument:"Generated document",loadingPreview:"Loading preview...",openPreviewTooltip:"Open preview",downloadDocumentTooltip:"Download document",noSheetDataFound:"No sheet data found.",csvRowsPreviewMessage:"Showing first 25 of {{count}} rows — download for the full file.",noDataFound:"No data found.",previewUnavailable:"Preview is not available for this format. Use download to open it locally.",previewUnavailableShort:"Preview unavailable"},zy={generatedImageTitle:"Generated image — click to enlarge",generatedImageAlt:"Generated image",downloadImageTooltip:"Download image",viewFullSizeTooltip:"View full size",showPrompt:"Show prompt",hidePrompt:"Hide prompt",promptLabel:"Prompt"},Ry={downloadVideoTooltip:"Download video",viewFullSizeTooltip:"View full size",showPrompt:"Show prompt",hidePrompt:"Hide prompt",promptLabel:"Prompt"},Oy={button:{audioPlayingTitle:"Audio playing...",voiceEnabledTitle:"Voice enabled - Click to disable",enableVoiceTitle:"Click to enable voice responses",playingLabel:"Playing...",voiceOnLabel:"Voice On",enableVoiceLabel:"Enable Voice"},player:{audioFileTooLargePlaceholder:"Audio file too large ({{sizeMB}}MB > {{maxMB}}MB limit)",largeAudioWarning:"Large audio file ({{sizeMB}}MB) - may take time to load",invalidBase64Error:"Invalid base64 audio data",loadFailureError:"Failed to load audio",playbackFailureError:"Playback failed",pauseTitle:"Pause",playTitle:"Play",pauseAriaLabel:"Pause audio",playAriaLabel:"Play audio"}},Uy={searchPlaceholder:"Search models…",searchAriaLabel:"Search models",noModelsMatch:'No models match "{{query}}"',modelCountHint:"{{filtered}} of {{total}} models",selectModel:"Select model"},$y={noSkillsAvailable:"No skills available for this adapter.",loadingLabel:"Loading skills...",noMatchingSkills:'No matching skills for "{{query}}".',noMatchingSkillsGeneric:"No matching skills.",listboxLabel:"Available skills"},Iy={edit:{willRegenerateHint:"Will regenerate response"},copyImageLabel:"Copy image to clipboard",copyLabel:"Copy to clipboard",feedback:{good:"Good response",poor:"Poor response",thanks:"Thanks!"},editAriaLabel:"Edit message",regenerateTitle:"Regenerate response",regenerateAriaLabel:"Regenerate response",thread:{continueDiscussionTitle:"Continue this discussion with the current answer's context",continueDiscussionAriaLabel:"Continue this discussion with the current answer's context",continueLabel:"Continue",replyCount_one:"{{count}} reply",replyCount_other:"{{count}} replies",clearTitle:"Clear replies",clearAriaLabel:"Clear replies",hideRepliesAriaLabel:"Hide replies",hideRepliesLabel:"Hide replies",placeholder:"Reply in thread...",skillsHint:"Use a skill",skillsHintAriaLabel:"Show available skills (or type a forward slash)",removeSkillAriaLabel:"Remove thread skill",sendMessageTitle:"Send thread message",selectModelTitle:"Select model for this thread",limitReachedGuest:"You've reached the guest limit of {{count}} messages per thread. Sign in to continue this thread.",limitReachedUser:"This thread reached the {{count}} message limit. Start a new conversation for more follow-ups.",signInForHigherLimits:"Sign in for higher limits",signInPromptMessage:"Sign in to unlock higher message limits and continue this thread."},confirmation:{clearRepliesTitle:"Clear Replies",clearRepliesMessage:"Are you sure you want to clear these replies? This removes the child thread from the backend without deleting the main conversation."}},Fy={emptyStateHeading:"Your messages will appear here.",emptyStateSubheading:"Start the conversation by sending a prompt below."},By={browserNotSupported:"Speech recognition is not supported in this browser. Please try Chrome, Edge, or Safari.",error:{noSpeech:"No speech detected. Please try again.",audioCapture:"Microphone access denied. Please allow microphone access and try again.",notAllowed:"Microphone access not allowed. Please enable microphone permissions.",network:"Network error occurred. Please check your connection.",generic:"Speech recognition error: {{error}}",startFailed:"Failed to start speech recognition. Please try again."}},qy={error:{singleAdapterMissing:"Single adapter mode requires agentMode.defaultAdapterId to match an adapter id in orbitchat.yaml.",configurationFailed:"Unable to configure this agent.",authenticationFailed:"We couldn't load this agent. It may not exist or you might not have access to it.",notFound:"This agent was not found on the server. Please pick another agent.",loadFailed:"Unable to load agent overview right now."}},Hy={common:hy,app:gy,chatInterface:by,settings:xy,sidebar:yy,messageInput:vy,authStatus:Sy,loginPrompt:wy,outOfService:ky,confirmationModal:Ay,appHeader:_y,appFooter:Cy,agentCard:Ty,markdown:Ny,adapterSelector:jy,agentSelectionList:Ey,fileUpload:Ly,fileList:My,documentDisplay:Dy,imageDisplay:zy,videoDisplay:Ry,audio:Oy,modelPicker:Uy,skillPicker:$y,message:Iy,messageList:Fy,voice:By,agent:qy},Vy={cancel:"Annuler",close:"Fermer",confirm:"Confirmer",delete:"Supprimer",remove:"Retirer",clear:"Effacer",send:"Envoyer",signIn:"Se connecter",logOut:"Se déconnecter",download:"Télécharger"},Gy={sidebar:{openAriaLabel:"Ouvrir la barre latérale",openTitle:"Ouvrir la barre latérale"},menu:{closeAriaLabel:"Fermer le menu"}},Py={workspace:{ariaLabel:"Espace de conversation"},error:{dismissAriaLabel:"Ignorer l'erreur"},mobile:{chatsButton:"Discussions",openChatsMenuAriaLabel:"Ouvrir le menu des conversations",settingsButton:"Paramètres",openSettingsAriaLabel:"Ouvrir les paramètres"},settings:{ariaLabel:"Paramètres",title:"Paramètres"},changeAgent:{button:"Changer d'agent",titleEnabled:"Changez d'agent avant de commencer cette conversation",titleDisabled:"L'agent ne peut pas être changé une fois la conversation commencée"},newConversation:{button:"Nouvelle",tooltipCanStart:"Démarrer une nouvelle conversation",tooltipGuestLimited:"Limite de conversations invité atteinte. Connectez-vous pour plus de conversations.",tooltipCannotStart:"Terminez votre conversation actuelle avant d'en démarrer une nouvelle."},empty:{configuringAgent:"Configuration de votre agent…"},newChatTitle:"Nouvelle",updatedAt:"Mis à jour {{time}}",docked:{placeholder:"Démarrer un nouveau sujet..."}},Xy={dialog:{closeOverlayAriaLabel:"Fermer la fenêtre des paramètres",title:"Paramètres",closeButtonAriaLabel:"Fermer les paramètres"},appearance:{heading:"Apparence",themeLabel:"Thème",themeLight:"Clair",themeDark:"Sombre",themeSystem:"Système"},language:{label:"Langue"},chat:{heading:"Préférences"},soundEffects:{label:"Effets sonores",description:"Jouer des sons pour les notifications et les événements",toggleAriaLabel:"Activer ou désactiver les effets sonores"},dataManagement:{heading:"Gestion des données",description:"Effacer toutes les données de l'application, y compris les conversations et les paramètres personnalisés."},reset:{button:"Réinitialiser l'application",confirmTitle:"Réinitialiser les données de l'application?",confirmMessage:"Cette action supprime tout ce qui est stocké sur cet appareil et recharge l'application.",confirmButton:"Réinitialiser"}},Yy={selectAgent:{title:"Sélectionner un agent"},deleteAllConversations:{title:"Tout effacer",button:"Tout effacer"},navAriaLabel:"Barre latérale des conversations",adapterConfigureFailed:"Échec de la configuration de l'adaptateur",collapse:{ariaLabel:"Fermer la barre latérale",title:"Fermer la barre latérale"},search:{ariaLabel:"Rechercher des conversations",placeholder:"Rechercher",clearAriaLabel:"Effacer la recherche"},resultsNone:"Aucun résultat",results_one:"{{count}} résultat",results_other:"{{count}} résultats",conversations:{ariaLabel:"Conversations"},timeGroups:{today:"Aujourd'hui",yesterday:"Hier",thisWeek:"Cette semaine",thisMonth:"Ce mois-ci",earlier:"Plus ancien"},conversationCard:{openAriaLabel:"Ouvrir la conversation : {{title}}",editAriaLabel:"Renommer la conversation : {{title}}",deleteAriaLabel:"Supprimer la conversation : {{title}}",editInputAriaLabel:"Modifier le titre de la conversation"},deleteConfirm:{title:"Supprimer la conversation",message:"Voulez-vous vraiment supprimer « {{title}} »? L'historique de la conversation sera effacé.",confirmText:"Supprimer"},clearAllConfirm:{title:"Supprimer toutes les conversations",message_one:"Voulez-vous vraiment supprimer cette conversation? Tout l'historique de la conversation sera effacé.",message_other:"Voulez-vous vraiment supprimer les {{count}} conversations? Tout l'historique des conversations sera effacé.",confirmText:"Tout effacer"}},Ky={textarea:{ariaLabel:"Champ de message"},skillsHint:{ariaLabel:"Afficher les compétences disponibles (ou tapez une barre oblique)",title:"Utiliser une compétence",text:"Compétences"},selectedSkill:{removeAriaLabel:"Retirer la compétence"},fileUpload:{attachAriaLabel:"Joindre des fichiers",titleNotSupported:"Le téléversement de fichiers n'est pas pris en charge par cet adaptateur",titleLimitPerConversation:"Limite de {{count}} fichiers atteinte pour cette conversation. Démarrez une nouvelle discussion pour en téléverser davantage.",titleLimitWorkspace:"Limite de {{count}} fichiers au total atteinte. Retirez des fichiers d'autres conversations d'abord.",titleUploading:"Des fichiers sont en cours de téléversement. Veuillez patienter...",titleAttached:"{{count}} fichier(s) joint(s)"},voiceOutput:{titleEnabled:"Réponses vocales activées - Cliquez pour désactiver",titleDisabled:"Activer les réponses vocales (synthèse vocale)",ariaLabelEnabled:"Désactiver les réponses vocales",ariaLabelDisabled:"Activer les réponses vocales"},voiceInput:{titleUploading:"Des fichiers sont en cours de téléversement. Veuillez patienter...",titleListening:"Arrêter l'enregistrement",titleDisabled:"Démarrer la saisie vocale",ariaLabelListening:"Arrêter l'enregistrement",ariaLabelDisabled:"Démarrer la saisie vocale"},agentInfo:{title:"À propos de cet agent",ariaLabel:"À propos de cet agent"},submit:{title:"Envoyer le message",ariaLabel:"Envoyer le message"},stop:{title:"Arrêter la génération",ariaLabel:"Arrêter la génération"},attachedFile:{uploadingStatus:"Téléversement...",processingStatus:"Traitement...",failedStatus:"Échec",removeTitleFailed:"Ignorer",removeTitleNormal:"Retirer le fichier"},uploadPanel:{headingAttach:"Joindre des fichiers",headingUploading:"Téléversement des fichiers",closeTitle:"Fermer"},uploadProgress:{statusUploading:"Téléversement",statusProcessing:"Traitement",statusCompleted:"Terminé",statusPending:"En attente"},listeningIndicator:"Écoute en cours...",fileDelete:{title:"Retirer le fichier",message:"Voulez-vous vraiment retirer « {{filename}} »? Cela supprimera le fichier du serveur et de cette conversation. Cette action est irréversible.",confirmText:"Retirer"},agentInfoModal:{title:"À propos de cet agent",closeAriaLabel:"Fermer",confirmButton:"Compris"},placeholder:{filesUploading:"Des fichiers sont en cours de téléversement, veuillez patienter...",messageOrbit:"Envoyer un message à ORBIT ou déposer des fichiers ici",guestLimitTotal:"Limite invité de {{count}} messages atteinte. Connectez-vous pour des limites plus élevées.",workspaceLimitTotal:"Limite de {{count}} messages atteinte. Supprimez ou archivez d'anciennes conversations pour continuer.",guestLimitPerConversation:"Limite invité de {{count}} messages atteinte. Connectez-vous pour des limites plus élevées.",conversationLimitReached:"Cette discussion a atteint la limite de {{count}} messages. Démarrez une nouvelle conversation pour continuer."},limitWarning:{guestTotalMessages:"Limite invité de {{count}} messages au total atteinte. Connectez-vous pour des limites plus élevées, ou supprimez des conversations pour repartir à zéro.",workspaceTotalMessages:"Limite de {{count}} messages au total atteinte. Supprimez ou exportez d'anciennes conversations pour continuer.",guestPerConversation:"Limite invité de {{count}} messages par conversation atteinte. Connectez-vous pour des limites plus élevées, ou supprimez des conversations pour repartir à zéro.",conversationLimitReached:"Cette conversation a atteint la limite de {{count}} messages. Démarrez une nouvelle conversation pour continuer à discuter."},signInPrompt:{button:"Se connecter pour des limites plus élevées",message:"Connectez-vous pour débloquer des limites de messages plus élevées et plus de conversations."},autocompletePanel:{ariaLabel:"Suggestions de saisie automatique"},uploadSuccess:{single:"Fichier « {{filename}} » téléversé avec succès",multiple:"{{count}} fichiers téléversés avec succès"},conversationNotFoundShort:"Conversation introuvable. Veuillez sélectionner une conversation d'abord.",fileRemoveFailed:"Échec du retrait du fichier",fileProcessingFailedTitle:"Le traitement du fichier a échoué"},Qy={signOutButton:{title:"Se déconnecter",ariaLabel:"Se déconnecter"}},Zy={heading:"Connectez-vous pour en profiter davantage"},Jy={statusBadge:"Service suspendu",heading:"Temporairement indisponible",retryButton:"Réessayer"},Wy={loadingLabel:"Effacement..."},ev={homeLinkAriaLabel:"Aller à la page d'accueil",logoAlt:"Logo",navLinksAriaLabel:"Liens d'en-tête"},tv={navLinksAriaLabel:"Liens de pied de page"},av={configureMessage:"Configurez cet agent pour voir ses capacités.",startConversationAriaLabel:"Démarrer une conversation avec {{name}}"},nv={codeBlock:{copied:"Copié!",copyTitle:"Copier le code",copyAriaLabel:"Copier le code dans le presse-papiers",copyLabel:"Copier",loadingRenderer:"Chargement du moteur de rendu..."},diagram:{copyCodeAriaLabel:"Copier le code du diagramme dans le presse-papiers",exportPngTitle:"Exporter en PNG",exportPngAriaLabel:"Exporter le diagramme en image PNG",errorTitle:"Erreur de diagramme Mermaid"},music:{copyNotationAriaLabel:"Copier la notation ABC dans le presse-papiers",exportPngTitle:"Exporter en PNG",exportPngAriaLabel:"Exporter la notation musicale en image PNG",rendering:"Rendu de la notation..."},svg:{copyCodeAriaLabel:"Copier le code SVG dans le presse-papiers",exportPngTitle:"Exporter en PNG",exportPngAriaLabel:"Exporter le SVG en image PNG"},chart:{legendAriaLabel:"Légende du graphique",copyCodeAriaLabel:"Copier le code du graphique dans le presse-papiers",exportPngTitle:"Exporter en PNG",exportPngAriaLabel:"Exporter le graphique en image PNG",errorTitle:"Erreur de rendu du graphique",loadingAriaLabel:"Chargement du graphique",showRawSource:"Afficher le code source"}},sv={defaultLabel:"Adaptateur",selectAnAgent:"Sélectionner un agent",loadingAgents:"Chargement des agents…",errorLoadingAgents:"Erreur lors du chargement des agents",noAgentsAvailable:"Aucun agent disponible",failedToLoad:"Impossible de charger les adaptateurs. Veuillez vérifier votre connexion."},rv={searchPlaceholder:"Rechercher des agents",clearSearchAriaLabel:"Effacer la recherche",noAgentsAvailable:"Aucun agent n'est disponible pour le moment. Configurez des adaptateurs dans vos paramètres middleware pour continuer.",noSearchResults:"Aucun agent ne correspond à votre recherche.",unableToLoad:"Impossible de charger les agents pour le moment."},iv={selectBeforeUpload:"Veuillez sélectionner ou créer une conversation avant de téléverser des fichiers.",conversationNotFound:"Conversation introuvable. Veuillez réessayer.",maxFilesPerConversationError:"Maximum de {{count}} fichiers autorisés par conversation. Veuillez en retirer avant de continuer.",maxFilesGuestLimitMessage:"Vous avez atteint la limite invité de {{count}} fichiers par conversation. Connectez-vous pour téléverser plus de fichiers.",maxTotalFilesError:"Maximum de {{count}} fichiers au total autorisés dans toutes les conversations. Veuillez retirer des fichiers d'autres conversations d'abord.",maxTotalFilesGuestLimitMessage:"Vous avez atteint la limite invité de {{count}} fichiers au total. Connectez-vous pour téléverser plus de fichiers.",adapterNotConfigured:"Aucun adaptateur configuré pour cette conversation. Veuillez sélectionner un adaptateur d'abord.",disabledAriaLabel:"Téléversement de fichiers désactivé",enabledAriaLabel:"Téléverser des fichiers",dragDropText:"Déposez des fichiers ou cliquez pour parcourir",draggingText:"Déposez les fichiers ici",fileTypesAndLimit:"PDF, DOCX, TXT, CSV, fichiers de code, images, audio · max {{count}} fichiers",otherConversationsLabel:"Autres conversations",uploadingStatus:"Téléversement",processingStatus:"Traitement",completedStatus:"Terminé",failedStatus:"Échec",processingFailedMessage:"Le traitement a échoué"},lv={header:"Fichiers ({{count}})",noFilesAttached:"Aucun fichier joint",uploadFilesToUse:"Téléversez des fichiers pour les utiliser dans cette conversation",removeFileTooltip:"Retirer le fichier",confirmRemoveTitle:"Retirer le fichier",confirmRemoveMessage:"Voulez-vous vraiment retirer « {{filename}} »? Cela supprimera le fichier du serveur et de cette conversation. Cette action est irréversible."},ov={generatedDocument:"Document généré",loadingPreview:"Chargement de l'aperçu...",openPreviewTooltip:"Ouvrir l'aperçu",downloadDocumentTooltip:"Télécharger le document",noSheetDataFound:"Aucune donnée de feuille trouvée.",csvRowsPreviewMessage:"Affichage des 25 premières lignes sur {{count}} — téléchargez pour le fichier complet.",noDataFound:"Aucune donnée trouvée.",previewUnavailable:"L'aperçu n'est pas disponible pour ce format. Téléchargez-le pour l'ouvrir localement.",previewUnavailableShort:"Aperçu indisponible"},cv={generatedImageTitle:"Image générée — cliquez pour agrandir",generatedImageAlt:"Image générée",downloadImageTooltip:"Télécharger l'image",viewFullSizeTooltip:"Afficher en taille réelle",showPrompt:"Afficher l'invite",hidePrompt:"Masquer l'invite",promptLabel:"Invite"},uv={downloadVideoTooltip:"Télécharger la vidéo",viewFullSizeTooltip:"Afficher en taille réelle",showPrompt:"Afficher l'invite",hidePrompt:"Masquer l'invite",promptLabel:"Invite"},dv={button:{audioPlayingTitle:"Lecture audio en cours...",voiceEnabledTitle:"Voix activée - Cliquez pour désactiver",enableVoiceTitle:"Cliquez pour activer les réponses vocales",playingLabel:"Lecture en cours...",voiceOnLabel:"Voix activée",enableVoiceLabel:"Activer la voix"},player:{audioFileTooLargePlaceholder:"Fichier audio trop volumineux ({{sizeMB}} Mo > limite de {{maxMB}} Mo)",largeAudioWarning:"Fichier audio volumineux ({{sizeMB}} Mo) - le chargement peut prendre du temps",invalidBase64Error:"Données audio base64 invalides",loadFailureError:"Échec du chargement de l'audio",playbackFailureError:"Échec de la lecture",pauseTitle:"Pause",playTitle:"Lecture",pauseAriaLabel:"Mettre l'audio en pause",playAriaLabel:"Lire l'audio"}},fv={searchPlaceholder:"Rechercher des modèles…",searchAriaLabel:"Rechercher des modèles",noModelsMatch:"Aucun modèle ne correspond à « {{query}} »",modelCountHint:"{{filtered}} sur {{total}} modèles",selectModel:"Sélectionner un modèle"},mv={noSkillsAvailable:"Aucune compétence disponible pour cet adaptateur.",loadingLabel:"Chargement des compétences...",noMatchingSkills:"Aucune compétence ne correspond à « {{query}} ».",noMatchingSkillsGeneric:"Aucune compétence correspondante.",listboxLabel:"Compétences disponibles"},pv={edit:{willRegenerateHint:"La réponse sera régénérée"},copyImageLabel:"Copier l'image dans le presse-papiers",copyLabel:"Copier dans le presse-papiers",feedback:{good:"Bonne réponse",poor:"Mauvaise réponse",thanks:"Merci!"},editAriaLabel:"Modifier le message",regenerateTitle:"Régénérer la réponse",regenerateAriaLabel:"Régénérer la réponse",thread:{continueDiscussionTitle:"Poursuivre cette discussion avec le contexte de la réponse actuelle",continueDiscussionAriaLabel:"Poursuivre cette discussion avec le contexte de la réponse actuelle",continueLabel:"Continuer",replyCount_one:"{{count}} réponse",replyCount_other:"{{count}} réponses",clearTitle:"Effacer les réponses",clearAriaLabel:"Effacer les réponses",hideRepliesAriaLabel:"Masquer les réponses",hideRepliesLabel:"Masquer les réponses",placeholder:"Répondre dans le fil...",skillsHint:"Utiliser une compétence",skillsHintAriaLabel:"Afficher les compétences disponibles (ou tapez une barre oblique)",removeSkillAriaLabel:"Retirer la compétence du fil",sendMessageTitle:"Envoyer le message du fil",selectModelTitle:"Sélectionner le modèle pour ce fil",limitReachedGuest:"Vous avez atteint la limite invité de {{count}} messages par fil. Connectez-vous pour continuer ce fil.",limitReachedUser:"Ce fil a atteint la limite de {{count}} messages. Démarrez une nouvelle conversation pour continuer les échanges.",signInForHigherLimits:"Se connecter pour des limites plus élevées",signInPromptMessage:"Connectez-vous pour débloquer des limites de messages plus élevées et continuer ce fil."},confirmation:{clearRepliesTitle:"Effacer les réponses",clearRepliesMessage:"Voulez-vous vraiment effacer ces réponses? Cela supprime le fil enfant du serveur sans supprimer la conversation principale."}},hv={emptyStateHeading:"Vos messages apparaîtront ici.",emptyStateSubheading:"Démarrez la conversation en envoyant un message ci-dessous."},gv={browserNotSupported:"La reconnaissance vocale n'est pas prise en charge par ce navigateur. Veuillez essayer Chrome, Edge ou Safari.",error:{noSpeech:"Aucune parole détectée. Veuillez réessayer.",audioCapture:"Accès au microphone refusé. Veuillez autoriser l'accès au microphone et réessayer.",notAllowed:"Accès au microphone non autorisé. Veuillez activer les autorisations du microphone.",network:"Une erreur réseau s'est produite. Veuillez vérifier votre connexion.",generic:"Erreur de reconnaissance vocale : {{error}}",startFailed:"Impossible de démarrer la reconnaissance vocale. Veuillez réessayer."}},bv={error:{singleAdapterMissing:"Le mode adaptateur unique nécessite que agentMode.defaultAdapterId corresponde à un identifiant d'adaptateur dans orbitchat.yaml.",configurationFailed:"Impossible de configurer cet agent.",authenticationFailed:"Nous n'avons pas pu charger cet agent. Il est possible qu'il n'existe pas ou que vous n'y ayez pas accès.",notFound:"Cet agent n'a pas été trouvé sur le serveur. Veuillez choisir un autre agent.",loadFailed:"Impossible de charger l'aperçu de l'agent pour le moment."}},xv={common:Vy,app:Gy,chatInterface:Py,settings:Xy,sidebar:Yy,messageInput:Ky,authStatus:Qy,loginPrompt:Zy,outOfService:Jy,confirmationModal:Wy,appHeader:ev,appFooter:tv,agentCard:av,markdown:nv,adapterSelector:sv,agentSelectionList:rv,fileUpload:iv,fileList:lv,documentDisplay:ov,imageDisplay:cv,videoDisplay:uv,audio:dv,modelPicker:fv,skillPicker:mv,message:pv,messageList:hv,voice:gv,agent:bv},yv={en:{translation:Hy},fr:{translation:xv}};pa.use(iy).init({resources:yv,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},returnNull:!1});var vv={agentMode:{mode:"multi",defaultAdapterId:"chat-with-files"},application:{name:"ORBIT Chat",description:"Explore ideas with ORBIT's AI copilots, share context, and build together.",inputPlaceholder:"Message ORBIT...",settingsAboutMsg:"ORBIT Chat",locale:"en-US",favicon:null},i18n:{activeLanguages:["en","fr"],defaultLanguage:"en"},seo:{includeSitemap:!1,siteUrl:"http://localhost:5173",exposeAgentNotes:!0},debug:{consoleDebug:!1},features:{enableUpload:!0,enableAudioOutput:!0,enableAudioInput:!0,enableFeedbackButtons:!0,enableConversationThreads:!0,enableAutocomplete:!0},voice:{silenceTimeoutMs:4e3,recognitionLanguage:""},outOfServiceMessage:null,limits:{files:{perConversation:5,maxSizeMB:50,totalFiles:100},conversations:{maxConversations:10,messagesPerConversation:1e3,messagesPerThread:1e3,totalMessages:1e4},messages:{maxLength:1e4}},guestLimits:{files:{perConversation:1,maxSizeMB:5,totalFiles:1},conversations:{maxConversations:2,messagesPerConversation:5,messagesPerThread:2,totalMessages:10},messages:{maxLength:500},rateLimit:{enabled:!0,windowMs:6e4,maxRequests:60,chat:{windowMs:6e4,maxRequests:10}}},auth:{enabled:!1,provider:"auth0"},header:{enabled:!0,logoUrl:"",logoUrlLight:"",logoUrlDark:"",logoHeight:"3.5rem",logoWidth:"auto",bgColor:"",textColor:"",showBorder:!1,navLinks:[{label:"Docs",url:"/"},{label:"About",url:"/about"}]},footer:{enabled:!0,text:"Copyright © 2025 Schmitech Inc.",bgColor:"",textColor:"",showBorder:!1,layout:"stacked",align:"center",topPadding:"large",navLinks:[{label:"Support",url:"/"},{label:"Privacy",url:"/about"}]},adapters:[{id:"simple-chat",name:"Simple AI Chat",apiUrl:"http://99.79.50.155:3000",description:"Basic chat interface using the default conversational agent (Similar to ChatGPT - no files).",inputPlaceholder:"Simple chat, ask anything..."},{id:"web-search",name:"Simple AI Chat (Web Search)",apiUrl:"http://99.79.50.155:3000",description:"Basic chat interface using the default conversational agent with web search supports.",inputPlaceholder:"Simple chat, ask anything..."},{id:"chat-with-files",name:"Simple AI Chat (Multimodal)",apiUrl:"http://99.79.50.155:3000",description:"Extract knowledge from PDF, Images, Word, etc. (Similar to ChatGPT Multimodal)",inputPlaceholder:"Files chat, ask anything..."},{id:"image-generator",name:"AI Image Generator",apiUrl:"http://99.79.50.155:3000",description:"Generate images from text descriptions using DALL-E 3 or Imagen 3.",inputPlaceholder:"Describe the image you want to create..."},{id:"video-generator",name:"AI Video Generator",apiUrl:"http://99.79.50.155:3000",description:"Generate videos from text descriptions.",inputPlaceholder:"Describe the video you want to create..."},{id:"qa-sql",name:"City FAQ Assistant (SQLite)",apiUrl:"http://99.79.50.155:3000",description:"Quick-test QA assistant over the sample city Q&A SQLite database.",inputPlaceholder:"Ask a city services question..."},{id:"qa-vector-chroma",name:"City FAQ Assistant (Chroma)",apiUrl:"http://99.79.50.155:3000",description:"Quick-test semantic QA assistant over the sample city Q&A Chroma collection.",inputPlaceholder:"Ask a city services question..."},{id:"hr-db-chatbot",name:"HR System Assistant",apiUrl:"http://99.79.50.155:3000",description:"HR database assistant: natural language queries over SQLite HR data via intent templates.",inputPlaceholder:"Ask HR questions..."},{id:"intent-sql-postgres",name:"Customer Orders Assistant",apiUrl:"http://99.79.50.155:3000",description:"Customer orders assistant: natural language queries over PostgreSQL customer orders data."},{id:"ecomm-analytics",name:"Business Analytics Assistant",apiUrl:"http://99.79.50.155:3000",description:"DuckDB analytics assistant: natural language analytics queries over the analytics demo. This agent is the perfect example of how to use something like OLAP to quickly discover insigths."},{id:"intent-http-jsonplaceholder",name:"REST API Chat",apiUrl:"http://99.79.50.155:3000",description:"Natural language queries over the fake REST API."},{id:"intent-http-paris-opendata",name:"City of Paris Chat",apiUrl:"http://99.79.50.155:3000",description:"Paris open data: events and activities (Que Faire à Paris) via natural language."},{id:"intent-mongodb-mflix",name:"Chat With Movies DB",apiUrl:"http://99.79.50.155:3000",description:"MFlix movies assistant: query the sample_mflix MongoDB database via intent templates."},{id:"intent-graphql-spacex",name:"GraphQL Chatbot",apiUrl:"http://99.79.50.155:3000",description:"SpaceX GraphQL assistant: natural language queries over the SpaceX API.",inputPlaceholder:"Ask SpaceX questions..."},{id:"audio-transcription",name:"Audio Transcription",apiUrl:"http://99.79.50.155:3000",description:"Audio Transcription Test.",inputPlaceholder:"Use the microphone for voice..."},{id:"voice-chat",name:"Voice Chat",apiUrl:"http://99.79.50.155:3000",description:"Voice chat adapter test.",inputPlaceholder:"Use the microphone for voice..."},{id:"real-time-voice-chat",name:"Real-Time Voice Chat",apiUrl:"http://99.79.50.155:3000",description:"Real-time voice chat adapter test (websocket).",inputPlaceholder:"Use the microphone for voice..."}]};const Od="http://localhost:3000",Sv="/favicon.svg",wv="/orbit-logo-light.png",kv="/orbit-logo-dark.png",Av={agentMode:{mode:"multi",defaultAdapterId:""},i18n:{activeLanguages:["en"],defaultLanguage:"en"},application:{name:"ORBIT Chat",description:"Explore ideas with ORBIT's AI copilots, share context, and build together.",inputPlaceholder:"Message ORBIT...",settingsAboutMsg:"ORBIT Chat",locale:"en-US",favicon:""},debug:{consoleDebug:!1},seo:{includeSitemap:!1,siteUrl:"",alternateSiteUrls:[],hostPatterns:[],exposeAgentNotes:!0},features:{enableUpload:!1,enableAudioOutput:!1,enableAudioInput:!1,enableFeedbackButtons:!1,enableConversationThreads:!0,enableAutocomplete:!1},voice:{silenceTimeoutMs:4e3,recognitionLanguage:""},outOfServiceMessage:null,limits:{files:{perConversation:5,maxSizeMB:50,totalFiles:100},conversations:{maxConversations:10,messagesPerConversation:1e3,messagesPerThread:1e3,totalMessages:1e4},messages:{maxLength:1e3}},guestLimits:{files:{perConversation:1,maxSizeMB:10,totalFiles:2},conversations:{maxConversations:1,messagesPerConversation:10,messagesPerThread:10,totalMessages:10},messages:{maxLength:500}},auth:{enabled:!1,provider:"auth0",domain:"",clientId:"",audience:"",tenantId:"",scopes:[]},header:{enabled:!1,logoUrl:"",logoUrlLight:"",logoUrlDark:"",logoHeight:"",logoWidth:"",bgColor:"",textColor:"",showBorder:!0,navLinks:[]},footer:{enabled:!1,text:"",bgColor:"",textColor:"",showBorder:!1,layout:"stacked",align:"center",topPadding:"large",navLinks:[]},startupScripts:[],adapters:[]};function zo(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ud(i,n){if(!zo(i)||!zo(n))return n;const r={...i};return Object.keys(n).forEach(l=>{if(l==="__proto__"||l==="constructor"||l==="prototype")return;const o=r[l],u=n[l];zo(o)&&zo(u)?r[l]=Ud(o,u):u!==void 0&&(r[l]=u)}),r}function _v(i){if(typeof i!="string")return null;const n=i.trim();if(!n)return null;const r=n.toLowerCase();return r==="false"||r==="0"||r==="off"||r==="disabled"?null:n}function Cv(i){return i==="single"?"single":"multi"}function Tv(i){const n=i.trim();if(n.startsWith("["))try{const r=JSON.parse(n);return Array.isArray(r)?r.filter(Boolean):[]}catch{return[]}return n.split(/\s+/).filter(Boolean)}function Nv(){const i=vv||{},n=typeof window<"u"&&window.ORBIT_CHAT_CONFIG||{},r=!!(typeof window<"u"&&window.ORBIT_CHAT_CONFIG);let l=Ud(Av,i);return l=Ud(l,n),!r||l.auth.domain,(!r||!l.auth.clientId)&&(l.auth.clientId="b753fbd6-35f8-439e-8786-098955e2a43c"),!r||l.auth.audience,!r||l.auth.provider,(!r||!l.auth.tenantId)&&(l.auth.tenantId="6ffcc616-8f76-4a3b-9b52-37a22175c738"),(!r||l.auth.scopes.length===0)&&(l.auth.scopes=Tv("openid profile email User.Read")),l.outOfServiceMessage=_v(l.outOfServiceMessage),l.agentMode.mode=Cv(l.agentMode.mode),l.agentMode.defaultAdapterId=typeof l.agentMode.defaultAdapterId=="string"?l.agentMode.defaultAdapterId.trim():"",l}const Se=Nv();function Et(){var n;const i=Se.adapters;if(Array.isArray(i)&&i.length>0){const r=(n=i[0].apiUrl)==null?void 0:n.trim();if(r)return r}return Od}function Da(i){const n=i==null?void 0:i.trim();return n&&n.length>0?n:Et()}function jv(){const i=Se.adapters;return Array.isArray(i)&&i.length>0?i[0].id:"default-key"}function Ev(){return Se.agentMode.mode}function cc(){return Ev()==="single"}function Yd(){if(!cc())return null;const i=Se.agentMode.defaultAdapterId;return i&&Se.adapters.some(r=>{var l;return((l=r==null?void 0:r.id)==null?void 0:l.trim())===i})?i:null}function Zg(){const i=Array.isArray(Se.i18n.activeLanguages)?Se.i18n.activeLanguages.filter(n=>typeof n=="string"):[];return i.length>0?i:["en"]}function Lv(){var n;const i=(n=Se.i18n.defaultLanguage)==null?void 0:n.trim();return i&&Zg().includes(i)?i:"en"}function Kd(){return Se.application.name}function Qd(){return Se.application.description}function Jg(){return Se.application.inputPlaceholder}function Mv(i){var o;const n=i==null?void 0:i.trim();if(!n)return null;const r=Se.adapters.find(u=>{var m;return((m=u==null?void 0:u.id)==null?void 0:m.trim())===n});return((o=r==null?void 0:r.name)==null?void 0:o.trim())||null}function Dv(i){var o;const n=i==null?void 0:i.trim();if(!n)return null;const r=Se.adapters.find(u=>{var m;return((m=u==null?void 0:u.id)==null?void 0:m.trim())===n});return((o=r==null?void 0:r.inputPlaceholder)==null?void 0:o.trim())||null}function Wg(){return Se.seo.siteUrl.trim()}function zv(){return Array.isArray(Se.seo.alternateSiteUrls)?Se.seo.alternateSiteUrls.filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean):[]}function Rv(){return Array.isArray(Se.seo.hostPatterns)?Se.seo.hostPatterns.filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean):[]}function Ov(){return Se.seo.exposeAgentNotes}function Uv(){var n;return((n=Se.application.favicon)==null?void 0:n.trim())||Sv}function $v(){return Se.features.enableUpload}function Iv(){return Se.features.enableAudioOutput}function Fv(){return Se.features.enableAudioInput}function tg(){return Se.features.enableFeedbackButtons}function Bv(){return Se.features.enableConversationThreads}function e0(){return Se.features.enableAutocomplete}function qv(){return Math.max(1e3,Se.voice.silenceTimeoutMs)}function Hv(){return Se.voice.recognitionLanguage}function Vv(){const i=Yd();if(i)return i;const n=Se.adapters;if(Array.isArray(n)&&n.length>0)for(const r of n){const l=typeof(r==null?void 0:r.id)=="string"?r.id.trim():"";if(l)return l}return null}function Gv(){return Se.outOfServiceMessage}function Zd(){return Se.auth.enabled}function za(){const{enabled:i,provider:n,domain:r,clientId:l,tenantId:o}=Se.auth;return!i||!l?!1:n==="entra"?!!o:!!r}function Pv(){return Se.auth.domain}function t0(){return Se.auth.clientId}function Xv(){return Se.auth.audience}function uc(){return Se.auth.provider}function Yv(){return Se.auth.tenantId}function Jd(){const i=Se.auth.scopes;return i.length>0?i:["openid","profile","email"]}function $d(){return Se.header.enabled}function Kv(){return Se.header.logoUrl}function Qv(){var n;return((n=Se.header.logoUrlLight)==null?void 0:n.trim())||wv}function Zv(){var n;return((n=Se.header.logoUrlDark)==null?void 0:n.trim())||kv}function Jv(){var i;return((i=Se.header.logoHeight)==null?void 0:i.trim())||""}function Wv(){var i;return((i=Se.header.logoWidth)==null?void 0:i.trim())||""}function e1(){return Se.header.bgColor}function t1(){return Se.header.textColor}function a1(){return Se.header.showBorder}function a0(i){if(Array.isArray(i))return i;if(typeof i=="string")try{const n=JSON.parse(i);return Array.isArray(n)?n:[]}catch{return[]}return[]}function n0(){return a0(Se.header.navLinks)}function s0(){return Se.footer.enabled}function n1(){return Se.footer.text}function s1(){return Se.footer.bgColor}function r1(){return Se.footer.textColor}function i1(){return Se.footer.showBorder}function l1(){return Se.footer.layout==="inline"?"inline":"stacked"}function o1(){return Se.footer.topPadding==="normal"?"normal":"large"}function c1(){const i=Se.startupScripts;return Array.isArray(i)?i.filter(n=>!!(n&&typeof n=="object")).map(n=>{const r=typeof n.src=="string"?n.src.trim():"",l=typeof n.content=="string"?n.content.trim():"",o=typeof n.id=="string"?n.id.trim():"";return{...n,src:r||void 0,content:l||void 0,id:o||void 0}}).filter(n=>!!(n.src||n.content)):[]}function u1(){return a0(Se.footer.navLinks)}const r0=["en","fr"],Ro={en:"English",fr:"Français"};function Po(i){return r0.includes(i)}const i0=S.createContext(void 0),l0="orbit-chat-language";function d1(){const i=Zg().filter(Po);return i.length>0?i:["en"]}function f1(i){const n=localStorage.getItem(l0);if(n&&Po(n)&&i.includes(n))return n;const r=[...navigator.languages||[],navigator.language].filter(Boolean);for(const o of r){const u=o.split("-")[0].toLowerCase();if(Po(u)&&i.includes(u))return u}const l=Lv();return Po(l)&&i.includes(l)?l:i[0]??"en"}function m1({children:i}){const[n]=S.useState(()=>d1()),[r,l]=S.useState(()=>f1(n));S.useEffect(()=>{pa.changeLanguage(r)},[r]),S.useEffect(()=>{localStorage.setItem(l0,r)},[r]);const o=u=>{r0.includes(u)&&l(u)};return f.jsx(i0.Provider,{value:{currentLanguage:r,activeLanguages:n,setLanguage:o},children:i})}function p1(){const i=S.useContext(i0);if(!i)throw new Error("useLanguage must be used within LanguageProvider");return i}/**
|
|
35
|
+
* @license lucide-react v0.469.0 - ISC
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the ISC license.
|
|
38
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/const h1=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o0=(...i)=>i.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).join(" ").trim();/**
|
|
40
|
+
* @license lucide-react v0.469.0 - ISC
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the ISC license.
|
|
43
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/var g1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
45
|
+
* @license lucide-react v0.469.0 - ISC
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the ISC license.
|
|
48
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/const b1=S.forwardRef(({color:i="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:m,...p},h)=>S.createElement("svg",{ref:h,...g1,width:n,height:n,stroke:i,strokeWidth:l?Number(r)*24/Number(n):r,className:o0("lucide",o),...p},[...m.map(([b,y])=>S.createElement(b,y)),...Array.isArray(u)?u:[u]]));/**
|
|
50
|
+
* @license lucide-react v0.469.0 - ISC
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the ISC license.
|
|
53
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/const Le=(i,n)=>{const r=S.forwardRef(({className:l,...o},u)=>S.createElement(b1,{ref:u,iconNode:n,className:o0(`lucide-${h1(i)}`,l),...o}));return r.displayName=`${i}`,r};/**
|
|
55
|
+
* @license lucide-react v0.469.0 - ISC
|
|
56
|
+
*
|
|
57
|
+
* This source code is licensed under the ISC license.
|
|
58
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
+
*/const Id=Le("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
60
|
+
* @license lucide-react v0.469.0 - ISC
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the ISC license.
|
|
63
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/const bl=Le("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
65
|
+
* @license lucide-react v0.469.0 - ISC
|
|
66
|
+
*
|
|
67
|
+
* This source code is licensed under the ISC license.
|
|
68
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
+
*/const pi=Le("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
70
|
+
* @license lucide-react v0.469.0 - ISC
|
|
71
|
+
*
|
|
72
|
+
* This source code is licensed under the ISC license.
|
|
73
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
74
|
+
*/const ag=Le("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
75
|
+
* @license lucide-react v0.469.0 - ISC
|
|
76
|
+
*
|
|
77
|
+
* This source code is licensed under the ISC license.
|
|
78
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
+
*/const Wo=Le("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
80
|
+
* @license lucide-react v0.469.0 - ISC
|
|
81
|
+
*
|
|
82
|
+
* This source code is licensed under the ISC license.
|
|
83
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
+
*/const Xo=Le("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
85
|
+
* @license lucide-react v0.469.0 - ISC
|
|
86
|
+
*
|
|
87
|
+
* This source code is licensed under the ISC license.
|
|
88
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
89
|
+
*/const x1=Le("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
90
|
+
* @license lucide-react v0.469.0 - ISC
|
|
91
|
+
*
|
|
92
|
+
* This source code is licensed under the ISC license.
|
|
93
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
+
*/const ng=Le("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
95
|
+
* @license lucide-react v0.469.0 - ISC
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the ISC license.
|
|
98
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/const y1=Le("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
100
|
+
* @license lucide-react v0.469.0 - ISC
|
|
101
|
+
*
|
|
102
|
+
* This source code is licensed under the ISC license.
|
|
103
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
104
|
+
*/const Wd=Le("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
105
|
+
* @license lucide-react v0.469.0 - ISC
|
|
106
|
+
*
|
|
107
|
+
* This source code is licensed under the ISC license.
|
|
108
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
+
*/const v1=Le("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
110
|
+
* @license lucide-react v0.469.0 - ISC
|
|
111
|
+
*
|
|
112
|
+
* This source code is licensed under the ISC license.
|
|
113
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
114
|
+
*/const S1=Le("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
|
|
115
|
+
* @license lucide-react v0.469.0 - ISC
|
|
116
|
+
*
|
|
117
|
+
* This source code is licensed under the ISC license.
|
|
118
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
+
*/const w1=Le("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
|
|
120
|
+
* @license lucide-react v0.469.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/const k1=Le("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
125
|
+
* @license lucide-react v0.469.0 - ISC
|
|
126
|
+
*
|
|
127
|
+
* This source code is licensed under the ISC license.
|
|
128
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
+
*/const A1=Le("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
130
|
+
* @license lucide-react v0.469.0 - ISC
|
|
131
|
+
*
|
|
132
|
+
* This source code is licensed under the ISC license.
|
|
133
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
+
*/const _1=Le("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
135
|
+
* @license lucide-react v0.469.0 - ISC
|
|
136
|
+
*
|
|
137
|
+
* This source code is licensed under the ISC license.
|
|
138
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
+
*/const C1=Le("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
|
|
140
|
+
* @license lucide-react v0.469.0 - ISC
|
|
141
|
+
*
|
|
142
|
+
* This source code is licensed under the ISC license.
|
|
143
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
144
|
+
*/const Yo=Le("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
145
|
+
* @license lucide-react v0.469.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/const c0=Le("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
|
|
150
|
+
* @license lucide-react v0.469.0 - ISC
|
|
151
|
+
*
|
|
152
|
+
* This source code is licensed under the ISC license.
|
|
153
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
154
|
+
*/const T1=Le("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
155
|
+
* @license lucide-react v0.469.0 - ISC
|
|
156
|
+
*
|
|
157
|
+
* This source code is licensed under the ISC license.
|
|
158
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
+
*/const N1=Le("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
160
|
+
* @license lucide-react v0.469.0 - ISC
|
|
161
|
+
*
|
|
162
|
+
* This source code is licensed under the ISC license.
|
|
163
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
+
*/const j1=Le("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
165
|
+
* @license lucide-react v0.469.0 - ISC
|
|
166
|
+
*
|
|
167
|
+
* This source code is licensed under the ISC license.
|
|
168
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
169
|
+
*/const sg=Le("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
170
|
+
* @license lucide-react v0.469.0 - ISC
|
|
171
|
+
*
|
|
172
|
+
* This source code is licensed under the ISC license.
|
|
173
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
+
*/const E1=Le("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
175
|
+
* @license lucide-react v0.469.0 - ISC
|
|
176
|
+
*
|
|
177
|
+
* This source code is licensed under the ISC license.
|
|
178
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
+
*/const L1=Le("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
180
|
+
* @license lucide-react v0.469.0 - ISC
|
|
181
|
+
*
|
|
182
|
+
* This source code is licensed under the ISC license.
|
|
183
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
184
|
+
*/const M1=Le("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
185
|
+
* @license lucide-react v0.469.0 - ISC
|
|
186
|
+
*
|
|
187
|
+
* This source code is licensed under the ISC license.
|
|
188
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
+
*/const D1=Le("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
190
|
+
* @license lucide-react v0.469.0 - ISC
|
|
191
|
+
*
|
|
192
|
+
* This source code is licensed under the ISC license.
|
|
193
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
+
*/const z1=Le("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
|
195
|
+
* @license lucide-react v0.469.0 - ISC
|
|
196
|
+
*
|
|
197
|
+
* This source code is licensed under the ISC license.
|
|
198
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
+
*/const R1=Le("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
200
|
+
* @license lucide-react v0.469.0 - ISC
|
|
201
|
+
*
|
|
202
|
+
* This source code is licensed under the ISC license.
|
|
203
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
+
*/const O1=Le("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
|
|
205
|
+
* @license lucide-react v0.469.0 - ISC
|
|
206
|
+
*
|
|
207
|
+
* This source code is licensed under the ISC license.
|
|
208
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
+
*/const U1=Le("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
210
|
+
* @license lucide-react v0.469.0 - ISC
|
|
211
|
+
*
|
|
212
|
+
* This source code is licensed under the ISC license.
|
|
213
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
+
*/const $1=Le("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
|
|
215
|
+
* @license lucide-react v0.469.0 - ISC
|
|
216
|
+
*
|
|
217
|
+
* This source code is licensed under the ISC license.
|
|
218
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
+
*/const u0=Le("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
|
|
220
|
+
* @license lucide-react v0.469.0 - ISC
|
|
221
|
+
*
|
|
222
|
+
* This source code is licensed under the ISC license.
|
|
223
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
+
*/const I1=Le("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
225
|
+
* @license lucide-react v0.469.0 - ISC
|
|
226
|
+
*
|
|
227
|
+
* This source code is licensed under the ISC license.
|
|
228
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
+
*/const F1=Le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
230
|
+
* @license lucide-react v0.469.0 - ISC
|
|
231
|
+
*
|
|
232
|
+
* This source code is licensed under the ISC license.
|
|
233
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
234
|
+
*/const B1=Le("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/**
|
|
235
|
+
* @license lucide-react v0.469.0 - ISC
|
|
236
|
+
*
|
|
237
|
+
* This source code is licensed under the ISC license.
|
|
238
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
+
*/const q1=Le("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
240
|
+
* @license lucide-react v0.469.0 - ISC
|
|
241
|
+
*
|
|
242
|
+
* This source code is licensed under the ISC license.
|
|
243
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
+
*/const H1=Le("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
245
|
+
* @license lucide-react v0.469.0 - ISC
|
|
246
|
+
*
|
|
247
|
+
* This source code is licensed under the ISC license.
|
|
248
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
+
*/const ef=Le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
250
|
+
* @license lucide-react v0.469.0 - ISC
|
|
251
|
+
*
|
|
252
|
+
* This source code is licensed under the ISC license.
|
|
253
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
+
*/const rg=Le("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
255
|
+
* @license lucide-react v0.469.0 - ISC
|
|
256
|
+
*
|
|
257
|
+
* This source code is licensed under the ISC license.
|
|
258
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
+
*/const tf=Le("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
260
|
+
* @license lucide-react v0.469.0 - ISC
|
|
261
|
+
*
|
|
262
|
+
* This source code is licensed under the ISC license.
|
|
263
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
+
*/const V1=Le("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
265
|
+
* @license lucide-react v0.469.0 - ISC
|
|
266
|
+
*
|
|
267
|
+
* This source code is licensed under the ISC license.
|
|
268
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
+
*/const G1=Le("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
270
|
+
* @license lucide-react v0.469.0 - ISC
|
|
271
|
+
*
|
|
272
|
+
* This source code is licensed under the ISC license.
|
|
273
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
274
|
+
*/const d0=Le("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
|
|
275
|
+
* @license lucide-react v0.469.0 - ISC
|
|
276
|
+
*
|
|
277
|
+
* This source code is licensed under the ISC license.
|
|
278
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
+
*/const f0=Le("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
|
|
280
|
+
* @license lucide-react v0.469.0 - ISC
|
|
281
|
+
*
|
|
282
|
+
* This source code is licensed under the ISC license.
|
|
283
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
+
*/const m0=Le("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
285
|
+
* @license lucide-react v0.469.0 - ISC
|
|
286
|
+
*
|
|
287
|
+
* This source code is licensed under the ISC license.
|
|
288
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
289
|
+
*/const P1=Le("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
|
|
290
|
+
* @license lucide-react v0.469.0 - ISC
|
|
291
|
+
*
|
|
292
|
+
* This source code is licensed under the ISC license.
|
|
293
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
294
|
+
*/const af=Le("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
295
|
+
* @license lucide-react v0.469.0 - ISC
|
|
296
|
+
*
|
|
297
|
+
* This source code is licensed under the ISC license.
|
|
298
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
299
|
+
*/const X1=Le("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
300
|
+
* @license lucide-react v0.469.0 - ISC
|
|
301
|
+
*
|
|
302
|
+
* This source code is licensed under the ISC license.
|
|
303
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
304
|
+
*/const ec=Le("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
305
|
+
* @license lucide-react v0.469.0 - ISC
|
|
306
|
+
*
|
|
307
|
+
* This source code is licensed under the ISC license.
|
|
308
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
+
*/const Y1=Le("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
|
310
|
+
* @license lucide-react v0.469.0 - ISC
|
|
311
|
+
*
|
|
312
|
+
* This source code is licensed under the ISC license.
|
|
313
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
+
*/const wa=Le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
315
|
+
* @license lucide-react v0.469.0 - ISC
|
|
316
|
+
*
|
|
317
|
+
* This source code is licensed under the ISC license.
|
|
318
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
319
|
+
*/const K1=Le("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/**
|
|
320
|
+
* @license lucide-react v0.469.0 - ISC
|
|
321
|
+
*
|
|
322
|
+
* This source code is licensed under the ISC license.
|
|
323
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
+
*/const Q1=Le("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);Gd.__defineMacro("\\ce",function(i){return p0(i.consumeArgs(1)[0],"ce")});Gd.__defineMacro("\\pu",function(i){return p0(i.consumeArgs(1)[0],"pu")});Gd.__defineMacro("\\tripledash","{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");var p0=function(n,r){for(var l="",o=n.length&&n[n.length-1].loc.start,u=n.length-1;u>=0;u--)n[u].loc.start>o&&(l+=" ",o=n[u].loc.start),l+=n[u].text,o+=n[u].text.length;var m=St.go(te.go(l,r));return m},te={go:function(n,r){if(!n)return[];r===void 0&&(r="ce");var l="0",o={};o.parenthesisLevel=0,n=n.replace(/\n/g," "),n=n.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),n=n.replace(/[\u2026]/g,"...");for(var u,m=10,p=[];;){u!==n?(m=10,u=n):m--;var h=te.stateMachines[r],b=h.transitions[l]||h.transitions["*"];e:for(var y=0;y<b.length;y++){var x=te.patterns.match_(b[y].pattern,n);if(x){for(var w=b[y].task,v=0;v<w.action_.length;v++){var k;if(h.actions[w.action_[v].type_])k=h.actions[w.action_[v].type_](o,x.match_,w.action_[v].option);else if(te.actions[w.action_[v].type_])k=te.actions[w.action_[v].type_](o,x.match_,w.action_[v].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+w.action_[v].type_+")"];te.concatArray(p,k)}if(l=w.nextState||l,n.length>0){if(w.revisit||(n=x.remainder),!w.toContinue)break e}else return p}}if(m<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(n,r){if(r)if(Array.isArray(r))for(var l=0;l<r.length;l++)n.push(r[l]);else n.push(r)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(n){var r=n.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return r&&r[0]?{match_:r.splice(1),remainder:n.substr(r[0].length)}:null},"(-)(9)^(-9)":function(n){var r=n.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return r&&r[0]?{match_:r.splice(1),remainder:n.substr(r[0].length)}:null},"state of aggregation $":function(n){var r=te.patterns.findObserveGroups(n,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(r&&r.remainder.match(/^($|[\s,;\)\]\}])/))return r;var l=n.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return l?{match_:l[0],remainder:n.substr(l[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(n){return te.patterns.findObserveGroups(n,"^{","","","}")},"^($...$)":function(n){return te.patterns.findObserveGroups(n,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(n){return te.patterns.findObserveGroups(n,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(n){return te.patterns.findObserveGroups(n,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(n){return te.patterns.findObserveGroups(n,"_{","","","}")},"_($...$)":function(n){return te.patterns.findObserveGroups(n,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(n){return te.patterns.findObserveGroups(n,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(n){return te.patterns.findObserveGroups(n,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(n){return te.patterns.findObserveGroups(n,"","{","}","")},"{(...)}":function(n){return te.patterns.findObserveGroups(n,"{","","","}")},"$...$":function(n){return te.patterns.findObserveGroups(n,"","$","$","")},"${(...)}$":function(n){return te.patterns.findObserveGroups(n,"${","","","}$")},"$(...)$":function(n){return te.patterns.findObserveGroups(n,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(n){return te.patterns.findObserveGroups(n,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(n){return te.patterns.findObserveGroups(n,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(n){return te.patterns.findObserveGroups(n,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(n){return te.patterns.findObserveGroups(n,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(n){return te.patterns.findObserveGroups(n,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(n){return te.patterns.findObserveGroups(n,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(n){return te.patterns.findObserveGroups(n,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(n){return te.patterns.findObserveGroups(n,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(n){return te.patterns.findObserveGroups(n,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(n){return te.patterns.findObserveGroups(n,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(n){return te.patterns.findObserveGroups(n,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(n){return te.patterns.findObserveGroups(n,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(n){var r;if(r=n.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),r)return{match_:r[0],remainder:n.substr(r[0].length)};var l=te.patterns.findObserveGroups(n,"","$","$","");return l&&(r=l.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),r)?{match_:r[0],remainder:n.substr(r[0].length)}:null},amount2:function(n){return this.amount(n)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(n){if(n.match(/^\([a-z]+\)$/))return null;var r=n.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return r?{match_:r[0],remainder:n.substr(r[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(n,r,l,o,u,m,p,h,b,y){var x=function(z,M){if(typeof M=="string")return z.indexOf(M)!==0?null:M;var B=z.match(M);return B?B[0]:null},w=function(z,M,B){for(var H=0;M<z.length;){var F=z.charAt(M),C=x(z.substr(M),B);if(C!==null&&H===0)return{endMatchBegin:M,endMatchEnd:M+C.length};if(F==="{")H++;else if(F==="}"){if(H===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];H--}M++}return H>0,null},v=x(n,r);if(v===null||(n=n.substr(v.length),v=x(n,l),v===null))return null;var k=w(n,v.length,o||u);if(k===null)return null;var _=n.substring(0,o?k.endMatchEnd:k.endMatchBegin);if(m||p){var j=this.findObserveGroups(n.substr(k.endMatchEnd),m,p,h,b);if(j===null)return null;var R=[_,j.match_];return{match_:y?R.join(""):R,remainder:j.remainder}}else return{match_:_,remainder:n.substr(k.endMatchEnd)}},match_:function(n,r){var l=te.patterns.patterns[n];if(l===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+n+")"];if(typeof l=="function")return te.patterns.patterns[n](r);var o=r.match(l);if(o){var u;return o[2]?u=[o[1],o[2]]:o[1]?u=o[1]:u=o[0],{match_:u,remainder:r.substr(o[0].length)}}return null}},actions:{"a=":function(n,r){n.a=(n.a||"")+r},"b=":function(n,r){n.b=(n.b||"")+r},"p=":function(n,r){n.p=(n.p||"")+r},"o=":function(n,r){n.o=(n.o||"")+r},"q=":function(n,r){n.q=(n.q||"")+r},"d=":function(n,r){n.d=(n.d||"")+r},"rm=":function(n,r){n.rm=(n.rm||"")+r},"text=":function(n,r){n.text_=(n.text_||"")+r},insert:function(n,r,l){return{type_:l}},"insert+p1":function(n,r,l){return{type_:l,p1:r}},"insert+p1+p2":function(n,r,l){return{type_:l,p1:r[0],p2:r[1]}},copy:function(n,r){return r},rm:function(n,r){return{type_:"rm",p1:r||""}},text:function(n,r){return te.go(r,"text")},"{text}":function(n,r){var l=["{"];return te.concatArray(l,te.go(r,"text")),l.push("}"),l},"tex-math":function(n,r){return te.go(r,"tex-math")},"tex-math tight":function(n,r){return te.go(r,"tex-math tight")},bond:function(n,r,l){return{type_:"bond",kind_:l||r}},"color0-output":function(n,r){return{type_:"color0",color:r[0]}},ce:function(n,r){return te.go(r)},"1/2":function(n,r){var l=[];r.match(/^[+\-]/)&&(l.push(r.substr(0,1)),r=r.substr(1));var o=r.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return o[1]=o[1].replace(/\$/g,""),l.push({type_:"frac",p1:o[1],p2:o[2]}),o[3]&&(o[3]=o[3].replace(/\$/g,""),l.push({type_:"tex-math",p1:o[3]})),l},"9,9":function(n,r){return te.go(r,"9,9")}},createTransitions:function(n){var r,l,o,u,m={};for(r in n)for(l in n[r])for(o=l.split("|"),n[r][l].stateArray=o,u=0;u<o.length;u++)m[o[u]]=[];for(r in n)for(l in n[r])for(o=n[r][l].stateArray||[],u=0;u<o.length;u++){var p=n[r][l];if(p.action_){p.action_=[].concat(p.action_);for(var h=0;h<p.action_.length;h++)typeof p.action_[h]=="string"&&(p.action_[h]={type_:p.action_[h]})}else p.action_=[];for(var b=r.split("|"),y=0;y<b.length;y++)if(o[u]==="*")for(var x in m)m[x].push({pattern:b[y],task:p});else m[o[u]].push({pattern:b[y],task:p})}return m},stateMachines:{}};te.stateMachines={ce:{transitions:te.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(n,r){var l;if((n.d||"").match(/^[0-9]+$/)){var o=n.d;n.d=void 0,l=this.output(n),n.b=o}else l=this.output(n);return te.actions["o="](n,r),l},"d= kv":function(n,r){n.d=r,n.dType="kv"},"charge or bond":function(n,r){if(n.beginsWithBond){var l=[];return te.concatArray(l,this.output(n)),te.concatArray(l,te.actions.bond(n,r,"-")),l}else n.d=r},"- after o/d":function(n,r,l){var o=te.patterns.match_("orbital",n.o||""),u=te.patterns.match_("one lowercase greek letter $",n.o||""),m=te.patterns.match_("one lowercase latin letter $",n.o||""),p=te.patterns.match_("$one lowercase latin letter$ $",n.o||""),h=r==="-"&&(o&&o.remainder===""||u||m||p);h&&!n.a&&!n.b&&!n.p&&!n.d&&!n.q&&!o&&m&&(n.o="$"+n.o+"$");var b=[];return h?(te.concatArray(b,this.output(n)),b.push({type_:"hyphen"})):(o=te.patterns.match_("digits",n.d||""),l&&o&&o.remainder===""?(te.concatArray(b,te.actions["d="](n,r)),te.concatArray(b,this.output(n))):(te.concatArray(b,this.output(n)),te.concatArray(b,te.actions.bond(n,r,"-")))),b},"a to o":function(n){n.o=n.a,n.a=void 0},"sb=true":function(n){n.sb=!0},"sb=false":function(n){n.sb=!1},"beginsWithBond=true":function(n){n.beginsWithBond=!0},"beginsWithBond=false":function(n){n.beginsWithBond=!1},"parenthesisLevel++":function(n){n.parenthesisLevel++},"parenthesisLevel--":function(n){n.parenthesisLevel--},"state of aggregation":function(n,r){return{type_:"state of aggregation",p1:te.go(r,"o")}},comma:function(n,r){var l=r.replace(/\s*$/,""),o=l!==r;return o&&n.parenthesisLevel===0?{type_:"comma enumeration L",p1:l}:{type_:"comma enumeration M",p1:l}},output:function(n,r,l){var o;if(!n.r)o=[],!n.a&&!n.b&&!n.p&&!n.o&&!n.q&&!n.d&&!l||(n.sb&&o.push({type_:"entitySkip"}),!n.o&&!n.q&&!n.d&&!n.b&&!n.p&&l!==2?(n.o=n.a,n.a=void 0):!n.o&&!n.q&&!n.d&&(n.b||n.p)?(n.o=n.a,n.d=n.b,n.q=n.p,n.a=n.b=n.p=void 0):n.o&&n.dType==="kv"&&te.patterns.match_("d-oxidation$",n.d||"")?n.dType="oxidation":n.o&&n.dType==="kv"&&!n.q&&(n.dType=void 0),o.push({type_:"chemfive",a:te.go(n.a,"a"),b:te.go(n.b,"bd"),p:te.go(n.p,"pq"),o:te.go(n.o,"o"),q:te.go(n.q,"pq"),d:te.go(n.d,n.dType==="oxidation"?"oxidation":"bd"),dType:n.dType}));else{var u;n.rdt==="M"?u=te.go(n.rd,"tex-math"):n.rdt==="T"?u=[{type_:"text",p1:n.rd||""}]:u=te.go(n.rd);var m;n.rqt==="M"?m=te.go(n.rq,"tex-math"):n.rqt==="T"?m=[{type_:"text",p1:n.rq||""}]:m=te.go(n.rq),o={type_:"arrow",r:n.r,rd:u,rq:m}}for(var p in n)p!=="parenthesisLevel"&&p!=="beginsWithBond"&&delete n[p];return o},"oxidation-output":function(n,r){var l=["{"];return te.concatArray(l,te.go(r,"oxidation")),l.push("}"),l},"frac-output":function(n,r){return{type_:"frac-ce",p1:te.go(r[0]),p2:te.go(r[1])}},"overset-output":function(n,r){return{type_:"overset",p1:te.go(r[0]),p2:te.go(r[1])}},"underset-output":function(n,r){return{type_:"underset",p1:te.go(r[0]),p2:te.go(r[1])}},"underbrace-output":function(n,r){return{type_:"underbrace",p1:te.go(r[0]),p2:te.go(r[1])}},"color-output":function(n,r){return{type_:"color",color1:r[0],color2:te.go(r[1])}},"r=":function(n,r){n.r=r},"rdt=":function(n,r){n.rdt=r},"rd=":function(n,r){n.rd=r},"rqt=":function(n,r){n.rqt=r},"rq=":function(n,r){n.rq=r},operator:function(n,r,l){return{type_:"operator",kind_:l||r}}}},a:{transitions:te.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:te.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:te.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(n){if(n.text_){var r={type_:"text",p1:n.text_};for(var l in n)delete n[l];return r}}}},pq:{transitions:te.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(n,r){return{type_:"state of aggregation subscript",p1:te.go(r,"o")}},"color-output":function(n,r){return{type_:"color",color1:r[0],color2:te.go(r[1],"pq")}}}},bd:{transitions:te.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(n,r){return{type_:"color",color1:r[0],color2:te.go(r[1],"bd")}}}},oxidation:{transitions:te.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(n,r){return{type_:"roman numeral",p1:r||""}}}},"tex-math":{transitions:te.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(n){if(n.o){var r={type_:"tex-math",p1:n.o};for(var l in n)delete n[l];return r}}}},"tex-math tight":{transitions:te.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(n,r){n.o=(n.o||"")+"{"+r+"}"},output:function(n){if(n.o){var r={type_:"tex-math",p1:n.o};for(var l in n)delete n[l];return r}}}},"9,9":{transitions:te.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:te.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(n,r){var l=[];return r[0]==="+-"||r[0]==="+/-"?l.push("\\pm "):r[0]&&l.push(r[0]),r[1]&&(te.concatArray(l,te.go(r[1],"pu-9,9")),r[2]&&(r[2].match(/[,.]/)?te.concatArray(l,te.go(r[2],"pu-9,9")):l.push(r[2])),r[3]=r[4]||r[3],r[3]&&(r[3]=r[3].trim(),r[3]==="e"||r[3].substr(0,1)==="*"?l.push({type_:"cdot"}):l.push({type_:"times"}))),r[3]&&l.push("10^{"+r[5]+"}"),l},"number^":function(n,r){var l=[];return r[0]==="+-"||r[0]==="+/-"?l.push("\\pm "):r[0]&&l.push(r[0]),te.concatArray(l,te.go(r[1],"pu-9,9")),l.push("^{"+r[2]+"}"),l},operator:function(n,r,l){return{type_:"operator",kind_:l||r}},space:function(){return{type_:"pu-space-1"}},output:function(n){var r,l=te.patterns.match_("{(...)}",n.d||"");l&&l.remainder===""&&(n.d=l.match_);var o=te.patterns.match_("{(...)}",n.q||"");if(o&&o.remainder===""&&(n.q=o.match_),n.d&&(n.d=n.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),n.d=n.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),n.q){n.q=n.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),n.q=n.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var u={d:te.go(n.d,"pu"),q:te.go(n.q,"pu")};n.o==="//"?r={type_:"pu-frac",p1:u.d,p2:u.q}:(r=u.d,u.d.length>1||u.q.length>1?r.push({type_:" / "}):r.push({type_:"/"}),te.concatArray(r,u.q))}else r=te.go(n.d,"pu-2");for(var m in n)delete n[m];return r}}},"pu-2":{transitions:te.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(n,r){n.rm+="^{"+r+"}"},space:function(){return{type_:"pu-space-2"}},output:function(n){var r=[];if(n.rm){var l=te.patterns.match_("{(...)}",n.rm||"");l&&l.remainder===""?r=te.go(l.match_,"pu"):r={type_:"rm",p1:n.rm}}for(var o in n)delete n[o];return r}}},"pu-9,9":{transitions:te.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(n){var r=[];if(n.text_=n.text_||"",n.text_.length>4){var l=n.text_.length%3;l===0&&(l=3);for(var o=n.text_.length-3;o>0;o-=3)r.push(n.text_.substr(o,3)),r.push({type_:"1000 separator"});r.push(n.text_.substr(0,l)),r.reverse()}else r.push(n.text_);for(var u in n)delete n[u];return r},"output-o":function(n){var r=[];if(n.text_=n.text_||"",n.text_.length>4){for(var l=n.text_.length-3,o=0;o<l;o+=3)r.push(n.text_.substr(o,3)),r.push({type_:"1000 separator"});r.push(n.text_.substr(o))}else r.push(n.text_);for(var u in n)delete n[u];return r}}}};var St={go:function(n,r){if(!n)return"";for(var l="",o=!1,u=0;u<n.length;u++){var m=n[u];typeof m=="string"?l+=m:(l+=St._go2(m),m.type_==="1st-level escape"&&(o=!0))}return!r&&!o&&l&&(l="{"+l+"}"),l},_goInner:function(n){return n&&St.go(n,!0)},_go2:function(n){var r;switch(n.type_){case"chemfive":r="";var l={a:St._goInner(n.a),b:St._goInner(n.b),p:St._goInner(n.p),o:St._goInner(n.o),q:St._goInner(n.q),d:St._goInner(n.d)};l.a&&(l.a.match(/^[+\-]/)&&(l.a="{"+l.a+"}"),r+=l.a+"\\,"),(l.b||l.p)&&(r+="{\\vphantom{X}}",r+="^{\\hphantom{"+(l.b||"")+"}}_{\\hphantom{"+(l.p||"")+"}}",r+="{\\vphantom{X}}",r+="^{\\smash[t]{\\vphantom{2}}\\mathllap{"+(l.b||"")+"}}",r+="_{\\vphantom{2}\\mathllap{\\smash[t]{"+(l.p||"")+"}}}"),l.o&&(l.o.match(/^[+\-]/)&&(l.o="{"+l.o+"}"),r+=l.o),n.dType==="kv"?((l.d||l.q)&&(r+="{\\vphantom{X}}"),l.d&&(r+="^{"+l.d+"}"),l.q&&(r+="_{\\smash[t]{"+l.q+"}}")):n.dType==="oxidation"?(l.d&&(r+="{\\vphantom{X}}",r+="^{"+l.d+"}"),l.q&&(r+="{\\vphantom{X}}",r+="_{\\smash[t]{"+l.q+"}}")):(l.q&&(r+="{\\vphantom{X}}",r+="_{\\smash[t]{"+l.q+"}}"),l.d&&(r+="{\\vphantom{X}}",r+="^{"+l.d+"}"));break;case"rm":r="\\mathrm{"+n.p1+"}";break;case"text":n.p1.match(/[\^_]/)?(n.p1=n.p1.replace(" ","~").replace("-","\\text{-}"),r="\\mathrm{"+n.p1+"}"):r="\\text{"+n.p1+"}";break;case"roman numeral":r="\\mathrm{"+n.p1+"}";break;case"state of aggregation":r="\\mskip2mu "+St._goInner(n.p1);break;case"state of aggregation subscript":r="\\mskip1mu "+St._goInner(n.p1);break;case"bond":if(r=St._getBond(n.kind_),!r)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+n.kind_+")"];break;case"frac":var o="\\frac{"+n.p1+"}{"+n.p2+"}";r="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"pu-frac":var u="\\frac{"+St._goInner(n.p1)+"}{"+St._goInner(n.p2)+"}";r="\\mathchoice{\\textstyle"+u+"}{"+u+"}{"+u+"}{"+u+"}";break;case"tex-math":r=n.p1+" ";break;case"frac-ce":r="\\frac{"+St._goInner(n.p1)+"}{"+St._goInner(n.p2)+"}";break;case"overset":r="\\overset{"+St._goInner(n.p1)+"}{"+St._goInner(n.p2)+"}";break;case"underset":r="\\underset{"+St._goInner(n.p1)+"}{"+St._goInner(n.p2)+"}";break;case"underbrace":r="\\underbrace{"+St._goInner(n.p1)+"}_{"+St._goInner(n.p2)+"}";break;case"color":r="{\\color{"+n.color1+"}{"+St._goInner(n.color2)+"}}";break;case"color0":r="\\color{"+n.color+"}";break;case"arrow":var m={rd:St._goInner(n.rd),rq:St._goInner(n.rq)},p="\\x"+St._getArrow(n.r);m.rq&&(p+="[{"+m.rq+"}]"),m.rd?p+="{"+m.rd+"}":p+="{}",r=p;break;case"operator":r=St._getOperator(n.kind_);break;case"1st-level escape":r=n.p1+" ";break;case"space":r=" ";break;case"entitySkip":r="~";break;case"pu-space-1":r="~";break;case"pu-space-2":r="\\mkern3mu ";break;case"1000 separator":r="\\mkern2mu ";break;case"commaDecimal":r="{,}";break;case"comma enumeration L":r="{"+n.p1+"}\\mkern6mu ";break;case"comma enumeration M":r="{"+n.p1+"}\\mkern3mu ";break;case"comma enumeration S":r="{"+n.p1+"}\\mkern1mu ";break;case"hyphen":r="\\text{-}";break;case"addition compound":r="\\,{\\cdot}\\,";break;case"electron dot":r="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":r="{\\times}";break;case"prime":r="\\prime ";break;case"cdot":r="\\cdot ";break;case"tight cdot":r="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":r="\\times ";break;case"circa":r="{\\sim}";break;case"^":r="uparrow";break;case"v":r="downarrow";break;case"ellipsis":r="\\ldots ";break;case"/":r="/";break;case" / ":r="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return r},_getArrow:function(n){switch(n){case"->":return"rightarrow";case"→":return"rightarrow";case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"rightleftarrows";case"<=>":return"rightleftharpoons";case"⇌":return"rightleftharpoons";case"<=>>":return"rightequilibrium";case"<<=>":return"leftequilibrium";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(n){switch(n){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";case"~=":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"~--":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"-~-":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(n){switch(n){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function Z1(i){const n=i.trim().split(`
|
|
325
|
+
`);if(n.length<2)return!1;const r=n[0].trim();if(!r.startsWith("|")||(r.match(/\|/g)||[]).length<2)return!1;const l=n[1].trim();if(!l.startsWith("|")||!/^[\s|:|-]+$/.test(l)||!l.includes("-"))return!1;for(let o=2;o<n.length;o++){const u=n[o].trim();if(u!==""&&!u.startsWith("|"))return!1}return!0}function J1(i){return i.replace(/(^|\n)(```|~~~)\s*\n([\s\S]*?)\n\2(\n|$)/g,(n,r,l,o,u)=>Z1(o)?`${r}
|
|
326
|
+
${o.trim()}
|
|
327
|
+
${u}`:n)}function W1(i){const n={};let r=0;return i=i.replace(/\$\$([\s\S]*?)\$\$/g,(l,o)=>{const u=`__DISPLAY_MATH_${r++}__`;return n[u]=`$$${o}$$`,u}),i=i.replace(/\\\[([\s\S]*?)\\\]/g,(l,o)=>{const u=`__DISPLAY_MATH_${r++}__`;return n[u]=`$$${o}$$`,u}),i=i.replace(/\\\(([\s\S]*?)\\\)/g,(l,o)=>{const u=`__INLINE_MATH_${r++}__`;return n[u]=`$${o}$`,u}),i=i.replace(/(^|\n)(```|~~~)([^\n]*)\n([\s\S]*?)\n\2(\n|$)/g,(l,o,u,m,p,h)=>{const b=`__FENCED_CODE_${r++}__`;return n[b]=`${o}${u}${m}
|
|
328
|
+
${p}
|
|
329
|
+
${u}${h}`,b}),i=i.replace(/`([^`]+)`/g,l=>{const o=`__INLINE_CODE_${r++}__`;return n[o]=l,o}),{masked:i,masks:n}}function e2(i){const n={};let r=0;return i=i.replace(new RegExp("(?<!\\$)\\$(?!\\$)([^$\\n]+?)(?<!\\$)\\$(?!\\$)","g"),(l,o)=>{const u=o.trim();if(/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?(?:\s?[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion)?$/.test(u))return l;const p=`__INLINE_MATH_${r++}__`;return n[p]=`$${o}$`,p}),{masked:i,masks:n}}const ig=/\\(?:iiint|iint|oint|int|sum|prod|lim|frac|sqrt|sin|cos|tan|sec|csc|cot|arcsin|arccos|arctan|ln|log|exp|Delta|nabla|partial)\b/;function t2(i){const n=/(__INLINE_MATH_\d+__|__DISPLAY_MATH_\d+__|__CURRENCY_\d+__)/g,r=/^(__INLINE_MATH_\d+__|__DISPLAY_MATH_\d+__|__CURRENCY_\d+__)$/;return i.split(`
|
|
330
|
+
`).map(l=>ig.test(l)?l.split(n).map(o=>!o||r.test(o)||!ig.test(o)||o.includes("$")?o:o.replace(/\\(?:iiint|iint|oint|int|sum|prod|lim|frac|sqrt|sin|cos|tan|sec|csc|cot|arcsin|arccos|arctan|ln|log|exp|Delta|nabla|partial)\b[^\n]*/g,u=>{const m=u.trimEnd();return m?`$${m}$${u.slice(m.length)}`:u})).join(""):l).join(`
|
|
331
|
+
`)}function a2(i){return i.replace(/\$([^$\n]*?)\s*=\s*\$([^$\n]+)\$\s*([^$\n]*?)\$/g,(n,r,l,o)=>{const u=String(r).trimEnd(),m=String(l).trim(),p=String(o).trim(),h=[m,p].filter(Boolean).join(" ");return`$${u} = ${h}$`})}function n2(i){const n=i.split(`
|
|
332
|
+
`);for(let l=0;l<n.length-1;l++){const o=n[l],u=n[l+1]??"";if(!o||!u)continue;const m=u.trim();if(!(m.startsWith("|")&&m.includes("-")))continue;const h=o.indexOf("|");if(h<=0)continue;const b=o.slice(0,h);if(!b||b.trim()==="")continue;const y=b.trim(),x=y.replace(/\s+/g,""),w=x!==""&&/^[>]+$/.test(x),v=/^[-*+]\s*$/.test(y),k=/^\d+\.\s*$/.test(y);if(w||v||k)continue;const _=o.slice(h);if((_.match(/\|/g)||[]).length<2)continue;const R=b.replace(/\s+$/,""),P=_.replace(/^\s+/,"");R&&(n.splice(l,1,R,P),l++)}const r=[];for(let l=0;l<n.length;l++){const o=n[l],u=o.trim(),p=(n[l+1]??"").trim();u.startsWith("|")&&(u.match(/\|/g)||[]).length>=2&&p.startsWith("|")&&/^[\s|:-]+$/.test(p)&&p.includes("-")&&r.length>0&&r[r.length-1].trim()!==""&&r.push(""),r.push(o)}return r.join(`
|
|
333
|
+
`)}const lg=["aligned","align","align*","array","cases","pmatrix","bmatrix","vmatrix","Vmatrix","matrix","smallmatrix","gather","gather*","multline","multline*","split","flalign","flalign*","eqnarray","equation","equation*"];function s2(i,n){let r=0,l=`__${n}_${r}__`;for(;Object.prototype.hasOwnProperty.call(i,l);)r++,l=`__${n}_${r}__`;return l}function r2(i,n){if(!lg.length)return i;const r=lg.join("|"),l=new RegExp(String.raw`\\begin\{(${r})\}([\s\S]*?)\\end\{\1\}`,"g");return i.replace(l,(o,u,m,p,h)=>{const b=h.slice(0,p),y=h.slice(p+o.length),x=/(\$\$|\\\[)\s*$/.test(b),w=/^\s*(\$\$|\\\])/.test(y);if(x&&w)return o;const v=b.lastIndexOf("\\["),k=b.lastIndexOf("\\]");if(v>k&&v!==-1&&/\\]/.test(y))return o;const j=/\$\$/g;let R=0;for(;j.exec(b)!==null;)R++;if(R%2===1&&/\$\$/.test(y))return o;if((b.replace(/\$\$/g,"__DD__").replace(/\\\$/g,"__ES__").match(/\$/g)||[]).length%2===1){const U=y.replace(/\$\$/g,"__DD__").replace(/\\\$/g,"__ES__");if(/^[^$]*\$(?!\$)/.test(U))return o}const F=s2(n,"LATEX_ENV"),C=o.trim();return n[F]=`
|
|
334
|
+
$$
|
|
335
|
+
${C}
|
|
336
|
+
$$
|
|
337
|
+
`,F})}function i2(i,n){for(const[r,l]of Object.entries(n)){const o=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");i=i.replace(o,()=>l)}return i}const l2=i=>{if(!i||typeof i!="string")return"";try{let n=i.replace(/\r\n/g,`
|
|
338
|
+
`).replace(/\r/g,`
|
|
339
|
+
`);n=J1(n);const{masked:r,masks:l}=W1(n);n=r,n=n.replace(/<br\s*\/?>/gi,`
|
|
340
|
+
`),n=n.replace(/\\(ne|neq)\$(?=\s*[-+0-9A-Za-z(])/g,"\\$1"),n=a2(n),n=n2(n),n=r2(n,l);const o=new Map;let u=0;const m=String.raw`-?\$\(?\d{1,3}(?:,\d{3})*(?:\.\d+)?\)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?|\$-?\d+(?:\.\d+)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?`,p=new RegExp(String.raw`(${m})(\s?[–-]\s?)(${m})`,"g");n=n.replace(p,(w,v,k,_)=>{const j=`__CURRENCY_${u++}__`,R=`__CURRENCY_${u++}__`;return o.set(j,v),o.set(R,_),`${j}${k}${R}`});const h=new RegExp(String.raw`-?\$\(?\d{1,3}(?:,\d{3})*(?:\.\d+)?\)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?(?!\w)|\$-?\d+(?:\.\d+)?(?:\s?(?:[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion))?(?!\w)`,"g");n=n.replace(h,(w,v,k)=>{if(k.substring(v+w.length).match(/^[a-zA-Z]/)&&!w.match(/[KMBkmb]|[Kk]ilo|[Mm]illion|[Bb]illion$/))return w;const j=`__CURRENCY_${u++}__`;return o.set(j,w),j});const{masked:b,masks:y}=e2(n);return n=b,Object.assign(l,y),n=t2(n),[/(?:^|\s)([a-zA-Z0-9]+\s*[\^_]\s*[a-zA-Z0-9{}]+(?:\s*[+\-*/]\s*[a-zA-Z0-9]+\s*[\^_]\s*[a-zA-Z0-9{}]+)*\s*=\s*[^$\n]+)(?:\s|$)/g,/(?:^|\s)(\\frac\{[^}]+\}\{[^}]+\})(?:\s|$)/g,/(?:^|\s)(\\(?:sqrt|int|sum|prod|lim|log|ln|sin|cos|tan|exp)\b[^$\n]{0,50})(?:\s|$)/g,/(?:^|\s)([A-Z][a-z]?(?:\d+)?(?:\([A-Z][a-z]?(?:\d+)?\))?(?:\d+)?(?:[+-]\d*)?)+(?:\s|$)/g].forEach(w=>{n=n.replace(w,(v,k)=>{if(v.includes("$")||v.includes("__INLINE_MATH_")||v.includes("__DISPLAY_MATH_")||v.includes("__CURRENCY_"))return v;const _=String(k??"").trim();if(/^[A-Za-z]$/.test(_))return v;const j=/[\\^_+=<>]|\\b(?:frac|sqrt|sum|int|lim|log|ln|sin|cos|tan|exp)\b/.test(_),R=/\d/.test(_),P=/[()]/.test(_),z=(_.match(/[A-Z]/g)||[]).length,M=(_.match(/[a-z]/g)||[]).length,B=z>=2,H=R||P||B&&M>0;return!j&&!H?v:v.replace(k,`$${k}$`)})}),n=n.replace(new RegExp("(?<!\\\\)\\$(?!\\$)([^$\\n]*?)(?<!\\\\)\\$(?!\\$)","g"),(w,v)=>{if(w.includes("__CURRENCY_")||w.includes("__INLINE_MATH_")||w.includes("__DISPLAY_MATH_")||v.trim()==="")return w;const k=/^\d+(?:,\d{3})*(?:\.\d{2})?$/.test(v.trim()),_=/\\/.test(v),j=/[+\-*/=<>^_{}()]/.test(v),R=/[a-zA-Z].*\d|\d.*[a-zA-Z]/.test(v),P=/\\(?:alpha|beta|gamma|delta|epsilon|theta|lambda|mu|pi|sigma|omega)/.test(v),z=/\\(?:frac|sqrt|sum|int|lim|log|ln|sin|cos|tan|exp)/.test(v),M=/^[A-Za-z]$/.test(v.trim());return!k&&(_||j||R||P||z||M||v.length>1)?w:`\\$${v}\\$`}),n=n.split(`
|
|
341
|
+
`).map(w=>{const v=w.indexOf("$$");return v===-1||w.trim()==="$$"||w.indexOf("$$",v+2)!==-1?w:w.replace("$$","\\$\\$")}).join(`
|
|
342
|
+
`),o.forEach((w,v)=>{const k=w.replace(/\$/g,"$");n=n.replace(new RegExp(v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),k)}),n=n.replace(/\\$/g,"$"),n=i2(n,l),n=n.trimEnd()+`
|
|
343
|
+
`,n}catch(n){return console.warn("Error preprocessing markdown:",n),i}},o2={'code[class*="language-"]':{color:"#393A34",fontFamily:'"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",fontSize:".9em",lineHeight:"1.2em",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#393A34",fontFamily:'"Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",fontSize:".9em",lineHeight:"1.2em",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",border:"1px solid #dddddd",backgroundColor:"white"},'pre > code[class*="language-"]':{fontSize:"1em"},'pre[class*="language-"]::-moz-selection':{background:"#C1DEF1"},'pre[class*="language-"] ::-moz-selection':{background:"#C1DEF1"},'code[class*="language-"]::-moz-selection':{background:"#C1DEF1"},'code[class*="language-"] ::-moz-selection':{background:"#C1DEF1"},'pre[class*="language-"]::selection':{background:"#C1DEF1"},'pre[class*="language-"] ::selection':{background:"#C1DEF1"},'code[class*="language-"]::selection':{background:"#C1DEF1"},'code[class*="language-"] ::selection':{background:"#C1DEF1"},':not(pre) > code[class*="language-"]':{padding:".2em",paddingTop:"1px",paddingBottom:"1px",background:"#f8f8f8",border:"1px solid #dddddd"},comment:{color:"#008000",fontStyle:"italic"},prolog:{color:"#008000",fontStyle:"italic"},doctype:{color:"#008000",fontStyle:"italic"},cdata:{color:"#008000",fontStyle:"italic"},namespace:{Opacity:".7"},string:{color:"#A31515"},punctuation:{color:"#393A34"},operator:{color:"#393A34"},url:{color:"#36acaa"},symbol:{color:"#36acaa"},number:{color:"#36acaa"},boolean:{color:"#36acaa"},variable:{color:"#36acaa"},constant:{color:"#36acaa"},inserted:{color:"#36acaa"},atrule:{color:"#0000ff"},keyword:{color:"#0000ff"},"attr-value":{color:"#0000ff"},".language-autohotkey .token.selector":{color:"#0000ff"},".language-json .token.boolean":{color:"#0000ff"},".language-json .token.number":{color:"#0000ff"},'code[class*="language-css"]':{color:"#0000ff"},function:{color:"#393A34"},deleted:{color:"#9a050f"},".language-autohotkey .token.tag":{color:"#9a050f"},selector:{color:"#800000"},".language-autohotkey .token.keyword":{color:"#00009f"},important:{color:"#e90",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},"class-name":{color:"#2B91AF"},".language-json .token.property":{color:"#2B91AF"},tag:{color:"#800000"},"attr-name":{color:"#ff0000"},property:{color:"#ff0000"},regex:{color:"#ff0000"},entity:{color:"#ff0000"},"directive.tag.tag":{background:"#ffff00",color:"#393A34"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"#a5a5a5"},".line-numbers .line-numbers-rows > span:before":{color:"#2B91AF"},".line-highlight.line-highlight":{background:"linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0))"}},c2={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}},u2=S.lazy(()=>On(()=>import("./MermaidRenderer-B_R73JsW.js").then(i=>i.au),__vite__mapDeps([0,1,2,3,4,5])).then(i=>({default:i.MermaidRenderer}))),d2=S.lazy(()=>On(()=>import("./SVGRenderer-Cchy5MKU.js"),__vite__mapDeps([6,1,3,5,7,2,8])).then(i=>({default:i.SVGRenderer}))),f2=S.lazy(()=>On(()=>import("./ChartRenderer-6ita77oC.js"),__vite__mapDeps([9,1,5,4,10,11,12,13,14,15,7,2,8])).then(i=>({default:i.ChartRenderer}))),m2=S.lazy(()=>On(()=>import("./MusicRenderer-CPyadT-W.js"),__vite__mapDeps([16,2,1,5,7,8])).then(i=>({default:i.MusicRenderer}))),p2=i=>{var l,o;if(!i)return typeof window<"u"&&((l=window.matchMedia)!=null&&l.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light";const n=i.closest(".markdown-content");if(n){if(n.classList.contains("dark"))return"dark";if(n.classList.contains("light"))return"light"}if(i.closest(".dark"))return"dark";if(i.closest(".light"))return"light";const r=i.closest("[data-theme]");if(r){const u=r.getAttribute("data-theme");if(u==="dark")return"dark";if(u==="light")return"light"}return typeof window<"u"&&((o=window.matchMedia)!=null&&o.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"},h2=(i,n)=>{const[r,l]=S.useState("light"),o=S.useRef("light");return S.useEffect(()=>{var b,y,x;if(n||typeof window>"u"||typeof document>"u")return;const u=()=>{const w=p2(i.current);w!==o.current&&(o.current=w,l(w))};u();const m=((b=window.matchMedia)==null?void 0:b.call(window,"(prefers-color-scheme: dark)"))??null,p=()=>u();m==null||m.addEventListener("change",p);const h=typeof MutationObserver<"u"?new MutationObserver(()=>u()):null;if(h){const w=((x=(y=i.current)==null?void 0:y.closest)==null?void 0:x.call(y,".markdown-content"))??null;w&&h.observe(w,{attributes:!0,attributeFilter:["class","data-theme"]}),document.body&&h.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme"]})}return()=>{m==null||m.removeEventListener("change",p),h==null||h.disconnect()}},[n,i]),n??r},g2={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"tsx",sh:"bash",shell:"bash",shellsession:"bash",yml:"yaml",yaml:"yaml",py:"python",rb:"ruby",kt:"kotlin",md:"markdown",csharp:"csharp","c#":"csharp","c++":"cpp",tf:"hcl",terraform:"hcl",docker:"dockerfile",dotenv:"env",env:"env",plaintext:"text",text:"text"},b2=i=>{if(!i)return"";const n=i.match(/(?:^|\s)language-([^\s]+)/);if(!n)return"";const l=n[1].toLowerCase().split("{")[0].split("[")[0].split("<")[0].split(":")[0].trim().replace(/[^a-z0-9+#-]+$/g,"");return l?g2[l]??l:""},x2=i=>Rn.Children.toArray(i).map(n=>typeof n=="string"||typeof n=="number"?String(n):"").join("").replace(/\n$/,""),og=({code:i})=>{const{t:n}=pt(),[r,l]=S.useState(!1),o=async()=>{try{await navigator.clipboard.writeText(i),l(!0),setTimeout(()=>l(!1),2e3)}catch{const u=document.createElement("textarea");u.value=i,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select();try{document.execCommand("copy"),l(!0),setTimeout(()=>l(!1),2e3)}catch(m){console.error("Failed to copy code:",m)}document.body.removeChild(u)}};return f.jsxs("button",{className:"code-copy-button",onClick:o,title:n(r?"markdown.codeBlock.copied":"markdown.codeBlock.copyTitle"),"aria-label":n(r?"markdown.codeBlock.copied":"markdown.codeBlock.copyAriaLabel"),children:[r?f.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("path",{d:"M5.5 4.5H3.5C2.94772 4.5 2.5 4.94772 2.5 5.5V12.5C2.5 13.0523 2.94772 13.5 3.5 13.5H10.5C11.0523 13.5 11.5 13.0523 11.5 12.5V10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("path",{d:"M6.5 2.5H12.5C13.0523 2.5 13.5 2.94772 13.5 3.5V9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("path",{d:"M9.5 6.5L13.5 2.5L9.5 2.5V6.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),f.jsx("span",{className:"code-copy-button-text",children:n(r?"markdown.codeBlock.copied":"markdown.codeBlock.copyLabel")})]})},y2=({inline:i,className:n="",children:r,enableGraphs:l=!0,enableMermaid:o=!0,enableSVG:u=!0,enableCharts:m=!0,enableMusic:p=!0,enableSyntaxHighlighting:h=!0,syntaxTheme:b})=>{const{t:y}=pt(),x=S.useRef(null),w=h2(x,b),v=f.jsx("div",{className:"markdown-code-block code-block-container",children:y("markdown.codeBlock.loadingRenderer")});if(i)return f.jsx("code",{className:n,children:r});const k=b2(n),_=x2(r);if(m&&(k==="chart"||k==="chart-json"||k==="chart-table"))return f.jsx("div",{ref:x,children:f.jsx(S.Suspense,{fallback:v,children:f.jsx(f2,{code:_,language:k})})});if(p&&(k==="abc"||k==="music"))return f.jsx("div",{ref:x,children:f.jsx(S.Suspense,{fallback:v,children:f.jsx(m2,{code:_})})});if(l){if(k==="mermaid"&&o)return f.jsx("div",{ref:x,children:f.jsx(S.Suspense,{fallback:v,children:f.jsx(u2,{code:_})})});if(k==="svg"&&u)return f.jsx("div",{ref:x,children:f.jsx(S.Suspense,{fallback:v,children:f.jsx(d2,{code:_})})})}if(h&&k){const j=w==="light"?o2:c2;return f.jsxs("div",{ref:x,className:"syntax-highlighted-wrapper code-block-container",children:[f.jsx(og,{code:_}),f.jsx(yx,{language:k,style:j,customStyle:{margin:"12px 0",borderRadius:"6px",fontSize:"0.9em"},showLineNumbers:!1,children:_})]})}return f.jsxs("div",{ref:x,className:`markdown-code-block code-block-container ${n}`.trim(),children:[f.jsx(og,{code:_}),f.jsx("pre",{style:{margin:0,padding:0,background:"transparent",border:"none"},children:f.jsx("code",{children:_})})]})},cg=new Set(["div","pre","blockquote","ul","ol","table","thead","tbody","tr","td","th","h1","h2","h3","h4","h5","h6","section","article","figure"]),v2=({children:i,href:n="",className:r="",...l})=>{const o=Rn.Children.toArray(i).map(y=>typeof y=="string"?y:"").join("").trim(),u=/^https?:\/\//i.test(n),m=!!(u&&o&&ug(o)===ug(n)),p=u?S2(n):null,h=!!(m&&p),b=["markdown-link",h?"markdown-link--card":"markdown-link--inline",r].filter(Boolean).join(" ");return f.jsxs("a",{...l,href:n,target:"_blank",rel:"noopener noreferrer",className:b,children:[f.jsx("span",{className:"markdown-link__content",children:h&&p?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"markdown-link__hostname",children:p.hostname}),p.path&&p.path!=="/"&&f.jsx("span",{className:"markdown-link__path",children:p.path})]}):i}),u&&f.jsx("span",{className:"markdown-link__icon","aria-hidden":"true",children:f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M8 16L16 8M16 8H9M16 8V15",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})]})};function ug(i){return i.trim().replace(/\/$/,"")}function S2(i){try{const n=new URL(i),r=n.hostname.replace(/^www\./i,""),l=`${n.pathname}${n.search}${n.hash}`||"/";return{hostname:r,path:l}}catch{return null}}const ds=({content:i,className:n="",disableMath:r=!1,enableGraphs:l=!0,enableMermaid:o=!0,enableSVG:u=!0,enableCharts:m=!0,enableMusic:p=!0,enableSyntaxHighlighting:h=!0,syntaxTheme:b="dark"})=>{const y=l2(i);if(!y)return null;const x=r?[Dh]:[Dh,[bx,{singleDollarTextMath:!0}]],w=[];r||w.push([xx,{throwOnError:!1,errorColor:"#cc0000",strict:!1,trust:!0,macros:{"\\RR":"\\mathbb{R}","\\NN":"\\mathbb{N}","\\ZZ":"\\mathbb{Z}","\\QQ":"\\mathbb{Q}","\\CC":"\\mathbb{C}","\\dx":"\\,dx","\\dy":"\\,dy","\\dt":"\\,dt","\\dz":"\\,dz"}}]);const v={table:({children:k,..._})=>f.jsx("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:f.jsx("table",{..._,children:k})}),a:v2,code:k=>{const{className:_,children:j,...R}=k,P=_&&/language-/.test(_),z="inline"in k&&typeof k.inline=="boolean"&&k.inline||!P,M=P;return f.jsx(y2,{inline:z,className:_,enableGraphs:l,enableMermaid:o,enableSVG:u,enableCharts:m,enableMusic:p,enableSyntaxHighlighting:h,syntaxTheme:b,"data-block-code":M?"true":void 0,...R,children:j})},p:({node:k,..._})=>{var z;const R=Rn.Children.toArray(_.children).filter(M=>!(typeof M=="string"&&M.trim()==="")).some(M=>{if(!Rn.isValidElement(M))return!1;const B=M.props;return(B==null?void 0:B["data-block-code"])==="true"?!0:typeof M.type=="string"?cg.has(M.type):!1}),P=(z=k==null?void 0:k.children)==null?void 0:z.some(M=>{var B;if(M.type==="code")return!0;if(M.type==="element"){if(M.tagName&&cg.has(M.tagName))return!0;if(M.tagName==="code"){const H=(B=M.properties)==null?void 0:B.className;return Array.isArray(H)?H.some(F=>typeof F=="string"&&F.startsWith("language-")):!0}}return!1});return R||P?f.jsx(f.Fragment,{children:_.children}):f.jsx("p",{..._})}};return f.jsx("div",{className:`markdown-content ${n}`,children:f.jsx(gx,{remarkPlugins:x,rehypePlugins:w,components:v,children:y})})},nf=()=>Se.debug.consoleDebug,se=(...i)=>{nf()&&console.log(...i)},qe=(...i)=>{nf()&&console.warn(...i)},Ve=(...i)=>{nf()&&console.error(...i)},Bt=(...i)=>{console.error(...i)};function dg({audio:i,audioFormat:n="mp3",autoPlay:r=!1,maxSizeMB:l=10}){const{t:o}=pt(),u=S.useRef(null),[m,p]=S.useState(!1),[h,b]=S.useState(0),[y,x]=S.useState(0),[w,v]=S.useState(!0),[k,_]=S.useState(null),[j,R]=S.useState(null);S.useEffect(()=>{if(!i)return;let U=null,Y=!0;return(async()=>{try{v(!0),_(null),R(null);const ie=i.length*3/4/(1024*1024);if(ie>l)throw new Error(o("audio.player.audioFileTooLargePlaceholder",{sizeMB:ie.toFixed(1),maxMB:l}));if(ie>2&&(R(o("audio.player.largeAudioWarning",{sizeMB:ie.toFixed(1)})),se("[AudioPlayer] Large audio file detected",{sizeMB:ie.toFixed(2)})),!/^[A-Za-z0-9+/=]+$/.test(i.replace(/\s/g,"")))throw new Error(o("audio.player.invalidBase64Error"));const G=atob(i),E=new Uint8Array(G.length);for(let le=0;le<G.length;le++)E[le]=G.charCodeAt(le);const I=n==="mp3"?"audio/mpeg":n==="wav"?"audio/wav":n==="ogg"?"audio/ogg":n==="opus"?"audio/opus":n==="webm"?"audio/webm":`audio/${n}`,V=new Blob([E],{type:I});if(U=URL.createObjectURL(V),!Y||!u.current){U&&URL.revokeObjectURL(U);return}u.current.src=U,v(!1),se("[AudioPlayer] Audio loaded successfully",{format:n,mimeType:I,size:V.size}),r&&u.current&&u.current.play().catch(le=>{Ve("[AudioPlayer] Auto-play failed:",le)})}catch(ae){Ve("[AudioPlayer] Failed to load audio:",ae),Y&&(_(o("audio.player.loadFailureError")),v(!1))}})(),()=>{Y=!1,U&&URL.revokeObjectURL(U)}},[i,n,r,l,o]);const P=()=>{u.current&&b(u.current.duration)},z=()=>{u.current&&x(u.current.currentTime)},M=()=>p(!0),B=()=>p(!1),H=()=>{p(!1),x(0)},F=()=>{u.current&&(m?u.current.pause():u.current.play().catch(U=>{Ve("[AudioPlayer] Playback failed:",U),_(o("audio.player.playbackFailureError"))}))},C=U=>{if(!u.current)return;const Y=parseFloat(U.target.value);u.current.currentTime=Y,x(Y)},Q=U=>{if(!isFinite(U))return"0:00";const Y=Math.floor(U/60),J=Math.floor(U%60);return`${Y}:${J.toString().padStart(2,"0")}`};return k?f.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-700 dark:bg-red-900/20 dark:text-red-400",children:[f.jsx(ec,{className:"h-4 w-4"}),f.jsx("span",{children:k})]}):f.jsxs("div",{className:"mt-3 flex flex-col gap-1",children:[j&&f.jsxs("div",{className:"text-xs text-amber-600 dark:text-amber-400 px-1",children:["⚠️ ",j]}),f.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-gray-300 bg-white px-3 py-2 dark:border-[#4a4b54] dark:bg-[#343541]",children:[f.jsx("audio",{ref:u,onLoadedMetadata:P,onTimeUpdate:z,onPlay:M,onPause:B,onEnded:H}),f.jsx("button",{onClick:F,disabled:w,className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 disabled:opacity-50 dark:bg-[#4a4b54] dark:hover:bg-[#565869]",title:o(m?"audio.player.pauseTitle":"audio.player.playTitle"),"aria-label":o(m?"audio.player.pauseAriaLabel":"audio.player.playAriaLabel"),children:w?f.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}):m?f.jsx($1,{className:"h-4 w-4 text-gray-700 dark:text-[#ececf1]"}):f.jsx(I1,{className:"h-4 w-4 text-gray-700 dark:text-[#ececf1]"})}),f.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[f.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:Q(y)}),f.jsx("input",{type:"range",min:"0",max:h||0,value:y,onChange:C,disabled:w||!h,className:"flex-1 cursor-pointer accent-gray-600 dark:accent-[#bfc2cd]",style:{background:h?`linear-gradient(to right, rgb(75 85 99) 0%, rgb(75 85 99) ${y/h*100}%, rgb(229 231 235) ${y/h*100}%, rgb(229 231 235) 100%)`:"rgb(229 231 235)"}}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:Q(h)})]}),f.jsx(ec,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"})]})]})}var dc=Hg();function fg({image:i,imageUrl:n,imageFormat:r="png",revisedPrompt:l}){const{t:o}=pt(),[u,m]=S.useState(!1),[p,h]=S.useState(!1),[b,y]=S.useState(null),x=S.useRef(null);S.useEffect(()=>{if(i||!n)return;let _=!1;return(async()=>{try{const j=typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null,R=await fetch(n,{headers:j?{"X-Adapter-Name":j}:{}});if(!R.ok){console.warn("[ImageDisplay] Server returned",R.status,"for",n);return}if(_)return;const P=await R.arrayBuffer();if(_)return;const z=new Blob([P],{type:`image/${r}`}),M=URL.createObjectURL(z);x.current=M,y(M)}catch(j){console.warn("[ImageDisplay] Failed to fetch image from",n,j)}})(),()=>{_=!0,x.current&&(URL.revokeObjectURL(x.current),x.current=null)}},[n,i,r]);const v=(i?`data:image/${r};base64,${i}`:null)??b;S.useEffect(()=>{if(!u)return;const _=j=>{j.key==="Escape"&&m(!1)};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const k=_=>{if(_.stopPropagation(),!v)return;const j=document.createElement("a");j.href=v,j.download=`generated-image.${r}`,j.click()};return v?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"generated-image-wrapper",style:{marginTop:"0.75rem"},children:[f.jsxs("div",{className:"generated-image-container",style:{position:"relative",display:"inline-block",cursor:"zoom-in",maxWidth:"100%"},onClick:()=>m(!0),title:l||o("imageDisplay.generatedImageTitle"),children:[f.jsx("img",{src:v,alt:l||o("imageDisplay.generatedImageAlt"),style:{maxWidth:"100%",maxHeight:"480px",borderRadius:"8px",display:"block",objectFit:"contain"}}),f.jsxs("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[f.jsx("button",{onClick:k,title:o("imageDisplay.downloadImageTooltip"),style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:f.jsx(Wd,{size:14})}),f.jsx("button",{onClick:_=>{_.stopPropagation(),m(!0)},title:o("imageDisplay.viewFullSizeTooltip"),style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:f.jsx(Q1,{size:14})})]})]}),l&&f.jsxs("div",{style:{marginTop:"8px",maxWidth:"480px"},children:[f.jsxs("button",{type:"button",onClick:()=>h(_=>!_),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:0,background:"transparent",border:"none",cursor:"pointer",fontSize:"0.75rem",fontWeight:500,opacity:.72},"aria-expanded":p,children:[p?f.jsx(Wo,{size:14}):f.jsx(pi,{size:14}),o(p?"imageDisplay.hidePrompt":"imageDisplay.showPrompt")]}),p&&f.jsxs("div",{style:{marginTop:"8px",padding:"8px 10px",background:"rgba(128,128,128,0.08)",borderRadius:"6px"},children:[f.jsx("span",{style:{display:"block",fontSize:"0.65rem",fontWeight:600,opacity:.5,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:o("imageDisplay.promptLabel")}),f.jsx("span",{style:{fontSize:"0.8rem",lineHeight:1.45,opacity:.85},children:l})]})]})]}),u&&typeof document<"u"&&dc.createPortal(f.jsxs("div",{onClick:()=>m(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.85)",zIndex:9999,overflow:"auto",padding:"56px 24px 24px"},children:[f.jsx("button",{onClick:_=>{_.stopPropagation(),m(!1)},style:{position:"fixed",top:"16px",right:"16px",background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",padding:"8px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:f.jsx(wa,{size:20})}),f.jsx("img",{src:v,alt:l||o("imageDisplay.generatedImageAlt"),style:{display:"block",width:"auto",height:"auto",maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 80px)",objectFit:"contain",borderRadius:"8px",margin:"0 auto"},onClick:_=>_.stopPropagation()})]}),document.body)]}):null}const _d=[750,1500,3e3,5e3],w2=new Set([403,404,409,425,429,500,502,503,504]),k2=i=>new Promise(n=>setTimeout(n,i));function mg({video:i,videoUrl:n,videoFormat:r="mp4",revisedPrompt:l,adapterName:o}){const{t:u}=pt(),[m,p]=S.useState(!1),[h,b]=S.useState(!1),[y,x]=S.useState(null),w=S.useRef(null);S.useEffect(()=>{if(i||!n)return;let j=!1;return(async()=>{try{const R=o||(typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null);let P=null;for(let H=0;H<=_d.length&&(P=await fetch(n,{headers:R?{"X-Adapter-Name":R}:{}}),!(P.ok||!w2.has(P.status)||H===_d.length));H+=1)if(await k2(_d[H]),j)return;if(!(P!=null&&P.ok)){console.warn("[VideoDisplay] Server returned",P.status,"for",n);return}if(j)return;const z=await P.arrayBuffer();if(j)return;const M=new Blob([z],{type:`video/${r}`}),B=URL.createObjectURL(M);w.current=B,x(B)}catch(R){console.warn("[VideoDisplay] Failed to fetch video from",n,R)}})(),()=>{j=!0,w.current&&(URL.revokeObjectURL(w.current),w.current=null)}},[n,i,r,o]);const k=(i?`data:video/${r};base64,${i}`:null)??y;S.useEffect(()=>{if(!m)return;const j=R=>{R.key==="Escape"&&p(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[m]);const _=j=>{if(j.stopPropagation(),!k)return;const R=document.createElement("a");R.href=k,R.download=`generated-video.${r}`,R.click()};return k?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"generated-video-wrapper",style:{marginTop:"0.75rem"},children:[f.jsxs("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%"},children:[f.jsx("video",{src:k,controls:!0,style:{maxWidth:"100%",maxHeight:"480px",borderRadius:"8px",display:"block",backgroundColor:"#000"}}),f.jsxs("div",{style:{position:"absolute",bottom:"48px",right:"8px",display:"flex",gap:"6px"},children:[f.jsx("button",{onClick:_,title:u("videoDisplay.downloadVideoTooltip"),style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:f.jsx(Wd,{size:14})}),f.jsx("button",{onClick:j=>{j.stopPropagation(),p(!0)},title:u("videoDisplay.viewFullSizeTooltip"),style:{background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"6px",padding:"5px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:f.jsx(N1,{size:14})})]})]}),l&&f.jsxs("div",{style:{marginTop:"8px",maxWidth:"480px"},children:[f.jsxs("button",{type:"button",onClick:()=>b(j=>!j),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:0,background:"transparent",border:"none",cursor:"pointer",fontSize:"0.75rem",fontWeight:500,opacity:.72},"aria-expanded":h,children:[h?f.jsx(Wo,{size:14}):f.jsx(pi,{size:14}),u(h?"videoDisplay.hidePrompt":"videoDisplay.showPrompt")]}),h&&f.jsxs("div",{style:{marginTop:"8px",padding:"8px 10px",background:"rgba(128,128,128,0.08)",borderRadius:"6px"},children:[f.jsx("span",{style:{display:"block",fontSize:"0.65rem",fontWeight:600,opacity:.5,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"3px"},children:u("videoDisplay.promptLabel")}),f.jsx("span",{style:{fontSize:"0.8rem",lineHeight:1.45,opacity:.85},children:l})]})]})]}),m&&f.jsxs("div",{onClick:()=>p(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.9)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},children:[f.jsx("button",{onClick:j=>{j.stopPropagation(),p(!1)},style:{position:"fixed",top:"16px",right:"16px",background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",padding:"8px",cursor:"pointer",color:"#fff",display:"flex",alignItems:"center"},children:f.jsx(wa,{size:20})}),f.jsx("video",{src:k,controls:!0,autoPlay:!0,style:{maxWidth:"92vw",maxHeight:"92vh",borderRadius:"8px"},onClick:j=>j.stopPropagation()})]})]}):null}let tc=null;function h0(i){tc=i}function fc(){tc=null}async function sf(){if(!tc)return null;try{return await tc()}catch{return null}}let Fd=!1,xl=null;const Bd=new Set;function g0(){Bd.forEach(i=>i())}function kn(){return Fd}function A2(){return xl}function mc(i){Fd!==i&&(Fd=i,!i&&xl!==null&&(xl=null),g0())}function fi(i){const n=typeof i=="string"&&i.trim().length>0?i.trim():null;xl!==n&&(xl=n,g0())}function _2(i){return Bd.add(i),()=>{Bd.delete(i)}}const pg="orbitchat-guest-user-id";function Oo(i){if(typeof i!="string")return null;const n=i.trim();return n.length>0?n:null}function C2(i){const n=i.split(".");if(n.length<2)return null;try{const r=n[1].replace(/-/g,"+").replace(/_/g,"/"),l=r.padEnd(Math.ceil(r.length/4)*4,"="),o=atob(l);return JSON.parse(o)}catch{return null}}function T2(){const i=globalThis.crypto;if(i&&typeof i.randomUUID=="function")return`guest:orbitchat:${i.randomUUID()}`;if(!i||typeof i.getRandomValues!="function")throw new Error("Secure random number generation is unavailable");const n=new Uint8Array(16);return i.getRandomValues(n),`guest:orbitchat:${Array.from(n,l=>l.toString(16).padStart(2,"0")).join("")}`}function N2(){if(typeof window>"u")return"guest:orbitchat:server";const i=window.localStorage.getItem(pg);if(i&&i.trim().length>0)return i;const n=T2();return window.localStorage.setItem(pg,n),n}async function b0(){const i=A2();if(i)return i;const n=await sf();if(n){const r=C2(n),l=Oo(r==null?void 0:r.sub)||Oo(r==null?void 0:r.user_id)||Oo(r==null?void 0:r.preferred_username)||Oo(r==null?void 0:r.email);if(l)return l}return kn()?"authenticated:orbitchat:unknown":N2()}const j2={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",md:"text/markdown",csv:"text/csv"},hg={pdf:"PDF",docx:"Word document",xlsx:"Excel workbook",pptx:"PowerPoint deck",md:"Markdown document",csv:"CSV file"},Ko=/[\uE000-\uF8FF]|\\[eE][0-9a-fA-F]{2,3}|\\[fF][0-8][0-9a-fA-F]{2,3}/,E2=/((?:p\.)?generated-docx-preview-num-\d+-\d+:before\s*\{[^}]*?)content\s*:\s*"([^"]*)"\s*;([^}]*?\})/g;function L2(i){var r;return Ko.test(i)?`•${((r=i.match(/(?:\\9|\t|\u00A0| )+$/))==null?void 0:r[0])||"\\9"}`:null}function gg(i){Array.from(i.querySelectorAll("style")).forEach(l=>{const o=l.textContent;!o||!Ko.test(o)||(l.textContent=o.replace(E2,(u,m,p,h)=>{const b=L2(p);if(!b)return u;const y=h.replace(/\s*font-family\s*:\s*[^;{}]+;?/gi,"");return`${m}content: "${b}";${y}`}))}),Array.from(i.querySelectorAll('span[style*="font-family"]')).forEach(l=>{if(!/\b(symbol|wingdings|webdings)\b/i.test(l.style.fontFamily))return;const o=l.textContent||"";Ko.test(o)&&(l.textContent=o.replace(Ko,"•"),l.style.fontFamily="")})}function M2(i){return(i||"pdf").toLowerCase().replace(/^\./,"")||"pdf"}function D2(i){const n=window.atob(i),r=new Uint8Array(n.length);for(let l=0;l<n.length;l+=1)r[l]=n.charCodeAt(l);return r.buffer}function z2(i){return i==="xlsx"||i==="csv"?f.jsx(w1,{className:"h-5 w-5"}):i==="pptx"?f.jsx(B1,{className:"h-5 w-5"}):i==="md"?f.jsx(S1,{className:"h-5 w-5"}):f.jsx(k1,{className:"h-5 w-5"})}function bg({document:i,documentUrl:n,documentFormat:r="pdf",revisedPrompt:l,adapterName:o}){const{t:u}=pt(),m=M2(r),[p,h]=S.useState(i||n?"loading":"idle"),[b,y]=S.useState(null),[x,w]=S.useState(null),[v,k]=S.useState([]),[_,j]=S.useState(""),[R,P]=S.useState(null),[z,M]=S.useState([]),[B,H]=S.useState(0),[F,C]=S.useState(!1),[Q,U]=S.useState(null),Y=S.useRef(null),J=S.useRef(null),ae=S.useRef(null),ie=l||hg[m]||u("documentDisplay.generatedDocument"),G=S.useMemo(()=>`generated-document.${m}`,[m]),E=j2[m]||"application/octet-stream";S.useEffect(()=>{if(!i&&!n)return;let ue=!1;return(async()=>{h("loading"),U(null),k([]),j(""),P(null),M([]),H(0);try{const de=i?D2(i):await(async()=>{const ye=(o==null?void 0:o.trim())||(typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null),fe={"X-User-ID":await b0()};ye&&(fe["X-Adapter-Name"]=ye);const ve=await sf();ve&&(fe.Authorization=`Bearer ${ve}`);const ke=await fetch(n,{headers:fe});if(!ke.ok)throw new Error(`Server returned ${ke.status}`);return ke.arrayBuffer()})();if(ue)return;const ge=new Blob([de],{type:E}),ee=URL.createObjectURL(ge);if(Y.current&&URL.revokeObjectURL(Y.current),Y.current=ee,y(ee),w(de.slice(0)),m==="xlsx"){const{default:ye}=await On(async()=>{const{default:ke}=await import("./index-CZz_ECqk.js");return{default:ke}},[]),ve=(await ye(ge))[0];j((ve==null?void 0:ve.sheet)||"First sheet"),k(((ve==null?void 0:ve.data)||[]).slice(0,100).map(ke=>ke.slice(0,30).map(Ee=>Ee==null?"":String(Ee))))}if(m==="md"&&P(new TextDecoder("utf-8").decode(de)),m==="csv"){const ye=new TextDecoder("utf-8").decode(de),{default:fe}=await On(async()=>{const{default:ke}=await import("./papaparse.min-BWA-Odol.js").then(Ee=>Ee.p);return{default:ke}},__vite__mapDeps([17,1])),ve=fe.parse(ye,{skipEmptyLines:!0});H(ve.data.length),M(ve.data.slice(0,25))}h("ready")}catch(de){if(ue)return;console.warn("[DocumentDisplay] Failed to load document from",n,de),U(de instanceof Error?de.message:"Unable to load document"),h("error")}})(),()=>{ue=!0,Y.current&&(URL.revokeObjectURL(Y.current),Y.current=null)}},[o,i,n,m,E]),S.useEffect(()=>{if(p!=="ready"||m!=="docx"||!x||!J.current)return;const ue=J.current;ue.replaceChildren(),On(()=>import("./docx-preview-CMb3nQfR.js"),__vite__mapDeps([18,1])).then(async({renderAsync:oe})=>{await oe(x.slice(0),ue,void 0,{className:"generated-docx-preview",inWrapper:!1,ignoreWidth:!0,ignoreHeight:!0}),gg(ue)}).catch(oe=>{console.warn("[DocumentDisplay] Failed to render DOCX preview",oe),U("Unable to render document preview")})},[x,m,p]),S.useEffect(()=>{if(!F||m!=="docx"||!x||!ae.current)return;const ue=ae.current;ue.replaceChildren(),On(()=>import("./docx-preview-CMb3nQfR.js"),__vite__mapDeps([18,1])).then(async({renderAsync:oe})=>{await oe(x.slice(0),ue,void 0,{className:"generated-docx-preview",inWrapper:!1,ignoreWidth:!0,ignoreHeight:!0}),gg(ue)}).catch(oe=>{console.warn("[DocumentDisplay] Failed to render modal DOCX preview",oe)})},[x,m,F]),S.useEffect(()=>{if(!F)return;const ue=oe=>{oe.key==="Escape"&&C(!1)};return window.document.addEventListener("keydown",ue),()=>window.document.removeEventListener("keydown",ue)},[F]);const I=ue=>{if(ue==null||ue.stopPropagation(),!b)return;const oe=window.document.createElement("a");oe.href=b,oe.download=G,oe.click()},V=p==="ready"&&(m==="pdf"||m==="docx"||m==="xlsx"||m==="md"||m==="csv"),le=V&&m!=="xlsx"&&m!=="csv";return p==="idle"?null:f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mt-3 max-w-full overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-[#3b3c49] dark:bg-[#202123]",children:[f.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 px-3 py-2.5 dark:border-[#3b3c49]",children:[f.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-300",children:z2(m)}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:"truncate text-sm font-medium text-[#353740] dark:text-[#ececf1]",children:ie}),f.jsxs("p",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:[hg[m]||`${m.toUpperCase()} document`,p==="loading"?` · ${u("documentDisplay.loadingPreview")}`:"",p==="error"?` · ${Q||u("documentDisplay.previewUnavailableShort")}`:""]})]}),le&&f.jsx("button",{type:"button",onClick:()=>C(!0),className:"rounded-md p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-[#bfc2cd] dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:u("documentDisplay.openPreviewTooltip"),"aria-label":u("documentDisplay.openPreviewTooltip"),children:f.jsx(v1,{className:"h-4 w-4"})}),f.jsx("button",{type:"button",onClick:I,disabled:!b,className:"rounded-md p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-[#bfc2cd] dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:u("documentDisplay.downloadDocumentTooltip"),"aria-label":u("documentDisplay.downloadDocumentTooltip"),children:f.jsx(Wd,{className:"h-4 w-4"})})]}),V&&f.jsxs("div",{className:"max-h-[460px] overflow-auto bg-gray-50 dark:bg-[#171717]",children:[m==="pdf"&&b&&f.jsx("iframe",{src:b,title:ie,className:"block h-[460px] w-full border-0 bg-white"}),m==="docx"&&f.jsx("div",{ref:J,className:"min-h-[240px] bg-white p-5 text-sm text-[#111827] dark:bg-white dark:text-[#111827]"}),m==="xlsx"&&f.jsxs("div",{className:"p-3",children:[_&&f.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500 dark:text-[#bfc2cd]",children:_}),f.jsx("div",{className:"overflow-auto rounded-md border border-gray-200 bg-white dark:border-[#3b3c49] dark:bg-[#202123]",children:f.jsx("table",{className:"min-w-full border-collapse text-left text-xs",children:f.jsx("tbody",{children:v.length>0?v.map((ue,oe)=>f.jsx("tr",{className:oe===0?"bg-gray-50 font-medium dark:bg-white/5":void 0,children:ue.map((de,ge)=>f.jsx("td",{className:"max-w-[220px] truncate border-b border-r border-gray-100 px-2 py-1.5 text-[#353740] dark:border-[#3b3c49] dark:text-[#ececf1]",children:de},ge))},oe)):f.jsx("tr",{children:f.jsx("td",{className:"px-3 py-4 text-sm text-gray-500 dark:text-[#bfc2cd]",children:u("documentDisplay.noSheetDataFound")})})})})})]}),m==="md"&&R!==null&&f.jsx("div",{className:"bg-white p-5 text-sm text-[#111827] dark:bg-[#171717] dark:text-[#ececf1]",children:f.jsx(ds,{content:R,disableMath:!0})}),m==="csv"&&f.jsxs("div",{className:"p-3",children:[B>25&&f.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-[#bfc2cd]",children:u("documentDisplay.csvRowsPreviewMessage",{count:B})}),f.jsx("div",{className:"overflow-auto rounded-md border border-gray-200 bg-white dark:border-[#3b3c49] dark:bg-[#202123]",children:f.jsx("table",{className:"min-w-full border-collapse text-left text-xs",children:f.jsx("tbody",{children:z.length>0?z.map((ue,oe)=>f.jsx("tr",{className:oe===0?"bg-gray-50 font-medium dark:bg-white/5":void 0,children:ue.map((de,ge)=>f.jsx("td",{className:"max-w-[220px] truncate border-b border-r border-gray-100 px-2 py-1.5 text-[#353740] dark:border-[#3b3c49] dark:text-[#ececf1]",children:de},ge))},oe)):f.jsx("tr",{children:f.jsx("td",{className:"px-3 py-4 text-sm text-gray-500 dark:text-[#bfc2cd]",children:u("documentDisplay.noDataFound")})})})})})]})]}),p==="ready"&&!V&&f.jsx("div",{className:"px-3 py-4 text-sm text-gray-600 dark:text-[#bfc2cd]",children:u("documentDisplay.previewUnavailable")})]}),F&&b&&f.jsxs("div",{onClick:()=>C(!1),className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/85 p-4",children:[f.jsx("button",{onClick:ue=>{ue.stopPropagation(),C(!1)},className:"fixed right-4 top-4 flex items-center rounded-full border-0 bg-white/15 p-2 text-white",title:u("common.close"),"aria-label":u("common.close"),children:f.jsx(wa,{className:"h-5 w-5"})}),f.jsxs("div",{onClick:ue=>ue.stopPropagation(),className:"h-[92vh] w-[92vw] overflow-auto rounded-lg bg-white",children:[m==="pdf"&&f.jsx("iframe",{src:b,title:ie,className:"h-full w-full border-0"}),m==="docx"&&f.jsx("div",{ref:ae,className:"min-h-full bg-white p-8 text-[#111827]"}),m==="md"&&R!==null&&f.jsx("div",{className:"min-h-full bg-white p-8 text-sm text-[#111827]",children:f.jsx(ds,{content:R,disableMath:!0})})]})]})]})}const R2=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(",");function yl(i,{enabled:n,onEscape:r}){S.useEffect(()=>{if(!n||!i.current)return;const l=i.current,o=document.activeElement,u=Array.from(l.querySelectorAll(R2)).filter(b=>b.tabIndex!==-1),m=u[0]||l,p=u[u.length-1]||l;m.focus({preventScroll:!0});const h=b=>{if(b.key==="Escape"){r==null||r();return}if(b.key!=="Tab")return;if(u.length===0){b.preventDefault(),l.focus({preventScroll:!0});return}const y=document.activeElement;if(b.shiftKey){(!y||y===m||!l.contains(y))&&(b.preventDefault(),p.focus({preventScroll:!0}));return}(!y||y===p||!l.contains(y))&&(b.preventDefault(),m.focus({preventScroll:!0}))};return document.addEventListener("keydown",h),()=>{var b;document.removeEventListener("keydown",h),(b=o==null?void 0:o.focus)==null||b.call(o,{preventScroll:!0})}},[n,r,i])}function ac({isOpen:i,onClose:n,onConfirm:r,title:l,message:o,confirmText:u,cancelText:m,type:p="danger",isLoading:h=!1}){const b=S.useRef(null);yl(b,{enabled:i,onEscape:n});const{t:y}=pt(),x=u??y("common.confirm"),w=m??y("common.cancel");if(!i)return null;const v=()=>{h||r()},_=(()=>{switch(p){case"danger":return{icon:"text-red-500",iconBg:"bg-red-100 dark:bg-red-900/20",confirmButton:"bg-red-600 hover:bg-red-700 focus:ring-red-500",border:"border-red-200 dark:border-red-800"};case"warning":return{icon:"text-amber-500",iconBg:"bg-amber-100 dark:bg-amber-900/20",confirmButton:"bg-amber-600 hover:bg-amber-700 focus:ring-amber-500",border:"border-amber-200 dark:border-amber-800"};default:return{icon:"text-blue-500",iconBg:"bg-blue-100 dark:bg-blue-900/20",confirmButton:"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500",border:"border-blue-200 dark:border-blue-800"}}})(),j=f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black/60 p-4 backdrop-blur-sm animate-fadeIn",children:f.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-title",tabIndex:-1,className:"w-full max-w-md max-h-[calc(100vh-2rem)] overflow-y-auto rounded-2xl bg-white shadow-2xl transform animate-fadeIn dark:bg-[#1a1b1e]",children:[f.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-[#2d2f39]",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:`w-10 h-10 rounded-full ${_.iconBg} flex items-center justify-center`,children:f.jsx(af,{className:`w-5 h-5 ${_.icon}`})}),f.jsx("h2",{id:"confirm-title",className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:l})]}),f.jsx("button",{type:"button",onClick:n,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors","aria-label":y("common.close"),children:f.jsx(wa,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),f.jsx("div",{className:"p-6",children:f.jsx("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:o})}),f.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200 dark:border-[#2d2f39] bg-gray-50 dark:bg-[#131416] rounded-b-2xl",children:[f.jsx("button",{type:"button",onClick:n,disabled:h,className:"px-4 py-3 md:py-2.5 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:w}),f.jsx("button",{type:"button",onClick:v,disabled:h,className:`px-4 py-3 md:py-2.5 text-white rounded-lg transition-all font-medium shadow-sm hover:shadow-md transform hover:scale-105 active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-800 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none ${_.confirmButton}`,children:h?f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),y("confirmationModal.loadingLabel")]}):x})]})]})});return typeof document>"u"?j:dc.createPortal(j,document.body)}const O2=["#","*","`","[","]","(",")","{","}","|","<",">"],x0=i=>O2.some(n=>i.includes(n));function y0(i){if(!i||i.length<1e3)return!1;const n=/^[A-Za-z0-9+/=]+$/,r=i.replace(/\s+/g,"");if(r.length>1e4&&n.test(r)){const l=/\b(the|and|for|are|but|not|you|all|can|function|const|let|var|class|return|import|export|async|await|if|else|while|true|false|null|undefined|http|https|www|error|data|response|request|api|json|xml|html|css|js|py|java|cpp|def|print|console|log)\b/i.test(i),o=x0(i),u=/[-.,;:!?'"()]/.test(i);if(!l&&!o&&!u)return!0}return!!(r.length>5e4&&n.test(r)&&i.replace(/[A-Za-z0-9+/=\s]/g,"").length<10)}const U2=/(?:\u202F|\u2009|\u200A|\u200B|\u200C|\u200D|\uFEFF)/g;function oi(i){if(!i)return i;let n=i.replace(U2," ");if(y0(n))return"";const r=/([A-Za-z0-9+/=]{10000,})/g;return n=n.replace(r,l=>{const o=l.replace(/\s+/g,"");if(o.length>1e4&&/^[A-Za-z0-9+/=]+$/.test(o)){const u=/\b(function|const|let|var|class|return|import|export|if|else|while|for|true|false|null|def|print)\b/i.test(l),m=x0(l),p=/[-.,;:!?'"()]/.test(l);if(!u&&!m&&!p)return""}return l}),n}function qd(i,n=5e4){return!i||i.length<=n?i:y0(i)?"":i.substring(0,n)+`
|
|
344
|
+
|
|
345
|
+
... (content truncated due to length)`}const $2={maxFilesPerConversation:Se.limits.files.perConversation,maxFileSizeMB:Se.limits.files.maxSizeMB,maxTotalFiles:Se.limits.files.totalFiles,maxConversations:Se.limits.conversations.maxConversations,maxMessagesPerConversation:Se.limits.conversations.maxMessagesPerConversation,maxMessagesPerThread:Se.limits.conversations.maxMessagesPerThread,maxTotalMessages:Se.limits.conversations.totalMessages,maxMessageLength:Se.limits.messages.maxLength};function I2(i){const n=Se.guestLimits;switch(i){case"maxConversations":return n.conversations.maxConversations;case"maxMessagesPerConversation":return n.conversations.messagesPerConversation;case"maxMessagesPerThread":return n.conversations.messagesPerThread;case"maxTotalMessages":return n.conversations.totalMessages;case"maxFilesPerConversation":return n.files.perConversation;case"maxTotalFiles":return n.files.totalFiles;case"maxMessageLength":return n.messages.maxLength;case"maxFileSizeMB":return n.files.maxSizeMB;default:return}}const Re=new Proxy($2,{get(i,n){if(za()&&!kn()){const r=I2(n);if(r!==void 0)return r}return i[n]}});function hi(){return S.useSyncExternalStore(_2,kn,kn)}class v0 extends Error{constructor(r,l){super(r);Sa(this,"status");Sa(this,"statusText");this.name="ApiRequestError",this.status=l.status,this.statusText=l.statusText}}async function Ft(i={}){const n={"X-User-ID":await b0(),...i},r=await sf();return r&&(n.Authorization=`Bearer ${r}`),n}function Mn(i){return encodeURIComponent(i)}function F2(i){return!i||i.length===0?"":`?file_ids=${i.map(encodeURIComponent).join(",")}`}async function cl(i){const n=`API request failed: ${i.status} ${i.statusText}`;try{if((i.headers.get("content-type")||"").includes("application/json")){const l=await i.json(),o=typeof l.detail=="string"&&l.detail.trim()||typeof l.error=="string"&&l.error.trim()||typeof l.message=="string"&&l.message.trim();if(o)return`${n}: ${o}`}else{const l=(await i.text()).trim();if(l)return`${n}: ${l}`}}catch{}return n}function xg(i){if(!i.startsWith("data: "))return null;try{const n=JSON.parse(i.substring(6));return n.request_id&&!n.response&&!n.done?{text:"",done:!1,request_id:n.request_id}:{text:n.text||n.content||n.message||n.response||"",done:n.done||!1,request_id:n.request_id,audio:n.audio,audioFormat:n.audio_format||n.audioFormat,audio_chunk:n.audio_chunk,chunk_index:n.chunk_index,image:n.image,image_format:n.image_format,image_revised_prompt:n.image_revised_prompt,image_url:n.image_url,video:n.video,video_format:n.video_format,video_revised_prompt:n.video_revised_prompt,video_url:n.video_url,document:n.document,document_format:n.document_format,document_revised_prompt:n.document_revised_prompt,document_url:n.document_url,assistant_message_id:n.assistant_message_id,threading:n.threading}}catch{return null}}let Uo=null;function B2(){let i=null,n=null;const r=(o,u,m)=>{i=u||null,n=m||null},l=(o,u)=>({async*streamChat(m,p,h,b,y,x,w,v,k,_,j,R,P){var B,H;const z={messages:[{role:"user",content:m}],stream:p!==!1};h&&h.length>0&&(z.file_ids=h),b&&(z.thread_id=b),y&&(z.audio_input=y),x&&(z.audio_format=x),w&&(z.language=w),v!==void 0&&(z.return_audio=v),k&&(z.tts_voice=k),_&&(z.source_language=_),j&&(z.target_language=j),R&&(z.model=R),P&&(z.skill=P);const M=await fetch("/api/v1/chat",{method:"POST",headers:await Ft({"Content-Type":"application/json","X-Adapter-Name":o,...u?{"X-Session-ID":u}:{}}),body:JSON.stringify(z)});if(!M.ok)throw new Error(await cl(M));if((B=M.headers.get("content-type"))!=null&&B.includes("text/event-stream")){const F=(H=M.body)==null?void 0:H.getReader(),C=new TextDecoder;let Q="";if(!F)throw new Error("Response body is not readable");for(;;){const{done:U,value:Y}=await F.read();if(U)break;Q+=C.decode(Y,{stream:!0});const J=Q.split(`
|
|
346
|
+
`);Q=J.pop()||"";for(const ae of J){const ie=xg(ae);ie&&(yield ie)}}if(Q.trim())for(const U of Q.split(`
|
|
347
|
+
`)){const Y=xg(U);Y&&(yield Y)}}else{const F=await M.json();yield{text:F.message||F.response||"",done:!0,audio:F.audio,audioFormat:F.audio_format||F.audioFormat,image:F.image,image_format:F.image_format,image_revised_prompt:F.image_revised_prompt,image_url:F.image_url,video:F.video,video_format:F.video_format,video_revised_prompt:F.video_revised_prompt,video_url:F.video_url,document:F.document,document_format:F.document_format,document_revised_prompt:F.document_revised_prompt,document_url:F.document_url,assistant_message_id:F.assistant_message_id,threading:F.threading}}},async createThread(m,p){const h=await fetch("/api/threads",{method:"POST",headers:await Ft({"Content-Type":"application/json","X-Adapter-Name":o,"X-Session-ID":p}),body:JSON.stringify({message_id:m,session_id:p})});if(!h.ok)throw new Error(`Failed to create thread: ${h.statusText}`);return h.json()},async getThreadInfo(m){const p=await fetch(`/api/threads/${Mn(m)}`,{headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(`Failed to get thread info: ${p.statusText}`);return p.json()},async deleteThread(m){const p=await fetch(`/api/threads/${Mn(m)}`,{method:"DELETE",headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(`Failed to delete thread: ${p.statusText}`);return p.json()},async submitFeedback(m,p,h){const b=await fetch("/api/feedback",{method:"POST",headers:await Ft({"Content-Type":"application/json","X-Adapter-Name":o,"X-Session-ID":p}),body:JSON.stringify({message_id:m,session_id:p,feedback_type:h})});if(!b.ok)throw new Error(`Failed to submit feedback: ${b.statusText}`);return b.json()},async getSessionFeedback(m){const p=await fetch(`/api/feedback/${Mn(m)}`,{headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(`Failed to get feedback: ${p.statusText}`);return p.json()},async clearConversationHistory(m){const p=m||u;if(!p)throw new Error("No session ID available for clearing conversation history");const h=await fetch(`/api/admin/chat-history/${Mn(p)}`,{method:"DELETE",headers:await Ft({"X-Adapter-Name":o})});if(!h.ok)throw new Error(`Failed to clear history: ${h.statusText}`);return h.json()},async getConversationHistory(m,p){const h=m||u;if(!h)throw new Error("No session ID available for conversation history");const b=typeof p=="number"&&Number.isFinite(p)&&p>0?`?limit=${Math.floor(p)}`:"",y=await fetch(`/api/admin/chat-history/${Mn(h)}${b}`,{headers:await Ft({"X-Adapter-Name":o})});if(!y.ok)throw new Error(`Failed to load history: ${y.statusText}`);return y.json()},async deleteConversationWithFiles(m,p){const h=m||u;if(!h)throw new Error("No session ID available for deleting conversation");const b=F2(p),y=await fetch(`/api/admin/conversations/${Mn(h)}${b}`,{method:"DELETE",headers:await Ft({"X-Adapter-Name":o})});if(!y.ok)throw new Error(`Failed to delete conversation: ${y.statusText}`);return y.json()},getSessionId:()=>u,async uploadFile(m){const p=new FormData;p.append("file",m);const h=await fetch("/api/files/upload",{method:"POST",headers:await Ft({"X-Adapter-Name":o}),body:p});if(!h.ok)throw new Error(`Failed to upload file: ${h.statusText}`);return h.json()},async listFiles(){const m=await fetch("/api/files",{headers:await Ft({"X-Adapter-Name":o})});if(!m.ok)throw new Error(`Failed to list files: ${m.statusText}`);const p=await m.json();return Array.isArray(p)?p:p.files||[]},async getFileInfo(m){const p=await fetch(`/api/files/${Mn(m)}`,{headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(`Failed to get file info: ${p.statusText}`);return p.json()},async queryFile(m,p,h){const b=await fetch(`/api/files/${Mn(m)}/query`,{method:"POST",headers:await Ft({"Content-Type":"application/json","X-Adapter-Name":o}),body:JSON.stringify({query:p,max_results:h})});if(!b.ok)throw new Error(`Failed to query file: ${b.statusText}`);return b.json()},async deleteFile(m){const p=await fetch(`/api/files/${Mn(m)}`,{method:"DELETE",headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(`Failed to delete file: ${p.statusText}`);return p.json()},async validateApiKey(){const m=await fetch(`/api/admin/api-keys/${Mn(o)}/status`,{headers:await Ft({"X-Adapter-Name":o})});if(!m.ok)throw new Error(`Failed to validate API key: ${m.statusText}`);return m.json()},async getAdapterInfo(){const m="/api/admin/adapters/info",p=x=>{if(!x)return 0;const w=Number(x);if(Number.isFinite(w)&&w>0)return Math.min(w*1e3,3e4);const v=Date.parse(x);if(!Number.isNaN(v)){const k=v-Date.now();if(k>0)return Math.min(k,3e4)}return 0},h=x=>new Promise(w=>setTimeout(w,x)),b=async()=>fetch(m,{headers:await Ft({"X-Adapter-Name":o})});let y=await b();if(y.status===429){const x=p(y.headers.get("Retry-After"));x>0&&(await h(x),y=await b())}if(!y.ok){const x=await y.text(),w=`${y.status} ${y.statusText}`.trim(),v=y.status===401?`Adapter info request was unauthorized for '${o}'. Verify the adapter exists and you have access.`:`Failed to load adapter info (${w}) for '${o}'.`;throw console.warn("[ProxyApi] Adapter info request failed",{adapter:o,status:y.status,statusText:y.statusText,details:x||void 0}),new v0(v,y)}return y.json()},async stopChat(m,p){const h=await fetch("/api/v1/chat/stop",{method:"POST",headers:await Ft({"Content-Type":"application/json","X-Adapter-Name":o}),body:JSON.stringify({session_id:m,request_id:p})});return h.ok?(await h.json()).status==="cancelled":(console.warn(`[ProxyApi] stopChat failed: ${h.status} ${h.statusText}`),!1)},async getAdapterModels(m){const p=await fetch(`/api/admin/adapters/${encodeURIComponent(m)}/models`,{headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(await cl(p));return p.json()},async getAllModels(){const m=await fetch("/api/admin/models",{headers:await Ft({"X-Adapter-Name":o})});if(!m.ok)throw new Error(await cl(m));return m.json()},async getAdapterSkills(m){const p=await fetch(`/api/admin/adapters/${encodeURIComponent(m)}/skills`,{headers:await Ft({"X-Adapter-Name":o})});if(!p.ok)throw new Error(await cl(p));return p.json()},async getAllSkills(){const m=await fetch("/api/admin/skills",{headers:await Ft({"X-Adapter-Name":o})});if(!m.ok)throw new Error(await cl(m));return m.json()}});return{configureApi:r,streamChat:async function*(o,u,m,p,h,b,y,x,w,v,k,_,j){if(!n)throw new Error("Adapter name is required");yield*l(n,i).streamChat(o,u,m,p,h,b,y,x,w,v,k,_,j)},stopChat:async(o,u)=>{if(!n)throw new Error("Adapter name is required");return l(n,i).stopChat(o,u)},ApiClient:class{constructor(u){Sa(this,"client");const m=u.adapterName||null,p=u.sessionId||null;if(!m)throw new Error("Adapter name is required");this.client=l(m,p)}async*streamChat(...u){yield*this.client.streamChat(...u)}get createThread(){var u;return(u=this.client.createThread)==null?void 0:u.bind(this.client)}get getThreadInfo(){var u;return(u=this.client.getThreadInfo)==null?void 0:u.bind(this.client)}get deleteThread(){var u;return(u=this.client.deleteThread)==null?void 0:u.bind(this.client)}get submitFeedback(){var u;return(u=this.client.submitFeedback)==null?void 0:u.bind(this.client)}get getSessionFeedback(){var u;return(u=this.client.getSessionFeedback)==null?void 0:u.bind(this.client)}get clearConversationHistory(){var u;return(u=this.client.clearConversationHistory)==null?void 0:u.bind(this.client)}get getConversationHistory(){var u;return(u=this.client.getConversationHistory)==null?void 0:u.bind(this.client)}get deleteConversationWithFiles(){var u;return(u=this.client.deleteConversationWithFiles)==null?void 0:u.bind(this.client)}get getSessionId(){var u;return(u=this.client.getSessionId)==null?void 0:u.bind(this.client)}get uploadFile(){var u;return(u=this.client.uploadFile)==null?void 0:u.bind(this.client)}get listFiles(){var u;return(u=this.client.listFiles)==null?void 0:u.bind(this.client)}get getFileInfo(){var u;return(u=this.client.getFileInfo)==null?void 0:u.bind(this.client)}get queryFile(){var u;return(u=this.client.queryFile)==null?void 0:u.bind(this.client)}get deleteFile(){var u;return(u=this.client.deleteFile)==null?void 0:u.bind(this.client)}get validateApiKey(){var u;return(u=this.client.validateApiKey)==null?void 0:u.bind(this.client)}get getAdapterInfo(){var u;return(u=this.client.getAdapterInfo)==null?void 0:u.bind(this.client)}get stopChat(){var u;return(u=this.client.stopChat)==null?void 0:u.bind(this.client)}get getAdapterModels(){var u;return(u=this.client.getAdapterModels)==null?void 0:u.bind(this.client)}get getAllModels(){var u;return(u=this.client.getAllModels)==null?void 0:u.bind(this.client)}get getAdapterSkills(){var u;return(u=this.client.getAdapterSkills)==null?void 0:u.bind(this.client)}get getAllSkills(){var u;return(u=this.client.getAllSkills)==null?void 0:u.bind(this.client)}}}}async function q2(){return Uo||(se("Loading API via Express proxy"),Uo=B2(),se("API loaded successfully"),Uo)}async function At(){return await q2()}class yg{static async getAdapterSkills(n,r){const l=await At(),o=new l.ApiClient({apiUrl:"",adapterName:r});return o.getAdapterSkills?(await o.getAdapterSkills(n)).available_skills:[]}static async getAllSkills(n){const r=await At(),l=new r.ApiClient({apiUrl:"",adapterName:n});return l.getAllSkills?(await l.getAllSkills()).skills:[]}}const H2=6e4;function S0(i={}){const{adapterName:n,enabled:r=!0,selectionScopeKey:l,supportsThreading:o=!1}=i,u=r&&!!n&&!o,m=l??n??"__default__",[p,h]=S.useState([]),[b,y]=S.useState(!1),[x,w]=S.useState(null),[v,k]=S.useState({}),_=S.useRef(null),j=S.useRef(new Map),R=S.useCallback(async B=>{var C,Q;const H=B,F=j.current.get(H);if(F&&F.expiresAt>Date.now()){h(F.skills),w(B);return}_.current&&_.current.abort(),_.current=new AbortController,y(!0);try{const[U,Y]=await Promise.all([yg.getAdapterSkills(B,B),yg.getAllSkills(B)]);if((C=_.current)!=null&&C.signal.aborted)return;const J=Y.filter(ae=>U.includes(ae.name)&&ae.enabled);j.current.set(H,{skills:J,expiresAt:Date.now()+H2}),h(J),w(B),se("[useSkills] Loaded",J.length,"skills for adapter",B)}catch(U){if(U instanceof Error&&U.name==="AbortError")return;qe("[useSkills] Failed to load skills:",U instanceof Error?U.message:String(U)),h([]),w(B)}finally{(Q=_.current)!=null&&Q.signal.aborted||y(!1)}},[]);S.useEffect(()=>{if(!u||!n)return;const B=window.setTimeout(()=>{R(n)},0);return()=>{var H;window.clearTimeout(B),(H=_.current)==null||H.abort()}},[u,n,R]);const P=S.useCallback(B=>{k(H=>{const F=H[m]??null;if(F===B||(F==null?void 0:F.name)===(B==null?void 0:B.name))return H;const C={...H};return B?C[m]=B:delete C[m],C})},[m]),z=S.useCallback(()=>{k(B=>{if(!B[m])return B;const H={...B};return delete H[m],H})},[m]),M=u?v[m]??null:null;return{skills:u&&x===n?p:[],isLoading:u?b||x!==n:!1,selectedSkill:M,selectSkill:P,clearSkill:z}}const vg=i=>{let n;const r=new Set,l=(b,y)=>{const x=typeof b=="function"?b(n):b;if(!Object.is(x,n)){const w=n;n=y??(typeof x!="object"||x===null)?x:Object.assign({},n,x),r.forEach(v=>v(n,w))}},o=()=>n,p={setState:l,getState:o,getInitialState:()=>h,subscribe:b=>(r.add(b),()=>r.delete(b))},h=n=i(l,o,p);return p},V2=(i=>i?vg(i):vg),G2=i=>i;function P2(i,n=G2){const r=Rn.useSyncExternalStore(i.subscribe,Rn.useCallback(()=>n(i.getState()),[i,n]),Rn.useCallback(()=>n(i.getInitialState()),[i,n]));return Rn.useDebugValue(r),r}const Sg=i=>{const n=V2(i),r=l=>P2(n,l);return Object.assign(r,n),r},w0=(i=>i?Sg(i):Sg),Ra=w0(i=>({showLoginPrompt:!1,promptMessage:"",openLoginPrompt:n=>i({showLoginPrompt:!0,promptMessage:n}),closeLoginPrompt:()=>i({showLoginPrompt:!1,promptMessage:""})})),$o=i=>{const n=i==null?void 0:i.trim();return n||(typeof window<"u"&&window.localStorage?localStorage.getItem("chat-adapter-name"):null)};class vl{static async uploadFile(n,r,l,o,u){try{const m=Re.maxFileSizeMB*1024*1024;if(n.size>m)throw new Error(`File size exceeds maximum limit of ${Re.maxFileSizeMB}MB`);if(!(["application/pdf","text/plain","text/markdown","text/csv","application/json","text/html","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","application/vnd.ms-excel.sheet.macroEnabled.12","text/x-python","text/x-python-script","text/x-java-source","text/x-java","text/x-sql","text/javascript","application/javascript","text/typescript","application/typescript","text/x-c++src","text/x-csrc","text/x-c","text/x-go","text/x-rust","text/x-ruby","text/x-php","text/x-shellscript","text/x-sh","text/yaml","text/x-yaml","text/xml","application/xml","text/css","text/x-scss","text/x-sass","text/x-less","image/png","image/jpeg","image/tiff","image/webp","audio/wav","audio/mpeg","audio/mp3","audio/mp4","audio/ogg","audio/flac","audio/webm","audio/x-m4a","audio/aac","text/vtt"].includes(n.type)||/\.(pdf|txt|md|csv|json|html|docx|pptx|xlsx|py|java|sql|js|mjs|ts|tsx|cpp|cxx|cc|c|h|hpp|go|rs|rb|php|sh|bash|zsh|yaml|yml|xml|css|scss|sass|less|png|jpe?g|tiff?|webp|wav|mp3|mp4|ogg|flac|webm|m4a|aac|vtt)$/i.test(n.name)||(n.type==="application/x-zip-compressed"||n.type==="application/zip")&&/\.xlsx$/i.test(n.name)))throw new Error(`File type not supported: ${n.type||"unknown"}`);r&&r({filename:n.name,progress:0,status:"uploading"});const b=await At(),y=(o==null?void 0:o.trim())||Et(),x=$o(u);if(!x)throw new Error("Adapter not configured. Please select an adapter from the dropdown.");se(`Using adapter: ${x}`);const w=new b.ApiClient({apiUrl:y,sessionId:null,adapterName:x});if(!w.uploadFile)throw new Error("File upload is not available.");const v=await w.uploadFile(n);r&&r({filename:n.name,progress:75,status:"processing",fileId:v.file_id});let k;try{k=await this.pollFileStatus(v.file_id,30,2e3,void 0,y,x)}catch(_){const j=_ instanceof Error?_.message:String(_);if(j.includes("was deleted"))throw new Error(`File ${v.file_id} was deleted during upload`);qe(`File status polling failed for ${v.file_id}:`,_);const R=j.includes("processing failed")||j.includes("timeout");k={file_id:v.file_id,filename:v.filename,mime_type:v.mime_type,file_size:v.file_size,processing_status:R?"failed":v.status||"processing",chunk_count:v.chunk_count,error_message:R?j:void 0}}return r&&r({filename:n.name,progress:100,status:k.processing_status==="completed"?"completed":"processing",fileId:v.file_id}),k}catch(m){let p=m instanceof Error?m.message:"Upload failed";throw p.includes("401")&&(p="Authentication failed. Please check your adapter configuration."),r&&r({filename:n.name,progress:0,status:"error",error:p}),new Error(p)}}static async uploadFiles(n,r){const o=[],u=[];for(let m=0;m<n.length;m+=3){const p=n.slice(m,m+3),h=await Promise.allSettled(p.map(async(b,y)=>{const x=m+y;return this.uploadFile(b,w=>{r&&r(x,w)})}));for(let b=0;b<h.length;b++){const y=h[b],x=m+b;y.status==="fulfilled"?o.push(y.value):(Bt(`Failed to upload file ${n[x].name}:`,y.reason),u.push({index:x,file:n[x].name,error:y.reason}))}}if(o.length===0&&u.length>0){const m=u[0].error;throw m instanceof Error?m:new Error(`All ${u.length} file uploads failed`)}return u.length>0&&qe(`[FileUploadService] ${u.length} of ${n.length} files failed to upload:`,u.map(m=>m.file)),o}static async listFiles(n,r,l){try{const o=await At(),u=(r==null?void 0:r.trim())||Et(),m=$o(l);if(!m)throw new Error("Adapter not configured");const p=new o.ApiClient({apiUrl:u,sessionId:null,adapterName:m});if(!p.listFiles)throw new Error("File listing is not available.");const h=await p.listFiles();return(Array.isArray(h)?h:Array.isArray(h.files)?h.files:[]).map(y=>({file_id:y.file_id,filename:y.filename,mime_type:y.mime_type,file_size:y.file_size,upload_timestamp:y.upload_timestamp,processing_status:y.processing_status,chunk_count:y.chunk_count,error_message:y.error_message}))}catch(o){Bt("Failed to list files:",o);const u=o instanceof Error?o.message:"Failed to list files";throw new Error(u)}}static async getFileInfo(n,r,l,o){try{const u=await At(),m=(l==null?void 0:l.trim())||Et(),p=$o(o);if(!p)throw new Error("Adapter not configured");const h=new u.ApiClient({apiUrl:m,sessionId:null,adapterName:p});if(!h.getFileInfo)throw new Error("File info retrieval is not available.");const b=await h.getFileInfo(n);return{file_id:b.file_id,filename:b.filename,mime_type:b.mime_type,file_size:b.file_size,upload_timestamp:b.upload_timestamp,processing_status:b.processing_status,chunk_count:b.chunk_count,error_message:b.error_message}}catch(u){if(u instanceof Error&&(u.message.includes("404")||u.message.includes("File not found")))throw new Error(`File ${n} was deleted`);Bt(`Failed to get file info for ${n}:`,u);const m=u instanceof Error?u.message:`Failed to get file info: ${n}`;throw new Error(m)}}static async pollFileStatus(n,r=30,l=2e3,o,u,m){for(let p=0;p<r;p++)try{if(o&&!o())throw new Error("Polling cancelled - component unmounted");const h=await this.getFileInfo(n,void 0,u,m);if(h.processing_status==="completed")return h;if(h.processing_status==="error"||h.processing_status==="failed"){const b=h.error_message;throw new Error(b||`File processing failed for ${n}`)}p<r-1&&await new Promise(b=>setTimeout(b,l))}catch(h){const b=h instanceof Error?h.message:String(h);if(b.includes("404")||b.includes("File not found")||b.includes("was deleted"))throw new Error(`File ${n} was deleted during upload`);if(b.includes("component unmounted")||b.includes("processing failed")||b.includes("processing_status")||b.includes("401")||b.includes("403")||b.includes("500")||b.includes("502")||b.includes("503")||b.includes("Authentication")||b.includes("Adapter not configured"))throw h;if(p<r-1){await new Promise(y=>setTimeout(y,l));continue}throw h}throw new Error(`File processing timeout: ${n} did not complete within ${r*l/1e3} seconds`)}static async deleteFile(n,r,l,o){try{const u=await At(),m=(l==null?void 0:l.trim())||Et(),p=$o(o);if(!p)throw new Error("Adapter not configured");const h=new u.ApiClient({apiUrl:m,sessionId:null,adapterName:p});if(!h.deleteFile)throw new Error("File deletion is not available.");return await h.deleteFile(n)}catch(u){if(u instanceof Error&&(u.message.includes("404")||u.message.includes("File not found")||u.message.includes("Not Found")))return se(`File ${n} was already deleted from server`),{message:"File already deleted",file_id:n};Bt(`Failed to delete file ${n}:`,u);const m=u instanceof Error?u.message:`Failed to delete file: ${n}`;throw new Error(m)}}}class X2{constructor(){Sa(this,"audioQueue",[]);Sa(this,"isPlaying",!1);Sa(this,"currentAudio",null);Sa(this,"audioContext",null);Sa(this,"isEnabled",!1);Sa(this,"onPlaybackStart",null);Sa(this,"onPlaybackEnd",null);Sa(this,"mimeTypeCache",new Map);Sa(this,"onChunkPlayed",null);Sa(this,"blobUrls",[]);Sa(this,"suppressPlaybackErrors",!1)}async enableAudio(){var n,r;try{if(!this.audioContext){const u=typeof AudioContext<"u"?AudioContext:typeof window<"u"&&window.webkitAudioContext||null;u&&(this.audioContext=new u)}const l=((n=this.audioContext)==null?void 0:n.state)==="suspended"?this.audioContext.resume():Promise.resolve();let o=Promise.resolve();try{const u=this.createSilentWavBlob(),m=URL.createObjectURL(u),p=new Audio;p.setAttribute("playsinline",""),p.setAttribute("webkit-playsinline",""),p.src=m,p.volume=0,o=p.play().then(()=>{p.pause()}).catch(()=>{se("[AudioStreamManager] HTMLAudioElement silent unlock failed (will retry on next gesture)")}).finally(()=>{URL.revokeObjectURL(m)})}catch{se("[AudioStreamManager] Could not create silent audio element")}if(await l,this.audioContext&&this.audioContext.state==="running"){const u=this.audioContext.createBuffer(1,1,22050),m=this.audioContext.createBufferSource();m.buffer=u,m.connect(this.audioContext.destination),m.start(0)}return await o,this.isEnabled=!0,se("[AudioStreamManager] Audio playback enabled",{audioContextState:(r=this.audioContext)==null?void 0:r.state}),!0}catch(l){return Ve("[AudioStreamManager] Failed to enable audio:",l),!1}}createSilentWavBlob(){const m=new ArrayBuffer(844),p=new DataView(m),h=(b,y)=>{for(let x=0;x<y.length;x++)p.setUint8(b+x,y.charCodeAt(x))};return h(0,"RIFF"),p.setUint32(4,836,!0),h(8,"WAVE"),h(12,"fmt "),p.setUint32(16,16,!0),p.setUint16(20,1,!0),p.setUint16(22,1,!0),p.setUint32(24,8e3,!0),p.setUint32(28,8e3*2,!0),p.setUint16(32,2,!0),p.setUint16(34,16,!0),h(36,"data"),p.setUint32(40,800,!0),new Blob([m],{type:"audio/wav"})}disableAudio(){!this.isEnabled&&!this.isPlaying||(this.isEnabled=!1,this.stop(),se("[AudioStreamManager] Audio playback disabled"))}async ensureAudioContext(){var n;if(!this.audioContext){const r=typeof AudioContext<"u"?AudioContext:typeof window<"u"&&window.webkitAudioContext||null;if(r)try{this.audioContext=new r}catch(l){return Ve("[AudioStreamManager] Failed to create AudioContext:",l),!1}}if(((n=this.audioContext)==null?void 0:n.state)==="suspended")try{await this.audioContext.resume()}catch(r){return se("[AudioStreamManager] AudioContext resume deferred",r),!1}return!0}resolveMimeType(n){const r=this.mimeTypeCache.get(n);if(r)return r;let l;switch(n){case"mp3":l="audio/mpeg";break;case"wav":l="audio/wav";break;case"webm":l="audio/webm";break;case"ogg":l="audio/ogg";break;case"opus":{const o=typeof document<"u"?document.createElement("audio"):null;o!=null&&o.canPlayType("audio/ogg; codecs=opus")?l="audio/ogg; codecs=opus":o!=null&&o.canPlayType("audio/webm; codecs=opus")?l="audio/webm; codecs=opus":l="audio/mp4";break}default:l=`audio/${n}`}return this.mimeTypeCache.set(n,l),se(`[AudioStreamManager] Resolved MIME type for "${n}": ${l}`),l}isAudioEnabled(){return this.isEnabled}setOnPlaybackStart(n){this.onPlaybackStart=n}setOnPlaybackEnd(n){this.onPlaybackEnd=n}setOnChunkPlayed(n){this.onChunkPlayed=n}async addChunk(n){if(!this.isEnabled){se(`[AudioStreamManager] Audio disabled, dropping chunk ${n.chunkIndex}`);return}se(`[AudioStreamManager] Adding chunk ${n.chunkIndex} to queue`),this.audioQueue.push(n),this.audioQueue.sort((r,l)=>r.chunkIndex-l.chunkIndex),this.isPlaying||this.playNextChunk().catch(r=>{Ve("[AudioStreamManager] Playback chain error:",r)})}async playNextChunk(){var r,l;if(this.audioQueue.length===0){this.isPlaying=!1,se("[AudioStreamManager] Queue empty, playback complete"),this.onPlaybackEnd&&this.onPlaybackEnd();return}if(!this.isEnabled){se("[AudioStreamManager] Audio not enabled, skipping playback"),this.audioQueue=[],this.isPlaying=!1;return}this.suppressPlaybackErrors=!1,await this.ensureAudioContext(),this.isPlaying=!0;const n=this.audioQueue.shift();try{if(!this.isPlaying)return;if(this.onPlaybackStart&&n.chunkIndex===0&&this.onPlaybackStart(),se(`[AudioStreamManager] Playing chunk ${n.chunkIndex}`),!n.audio||n.audio.length===0)throw new Error(`Empty audio data for chunk ${n.chunkIndex}`);let o;try{o=atob(n.audio)}catch(x){throw new Error(`Failed to decode base64 audio for chunk ${n.chunkIndex}: ${x instanceof Error?x.message:String(x)}`)}if(o.length===0)throw new Error(`Decoded audio data is empty for chunk ${n.chunkIndex}`);const u=new Uint8Array(o.length);for(let x=0;x<o.length;x++)u[x]=o.charCodeAt(x);const m=this.resolveMimeType(n.audioFormat),p=new Blob([u],{type:m}),h=URL.createObjectURL(p);this.blobUrls.push(h);const b=()=>{if(this.currentAudio){try{this.currentAudio.pause()}catch{}this.currentAudio.removeAttribute("src"),this.currentAudio.load()}URL.revokeObjectURL(h),this.blobUrls=this.blobUrls.filter(x=>x!==h)};let y=!1;try{y=await this.playViaAudioElement(h,n,m,b)}catch{y=!1}if(!y&&!this.suppressPlaybackErrors&&this.audioContext){se(`[AudioStreamManager] HTMLAudioElement failed for chunk ${n.chunkIndex}, trying AudioContext fallback`);try{y=await this.playViaAudioContext(u.buffer,n.chunkIndex)}catch(x){Ve(`[AudioStreamManager] AudioContext fallback also failed for chunk ${n.chunkIndex}:`,x)}b()}this.currentAudio=null,this.playNextChunk().catch(x=>{Ve("[AudioStreamManager] Playback chain error:",x)})}catch(o){if(this.suppressPlaybackErrors){se("[AudioStreamManager] Playback stopped, suppressing audio error");return}const u=o instanceof Error?o.message:String(o);console.error(`[AudioStreamManager] Failed to play chunk ${n.chunkIndex}:`,u,o,{audioFormat:n.audioFormat,chunkIndex:n.chunkIndex,audioLength:(r=n.audio)==null?void 0:r.length,audioContextState:(l=this.audioContext)==null?void 0:l.state,isEnabled:this.isEnabled}),Ve(`[AudioStreamManager] Failed to play chunk ${n.chunkIndex}:`,o),this.playNextChunk().catch(m=>{Ve("[AudioStreamManager] Playback chain error after recovery:",m)})}}playViaAudioElement(n,r,l,o){return new Promise(u=>{const m=new Audio;m.setAttribute("playsinline",""),m.setAttribute("webkit-playsinline",""),m.src=n,this.currentAudio=m;let p=!1;const h=x=>{p||(p=!0,u(x))},b=()=>{if(this.suppressPlaybackErrors){o(),h(!0);return}const x=m.error;Ve(`[AudioStreamManager] Media error on chunk ${r.chunkIndex}:`,x?{code:x.code,message:x.message,SRC_NOT_SUPPORTED:x.code===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED}:"unknown"),o(),h(!1)};m.addEventListener("error",b,{once:!0});const y=async()=>{if(!p)try{m.addEventListener("ended",()=>{p||(se(`[AudioStreamManager] Chunk ${r.chunkIndex} finished`),this.onChunkPlayed&&this.onChunkPlayed(r.chunkIndex),o(),h(!0))},{once:!0}),await m.play()}catch(x){if(this.suppressPlaybackErrors){o(),h(!0);return}se(`[AudioStreamManager] audio.play() rejected for chunk ${r.chunkIndex}:`,x),o(),h(!1)}};m.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?y():m.addEventListener("canplay",()=>y(),{once:!0})})}playViaAudioContext(n,r){return new Promise((l,o)=>{if(!this.audioContext){o(new Error("No AudioContext"));return}const u=n.slice(0);this.audioContext.decodeAudioData(u,m=>{if(!this.audioContext||this.suppressPlaybackErrors){l(!0);return}const p=this.audioContext.createBufferSource();p.buffer=m,p.connect(this.audioContext.destination),p.onended=()=>{se(`[AudioStreamManager] Chunk ${r} finished (AudioContext path)`),this.onChunkPlayed&&this.onChunkPlayed(r),l(!0)},p.start(0)},m=>{o(m)})})}stop(){se("[AudioStreamManager] Stopping playback"),this.suppressPlaybackErrors=!0,this.isPlaying=!1,this.audioQueue=[],this.currentAudio&&(this.currentAudio.pause(),this.currentAudio.src="",this.currentAudio=null),this.blobUrls.forEach(n=>URL.revokeObjectURL(n)),this.blobUrls=[]}reset(){this.stop(),se("[AudioStreamManager] Manager reset")}getQueueSize(){return this.audioQueue.length}isCurrentlyPlaying(){return this.isPlaying}}const Ps=new X2,Y2=Vv()||jv(),k0=()=>{if(cc())return Yd()||void 0},pl="",K2=["New Chat","New Conversation"],Q2=i=>i&&!K2.includes(i)?i:pl,hl=(i,n,r)=>({id:i,sessionId:n,title:pl,messages:[],createdAt:new Date,updatedAt:new Date,apiUrl:r,adapterName:k0(),adapterLoadError:null}),nc=()=>{const i=localStorage.getItem("chatbot-session-id");if(i)return i;const n=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return localStorage.setItem("chatbot-session-id",n),n},Z2=i=>{localStorage.setItem("chatbot-session-id",i)};let J2=0;const ci=i=>{const n=Date.now(),r=++J2,l=Math.random().toString(36).substr(2,9);return`msg_${n}_${r}_${l}_${i}`},Xs=()=>{const i=Date.now(),n=Math.random().toString(36).substr(2,9);return`session_${i}_${n}`},A0=i=>{const n=new Set;let r=!1;const l=i.map(o=>{if(!n.has(o.id))return n.add(o.id),o;r=!0;const u={...o,id:ci(o.role)};return n.add(u.id),qe(`[chatStore] Re-keyed duplicate message id ${o.id}`),u});return r?l:i},wg=i=>i.filter(n=>!n.isThreadMessage&&!(n.role==="assistant"&&n.isStreaming)).length,kg=i=>i.flatMap(r=>[r.imageUrl,r.videoUrl,r.documentUrl]).map(r=>{var l;return((l=r==null?void 0:r.match(/\/api\/files\/([^/]+)\/content/))==null?void 0:l[1])??null}).filter(r=>r!==null),W2=(i,n)=>{if(i instanceof Date)return new Date(i);if(typeof i=="number"&&Number.isFinite(i)){const r=new Date(i);if(!Number.isNaN(r.getTime()))return r}if(typeof i=="string"){const r=new Date(i);if(!Number.isNaN(r.getTime()))return r}return n?new Date(n):new Date},eS=(i,n)=>{const r=new Map;n.forEach((o,u)=>{o.databaseMessageId&&r.set(o.databaseMessageId,{message:o,index:u})});const l=new Set;return i.map((o,u)=>{var x;const m=o.role==="user"?"user":"assistant",p=typeof o.message_id=="string"&&o.message_id.length>0?o.message_id:void 0;let h;if(p&&r.has(p)){const w=r.get(p);h=w.message,l.add(w.index)}else{const w=u<n.length?u:0;if(!l.has(w)&&((x=n[w])==null?void 0:x.role)===m)h=n[w],l.add(w);else for(let v=1;v<n.length;v++){const k=(w+v)%n.length;if(!l.has(k)&&n[k].role===m){h=n[k],l.add(k);break}}}const b=o.timestamp?W2(o.timestamp,h==null?void 0:h.timestamp):h!=null&&h.timestamp?new Date(h.timestamp):new Date,y=h?{...h,content:o.content??h.content,timestamp:b}:{id:p?`srv_${p}`:ci(m),content:o.content||"",role:m,timestamp:b};if(y.isStreaming=!1,p&&(y.databaseMessageId=p),!y.supportsThreading&&o.metadata&&typeof o.metadata=="object"){const w=o.metadata,v=w==null?void 0:w.retrieved_docs;Array.isArray(v)&&v.length>0&&(y.supportsThreading=!0)}return y})},tS=(i,n)=>{if(i.length!==n.length)return!1;for(let r=0;r<i.length;r++){const l=i[r],o=n[r];if(l.role!==o.role||l.content!==o.content||(l.databaseMessageId||null)!==(o.databaseMessageId||null)||+l.timestamp!=+o.timestamp)return!1}return!0},Cd=i=>{var o,u,m,p,h,b;const n=((u=(o=i.adapterInfo)==null?void 0:o.adapter_name)==null?void 0:u.includes("voice"))||((p=(m=i.adapterInfo)==null?void 0:m.adapter_name)==null?void 0:p.includes("audio"))||((b=(h=i.adapterInfo)==null?void 0:h.adapter_name)==null?void 0:b.includes("multilingual"));let r=!1;try{const y=localStorage.getItem("chat-settings");y&&(r=JSON.parse(y).voiceEnabled===!0)}catch{qe("Failed to read global voice setting")}const l=i.audioSettings;return{returnAudio:(l==null?void 0:l.enabled)??r??!!n,ttsVoice:(l==null?void 0:l.ttsVoice)||void 0,language:(l==null?void 0:l.language)||"en-US",audioFormat:l==null?void 0:l.audioFormat}},aS=300;let Io=null;const oa=i=>{Io&&clearTimeout(Io),Io=setTimeout(()=>{Io=null;try{const n=i(),r=n.conversations.map(l=>({...l,messages:l.messages.map(o=>o.audio||o.image||o.video||o.document?Object.fromEntries(Object.entries(o).filter(([m])=>m!=="audio"&&m!=="image"&&m!=="video"&&m!=="document")):o)}));localStorage.setItem("chat-state",JSON.stringify({conversations:r,currentConversationId:n.currentConversationId}))}catch(n){n instanceof DOMException&&n.name==="QuotaExceededError"?qe("[chatStore] localStorage quota exceeded — skipping save"):Bt("[chatStore] Failed to save state to localStorage:",n)}},aS)},nS=32,ui=new Map;let Dn=null,la=null,wn=null,us=null;const Fo=(i,n)=>{const r=ui.get(i);if(r){if(r.timeoutId&&(clearTimeout(r.timeoutId),r.timeoutId=null),r.content){const l=r.content;r.content="",n(o=>({conversations:o.conversations.map(u=>{if(u.id!==i)return u;const m=[...u.messages],p=m[m.length-1];return p&&p.role==="assistant"&&p.isStreaming&&(m[m.length-1]={...p,content:p.content+l}),{...u,messages:m,updatedAt:new Date}})}))}ui.delete(i)}},dn=(i,n,r)=>({conversations:i.conversations.map(l=>{var m;if(l.id!==n)return l;const o=[...l.messages],u=o.length-1;return((m=o[u])==null?void 0:m.role)==="assistant"&&(o[u]={...o[u],...r(o[u])}),{...l,messages:o,updatedAt:new Date}})});let sc=!1,rc="";async function ul(){if(sc&&rc)return!0;try{const i=await At(),n=localStorage.getItem("chat-api-url");n&&n===Od&&localStorage.removeItem("chat-api-url");const r=n&&n!==Od?n:Et(),l=nc(),o=localStorage.getItem("chat-adapter-name")||Y2;return i.configureApi(r,l,o),rc=r,sc=!0,!0}catch(i){return Bt("Failed to configure API:",i),!1}}const Ye=w0((i,n)=>({conversations:[],currentConversationId:null,isLoading:!1,error:null,sessionId:nc(),getSessionId:()=>n().sessionId,configureApiSettings:async(r,l,o)=>{const u=n(),m=u.conversations.find(h=>h.id===u.currentConversationId),p=(m==null?void 0:m.sessionId)||l||nc();l&&Z2(l),i({sessionId:p});try{const h=await At();if(!o||!o.trim())throw new Error("Adapter name is required");h.configureApi(r,p,o),rc=r,sc=!0;let b;try{const y=new h.ApiClient({apiUrl:r,sessionId:null,adapterName:o});typeof y.getAdapterInfo=="function"&&(b=await y.getAdapterInfo(),se("Adapter info loaded:",b))}catch(y){qe("Failed to load adapter info:",y)}if(m)i(y=>({conversations:y.conversations.map(x=>x.id===m.id?{...x,adapterName:o,apiUrl:r,adapterInfo:b,adapterLoadError:null,updatedAt:new Date}:x)}));else if(o&&o.trim()){const y=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,x=Xs();i(w=>({conversations:[...w.conversations,{id:y,sessionId:x,title:pl,messages:[],createdAt:new Date,updatedAt:new Date,adapterName:o,apiUrl:r,adapterInfo:b,adapterLoadError:null}],currentConversationId:y}))}}catch(h){throw Ve("Failed to configure API:",h),i({isLoading:!1}),h instanceof Error?h:new Error("Failed to configure API settings")}o?localStorage.setItem("chat-adapter-name",o):localStorage.removeItem("chat-adapter-name"),i({isLoading:!1})},createConversation:()=>{var y;const r=n(),l=Re.maxConversations,o=r.conversations.length,u=r.currentConversationId?r.conversations.find(x=>x.id===r.currentConversationId):null;if(l!==null&&o>=l){if(za()&&!kn()){const w=`You've reached the guest limit of ${l} conversation${l===1?"":"s"}. Sign in to unlock more conversations, or delete conversations to start over.`;throw i({error:w}),Ra.getState().openLoginPrompt(w),new Error("Guest conversation limit reached")}const x=`Maximum of ${l} conversations reached. Please delete an existing conversation before starting a new one.`;throw i({error:x}),new Error(x)}const m=!!u&&(u.messages.length>0||(((y=u.attachedFiles)==null?void 0:y.length)||0)>0);if(u&&!m){const x="Finish or delete the current conversation before starting a new one.";throw i({error:x}),new Error(x)}const p=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,h=Xs(),b={id:p,sessionId:h,title:pl,messages:[],createdAt:new Date,updatedAt:new Date,apiUrl:Et(),adapterName:k0(),adapterLoadError:null};return i(x=>({conversations:[b,...x.conversations],currentConversationId:p,sessionId:h,isLoading:!1})),oa(n),p},selectConversation:async r=>{const l=n().conversations.find(o=>o.id===r);if(l){const o=l.messages.some(h=>h.role==="assistant"&&h.isStreaming);i({currentConversationId:r,sessionId:l.sessionId,isLoading:o});const u=l.apiUrl||Et(),m=l.adapterName;if(await ul()&&m){const h=await At();if(h.configureApi(u,l.sessionId,m),!l.adapterInfo)try{const b=new h.ApiClient({apiUrl:u,sessionId:null,adapterName:m});if(typeof b.getAdapterInfo=="function"){const y=await b.getAdapterInfo();se("Adapter info loaded for conversation:",y),i(x=>({conversations:x.conversations.map(w=>w.id===r?{...w,adapterInfo:y,adapterLoadError:null,updatedAt:new Date}:w)})),oa(n)}}catch(b){qe("Failed to load adapter info for conversation:",b)}}n().loadFeedbackForConversation(l.sessionId).catch(()=>{})}oa(n)},deleteConversation:async r=>{var u,m;const l=n(),o=l.conversations.find(p=>p.id===r);if(se(`🗑️ Deleting conversation ${r}:`,{conversationId:r,sessionId:o==null?void 0:o.sessionId,title:o==null?void 0:o.title,messageCount:o==null?void 0:o.messages.length,fileCount:((u=o==null?void 0:o.attachedFiles)==null?void 0:u.length)||0}),l.currentConversationId===r&&Ps.stop(),o!=null&&o.sessionId)try{if(!await ul())Bt("Failed to configure API for conversation deletion");else{const h=o.apiUrl||Et(),b=o.adapterName;b?se(`Using conversation's adapter for deletion: ${b} (conversation: ${r})`):qe(`Skipping server deletion for conversation ${r}: adapter not configured`);const y=await At(),x=new y.ApiClient({apiUrl:h,sessionId:o.sessionId,adapterName:b}),w=((m=o.attachedFiles)==null?void 0:m.map(_=>_.file_id))||[],v=kg(o.messages||[]),k=[...w,...v];if(se(`🔧 Calling deleteConversationWithFiles for session: ${o.sessionId}`),x.deleteConversationWithFiles){const _=await x.deleteConversationWithFiles(o.sessionId,k);se(`✅ Deleted conversation and files for session: ${o.sessionId}`,_),se(` - Deleted ${_.deleted_messages} messages`),se(` - Deleted ${_.deleted_files} files`),_.file_deletion_errors&&_.file_deletion_errors.length>0&&qe(` - Errors deleting files: ${_.file_deletion_errors.join(", ")}`)}else qe("⚠️ deleteConversationWithFiles method not available on API client")}}catch(p){Bt("Failed to clear conversation history from server:",p)}else qe(`⚠️ No session ID found for conversation ${r}, skipping server-side deletion`);i(p=>{var y;const h=p.conversations.filter(x=>x.id!==r),b=p.currentConversationId===r?((y=h[0])==null?void 0:y.id)||null:p.currentConversationId;if(h.length===0){const x=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,w=Xs(),v=hl(x,w,Et());return oa(n),{conversations:[v],currentConversationId:x,sessionId:w}}return oa(n),{conversations:h,currentConversationId:b}})},deleteAllConversations:async()=>{const l=[...n().conversations];se(`🗑️ Deleting all conversations (${l.length} total)`),Ps.stop();const o=l.map(async y=>{var x;if(y!=null&&y.sessionId)try{if(!await ul()){Bt("Failed to configure API for conversation deletion");return}const v=y.adapterName;if(!v){se(`Skipping server deletion for conversation ${y.id}: adapter not configured`);return}const k=await At(),_=new k.ApiClient({apiUrl:Da(y.apiUrl),sessionId:y.sessionId,adapterName:v}),j=[...((x=y.attachedFiles)==null?void 0:x.map(R=>R.file_id))||[],...kg(y.messages||[])];_.deleteConversationWithFiles?(await _.deleteConversationWithFiles(y.sessionId,j),se(`✅ Deleted conversation ${y.id} and files`)):qe(`deleteConversationWithFiles not available for conversation ${y.id}`)}catch(w){Bt(`Failed to delete conversation ${y.id} from server:`,w)}}),m=(await Promise.allSettled(o)).filter(y=>y.status==="rejected");m.length>0&&Bt(`Some conversations failed to delete from server: ${m.length}`,m);const p=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,h=Xs(),b=hl(p,h,Et());i({conversations:[b],currentConversationId:p,sessionId:h}),oa(n)},deleteThread:async(r,l,o)=>{const u=n().conversations.find(x=>x.id===r);if(!u)throw new Error("Conversation not found");if(!u.adapterName)throw new Error("Adapter not configured for this conversation");const m=u.messages.find(x=>x.id===l);if(!(m!=null&&m.threadInfo)||m.threadInfo.thread_id!==o)throw new Error("Thread not found for this message");const p=Da(u.apiUrl||Et()),h=await At(),b=new h.ApiClient({apiUrl:p,sessionId:u.sessionId,adapterName:u.adapterName});await new(await On(async()=>{const{ThreadService:x}=await import("./threadService-B9Db3n0J.js");return{ThreadService:x}},[])).ThreadService(b).deleteThread(o),i(x=>({conversations:x.conversations.map(w=>{var _;if(w.id!==r)return w;const v=w.messages.filter(j=>j.isThreadMessage?!(j.threadId===o||j.parentMessageId===l):!0).map(j=>j.id!==l?j:{...j,threadInfo:void 0,supportsThreading:!0}),k=w.currentThreadId===o||w.currentThreadSessionId===((_=m.threadInfo)==null?void 0:_.thread_session_id);return{...w,messages:v,currentThreadId:k?void 0:w.currentThreadId,currentThreadSessionId:k?void 0:w.currentThreadSessionId,updatedAt:new Date}})})),oa(n)},sendMessage:async(r,l,o,u,m)=>{var h;let p=null;try{if(n().isLoading){qe("Another request is already in progress");return}if(!await ul())throw new Error("API not properly configured. Please configure API settings first.");let y=n().currentConversationId;y||(y=n().createConversation());const x=n().conversations.find(C=>C.id===y);if(!x)throw new Error("Conversation not found");const w=Re.maxConversations;if(za()&&!kn()&&w!==null&&n().conversations.length>w){Ra.getState().openLoginPrompt(`You've reached the guest limit of ${w} conversation${w===1?"":"s"}. Sign in to continue chatting.`),i({isLoading:!1});return}const v=l?l.map(C=>{var U;const Q=(U=x==null?void 0:x.attachedFiles)==null?void 0:U.find(Y=>Y.file_id===C);return Q||{file_id:C,filename:"",mime_type:"",file_size:0}}).filter(C=>C!==void 0):[];v.length>0&&v.forEach(C=>{n().addFileToConversation(y,C)});const k=o||null;let _,j=null;if(k){if(_=x.messages.find(C=>{var Q;return((Q=C.threadInfo)==null?void 0:Q.thread_id)===k}),!_)throw new Error("Thread metadata not found. Please recreate the thread from this message.");if(j=((h=_.threadInfo)==null?void 0:h.thread_session_id)||null,!j)throw new Error("Thread session is missing. Please recreate the thread from this message.")}const R=wg(x.messages),P=Re.maxMessagesPerConversation;if(P!==null&&R>=P){za()&&!kn()&&Ra.getState().openLoginPrompt(`You've reached the guest limit of ${P} messages per conversation. Sign in to send more messages, or delete conversations to start over.`),qe(`[chatStore] Conversation ${y} reached the message limit (${P}).`),i({isLoading:!1});return}const z=Re.maxTotalMessages;if(z!==null&&n().conversations.reduce((Q,U)=>Q+wg(U.messages),0)>=z){za()&&!kn()&&Ra.getState().openLoginPrompt(`You've reached the guest limit of ${z} total messages. Sign in to continue chatting, or delete conversations to start over.`),qe(`[chatStore] Workspace reached the total message limit (${z}).`),i({isLoading:!1});return}const M={id:ci("user"),content:r,role:"user",timestamp:new Date,attachments:v.length>0?v:void 0},B=ci("assistant"),H={id:B,content:"",role:"assistant",timestamp:new Date,isStreaming:!0};if(k&&_){M.isThreadMessage=!0,M.threadId=k,M.parentMessageId=_.id,H.isThreadMessage=!0,H.threadId=k,H.parentMessageId=_.id;const C=Re.maxMessagesPerThread;if(C!==null&&x.messages.filter(U=>U.isThreadMessage?(U.threadId===k||U.parentMessageId===_.id)&&!(U.role==="assistant"&&U.isStreaming):!1).length>=C){za()&&!kn()&&Ra.getState().openLoginPrompt(`You've reached the guest limit of ${C} messages per thread. Sign in to continue this thread, or delete conversations to start over.`),qe(`[chatStore] Thread ${k} reached the message limit (${C}).`),i({isLoading:!1});return}}i(C=>{const Q=C.conversations.find(Y=>Y.id===y),U=(Q==null?void 0:Q.messages.filter(Y=>Y.role==="assistant"&&Y.isStreaming))||[];return U.length>0&&qe(`Cleaning up ${U.length} existing streaming messages`),{conversations:C.conversations.map(Y=>{if(Y.id!==y)return Y;const J=Y.messages.filter(ae=>!(ae.role==="assistant"&&ae.isStreaming));return{...Y,messages:[...J,M,H],updatedAt:new Date,title:Y.messages.length===0?r.slice(0,50)+(r.length>50?"...":""):Y.title}}),isLoading:!0,error:null}}),p=y;let F=!1;Ps.reset();try{const C=n().conversations.find(V=>V.id===p);if(!C)throw new Error("Conversation not found");if(!C.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");const Q=Da(C.apiUrl),U=C.adapterName,Y=j||C.sessionId,J=await At();J.configureApi(Q,Y,U),k&&Y!==C.sessionId&&se(`[chatStore] Thread mode: using thread session ${Y} (original: ${C.sessionId})`);const{returnAudio:ae,ttsVoice:ie,language:G,audioFormat:E}=Cd(C);se("[chatStore] Audio settings:",{returnAudio:ae,ttsVoice:ie,language:G,audioFormat:E});const I=new AbortController;Dn=I,wn=Y,us=p,la=null;for await(const V of J.streamChat(r,!0,l,k||void 0,void 0,void 0,G,ae,ie,void 0,void 0,u,m)){if(V.request_id&&!la&&(la=V.request_id,se(`[chatStore] >>> CAPTURED request_id for stop: ${V.request_id}`)),V.audio_chunk&&Ps.addChunk({audio:V.audio_chunk,audioFormat:V.audioFormat||"opus",chunkIndex:V.chunk_index??0}),V.text){const le=oi(V.text);le?(n().appendToLastMessage(le,p),F=!0):V.text.length>100&&qe("[chatStore] Filtered out potential base64 audio data from message content")}if(V.audio&&V.done&&i(le=>dn(le,p,()=>({audio:V.audio,audioFormat:V.audioFormat||"mp3"}))),V.image&&V.done&&(F=!0,i(le=>dn(le,p,()=>({image:V.image,imageFormat:V.image_format||"png",imageRevisedPrompt:V.image_revised_prompt,imageUrl:V.image_url})))),(V.video||V.video_url)&&V.done&&(F=!0,i(le=>dn(le,p,()=>({video:V.video,videoFormat:V.video_format||"mp4",videoRevisedPrompt:V.video_revised_prompt,videoUrl:V.video_url})))),(V.document||V.document_url)&&V.done&&(F=!0,i(le=>dn(le,p,()=>({document:V.document,documentFormat:V.document_format||"pdf",documentRevisedPrompt:V.document_revised_prompt,documentUrl:V.document_url})))),V.done){se("[chatStore] Stream completed, receivedAnyText:",F);const le=V.threading;le!=null&&le.supports_threading&&i(ue=>({conversations:ue.conversations.map(oe=>oe.id!==p?oe:{...oe,messages:oe.messages.map(de=>de.id===B?{...de,supportsThreading:!0,databaseMessageId:le.message_id}:de),updatedAt:new Date})})),V.assistant_message_id&&i(ue=>({conversations:ue.conversations.map(oe=>oe.id!==p?oe:{...oe,messages:oe.messages.map(de=>de.id===B&&!de.databaseMessageId?{...de,databaseMessageId:V.assistant_message_id}:de),updatedAt:new Date})}));break}}!F&&!I.signal.aborted&&n().appendToLastMessage("No response received from the server. Please try again later.",p)}catch(C){if(C instanceof Error&&(C.name==="AbortError"||C.message==="Stream cancelled by user"||C.message.includes("aborted")))se("[chatStore] Stream was cancelled by user"),F=!0;else{Bt("Chat API error:",C);let U="Sorry, there was an error processing your request.";C instanceof Error&&(C.message.startsWith("Server error:")?U=C.message.substring(14):(C.message.includes("Could not connect")||C.message.includes("timed out"))&&(U=C.message)),n().appendToLastMessage(U,p)}}Dn=null,la=null,wn=null,us=null,Fo(p,i),i(C=>{const Q=C.conversations.map(Y=>Y.id===p?{...Y,messages:Y.messages.map(J=>J.id===B?{...J,isStreaming:!1}:J),updatedAt:new Date}:Y),U=Q.find(Y=>Y.id===C.currentConversationId);return{conversations:Q,isLoading:U?U.messages.some(Y=>Y.role==="assistant"&&Y.isStreaming):!1}}),oa(n)}catch(b){Bt("Chat store error:",b),i(y=>({isLoading:!1,...y.currentConversationId===p&&{error:`Failed to send message: ${b instanceof Error?b.message:"Unknown error"}`}}))}},createThread:async(r,l)=>{try{const o=n().conversations.find(w=>w.sessionId===l);if(!o)throw new Error("Conversation not found for session");if(!o.adapterName)throw new Error("Adapter not configured for this conversation");const u=o.messages.find(w=>w.id===r);if(!u)throw new Error("Message not found");const m=u.databaseMessageId||r,p=Da(o.apiUrl||Et()),h=await At(),b=new h.ApiClient({apiUrl:p,sessionId:l,adapterName:o.adapterName}),x=await new(await On(async()=>{const{ThreadService:w}=await import("./threadService-B9Db3n0J.js");return{ThreadService:w}},[])).ThreadService(b).createThread(m,l);i(w=>({conversations:w.conversations.map(v=>v.sessionId!==l?v:{...v,messages:v.messages.map(k=>k.id===r?{...k,threadInfo:x,supportsThreading:!0}:k),currentThreadId:void 0,currentThreadSessionId:void 0})})),se(`[chatStore] Created thread ${x.thread_id} for message ${r}`)}catch(o){throw Bt("Failed to create thread:",o),o}},appendToLastMessage:(r,l)=>{const o=oi(r);if(!o&&r){qe("[chatStore] Filtered out base64 audio data from message content");return}const u=qd(o),m=l||n().currentConversationId;if(!m)return;const p=m,h=ui.get(p);h?(h.content+=u,h.timeoutId&&clearTimeout(h.timeoutId)):ui.set(p,{content:u,timeoutId:null});const b=()=>{const x=ui.get(p);if(!x||!x.content)return;const w=x.content;x.content="",x.timeoutId=null,i(v=>({conversations:v.conversations.map(k=>{if(k.id!==m)return k;const _=[...k.messages],j=_[_.length-1];return j&&j.role==="assistant"&&j.isStreaming&&(_[_.length-1]={...j,content:j.content+w}),{...k,messages:_,updatedAt:new Date}})}))},y=ui.get(p);y.timeoutId=setTimeout(b,nS)},regenerateResponse:async(r,l)=>{let o=null;try{if(n().isLoading){qe("Another request is already in progress");return}if(!await ul())throw new Error("API not properly configured");const m=n(),p=m.conversations.find(_=>_.id===m.currentConversationId);if(!p)return;const h=p.messages.findIndex(_=>_.id===r);if(h===-1)return;const b=p.messages[h];if(!b||b.role!=="assistant")return;const y=p.messages[h-1];if(!y||y.role!=="user")return;const x=(y.attachments||[]).map(_=>_.file_id).filter(_=>typeof _=="string"&&_.length>0),w=ci("assistant");if(i(_=>({conversations:_.conversations.map(j=>j.id===_.currentConversationId?{...j,messages:[...j.messages.slice(0,h),{id:w,content:"",role:"assistant",timestamp:new Date,isStreaming:!0,supportsThreading:b.supportsThreading,databaseMessageId:b.databaseMessageId,threadInfo:b.threadInfo,threadId:b.threadId,parentMessageId:b.parentMessageId,isThreadMessage:b.isThreadMessage},...j.messages.slice(h+1)],updatedAt:new Date}:j),isLoading:!0,error:null})),o=m.currentConversationId,!o)throw new Error("No conversation selected");let v=!1;const k=new AbortController;Dn=k,us=o,la=null;try{const _=n().conversations.find(M=>M.id===o);if(!_)throw new Error("Conversation not found");if(!_.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");wn=_.sessionId,_.sessionId&&(await At()).configureApi(Da(_.apiUrl),_.sessionId,_.adapterName);const j=await At(),{returnAudio:R,ttsVoice:P,language:z}=Cd(_);for await(const M of j.streamChat(y.content,!0,x.length>0?x:void 0,void 0,void 0,void 0,z,R,P,void 0,void 0,l)){if(M.request_id&&!la&&(la=M.request_id,se(`[chatStore] >>> CAPTURED request_id for regenerate stop: ${M.request_id}`)),M.text){const B=oi(M.text);B?(n().appendToLastMessage(B,o),v=!0):M.text.length>100&&qe("[chatStore] Filtered out potential base64 audio data from regenerated message content")}if(M.audio&&M.done&&i(B=>dn(B,o,()=>({audio:M.audio,audioFormat:M.audioFormat||"mp3"}))),M.image&&M.done&&(v=!0,i(B=>dn(B,o,()=>({image:M.image,imageFormat:M.image_format||"png",imageRevisedPrompt:M.image_revised_prompt,imageUrl:M.image_url})))),(M.video||M.video_url)&&M.done&&(v=!0,i(B=>dn(B,o,()=>({video:M.video,videoFormat:M.video_format||"mp4",videoRevisedPrompt:M.video_revised_prompt,videoUrl:M.video_url})))),(M.document||M.document_url)&&M.done&&(v=!0,i(B=>dn(B,o,()=>({document:M.document,documentFormat:M.document_format||"pdf",documentRevisedPrompt:M.document_revised_prompt,documentUrl:M.document_url})))),M.done){const B=M.threading;B!=null&&B.supports_threading&&i(H=>({conversations:H.conversations.map(F=>F.id!==o?F:{...F,messages:F.messages.map(C=>C.id===w?{...C,supportsThreading:!0,databaseMessageId:B.message_id}:C),updatedAt:new Date})})),M.assistant_message_id&&i(H=>({conversations:H.conversations.map(F=>F.id!==o?F:{...F,messages:F.messages.map(C=>C.id===w&&!C.databaseMessageId?{...C,databaseMessageId:M.assistant_message_id}:C),updatedAt:new Date})}));break}}!v&&!k.signal.aborted&&n().appendToLastMessage("No response received from the server. Please try again later.",o)}catch(_){if(_ instanceof Error&&(_.name==="AbortError"||_.message==="Stream cancelled by user"||_.message.includes("aborted")))se("[chatStore] Regeneration stream was cancelled by user"),v=!0;else{Bt("Regenerate API error:",_);let R="Sorry, there was an error regenerating the response.";_ instanceof Error&&(_.message.startsWith("Server error:")?R=_.message.substring(14):(_.message.includes("Could not connect")||_.message.includes("timed out"))&&(R=_.message)),n().appendToLastMessage(R,o)}}Dn=null,la=null,wn=null,us=null,Fo(o,i),i(_=>{const j=_.conversations.map(P=>P.id===o?{...P,messages:P.messages.map(z=>z.id===w?{...z,isStreaming:!1}:z),updatedAt:new Date}:P),R=j.find(P=>P.id===_.currentConversationId);return{conversations:j,isLoading:R?R.messages.some(P=>P.role==="assistant"&&P.isStreaming):!1}})}catch(u){Bt("Regenerate error:",u),i(m=>({isLoading:!1,...m.currentConversationId===o&&{error:`Failed to regenerate response: ${u instanceof Error?u.message:"Unknown error"}`}}))}},editMessageAndRegenerate:async(r,l,o)=>{let u=null;try{if(n().isLoading){await n().stopStreaming();const k=n().currentConversationId;k&&Fo(k,i)}const m=n(),p=m.conversations.find(k=>k.id===m.currentConversationId);if(!p)return;const h=p.messages.findIndex(k=>k.id===r);if(h===-1)return;const b=p.messages[h];if(b.role!=="user")return;const y=(b.attachments||[]).map(k=>k.file_id).filter(k=>typeof k=="string"&&k.length>0),x=ci("assistant");i(k=>({conversations:k.conversations.map(_=>_.id===k.currentConversationId?{..._,messages:[..._.messages.slice(0,h),{...b,content:l,updatedAt:new Date},{id:x,content:"",role:"assistant",timestamp:new Date,isStreaming:!0}],updatedAt:new Date}:_),isLoading:!0,error:null})),u=m.currentConversationId;let w=!1;const v=new AbortController;Dn=v,us=u,la=null;try{const k=n().conversations.find(z=>z.id===u);if(!k)throw new Error("Conversation not found");if(!k.adapterName)throw new Error("Adapter not configured for this conversation. Please select an adapter first.");wn=k.sessionId,k.sessionId&&(await At()).configureApi(Da(k.apiUrl),k.sessionId,k.adapterName);const _=await At(),{returnAudio:j,ttsVoice:R,language:P}=Cd(k);for await(const z of _.streamChat(l,!0,y.length>0?y:void 0,void 0,void 0,void 0,P,j,R,void 0,void 0,o)){if(z.request_id&&!la&&(la=z.request_id,se(`[chatStore] >>> CAPTURED request_id for edit-regenerate stop: ${z.request_id}`)),z.text){const M=oi(z.text);M&&(n().appendToLastMessage(M,u),w=!0)}if(z.audio&&z.done&&i(M=>dn(M,u,()=>({audio:z.audio,audioFormat:z.audioFormat||"mp3"}))),z.image&&z.done&&(w=!0,i(M=>dn(M,u,()=>({image:z.image,imageFormat:z.image_format||"png",imageRevisedPrompt:z.image_revised_prompt,imageUrl:z.image_url})))),(z.video||z.video_url)&&z.done&&(w=!0,i(M=>dn(M,u,()=>({video:z.video,videoFormat:z.video_format||"mp4",videoRevisedPrompt:z.video_revised_prompt,videoUrl:z.video_url})))),(z.document||z.document_url)&&z.done&&(w=!0,i(M=>dn(M,u,()=>({document:z.document,documentFormat:z.document_format||"pdf",documentRevisedPrompt:z.document_revised_prompt,documentUrl:z.document_url})))),z.done){const M=z.threading;M!=null&&M.supports_threading&&i(B=>({conversations:B.conversations.map(H=>H.id!==u?H:{...H,messages:H.messages.map(F=>F.id===x?{...F,supportsThreading:!0,databaseMessageId:M.message_id}:F),updatedAt:new Date})})),z.assistant_message_id&&i(B=>({conversations:B.conversations.map(H=>H.id!==u?H:{...H,messages:H.messages.map(F=>F.id===x&&!F.databaseMessageId?{...F,databaseMessageId:z.assistant_message_id}:F),updatedAt:new Date})}));break}}!w&&!v.signal.aborted&&n().appendToLastMessage("No response received from the server. Please try again later.",u)}catch(k){if(k instanceof Error&&(k.name==="AbortError"||k.message==="Stream cancelled by user"||k.message.includes("aborted")))se("[chatStore] Edit-regenerate stream was cancelled by user"),w=!0;else{Bt("Edit-regenerate API error:",k);let j="Sorry, there was an error regenerating the response.";k instanceof Error&&(k.message.startsWith("Server error:")?j=k.message.substring(14):(k.message.includes("Could not connect")||k.message.includes("timed out"))&&(j=k.message)),n().appendToLastMessage(j,u)}}Dn=null,la=null,wn=null,us=null,Fo(u,i),i(k=>{const _=k.conversations.map(R=>R.id===u?{...R,messages:R.messages.map(P=>P.id===x?{...P,isStreaming:!1}:P),updatedAt:new Date}:R),j=_.find(R=>R.id===k.currentConversationId);return{conversations:_,isLoading:j?j.messages.some(R=>R.role==="assistant"&&R.isStreaming):!1}}),oa(n)}catch(m){Bt("Edit & regenerate error:",m),i(p=>({isLoading:!1,...p.currentConversationId===u&&{error:`Failed to regenerate response: ${m instanceof Error?m.message:"Unknown error"}`}}))}},updateConversationTitle:(r,l)=>{i(o=>({conversations:o.conversations.map(u=>u.id===r?{...u,title:l,updatedAt:new Date}:u)})),oa(n)},clearError:()=>i({error:null}),cleanupStreamingMessages:()=>{const r=us;i(l=>{let o=!1;return{conversations:l.conversations.map(m=>m.id===r?(m.messages.some(h=>h.role==="assistant"&&h.isStreaming)&&(o=!0),m):m.messages.some(h=>h.role==="assistant"&&h.isStreaming)?{...m,messages:m.messages.filter(h=>!(h.role==="assistant"&&h.isStreaming)),updatedAt:new Date}:m),isLoading:o}})},canCreateNewConversation:()=>{var m;const r=n(),l=Re.maxConversations;if(!r.currentConversationId)return l===null||r.conversations.length<l;const o=r.conversations.find(p=>p.id===r.currentConversationId);return!!o&&(o.messages.length>0||(((m=o.attachedFiles)==null?void 0:m.length)||0)>0)?l===null||r.conversations.length<l:!1},getConversationCount:()=>n().conversations.length,addFileToConversation:(r,l)=>{se("[chatStore] addFileToConversation called",{conversationId:r,fileId:l.file_id,filename:l.filename}),i(o=>({conversations:o.conversations.map(u=>u.id===r?{...u,attachedFiles:[...(u.attachedFiles||[]).filter(m=>m.file_id!==l.file_id),l],updatedAt:new Date}:u)})),oa(n)},removeFileFromConversation:async(r,l)=>{se("[chatStore] removeFileFromConversation called",{conversationId:r,fileId:l});try{const o=n().conversations.find(u=>u.id===r);if(!o)throw new Error("Conversation not found");if(!o.adapterName)throw new Error("Adapter not configured for this conversation. Cannot delete file.");await vl.deleteFile(l,void 0,Da(o.apiUrl),o.adapterName),se(`[chatStore] Successfully deleted file ${l} from server`)}catch(o){o instanceof Error&&(o.message.includes("404")||o.message.includes("File not found"))?se(`[chatStore] File ${l} was already deleted from server`):Ve(`[chatStore] Failed to delete file ${l} from server:`,o)}i(o=>({conversations:o.conversations.map(u=>u.id===r?{...u,attachedFiles:(u.attachedFiles||[]).filter(m=>m.file_id!==l),updatedAt:new Date}:u)})),oa(n)},loadConversationFiles:async r=>{try{const l=n().conversations.find(p=>p.id===r);if(!l)return;if(!l.adapterName){se(`Skipping file load for conversation ${r}: adapter not configured`);return}if(new Set((l.attachedFiles||[]).map(p=>p.file_id)).size===0){se(`No files to sync for conversation ${r}`);return}const u=await vl.listFiles(void 0,Da(l.apiUrl),l.adapterName),m=new Map(u.map(p=>[p.file_id,{file_id:p.file_id,filename:p.filename,mime_type:p.mime_type,file_size:p.file_size,upload_timestamp:p.upload_timestamp,processing_status:p.processing_status,chunk_count:p.chunk_count}]));i(p=>{const h=p.conversations.find(y=>y.id===r);if(!h)return p;const b=(h.attachedFiles||[]).map(y=>m.get(y.file_id)||y).filter(y=>m.has(y.file_id)||!y.processing_status||y.processing_status==="processing");return{conversations:p.conversations.map(y=>y.id===r?{...y,attachedFiles:b,updatedAt:new Date}:y)}}),oa(n)}catch(l){Bt(`Failed to load files for conversation ${r}:`,l)}},syncConversationFiles:async r=>{await n().loadConversationFiles(r)},syncConversationsWithBackend:async()=>{try{const r=n();if(r.conversations.length===0)return;const l=await At(),o=Re.maxMessagesPerConversation!==null&&Re.maxMessagesPerConversation||void 0;let u=!1;const p=(await Promise.all(r.conversations.map(async h=>{var b;if(!h.sessionId)return null;if(!h.adapterName)return qe(`[chatStore] Skipping backend sync for conversation ${h.id} - adapter not configured`),null;try{const y=new l.ApiClient({apiUrl:Da(h.apiUrl),sessionId:h.sessionId,adapterName:h.adapterName});if(typeof y.getConversationHistory!="function")return u||(u=!0,qe("[chatStore] Conversation history endpoint not supported by current API client")),null;const x=await y.getConversationHistory(h.sessionId,o),w=Array.isArray(x==null?void 0:x.messages)?x.messages:[];if(w.length===0)return h.messages.length===0?null:{id:h.id,sessionId:(x==null?void 0:x.session_id)||h.sessionId,messages:[],cleared:!0,updatedAt:new Date};const v=eS(w,h.messages),k=h.messages.filter(j=>j.isThreadMessage),_=A0(k.length>0?[...v,...k]:v);return tS(h.messages,_)?null:{id:h.id,sessionId:(x==null?void 0:x.session_id)||h.sessionId,messages:_,cleared:!1,updatedAt:((b=v[v.length-1])==null?void 0:b.timestamp)||new Date}}catch(y){return qe(`[chatStore] Failed to sync session ${h.sessionId}:`,y),null}}))).filter(h=>!!h);if(p.length===0)return;i(h=>{const b=new Map(p.map(y=>[y.id,y]));return{conversations:h.conversations.map(y=>{const x=b.get(y.id);return x?x.cleared?{...y,sessionId:x.sessionId||y.sessionId,messages:[],attachedFiles:[],title:pl,updatedAt:x.updatedAt,adapterLoadError:null}:{...y,sessionId:x.sessionId||y.sessionId,messages:x.messages,updatedAt:x.updatedAt,adapterLoadError:null}:y}),currentConversationId:h.currentConversationId}}),oa(n)}catch(r){qe("Failed to synchronize conversations with backend:",r)}},stopStreaming:async()=>{var l;if(!n().isLoading){se("[chatStore] stopStreaming called but not currently loading");return}if(se("[chatStore] Stopping stream...",{hasAbortController:!!Dn,requestId:la,sessionId:wn}),Dn&&Dn.abort(),la&&wn)try{const o=await At(),u=await((l=o.stopChat)==null?void 0:l.call(o,wn,la));se(`[chatStore] Server-side cancellation result: ${u}`)}catch(o){qe("[chatStore] Failed to cancel server-side stream:",o)}else qe(`[chatStore] Cannot call stopChat - missing IDs: requestId=${la}, sessionId=${wn}`);const r=us||n().currentConversationId;i(r?o=>({conversations:o.conversations.map(u=>u.id!==r?u:{...u,messages:u.messages.map(m=>m.isStreaming?{...m,isStreaming:!1}:m),updatedAt:new Date}),isLoading:!1}):{isLoading:!1}),Dn=null,la=null,wn=null,us=null,se("[chatStore] Stream stopped successfully")},clearCurrentConversationAdapter:()=>{const r=n().currentConversationId;r&&(i(l=>({conversations:l.conversations.map(o=>o.id===r?{...o,adapterName:void 0,adapterInfo:void 0,adapterLoadError:null}:o)})),oa(n))},submitFeedback:async(r,l)=>{const o=n(),u=o.conversations.find(p=>p.id===o.currentConversationId);if(!u)return;const m=u.messages.find(p=>p.id===r);if(!(m!=null&&m.databaseMessageId)){qe("[chatStore] Cannot submit feedback: no databaseMessageId on message");return}if(u.adapterName)try{const p=await At(),y=(await new p.ApiClient({apiUrl:Da(u.apiUrl||Et()),sessionId:u.sessionId,adapterName:u.adapterName}).submitFeedback(m.databaseMessageId,u.sessionId,l)).feedback_type;i(x=>({conversations:x.conversations.map(w=>w.id!==o.currentConversationId?w:{...w,messages:w.messages.map(v=>v.id===r?{...v,feedback:y}:v),updatedAt:new Date})})),oa(n)}catch(p){Ve("[chatStore] Failed to submit feedback:",p)}},loadFeedbackForConversation:async r=>{var u;const o=n().conversations.find(m=>m.sessionId===r);if(o!=null&&o.adapterName)try{const m=await At(),p=new m.ApiClient({apiUrl:Da(o.apiUrl||Et()),sessionId:o.sessionId,adapterName:o.adapterName}),h=new Set([r]);for(const x of o.messages)(u=x.threadInfo)!=null&&u.thread_session_id&&h.add(x.threadInfo.thread_session_id);const b=await Promise.all(Array.from(h).map(x=>p.getSessionFeedback(x).catch(()=>({feedbacks:[]})))),y=new Map;for(const x of b)if(x!=null&&x.feedbacks)for(const w of x.feedbacks)y.set(w.message_id,w.feedback_type);if(y.size===0)return;i(x=>({conversations:x.conversations.map(w=>w.sessionId!==r?w:{...w,messages:w.messages.map(v=>v.databaseMessageId&&y.has(v.databaseMessageId)?{...v,feedback:y.get(v.databaseMessageId)}:v)})}))}catch(m){Ve("[chatStore] Failed to load feedback:",m)}}})),sS=async()=>{var h;const i=localStorage.getItem("chat-state"),n=Et(),r=!!localStorage.getItem("chat-api-url");let l=nc(),o=!1;if(i)try{const b=JSON.parse(i),y=v=>{if(v instanceof Date)return v;const k=v?new Date(v):new Date;return Number.isNaN(k.getTime())?new Date:k},w=(Array.isArray(b.conversations)?b.conversations:[]).map(v=>{const _=(Array.isArray(v.messages)?v.messages:[]).filter(z=>!(z.role==="assistant"&&z.isStreaming)).map(z=>({...z,timestamp:y(z.timestamp),isStreaming:!1})),j=A0(_),R={id:v.id,sessionId:v.sessionId||Xs(),title:Q2(v.title),messages:j,createdAt:y(v.createdAt),updatedAt:y(v.updatedAt),attachedFiles:v.attachedFiles||[],adapterName:v.adapterName,apiUrl:v.apiUrl,adapterInfo:v.adapterInfo,adapterLoadError:v.adapterLoadError||null,audioSettings:v.audioSettings,currentThreadId:void 0,currentThreadSessionId:void 0},P=R.messages.length===0&&!R.adapterName;return{...R,apiUrl:P&&!r?n:Da(v.apiUrl)}});if(o=w.length>0,b.currentConversationId&&w.length>0){const v=w.find(k=>k.id===b.currentConversationId);v!=null&&v.sessionId&&(l=v.sessionId)}if(w.length===0){const v=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,k=Xs(),_=hl(v,k,Et());Ye.setState({conversations:[_],currentConversationId:v,sessionId:k}),l=k}else Ye.setState({conversations:w,currentConversationId:b.currentConversationId||((h=w[0])==null?void 0:h.id)||null,sessionId:l}),!b.currentConversationId&&w.length>0&&(Ye.setState({currentConversationId:w[0].id,sessionId:w[0].sessionId||l}),l=w[0].sessionId||l);se("📋 Loaded conversations:",Ye.getState().conversations.map(v=>{var k;return{id:v.id,title:v.title,sessionId:v.sessionId,messageCount:((k=v.messages)==null?void 0:k.length)||0}})),setTimeout(()=>Ye.getState().cleanupStreamingMessages(),100)}catch(b){Bt("Failed to load chat state:",b);const y=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,x=Xs(),w=hl(y,x,Et());Ye.setState({conversations:[w],currentConversationId:y,sessionId:x}),l=x}else{const b=`conv_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,y=Xs(),x=hl(b,y,Et());Ye.setState({conversations:[x],currentConversationId:b,sessionId:y}),l=y}localStorage.removeItem("chat-api-key");const u=Ye.getState(),m=u.currentConversationId?u.conversations.find(b=>b.id===u.currentConversationId):null,p=o&&(m!=null&&m.apiUrl)?m.apiUrl:Et();try{const b=await At(),y=m==null?void 0:m.adapterName;if(!y)se("No adapter selected yet. Waiting for user selection before configuring API.");else if(b.configureApi(p,l,y),rc=p,sc=!0,!(m!=null&&m.adapterInfo))try{const x=new b.ApiClient({apiUrl:p,sessionId:null,adapterName:y});if(typeof x.getAdapterInfo=="function"){const w=await x.getAdapterInfo();se("Adapter info loaded for existing adapter:",w);const v=Ye.getState();v.currentConversationId&&(Ye.setState({conversations:v.conversations.map(k=>k.id===v.currentConversationId?{...k,adapterInfo:w,adapterLoadError:null,updatedAt:new Date}:k)}),setTimeout(()=>{const k=Ye.getState();localStorage.setItem("chat-state",JSON.stringify({conversations:k.conversations,currentConversationId:k.currentConversationId}))},0))}}catch(x){qe("Failed to load adapter info for existing adapter:",x)}}catch(b){Bt("Failed to initialize API:",b)}try{await Ye.getState().syncConversationsWithBackend()}catch(b){qe("Conversation history sync skipped:",b)}};typeof window<"u"&&sS();function rS(i){return i.includes("image")?f.jsx(_1,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}):i.includes("video")||i.includes("audio")?f.jsx(K1,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}):f.jsx(tf,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"})}function iS(i){return i.replace(/-/g," ")}function _0({skills:i,isLoading:n,selectedSkill:r,activeSkillName:l,query:o="",onSelect:u,onActiveSkillChange:m}){const{t:p}=pt(),h=Rn.useRef(null),b=o.toLowerCase().replace(/-/g," "),y=b?i.filter(x=>x.name.replace(/-/g," ").toLowerCase().includes(b)||x.description.toLowerCase().includes(b)):i;return Rn.useEffect(()=>{var w;const x=(w=h.current)==null?void 0:w.querySelector('[data-active="true"]');x==null||x.scrollIntoView({block:"nearest"})},[l,y.length]),!n&&i.length===0?f.jsx("div",{className:"w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-lg shadow-black/5 dark:border-[#242424] dark:bg-[#101010] dark:shadow-black/30",children:f.jsx("p",{className:"px-4 py-3 text-sm text-gray-500 dark:text-[#bfc2cd]",children:p("skillPicker.noSkillsAvailable")})}):f.jsx("div",{className:"w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-lg shadow-black/5 dark:border-[#242424] dark:bg-[#101010] dark:shadow-black/30",children:n?f.jsx("div",{className:"px-4 py-3.5",children:f.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-[#bfc2cd]",children:[f.jsx("div",{className:"h-3.5 w-3.5 rounded-full border-2 border-current border-t-transparent animate-spin","aria-hidden":"true"}),p("skillPicker.loadingLabel")]})}):y.length===0?f.jsx("div",{className:"px-4 py-3.5",children:f.jsx("p",{className:"text-sm text-gray-500 dark:text-[#bfc2cd]",children:b?p("skillPicker.noMatchingSkills",{query:o}):p("skillPicker.noMatchingSkillsGeneric")})}):f.jsx("div",{ref:h,role:"listbox","aria-label":p("skillPicker.listboxLabel"),className:"max-h-72 overflow-y-auto p-1.5",children:y.map((x,w)=>{const v=(r==null?void 0:r.name)===x.name,k=l===x.name||!l&&(v||!r&&w===0);return f.jsxs("button",{id:`skill-option-${x.name}`,type:"button",role:"option","aria-selected":k,"data-active":k?"true":void 0,onMouseEnter:()=>m==null?void 0:m(x),onClick:()=>u(x),className:`group flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:focus-visible:ring-gray-600 ${k?"bg-gray-100 text-gray-950 dark:bg-[#242424] dark:text-white":"text-gray-900 hover:bg-gray-50 dark:text-gray-100 dark:hover:bg-[#1a1a1a]"}`,children:[f.jsx("div",{className:`mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center transition-colors ${k?"text-gray-900 dark:text-white":"text-gray-500 group-hover:text-gray-700 dark:text-[#bfc2cd] dark:group-hover:text-gray-200"}`,children:rS(x.name)}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"flex min-w-0 items-center gap-2",children:f.jsx("span",{className:"truncate text-sm font-medium capitalize leading-5 text-current",children:iS(x.name)})}),x.description&&f.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs leading-5 text-gray-500 dark:text-[#bfc2cd]",children:x.description})]}),v&&f.jsx("span",{className:"mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-gray-900 text-white dark:bg-white dark:text-gray-900",children:f.jsx(bl,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]},x.name)})})})}function C0({availableModels:i,defaultModel:n,selectedModel:r,onSelect:l,wrapperClassName:o="relative hidden md:block",maxWidthClass:u="max-w-[200px]",triggerTitle:m,listboxLabel:p,staticPaddingClass:h="px-3 py-1.5",triggerPaddingClass:b="px-3 py-1.5"}){const{t:y}=pt(),x=m??y("modelPicker.selectModel"),w=p??y("modelPicker.selectModel"),[v,k]=S.useState(!1),[_,j]=S.useState(""),[R,P]=S.useState(null),z=S.useRef(null),M=S.useRef(null),B=S.useRef(null),H=S.useRef(null),F=r??n,C=_.trim()?i.filter(ae=>ae.name.toLowerCase().includes(_.trim().toLowerCase())):i,Q=S.useCallback(()=>{if(!M.current)return;const ae=M.current.getBoundingClientRect();P({bottom:window.innerHeight-ae.top+8,right:window.innerWidth-ae.right})},[]),U=S.useCallback(()=>{k(!1),j("")},[]),Y=()=>{if(v){U();return}Q(),k(!0)};if(S.useEffect(()=>{if(!v)return;const ae=setTimeout(()=>{var I;return(I=B.current)==null?void 0:I.focus()},10),ie=I=>{var oe,de;const V=I.target,le=((oe=z.current)==null?void 0:oe.contains(V))??!1,ue=((de=H.current)==null?void 0:de.contains(V))??!1;!le&&!ue&&U()},G=I=>{var V;I.key==="Escape"&&(I.preventDefault(),U(),(V=M.current)==null||V.focus())},E=new ResizeObserver(Q);return M.current&&E.observe(M.current),window.addEventListener("resize",Q,{passive:!0}),document.addEventListener("scroll",Q,{capture:!0,passive:!0}),document.addEventListener("pointerdown",ie),document.addEventListener("keydown",G),()=>{clearTimeout(ae),E.disconnect(),window.removeEventListener("resize",Q),document.removeEventListener("scroll",Q,{capture:!0}),document.removeEventListener("pointerdown",ie),document.removeEventListener("keydown",G)}},[U,v,Q]),!n&&i.length===0)return null;const J=v&&R&&typeof document<"u"?dc.createPortal(f.jsxs("div",{ref:H,style:{position:"fixed",bottom:R.bottom,right:R.right,width:288,zIndex:9999},className:"rounded-xl border border-gray-200 bg-white shadow-xl dark:border-[#2f303d] dark:bg-[#111111]",children:[f.jsx("div",{className:"p-2 border-b border-gray-100 dark:border-[#222222]",children:f.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-gray-50 px-3 py-1.5 dark:bg-[#1a1a1a]",children:[f.jsx(ef,{className:"h-3.5 w-3.5 flex-shrink-0 text-gray-400 dark:text-[#6b6f7a]","aria-hidden":"true"}),f.jsx("input",{ref:B,type:"text",value:_,onChange:ae=>j(ae.target.value),placeholder:y("modelPicker.searchPlaceholder"),className:"flex-1 bg-transparent pl-1 text-xs text-gray-700 placeholder-gray-400 focus:outline-none dark:text-[#ececf1] dark:placeholder-[#6b6f7a]","aria-label":y("modelPicker.searchAriaLabel")})]})}),f.jsx("div",{role:"listbox","aria-label":w,className:"max-h-60 overflow-y-auto py-1",children:C.length===0?f.jsx("div",{className:"px-3 py-5 text-center text-xs text-gray-400 dark:text-[#6b6f7a]",children:y("modelPicker.noModelsMatch",{query:_})}):C.map(ae=>{const ie=F===ae.name;return f.jsxs("button",{role:"option","aria-selected":ie,type:"button",onClick:()=>{var G;l(ae.name),U(),(G=M.current)==null||G.focus()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs transition-colors ${ie?"bg-gray-100 text-gray-900 dark:bg-[#1f1f1f] dark:text-[#ececf1]":"text-gray-700 hover:bg-gray-50 dark:text-[#bfc2cd] dark:hover:bg-[#1a1a1a]"}`,children:[f.jsx("span",{className:`flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded-full border ${ie?"border-blue-500 bg-blue-500 dark:border-blue-400 dark:bg-blue-400":"border-gray-300 dark:border-[#5a5b65]"}`,children:ie&&f.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-white"})}),f.jsx("span",{className:"truncate font-medium normal-case tracking-normal",children:ae.name})]},ae.name)})}),i.length>8&&f.jsx("div",{className:"border-t border-gray-100 px-3 py-1.5 dark:border-[#222222]",children:f.jsx("span",{className:"text-[10px] text-gray-400 dark:text-[#6b6f7a]",children:y("modelPicker.modelCountHint",{filtered:C.length,total:i.length})})})]}),document.body):null;return f.jsx("div",{ref:z,className:o,children:i.length>1?f.jsxs(f.Fragment,{children:[f.jsxs("button",{ref:M,type:"button",onClick:Y,className:`inline-flex min-w-[100px] ${u} items-center gap-1.5 rounded-full border border-gray-200 bg-gray-100 ${b} text-xs font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:border-[#4a4b54] dark:bg-[#343541] dark:text-[#bfc2cd] dark:hover:bg-[#3a3b48]`,"aria-haspopup":"listbox","aria-expanded":v,title:x,children:[f.jsx("span",{className:"truncate flex-1",children:F}),f.jsx(pi,{className:`h-3.5 w-3.5 flex-shrink-0 text-gray-400 transition-transform duration-150 dark:text-[#6b6f7a] ${v?"rotate-180":""}`,"aria-hidden":"true"})]}),J]}):f.jsx("div",{className:`inline-flex min-w-[100px] ${u} items-center rounded-full border border-gray-200 bg-gray-100 ${h} text-xs text-gray-500 dark:border-[#4a4b54] dark:bg-[#343541] dark:text-[#bfc2cd]`,title:F??void 0,children:f.jsx("span",{className:"truncate",children:F})})})}const lS=[],oS=(i="png")=>{const n=i.toLowerCase().replace(/^image\//,"");return n==="jpg"?"image/jpeg":`image/${n||"png"}`},cS=(i,n)=>{const r=atob(i),l=new Uint8Array(r.length);for(let o=0;o<r.length;o+=1)l[o]=r.charCodeAt(o);return new Blob([l],{type:n})},uS=async i=>{const n=URL.createObjectURL(i);try{const r=new Image;r.decoding="async";const l=new Promise((m,p)=>{r.onload=()=>m(r),r.onerror=()=>p(new Error("Failed to load generated image for clipboard copy"))});r.src=n,await l;const o=document.createElement("canvas");o.width=r.naturalWidth,o.height=r.naturalHeight;const u=o.getContext("2d");if(!u)throw new Error("Could not create canvas context for image clipboard copy");return u.drawImage(r,0,0),await new Promise((m,p)=>{o.toBlob(h=>{h?m(h):p(new Error("Could not encode generated image for clipboard copy"))},"image/png")})}finally{URL.revokeObjectURL(n)}},dS=async(i,n)=>{const r=oS(i.imageFormat);if(i.image)return cS(i.image,r);if(!i.imageUrl)return null;const l=await fetch(i.imageUrl,{headers:n?{"X-Adapter-Name":n}:{}});if(!l.ok)throw new Error(`Could not fetch generated image for clipboard copy: ${l.status}`);const o=await l.blob();return o.type?o:new Blob([o],{type:r})},fS=i=>i.imageUrl?new URL(i.imageUrl,window.location.origin).toString():i.imageRevisedPrompt||i.content;function Ag({size:i="md"}){const n=i==="sm"?"h-2 w-2":"h-2.5 w-2.5";return f.jsx("div",{className:"flex items-center gap-1.5 py-1",children:[0,150,300].map(r=>f.jsx("span",{className:`inline-block ${n} animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]`,style:{animationDelay:`${r}ms`}},r))})}function mS({reply:i}){const{t:n}=pt(),[r,l]=S.useState(!1),[o,u]=S.useState(!1),m=S.useRef(null),p=Ye(b=>b.submitFeedback);S.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const h=async b=>{if(!i.databaseMessageId||r)return;const y=i.feedback!==b;l(!0);try{await p(i.id,b),y?(u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{u(!1),m.current=null},2e3)):u(!1)}catch(x){Ve("Failed to submit thread reply feedback:",x)}finally{l(!1)}};return f.jsxs("div",{className:"flex items-center gap-0.5 mt-0.5",children:[f.jsx("button",{onClick:()=>h("up"),disabled:r,className:`rounded-md p-1.5 hover:bg-gray-100 dark:hover:bg-[#3c3f4a] transition-colors ${r?"opacity-50 cursor-not-allowed":""} ${i.feedback==="up"?"text-green-600 dark:text-green-400":"text-gray-400 dark:text-[#6e6e80] hover:text-gray-700 dark:hover:text-[#ececf1]"}`,title:n("message.feedback.good"),"aria-label":n("message.feedback.good"),children:f.jsx(f0,{className:"h-3.5 w-3.5"})}),f.jsx("button",{onClick:()=>h("down"),disabled:r,className:`rounded-md p-1.5 hover:bg-gray-100 dark:hover:bg-[#3c3f4a] transition-colors ${r?"opacity-50 cursor-not-allowed":""} ${i.feedback==="down"?"text-red-600 dark:text-red-400":"text-gray-400 dark:text-[#6e6e80] hover:text-gray-700 dark:hover:text-[#ececf1]"}`,title:n("message.feedback.poor"),"aria-label":n("message.feedback.poor"),children:f.jsx(d0,{className:"h-3.5 w-3.5"})}),o&&f.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 animate-fadeIn dark:bg-emerald-500/15 dark:text-emerald-300",children:[f.jsx(bl,{className:"h-3 w-3"}),n("message.feedback.thanks")]})]})}function pS({message:i,onRegenerate:n,onEdit:r,onStartThread:l,onClearThread:o,onSendThreadMessage:u,threadMessages:m,sessionId:p,isThreadSendDisabled:h,availableModels:b=[],defaultModel:y=null,selectedModel:x=null}){var qa,Ha,Js;const{t:w}=pt(),[v,k]=S.useState(!1),[_,j]=S.useState(i.content||""),[R,P]=S.useState(!1),z=S.useRef(null),[M,B]=S.useState(!1),[H,F]=S.useState(!1),[C,Q]=S.useState(!1),[U,Y]=S.useState(""),[J,ae]=S.useState(!1),[ie,G]=S.useState(!1),[E,I]=S.useState(!1),[V,le]=S.useState(0),[ue,oe]=S.useState(!1),[de,ge]=S.useState(!1),[ee,ye]=S.useState(()=>x??y),fe=S.useRef(x),ve=S.useRef(((qa=i.threadInfo)==null?void 0:qa.thread_id)||null),ke=S.useRef(null),Ee=S.useRef(null),Ze=S.useRef(null),ce=S.useRef(!1),pe=S.useRef(0),we=S.useRef(""),Ue=S.useRef(!1),Ce=S.useRef(!0),he=S.useRef(!1),Me=S.useRef(null),He=S.useRef(null),De=i.role==="assistant",wt=m??lS,ut=wt.filter(ne=>!(ne.role==="assistant"&&ne.isStreaming)).length,me=wt.some(ne=>ne.isStreaming),ze=hi(),rt=za()&&!ze,Be=Ye(ne=>ne.conversations.find(Ie=>Ie.id===ne.currentConversationId)),st=!!((i.image||i.imageUrl)&&De&&!i.isStreaming),fn=!!((i.video||i.videoUrl)&&De&&!i.isStreaming),Lt=w(st?"message.copyImageLabel":"message.copyLabel"),ca=Bv(),fs=Re.maxMessageLength,Oa=Re.maxMessagesPerThread,An=Oa!==null&&ut>=Oa,Ua=An?rt?w("message.thread.limitReachedGuest",{count:Oa}):w("message.thread.limitReachedUser",{count:Oa}):null,{theme:ht,isDark:Jt}=mi(),Rt=w("message.thread.placeholder"),Qe=`thread-input-${i.id}`,{skills:ua,isLoading:$a,selectedSkill:Te,selectSkill:Ke,clearSkill:dt}=S0({adapterName:Be==null?void 0:Be.adapterName,enabled:ca&&!!i.threadInfo,selectionScopeKey:((Ha=i.threadInfo)==null?void 0:Ha.thread_id)||i.id}),be=U.startsWith("/")?U.slice(1):"",da=be.toLowerCase().replace(/-/g," "),Ot=da?ua.filter(ne=>ne.name.replace(/-/g," ").toLowerCase().includes(da)||ne.description.toLowerCase().includes(da)):ua,Ys=Ot.length>0?Math.min(V,Ot.length-1):0,fa=Ot[Ys]??null,$n=(fa==null?void 0:fa.name.replace(/-/g," "))??"",_n=E&&fa&&U.startsWith("/")&&$n.toLowerCase().startsWith(be.toLowerCase())&&$n.length>be.length?$n.slice(be.length):null,ms=ht.mode==="dark"?"dark":ht.mode==="light"?"light":"",Wt=Jt?"dark":"light",Ks=S.useMemo(()=>["message-markdown w-full min-w-0","prose prose-slate dark:prose-invert max-w-none",ms].filter(Boolean).join(" "),[ms]),Qs=S.useMemo(()=>["message-markdown w-full min-w-0","prose dark:prose-invert max-w-none",ms].filter(Boolean).join(" "),[ms]),Cn=De?Ks:Qs,mn=`${Ks} text-sm leading-6`,ps=`${Qs} text-sm leading-6`;S.useEffect(()=>{var ne,Ie;!ve.current&&((ne=i.threadInfo)!=null&&ne.thread_id)&&ae(!0),ve.current=((Ie=i.threadInfo)==null?void 0:Ie.thread_id)||null},[(Js=i.threadInfo)==null?void 0:Js.thread_id]),S.useEffect(()=>{i.threadInfo||setTimeout(()=>{Y(""),ae(!1),G(!1),I(!1),dt()},0)},[i.threadInfo,dt]),S.useEffect(()=>{ut>0&&setTimeout(()=>{ae(!0)},0)},[ut]),S.useEffect(()=>()=>{Me.current&&clearTimeout(Me.current),He.current&&clearTimeout(He.current)},[]),S.useEffect(()=>{if(!v||!z.current)return;const ne=z.current;ne.focus(),ne.setSelectionRange(ne.value.length,ne.value.length)},[v]),S.useEffect(()=>{if(!v||!z.current)return;const ne=z.current;ne.style.height="auto",ne.style.height=`${ne.scrollHeight}px`},[v,_]);const pn=S.useCallback(()=>{const ne=_.trim();if(!ne||ne===i.content){k(!1);return}r==null||r(i.id,ne),k(!1)},[_,i.content,i.id,r]),Ut=S.useCallback(()=>{requestAnimationFrame(()=>{Ze.current&&(Ze.current.scrollTop=Ze.current.scrollHeight)})},[]);S.useEffect(()=>{if(!J)return;const ne=wt.length,Ie=ne>pe.current,xe=wt[wt.length-1],Pe=(xe==null?void 0:xe.content)||"",ea=Pe!==we.current,_t=(xe==null?void 0:xe.isStreaming)??!1,qt=Ue.current&&!_t;Ie||_t&&ea||qt?(Ut(),Ce.current=!0):Ce.current&&ea&&Ut(),pe.current=ne,we.current=Pe,Ue.current=_t},[J,wt,Ut]),S.useEffect(()=>{J&&(Ut(),Ce.current=!0)},[J,Ut]);const kt=De?"message-bubble message-bubble-assistant min-w-0 break-words leading-relaxed text-[#353740] dark:text-[#ececf1]":"message-bubble message-bubble-user relative inline-block min-w-0 break-words leading-relaxed rounded-[1.75rem] bg-[#f4f4f4] px-4 py-3 pr-10 text-[#111827] dark:bg-[#303030] dark:text-[#f5f5f5]",Kt="border-gray-200 bg-white/80 dark:border-[#3b3c49] dark:bg-white/5",en=S.useCallback(()=>{B(!0),Me.current&&clearTimeout(Me.current),Me.current=setTimeout(()=>{B(!1),Me.current=null},2e3)},[]),hn=async()=>{try{if(st){if("ClipboardItem"in window&&navigator.clipboard.write)try{const Ie=(Be==null?void 0:Be.adapterName)||(typeof window<"u"?window.localStorage.getItem("chat-adapter-name"):null),xe=await dS(i,Ie);if(xe){const Pe=xe.type==="image/png"?xe:await uS(xe);await navigator.clipboard.write([new ClipboardItem({[Pe.type||"image/png"]:Pe})]),en();return}}catch(Ie){Ve("Failed to copy generated image, falling back to text:",Ie)}const ne=fS(i);if(ne){await navigator.clipboard.writeText(ne),en();return}return}await navigator.clipboard.writeText(i.content),en()}catch(ne){Ve(st?"Failed to copy generated image:":"Failed to copy text:",ne)}},gi=Ye(ne=>ne.submitFeedback),Xt=async ne=>{if(!i.databaseMessageId||H)return;const Ie=i.feedback!==ne;F(!0);try{await gi(i.id,ne),Ie?(Q(!0),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{Q(!1),He.current=null},2e3)):Q(!1)}catch(xe){Ve("Failed to submit feedback:",xe)}finally{F(!1)}},hs=async()=>{if(!u||!i.threadInfo||An)return;const ne=U.trim();if(!ne)return;const Ie=U,xe=Te,Pe=Te==null?void 0:Te.name;Y(""),G(!0),I(!1),Pe&&dt();try{await u(i.threadInfo.thread_id,i.id,ne,Pe,ee??y??void 0),setTimeout(()=>{ke.current&&ke.current.focus()},100)}catch(ea){Ve("Failed to send thread message:",ea),Y(Ie),xe&&Ke(xe),setTimeout(()=>{ke.current&&ke.current.focus()},100)}finally{G(!1)}},Ia=S.useCallback(ne=>{var Ie;Ke(ne),I(!1),Y(""),le(0),(Ie=ke.current)==null||Ie.focus()},[Ke]),gs=S.useCallback(()=>{var ne;I(!1),Y(""),le(0),(ne=ke.current)==null||ne.focus()},[]),ha=S.useCallback(()=>{var ne;Y("/"),I(!0),le(0),(ne=ke.current)==null||ne.focus()},[]),Qt=ne=>{if(E){if(ne.key==="ArrowDown"){ne.preventDefault(),le(Ie=>Ot.length===0?0:(Ie+1)%Ot.length);return}if(ne.key==="ArrowUp"){ne.preventDefault(),le(Ie=>Ot.length===0?0:(Ie-1+Ot.length)%Ot.length);return}if(ne.key==="Home"){ne.preventDefault(),le(0);return}if(ne.key==="End"){ne.preventDefault(),le(Math.max(Ot.length-1,0));return}if((ne.key==="Enter"&&!ne.shiftKey||ne.key==="Tab")&&fa){ne.preventDefault(),Ia(fa);return}if(ne.key==="Escape"){ne.preventDefault(),gs();return}}ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),hs())},Fa=!i.threadInfo||!u||h||me||ie||An,Tn=!!i.threadInfo&&!!o&&ut>0&&!me&&!ie&&!h,Mt=async()=>{if(!(!i.threadInfo||!o)){ge(!0);try{await o(i.id,i.threadInfo.thread_id),oe(!1),ae(!1),Y("")}catch(ne){Ve("Failed to clear thread:",ne)}finally{ge(!1)}}};S.useEffect(()=>{fe.current=x},[x]),S.useEffect(()=>{ye(fe.current??y)},[y]),S.useEffect(()=>{if(!J||Fa){he.current=ie;return}const ne=ke.current;if(!ne){he.current=ie;return}if(!(ce.current||he.current)){he.current=ie;return}const xe=requestAnimationFrame(()=>{var ea;ce.current&&((ea=Ee.current)==null||ea.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})),ne.focus();const Pe=ne.value.length;ne.setSelectionRange(Pe,Pe),ce.current=!1,he.current=ie});return()=>{cancelAnimationFrame(xe),he.current=ie}},[J,Fa,ie]),S.useEffect(()=>{if(ke.current){const Ie=ke.current;Ie.style.height="auto";const xe=Ie.scrollHeight;Ie.style.height=`${Math.min(xe,120)}px`,Ie.style.overflowY=xe>120?"auto":"hidden"}},[U]);const Ba=S.useMemo(()=>{if(i.isStreaming&&(!i.content||i.content==="…"))return f.jsx("div",{className:Cn,children:f.jsx(Ag,{})});const ne=i.isStreaming&&De?" streaming-cursor":"";return f.jsx("div",{className:ne||void 0,children:f.jsx(ds,{content:qd(oi(i.content||"")),className:Cn,syntaxTheme:Wt})})},[Cn,i.content,i.isStreaming,De,Wt]),Zs=S.useMemo(()=>{const ne=xe=>xe instanceof Date?xe.getTime():new Date(xe).getTime();return[...wt].sort((xe,Pe)=>ne(xe.timestamp)-ne(Pe.timestamp)).map(xe=>{const Pe=xe.role==="assistant",ea=Pe?mn:ps,_t=xe.isStreaming&&Pe?" streaming-cursor":"",qt=xe.isStreaming&&(!xe.content||xe.content==="…")?f.jsx("div",{className:ea,children:f.jsx(Ag,{size:"sm"})}):f.jsx("div",{className:_t||void 0,children:f.jsx(ds,{content:qd(oi(xe.content||"")),className:ea,syntaxTheme:Wt})});return f.jsx("div",{className:`min-w-0 flex ${Pe?"justify-start":"justify-end"}`,children:f.jsxs("div",{className:Pe?"min-w-0 w-full max-w-full":"min-w-0 max-w-[85%]",children:[f.jsxs("div",{className:Pe?"thread-markdown-wrapper overflow-x-visible text-sm text-[#353740] dark:text-[#ececf1]":"thread-markdown-wrapper overflow-x-visible text-sm rounded-[1.75rem] bg-[#f4f4f4] px-4 py-3 text-[#111827] dark:bg-[#303030] dark:text-[#f5f5f5]",children:[qt,xe.audio&&Pe&&!xe.isStreaming&&f.jsx(dg,{audio:xe.audio,audioFormat:xe.audioFormat,autoPlay:!1}),(xe.image||xe.imageUrl)&&Pe&&!xe.isStreaming&&f.jsx(fg,{image:xe.image,imageUrl:xe.imageUrl,imageFormat:xe.imageFormat,revisedPrompt:xe.imageRevisedPrompt}),(xe.video||xe.videoUrl)&&Pe&&!xe.isStreaming&&f.jsx(mg,{video:xe.video,videoUrl:xe.videoUrl,videoFormat:xe.videoFormat,revisedPrompt:xe.videoRevisedPrompt,adapterName:Be==null?void 0:Be.adapterName}),(xe.document||xe.documentUrl)&&Pe&&!xe.isStreaming&&f.jsx(bg,{document:xe.document,documentUrl:xe.documentUrl,documentFormat:xe.documentFormat,revisedPrompt:xe.documentRevisedPrompt,adapterName:Be==null?void 0:Be.adapterName})]}),Pe&&!xe.isStreaming&&tg()&&f.jsx(mS,{reply:xe})]})},xe.id)})},[Be==null?void 0:Be.adapterName,Wt,mn,wt,ps]);return f.jsxs("div",{className:"group animate-fadeIn min-w-0 w-full px-0",children:[f.jsxs("div",{className:"min-w-0 space-y-1",children:[f.jsxs("div",{className:kt,children:[v?f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("textarea",{ref:z,className:"w-full resize-none overflow-hidden bg-transparent outline-none text-[#111827] dark:text-[#f5f5f5] leading-relaxed",value:_,onChange:ne=>j(ne.target.value),onCompositionStart:()=>P(!0),onCompositionEnd:()=>P(!1),onKeyDown:ne=>{ne.key==="Enter"&&!ne.shiftKey&&!R&&(ne.preventDefault(),ne.stopPropagation(),pn()),ne.key==="Escape"&&(ne.stopPropagation(),k(!1),j(i.content||""))},maxLength:Re.maxMessageLength,rows:1,style:{minHeight:"24px"}}),f.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[f.jsx("span",{className:"text-xs text-gray-400 dark:text-[#6e6e80]",children:w("message.edit.willRegenerateHint")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("button",{onClick:()=>{k(!1),j(i.content||"")},className:"px-3 py-1.5 text-xs font-medium rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 dark:bg-[#4a4b54] dark:text-gray-200 dark:hover:bg-[#565869] transition-colors",children:w("common.cancel")}),f.jsxs("button",{onClick:pn,className:"px-3 py-1.5 text-xs font-medium rounded-full bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-1.5",children:[f.jsx(Id,{className:"w-3.5 h-3.5"}),w("common.send")]})]})]})]}):Ba,i.attachments&&i.attachments.length>0&&f.jsx("div",{className:"mt-3 space-y-2",children:i.attachments.map(ne=>f.jsxs("div",{className:`flex items-center gap-3 rounded-xl border p-3 ${Kt}`,children:[f.jsx(A1,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:"truncate text-sm font-medium text-[#353740] dark:text-[#ececf1]",children:ne.filename}),f.jsxs("p",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:[(ne.file_size/1024).toFixed(1)," KB"]})]})]},ne.file_id))}),i.audio&&De&&!i.isStreaming&&f.jsx(dg,{audio:i.audio,audioFormat:i.audioFormat,autoPlay:!1}),(i.image||i.imageUrl)&&De&&!i.isStreaming&&f.jsx(fg,{image:i.image,imageUrl:i.imageUrl,imageFormat:i.imageFormat,revisedPrompt:i.imageRevisedPrompt}),(i.video||i.videoUrl)&&De&&!i.isStreaming&&f.jsx(mg,{video:i.video,videoUrl:i.videoUrl,videoFormat:i.videoFormat,revisedPrompt:i.videoRevisedPrompt,adapterName:Be==null?void 0:Be.adapterName}),(i.document||i.documentUrl)&&De&&!i.isStreaming&&f.jsx(bg,{document:i.document,documentUrl:i.documentUrl,documentFormat:i.documentFormat,revisedPrompt:i.documentRevisedPrompt,adapterName:Be==null?void 0:Be.adapterName}),!De&&r&&!v&&f.jsx("button",{onClick:()=>{j(i.content||""),k(!0)},className:"absolute top-1/2 -translate-y-1/2 right-2 rounded-md p-1 text-gray-600 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white transition-colors",title:w("message.editAriaLabel"),"aria-label":w("message.editAriaLabel"),children:f.jsx(u0,{className:"h-3.5 w-3.5"})})]}),De&&!i.isStreaming&&f.jsxs("div",{className:"py-1 flex flex-nowrap items-center gap-0.5 text-gray-400 dark:text-[#8e8ea0] transition-opacity",children:[!fn&&f.jsx("button",{onClick:hn,className:"rounded-md p-1.5 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:Lt,"aria-label":Lt,children:M?f.jsx(bl,{className:"h-4 w-4 text-emerald-500 dark:text-emerald-400"}):f.jsx(y1,{className:"h-4 w-4"})}),tg()&&f.jsxs("div",{className:"relative flex items-center gap-0.5",children:[f.jsx("button",{onClick:()=>Xt("up"),disabled:H,className:`rounded-md p-1.5 transition-colors ${H?"opacity-50 cursor-not-allowed":""} ${i.feedback==="up"?"text-green-600 dark:text-green-400":"hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]"}`,title:w("message.feedback.good"),"aria-label":w("message.feedback.good"),children:f.jsx(f0,{className:"h-4 w-4"})}),f.jsx("button",{onClick:()=>Xt("down"),disabled:H,className:`rounded-md p-1.5 transition-colors ${H?"opacity-50 cursor-not-allowed":""} ${i.feedback==="down"?"text-red-600 dark:text-red-400":"hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]"}`,title:w("message.feedback.poor"),"aria-label":w("message.feedback.poor"),children:f.jsx(d0,{className:"h-4 w-4"})}),C&&f.jsxs("div",{className:"absolute bottom-full left-1/2 mb-2 -translate-x-1/2 whitespace-nowrap rounded-lg bg-emerald-500 px-2.5 py-1 text-[11px] font-bold uppercase tracking-wider text-white shadow-sm animate-fadeIn dark:bg-emerald-600",children:[f.jsx("div",{className:"absolute left-1/2 top-full h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rotate-45 bg-emerald-500 dark:bg-emerald-600"}),f.jsxs("div",{className:"relative flex items-center gap-1.5",children:[f.jsx(bl,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:w("message.feedback.thanks")})]})]})]}),n&&f.jsx("button",{onClick:()=>n(i.id),className:"rounded-md p-1.5 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]",title:w("message.regenerateTitle"),"aria-label":w("message.regenerateAriaLabel"),children:f.jsx(H1,{className:"h-4 w-4"})}),ca&&i.supportsThreading&&!i.threadInfo&&l&&p&&f.jsxs("button",{type:"button",onClick:()=>{ce.current=!0,ae(!0),l(i.id,p)},className:"ml-1 inline-flex items-center gap-1.5 rounded-full border border-blue-200 bg-blue-50 px-2.5 py-1.5 text-xs text-blue-700 shadow-sm transition-all hover:border-blue-300 hover:bg-blue-100 hover:text-blue-800 hover:shadow-md dark:border-blue-500/30 dark:bg-blue-500/10 dark:text-blue-200 dark:hover:border-blue-400/50 dark:hover:bg-blue-500/20 dark:hover:text-blue-100 animate-follow-up-enter whitespace-nowrap",title:w("message.thread.continueDiscussionTitle"),"aria-label":w("message.thread.continueDiscussionAriaLabel"),children:[f.jsx(sg,{className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{children:w("message.thread.continueLabel")})]}),ca&&i.threadInfo&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"w-px h-4 shrink-0 bg-gray-200 dark:bg-[#3c3f4a] mx-1"}),f.jsxs("button",{onClick:()=>ae(ne=>!ne),className:"inline-flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1.5 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1] transition-colors text-xs",children:[f.jsx(sg,{className:"h-4 w-4"}),f.jsx("span",{className:"truncate",children:w("message.thread.replyCount",{count:ut})}),J?f.jsx(Wo,{className:"h-3 w-3"}):f.jsx(pi,{className:"h-3 w-3"})]}),Tn&&f.jsx("button",{type:"button",onClick:()=>oe(!0),className:"inline-flex items-center rounded-md px-2 py-1 text-xs font-medium text-red-600 transition-colors hover:bg-red-50 dark:text-red-300 dark:hover:bg-red-900/30",title:w("message.thread.clearTitle"),"aria-label":w("message.thread.clearAriaLabel"),children:w("common.clear")})]})]}),ca&&i.threadInfo&&J&&f.jsxs("div",{className:"thread-panel mt-3 md:mt-3 border-l-2 border-gray-200 pl-3 sm:pl-4 dark:border-[#3b3c49]",children:[f.jsx("div",{ref:Ze,className:"thread-replies-scroll mt-2 space-y-2 pb-3",onScroll:()=>{if(!Ze.current)return;const{scrollTop:ne,scrollHeight:Ie,clientHeight:xe}=Ze.current;Ce.current=Ie-ne-xe<100},children:ut>0?Zs:null}),Ua&&f.jsxs("div",{className:"mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-[#2f2410] dark:text-amber-100",children:[Ua,rt&&f.jsx("div",{className:"mt-2",children:f.jsx("button",{type:"button",onClick:()=>Ra.getState().openLoginPrompt(w("message.thread.signInPromptMessage")),className:"inline-flex items-center gap-1 rounded-md bg-blue-600 px-2.5 py-1 text-[11px] font-medium text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",children:w("message.thread.signInForHigherLimits")})})]}),f.jsxs("div",{ref:Ee,className:"mt-1 w-full max-w-[64rem] bg-transparent pt-1",children:[f.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-gray-200 bg-gray-50 px-3 py-2 dark:border-[#242424] dark:bg-[#101010]",children:[Te&&f.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs text-gray-700 shadow-sm dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-200",children:[f.jsx(tf,{className:"h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":"true"}),f.jsx("span",{className:"min-w-0 truncate font-medium capitalize",children:Te.name.replace(/-/g," ")}),f.jsx("button",{type:"button",onClick:()=>dt(),className:"-mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-gray-100","aria-label":w("message.thread.removeSkillAriaLabel"),children:f.jsx(wa,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),!Te&&ua.length>0&&U.length===0&&!Fa&&f.jsxs("button",{type:"button",onClick:ha,className:"flex h-8 shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs font-medium text-gray-600 shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-300 dark:hover:bg-white/10 dark:hover:text-gray-100 dark:focus-visible:ring-gray-600","aria-label":w("message.thread.skillsHintAriaLabel"),title:w("message.thread.skillsHint"),children:[f.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded bg-gray-200 font-mono text-[10px] leading-none text-gray-600 dark:bg-[#2a2a2a] dark:text-gray-300","aria-hidden":"true",children:"/"}),w("messageInput.skillsHint.text")]}),f.jsxs("div",{className:"relative flex min-h-8 flex-1 items-center min-w-0",children:[f.jsx("label",{htmlFor:Qe,className:"sr-only",children:w("message.thread.placeholder")}),_n&&f.jsxs("div",{className:"pointer-events-none absolute inset-0 whitespace-pre-wrap px-0 py-0 text-base leading-8 text-gray-400 dark:text-[#8e8ea0] sm:text-sm sm:leading-8","aria-hidden":"true",children:[f.jsx("span",{className:"invisible",children:U}),f.jsx("span",{children:_n})]}),f.jsx("textarea",{id:Qe,ref:ke,className:"relative z-10 block h-8 w-full min-w-0 resize-none overflow-hidden bg-transparent px-0 py-0 text-base leading-8 text-[#353740] placeholder-slate-500 outline-none transition focus:outline-none disabled:opacity-60 dark:text-[#ececf1] dark:placeholder-[#70707c] sm:text-sm sm:leading-8",placeholder:Rt,"aria-label":w("message.thread.placeholder"),value:U,onChange:ne=>{const Ie=ne.target.value;Y(Ie),Ie.startsWith("/")&&le(0),I(Ie.startsWith("/"))},onKeyDown:Qt,disabled:Fa,rows:1,maxLength:fs,style:{minHeight:"32px",maxHeight:"120px",outline:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none",appearance:"none"}})]}),f.jsxs("div",{className:"flex items-center justify-between sm:justify-end gap-2",children:[f.jsx(C0,{availableModels:b,defaultModel:y,selectedModel:ee,onSelect:ye,maxWidthClass:"max-w-[120px]",triggerPaddingClass:"px-2 py-1",staticPaddingClass:"px-2 py-1",triggerTitle:w("message.thread.selectModelTitle"),listboxLabel:w("message.thread.selectModelTitle")}),U.trim().length>0&&f.jsx("button",{type:"button",onClick:hs,disabled:Fa||U.trim().length===0,className:"flex h-10 w-10 sm:h-8 sm:w-8 items-center justify-center rounded-full transition active:scale-95 bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 disabled:cursor-not-allowed",title:w("message.thread.sendMessageTitle"),children:f.jsx(Id,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]})]}),E&&f.jsx("div",{className:"w-full pt-1",children:f.jsx(_0,{skills:ua,isLoading:$a,selectedSkill:Te,activeSkillName:fa==null?void 0:fa.name,query:be,onActiveSkillChange:ne=>{const Ie=Ot.findIndex(xe=>xe.name===ne.name);Ie>=0&&le(Ie)},onSelect:Ia,onClose:gs})})]}),ut>0&&f.jsx("div",{className:"mt-2 flex justify-end",children:f.jsxs("button",{type:"button",onClick:()=>ae(!1),className:"inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-[#bfc2cd] dark:hover:bg-[#2f313a] dark:hover:text-white","aria-label":w("message.thread.hideRepliesAriaLabel"),children:[f.jsx(Wo,{className:"h-3 w-3"}),f.jsx("span",{children:w("message.thread.hideRepliesLabel")})]})})]})]}),f.jsx(ac,{isOpen:ue,onClose:()=>{de||oe(!1)},onConfirm:Mt,title:w("message.confirmation.clearRepliesTitle"),message:w("message.confirmation.clearRepliesMessage"),confirmText:w("common.clear"),cancelText:w("common.cancel"),type:"danger",isLoading:de})]})}let li=null;function hS(){if(typeof window>"u")return null;const i=window.AudioContext??window.webkitAudioContext;return i?((!li||li.state==="closed")&&(li=new i),li.state==="suspended"&&li.resume(),li):(se("[SoundEffects] AudioContext not supported in this browser"),null)}function gS(i){const n=hS();if(!n)return;const r=n.currentTime;for(const l of i){const o=n.createOscillator(),u=n.createGain();o.connect(u),u.connect(n.destination),o.frequency.value=l.frequency,o.type=l.type;const m=r+l.startTime,p=m+l.duration;u.gain.setValueAtTime(.001,m),u.gain.linearRampToValueAtTime(l.gain,m+.008),u.gain.exponentialRampToValueAtTime(.001,p),o.start(m),o.stop(p+.01)}}const bS={messageSent:[{frequency:1046,startTime:0,duration:.08,gain:.15,type:"sine"},{frequency:1397,startTime:.07,duration:.11,gain:.18,type:"sine"}],messageReceived:[{frequency:988,startTime:0,duration:.12,gain:.16,type:"sine"},{frequency:1319,startTime:.13,duration:.12,gain:.18,type:"sine"},{frequency:1568,startTime:.26,duration:.18,gain:.14,type:"sine"}],success:[{frequency:784,startTime:0,duration:.1,gain:.14,type:"sine"},{frequency:1175,startTime:.11,duration:.18,gain:.18,type:"sine"}],error:[{frequency:330,startTime:0,duration:.15,gain:.16,type:"sine"},{frequency:262,startTime:.18,duration:.22,gain:.13,type:"sine"}],notification:[{frequency:880,startTime:0,duration:.1,gain:.14,type:"sine"},{frequency:1109,startTime:.12,duration:.16,gain:.17,type:"sine"}]};function dl(i,n){if(!n)return;const r=bS[i];if(!r){se(`[SoundEffects] Unknown sound effect type: ${i}`);return}try{gS(r),se(`[SoundEffects] Playing ${i} sound effect`)}catch(l){se(`[SoundEffects] Failed to play ${i} sound effect:`,l)}}function xS({messages:i,onRegenerate:n,onEditMessage:r,onStartThread:l,onClearThread:o,onSendThreadMessage:u,sessionId:m,isLoading:p,contentMaxWidthClass:h="max-w-[64rem]",availableModels:b,defaultModel:y,selectedModel:x}){const w=S.useRef(null),v=S.useRef(null),k=S.useRef(i.length),_=S.useRef(""),j=S.useRef(p),R=S.useRef(!0),{settings:P}=lc(),{t:z}=pt(),{topLevelMessages:M,threadLookup:B}=S.useMemo(()=>{const C=new Map,Q=[];return i.forEach(U=>{if(U.isThreadMessage&&U.parentMessageId){const Y=C.get(U.parentMessageId)||[];C.set(U.parentMessageId,[...Y,U]);return}Q.push(U)}),{topLevelMessages:Q,threadLookup:C}},[i]),H=()=>{if(!v.current)return;const{scrollTop:C,scrollHeight:Q,clientHeight:U}=v.current,J=Q-C-U<200;R.current=J},F=S.useCallback(()=>{requestAnimationFrame(()=>{v.current&&(v.current.scrollTop=v.current.scrollHeight)})},[]);return S.useEffect(()=>{const C=i.length,Q=k.current,U=C>Q,Y=i[i.length-1],J=(Y==null?void 0:Y.content)||"",ae=J!==_.current,ie=(Y==null?void 0:Y.isStreaming)??!1;U||ie&&ae?(F(),R.current=!0):R.current&&ae&&F(),k.current=C,_.current=J},[i,F]),S.useEffect(()=>{p&&(F(),R.current=!0)},[p,F]),S.useEffect(()=>{if(j.current&&!p){const C=i[i.length-1];(C==null?void 0:C.role)==="assistant"&&C.content&&dl("messageReceived",P.soundEnabled)}j.current=p},[p,i,P.soundEnabled]),M.length===0?f.jsx("div",{className:"flex-1 flex items-center justify-center px-4 sm:px-6",children:f.jsxs("div",{className:"text-center text-lg text-gray-500 dark:text-[#bfc2cd]",children:[f.jsx("p",{className:"text-xl",children:z("messageList.emptyStateHeading")}),f.jsx("p",{className:"mt-1 text-lg",children:z("messageList.emptyStateSubheading")})]})}):f.jsx("div",{ref:v,className:"message-list flex-1 overflow-y-auto pb-8 pt-4 sm:pt-6",onScroll:H,children:f.jsx("div",{className:"mx-auto w-full max-w-[96rem] px-3 sm:px-5 md:px-6 lg:px-8 xl:px-10",children:f.jsxs("div",{className:`message-list__rail mx-auto w-full space-y-7 ${h}`,children:[M.map(C=>f.jsx("div",{className:`flex w-full ${C.role==="user"?"justify-end":"justify-start"}`,style:{contentVisibility:"auto",containIntrinsicSize:"420px"},children:f.jsx(pS,{message:C,onRegenerate:n,onEdit:r,onStartThread:l,onClearThread:o,onSendThreadMessage:u,threadMessages:B.get(C.id),sessionId:m,isThreadSendDisabled:p,availableModels:b,defaultModel:y,selectedModel:x})},C.id)),f.jsx("div",{ref:w,className:"h-8"})]})})})}const yS=4e3;function vS(i,n,r={}){var Q;const{t:l}=pt(),[o,u]=S.useState(!1),[m,p]=S.useState(null),h=S.useRef(null),b=S.useRef(""),y=S.useRef(""),x=S.useRef(!1),w=S.useRef(null),v=typeof navigator<"u"?navigator.language:"en-US",k=Number.isFinite(r.silenceTimeoutMs)?Math.max(Math.floor(r.silenceTimeoutMs),1e3):yS,_=((Q=r.language)==null?void 0:Q.trim())||v||"en-US",j=S.useCallback(U=>U.replace(/\s+/g," ").trim(),[]),R=S.useCallback(U=>{const Y=j(U);Y&&Y!==y.current&&(y.current=Y,i(Y))},[j,i]),P=S.useCallback(()=>{if(!b.current)return;const U=b.current;b.current="",R(U)},[R]),z=typeof window<"u"&&("webkitSpeechRecognition"in window||"SpeechRecognition"in window),M=S.useCallback(()=>{!n||x.current||(x.current=!0,n())},[n]),B=S.useCallback(()=>{w.current!==null&&(clearTimeout(w.current),w.current=null)},[]),H=S.useCallback(()=>{B(),w.current=setTimeout(()=>{se("Speech recognition silence threshold reached, stopping recording"),h.current?h.current.stop():M()},k)},[B,M,k]),F=S.useCallback(()=>{if(!z){p(l("voice.browserNotSupported"));return}if(!h.current)try{x.current=!1;const U=window.SpeechRecognition||window.webkitSpeechRecognition,Y=new U;Y.continuous=!0,Y.interimResults=!0,Y.lang=_,Y.maxAlternatives=1,Y.onstart=()=>{u(!0),p(null),b.current="",y.current="",se("Speech recognition started"),H()},Y.onresult=J=>{let ae="",ie="";for(let G=J.resultIndex;G<J.results.length;G++){const E=J.results[G][0].transcript;J.results[G].isFinal?ae+=E:ie+=E}ie&&(b.current=j(ie)),ae&&(b.current="",R(ae)),H()},Y.onend=()=>{B(),P(),u(!1),h.current=null,se("Speech recognition ended"),M()},Y.onerror=J=>{switch(B(),Ve("Speech recognition error:",J.error),u(!1),h.current=null,b.current="",M(),J.error){case"no-speech":p(l("voice.error.noSpeech"));break;case"audio-capture":p(l("voice.error.audioCapture"));break;case"not-allowed":p(l("voice.error.notAllowed"));break;case"network":p(l("voice.error.network"));break;default:p(l("voice.error.generic",{error:J.error}))}},Y.start(),h.current=Y}catch(U){Ve("Failed to start speech recognition:",U),p(l("voice.error.startFailed")),u(!1)}},[z,P,M,H,B,_,j,R,l]),C=S.useCallback(()=>{if(se("Stopping speech recognition..."),h.current){const U=h.current;U.onstart=null,U.onerror=null;try{U.stop()}catch(Y){se("Recognition already stopped or error stopping:",Y),B(),P(),U.onend=null,U.onresult=null,h.current=null,u(!1),M()}}B(),u(!1),p(null),se("Speech recognition stopped, isListening set to false")},[B,P,M]);return{isListening:o,isSupported:z,startListening:F,stopListening:C,error:m}}const SS=300,_g=3,Bo=5,wS=6e4;function Cg(i){if(typeof i!="string")return null;const n=i.replace(/[\r\n\u2028\u2029]+/g," ").replace(/\s{2,}/g," ").trim();return n?{text:n}:null}function kS(i,n={}){const{enabled:r=e0(),adapterName:l,sessionId:o,adapterSupportsAutocomplete:u,skill:m,inputRef:p}=n,[h,b]=S.useState([]),[y,x]=S.useState(!1),[w,v]=S.useState(-1),k=S.useRef(null),_=S.useRef(null),j=S.useRef(null),R=S.useRef(null),P=S.useRef(null),z=S.useRef(0),M=S.useRef([]),B=S.useRef([]),H=S.useRef(new Map);S.useEffect(()=>{M.current=h},[h]);const F=S.useCallback(G=>{const E=H.current.get(G);return E?E<=Date.now()?(H.current.delete(G),!1):!0:!1},[]),C=S.useCallback((G,E=!0)=>{const I=G.toLowerCase().trim(),V=B.current.length>0?B.current:M.current;if(!I)return V.slice(0,Bo);const le=V.filter(ue=>ue.text.toLowerCase().includes(I));return le.length>0?le.slice(0,Bo):E?V.slice(0,Bo):[]},[]),Q=S.useCallback(async G=>{if(!r||G.length<_g){b([]),B.current=[],_.current&&clearTimeout(_.current),j.current&&clearTimeout(j.current),x(!1);return}if(!l){b([]),B.current=[],_.current&&clearTimeout(_.current),x(!1);return}if(u===!1||F(l)){b([]),B.current=[],_.current&&clearTimeout(_.current),x(!1);return}R.current&&R.current.abort(),R.current=new AbortController;const E=z.current+1;z.current=E,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{E===z.current&&x(!0)},150);try{const I={"X-Adapter-Name":l};o&&(I["X-Session-ID"]=o);const V=new URLSearchParams;V.set("q",G),V.set("limit",String(Bo)),m&&V.set("skill",m);const le=`/api/v1/autocomplete?${V.toString()}`,ue=await fetch(le,{method:"GET",headers:I,signal:R.current.signal});if(!ue.ok){qe("[useAutocomplete] Request failed:",ue.status),[404,405,501].includes(ue.status)?(H.current.set(l,Date.now()+wS),b([]),B.current=[]):b(C(G));return}const oe=await ue.json(),de=Array.isArray(oe==null?void 0:oe.suggestions)?oe.suggestions.map(ge=>Cg(typeof ge=="string"?ge:ge==null?void 0:ge.text)).filter(ge=>ge!==null):[];if(E!==z.current)return;de.length===0?b(C(G,!1)):(b(de),B.current=de),v(-1),se("[useAutocomplete] Received",de.length,"suggestions")}catch(I){if(I instanceof Error&&I.name==="AbortError")return;qe("[useAutocomplete] Error:",I instanceof Error?I.message:String(I)),E===z.current&&b(C(G))}finally{E===z.current&&(_.current&&(clearTimeout(_.current),_.current=null),x(!1))}},[r,l,o,u,m,C,F]);S.useEffect(()=>{k.current&&clearTimeout(k.current);const G=()=>{R.current&&R.current.abort(),_.current&&clearTimeout(_.current),x(!1)},E=()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{j.current=null,b([]),G()},0)};if(!r||i.length<_g||u===!1||l&&F(l)){E();return}if(P.current){if(i===P.current){E();return}P.current=null}return k.current=setTimeout(()=>{Q(i)},SS),()=>{k.current&&clearTimeout(k.current),j.current&&(clearTimeout(j.current),j.current=null)}},[i,Q,r,l,u,F]),S.useEffect(()=>()=>{R.current&&R.current.abort(),_.current&&clearTimeout(_.current)},[]);const U=S.useCallback(()=>{v(G=>{const E=M.current.length;return E===0?-1:G<E-1?G+1:0})},[]),Y=S.useCallback(()=>{v(G=>{const E=M.current.length;return E===0?-1:G>0?G-1:E-1})},[]),J=S.useCallback(()=>{b([]),B.current=[],v(-1),R.current&&R.current.abort(),_.current&&clearTimeout(_.current),x(!1)},[]),ae=S.useCallback(G=>{if(!(p!=null&&p.current))return;const E=()=>{const I=p.current;if(!I)return;const V=typeof G=="string"?G.length:I.value.length;I.focus({preventScroll:!0}),typeof I.setSelectionRange=="function"&&I.setSelectionRange(V,V)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(E):setTimeout(E,0)},[p]),ie=S.useCallback(G=>{P.current=G},[]);return{suggestions:h,isLoading:y,selectedIndex:w,setSelectedIndex:v,selectNext:U,selectPrevious:Y,clearSuggestions:J,focusInputAfterSelection:ae,suppressUntilQueryChange:ie}}const Vs=new Map,AS=new Map,_S=new Map,CS=new Set,TS=()=>{if(typeof window>"u")return null;try{return localStorage.getItem("chat-adapter-name")}catch{return null}},T0=i=>typeof i=="object"&&i!==null&&"message"in i,NS=i=>i instanceof Error?i.message:typeof i=="string"?i:T0(i)?i.message??"Unknown error":"Unknown error";function jS({conversationId:i,onFilesSelected:n,onUploadError:r,onClose:l,onUploadingChange:o,onUploadSuccess:u,maxFiles:m=Re.maxFilesPerConversation,disabled:p=!1}){const{t:h}=pt(),[b,y]=S.useState(!1),[x,w]=S.useState(0),v=S.useRef(null),k=S.useRef(_S),_=S.useRef(CS),j=S.useRef(new Map),R=S.useRef(!0),P=S.useRef(AS),z=S.useRef(i),M=Ye(ee=>ee.conversations),B=S.useMemo(()=>{if(!i)return new Map;const ee=Vs.get(i);return ee?new Map(ee):new Map},[i,x]),H=S.useCallback(ee=>{if(!ee){o==null||o(null,!1),w(ke=>ke+1);return}const ye=Vs.get(ee)||new Map,fe=M.find(ke=>ke.id===ee),ve=new Map(ye);if(fe!=null&&fe.attachedFiles){const ke=new Set(fe.attachedFiles.filter(Ee=>Ee.processing_status==="completed"||Ee.processing_status==="failed"||Ee.processing_status==="error").map(Ee=>Ee.file_id));ve.forEach((Ee,Ze)=>{Ee.fileId&&ke.has(Ee.fileId)&&ve.delete(Ze)})}ve.size>0?(Vs.set(ee,ve),o==null||o(ee,!0)):(Vs.delete(ee),o==null||o(ee,!1)),w(ke=>ke+1)},[M,o]);S.useEffect(()=>{z.current=i,setTimeout(()=>{H(i)},0)},[i,H]),S.useEffect(()=>{i&&setTimeout(()=>{H(i)},0)},[M,i,H]);const F=S.useCallback((ee,ye)=>{if(!ee)return;const fe=Vs.get(ee)||new Map,ve=ye(new Map(fe));ve.size>0?Vs.set(ee,ve):Vs.delete(ee),o==null||o(ee,ve.size>0),w(ke=>ke+1)},[o]),C=S.useCallback((ee,ye)=>{if(!ee)return;const fe=P.current.get(ee)||[],ve=ye([...fe||[]]),ke=new Set(fe.map(Ee=>Ee.file_id));if(P.current.set(ee,ve),n(ee,ve),u){const Ee=ve.filter(Ze=>!ke.has(Ze.file_id));Ee.length>0&&u(ee,Ee)}w(Ee=>Ee+1)},[n,u]),Q=Ye(ee=>ee.removeFileFromConversation),U=Ye(ee=>ee.addFileToConversation);S.useEffect(()=>(R.current=!0,()=>{R.current=!1}),[]);const Y=S.useCallback(()=>{R.current=!1,new Map(j.current).forEach(ye=>ye.abort()),setTimeout(()=>{const ye=Ye.getState(),fe=new Map(ye.conversations.map(ke=>[ke.id,ke])),ve=[];k.current.forEach((ke,Ee)=>{var Ze;if(ke){const ce=fe.get(ke);if(new Set(((Ze=ce==null?void 0:ce.attachedFiles)==null?void 0:Ze.map(we=>we.file_id))||[]).has(Ee)){_.current.add(Ee),k.current.delete(Ee);return}}if(_.current.has(Ee)){se(`[FileUpload] Skipping cleanup delete for ${Ee}; file was previously attached and already handled`),k.current.delete(Ee),_.current.delete(Ee);return}ve.push({fileId:Ee,conversationId:ke||null})}),ve.length>0&&(l==null||l(),ve.forEach(async({fileId:ke,conversationId:Ee})=>{try{if(Ee)await Q(Ee,ke);else{const Ze=TS();await vl.deleteFile(ke,void 0,void 0,Ze??void 0)}}catch(Ze){if(T0(Ze)){const ce=Ze.message??"";!ce.includes("404")&&!ce.includes("File not found")&&qe(`Failed to cleanup file ${ke} during component unmount:`,Ze)}else qe(`Failed to cleanup file ${ke} during component unmount`,Ze)}}))},300)},[l,Q]);S.useEffect(()=>Y,[Y]);const J=S.useCallback(async ee=>{if(!ee||ee.length===0)return;const ye=Array.from(ee),fe=Ye.getState(),ve=i||fe.currentConversationId;if(!ve){r==null||r(h("fileUpload.selectBeforeUpload"));return}const ke=fe.conversations.find(pe=>pe.id===ve);if(!ke){r==null||r(h("fileUpload.conversationNotFound"));return}if((P.current.get(ve)||[]).length+ye.length>m){const pe=h("fileUpload.maxFilesPerConversationError",{count:m});za()&&!kn()&&Ra.getState().openLoginPrompt(h("fileUpload.maxFilesGuestLimitMessage",{count:m})),r==null||r(pe);return}if(Re.maxTotalFiles!==null&&fe.conversations.reduce((Ue,Ce)=>{var he;return Ue+(((he=Ce.attachedFiles)==null?void 0:he.length)||0)},0)+ye.length>Re.maxTotalFiles){const Ue=h("fileUpload.maxTotalFilesError",{count:Re.maxTotalFiles});za()&&!kn()&&Ra.getState().openLoginPrompt(h("fileUpload.maxTotalFilesGuestLimitMessage",{count:Re.maxTotalFiles})),r==null||r(Ue);return}if(!ke.adapterName){r==null||r(h("fileUpload.adapterNotConfigured"));return}const Ze=ke.adapterName,ce=Da(ke.apiUrl);for(let pe=0;pe<ye.length;pe++){const we=ye[pe],Ue=new AbortController;j.current.set(we.name,Ue);const Ce=`${ve}-${we.name}-${Date.now()}-${pe}`;let he=null;try{const Me=await vl.uploadFile(we,He=>{if(F(ve,De=>(De.set(Ce,He),De)),He.fileId&&!he){he=He.fileId,k.current.set(He.fileId,ve),_.current.add(He.fileId);const De={file_id:He.fileId,filename:we.name,mime_type:we.type||"application/octet-stream",file_size:we.size,processing_status:He.status==="uploading"?"uploading":He.status==="processing"?"processing":He.status==="completed"?"completed":void 0};se(`[FileUpload] Adding file ${He.fileId} to conversation ${ve} immediately (status: ${De.processing_status})`),U(ve,De)}},void 0,ce,Ze).catch(He=>{if(He.message&&He.message.includes("was deleted")){he&&k.current.delete(he);const De=He.message.match(/File\s+([\w-]+)\s+was deleted/);return De&&De[1]&&k.current.delete(De[1]),se(`File ${we.name} was deleted during upload`),null}throw He});Me?(k.current.set(Me.file_id,ve),_.current.add(Me.file_id),se(`[FileUpload] Updating file ${Me.file_id} in conversation ${ve} with final status`),U(ve,Me),Me.processing_status==="completed"||Me.processing_status==="failed"||Me.processing_status==="error"?F(ve,De=>(De.delete(Ce),De)):F(ve,De=>{const wt=De.get(Ce);return wt&&De.set(Ce,{...wt,progress:90,status:"processing",fileId:Me.file_id}),De}),C(ve,De=>{if(new Set(De.map(me=>me.file_id)).has(Me.file_id))return De;const ut=[...De,Me];return se(`[FileUpload] Updated uploadedFiles for ${ve}: ${ut.length} files`,ut),ut})):(qe(`Upload completed for ${we.name} but uploadedAttachment is null`),F(ve,He=>(He.delete(Ce),He)))}catch(Me){const He=NS(Me);if(Me instanceof DOMException&&Me.name==="AbortError"||Ue.signal.aborted){se(`Upload cancelled for ${we.name}`),he&&k.current.delete(he);continue}if(He.includes("was deleted")){se(`File ${we.name} was deleted during upload`),he&&k.current.delete(he);const ut=He.match(/File\s+([\w-]+)\s+was deleted/);ut&&ut[1]&&k.current.delete(ut[1]);continue}R.current?(Ve(`Failed to upload file ${we.name}:`,Me),Ve(`File type: ${we.type}, File name: ${we.name}`),r==null||r(He||`Failed to upload ${we.name}`)):qe(`Upload error for ${we.name} (component unmounted):`,He),he&&k.current.delete(he);const De=Ce,wt=ve;setTimeout(()=>{F(wt,ut=>(ut.delete(De),ut))},5e3)}finally{j.current.delete(we.name)}}},[U,i,m,r,h,C,F]),ae=S.useCallback(ee=>{ee.preventDefault(),ee.stopPropagation(),p||y(!0)},[p]),ie=S.useCallback(ee=>{ee.preventDefault(),ee.stopPropagation(),y(!1)},[]),G=S.useCallback(ee=>{if(ee.preventDefault(),ee.stopPropagation(),y(!1),p)return;const ye=ee.dataTransfer.files;J(ye)},[p,J]),E=S.useCallback(ee=>{const ye=ee.target.files;J(ye),v.current&&(v.current.value="")},[J]),I=S.useCallback(()=>{!p&&v.current&&v.current.click()},[p]),V=S.useCallback(ee=>{p||(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),I())},[p,I]),le=B.size>0,ue=S.useMemo(()=>{const ee=new Map;return M.forEach(ye=>{ee.set(ye.id,ye.title||h("chatInterface.newChatTitle"))}),ee},[M,h]),oe=S.useMemo(()=>{const ee=[];return Vs.forEach((ye,fe)=>{fe!==i&&ye.size>0&&ee.push({conversationId:fe,uploads:Array.from(ye.entries()).map(([ve,ke])=>({key:ve,progress:ke}))})}),ee},[i,x]),de=(ee,ye)=>{const fe=ee.status==="error";return f.jsxs("div",{className:`group relative w-full flex items-center gap-3 rounded-lg px-3 py-2.5 overflow-hidden transition-colors ${fe?"border border-red-200 bg-red-50 dark:border-red-500/30 dark:bg-[#101010]":"border border-gray-200 bg-gray-50 dark:border-[#242424] dark:bg-[#101010]"}`,children:[!fe&&f.jsx("div",{className:"absolute inset-0 bg-blue-50 dark:bg-white/[0.04] transition-all duration-500 ease-out rounded-lg",style:{width:`${ee.progress}%`}}),f.jsxs("div",{className:"relative flex items-center gap-3 w-full min-w-0",children:[f.jsx("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md ${fe?"bg-red-100 dark:bg-red-500/15":"bg-blue-100 dark:bg-white/[0.06]"}`,children:fe?f.jsx(Xo,{className:"h-4 w-4 text-red-500 dark:text-red-400"}):f.jsx(Yo,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 animate-spin"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("p",{className:"text-sm font-medium text-[#353740] dark:text-[#ececf1] truncate",children:ee.filename}),fe?f.jsx("p",{className:"mt-0.5 text-xs text-red-600 dark:text-red-400 truncate",children:ee.error||h("fileUpload.processingFailedMessage")}):f.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[f.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-[#242424] rounded-full h-1",children:f.jsx("div",{className:"bg-blue-500 dark:bg-blue-400 h-1 rounded-full transition-all duration-500 ease-out",style:{width:`${ee.progress}%`}})}),f.jsxs("span",{className:"text-[11px] tabular-nums text-gray-400 dark:text-[#8e8ea0] shrink-0",children:[Math.round(ee.progress),"%"]})]})]}),f.jsx("span",{className:`text-xs font-medium shrink-0 ${fe?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-[#bfc2cd]"}`,children:ee.status==="uploading"?h("fileUpload.uploadingStatus"):ee.status==="processing"?h("fileUpload.processingStatus"):ee.status==="completed"?h("fileUpload.completedStatus"):h("fileUpload.failedStatus")})]})]},ye)},ge=f.jsx("div",{className:"w-full max-w-full overflow-hidden space-y-1.5",role:"status","aria-live":"polite",children:Array.from(B.entries()).map(([ee,ye])=>de(ye,ee))});return f.jsxs("div",{className:"w-full max-w-full overflow-hidden space-y-2",children:[le&&ge,!le&&f.jsxs("button",{type:"button",onClick:I,onKeyDown:V,onDragOver:ae,onDragLeave:ie,onDrop:G,disabled:p,className:`
|
|
348
|
+
group relative w-full max-w-full rounded-lg border p-4 transition-all duration-200 text-left overflow-hidden
|
|
349
|
+
${b?"border-blue-300 bg-blue-50 ring-2 ring-blue-400 ring-inset dark:border-blue-500/40 dark:bg-[#101010] dark:ring-blue-500":p?"border-gray-200 bg-gray-50 cursor-not-allowed opacity-50 dark:border-[#242424] dark:bg-[#101010]":"border-gray-200 bg-gray-50 hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 focus-visible:ring-inset dark:border-[#242424] dark:bg-[#101010] dark:hover:bg-[#1a1a1a]"}
|
|
350
|
+
`,"aria-label":h(p?"fileUpload.disabledAriaLabel":"fileUpload.enabledAriaLabel"),children:[f.jsx("input",{ref:v,type:"file",multiple:!0,onChange:E,className:"hidden",disabled:p,accept:".pdf,.doc,.docx,.txt,.md,.csv,.json,.html,.pptx,.xlsx,.py,.java,.sql,.js,.mjs,.ts,.tsx,.cpp,.cxx,.cc,.c,.h,.hpp,.go,.rs,.rb,.php,.sh,.bash,.zsh,.yaml,.yml,.xml,.css,.scss,.sass,.less,.png,.jpg,.jpeg,.tiff,.webp,.wav,.mp3,.mp4,.ogg,.flac,.webm,.m4a,.aac,.vtt"}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg transition-colors duration-200 ${b?"bg-blue-100 dark:bg-blue-500/15":"bg-gray-200/70 dark:bg-[#1a1a1a] group-hover:bg-blue-100 dark:group-hover:bg-[#242424]"}`,children:f.jsx(X1,{className:`h-5 w-5 transition-colors duration-200 ${b?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-[#8e8ea0] group-hover:text-blue-500 dark:group-hover:text-blue-400"}`})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("p",{className:`text-sm font-medium transition-colors duration-200 ${b?"text-blue-700 dark:text-blue-300":"text-[#353740] dark:text-[#ececf1]"}`,children:h(p?"fileUpload.disabledAriaLabel":b?"fileUpload.draggingText":"fileUpload.dragDropText")}),f.jsx("p",{className:"text-xs text-gray-400 dark:text-[#8e8ea0] mt-0.5",children:h("fileUpload.fileTypesAndLimit",{count:m})})]})]})]}),oe.length>0&&f.jsxs("div",{className:"w-full max-w-full space-y-2 rounded-lg border border-gray-200 bg-gray-50 p-2.5 dark:border-[#242424] dark:bg-[#101010]",children:[f.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-[#8e8ea0] px-1",children:h("fileUpload.otherConversationsLabel")}),oe.map(({conversationId:ee,uploads:ye})=>f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("div",{className:"text-[11px] font-medium text-gray-400 dark:text-[#6b6f7a] px-1",children:ue.get(ee)||"Conversation"}),ye.map(({key:fe,progress:ve})=>de(ve,fe))]},ee))]})]})}const Tg={"image/jpeg":"jpg","image/jpg":"jpg","image/png":"png","image/tiff":"tiff","image/tif":"tif","image/gif":"gif","image/webp":"webp","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/msword":"doc","text/plain":"txt","text/markdown":"md","application/json":"json"},qo=4,Ho=3,ES=0,LS=0,Td=2;function MS(i){if(!i||typeof i!="object")return null;const n=i,r=["supportsAutocomplete","isAutocompleteSupported","autocompleteSupported"];for(const u of r)if(typeof n[u]=="boolean")return n[u];const l=["capabilities","features"],o=["autocomplete","supportsAutocomplete","autocomplete_supported"];for(const u of l){const m=n[u];if(!m||typeof m!="object")continue;const p=m;for(const h of o)if(typeof p[h]=="boolean")return p[h]}return null}function DS(i){if(!i)return"bin";if(Tg[i])return Tg[i];const n=i.split("/");return n.length===2&&n[1]?n[1]:"bin"}function zS(i){return i.replace(/[^a-zA-Z0-9._-]/g,"_").replace(/_+/g,"_")||"pasted-file"}function RS(i){const n=i.lastIndexOf(".");return n===-1||n===i.length-1?null:i.slice(n+1).toLowerCase()}function OS(i){const n=i.lastIndexOf(".");return n===-1?i:i.slice(0,n)}function US(i,n){const r=Date.now(),l=i.name&&i.name.trim().length>0?i.name.trim():"pasted-file",o=zS(OS(l)),m=RS(l)||DS(i.type),p=`${o}-${r}-${n}.${m}`;return new File([i],p,{type:i.type||"application/octet-stream"})}function Ng({onSend:i,disabled:n=!1,placeholder:r=Jg(),autoFocusEnabled:l=!0,suppressMobileAutoFocus:o=!1,isCentered:u=!1,maxWidthClass:m="max-w-5xl",adapterNotes:p,skillState:h,availableModels:b=[],defaultModel:y=null,selectedModel:x=null,onSelectModel:w}){var Tl;const{t:v}=pt(),[k,_]=S.useState(""),[j,R]=S.useState(!1),[P,z]=S.useState(!1),[M,B]=S.useState(!1),[H,F]=S.useState(!1),[C,Q]=S.useState([]),[U,Y]=S.useState({}),[J,ae]=S.useState(new Map),[ie,G]=S.useState(!1),[E,I]=S.useState(!1),[V,le]=S.useState(null),[ue,oe]=S.useState(null),[de,ge]=S.useState(null),[ee,ye]=S.useState({isOpen:!1,fileId:"",filename:"",isDeleting:!1}),fe=S.useRef(null),ve=S.useRef(null),ke=S.useRef(null),Ee=S.useRef(null),Ze=S.useRef(null),ce=S.useRef(new Set),pe=S.useRef(""),we=S.useRef(!1),Ue=S.useRef(0),Ce=S.useRef(null),{settings:he,updateSettings:Me}=lc(),{theme:He,isDark:De}=mi(),wt=He.mode==="dark"?"dark":He.mode==="light"?"light":"",ut=De?"dark":"light";yl(ve,{enabled:M,onEscape:()=>B(!1)});const me=S.useCallback((N,re)=>{N&&Y(Ne=>{if(Ne[N]===re)return Ne;const Fe={...Ne};return re?Fe[N]=!0:delete Fe[N],Fe})},[]),[ze,rt]=S.useState(0),[Be,st]=S.useState(!1),[fn,Lt]=S.useState(0),[ca,fs]=S.useState(()=>({top:qo+Ho,bottom:Math.max(qo-Ho,0)})),[Oa,An]=S.useState(null),Ua=hi(),ht=za()&&!Ua,Jt=Ra(N=>N.showLoginPrompt),{createConversation:Rt,currentConversationId:Qe,conversations:ua,isLoading:$a,syncConversationFiles:Te,stopStreaming:Ke,removeFileFromConversation:dt}=Ye(),be=ua.find(N=>N.id===Qe),da=be?be.messages.filter(N=>!(N.role==="assistant"&&N.isStreaming)).length:0,Ot=ua.reduce((N,re)=>N+re.messages.filter(Ne=>!(Ne.role==="assistant"&&Ne.isStreaming)).length,0),Ys=!!be&&Re.maxMessagesPerConversation!==null&&da>=Re.maxMessagesPerConversation,fa=Re.maxTotalMessages!==null&&Ot>=Re.maxTotalMessages,$n=S.useCallback(()=>{rt(N=>N+1)},[]),_n=qv(),ms=Hv(),{isListening:Wt,isSupported:Ks,startListening:Qs,stopListening:Cn,error:mn}=vS(N=>{_(re=>{const Ne=re.length>0&&!/\s$/.test(re)?" ":"",Fe=(re+Ne+N).slice(0,Re.maxMessageLength);return pe.current=Fe,Fe})},$n,{silenceTimeoutMs:_n,language:ms||void 0}),ps=Iv(),pn=Fv(),Ut=pn&&Ks,kt=$v(),Kt=e0(),en=MS(be==null?void 0:be.adapterInfo),{skills:hn,isLoading:gi,selectedSkill:Xt,selectSkill:hs,clearSkill:Ia}=h,gs=(be==null?void 0:be.adapterName)||null,{suggestions:ha,selectedIndex:Qt,setSelectedIndex:Fa,selectNext:Tn,selectPrevious:Mt,clearSuggestions:Ba,focusInputAfterSelection:Zs,suppressUntilQueryChange:qa}=kS(k,{enabled:Kt&&!Wt,apiUrl:be==null?void 0:be.apiUrl,adapterName:gs,sessionId:be==null?void 0:be.sessionId,adapterSupportsAutocomplete:en,skill:(Xt==null?void 0:Xt.name)||null,inputRef:fe}),Ha=ha.length>0,Js=!Wt,ne=Js&&Ha&&!Be,Ie=k.startsWith("/")?k.slice(1):"",xe=Ie.toLowerCase().replace(/-/g," "),Pe=xe?hn.filter(N=>N.name.replace(/-/g," ").toLowerCase().includes(xe)||N.description.toLowerCase().includes(xe)):hn,ea=Pe.length>0?Math.min(fn,Pe.length-1):0,_t=Pe[ea]??null,qt=(_t==null?void 0:_t.name.replace(/-/g," "))??"",Sl=Be&&_t&&k.startsWith("/")&&qt.toLowerCase().startsWith(Ie.toLowerCase())&&qt.length>Ie.length?qt.slice(Ie.length):null,pc=Qt>=0?Qt:0,In=Ha?ha[pc]:null,bi=S.useMemo(()=>{if(!In)return null;const N=In.text||"";if(!k)return N;const re=k;return N.toLowerCase().startsWith(re.toLowerCase())&&N.length>re.length?N.slice(re.length):null},[In,k]),bs=Sl??bi,hc=k.trim().length===0&&!bs,ka=S.useCallback(N=>{if(!k)return f.jsx("span",{className:"line-clamp-1 text-current",children:N});if(!N.toLowerCase().startsWith(k.toLowerCase()))return f.jsx("span",{className:"line-clamp-1 text-current",children:N});const re=N.slice(0,k.length),Ne=N.slice(k.length);return f.jsxs("span",{className:"line-clamp-1",children:[f.jsx("span",{className:"text-gray-500 dark:text-[#8e8ea0]",children:re}),f.jsx("span",{className:"font-semibold text-[#353740] dark:text-[#ececf1]",children:Ne})]})},[k]),kr=S.useCallback(N=>{var re;hs(N),st(!1),_(""),Ba(),Lt(0),(re=fe.current)==null||re.focus()},[Ba,hs]),wl=S.useCallback(()=>{var N;_("/"),st(!0),Lt(0),(N=fe.current)==null||N.focus()},[]),Ar=S.useCallback(()=>{var N;st(!1),_(""),Lt(0),(N=fe.current)==null||N.focus()},[]),Aa=S.useCallback(()=>{const N=fe.current;if(!N||typeof window>"u")return;const re=Pa=>{const Lr=Pa+Ho,sr=Math.max(Pa-Ho,0);N.style.paddingTop=`${Lr}px`,N.style.paddingBottom=`${sr}px`,fs({top:Lr,bottom:sr})},Ne=window.getComputedStyle(N),Fe=parseFloat(Ne.lineHeight||"0");if(!Number.isNaN(Fe)&&Fe>0?An(Pa=>Pa===Fe?Pa:Fe):An(Pa=>Pa===null?Pa:null),!Fe||Number.isNaN(Fe)){re(qo);return}const ot=N.scrollHeight,ta=N.clientHeight;if(ot>Fe+2){re(qo);return}const nt=Math.max(ta-Fe,0),Xn=Math.max(nt/2,0);re(Xn)},[]),kl=()=>{const N=fe.current;return N?N.selectionStart===N.selectionEnd&&N.selectionStart===k.length:!1},xi=(be==null?void 0:be.attachedFiles)||[],ga=Qe?xi:C,gc=ua.reduce((N,re)=>{var Ne;return N+(((Ne=re.attachedFiles)==null?void 0:Ne.length)||0)},0),yi=Re.maxFilesPerConversation!==null&&Re.maxFilesPerConversation>0&&xi.length>=Re.maxFilesPerConversation,vi=Re.maxTotalFiles!==null&&gc>=Re.maxTotalFiles,Fn=((Tl=be==null?void 0:be.adapterInfo)==null?void 0:Tl.isFileSupported)??!1,Si=ga.some(N=>N.processing_status?N.processing_status!=="completed"&&N.processing_status!=="error"&&N.processing_status!=="failed":!0),ba=Qe?!!U[Qe]:!1,Bn=Object.values(U).some(Boolean),Va=k.trim().length>0,_r=Ys||fa,Nt=n||Si||ba||_r,qn=kt&&Fn,gn=yi||vi,xs=!qn||Nt||gn;S.useLayoutEffect(()=>{if(fe.current){const N=fe.current,re=120;N.style.height="auto";const Ne=N.scrollHeight;N.style.height=`${Math.min(Ne,re)}px`,N.style.overflowY=Ne>re?"auto":"hidden",Aa()}},[k,Aa]),S.useEffect(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;const N=fe.current;if(!N)return;const re=new ResizeObserver(()=>{Aa()});return re.observe(N),()=>{re.disconnect()}},[Aa]);const Cr=()=>{const N=document.activeElement;return N&&N.tagName==="TEXTAREA"},Ws=S.useCallback(()=>!o||typeof window>"u"?!1:window.matchMedia("(max-width: 767px)").matches,[o]);S.useEffect(()=>{Ws()||l&&!Nt&&fe.current&&!Cr()&&fe.current.focus()},[l,Nt,o,Ws]);const Hn=S.useRef($a);S.useEffect(()=>{if(Ws()){Hn.current=$a;return}l&&Hn.current&&!$a&&!Nt&&fe.current&&setTimeout(()=>{fe.current&&!Cr()&&fe.current.focus()},100),Hn.current=$a},[l,$a,Nt,o,Ws]),S.useEffect(()=>{if(!Ut||(ze>Ue.current&&(we.current=!0,Ue.current=ze),!we.current||ze===0))return;const N=pe.current.trim(),re=Ye.getState();if(se("[MessageInput] Auto-send check after voice completion:",{hasMessage:!!N,isInputDisabled:Nt,isComposing:j,isLoading:re.isLoading}),we.current=!1,!N)return;if(Nt||j){se("[MessageInput] Auto-send skipped because input is currently disabled or composing");return}const Ne=re.conversations.find(gt=>gt.id===re.currentConversationId),ot=((Ne==null?void 0:Ne.attachedFiles)||[]).map(gt=>gt.file_id),ta=Xt==null?void 0:Xt.name;se("[MessageInput] Auto-sending voice message immediately:",N),i(N,ot.length>0?ot:void 0,void 0,ta),ta&&Ia(),setTimeout(()=>{st(!1)},0),Ba(),setTimeout(()=>{_("")},0),pe.current="",fe.current&&(fe.current.style.height="auto",fe.current.style.overflowY="hidden",Aa())},[Ut,ze,Nt,j,i,Xt,Ia,Aa,Ba]),S.useEffect(()=>{ba&&H&&setTimeout(()=>{F(!1)},0)},[ba,H]),S.useEffect(()=>{!ba&&ga.length},[ba,H,ga.length]);const _a=S.useCallback((N,re)=>{setTimeout(()=>{let Ne=Ye.getState(),Fe=re||Ne.currentConversationId;if(Fe||(Fe=Rt(),Ne=Ye.getState(),Fe=Ne.currentConversationId||Fe),!Fe){Ve("[MessageInput] Unable to sync files: conversation ID missing");return}const ot=new Set(N.map(gt=>gt.file_id)),ta=[];ce.current.forEach((gt,nt)=>{const[,...Xn]=nt.split("-"),Pa=Xn.join("-");ot.has(Pa)||ta.push(nt)}),ta.forEach(gt=>ce.current.delete(gt)),N.forEach(gt=>{const nt=`${Fe}-${gt.file_id}`;ce.current.has(nt)||(ce.current.add(nt),se(`[MessageInput] Adding file ${gt.file_id} to conversation ${Fe}`),Ne.addFileToConversation(Fe,gt))})},0)},[Rt]);S.useEffect(()=>{if(Qe!==Ce.current)if(Ce.current=Qe||null,Qe&&be){const N=be.attachedFiles||[];setTimeout(()=>{Q(N.map(re=>({...re})))},0)}else setTimeout(()=>{Q([])},0)},[Qe,be]),S.useEffect(()=>{if(Qe&&be){const N=be.attachedFiles||[];N.length>0?setTimeout(()=>{Q(re=>{const Ne=new Set(re.map(ot=>ot.file_id)),Fe=N.filter(ot=>!Ne.has(ot.file_id));return Fe.length>0?(se(`[MessageInput] Syncing ${Fe.length} missing files from conversation to UI`),[...re,...Fe]):re})},0):N.length===0&&C.length>0&&setTimeout(()=>{Q([])},0)}},[Qe,be,ua,C.length]);const er=S.useRef(null),Vn=S.useRef(""),Ga=(be==null?void 0:be.attachedFiles)||[],ys=Ga.length>0?`${Ga.length}:${Ga.map(N=>N.file_id).join("|")}`:"",tr=Ga.some(N=>!N.processing_status||N.processing_status==="processing"||N.processing_status==="uploading");S.useEffect(()=>{if(!Qe||!(be!=null&&be.adapterName))return;const N=ys!=="";if(N&&(er.current!==Qe||Vn.current!==ys)?(se(`[MessageInput] Syncing files for conversation ${Qe}...`),er.current=Qe,Vn.current=ys,Te(Qe).catch(Fe=>{Ve("[MessageInput] Failed to sync conversation files:",Fe)})):N||(er.current=Qe,Vn.current=""),!tr)return;se("[MessageInput] Files still processing, starting poll...");const Ne=setInterval(async()=>{const ot=Ye.getState().conversations.find(nt=>nt.id===Qe);if(!ot){clearInterval(Ne);return}if((ot.attachedFiles||[]).filter(nt=>!nt.processing_status||nt.processing_status==="processing"||nt.processing_status==="uploading").length===0){se("[MessageInput] All files completed processing, stopping poll"),clearInterval(Ne);return}try{await Te(Qe)}catch(nt){Ve("[MessageInput] Failed to poll file status:",nt)}},3e3);return()=>{clearInterval(Ne)}},[Qe,be==null?void 0:be.adapterName,ys,tr,Te]),S.useEffect(()=>{setTimeout(()=>{Y(N=>{const re=new Set(ua.map(ot=>ot.id));let Ne=!1;const Fe={...N};return Object.keys(Fe).forEach(ot=>{re.has(ot)||(delete Fe[ot],Ne=!0)}),Ne?Fe:N})},0)},[ua]);const wi=N=>{if(N.preventDefault(),Va&&!Nt&&!j){Wt&&Cn();const Ne=((be==null?void 0:be.attachedFiles)||[]).map(ot=>ot.file_id),Fe=Xt==null?void 0:Xt.name;i(k.trim(),Ne.length>0?Ne:void 0,void 0,Fe),Fe&&Ia(),st(!1),dl("messageSent",he.soundEnabled),_(""),pe.current="",Q([]),F(!1),fe.current&&(fe.current.style.height="auto",fe.current.style.overflowY="hidden",Aa())}},Gn=S.useCallback(N=>{if(!N||N.length===0)return;const re=N.length===1?v("messageInput.uploadSuccess.single",{filename:N[0].filename}):v("messageInput.uploadSuccess.multiple",{count:N.length});dl("success",he.soundEnabled),oe(re),setTimeout(()=>{oe(null)},6e3)},[he.soundEnabled,v]),Tr=S.useCallback((N,re)=>{se(`[MessageInput] handleFilesSelected called with ${re.length} files for conversation ${N}:`,re),N&&(N===Qe&&Q(re),_a(re,N))},[Qe,_a]),Al=S.useCallback((N,re)=>{N===Qe&&Gn(re)},[Qe,Gn]),ma=S.useCallback(N=>{ye({isOpen:!0,fileId:N.file_id,filename:N.filename,isDeleting:!1})},[]),Pn=S.useCallback(()=>{ye(N=>N.isDeleting?N:{isOpen:!1,fileId:"",filename:"",isDeleting:!1})},[]),Nr=S.useCallback(async()=>{if(!(!Qe||!ee.fileId)){ye(N=>({...N,isDeleting:!0}));try{await dt(Qe,ee.fileId),Q(N=>N.filter(re=>re.file_id!==ee.fileId)),ye({isOpen:!1,fileId:"",filename:"",isDeleting:!1})}catch(N){const re=N instanceof Error?N.message:v("messageInput.fileRemoveFailed");Ve("[MessageInput] Failed to remove file:",N),ge(re),ye({isOpen:!1,fileId:"",filename:"",isDeleting:!1})}}},[Qe,ee.fileId,dt,v]),vs=S.useCallback(N=>N.replace(/\s+/g," ").trim(),[]),jr=S.useCallback(N=>{const re=vs(N);_(re),Ba(),qa(re),Zs(re)},[Ba,Zs,vs,qa]),ar=S.useCallback(N=>{if(N<0)return;const re=ha[N]||ha[0];re&&jr(re.text)},[ha,jr]),ki=N=>{if(Be){if(N.key==="ArrowDown"){N.preventDefault(),Lt(re=>Pe.length===0?0:(re+1)%Pe.length);return}if(N.key==="ArrowUp"){N.preventDefault(),Lt(re=>Pe.length===0?0:(re-1+Pe.length)%Pe.length);return}if(N.key==="Home"){N.preventDefault(),Lt(0);return}if(N.key==="End"){N.preventDefault(),Lt(Math.max(Pe.length-1,0));return}if((N.key==="Enter"&&!N.shiftKey||N.key==="Tab")&&_t){N.preventDefault(),kr(_t);return}if(N.key==="Escape"){N.preventDefault(),Ar();return}}if(Ha&&Js){if(N.key==="ArrowDown"){N.preventDefault(),Tn();return}if(N.key==="ArrowUp"){N.preventDefault(),Mt();return}if(N.key==="Tab"){N.preventDefault();const re=Qt>=0?Qt:0;ar(re);return}if(N.key==="ArrowRight"&&kl()){if(bi&&In){N.preventDefault(),jr(In.text);return}if(Qt>=0){N.preventDefault(),ar(Qt);return}}if(N.key==="Enter"&&Qt>=0){N.preventDefault(),ar(Qt);return}if(N.key==="Escape"){N.preventDefault(),Ba();return}}N.key==="Enter"&&!N.shiftKey&&!j&&(N.preventDefault(),wi(N))},nr=()=>{Wt?Cn():(Ba(),Qs())},Er=()=>{const N=!he.voiceEnabled;Me({voiceEnabled:N}),N&&Ps.enableAudio()},_l=S.useCallback(async N=>{if(!kt||!P||!Fn||Nt)return;const re=N.clipboardData;if(!re||!re.items)return;const Fe=Array.from(re.items).filter(gt=>gt.kind==="file");if(Fe.length===0)return;const ot=[];if(Fe.forEach((gt,nt)=>{const Xn=gt.getAsFile();Xn&&ot.push(US(Xn,nt))}),ot.length===0)return;N.preventDefault(),le(null),oe(null);let ta=null;try{const gt=Ye.getState(),nt=gt.conversations.find(xa=>xa.id===gt.currentConversationId);if(((nt==null?void 0:nt.attachedFiles)||[]).length+ot.length>Re.maxFilesPerConversation)throw ht&&Ra.getState().openLoginPrompt(v("fileUpload.maxFilesGuestLimitMessage",{count:Re.maxFilesPerConversation})),new Error(v("fileUpload.maxFilesPerConversationError",{count:Re.maxFilesPerConversation}));if(Re.maxTotalFiles!==null&>.conversations.reduce((tn,xn)=>{var aa;return tn+(((aa=xn.attachedFiles)==null?void 0:aa.length)||0)},0)+ot.length>Re.maxTotalFiles)throw ht&&Ra.getState().openLoginPrompt(v("fileUpload.maxTotalFilesGuestLimitMessage",{count:Re.maxTotalFiles})),new Error(v("fileUpload.maxTotalFilesError",{count:Re.maxTotalFiles}));if(!nt)throw new Error(v("messageInput.conversationNotFoundShort"));if(!nt.adapterName)throw new Error(v("fileUpload.adapterNotConfigured"));const Lr=Da(nt.apiUrl),sr=nt.adapterName;ta=nt.id,me(ta,!0);const rr=[],Nl=[];for(let xa=0;xa<ot.length;xa++){const tn=ot[xa],xn=tn.name||`Clipboard file ${xa+1}`,aa=`${xn}-${Date.now()}-${xa}`;ae(ya=>{const Ca=new Map(ya);return Ca.set(aa,{filename:xn,progress:0,status:"uploading"}),Ca});const vc=ya=>{ae(Ca=>{const Ta=new Map(Ca),Ss=Ta.get(aa);return Ss&&Ta.set(aa,{...Ss,filename:xn,progress:ya.progress,status:ya.status,fileId:ya.fileId}),Ta})},Sc=()=>new Promise(ya=>{ae(Ca=>{const Ta=new Map(Ca),Ss=Ta.get(aa);return Ss&&Ta.set(aa,{...Ss,progress:100,status:"completed"}),Ta}),setTimeout(()=>{ae(Ca=>{const Ta=new Map(Ca);return Ta.delete(aa),Ta}),ya()},2500)});se(`[MessageInput] Pasting file: ${tn.name}, type: ${tn.type||"unknown"}, size: ${tn.size}`);const wc=await vl.uploadFile(tn,ya=>{se(`[MessageInput] Paste upload progress for ${tn.name}: ${ya.progress}% - ${ya.status}`),vc(ya)},void 0,Lr,sr);rr.push(wc),Nl.push(Sc())}if(rr.length>0){let xa=rr;if(ta&&ta===Qe){const tn=new Set(C.map(aa=>aa.file_id)),xn=rr.filter(aa=>!tn.has(aa.file_id));xn.length>0?(Q(aa=>[...aa,...xn]),xa=xn):xa=[]}xa.length>0&&_a(xa,ta),await Promise.all(Nl),Gn(rr)}}catch(gt){const nt=gt instanceof Error?gt.message:"Failed to paste file";Ve("[MessageInput] Paste error:",gt),dl("error",he.soundEnabled),le(nt),nt.toLowerCase().includes("maximum")&&ge(nt),setTimeout(()=>{le(null)},5e3),ae(new Map)}finally{me(ta,!1)}},[C,Qe,P,Fn,ht,Nt,me,he.soundEnabled,Gn,_a,kt,v]),Cl=Dv(be==null?void 0:be.adapterName),bc=Si||ba?v("messageInput.placeholder.filesUploading"):Cl||(qn?v("messageInput.placeholder.messageOrbit"):r),Ai=fa?ht?v("messageInput.placeholder.guestLimitTotal",{count:Re.maxTotalMessages}):v("messageInput.placeholder.workspaceLimitTotal",{count:Re.maxTotalMessages}):Ys?ht?v("messageInput.placeholder.guestLimitPerConversation",{count:Re.maxMessagesPerConversation}):v("messageInput.placeholder.conversationLimitReached",{count:Re.maxMessagesPerConversation}):bc,bn=[];fa&&Re.maxTotalMessages!==null&&(ht?Jt&&bn.push(v("messageInput.limitWarning.guestTotalMessages",{count:Re.maxTotalMessages})):bn.push(v("messageInput.limitWarning.workspaceTotalMessages",{count:Re.maxTotalMessages}))),Ys&&Re.maxMessagesPerConversation!==null&&(ht?Jt&&bn.push(v("messageInput.limitWarning.guestPerConversation",{count:Re.maxMessagesPerConversation})):bn.push(v("messageInput.limitWarning.conversationLimitReached",{count:Re.maxMessagesPerConversation}))),de&&bn.push(de),S.useEffect(()=>{!pn||!mn||dl("error",he.soundEnabled)},[pn,he.soundEnabled,mn]),S.useEffect(()=>{if(!de)return;const N=setTimeout(()=>ge(null),5e3);return()=>clearTimeout(N)},[de]),S.useEffect(()=>{var N;(H||ba||J.size>0||Bn)&&((N=ke.current)==null||N.scrollIntoView({behavior:"smooth",block:"nearest"}))},[H,ba,J.size,Bn]),S.useEffect(()=>{var N;ne&&((N=Ee.current)==null||N.scrollIntoView({behavior:"smooth",block:"nearest"}))},[ne]),S.useEffect(()=>{var N;Be&&((N=Ze.current)==null||N.scrollIntoView({behavior:"smooth",block:"end"}))},[Be,Pe.length]);const xc=m,yc=u?"flex justify-center":"";return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:`bg-transparent px-2 py-1.5 md:bg-transparent md:px-0 md:pt-4 md:pb-2 md:dark:bg-transparent sm:px-4 ${yc}`,children:f.jsxs("div",{className:`mx-auto w-full ${xc}`,children:[mn&&pn&&f.jsxs("div",{role:"alert","aria-live":"assertive",className:"mb-2.5 w-full flex items-start gap-2.5 rounded-lg bg-red-50 dark:bg-red-950/40 px-3.5 py-2.5 animate-fadeIn",children:[f.jsx(Xo,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-red-500 dark:text-red-400"}),f.jsx("span",{className:"text-sm text-red-700 dark:text-red-300",children:mn})]}),V&&f.jsxs("div",{role:"alert","aria-live":"assertive",className:"mb-2.5 w-full flex items-start gap-2.5 rounded-lg bg-red-50 dark:bg-red-950/40 px-3.5 py-2.5 animate-fadeIn",children:[f.jsx(Xo,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-red-500 dark:text-red-400"}),f.jsx("span",{className:"text-sm text-red-700 dark:text-red-300",children:V})]}),ue&&f.jsxs("div",{role:"status","aria-live":"polite",className:"mb-2.5 w-full flex items-center gap-2.5 rounded-lg bg-gray-50 dark:bg-[#1f1f24] px-3.5 py-2.5 animate-fadeIn",children:[f.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-emerald-100 dark:bg-emerald-900/40",children:f.jsx(x1,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})}),f.jsx("span",{className:"text-sm text-[#353740] dark:text-[#ececf1]",children:ue})]}),bn.length>0&&f.jsxs("div",{role:"status","aria-live":"polite",className:"mb-2.5 w-full flex items-start gap-2.5 rounded-lg bg-amber-50 dark:bg-amber-950/30 px-3.5 py-2.5 animate-fadeIn",children:[f.jsx(af,{className:"h-4 w-4 mt-0.5 flex-shrink-0 text-amber-500 dark:text-amber-400"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("ul",{className:"list-none space-y-0.5",children:bn.map((N,re)=>f.jsx("li",{className:"text-sm text-amber-800 dark:text-amber-200",children:N},`${N}-${re}`))}),ht&&(_r||gn)&&Jt&&f.jsx("button",{type:"button",onClick:()=>Ra.getState().openLoginPrompt(v("messageInput.signInPrompt.message")),className:"mt-2 inline-flex items-center gap-1.5 rounded-md bg-[#353740] px-3 py-1.5 text-xs font-medium text-white hover:bg-[#40414f] dark:bg-white dark:text-[#353740] dark:hover:bg-gray-200 transition-colors",children:v("messageInput.signInPrompt.button")})]})]}),f.jsxs("div",{className:"relative w-full",children:[f.jsxs("form",{onSubmit:wi,className:"flex w-full flex-col gap-2 md:gap-3",children:[f.jsxs("div",{className:`flex flex-row items-center gap-1.5 md:gap-2 rounded-xl md:rounded-lg border px-2.5 py-1.5 md:px-4 md:py-3 shadow-sm transition-all ${P?"border-gray-400 shadow-md dark:border-[#3a3a3a] dark:shadow-lg":"border-gray-300 dark:border-[#242424]"} bg-gray-50 dark:bg-[#111111]`,children:[Xt&&f.jsxs("div",{className:"flex h-8 max-w-[45%] shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs text-gray-700 shadow-sm dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-200 sm:max-w-[38%] md:max-w-[32%]",children:[f.jsx(tf,{className:"h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":"true"}),f.jsx("span",{className:"min-w-0 truncate font-medium capitalize",children:Xt.name.replace(/-/g," ")}),f.jsx("button",{type:"button",onClick:()=>{var N;Ia(),(N=fe.current)==null||N.focus()},className:"-mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-gray-100 dark:focus-visible:ring-gray-600","aria-label":v("messageInput.selectedSkill.removeAriaLabel"),children:f.jsx(wa,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),!Xt&&hn.length>0&&k.length===0&&!Nt&&f.jsxs("button",{type:"button",onClick:wl,className:"flex h-8 shrink-0 items-center gap-1.5 self-center rounded-full border border-gray-300 bg-white px-2.5 text-xs font-medium text-gray-600 shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:border-[#3a3a3a] dark:bg-[#1a1a1a] dark:text-gray-300 dark:hover:bg-white/10 dark:hover:text-gray-100 dark:focus-visible:ring-gray-600","aria-label":v("messageInput.skillsHint.ariaLabel"),title:v("messageInput.skillsHint.title"),children:[f.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded bg-gray-200 font-mono text-[10px] leading-none text-gray-600 dark:bg-[#2a2a2a] dark:text-gray-300","aria-hidden":"true",children:"/"}),v("messageInput.skillsHint.text")]}),f.jsxs("div",{className:"relative flex-1 w-full min-w-0",children:[hc&&Ai&&f.jsx("div",{className:"pointer-events-none absolute inset-0 truncate whitespace-nowrap text-base md:text-sm text-gray-500 dark:text-[#8e8ea0]",style:{paddingTop:Math.max(ca.top-ES,0),paddingBottom:ca.bottom,paddingLeft:`${Td}px`,paddingRight:0,lineHeight:Oa?`${Oa}px`:void 0},"aria-hidden":"true",children:Ai}),bs&&P&&f.jsxs("div",{className:"pointer-events-none absolute inset-0 whitespace-pre-wrap text-base md:text-sm text-gray-400 dark:text-[#8e8ea0]",style:{paddingTop:Math.max(ca.top-LS,0),paddingBottom:ca.bottom,paddingLeft:`${Td}px`,paddingRight:0,lineHeight:Oa?`${Oa}px`:void 0},"aria-hidden":"true",children:[f.jsx("span",{className:"invisible",children:k}),f.jsx("span",{children:bs})]}),f.jsx("textarea",{ref:fe,"aria-label":v("messageInput.textarea.ariaLabel"),value:k,onChange:N=>{const re=N.target.value;_(re),re.startsWith("/")&&Lt(0),st(re.startsWith("/")&&hn.length>0)},onKeyDown:ki,onPaste:_l,onCompositionStart:()=>R(!0),onCompositionEnd:()=>R(!1),onFocus:()=>z(!0),onBlur:()=>z(!1),placeholder:Ai,disabled:Nt,rows:1,maxLength:Re.maxMessageLength,className:"relative z-10 flex-1 w-full min-w-0 resize-none bg-transparent py-0 text-base md:text-sm text-[#353740] placeholder-transparent focus:outline-none dark:text-[#ececf1] dark:placeholder-transparent",style:{minHeight:"24px",maxHeight:"120px",paddingTop:`${ca.top}px`,paddingBottom:`${ca.bottom}px`,paddingLeft:`${Td}px`,paddingRight:0,border:"none",outline:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none",appearance:"none",caretColor:k.trim()||P?"inherit":"transparent"}})]}),f.jsxs("div",{className:"flex items-center justify-end gap-1 md:gap-2 flex-shrink-0",children:[f.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[u&&!kt&&f.jsx("div",{className:"hidden md:block h-8 w-8 shrink-0","aria-hidden":"true"}),kt&&f.jsx("button",{type:"button",onClick:N=>{N.preventDefault(),xs||F(!H)},disabled:xs,onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${H||ga.length>0?"bg-gray-200 text-[#353740] dark:bg-[#565869] dark:text-[#ececf1]":xs?"cursor-not-allowed text-gray-300 dark:text-[#6b6f7a]":"text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]"}`,title:Fn?gn&&yi&&Re.maxFilesPerConversation!==null?v("messageInput.fileUpload.titleLimitPerConversation",{count:Re.maxFilesPerConversation}):gn&&vi&&Re.maxTotalFiles!==null?v("messageInput.fileUpload.titleLimitWorkspace",{count:Re.maxTotalFiles}):Nt?v("messageInput.fileUpload.titleUploading"):ga.length>0?v("messageInput.fileUpload.titleAttached",{count:ga.length}):v("messageInput.fileUpload.attachAriaLabel"):v("messageInput.fileUpload.titleNotSupported"),"aria-label":v("messageInput.fileUpload.attachAriaLabel"),children:xs&&ie?f.jsx(wa,{className:"h-4 w-4"}):f.jsx(U1,{className:"h-4 w-4"})}),k.length>0&&f.jsx("div",{className:"hidden md:block px-2 text-xs text-gray-500 dark:text-[#bfc2cd] md:min-w-[72px] md:text-right",children:f.jsxs("span",{className:k.length>=Re.maxMessageLength?"text-red-600 font-semibold":"",children:[k.length,"/",Re.maxMessageLength]})})]}),f.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[f.jsx(C0,{availableModels:b,defaultModel:y,selectedModel:x,onSelect:N=>w==null?void 0:w(N)}),(ps||pn)&&f.jsxs(f.Fragment,{children:[ps&&f.jsx("button",{type:"button",onClick:Er,className:`hidden md:flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${he.voiceEnabled?"bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-300":"text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]"}`,title:he.voiceEnabled?v("messageInput.voiceOutput.titleEnabled"):v("messageInput.voiceOutput.titleDisabled"),"aria-label":he.voiceEnabled?v("messageInput.voiceOutput.ariaLabelEnabled"):v("messageInput.voiceOutput.ariaLabelDisabled"),children:he.voiceEnabled?f.jsx(ec,{className:"h-5 w-5"}):f.jsx(Y1,{className:"h-5 w-5"})}),Ut&&f.jsx("button",{type:"button",onClick:nr,disabled:Nt,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),className:`hidden md:flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${Wt?"!flex bg-red-100 text-red-600 dark:bg-red-900/40 dark:text-red-300":Nt?"cursor-not-allowed text-gray-300 dark:text-[#6b6f7a]":"text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]"}`,title:v(Nt?"messageInput.voiceInput.titleUploading":Wt?"messageInput.voiceInput.titleListening":"messageInput.voiceInput.titleDisabled"),"aria-label":v(Wt?"messageInput.voiceInput.ariaLabelListening":"messageInput.voiceInput.ariaLabelDisabled"),children:Wt||Nt&&E?f.jsx(E1,{className:"h-5 w-5"}):f.jsx(L1,{className:"h-5 w-5"})})]}),p&&f.jsx("button",{type:"button",onClick:()=>B(!0),className:"hidden md:flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 text-gray-500 hover:bg-gray-200 hover:text-[#353740] dark:text-[#bfc2cd] dark:hover:bg-[#565869]",title:v("messageInput.agentInfo.title"),"aria-label":v("messageInput.agentInfo.ariaLabel"),children:f.jsx(ng,{className:"h-5 w-5"})}),(Si||ba)&&f.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:f.jsx(Yo,{className:"h-4 w-4 animate-spin text-gray-500 dark:text-[#bfc2cd]"})}),$a?f.jsx("button",{type:"button",onClick:N=>{N.preventDefault(),Ke()},className:"flex h-9 w-9 md:h-8 md:w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 bg-red-500 text-white hover:bg-red-600 dark:bg-red-600 dark:hover:bg-red-700",title:v("messageInput.stop.title"),"aria-label":v("messageInput.stop.ariaLabel"),children:f.jsx(V1,{className:"h-4 w-4 md:h-3 md:w-3 fill-current"})}):f.jsx("button",{type:"submit",disabled:!Va||Nt||j,className:`flex h-9 w-9 md:h-8 md:w-8 shrink-0 items-center justify-center rounded-full transition-all active:scale-95 ${Va&&!Nt&&!j?"bg-black text-white hover:bg-gray-800 dark:bg-white dark:text-black dark:hover:bg-gray-200":"bg-gray-300 text-gray-500 dark:bg-[#565869] dark:text-[#6b6f7a]"}`,title:v("messageInput.submit.title"),"aria-label":v("messageInput.submit.ariaLabel"),children:f.jsx(Id,{className:"h-4 w-4"})})]})]})]}),ga.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2",children:ga.map(N=>{const re=!N.processing_status||N.processing_status==="processing"||N.processing_status==="uploading",Ne=N.processing_status==="failed"||N.processing_status==="error";return f.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-2 py-1 text-xs ${Ne?"border-red-200 bg-red-50 dark:border-red-800/50 dark:bg-red-950/30":"border-gray-200 bg-white dark:border-[#4a4b54] dark:bg-[#2d2f39]"}`,title:Ne?N.error_message||v("messageInput.fileProcessingFailedTitle"):void 0,children:[re&&f.jsx(Yo,{className:"h-3 w-3 animate-spin text-blue-500 dark:text-blue-400 flex-shrink-0"}),Ne&&f.jsx(Xo,{className:"h-3 w-3 text-red-500 dark:text-red-400 flex-shrink-0"}),f.jsx("span",{className:`truncate max-w-[150px] ${Ne?"text-red-700 dark:text-red-300":"text-[#353740] dark:text-[#ececf1]"}`,children:N.filename}),re&&f.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:N.processing_status==="uploading"?v("messageInput.attachedFile.uploadingStatus"):v("messageInput.attachedFile.processingStatus")}),Ne&&f.jsx("span",{className:"text-xs text-red-500 dark:text-red-400",children:v("messageInput.attachedFile.failedStatus")}),f.jsx("button",{type:"button",onClick:()=>{Ne?(Qe&&dt(Qe,N.file_id),Q(Fe=>Fe.filter(ot=>ot.file_id!==N.file_id))):ma(N)},className:"rounded p-2 md:p-0.5 text-gray-500 transition-colors hover:bg-red-50 hover:text-red-600 dark:text-[#bfc2cd] dark:hover:bg-red-900/30 dark:hover:text-red-300",title:v(Ne?"messageInput.attachedFile.removeTitleFailed":"messageInput.attachedFile.removeTitleNormal"),children:f.jsx(wa,{className:"h-4 w-4 md:h-3 md:w-3"})})]},N.file_id)})}),kt&&(Fn||Bn)&&f.jsxs("div",{ref:ke,className:`rounded-lg border border-gray-200/80 bg-white p-2.5 dark:border-[#3c3f4a] dark:bg-[#2a2b32] transition-all duration-200 ${!H&&!ba&&J.size===0&&!Bn?"hidden":""}`,children:[H&&f.jsxs("div",{className:"mb-2 flex items-center justify-between px-1",children:[f.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-[#8e8ea0] uppercase tracking-wider",children:v("messageInput.uploadPanel.headingAttach")}),f.jsx("button",{type:"button",onClick:()=>F(!1),className:"flex h-6 w-6 items-center justify-center rounded-md text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:text-[#6b6f7a] dark:hover:bg-[#3c3f4a] dark:hover:text-[#bfc2cd] transition-colors",title:v("messageInput.uploadPanel.closeTitle"),children:f.jsx(wa,{className:"h-3.5 w-3.5"})})]}),(ba||J.size>0)&&!H&&J.size===0&&f.jsx("div",{className:"mb-2 px-1",children:f.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-[#8e8ea0] uppercase tracking-wider",children:v("messageInput.uploadPanel.headingUploading")})}),J.size>0&&f.jsx("div",{className:"mb-2 space-y-1.5",children:Array.from(J.entries()).map(([N,re])=>f.jsxs("div",{className:"group relative w-full flex items-center gap-3 rounded-lg px-3 py-2.5 bg-gray-50 dark:bg-[#1f1f24] overflow-hidden transition-colors",children:[f.jsx("div",{className:"absolute inset-0 bg-blue-50 dark:bg-blue-900/15 transition-all duration-500 ease-out rounded-lg",style:{width:`${re.progress??0}%`}}),f.jsxs("div",{className:"relative flex items-center gap-3 w-full min-w-0",children:[f.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-blue-100 dark:bg-blue-900/30",children:f.jsx(Yo,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 animate-spin"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("p",{className:"text-sm font-medium text-[#353740] dark:text-[#ececf1] truncate",children:re.filename}),f.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[f.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-[#3c3f4a] rounded-full h-1",children:f.jsx("div",{className:"bg-blue-500 dark:bg-blue-400 h-1 rounded-full transition-all duration-500 ease-out",style:{width:`${re.progress??0}%`}})}),f.jsxs("span",{className:"text-[11px] tabular-nums text-gray-400 dark:text-[#8e8ea0] shrink-0",children:[Math.round(re.progress??0),"%"]})]})]}),f.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-[#bfc2cd] shrink-0",children:re.status==="uploading"?v("messageInput.uploadProgress.statusUploading"):re.status==="processing"?v("messageInput.uploadProgress.statusProcessing"):re.status==="completed"?v("messageInput.uploadProgress.statusCompleted"):v("messageInput.uploadProgress.statusPending")})]})]},N))}),f.jsx("div",{className:`${H||ba?"block max-h-[40vh] overflow-y-auto":"hidden"}`,"aria-hidden":!(H||ba),children:f.jsx(jS,{conversationId:Qe,onFilesSelected:Tr,onUploadError:N=>{Ve("File upload error:",N),ge(N)},onUploadingChange:me,onUploadSuccess:Al,maxFiles:Re.maxFilesPerConversation,disabled:xs})})]}),f.jsx("div",{className:"h-3 md:h-1",children:Ut&&Wt&&f.jsxs("span",{className:"flex items-center gap-2 text-sm md:text-xs text-gray-500 dark:text-[#bfc2cd]",children:[f.jsx("span",{className:"h-2.5 w-2.5 md:h-2 md:w-2 animate-pulse rounded-full bg-red-500"}),v("messageInput.listeningIndicator")]})})]}),Be&&f.jsx("div",{ref:Ze,className:"w-full pt-1",children:f.jsx(_0,{skills:hn,isLoading:gi,selectedSkill:Xt,activeSkillName:_t==null?void 0:_t.name,query:Ie,onActiveSkillChange:N=>{const re=Pe.findIndex(Ne=>Ne.name===N.name);re>=0&&Lt(re)},onSelect:kr,onClose:Ar})}),ne&&f.jsx("div",{ref:Ee,role:"listbox","aria-label":v("messageInput.autocompletePanel.ariaLabel"),className:"w-full pt-1",children:ha.map((N,re)=>{const Ne=re===Qt;return f.jsx("button",{type:"button",role:"option","aria-selected":Ne,className:`flex w-full items-center gap-3 px-3 py-3 md:py-2.5 text-left text-[15px] md:text-sm transition-colors ${Ne?"bg-gray-100 dark:bg-[#2d2f39]":"hover:bg-gray-50 dark:hover:bg-[#2d2f39]/60"}`,onClick:()=>jr(N.text),onMouseEnter:()=>Fa(re),children:ka(N.text)},re)})}),f.jsx(ac,{isOpen:ee.isOpen,onClose:Pn,onConfirm:Nr,title:v("messageInput.fileDelete.title"),message:v("messageInput.fileDelete.message",{filename:ee.filename}),confirmText:v("messageInput.fileDelete.confirmText"),cancelText:v("common.cancel"),type:"danger",isLoading:ee.isDeleting})]})]})}),M&&p&&typeof document<"u"&&dc.createPortal(f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black/60 p-4 backdrop-blur-sm animate-fadeIn",children:f.jsxs("div",{ref:ve,role:"dialog","aria-modal":"true","aria-labelledby":"agent-info-title",tabIndex:-1,className:"w-full max-w-2xl max-h-[calc(100vh-2rem)] overflow-y-auto rounded-2xl bg-white shadow-2xl transform animate-fadeIn dark:bg-[#1a1b1e]",children:[f.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-[#2d2f39]",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/20 flex items-center justify-center",children:f.jsx(ng,{className:"w-5 h-5 text-blue-500"})}),f.jsx("h2",{id:"agent-info-title",className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:v("messageInput.agentInfoModal.title")})]}),f.jsx("button",{type:"button",onClick:()=>B(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-[#25262f] rounded-lg transition-colors","aria-label":v("messageInput.agentInfoModal.closeAriaLabel"),children:f.jsx(wa,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),f.jsx("div",{className:"p-6",children:f.jsx(ds,{content:p,className:`message-markdown w-full min-w-0 prose prose-slate dark:prose-invert max-w-none text-sm leading-relaxed text-[#434654] dark:text-[#d7dae3] [&>:first-child]:mt-0 [&>:last-child]:mb-0 ${wt}`,syntaxTheme:ut})}),f.jsx("div",{className:"flex items-center justify-end p-6 border-t border-gray-200 dark:border-[#2d2f39] bg-gray-50 dark:bg-[#111113] rounded-b-2xl",children:f.jsx("button",{type:"button",onClick:()=>B(!1),className:"px-4 py-3 md:py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium shadow-sm hover:shadow-md",children:v("messageInput.agentInfoModal.confirmButton")})})]})}),document.body)]})}function jg({adapter:i,onSelect:n}){var p;const{t:r}=pt(),l=(p=i.description)==null?void 0:p.trim(),{isDark:o}=mi(),u=o?"dark":"light",m=()=>n(i);return f.jsxs("div",{tabIndex:0,role:"button","data-agent-card":"true",onClick:m,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),m())},className:"group relative flex w-full cursor-pointer flex-col rounded-2xl border border-slate-200 bg-white px-4 py-3.5 text-left shadow-sm transition-colors duration-150 hover:border-slate-300 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 dark:border-[#242424] dark:bg-[#080808] dark:hover:border-[#333333] dark:hover:bg-[#111111] dark:focus-visible:ring-sky-400/30 md:px-5 md:py-4",children:[f.jsx("div",{className:"relative",children:f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:"truncate text-[15px] font-semibold text-sky-900 dark:text-sky-300 md:text-base",children:i.name}),l?f.jsx("div",{className:"mt-1 text-sm leading-5 text-slate-600 dark:text-slate-300",children:f.jsx(ds,{content:l,className:"prose prose-slate max-w-none text-inherit dark:prose-invert [&>*]:mb-0 [&>*]:mt-0 [&_p]:overflow-hidden [&_p]:text-ellipsis [&_p]:[display:-webkit-box] [&_p]:[-webkit-box-orient:vertical] [&_p]:[-webkit-line-clamp:4]",syntaxTheme:u})}):f.jsx("p",{className:"mt-1 text-sm leading-5 text-slate-500 dark:text-slate-400",children:r("agentCard.configureMessage")})]}),f.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),m()},className:"hidden h-8 w-8 flex-shrink-0 items-center justify-center self-start rounded-full text-slate-700 transition-all duration-150 hover:bg-slate-100 group-hover:translate-x-0.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 dark:text-slate-200 dark:hover:bg-white/10 dark:focus-visible:ring-sky-400/30 md:inline-flex","aria-label":r("agentCard.startConversationAriaLabel",{name:i.name}),children:f.jsx(ag,{className:"h-4 w-4","aria-hidden":"true"})})]})})}),f.jsx("div",{className:"mt-3 flex items-center justify-end gap-3 border-t border-slate-200 pt-2.5 text-xs text-slate-500 dark:border-white/10 dark:text-slate-400 md:hidden",children:f.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),m()},className:"inline-flex h-8 w-8 items-center justify-center rounded-full text-slate-700 transition-all duration-150 hover:bg-slate-100 group-hover:translate-x-0.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/30 dark:text-slate-200 dark:hover:bg-white/10 dark:focus-visible:ring-sky-400/30","aria-label":r("agentCard.startConversationAriaLabel",{name:i.name}),children:f.jsx(ag,{className:"h-4 w-4","aria-hidden":"true"})})})]})}const Sr=i=>{if(typeof i!="string")return;const n=i.trim();return n.length>0?n:void 0},$S=i=>{if(!i||typeof i!="object")return null;const n=i,r=Sr(n.name);if(!r)return null;const l=Sr(n.id);if(!l)return console.warn(`[middlewareConfig] Adapter "${r}" is missing a required 'id' field — skipping.`),null;const o=Sr(n.apiUrl),u=Sr(n.model),m=Sr(n.inputPlaceholder),p=typeof n.notes=="string"?n.notes.trim():void 0;let h=Sr(n.description)||Sr(n.summary);if(!h&&typeof p=="string"){const y=p.split(/\r?\n/).find(x=>x.trim().length>0);h=y?y.trim():void 0}const b={id:l,name:r};return o&&(b.apiUrl=o),h&&(b.description=h),p&&(b.notes=p),u&&(b.model=u),m&&(b.inputPlaceholder=m),b},N0=i=>Array.isArray(i)?i.map($S).filter(n=>n!==null):[];let Gs=null,Nd=0;const IS=3e4;function FS(){if(typeof window<"u"){const i=window.ORBIT_CHAT_CONFIG;if(i!=null&&i.adapters&&Array.isArray(i.adapters)){se("Loading adapters from window.ORBIT_CHAT_CONFIG");const n=N0(i.adapters);if(n.length===0)return null;const r=`{
|
|
351
|
+
"simple-chat": "default-key",
|
|
352
|
+
"web-search": "orbit_XfxmYoTZgnp7zoMTKsIBfMBuYwj6U21P",
|
|
353
|
+
"chat-with-files": "multimodal",
|
|
354
|
+
"hr-db-chatbot": "human-resources",
|
|
355
|
+
"intent-sql-sqlite-classified": "classified",
|
|
356
|
+
"ecomm-analytics": "analytical",
|
|
357
|
+
"intent-duckdb-ev-population": "electric-vehicle",
|
|
358
|
+
"intent-http-jsonplaceholder": "rest-json-api",
|
|
359
|
+
"intent-http-paris-opendata": "paris-opendata",
|
|
360
|
+
"intent-mongodb-mflix": "mongodb-mflix",
|
|
361
|
+
"intent-graphql-spacex": "graphql-spacex",
|
|
362
|
+
"intent-sql-postgres": "postgres-customer-orders",
|
|
363
|
+
"open-ai-real-time-voice-chat": "open-ai-real-time-voice-chat",
|
|
364
|
+
"composite-multi-source-explorer": "composite-multi-source-explorer",
|
|
365
|
+
"math-teacher-quadratic": "math-teacher-trig-identities",
|
|
366
|
+
"qa-sql": "orbit_g6QuN5sPUh3fI2v0njoOJroXbAh1ILGP",
|
|
367
|
+
"qa-vector-chroma": "orbit_Rxm90sh85f8l5bzOLJpqpMUP9HcoNAX3",
|
|
368
|
+
"image-generator": "orbit_bZQ0h6kvpTphfCr9QgrCP13dkVclAsKQ",
|
|
369
|
+
"video-generator": "orbit_9P1vnx1GNMvVNyNCKF71VvVvcYx9duuo",
|
|
370
|
+
"intent-elasticsearch-log": "orbit_Ghpo8Q9mRdvVIODdw97ht7lBPpYBAzb6",
|
|
371
|
+
"audio-transcription": "orbit_RTBIwFoB6DA2mBuuHfnKf0xabwE6XKs2",
|
|
372
|
+
"voice-chat": "orbit_WjrkTqVjHE7mBa2ri8sAjENEVnLT9wbO",
|
|
373
|
+
"real-time-voice-chat": "orbit_xkvziKTXpZ1ufHWKg76pUDPbMDBRSRqC",
|
|
374
|
+
"tender-notices": "tender-notices",
|
|
375
|
+
"award-notices": "award-notices",
|
|
376
|
+
"contract-history": "contract-history",
|
|
377
|
+
"standing-offers": "standing-offers"
|
|
378
|
+
}`;if(!r.trim())return[];try{const l=JSON.parse(r),o=new Set(Object.entries(l).filter(([,u])=>{if(typeof u=="string")return u.trim().length>0;if(u&&typeof u=="object"){const m=u;if(typeof m.apiKey=="string"&&m.apiKey.trim().length>0||typeof m.key=="string"&&m.key.trim().length>0)return!0}return!1}).map(([u])=>u));return n.filter(u=>o.has(u.id))}catch{return[]}}}return null}async function rf(){if(Gs&&Date.now()-Nd<IS)return Gs;try{const n=await fetch("/api/adapters?refresh=1",{cache:"no-store",headers:{"Cache-Control":"no-cache"}});if(n.ok){const r=await n.json(),l=N0(r.adapters);if(l.length>0)return Gs=l,Nd=Date.now(),se("Fetched adapters from /api/adapters:",Gs),Gs;se("/api/adapters response did not contain valid adapters, trying fallback")}se(`/api/adapters returned ${n.status}, trying fallback`)}catch(n){se("Could not fetch from /api/adapters, trying fallback:",n)}const i=FS();if(i&&i.length>0)return Gs=i,Nd=Date.now(),se("Loaded adapters from config:",Gs),Gs;throw Ve("No adapters available from API or config"),new Error("No adapters available. Define adapters in orbitchat.yaml and provide matching ids in VITE_ADAPTER_KEYS.")}const BS="h-[96px]";function qS({onAdapterSelect:i,className:n="",title:r="",subtitle:l="",eyebrow:o=""}){const{t:u}=pt(),[m,p]=S.useState([]),[h,b]=S.useState(!0),[y,x]=S.useState(null),w=S.useRef(null),v=S.useRef(null),[k,_]=S.useState(""),[j,R]=S.useState(!1),P=S.useCallback(()=>{const G=w.current;if(!G){R(!1);return}R(G.scrollHeight-G.scrollTop-G.clientHeight>20)},[]),z=()=>typeof window<"u"&&window.matchMedia("(min-width: 768px)").matches,M=()=>{var G;return Array.from(((G=w.current)==null?void 0:G.querySelectorAll('[data-agent-card="true"]'))??[])},B=G=>{const I=M()[G]??null;I&&(I.focus(),I.scrollIntoView({block:"nearest"}))},H=()=>{B(0)},F=()=>{const G=M();G.length!==0&&B(G.length-1)},C=G=>{if(!h&&!y&&Y.length>0&&z()){if(G.key==="Tab"&&!G.shiftKey){G.preventDefault(),H();return}if(G.key==="ArrowDown"){G.preventDefault(),H();return}G.key==="ArrowUp"&&(G.preventDefault(),F())}},Q=G=>{var le;if(!J||!z()||G.key!=="ArrowDown"&&G.key!=="ArrowUp")return;const E=document.activeElement;if(!(E instanceof HTMLElement)||E.dataset.agentCard!=="true")return;const I=M(),V=I.indexOf(E);if(V!==-1){if(G.preventDefault(),G.key==="ArrowDown"){B((V+1)%I.length);return}if(V===0){(le=v.current)==null||le.focus();return}B(V-1)}},U=k.trim().toLowerCase(),Y=U?m.filter(G=>{var le,ue;const E=G.name.toLowerCase().includes(U),I=((le=G.description)==null?void 0:le.toLowerCase().includes(U))??!1,V=((ue=G.model)==null?void 0:ue.toLowerCase().includes(U))??!1;return E||I||V}):m,J=k.trim().length>0,ae=J||Y.length===1;S.useEffect(()=>{const G=w.current;if(G)return P(),G.addEventListener("scroll",P,{passive:!0}),()=>G.removeEventListener("scroll",P)},[P,Y]),S.useEffect(()=>{let G=!0;return(async()=>{try{b(!0),x(null);const V=(await rf()).slice().sort((le,ue)=>le.name.localeCompare(ue.name,void 0,{sensitivity:"base"}));G&&p(V)}catch(I){Ve("[AgentSelectionList] Failed to load adapters",I),G&&x(u("agentSelectionList.unableToLoad"))}finally{G&&b(!1)}})(),()=>{G=!1}},[u]),S.useEffect(()=>{var G;h||y||m.length===0||(G=v.current)==null||G.focus()},[h,y,m.length]);const ie=()=>h?f.jsx("div",{className:"grid gap-4",children:Array.from({length:3}).map((G,E)=>f.jsx("div",{className:`${BS} animate-pulse rounded-2xl border border-gray-200 bg-transparent dark:border-[#3b3c49]`},E))}):y?f.jsx("div",{className:"rounded-2xl border border-red-200 bg-transparent px-4 py-6 text-sm text-red-700 dark:border-red-900 dark:text-red-200",children:y}):m.length===0?f.jsx("div",{className:"rounded-2xl border border-gray-200 bg-transparent px-4 py-6 text-sm text-gray-600 dark:border-[#3b3c49] dark:text-gray-300",children:u("agentSelectionList.noAgentsAvailable")}):Y.length===0?f.jsx("div",{className:"rounded-2xl border border-gray-200 bg-transparent px-4 py-6 text-sm text-gray-600 dark:border-[#3b3c49] dark:text-gray-300",children:u("agentSelectionList.noSearchResults")}):f.jsxs("div",{className:"relative flex flex-col h-full min-h-0",children:[f.jsx("div",{ref:w,onKeyDown:Q,className:"agent-selection-scroll flex-1 min-h-0 overflow-y-auto pr-1 pb-2",children:ae?f.jsx("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-3 lg:max-w-2xl",children:Y.map(G=>f.jsx(jg,{adapter:G,onSelect:E=>i(E.id)},G.id))}):f.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:Y.map(G=>f.jsx(jg,{adapter:G,onSelect:E=>i(E.id)},G.id))})}),j&&f.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-12 md:hidden bg-gradient-to-t from-white dark:from-[#212121] to-transparent","aria-hidden":"true"})]});return f.jsxs("div",{className:`flex w-full flex-col gap-4 md:gap-6 ${n}`,children:[(o||r||l)&&f.jsxs("div",{className:"flex-shrink-0",children:[o&&f.jsx("p",{className:"text-sm font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-300",children:o}),r&&f.jsx("h2",{className:"mt-2 text-2xl font-bold text-gray-900 dark:text-white",children:r}),l&&f.jsx("p",{className:"mt-2 text-base text-gray-600 dark:text-gray-300",children:l})]}),f.jsx("div",{className:"flex w-full flex-shrink-0 justify-center",children:f.jsx("div",{className:"w-full max-w-xl lg:max-w-2xl",children:f.jsxs("div",{className:"relative overflow-hidden rounded-[1.75rem] border border-slate-300/90 bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,250,252,0.94))] shadow-[0_10px_28px_rgba(15,23,42,0.05)] dark:border-white/20 dark:bg-[linear-gradient(180deg,rgba(37,39,49,0.95),rgba(29,31,39,0.92))] dark:shadow-[0_12px_30px_rgba(0,0,0,0.2)]",children:[f.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[inherit] bg-[linear-gradient(180deg,rgba(255,255,255,0.45),rgba(255,255,255,0))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]"}),f.jsx(ef,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400 dark:text-slate-500"}),f.jsx("input",{ref:v,type:"text",placeholder:u("agentSelectionList.searchPlaceholder"),value:k,maxLength:100,disabled:h||!!y||m.length===0,onChange:G=>_(G.target.value),onKeyDown:C,className:"relative z-10 w-full bg-transparent py-3 pl-11 pr-11 text-sm font-medium text-slate-700 placeholder:font-normal placeholder:text-slate-400 focus:outline-none focus:ring-0 focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-60 dark:text-slate-100 dark:placeholder:text-slate-400"}),k&&f.jsx("button",{type:"button",onClick:()=>_(""),className:"absolute right-3 top-1/2 z-10 inline-flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-slate-200/80 bg-white/90 text-slate-400 transition-colors hover:border-slate-300 hover:text-slate-600 focus:outline-none focus:ring-2 focus:ring-sky-200 dark:border-white/10 dark:bg-white/5 dark:text-slate-500 dark:hover:border-white/20 dark:hover:text-slate-200 dark:focus:ring-sky-500/20","aria-label":u("agentSelectionList.clearSearchAriaLabel"),children:f.jsx(wa,{className:"h-3.5 w-3.5"})})]})})}),f.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:ie()})]})}function Hd(){return Zd()?uc()==="entra"?f.jsx(VS,{}):f.jsx(HS,{}):null}function HS(){const{user:i,logout:n,loginWithRedirect:r}=Xd();if(!hi()||!i)return f.jsx(j0,{onClick:()=>r()});const o=i.name||i.email||"User";return f.jsx(E0,{displayName:o,onClick:()=>n({logoutParams:{returnTo:window.location.origin}})})}function VS(){const{instance:i,accounts:n}=Pd();if(!hi()||n.length===0)return f.jsx(j0,{onClick:()=>i.loginRedirect({scopes:Jd()}).catch(()=>{})});const l=n[0],o=l.name||l.username||"User";return f.jsx(E0,{displayName:o,onClick:()=>i.logoutRedirect({postLogoutRedirectUri:window.location.origin}).catch(()=>{})})}function j0({onClick:i}){const{t:n}=pt();return f.jsxs("button",{onClick:i,className:"inline-flex items-center justify-center gap-1.5 rounded-lg border border-blue-400/70 bg-blue-600 px-3 py-2 text-xs font-semibold text-white shadow-sm active:scale-[0.97] transition-all duration-150 hover:bg-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:border-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",children:[f.jsx(c0,{className:"h-4 w-4"}),f.jsx("span",{children:n("common.signIn")})]})}function E0({displayName:i,onClick:n}){const{t:r}=pt();return f.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm text-gray-600 dark:text-[#bfc2cd]",children:[f.jsx("span",{className:"hidden max-w-[170px] truncate font-medium md:block",title:i,children:i}),f.jsxs("button",{onClick:n,className:"inline-flex min-h-10 items-center justify-center gap-1.5 rounded-lg border border-slate-200 px-3 py-2 text-xs font-semibold text-slate-600 shadow-sm transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-400 dark:border-[#454755] dark:text-[#c4c8d4] dark:hover:border-red-900/40 dark:hover:bg-red-900/20 dark:hover:text-red-300 md:rounded-full md:text-sm md:font-medium",title:r("authStatus.signOutButton.title"),"aria-label":r("authStatus.signOutButton.ariaLabel"),children:[f.jsx(T1,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden md:inline",children:r("common.logOut")})]})]})}function L0({placement:i="default",compact:n=!1}){const{t:r}=pt();if(!s0())return null;const l=n1(),o=s1(),u=r1(),m=i1(),p=l1(),h=o1(),b=u1(),y=m?"border-t border-slate-200/80 dark:border-[#333645]":"",x=n?i==="sidebar"?"pt-4 pb-2":"pt-2 pb-2":h==="normal"?"pt-3 pb-3":"pt-5 pb-3",w=p==="inline"?"flex w-full flex-col gap-1 items-center justify-center text-center sm:flex-row sm:items-center sm:justify-center":"flex w-full flex-col items-center justify-center gap-1 text-center",v="justify-center",k=i==="sidebar"?"w-full px-2":"w-full px-3 sm:px-6",_=i==="sidebar"?"w-full":"mx-auto w-full max-w-7xl",j=n?"inline-flex min-h-8 items-center rounded px-1.5 text-xs font-medium transition-colors hover:bg-slate-100 hover:text-blue-700 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:bg-[#2b2d39] dark:hover:text-blue-300":"inline-flex min-h-10 items-center rounded-md px-2.5 text-sm font-medium transition-colors hover:bg-slate-100 hover:text-blue-700 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:bg-[#2b2d39] dark:hover:text-blue-300 sm:text-base";return f.jsx("footer",{className:`shrink-0 bg-white dark:bg-black text-sm ${x} ${y}`.trim(),style:{backgroundColor:o||void 0,color:u||void 0},children:f.jsx("div",{className:k,children:f.jsx("div",{className:_,children:f.jsxs("div",{className:w,children:[l&&f.jsx("p",{className:`${n?"text-xs leading-snug":"text-sm"} text-slate-700 dark:text-slate-200 ${i==="sidebar"?"pt-0.5":""}`.trim(),children:l}),b.length>0&&f.jsx("nav",{"aria-label":r("appFooter.navLinksAriaLabel"),children:f.jsx("ul",{className:`flex flex-wrap items-center ${v} ${n?"gap-1":"gap-1.5 sm:gap-2"}`,children:b.map((R,P)=>{const z=p==="inline"&&P>0;return f.jsxs("li",{className:"flex items-center",children:[z&&f.jsx("span",{className:"mr-1.5 text-slate-400 dark:text-slate-500","aria-hidden":"true",children:"·"}),f.jsx("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:j,style:{color:u||void 0},children:R.label})]},R.url)})})})]})})})})}const GS=60*1e3;let jd=null,Eg=0;const Ed=i=>{if(!i||i==="/")return"/";const n=i.trim();if(!n)return"/";const r=n.startsWith("/")?n:`/${n}`;return r==="/"?"/":r.endsWith("/")?r.slice(0,-1):r},M0=()=>{if(typeof window>"u")return Ed("/");const i=Ed("/");if(typeof document>"u")return i;const n=document.querySelector("base[href]");if(!n)return i;try{const r=new URL(n.getAttribute("href")||"/",window.location.origin);return Ed(r.pathname||i)}catch{return i}},ic=i=>i.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),PS=async()=>{const i=Date.now();if(jd&&i-Eg<GS)return jd;let n=[];try{n=await rf()}catch(l){qe("[agentRouting] Unable to load adapters for slug resolution",l)}const r=new Map;return n.forEach(l=>{const o=ic(l.name);o&&r.set(o,l.id);const u=ic(l.id);u&&u!==o&&r.set(u,l.id)}),jd=r,Eg=i,r},Vd=i=>{var u;const n=M0(),r=i.startsWith("/")?i:`/${i}`;let l=r;if(n!=="/"){if(!r.startsWith(n))return null;l=r.slice(n.length)}const o=l.split("/").filter(Boolean);return o.length===0?null:((u=o[0])==null?void 0:u.toLowerCase())||null},D0=i=>{const n=M0();if(!i)return n;const r=i.replace(/^\/+|\/+$/g,"");return n==="/"?r?`/${r}`:"/":`${n}/${r}`.replace(/\/{2,}/g,"/")},zn=i=>{if(typeof window>"u")return;const n=D0(i),r=window.location.pathname;if(n===r)return;const l=window.location.search||"",o=window.location.hash||"";window.history.replaceState(window.history.state,"",`${n}${l}${o}`)},XS=()=>D0(null),YS=async i=>{const n=i.trim().toLowerCase();return n&&(await PS()).get(n)||null};function KS({currentConversation:i,showEmptyState:n,createConversation:r,configureApiSettings:l,clearError:o,clearCurrentConversationAdapter:u}){var Ze;const{t:m}=pt(),p=m("agent.error.singleAdapterMissing"),[h,b]=S.useState(!1),[y,x]=S.useState(null),w=cc(),v=Yd(),k=typeof window<"u"?Vd(window.location.pathname):null,[_,j]=S.useState(k),[R,P]=S.useState(()=>!w&&n&&!k),z=S.useRef(null),M=S.useRef(new Map),B=S.useRef(0),H=3e4,F=!!i,C=(i==null?void 0:i.messages.length)??0,Q=((Ze=i==null?void 0:i.attachedFiles)==null?void 0:Ze.length)??0,U=S.useMemo(()=>F&&(C>0||Q>0),[Q,C,F]),Y=S.useCallback(()=>{oa(()=>Ye.getState())},[]),J=S.useCallback((ce,pe)=>{if(!ce)return;const we=pe||m("agent.error.configurationFailed");let Ue=!1;Ye.setState(Ce=>{const he=Ce.conversations.find(Me=>Me.id===ce);return!he||he.messages.length>0?Ce:(Ue=!0,{conversations:Ce.conversations.map(Me=>Me.id===ce?{...Me,adapterLoadError:we}:Me)})}),Ue&&Y()},[Y,m]),ae=S.useCallback(ce=>{if(!ce)return;let pe=!1;Ye.setState(we=>{const Ue=we.conversations.find(Ce=>Ce.id===ce);return!Ue||!Ue.adapterLoadError?we:(pe=!0,{conversations:we.conversations.map(Ce=>Ce.id===ce?{...Ce,adapterLoadError:null}:Ce)})}),pe&&Y()},[Y]),ie=S.useCallback(ce=>ce instanceof v0?ce.status===401?m("agent.error.authenticationFailed"):ce.status===404?m("agent.error.notFound"):ce.message:ce instanceof Error?ce.message:m("agent.error.loadFailed"),[m]),G=S.useCallback(()=>{const ce=Ye.getState(),pe=ce.currentConversationId?ce.conversations.find(we=>we.id===ce.currentConversationId):null;if(!pe||pe.messages.length>0)try{return r()}catch(we){qe("Cannot create a new conversation for agent selection:",we instanceof Error?we.message:"Unknown error")}return(pe==null?void 0:pe.id)||null},[r]),E=S.useCallback(async ce=>{if(!(ce!=null&&ce.adapterName))return{ok:!1};try{const pe=await At(),we=new pe.ApiClient({apiUrl:ce.apiUrl||Et(),sessionId:null,adapterName:ce.adapterName});if(typeof we.getAdapterInfo!="function")return{ok:!1};const Ue=await we.getAdapterInfo();return Ye.setState(Ce=>({conversations:Ce.conversations.map(he=>he.id===ce.id?{...he,adapterInfo:Ue,adapterLoadError:null,updatedAt:new Date}:he)})),Ye.getState().currentConversationId===ce.id&&x(null),Y(),{ok:!0}}catch(pe){const we=ie(pe),Ue=Ye.getState();Ue.currentConversationId===ce.id&&x({conversationId:ce.id,message:we});const Ce=Ue.conversations.find(he=>he.id===ce.id);return Ce&&Ce.messages.length===0&&J(ce.id,we),{ok:!1,error:pe}}},[ie,J,Y]),I=S.useCallback(async ce=>{if(!ce)return;const pe=Ye.getState(),we=pe.currentConversationId?pe.conversations.find(Ue=>Ue.id===pe.currentConversationId):null;if(we){b(!0),x(null),ae(we.id);try{const Ue=we.apiUrl||Et();await l(Ue,void 0,ce),o();const Ce=Ye.getState(),he=Ce.conversations.find(Me=>Me.id===Ce.currentConversationId);if((he==null?void 0:he.adapterName)===ce&&(!he.adapterInfo||he.adapterInfo.notes===void 0)){const Me=await E(he);!Me.ok&&Me.error&&Ve("Failed to load adapter info after selecting adapter:",Me.error)}}catch(Ue){Ve("Failed to configure adapter from empty state:",Ue);const Ce=ie(Ue);x({conversationId:we.id,message:Ce}),J(we.id,Ce)}finally{b(!1)}}},[ae,o,l,E,ie,J]),V=S.useCallback(ce=>{w||(G(),P(!1),zn(ic(ce)),I(ce))},[G,I,w]),le=S.useCallback(()=>{w||(u(),zn(null),P(!0))},[u,w]),ue=S.useCallback(()=>{var Ue,Ce;if(w){const he=Ye.getState(),Me=he.currentConversationId?he.conversations.find(De=>De.id===he.currentConversationId):null;if(!!Me&&(Me.messages.length>0||(((Ue=Me.attachedFiles)==null?void 0:Ue.length)||0)>0))try{r()}catch(De){qe("Cannot go home (new conversation):",De instanceof Error?De.message:"Unknown error")}zn(null),P(!1);return}j(null);const ce=Ye.getState(),pe=ce.currentConversationId?ce.conversations.find(he=>he.id===ce.currentConversationId):null;if(!!pe&&(pe.messages.length>0||(((Ce=pe.attachedFiles)==null?void 0:Ce.length)||0)>0))try{r()}catch(he){qe("Cannot go home (new conversation):",he instanceof Error?he.message:"Unknown error");return}else pe!=null&&pe.adapterName&&u();zn(null),P(!0)},[u,r,w]),de=!w&&n&&!_&&!(i!=null&&i.adapterName)&&!U||!w&&n&&R&&!(i!=null&&i.adapterName)&&!U;S.useEffect(()=>{if(w){zn(null);return}if(!_){if(de||!(i!=null&&i.adapterName)){zn(null);return}zn(ic(i.adapterName))}},[i==null?void 0:i.adapterName,w,_,de]);const ge=S.useCallback(async()=>{if(typeof window>"u")return;const ce=++B.current;if(w){zn(null),j(null);return}const pe=Vd(window.location.pathname);if(!pe)return;const we=await YS(pe);if(ce===B.current){if(!we){G(),zn(null),u(),P(!0),j(null);return}G(),P(!1),zn(pe),await I(we),j(null)}},[u,G,I,w]),ee=S.useRef(ge);S.useEffect(()=>{ee.current=ge},[ge]),S.useEffect(()=>{const ce=window.setTimeout(()=>{ee.current()},0),pe=()=>{ee.current()};return window.addEventListener("popstate",pe),()=>{window.clearTimeout(ce),B.current+=1,window.removeEventListener("popstate",pe)}},[]);const ye=i==null?void 0:i.id,fe=i==null?void 0:i.adapterName,ve=i==null?void 0:i.apiUrl,ke=!!(i!=null&&i.adapterInfo);S.useEffect(()=>{if(!w||!v||!n||!ye||U||h)return;const ce=(fe==null?void 0:fe.trim())||v,pe=(fe==null?void 0:fe.trim())!==ce||!ke;if(!ce||!pe)return;let we=!1;return(async()=>{b(!0),x(null),ae(ye);try{const Ce=ve||Et();await l(Ce,void 0,ce),o()}catch(Ce){if(!we){const he=ie(Ce);x({conversationId:ye,message:he}),J(ye,he)}}finally{we||b(!1)}})(),()=>{we=!0}},[ae,o,l,U,ie,h,w,J,n,fe,ve,ke,ye,v]),S.useEffect(()=>{(async()=>{var Ue;const pe=i==null?void 0:i.adapterName;if(z.current===pe)return;const we=!(i!=null&&i.adapterInfo)||(i==null?void 0:i.adapterInfo)&&i.adapterInfo.notes===void 0;if(pe&&we){z.current=pe,se("[ChatInterface] Loading adapter info - adapterName:",pe,"reason:",i!=null&&i.adapterInfo?"notes undefined":"missing");const Ce=await E(i);if(Ce.ok)se("[ChatInterface] Adapter info loaded successfully");else{const he=Ce.error;Ve("[ChatInterface] Failed to load adapter info:",he);const Me=he instanceof Error?he.message:String(he);if((Me.includes("429")||Me.includes("Too Many Requests"))&&pe){const De=M.current.get(pe);De&&clearTimeout(De);const wt=setTimeout(()=>{z.current===pe&&(z.current=null),M.current.delete(pe)},H);M.current.set(pe,wt),qe(`[ChatInterface] Adapter info request rate-limited; retrying in ${H/1e3}s`)}else z.current=null}}else se("[ChatInterface] Skipping adapter info load:",{adapterName:pe,hasAdapterInfo:!!(i!=null&&i.adapterInfo),hasNotes:((Ue=i==null?void 0:i.adapterInfo)==null?void 0:Ue.notes)!==void 0,refValue:z.current})})()},[E,i]),S.useEffect(()=>{const ce=M.current;return()=>{ce.forEach(pe=>clearTimeout(pe)),ce.clear()}},[]);const Ee=w&&!v?p:(i==null?void 0:i.adapterLoadError)??((y==null?void 0:y.conversationId)===(i==null?void 0:i.id)?y.message:null);return{adapterNotesError:Ee,handleAgentCardSelection:V,handleChangeAgent:le,goToAgentSelectionHome:ue,hasAdapterConfigurationError:!!Ee,isAgentSelectionVisible:R,isConfiguringAdapter:h,isSingleAdapterMode:w,setIsAgentSelectionVisible:P,shouldShowAgentSelectionList:de}}const z0=S.createContext(null),QS={registerGoHome:()=>{},goHome:()=>{}};function R0(){return S.useContext(z0)??QS}function ZS({adapter:i,syntaxTheme:n,forcedThemeClass:r=""}){var o;const l=(o=i.notes)==null?void 0:o.trim();return l?f.jsxs("section",{"aria-labelledby":"agent-seo-content-title",className:"mx-auto w-full max-w-[56rem] px-1 text-left sm:px-0",children:[f.jsx("h2",{id:"agent-seo-content-title",className:"sr-only",children:i.name}),f.jsx("div",{children:f.jsx(ds,{content:l,className:`message-markdown prose prose-slate dark:prose-invert max-w-none text-sm leading-relaxed text-[#434654] dark:text-[#d7dae3] [&>:first-child]:mt-0 [&>:last-child]:mb-0 ${r}`,syntaxTheme:n})})]}):null}const JS='meta[name="description"]',WS='meta[property="og:title"]',ew='meta[property="og:description"]',tw='meta[property="og:type"]',aw='link[rel="canonical"]';function Lg(i){return i.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function nw(i){return i.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^>\s?/gm,"").replace(/[*_~]/g,"").replace(/\s+/g," ").trim()}function sw(i,n){const r=i==null?void 0:i.trim();if(r)return r;if(!n)return Qd();const l=nw(n);return l.length>160?`${l.slice(0,157).trimEnd()}...`:l}function rw(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function iw(i){const n=i.trim();if(!n)return null;try{return new URL(n).origin}catch{return null}}function lw(i){const n=i.trim();if(!n)return null;const r=`^${rw(n).replace(/\\\*/g,".*")}$`;try{return new RegExp(r,"i")}catch{return null}}function ow(i){return[Wg(),...zv()].map(iw).filter(r=>!!r).includes(i)?!0:Rv().some(r=>{const l=lw(r);return l?l.test(i):!1})}function cw(i){var l,o,u;const n=i==null?void 0:i.trim();if(!n)return null;const r=Se.adapters.find(m=>{var p;return((p=m==null?void 0:m.id)==null?void 0:p.trim())===n});return r?{id:r.id,name:((l=r.name)==null?void 0:l.trim())||r.id,description:((o=r.description)==null?void 0:o.trim())||void 0,notes:((u=r.notes)==null?void 0:u.trim())||void 0}:null}function uw(i){var l,o,u;if(typeof window>"u")return null;const n=Vd(window.location.pathname);if(!n)return null;const r=Se.adapters.find(m=>{const p=Lg(m.name||""),h=Lg(m.id||"");return n===p||n===h});return r?{id:r.id,name:((l=r.name)==null?void 0:l.trim())||r.id,description:((o=r.description)==null?void 0:o.trim())||void 0,notes:((u=r.notes)==null?void 0:u.trim())||void 0}:null}function Vo(i,n,r){if(typeof document>"u")return null;const l=document.querySelector(i);if(l)return l;const o=document.createElement("meta");return o.setAttribute(n,r),document.head.appendChild(o),o}function dw(){if(typeof document>"u")return null;const i=document.querySelector(aw);if(i)return i;const n=document.createElement("link");return n.rel="canonical",document.head.appendChild(n),n}function O0(i){if(typeof document>"u")return;const n=Kd(),r=i?`${i.name} | ${n}`:n,l=i?sw(i.description,i.notes):Qd();document.title=r;const o=Vo(JS,"name","description");o&&(o.content=l);const u=Vo(WS,"property","og:title");u&&(u.content=r);const m=Vo(ew,"property","og:description");m&&(m.content=l);const p=Vo(tw,"property","og:type");p&&(p.content="website");const h=dw();if(h&&typeof window<"u"){const b=Wg(),y=window.location.origin,x=b?new URL(b.endsWith("/")?b:`${b}/`).origin:"",v=`${y&&ow(y)?y:x||y}${window.location.pathname}`;h.href=v}}function fw(){return Ov()}class lf{static async getAdapterModels(n,r){const l=await At(),o=new l.ApiClient({apiUrl:"",adapterName:r});if(!o.getAdapterModels)throw new Error("getAdapterModels is not available on this API client");return o.getAdapterModels(n)}static async getAllModels(n){const r=await At(),l=new r.ApiClient({apiUrl:"",adapterName:n});if(!l.getAllModels)throw new Error("getAllModels is not available on this API client");return l.getAllModels()}static async listAdapterModels(n,r){return(await lf.getAdapterModels(n,r)).models}}const mw="rounded-t-[32px] border border-white/40 bg-transparent px-4 pb-4 pt-[max(env(safe-area-inset-top),1rem)] shadow-none backdrop-blur-0 dark:border-[#2f303d] dark:bg-transparent md:rounded-none md:border-0 md:bg-transparent md:px-0 md:pb-0 md:pt-3 md:shadow-none md:backdrop-blur-0 md:dark:bg-transparent md:dark:border-0",pw="shrink-0 sticky bottom-[calc(var(--app-footer-height,0px)+0.25rem)] z-10 -mx-4 mt-auto overflow-visible bg-transparent pb-[max(env(safe-area-inset-bottom),0.5rem)] shadow-none backdrop-blur-0 transition-all duration-200 dark:bg-transparent md:bottom-[calc(var(--app-footer-height,0px)+0.5rem)] md:z-10 md:mx-0 md:mt-0 md:overflow-visible md:rounded-none md:border-0 md:bg-transparent md:pb-0 md:shadow-none md:backdrop-blur-0 md:dark:bg-transparent md:dark:border-0 [&>div]:bg-transparent md:[&>div]:rounded-none md:[&>div]:px-0",hw="relative z-20 shrink-0 -mx-4 px-4 pt-2 pb-2 bg-transparent border-b border-transparent dark:border-transparent dark:bg-transparent md:static md:mx-0 md:px-0 md:pt-6 md:pb-6 md:bg-transparent md:border-gray-200 md:dark:border-[#4a4b54] md:dark:bg-transparent";function gw({onOpenSettings:i,onOpenSidebar:n}){var Ua,ht,Jt,Rt,Qe,ua,$a;const{t:r}=pt(),{conversations:l,currentConversationId:o,createConversation:u,canCreateNewConversation:m,sendMessage:p,regenerateResponse:h,editMessageAndRegenerate:b,isLoading:y,configureApiSettings:x,error:w,clearError:v,createThread:k,clearCurrentConversationAdapter:_}=Ye(),{settings:j}=lc(),R=hi(),P=za()&&!R,{theme:z,isDark:M}=mi(),B=z.mode==="dark"?"dark":z.mode==="light"?"light":"",H=M?"dark":"light",F=["application-description agent-home-markdown prose prose-slate dark:prose-invert max-w-none text-sm md:text-base leading-relaxed","text-[#4a4c5a] dark:text-[#bfc2cd]","[&>:first-child]:mt-0 [&>:last-child]:mb-0",B].filter(Boolean).join(" "),C=l.find(Te=>Te.id===o),Q=l.some(Te=>{var Ke;return(Te.messages.length>0||(((Ke=Te.attachedFiles)==null?void 0:Ke.length)||0)>0)&&!Te.adapterLoadError}),U=!C||C.messages.length===0,Y=((Ua=C==null?void 0:C.adapterInfo)==null?void 0:Ua.supportsThreading)===!0,J=!!(C!=null&&C.adapterName&&(C!=null&&C.adapterInfo))&&!Y,ae=S0({adapterName:C==null?void 0:C.adapterName,enabled:J,selectionScopeKey:o,supportsThreading:Y}),ie=Jg(),G=Kd(),E=Qd().trim(),I=E.length>0,{registerGoHome:V}=R0(),[le,ue]=S.useState([]),[oe,de]=S.useState(null);S.useEffect(()=>{const Te=C==null?void 0:C.adapterName;let Ke=!1;async function dt(){if(de(null),!Te){ue([]);return}try{const be=await lf.listAdapterModels(Te,Te);if(Ke)return;ue(be),de(be.length>0?be[0].name:null)}catch{Ke||(ue([]),de(null))}}return dt(),()=>{Ke=!0}},[C==null?void 0:C.adapterName]);const{adapterNotesError:ge,handleAgentCardSelection:ee,handleChangeAgent:ye,goToAgentSelectionHome:fe,hasAdapterConfigurationError:ve,isAgentSelectionVisible:ke,isConfiguringAdapter:Ee,isSingleAdapterMode:Ze,shouldShowAgentSelectionList:ce}=KS({currentConversation:C,showEmptyState:U,createConversation:u,configureApiSettings:x,clearError:v,clearCurrentConversationAdapter:_});S.useLayoutEffect(()=>(V(()=>fe()),()=>V(null)),[V,fe]);const pe="max-w-[96rem]",we="max-w-[64rem]",Ue="max-w-[56rem]",Ce=`mx-auto w-full ${pe}`,he=m(),Me=!!(C!=null&&C.adapterName)&&((C==null?void 0:C.messages.length)||0)===0,He=r(he?"chatInterface.newConversation.tooltipCanStart":P?"chatInterface.newConversation.tooltipGuestLimited":"chatInterface.newConversation.tooltipCannotStart"),De=!!(C&&!ce),wt=ce?"border-transparent dark:border-transparent md:border-transparent md:dark:border-transparent":"",ut=!$d()&&ce?"pt-0 pb-0 md:pt-0 md:pb-1":"",ze=`${hw} ${wt} ${ut}`.trim(),rt=s0(),Be=l.some(Te=>{var Ke;return(Te.messages.length>0||(((Ke=Te.attachedFiles)==null?void 0:Ke.length)??0)>0)&&!Te.adapterLoadError}),st=rt&&!Be,fn=ce?"pt-0 md:pt-0":"pt-4 md:pt-6",Lt=S.useMemo(()=>{var be,da,Ot;if(ce)return null;const Te=cw(C==null?void 0:C.adapterName)||uw();if(!Te&&!(C!=null&&C.adapterName))return null;const Ke=(be=C==null?void 0:C.adapterName)==null?void 0:be.trim(),dt=(Ot=(da=C==null?void 0:C.adapterInfo)==null?void 0:da.notes)==null?void 0:Ot.trim();return Te?{...Te,notes:dt||Te.notes}:Ke?{id:Ke,name:Ke,notes:dt||void 0}:null},[(ht=C==null?void 0:C.adapterInfo)==null?void 0:ht.notes,C==null?void 0:C.adapterName,ce]);S.useEffect(()=>{O0(Lt)},[Lt]),S.useEffect(()=>{let Te=null;const Ke=()=>{Te&&(Te(),Te=null)};if(j.voiceEnabled){if(Ps.isAudioEnabled())return se("[ChatInterface] Audio streaming already enabled"),Ke;const dt=()=>{Ke();const be=async()=>{Ke(),await Ps.enableAudio()?se("[ChatInterface] Audio streaming enabled after user gesture"):(qe("[ChatInterface] User gesture did not enable audio streaming"),dt())};document.addEventListener("pointerdown",be,{once:!0}),document.addEventListener("keydown",be,{once:!0}),Te=()=>{document.removeEventListener("pointerdown",be),document.removeEventListener("keydown",be)},se("[ChatInterface] Waiting for user gesture to enable audio streaming")};return dt(),Ke}return Ke(),Ps.disableAudio(),se("[ChatInterface] Audio streaming disabled via settings"),Ke},[j.voiceEnabled]);const ca=(Te,Ke,dt,be)=>{p(Te,Ke,dt,oe??void 0,be)},fs=async(Te,Ke,dt,be,da)=>{await p(dt,void 0,Te,da??oe??void 0,be)},Oa=()=>{try{u()}catch(Te){qe("Cannot create new conversation:",Te instanceof Error?Te.message:"Unknown error")}},An=S.useCallback(async(Te,Ke)=>{if(C)try{await Ye.getState().deleteThread(C.id,Te,Ke)}catch(dt){Ve("Failed to clear thread:",dt)}},[C]);return f.jsx("main",{className:"flex-1 flex flex-col bg-transparent overflow-hidden","aria-label":r("chatInterface.workspace.ariaLabel"),children:f.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden px-3 sm:px-5 lg:px-8",children:f.jsxs("div",{className:`mx-auto flex h-full w-full ${pe} flex-col overflow-hidden md:pb-4 ${mw}`,children:[w&&f.jsx("div",{role:"alert",className:"mt-6 rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-600/40 dark:bg-red-900/30 dark:text-red-200",children:f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("p",{children:w}),f.jsx("button",{onClick:v,className:"ml-4 rounded p-1 text-red-500 hover:bg-red-100 hover:text-red-700 dark:text-red-200 dark:hover:bg-red-800/40","aria-label":r("chatInterface.error.dismissAriaLabel"),children:"×"})]})}),f.jsxs("div",{className:ze,children:[n&&f.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2 md:hidden",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("button",{onClick:n,disabled:!Q,className:`inline-flex items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-semibold shadow-sm transition-all duration-150 ${Q?"border-white/50 bg-white/80 text-gray-800 active:scale-[0.97] hover:bg-white dark:border-[#2f303d] dark:bg-[#232430] dark:text-[#ececf1]":"cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400 shadow-none dark:border-[#2f303d] dark:bg-[#181922] dark:text-[#6b6f7a]"}`,"aria-label":r("chatInterface.mobile.openChatsMenuAriaLabel"),children:[f.jsx(j1,{className:"h-4 w-4"}),r("chatInterface.mobile.chatsButton")]}),f.jsxs("button",{onClick:i,className:"inline-flex items-center justify-center gap-1.5 rounded-lg border border-white/50 bg-[#11121a]/90 px-3 py-2 text-xs font-semibold text-white shadow-sm active:scale-[0.97] transition-all duration-150 hover:bg-[#0c0d14] dark:border-[#3b3c49] dark:bg-[#565869] dark:hover:bg-[#6b6f7a]","aria-label":r("chatInterface.mobile.openSettingsAriaLabel"),children:[f.jsx(rg,{className:"h-4 w-4"}),r("chatInterface.mobile.settingsButton")]})]}),f.jsx("div",{className:"ml-auto flex-shrink-0",children:f.jsx(Hd,{})})]}),f.jsxs("div",{className:"flex flex-col gap-2 md:gap-4 sm:flex-row sm:items-end sm:justify-between",children:[f.jsx("div",{className:"min-w-0 flex-1",children:De&&f.jsx("div",{className:"space-y-1.5 md:space-y-3",children:f.jsxs("div",{className:"md:space-y-1",children:[f.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[f.jsx("h1",{className:"min-w-0 truncate text-lg md:text-2xl font-semibold text-[#353740] dark:text-[#ececf1]",children:(C==null?void 0:C.title)||r("chatInterface.newChatTitle")}),C&&f.jsx("span",{className:"flex-shrink-0 text-xs md:hidden text-gray-500 dark:text-[#bfc2cd]",children:C.updatedAt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),C&&f.jsx("div",{className:"hidden md:flex items-center text-sm text-gray-500 dark:text-[#bfc2cd]",children:f.jsx("span",{children:r("chatInterface.updatedAt",{time:C.updatedAt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})})})]})})}),f.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 my-2 md:my-0 sm:w-auto md:justify-end md:gap-3",children:[f.jsx("div",{className:"hidden flex-shrink-0 items-center md:inline-flex",children:f.jsx("button",{onClick:i,className:"inline-flex h-[42px] w-[42px] items-center justify-center rounded-full border border-gray-200 text-gray-500 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/50 dark:border-[#3c3f4a] dark:text-[#9aa1bc] dark:hover:border-[#4d5166] dark:hover:bg-[#2d2f39] dark:hover:text-[#ececf1]","aria-label":r("chatInterface.settings.ariaLabel"),title:r("chatInterface.settings.title"),children:f.jsx(rg,{className:"h-4 w-4"})})}),!Ze&&!ce&&!!(C!=null&&C.adapterName)&&f.jsx("button",{type:"button",onClick:()=>{Me&&ye()},disabled:!Me,className:`order-2 sm:order-1 inline-flex h-8 md:h-[42px] w-[calc(50%-0.25rem)] min-w-[140px] md:w-[190px] items-center justify-center gap-1 md:gap-2 rounded-full border px-2.5 md:px-3.5 py-1.5 md:py-2.5 text-[11px] md:text-[13px] font-medium tracking-[0.01em] transition-colors focus-visible:outline-none focus-visible:ring-2 ${Me?"border-blue-300 text-blue-700 hover:bg-blue-50 hover:border-blue-400 focus-visible:ring-blue-500 dark:border-blue-500/40 dark:text-blue-300 dark:hover:bg-blue-900/20 dark:hover:border-blue-400/60 dark:focus-visible:ring-blue-400/60":"cursor-not-allowed border-gray-200 text-gray-400 bg-transparent dark:border-[#3c3f4a] dark:text-[#6b6f7a]"}`,title:r(Me?"chatInterface.changeAgent.titleEnabled":"chatInterface.changeAgent.titleDisabled"),children:r("chatInterface.changeAgent.button")}),!ce&&f.jsxs("button",{onClick:Oa,disabled:!he,className:`order-3 sm:order-2 inline-flex h-8 md:h-[42px] w-[calc(50%-0.25rem)] min-w-[140px] md:w-[190px] items-center justify-center gap-1 md:gap-2 rounded-full border px-2.5 md:px-3.5 py-1.5 md:py-2.5 text-[11px] md:text-[13px] font-medium tracking-[0.01em] ${he?"border-[#1f2937] bg-[#1f2937] text-white shadow-[0_2px_8px_rgba(15,23,42,0.12)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1f2937]/40 dark:border-[#4b5568] dark:bg-[#2f3747] dark:text-[#e9edf8] dark:shadow-[0_2px_8px_rgba(0,0,0,0.25)] dark:focus-visible:ring-[#6f809f]/35":"cursor-not-allowed border-gray-200 text-gray-400 bg-white/40 dark:border-[#3c3f4a] dark:text-[#6b6f7a] dark:bg-transparent"}`,title:He,children:[f.jsx(F1,{className:"h-3.5 w-3.5"}),r("chatInterface.newConversation.button")]}),!$d()&&f.jsx("div",{className:"order-4 hidden flex-shrink-0 items-center md:inline-flex",children:f.jsx(Hd,{})})]})]})]}),U?f.jsxs("div",{className:`flex flex-1 flex-col min-h-0 ${fn} ${ce?"overflow-hidden":""}`,children:[ce?f.jsx("div",{className:"flex-1 flex flex-col md:justify-start min-h-0 overflow-hidden",children:f.jsx("div",{className:"w-full flex flex-col min-h-0 overflow-hidden flex-1",children:f.jsxs("div",{className:"flex flex-col min-h-0 flex-1 gap-3 overflow-hidden md:gap-6",children:[f.jsx("div",{className:`${Ce} flex-shrink-0 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:f.jsxs("div",{className:"flex-1",children:[f.jsx(ds,{content:G,className:"agent-home-markdown prose prose-slate dark:prose-invert max-w-none [&>:first-child]:mt-0 [&>:last-child]:mb-0 text-2xl font-semibold text-[#11111b] dark:text-white text-center md:text-left [&_p]:text-2xl [&_p]:font-semibold [&_p]:leading-tight [&_p]:m-0",syntaxTheme:H}),I&&f.jsx("div",{className:"mt-2",children:f.jsx(ds,{content:E,className:F,syntaxTheme:H})})]})}),f.jsx(qS,{onAdapterSelect:ee,className:`${Ce} md:flex-1 md:min-h-0 md:overflow-hidden`})]})})}):f.jsx("div",{className:"flex flex-1 w-full min-h-0 flex-col overflow-y-auto pt-4 md:pt-6",children:f.jsxs("div",{className:`mx-auto flex w-full ${Ue} flex-col items-center gap-4 pb-8 md:gap-5 md:pb-12`,children:[ge?f.jsx("p",{className:"w-full text-center text-sm text-red-600 dark:text-red-400",children:ge}):C!=null&&C.adapterName?f.jsx("h2",{className:"w-full text-center text-xl font-semibold tracking-tight text-[#353740] dark:text-[#ececf1] md:text-2xl",style:{fontFamily:'-apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},children:Mv(C.adapterName)||C.adapterName}):Ee?f.jsx("p",{className:"w-full text-center text-sm text-gray-500 dark:text-[#bfc2cd]",children:r("chatInterface.empty.configuringAgent")}):null,Lt&&fw()&&f.jsx(ZS,{adapter:Lt,syntaxTheme:H,forcedThemeClass:B}),f.jsx("div",{className:"w-full min-w-0",children:f.jsx(Ng,{onSend:ca,disabled:y||!C||!(C!=null&&C.adapterName)||ve,autoFocusEnabled:!0,placeholder:ie,isCentered:!0,maxWidthClass:Ue,adapterNotes:(Jt=C==null?void 0:C.adapterInfo)==null?void 0:Jt.notes,skillState:ae,availableModels:le,defaultModel:((Rt=C==null?void 0:C.adapterInfo)==null?void 0:Rt.model)??null,selectedModel:oe,onSelectModel:de})})]})}),st&&f.jsx("div",{className:"shrink-0 pt-5 md:pt-6",children:f.jsx(L0,{compact:!0})})]}):f.jsxs("div",{className:"flex flex-1 flex-col min-h-0",children:[f.jsx(xS,{messages:C.messages,onRegenerate:Te=>h(Te,oe??void 0),onEditMessage:(Te,Ke)=>b(Te,Ke,oe??void 0),onStartThread:async(Te,Ke)=>{try{await k(Te,Ke)}catch(dt){Ve("Failed to create thread:",dt)}},onClearThread:An,onSendThreadMessage:fs,sessionId:C.sessionId,isLoading:y,contentMaxWidthClass:we,availableModels:le,defaultModel:((Qe=C==null?void 0:C.adapterInfo)==null?void 0:Qe.model)??null,selectedModel:oe}),f.jsx("div",{className:pw,children:f.jsx("div",{className:"mx-auto w-full max-w-[96rem] px-3 sm:px-5 md:px-6 lg:px-8 xl:px-10",children:f.jsx(Ng,{onSend:ca,disabled:y||!C||!C.adapterName||ke||ve,autoFocusEnabled:!0,placeholder:r("chatInterface.docked.placeholder"),maxWidthClass:we,isCentered:!1,adapterNotes:(ua=C==null?void 0:C.adapterInfo)==null?void 0:ua.notes,skillState:ae,availableModels:le,defaultModel:(($a=C==null?void 0:C.adapterInfo)==null?void 0:$a.model)??null,selectedModel:oe,onSelectModel:de})})})]})]})})})}function bw({selectedAdapter:i,onAdapterChange:n,disabled:r,showDescriptions:l=!1,variant:o="sidebar",label:u,showLabel:m}){const{t:p}=pt(),[h,b]=S.useState([]),[y,x]=S.useState(!0),[w,v]=S.useState(null),[k,_]=S.useState(!1);S.useEffect(()=>{let Q=!0;async function U(){try{x(!0),v(null);const Y=await rf();Q&&b(Y)}catch(Y){Ve("Failed to load adapters:",Y),Q&&v(p("adapterSelector.failedToLoad"))}finally{Q&&x(!1)}}return U(),()=>{Q=!1}},[p]);const j=h.find(Q=>Q.id===i),R=typeof m=="boolean"?m:o==="prominent",P=u||p(o==="prominent"?"adapterSelector.selectAnAgent":"adapterSelector.defaultLabel"),z=S.useMemo(()=>o==="prominent"?"relative w-full text-left":"relative w-full",[o]),M=S.useMemo(()=>{const Q="w-full rounded-md border bg-white px-4 py-3 text-left text-sm text-[#353740] focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:bg-[#343541] dark:text-[#ececf1]";return o==="prominent"?[Q,"border-gray-300 shadow-sm transition-all duration-200 focus-visible:ring-blue-500 dark:border-[#4a4b54] dark:focus-visible:ring-blue-400"].join(" "):["w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-left text-sm text-[#353740] focus:border-gray-400 focus:outline-none dark:border-[#4a4b54] dark:bg-[#343541] dark:text-[#ececf1] dark:focus:border-[#6b6f7a]"].join(" ")},[o]),B=S.useMemo(()=>o==="prominent"?"absolute z-20 mt-2 w-full rounded-xl border border-gray-200 bg-white shadow-xl ring-1 ring-black/5 dark:border-[#4a4b54] dark:bg-[#1f2027]":"absolute z-20 mt-1 w-full rounded-md border border-gray-200 bg-white shadow-lg ring-1 ring-black/5 dark:border-[#4a4b54] dark:bg-[#1f2027]",[o]),C=R?`mb-2 block text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-[#bfc2cd] ${o==="prominent"?"!text-sm !font-semibold !text-gray-700 dark:!text-white":""}`:"sr-only";return f.jsxs("div",{className:z,children:[f.jsx("label",{className:C,children:P}),f.jsxs("div",{className:"relative",children:[f.jsx("button",{type:"button",onClick:()=>!r&&_(!k),disabled:r||y||h.length===0,className:`${M} disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":P,children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex flex-col min-w-0",children:[f.jsx("span",{className:`truncate font-medium ${j?"text-[#11121a] dark:text-white":"text-gray-500 dark:text-gray-400"}`,children:y?p("adapterSelector.loadingAgents"):w?p("adapterSelector.errorLoadingAgents"):j?j.name:h.length===0?p("adapterSelector.noAgentsAvailable"):p("adapterSelector.selectAnAgent")}),o==="prominent"&&(j==null?void 0:j.description)&&f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:j.description})]}),f.jsx(pi,{className:`h-4 w-4 flex-shrink-0 transition-transform text-gray-400 dark:text-gray-300 ${k?"rotate-180":""}`})]})}),k&&!r&&h.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>_(!1)}),f.jsx("div",{className:B,children:f.jsx("div",{className:"max-h-72 overflow-auto py-2",children:h.map(Q=>{const U=Q.id===i;return f.jsx("button",{type:"button",onClick:()=>{U||n(Q.id),_(!1)},className:`w-full px-4 py-3 text-left text-sm transition-colors ${U?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-200":"text-[#353740] hover:bg-gray-50 dark:text-[#ececf1] dark:hover:bg-[#2a2d35]"}`,children:f.jsxs("div",{className:"flex flex-col gap-1",children:[f.jsx("span",{className:"font-medium truncate",children:Q.name}),l&&Q.description&&f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:Q.description})]})},Q.id)})})})]})]}),w&&f.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:w})]})}const Go=100;function xw(i,n){const r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),l=new Date(r);l.setDate(l.getDate()-1);const o=new Date(r);o.setDate(o.getDate()-r.getDay());const u=new Date(n.getFullYear(),n.getMonth(),1);return i>=r?"today":i>=l?"yesterday":i>=o?"thisWeek":i>=u?"thisMonth":"earlier"}function yw(i){const n=new Date,r=["today","yesterday","thisWeek","thisMonth","earlier"],l=new Map;for(const o of i){const u=xw(o.updatedAt,n),m=l.get(u);m?m.push(o):l.set(u,[o])}return r.filter(o=>l.has(o)).map(o=>({label:o,conversations:l.get(o)}))}function Mg({onRequestClose:i,onToggleDesktopSidebar:n}){const{t:r}=pt(),l=cc(),{conversations:o,currentConversationId:u,selectConversation:m,deleteConversation:p,deleteAllConversations:h,updateConversationTitle:b,getConversationCount:y,configureApiSettings:x,clearError:w}=Ye(),v=o.find(me=>me.id===u),[k,_]=S.useState(""),[j,R]=S.useState(null),[P,z]=S.useState(""),[M,B]=S.useState({isOpen:!1,conversationId:"",conversationTitle:"",isDeleting:!1}),[H,F]=S.useState({isOpen:!1,isDeleting:!1}),[C,Q]=S.useState(!1),[U,Y]=S.useState(null),[J,ae]=S.useState(!1),[ie,G]=S.useState(null),E=S.useRef(null),I=S.useRef(null),V=S.useRef(null),le=!v||v.messages.length===0,ue=(U==null?void 0:U.conversationId)===u?U.adapterName:(v==null?void 0:v.adapterName)??null,oe=(ie==null?void 0:ie.conversationId)===u?ie.message:null,de=S.useMemo(()=>o.filter(me=>{var ze;return(me.messages.length>0||(((ze=me.attachedFiles)==null?void 0:ze.length)||0)>0)&&!me.adapterLoadError}),[o]),ge=S.useMemo(()=>{if(!k)return de;const me=k.toLowerCase();return de.filter(ze=>(ze.title||r("chatInterface.newChatTitle")).toLowerCase().includes(me)||ze.messages.some(rt=>rt.content.toLowerCase().includes(me))||(ze.attachedFiles||[]).some(rt=>rt.filename.toLowerCase().includes(me)))},[de,k,r]),ee=S.useMemo(()=>yw(ge),[ge]),ye=y(),fe=k.length>0,ve=de.length>0;S.useEffect(()=>{if(!u||!I.current)return;const me=I.current.querySelector('[aria-current="true"]');me&&me.scrollIntoView({block:"nearest",behavior:"smooth"})},[u]);const ke=S.useCallback(me=>{var fn;if(me.key!=="ArrowDown"&&me.key!=="ArrowUp")return;me.preventDefault();const ze=(fn=I.current)==null?void 0:fn.querySelectorAll('[role="option"]');if(!ze||ze.length===0)return;const rt=document.activeElement,Be=Array.from(ze).indexOf(rt);let st;me.key==="ArrowDown"?st=Be<ze.length-1?Be+1:0:st=Be>0?Be-1:ze.length-1,ze[st].focus()},[]),Ee=async me=>{if(!(!le||!me)){Y({conversationId:u??null,adapterName:me}),G(null),ae(!0);try{const ze=(v==null?void 0:v.apiUrl)||Et();await x(ze,void 0,me),w(),Q(!1)}catch(ze){Ve("Failed to configure adapter:",ze),G({conversationId:u??null,message:ze instanceof Error?ze.message:r("sidebar.adapterConfigureFailed")})}finally{ae(!1)}}},Ze=async me=>{try{await m(me),i==null||i()}catch(ze){Ve("Failed to select conversation:",ze)}},ce=(me,ze)=>{me.stopPropagation(),B({isOpen:!0,conversationId:ze.id,conversationTitle:ze.title||r("chatInterface.newChatTitle"),isDeleting:!1})},pe=async()=>{B(me=>({...me,isDeleting:!0}));try{await p(M.conversationId)}catch(me){Ve("Failed to delete conversation:",me)}B({isOpen:!1,conversationId:"",conversationTitle:"",isDeleting:!1})},we=()=>{B({isOpen:!1,conversationId:"",conversationTitle:"",isDeleting:!1})},Ue=(me,ze)=>{me.stopPropagation(),R(ze.id),z((ze.title||r("chatInterface.newChatTitle")).slice(0,Go))},Ce=me=>{const ze=P.slice(0,Go).trim();ze&&b(me,ze),R(null),z("")},he=()=>{R(null),z("")},Me=()=>{F({isOpen:!0,isDeleting:!1})},He=async()=>{F(me=>({...me,isDeleting:!0}));try{await h()}catch(me){Ve("Failed to clear all conversations:",me)}F({isOpen:!1,isDeleting:!1})},De=()=>{F({isOpen:!1,isDeleting:!1})},wt=me=>{var ze,rt,Be;return(ze=me.adapterName)!=null&&ze.trim()?me.adapterName:(Be=(rt=me.adapterInfo)==null?void 0:rt.adapter_name)!=null&&Be.trim()?me.adapterInfo.adapter_name:null};yl(E,{enabled:C,onEscape:()=>Q(!1)});const ut=me=>{const ze=u===me.id,rt=wt(me),Be=me.title||r("chatInterface.newChatTitle");return f.jsx("div",{role:"option","aria-selected":ze,tabIndex:0,onKeyDown:st=>{(st.key==="Enter"||st.key===" ")&&(st.preventDefault(),Ze(me.id))},onClick:()=>Ze(me.id),className:`group relative flex w-full cursor-pointer items-center rounded-lg px-3 py-2 text-left text-sm transition-colors duration-100
|
|
379
|
+
${ze?"bg-slate-100 dark:bg-[#2a2b36]":"hover:bg-slate-100/70 dark:hover:bg-[#25262f]"} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500/50 dark:focus-visible:ring-sky-400/40`,"aria-current":ze?"true":void 0,"aria-label":r("sidebar.conversationCard.openAriaLabel",{title:Be}),children:j===me.id?f.jsx("input",{type:"text",value:P,onChange:st=>z(st.target.value.slice(0,Go)),onKeyDown:st=>{st.key==="Enter"&&Ce(me.id),st.key==="Escape"&&he(),st.stopPropagation()},onBlur:()=>Ce(me.id),maxLength:Go,className:"flex-1 rounded border border-sky-300 bg-white px-2 py-0.5 text-sm text-[#353740] focus:outline-none focus:ring-2 focus:ring-sky-400/50 dark:border-sky-500/40 dark:bg-[#1a1b1e] dark:text-[#ececf1]",autoFocus:!0,"aria-label":r("sidebar.conversationCard.editInputAriaLabel")}):f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[f.jsx("h3",{className:`flex-1 truncate text-sm leading-snug ${ze?"font-medium text-slate-900 dark:text-[#ececf1]":"font-normal text-slate-700 dark:text-[#c5c8d6]"}`,children:Be}),f.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity duration-100 group-hover:opacity-100 group-focus-within:opacity-100",children:[f.jsx("button",{onClick:st=>Ue(st,me),className:"rounded p-1 text-slate-400 transition-colors hover:bg-slate-200/80 hover:text-slate-600 dark:text-[#6b6f7a] dark:hover:bg-[#3c3f4a] dark:hover:text-[#c5c8d6]","aria-label":r("sidebar.conversationCard.editAriaLabel",{title:Be}),children:f.jsx(u0,{className:"h-3 w-3"})}),f.jsx("button",{onClick:st=>ce(st,me),className:"rounded p-1 text-slate-400 transition-colors hover:bg-red-100/80 hover:text-red-600 dark:text-[#6b6f7a] dark:hover:bg-red-900/30 dark:hover:text-red-400","aria-label":r("sidebar.conversationCard.deleteAriaLabel",{title:Be}),children:f.jsx(m0,{className:"h-3 w-3"})})]})]}),rt&&f.jsx("span",{className:"truncate text-[11px] leading-none text-slate-400 dark:text-[#6b6f7a]",children:rt})]})},me.id)};return f.jsxs(f.Fragment,{children:[!l&&C&&f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm px-4",children:f.jsxs("div",{ref:E,role:"dialog","aria-modal":"true","aria-labelledby":"select-agent-title",tabIndex:-1,className:"w-full max-w-md rounded-2xl border border-gray-200 bg-white p-6 shadow-2xl dark:border-[#3d4050] dark:bg-[#1a1b1e]",children:[f.jsx("h2",{id:"select-agent-title",className:"mb-4 text-lg font-semibold text-gray-900 dark:text-[#ececf1]",children:r("sidebar.selectAgent.title")}),f.jsxs("div",{className:"space-y-5",children:[f.jsx(bw,{selectedAdapter:ue,onAdapterChange:Ee,disabled:J,variant:"prominent",showDescriptions:!0,showLabel:!1}),oe&&f.jsx("div",{role:"alert",className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-600/40 dark:bg-red-900/30 dark:text-red-200",children:oe}),f.jsx("div",{className:"flex justify-end gap-3 pt-2",children:f.jsx("button",{type:"button",onClick:()=>{G(null),Q(!1)},className:"rounded-lg px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:text-[#d1d5db] dark:hover:bg-[#2d2f39]",disabled:J,children:r("common.cancel")})})]})]})}),f.jsxs("nav",{"aria-label":r("sidebar.navAriaLabel"),className:"flex h-full md:h-[calc(100%-2rem)] md:mt-4 w-full md:w-72 flex-col border-r border-b border-gray-200 md:border-l md:border-t md:rounded-2xl md:overflow-hidden bg-transparent dark:border-[#2d2f39]",children:[f.jsxs("div",{className:"bg-transparent px-4 pb-4 pt-4 dark:border-[#2d2f39]",children:[f.jsxs("div",{className:"flex items-center gap-2 pb-3",children:[o.length>0&&o.some(me=>me.messages.length>0)&&f.jsxs("button",{onClick:Me,className:"flex flex-1 items-center justify-center gap-2 rounded-lg border border-red-200 px-3 py-2 text-sm font-medium text-red-600 transition-all duration-150 hover:bg-red-50 hover:border-red-300 hover:shadow-sm dark:border-red-500/25 dark:text-red-400 dark:hover:bg-red-950/20 dark:hover:border-red-500/40",title:r("sidebar.deleteAllConversations.title"),children:[f.jsx(P1,{className:"h-4 w-4"}),r("sidebar.deleteAllConversations.button")]}),n&&f.jsx("button",{type:"button",onClick:n,className:"ml-auto hidden shrink-0 md:inline-flex h-9 w-9 items-center justify-center rounded-xl border border-slate-200/80 bg-white text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:border-[#333645] dark:bg-[#161616] dark:text-[#d1d5db] dark:hover:border-[#43465a] dark:hover:bg-[#202020] dark:hover:text-white","aria-label":r("sidebar.collapse.ariaLabel"),title:r("sidebar.collapse.title"),children:f.jsx(R1,{className:"h-4 w-4"})})]}),oe&&!C&&f.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-600 dark:text-red-400",children:oe}),ve&&f.jsxs("div",{className:"border-t border-gray-200 pt-4 mt-4 dark:border-[#2d2f39]",children:[f.jsxs("div",{className:"relative overflow-hidden rounded-[1.75rem] border border-slate-200/85 bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,250,252,0.94))] shadow-[0_10px_28px_rgba(15,23,42,0.05)] transition-all duration-200 focus-within:border-sky-300/90 focus-within:shadow-[0_0_0_1px_rgba(125,211,252,0.55),0_10px_28px_rgba(15,23,42,0.05)] dark:border-white/10 dark:bg-[linear-gradient(180deg,rgba(37,39,49,0.95),rgba(29,31,39,0.92))] dark:shadow-[0_12px_30px_rgba(0,0,0,0.2)] dark:focus-within:border-sky-400/30 dark:focus-within:shadow-[0_0_0_1px_rgba(56,189,248,0.22),0_12px_30px_rgba(0,0,0,0.2)]",children:[f.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[inherit] bg-[linear-gradient(180deg,rgba(255,255,255,0.45),rgba(255,255,255,0))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]"}),f.jsx(ef,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400 dark:text-slate-500"}),f.jsx("input",{ref:V,type:"text",role:"searchbox","aria-label":r("sidebar.search.ariaLabel"),placeholder:r("sidebar.search.placeholder"),value:k,onChange:me=>_(me.target.value),className:"relative z-10 w-full bg-transparent py-3 pl-11 pr-11 text-sm font-medium text-slate-700 placeholder:font-normal placeholder:text-slate-400 focus:outline-none dark:text-slate-100 dark:placeholder:text-slate-500"}),k&&f.jsx("button",{type:"button",onClick:()=>{var me;_(""),(me=V.current)==null||me.focus()},className:"absolute right-3 top-1/2 z-10 inline-flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-slate-200/80 bg-white/90 text-slate-400 transition-colors hover:border-slate-300 hover:text-slate-600 focus:outline-none focus:ring-2 focus:ring-sky-200 dark:border-white/10 dark:bg-white/5 dark:text-slate-500 dark:hover:border-white/20 dark:hover:text-slate-200 dark:focus:ring-sky-500/20","aria-label":r("sidebar.search.clearAriaLabel"),children:f.jsx(wa,{className:"h-3.5 w-3.5"})})]}),fe&&f.jsx("p",{"aria-live":"polite",className:"mt-2 text-center text-[11px] tabular-nums text-gray-400 dark:text-[#6e7490]",children:ge.length===0?r("sidebar.resultsNone"):r("sidebar.results",{count:ge.length})})]})]}),f.jsx("div",{ref:I,role:"listbox","aria-label":r("sidebar.conversations.ariaLabel"),onKeyDown:ke,className:"flex-1 overflow-y-auto bg-transparent px-3 py-2",children:ge.length===0?null:fe?f.jsx("div",{className:"space-y-1",children:ge.map(ut)}):f.jsx("div",{className:"space-y-4",children:ee.map(me=>f.jsxs("section",{"aria-label":r(`sidebar.timeGroups.${me.label}`),children:[f.jsx("h4",{className:"sticky top-0 z-10 mb-1 bg-transparent px-1 pb-1 pt-0.5 text-[11px] font-semibold uppercase tracking-wider text-gray-400 backdrop-blur-sm dark:text-[#6e7490]",children:r(`sidebar.timeGroups.${me.label}`)}),f.jsx("div",{className:"space-y-1",children:me.conversations.map(ut)})]},me.label))})}),(()=>{const me=n0();return me.length===0?null:f.jsx("div",{className:"shrink-0 border-t border-gray-200/80 px-4 py-3 md:hidden dark:border-[#2d2f39]",children:f.jsx("nav",{"aria-label":r("appHeader.navLinksAriaLabel"),children:f.jsx("ul",{className:"flex flex-wrap gap-2",children:me.map(ze=>f.jsx("li",{children:f.jsx("a",{href:ze.url,className:"inline-flex items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-[#d1d5db] dark:hover:bg-[#2b2d39]",children:ze.label})},ze.url))})})})})(),f.jsx("div",{className:"shrink-0 border-t border-gray-200/80 dark:border-[#2d2f39]",children:f.jsx(L0,{placement:"sidebar",compact:!0})})]}),f.jsx(ac,{isOpen:M.isOpen,onClose:we,onConfirm:pe,title:r("sidebar.deleteConfirm.title"),message:r("sidebar.deleteConfirm.message",{title:M.conversationTitle}),confirmText:r("sidebar.deleteConfirm.confirmText"),cancelText:r("common.cancel"),type:"danger",isLoading:M.isDeleting}),f.jsx(ac,{isOpen:H.isOpen,onClose:De,onConfirm:He,title:r("sidebar.clearAllConfirm.title"),message:r("sidebar.clearAllConfirm.message",{count:ye}),confirmText:r("sidebar.clearAllConfirm.confirmText"),cancelText:r("common.cancel"),type:"danger",isLoading:H.isDeleting})]})}const vw="3.11.0",Sw={version:vw},of=Sw.version,ww=["@@auth0spajs@@","a0.spajs","auth0","com.auth0"];function kw(i){const n=i.toLowerCase();return ww.some(r=>n.includes(r.toLowerCase()))}function Aw(i){const n=[];for(let r=0;r<i.length;r++){const l=i.key(r);l&&kw(l)&&n.push(l)}n.forEach(r=>i.removeItem(r))}function Dg(i){try{Aw(i),i.clear()}catch(n){console.warn("[Settings] Failed to clear browser storage during reset.",n)}}function _w(){if(typeof document>"u"||!document.cookie)return;const i=new Set([void 0]),n=window.location.hostname;n&&n!=="localhost"&&!/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n)&&(i.add(n),i.add(`.${n}`)),document.cookie.split(";").forEach(l=>{const o=l.indexOf("="),u=(o>-1?l.slice(0,o):l).trim();u&&i.forEach(m=>{const p=m?`;domain=${m}`:"";document.cookie=`${u}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/${p}`})})}function Cw(){Dg(localStorage),Dg(sessionStorage),_w()}function Tw({isOpen:i,onClose:n}){const{t:r}=pt(),{theme:l,updateTheme:o}=mi(),{settings:u,updateSettings:m}=lc(),{activeLanguages:p,currentLanguage:h,setLanguage:b}=p1(),[y,x]=S.useState(!1),[w,v]=S.useState(!1),k=S.useRef(null),_=S.useRef(null),j=S.useMemo(()=>[...p].sort((H,F)=>Ro[H].localeCompare(Ro[F])),[p]);S.useEffect(()=>{if(!w)return;const H=F=>{F.key==="Escape"&&(F.stopPropagation(),v(!1))};return document.addEventListener("keydown",H,{capture:!0}),()=>document.removeEventListener("keydown",H,{capture:!0})},[w]);const R=H=>{o({mode:H})},P=()=>{m({soundEnabled:!u.soundEnabled})},z=()=>{x(!0)},M=()=>{x(!1)},B=()=>{M(),fc(),mc(!1),fi(null),Ra.getState().closeLoginPrompt(),Cw(),window.location.reload()};return yl(k,{enabled:i&&!y,onEscape:n}),yl(_,{enabled:y,onEscape:M}),i?f.jsxs("div",{className:"fixed inset-0 z-50 flex items-end md:items-center justify-center overflow-y-auto bg-black/50 p-0 md:p-4",children:[f.jsx("button",{type:"button",onClick:n,"aria-label":r("settings.dialog.closeOverlayAriaLabel"),className:"absolute inset-0"}),f.jsxs("div",{onClick:H=>H.stopPropagation(),ref:k,role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",tabIndex:-1,className:"relative flex h-[100dvh] w-full max-w-none flex-col overflow-hidden bg-white shadow-2xl dark:bg-[#1a1b1e] md:h-auto md:max-h-[90vh] md:max-w-md md:rounded-2xl",children:[f.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between border-b border-gray-200 px-6 pb-4 pt-[max(env(safe-area-inset-top),1rem)] dark:border-[#2d2f39] md:p-6",children:[f.jsx("h2",{id:"settings-title",className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:r("settings.dialog.title")}),f.jsx("button",{onClick:n,className:"p-2 hover:bg-gray-100 dark:hover:bg-[#25262f] rounded-lg transition-colors","aria-label":r("settings.dialog.closeButtonAriaLabel"),children:f.jsx(wa,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),f.jsxs("div",{className:"flex-1 min-h-0 space-y-6 overflow-y-auto px-6 pb-[max(env(safe-area-inset-bottom),1.25rem)] pt-6 md:p-6",children:[f.jsxs("div",{className:"space-y-4",children:[f.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[f.jsx(z1,{className:"w-5 h-5"}),r("settings.appearance.heading")]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r("settings.appearance.themeLabel")}),f.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"light",label:r("settings.appearance.themeLight"),icon:G1},{value:"dark",label:r("settings.appearance.themeDark"),icon:D1},{value:"system",label:r("settings.appearance.themeSystem"),icon:M1}].map(({value:H,label:F,icon:C})=>f.jsxs("button",{onClick:()=>R(H),className:`flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all duration-200 ${l.mode===H?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-[#2d2f39] hover:border-gray-300 dark:hover:border-[#43465a] text-gray-700 dark:text-gray-300"}`,children:[f.jsx(C,{className:"w-5 h-5"}),f.jsx("span",{className:"text-sm font-medium",children:F})]},H))})]}),p.length>1&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 flex items-center gap-2",children:[f.jsx(C1,{className:"w-4 h-4"}),r("settings.language.label")]}),f.jsxs("div",{className:"relative",children:[f.jsxs("button",{type:"button",onClick:()=>v(H=>!H),"aria-haspopup":"listbox","aria-expanded":w,className:`flex w-full items-center justify-between gap-2 rounded-lg border-2 px-3 py-2.5 text-left text-sm transition-colors duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 dark:focus-visible:ring-blue-400/40 ${w?"border-blue-500":"border-gray-200 dark:border-[#2d2f39] hover:border-gray-300 dark:hover:border-[#43465a]"}`,children:[f.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:Ro[h]}),f.jsx(pi,{className:`h-4 w-4 flex-shrink-0 text-gray-400 transition-transform duration-200 dark:text-gray-500 ${w?"rotate-180":""}`})]}),w&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>v(!1)}),f.jsx("div",{role:"listbox","aria-label":r("settings.language.label"),className:"absolute z-20 mt-2 max-h-60 w-full overflow-y-auto rounded-lg border border-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/5 dark:border-[#2d2f39] dark:bg-[#1a1b1e] dark:ring-white/5",children:j.map(H=>{const F=H===h;return f.jsxs("button",{type:"button",role:"option","aria-selected":F,onClick:()=>{b(H),v(!1)},className:`flex w-full items-center justify-between gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors ${F?"bg-blue-50 font-medium text-blue-700 dark:bg-blue-900/20 dark:text-blue-300":"text-gray-700 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-[#25262f]"}`,children:[f.jsx("span",{className:"truncate",children:Ro[H]}),F&&f.jsx(bl,{className:"h-4 w-4 flex-shrink-0 text-blue-600 dark:text-blue-400"})]},H)})})]})]})]})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:r("settings.chat.heading")}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ec,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),f.jsxs("div",{children:[f.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r("settings.soundEffects.label")}),f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("settings.soundEffects.description")})]})]}),f.jsx("button",{onClick:P,role:"switch","aria-checked":u.soundEnabled,"aria-label":r("settings.soundEffects.toggleAriaLabel"),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${u.soundEnabled?"bg-blue-600":"bg-gray-200 dark:bg-[#3c3f4a]"}`,children:f.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${u.soundEnabled?"translate-x-6":"translate-x-1"}`})})]})]}),f.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-[#2d2f39]",children:[f.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[f.jsx(m0,{className:"w-5 h-5"}),r("settings.dataManagement.heading")]}),f.jsxs("div",{className:"space-y-3",children:[f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("settings.dataManagement.description")}),f.jsx("button",{onClick:z,className:"w-full px-4 py-2 text-sm font-medium text-red-600 dark:text-red-400 border border-red-300 dark:border-red-700 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors",children:r("settings.reset.button")})]})]}),f.jsxs("p",{className:"pt-2 text-center text-xs text-gray-400 dark:text-[#858999]",children:["v",of]})]}),y&&f.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:f.jsxs("div",{ref:_,role:"dialog","aria-modal":"true","aria-labelledby":"reset-dialog-title",tabIndex:-1,className:"max-h-[calc(100dvh-2rem)] w-full max-w-sm overflow-y-auto rounded-2xl border border-red-100 bg-white p-6 shadow-2xl dark:border-red-800/60 dark:bg-[#111113]",children:[f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx("div",{className:"mt-0.5 flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/40",children:f.jsx(af,{className:"w-5 h-5 text-red-600 dark:text-red-400"})}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("p",{id:"reset-dialog-title",className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("settings.reset.confirmTitle")}),f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("settings.reset.confirmMessage")})]})]}),f.jsxs("div",{className:"mt-4 flex gap-2 pt-2",children:[f.jsx("button",{onClick:M,className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-[#2d2f39] rounded-lg hover:bg-gray-50 dark:hover:bg-[#1a1b1e] transition-colors",children:r("common.cancel")}),f.jsx("button",{onClick:B,className:"flex-1 px-4 py-2 text-sm font-semibold rounded-lg transition-colors bg-red-600 text-white hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-600",children:r("settings.reset.confirmButton")})]})]})})]})]}):null}function Nw({message:i}){const{t:n}=pt(),r=Kd();return f.jsx("main",{className:"min-h-dvh bg-white px-4 py-6 text-slate-950 dark:bg-black dark:text-slate-100 sm:px-6 lg:px-8",children:f.jsxs("div",{className:"mx-auto flex min-h-[calc(100dvh-3rem)] w-full max-w-5xl flex-col",children:[f.jsxs("header",{className:"flex items-center justify-between gap-4",children:[f.jsx("p",{className:"min-w-0 truncate text-lg font-semibold tracking-tight sm:text-xl",children:r}),f.jsxs("span",{className:"shrink-0 text-xs font-medium text-slate-400 dark:text-[#858999]",children:["v",of]})]}),f.jsx("section",{className:"flex flex-1 items-center justify-center py-12",children:f.jsxs("div",{className:"w-full max-w-lg space-y-8",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("span",{className:"relative flex h-2.5 w-2.5 shrink-0",children:[f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-60 dark:bg-amber-500"}),f.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-amber-500 dark:bg-amber-400"})]}),f.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-amber-700 dark:text-amber-400",children:n("outOfService.statusBadge")})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-slate-950 dark:text-white sm:text-4xl",children:n("outOfService.heading")}),f.jsx("p",{className:"max-w-md whitespace-pre-wrap text-base leading-relaxed text-slate-500 dark:text-slate-400",children:i})]}),f.jsx("div",{className:"border-t border-slate-200 dark:border-[#242424]"}),f.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[f.jsxs("button",{type:"button",onClick:()=>window.location.reload(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-slate-950 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200",children:[f.jsx(q1,{className:"h-4 w-4","aria-hidden":"true"}),n("outOfService.retryButton")]}),f.jsx("span",{className:"hidden text-slate-300 dark:text-slate-700 sm:block","aria-hidden":"true",children:"·"})]})]})})]})})}function jw({children:i}){const{instance:n,accounts:r}=Pd(),l=vx();return S.useEffect(()=>{mc(l)},[l]),S.useEffect(()=>{if(!l||r.length===0){fi(null);return}const o=r[0];fi(o.username||o.name||o.localAccountId||null)},[l,r]),S.useEffect(()=>{if(!l||r.length===0)return;const o=r[0],u=Jd();return h0(async()=>(await n.acquireTokenSilent({scopes:u,account:o})).accessToken),()=>fc()},[l,r,n]),f.jsx(f.Fragment,{children:i})}function Ew({children:i}){return f.jsx(jw,{children:i})}function Lw({children:i}){const{isLoading:n,isAuthenticated:r,getAccessTokenSilently:l,user:o}=Xd();return S.useEffect(()=>{mc(r)},[r]),S.useEffect(()=>{if(!r){fi(null);return}const u=(o==null?void 0:o.sub)||(o==null?void 0:o.email)||(o==null?void 0:o.nickname)||(o==null?void 0:o.name)||null;fi(u)},[r,o]),S.useEffect(()=>(r&&h0(()=>l()),()=>fc()),[r,l]),n?f.jsx("div",{className:"flex items-center justify-center h-screen bg-white dark:bg-[#212121]",children:f.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 dark:border-gray-100"})}):f.jsx(f.Fragment,{children:i})}function Mw({children:i}){return S.useEffect(()=>{mc(!1),fi(null),fc()},[]),f.jsx(f.Fragment,{children:i})}function Dw({children:i}){return za()?uc()==="entra"?f.jsx(Ew,{children:i}):f.jsx(Lw,{children:i}):f.jsx(Mw,{children:i})}function zw(){const i=Zd(),n=za(),r=hi(),{showLoginPrompt:l,promptMessage:o,closeLoginPrompt:u}=Ra();return S.useEffect(()=>{l&&(!i||!n||r)&&u()},[l,i,n,r,u]),!i||!n||r||!l?null:uc()==="entra"?f.jsx(Ow,{message:o,onClose:u}):f.jsx(Rw,{message:o,onClose:u})}function Rw({message:i,onClose:n}){const{loginWithRedirect:r}=Xd();return f.jsx(U0,{message:i,onClose:n,onLogin:()=>r()})}function Ow({message:i,onClose:n}){const{instance:r}=Pd();return f.jsx(U0,{message:i,onClose:n,onLogin:()=>r.loginRedirect({scopes:Jd()}).catch(()=>{})})}function U0({message:i,onClose:n,onLogin:r}){const{t:l}=pt();return f.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[f.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:n,"aria-hidden":"true"}),f.jsxs("div",{className:"relative z-10 mx-4 w-full max-w-md rounded-2xl border border-gray-200 bg-white p-6 shadow-2xl dark:border-[#4a4b54] dark:bg-[#2d2f39]",children:[f.jsx("button",{onClick:n,className:"absolute right-3 top-3 rounded-full p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-[#3c3f4a] dark:hover:text-[#ececf1]","aria-label":l("common.close"),children:f.jsx(wa,{className:"h-4 w-4"})}),f.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[f.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/40",children:f.jsx(c0,{className:"h-5 w-5 text-blue-600 dark:text-blue-300"})}),f.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-[#ececf1]",children:l("loginPrompt.heading")})]}),f.jsx("p",{className:"mb-6 text-sm leading-relaxed text-gray-600 dark:text-[#bfc2cd]",children:i}),f.jsxs("div",{className:"flex gap-3",children:[f.jsx("button",{onClick:r,className:"flex-1 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",children:l("common.signIn")}),f.jsx("button",{onClick:n,className:"flex-1 rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400 dark:border-[#4a4b54] dark:bg-[#2d2f39] dark:text-[#bfc2cd] dark:hover:bg-[#3c3f4a]",children:l("common.cancel")})]})]})]})}function Uw(){const{t:i}=pt(),{goHome:n}=R0(),{isDark:r}=mi(),l=XS(),o=S.useRef(!1),u=Kv(),m=Qv(),p=Zv(),h=r?p:m,b=Jv(),y=Wv(),x=!!(b||y),w=e1(),v=t1(),k=a1(),_=n0(),j=k?"border-b border-slate-200/80 dark:border-[#333645]":"",R="inline-flex min-h-10 items-center rounded-md px-2.5 text-sm font-medium transition-colors hover:bg-slate-100 hover:text-blue-700 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:hover:bg-[#2b2d39] dark:hover:text-blue-300";return S.useEffect(()=>{o.current},[p,u,m]),$d()?f.jsx("header",{className:`relative z-30 shrink-0 bg-white px-3 pb-1 pt-2 dark:bg-black sm:px-5 sm:pb-2 sm:pt-3 lg:px-8 md:pt-5 ${j}`.trim(),style:{backgroundColor:w||void 0,color:v||void 0},children:f.jsxs("div",{className:"mx-auto flex w-full max-w-[96rem] items-center justify-between gap-3",children:[f.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-2 md:justify-start md:gap-3",children:f.jsx("a",{href:l,"aria-label":i("appHeader.homeLinkAriaLabel"),onClick:P=>{P.preventDefault(),n()},className:"inline-flex items-center rounded-sm px-1 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-300 dark:focus-visible:ring-offset-black md:-ml-1",children:f.jsx("img",{src:h,alt:i("appHeader.logoAlt"),draggable:!1,className:`block max-w-full flex-shrink-0 select-none ${x?"":"h-8 w-auto sm:h-10 md:h-11"}`.trim(),style:{WebkitUserDrag:"none",...b?{height:b}:{},...y?{width:y}:{}}})})}),f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center justify-end gap-2 sm:gap-4 md:flex",children:[_.length>0&&f.jsx("nav",{"aria-label":i("appHeader.navLinksAriaLabel"),className:"hidden sm:block",children:f.jsx("ul",{className:"flex items-center gap-1.5 sm:gap-2",children:_.map(P=>f.jsx("li",{children:f.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:R,style:{color:v||void 0},children:P.label})},P.url))})}),f.jsx(Hd,{})]})]})}):null}function $w({children:i}){const n=S.useRef(null),r=S.useCallback(o=>{n.current=o},[]),l=S.useCallback(()=>{var o;(o=n.current)==null||o.call(n)},[]);return f.jsx(z0.Provider,{value:{registerGoHome:r,goHome:l},children:i})}function Iw(){const{t:i}=pt(),[n,r]=S.useState(!1),[l,o]=S.useState(!1),[u,m]=S.useState(()=>localStorage.getItem("desktop-sidebar-collapsed")==="true"),p=Ye(y=>y.conversations),h=Gv();if(S.useEffect(()=>{localStorage.setItem("desktop-sidebar-collapsed",String(u))},[u]),h)return f.jsx($h,{children:f.jsx(Nw,{message:h})});const b=p.some(y=>{var x;return(y.messages.length>0||(((x=y.attachedFiles)==null?void 0:x.length)??0)>0)&&!y.adapterLoadError});return f.jsx($h,{children:f.jsx(jx,{children:f.jsx(m1,{children:f.jsx(Dw,{children:f.jsx($w,{children:f.jsxs("div",{className:"h-dvh flex flex-col bg-white dark:bg-black text-slate-900 dark:text-slate-100",children:[f.jsxs("div",{className:"flex-1 flex flex-col md:flex-row md:pl-4 min-h-0",children:[b&&(u?f.jsx("div",{className:"hidden md:flex md:w-16 md:h-full shrink-0 items-start justify-center pt-8",children:f.jsx("button",{type:"button",onClick:()=>m(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-xl border border-slate-200/80 bg-white text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:border-[#333645] dark:bg-[#161616] dark:text-[#d1d5db] dark:hover:border-[#43465a] dark:hover:bg-[#202020] dark:hover:text-white","aria-label":i("app.sidebar.openAriaLabel"),title:i("app.sidebar.openTitle"),children:f.jsx(O1,{className:"h-4 w-4"})})}):f.jsx("div",{className:"hidden md:h-full md:flex",children:f.jsx(Mg,{onToggleDesktopSidebar:()=>m(!0)})})),f.jsxs("div",{className:"flex-1 flex flex-col w-full min-h-0",children:[f.jsx(Uw,{}),f.jsx("div",{className:"flex-1 flex justify-center w-full min-h-0",children:f.jsx(gw,{onOpenSettings:()=>r(!0),onOpenSidebar:()=>o(!0)})})]})]}),f.jsx(zw,{}),f.jsx(Tw,{isOpen:n,onClose:()=>r(!1)}),l&&f.jsxs("div",{className:"fixed inset-0 z-50 flex md:hidden",children:[f.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>o(!1),"aria-hidden":"true"}),f.jsxs("div",{className:"relative z-10 h-full w-[min(20rem,90vw)] animate-slideIn bg-white dark:bg-black",children:[f.jsx(Mg,{onRequestClose:()=>o(!1)}),f.jsx("button",{onClick:()=>o(!1),className:"absolute -right-3 top-[max(env(safe-area-inset-top),0.75rem)] rounded-full bg-white/95 p-3 text-gray-600 shadow-lg active:scale-95 transition-transform dark:bg-[#2d2f39] dark:text-[#ececf1]","aria-label":i("app.menu.closeAriaLabel"),children:f.jsx(wa,{className:"h-5 w-5"})})]})]})]})})})})})})}const Ld=new Sx({auth:{clientId:t0(),authority:`https://login.microsoftonline.com/${Yv()}`,redirectUri:typeof window<"u"?window.location.origin:"/"},cache:{cacheLocation:"sessionStorage"}});function Fw({children:i}){const[n,r]=S.useState(!1);return S.useEffect(()=>{Ld.initialize().then(()=>Ld.handleRedirectPromise()).catch(l=>{console.error("[EntraAuth] Redirect processing failed:",l)}).finally(()=>r(!0))},[]),n?f.jsx(wx,{instance:Ld,children:i}):null}function Bw({children:i}){if(!Zd()||!za())return f.jsx(f.Fragment,{children:i});if(uc()==="entra")return f.jsx(Fw,{children:i});const r=Pv(),l=t0(),o=Xv();return!r||!l?f.jsx(f.Fragment,{children:i}):f.jsx(kx,{domain:r,clientId:l,authorizationParams:{redirect_uri:window.location.origin,...o?{audience:o}:{}},cacheLocation:"memory",children:i})}O0(null);const zg=Uv(),Rg=document.querySelector('link[rel="icon"]');if(Rg)Rg.href=zg;else{const i=document.createElement("link");i.rel="icon",i.href=zg,document.head.appendChild(i)}const qw=c1();var Og,Ug,$g,Ig,Fg,Bg;for(const i of qw){const n=((Og=i.src)==null?void 0:Og.trim())||"",r=((Ug=i.content)==null?void 0:Ug.trim())||"",l=(($g=i.id)==null?void 0:$g.trim())||"";if(!n&&!r||l&&document.querySelector(`script[data-orbitchat-startup-script-id="${l}"]`)||Array.from(document.querySelectorAll("script[data-orbitchat-startup-script]")).some(m=>{const p=n&&m.dataset.orbitchatStartupScriptSrc===n,h=r&&(m.textContent||"").trim()===r;return!!(p||h)}))continue;const u=document.createElement("script");n&&(u.src=n),r&&(u.text=r),u.async=i.async??!0,i.defer!==void 0&&(u.defer=i.defer),(Ig=i.type)!=null&&Ig.trim()&&(u.type=i.type.trim()),(Fg=i.integrity)!=null&&Fg.trim()&&(u.integrity=i.integrity.trim()),i.crossOrigin&&(u.crossOrigin=i.crossOrigin),(Bg=i.referrerPolicy)!=null&&Bg.trim()&&(u.referrerPolicy=i.referrerPolicy.trim()),u.dataset.orbitchatStartupScript="true",l&&(u.dataset.orbitchatStartupScriptId=l),n&&(u.dataset.orbitchatStartupScriptSrc=n),document.head.appendChild(u)}se("🚀 AI Chat Application started");se(`📱 App Version: v${of}`);Nx.createRoot(document.getElementById("root")).render(f.jsx(S.StrictMode,{children:f.jsx(Bw,{children:f.jsx(Iw,{})})}));export{dc as a,uy as r,pt as u};
|