@bpinhosilva/agent-orchestrator 1.0.0-alpha.36 → 1.0.0-alpha.37

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 (55) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/migrations/1775940000000-DropArtifactsTable.js +13 -0
  3. package/dist/models/models.module.js +2 -1
  4. package/dist/models/models.service.js +13 -2
  5. package/dist/ui/assets/AgentFleet-CJZli5uA.js +1 -0
  6. package/dist/ui/assets/{AttachmentItem-QhT0YOmu.js → AttachmentItem-BtWBbVb3.js} +1 -1
  7. package/dist/ui/assets/ConfirmDialog-0ML5KiMx.js +1 -0
  8. package/dist/ui/assets/CreateRecurrentTaskModal-CBDVBNo3.js +1 -0
  9. package/dist/ui/assets/{MarkdownField-DJ12Ejut.js → MarkdownField-NTZbIxf_.js} +1 -1
  10. package/dist/ui/assets/Profile-CqypVkz4.js +1 -0
  11. package/dist/ui/assets/{ProjectDetail-v5rQQk2o.js → ProjectDetail-qhJ1BW1O.js} +1 -1
  12. package/dist/ui/assets/Providers-DCwmZwIR.js +1 -0
  13. package/dist/ui/assets/Scheduler-p4EMmdyC.js +1 -0
  14. package/dist/ui/assets/{Settings-DbnrEvZM.js → Settings-D9CpYRIX.js} +1 -1
  15. package/dist/ui/assets/{TaskDetail-C1bdyprq.js → TaskDetail-BEeV-tnd.js} +1 -1
  16. package/dist/ui/assets/TaskExecutions-vewMhs1F.js +2 -0
  17. package/dist/ui/assets/TaskManager-BbH2Ryxd.js +8 -0
  18. package/dist/ui/assets/UserDetail-obJE0ziY.js +1 -0
  19. package/dist/ui/assets/Users-Byt4xdom.js +1 -0
  20. package/dist/ui/assets/index-UgPpBNRb.js +3 -0
  21. package/dist/ui/assets/index-gxaIk1id.css +2 -0
  22. package/dist/ui/assets/providers-W8KP5fBt.js +1 -0
  23. package/dist/ui/assets/x-CM5VLsbZ.js +1 -0
  24. package/dist/ui/index.html +3 -2
  25. package/package.json +1 -1
  26. package/dist/ui/assets/AgentFleet-CMdfKF4L.js +0 -1
  27. package/dist/ui/assets/ConfirmDialog-BiPWFYdx.js +0 -1
  28. package/dist/ui/assets/CreateRecurrentTaskModal-BsVRuvR2.js +0 -1
  29. package/dist/ui/assets/Profile-seY6wWr2.js +0 -1
  30. package/dist/ui/assets/Providers-DK-acBgM.js +0 -1
  31. package/dist/ui/assets/Scheduler-DflIuJxr.js +0 -1
  32. package/dist/ui/assets/TaskExecutions-B28kes6l.js +0 -2
  33. package/dist/ui/assets/TaskManager-DAQNB4Q5.js +0 -8
  34. package/dist/ui/assets/UserDetail-CyKBaqAe.js +0 -1
  35. package/dist/ui/assets/Users-g6D9mZQc.js +0 -1
  36. package/dist/ui/assets/index-4X4zupUS.js +0 -3
  37. package/dist/ui/assets/index-BUrAFVNL.css +0 -2
  38. package/dist/ui/assets/providers-BLAJFnS4.js +0 -1
  39. package/dist/ui/assets/trending-up-D2Iapk5q.js +0 -1
  40. /package/dist/ui/assets/{clock-BTNXfvPT.js → clock-B13B5_wP.js} +0 -0
  41. /package/dist/ui/assets/{eye-CSLoB6-a.js → eye-C7PLqIzx.js} +0 -0
  42. /package/dist/ui/assets/{file-text-CRyDRJx0.js → file-text-D92QURK8.js} +0 -0
  43. /package/dist/ui/assets/{layers-CpiP5U5p.js → layers-CNTE6Cl4.js} +0 -0
  44. /package/dist/ui/assets/{loader-circle-DbVXtlbV.js → loader-circle-BJWGdyUC.js} +0 -0
  45. /package/dist/ui/assets/{paperclip-6x5JJ7A7.js → paperclip-b4O2LqQ-.js} +0 -0
  46. /package/dist/ui/assets/{refresh-cw-BGkg-lCf.js → refresh-cw-Bx28oH-b.js} +0 -0
  47. /package/dist/ui/assets/{rocket-DzN1Mizs.js → rocket-D75KmVDG.js} +0 -0
  48. /package/dist/ui/assets/{save-zLR2Bpx5.js → save-BJqQo16R.js} +0 -0
  49. /package/dist/ui/assets/{send-Bwuzypop.js → send-DHRDZ09J.js} +0 -0
  50. /package/dist/ui/assets/{shield-alert-BRwAB12k.js → shield-alert-DwOWpTph.js} +0 -0
  51. /package/dist/ui/assets/{shield-check-CdGbbgI2.js → shield-check-5104WjFF.js} +0 -0
  52. /package/dist/ui/assets/{terminal-DXcWSHx9.js → terminal-FItpYHvw.js} +0 -0
  53. /package/dist/ui/assets/{trash-2-BWnYC9Ad.js → trash-2-BlARVDmE.js} +0 -0
  54. /package/dist/ui/assets/{user-plus-CiJgTJ8j.js → user-plus-5rm15Rqq.js} +0 -0
  55. /package/dist/ui/assets/{users-BVNMRlU5.js → users-KvCcsozL.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.0.0-alpha.37](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2026-04-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **models:** implement model deletion with agent association check and enhance UI for model mgn ([e4cc599](https://github.com/bpinhosilva/agent-orchestrator/commit/e4cc599263f910e80e00116218e9408ec2ac2bf3))
7
+
1
8
  # [1.0.0-alpha.36](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2026-04-13)
2
9
 
3
10
 
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DropArtifactsTable1775940000000 = void 0;
4
+ class DropArtifactsTable1775940000000 {
5
+ name = 'DropArtifactsTable1775940000000';
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`DROP TABLE "artifacts"`);
8
+ }
9
+ async down(queryRunner) {
10
+ await queryRunner.query(`CREATE TABLE "artifacts" ("id" uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(), "originalName" varchar NOT NULL, "mimeType" varchar NOT NULL, "filePath" varchar NOT NULL, "metadata" text)`);
11
+ }
12
+ }
13
+ exports.DropArtifactsTable1775940000000 = DropArtifactsTable1775940000000;
@@ -12,12 +12,13 @@ const typeorm_1 = require("@nestjs/typeorm");
12
12
  const models_service_1 = require("./models.service");
13
13
  const models_controller_1 = require("./models.controller");
14
14
  const model_entity_1 = require("./entities/model.entity");
15
+ const agent_entity_1 = require("../agents/entities/agent.entity");
15
16
  let ModelsModule = class ModelsModule {
16
17
  };
17
18
  exports.ModelsModule = ModelsModule;
18
19
  exports.ModelsModule = ModelsModule = __decorate([
19
20
  (0, common_1.Module)({
20
- imports: [typeorm_1.TypeOrmModule.forFeature([model_entity_1.Model])],
21
+ imports: [typeorm_1.TypeOrmModule.forFeature([model_entity_1.Model, agent_entity_1.AgentEntity])],
21
22
  controllers: [models_controller_1.ModelsController],
22
23
  providers: [models_service_1.ModelsService],
23
24
  exports: [typeorm_1.TypeOrmModule],
@@ -17,10 +17,13 @@ const common_1 = require("@nestjs/common");
17
17
  const typeorm_1 = require("@nestjs/typeorm");
18
18
  const typeorm_2 = require("typeorm");
19
19
  const model_entity_1 = require("./entities/model.entity");
20
+ const agent_entity_1 = require("../agents/entities/agent.entity");
20
21
  let ModelsService = class ModelsService {
21
22
  modelRepository;
22
- constructor(modelRepository) {
23
+ agentRepository;
24
+ constructor(modelRepository, agentRepository) {
23
25
  this.modelRepository = modelRepository;
26
+ this.agentRepository = agentRepository;
24
27
  }
25
28
  async create(createModelDto) {
26
29
  const { providerId, ...rest } = createModelDto;
@@ -66,6 +69,12 @@ let ModelsService = class ModelsService {
66
69
  }
67
70
  async remove(id) {
68
71
  const model = await this.findOne(id);
72
+ const agentCount = await this.agentRepository.count({
73
+ where: { model: { id } },
74
+ });
75
+ if (agentCount > 0) {
76
+ throw new common_1.ConflictException(`Cannot delete model "${model.name}": ${agentCount} agent(s) are currently using it.`);
77
+ }
69
78
  await this.modelRepository.remove(model);
70
79
  }
71
80
  };
@@ -73,5 +82,7 @@ exports.ModelsService = ModelsService;
73
82
  exports.ModelsService = ModelsService = __decorate([
74
83
  (0, common_1.Injectable)(),
75
84
  __param(0, (0, typeorm_1.InjectRepository)(model_entity_1.Model)),
76
- __metadata("design:paramtypes", [typeorm_2.Repository])
85
+ __param(1, (0, typeorm_1.InjectRepository)(agent_entity_1.AgentEntity)),
86
+ __metadata("design:paramtypes", [typeorm_2.Repository,
87
+ typeorm_2.Repository])
77
88
  ], ModelsService);
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{i as n,n as r,t as i}from"./vendor-query-BMPnNmZi.js";import{r as a}from"./vendor-markdown-Dl_1qnne.js";import{i as o}from"./client-CylGrWpP.js";import{t as s}from"./activity-D2aBFbnN.js";import{t as c}from"./box-3f35ZKNV.js";import{t as l}from"./brain-DwFWAhZ9.js";import{t as u}from"./check-BhOeS9mA.js";import{t as d}from"./chevron-down-DOfOMDZp.js";import{n as f,t as p}from"./x-CM5VLsbZ.js";import{n as m,t as h}from"./terminal-FItpYHvw.js";import{n as g,t as _}from"./MarkdownField-NTZbIxf_.js";import{r as v,t as y}from"./providers-W8KP5fBt.js";import{t as b}from"./layers-CNTE6Cl4.js";import{t as x}from"./loader-circle-BJWGdyUC.js";import{t as S}from"./send-DHRDZ09J.js";import{t as C}from"./trash-2-BlARVDmE.js";import{t as w}from"./ConfirmDialog-0ML5KiMx.js";import{n as T,t as E}from"./vendor-motion-CPra8At-.js";import{c as ee,g as D,l as O,u as k,v as A,x as j}from"./index-UgPpBNRb.js";import{c as M,l as N,o as P,r as te,s as F,t as I}from"./taskFormSchemas-CgvN8KCz.js";import{a as L,c as R,o as z,s as B}from"./vendor-forms-BmyvqYDG.js";import"./tasks-CaT1ysud.js";var ne=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),V=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),H=o(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),U=o(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),re=o(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),W=e(t(),1),G=a(),K={active:{color:`text-secondary`,bg:`bg-secondary/10`,dot:`bg-secondary`,animate:`animate-pulse`,icon:l},idle:{color:`text-on-surface-variant`,bg:`bg-on-surface-variant/10`,dot:`bg-on-surface-variant`,animate:``,icon:g},updating:{color:`text-primary`,bg:`bg-primary/10`,dot:`bg-primary`,animate:`animate-ping`,icon:s},inactive:{color:`text-error/60`,bg:`bg-error/5`,dot:`bg-error/40`,animate:``,icon:m}},q=({id:e,name:t,emoji:n,expertise:r,model:i,status:a,metricLabel:o,metricValue:s,onProbe:c,onConfigure:u,onDelete:d,onActivate:f})=>{let[p,m]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&m(!1)};return p&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(0,G.jsxs)(`div`,{className:`group relative bg-surface-container-low rounded-xl p-6 transition-all duration-300 hover:translate-y-[-4px] shadow-lg border border-transparent hover:border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5 px-2.5 py-1 rounded-full ${_.bg} ${_.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${_.dot} ${_.animate}`}),a]}),(0,G.jsxs)(`div`,{className:`flex gap-5`,children:[(0,G.jsx)(`div`,{className:`w-16 h-16 rounded-xl bg-surface-container-high flex items-center justify-center ring-1 ring-outline-variant/30 group-hover:ring-primary/50 transition-all text-3xl`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:n??`🧠`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-on-surface-variant text-xs mt-1`,children:r}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:`Model`}),(0,G.jsx)(`span`,{className:`text-xs font-semibold text-primary`,children:i})]}),(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:o}),(0,G.jsx)(`span`,{className:`text-xs font-semibold ${_.color}`,children:s})]})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e)},className:`flex-1 py-2 rounded bg-surface-container-high text-xs font-semibold text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Configure`}),(0,G.jsxs)(`div`,{className:`relative`,ref:g,children:[(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),m(!p)},"aria-label":`Agent actions menu`,className:`px-3 py-2 rounded bg-surface-container-high text-on-surface-variant hover:text-white transition-colors h-full ${p?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(v,{size:16,"aria-hidden":`true`})}),p&&(0,G.jsxs)(`div`,{className:`absolute bottom-full right-0 mb-2 w-48 bg-surface-container-highest rounded-lg shadow-2xl py-2 ring-1 ring-outline-variant/20 animate-in fade-in slide-in-from-bottom-2 duration-200 z-20`,children:[(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),c?.(e),m(!1)},disabled:a===`inactive`,className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-primary/10 transition-colors group disabled:opacity-30 disabled:grayscale disabled:cursor-not-allowed`,children:[(0,G.jsx)(h,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-white/5 transition-colors`,children:[(0,G.jsx)(D,{size:14}),`Control Matrix`]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-outline-variant/10`}),a===`inactive`?(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),f?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-secondary/60 hover:text-secondary hover:bg-secondary/10 transition-colors`,children:[(0,G.jsx)(l,{size:14}),`Activate Node`]}):(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e),m(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-error/60 hover:text-error hover:bg-error/10 transition-colors`,children:[(0,G.jsx)(C,{size:14}),`Decommission`]})]})]})]})]})},ie=({isOpen:e,selectedEmoji:t,currentEmoji:n,isSaving:r,onSelect:i,onClose:a,onConfirm:o})=>((0,W.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[110] flex items-center justify-center bg-black/70 px-4 py-8 backdrop-blur-md`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-emoji-picker-title`,className:`relative w-full max-w-3xl overflow-hidden rounded-[28px] border border-outline-variant/20 bg-surface shadow-[0_35px_120px_rgba(0,0,0,0.55)]`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(173,198,255,0.16),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(197,255,191,0.12),transparent_32%)]`}),(0,G.jsx)(`div`,{className:`relative border-b border-outline-variant/10 px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-black uppercase tracking-[0.32em] text-primary`,children:[(0,G.jsx)(g,{size:12}),`Agent identity`]}),(0,G.jsx)(`h2`,{id:`agent-emoji-picker-title`,className:`font-headline text-2xl font-black tracking-tight text-on-surface`,children:`Choose an emoji signature`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm leading-relaxed text-on-surface-variant`,children:`Pick one of the built-in native emojis to mark this agent across the fleet, tasks, and comments.`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close emoji picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,G.jsx)(p,{size:18})})]})}),(0,G.jsxs)(`div`,{className:`relative p-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:P.map(e=>{let r=e.value===t,a=e.value===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.value),className:`group relative overflow-hidden rounded-3xl border p-4 text-left transition-all duration-200 ${r?`border-primary bg-primary/10 shadow-[0_18px_35px_rgba(173,198,255,0.16)]`:`border-outline-variant/20 bg-surface-container-low/80 hover:-translate-y-0.5 hover:border-primary/35 hover:bg-surface-container-high`}`,"aria-pressed":r,"aria-label":`${e.label} emoji ${e.value}`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl border border-white/5 bg-surface-container-high text-4xl shadow-inner shadow-black/20`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.value})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:e.hint})]}),r?(0,G.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,G.jsx)(u,{size:14})}):null]}),(0,G.jsx)(`p`,{className:`mt-3 text-[11px] font-bold uppercase tracking-[0.24em] text-on-surface-variant/60`,children:a?`Current`:`Available`})]},e.value)})}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,G.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save emoji`]})]})]})]})]}):null),J=[{label:`AI Optimized`,values:{creativity:3,strictness:3.5}},{label:`Creative`,values:{creativity:4.5,strictness:2}},{label:`Analyst`,values:{creativity:1.5,strictness:4.5}},{label:`Assistant`,values:{creativity:3,strictness:2.5}},{label:`Strict Expert`,values:{creativity:2,strictness:5}}],Y=1,X=5,Z=.01,Q=e=>(e??O.creativity).toFixed(2),ae=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??O.creativity,i=e.strictness??O.strictness,a=n=>{t({...e,creativity:parseFloat(n.target.value)})},o=n=>{t({...e,strictness:parseFloat(n.target.value)})};return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Personality Matrix`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t({...e.values}),disabled:n,"aria-label":e.label,className:`text-[10px] px-2 py-0.5 rounded bg-surface-container-highest hover:bg-tertiary/20 hover:text-tertiary border border-outline/20 transition-colors disabled:pointer-events-none disabled:opacity-50`,children:e.label},e.label))}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Creativity`}),(0,G.jsx)(`span`,{"data-testid":`creativity-value`,className:`text-primary font-mono font-bold`,children:Q(r)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:r,onChange:a,disabled:n,"aria-label":`Creativity`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":r,className:`w-full accent-primary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Strictness`}),(0,G.jsx)(`span`,{"data-testid":`strictness-value`,className:`text-secondary font-mono font-bold`,children:Q(i)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:i,onChange:o,disabled:n,"aria-label":`Strictness`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":i,className:`w-full accent-secondary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]})]})]})},oe=({isOpen:e,onClose:t,onUpdated:n,agent:r})=>{let{notifyError:i,notifySuccess:a}=ee(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[f,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),[v,b]=(0,W.useState)(``),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),[E,D]=(0,W.useState)(``),[A,j]=(0,W.useState)([]),[P,te]=(0,W.useState)(``),[F,I]=(0,W.useState)([]),[L,R]=(0,W.useState)(``),[z,B]=(0,W.useState)(`🧠`),[V,H]=(0,W.useState)(!1),[U,K]=(0,W.useState)({...O});(0,W.useEffect)(()=>{e&&r&&(b(r.name||``),C(r.role||``),T(r.description||``),D(r.systemInstructions||``),R(r.model?.id||``),B(N(r.emoji)),te(r.model?.provider?.id??``),K(r.attributes??{...O}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{m(!0);let{data:e}=await y.findAll();j(e)}catch{}finally{m(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!P){I([]);return}(async()=>{try{l(!0);let{data:e}=await y.findModels(P);I(e),L&&!e.find(e=>e.id===L)&&R(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[P,L]);let q=()=>{r?.id&&(navigator.clipboard.writeText(r.id),g(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>g(!1),2e3))},J=async()=>{if(r?.id)try{s(!0),await k.update(r.id,{name:v,emoji:z,role:S,description:w,systemInstructions:E,modelId:L||void 0,attributes:U}),n?.(),t()}catch{i(`Update Failed`,`An error occurred while saving the configuration.`)}finally{s(!1)}};return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!V&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[V,e,t]),e?(0,G.jsxs)(`div`,{className:`fixed inset-y-0 right-0 w-[420px] bg-surface-container-low shadow-2xl z-[60] flex flex-col ring-1 ring-outline-variant/10 animate-in slide-in-from-right duration-300`,children:[(0,G.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/10 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Agent Configuration`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest mt-0.5`,children:[`Edit Profile: `,r?.name||`Logic Specialist`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors`,children:(0,G.jsx)(p,{size:20})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-8 scrollbar-hide`,children:[(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>H(!0),className:`relative flex h-20 w-20 items-center justify-center overflow-hidden rounded-2xl bg-surface-container-high ring-1 ring-outline-variant/50 transition-all hover:ring-primary/40`,"aria-label":`Change agent emoji`,children:[(0,G.jsx)(`span`,{className:`text-4xl text-secondary`,children:z}),(0,G.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity hover:opacity-100 text-white`,children:(0,G.jsx)(re,{size:16})})]}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Emoji Signature`}),(0,G.jsx)(`p`,{className:`text-xs font-semibold text-on-surface`,children:M(z).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:M(z).hint})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3`,type:`text`,value:v,onChange:e=>b(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{className:`flex-1 bg-surface-container-lowest/50 border-none rounded-md text-[10px] font-mono text-on-surface-variant focus:ring-0 h-8 px-3 cursor-default`,type:`text`,value:r?.id||``,readOnly:!0}),(0,G.jsx)(`button`,{onClick:q,className:`p-1.5 rounded bg-surface-container-highest hover:bg-surface-container-highest/80 text-on-surface-variant transition-colors flex items-center justify-center aspect-square h-8`,title:`Copy ID`,children:h?(0,G.jsx)(u,{size:14,className:`text-primary`}):(0,G.jsx)(ne,{size:14})})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Role`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3 placeholder:text-on-surface-variant/30`,type:`text`,placeholder:`e.g. Researcher, Developer...`,value:S,onChange:e=>C(e.target.value)})]})]}),(0,G.jsx)(_,{label:`Description`,value:w,onChange:T,placeholder:`Detailed agent profile...`,height:`h-32`,maxLength:1e3}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Provider`}),f&&(0,G.jsx)(x,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:P,onChange:e=>te(e.target.value),disabled:f,children:[(0,G.jsx)(`option`,{value:``,children:`Select a provider...`}),A.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Model Engine`}),c&&(0,G.jsx)(x,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:L,onChange:e=>R(e.target.value),disabled:c||F.length===0,children:[F.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),F.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsx)(ae,{value:U,onChange:K}),(0,G.jsx)(_,{label:`System Instructions`,value:E,onChange:D,placeholder:`Define operational logic...`,height:`h-64`,maxLength:2e3})]}),(0,G.jsxs)(`div`,{className:`p-6 bg-surface-container-high border-t border-outline-variant/10 flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>{J()},disabled:o,className:`flex-1 bg-primary text-on-primary py-2.5 rounded font-bold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 transition-all flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50`,children:o?(0,G.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:16}),`Save Changes`]})}),(0,G.jsx)(`button`,{onClick:t,className:`px-4 py-2.5 rounded border border-outline-variant text-on-surface-variant hover:text-white transition-all`,children:`Reset`})]}),(0,G.jsx)(ie,{isOpen:V,selectedEmoji:z,currentEmoji:N(r?.emoji),isSaving:o,onSelect:B,onClose:()=>H(!1),onConfirm:()=>H(!1)})]}):null},se={name:``,role:``,description:``,emoji:F,providerId:``,modelId:``,instructions:I,attributes:{...O}},ce=[{id:1,title:`Essential Config`,subtitle:`ID, ROLE & MODEL`},{id:2,title:`Intelligence Tuning`,subtitle:`COGNITIVE MATRIX`},{id:3,title:`Instructions`,subtitle:`KNOWLEDGE BASE`}],$=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:s,notifyError:l,notifySuccess:u}=ee(),[f,p]=(0,W.useState)(1),[m,h]=(0,W.useState)(!1),v=(0,W.useId)(),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),w=(0,W.useId)(),D=(0,W.useId)(),A=(0,W.useId)(),j=(0,W.useId)(),{control:P,formState:{errors:I},handleSubmit:ne,register:V,reset:H,setValue:U}=B({resolver:L(te),defaultValues:se,mode:`onBlur`}),K=R({control:P,name:`providerId`}),q=R({control:P,name:`modelId`}),J=R({control:P,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await y.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await y.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(se);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,H]),(0,W.useEffect)(()=>{e&&Y.error&&s(Y.error,`Providers Load Failed`)},[e,s,Y.error]),(0,W.useEffect)(()=>{e&&X.error&&s(X.error,`Models Load Failed`)},[e,X.error,s]);let Z=(0,W.useMemo)(()=>Y.data??[],[Y.data]),Q=(0,W.useMemo)(()=>X.data??[],[X.data]);(0,W.useEffect)(()=>{if(e){if(Z.length===0){K&&U(`providerId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!K||!Z.some(e=>e.id===K))&&U(`providerId`,Z[0].id,{shouldDirty:!1,shouldValidate:!0})}},[e,K,Z,U]),(0,W.useEffect)(()=>{if(e){if(!K){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}if(Q.length===0){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!q||!Q.some(e=>e.id===q))&&U(`modelId`,Q[0].id,{shouldDirty:!1,shouldValidate:!0})}},[Q,e,q,K,U]);let oe=i({mutationFn:async e=>(await k.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,modelId:e.modelId,status:`active`,attributes:e.attributes}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`agents`]}),u(`Agent Deployed`,`Successfully commissioned ${e.name} into the fleet.`),a?.(),t(),H(se),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=oe.isPending,le=Y.isPending||X.isPending,ue=ne(async e=>{await oe.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),de=()=>{$||(p(1),t())};return e?(0,G.jsx)(T,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,G.jsx)(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:de,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(E.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":v,"aria-describedby":x,"aria-busy":$||le,className:`relative w-full max-w-5xl h-full max-h-[850px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{id:v,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:x,className:`text-sm text-on-surface-variant/80 mt-1`,children:`Configure a specialized AI persona to handle specific nodes in your automation flows.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:de,disabled:$,className:`px-6 py-2.5 rounded-md text-sm font-bold text-on-surface-variant hover:text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:ue,disabled:$||Z.length===0||Q.length===0,className:`px-8 py-2.5 rounded-md bg-primary text-on-primary text-sm font-bold shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed disabled:hover:scale-100`,children:$?`Deploying...`:`Deploy Agent`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`w-72 bg-surface-container-low/30 border-r border-outline-variant/5 p-8 flex flex-col gap-10`,children:[(0,G.jsx)(`div`,{className:`space-y-8`,children:ce.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex gap-4 group cursor-pointer text-left w-full`,onClick:()=>p(e.id),"aria-pressed":f===e.id,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-[10px] font-black transition-all ${f===e.id?`bg-secondary text-surface`:`bg-surface-container-highest text-on-surface-variant`}`,children:e.id.toString().padStart(2,`0`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-bold font-headline transition-colors ${f===e.id?`text-white`:`text-on-surface-variant`}`,children:e.title}),(0,G.jsx)(`p`,{className:`text-[9px] font-bold tracking-widest text-on-surface-variant/50 mt-0.5`,children:e.subtitle})]})]},e.id))}),(0,G.jsxs)(`div`,{className:`mt-auto bg-tertiary/10 rounded-xl p-5 ring-1 ring-tertiary/20 backdrop-blur-sm relative overflow-hidden group`,children:[(0,G.jsx)(`div`,{className:`absolute -right-4 -top-4 w-16 h-16 bg-tertiary/10 rounded-full blur-2xl group-hover:bg-tertiary/20 transition-all duration-700`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-tertiary`,children:[(0,G.jsx)(g,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest`,children:`AI Suggestion`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed italic`,children:[`"Try selecting `,(0,G.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Researcher`}),` role for high-depth data synthesis tasks."`]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-12 custom-scrollbar`,children:[(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-secondary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Basic Configuration`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:`group flex w-full items-center justify-between rounded-[24px] border border-outline-variant/10 bg-surface-container-highest/20 p-5 text-left transition-all hover:border-primary/30 hover:bg-surface-container-highest/35`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-20 w-20 items-center justify-center rounded-[20px] border border-primary/20 bg-surface-container-high text-5xl shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:N(J)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.32em] text-primary/80`,children:`Emoji signature`}),(0,G.jsx)(`h4`,{className:`mt-2 font-headline text-xl font-black text-white`,children:M(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:M(J).hint})]})]}),(0,G.jsx)(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-full border border-outline-variant/20 bg-surface-container-high text-on-surface-variant transition-colors group-hover:text-on-surface`,children:(0,G.jsx)(re,{size:16,"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-name`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,G.jsx)(`input`,{id:`create-agent-name`,type:`text`,placeholder:`e.g. Researcher-X`,"aria-invalid":!!I.name,"aria-describedby":I.name?S:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`name`)})}),I.name&&(0,G.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:I.name.message})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-role`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Primary Role`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all text-on-surface`,children:(0,G.jsx)(`input`,{id:`create-agent-role`,type:`text`,placeholder:`e.g. Researcher`,"aria-invalid":!!I.role,"aria-describedby":I.role?C:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-4 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`role`)})}),I.role&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:I.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(z,{control:P,name:`description`,render:({field:e})=>(0,G.jsx)(_,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Define what this agent aims to achieve... You can use markdown for formatting.`,height:`h-32`,maxLength:1e3})}),I.description&&(0,G.jsx)(`p`,{id:w,className:`text-xs text-error font-semibold`,children:I.description.message})]}),(0,G.jsxs)(`div`,{className:`pt-4 space-y-8 border-t border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Select Provider`}),le&&(0,G.jsx)(`span`,{className:`text-[10px] text-primary animate-pulse font-bold uppercase tracking-widest`,children:`Updating...`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[Z.map(e=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":K===e.id,onClick:()=>{K!==e.id&&(U(`providerId`,e.id,{shouldDirty:!0,shouldValidate:!0}),U(`modelId`,``,{shouldDirty:!0,shouldValidate:!1}))},className:`p-4 rounded-xl flex flex-col items-center gap-3 transition-all ${K===e.id?`bg-primary/10 ring-2 ring-primary shadow-[0_0_20px_rgba(173,198,255,0.15)]`:`bg-surface-container-highest/30 ring-1 ring-outline-variant/10 hover:bg-surface-container-highest/50`}`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${K===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:(0,G.jsx)(c,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`h4`,{className:`text-xs font-black uppercase tracking-wider ${K===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name})})]},e.id)),Z.length===0&&!Y.isPending&&(0,G.jsxs)(`div`,{className:`col-span-4 py-8 border-2 border-dashed border-outline-variant/10 rounded-xl flex flex-col items-center justify-center text-on-surface-variant/40 gap-2`,children:[(0,G.jsx)(b,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),I.providerId&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:I.providerId.message})]}),(0,G.jsx)(T,{mode:`wait`,children:K&&(0,G.jsxs)(E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`space-y-4 pt-4 border-t border-outline-variant/5`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-model`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Model Variant Selection`}),(0,G.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,G.jsxs)(`select`,{id:`create-agent-model`,value:q,onChange:e=>U(`modelId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!I.modelId,"aria-describedby":I.modelId?A:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,disabled:!0,className:`bg-surface-container-low text-on-surface`,children:`Select a model...`}),Q.map(e=>(0,G.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,G.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,G.jsx)(d,{size:18,"aria-hidden":`true`})})]}),I.modelId&&(0,G.jsx)(`p`,{id:A,className:`text-xs text-error font-semibold`,children:I.modelId.message}),Q.length===0&&!X.isPending&&(0,G.jsx)(`div`,{className:`py-6 text-center bg-error/5 rounded-xl border border-error/10`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-error uppercase tracking-widest opacity-60`,children:`No model variants found for this provider`})})]},K)})]})]}),(0,G.jsxs)(`section`,{className:`space-y-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-primary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Intelligence Tuning`})]}),(0,G.jsx)(z,{control:P,name:`attributes`,render:({field:e})=>(0,G.jsx)(ae,{value:e.value??{...O},onChange:e.onChange})})]}),(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-tertiary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Operational Directives`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(z,{control:P,name:`instructions`,render:({field:e})=>(0,G.jsx)(_,{label:`System Instructions`,value:e.value,onChange:e.onChange,height:`h-64`,helperText:`Prompt Engineering Active`,maxLength:1e3})}),I.instructions&&(0,G.jsx)(`p`,{id:j,className:`text-xs text-error font-semibold`,children:I.instructions.message})]})]})]})]})]}),(0,G.jsx)(ie,{isOpen:m,selectedEmoji:N(J),currentEmoji:F,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>h(!1),onConfirm:()=>h(!1)})]})}):null},le=({isOpen:e,onClose:t,agent:n})=>{let r=`Wake up, who are you?`,[i,a]=(0,W.useState)(r),[o,c]=(0,W.useState)(``),[u,d]=(0,W.useState)(),[m,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(`idle`);return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),c(``),d(void 0),v(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(T,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,G.jsxs)(E.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-2xl bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-6 py-4 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,G.jsx)(l,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:[`Probe: `,n?.name]}),(0,G.jsx)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest font-bold`,children:`Neural Direct Message`})]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors p-2`,children:(0,G.jsx)(p,{size:20})})]}),(0,G.jsxs)(`div`,{className:`p-6 space-y-6 max-h-[80vh] overflow-y-auto scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(h,{size:12}),`Command Input`]}),(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`Type your command...`,className:`w-full bg-surface-container-highest/30 rounded-xl p-4 text-sm text-on-surface h-32 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all resize-none border border-outline-variant/10 group-hover:border-outline-variant/30`}),(0,G.jsx)(`button`,{onClick:async()=>{if(!(!n?.id||!i.trim()))try{g(!0),v(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await k.probe(n.id,i);c(e.content),d(e.image),v(`success`)}catch(e){console.error(`Probe failed:`,e);let t=`An unexpected error occurred during the probe.`;if(e&&typeof e==`object`&&`response`in e){let n=e;t=n.response?.data?.message||n.message||t}else e instanceof Error&&(t=e.message);c(`ERROR: ${t}`),v(`error`)}finally{g(!1)}},disabled:m||!i.trim(),className:`absolute bottom-3 right-3 p-2.5 rounded-lg bg-primary text-on-primary shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-[0.95] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:m?(0,G.jsx)(x,{size:18,className:`animate-spin`}):(0,G.jsx)(S,{size:18})})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(s,{size:12,className:m?`animate-pulse`:``}),`Neural Response`]}),_===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-secondary uppercase bg-secondary/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(f,{size:10}),` Sync Complete`]}),_===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-error uppercase bg-error/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(j,{size:10}),` Link Severed`]})]}),(0,G.jsx)(`div`,{className:`w-full min-h-[100px] bg-black/40 rounded-xl p-5 border border-outline-variant/5 font-mono text-sm leading-relaxed transition-all duration-500 whitespace-pre-wrap ${_===`error`?`text-error/80 border-error/20`:_===`success`?`text-secondary/90 border-secondary/20 shadow-[inset_0_0_20px_rgba(102,231,175,0.05)]`:`text-on-surface-variant/60`}`,children:o||`Enter a command and initiate the probe to see the agent response.`}),(0,G.jsx)(T,{children:u&&(0,G.jsxs)(E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(H,{size:12}),`Visual Output`]}),(0,G.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border border-outline-variant/10 bg-surface-container-highest/20 group`,children:[(0,G.jsx)(`img`,{src:`data:image/png;base64,${u}`,alt:`Neural Output`,className:`w-full h-auto max-h-[400px] object-contain mx-auto`}),(0,G.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-white uppercase tracking-wider`,children:`Generated Content`})})]})]})})]})]}),(0,G.jsx)(`div`,{className:`px-6 py-4 bg-surface-container-high/50 border-t border-outline-variant/10 flex justify-end`,children:(0,G.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface hover:bg-surface-container-highest transition-all`,children:`Close Terminal`})})]})]})}):null},ue=()=>{let{notifySuccess:e,notifyApiError:t}=ee(),a=n(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(`grid`),{data:v=[],isLoading:y}=r({queryKey:[`agents`],queryFn:async()=>{let{data:e}=await k.findAll();return e}}),b=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),S=i({mutationFn:e=>k.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),b()},onError:e=>t(e,`Operation Failed`)}),C=i({mutationFn:e=>k.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),b()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},E=e=>{s(e),p(!0)},D=e=>{s(e),h(!0)},O=()=>{o&&S.mutate(o.id)},j=e=>{C.mutate(e)};return(0,G.jsxs)(`div`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agent Fleet`}),(0,G.jsxs)(`p`,{className:`text-on-surface-variant mt-2 font-body text-sm`,children:[`Commanding `,(0,G.jsx)(`span`,{className:`text-secondary font-bold`,children:v.filter(e=>e.status!==`inactive`).length}),` active neural nodes across the network.`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>_(`grid`),"aria-label":`Grid view`,"aria-pressed":g===`grid`,className:`p-2 rounded transition-colors ${g===`grid`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(V,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`button`,{onClick:()=>_(`list`),"aria-label":`List view`,"aria-pressed":g===`list`,className:`p-2 rounded transition-colors ${g===`list`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(U,{size:20,"aria-hidden":`true`})})]})]}),y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(x,{className:`w-12 h-12 text-primary animate-spin`})}):(0,G.jsxs)(`div`,{className:g===`grid`?`grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-3 gap-6`:`flex flex-col gap-4`,children:[v.map(e=>(0,G.jsx)(`div`,{onClick:()=>T(e),className:e.status===`inactive`?`opacity-50 grayscale hover:grayscale-0 transition-all`:``,children:(0,G.jsx)(q,{id:e.id,name:e.name,emoji:e.emoji,expertise:e.role||`General Assistant`,model:e.model?.name||`Unknown`,status:e.status||`active`,metricLabel:`Provider`,metricValue:e.model?.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>E(e),onDelete:()=>D(e),onActivate:()=>j(e.id)})},e.id)),(0,G.jsxs)(`div`,{onClick:()=>d(!0),className:`border-2 border-dashed border-outline-variant/30 rounded-xl p-6 flex flex-col items-center justify-center text-center group cursor-pointer hover:border-primary/50 transition-all hover:bg-primary/5`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-low flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:(0,G.jsx)(A,{size:24,className:`text-primary`})}),(0,G.jsx)(`span`,{className:`text-sm font-bold font-headline text-on-surface-variant group-hover:text-on-surface`,children:`Deploy New Agent`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60 mt-1 max-w-[200px]`,children:`Expand your fleet with specialized intelligence units.`})]})]}),(0,G.jsx)(oe,{isOpen:c,onClose:()=>l(!1),onUpdated:b,agent:o},o?.id||`none`),(0,G.jsx)(le,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:b}),(0,G.jsx)(w,{isOpen:m,onClose:()=>h(!1),onConfirm:O,title:`Decommission Neural Node?`,message:`This will mark ${o?.name} as inactive. The agent will remain in the database but will no longer be available for automated tasks or direct neural connection.`,confirmText:`Decommission`,variant:`danger`})]})};export{ue as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{t as r}from"./file-text-CRyDRJx0.js";var i=n(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);e();var a=t(),o=({name:e,size:t,type:n,filePath:o})=>{let s=[`png`,`jpg`,`jpeg`,`svg`,`gif`].includes(n.toLowerCase()),c=(e=>e.startsWith(`http`)?e:e.startsWith(`uploads/`)?`/api/v1/${e}`:`/api/v1/uploads/artifacts/${e}`)(o);return(0,a.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-surface-container-highest/40 rounded-lg border border-outline-variant/10 group hover:border-primary/20 transition-all cursor-pointer`,onClick:()=>window.open(c,`_blank`),children:[(0,a.jsx)(`div`,{className:`h-10 w-10 rounded shadow-inner flex items-center justify-center overflow-hidden ${s?`bg-secondary/10 text-secondary`:`bg-primary/10 text-primary`}`,children:s?(0,a.jsx)(`img`,{src:c,alt:e,className:`h-full w-full object-cover`}):(0,a.jsx)(r,{size:20})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsx)(`p`,{className:`text-xs font-bold text-on-surface truncate`,children:e}),(0,a.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter`,children:t||`Artifact`})]}),(0,a.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,a.jsx)(`button`,{className:`p-1.5 hover:bg-surface-container-highest rounded text-on-surface-variant hover:text-primary transition-colors`,children:(0,a.jsx)(i,{size:14})})})]})};export{i as n,o as t};
1
+ import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{t as r}from"./file-text-D92QURK8.js";var i=n(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);e();var a=t(),o=({name:e,size:t,type:n,filePath:o})=>{let s=[`png`,`jpg`,`jpeg`,`svg`,`gif`].includes(n.toLowerCase()),c=(e=>e.startsWith(`http`)?e:e.startsWith(`uploads/`)?`/api/v1/${e}`:`/api/v1/uploads/artifacts/${e}`)(o);return(0,a.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-surface-container-highest/40 rounded-lg border border-outline-variant/10 group hover:border-primary/20 transition-all cursor-pointer`,onClick:()=>window.open(c,`_blank`),children:[(0,a.jsx)(`div`,{className:`h-10 w-10 rounded shadow-inner flex items-center justify-center overflow-hidden ${s?`bg-secondary/10 text-secondary`:`bg-primary/10 text-primary`}`,children:s?(0,a.jsx)(`img`,{src:c,alt:e,className:`h-full w-full object-cover`}):(0,a.jsx)(r,{size:20})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsx)(`p`,{className:`text-xs font-bold text-on-surface truncate`,children:e}),(0,a.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter`,children:t||`Artifact`})]}),(0,a.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,a.jsx)(`button`,{className:`p-1.5 hover:bg-surface-container-highest rounded text-on-surface-variant hover:text-primary transition-colors`,children:(0,a.jsx)(i,{size:14})})})]})};export{i as n,o as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{n as r,t as i}from"./x-CM5VLsbZ.js";import{n as a,t as o}from"./vendor-motion-CPra8At-.js";import{b as s}from"./index-UgPpBNRb.js";var c=n(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var l=t(),u=({isOpen:e,onClose:t,onConfirm:n,title:u,message:d,confirmText:f=`Confirm`,cancelText:p=`Cancel`,variant:m=`primary`,loading:h=!1,showCheckbox:g=!1,checkboxLabel:_=`Don't show this again`,onCheckboxChange:v})=>{let y={danger:{icon:c,iconBg:`bg-error/10`,iconColor:`text-error`,buttonBg:`bg-error hover:bg-error/90`,buttonText:`text-on-error`,ring:`ring-error/20`},primary:{icon:s,iconBg:`bg-primary/10`,iconColor:`text-primary`,buttonBg:`bg-primary hover:bg-primary/90`,buttonText:`text-on-primary`,ring:`ring-primary/20`},success:{icon:r,iconBg:`bg-secondary/10`,iconColor:`text-secondary`,buttonBg:`bg-secondary hover:bg-secondary/90`,buttonText:`text-surface`,ring:`ring-secondary/20`},warning:{icon:c,iconBg:`bg-tertiary/10`,iconColor:`text-tertiary`,buttonBg:`bg-tertiary hover:bg-tertiary/90`,buttonText:`text-surface`,ring:`ring-tertiary/20`}}[m],b=y.icon;return e?(0,l.jsx)(a,{children:(0,l.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,l.jsx)(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,l.jsxs)(o.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`relative w-full max-w-md bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden ring-1 ring-outline-variant/10 p-6 flex flex-col gap-6`,children:[(0,l.jsxs)(`div`,{className:`flex gap-4`,children:[(0,l.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex-shrink-0 flex items-center justify-center ${y.iconBg} ${y.iconColor}`,children:(0,l.jsx)(b,{size:24})}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`h3`,{className:`text-xl font-black font-headline text-white tracking-tight mb-2`,children:u}),(0,l.jsx)(`p`,{className:`text-sm text-on-surface-variant leading-relaxed`,children:d})]}),(0,l.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors h-fit p-1`,children:(0,l.jsx)(i,{size:20})})]}),g&&(0,l.jsx)(`div`,{className:`flex items-center gap-3 px-1 mt-[-12px]`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer group`,children:[(0,l.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,l.jsx)(`input`,{type:`checkbox`,onChange:e=>v?.(e.target.checked),className:`peer appearance-none w-5 h-5 rounded border border-outline-variant/30 bg-surface-container-highest checked:bg-primary checked:border-primary transition-all cursor-pointer`}),(0,l.jsx)(r,{size:14,className:`absolute inset-0 m-auto text-on-primary opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none`})]}),(0,l.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant group-hover:text-white transition-colors uppercase tracking-wider`,children:_})]})}),(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-2`,children:[(0,l.jsx)(`button`,{onClick:t,disabled:h,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all disabled:opacity-50`,children:p}),(0,l.jsx)(`button`,{onClick:n,disabled:h,className:`px-6 py-2.5 rounded-lg text-sm font-bold shadow-lg transition-all ${y.buttonBg} ${y.buttonText} ${y.ring} hover:scale-[1.02] active:scale-[0.98] disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed`,children:h?`Processing...`:f})]})]})]})}):null};export{u as t};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CxfOy4-Z.js";import{r}from"./vendor-markdown-Dl_1qnne.js";import{i,t as a}from"./client-CylGrWpP.js";import{t as o}from"./brain-DwFWAhZ9.js";import{t as s}from"./chevron-down-DOfOMDZp.js";import{t as c}from"./x-CM5VLsbZ.js";import{t as l}from"./clock-B13B5_wP.js";import{n as u,r as d,t as f}from"./MarkdownField-NTZbIxf_.js";import{t as p}from"./cpu-C3sglvsN.js";import{t as m}from"./rocket-D75KmVDG.js";import{n as h,t as g}from"./vendor-motion-CPra8At-.js";import{C as _,c as v,u as y,x as b}from"./index-UgPpBNRb.js";import{t as x}from"./tasks-CaT1ysud.js";var S=i(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),ee=i(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),C=i(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),w=i(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),T=i(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),E=i(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),D=i(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),O={ACTIVE:`active`,PAUSED:`paused`,ERROR:`error`},k={RUNNING:`running`,SUCCESS:`success`,FAILURE:`failure`,CANCELED:`canceled`},A={create:(e,t)=>a.post(`/projects/${e}/recurrent-tasks`,t),findAll:e=>a.get(`/projects/${e}/recurrent-tasks`),findOne:(e,t)=>a.get(`/projects/${e}/recurrent-tasks/${t}`),update:(e,t,n)=>a.patch(`/projects/${e}/recurrent-tasks/${t}`,n),delete:(e,t)=>a.delete(`/projects/${e}/recurrent-tasks/${t}`),findExecutions:(e,t,n=1,r=10)=>a.get(`/projects/${e}/recurrent-tasks/${t}/executions`,{params:{page:n,limit:r}})},j=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())})),M=e(n(),1),te=e(j(),1),N=r(),P=({projectId:e,isOpen:t,onClose:n,onSuccess:r,initialData:i})=>{let{notifyApiError:a,notifyError:C}=v(),[w,T]=(0,M.useState)(!1),[E,k]=(0,M.useState)([]),[j,P]=(0,M.useState)(!1),[F,I]=(0,M.useState)(!1),[L,R]=(0,M.useState)(``),[z,B]=(0,M.useState)(``),[V,H]=(0,M.useState)(``),[U,W]=(0,M.useState)(``),[G,K]=(0,M.useState)(x.MEDIUM),[q,J]=(0,M.useState)(null),[Y,X]=(0,M.useState)(!1),Z=(()=>{try{return te.default.toString(V)}catch{return null}})(),ne=[{label:`Every 10s`,value:`*/10 * * * * *`},{label:`Every 15m`,value:`*/15 * * * *`},{label:`Hourly`,value:`0 * * * *`},{label:`Daily (12AM)`,value:`0 0 * * *`},{label:`Weekly (Sun)`,value:`0 0 * * 0`},{label:`Monthly (1st)`,value:`0 0 1 * *`}];(0,M.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return t?(window.addEventListener(`keydown`,e),re(),i&&(R(i.title),B(i.description),H(i.cronExpression),W(i.assignee.id),K(Number(i.priority)))):(R(``),B(``),H(``),W(``),K(x.MEDIUM),J(null),X(!1)),()=>window.removeEventListener(`keydown`,e)},[t,i,n]);let re=async()=>{try{P(!0),k((await y.findAll()).data||[])}catch(e){console.error(`Failed to fetch agents:`,e)}finally{P(!1)}},Q=e=>{if(!e.trim())return J(`Cron expression is required`),!1;let t=e.trim().split(/\s+/);return t.length!==5&&t.length!==6?(J(`Invalid cron format (expected 5 or 6 fields)`),!1):(J(null),!0)},ie=async t=>{if(t.preventDefault(),!L||!z||!U||!V){let e=[];L||e.push(`title`),z||e.push(`description`),U||e.push(`assigneeId`),V||e.push(`cronExpression`),C(`Validation Error`,`Please fill in all required fields: ${e.join(`, `)}`);return}if(Q(V))try{T(!0),i?await A.update(e,i.id,{title:L,description:z,cronExpression:V,assigneeId:U,priority:G}):await A.create(e,{title:L,description:z,cronExpression:V,assigneeId:U,priority:G,status:O.ACTIVE}),r(),n()}catch(e){console.error(`Failed to save recurrent task:`,e),a(e,`Operation Failed`)}finally{T(!1)}},ae=e=>{switch(e){case x.CRITICAL:return`CRIT`;case x.HIGH:return`HIGH`;case x.MEDIUM:return`MED`;case x.LOW:return`LOW`;default:return`MED`}},$=E.find(e=>e.id===U);return t?(0,N.jsx)(h,{children:(0,N.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-background/60 backdrop-blur-md flex items-center justify-center p-4 overflow-y-auto`,children:(0,N.jsxs)(g.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`glass-panel w-full max-w-2xl rounded-xl overflow-hidden shadow-2xl glow-primary flex flex-col my-8`,"data-testid":`recurrent-task-modal`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`p-6 pb-0 flex justify-between items-start`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-2xl font-headline font-extrabold text-primary tracking-tight`,children:i?`Update Protocol`:`Deploy New Task`}),(0,N.jsx)(`p`,{className:`text-sm text-on-surface-variant mt-1`,children:i?`Modify the existing automated orchestration routine.`:`Configure an automated orchestration routine.`})]}),(0,N.jsx)(`button`,{onClick:n,className:`text-on-surface-variant hover:text-on-surface transition-colors p-1`,children:(0,N.jsx)(c,{size:24})})]}),(0,N.jsxs)(`form`,{onSubmit:ie,className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`p-8 space-y-8 overflow-y-auto max-h-[70vh] custom-scrollbar`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-tertiary`,children:[(0,N.jsx)(S,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Task Identity`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-on-surface-variant px-1`,children:`Task Name`}),(0,N.jsx)(`input`,{type:`text`,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 text-on-surface placeholder:text-outline-variant focus:ring-1 focus:ring-tertiary transition-all`,placeholder:`e.g., Daily Market Sweep`,value:L,onChange:e=>R(e.target.value)})]}),(0,N.jsx)(f,{label:`Description`,value:z,onChange:B,placeholder:`Briefly describe the objective of this task... You can use markdown for formatting.`,height:`h-32`,helperText:`Supports GitHub Flavored Markdown`})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,N.jsx)(_,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Agent Fleet`})]}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center bg-surface-container-lowest rounded-lg p-3 cursor-pointer hover:bg-surface-container-high transition-colors ring-1 ring-outline-variant/10 focus-within:ring-primary/40`,onClick:()=>I(!F),role:`combobox`,"aria-expanded":F,"data-testid":`agent-select`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-primary/20 flex items-center justify-center mr-3`,children:(0,N.jsx)(o,{size:16,className:`text-primary`})}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-on-surface`,children:$?$.name:`Select Intelligence Core`}),(0,N.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:$?$.role||`Active Agent`:`Choose an active agent for execution`})]}),(0,N.jsx)(s,{size:20,className:`text-outline transition-transform ${F?`rotate-180`:``}`})]}),(0,N.jsx)(h,{children:F&&(0,N.jsx)(g.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`absolute top-full left-0 w-full mt-2 bg-surface-container-highest rounded-lg shadow-xl p-2 z-50 border border-outline-variant/20 max-h-60 overflow-y-auto custom-scrollbar`,"data-testid":`agent-dropdown`,children:j?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant animate-pulse`,children:`Scanning fleet...`}):E.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant`,children:`No active agents found.`}):E.map(e=>(0,N.jsxs)(`div`,{className:`p-3 hover:bg-surface-container-low rounded cursor-pointer flex items-center gap-3 transition-colors group`,onClick:()=>{W(e.id),I(!1)},"data-testid":`agent-option-${e.id}`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-surface-container-high flex items-center justify-center group-hover:bg-primary/20 transition-colors`,children:(0,N.jsx)(p,{size:14,className:`text-secondary group-hover:text-primary`})}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-bold text-on-surface group-hover:text-primary transition-colors`,children:e.name}),(0,N.jsxs)(`div`,{className:`text-[10px] text-secondary`,children:[e.status||`Active`,` • `,e.role||`Core`]})]})]},e.id))})}),(0,N.jsxs)(`select`,{className:`sr-only`,value:U,onChange:e=>W(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:`Select Agent`}),E.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-secondary`,children:[(0,N.jsx)(l,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Scheduling Protocol`})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`relative flex items-center gap-2`,children:[(0,N.jsxs)(`div`,{className:`relative flex-1`,children:[(0,N.jsx)(`input`,{required:!0,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 font-mono text-sm text-secondary focus:ring-1 transition-all pr-10 ${q?`ring-1 ring-error`:`focus:ring-secondary`}`,type:`text`,value:V,onChange:e=>{H(e.target.value),q&&Q(e.target.value)},onBlur:e=>Q(e.target.value),placeholder:`e.g. 0 0 * * *`}),(0,N.jsx)(d,{size:16,className:`absolute right-3 top-3.5 text-outline-variant`})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>X(!Y),className:`p-3 rounded-lg border transition-all ${Y?`bg-secondary/20 border-secondary text-secondary shadow-[0_0_10px_rgba(78,222,163,0.2)]`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:text-secondary hover:border-secondary/30`}`,title:`Open Cron Wizard`,children:(0,N.jsx)(D,{size:18})})]}),(0,N.jsx)(h,{children:Y&&(0,N.jsx)(g.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`overflow-hidden bg-surface-container-highest/30 rounded-xl border border-secondary/10`,children:(0,N.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-secondary/60`,children:[(0,N.jsx)(u,{size:12}),`Temporal Presets`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ne.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{H(e.value),J(null)},className:`px-3 py-1.5 rounded-full text-[10px] font-bold border transition-all ${V===e.value?`bg-secondary text-on-secondary border-secondary shadow-lg shadow-secondary/20`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:border-secondary/40 hover:text-secondary`}`,children:e.label},e.value))})]})})}),Z&&!q&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-secondary font-medium bg-secondary/5 px-3 py-2 rounded-lg border border-secondary/10 animate-in fade-in slide-in-from-left-2`,children:[(0,N.jsx)(ee,{size:14,className:`shrink-0`}),(0,N.jsx)(`span`,{children:Z})]}),(0,N.jsx)(`div`,{className:`px-1 py-1`,children:(0,N.jsxs)(`p`,{className:`text-[9px] text-on-surface-variant/40 font-mono uppercase tracking-[0.1em] flex gap-2`,children:[(0,N.jsx)(`span`,{className:`text-secondary/60 opacity-60 font-black`,children:`[Sec]`}),(0,N.jsx)(`span`,{children:`Min`}),(0,N.jsx)(`span`,{children:`Hour`}),(0,N.jsx)(`span`,{children:`Dom`}),(0,N.jsx)(`span`,{children:`Mon`}),(0,N.jsx)(`span`,{children:`Dow`})]})}),q&&(0,N.jsxs)(`p`,{className:`text-[10px] text-error px-1 flex items-center gap-1.5 font-medium`,children:[(0,N.jsx)(b,{size:12}),q]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-error`,children:[(0,N.jsx)(b,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Execution Priority`})]}),(0,N.jsx)(`div`,{className:`flex bg-surface-container-lowest p-1 rounded-lg`,children:[x.LOW,x.MEDIUM,x.HIGH,x.CRITICAL].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>K(e),className:`flex-1 py-2 text-[10px] font-bold rounded transition-all ${Number(G)===Number(e)?e===x.CRITICAL?`bg-error/20 text-error`:`bg-surface-container-high text-primary`:`text-on-surface-variant hover:text-on-surface`}`,children:ae(e)},e))})]})]}),(0,N.jsxs)(`section`,{className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,N.jsx)(`h4`,{className:`text-xs font-bold font-headline text-on-surface-variant tracking-wide`,children:`Deployment Preview`}),(0,N.jsx)(`span`,{className:`text-[10px] bg-secondary-container/30 text-secondary px-2 py-0.5 rounded-full font-bold uppercase`,children:`System Cluster 0-A`})]}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 bg-surface-container-high/50 rounded-lg`,children:[(0,N.jsx)(`span`,{className:`text-on-surface font-medium italic`,children:`Logic integrity check passed`}),(0,N.jsx)(`span`,{className:`text-secondary font-bold`,children:`READY`})]}),(0,N.jsxs)(`div`,{className:`text-[10px] text-on-surface-variant leading-relaxed`,children:[`This task will be registered in the Alpha-Centauri cluster and executed by `,(0,N.jsx)(`span`,{className:`text-primary`,children:$?.name||`an assigned agent`}),` according to the provided temporal sequence.`]})]})]})]}),(0,N.jsxs)(`div`,{className:`p-6 bg-surface-container-low/50 flex justify-end items-center gap-4 sticky bottom-0 border-t border-outline-variant/10`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`px-6 py-2.5 text-sm font-bold text-on-surface-variant hover:text-on-surface transition-all active:scale-95`,children:`Cancel`}),(0,N.jsxs)(`button`,{type:`submit`,disabled:w,className:`px-8 py-2.5 text-sm font-bold bg-primary text-on-primary rounded-lg shadow-lg hover:shadow-primary/20 transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:[w?(0,N.jsx)(`div`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,N.jsx)(m,{size:16,className:`group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform`}),i?`Update Task`:`Create Task`]})]})]})]})})}):null};export{E as a,C as c,A as i,k as n,T as o,O as r,w as s,P as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{n,r,t as i}from"./vendor-markdown-Dl_1qnne.js";import{i as a}from"./client-CylGrWpP.js";import{t as o}from"./eye-CSLoB6-a.js";var s=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),c=a(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),l=e(t(),1),u=r(),d=({label:e,value:t,onChange:r=()=>{},placeholder:a,height:d=`h-40`,helperText:f,maxLength:p,onKeyDown:m,initialMode:h=`write`,readOnly:g=!1})=>{let[_,v]=(0,l.useState)(h);return g?(0,u.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||``})}):(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e&&(0,u.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:e}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface-container-high/50 p-1 rounded-lg ring-1 ring-outline-variant/10`,children:[(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`write`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`write`?`bg-primary text-surface shadow-lg shadow-primary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(s,{size:12}),`Write`]}),(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`preview`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`preview`?`bg-secondary text-surface shadow-lg shadow-secondary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(o,{size:12}),`Preview`]})]})]}),(0,u.jsx)(`div`,{className:`relative group bg-surface-container-highest/30 rounded-lg ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all ${d} overflow-hidden`,children:_===`write`?(0,u.jsx)(`textarea`,{value:t,onChange:e=>r(e.target.value),onKeyDown:m,placeholder:a,maxLength:p,className:`w-full h-full bg-transparent border-none text-xs text-on-surface p-4 focus:outline-none placeholder:text-on-surface-variant/30 resize-none leading-relaxed font-mono`}):(0,u.jsx)(`div`,{className:`w-full h-full p-4 overflow-y-auto custom-scrollbar prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||`*Nothing to preview*`})})}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[f?(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 py-0.5 rounded bg-tertiary/10 text-[9px] font-black text-tertiary tracking-widest uppercase w-fit`,children:[(0,u.jsx)(c,{size:10}),f]}):(0,u.jsx)(`div`,{}),p!=null&&p>0?(0,u.jsxs)(`div`,{className:`text-[10px] font-bold text-on-surface-variant/40 lowercase tracking-widest`,children:[t.length,` / `,p]}):null]})]})};export{c as n,s as r,d as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{n,r,t as i}from"./vendor-markdown-Dl_1qnne.js";import{i as a}from"./client-CylGrWpP.js";import{t as o}from"./eye-C7PLqIzx.js";var s=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),c=a(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),l=e(t(),1),u=r(),d=({label:e,value:t,onChange:r=()=>{},placeholder:a,height:d=`h-40`,helperText:f,maxLength:p,onKeyDown:m,initialMode:h=`write`,readOnly:g=!1})=>{let[_,v]=(0,l.useState)(h);return g?(0,u.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||``})}):(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e&&(0,u.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:e}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface-container-high/50 p-1 rounded-lg ring-1 ring-outline-variant/10`,children:[(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`write`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`write`?`bg-primary text-surface shadow-lg shadow-primary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(s,{size:12}),`Write`]}),(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`preview`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`preview`?`bg-secondary text-surface shadow-lg shadow-secondary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(o,{size:12}),`Preview`]})]})]}),(0,u.jsx)(`div`,{className:`relative group bg-surface-container-highest/30 rounded-lg ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all ${d} overflow-hidden`,children:_===`write`?(0,u.jsx)(`textarea`,{value:t,onChange:e=>r(e.target.value),onKeyDown:m,placeholder:a,maxLength:p,className:`w-full h-full bg-transparent border-none text-xs text-on-surface p-4 focus:outline-none placeholder:text-on-surface-variant/30 resize-none leading-relaxed font-mono`}):(0,u.jsx)(`div`,{className:`w-full h-full p-4 overflow-y-auto custom-scrollbar prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||`*Nothing to preview*`})})}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[f?(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 py-0.5 rounded bg-tertiary/10 text-[9px] font-black text-tertiary tracking-widest uppercase w-fit`,children:[(0,u.jsx)(c,{size:10}),f]}):(0,u.jsx)(`div`,{}),p!=null&&p>0?(0,u.jsxs)(`div`,{className:`text-[10px] font-bold text-on-surface-variant/40 lowercase tracking-widest`,children:[t.length,` / `,p]}):null]})]})};export{c as n,s as r,d as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{n}from"./vendor-react-CiDbU5Ns.js";import{r}from"./vendor-markdown-Dl_1qnne.js";import{i}from"./client-CylGrWpP.js";import{t as a}from"./box-3f35ZKNV.js";import{t as o}from"./check-BhOeS9mA.js";import{t as s}from"./chevron-down-DOfOMDZp.js";import{n as c,t as l}from"./x-CM5VLsbZ.js";import{n as u,t as ee}from"./user-plus-5rm15Rqq.js";import{t as d}from"./eye-C7PLqIzx.js";import{n as f,t as te}from"./users-KvCcsozL.js";import{t as ne}from"./rocket-D75KmVDG.js";import{t as re}from"./save-BJqQo16R.js";import{t as p}from"./shield-check-5104WjFF.js";import{t as ie}from"./user-DpMk7aqI.js";import"./vendor-motion-CPra8At-.js";import{a as ae,d as oe,f as se,i as m,m as ce,n as h,o as le,p as ue,r as de,s as fe}from"./index-UgPpBNRb.js";var g=i(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),pe=i(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),_=e(t(),1),v=r(),me=({isOpen:e,selectedAvatar:t,currentAvatar:n,isSaving:r,onSelect:i,onClose:a,onConfirm:s})=>((0,_.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 py-8 backdrop-blur-sm`,children:[(0,v.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,v.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-picker-title`,className:`relative w-full max-w-2xl rounded-3xl border border-outline-variant/20 bg-surface p-6 shadow-[0_28px_80px_rgba(0,0,0,0.45)]`,children:[(0,v.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`p`,{className:`mb-2 text-[11px] font-bold uppercase tracking-[0.3em] text-primary/80`,children:`Avatar presets`}),(0,v.jsx)(`h2`,{id:`avatar-picker-title`,className:`font-headline text-2xl font-bold text-on-surface`,children:`Choose your avatar`}),(0,v.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Pick one of the built-in presets. Your choice updates everywhere your profile picture is shown.`})]}),(0,v.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close avatar picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,v.jsx)(l,{size:18})})]}),(0,v.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:m.map(e=>{let r=e.key===t,a=e.key===n;return(0,v.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`group relative rounded-2xl border p-3 text-left transition-all ${r?`border-primary bg-primary/10 shadow-[0_0_0_1px_rgba(173,198,255,0.25)]`:`border-outline-variant/20 bg-surface-container-low hover:border-primary/40 hover:bg-surface-container-high`}`,children:[(0,v.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-container-high`,children:(0,v.jsx)(`img`,{src:e.src,alt:e.label,className:`aspect-square w-full object-cover`})}),(0,v.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,v.jsx)(`span`,{className:`text-sm font-semibold text-on-surface`,children:e.label}),r?(0,v.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,v.jsx)(o,{size:14})}):null]}),(0,v.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:a?`Current avatar`:`Available preset`})]},e.key)})}),(0,v.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,v.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,v.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save avatar`]})]})]})]}):null);function y({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,suffix:c,autoComplete:l,error:u}){return(0,v.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,v.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,v.jsxs)(`div`,{className:`relative`,children:[(0,v.jsx)(`input`,{id:t,type:n,value:r,autoComplete:l,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${u?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,v.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),u&&(0,v.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:u})]})}function b({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,_.useState)(!1);return(0,v.jsx)(y,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,v.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,v.jsx)(u,{size:16}):(0,v.jsx)(d,{size:16})})})}function he({projectId:e,title:t,description:r,status:i,icon:a,iconColor:o}){return(0,v.jsxs)(n,{to:`/projects/${e}`,className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10 hover:bg-surface-container-high transition-colors cursor-pointer ${i===`archived`?`opacity-70`:``}`,children:[(0,v.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,v.jsx)(`div`,{className:`p-2 rounded-lg ${o}`,children:a}),(0,v.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded uppercase font-bold tracking-tight ${i===`active`?`bg-secondary/10 text-secondary border border-secondary/20`:`bg-surface-container-highest text-on-surface-variant`}`,children:i.replace(`_`,` `)})]}),(0,v.jsx)(`h3`,{className:`font-headline font-bold text-on-surface text-sm`,children:t}),(0,v.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-1 leading-relaxed`,children:r})]})}var x=()=>{let{user:e,refreshUser:t}=ue(),{projects:n,refreshProjects:r}=ce(),i=e?.role===`admin`,o=n.some(e=>e.status===oe.ACTIVE),u=i&&!o,d=i?`Only one active project is allowed at a time. Move the active project out of active status before creating a new one.`:`Only admins can create projects.`,[m,x]=(0,_.useState)(``),[S,C]=(0,_.useState)(``),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(`user`),[O,k]=(0,_.useState)(``),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)({}),[ge,P]=(0,_.useState)({}),[_e,ve]=(0,_.useState)(!1),[F,I]=(0,_.useState)(!1),[ye,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(``),[be,B]=(0,_.useState)(!1),[V,H]=(0,_.useState)(``),[U,W]=(0,_.useState)(!1),[xe,G]=(0,_.useState)(!1),[Se,K]=(0,_.useState)(!1),[Ce,q]=(0,_.useState)(!1),[J,Y]=(0,_.useState)(``),[we,Te]=(0,_.useState)(!1),[Ee,X]=(0,_.useState)(ae),De=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Oe=()=>{let e={};return m.trim()?m.length>100&&(e.name=`Maximum 100 characters.`):e.name=`First name is required.`,S.trim()?S.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,w.trim()?De.test(w)?w.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email address.`:e.email=`Email is required.`,e},ke=()=>{let e={};return O?O.length<8?e.newPwd=`Minimum 8 characters.`:O.length>72&&(e.newPwd=`Maximum 72 characters.`):e.newPwd=`New password is required.`,A?O!==A&&(e.confirmPwd=`Passwords do not match.`):e.confirmPwd=`Please confirm the new password.`,e},Z=e=>le(e)?e:ae;(0,_.useEffect)(()=>{e&&(x(e.name??``),C(e.lastName??``),T(e.email??``),D(e.role??`user`),X(Z(e.avatar)))},[e]);let Ae=async()=>{let n=Oe();if(Object.keys(n).length>0){N(n);return}N({}),ve(!0),z(``),L(!1);try{let n={};m!==(e?.name??``)&&(n.name=m),S!==(e?.lastName??``)&&(n.lastName=S),w!==(e?.email??``)&&(n.email=w);let r=[];Object.keys(n).length>0&&r.push(h.updateProfile(n)),i&&e?.id&&E!==e?.role&&r.push(te.updateRole(e.id,E)),r.length>0&&(await Promise.all(r),await t()),L(!0),setTimeout(()=>L(!1),3e3)}catch(e){z(e instanceof Error?e.message:`Failed to save changes`)}finally{ve(!1)}},je=async()=>{let e=ke();if(Object.keys(e).length>0){P(e);return}P({}),H(``),B(!1),I(!0);try{await h.updateProfile({newPassword:O}),k(``),j(``),B(!0),setTimeout(()=>B(!1),4e3)}catch(e){H(e instanceof Error?e.message:`Failed to update password`)}finally{I(!1)}},Me=async()=>{if(!(!J||!e?.id)){Te(!0);try{await se.addMember(J,e.id),await r(),K(!1),Y(``)}catch(e){console.error(`Failed to assign project:`,e)}finally{Te(!1)}}},Ne=async()=>{z(``),L(!1),W(!0);try{await h.updateProfile({avatar:Ee}),await t(),q(!1),L(!0),setTimeout(()=>L(!1),3e3)}catch(e){z(e instanceof Error?e.message:`Failed to update avatar`)}finally{W(!1)}},Q=e?`${e.name??``} ${e.lastName??``}`.trim():`Agent`,$=e?.role??`user`,Pe=$.charAt(0).toUpperCase()+$.slice(1);return(0,v.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,v.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,v.jsxs)(`div`,{className:`relative group flex-shrink-0`,children:[(0,v.jsx)(`div`,{className:`absolute -inset-1 bg-gradient-to-tr from-primary to-tertiary rounded-full blur opacity-20 group-hover:opacity-40 transition duration-700`}),(0,v.jsx)(de,{name:Q,avatar:e?.avatar,avatarUrl:e?.avatarUrl,alt:Q,className:`relative h-28 w-28 overflow-hidden rounded-full ring-4 ring-surface sm:h-32 sm:w-32`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>{X(Z(e?.avatar)),q(!0)},title:`Change avatar`,className:`absolute bottom-1 right-1 bg-primary text-on-primary p-1.5 rounded-full shadow-lg hover:scale-110 active:scale-95 transition-transform`,children:(0,v.jsx)(pe,{size:14})})]}),(0,v.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,v.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Q}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,v.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest shadow-[0_0_12px_rgba(78,222,163,0.1)]`,children:Pe}),(0,v.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:e?.email})]})]}),(0,v.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,v.jsx)(`button`,{id:`profile-cancel-btn`,onClick:()=>{x(e?.name??``),C(e?.lastName??``),T(e?.email??``),D(e?.role??`user`),z(``),N({})},className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm`,children:(0,v.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(l,{size:15}),` Cancel`]})}),(0,v.jsxs)(`button`,{id:`profile-save-btn`,onClick:Ae,disabled:_e,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.15)] text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[_e?(0,v.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,v.jsx)(re,{size:15}),`Save Changes`]})]})]}),ye&&(0,v.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,v.jsx)(c,{size:16}),` Profile updated successfully.`]}),R&&(0,v.jsx)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium`,children:R}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,v.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,v.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,v.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,v.jsx)(ie,{size:18})}),(0,v.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Personal Information`})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-5`,children:[(0,v.jsx)(y,{label:`First Name`,id:`profile-first-name`,value:m,onChange:x,placeholder:`Your first name`,error:M.name}),(0,v.jsx)(y,{label:`Last Name`,id:`profile-last-name`,value:S,onChange:C,placeholder:`Your last name`,error:M.lastName}),(0,v.jsx)(y,{label:`Email Address`,id:`profile-email`,type:`email`,value:w,onChange:T,placeholder:`your@email.com`,className:`sm:col-span-2`,error:M.email})]})]}),(0,v.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,v.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,v.jsx)(p,{size:18})}),(0,v.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Role & Clearance`})]}),(0,v.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-5`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 flex-1`,children:[(0,v.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-widest shadow-[0_0_15px_rgba(78,222,163,0.1)] flex-shrink-0`,children:Pe}),(0,v.jsx)(`p`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:$===`admin`?`Full orchestration privileges across all projects.`:`Standard access for task execution and project participation.`})]}),i&&(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:w-48 flex-shrink-0`,children:[(0,v.jsx)(`label`,{htmlFor:`profile-role-select`,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Update Role`}),(0,v.jsxs)(`div`,{className:`relative`,children:[(0,v.jsxs)(`select`,{id:`profile-role-select`,value:E,onChange:e=>D(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all appearance-none cursor-pointer`,children:[(0,v.jsx)(`option`,{value:`admin`,children:`Admin`}),(0,v.jsx)(`option`,{value:`user`,children:`Member`})]}),(0,v.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]})]})]})]}),(0,v.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,v.jsxs)(`div`,{className:`flex justify-between items-center mb-7`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,v.jsx)(f,{size:18})}),(0,v.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Project Assignments`})]}),i&&(0,v.jsxs)(`button`,{onClick:()=>u&&G(!0),disabled:!u,title:u?void 0:d,className:`text-xs font-bold text-primary flex items-center gap-1 hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:[(0,v.jsx)(g,{size:14}),` Create Project`]})]}),i&&o&&(0,v.jsx)(`p`,{className:`mb-5 text-xs text-on-surface-variant`,children:d}),i&&n.length>0&&(0,v.jsx)(`div`,{className:`mb-5`,children:Se?(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsxs)(`div`,{className:`relative flex-1`,children:[(0,v.jsxs)(`select`,{id:`profile-assign-project-select`,value:J,onChange:e=>Y(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 appearance-none`,children:[(0,v.jsx)(`option`,{value:``,children:`Select a project…`}),n.map(e=>(0,v.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,v.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}),(0,v.jsx)(`button`,{onClick:Me,disabled:!J||we,className:`px-4 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary disabled:opacity-50 hover:brightness-110 transition-all`,children:we?`…`:`Assign`}),(0,v.jsx)(`button`,{onClick:()=>{K(!1),Y(``)},className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:(0,v.jsx)(l,{size:14})})]}):(0,v.jsxs)(`button`,{onClick:()=>K(!0),className:`text-xs font-bold text-on-surface-variant flex items-center gap-1.5 hover:text-primary transition-colors`,children:[(0,v.jsx)(ee,{size:14}),` Assign to Project`]})}),n&&n.length>0?(0,v.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[n.slice(0,4).map((e,t)=>(0,v.jsx)(he,{projectId:e.id,title:e.title,description:e.description??`No description provided.`,status:e.status,icon:t===0?(0,v.jsx)(ne,{size:18}):t===1?(0,v.jsx)(f,{size:18}):(0,v.jsx)(a,{size:18}),iconColor:t===0?`bg-primary/10 text-primary`:t===1?`bg-tertiary/10 text-tertiary`:`bg-on-surface-variant/10 text-on-surface-variant`},e.id)),i&&u&&(0,v.jsxs)(`div`,{onClick:()=>G(!0),role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&G(!0),className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all cursor-pointer min-h-[140px]`,children:[(0,v.jsx)(g,{size:24,className:`text-primary/40`}),(0,v.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:`New Project`})]})]}):(0,v.jsxs)(`div`,{onClick:u?()=>G(!0):void 0,role:u?`button`:void 0,tabIndex:u?0:void 0,onKeyDown:u?e=>e.key===`Enter`&&G(!0):void 0,className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all min-h-[140px] ${u?`cursor-pointer`:`cursor-default opacity-60`}`,children:[(0,v.jsx)(g,{size:24,className:`text-primary/40`}),(0,v.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:u?`Create First Project`:i?`Active Project Exists`:`No Projects Assigned`})]})]})]}),(0,v.jsx)(`div`,{className:`lg:col-span-4 flex flex-col gap-6`,children:(0,v.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,v.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,v.jsx)(p,{size:18})}),(0,v.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Security`})]}),be&&(0,v.jsxs)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-xs font-medium flex items-center gap-2`,children:[(0,v.jsx)(c,{size:14}),` Password updated successfully.`]}),V&&(0,v.jsx)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-error/10 border border-error/30 text-error text-xs`,children:V}),(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(b,{label:`New Password`,id:`profile-new-pwd`,value:O,onChange:k,placeholder:`Min. 8 characters`,error:ge.newPwd}),(0,v.jsx)(b,{label:`Confirm New Password`,id:`profile-confirm-pwd`,value:A,onChange:j,placeholder:`Repeat new password`,error:ge.confirmPwd}),(0,v.jsxs)(`button`,{id:`profile-update-creds-btn`,onClick:je,disabled:F,className:`w-full py-2.5 rounded-lg text-sm font-bold bg-tertiary/10 text-tertiary border border-tertiary/20 hover:bg-tertiary hover:text-on-tertiary transition-all disabled:opacity-60 flex items-center justify-center gap-2`,children:[F?(0,v.jsx)(`span`,{className:`w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin`}):null,`Update Credentials`]})]})]})})]}),(0,v.jsx)(fe,{isOpen:xe,onClose:()=>G(!1),onCreated:async()=>{await r(),G(!1)},canCreate:u,blockedReason:d}),(0,v.jsx)(me,{isOpen:Ce,selectedAvatar:Ee,currentAvatar:Z(e?.avatar),isSaving:U,onSelect:X,onClose:()=>{U||(q(!1),X(Z(e?.avatar)))},onConfirm:Ne})]})};export{x as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{c as n,s as r}from"./vendor-react-CiDbU5Ns.js";import{r as i}from"./vendor-markdown-Dl_1qnne.js";import{i as a}from"./client-CylGrWpP.js";import{t as o}from"./chevron-down-DOfOMDZp.js";import{n as s,t as c}from"./MarkdownField-DJ12Ejut.js";import{t as l}from"./layers-CpiP5U5p.js";import{t as u}from"./save-zLR2Bpx5.js";import{t as d}from"./shield-check-CdGbbgI2.js";import{t as f}from"./trash-2-BWnYC9Ad.js";import{t as p}from"./user-DpMk7aqI.js";import{c as m,d as h,f as g,m as _,u as v,w as y}from"./index-4X4zupUS.js";var b=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),x=e(t(),1),S=i(),C=()=>{let{projectId:e}=n(),t=r(),{notifySuccess:i,notifyApiError:a}=m(),{projects:C,refreshProjects:w}=_(),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)([]),[k,A]=(0,x.useState)(!0),[j,M]=(0,x.useState)(!1),N=C.some(t=>t.status===h.ACTIVE&&t.id!==e),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[R,z]=(0,x.useState)(h.PLANNING),[B,V]=(0,x.useState)(``),H=(0,x.useCallback)(async()=>{try{A(!0);let[t,n]=await Promise.all([g.findOne(e),v.findAll()]),r=t.data;E(r),O(n.data),F(r.title),L(r.description||``),z(r.status||h.PLANNING),V(r.ownerAgent?.id||``)}catch(e){console.error(`Failed to load project details:`,e),a(e,`Fetch Error`)}finally{A(!1)}},[e,a]);return(0,x.useEffect)(()=>{e&&H()},[e,H]),k?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[50vh]`,children:(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border border-outline-variant/30 border-t-primary animate-spin`})}):T?(0,S.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-6`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`w-12 h-12 rounded-2xl bg-surface-container-high border border-outline-variant/10 flex items-center justify-center text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all group`,children:(0,S.jsx)(b,{size:20,className:`group-hover:-translate-x-1 transition-transform`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,S.jsx)(`div`,{className:`w-6 h-6 rounded-lg bg-secondary/20 flex items-center justify-center text-secondary`,children:(0,S.jsx)(y,{size:12})}),(0,S.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant`,children:`Project Console`})]}),(0,S.jsx)(`h1`,{className:`text-3xl font-black font-headline text-white tracking-tight -mt-1`,children:T.title})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 w-full md:w-auto`,children:[(0,S.jsxs)(`button`,{className:`flex-1 md:flex-initial px-6 py-3 rounded-2xl bg-surface-container-high text-on-article-variant font-bold text-sm flex items-center justify-center gap-2 hover:bg-error/10 hover:text-error transition-all ring-1 ring-outline-variant/10 border-none`,children:[(0,S.jsx)(f,{size:18}),`Delete Project`]}),(0,S.jsxs)(`button`,{onClick:async()=>{if(e)try{M(!0),await g.update(e,{title:P,description:I||void 0,status:R,ownerAgentId:B||null}),await w(),i(`Project Updated`,`Project settings have been updated`)}catch(e){console.error(`Failed to update project:`,e),a(e,`Sync Error`)}finally{M(!1)}},disabled:j,className:`flex-1 md:flex-initial px-8 py-3 rounded-2xl bg-primary text-surface font-black text-sm flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-primary/20 disabled:grayscale disabled:opacity-50`,children:[j?(0,S.jsx)(`div`,{className:`w-5 h-5 border-2 border-surface/30 border-t-surface rounded-full animate-spin`}):(0,S.jsx)(u,{size:18}),`Synchronize Parameters`]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,S.jsx)(`div`,{className:`lg:col-span-2 space-y-8`,children:(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 overflow-hidden shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/5 flex items-center gap-3`,children:[(0,S.jsx)(l,{size:18,className:`text-primary`}),(0,S.jsx)(`h3`,{className:`text-sm font-black uppercase tracking-widest text-on-surface`,children:`Project Settings`})]}),(0,S.jsxs)(`div`,{className:`p-8 space-y-8`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 italic`,children:`Identification Tag`}),(0,S.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,S.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-transparent border-none text-base text-on-surface h-14 px-5 focus:outline-none font-bold`})})]}),(0,S.jsx)(`div`,{className:`space-y-2`,children:(0,S.jsx)(c,{label:`Operational Directives`,value:I,onChange:L,height:`h-64`,maxLength:5e3,placeholder:`Enter strategic goals, scope, and specific node instructions...`})})]})]})}),(0,S.jsxs)(`div`,{className:`space-y-8`,children:[(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 p-8 space-y-6 shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(d,{size:14,className:`text-secondary`}),`Operational Protocol`]}),(0,S.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:Object.values(h).map(e=>(0,S.jsx)(`button`,{onClick:()=>z(e),disabled:e===h.ACTIVE&&N&&R!==h.ACTIVE,className:`px-4 py-3 rounded-xl border text-[11px] font-black uppercase tracking-widest transition-all text-left ${R===e?`bg-secondary/10 border-secondary text-secondary shadow-lg shadow-secondary/5`:`bg-surface-container-high/30 border-outline-variant/5 text-on-surface-variant/60 hover:bg-surface-container-high/60 disabled:opacity-50 disabled:cursor-not-allowed`}`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.replace(`_`,` `),R===e&&(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary animate-pulse`})]})},e))}),N&&R!==h.ACTIVE&&(0,S.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:`Another project is already active. Move it out of active status before activating this one.`})]}),(0,S.jsxs)(`div`,{className:`pt-6 border-t border-outline-variant/5 space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(p,{size:14,className:`text-primary`}),`Designated Project Lead`]}),(0,S.jsxs)(`div`,{className:`bg-surface-container-high/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 transition-all relative`,children:[(0,S.jsxs)(`select`,{value:B,onChange:e=>V(e.target.value),className:`w-full bg-transparent border-none text-[11px] font-bold text-on-surface h-12 px-5 focus:outline-none appearance-none cursor-pointer`,children:[(0,S.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`Unassigned Protocol Lead`}),D.map(e=>(0,S.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface font-bold uppercase tracking-tight`,children:e.name},e.id))]}),(0,S.jsx)(`div`,{className:`absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,S.jsx)(o,{size:14})})]}),(0,S.jsx)(`p`,{className:`px-1 text-[11px] text-on-surface-variant/70 italic leading-relaxed`,children:`*The Project Lead will oversee autonomous reasoning and token allocation for this project.`})]})]}),(0,S.jsxs)(`div`,{className:`px-8 py-10 rounded-3xl bg-surface-container-low/30 border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-center`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant/20 mb-4 animate-pulse`,children:(0,S.jsx)(s,{size:24})}),(0,S.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 max-w-[180px]`,children:`Statistical insight logs will be synchronized here`})]})]})]})]}):(0,S.jsxs)(`div`,{className:`p-8 text-center bg-surface-container-low rounded-3xl border border-outline-variant/10 max-w-lg mx-auto mt-20`,children:[(0,S.jsx)(`h2`,{className:`text-xl font-black text-white mb-4`,children:`Project Not Found`}),(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`bg-primary text-surface px-6 py-2 rounded-lg font-bold hover:scale-105 transition-all`,children:`Return to Hub`})]})};export{C as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{c as n,s as r}from"./vendor-react-CiDbU5Ns.js";import{r as i}from"./vendor-markdown-Dl_1qnne.js";import{i as a}from"./client-CylGrWpP.js";import{t as o}from"./chevron-down-DOfOMDZp.js";import{n as s,t as c}from"./MarkdownField-NTZbIxf_.js";import{t as l}from"./layers-CNTE6Cl4.js";import{t as u}from"./save-BJqQo16R.js";import{t as d}from"./shield-check-5104WjFF.js";import{t as f}from"./trash-2-BlARVDmE.js";import{t as p}from"./user-DpMk7aqI.js";import{S as m,c as h,d as g,f as _,m as v,u as y}from"./index-UgPpBNRb.js";var b=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),x=e(t(),1),S=i(),C=()=>{let{projectId:e}=n(),t=r(),{notifySuccess:i,notifyApiError:a}=h(),{projects:C,refreshProjects:w}=v(),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)([]),[k,A]=(0,x.useState)(!0),[j,M]=(0,x.useState)(!1),N=C.some(t=>t.status===g.ACTIVE&&t.id!==e),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[R,z]=(0,x.useState)(g.PLANNING),[B,V]=(0,x.useState)(``),H=(0,x.useCallback)(async()=>{try{A(!0);let[t,n]=await Promise.all([_.findOne(e),y.findAll()]),r=t.data;E(r),O(n.data),F(r.title),L(r.description||``),z(r.status||g.PLANNING),V(r.ownerAgent?.id||``)}catch(e){console.error(`Failed to load project details:`,e),a(e,`Fetch Error`)}finally{A(!1)}},[e,a]);return(0,x.useEffect)(()=>{e&&H()},[e,H]),k?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[50vh]`,children:(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border border-outline-variant/30 border-t-primary animate-spin`})}):T?(0,S.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-6`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`w-12 h-12 rounded-2xl bg-surface-container-high border border-outline-variant/10 flex items-center justify-center text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all group`,children:(0,S.jsx)(b,{size:20,className:`group-hover:-translate-x-1 transition-transform`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,S.jsx)(`div`,{className:`w-6 h-6 rounded-lg bg-secondary/20 flex items-center justify-center text-secondary`,children:(0,S.jsx)(m,{size:12})}),(0,S.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant`,children:`Project Console`})]}),(0,S.jsx)(`h1`,{className:`text-3xl font-black font-headline text-white tracking-tight -mt-1`,children:T.title})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 w-full md:w-auto`,children:[(0,S.jsxs)(`button`,{className:`flex-1 md:flex-initial px-6 py-3 rounded-2xl bg-surface-container-high text-on-article-variant font-bold text-sm flex items-center justify-center gap-2 hover:bg-error/10 hover:text-error transition-all ring-1 ring-outline-variant/10 border-none`,children:[(0,S.jsx)(f,{size:18}),`Delete Project`]}),(0,S.jsxs)(`button`,{onClick:async()=>{if(e)try{M(!0),await _.update(e,{title:P,description:I||void 0,status:R,ownerAgentId:B||null}),await w(),i(`Project Updated`,`Project settings have been updated`)}catch(e){console.error(`Failed to update project:`,e),a(e,`Sync Error`)}finally{M(!1)}},disabled:j,className:`flex-1 md:flex-initial px-8 py-3 rounded-2xl bg-primary text-surface font-black text-sm flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-primary/20 disabled:grayscale disabled:opacity-50`,children:[j?(0,S.jsx)(`div`,{className:`w-5 h-5 border-2 border-surface/30 border-t-surface rounded-full animate-spin`}):(0,S.jsx)(u,{size:18}),`Synchronize Parameters`]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,S.jsx)(`div`,{className:`lg:col-span-2 space-y-8`,children:(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 overflow-hidden shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/5 flex items-center gap-3`,children:[(0,S.jsx)(l,{size:18,className:`text-primary`}),(0,S.jsx)(`h3`,{className:`text-sm font-black uppercase tracking-widest text-on-surface`,children:`Project Settings`})]}),(0,S.jsxs)(`div`,{className:`p-8 space-y-8`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 italic`,children:`Identification Tag`}),(0,S.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,S.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-transparent border-none text-base text-on-surface h-14 px-5 focus:outline-none font-bold`})})]}),(0,S.jsx)(`div`,{className:`space-y-2`,children:(0,S.jsx)(c,{label:`Operational Directives`,value:I,onChange:L,height:`h-64`,maxLength:5e3,placeholder:`Enter strategic goals, scope, and specific node instructions...`})})]})]})}),(0,S.jsxs)(`div`,{className:`space-y-8`,children:[(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 p-8 space-y-6 shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(d,{size:14,className:`text-secondary`}),`Operational Protocol`]}),(0,S.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:Object.values(g).map(e=>(0,S.jsx)(`button`,{onClick:()=>z(e),disabled:e===g.ACTIVE&&N&&R!==g.ACTIVE,className:`px-4 py-3 rounded-xl border text-[11px] font-black uppercase tracking-widest transition-all text-left ${R===e?`bg-secondary/10 border-secondary text-secondary shadow-lg shadow-secondary/5`:`bg-surface-container-high/30 border-outline-variant/5 text-on-surface-variant/60 hover:bg-surface-container-high/60 disabled:opacity-50 disabled:cursor-not-allowed`}`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.replace(`_`,` `),R===e&&(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary animate-pulse`})]})},e))}),N&&R!==g.ACTIVE&&(0,S.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:`Another project is already active. Move it out of active status before activating this one.`})]}),(0,S.jsxs)(`div`,{className:`pt-6 border-t border-outline-variant/5 space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(p,{size:14,className:`text-primary`}),`Designated Project Lead`]}),(0,S.jsxs)(`div`,{className:`bg-surface-container-high/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 transition-all relative`,children:[(0,S.jsxs)(`select`,{value:B,onChange:e=>V(e.target.value),className:`w-full bg-transparent border-none text-[11px] font-bold text-on-surface h-12 px-5 focus:outline-none appearance-none cursor-pointer`,children:[(0,S.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`Unassigned Protocol Lead`}),D.map(e=>(0,S.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface font-bold uppercase tracking-tight`,children:e.name},e.id))]}),(0,S.jsx)(`div`,{className:`absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,S.jsx)(o,{size:14})})]}),(0,S.jsx)(`p`,{className:`px-1 text-[11px] text-on-surface-variant/70 italic leading-relaxed`,children:`*The Project Lead will oversee autonomous reasoning and token allocation for this project.`})]})]}),(0,S.jsxs)(`div`,{className:`px-8 py-10 rounded-3xl bg-surface-container-low/30 border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-center`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant/20 mb-4 animate-pulse`,children:(0,S.jsx)(s,{size:24})}),(0,S.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 max-w-[180px]`,children:`Statistical insight logs will be synchronized here`})]})]})]})]}):(0,S.jsxs)(`div`,{className:`p-8 text-center bg-surface-container-low rounded-3xl border border-outline-variant/10 max-w-lg mx-auto mt-20`,children:[(0,S.jsx)(`h2`,{className:`text-xl font-black text-white mb-4`,children:`Project Not Found`}),(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`bg-primary text-surface px-6 py-2 rounded-lg font-bold hover:scale-105 transition-all`,children:`Return to Hub`})]})};export{C as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{i as n,n as r,t as i}from"./vendor-query-BMPnNmZi.js";import{r as a}from"./vendor-markdown-Dl_1qnne.js";import{i as o}from"./client-CylGrWpP.js";import{t as s}from"./box-3f35ZKNV.js";import{t as c}from"./chevron-right-KmgHEojr.js";import{t as l}from"./x-CM5VLsbZ.js";import{t as u}from"./clock-B13B5_wP.js";import{t as d}from"./cpu-C3sglvsN.js";import{t as f}from"./database-DC2jO6Si.js";import{n as p,r as m,t as h}from"./providers-W8KP5fBt.js";import{t as g}from"./rocket-D75KmVDG.js";import{t as _}from"./trash-2-BlARVDmE.js";import{t as v}from"./ConfirmDialog-0ML5KiMx.js";import{t as y}from"./zap-BI5M4WZX.js";import{n as b,t as x}from"./vendor-motion-CPra8At-.js";import{_ as S,b as C,c as w,v as T}from"./index-UgPpBNRb.js";import{t as E}from"./cn-DjbzjBLV.js";var D=o(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),O=o(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),k=e(t(),1),A={all:[`providers`],models:e=>[`providers`,e,`models`]},j=()=>r({queryKey:A.all,queryFn:async()=>(await h.findAll()).data}),M=e=>r({queryKey:e?A.models(e):[`providers`,`unselected`,`models`],queryFn:async()=>{if(!e)return[];let t=await h.findModels(e);return Array.isArray(t.data)?t.data:[]},enabled:!!e}),N=e=>{let t=n(),{notifyApiError:r}=w();return i({mutationFn:async({providerName:e,models:t})=>{let n=(await h.create({name:e.trim()})).data,r=t.map(e=>e.trim()).filter(Boolean);return r.length>0&&await Promise.all(r.map(e=>p.create({name:e,providerId:n.id}))),n},onSuccess:async n=>{await Promise.all([t.invalidateQueries({queryKey:A.all}),t.invalidateQueries({queryKey:A.models(n.id)})]),e?.onSuccess?.(n)},onError:e=>{r(e,`Registration Failed`)}})},P=e=>{let t=n(),{notifyApiError:r}=w();return i({mutationFn:async({providerId:e,models:t})=>{let n=t.map(e=>e.trim()).filter(Boolean);await Promise.all(n.map(t=>p.create({name:t,providerId:e})))},onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:A.models(r.providerId)}),e?.onSuccess?.()},onError:e=>{r(e,`Registration Failed`)}})},F=e=>{let t=n(),{notifySuccess:r,notifyApiError:a}=w();return i({mutationFn:e=>p.delete(e),onSuccess:async()=>{await t.invalidateQueries({queryKey:A.models(e)}),r(`Model Removed`,`The model has been successfully deleted from the registry.`)},onError:e=>{a(e,`Cannot Delete Model`)}})},I=a(),L=({isOpen:e,onClose:t,onCreated:n,providerId:r,providerName:i})=>{let[a,o]=(0,k.useState)([``]),s=P({onSuccess:()=>{n(),o([``]),t()}});(0,k.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!s.isPending&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[s.isPending,e,t]);let c=(0,k.useMemo)(()=>a.some(e=>e.trim().length>0),[a]),u=a.length>1,f=()=>o(e=>[...e,``]),p=(e,t)=>{o(n=>{let r=[...n];return r[e]=t,r})},m=e=>{u&&o(t=>t.filter((t,n)=>n!==e))},h=()=>{s.isPending||t()},g=async e=>{e.preventDefault(),!(!r||!c)&&await s.mutateAsync({providerId:r,models:a})};return(0,I.jsx)(b,{children:e&&(0,I.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 text-white`,children:[(0,I.jsx)(x.button,{type:`button`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:h,disabled:s.isPending,"aria-label":`Close create model modal`,className:`absolute inset-0 bg-background/80 backdrop-blur-md disabled:cursor-not-allowed`}),(0,I.jsxs)(x.div,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`create-model-title`,initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low/90 backdrop-blur-2xl rounded-2xl shadow-[0_0_50px_-12px_rgba(78,222,163,0.1)] overflow-hidden border border-outline-variant/20`,children:[(0,I.jsxs)(`div`,{className:`px-8 pt-8 pb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(d,{size:18,className:`text-primary`})}),(0,I.jsx)(`h2`,{id:`create-model-title`,className:`text-xl font-headline font-bold text-on-surface tracking-tight`,children:`Expand Provider Fleets`})]}),(0,I.jsx)(`button`,{type:`button`,onClick:h,disabled:s.isPending,"aria-label":`Close create model modal`,title:`Close`,className:`p-2 rounded-full hover:bg-white/5 transition-colors text-on-surface-variant/40 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(l,{size:18})})]}),(0,I.jsxs)(`p`,{className:`text-xs text-on-surface-variant font-medium opacity-60`,children:[`Registering new registry variants for `,(0,I.jsx)(`span`,{className:`text-primary font-bold`,children:i})]})]}),(0,I.jsxs)(`form`,{onSubmit:g,children:[(0,I.jsxs)(`div`,{className:`px-8 py-4 space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,children:`Model Identifiers`}),(0,I.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/40 italic font-medium`,children:`Batch register endpoints`})]}),(0,I.jsx)(`div`,{className:`space-y-3 max-h-[300px] overflow-y-auto pr-2 scrollbar-none custom-scrollbar`,children:a.map((e,t)=>(0,I.jsxs)(x.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex gap-2 group`,children:[(0,I.jsx)(`div`,{className:`relative flex-1 bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,I.jsx)(`input`,{autoFocus:t===a.length-1,type:`text`,value:e,onChange:e=>p(t,e.target.value),placeholder:`e.g., gpt-4o-2024-05-13`,disabled:s.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-3 text-sm focus:outline-none text-white placeholder:text-on-surface-variant/20 disabled:opacity-60`,"aria-label":`Model identifier ${t+1}`})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>m(t),disabled:!u||s.isPending,"aria-label":`Remove model identifier ${t+1}`,title:u?`Remove model identifier`:`At least one model input is kept visible`,className:E(`w-12 h-12 flex items-center justify-center transition-colors bg-surface-container-highest/10 rounded-xl`,u?`text-on-surface-variant/20 hover:text-error hover:bg-error/10`:`text-on-surface-variant/10 cursor-not-allowed opacity-50`,s.isPending&&`cursor-not-allowed opacity-50`),children:(0,I.jsx)(_,{size:18})})]},t))}),(0,I.jsxs)(`button`,{type:`button`,onClick:f,disabled:s.isPending,className:`w-full py-4 border-2 border-dashed border-primary/20 rounded-xl flex items-center justify-center gap-3 text-on-surface-variant/40 hover:border-primary/40 hover:text-primary transition-all group font-bold text-[10px] uppercase tracking-widest bg-primary/5 hover:bg-primary/10 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Add model identifier`,children:[(0,I.jsx)(T,{size:16,className:`group-hover:scale-110 transition-transform`}),`Register New Target variant`]})]}),(0,I.jsxs)(`div`,{className:`bg-primary/5 p-5 rounded-2xl flex gap-4 border border-primary/5 transition-all group relative overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-24 h-24 bg-primary/5 blur-2xl rounded-full -mr-10 -mt-10 pointer-events-none`}),(0,I.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0`,children:(0,I.jsx)(y,{size:18,className:`text-primary`})}),(0,I.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant/80 leading-relaxed font-medium`,children:[`Batch models registered here will be synchronized with the`,` `,(0,I.jsx)(`span`,{className:`text-primary font-bold`,children:`Orchestrator Registry`}),` for global accessibility.`]})]})]}),(0,I.jsxs)(`div`,{className:`px-8 py-8 flex items-center justify-end gap-6 bg-gradient-to-t from-surface-container-lowest/50 to-transparent`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:h,disabled:s.isPending,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,disabled:s.isPending||!c||!r,className:`bg-primary px-8 py-3.5 rounded-xl text-on-primary text-[10px] font-black uppercase tracking-[0.2em] shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed flex items-center gap-2`,children:s.isPending?(0,I.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T,{size:16}),`Append Provider Fleets`]})})]})]}),(0,I.jsx)(`div`,{className:`absolute -bottom-16 -right-16 w-48 h-48 bg-primary/10 blur-[60px] rounded-full pointer-events-none`}),(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-1 bg-gradient-to-l from-secondary/40 to-transparent`})]})]})})},R=({isOpen:e,onClose:t,onCreated:n})=>{let{notifyError:r}=w(),[i,a]=(0,k.useState)(``),[o,c]=(0,k.useState)([``]),u=N({onSuccess:e=>{n?.(e.id),a(``),c([``]),t()}});(0,k.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!u.isPending&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,u.isPending]);let d=o.length>1,f=i.trim().length>0,p=(0,k.useMemo)(()=>o.filter(e=>e.trim().length>0).length,[o]),m=()=>c(e=>[...e,``]),h=(e,t)=>{c(n=>{let r=[...n];return r[e]=t,r})},v=e=>{d&&c(t=>t.filter((t,n)=>n!==e))},y=()=>{u.isPending||t()},S=async e=>{if(e.preventDefault(),!f){r(`Validation Error`,`Please enter a provider name`);return}await u.mutateAsync({providerName:i,models:o})};return(0,I.jsx)(b,{children:e&&(0,I.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,children:[(0,I.jsx)(x.button,{type:`button`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:y,disabled:u.isPending,"aria-label":`Close register provider modal`,className:`absolute inset-0 bg-background/80 backdrop-blur-md disabled:cursor-not-allowed`}),(0,I.jsxs)(x.div,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`register-provider-title`,initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low/90 backdrop-blur-2xl rounded-2xl shadow-[0_0_50px_-12px_rgba(173,198,255,0.2)] overflow-hidden border border-outline-variant/20`,children:[(0,I.jsxs)(`div`,{className:`px-8 pt-8 pb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(s,{size:18,className:`text-primary`})}),(0,I.jsx)(`h2`,{id:`register-provider-title`,className:`text-xl font-headline font-bold text-on-surface tracking-tight`,children:`Register Provider`})]}),(0,I.jsx)(`button`,{type:`button`,onClick:y,disabled:u.isPending,"aria-label":`Close register provider modal`,title:`Close`,className:`p-2 rounded-full hover:bg-white/5 transition-colors text-on-surface-variant/40 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(l,{size:18})})]}),(0,I.jsx)(`p`,{className:`text-xs text-on-surface-variant font-medium opacity-60`,children:`Onboard a new computational gateway to your agentic ecosystem.`})]}),(0,I.jsxs)(`form`,{onSubmit:S,children:[(0,I.jsxs)(`div`,{className:`px-8 py-4 space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,htmlFor:`provider-name-input`,children:`Provider Name`}),(0,I.jsx)(`div`,{className:`bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,I.jsx)(`input`,{id:`provider-name-input`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g., OpenAI`,disabled:u.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-3 text-sm focus:outline-none text-white placeholder:text-on-surface-variant/20 disabled:opacity-60`})})]}),(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,children:`Model Variants`}),(0,I.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/40 italic font-medium`,children:p>0?`${p} pending`:`Define available endpoints`})]}),(0,I.jsx)(`div`,{className:`space-y-3 max-h-[200px] overflow-y-auto pr-2 scrollbar-hide`,children:o.map((e,t)=>(0,I.jsxs)(x.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex gap-2 group`,children:[(0,I.jsx)(`div`,{className:`relative flex-1 bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/5 focus-within:ring-secondary/40 transition-all`,children:(0,I.jsx)(`input`,{type:`text`,value:e,onChange:e=>h(t,e.target.value),placeholder:`gpt-4o`,disabled:u.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-2.5 text-xs text-white focus:outline-none placeholder:text-on-surface-variant/20 disabled:opacity-60`,"aria-label":`Model variant ${t+1}`})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>v(t),disabled:!d||u.isPending,"aria-label":`Remove model variant ${t+1}`,title:d?`Remove model variant`:`At least one model input is kept visible`,className:E(`w-10 h-10 flex items-center justify-center transition-colors bg-surface-container-highest/10 rounded-xl`,d?`text-on-surface-variant/20 hover:text-error hover:bg-error/10`:`text-on-surface-variant/10 cursor-not-allowed opacity-50`,u.isPending&&`cursor-not-allowed opacity-50`),children:(0,I.jsx)(_,{size:16})})]},t))}),(0,I.jsxs)(`button`,{type:`button`,onClick:m,disabled:u.isPending,className:`w-full py-3 border-2 border-dashed border-outline-variant/10 rounded-xl flex items-center justify-center gap-2 text-on-surface-variant/40 hover:border-primary/40 hover:text-primary transition-all group font-bold text-[10px] uppercase tracking-widest disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Add model variant`,children:[(0,I.jsx)(T,{size:14,className:`group-hover:scale-110 transition-transform`}),`Add model variant`]})]}),(0,I.jsxs)(`div`,{className:`bg-tertiary-container/10 p-5 rounded-2xl flex gap-4 border border-tertiary/5 relative overflow-hidden group`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-24 h-24 bg-tertiary/5 blur-2xl rounded-full -mr-10 -mt-10`}),(0,I.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-tertiary/10 flex items-center justify-center shrink-0`,children:(0,I.jsx)(C,{size:18,className:`text-tertiary`})}),(0,I.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant/80 leading-relaxed font-medium`,children:[`Once registered, these models will be available in the`,` `,(0,I.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Orchestration Canvas`}),` for node deployment and agent personality mapping.`]})]})]}),(0,I.jsxs)(`div`,{className:`px-8 py-8 flex items-center justify-end gap-6 bg-gradient-to-t from-surface-container-lowest/50 to-transparent`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:y,disabled:u.isPending,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,disabled:u.isPending||!f,className:`bg-primary px-8 py-3 rounded-xl text-on-primary text-[10px] font-black uppercase tracking-[0.2em] shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed flex items-center gap-2`,children:u.isPending?(0,I.jsx)(`span`,{className:`w-3 h-3 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g,{size:14}),`Register Provider`]})})]})]}),(0,I.jsx)(`div`,{className:`absolute -bottom-16 -left-16 w-48 h-48 bg-primary/10 blur-[60px] rounded-full pointer-events-none`}),(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-1 bg-gradient-to-l from-secondary/40 to-transparent`})]})]})})},z=({model:e,onDelete:t})=>{let[n,r]=(0,k.useState)(!1),i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return n&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,I.jsxs)(`div`,{ref:i,className:`relative inline-block`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-label":`Actions for model ${e.name}`,title:`Actions for model ${e.name}`,className:`text-on-surface-variant/40 hover:text-white transition-colors p-1 rounded`,children:(0,I.jsx)(m,{size:14})}),n&&(0,I.jsx)(`div`,{className:`absolute right-0 bottom-full mb-1 z-50 w-36 bg-surface-container-high rounded-xl shadow-2xl ring-1 ring-outline-variant/10 overflow-hidden animate-in fade-in zoom-in-95 duration-150`,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{r(!1),t(e)},className:`w-full px-4 py-3 text-left text-xs font-bold text-error hover:bg-error/10 transition-colors flex items-center gap-2`,"aria-label":`Remove model ${e.name}`,children:[(0,I.jsx)(_,{size:12}),`Remove`]})})]})},B=({provider:e,models:t,isLoadingModels:n,isRefreshing:r,onRefresh:i,onOpenCreateModel:a,onDeleteModel:o})=>e?(0,I.jsxs)(`div`,{className:`bg-surface-container-low rounded-3xl overflow-hidden ring-1 ring-outline-variant/10 shadow-2xl animate-in fade-in zoom-in-95 duration-500`,children:[(0,I.jsxs)(`div`,{className:`p-10 relative overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-[500px] h-full bg-gradient-to-l from-primary/5 to-transparent pointer-events-none`}),(0,I.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start justify-between gap-8 relative z-10`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,I.jsx)(`div`,{className:`w-20 h-20 bg-surface rounded-2xl flex items-center justify-center ring-1 ring-primary/20 shadow-inner group transition-all duration-500 hover:ring-primary/40`,children:(0,I.jsx)(D,{size:40,className:`text-primary group-hover:scale-110 transition-transform`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h2`,{className:`text-3xl font-headline font-black text-white tracking-tight`,children:e.name}),(0,I.jsx)(`div`,{className:`flex gap-2`,children:(0,I.jsx)(`span`,{className:`px-2.5 py-0.5 bg-secondary/10 text-secondary text-[9px] font-black uppercase tracking-widest rounded ring-1 ring-secondary/20 font-headline`,children:`Primary`})})]}),(0,I.jsx)(`p`,{className:`text-on-surface-variant/60 text-sm mt-2`,children:e.description||`Infrastructure gateway for agentic cognition & reasoning.`})]})]}),(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:i,disabled:r,"aria-label":`Refresh ${e.name} data`,title:`Refresh ${e.name} data`,className:`p-2.5 rounded-xl bg-surface-container-high text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all ring-1 ring-outline-variant/10 disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(O,{size:18,className:E(r&&`animate-spin`)})}),(0,I.jsx)(`button`,{type:`button`,disabled:!0,"aria-label":`More provider actions unavailable`,title:`More provider actions unavailable`,className:`p-2.5 rounded-xl bg-surface-container-high text-on-surface-variant/40 transition-all ring-1 ring-outline-variant/10 disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(m,{size:18})})]})]})]}),(0,I.jsxs)(`div`,{className:`p-10 border-t border-outline-variant/5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h3`,{className:`font-headline font-black text-lg text-white`,children:`Registered Models`}),(0,I.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-surface-container-high text-[10px] font-bold text-on-surface-variant`,children:[t.length,` Models`]})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:a,disabled:!e.id,className:`text-[10px] font-black uppercase tracking-widest text-primary hover:text-primary/70 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Register models for ${e.name}`,children:[(0,I.jsx)(`div`,{className:`w-5 h-5 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(T,{size:12})}),`Register New Model`]})]}),(0,I.jsx)(`div`,{className:`rounded-2xl border border-outline-variant/5 overflow-visible`,children:(0,I.jsxs)(`table`,{className:`w-full text-left text-xs border-collapse`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{className:`bg-surface-container-high/30 text-on-surface-variant/40 font-black uppercase tracking-[0.2em]`,children:[(0,I.jsx)(`th`,{className:`py-5 px-6`,children:`Model ID`}),(0,I.jsx)(`th`,{className:`py-5 px-6 text-right`,children:`Status`}),(0,I.jsx)(`th`,{className:`py-5 px-6 w-12 text-center`,children:`Action`})]})}),(0,I.jsx)(`tbody`,{className:`divide-y divide-outline-variant/5`,children:n?(0,I.jsx)(`tr`,{children:(0,I.jsx)(`td`,{colSpan:3,className:`py-20 text-center`,children:(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center space-y-4 opacity-40`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin`}),(0,I.jsx)(`p`,{className:`text-[10px] uppercase font-black tracking-widest text-primary animate-pulse`,children:`Hydrating Model Registry...`})]})})}):t.length>0?t.map(e=>(0,I.jsxs)(`tr`,{className:`group hover:bg-primary/5 transition-all`,children:[(0,I.jsx)(`td`,{className:`py-5 px-6 font-mono text-on-surface font-medium`,children:e.name}),(0,I.jsx)(`td`,{className:`py-5 px-6 text-right`,children:(0,I.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 rounded font-black text-[8px] uppercase tracking-widest bg-secondary/10 text-secondary`,children:`Active`})}),(0,I.jsx)(`td`,{className:`py-5 px-6 text-center`,children:(0,I.jsx)(z,{model:e,onDelete:o})})]},e.id)):(0,I.jsx)(`tr`,{children:(0,I.jsx)(`td`,{colSpan:3,className:`py-12 text-center text-on-surface-variant/20 italic font-medium`,children:`No models registered for this provider gate.`})})})]})})]}),(0,I.jsxs)(`div`,{className:`ui-helper-text p-8 border-t border-outline-variant/5 bg-surface-container-lowest/20 flex items-center gap-3`,children:[(0,I.jsx)(u,{size:14,className:`text-tertiary`}),`Model registry updates propagate automatically after provider and model changes.`]})]}):(0,I.jsxs)(`div`,{className:`h-[600px] bg-surface-container-low/50 rounded-3xl border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-on-surface-variant gap-4 opacity-40`,children:[(0,I.jsx)(`div`,{className:`w-20 h-20 rounded-2xl bg-surface-container flex items-center justify-center shadow-inner`,children:(0,I.jsx)(D,{size:40,className:`text-primary/50`})}),(0,I.jsxs)(`div`,{className:`text-center`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-headline font-black text-white uppercase tracking-widest mb-1`,children:`Infrastructure Hub`}),(0,I.jsx)(`p`,{className:`text-[10px] font-medium opacity-60`,children:`Select a provider on the left to view active node details.`})]})]}),V=({providers:e,selectedProviderId:t,selectedProviderModelCount:n,isLoading:r,onSelect:i})=>r&&e.length===0?(0,I.jsx)(`div`,{className:`space-y-3`,"aria-live":`polite`,children:Array.from({length:3}).map((e,t)=>(0,I.jsx)(`div`,{className:`h-28 rounded-2xl border border-outline-variant/10 bg-surface-container-low animate-pulse`},t))}):e.length===0?(0,I.jsxs)(`div`,{className:`p-8 border-2 border-dashed border-outline-variant/10 rounded-2xl flex flex-col items-center justify-center text-center opacity-40`,children:[(0,I.jsx)(S,{size:24,className:`mb-4`}),(0,I.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest leading-relaxed`,children:[`No providers registered yet.`,(0,I.jsx)(`br`,{}),`Establish logical gateways in the infrastructure hub.`]})]}):(0,I.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let r=t===e.id,a=r?`${n} Models Active`:`Select to inspect`;return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:E(`w-full p-5 rounded-2xl border text-left transition-all duration-300 group`,r?`bg-surface-container-high border-secondary/20 shadow-lg shadow-secondary/5 ring-1 ring-secondary/10 text-white`:`bg-surface-container-low border-transparent hover:bg-surface-container-high/50 text-on-surface-variant`),"aria-pressed":r,"aria-label":`Select provider ${e.name}`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,I.jsx)(`div`,{className:E(`w-10 h-10 rounded-xl bg-surface-container-highest flex items-center justify-center transition-colors`,r?`text-primary`:`text-on-surface-variant`),children:(0,I.jsx)(f,{size:20})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:E(`font-bold text-sm block transition-colors`,r?`text-white`:`group-hover:text-white`),children:e.name}),(0,I.jsx)(`span`,{className:`text-[9px] font-bold text-on-surface-variant/40 uppercase tracking-widest leading-none mt-1 block`,children:a})]})]}),(0,I.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-secondary animate-pulse shadow-[0_0_10px_rgba(78,222,163,0.5)]`})]}),(0,I.jsx)(`div`,{className:`flex justify-start`,children:(0,I.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest text-secondary`,children:`Healthy`})})]},e.id)})}),H=()=>{let[e,t]=(0,k.useState)(!1),[n,r]=(0,k.useState)(!1),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(null),{data:c=[],isPending:l,isFetching:u,refetch:d}=j(),f=c.find(e=>e.id===i)?.id??c[0]?.id??null,p=M(f),m=(0,k.useMemo)(()=>c.find(e=>e.id===f)??null,[c,f]),{mutate:h,isPending:g}=F(f??``),_=(0,k.useCallback)(async()=>{await Promise.all([d(),f?p.refetch():Promise.resolve(void 0)])},[p,d,f]);return{providers:c,selectedProvider:m,selectedProviderId:f,setSelectedProviderId:a,models:p.data??[],isLoadingProviders:l,isFetchingProviders:u,isLoadingModels:p.isPending||p.isFetching,isRegisterProviderModalOpen:e,setIsRegisterProviderModalOpen:t,isCreateModelModalOpen:n,setIsCreateModelModalOpen:r,refreshProviders:_,modelPendingDelete:o,setModelPendingDelete:s,deleteModel:h,isDeletingModel:g}},U=()=>{let{providers:e,selectedProvider:t,selectedProviderId:n,setSelectedProviderId:r,models:i,isLoadingProviders:a,isFetchingProviders:o,isLoadingModels:s,isRegisterProviderModalOpen:l,setIsRegisterProviderModalOpen:u,isCreateModelModalOpen:d,setIsCreateModelModalOpen:f,refreshProviders:p,modelPendingDelete:m,setModelPendingDelete:h,deleteModel:g,isDeletingModel:_}=H();return(0,I.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,I.jsx)(`header`,{children:(0,I.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-end justify-between gap-6`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`nav`,{className:`flex items-center gap-2 mb-2 text-[10px] uppercase tracking-widest text-primary font-bold`,children:[(0,I.jsx)(`span`,{className:`opacity-60`,children:`Infrastructure`}),(0,I.jsx)(c,{size:12,className:`opacity-40`}),(0,I.jsx)(`span`,{children:`Model Providers`})]}),(0,I.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline tracking-tighter text-white`,children:`Provider Core`}),(0,I.jsx)(`p`,{className:`text-on-surface-variant text-sm mt-1`,children:`Manage global LLM integrations and endpoint health.`})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{p()},disabled:o,className:`px-5 py-2.5 bg-surface-container-high text-on-surface rounded-lg text-xs font-bold uppercase tracking-widest hover:bg-surface-container-highest transition-all ring-1 ring-outline-variant/10 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Refresh provider status`,children:[(0,I.jsx)(O,{size:14,className:E(o&&`animate-spin`)}),o?`Refreshing...`:`Refresh Status`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`px-6 py-2.5 bg-primary text-on-primary rounded-lg text-xs font-bold uppercase tracking-widest shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all flex items-center gap-2`,"aria-label":`Open register provider modal`,children:[(0,I.jsx)(T,{size:16}),`Register Provider`]})]})]})}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-8`,children:[(0,I.jsxs)(`div`,{className:`lg:col-span-4 space-y-5`,children:[(0,I.jsxs)(`h2`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant/40 flex items-center gap-3`,children:[(0,I.jsx)(S,{size:14,className:`text-primary`}),` Active Providers`]}),(0,I.jsx)(V,{providers:e,selectedProviderId:n,selectedProviderModelCount:n===t?.id?i.length:0,isLoading:a,onSelect:r})]}),(0,I.jsx)(`div`,{className:`lg:col-span-8 space-y-8`,children:(0,I.jsx)(B,{provider:t,models:i,isLoadingModels:s,isRefreshing:o,onRefresh:()=>{p()},onOpenCreateModel:()=>f(!0),onDeleteModel:h})})]}),(0,I.jsx)(R,{isOpen:l,onClose:()=>u(!1),onCreated:e=>{r(e),u(!1)}}),(0,I.jsx)(L,{isOpen:d,onClose:()=>f(!1),onCreated:()=>f(!1),providerId:t?.id??``,providerName:t?.name??``}),(0,I.jsx)(v,{isOpen:m!==null,onClose:()=>h(null),onConfirm:()=>{m&&g(m.id,{onSettled:()=>h(null)})},title:`Remove Model`,message:`Are you sure you want to remove "${m?.name??``}"? This action cannot be undone.`,confirmText:`Remove`,cancelText:`Cancel`,variant:`danger`,loading:_})]})};export{U as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{s as n}from"./vendor-react-CiDbU5Ns.js";import{i as r,n as i,t as a}from"./vendor-query-BMPnNmZi.js";import{r as o}from"./vendor-markdown-Dl_1qnne.js";import{i as s}from"./client-CylGrWpP.js";import{t as c}from"./activity-D2aBFbnN.js";import{n as l}from"./MarkdownField-NTZbIxf_.js";import{t as u}from"./database-DC2jO6Si.js";import{a as d,c as f,i as p,o as m,r as h,s as g,t as _}from"./CreateRecurrentTaskModal-CBDVBNo3.js";import{t as v}from"./refresh-cw-Bx28oH-b.js";import{t as y}from"./trash-2-BlARVDmE.js";import{t as b}from"./ConfirmDialog-0ML5KiMx.js";import{t as x}from"./vendor-motion-CPra8At-.js";import{C as S,c as C,m as w,v as T,y as E}from"./index-UgPpBNRb.js";import"./tasks-CaT1ysud.js";var D=s(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),O=e(t(),1),k=o(),A=()=>{let{activeProject:e,loading:t}=w(),{notifySuccess:o,notifyApiError:s}=C(),A=n(),j=r(),[M,N]=(0,O.useState)(!1),[P,F]=(0,O.useState)(()=>{let e=localStorage.getItem(`scheduler_show_insight`);return e===null?!0:e===`true`}),[I,L]=(0,O.useState)(void 0),[R,z]=(0,O.useState)(null),B=()=>{F(!1),localStorage.setItem(`scheduler_show_insight`,`false`)},V=[`recurrent-tasks`,e?.id],{data:H=[],isLoading:U}=i({queryKey:V,queryFn:async()=>{let t=await p.findAll(e.id);return Array.isArray(t.data)?t.data:[]},enabled:!!e?.id}),W=a({mutationFn:t=>p.delete(e.id,t.id),onSuccess:(e,t)=>{o(`Protocol Terminated`,`The task "${t.title}" has been removed from the fleet.`),z(null),j.invalidateQueries({queryKey:V})},onError:e=>s(e,`Error deleting task`)}),G=a({mutationFn:t=>{let n=t.status===h.ACTIVE?h.PAUSED:h.ACTIVE;return p.update(e.id,t.id,{status:n}).then(()=>n)},onSuccess:(e,t)=>{o(`Protocol ${e===h.ACTIVE?`Resumed`:`Paused`}`,`Operation "${t.title}" has been ${e===h.ACTIVE?`re-activated`:`suspended`}.`),j.invalidateQueries({queryKey:V})},onError:e=>s(e,`Failed to update protocol status`)}),K=()=>{L(void 0),N(!0)},q=e=>{L(e),N(!0)},J=e=>{G.isPending||G.mutate(e)},Y=H.length>0?(H.length-H.filter(e=>e.status===h.ERROR).length)/H.length*100:100,X=[{label:`Active Schedules`,value:H.filter(e=>e.status===h.ACTIVE).length.toString(),change:`+12%`,icon:d,color:`text-secondary`,bg:`bg-secondary/10`},{label:`Success Rate`,value:`${Y.toFixed(1)}%`,trend:Y,icon:c,color:`text-primary`},{label:`Paused Agents`,value:H.filter(e=>e.status===h.PAUSED).length.toString(),subtext:`Awaiting manual audit`,icon:f,color:`text-on-surface-variant`},{label:`Critical Errors`,value:H.filter(e=>e.status===h.ERROR).length.toString(),subtext:`System integrity: nominal`,icon:D,color:`text-error`,bg:`bg-error/10`}];return t?(0,k.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,k.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,k.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,k.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Initializing Temporal Grid`})]})}):e?(0,k.jsxs)(`div`,{className:`space-y-10 animate-in fade-in duration-700`,children:[(0,k.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-end gap-6`,children:[(0,k.jsxs)(x.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},children:[(0,k.jsx)(`h2`,{className:`text-4xl font-headline font-extrabold text-white tracking-tight mb-2`,children:`Temporal Orchestration`}),(0,k.jsx)(`p`,{className:`text-on-surface-variant font-body max-w-md`,children:`Manage autonomous agent lifecycle schedules and recurrent operational flows.`})]}),(0,k.jsxs)(x.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:K,className:`px-6 py-3.5 bg-primary text-on-primary rounded-xl font-black text-xs uppercase tracking-widest flex items-center gap-2 shadow-lg shadow-primary/20 transition-all border border-primary-container/20 group hover:shadow-primary/40`,children:[(0,k.jsx)(T,{size:18,className:`group-hover:rotate-90 transition-transform duration-300`}),`New Scheduled Task`]})]}),(0,k.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6`,children:X.map((e,t)=>(0,k.jsxs)(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.1},className:`bg-surface-container-low p-6 rounded-2xl border border-outline-variant/10 shadow-xl group hover:border-primary/20 transition-colors`,children:[(0,k.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 mb-1`,children:e.label}),(0,k.jsx)(`h3`,{className:`text-3xl font-headline font-black ${e.color}`,children:e.value}),e.change&&(0,k.jsxs)(`div`,{className:`mt-4 flex items-center text-[10px] font-black uppercase tracking-wider ${e.color} ${e.bg} px-2.5 py-1 rounded-full w-fit`,children:[(0,k.jsx)(e.icon,{size:12,className:`mr-1.5`}),e.change,` vs last month`]}),e.trend!==void 0&&(0,k.jsx)(`div`,{className:`mt-4 w-full bg-surface-container-highest h-1.5 rounded-full overflow-hidden`,children:(0,k.jsx)(x.div,{initial:{width:0},animate:{width:`${e.trend}%`},transition:{duration:1,delay:.5},className:`bg-primary h-full shadow-[0_0_12px_rgba(173,198,255,0.6)]`})}),e.subtext&&(0,k.jsx)(`p`,{className:`mt-4 text-[11px] text-on-surface-variant/50 font-medium italic`,children:e.subtext})]},t))}),(0,k.jsxs)(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:`bg-surface-container-low rounded-2xl overflow-hidden border border-outline-variant/10 shadow-2xl`,children:[(0,k.jsxs)(`div`,{className:`px-8 py-5 flex flex-col md:flex-row justify-between items-center gap-4 bg-surface-container-high/30 border-b border-outline-variant/10`,children:[(0,k.jsx)(`h4`,{className:`font-headline font-bold text-lg text-white`,children:`Recurrent Protocols`}),(0,k.jsxs)(`div`,{className:`flex gap-6`,children:[(0,k.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,k.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-secondary shadow-[0_0_8px_rgba(78,222,163,0.4)]`}),` Active`]}),(0,k.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,k.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-on-surface-variant/40`}),` Paused`]}),(0,k.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,k.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-error shadow-[0_0_8px_rgba(255,180,171,0.4)]`}),` Error`]})]})]}),(0,k.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:U?(0,k.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-20 space-y-4`,children:[(0,k.jsx)(v,{className:`text-primary animate-spin`,size:40}),(0,k.jsx)(`p`,{className:`text-on-surface-variant font-mono text-xs uppercase tracking-widest animate-pulse`,children:`Synchronizing Fleet States...`})]}):H.length===0?(0,k.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-20 space-y-6 text-center`,children:[(0,k.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-surface-container-highest flex items-center justify-center text-on-surface-variant`,children:(0,k.jsx)(u,{size:32})}),(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsx)(`h5`,{className:`text-xl font-headline font-bold text-white`,children:`No active protocols detected`}),(0,k.jsx)(`p`,{className:`text-on-surface-variant max-w-sm font-body`,children:`Deployment requested: Initiating autonomous routines requires manual configuration.`})]}),(0,k.jsx)(`button`,{onClick:K,className:`px-4 py-2 border border-primary/30 text-primary rounded-lg text-[10px] font-black uppercase tracking-widest hover:bg-primary/5 transition-colors`,children:`Initiate First Sequence`})]}):H.map(e=>(0,k.jsx)(`div`,{className:`px-8 py-6 hover:bg-surface-container-high/20 transition-all group`,children:(0,k.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[auto_1fr_160px_160px_160px_220px] items-center gap-10`,children:[(0,k.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-surface-container-highest flex items-center justify-center border border-outline-variant/20 group-hover:border-primary/30 transition-colors shadow-inner`,children:(0,k.jsx)(c,{className:e.status===h.ERROR?`text-error`:`text-primary`,size:24})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h5`,{className:`text-xl font-headline font-black text-white mb-2 group-hover:text-primary transition-colors tracking-tight cursor-pointer`,onClick:()=>A(`/scheduler/tasks/${e.id}/executions`),children:e.title}),(0,k.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,k.jsxs)(`span`,{className:`flex items-center gap-1.5 bg-surface-container-highest px-3 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest text-on-surface-variant border border-outline-variant/10 shadow-sm`,children:[(0,k.jsx)(S,{size:12}),e.assignee?.name||`Unassigned`]})})]}),(0,k.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,k.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Cycle Pattern`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,k.jsx)(`p`,{className:`font-mono text-xs text-tertiary font-bold tracking-widest`,children:e.cronExpression}),(0,k.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter italic`,children:`Recurrent Loop`})]})]}),(0,k.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,k.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Last Execution`}),(0,k.jsx)(`p`,{className:`text-sm font-bold tracking-tight text-white/90`,children:e.lastRun?new Date(e.lastRun).toLocaleString():(0,k.jsx)(`span`,{className:`text-on-surface-variant/40 italic`,children:`Never executed`})})]}),(0,k.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,k.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Deployed`}),(0,k.jsx)(`p`,{className:`text-sm font-bold text-on-surface tracking-tight`,children:new Date(e.createdAt).toLocaleDateString()})]}),(0,k.jsxs)(`div`,{className:`flex items-center justify-end relative h-full`,children:[(0,k.jsx)(`div`,{className:`flex items-center gap-4 group-hover:opacity-0 transition-opacity`,children:(0,k.jsx)(`span`,{className:`px-4 py-1.5 rounded-full text-[10px] font-black uppercase tracking-widest border transition-all ${e.status===h.ACTIVE?`bg-secondary/10 text-secondary border-secondary/20 shadow-[0_0_15px_rgba(78,222,163,0.1)]`:e.status===h.PAUSED?`bg-surface-container-highest text-on-surface-variant/60 border-outline-variant/20`:`bg-error/10 text-error border-error/20 shadow-[0_0_15px_rgba(255,180,171,0.1)]`}`,children:e.status})}),(0,k.jsxs)(`div`,{className:`absolute right-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all translate-x-2 group-hover:translate-x-0`,children:[(0,k.jsx)(`button`,{className:`p-3 transition-colors disabled:opacity-40 ${e.status===h.ACTIVE?`text-secondary hover:text-secondary/80`:`text-on-surface-variant hover:text-secondary`}`,title:e.status===h.ACTIVE?`Pause Protocol`:`Resume Protocol`,disabled:G.isPending,onClick:()=>J(e),children:e.status===h.ACTIVE?(0,k.jsx)(f,{size:20}):(0,k.jsx)(g,{size:20})}),(0,k.jsx)(`button`,{className:`p-3 text-on-surface-variant hover:text-primary transition-colors`,title:`Edit`,onClick:()=>q(e),children:(0,k.jsx)(m,{size:20})}),(0,k.jsx)(`button`,{className:`p-3 text-on-surface-variant hover:text-error transition-colors`,title:`Delete`,onClick:()=>z(e),children:(0,k.jsx)(y,{size:20})})]})]})]})},e.id))})]}),P&&(0,k.jsxs)(x.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{delay:.6},className:`p-8 rounded-3xl bg-gradient-to-br from-tertiary/10 via-surface-container-low to-surface-container-low border border-tertiary/20 relative overflow-hidden group`,children:[(0,k.jsxs)(`div`,{className:`relative z-10 flex flex-col md:flex-row gap-8 items-start md:items-center`,children:[(0,k.jsx)(`div`,{className:`w-16 h-16 bg-tertiary/10 rounded-2xl border border-tertiary/20 flex items-center justify-center text-tertiary shadow-xl group-hover:scale-110 transition-transform duration-500`,children:(0,k.jsx)(l,{size:32})}),(0,k.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`text-xl font-headline font-black text-tertiary mb-2 uppercase tracking-tight`,children:`Orchestrator Intelligence Insight`}),(0,k.jsx)(`p`,{className:`text-on-surface-variant leading-relaxed max-w-4xl font-body italic text-base`,children:`"To maximize efficiency, schedule tasks with non-overlapping times."`})]}),(0,k.jsx)(`div`,{className:`flex gap-4`,children:(0,k.jsx)(`button`,{onClick:B,className:`px-6 py-2.5 border border-tertiary/30 text-tertiary rounded-xl font-black text-xs uppercase tracking-widest hover:bg-tertiary/5 transition-colors`,children:`Dismiss`})})]})]}),(0,k.jsx)(`div`,{className:`absolute -right-20 -bottom-20 w-80 h-80 bg-tertiary/5 blur-[100px] rounded-full group-hover:bg-tertiary/10 transition-colors duration-1000`})]}),(0,k.jsx)(_,{projectId:e.id,isOpen:M,onClose:()=>N(!1),onSuccess:()=>{N(!1),j.invalidateQueries({queryKey:V})},initialData:I}),(0,k.jsx)(b,{isOpen:!!R,onClose:()=>!W.isPending&&z(null),onConfirm:()=>R&&W.mutate(R),title:`Delete Recurrent Protocol?`,message:`Are you sure you want to delete the recurrent protocol "${R?.title}"? This action cannot be undone.`,confirmText:`Delete Protocol`,variant:`danger`,loading:W.isPending})]}):(0,k.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,k.jsxs)(`div`,{className:`text-center space-y-6 max-w-md`,children:[(0,k.jsx)(`div`,{className:`w-20 h-20 bg-surface-container-highest rounded-3xl flex items-center justify-center text-on-surface-variant/20 mx-auto border border-outline-variant/10 shadow-xl`,children:(0,k.jsx)(E,{size:40})}),(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(`h2`,{className:`text-2xl font-black font-headline text-white tracking-tight`,children:`No Active Projects Found`}),(0,k.jsx)(`p`,{className:`text-on-surface-variant text-sm leading-relaxed`,children:`Temporal orchestration requires an active project. Create or select a project from the sidebar to manage recurrent tasks.`})]})]})})};export{A as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{r as n}from"./vendor-markdown-Dl_1qnne.js";import{t as r}from"./client-CylGrWpP.js";import{t as i}from"./activity-D2aBFbnN.js";import{n as a,t as o}from"./terminal-DXcWSHx9.js";import{t as s}from"./cpu-C3sglvsN.js";import{t as c}from"./refresh-cw-BGkg-lCf.js";import{t as l}from"./save-zLR2Bpx5.js";import{c as u}from"./index-4X4zupUS.js";var d=e(t(),1),f=async()=>{let{data:e}=await r.get(`/system-settings`);return e},p=async e=>{let{data:t}=await r.patch(`/system-settings`,e);return t},m=n(),h=()=>{let[e,t]=(0,d.useState)(null),[n,r]=(0,d.useState)(!0),[h,g]=(0,d.useState)(!1),{notifySuccess:_,notifyApiError:v,notifyInfo:y}=u();(0,d.useEffect)(()=>{(async()=>{try{t(await f())}catch(e){v(e,`Failed to load settings`)}finally{r(!1)}})()},[v]);let b=async()=>{if(e){g(!0);try{await p(e),_(`Settings committed`,`Configuration synchronized with central orchestrator.`)}catch(e){v(e,`Commit failed`)}finally{g(!1)}}},x=(0,d.useMemo)(()=>{if(!e)return{};let t={},n=e.data.taskScheduler,r=e.data.recurrentTasksScheduler;return(!n.pollIntervalInMs||n.pollIntervalInMs<1e4)&&(t[`ts.poll`]=`Minimum 10 000 ms`),(!n.maxTaskPerExecution||n.maxTaskPerExecution<1||n.maxTaskPerExecution>15)&&(t[`ts.max`]=`Must be between 1 and 15`),(!r.pollIntervalInMs||r.pollIntervalInMs<15e3)&&(t[`rs.poll`]=`Minimum 15 000 ms`),(!r.executionTimeout||r.executionTimeout<6e4)&&(t[`rs.timeout`]=`Minimum 60 000 ms`),(!r.maxActiveTasks||r.maxActiveTasks<1||r.maxActiveTasks>5)&&(t[`rs.max`]=`Must be between 1 and 5`),t},[e]),S=Object.keys(x).length>0,C=async()=>{r(!0);try{t(await f()),y(`Changes aborted`,`Configuration reloaded from the last known state.`)}catch{}finally{r(!1)}},w=(n,r)=>{e&&t({...e,data:{...e.data,taskScheduler:{...e.data.taskScheduler,[n]:r}}})},T=(n,r)=>{e&&t({...e,data:{...e.data,recurrentTasksScheduler:{...e.data.recurrentTasksScheduler,[n]:r}}})};return n?(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,m.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border-outline-variant/30 border-t-primary animate-spin`})}):e?(0,m.jsxs)(`div`,{className:`flex flex-col h-full font-mono text-on-surface`,children:[(0,m.jsxs)(`div`,{className:`flex justify-between items-center mb-10 border-b border-outline-variant/10 pb-6`,children:[(0,m.jsxs)(`div`,{className:`border-l-2 border-primary/40 pl-6`,children:[(0,m.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-1`,children:`Developer Configuration Terminal`}),(0,m.jsxs)(`p`,{className:`text-on-surface-variant text-sm flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-secondary animate-pulse`}),`Direct access to system scheduling and processing parameters.`]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,m.jsxs)(`button`,{onClick:C,className:`text-on-surface-variant text-[11px] hover:text-on-surface transition-colors px-3 py-1 flex items-center gap-2`,children:[(0,m.jsx)(a,{size:14}),` ABORT_CHANGES`]}),(0,m.jsxs)(`button`,{onClick:b,disabled:h||S,className:`bg-primary/10 border border-primary/40 text-primary text-[11px] font-bold px-4 py-1 hover:bg-primary/20 transition-all flex items-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed`,children:[h?(0,m.jsx)(i,{size:14,className:`animate-spin`}):(0,m.jsx)(l,{size:14}),`COMMIT --PUSH`]})]})]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-4 gap-8 flex-1 overflow-y-auto pr-2 custom-scrollbar pb-24`,children:[(0,m.jsx)(`aside`,{className:`lg:col-span-1 border-r border-outline-variant/10 pr-4 hidden lg:flex flex-col gap-1`,children:(0,m.jsxs)(`nav`,{className:`space-y-0.5`,children:[(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 bg-primary/5 text-primary border-r-2 border-primary text-left`,children:[(0,m.jsx)(o,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Scheduler`})]}),(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 text-on-surface-variant hover:text-on-surface hover:bg-surface-container transition-all text-left`,children:[(0,m.jsx)(c,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Recurrent`})]})]})}),(0,m.jsxs)(`div`,{className:`lg:col-span-3 space-y-12`,children:[(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(s,{size:14}),` 01. TASK_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 10 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:1e4,value:e.data.taskScheduler.pollIntervalInMs,onChange:e=>w(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Tasks Per Execution `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 15`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:15,value:e.data.taskScheduler.maxTaskPerExecution,onChange:e=>w(`maxTaskPerExecution`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.max`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.max`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.max`]})]})]})]}),(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(c,{size:14}),` 02. RECURRENT_TASKS_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 15 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:15e3,value:e.data.recurrentTasksScheduler.pollIntervalInMs,onChange:e=>T(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Execution Timeout (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 60 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:6e4,value:e.data.recurrentTasksScheduler.executionTimeout,onChange:e=>T(`executionTimeout`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.timeout`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.timeout`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.timeout`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Active Tasks `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 5`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:5,value:e.data.recurrentTasksScheduler.maxActiveTasks,onChange:e=>T(`maxActiveTasks`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border border-outline-variant/30 px-3 py-1.5 text-secondary font-mono text-sm focus:border-primary focus:ring-0 outline-none transition-colors`})]})]})]})]})]})]}):null};export{h as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{r as n}from"./vendor-markdown-Dl_1qnne.js";import{t as r}from"./client-CylGrWpP.js";import{t as i}from"./activity-D2aBFbnN.js";import{n as a,t as o}from"./terminal-FItpYHvw.js";import{t as s}from"./cpu-C3sglvsN.js";import{t as c}from"./refresh-cw-Bx28oH-b.js";import{t as l}from"./save-BJqQo16R.js";import{c as u}from"./index-UgPpBNRb.js";var d=e(t(),1),f=async()=>{let{data:e}=await r.get(`/system-settings`);return e},p=async e=>{let{data:t}=await r.patch(`/system-settings`,e);return t},m=n(),h=()=>{let[e,t]=(0,d.useState)(null),[n,r]=(0,d.useState)(!0),[h,g]=(0,d.useState)(!1),{notifySuccess:_,notifyApiError:v,notifyInfo:y}=u();(0,d.useEffect)(()=>{(async()=>{try{t(await f())}catch(e){v(e,`Failed to load settings`)}finally{r(!1)}})()},[v]);let b=async()=>{if(e){g(!0);try{await p(e),_(`Settings committed`,`Configuration synchronized with central orchestrator.`)}catch(e){v(e,`Commit failed`)}finally{g(!1)}}},x=(0,d.useMemo)(()=>{if(!e)return{};let t={},n=e.data.taskScheduler,r=e.data.recurrentTasksScheduler;return(!n.pollIntervalInMs||n.pollIntervalInMs<1e4)&&(t[`ts.poll`]=`Minimum 10 000 ms`),(!n.maxTaskPerExecution||n.maxTaskPerExecution<1||n.maxTaskPerExecution>15)&&(t[`ts.max`]=`Must be between 1 and 15`),(!r.pollIntervalInMs||r.pollIntervalInMs<15e3)&&(t[`rs.poll`]=`Minimum 15 000 ms`),(!r.executionTimeout||r.executionTimeout<6e4)&&(t[`rs.timeout`]=`Minimum 60 000 ms`),(!r.maxActiveTasks||r.maxActiveTasks<1||r.maxActiveTasks>5)&&(t[`rs.max`]=`Must be between 1 and 5`),t},[e]),S=Object.keys(x).length>0,C=async()=>{r(!0);try{t(await f()),y(`Changes aborted`,`Configuration reloaded from the last known state.`)}catch{}finally{r(!1)}},w=(n,r)=>{e&&t({...e,data:{...e.data,taskScheduler:{...e.data.taskScheduler,[n]:r}}})},T=(n,r)=>{e&&t({...e,data:{...e.data,recurrentTasksScheduler:{...e.data.recurrentTasksScheduler,[n]:r}}})};return n?(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,m.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border-outline-variant/30 border-t-primary animate-spin`})}):e?(0,m.jsxs)(`div`,{className:`flex flex-col h-full font-mono text-on-surface`,children:[(0,m.jsxs)(`div`,{className:`flex justify-between items-center mb-10 border-b border-outline-variant/10 pb-6`,children:[(0,m.jsxs)(`div`,{className:`border-l-2 border-primary/40 pl-6`,children:[(0,m.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-1`,children:`Developer Configuration Terminal`}),(0,m.jsxs)(`p`,{className:`text-on-surface-variant text-sm flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-secondary animate-pulse`}),`Direct access to system scheduling and processing parameters.`]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,m.jsxs)(`button`,{onClick:C,className:`text-on-surface-variant text-[11px] hover:text-on-surface transition-colors px-3 py-1 flex items-center gap-2`,children:[(0,m.jsx)(a,{size:14}),` ABORT_CHANGES`]}),(0,m.jsxs)(`button`,{onClick:b,disabled:h||S,className:`bg-primary/10 border border-primary/40 text-primary text-[11px] font-bold px-4 py-1 hover:bg-primary/20 transition-all flex items-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed`,children:[h?(0,m.jsx)(i,{size:14,className:`animate-spin`}):(0,m.jsx)(l,{size:14}),`COMMIT --PUSH`]})]})]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-4 gap-8 flex-1 overflow-y-auto pr-2 custom-scrollbar pb-24`,children:[(0,m.jsx)(`aside`,{className:`lg:col-span-1 border-r border-outline-variant/10 pr-4 hidden lg:flex flex-col gap-1`,children:(0,m.jsxs)(`nav`,{className:`space-y-0.5`,children:[(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 bg-primary/5 text-primary border-r-2 border-primary text-left`,children:[(0,m.jsx)(o,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Scheduler`})]}),(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 text-on-surface-variant hover:text-on-surface hover:bg-surface-container transition-all text-left`,children:[(0,m.jsx)(c,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Recurrent`})]})]})}),(0,m.jsxs)(`div`,{className:`lg:col-span-3 space-y-12`,children:[(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(s,{size:14}),` 01. TASK_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 10 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:1e4,value:e.data.taskScheduler.pollIntervalInMs,onChange:e=>w(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Tasks Per Execution `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 15`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:15,value:e.data.taskScheduler.maxTaskPerExecution,onChange:e=>w(`maxTaskPerExecution`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.max`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.max`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.max`]})]})]})]}),(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(c,{size:14}),` 02. RECURRENT_TASKS_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 15 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:15e3,value:e.data.recurrentTasksScheduler.pollIntervalInMs,onChange:e=>T(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Execution Timeout (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 60 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:6e4,value:e.data.recurrentTasksScheduler.executionTimeout,onChange:e=>T(`executionTimeout`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.timeout`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.timeout`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.timeout`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Active Tasks `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 5`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:5,value:e.data.recurrentTasksScheduler.maxActiveTasks,onChange:e=>T(`maxActiveTasks`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border border-outline-variant/30 px-3 py-1.5 text-secondary font-mono text-sm focus:border-primary focus:ring-0 outline-none transition-colors`})]})]})]})]})]})]}):null};export{h as default};