@eoasmxd/freya 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/core/dist/context.js +2 -2
  2. package/core/dist/plugin/plugin-manager.d.ts +1 -1
  3. package/core/dist/plugin/plugin-manager.js +8 -8
  4. package/core/dist/prompt/prompt-registry.d.ts +4 -4
  5. package/core/dist/prompt/prompt-registry.js +33 -14
  6. package/core/dist/skill/skill-registry.d.ts +1 -1
  7. package/core/dist/skill/skill-registry.js +5 -5
  8. package/core/dist/utils/paths.d.ts +2 -2
  9. package/core/dist/utils/paths.js +4 -3
  10. package/core/package.json +2 -2
  11. package/doc/tutorials/part5_plugins/10.1_microkernel_decoupling.md +2 -2
  12. package/freya.js +2 -2
  13. package/package.json +2 -2
  14. package/plugins/plugin-gemini/package.json +1 -1
  15. package/plugins/plugin-openai/package.json +1 -1
  16. package/plugins/plugin-telegram-channel/package.json +1 -1
  17. package/plugins/plugin-tool-fs/dist/tools.d.ts +1 -1
  18. package/plugins/plugin-tool-fs/dist/tools.js +58 -15
  19. package/plugins/plugin-tool-fs/package.json +1 -1
  20. package/plugins/plugin-tool-memory/package.json +1 -1
  21. package/plugins/plugin-tool-mysql/package.json +1 -1
  22. package/plugins/plugin-tool-web/package.json +1 -1
  23. package/plugins/plugin-wecom-channel/package.json +1 -1
  24. package/plugins/plugin-weixin-channel/package.json +1 -1
  25. package/src/packages/core/src/context.ts +2 -2
  26. package/src/packages/core/src/plugin/plugin-manager.ts +11 -11
  27. package/src/packages/core/src/prompt/prompt-registry.ts +39 -15
  28. package/src/packages/core/src/skill/skill-registry.ts +7 -7
  29. package/src/packages/core/src/utils/paths.ts +5 -4
  30. package/src/packages/sdk/src/types/context.ts +5 -5
  31. package/src/packages/ui/src/features/config/panels/PluginConfigPanel.tsx +2 -2
  32. package/src/packages/ui/src/features/config/panels/SkillConfigPanel.tsx +2 -2
  33. package/src/plugins/plugin-tool-fs/src/tools.ts +65 -15
  34. package/ui/assets/{index-CSZmaZbL.js → index-CD0PlILU.js} +1 -1
  35. package/ui/index.html +1 -1
@@ -40,4 +40,4 @@ Error generating stack: `+o.message+`
40
40
  `+o.stack}return{value:e,source:t,stack:l,digest:null}}function go(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function bo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Kf=typeof WeakMap=="function"?WeakMap:Map;function sc(e,t,n){n=ht(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Cl||(Cl=!0,us=r),bo(e,t)},n}function ic(e,t,n){n=ht(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){bo(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){bo(e,t),typeof r!="function"&&(Rt===null?Rt=new Set([this]):Rt.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function ta(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Kf;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=sp.bind(null,e,t,n),t.then(e,e))}function na(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ra(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ht(-1,1),t.tag=2,Ot(n,t,1))),n.lanes|=1),e)}var Yf=kt.ReactCurrentOwner,$e=!1;function ze(e,t,n,r){t.child=e===null?$u(t,null,n,r):zn(t,e.child,n,r)}function la(e,t,n,r,l){n=n.render;var o=t.ref;return Cn(t,l),r=Qs(e,t,n,r,o,l),n=Ks(),e!==null&&!$e?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,xt(e,t,l)):(re&&n&&Ms(t),t.flags|=1,ze(e,t,r,l),t.child)}function oa(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!ni(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,ac(e,t,o,r,l)):(e=ll(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:mr,n(s,r)&&e.ref===t.ref)return xt(e,t,l)}return t.flags|=1,e=Dt(o,r),e.ref=t.ref,e.return=t,t.child=e}function ac(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(mr(o,r)&&e.ref===t.ref)if($e=!1,t.pendingProps=r=o,(e.lanes&l)!==0)e.flags&131072&&($e=!0);else return t.lanes=e.lanes,xt(e,t,l)}return es(e,t,n,r,l)}function uc(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},q(kn,Ae),Ae|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,q(kn,Ae),Ae|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,q(kn,Ae),Ae|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,q(kn,Ae),Ae|=r;return ze(e,t,l,n),t.child}function cc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function es(e,t,n,r,l){var o=Fe(n)?bt:Pe.current;return o=Pn(t,o),Cn(t,l),n=Qs(e,t,n,r,o,l),r=Ks(),e!==null&&!$e?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,xt(e,t,l)):(re&&r&&Ms(t),t.flags|=1,ze(e,t,n,l),t.child)}function sa(e,t,n,r,l){if(Fe(n)){var o=!0;hl(t)}else o=!1;if(Cn(t,l),t.stateNode===null)tl(e,t),oc(t,n,r),qo(t,n,r,l),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var u=s.context,d=n.contextType;typeof d=="object"&&d!==null?d=Xe(d):(d=Fe(n)?bt:Pe.current,d=Pn(t,d));var g=n.getDerivedStateFromProps,f=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||u!==d)&&ea(t,s,r,d),Ct=!1;var p=t.memoizedState;s.state=p,kl(t,r,s,l),u=t.memoizedState,a!==r||p!==u||De.current||Ct?(typeof g=="function"&&(Zo(t,n,g,r),u=t.memoizedState),(a=Ct||bi(t,n,a,r,p,u,d))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),s.props=r,s.state=u,s.context=d,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Fu(e,t),a=t.memoizedProps,d=t.type===t.elementType?a:be(t.type,a),s.props=d,f=t.pendingProps,p=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=Xe(u):(u=Fe(n)?bt:Pe.current,u=Pn(t,u));var y=n.getDerivedStateFromProps;(g=typeof y=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||p!==u)&&ea(t,s,r,u),Ct=!1,p=t.memoizedState,s.state=p,kl(t,r,s,l);var v=t.memoizedState;a!==f||p!==v||De.current||Ct?(typeof y=="function"&&(Zo(t,n,y,r),v=t.memoizedState),(d=Ct||bi(t,n,d,r,p,v,u)||!1)?(g||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,v,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,v,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),s.props=r,s.state=v,s.context=u,r=d):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return ts(e,t,n,r,o,l)}function ts(e,t,n,r,l,o){cc(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return l&&Qi(t,n,!1),xt(e,t,o);r=t.stateNode,Yf.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=zn(t,e.child,null,o),t.child=zn(t,null,a,o)):ze(e,t,a,o),t.memoizedState=r.state,l&&Qi(t,n,!0),t.child}function dc(e){var t=e.stateNode;t.pendingContext?Hi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hi(e,t.context,!1),Ws(e,t.containerInfo)}function ia(e,t,n,r,l){return _n(),Rs(l),t.flags|=256,ze(e,t,n,r),t.child}var ns={dehydrated:null,treeContext:null,retryLane:0};function rs(e){return{baseLanes:e,cachePool:null,transitions:null}}function fc(e,t,n){var r=t.pendingProps,l=le.current,o=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(l&2)!==0),a?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),q(le,l&1),e===null)return Jo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,o?(r=t.mode,o=t.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Al(s,r,0,null),e=Zt(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=rs(n),t.memoizedState=ns,e):Js(t,s));if(l=e.memoizedState,l!==null&&(a=l.dehydrated,a!==null))return Gf(e,t,s,r,a,l,n);if(o){o=r.fallback,s=t.mode,l=e.child,a=l.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Dt(l,u),r.subtreeFlags=l.subtreeFlags&14680064),a!==null?o=Dt(a,o):(o=Zt(o,s,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,s=e.child.memoizedState,s=s===null?rs(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=e.childLanes&~n,t.memoizedState=ns,r}return o=e.child,e=o.sibling,r=Dt(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Js(e,t){return t=Al({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Vr(e,t,n,r){return r!==null&&Rs(r),zn(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,n,r,l,o,s){if(n)return t.flags&256?(t.flags&=-257,r=go(Error(j(422))),Vr(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=Al({mode:"visible",children:r.children},l,0,null),o=Zt(o,l,s,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&zn(t,e.child,null,s),t.child.memoizedState=rs(s),t.memoizedState=ns,o);if(!(t.mode&1))return Vr(e,t,s,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(j(419)),r=go(o,r,void 0),Vr(e,t,s,r)}if(a=(s&e.childLanes)!==0,$e||a){if(r=xe,r!==null){switch(s&-s){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|s)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,vt(e,l),rt(r,e,l,-1))}return ti(),r=go(Error(j(421))),Vr(e,t,s,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=ip.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,We=Mt(l.nextSibling),Be=t,re=!0,tt=null,e!==null&&(Ke[Ye++]=pt,Ke[Ye++]=mt,Ke[Ye++]=en,pt=e.id,mt=e.overflow,en=t),t=Js(t,r.children),t.flags|=4096,t)}function aa(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xo(e.return,t,n)}function yo(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function pc(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(ze(e,t,r.children,n),r=le.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&aa(e,n,t);else if(e.tag===19)aa(e,n,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}r&=1}if(q(le,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Sl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),yo(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Sl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}yo(t,!0,n,null,o);break;case"together":yo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function tl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function xt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),nn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(j(153));if(t.child!==null){for(e=t.child,n=Dt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Dt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Jf(e,t,n){switch(t.tag){case 3:dc(t),_n();break;case 5:Uu(t);break;case 1:Fe(t.type)&&hl(t);break;case 4:Ws(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;q(vl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(q(le,le.current&1),t.flags|=128,null):n&t.child.childLanes?fc(e,t,n):(q(le,le.current&1),e=xt(e,t,n),e!==null?e.sibling:null);q(le,le.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return pc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),q(le,le.current),r)break;return null;case 22:case 23:return t.lanes=0,uc(e,t,n)}return xt(e,t,n)}var mc,ls,hc,gc;mc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ls=function(){};hc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Jt(ut.current);var o=null;switch(n){case"input":l=Eo(e,l),r=Eo(e,r),o=[];break;case"select":l=se({},l,{value:void 0}),r=se({},r,{value:void 0}),o=[];break;case"textarea":l=_o(e,l),r=_o(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=pl)}Io(n,r);var s;n=null;for(d in l)if(!r.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var a=l[d];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(ir.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in r){var u=r[d];if(a=l!=null?l[d]:void 0,r.hasOwnProperty(d)&&u!==a&&(u!=null||a!=null))if(d==="style")if(a){for(s in a)!a.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&a[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(o||(o=[]),o.push(d,n)),n=u;else d==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(o=o||[]).push(d,u)):d==="children"?typeof u!="string"&&typeof u!="number"||(o=o||[]).push(d,""+u):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(ir.hasOwnProperty(d)?(u!=null&&d==="onScroll"&&ee("scroll",e),o||a===u||(o=[])):(o=o||[]).push(d,u))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};gc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Qn(e,t){if(!re)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ee(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Xf(e,t,n){var r=t.pendingProps;switch(Os(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ee(t),null;case 1:return Fe(t.type)&&ml(),Ee(t),null;case 3:return r=t.stateNode,In(),te(De),te(Pe),Vs(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Wr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,tt!==null&&(fs(tt),tt=null))),ls(e,t),Ee(t),null;case 5:Bs(t);var l=Jt(xr.current);if(n=t.type,e!==null&&t.stateNode!=null)hc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(j(166));return Ee(t),null}if(e=Jt(ut.current),Wr(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[it]=t,r[yr]=o,e=(t.mode&1)!==0,n){case"dialog":ee("cancel",r),ee("close",r);break;case"iframe":case"object":case"embed":ee("load",r);break;case"video":case"audio":for(l=0;l<Zn.length;l++)ee(Zn[l],r);break;case"source":ee("error",r);break;case"img":case"image":case"link":ee("error",r),ee("load",r);break;case"details":ee("toggle",r);break;case"input":yi(r,o),ee("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},ee("invalid",r);break;case"textarea":xi(r,o),ee("invalid",r)}Io(n,o),l=null;for(var s in o)if(o.hasOwnProperty(s)){var a=o[s];s==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&Ar(r.textContent,a,e),l=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&Ar(r.textContent,a,e),l=["children",""+a]):ir.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&ee("scroll",r)}switch(n){case"input":Lr(r),vi(r,o,!0);break;case"textarea":Lr(r),ki(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=pl)}r=l,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Ha(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[it]=t,e[yr]=r,mc(e,t,!1,!1),t.stateNode=e;e:{switch(s=Lo(n,r),n){case"dialog":ee("cancel",e),ee("close",e),l=r;break;case"iframe":case"object":case"embed":ee("load",e),l=r;break;case"video":case"audio":for(l=0;l<Zn.length;l++)ee(Zn[l],e);l=r;break;case"source":ee("error",e),l=r;break;case"img":case"image":case"link":ee("error",e),ee("load",e),l=r;break;case"details":ee("toggle",e),l=r;break;case"input":yi(e,r),l=Eo(e,r),ee("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=se({},r,{value:void 0}),ee("invalid",e);break;case"textarea":xi(e,r),l=_o(e,r),ee("invalid",e);break;default:l=r}Io(n,l),a=l;for(o in a)if(a.hasOwnProperty(o)){var u=a[o];o==="style"?Ya(e,u):o==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Qa(e,u)):o==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&ar(e,u):typeof u=="number"&&ar(e,""+u):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(ir.hasOwnProperty(o)?u!=null&&o==="onScroll"&&ee("scroll",e):u!=null&&xs(e,o,u,s))}switch(n){case"input":Lr(e),vi(e,r,!1);break;case"textarea":Lr(e),ki(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ft(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Sn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Sn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=pl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ee(t),null;case 6:if(e&&t.stateNode!=null)gc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(j(166));if(n=Jt(xr.current),Jt(ut.current),Wr(t)){if(r=t.stateNode,n=t.memoizedProps,r[it]=t,(o=r.nodeValue!==n)&&(e=Be,e!==null))switch(e.tag){case 3:Ar(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ar(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[it]=t,t.stateNode=r}return Ee(t),null;case 13:if(te(le),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(re&&We!==null&&t.mode&1&&!(t.flags&128))Ou(),_n(),t.flags|=98560,o=!1;else if(o=Wr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(j(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(j(317));o[it]=t}else _n(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ee(t),o=!1}else tt!==null&&(fs(tt),tt=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||le.current&1?ge===0&&(ge=3):ti())),t.updateQueue!==null&&(t.flags|=4),Ee(t),null);case 4:return In(),ls(e,t),e===null&&hr(t.stateNode.containerInfo),Ee(t),null;case 10:return Fs(t.type._context),Ee(t),null;case 17:return Fe(t.type)&&ml(),Ee(t),null;case 19:if(te(le),o=t.memoizedState,o===null)return Ee(t),null;if(r=(t.flags&128)!==0,s=o.rendering,s===null)if(r)Qn(o,!1);else{if(ge!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Sl(e),s!==null){for(t.flags|=128,Qn(o,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,e=s.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return q(le,le.current&1|2),t.child}e=e.sibling}o.tail!==null&&ce()>Mn&&(t.flags|=128,r=!0,Qn(o,!1),t.lanes=4194304)}else{if(!r)if(e=Sl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Qn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!re)return Ee(t),null}else 2*ce()-o.renderingStartTime>Mn&&n!==1073741824&&(t.flags|=128,r=!0,Qn(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ce(),t.sibling=null,n=le.current,q(le,r?n&1|2:n&1),t):(Ee(t),null);case 22:case 23:return ei(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ae&1073741824&&(Ee(t),t.subtreeFlags&6&&(t.flags|=8192)):Ee(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function Zf(e,t){switch(Os(t),t.tag){case 1:return Fe(t.type)&&ml(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return In(),te(De),te(Pe),Vs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Bs(t),null;case 13:if(te(le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));_n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return te(le),null;case 4:return In(),null;case 10:return Fs(t.type._context),null;case 22:case 23:return ei(),null;case 24:return null;default:return null}}var Hr=!1,Te=!1,qf=typeof WeakSet=="function"?WeakSet:Set,M=null;function xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ue(e,t,r)}else n.current=null}function os(e,t,n){try{n()}catch(r){ue(e,t,r)}}var ua=!1;function bf(e,t){if(Bo=cl,e=Su(),Ls(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,d=0,g=0,f=e,p=null;t:for(;;){for(var y;f!==n||l!==0&&f.nodeType!==3||(a=s+l),f!==o||r!==0&&f.nodeType!==3||(u=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(y=f.firstChild)!==null;)p=f,f=y;for(;;){if(f===e)break t;if(p===n&&++d===l&&(a=s),p===o&&++g===r&&(u=s),(y=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=y}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Vo={focusedElem:e,selectionRange:n},cl=!1,M=t;M!==null;)if(t=M,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,M=e;else for(;M!==null;){t=M;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var N=v.memoizedProps,U=v.memoizedState,m=t.stateNode,c=m.getSnapshotBeforeUpdate(t.elementType===t.type?N:be(t.type,N),U);m.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(S){ue(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,M=e;break}M=t.return}return v=ua,ua=!1,v}function lr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&os(t,n,o)}l=l.next}while(l!==r)}}function Fl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ss(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function yc(e){var t=e.alternate;t!==null&&(e.alternate=null,yc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[it],delete t[yr],delete t[Ko],delete t[Rf],delete t[$f])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function vc(e){return e.tag===5||e.tag===3||e.tag===4}function ca(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vc(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.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 is(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pl));else if(r!==4&&(e=e.child,e!==null))for(is(e,t,n),e=e.sibling;e!==null;)is(e,t,n),e=e.sibling}function as(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(as(e,t,n),e=e.sibling;e!==null;)as(e,t,n),e=e.sibling}var Se=null,et=!1;function Nt(e,t,n){for(n=n.child;n!==null;)xc(e,t,n),n=n.sibling}function xc(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(zl,n)}catch{}switch(n.tag){case 5:Te||xn(n,t);case 6:var r=Se,l=et;Se=null,Nt(e,t,n),Se=r,et=l,Se!==null&&(et?(e=Se,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Se.removeChild(n.stateNode));break;case 18:Se!==null&&(et?(e=Se,n=n.stateNode,e.nodeType===8?uo(e.parentNode,n):e.nodeType===1&&uo(e,n),fr(e)):uo(Se,n.stateNode));break;case 4:r=Se,l=et,Se=n.stateNode.containerInfo,et=!0,Nt(e,t,n),Se=r,et=l;break;case 0:case 11:case 14:case 15:if(!Te&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&os(n,t,s),l=l.next}while(l!==r)}Nt(e,t,n);break;case 1:if(!Te&&(xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ue(n,t,a)}Nt(e,t,n);break;case 21:Nt(e,t,n);break;case 22:n.mode&1?(Te=(r=Te)||n.memoizedState!==null,Nt(e,t,n),Te=r):Nt(e,t,n);break;default:Nt(e,t,n)}}function da(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qf),t.forEach(function(r){var l=ap.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function qe(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];try{var o=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:Se=a.stateNode,et=!1;break e;case 3:Se=a.stateNode.containerInfo,et=!0;break e;case 4:Se=a.stateNode.containerInfo,et=!0;break e}a=a.return}if(Se===null)throw Error(j(160));xc(o,s,l),Se=null,et=!1;var u=l.alternate;u!==null&&(u.return=null),l.return=null}catch(d){ue(l,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)kc(t,e),t=t.sibling}function kc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(qe(t,e),ot(e),r&4){try{lr(3,e,e.return),Fl(3,e)}catch(N){ue(e,e.return,N)}try{lr(5,e,e.return)}catch(N){ue(e,e.return,N)}}break;case 1:qe(t,e),ot(e),r&512&&n!==null&&xn(n,n.return);break;case 5:if(qe(t,e),ot(e),r&512&&n!==null&&xn(n,n.return),e.flags&32){var l=e.stateNode;try{ar(l,"")}catch(N){ue(e,e.return,N)}}if(r&4&&(l=e.stateNode,l!=null)){var o=e.memoizedProps,s=n!==null?n.memoizedProps:o,a=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&Ba(l,o),Lo(a,s);var d=Lo(a,o);for(s=0;s<u.length;s+=2){var g=u[s],f=u[s+1];g==="style"?Ya(l,f):g==="dangerouslySetInnerHTML"?Qa(l,f):g==="children"?ar(l,f):xs(l,g,f,d)}switch(a){case"input":To(l,o);break;case"textarea":Va(l,o);break;case"select":var p=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!o.multiple;var y=o.value;y!=null?Sn(l,!!o.multiple,y,!1):p!==!!o.multiple&&(o.defaultValue!=null?Sn(l,!!o.multiple,o.defaultValue,!0):Sn(l,!!o.multiple,o.multiple?[]:"",!1))}l[yr]=o}catch(N){ue(e,e.return,N)}}break;case 6:if(qe(t,e),ot(e),r&4){if(e.stateNode===null)throw Error(j(162));l=e.stateNode,o=e.memoizedProps;try{l.nodeValue=o}catch(N){ue(e,e.return,N)}}break;case 3:if(qe(t,e),ot(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{fr(t.containerInfo)}catch(N){ue(e,e.return,N)}break;case 4:qe(t,e),ot(e);break;case 13:qe(t,e),ot(e),l=e.child,l.flags&8192&&(o=l.memoizedState!==null,l.stateNode.isHidden=o,!o||l.alternate!==null&&l.alternate.memoizedState!==null||(qs=ce())),r&4&&da(e);break;case 22:if(g=n!==null&&n.memoizedState!==null,e.mode&1?(Te=(d=Te)||g,qe(t,e),Te=d):qe(t,e),ot(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!g&&e.mode&1)for(M=e,g=e.child;g!==null;){for(f=M=g;M!==null;){switch(p=M,y=p.child,p.tag){case 0:case 11:case 14:case 15:lr(4,p,p.return);break;case 1:xn(p,p.return);var v=p.stateNode;if(typeof v.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(N){ue(r,n,N)}}break;case 5:xn(p,p.return);break;case 22:if(p.memoizedState!==null){pa(f);continue}}y!==null?(y.return=p,M=y):pa(f)}g=g.sibling}e:for(g=null,f=e;;){if(f.tag===5){if(g===null){g=f;try{l=f.stateNode,d?(o=l.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=f.stateNode,u=f.memoizedProps.style,s=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=Ka("display",s))}catch(N){ue(e,e.return,N)}}}else if(f.tag===6){if(g===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(N){ue(e,e.return,N)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;g===f&&(g=null),f=f.return}g===f&&(g=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:qe(t,e),ot(e),r&4&&da(e);break;case 21:break;default:qe(t,e),ot(e)}}function ot(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(vc(n)){var r=n;break e}n=n.return}throw Error(j(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(ar(l,""),r.flags&=-33);var o=ca(e);as(e,o,l);break;case 3:case 4:var s=r.stateNode.containerInfo,a=ca(e);is(e,a,s);break;default:throw Error(j(161))}}catch(u){ue(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ep(e,t,n){M=e,Sc(e)}function Sc(e,t,n){for(var r=(e.mode&1)!==0;M!==null;){var l=M,o=l.child;if(l.tag===22&&r){var s=l.memoizedState!==null||Hr;if(!s){var a=l.alternate,u=a!==null&&a.memoizedState!==null||Te;a=Hr;var d=Te;if(Hr=s,(Te=u)&&!d)for(M=l;M!==null;)s=M,u=s.child,s.tag===22&&s.memoizedState!==null?ma(l):u!==null?(u.return=s,M=u):ma(l);for(;o!==null;)M=o,Sc(o),o=o.sibling;M=l,Hr=a,Te=d}fa(e)}else l.subtreeFlags&8772&&o!==null?(o.return=l,M=o):fa(e)}}function fa(e){for(;M!==null;){var t=M;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Te||Fl(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Te)if(n===null)r.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:be(t.type,n.memoizedProps);r.componentDidUpdate(l,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&Xi(t,o,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Xi(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var g=d.memoizedState;if(g!==null){var f=g.dehydrated;f!==null&&fr(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(j(163))}Te||t.flags&512&&ss(t)}catch(p){ue(t,t.return,p)}}if(t===e){M=null;break}if(n=t.sibling,n!==null){n.return=t.return,M=n;break}M=t.return}}function pa(e){for(;M!==null;){var t=M;if(t===e){M=null;break}var n=t.sibling;if(n!==null){n.return=t.return,M=n;break}M=t.return}}function ma(e){for(;M!==null;){var t=M;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Fl(4,t)}catch(u){ue(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var l=t.return;try{r.componentDidMount()}catch(u){ue(t,l,u)}}var o=t.return;try{ss(t)}catch(u){ue(t,o,u)}break;case 5:var s=t.return;try{ss(t)}catch(u){ue(t,s,u)}}}catch(u){ue(t,t.return,u)}if(t===e){M=null;break}var a=t.sibling;if(a!==null){a.return=t.return,M=a;break}M=t.return}}var tp=Math.ceil,jl=kt.ReactCurrentDispatcher,Xs=kt.ReactCurrentOwner,Je=kt.ReactCurrentBatchConfig,H=0,xe=null,de=null,we=0,Ae=0,kn=Wt(0),ge=0,Nr=null,nn=0,Ul=0,Zs=0,or=null,Re=null,qs=0,Mn=1/0,dt=null,Cl=!1,us=null,Rt=null,Qr=!1,_t=null,El=0,sr=0,cs=null,nl=-1,rl=0;function Ie(){return H&6?ce():nl!==-1?nl:nl=ce()}function $t(e){return e.mode&1?H&2&&we!==0?we&-we:Ff.transition!==null?(rl===0&&(rl=ou()),rl):(e=G,e!==0||(e=window.event,e=e===void 0?16:fu(e.type)),e):1}function rt(e,t,n,r){if(50<sr)throw sr=0,cs=null,Error(j(185));Cr(e,n,r),(!(H&2)||e!==xe)&&(e===xe&&(!(H&2)&&(Ul|=n),ge===4&&Tt(e,we)),Ue(e,r),n===1&&H===0&&!(t.mode&1)&&(Mn=ce()+500,Rl&&Bt()))}function Ue(e,t){var n=e.callbackNode;Dd(e,t);var r=ul(e,e===xe?we:0);if(r===0)n!==null&&Ni(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ni(n),t===1)e.tag===0?Df(ha.bind(null,e)):Iu(ha.bind(null,e)),Mf(function(){!(H&6)&&Bt()}),n=null;else{switch(su(r)){case 1:n=js;break;case 4:n=ru;break;case 16:n=al;break;case 536870912:n=lu;break;default:n=al}n=_c(n,wc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function wc(e,t){if(nl=-1,rl=0,H&6)throw Error(j(327));var n=e.callbackNode;if(En()&&e.callbackNode!==n)return null;var r=ul(e,e===xe?we:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Tl(e,r);else{t=r;var l=H;H|=2;var o=jc();(xe!==e||we!==t)&&(dt=null,Mn=ce()+500,Xt(e,t));do try{lp();break}catch(a){Nc(e,a)}while(!0);Ds(),jl.current=o,H=l,de!==null?t=0:(xe=null,we=0,t=ge)}if(t!==0){if(t===2&&(l=Do(e),l!==0&&(r=l,t=ds(e,l))),t===1)throw n=Nr,Xt(e,0),Tt(e,r),Ue(e,ce()),n;if(t===6)Tt(e,r);else{if(l=e.current.alternate,!(r&30)&&!np(l)&&(t=Tl(e,r),t===2&&(o=Do(e),o!==0&&(r=o,t=ds(e,o))),t===1))throw n=Nr,Xt(e,0),Tt(e,r),Ue(e,ce()),n;switch(e.finishedWork=l,e.finishedLanes=r,t){case 0:case 1:throw Error(j(345));case 2:Kt(e,Re,dt);break;case 3:if(Tt(e,r),(r&130023424)===r&&(t=qs+500-ce(),10<t)){if(ul(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){Ie(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Qo(Kt.bind(null,e,Re,dt),t);break}Kt(e,Re,dt);break;case 4:if(Tt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,l=-1;0<r;){var s=31-nt(r);o=1<<s,s=t[s],s>l&&(l=s),r&=~o}if(r=l,r=ce()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*tp(r/1960))-r,10<r){e.timeoutHandle=Qo(Kt.bind(null,e,Re,dt),r);break}Kt(e,Re,dt);break;case 5:Kt(e,Re,dt);break;default:throw Error(j(329))}}}return Ue(e,ce()),e.callbackNode===n?wc.bind(null,e):null}function ds(e,t){var n=or;return e.current.memoizedState.isDehydrated&&(Xt(e,t).flags|=256),e=Tl(e,t),e!==2&&(t=Re,Re=n,t!==null&&fs(t)),e}function fs(e){Re===null?Re=e:Re.push.apply(Re,e)}function np(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var l=n[r],o=l.getSnapshot;l=l.value;try{if(!lt(o(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Tt(e,t){for(t&=~Zs,t&=~Ul,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-nt(t),r=1<<n;e[n]=-1,t&=~r}}function ha(e){if(H&6)throw Error(j(327));En();var t=ul(e,0);if(!(t&1))return Ue(e,ce()),null;var n=Tl(e,t);if(e.tag!==0&&n===2){var r=Do(e);r!==0&&(t=r,n=ds(e,r))}if(n===1)throw n=Nr,Xt(e,0),Tt(e,t),Ue(e,ce()),n;if(n===6)throw Error(j(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Kt(e,Re,dt),Ue(e,ce()),null}function bs(e,t){var n=H;H|=1;try{return e(t)}finally{H=n,H===0&&(Mn=ce()+500,Rl&&Bt())}}function rn(e){_t!==null&&_t.tag===0&&!(H&6)&&En();var t=H;H|=1;var n=Je.transition,r=G;try{if(Je.transition=null,G=1,e)return e()}finally{G=r,Je.transition=n,H=t,!(H&6)&&Bt()}}function ei(){Ae=kn.current,te(kn)}function Xt(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Lf(n)),de!==null)for(n=de.return;n!==null;){var r=n;switch(Os(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ml();break;case 3:In(),te(De),te(Pe),Vs();break;case 5:Bs(r);break;case 4:In();break;case 13:te(le);break;case 19:te(le);break;case 10:Fs(r.type._context);break;case 22:case 23:ei()}n=n.return}if(xe=e,de=e=Dt(e.current,null),we=Ae=t,ge=0,Nr=null,Zs=Ul=nn=0,Re=or=null,Gt!==null){for(t=0;t<Gt.length;t++)if(n=Gt[t],r=n.interleaved,r!==null){n.interleaved=null;var l=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=l,r.next=s}n.pending=r}Gt=null}return e}function Nc(e,t){do{var n=de;try{if(Ds(),br.current=Nl,wl){for(var r=oe.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}wl=!1}if(tn=0,ve=he=oe=null,rr=!1,kr=0,Xs.current=null,n===null||n.return===null){ge=1,Nr=t,de=null;break}e:{var o=e,s=n.return,a=n,u=t;if(t=we,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var d=u,g=a,f=g.tag;if(!(g.mode&1)&&(f===0||f===11||f===15)){var p=g.alternate;p?(g.updateQueue=p.updateQueue,g.memoizedState=p.memoizedState,g.lanes=p.lanes):(g.updateQueue=null,g.memoizedState=null)}var y=na(s);if(y!==null){y.flags&=-257,ra(y,s,a,o,t),y.mode&1&&ta(o,d,t),t=y,u=d;var v=t.updateQueue;if(v===null){var N=new Set;N.add(u),t.updateQueue=N}else v.add(u);break e}else{if(!(t&1)){ta(o,d,t),ti();break e}u=Error(j(426))}}else if(re&&a.mode&1){var U=na(s);if(U!==null){!(U.flags&65536)&&(U.flags|=256),ra(U,s,a,o,t),Rs(Ln(u,a));break e}}o=u=Ln(u,a),ge!==4&&(ge=2),or===null?or=[o]:or.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var m=sc(o,u,t);Ji(o,m);break e;case 1:a=u;var c=o.type,h=o.stateNode;if(!(o.flags&128)&&(typeof c.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Rt===null||!Rt.has(h)))){o.flags|=65536,t&=-t,o.lanes|=t;var S=ic(o,a,t);Ji(o,S);break e}}o=o.return}while(o!==null)}Ec(n)}catch(w){t=w,de===n&&n!==null&&(de=n=n.return);continue}break}while(!0)}function jc(){var e=jl.current;return jl.current=Nl,e===null?Nl:e}function ti(){(ge===0||ge===3||ge===2)&&(ge=4),xe===null||!(nn&268435455)&&!(Ul&268435455)||Tt(xe,we)}function Tl(e,t){var n=H;H|=2;var r=jc();(xe!==e||we!==t)&&(dt=null,Xt(e,t));do try{rp();break}catch(l){Nc(e,l)}while(!0);if(Ds(),H=n,jl.current=r,de!==null)throw Error(j(261));return xe=null,we=0,ge}function rp(){for(;de!==null;)Cc(de)}function lp(){for(;de!==null&&!Pd();)Cc(de)}function Cc(e){var t=Pc(e.alternate,e,Ae);e.memoizedProps=e.pendingProps,t===null?Ec(e):de=t,Xs.current=null}function Ec(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Zf(n,t),n!==null){n.flags&=32767,de=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ge=6,de=null;return}}else if(n=Xf(n,t,Ae),n!==null){de=n;return}if(t=t.sibling,t!==null){de=t;return}de=t=e}while(t!==null);ge===0&&(ge=5)}function Kt(e,t,n){var r=G,l=Je.transition;try{Je.transition=null,G=1,op(e,t,n,r)}finally{Je.transition=l,G=r}return null}function op(e,t,n,r){do En();while(_t!==null);if(H&6)throw Error(j(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(j(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Fd(e,o),e===xe&&(de=xe=null,we=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Qr||(Qr=!0,_c(al,function(){return En(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Je.transition,Je.transition=null;var s=G;G=1;var a=H;H|=4,Xs.current=null,bf(e,n),kc(n,e),Cf(Vo),cl=!!Bo,Vo=Bo=null,e.current=n,ep(n),_d(),H=a,G=s,Je.transition=o}else e.current=n;if(Qr&&(Qr=!1,_t=e,El=l),o=e.pendingLanes,o===0&&(Rt=null),Ld(n.stateNode),Ue(e,ce()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],r(l.value,{componentStack:l.stack,digest:l.digest});if(Cl)throw Cl=!1,e=us,us=null,e;return El&1&&e.tag!==0&&En(),o=e.pendingLanes,o&1?e===cs?sr++:(sr=0,cs=e):sr=0,Bt(),null}function En(){if(_t!==null){var e=su(El),t=Je.transition,n=G;try{if(Je.transition=null,G=16>e?16:e,_t===null)var r=!1;else{if(e=_t,_t=null,El=0,H&6)throw Error(j(331));var l=H;for(H|=4,M=e.current;M!==null;){var o=M,s=o.child;if(M.flags&16){var a=o.deletions;if(a!==null){for(var u=0;u<a.length;u++){var d=a[u];for(M=d;M!==null;){var g=M;switch(g.tag){case 0:case 11:case 15:lr(8,g,o)}var f=g.child;if(f!==null)f.return=g,M=f;else for(;M!==null;){g=M;var p=g.sibling,y=g.return;if(yc(g),g===d){M=null;break}if(p!==null){p.return=y,M=p;break}M=y}}}var v=o.alternate;if(v!==null){var N=v.child;if(N!==null){v.child=null;do{var U=N.sibling;N.sibling=null,N=U}while(N!==null)}}M=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,M=s;else e:for(;M!==null;){if(o=M,o.flags&2048)switch(o.tag){case 0:case 11:case 15:lr(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,M=m;break e}M=o.return}}var c=e.current;for(M=c;M!==null;){s=M;var h=s.child;if(s.subtreeFlags&2064&&h!==null)h.return=s,M=h;else e:for(s=c;M!==null;){if(a=M,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Fl(9,a)}}catch(w){ue(a,a.return,w)}if(a===s){M=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,M=S;break e}M=a.return}}if(H=l,Bt(),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(zl,e)}catch{}r=!0}return r}finally{G=n,Je.transition=t}}return!1}function ga(e,t,n){t=Ln(n,t),t=sc(e,t,1),e=Ot(e,t,1),t=Ie(),e!==null&&(Cr(e,1,t),Ue(e,t))}function ue(e,t,n){if(e.tag===3)ga(e,e,n);else for(;t!==null;){if(t.tag===3){ga(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Rt===null||!Rt.has(r))){e=Ln(n,e),e=ic(t,e,1),t=Ot(t,e,1),e=Ie(),t!==null&&(Cr(t,1,e),Ue(t,e));break}}t=t.return}}function sp(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ie(),e.pingedLanes|=e.suspendedLanes&n,xe===e&&(we&n)===n&&(ge===4||ge===3&&(we&130023424)===we&&500>ce()-qs?Xt(e,0):Zs|=n),Ue(e,t)}function Tc(e,t){t===0&&(e.mode&1?(t=Rr,Rr<<=1,!(Rr&130023424)&&(Rr=4194304)):t=1);var n=Ie();e=vt(e,t),e!==null&&(Cr(e,t,n),Ue(e,n))}function ip(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Tc(e,n)}function ap(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),Tc(e,n)}var Pc;Pc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)$e=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return $e=!1,Jf(e,t,n);$e=!!(e.flags&131072)}else $e=!1,re&&t.flags&1048576&&Lu(t,yl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;tl(e,t),e=t.pendingProps;var l=Pn(t,Pe.current);Cn(t,n),l=Qs(null,t,r,e,l,n);var o=Ks();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Fe(r)?(o=!0,hl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,As(t),l.updater=Dl,t.stateNode=l,l._reactInternals=t,qo(t,r,e,n),t=ts(null,t,r,!0,o,n)):(t.tag=0,re&&o&&Ms(t),ze(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(tl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=cp(r),e=be(r,e),l){case 0:t=es(null,t,r,e,n);break e;case 1:t=sa(null,t,r,e,n);break e;case 11:t=la(null,t,r,e,n);break e;case 14:t=oa(null,t,r,be(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:be(r,l),es(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:be(r,l),sa(e,t,r,l,n);case 3:e:{if(dc(t),e===null)throw Error(j(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Fu(e,t),kl(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Ln(Error(j(423)),t),t=ia(e,t,r,n,l);break e}else if(r!==l){l=Ln(Error(j(424)),t),t=ia(e,t,r,n,l);break e}else for(We=Mt(t.stateNode.containerInfo.firstChild),Be=t,re=!0,tt=null,n=$u(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_n(),r===l){t=xt(e,t,n);break e}ze(e,t,r,n)}t=t.child}return t;case 5:return Uu(t),e===null&&Jo(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,s=l.children,Ho(r,l)?s=null:o!==null&&Ho(r,o)&&(t.flags|=32),cc(e,t),ze(e,t,s,n),t.child;case 6:return e===null&&Jo(t),null;case 13:return fc(e,t,n);case 4:return Ws(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zn(t,null,r,n):ze(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:be(r,l),la(e,t,r,l,n);case 7:return ze(e,t,t.pendingProps,n),t.child;case 8:return ze(e,t,t.pendingProps.children,n),t.child;case 12:return ze(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,s=l.value,q(vl,r._currentValue),r._currentValue=s,o!==null)if(lt(o.value,s)){if(o.children===l.children&&!De.current){t=xt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(o.tag===1){u=ht(-1,n&-n),u.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var g=d.pending;g===null?u.next=u:(u.next=g.next,g.next=u),d.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Xo(o.return,n,t),a.lanes|=n;break}u=u.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(j(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Xo(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ze(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Cn(t,n),l=Xe(l),r=r(l),t.flags|=1,ze(e,t,r,n),t.child;case 14:return r=t.type,l=be(r,t.pendingProps),l=be(r.type,l),oa(e,t,r,l,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:be(r,l),tl(e,t),t.tag=1,Fe(r)?(e=!0,hl(t)):e=!1,Cn(t,n),oc(t,r,l),qo(t,r,l,n),ts(null,t,r,!0,e,n);case 19:return pc(e,t,n);case 22:return uc(e,t,n)}throw Error(j(156,t.tag))};function _c(e,t){return nu(e,t)}function up(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ge(e,t,n,r){return new up(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cp(e){if(typeof e=="function")return ni(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ss)return 11;if(e===ws)return 14}return 2}function Dt(e,t){var n=e.alternate;return n===null?(n=Ge(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ll(e,t,n,r,l,o){var s=2;if(r=e,typeof e=="function")ni(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case cn:return Zt(n.children,l,o,t);case ks:s=8,l|=8;break;case wo:return e=Ge(12,n,t,l|2),e.elementType=wo,e.lanes=o,e;case No:return e=Ge(13,n,t,l),e.elementType=No,e.lanes=o,e;case jo:return e=Ge(19,n,t,l),e.elementType=jo,e.lanes=o,e;case Ua:return Al(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Da:s=10;break e;case Fa:s=9;break e;case Ss:s=11;break e;case ws:s=14;break e;case jt:s=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=Ge(s,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Zt(e,t,n,r){return e=Ge(7,e,r,t),e.lanes=n,e}function Al(e,t,n,r){return e=Ge(22,e,r,t),e.elementType=Ua,e.lanes=n,e.stateNode={isHidden:!1},e}function vo(e,t,n){return e=Ge(6,e,null,t),e.lanes=n,e}function xo(e,t,n){return t=Ge(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ql(0),this.expirationTimes=ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ql(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ri(e,t,n,r,l,o,s,a,u){return e=new dp(e,t,n,a,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Ge(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},As(o),e}function fp(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:un,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function zc(e){if(!e)return Ut;e=e._reactInternals;e:{if(on(e)!==e||e.tag!==1)throw Error(j(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Fe(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(j(171))}if(e.tag===1){var n=e.type;if(Fe(n))return zu(e,n,t)}return t}function Ic(e,t,n,r,l,o,s,a,u){return e=ri(n,r,!0,e,l,o,s,a,u),e.context=zc(null),n=e.current,r=Ie(),l=$t(n),o=ht(r,l),o.callback=t??null,Ot(n,o,l),e.current.lanes=l,Cr(e,l,r),Ue(e,r),e}function Wl(e,t,n,r){var l=t.current,o=Ie(),s=$t(l);return n=zc(n),t.context===null?t.context=n:t.pendingContext=n,t=ht(o,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ot(l,t,s),e!==null&&(rt(e,l,s,o),qr(e,l,s)),s}function Pl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ya(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function li(e,t){ya(e,t),(e=e.alternate)&&ya(e,t)}function pp(){return null}var Lc=typeof reportError=="function"?reportError:function(e){console.error(e)};function oi(e){this._internalRoot=e}Bl.prototype.render=oi.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(j(409));Wl(e,t,null,null)};Bl.prototype.unmount=oi.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rn(function(){Wl(null,e,null,null)}),t[yt]=null}};function Bl(e){this._internalRoot=e}Bl.prototype.unstable_scheduleHydration=function(e){if(e){var t=uu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Et.length&&t!==0&&t<Et[n].priority;n++);Et.splice(n,0,e),n===0&&du(e)}};function si(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function va(){}function mp(e,t,n,r,l){if(l){if(typeof r=="function"){var o=r;r=function(){var d=Pl(s);o.call(d)}}var s=Ic(t,r,e,0,null,!1,!1,"",va);return e._reactRootContainer=s,e[yt]=s.current,hr(e.nodeType===8?e.parentNode:e),rn(),s}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var a=r;r=function(){var d=Pl(u);a.call(d)}}var u=ri(e,0,!1,null,null,!1,!1,"",va);return e._reactRootContainer=u,e[yt]=u.current,hr(e.nodeType===8?e.parentNode:e),rn(function(){Wl(t,u,n,r)}),u}function Hl(e,t,n,r,l){var o=n._reactRootContainer;if(o){var s=o;if(typeof l=="function"){var a=l;l=function(){var u=Pl(s);a.call(u)}}Wl(t,s,e,l)}else s=mp(n,t,e,l,r);return Pl(s)}iu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Xn(t.pendingLanes);n!==0&&(Cs(t,n|1),Ue(t,ce()),!(H&6)&&(Mn=ce()+500,Bt()))}break;case 13:rn(function(){var r=vt(e,1);if(r!==null){var l=Ie();rt(r,e,1,l)}}),li(e,1)}};Es=function(e){if(e.tag===13){var t=vt(e,134217728);if(t!==null){var n=Ie();rt(t,e,134217728,n)}li(e,134217728)}};au=function(e){if(e.tag===13){var t=$t(e),n=vt(e,t);if(n!==null){var r=Ie();rt(n,e,t,r)}li(e,t)}};uu=function(){return G};cu=function(e,t){var n=G;try{return G=e,t()}finally{G=n}};Oo=function(e,t,n){switch(t){case"input":if(To(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var l=Ol(r);if(!l)throw Error(j(90));Wa(r),To(r,l)}}}break;case"textarea":Va(e,n);break;case"select":t=n.value,t!=null&&Sn(e,!!n.multiple,t,!1)}};Xa=bs;Za=rn;var hp={usingClientEntryPoint:!1,Events:[Tr,mn,Ol,Ga,Ja,bs]},Kn={findFiberByHostInstance:Yt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gp={bundleType:Kn.bundleType,version:Kn.version,rendererPackageName:Kn.rendererPackageName,rendererConfig:Kn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:kt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=eu(e),e===null?null:e.stateNode},findFiberByHostInstance:Kn.findFiberByHostInstance||pp,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kr.isDisabled&&Kr.supportsFiber)try{zl=Kr.inject(gp),at=Kr}catch{}}He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=hp;He.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!si(t))throw Error(j(200));return fp(e,t,null,n)};He.createRoot=function(e,t){if(!si(e))throw Error(j(299));var n=!1,r="",l=Lc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=ri(e,1,!1,null,null,n,!1,r,l),e[yt]=t.current,hr(e.nodeType===8?e.parentNode:e),new oi(t)};He.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(j(188)):(e=Object.keys(e).join(","),Error(j(268,e)));return e=eu(t),e=e===null?null:e.stateNode,e};He.flushSync=function(e){return rn(e)};He.hydrate=function(e,t,n){if(!Vl(t))throw Error(j(200));return Hl(null,e,t,!0,n)};He.hydrateRoot=function(e,t,n){if(!si(e))throw Error(j(405));var r=n!=null&&n.hydratedSources||null,l=!1,o="",s=Lc;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=Ic(t,null,e,1,n??null,l,!1,o,s),e[yt]=t.current,hr(e),r)for(e=0;e<r.length;e++)n=r[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new Bl(t)};He.render=function(e,t,n){if(!Vl(t))throw Error(j(200));return Hl(null,e,t,!1,n)};He.unmountComponentAtNode=function(e){if(!Vl(e))throw Error(j(40));return e._reactRootContainer?(rn(function(){Hl(null,null,e,!1,function(){e._reactRootContainer=null,e[yt]=null})}),!0):!1};He.unstable_batchedUpdates=bs;He.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Vl(n))throw Error(j(200));if(e==null||e._reactInternals===void 0)throw Error(j(38));return Hl(e,t,n,!1,r)};He.version="18.3.1-next-f1338f8080-20240426";function Mc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mc)}catch(e){console.error(e)}}Mc(),Ma.exports=He;var yp=Ma.exports,xa=yp;ko.createRoot=xa.createRoot,ko.hydrateRoot=xa.hydrateRoot;const vp=({isConnected:e,onClear:t,onOpenConfig:n})=>i.jsxs("header",{className:"header",children:[i.jsx("div",{className:"logo-container",children:i.jsx("div",{className:"logo",children:"Freya 控制台"})}),i.jsxs("div",{className:"header-actions",children:[i.jsxs("div",{className:"status-container",children:[i.jsx("span",{className:`status-dot ${e?"connected":""}`}),i.jsx("span",{children:e?"已连接":"已断开"})]}),i.jsx("button",{className:"btn-header",onClick:t,children:"重置会话"}),i.jsx("button",{className:"btn-header",onClick:n,children:"系统设置"})]})]}),xp=({code:e,lang:t,index:n})=>{const r=()=>{navigator.clipboard.writeText(e)};return i.jsxs("div",{className:"md-code-block-container",children:[i.jsxs("div",{className:"md-code-block-header",children:[i.jsx("span",{className:"lang",children:t||"text"}),i.jsx("button",{className:"copy-btn",onClick:r,children:"📋 复制"})]}),i.jsx("pre",{className:"md-code-block",children:i.jsx("code",{children:e.split(`
41
41
  `).map((l,o)=>{let s=l;return l.trim().startsWith("//")||l.trim().startsWith("#")?s=i.jsx("span",{className:"md-code-comment",children:l}):s=l.split(/(".*?"|'.*?'|`.*?`|\b(const|let|var|function|return|import|export|class|extends|async|await|try|catch|if|else|for|while|new|default|interface|type)\b)/g).map((u,d)=>u?/^(const|let|var|function|return|import|export|class|extends|async|await|try|catch|if|else|for|while|new|default|interface|type)$/.test(u)?i.jsx("span",{className:"md-code-keyword",children:u},d):u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")||u.startsWith("`")&&u.endsWith("`")?i.jsx("span",{className:"md-code-string",children:u},d):u:null),i.jsx("div",{children:s},o)})})})]},`code-${n}`)};function ka(e,t){return i.jsxs("table",{children:[i.jsx("thead",{children:i.jsx("tr",{children:e.headers.map((n,r)=>i.jsx("th",{children:qt(n)},`th-${r}`))})}),i.jsx("tbody",{children:e.rows.map((n,r)=>i.jsx("tr",{children:n.map((l,o)=>i.jsx("td",{children:qt(l)},`td-${o}`))},`tr-${r}`))})]},`table-${t}`)}function Oc(e){return e?e.split(/(```[\s\S]*?```)/g).map((n,r)=>{if(n.startsWith("```")){const f=n.match(/```(\w*)\n([\s\S]*?)```/),p=f?f[1]:"",y=f?f[2]:n.slice(3,-3);return i.jsx(xp,{code:y,lang:p,index:r},`code-block-${r}`)}const l=n.split(`
42
42
  `),o=[];let s=[],a=null,u=[];const d=(f,p)=>{const y=[],v=[];for(const U of f){const m={content:U.content,children:[],indent:U.indent};for(;v.length>0&&v[v.length-1].indent>=U.indent;)v.pop();v.length===0?y.push(m):v[v.length-1].children.push(m),v.push(m)}const N=(U,m,c)=>U.length===0?null:i.jsx("ul",{style:{margin:"0.2rem 0",paddingLeft:"1.3rem"},children:U.map((h,S)=>i.jsxs("li",{children:[qt(h.content),h.children.length>0&&N(h.children,`${m}-${S}`)]},`${m}-${S}`))},c);return N(y,p,p)},g=(f,p)=>{const y=f.map(v=>v.replace(/^\s*>\s?/,"")).join(`
43
- `);return i.jsx("blockquote",{className:"md-blockquote",children:Oc(y)},p)};for(let f=0;f<l.length;f++){const p=l[f],y=p.trim(),v=y.startsWith(">");!v&&u.length>0&&(o.push(g(u,`quote-${f}`)),u=[]);const N=p.match(/^(\s*)([-*])\s+(.*)$/),U=!!N;!U&&s.length>0&&(o.push(d(s,`list-${f}`)),s=[]);const m=y.startsWith("|");if(!m&&a&&(o.push(ka(a,f)),a=null),!y){o.push(i.jsx("div",{style:{height:"0.4rem"}},`empty-${f}`));continue}if(/^[*-]{3,}$/.test(y)){o.push(i.jsx("hr",{},`hr-${f}`));continue}if(v)u.push(p);else if(U)s.push({indent:N[1].length,content:N[3]});else if(m){const h=p.split("|").map(w=>w.trim());if(h[0]===""&&h.shift(),h[h.length-1]===""&&h.pop(),h.length>0&&h.every(w=>/^[ :-]+$/.test(w)))continue;a?a.rows.push(h):a={headers:h,rows:[]}}else{if(y.startsWith("#")){const h=y.match(/^(#{1,6})\s+(.*)$/);if(h){const S=h[1].length,w=h[2],T=`h${S}`;o.push(i.jsx(T,{children:qt(w)},`h-${f}`));continue}}o.push(i.jsx("p",{children:qt(p)},`p-${f}`))}}return u.length>0&&o.push(g(u,"quote-final")),s.length>0&&o.push(d(s,"list-final")),a&&o.push(ka(a,l.length)),i.jsx("div",{children:o},`text-${r}`)}):[]}function qt(e){return e?e.split(/(!\[.*?\]\(.*?\)|\[.*?\]\(.*?\)|\*\*.*?\*\*|`.*?`)/g).map((n,r)=>{if(n.startsWith("![")&&n.endsWith(")")){const l=n.match(/!\[(.*?)\]\((.*?)\)/);if(l){const[,o,s]=l;return i.jsx("img",{src:s,alt:o,className:"md-image",style:{maxWidth:"100%",maxHeight:"300px",display:"block",borderRadius:"8px",margin:"0.8rem 0",border:"1px solid var(--border-color, #e0e0e0)"}},r)}}if(n.startsWith("[")&&n.endsWith(")")){const l=n.match(/\[(.*?)\]\((.*?)\)/);if(l){const[,o,s]=l;return i.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"md-link",style:{color:"#0066cc",textDecoration:"underline",wordBreak:"break-all"},children:qt(o)},r)}}return n.startsWith("**")&&n.endsWith("**")?i.jsx("strong",{children:qt(n.slice(2,-2))},r):n.startsWith("`")&&n.endsWith("`")?i.jsx("code",{className:"md-code-inline",children:n.slice(1,-1)},r):n}):[]}const kp=({msg:e,isExpanded:t,onToggle:n})=>{try{const r=JSON.parse(e.content),l=r.toolName,o=r.status,s=r.arguments,a=r.result,u=r.statusText;return i.jsxs("div",{className:"tool-card-container",children:[i.jsxs("div",{className:"tool-card-header",onClick:n,children:[i.jsxs("div",{className:"tool-card-title",children:[i.jsx("span",{className:`tool-card-indicator ${o}`}),i.jsxs("span",{children:["🔧 使用工具: ",l]})]}),i.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:[u," ",t?"▲ 折叠":"▼ 展开"]})]}),t&&i.jsx("div",{className:"tool-card-body",children:i.jsxs("pre",{children:[i.jsxs("div",{children:[i.jsx("strong",{children:"输入参数:"})," ",JSON.stringify(s,null,2)]}),i.jsxs("div",{style:{marginTop:"0.5rem"},children:[i.jsx("strong",{children:"输出结果:"})," ",typeof a=="object"?JSON.stringify(a,null,2):a]})]})})]})}catch{return i.jsx("div",{className:"message-bubble assistant",style:{fontStyle:"italic"},children:"🔧 工具调用信息解析失败"})}},Sp=({groupId:e,items:t,isExpanded:n,onToggleGroup:r,expandedTools:l,onToggleTool:o,isGenerating:s,isLatestGroup:a})=>{const u=t.some(g=>{try{const f=JSON.parse(g.content);return f.status!=="completed"&&f.status!=="failed"}catch{return!1}});let d="已全部执行完成";return u?d="执行中...":a&&s&&(d="思考中..."),i.jsxs("div",{className:`tool-group-container ${n?"expanded":"collapsed"}`,children:[i.jsxs("div",{className:"tool-group-header",onClick:r,children:[i.jsxs("div",{className:"tool-group-title",children:[i.jsx("span",{children:"🛠️ 工具调用过程"}),i.jsxs("span",{style:{fontSize:"0.75rem",fontWeight:400,color:"var(--text-secondary)"},children:["(共 ",t.length," 步 · ",d,")"]})]}),i.jsx("span",{className:"tool-group-action-hint",children:n?"▲ 折叠":"▼ 展开"})]}),n&&i.jsxs("div",{className:"tool-group-body",children:[t.map(g=>{let f=l[g.id];if(f===void 0)try{const p=JSON.parse(g.content);f=p.status!=="completed"&&p.status!=="failed"}catch{f=!1}return i.jsx(kp,{msg:g,isExpanded:f,onToggle:()=>o(g.id)},g.id)}),t.length>1&&i.jsxs("div",{className:"tool-group-footer",onClick:r,children:[i.jsxs("span",{children:["🛠️ 工具调用过程 (",t.length," 步 · ",d,")"]}),i.jsx("span",{className:"tool-group-footer-btn",children:"▲ 折叠"})]})]})]},e)},wp=({messages:e,chatPanelRef:t,isGenerating:n})=>{const[r,l]=P.useState({}),[o,s]=P.useState({}),a=p=>{l(y=>({...y,[p]:!y[p]}))},u=p=>{s(y=>({...y,[p]:!y[p]}))};Ia.useEffect(()=>{t.current&&requestAnimationFrame(()=>{t.current&&(t.current.scrollTop=t.current.scrollHeight)})},[e,n]);const d=[];let g=[];e.forEach(p=>{p.isTool?g.push(p):(g.length>0&&(d.push({type:"tool_group",groupId:`group-${g[0].id}`,items:g}),g=[]),d.push({type:"message",message:p}))}),g.length>0&&d.push({type:"tool_group",groupId:`group-${g[0].id}`,items:g});const f=d.map((p,y)=>p.type==="tool_group"?y:-1).filter(p=>p!==-1).pop();return i.jsx("div",{className:"chat-panel",ref:t,children:d.map((p,y)=>{if(p.type==="tool_group"){const{groupId:m,items:c}=p,h=y===f,S=c.some(T=>{try{const C=JSON.parse(T.content);return C.status!=="completed"&&C.status!=="failed"}catch{return!1}});let w=r[m];return w===void 0&&(w=!!(h&&n||S)),i.jsx(Sp,{groupId:m,items:c,isExpanded:w,onToggleGroup:()=>a(m),expandedTools:o,onToggleTool:u,isGenerating:n,isLatestGroup:h},m)}const v=p.message,U=v.role==="user"?"👤 用户":"🤖 Freya";return i.jsxs("div",{className:`message-wrapper ${v.role}`,children:[i.jsx("div",{className:"message-meta",children:i.jsx("span",{className:"name",children:U})}),i.jsx("div",{className:`message-bubble ${v.isTyping?"cursor-typing":""}`,children:i.jsx("div",{className:"message-content",children:Oc(v.content)})})]},v.id)})})},Np=({input:e,isConnected:t,isGenerating:n,billing:r,onChangeInput:l,onSend:o,onInterrupt:s})=>{const a=P.useRef(null),u=g=>{l(g.target.value),a.current&&(a.current.style.height="auto",a.current.style.height=`${a.current.scrollHeight}px`)},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),o(),a.current&&(a.current.style.height="auto"))};return i.jsxs("footer",{className:"footer",children:[i.jsxs("div",{className:"billing-bar",children:[i.jsxs("div",{children:["Token 消耗: ",i.jsxs("span",{children:[r.totalTokens," Tokens"]})," (输入: ",r.promptTokens," | 缓存: ",r.cachedPromptTokens," | 输出: ",r.completionTokens,")"]}),i.jsxs("div",{children:["估算账单: ",i.jsx("span",{className:"billing-cost",children:r.cost.toFixed(6)})]})]}),i.jsxs("div",{className:"input-container",children:[i.jsx("textarea",{ref:a,rows:1,className:"chat-textarea",placeholder:t?"输入消息,与 Freya 对话...":"正在连接服务器,请稍候...",value:e,disabled:!t,onChange:u,onKeyDown:d}),n?i.jsx("button",{className:"btn btn-interrupt",onClick:s,children:"中断"}):i.jsx("button",{className:"btn btn-send",onClick:o,disabled:!t||!e.trim(),children:"发送"})]})]})},jp=({getApiUrl:e})=>{const[t,n]=P.useState([]),[r,l]=P.useState({}),[o,s]=P.useState({}),[a,u]=P.useState({}),[d,g]=P.useState({}),[f,p]=P.useState({}),[y,v]=P.useState(null),[N,U]=P.useState({}),[m,c]=P.useState([]),[h,S]=P.useState(null),[w,T]=P.useState(!1),C=(k,z="success")=>{const L=O();c(F=>[...F,{id:L,message:k,type:z}]),setTimeout(()=>{c(F=>F.filter(I=>I.id!==L))},3e3)},O=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),Y=(k,z)=>{const L=z.split(".");let F=k;for(const I of L){if(F==null)return;F=F[I]}return F},W=async()=>{try{const z=await(await fetch(e("/api/config/providers"))).json(),L=[];if(z.success&&Array.isArray(z.data)){for(const Q of z.data)if(Array.isArray(Q.models))for(const ne of Q.models)L.push({providerId:Q.id,modelId:ne.id,displayName:`${Q.name} - ${ne.name||ne.id} (${ne.id})`})}n(L);const I=await(await fetch(e("/api/config/schema"))).json();let R={};I.success&&I.data&&(R=I.data,l(R));const A=await(await fetch(e("/api/config"))).json();if(A.success&&A.data){const Q={},ne={};for(const[K,b]of Object.entries(R))for(const B of b){const J=Y(A.data,B.key);Q[B.key]=J!==void 0?J:B.defaultValue,B.type==="array"&&B.key.startsWith("models.")&&L.length>0&&(ne[B.key]=`${L[0].providerId}:::${L[0].modelId}`)}s(Q),u(ne),S(Q),T(!1)}}catch(k){console.error("WS load global config failed:",k)}},ye=async()=>{try{const k={...o};for(const I of Object.values(r))for(const R of I){if(R.type==="array"&&R.key.startsWith("models.")){const E=a[R.key];if(E){const[A,Q]=E.split(":::"),ne=(d[R.key]||"").trim();if(ne){const K=Array.isArray(k[R.key])?k[R.key]:[];K.some(B=>B.provider===A&&B.model===Q)||(k[R.key]=[...K,{provider:A,model:Q,name:ne}])}}}if(R.type==="array"&&Array.isArray(R.children)&&R.children.length>0){const E=f[R.key];if(E&&Object.keys(E).length>0){let A=!1,Q=!0;for(const ne of R.children){const K=E[ne.key];K!==void 0&&String(K).trim()!==""&&(A=!0),ne.required&&(!K||String(K).trim()==="")&&(Q=!1)}if(A&&Q){const ne={};for(const b of R.children){let B=E[b.key];B===void 0&&(B=b.defaultValue!==void 0?b.defaultValue:""),b.type==="number"?B=Number(B):b.type==="boolean"&&(B=!!B),ne[b.key]=B}const K=Array.isArray(k[R.key])?k[R.key]:[];k[R.key]=[...K,ne]}}}}const z={};for(const[I,R]of Object.entries(k)){let E=R,A=null;for(const Q of Object.values(r)){const ne=Q.find(K=>K.key===I);if(ne){A=ne;break}}A&&(A.type==="number"?E=Number(R):A.type==="boolean"&&(E=!!R)),z[I]=E}const F=await(await fetch(e("/api/config/batch"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:z})})).json();F.success?(C("配置保存成功","success"),g({}),p({}),v(null),U({}),S(k),T(!1),W()):C(`保存失败: ${F.error||F.message}`,"error")}catch(k){console.error(k),C("保存配置失败","error")}};P.useEffect(()=>{W()},[]),P.useEffect(()=>{if(!h)return;const k=JSON.stringify(h)!==JSON.stringify(o);T(k)},[o,h]);const fe=(k,z,L)=>{if(!z){C("请选择有效的模型源","error");return}const[F,I]=z.split(":::"),R=L.trim()||I,E={provider:F,model:I,name:R};s(A=>{const Q=Array.isArray(A[k])?A[k]:[];return{...A,[k]:[...Q,E]}}),g(A=>({...A,[k]:""})),C("模型绑定已添加","success")},Oe=(k,z)=>{s(L=>{const F=Array.isArray(L[k])?L[k]:[];return{...L,[k]:F.filter((I,R)=>R!==z)}}),C("模型绑定已移除","success")},je=(k,z,L)=>{s(F=>{const I=Array.isArray(F[k])?[...F[k]]:[];if(L==="up"&&z===0||L==="down"&&z===I.length-1)return F;const R=L==="up"?z-1:z+1,E=I[z];return I[z]=I[R],I[R]=E,{...F,[k]:I}})},ie=(k,z)=>{const L=f[k]||{};for(const I of z)if(I.required&&(!L[I.key]||String(L[I.key]).trim()==="")){C(`请填写必填项: ${I.description||I.key}`,"error");return}const F={};for(const I of z){let R=L[I.key];R===void 0&&(R=I.defaultValue!==void 0?I.defaultValue:""),I.type==="number"?R=Number(R):I.type==="boolean"&&(R=!!R),F[I.key]=R}s(I=>{const R=Array.isArray(I[k])?I[k]:[];return{...I,[k]:[...R,F]}}),p(I=>({...I,[k]:{}})),C("项目已添加","success")},Z=(k,z)=>{s(L=>{const F=Array.isArray(L[k])?L[k]:[];return{...L,[k]:F.filter((I,R)=>R!==z)}}),C("项目已移除","success")},ae=(k,z,L)=>{v({fieldKey:k,index:z}),U(L||{})},_=(k,z,L)=>{for(const F of L)if(F.required&&(!N[F.key]||String(N[F.key]).trim()==="")){C(`请填写必填项: ${F.description||F.key}`,"error");return}s(F=>{const I=Array.isArray(F[k])?[...F[k]]:[];if(z>=0&&z<I.length){const R={...I[z]};for(const E of L){let A=N[E.key];A===void 0&&(A=E.defaultValue!==void 0?E.defaultValue:""),E.type==="number"?A=Number(A):E.type==="boolean"&&(A=!!A),R[E.key]=A}I[z]=R}return{...F,[k]:I}}),v(null),U({}),C("修改已保存","success")},D=Object.keys(r).sort((k,z)=>k==="core"?-1:z==="core"?1:k.localeCompare(z));return i.jsxs("div",{children:[D.map(k=>{const z=r[k]||[],L={};for(const I of z){const R=I.category||"通用设置";L[R]||(L[R]=[]),L[R].push(I)}if(Object.keys(L).length===0)return null;const F=k==="core"?"核心系统参数":k.startsWith("@eoasmxd/freya-plugin-")?`插件专属配置: ${k.replace("@eoasmxd/freya-plugin-","")}`:`扩展模块配置: ${k}`;return i.jsxs("div",{className:"config-group",style:{marginBottom:"1.8rem",borderBottom:"1px solid rgba(255,255,255,0.02)",paddingBottom:"1.2rem"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"1.05rem",color:"#ffffff",fontWeight:"bold",borderLeft:"3px solid var(--accent)",paddingLeft:"0.6rem",marginBottom:"1rem"},children:F}),Object.entries(L).map(([I,R])=>i.jsxs("div",{style:{marginBottom:"1.4rem"},children:[i.jsx("div",{style:{fontSize:"0.86rem",fontWeight:600,color:"rgba(255, 255, 255, 0.75)",borderLeft:"2px solid var(--accent)",paddingLeft:"0.5rem",marginTop:"1.4rem",marginBottom:"0.8rem"},children:I}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.1rem"},children:R.map(E=>{const A=o[E.key];if(E.type==="array"&&E.key.startsWith("models.")){const K=Array.isArray(A)?A:[],b=a[E.key]||"",B=d[E.key]||"";return i.jsx("div",{className:"config-group",style:{margin:"0.4rem 0"},children:i.jsxs("div",{className:"crud-form-card",style:{margin:0,borderStyle:"solid",borderColor:"rgba(255,255,255,0.04)",padding:"1rem",gap:"0.8rem"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(255,255,255,0.02)",paddingBottom:"0.4rem"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.82rem",color:"rgba(255, 255, 255, 0.85)",fontWeight:500,margin:0},children:E.description||E.key}),i.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)"},children:"降级 Fallback 链 (越靠上优先级越高)"})]}),i.jsx("div",{className:"models-list",style:{margin:"0.2rem 0"},children:K.length===0?i.jsx("div",{style:{fontSize:"0.76rem",color:"var(--text-secondary)",padding:"0.5rem 0",fontStyle:"italic"},children:"当前场景未绑定任何运行时模型。系统将使用默认路由。"}):K.map((J,pe)=>i.jsxs("div",{className:"model-item",style:{padding:"0.5rem 0.8rem",background:"rgba(255,255,255,0.01)"},children:[i.jsxs("div",{className:"model-name",style:{fontSize:"0.8rem"},children:[J.name," ",i.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-secondary)",fontWeight:"normal"},children:["(",J.provider," / ",J.model,")"]})]}),i.jsxs("div",{style:{display:"flex",gap:"0.4rem"},children:[i.jsx("button",{className:"btn-action edit",title:"提高优先级",disabled:pe===0,onClick:()=>je(E.key,pe,"up"),children:"▲"}),i.jsx("button",{className:"btn-action edit",title:"降低优先级",disabled:pe===K.length-1,onClick:()=>je(E.key,pe,"down"),children:"▼"}),i.jsx("button",{className:"btn-action delete",title:"移除",onClick:()=>Oe(E.key,pe),children:"移除"})]})]},pe))}),i.jsxs("div",{style:{display:"flex",gap:"0.65rem",alignItems:"center",marginTop:"0.2rem"},children:[i.jsx("select",{className:"config-input",style:{flex:1,fontSize:"0.78rem",padding:"0.4rem 0.6rem",height:"32px"},value:b,onChange:J=>u(pe=>({...pe,[E.key]:J.target.value})),children:t.map(J=>i.jsx("option",{value:`${J.providerId}:::${J.modelId}`,children:J.displayName},`${J.providerId}:::${J.modelId}`))}),i.jsx("input",{type:"text",placeholder:"自定义别名 (选填)",className:"config-input",style:{width:"160px",fontSize:"0.78rem",padding:"0.4rem 0.6rem",height:"32px",boxSizing:"border-box"},value:B,onChange:J=>g(pe=>({...pe,[E.key]:J.target.value}))}),i.jsx("button",{className:"btn-primary",style:{padding:"0.4rem 1rem",fontSize:"0.78rem",height:"32px"},onClick:()=>fe(E.key,b,B),children:"绑定"})]})]})},E.key)}if(E.type==="array"&&Array.isArray(E.children)&&E.children.length>0){const K=Array.isArray(A)?A:[],b=f[E.key]||{};return i.jsx("div",{className:"config-group",style:{margin:"0.4rem 0"},children:i.jsxs("div",{className:"crud-form-card",style:{margin:0,borderStyle:"solid",borderColor:"rgba(255,255,255,0.04)",padding:"1rem",gap:"0.8rem"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(255,255,255,0.02)",paddingBottom:"0.4rem"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.82rem",color:"rgba(255, 255, 255, 0.85)",fontWeight:500,margin:0},children:E.description||E.key}),i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)"},children:["子配置项列表 (",K.length," 项)"]})]}),i.jsx("div",{className:"models-list",style:{margin:"0.2rem 0"},children:K.length===0?i.jsx("div",{style:{fontSize:"0.76rem",color:"var(--text-secondary)",padding:"0.5rem 0",fontStyle:"italic"},children:"当前列表为空。请在下方表单录入并添加新项目。"}):K.map((B,J)=>{var Vt,ct;const pe=(y==null?void 0:y.fieldKey)===E.key&&(y==null?void 0:y.index)===J;return i.jsxs("div",{className:"model-item",style:{padding:"0.55rem 0.85rem",background:"rgba(255,255,255,0.01)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[pe?i.jsx("div",{style:{flex:1,display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end",marginRight:"1rem"},children:(Vt=E.children)==null?void 0:Vt.map(X=>{const Dn=X.uiHint==="password"||X.sensitive,St=N[X.key]??"";return i.jsxs("div",{style:{flex:1,minWidth:"130px"},children:[i.jsx("label",{style:{fontSize:"0.7rem",color:"var(--text-secondary)",display:"block",marginBottom:"0.2rem"},children:X.description||X.key}),X.type==="boolean"?i.jsxs("label",{className:"switch",style:{margin:"0.2rem 0"},children:[i.jsx("input",{type:"checkbox",checked:!!St,onChange:sn=>U(wt=>({...wt,[X.key]:sn.target.checked}))}),i.jsx("span",{className:"slider"})]}):i.jsx("input",{type:Dn?"password":X.type==="number"?"number":"text",className:"config-input",style:{height:"30px",boxSizing:"border-box",fontSize:"0.78rem",padding:"0.15rem 0.4rem"},value:St,onChange:sn=>U(wt=>({...wt,[X.key]:sn.target.value}))})]},X.key)})}):i.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-primary)",display:"flex",flexWrap:"wrap",gap:"1rem"},children:(ct=E.children)==null?void 0:ct.map(X=>{const St=X.sensitive||X.uiHint==="password"?"******":String(B[X.key]??"");return i.jsxs("span",{children:[i.jsxs("span",{style:{color:"var(--text-secondary)"},children:[X.description||X.key,":"]})," ",i.jsx("span",{style:{fontFamily:"monospace",fontWeight:600},children:St})]},X.key)})}),i.jsx("div",{style:{display:"flex",gap:"0.4rem",flexShrink:0},children:pe?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"btn-action edit",title:"保存",onClick:()=>_(E.key,J,E.children||[]),children:"保存"}),i.jsx("button",{className:"btn-action delete",title:"取消",onClick:()=>{v(null),U({})},children:"取消"})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"btn-action edit",title:"编辑",onClick:()=>ae(E.key,J,B),children:"编辑"}),i.jsx("button",{className:"btn-action delete",title:"删除",onClick:()=>Z(E.key,J),children:"删除"})]})})]},J)})}),i.jsxs("div",{style:{background:"rgba(0,0,0,0.1)",padding:"0.75rem",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.02)",marginTop:"0.3rem"},children:[i.jsx("div",{style:{fontSize:"0.72rem",color:"rgba(255,255,255,0.3)",fontWeight:600,marginBottom:"0.5rem"},children:"添加新项"}),i.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end"},children:[E.children.map(B=>{const J=B.uiHint==="password"||B.sensitive,pe=b[B.key]??"",Vt=B.required?`${B.description} (必填)`:B.description;return i.jsxs("div",{style:{flex:1,minWidth:"150px"},children:[i.jsx("label",{style:{fontSize:"0.74rem",color:"rgba(255, 255, 255, 0.7)",display:"block",marginBottom:"0.2rem",fontWeight:500},children:B.description||B.key}),B.type==="boolean"?i.jsxs("label",{className:"switch",style:{margin:"0.2rem 0"},children:[i.jsx("input",{type:"checkbox",checked:!!pe,onChange:ct=>p(X=>({...X,[E.key]:{...X[E.key]||{},[B.key]:ct.target.checked}}))}),i.jsx("span",{className:"slider"})]}):i.jsx("input",{type:J?"password":B.type==="number"?"number":"text",placeholder:Vt,className:"config-input",style:{height:"32px",boxSizing:"border-box",fontSize:"0.78rem",padding:"0.2rem 0.5rem"},value:pe,onChange:ct=>p(X=>({...X,[E.key]:{...X[E.key]||{},[B.key]:ct.target.value}}))})]},B.key)}),i.jsx("button",{className:"btn-primary",style:{padding:"0.4rem 1.2rem",fontSize:"0.78rem",height:"32px",flexShrink:0},onClick:()=>ie(E.key,E.children||[]),children:"添加"})]})]})]})},E.key)}const Q=E.description||E.key,ne=E.type==="boolean";return i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0.25rem",borderBottom:"1px solid rgba(255, 255, 255, 0.025)"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.84rem",color:"rgba(255, 255, 255, 0.85)",fontWeight:500,margin:0},children:Q}),ne?i.jsxs("label",{className:"switch",style:{margin:0},children:[i.jsx("input",{type:"checkbox",checked:!!A,onChange:K=>s(b=>({...b,[E.key]:K.target.checked}))}),i.jsx("span",{className:"slider"})]}):E.type==="number"?i.jsx("input",{type:"number",className:"config-input",style:{width:"280px",height:"34px",boxSizing:"border-box",margin:0},value:A??"",onChange:K=>s(b=>({...b,[E.key]:Number(K.target.value)}))}):i.jsx("input",{type:"text",className:"config-input",style:{width:"280px",height:"34px",boxSizing:"border-box",margin:0},value:typeof A=="object"?JSON.stringify(A):A??"",onChange:K=>{let b=K.target.value;if(E.type==="array")try{b=JSON.parse(K.target.value)}catch{b=K.target.value}s(B=>({...B,[E.key]:b}))}})]},E.key)})})]},I))]},k)}),i.jsxs("button",{className:`floating-save-btn ${w?"dirty":"clean"}`,onClick:ye,disabled:!w,title:w?"有未保存的修改,点击保存":"配置无改变",children:[i.jsx("span",{style:{fontSize:"1.1rem"},children:w?"💾":"✓"}),w?"保存配置":"无修改"]}),m.length>0&&i.jsx("div",{className:"toast-container",children:m.map(k=>i.jsx("div",{className:`toast-card ${k.type}`,children:i.jsx("span",{children:k.message})},k.id))})]})},Cp=({getApiUrl:e})=>{var ci;const[t,n]=P.useState([]),[r,l]=P.useState(""),[o,s]=P.useState({}),[a,u]=P.useState([]),[d,g]=P.useState(!1),[f,p]=P.useState(""),[y,v]=P.useState(""),[N,U]=P.useState("openai"),[m,c]=P.useState(""),[h,S]=P.useState(""),[w,T]=P.useState(!1),[C,O]=P.useState(""),[Y,W]=P.useState(""),[ye,fe]=P.useState(0),[Oe,je]=P.useState(0),[ie,Z]=P.useState(0),[ae,_]=P.useState(4096),[D,k]=P.useState(""),[z,L]=P.useState(""),[F,I]=P.useState(["text"]),[R,E]=P.useState(""),[A,Q]=P.useState(""),[ne,K]=P.useState(0),[b,B]=P.useState(0),[J,pe]=P.useState(0),[Vt,ct]=P.useState(4096),[X,Dn]=P.useState(""),[St,sn]=P.useState(""),[wt,ii]=P.useState([]),[ai,ui]=P.useState([]),[_r,Fn]=P.useState(null),ke=(x,$="success")=>{const me=Rc();ui(_e=>[..._e,{id:me,message:x,type:$}]),setTimeout(()=>{ui(_e=>_e.filter(Vc=>Vc.id!==me))},3e3)},Rc=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),Ht=async()=>{try{const $=await(await fetch(e("/api/config/provider-types"))).json();$.success&&Array.isArray($.data)&&(u($.data),$.data.length>0&&U($.data[0]));const _e=await(await fetch(e("/api/config/providers"))).json();_e.success&&Array.isArray(_e.data)&&(n(_e.data),_e.data.length>0&&!r&&l(_e.data[0].id))}catch(x){console.error("WS load providers failed:",x)}};P.useEffect(()=>{Ht()},[]),P.useEffect(()=>{const x=t.find($=>$.id===r);s(x?{name:x.name,baseURL:x.baseURL,apiKey:x.apiKey}:{})},[r,t]);const $c=async()=>{if(r)try{const $=await(await fetch(e(`/api/config/providers/${r}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).json();$.success?(ke("提供商配置已保存","success"),Ht()):ke(`保存失败: ${$.message}`,"error")}catch(x){console.error(x),ke("保存提供商配置失败","error")}},Dc=async()=>{if(!f.trim()||!y.trim()){ke("请填写提供商唯一标识与显示名称","error");return}try{const $=await(await fetch(e("/api/config/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f.trim(),name:y.trim(),type:N,baseURL:m.trim(),apiKey:h})})).json();if($.success){ke("提供商已添加","success");const me=f.trim();p(""),v(""),c(""),S(""),g(!1),l(me),Ht()}else ke(`添加失败: ${$.message}`,"error")}catch(x){console.error(x)}},Fc=(x,$)=>{$.stopPropagation(),Fn({title:"删除模型提供商",message:`确定要永久删除模型提供商 "${x}" 及其绑定的全部模型配置吗?该操作不可撤销。`,onConfirm:async()=>{Fn(null);try{const _e=await(await fetch(e(`/api/config/providers/${x}`),{method:"DELETE"})).json();_e.success?(ke("提供商已删除","success"),r===x&&l(""),Ht()):ke(`删除失败: ${_e.message}`,"error")}catch(me){console.error(me),ke("删除提供商发生异常","error")}}})},Uc=async()=>{if(r){if(!C.trim()||!Y.trim()){ke("请填写模型物理标识与友好名称","error");return}try{const x={id:C.trim(),name:Y.trim(),inputPrice:Number(ye),outputPrice:Number(Oe),cachedInputPrice:Number(ie),contextWindow:Number(ae),capabilities:F};D.trim()!==""&&(x.contextTokens=Number(D)),z.trim()!==""&&(x.maxTokens=Number(z));const me=await(await fetch(e(`/api/config/models/${r}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)})).json();me.success?(ke("模型关联已添加","success"),O(""),W(""),fe(0),je(0),Z(0),_(4096),k(""),L(""),I(["text"]),T(!1),Ht()):ke(`添加失败: ${me.message}`,"error")}catch(x){console.error(x)}}},Ac=x=>{E(x.id),Q(x.name||""),K(x.inputPrice||0),B(x.outputPrice||0),pe(x.cachedInputPrice||0),ct(x.contextWindow||4096),Dn(x.contextTokens!==void 0&&x.contextTokens!==null?String(x.contextTokens):""),sn(x.maxTokens!==void 0&&x.maxTokens!==null?String(x.maxTokens):""),ii(Array.isArray(x.capabilities)?x.capabilities:["text"])},Wc=async x=>{if(r)try{const $={name:A.trim(),inputPrice:Number(ne),outputPrice:Number(b),cachedInputPrice:Number(J),contextWindow:Number(Vt),capabilities:wt};X.trim()!==""?$.contextTokens=Number(X):$.contextTokens=null,St.trim()!==""?$.maxTokens=Number(St):$.maxTokens=null;const _e=await(await fetch(e(`/api/config/models/${r}/${x}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).json();_e.success?(ke("模型配置已更新","success"),E(""),Ht()):ke(`更新失败: ${_e.message}`,"error")}catch($){console.error($)}},Bc=x=>{r&&Fn({title:"删除关联模型配置",message:`确定要断开并删除模型 "${x}" 的配置绑定吗?该操作不可撤销。`,onConfirm:async()=>{Fn(null);try{const me=await(await fetch(e(`/api/config/models/${r}/${x}`),{method:"DELETE"})).json();me.success?(ke("模型已删除","success"),Ht()):ke(`删除失败: ${me.message}`,"error")}catch($){console.error($),ke("删除模型发生异常","error")}}})},Ql=x=>{I($=>$.includes(x)?$.filter(me=>me!==x):[...$,x])},Kl=x=>{ii($=>$.includes(x)?$.filter(me=>me!==x):[...$,x])};return i.jsxs("div",{className:"providers-split",children:[i.jsxs("div",{className:"providers-sidebar-wrapper",children:[i.jsx("div",{className:"providers-sidebar",children:t.map(x=>i.jsxs("div",{className:`provider-item-row ${r===x.id?"active":""}`,children:[i.jsx("span",{className:"provider-item",onClick:()=>{l(x.id),E(""),T(!1)},children:x.name||x.id}),i.jsx("button",{className:"btn-action delete",title:"删除",onClick:$=>Fc(x.id,$),children:"删除"})]},x.id))}),i.jsx("button",{className:"btn-secondary",style:{padding:"0.45rem",fontSize:"0.8rem"},onClick:()=>g(!d),children:d?"取消":"添加提供商"}),d&&i.jsxs("div",{className:"crud-form-card",style:{padding:"0.8rem",gap:"0.5rem",margin:0},children:[i.jsx("input",{type:"text",placeholder:"唯一 ID (例如 deepseek)",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:f,onChange:x=>p(x.target.value)}),i.jsx("input",{type:"text",placeholder:"显示名称",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:y,onChange:x=>v(x.target.value)}),i.jsx("select",{className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:N,onChange:x=>U(x.target.value),children:a.map(x=>i.jsx("option",{value:x,children:x.toUpperCase()},x))}),i.jsx("input",{type:"text",placeholder:"Base URL 终点",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:m,onChange:x=>c(x.target.value)}),i.jsx("input",{type:"password",placeholder:"API Key",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:h,onChange:x=>S(x.target.value)}),i.jsx("button",{className:"btn-primary",style:{padding:"0.4rem",fontSize:"0.78rem",width:"100%"},onClick:Dc,children:"确认添加"})]})]}),i.jsx("div",{className:"providers-content",children:r?i.jsxs("div",{className:"provider-card",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",children:"提供商显示名称"}),i.jsx("input",{type:"text",className:"config-input",value:o.name||"",onChange:x=>s($=>({...$,name:x.target.value}))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",children:"API 终点 (Base URL)"}),i.jsx("input",{type:"text",className:"config-input",value:o.baseURL||"",onChange:x=>s($=>({...$,baseURL:x.target.value}))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",children:"凭证密钥 (API Key)"}),i.jsx("input",{type:"password",className:"config-input",placeholder:"******",value:o.apiKey||"",onChange:x=>s($=>({...$,apiKey:x.target.value}))})]}),i.jsx("div",{className:"tab-actions",style:{marginTop:"0.5rem"},children:i.jsx("button",{className:"btn-primary",onClick:$c,children:"保存提供商基础配置"})}),i.jsxs("div",{style:{marginTop:"0.8rem",borderTop:"1px solid rgba(255,255,255,0.03)",paddingTop:"1rem"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[i.jsx("label",{className:"config-label",children:"关联大模型列表"}),i.jsx("button",{className:"btn-header",onClick:()=>T(!w),children:w?"取消":"关联新模型"})]}),w&&i.jsxs("div",{className:"crud-form-card",children:[i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"模型物理 ID"}),i.jsx("input",{type:"text",placeholder:"如 deepseek-chat",className:"config-input",value:C,onChange:x=>O(x.target.value)})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"模型友好名称"}),i.jsx("input",{type:"text",placeholder:"如 DeepSeek V3",className:"config-input",value:Y,onChange:x=>W(x.target.value)})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"输入单价 (/ 1M Tokens)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:ye,onChange:x=>fe(Number(x.target.value))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"缓存输入单价 (/ 1M Tokens)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:ie,onChange:x=>Z(Number(x.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"输出单价 (/ 1M Tokens)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:Oe,onChange:x=>je(Number(x.target.value))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"上下文窗口 (Context Window)"}),i.jsx("input",{type:"number",className:"config-input",value:ae,onChange:x=>_(Number(x.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"上下文上限 Token (可选)"}),i.jsx("input",{type:"number",placeholder:"留空表示不限制",className:"config-input",value:D,onChange:x=>k(x.target.value)})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"最大输出限制 Token (可选)"}),i.jsx("input",{type:"number",placeholder:"留空表示不限制",className:"config-input",value:z,onChange:x=>L(x.target.value)})]})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"支持的能力类型 (Capabilities)"}),i.jsxs("div",{style:{display:"flex",gap:"1.2rem",padding:"0.2rem 0"},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:F.includes("text"),onChange:()=>Ql("text")}),i.jsx("span",{children:"文本对话 (text)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:F.includes("image"),onChange:()=>Ql("image")}),i.jsx("span",{children:"图片理解 / 视觉能力 (image)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:F.includes("audio"),onChange:()=>Ql("audio")}),i.jsx("span",{children:"音频理解 / 语音能力 (audio)"})]})]})]}),i.jsx("div",{className:"tab-actions",children:i.jsx("button",{className:"btn-primary",onClick:Uc,children:"确认新增并绑定"})})]}),i.jsx("div",{className:"models-list",children:(((ci=t.find(x=>x.id===r))==null?void 0:ci.models)||[]).map(x=>i.jsx("div",{className:"model-item",children:R===x.id?i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"模型名称"}),i.jsx("input",{type:"text",className:"config-input",value:A,onChange:$=>Q($.target.value)})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"窗口容量"}),i.jsx("input",{type:"number",className:"config-input",value:Vt,onChange:$=>ct(Number($.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"输入单价 (/ 1M)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:ne,onChange:$=>K(Number($.target.value))})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"缓存输入单价 (/ 1M)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:J,onChange:$=>pe(Number($.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"输出单价 (/ 1M)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:b,onChange:$=>B(Number($.target.value))})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"最大输出限制 (可选)"}),i.jsx("input",{type:"number",className:"config-input",placeholder:"无限制",value:St,onChange:$=>sn($.target.value)})]})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"上下文 Token 限制 (可选)"}),i.jsx("input",{type:"number",className:"config-input",placeholder:"无限制",value:X,onChange:$=>Dn($.target.value)})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"支持的能力类型 (Capabilities)"}),i.jsxs("div",{style:{display:"flex",gap:"1.2rem",padding:"0.2rem 0"},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:wt.includes("text"),onChange:()=>Kl("text")}),i.jsx("span",{children:"文本对话 (text)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:wt.includes("image"),onChange:()=>Kl("image")}),i.jsx("span",{children:"图片理解 / 视觉能力 (image)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:wt.includes("audio"),onChange:()=>Kl("audio")}),i.jsx("span",{children:"音频理解 / 语音能力 (audio)"})]})]})]}),i.jsxs("div",{className:"tab-actions",children:[i.jsx("button",{className:"btn-secondary",style:{height:"30px",padding:"0 0.8rem"},onClick:()=>E(""),children:"取消"}),i.jsx("button",{className:"btn-primary",style:{height:"30px",padding:"0 0.8rem"},onClick:()=>Wc(x.id),children:"保存修改"})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{className:"model-name",children:[x.name||x.id," ",i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)",fontWeight:"normal"},children:["(",x.id,")"]})]}),i.jsxs("div",{className:"model-details",style:{marginTop:"0.25rem",lineHeight:"1.4"},children:[i.jsxs("span",{children:["窗口: ",x.contextWindow||"未指定"]}),x.contextTokens&&i.jsxs("span",{children:[" (限制: ",x.contextTokens,")"]}),i.jsxs("span",{children:[" | 输入: ",x.inputPrice," (1M)"]}),x.cachedInputPrice>0&&i.jsxs("span",{children:[" (缓存: ",x.cachedInputPrice," (1M))"]}),i.jsxs("span",{children:[" | 输出: ",x.outputPrice," (1M)"]}),x.maxTokens&&i.jsxs("span",{children:[" | 最大输出: ",x.maxTokens]}),i.jsxs("div",{style:{marginTop:"0.15rem",color:"#888"},children:["能力类型: ",Array.isArray(x.capabilities)&&x.capabilities.length>0?x.capabilities.join(", "):"无"]})]})]}),i.jsxs("div",{className:"model-actions",children:[i.jsx("button",{className:"btn-action edit",title:"修改模型参数",onClick:()=>Ac(x),children:"编辑"}),i.jsx("button",{className:"btn-action delete",title:"删除",onClick:()=>Bc(x.id),children:"删除"})]})]})},x.id))})]})]}):i.jsx("div",{style:{color:"var(--text-secondary)",fontStyle:"italic",padding:"2rem",textAlign:"center"},children:"请在左侧选择或添加一个模型提供商以进行配置。"})}),_r&&i.jsx("div",{className:"confirm-modal-overlay",children:i.jsxs("div",{className:"confirm-modal-card",children:[i.jsx("div",{className:"confirm-modal-title",children:i.jsx("span",{children:_r.title})}),i.jsx("div",{className:"confirm-modal-desc",children:_r.message}),i.jsxs("div",{className:"confirm-modal-actions",children:[i.jsx("button",{className:"btn-secondary",style:{height:"32px",padding:"0 1rem"},onClick:()=>Fn(null),children:"取消"}),i.jsx("button",{className:"btn-primary",style:{height:"32px",padding:"0 1rem",background:"#f43f5e",borderColor:"#f43f5e"},onClick:_r.onConfirm,children:"确定删除"})]})]})}),ai.length>0&&i.jsx("div",{className:"toast-container",children:ai.map(x=>i.jsx("div",{className:`toast-card ${x.type}`,children:i.jsx("span",{children:x.message})},x.id))})]})},Ep=({getApiUrl:e})=>{const[t,n]=P.useState("SOUL"),[r,l]=P.useState(""),[o,s]=P.useState([]),a=(f,p="success")=>{const y=u();s(v=>[...v,{id:y,message:f,type:p}]),setTimeout(()=>{s(v=>v.filter(N=>N.id!==y))},3e3)},u=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),d=async f=>{try{const y=await(await fetch(e(`/api/config/prompts/${f}`))).json();y.success?l(y.data||""):l(`未找到或读取提示词失败: ${y.error}`)}catch(p){console.error("WS load prompt failed:",p)}};P.useEffect(()=>{d(t)},[t]);const g=async()=>{try{const p=await(await fetch(e(`/api/config/prompts/${t}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})})).json();p.success?a(`提示词 ${t} 保存成功`,"success"):a(`保存失败: ${p.message}`,"error")}catch(f){console.error(f),a("保存提示词失败","error")}};return i.jsxs("div",{className:"prompt-panel-wrapper",children:[i.jsxs("div",{className:"config-group",style:{flexDirection:"row",alignItems:"center",gap:"1rem",marginBottom:"1.25rem"},children:[i.jsx("label",{className:"config-label",children:"切换要编辑的主提示词卡片:"}),i.jsxs("select",{className:"config-input",value:t,onChange:f=>n(f.target.value),children:[i.jsx("option",{value:"SOUL",children:"SOUL (灵魂设定)"}),i.jsx("option",{value:"IDENTITY",children:"IDENTITY (身份设定)"}),i.jsx("option",{value:"USER",children:"USER (用户设定)"}),i.jsx("option",{value:"TOOLS",children:"TOOLS (工具使用规范)"}),i.jsx("option",{value:"AGENTS",children:"AGENTS (智能体配置)"}),i.jsx("option",{value:"MEMORY",children:"MEMORY (长期记忆)"})]})]}),i.jsx("div",{className:"config-group prompt-textarea-group",children:i.jsx("textarea",{className:"config-textarea",value:r,onChange:f=>l(f.target.value)})}),i.jsx("div",{className:"tab-actions",children:i.jsx("button",{className:"btn-primary",onClick:g,children:"保存提示词配置"})}),o.length>0&&i.jsx("div",{className:"toast-container",children:o.map(f=>i.jsx("div",{className:`toast-card ${f.type}`,children:i.jsx("span",{children:f.message})},f.id))})]})},Tp=({getApiUrl:e})=>{const[t,n]=P.useState([]),[r,l]=P.useState([]),o=(g,f="success")=>{const p=s();l(y=>[...y,{id:p,message:g,type:f}]),setTimeout(()=>{l(y=>y.filter(v=>v.id!==p))},3e3)},s=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),a=async()=>{try{const f=await(await fetch(e("/api/config/plugins"))).json();f.success&&Array.isArray(f.data)&&n(f.data)}catch(g){console.error("WS load plugins failed:",g)}};P.useEffect(()=>{a()},[]);const u=async(g,f)=>{try{const y=await(await fetch(e("/api/config/plugins/toggle"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginId:g,enabled:f})})).json();y.success?(o(`插件 ${g} 已${f?"启用":"禁用"}`,"success"),a()):o(`切换插件失败: ${y.message}`,"error")}catch(p){console.error(p),o("切换插件状态失败","error")}},d=g=>{switch(g){case"builtin":return{label:"内置",bg:"rgba(59, 130, 246, 0.15)",color:"#60a5fa"};case"workspace":return{label:"集成",bg:"rgba(168, 85, 247, 0.15)",color:"#c084fc"};case"npm":return{label:"NPM",bg:"rgba(245, 158, 11, 0.15)",color:"#fbbf24"};case"runtime":default:return{label:"自定义",bg:"rgba(16, 185, 129, 0.15)",color:"#34d399"}}};return i.jsxs("div",{className:"plugins-list",children:[t.map(g=>{const f=g.name||g.id,p=g.description||"未提供描述信息",y=f!==g.id,v=d(g.source);return i.jsxs("div",{className:"plugin-card",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"plugin-title",children:[f,y&&i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)",fontWeight:"normal",marginLeft:"0.5rem"},children:["(",g.id,")"]}),g.source&&i.jsx("span",{style:{fontSize:"0.68rem",marginLeft:"0.5rem",padding:"0.1rem 0.4rem",borderRadius:"4px",background:v.bg,color:v.color},children:v.label})]}),i.jsx("div",{className:"plugin-desc",children:p})]}),i.jsx("div",{children:i.jsxs("label",{className:"switch",children:[i.jsx("input",{type:"checkbox",checked:g.enabled,onChange:N=>u(g.id,N.target.checked)}),i.jsx("span",{className:"slider"})]})})]},g.id)}),r.length>0&&i.jsx("div",{className:"toast-container",children:r.map(g=>i.jsx("div",{className:`toast-card ${g.type}`,children:i.jsx("span",{children:g.message})},g.id))})]})},Pp=({getApiUrl:e})=>{const[t,n]=P.useState([]),[r,l]=P.useState(!0),[o,s]=P.useState([]),a=(f,p="success")=>{const y=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15);s(v=>[...v,{id:y,message:f,type:p}]),setTimeout(()=>{s(v=>v.filter(N=>N.id!==y))},3e3)},u=async()=>{try{l(!0);const p=await(await fetch(e("/api/config/skills"))).json();p.success&&Array.isArray(p.data)&&n(p.data)}catch(f){console.error("加载技能列表失败:",f),a("加载技能列表失败","error")}finally{l(!1)}};P.useEffect(()=>{u()},[]);const d=async(f,p)=>{try{const v=await(await fetch(e("/api/config/skills/toggle"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillId:f,enabled:p})})).json();v.success?(a(`技能 "${f}" 已${p?"启用":"禁用"}`,"success"),u()):a(`切换技能状态失败: ${v.message||v.error}`,"error")}catch(y){console.error("切换技能状态失败:",y),a("切换技能状态失败","error")}};if(r&&t.length===0)return i.jsx("div",{style:{padding:"1rem",color:"var(--text-secondary)",fontSize:"0.85rem"},children:"正在加载技能卡配置..."});if(!r&&t.length===0)return i.jsxs("div",{style:{padding:"2rem 1rem",textAlign:"center",color:"var(--text-secondary)",fontSize:"0.85rem"},children:["暂未扫描到任何技能卡。可在 ",i.jsx("code",{children:"~/.freya/skills/"})," 目录下添加 ",i.jsx("code",{children:"*.md"})," 技能卡文件。"]});const g=f=>{switch(f){case"builtin":return{label:"内置",bg:"rgba(59, 130, 246, 0.15)",color:"#60a5fa"};case"workspace":return{label:"集成",bg:"rgba(168, 85, 247, 0.15)",color:"#c084fc"};case"runtime":default:return{label:"自定义",bg:"rgba(16, 185, 129, 0.15)",color:"#34d399"}}};return i.jsxs("div",{className:"plugins-list",children:[t.map(f=>{const p=f.name||f.id,y=f.description||"未提供描述信息",v=g(f.source);return i.jsxs("div",{className:"plugin-card",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"plugin-title",children:[p,i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)",fontWeight:"normal",marginLeft:"0.5rem"},children:["(",f.id,")"]}),i.jsx("span",{style:{fontSize:"0.68rem",marginLeft:"0.5rem",padding:"0.1rem 0.4rem",borderRadius:"4px",background:v.bg,color:v.color},children:v.label})]}),i.jsx("div",{className:"plugin-desc",children:y})]}),i.jsx("div",{children:i.jsxs("label",{className:"switch",children:[i.jsx("input",{type:"checkbox",checked:f.enabled,onChange:N=>d(f.id,N.target.checked)}),i.jsx("span",{className:"slider"})]})})]},f.id)}),o.length>0&&i.jsx("div",{className:"toast-container",children:o.map(f=>i.jsx("div",{className:`toast-card ${f.type}`,children:i.jsx("span",{children:f.message})},f.id))})]})},_p=({onClose:e,getApiUrl:t})=>{const[n,r]=P.useState("global"),l=()=>n==="global"?"全局参数设置":n==="providers"?"大模型提供商与模型管理":n==="prompts"?"系统提示词管理":n==="plugins"?"扩展插件管理":n==="skills"?"技能卡管理":"";return i.jsx("div",{className:"modal-overlay",onClick:e,children:i.jsxs("div",{className:"modal-container",onClick:o=>o.stopPropagation(),children:[i.jsxs("div",{className:"modal-sidebar",children:[i.jsx("div",{className:"modal-sidebar-header",children:"Freya 配置中心"}),i.jsxs("div",{className:"modal-sidebar-tabs",children:[i.jsx("button",{className:`tab-btn ${n==="global"?"active":""}`,onClick:()=>r("global"),children:"全局配置"}),i.jsx("button",{className:`tab-btn ${n==="providers"?"active":""}`,onClick:()=>r("providers"),children:"模型提供商"}),i.jsx("button",{className:`tab-btn ${n==="prompts"?"active":""}`,onClick:()=>r("prompts"),children:"提示词管理"}),i.jsx("button",{className:`tab-btn ${n==="plugins"?"active":""}`,onClick:()=>r("plugins"),children:"扩展插件"}),i.jsx("button",{className:`tab-btn ${n==="skills"?"active":""}`,onClick:()=>r("skills"),children:"技能卡管理"})]})]}),i.jsxs("div",{className:"modal-main",children:[i.jsxs("div",{className:"modal-main-header",children:[i.jsx("div",{className:"tab-title",children:l()}),i.jsx("button",{className:"modal-close",onClick:e,title:"关闭",children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsxs("div",{className:"modal-body",children:[n==="global"&&i.jsx(jp,{getApiUrl:t}),n==="providers"&&i.jsx(Cp,{getApiUrl:t}),n==="prompts"&&i.jsx(Ep,{getApiUrl:t}),n==="plugins"&&i.jsx(Tp,{getApiUrl:t}),n==="skills"&&i.jsx(Pp,{getApiUrl:t})]})]})]})})},Yn=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15);function zp(){const[e,t]=P.useState([]),[n,r]=P.useState(""),[l,o]=P.useState(!1),[s,a]=P.useState(!1),[u,d]=P.useState({promptTokens:0,completionTokens:0,totalTokens:0,cachedPromptTokens:0,cost:0}),[g,f]=P.useState(!1),[p,y]=P.useState(null),v=P.useRef(null),N=P.useRef(Yn()),U=P.useRef(null);P.useEffect(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight)},[e]);const m=w=>`${window.location.pathname.endsWith("/")?window.location.pathname.slice(0,-1):window.location.pathname}${w}`;P.useEffect(()=>{let w=null,T=null,C=!1;function O(){if(C)return;const Y=window.location.protocol==="https:"?"wss:":"ws:",W=window.location.pathname.endsWith("/")?window.location.pathname:`${window.location.pathname}/`,ye=`${Y}//${window.location.host}${W}`;w=new WebSocket(ye),v.current=w,w.onopen=()=>{o(!0);let fe=sessionStorage.getItem("freya_clientId");fe||(fe=Yn(),sessionStorage.setItem("freya_clientId",fe)),w.send(JSON.stringify({event:"client:reconnect",data:{clientId:fe}}))},w.onmessage=fe=>{try{const Oe=JSON.parse(fe.data),{event:je,data:ie}=Oe;if(je==="server:connected")t(Z=>Z.length>0?Z:[{id:"sys-init",role:"assistant",content:ie.message}]);else if(je==="server:reply")t(Z=>[...Z,{id:Yn(),role:"assistant",content:ie.text,isTyping:!1}]);else if(je==="server:delta")t(Z=>{const ae=Z[Z.length-1];return ae&&ae.role==="assistant"&&ae.isTyping&&!ae.isTool?[...Z.slice(0,-1),{...ae,content:ae.content+ie.text}]:[...Z,{id:Yn(),role:"assistant",content:ie.text,isTyping:!0}]});else if(je==="server:billing")d({promptTokens:ie.promptTokens,completionTokens:ie.completionTokens,totalTokens:ie.totalTokens,cachedPromptTokens:ie.cachedPromptTokens,cost:ie.cost});else if(je==="server:tool_status"){const Z=ie.toolCallId,ae=ie.toolName,_=ie.status,D=ie.arguments,k=ie.result;t(z=>{let L="";if(Z)L=`tool-${Z}`;else{let Q="";try{Q=JSON.stringify(D)}catch{Q=String(D)}L=`tool-${ae}-${Q}`}const F=z.findIndex(Q=>Q.id===L);let I="正在执行...";_==="completed"?I="执行成功":_==="failed"&&(I=`执行失败: ${k||""}`);let R=k;try{JSON.stringify(k)}catch{R=typeof k=="object"?String(k):k}let E=D;try{JSON.stringify(D)}catch{E=typeof D=="object"?String(D):D}const A={id:L,role:"assistant",content:JSON.stringify({toolName:ae,status:_,arguments:E,result:R,statusText:I}),isTool:!0};if(F>-1){const Q=[...z];return Q[F]=A,Q}else return[...z,A]})}else je==="server:status"?a(ie.status==="generating"):je==="server:completed"&&(a(!1),t(Z=>{const ae=Z[Z.length-1];return ae&&ae.role==="assistant"?[...Z.slice(0,-1),{...ae,isTyping:!1}]:Z}))}catch(Oe){console.error("WS payload parse error:",Oe)}},w.onclose=()=>{o(!1),a(!1),C||(T=setTimeout(O,3e3))},w.onerror=fe=>{console.error("WS connection error:",fe),w.close()}}return O(),()=>{C=!0,w&&w.close(),T&&clearTimeout(T)}},[]);const c=()=>{!n.trim()||!l||(t(w=>[...w,{id:Yn(),role:"user",content:n}]),r(""),a(!0),v.current&&v.current.send(JSON.stringify({event:"client:message",data:{sessionId:N.current,content:n}})))},h=()=>{var w;!l||!s||((w=v.current)==null||w.send(JSON.stringify({event:"client:interrupt",data:{sessionId:N.current}})),a(!1),t(T=>{const C=T[T.length-1];return C&&C.role==="assistant"&&C.isTyping?[...T.slice(0,-1),{...C,content:C.content+" [生成已中断]",isTyping:!1}]:T}))},S=()=>{y({title:"重置当前会话",message:"确定要清空当前对话历史并重置会话吗?该操作不可撤销。",onConfirm:()=>{y(null),t([]),d({promptTokens:0,completionTokens:0,totalTokens:0,cachedPromptTokens:0,cost:0}),v.current&&l&&v.current.send(JSON.stringify({event:"client:message",data:{sessionId:N.current,content:"/reset"}}))}})};return i.jsxs("div",{className:"app-container",children:[i.jsx(vp,{isConnected:l,onClear:S,onOpenConfig:()=>f(!0)}),i.jsx(wp,{messages:e,chatPanelRef:U,isGenerating:s}),i.jsx(Np,{input:n,isConnected:l,isGenerating:s,billing:u,onChangeInput:r,onSend:c,onInterrupt:h}),g&&i.jsx(_p,{onClose:()=>f(!1),getApiUrl:m}),p&&i.jsx("div",{className:"confirm-modal-overlay",children:i.jsxs("div",{className:"confirm-modal-card",children:[i.jsxs("div",{className:"confirm-modal-title",children:[i.jsx("span",{children:"⚠️"}),i.jsx("span",{children:p.title})]}),i.jsx("div",{className:"confirm-modal-desc",children:p.message}),i.jsxs("div",{className:"confirm-modal-actions",children:[i.jsx("button",{className:"btn-secondary",style:{height:"32px",padding:"0 1rem"},onClick:()=>y(null),children:"取消"}),i.jsx("button",{className:"btn-primary",style:{height:"32px",padding:"0 1rem",background:"#f43f5e",borderColor:"#f43f5e"},onClick:p.onConfirm,children:"确定重置"})]})]})})]})}ko.createRoot(document.getElementById("root")).render(i.jsx(Ia.StrictMode,{children:i.jsx(zp,{})}));
43
+ `);return i.jsx("blockquote",{className:"md-blockquote",children:Oc(y)},p)};for(let f=0;f<l.length;f++){const p=l[f],y=p.trim(),v=y.startsWith(">");!v&&u.length>0&&(o.push(g(u,`quote-${f}`)),u=[]);const N=p.match(/^(\s*)([-*])\s+(.*)$/),U=!!N;!U&&s.length>0&&(o.push(d(s,`list-${f}`)),s=[]);const m=y.startsWith("|");if(!m&&a&&(o.push(ka(a,f)),a=null),!y){o.push(i.jsx("div",{style:{height:"0.4rem"}},`empty-${f}`));continue}if(/^[*-]{3,}$/.test(y)){o.push(i.jsx("hr",{},`hr-${f}`));continue}if(v)u.push(p);else if(U)s.push({indent:N[1].length,content:N[3]});else if(m){const h=p.split("|").map(w=>w.trim());if(h[0]===""&&h.shift(),h[h.length-1]===""&&h.pop(),h.length>0&&h.every(w=>/^[ :-]+$/.test(w)))continue;a?a.rows.push(h):a={headers:h,rows:[]}}else{if(y.startsWith("#")){const h=y.match(/^(#{1,6})\s+(.*)$/);if(h){const S=h[1].length,w=h[2],T=`h${S}`;o.push(i.jsx(T,{children:qt(w)},`h-${f}`));continue}}o.push(i.jsx("p",{children:qt(p)},`p-${f}`))}}return u.length>0&&o.push(g(u,"quote-final")),s.length>0&&o.push(d(s,"list-final")),a&&o.push(ka(a,l.length)),i.jsx("div",{children:o},`text-${r}`)}):[]}function qt(e){return e?e.split(/(!\[.*?\]\(.*?\)|\[.*?\]\(.*?\)|\*\*.*?\*\*|`.*?`)/g).map((n,r)=>{if(n.startsWith("![")&&n.endsWith(")")){const l=n.match(/!\[(.*?)\]\((.*?)\)/);if(l){const[,o,s]=l;return i.jsx("img",{src:s,alt:o,className:"md-image",style:{maxWidth:"100%",maxHeight:"300px",display:"block",borderRadius:"8px",margin:"0.8rem 0",border:"1px solid var(--border-color, #e0e0e0)"}},r)}}if(n.startsWith("[")&&n.endsWith(")")){const l=n.match(/\[(.*?)\]\((.*?)\)/);if(l){const[,o,s]=l;return i.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"md-link",style:{color:"#0066cc",textDecoration:"underline",wordBreak:"break-all"},children:qt(o)},r)}}return n.startsWith("**")&&n.endsWith("**")?i.jsx("strong",{children:qt(n.slice(2,-2))},r):n.startsWith("`")&&n.endsWith("`")?i.jsx("code",{className:"md-code-inline",children:n.slice(1,-1)},r):n}):[]}const kp=({msg:e,isExpanded:t,onToggle:n})=>{try{const r=JSON.parse(e.content),l=r.toolName,o=r.status,s=r.arguments,a=r.result,u=r.statusText;return i.jsxs("div",{className:"tool-card-container",children:[i.jsxs("div",{className:"tool-card-header",onClick:n,children:[i.jsxs("div",{className:"tool-card-title",children:[i.jsx("span",{className:`tool-card-indicator ${o}`}),i.jsxs("span",{children:["🔧 使用工具: ",l]})]}),i.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:[u," ",t?"▲ 折叠":"▼ 展开"]})]}),t&&i.jsx("div",{className:"tool-card-body",children:i.jsxs("pre",{children:[i.jsxs("div",{children:[i.jsx("strong",{children:"输入参数:"})," ",JSON.stringify(s,null,2)]}),i.jsxs("div",{style:{marginTop:"0.5rem"},children:[i.jsx("strong",{children:"输出结果:"})," ",typeof a=="object"?JSON.stringify(a,null,2):a]})]})})]})}catch{return i.jsx("div",{className:"message-bubble assistant",style:{fontStyle:"italic"},children:"🔧 工具调用信息解析失败"})}},Sp=({groupId:e,items:t,isExpanded:n,onToggleGroup:r,expandedTools:l,onToggleTool:o,isGenerating:s,isLatestGroup:a})=>{const u=t.some(g=>{try{const f=JSON.parse(g.content);return f.status!=="completed"&&f.status!=="failed"}catch{return!1}});let d="已全部执行完成";return u?d="执行中...":a&&s&&(d="思考中..."),i.jsxs("div",{className:`tool-group-container ${n?"expanded":"collapsed"}`,children:[i.jsxs("div",{className:"tool-group-header",onClick:r,children:[i.jsxs("div",{className:"tool-group-title",children:[i.jsx("span",{children:"🛠️ 工具调用过程"}),i.jsxs("span",{style:{fontSize:"0.75rem",fontWeight:400,color:"var(--text-secondary)"},children:["(共 ",t.length," 步 · ",d,")"]})]}),i.jsx("span",{className:"tool-group-action-hint",children:n?"▲ 折叠":"▼ 展开"})]}),n&&i.jsxs("div",{className:"tool-group-body",children:[t.map(g=>{let f=l[g.id];if(f===void 0)try{const p=JSON.parse(g.content);f=p.status!=="completed"&&p.status!=="failed"}catch{f=!1}return i.jsx(kp,{msg:g,isExpanded:f,onToggle:()=>o(g.id)},g.id)}),t.length>1&&i.jsxs("div",{className:"tool-group-footer",onClick:r,children:[i.jsxs("span",{children:["🛠️ 工具调用过程 (",t.length," 步 · ",d,")"]}),i.jsx("span",{className:"tool-group-footer-btn",children:"▲ 折叠"})]})]})]},e)},wp=({messages:e,chatPanelRef:t,isGenerating:n})=>{const[r,l]=P.useState({}),[o,s]=P.useState({}),a=p=>{l(y=>({...y,[p]:!y[p]}))},u=p=>{s(y=>({...y,[p]:!y[p]}))};Ia.useEffect(()=>{t.current&&requestAnimationFrame(()=>{t.current&&(t.current.scrollTop=t.current.scrollHeight)})},[e,n]);const d=[];let g=[];e.forEach(p=>{p.isTool?g.push(p):(g.length>0&&(d.push({type:"tool_group",groupId:`group-${g[0].id}`,items:g}),g=[]),d.push({type:"message",message:p}))}),g.length>0&&d.push({type:"tool_group",groupId:`group-${g[0].id}`,items:g});const f=d.map((p,y)=>p.type==="tool_group"?y:-1).filter(p=>p!==-1).pop();return i.jsx("div",{className:"chat-panel",ref:t,children:d.map((p,y)=>{if(p.type==="tool_group"){const{groupId:m,items:c}=p,h=y===f,S=c.some(T=>{try{const C=JSON.parse(T.content);return C.status!=="completed"&&C.status!=="failed"}catch{return!1}});let w=r[m];return w===void 0&&(w=!!(h&&n||S)),i.jsx(Sp,{groupId:m,items:c,isExpanded:w,onToggleGroup:()=>a(m),expandedTools:o,onToggleTool:u,isGenerating:n,isLatestGroup:h},m)}const v=p.message,U=v.role==="user"?"👤 用户":"🤖 Freya";return i.jsxs("div",{className:`message-wrapper ${v.role}`,children:[i.jsx("div",{className:"message-meta",children:i.jsx("span",{className:"name",children:U})}),i.jsx("div",{className:`message-bubble ${v.isTyping?"cursor-typing":""}`,children:i.jsx("div",{className:"message-content",children:Oc(v.content)})})]},v.id)})})},Np=({input:e,isConnected:t,isGenerating:n,billing:r,onChangeInput:l,onSend:o,onInterrupt:s})=>{const a=P.useRef(null),u=g=>{l(g.target.value),a.current&&(a.current.style.height="auto",a.current.style.height=`${a.current.scrollHeight}px`)},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),o(),a.current&&(a.current.style.height="auto"))};return i.jsxs("footer",{className:"footer",children:[i.jsxs("div",{className:"billing-bar",children:[i.jsxs("div",{children:["Token 消耗: ",i.jsxs("span",{children:[r.totalTokens," Tokens"]})," (输入: ",r.promptTokens," | 缓存: ",r.cachedPromptTokens," | 输出: ",r.completionTokens,")"]}),i.jsxs("div",{children:["估算账单: ",i.jsx("span",{className:"billing-cost",children:r.cost.toFixed(6)})]})]}),i.jsxs("div",{className:"input-container",children:[i.jsx("textarea",{ref:a,rows:1,className:"chat-textarea",placeholder:t?"输入消息,与 Freya 对话...":"正在连接服务器,请稍候...",value:e,disabled:!t,onChange:u,onKeyDown:d}),n?i.jsx("button",{className:"btn btn-interrupt",onClick:s,children:"中断"}):i.jsx("button",{className:"btn btn-send",onClick:o,disabled:!t||!e.trim(),children:"发送"})]})]})},jp=({getApiUrl:e})=>{const[t,n]=P.useState([]),[r,l]=P.useState({}),[o,s]=P.useState({}),[a,u]=P.useState({}),[d,g]=P.useState({}),[f,p]=P.useState({}),[y,v]=P.useState(null),[N,U]=P.useState({}),[m,c]=P.useState([]),[h,S]=P.useState(null),[w,T]=P.useState(!1),C=(k,z="success")=>{const L=O();c(F=>[...F,{id:L,message:k,type:z}]),setTimeout(()=>{c(F=>F.filter(I=>I.id!==L))},3e3)},O=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),Y=(k,z)=>{const L=z.split(".");let F=k;for(const I of L){if(F==null)return;F=F[I]}return F},W=async()=>{try{const z=await(await fetch(e("/api/config/providers"))).json(),L=[];if(z.success&&Array.isArray(z.data)){for(const Q of z.data)if(Array.isArray(Q.models))for(const ne of Q.models)L.push({providerId:Q.id,modelId:ne.id,displayName:`${Q.name} - ${ne.name||ne.id} (${ne.id})`})}n(L);const I=await(await fetch(e("/api/config/schema"))).json();let R={};I.success&&I.data&&(R=I.data,l(R));const A=await(await fetch(e("/api/config"))).json();if(A.success&&A.data){const Q={},ne={};for(const[K,b]of Object.entries(R))for(const B of b){const J=Y(A.data,B.key);Q[B.key]=J!==void 0?J:B.defaultValue,B.type==="array"&&B.key.startsWith("models.")&&L.length>0&&(ne[B.key]=`${L[0].providerId}:::${L[0].modelId}`)}s(Q),u(ne),S(Q),T(!1)}}catch(k){console.error("WS load global config failed:",k)}},ye=async()=>{try{const k={...o};for(const I of Object.values(r))for(const R of I){if(R.type==="array"&&R.key.startsWith("models.")){const E=a[R.key];if(E){const[A,Q]=E.split(":::"),ne=(d[R.key]||"").trim();if(ne){const K=Array.isArray(k[R.key])?k[R.key]:[];K.some(B=>B.provider===A&&B.model===Q)||(k[R.key]=[...K,{provider:A,model:Q,name:ne}])}}}if(R.type==="array"&&Array.isArray(R.children)&&R.children.length>0){const E=f[R.key];if(E&&Object.keys(E).length>0){let A=!1,Q=!0;for(const ne of R.children){const K=E[ne.key];K!==void 0&&String(K).trim()!==""&&(A=!0),ne.required&&(!K||String(K).trim()==="")&&(Q=!1)}if(A&&Q){const ne={};for(const b of R.children){let B=E[b.key];B===void 0&&(B=b.defaultValue!==void 0?b.defaultValue:""),b.type==="number"?B=Number(B):b.type==="boolean"&&(B=!!B),ne[b.key]=B}const K=Array.isArray(k[R.key])?k[R.key]:[];k[R.key]=[...K,ne]}}}}const z={};for(const[I,R]of Object.entries(k)){let E=R,A=null;for(const Q of Object.values(r)){const ne=Q.find(K=>K.key===I);if(ne){A=ne;break}}A&&(A.type==="number"?E=Number(R):A.type==="boolean"&&(E=!!R)),z[I]=E}const F=await(await fetch(e("/api/config/batch"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:z})})).json();F.success?(C("配置保存成功","success"),g({}),p({}),v(null),U({}),S(k),T(!1),W()):C(`保存失败: ${F.error||F.message}`,"error")}catch(k){console.error(k),C("保存配置失败","error")}};P.useEffect(()=>{W()},[]),P.useEffect(()=>{if(!h)return;const k=JSON.stringify(h)!==JSON.stringify(o);T(k)},[o,h]);const fe=(k,z,L)=>{if(!z){C("请选择有效的模型源","error");return}const[F,I]=z.split(":::"),R=L.trim()||I,E={provider:F,model:I,name:R};s(A=>{const Q=Array.isArray(A[k])?A[k]:[];return{...A,[k]:[...Q,E]}}),g(A=>({...A,[k]:""})),C("模型绑定已添加","success")},Oe=(k,z)=>{s(L=>{const F=Array.isArray(L[k])?L[k]:[];return{...L,[k]:F.filter((I,R)=>R!==z)}}),C("模型绑定已移除","success")},je=(k,z,L)=>{s(F=>{const I=Array.isArray(F[k])?[...F[k]]:[];if(L==="up"&&z===0||L==="down"&&z===I.length-1)return F;const R=L==="up"?z-1:z+1,E=I[z];return I[z]=I[R],I[R]=E,{...F,[k]:I}})},ie=(k,z)=>{const L=f[k]||{};for(const I of z)if(I.required&&(!L[I.key]||String(L[I.key]).trim()==="")){C(`请填写必填项: ${I.description||I.key}`,"error");return}const F={};for(const I of z){let R=L[I.key];R===void 0&&(R=I.defaultValue!==void 0?I.defaultValue:""),I.type==="number"?R=Number(R):I.type==="boolean"&&(R=!!R),F[I.key]=R}s(I=>{const R=Array.isArray(I[k])?I[k]:[];return{...I,[k]:[...R,F]}}),p(I=>({...I,[k]:{}})),C("项目已添加","success")},Z=(k,z)=>{s(L=>{const F=Array.isArray(L[k])?L[k]:[];return{...L,[k]:F.filter((I,R)=>R!==z)}}),C("项目已移除","success")},ae=(k,z,L)=>{v({fieldKey:k,index:z}),U(L||{})},_=(k,z,L)=>{for(const F of L)if(F.required&&(!N[F.key]||String(N[F.key]).trim()==="")){C(`请填写必填项: ${F.description||F.key}`,"error");return}s(F=>{const I=Array.isArray(F[k])?[...F[k]]:[];if(z>=0&&z<I.length){const R={...I[z]};for(const E of L){let A=N[E.key];A===void 0&&(A=E.defaultValue!==void 0?E.defaultValue:""),E.type==="number"?A=Number(A):E.type==="boolean"&&(A=!!A),R[E.key]=A}I[z]=R}return{...F,[k]:I}}),v(null),U({}),C("修改已保存","success")},D=Object.keys(r).sort((k,z)=>k==="core"?-1:z==="core"?1:k.localeCompare(z));return i.jsxs("div",{children:[D.map(k=>{const z=r[k]||[],L={};for(const I of z){const R=I.category||"通用设置";L[R]||(L[R]=[]),L[R].push(I)}if(Object.keys(L).length===0)return null;const F=k==="core"?"核心系统参数":k.startsWith("@eoasmxd/freya-plugin-")?`插件专属配置: ${k.replace("@eoasmxd/freya-plugin-","")}`:`扩展模块配置: ${k}`;return i.jsxs("div",{className:"config-group",style:{marginBottom:"1.8rem",borderBottom:"1px solid rgba(255,255,255,0.02)",paddingBottom:"1.2rem"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"1.05rem",color:"#ffffff",fontWeight:"bold",borderLeft:"3px solid var(--accent)",paddingLeft:"0.6rem",marginBottom:"1rem"},children:F}),Object.entries(L).map(([I,R])=>i.jsxs("div",{style:{marginBottom:"1.4rem"},children:[i.jsx("div",{style:{fontSize:"0.86rem",fontWeight:600,color:"rgba(255, 255, 255, 0.75)",borderLeft:"2px solid var(--accent)",paddingLeft:"0.5rem",marginTop:"1.4rem",marginBottom:"0.8rem"},children:I}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.1rem"},children:R.map(E=>{const A=o[E.key];if(E.type==="array"&&E.key.startsWith("models.")){const K=Array.isArray(A)?A:[],b=a[E.key]||"",B=d[E.key]||"";return i.jsx("div",{className:"config-group",style:{margin:"0.4rem 0"},children:i.jsxs("div",{className:"crud-form-card",style:{margin:0,borderStyle:"solid",borderColor:"rgba(255,255,255,0.04)",padding:"1rem",gap:"0.8rem"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(255,255,255,0.02)",paddingBottom:"0.4rem"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.82rem",color:"rgba(255, 255, 255, 0.85)",fontWeight:500,margin:0},children:E.description||E.key}),i.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)"},children:"降级 Fallback 链 (越靠上优先级越高)"})]}),i.jsx("div",{className:"models-list",style:{margin:"0.2rem 0"},children:K.length===0?i.jsx("div",{style:{fontSize:"0.76rem",color:"var(--text-secondary)",padding:"0.5rem 0",fontStyle:"italic"},children:"当前场景未绑定任何运行时模型。系统将使用默认路由。"}):K.map((J,pe)=>i.jsxs("div",{className:"model-item",style:{padding:"0.5rem 0.8rem",background:"rgba(255,255,255,0.01)"},children:[i.jsxs("div",{className:"model-name",style:{fontSize:"0.8rem"},children:[J.name," ",i.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-secondary)",fontWeight:"normal"},children:["(",J.provider," / ",J.model,")"]})]}),i.jsxs("div",{style:{display:"flex",gap:"0.4rem"},children:[i.jsx("button",{className:"btn-action edit",title:"提高优先级",disabled:pe===0,onClick:()=>je(E.key,pe,"up"),children:"▲"}),i.jsx("button",{className:"btn-action edit",title:"降低优先级",disabled:pe===K.length-1,onClick:()=>je(E.key,pe,"down"),children:"▼"}),i.jsx("button",{className:"btn-action delete",title:"移除",onClick:()=>Oe(E.key,pe),children:"移除"})]})]},pe))}),i.jsxs("div",{style:{display:"flex",gap:"0.65rem",alignItems:"center",marginTop:"0.2rem"},children:[i.jsx("select",{className:"config-input",style:{flex:1,fontSize:"0.78rem",padding:"0.4rem 0.6rem",height:"32px"},value:b,onChange:J=>u(pe=>({...pe,[E.key]:J.target.value})),children:t.map(J=>i.jsx("option",{value:`${J.providerId}:::${J.modelId}`,children:J.displayName},`${J.providerId}:::${J.modelId}`))}),i.jsx("input",{type:"text",placeholder:"自定义别名 (选填)",className:"config-input",style:{width:"160px",fontSize:"0.78rem",padding:"0.4rem 0.6rem",height:"32px",boxSizing:"border-box"},value:B,onChange:J=>g(pe=>({...pe,[E.key]:J.target.value}))}),i.jsx("button",{className:"btn-primary",style:{padding:"0.4rem 1rem",fontSize:"0.78rem",height:"32px"},onClick:()=>fe(E.key,b,B),children:"绑定"})]})]})},E.key)}if(E.type==="array"&&Array.isArray(E.children)&&E.children.length>0){const K=Array.isArray(A)?A:[],b=f[E.key]||{};return i.jsx("div",{className:"config-group",style:{margin:"0.4rem 0"},children:i.jsxs("div",{className:"crud-form-card",style:{margin:0,borderStyle:"solid",borderColor:"rgba(255,255,255,0.04)",padding:"1rem",gap:"0.8rem"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(255,255,255,0.02)",paddingBottom:"0.4rem"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.82rem",color:"rgba(255, 255, 255, 0.85)",fontWeight:500,margin:0},children:E.description||E.key}),i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)"},children:["子配置项列表 (",K.length," 项)"]})]}),i.jsx("div",{className:"models-list",style:{margin:"0.2rem 0"},children:K.length===0?i.jsx("div",{style:{fontSize:"0.76rem",color:"var(--text-secondary)",padding:"0.5rem 0",fontStyle:"italic"},children:"当前列表为空。请在下方表单录入并添加新项目。"}):K.map((B,J)=>{var Vt,ct;const pe=(y==null?void 0:y.fieldKey)===E.key&&(y==null?void 0:y.index)===J;return i.jsxs("div",{className:"model-item",style:{padding:"0.55rem 0.85rem",background:"rgba(255,255,255,0.01)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[pe?i.jsx("div",{style:{flex:1,display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end",marginRight:"1rem"},children:(Vt=E.children)==null?void 0:Vt.map(X=>{const Dn=X.uiHint==="password"||X.sensitive,St=N[X.key]??"";return i.jsxs("div",{style:{flex:1,minWidth:"130px"},children:[i.jsx("label",{style:{fontSize:"0.7rem",color:"var(--text-secondary)",display:"block",marginBottom:"0.2rem"},children:X.description||X.key}),X.type==="boolean"?i.jsxs("label",{className:"switch",style:{margin:"0.2rem 0"},children:[i.jsx("input",{type:"checkbox",checked:!!St,onChange:sn=>U(wt=>({...wt,[X.key]:sn.target.checked}))}),i.jsx("span",{className:"slider"})]}):i.jsx("input",{type:Dn?"password":X.type==="number"?"number":"text",className:"config-input",style:{height:"30px",boxSizing:"border-box",fontSize:"0.78rem",padding:"0.15rem 0.4rem"},value:St,onChange:sn=>U(wt=>({...wt,[X.key]:sn.target.value}))})]},X.key)})}):i.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-primary)",display:"flex",flexWrap:"wrap",gap:"1rem"},children:(ct=E.children)==null?void 0:ct.map(X=>{const St=X.sensitive||X.uiHint==="password"?"******":String(B[X.key]??"");return i.jsxs("span",{children:[i.jsxs("span",{style:{color:"var(--text-secondary)"},children:[X.description||X.key,":"]})," ",i.jsx("span",{style:{fontFamily:"monospace",fontWeight:600},children:St})]},X.key)})}),i.jsx("div",{style:{display:"flex",gap:"0.4rem",flexShrink:0},children:pe?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"btn-action edit",title:"保存",onClick:()=>_(E.key,J,E.children||[]),children:"保存"}),i.jsx("button",{className:"btn-action delete",title:"取消",onClick:()=>{v(null),U({})},children:"取消"})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"btn-action edit",title:"编辑",onClick:()=>ae(E.key,J,B),children:"编辑"}),i.jsx("button",{className:"btn-action delete",title:"删除",onClick:()=>Z(E.key,J),children:"删除"})]})})]},J)})}),i.jsxs("div",{style:{background:"rgba(0,0,0,0.1)",padding:"0.75rem",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.02)",marginTop:"0.3rem"},children:[i.jsx("div",{style:{fontSize:"0.72rem",color:"rgba(255,255,255,0.3)",fontWeight:600,marginBottom:"0.5rem"},children:"添加新项"}),i.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end"},children:[E.children.map(B=>{const J=B.uiHint==="password"||B.sensitive,pe=b[B.key]??"",Vt=B.required?`${B.description} (必填)`:B.description;return i.jsxs("div",{style:{flex:1,minWidth:"150px"},children:[i.jsx("label",{style:{fontSize:"0.74rem",color:"rgba(255, 255, 255, 0.7)",display:"block",marginBottom:"0.2rem",fontWeight:500},children:B.description||B.key}),B.type==="boolean"?i.jsxs("label",{className:"switch",style:{margin:"0.2rem 0"},children:[i.jsx("input",{type:"checkbox",checked:!!pe,onChange:ct=>p(X=>({...X,[E.key]:{...X[E.key]||{},[B.key]:ct.target.checked}}))}),i.jsx("span",{className:"slider"})]}):i.jsx("input",{type:J?"password":B.type==="number"?"number":"text",placeholder:Vt,className:"config-input",style:{height:"32px",boxSizing:"border-box",fontSize:"0.78rem",padding:"0.2rem 0.5rem"},value:pe,onChange:ct=>p(X=>({...X,[E.key]:{...X[E.key]||{},[B.key]:ct.target.value}}))})]},B.key)}),i.jsx("button",{className:"btn-primary",style:{padding:"0.4rem 1.2rem",fontSize:"0.78rem",height:"32px",flexShrink:0},onClick:()=>ie(E.key,E.children||[]),children:"添加"})]})]})]})},E.key)}const Q=E.description||E.key,ne=E.type==="boolean";return i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0.25rem",borderBottom:"1px solid rgba(255, 255, 255, 0.025)"},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.84rem",color:"rgba(255, 255, 255, 0.85)",fontWeight:500,margin:0},children:Q}),ne?i.jsxs("label",{className:"switch",style:{margin:0},children:[i.jsx("input",{type:"checkbox",checked:!!A,onChange:K=>s(b=>({...b,[E.key]:K.target.checked}))}),i.jsx("span",{className:"slider"})]}):E.type==="number"?i.jsx("input",{type:"number",className:"config-input",style:{width:"280px",height:"34px",boxSizing:"border-box",margin:0},value:A??"",onChange:K=>s(b=>({...b,[E.key]:Number(K.target.value)}))}):i.jsx("input",{type:"text",className:"config-input",style:{width:"280px",height:"34px",boxSizing:"border-box",margin:0},value:typeof A=="object"?JSON.stringify(A):A??"",onChange:K=>{let b=K.target.value;if(E.type==="array")try{b=JSON.parse(K.target.value)}catch{b=K.target.value}s(B=>({...B,[E.key]:b}))}})]},E.key)})})]},I))]},k)}),i.jsxs("button",{className:`floating-save-btn ${w?"dirty":"clean"}`,onClick:ye,disabled:!w,title:w?"有未保存的修改,点击保存":"配置无改变",children:[i.jsx("span",{style:{fontSize:"1.1rem"},children:w?"💾":"✓"}),w?"保存配置":"无修改"]}),m.length>0&&i.jsx("div",{className:"toast-container",children:m.map(k=>i.jsx("div",{className:`toast-card ${k.type}`,children:i.jsx("span",{children:k.message})},k.id))})]})},Cp=({getApiUrl:e})=>{var ci;const[t,n]=P.useState([]),[r,l]=P.useState(""),[o,s]=P.useState({}),[a,u]=P.useState([]),[d,g]=P.useState(!1),[f,p]=P.useState(""),[y,v]=P.useState(""),[N,U]=P.useState("openai"),[m,c]=P.useState(""),[h,S]=P.useState(""),[w,T]=P.useState(!1),[C,O]=P.useState(""),[Y,W]=P.useState(""),[ye,fe]=P.useState(0),[Oe,je]=P.useState(0),[ie,Z]=P.useState(0),[ae,_]=P.useState(4096),[D,k]=P.useState(""),[z,L]=P.useState(""),[F,I]=P.useState(["text"]),[R,E]=P.useState(""),[A,Q]=P.useState(""),[ne,K]=P.useState(0),[b,B]=P.useState(0),[J,pe]=P.useState(0),[Vt,ct]=P.useState(4096),[X,Dn]=P.useState(""),[St,sn]=P.useState(""),[wt,ii]=P.useState([]),[ai,ui]=P.useState([]),[_r,Fn]=P.useState(null),ke=(x,$="success")=>{const me=Rc();ui(_e=>[..._e,{id:me,message:x,type:$}]),setTimeout(()=>{ui(_e=>_e.filter(Vc=>Vc.id!==me))},3e3)},Rc=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),Ht=async()=>{try{const $=await(await fetch(e("/api/config/provider-types"))).json();$.success&&Array.isArray($.data)&&(u($.data),$.data.length>0&&U($.data[0]));const _e=await(await fetch(e("/api/config/providers"))).json();_e.success&&Array.isArray(_e.data)&&(n(_e.data),_e.data.length>0&&!r&&l(_e.data[0].id))}catch(x){console.error("WS load providers failed:",x)}};P.useEffect(()=>{Ht()},[]),P.useEffect(()=>{const x=t.find($=>$.id===r);s(x?{name:x.name,baseURL:x.baseURL,apiKey:x.apiKey}:{})},[r,t]);const $c=async()=>{if(r)try{const $=await(await fetch(e(`/api/config/providers/${r}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).json();$.success?(ke("提供商配置已保存","success"),Ht()):ke(`保存失败: ${$.message}`,"error")}catch(x){console.error(x),ke("保存提供商配置失败","error")}},Dc=async()=>{if(!f.trim()||!y.trim()){ke("请填写提供商唯一标识与显示名称","error");return}try{const $=await(await fetch(e("/api/config/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f.trim(),name:y.trim(),type:N,baseURL:m.trim(),apiKey:h})})).json();if($.success){ke("提供商已添加","success");const me=f.trim();p(""),v(""),c(""),S(""),g(!1),l(me),Ht()}else ke(`添加失败: ${$.message}`,"error")}catch(x){console.error(x)}},Fc=(x,$)=>{$.stopPropagation(),Fn({title:"删除模型提供商",message:`确定要永久删除模型提供商 "${x}" 及其绑定的全部模型配置吗?该操作不可撤销。`,onConfirm:async()=>{Fn(null);try{const _e=await(await fetch(e(`/api/config/providers/${x}`),{method:"DELETE"})).json();_e.success?(ke("提供商已删除","success"),r===x&&l(""),Ht()):ke(`删除失败: ${_e.message}`,"error")}catch(me){console.error(me),ke("删除提供商发生异常","error")}}})},Uc=async()=>{if(r){if(!C.trim()||!Y.trim()){ke("请填写模型物理标识与友好名称","error");return}try{const x={id:C.trim(),name:Y.trim(),inputPrice:Number(ye),outputPrice:Number(Oe),cachedInputPrice:Number(ie),contextWindow:Number(ae),capabilities:F};D.trim()!==""&&(x.contextTokens=Number(D)),z.trim()!==""&&(x.maxTokens=Number(z));const me=await(await fetch(e(`/api/config/models/${r}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)})).json();me.success?(ke("模型关联已添加","success"),O(""),W(""),fe(0),je(0),Z(0),_(4096),k(""),L(""),I(["text"]),T(!1),Ht()):ke(`添加失败: ${me.message}`,"error")}catch(x){console.error(x)}}},Ac=x=>{E(x.id),Q(x.name||""),K(x.inputPrice||0),B(x.outputPrice||0),pe(x.cachedInputPrice||0),ct(x.contextWindow||4096),Dn(x.contextTokens!==void 0&&x.contextTokens!==null?String(x.contextTokens):""),sn(x.maxTokens!==void 0&&x.maxTokens!==null?String(x.maxTokens):""),ii(Array.isArray(x.capabilities)?x.capabilities:["text"])},Wc=async x=>{if(r)try{const $={name:A.trim(),inputPrice:Number(ne),outputPrice:Number(b),cachedInputPrice:Number(J),contextWindow:Number(Vt),capabilities:wt};X.trim()!==""?$.contextTokens=Number(X):$.contextTokens=null,St.trim()!==""?$.maxTokens=Number(St):$.maxTokens=null;const _e=await(await fetch(e(`/api/config/models/${r}/${x}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).json();_e.success?(ke("模型配置已更新","success"),E(""),Ht()):ke(`更新失败: ${_e.message}`,"error")}catch($){console.error($)}},Bc=x=>{r&&Fn({title:"删除关联模型配置",message:`确定要断开并删除模型 "${x}" 的配置绑定吗?该操作不可撤销。`,onConfirm:async()=>{Fn(null);try{const me=await(await fetch(e(`/api/config/models/${r}/${x}`),{method:"DELETE"})).json();me.success?(ke("模型已删除","success"),Ht()):ke(`删除失败: ${me.message}`,"error")}catch($){console.error($),ke("删除模型发生异常","error")}}})},Ql=x=>{I($=>$.includes(x)?$.filter(me=>me!==x):[...$,x])},Kl=x=>{ii($=>$.includes(x)?$.filter(me=>me!==x):[...$,x])};return i.jsxs("div",{className:"providers-split",children:[i.jsxs("div",{className:"providers-sidebar-wrapper",children:[i.jsx("div",{className:"providers-sidebar",children:t.map(x=>i.jsxs("div",{className:`provider-item-row ${r===x.id?"active":""}`,children:[i.jsx("span",{className:"provider-item",onClick:()=>{l(x.id),E(""),T(!1)},children:x.name||x.id}),i.jsx("button",{className:"btn-action delete",title:"删除",onClick:$=>Fc(x.id,$),children:"删除"})]},x.id))}),i.jsx("button",{className:"btn-secondary",style:{padding:"0.45rem",fontSize:"0.8rem"},onClick:()=>g(!d),children:d?"取消":"添加提供商"}),d&&i.jsxs("div",{className:"crud-form-card",style:{padding:"0.8rem",gap:"0.5rem",margin:0},children:[i.jsx("input",{type:"text",placeholder:"唯一 ID (例如 deepseek)",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:f,onChange:x=>p(x.target.value)}),i.jsx("input",{type:"text",placeholder:"显示名称",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:y,onChange:x=>v(x.target.value)}),i.jsx("select",{className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:N,onChange:x=>U(x.target.value),children:a.map(x=>i.jsx("option",{value:x,children:x.toUpperCase()},x))}),i.jsx("input",{type:"text",placeholder:"Base URL 终点",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:m,onChange:x=>c(x.target.value)}),i.jsx("input",{type:"password",placeholder:"API Key",className:"config-input",style:{fontSize:"0.78rem",padding:"0.4rem 0.6rem"},value:h,onChange:x=>S(x.target.value)}),i.jsx("button",{className:"btn-primary",style:{padding:"0.4rem",fontSize:"0.78rem",width:"100%"},onClick:Dc,children:"确认添加"})]})]}),i.jsx("div",{className:"providers-content",children:r?i.jsxs("div",{className:"provider-card",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",children:"提供商显示名称"}),i.jsx("input",{type:"text",className:"config-input",value:o.name||"",onChange:x=>s($=>({...$,name:x.target.value}))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",children:"API 终点 (Base URL)"}),i.jsx("input",{type:"text",className:"config-input",value:o.baseURL||"",onChange:x=>s($=>({...$,baseURL:x.target.value}))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",children:"凭证密钥 (API Key)"}),i.jsx("input",{type:"password",className:"config-input",placeholder:"******",value:o.apiKey||"",onChange:x=>s($=>({...$,apiKey:x.target.value}))})]}),i.jsx("div",{className:"tab-actions",style:{marginTop:"0.5rem"},children:i.jsx("button",{className:"btn-primary",onClick:$c,children:"保存提供商基础配置"})}),i.jsxs("div",{style:{marginTop:"0.8rem",borderTop:"1px solid rgba(255,255,255,0.03)",paddingTop:"1rem"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[i.jsx("label",{className:"config-label",children:"关联大模型列表"}),i.jsx("button",{className:"btn-header",onClick:()=>T(!w),children:w?"取消":"关联新模型"})]}),w&&i.jsxs("div",{className:"crud-form-card",children:[i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"模型物理 ID"}),i.jsx("input",{type:"text",placeholder:"如 deepseek-chat",className:"config-input",value:C,onChange:x=>O(x.target.value)})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"模型友好名称"}),i.jsx("input",{type:"text",placeholder:"如 DeepSeek V3",className:"config-input",value:Y,onChange:x=>W(x.target.value)})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"输入单价 (/ 1M Tokens)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:ye,onChange:x=>fe(Number(x.target.value))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"缓存输入单价 (/ 1M Tokens)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:ie,onChange:x=>Z(Number(x.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"输出单价 (/ 1M Tokens)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:Oe,onChange:x=>je(Number(x.target.value))})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"上下文窗口 (Context Window)"}),i.jsx("input",{type:"number",className:"config-input",value:ae,onChange:x=>_(Number(x.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"上下文上限 Token (可选)"}),i.jsx("input",{type:"number",placeholder:"留空表示不限制",className:"config-input",value:D,onChange:x=>k(x.target.value)})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"最大输出限制 Token (可选)"}),i.jsx("input",{type:"number",placeholder:"留空表示不限制",className:"config-input",value:z,onChange:x=>L(x.target.value)})]})]}),i.jsxs("div",{className:"config-group",children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.74rem"},children:"支持的能力类型 (Capabilities)"}),i.jsxs("div",{style:{display:"flex",gap:"1.2rem",padding:"0.2rem 0"},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:F.includes("text"),onChange:()=>Ql("text")}),i.jsx("span",{children:"文本对话 (text)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:F.includes("image"),onChange:()=>Ql("image")}),i.jsx("span",{children:"图片理解 / 视觉能力 (image)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:F.includes("audio"),onChange:()=>Ql("audio")}),i.jsx("span",{children:"音频理解 / 语音能力 (audio)"})]})]})]}),i.jsx("div",{className:"tab-actions",children:i.jsx("button",{className:"btn-primary",onClick:Uc,children:"确认新增并绑定"})})]}),i.jsx("div",{className:"models-list",children:(((ci=t.find(x=>x.id===r))==null?void 0:ci.models)||[]).map(x=>i.jsx("div",{className:"model-item",children:R===x.id?i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"模型名称"}),i.jsx("input",{type:"text",className:"config-input",value:A,onChange:$=>Q($.target.value)})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"窗口容量"}),i.jsx("input",{type:"number",className:"config-input",value:Vt,onChange:$=>ct(Number($.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"输入单价 (/ 1M)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:ne,onChange:$=>K(Number($.target.value))})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"缓存输入单价 (/ 1M)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:J,onChange:$=>pe(Number($.target.value))})]})]}),i.jsxs("div",{className:"crud-form-row",children:[i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"输出单价 (/ 1M)"}),i.jsx("input",{type:"number",step:"0.0001",className:"config-input",value:b,onChange:$=>B(Number($.target.value))})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"最大输出限制 (可选)"}),i.jsx("input",{type:"number",className:"config-input",placeholder:"无限制",value:St,onChange:$=>sn($.target.value)})]})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"上下文 Token 限制 (可选)"}),i.jsx("input",{type:"number",className:"config-input",placeholder:"无限制",value:X,onChange:$=>Dn($.target.value)})]}),i.jsxs("div",{className:"config-group",style:{margin:0},children:[i.jsx("label",{className:"config-label",style:{fontSize:"0.72rem"},children:"支持的能力类型 (Capabilities)"}),i.jsxs("div",{style:{display:"flex",gap:"1.2rem",padding:"0.2rem 0"},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:wt.includes("text"),onChange:()=>Kl("text")}),i.jsx("span",{children:"文本对话 (text)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:wt.includes("image"),onChange:()=>Kl("image")}),i.jsx("span",{children:"图片理解 / 视觉能力 (image)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.8rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:wt.includes("audio"),onChange:()=>Kl("audio")}),i.jsx("span",{children:"音频理解 / 语音能力 (audio)"})]})]})]}),i.jsxs("div",{className:"tab-actions",children:[i.jsx("button",{className:"btn-secondary",style:{height:"30px",padding:"0 0.8rem"},onClick:()=>E(""),children:"取消"}),i.jsx("button",{className:"btn-primary",style:{height:"30px",padding:"0 0.8rem"},onClick:()=>Wc(x.id),children:"保存修改"})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{className:"model-name",children:[x.name||x.id," ",i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)",fontWeight:"normal"},children:["(",x.id,")"]})]}),i.jsxs("div",{className:"model-details",style:{marginTop:"0.25rem",lineHeight:"1.4"},children:[i.jsxs("span",{children:["窗口: ",x.contextWindow||"未指定"]}),x.contextTokens&&i.jsxs("span",{children:[" (限制: ",x.contextTokens,")"]}),i.jsxs("span",{children:[" | 输入: ",x.inputPrice," (1M)"]}),x.cachedInputPrice>0&&i.jsxs("span",{children:[" (缓存: ",x.cachedInputPrice," (1M))"]}),i.jsxs("span",{children:[" | 输出: ",x.outputPrice," (1M)"]}),x.maxTokens&&i.jsxs("span",{children:[" | 最大输出: ",x.maxTokens]}),i.jsxs("div",{style:{marginTop:"0.15rem",color:"#888"},children:["能力类型: ",Array.isArray(x.capabilities)&&x.capabilities.length>0?x.capabilities.join(", "):"无"]})]})]}),i.jsxs("div",{className:"model-actions",children:[i.jsx("button",{className:"btn-action edit",title:"修改模型参数",onClick:()=>Ac(x),children:"编辑"}),i.jsx("button",{className:"btn-action delete",title:"删除",onClick:()=>Bc(x.id),children:"删除"})]})]})},x.id))})]})]}):i.jsx("div",{style:{color:"var(--text-secondary)",fontStyle:"italic",padding:"2rem",textAlign:"center"},children:"请在左侧选择或添加一个模型提供商以进行配置。"})}),_r&&i.jsx("div",{className:"confirm-modal-overlay",children:i.jsxs("div",{className:"confirm-modal-card",children:[i.jsx("div",{className:"confirm-modal-title",children:i.jsx("span",{children:_r.title})}),i.jsx("div",{className:"confirm-modal-desc",children:_r.message}),i.jsxs("div",{className:"confirm-modal-actions",children:[i.jsx("button",{className:"btn-secondary",style:{height:"32px",padding:"0 1rem"},onClick:()=>Fn(null),children:"取消"}),i.jsx("button",{className:"btn-primary",style:{height:"32px",padding:"0 1rem",background:"#f43f5e",borderColor:"#f43f5e"},onClick:_r.onConfirm,children:"确定删除"})]})]})}),ai.length>0&&i.jsx("div",{className:"toast-container",children:ai.map(x=>i.jsx("div",{className:`toast-card ${x.type}`,children:i.jsx("span",{children:x.message})},x.id))})]})},Ep=({getApiUrl:e})=>{const[t,n]=P.useState("SOUL"),[r,l]=P.useState(""),[o,s]=P.useState([]),a=(f,p="success")=>{const y=u();s(v=>[...v,{id:y,message:f,type:p}]),setTimeout(()=>{s(v=>v.filter(N=>N.id!==y))},3e3)},u=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),d=async f=>{try{const y=await(await fetch(e(`/api/config/prompts/${f}`))).json();y.success?l(y.data||""):l(`未找到或读取提示词失败: ${y.error}`)}catch(p){console.error("WS load prompt failed:",p)}};P.useEffect(()=>{d(t)},[t]);const g=async()=>{try{const p=await(await fetch(e(`/api/config/prompts/${t}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})})).json();p.success?a(`提示词 ${t} 保存成功`,"success"):a(`保存失败: ${p.message}`,"error")}catch(f){console.error(f),a("保存提示词失败","error")}};return i.jsxs("div",{className:"prompt-panel-wrapper",children:[i.jsxs("div",{className:"config-group",style:{flexDirection:"row",alignItems:"center",gap:"1rem",marginBottom:"1.25rem"},children:[i.jsx("label",{className:"config-label",children:"切换要编辑的主提示词卡片:"}),i.jsxs("select",{className:"config-input",value:t,onChange:f=>n(f.target.value),children:[i.jsx("option",{value:"SOUL",children:"SOUL (灵魂设定)"}),i.jsx("option",{value:"IDENTITY",children:"IDENTITY (身份设定)"}),i.jsx("option",{value:"USER",children:"USER (用户设定)"}),i.jsx("option",{value:"TOOLS",children:"TOOLS (工具使用规范)"}),i.jsx("option",{value:"AGENTS",children:"AGENTS (智能体配置)"}),i.jsx("option",{value:"MEMORY",children:"MEMORY (长期记忆)"})]})]}),i.jsx("div",{className:"config-group prompt-textarea-group",children:i.jsx("textarea",{className:"config-textarea",value:r,onChange:f=>l(f.target.value)})}),i.jsx("div",{className:"tab-actions",children:i.jsx("button",{className:"btn-primary",onClick:g,children:"保存提示词配置"})}),o.length>0&&i.jsx("div",{className:"toast-container",children:o.map(f=>i.jsx("div",{className:`toast-card ${f.type}`,children:i.jsx("span",{children:f.message})},f.id))})]})},Tp=({getApiUrl:e})=>{const[t,n]=P.useState([]),[r,l]=P.useState([]),o=(g,f="success")=>{const p=s();l(y=>[...y,{id:p,message:g,type:f}]),setTimeout(()=>{l(y=>y.filter(v=>v.id!==p))},3e3)},s=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15),a=async()=>{try{const f=await(await fetch(e("/api/config/plugins"))).json();f.success&&Array.isArray(f.data)&&n(f.data)}catch(g){console.error("WS load plugins failed:",g)}};P.useEffect(()=>{a()},[]);const u=async(g,f)=>{try{const y=await(await fetch(e("/api/config/plugins/toggle"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginId:g,enabled:f})})).json();y.success?(o(`插件 ${g} 已${f?"启用":"禁用"}`,"success"),a()):o(`切换插件失败: ${y.message}`,"error")}catch(p){console.error(p),o("切换插件状态失败","error")}},d=g=>{switch(g){case"builtin":return{label:"内置",bg:"rgba(59, 130, 246, 0.15)",color:"#60a5fa"};case"launch":return{label:"集成",bg:"rgba(168, 85, 247, 0.15)",color:"#c084fc"};case"npm":return{label:"NPM",bg:"rgba(245, 158, 11, 0.15)",color:"#fbbf24"};case"runtime":default:return{label:"自定义",bg:"rgba(16, 185, 129, 0.15)",color:"#34d399"}}};return i.jsxs("div",{className:"plugins-list",children:[t.map(g=>{const f=g.name||g.id,p=g.description||"未提供描述信息",y=f!==g.id,v=d(g.source);return i.jsxs("div",{className:"plugin-card",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"plugin-title",children:[f,y&&i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)",fontWeight:"normal",marginLeft:"0.5rem"},children:["(",g.id,")"]}),g.source&&i.jsx("span",{style:{fontSize:"0.68rem",marginLeft:"0.5rem",padding:"0.1rem 0.4rem",borderRadius:"4px",background:v.bg,color:v.color},children:v.label})]}),i.jsx("div",{className:"plugin-desc",children:p})]}),i.jsx("div",{children:i.jsxs("label",{className:"switch",children:[i.jsx("input",{type:"checkbox",checked:g.enabled,onChange:N=>u(g.id,N.target.checked)}),i.jsx("span",{className:"slider"})]})})]},g.id)}),r.length>0&&i.jsx("div",{className:"toast-container",children:r.map(g=>i.jsx("div",{className:`toast-card ${g.type}`,children:i.jsx("span",{children:g.message})},g.id))})]})},Pp=({getApiUrl:e})=>{const[t,n]=P.useState([]),[r,l]=P.useState(!0),[o,s]=P.useState([]),a=(f,p="success")=>{const y=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15);s(v=>[...v,{id:y,message:f,type:p}]),setTimeout(()=>{s(v=>v.filter(N=>N.id!==y))},3e3)},u=async()=>{try{l(!0);const p=await(await fetch(e("/api/config/skills"))).json();p.success&&Array.isArray(p.data)&&n(p.data)}catch(f){console.error("加载技能列表失败:",f),a("加载技能列表失败","error")}finally{l(!1)}};P.useEffect(()=>{u()},[]);const d=async(f,p)=>{try{const v=await(await fetch(e("/api/config/skills/toggle"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillId:f,enabled:p})})).json();v.success?(a(`技能 "${f}" 已${p?"启用":"禁用"}`,"success"),u()):a(`切换技能状态失败: ${v.message||v.error}`,"error")}catch(y){console.error("切换技能状态失败:",y),a("切换技能状态失败","error")}};if(r&&t.length===0)return i.jsx("div",{style:{padding:"1rem",color:"var(--text-secondary)",fontSize:"0.85rem"},children:"正在加载技能卡配置..."});if(!r&&t.length===0)return i.jsxs("div",{style:{padding:"2rem 1rem",textAlign:"center",color:"var(--text-secondary)",fontSize:"0.85rem"},children:["暂未扫描到任何技能卡。可在 ",i.jsx("code",{children:"~/.freya/skills/"})," 目录下添加 ",i.jsx("code",{children:"*.md"})," 技能卡文件。"]});const g=f=>{switch(f){case"builtin":return{label:"内置",bg:"rgba(59, 130, 246, 0.15)",color:"#60a5fa"};case"launch":return{label:"集成",bg:"rgba(168, 85, 247, 0.15)",color:"#c084fc"};case"runtime":default:return{label:"自定义",bg:"rgba(16, 185, 129, 0.15)",color:"#34d399"}}};return i.jsxs("div",{className:"plugins-list",children:[t.map(f=>{const p=f.name||f.id,y=f.description||"未提供描述信息",v=g(f.source);return i.jsxs("div",{className:"plugin-card",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"plugin-title",children:[p,i.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-secondary)",fontWeight:"normal",marginLeft:"0.5rem"},children:["(",f.id,")"]}),i.jsx("span",{style:{fontSize:"0.68rem",marginLeft:"0.5rem",padding:"0.1rem 0.4rem",borderRadius:"4px",background:v.bg,color:v.color},children:v.label})]}),i.jsx("div",{className:"plugin-desc",children:y})]}),i.jsx("div",{children:i.jsxs("label",{className:"switch",children:[i.jsx("input",{type:"checkbox",checked:f.enabled,onChange:N=>d(f.id,N.target.checked)}),i.jsx("span",{className:"slider"})]})})]},f.id)}),o.length>0&&i.jsx("div",{className:"toast-container",children:o.map(f=>i.jsx("div",{className:`toast-card ${f.type}`,children:i.jsx("span",{children:f.message})},f.id))})]})},_p=({onClose:e,getApiUrl:t})=>{const[n,r]=P.useState("global"),l=()=>n==="global"?"全局参数设置":n==="providers"?"大模型提供商与模型管理":n==="prompts"?"系统提示词管理":n==="plugins"?"扩展插件管理":n==="skills"?"技能卡管理":"";return i.jsx("div",{className:"modal-overlay",onClick:e,children:i.jsxs("div",{className:"modal-container",onClick:o=>o.stopPropagation(),children:[i.jsxs("div",{className:"modal-sidebar",children:[i.jsx("div",{className:"modal-sidebar-header",children:"Freya 配置中心"}),i.jsxs("div",{className:"modal-sidebar-tabs",children:[i.jsx("button",{className:`tab-btn ${n==="global"?"active":""}`,onClick:()=>r("global"),children:"全局配置"}),i.jsx("button",{className:`tab-btn ${n==="providers"?"active":""}`,onClick:()=>r("providers"),children:"模型提供商"}),i.jsx("button",{className:`tab-btn ${n==="prompts"?"active":""}`,onClick:()=>r("prompts"),children:"提示词管理"}),i.jsx("button",{className:`tab-btn ${n==="plugins"?"active":""}`,onClick:()=>r("plugins"),children:"扩展插件"}),i.jsx("button",{className:`tab-btn ${n==="skills"?"active":""}`,onClick:()=>r("skills"),children:"技能卡管理"})]})]}),i.jsxs("div",{className:"modal-main",children:[i.jsxs("div",{className:"modal-main-header",children:[i.jsx("div",{className:"tab-title",children:l()}),i.jsx("button",{className:"modal-close",onClick:e,title:"关闭",children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsxs("div",{className:"modal-body",children:[n==="global"&&i.jsx(jp,{getApiUrl:t}),n==="providers"&&i.jsx(Cp,{getApiUrl:t}),n==="prompts"&&i.jsx(Ep,{getApiUrl:t}),n==="plugins"&&i.jsx(Tp,{getApiUrl:t}),n==="skills"&&i.jsx(Pp,{getApiUrl:t})]})]})]})})},Yn=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).substring(2,15);function zp(){const[e,t]=P.useState([]),[n,r]=P.useState(""),[l,o]=P.useState(!1),[s,a]=P.useState(!1),[u,d]=P.useState({promptTokens:0,completionTokens:0,totalTokens:0,cachedPromptTokens:0,cost:0}),[g,f]=P.useState(!1),[p,y]=P.useState(null),v=P.useRef(null),N=P.useRef(Yn()),U=P.useRef(null);P.useEffect(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight)},[e]);const m=w=>`${window.location.pathname.endsWith("/")?window.location.pathname.slice(0,-1):window.location.pathname}${w}`;P.useEffect(()=>{let w=null,T=null,C=!1;function O(){if(C)return;const Y=window.location.protocol==="https:"?"wss:":"ws:",W=window.location.pathname.endsWith("/")?window.location.pathname:`${window.location.pathname}/`,ye=`${Y}//${window.location.host}${W}`;w=new WebSocket(ye),v.current=w,w.onopen=()=>{o(!0);let fe=sessionStorage.getItem("freya_clientId");fe||(fe=Yn(),sessionStorage.setItem("freya_clientId",fe)),w.send(JSON.stringify({event:"client:reconnect",data:{clientId:fe}}))},w.onmessage=fe=>{try{const Oe=JSON.parse(fe.data),{event:je,data:ie}=Oe;if(je==="server:connected")t(Z=>Z.length>0?Z:[{id:"sys-init",role:"assistant",content:ie.message}]);else if(je==="server:reply")t(Z=>[...Z,{id:Yn(),role:"assistant",content:ie.text,isTyping:!1}]);else if(je==="server:delta")t(Z=>{const ae=Z[Z.length-1];return ae&&ae.role==="assistant"&&ae.isTyping&&!ae.isTool?[...Z.slice(0,-1),{...ae,content:ae.content+ie.text}]:[...Z,{id:Yn(),role:"assistant",content:ie.text,isTyping:!0}]});else if(je==="server:billing")d({promptTokens:ie.promptTokens,completionTokens:ie.completionTokens,totalTokens:ie.totalTokens,cachedPromptTokens:ie.cachedPromptTokens,cost:ie.cost});else if(je==="server:tool_status"){const Z=ie.toolCallId,ae=ie.toolName,_=ie.status,D=ie.arguments,k=ie.result;t(z=>{let L="";if(Z)L=`tool-${Z}`;else{let Q="";try{Q=JSON.stringify(D)}catch{Q=String(D)}L=`tool-${ae}-${Q}`}const F=z.findIndex(Q=>Q.id===L);let I="正在执行...";_==="completed"?I="执行成功":_==="failed"&&(I=`执行失败: ${k||""}`);let R=k;try{JSON.stringify(k)}catch{R=typeof k=="object"?String(k):k}let E=D;try{JSON.stringify(D)}catch{E=typeof D=="object"?String(D):D}const A={id:L,role:"assistant",content:JSON.stringify({toolName:ae,status:_,arguments:E,result:R,statusText:I}),isTool:!0};if(F>-1){const Q=[...z];return Q[F]=A,Q}else return[...z,A]})}else je==="server:status"?a(ie.status==="generating"):je==="server:completed"&&(a(!1),t(Z=>{const ae=Z[Z.length-1];return ae&&ae.role==="assistant"?[...Z.slice(0,-1),{...ae,isTyping:!1}]:Z}))}catch(Oe){console.error("WS payload parse error:",Oe)}},w.onclose=()=>{o(!1),a(!1),C||(T=setTimeout(O,3e3))},w.onerror=fe=>{console.error("WS connection error:",fe),w.close()}}return O(),()=>{C=!0,w&&w.close(),T&&clearTimeout(T)}},[]);const c=()=>{!n.trim()||!l||(t(w=>[...w,{id:Yn(),role:"user",content:n}]),r(""),a(!0),v.current&&v.current.send(JSON.stringify({event:"client:message",data:{sessionId:N.current,content:n}})))},h=()=>{var w;!l||!s||((w=v.current)==null||w.send(JSON.stringify({event:"client:interrupt",data:{sessionId:N.current}})),a(!1),t(T=>{const C=T[T.length-1];return C&&C.role==="assistant"&&C.isTyping?[...T.slice(0,-1),{...C,content:C.content+" [生成已中断]",isTyping:!1}]:T}))},S=()=>{y({title:"重置当前会话",message:"确定要清空当前对话历史并重置会话吗?该操作不可撤销。",onConfirm:()=>{y(null),t([]),d({promptTokens:0,completionTokens:0,totalTokens:0,cachedPromptTokens:0,cost:0}),v.current&&l&&v.current.send(JSON.stringify({event:"client:message",data:{sessionId:N.current,content:"/reset"}}))}})};return i.jsxs("div",{className:"app-container",children:[i.jsx(vp,{isConnected:l,onClear:S,onOpenConfig:()=>f(!0)}),i.jsx(wp,{messages:e,chatPanelRef:U,isGenerating:s}),i.jsx(Np,{input:n,isConnected:l,isGenerating:s,billing:u,onChangeInput:r,onSend:c,onInterrupt:h}),g&&i.jsx(_p,{onClose:()=>f(!1),getApiUrl:m}),p&&i.jsx("div",{className:"confirm-modal-overlay",children:i.jsxs("div",{className:"confirm-modal-card",children:[i.jsxs("div",{className:"confirm-modal-title",children:[i.jsx("span",{children:"⚠️"}),i.jsx("span",{children:p.title})]}),i.jsx("div",{className:"confirm-modal-desc",children:p.message}),i.jsxs("div",{className:"confirm-modal-actions",children:[i.jsx("button",{className:"btn-secondary",style:{height:"32px",padding:"0 1rem"},onClick:()=>y(null),children:"取消"}),i.jsx("button",{className:"btn-primary",style:{height:"32px",padding:"0 1rem",background:"#f43f5e",borderColor:"#f43f5e"},onClick:p.onConfirm,children:"确定重置"})]})]})})]})}ko.createRoot(document.getElementById("root")).render(i.jsx(Ia.StrictMode,{children:i.jsx(zp,{})}));
package/ui/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
6
  <title>Freya 智能体控制台</title>
7
- <script type="module" crossorigin src="./assets/index-CSZmaZbL.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-CD0PlILU.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-CRL1XIVy.css">
9
9
  </head>
10
10
  <body>