blockmine 1.19.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ # BlockMine Product Overview
2
+
3
+ BlockMine is an open-source centralized management and automation solution for Minecraft bots built on Mineflayer. It provides a modern web-based control panel for managing multiple Minecraft bots with advanced automation capabilities.
4
+
5
+ ## Core Features
6
+
7
+ - **Web-based Dashboard**: Modern React + Tailwind CSS interface for bot management
8
+ - **Visual Logic Editor (No-Code)**: Drag-and-drop interface for creating bot behaviors and commands without coding
9
+ - **Comprehensive Bot Management**: Start/stop bots, real-time console, resource monitoring, SOCKS5 proxy support
10
+ - **Plugin System**: Extensible architecture with plugin browser, automatic dependency management
11
+ - **Permissions System**: Flexible user groups and granular command permissions
12
+ - **Export/Import**: Full bot backups and command sharing via ZIP/JSON export
13
+
14
+ ## Target Users
15
+
16
+ - Minecraft server administrators
17
+ - Bot developers and automation enthusiasts
18
+ - Users who want to manage multiple Minecraft bots centrally
19
+ - Non-technical users who want bot automation without coding
20
+
21
+ ## Key Value Propositions
22
+
23
+ 1. **No-Code Automation**: Visual editor eliminates need for programming knowledge
24
+ 2. **Centralized Management**: Single interface for multiple bots and servers
25
+ 3. **Extensibility**: Rich plugin ecosystem for custom functionality
26
+ 4. **Easy Deployment**: One-command setup via `npx blockmine`
27
+ 5. **Professional UI**: Modern, responsive web interface accessible from any device
@@ -0,0 +1,89 @@
1
+ # Project Structure & Organization
2
+
3
+ ## Root Level Structure
4
+ ```
5
+ blockmine/
6
+ ├── backend/ # Node.js/Express API server
7
+ ├── frontend/ # React/Vite web application
8
+ ├── plugins/ # Plugin ecosystem directory
9
+ ├── stats-server/ # Separate statistics server
10
+ ├── mptest/ # MCP (Model Context Protocol) testing
11
+ ├── .kiro/ # Kiro AI assistant configuration
12
+ ├── .github/ # GitHub workflows and templates
13
+ ├── .husky/ # Git hooks configuration
14
+ └── image/ # Project assets and screenshots
15
+ ```
16
+
17
+ ## Backend Structure (`backend/`)
18
+ - **`src/`**: Main application source code
19
+ - **`prisma/`**: Database schema, migrations, and seed files
20
+ - **`storage/`**: Runtime data storage (logs, uploads, bot data)
21
+ - **`cli.js`**: Command-line interface entry point
22
+ - **`package.json`**: Backend dependencies and scripts
23
+ - **`nodemon.json`**: Development server configuration
24
+
25
+ ## Frontend Structure (`frontend/`)
26
+ - **`src/`**: React application source code
27
+ - **`public/`**: Static assets served by Vite
28
+ - **`dist/`**: Built production files (generated)
29
+ - **`components.json`**: shadcn/ui component configuration
30
+ - **`tailwind.config.js`**: Tailwind CSS customization
31
+ - **`vite.config.js`**: Vite build configuration with Monaco Editor plugin
32
+
33
+ ## Plugin System (`plugins/`)
34
+ Each plugin follows a standard structure:
35
+ ```
36
+ plugins/plugin-name/
37
+ ├── package.json # Plugin metadata and dependencies
38
+ ├── index.js # Main plugin entry point
39
+ ├── README.md # Plugin documentation
40
+ └── commands/ # Command definitions (if applicable)
41
+ ```
42
+
43
+ Common plugin types:
44
+ - **Command plugins**: Add new bot commands
45
+ - **Event handlers**: React to Minecraft events
46
+ - **UI extensions**: Add dashboard features
47
+ - **Automation**: Background tasks and scheduled actions
48
+
49
+ ## Configuration Files
50
+
51
+ ### Development & Build
52
+ - **`package.json`**: Root workspace configuration with npm workspaces
53
+ - **`ecosystem.config.js`**: PM2 process manager configuration
54
+ - **`.versionrc.json`**: Standard-version release configuration
55
+ - **`commitlint.config.js`**: Commit message linting rules
56
+
57
+ ### Code Quality
58
+ - **`.husky/`**: Git hooks for pre-commit and commit-msg validation
59
+ - **`frontend/eslint.config.js`**: ESLint rules for React code
60
+ - **`.gitignore`**: Version control exclusions
61
+
62
+ ## Key Architectural Patterns
63
+
64
+ ### Monorepo Organization
65
+ - Uses npm workspaces for dependency management
66
+ - Shared dependencies hoisted to root level
67
+ - Independent build processes for frontend/backend
68
+
69
+ ### Plugin Architecture
70
+ - Plugins are self-contained modules with their own package.json
71
+ - Plugin discovery via directory scanning
72
+ - Automatic dependency resolution and installation
73
+
74
+ ### API Structure
75
+ - RESTful API endpoints under `/api/`
76
+ - Real-time updates via Socket.IO
77
+ - File uploads handled via Multer middleware
78
+
79
+ ### Frontend Organization
80
+ - Component-based architecture with Radix UI primitives
81
+ - Custom hooks for state management (Zustand)
82
+ - Path aliases (`@/`) for clean imports
83
+ - Responsive design with Tailwind CSS utilities
84
+
85
+ ## Development Workflow
86
+ 1. **Setup**: `npm install` installs all workspace dependencies
87
+ 2. **Development**: `npm run dev` starts both frontend and backend with hot reload
88
+ 3. **Building**: `npm run build` creates production frontend bundle
89
+ 4. **Deployment**: `npx blockmine` for quick deployment or PM2 for production
@@ -0,0 +1,94 @@
1
+ # Technology Stack & Build System
2
+
3
+ ## Architecture
4
+ - **Monorepo**: Uses npm workspaces with separate frontend and backend packages
5
+ - **Frontend**: React 19 + Vite + Tailwind CSS
6
+ - **Backend**: Node.js + Express + Prisma ORM
7
+ - **Database**: SQLite (via Prisma)
8
+ - **Real-time**: Socket.IO for live updates
9
+ - **Bot Framework**: Mineflayer for Minecraft bot functionality
10
+
11
+ ## Key Technologies
12
+
13
+ ### Frontend Stack
14
+ - **React 19**: Latest React with modern hooks and concurrent features
15
+ - **Vite**: Fast build tool with HMR for development
16
+ - **Tailwind CSS**: Utility-first CSS framework with custom design system
17
+ - **Radix UI**: Headless component library for accessibility
18
+ - **React Flow**: Visual node editor for no-code logic builder
19
+ - **Monaco Editor**: VS Code editor for code editing features
20
+ - **Zustand**: Lightweight state management
21
+ - **React Router**: Client-side routing
22
+
23
+ ### Backend Stack
24
+ - **Express.js**: Web framework with validation middleware
25
+ - **Prisma**: Type-safe ORM with SQLite database
26
+ - **Socket.IO**: Real-time bidirectional communication
27
+ - **Pino**: High-performance logging
28
+ - **JWT**: Authentication tokens
29
+ - **Multer**: File upload handling
30
+ - **Node-cron**: Task scheduling
31
+
32
+ ### Development Tools
33
+ - **ESLint**: Code linting with React-specific rules
34
+ - **Husky**: Git hooks for code quality
35
+ - **Commitlint**: Conventional commit message enforcement
36
+ - **Standard-version**: Automated versioning and changelog
37
+ - **Nodemon**: Development server with auto-restart
38
+ - **Concurrently**: Run multiple npm scripts simultaneously
39
+
40
+ ## Common Commands
41
+
42
+ ### Development
43
+ ```bash
44
+ # Install dependencies
45
+ npm install
46
+
47
+ # Start development servers (both frontend and backend)
48
+ npm run dev
49
+
50
+ # Frontend dev server only (http://localhost:5173)
51
+ npm run dev --workspace=frontend
52
+
53
+ # Backend dev server only (http://localhost:3001)
54
+ npm run dev --workspace=backend
55
+ ```
56
+
57
+ ### Production
58
+ ```bash
59
+ # Build frontend for production
60
+ npm run build
61
+
62
+ # Start production server
63
+ npm start
64
+
65
+ # Quick deployment via npx
66
+ npx blockmine
67
+ ```
68
+
69
+ ### Release Management
70
+ ```bash
71
+ # Create patch release
72
+ npm run release:patch
73
+
74
+ # Create minor release
75
+ npm run release:minor
76
+
77
+ # Create major release
78
+ npm run release:major
79
+ ```
80
+
81
+ ### Database
82
+ ```bash
83
+ # Generate Prisma client
84
+ npx prisma generate --schema=./backend/prisma/schema.prisma
85
+
86
+ # Run database migrations
87
+ npx prisma migrate dev --schema=./backend/prisma/schema.prisma
88
+ ```
89
+
90
+ ## Build Configuration
91
+ - **Vite proxy**: Frontend proxies `/api` and `/socket.io` to backend during development
92
+ - **Monaco Editor**: Integrated via vite plugin for code editing features
93
+ - **Path aliases**: `@/` resolves to `frontend/src/`
94
+ - **Tailwind**: Custom design system with CSS variables and animations
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # История версий
2
2
 
3
3
 
4
+ ### [1.19.1](https://github.com/blockmineJS/blockmine/compare/v1.19.0...v1.19.1) (2025-10-01)
5
+
6
+
7
+ ### 🐛 Исправления
8
+
9
+ * изменение порядка ботов теперь корректное ([9663737](https://github.com/blockmineJS/blockmine/commit/9663737505201468dd2233bf5658be5b2442f583))
10
+ * фиксим новой вкладки прокси ([7ebdb7d](https://github.com/blockmineJS/blockmine/commit/7ebdb7d0df6c4e5cd6a9b15576cc1907ab7fcd74))
11
+
4
12
  ## [1.19.0](https://github.com/blockmineJS/blockmine/compare/v1.18.5...v1.19.0) (2025-08-23)
5
13
 
6
14
 
@@ -136,11 +136,20 @@ router.get('/', conditionalListAuth, async (req, res) => {
136
136
 
137
137
  if (botsWithoutSortOrder.length > 0) {
138
138
  console.log(`[API] Обновляем sortOrder для ${botsWithoutSortOrder.length} ботов`);
139
+
140
+ const maxSortOrder = await prisma.bot.aggregate({
141
+ _max: { sortOrder: true }
142
+ });
143
+
144
+ let nextSortOrder = (maxSortOrder._max.sortOrder || 0) + 1;
145
+
139
146
  for (const bot of botsWithoutSortOrder) {
140
147
  await prisma.bot.update({
141
148
  where: { id: bot.id },
142
- data: { sortOrder: bot.id }
149
+ data: { sortOrder: nextSortOrder }
143
150
  });
151
+ console.log(`[API] Установлен sortOrder ${nextSortOrder} для бота ${bot.id}`);
152
+ nextSortOrder++;
144
153
  }
145
154
  }
146
155
 
@@ -236,7 +245,7 @@ router.put('/bulk-proxy-update', authenticate, authorize('bot:update'), async (r
236
245
  const encryptedSettings = {
237
246
  proxyHost: proxySettings.proxyHost.trim(),
238
247
  proxyPort: parseInt(proxySettings.proxyPort),
239
- proxyUsername: proxySettings.proxyUsername ? encrypt(proxySettings.proxyUsername.trim()) : null,
248
+ proxyUsername: proxySettings.proxyUsername ? proxySettings.proxyUsername.trim() : null,
240
249
  proxyPassword: proxySettings.proxyPassword ? encrypt(proxySettings.proxyPassword) : null
241
250
  };
242
251
 
@@ -465,74 +474,56 @@ router.put('/:id', authenticate, checkBotAccess, authorize('bot:update'), async
465
474
 
466
475
  router.put('/:id/sort-order', authenticate, checkBotAccess, authorize('bot:update'), async (req, res) => {
467
476
  try {
468
- const { newPosition } = req.body;
477
+ const { newPosition, oldIndex, newIndex } = req.body;
469
478
  const botId = parseInt(req.params.id, 10);
470
479
 
471
- console.log(`[API] Запрос на изменение порядка бота ${botId} на позицию ${newPosition}`);
480
+ console.log(`[API] Запрос на изменение порядка бота ${botId}: oldIndex=${oldIndex}, newIndex=${newIndex}, newPosition=${newPosition}`);
472
481
 
473
- if (isNaN(botId) || typeof newPosition !== 'number') {
474
- console.log(`[API] Неверные параметры: botId=${botId}, newPosition=${newPosition}`);
475
- return res.status(400).json({ error: 'Неверные параметры' });
482
+ if (isNaN(botId)) {
483
+ console.log(`[API] Неверный botId: ${botId}`);
484
+ return res.status(400).json({ error: 'Неверный ID бота' });
476
485
  }
477
486
 
478
- const currentBot = await prisma.bot.findUnique({
479
- where: { id: botId },
480
- select: { sortOrder: true }
487
+ const allBots = await prisma.bot.findMany({
488
+ orderBy: { sortOrder: 'asc' },
489
+ select: { id: true, sortOrder: true }
481
490
  });
482
491
 
483
- if (!currentBot) {
492
+ console.log(`[API] Всего ботов: ${allBots.length}`);
493
+ const currentBotIndex = allBots.findIndex(bot => bot.id === botId);
494
+ if (currentBotIndex === -1) {
484
495
  console.log(`[API] Бот ${botId} не найден`);
485
496
  return res.status(404).json({ error: 'Бот не найден' });
486
497
  }
487
498
 
488
- const currentPosition = currentBot.sortOrder;
489
- console.log(`[API] Текущая позиция бота ${botId}: ${currentPosition}, новая позиция: ${newPosition}`);
490
-
491
- if (newPosition === currentPosition) {
499
+ if (newIndex < 0 || newIndex >= allBots.length) {
500
+ console.log(`[API] Неверная новая позиция: ${newIndex}`);
501
+ return res.status(400).json({ error: 'Неверная позиция' });
502
+ }
503
+
504
+ if (currentBotIndex === newIndex) {
492
505
  console.log(`[API] Позиция не изменилась для бота ${botId}`);
493
506
  return res.json({ success: true, message: 'Позиция не изменилась' });
494
507
  }
508
+ const reorderedBots = [...allBots];
509
+ const [movedBot] = reorderedBots.splice(currentBotIndex, 1);
510
+ reorderedBots.splice(newIndex, 0, movedBot);
495
511
 
496
- if (newPosition > currentPosition) {
497
- console.log(`[API] Перемещаем бота ${botId} вниз с позиции ${currentPosition} на ${newPosition}`);
498
- const updateResult = await prisma.bot.updateMany({
499
- where: {
500
- sortOrder: {
501
- gt: currentPosition,
502
- lte: newPosition
503
- }
504
- },
505
- data: {
506
- sortOrder: {
507
- decrement: 1
508
- }
509
- }
510
- });
511
- console.log(`[API] Обновлено ${updateResult.count} ботов при перемещении вниз`);
512
- } else {
513
- console.log(`[API] Перемещаем бота ${botId} вверх с позиции ${currentPosition} на ${newPosition}`);
514
- const updateResult = await prisma.bot.updateMany({
515
- where: {
516
- sortOrder: {
517
- gte: newPosition,
518
- lt: currentPosition
519
- }
520
- },
521
- data: {
522
- sortOrder: {
523
- increment: 1
524
- }
525
- }
526
- });
527
- console.log(`[API] Обновлено ${updateResult.count} ботов при перемещении вверх`);
512
+ console.log(`[API] Обновляем порядок для всех ботов`);
513
+ for (let i = 0; i < reorderedBots.length; i++) {
514
+ const bot = reorderedBots[i];
515
+ const newSortOrder = i + 1; // 1-based позиции
516
+
517
+ if (bot.sortOrder !== newSortOrder) {
518
+ await prisma.bot.update({
519
+ where: { id: bot.id },
520
+ data: { sortOrder: newSortOrder }
521
+ });
522
+ console.log(`[API] Обновлен бот ${bot.id}: sortOrder ${bot.sortOrder} -> ${newSortOrder}`);
523
+ }
528
524
  }
529
525
 
530
- await prisma.bot.update({
531
- where: { id: botId },
532
- data: { sortOrder: newPosition }
533
- });
534
-
535
- console.log(`[API] Успешно обновлен порядок бота ${botId} на позицию ${newPosition}`);
526
+ console.log(`[API] Успешно обновлен порядок бота ${botId}`);
536
527
  res.json({ success: true, message: 'Порядок ботов обновлен' });
537
528
  } catch (error) {
538
529
  console.error("[API Error] /bots sort-order PUT:", error);
@@ -588,6 +588,10 @@ router.post('/:pluginName/create-pr', resolvePluginPath, async (req, res) => {
588
588
  if (!branch) {
589
589
  return res.status(400).json({ error: 'Название ветки обязательно.' });
590
590
  }
591
+ // Validate branch name: only allow letters, numbers, dashes, underscores, dots, slashes
592
+ if (!branch.match(/^[\w\-.\/]+$/)) {
593
+ return res.status(400).json({ error: 'Некорректное имя ветки.' });
594
+ }
591
595
 
592
596
  try {
593
597
  cp.execSync('git --version');
@@ -675,10 +679,10 @@ router.post('/:pluginName/create-pr', resolvePluginPath, async (req, res) => {
675
679
 
676
680
 
677
681
  if (branchExists) {
678
- cp.execSync(`git push origin ${branch} --force`);
682
+ cp.execFileSync('git', ['push', 'origin', branch, '--force']);
679
683
  console.log(`[Plugin IDE] Ветка ${branch} обновлена`);
680
684
  } else {
681
- cp.execSync(`git push -u origin ${branch}`);
685
+ cp.execFileSync('git', ['push', '-u', 'origin', branch]);
682
686
  console.log(`[Plugin IDE] Новая ветка ${branch} создана`);
683
687
  }
684
688
 
@@ -390,7 +390,6 @@ class BotManager {
390
390
  if (decryptedConfig.proxyPassword) decryptedConfig.proxyPassword = decrypt(decryptedConfig.proxyPassword);
391
391
 
392
392
  if (decryptedConfig.proxyUsername) decryptedConfig.proxyUsername = decryptedConfig.proxyUsername.trim();
393
- if (decryptedConfig.proxyPassword) decryptedConfig.proxyPassword = decryptedConfig.proxyPassword.trim();
394
393
 
395
394
  const fullBotConfig = { ...decryptedConfig, plugins: sortedPlugins };
396
395
  const botProcessPath = path.resolve(__dirname, 'BotProcess.js');
@@ -187,9 +187,8 @@ process.on('message', async (message) => {
187
187
  if (config.proxyHost && config.proxyPort) {
188
188
  sendLog(`[System] Используется прокси: ${config.proxyHost}:${config.proxyPort}`);
189
189
 
190
- // Очищаем пароль от лишних символов
191
- const cleanProxyPassword = config.proxyPassword ? config.proxyPassword.trim() : null;
192
190
  const cleanProxyUsername = config.proxyUsername ? config.proxyUsername.trim() : null;
191
+ const cleanProxyPassword = config.proxyPassword || null;
193
192
 
194
193
  botOptions.connect = (client) => {
195
194
  SocksClient.createConnection({
@@ -8161,7 +8161,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
8161
8161
  To pick up a draggable item, press the space bar.
8162
8162
  While dragging, use the arrow keys to move the item.
8163
8163
  Press space again to drop the item in its new position, or press escape to cancel.
8164
- `},wtt={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Mtt(e){let{announcements:t=wtt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=btt}=e;const{announce:a,announcement:i}=xtt(),l=zy("DndLiveRegion"),[h,d]=g.useState(!1);if(g.useEffect(()=>{d(!0)},[]),vtt(g.useMemo(()=>({onDragStart(m){let{active:y}=m;a(t.onDragStart({active:y}))},onDragMove(m){let{active:y,over:v}=m;t.onDragMove&&a(t.onDragMove({active:y,over:v}))},onDragOver(m){let{active:y,over:v}=m;a(t.onDragOver({active:y,over:v}))},onDragEnd(m){let{active:y,over:v}=m;a(t.onDragEnd({active:y,over:v}))},onDragCancel(m){let{active:y,over:v}=m;a(t.onDragCancel({active:y,over:v}))}}),[a,t])),!h)return null;const f=ce.createElement(ce.Fragment,null,ce.createElement(ytt,{id:r,value:o.draggable}),ce.createElement(gtt,{id:l,announcement:i}));return n?Sa.createPortal(f,n):f}var br;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(br||(br={}));function kD(){}function lte(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Stt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const os=Object.freeze({x:0,y:0});function Tde(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ide(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Ctt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ute(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Rde(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function dte(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const _tt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=dte(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,h=n.get(l);if(h){const d=Tde(dte(h),o);a.push({id:l,data:{droppableContainer:i,value:d}})}}return a.sort(Ide)},Ntt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ute(t),a=[];for(const i of r){const{id:l}=i,h=n.get(l);if(h){const d=ute(h),f=o.reduce((y,v,b)=>y+Tde(d[b],v),0),m=Number((f/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:m}})}}return a.sort(Ide)};function jtt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=a-n;if(r<o&&n<a){const h=t.width*t.height,d=e.width*e.height,f=i*l,m=f/(h+d-f);return Number(m.toFixed(4))}return 0}const Ltt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const h=jtt(l,t);h>0&&o.push({id:i,data:{droppableContainer:a,value:h}})}}return o.sort(Ctt)};function Att(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function $de(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:os}function Ett(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const Ttt=Ett(1);function Itt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Rtt(e,t,n){const r=Itt(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:l}=r,h=e.left-i-(1-o)*parseFloat(n),d=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,m=a?e.height/a:e.height;return{width:f,height:m,top:d,right:h+f,bottom:d+m,left:h}}const $tt={ignoreTransform:!1};function a0(e,t){t===void 0&&(t=$tt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=bo(e).getComputedStyle(e);d&&(n=Rtt(n,d,f))}const{top:r,left:o,width:a,height:i,bottom:l,right:h}=n;return{top:r,left:o,width:a,height:i,bottom:l,right:h}}function hte(e){return a0(e,{ignoreTransform:!0})}function Ptt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Dtt(e,t){return t===void 0&&(t=bo(e).getComputedStyle(e)),t.position==="fixed"}function ztt(e,t){t===void 0&&(t=bo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?n.test(a):!1})}function zz(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(LX(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Py(o)||Lde(o)||n.includes(o))return n;const a=bo(e).getComputedStyle(o);return o!==e&&ztt(o,a)&&n.push(o),Dtt(o,a)?n:r(o.parentNode)}return e?r(e):n}function Pde(e){const[t]=zz(e,1);return t??null}function AV(e){return!Dz||!e?null:r0(e)?e:jX(e)?LX(e)||e===o0(e).scrollingElement?window:Py(e)?e:null:null}function Dde(e){return r0(e)?e.scrollX:e.scrollLeft}function zde(e){return r0(e)?e.scrollY:e.scrollTop}function nU(e){return{x:Dde(e),y:zde(e)}}var Lr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Lr||(Lr={}));function Ode(e){return!Dz||!e?!1:e===document.scrollingElement}function qde(e){const t={x:0,y:0},n=Ode(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const Ott={x:.2,y:.2};function qtt(e,t,n,r,o){let{top:a,left:i,right:l,bottom:h}=n;r===void 0&&(r=10),o===void 0&&(o=Ott);const{isTop:d,isBottom:f,isLeft:m,isRight:y}=qde(e),v={x:0,y:0},b={x:0,y:0},w={height:t.height*o.y,width:t.width*o.x};return!d&&a<=t.top+w.height?(v.y=Lr.Backward,b.y=r*Math.abs((t.top+w.height-a)/w.height)):!f&&h>=t.bottom-w.height&&(v.y=Lr.Forward,b.y=r*Math.abs((t.bottom-w.height-h)/w.height)),!y&&l>=t.right-w.width?(v.x=Lr.Forward,b.x=r*Math.abs((t.right-w.width-l)/w.width)):!m&&i<=t.left+w.width&&(v.x=Lr.Backward,b.x=r*Math.abs((t.left+w.width-i)/w.width)),{direction:v,speed:b}}function Htt(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Hde(e){return e.reduce((t,n)=>yp(t,nU(n)),os)}function Vtt(e){return e.reduce((t,n)=>t+Dde(n),0)}function Btt(e){return e.reduce((t,n)=>t+zde(n),0)}function Ftt(e,t){if(t===void 0&&(t=a0),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Pde(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Utt=[["x",["left","right"],Vtt],["y",["top","bottom"],Btt]];class TX{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=zz(n),o=Hde(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of Utt)for(const h of i)Object.defineProperty(this,h,{get:()=>{const d=l(r),f=o[a]-d;return this.rect[h]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vm{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Gtt(e){const{EventTarget:t}=bo(e);return e instanceof t?e:o0(e)}function EV(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var xa;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(xa||(xa={}));function fte(e){e.preventDefault()}function Xtt(e){e.stopPropagation()}var $t;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})($t||($t={}));const Vde={start:[$t.Space,$t.Enter],cancel:[$t.Esc],end:[$t.Space,$t.Enter,$t.Tab]},Wtt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $t.Right:return{...n,x:n.x+25};case $t.Left:return{...n,x:n.x-25};case $t.Down:return{...n,y:n.y+25};case $t.Up:return{...n,y:n.y-25}}};class IX{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new vm(o0(n)),this.windowListeners=new vm(bo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xa.Resize,this.handleCancel),this.windowListeners.add(xa.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xa.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ftt(r),n(os)}handleKeyDown(t){if(EX(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=Vde,coordinateGetter:i=Wtt,scrollBehavior:l="smooth"}=o,{code:h}=t;if(a.end.includes(h)){this.handleEnd(t);return}if(a.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:os;this.referenceCoordinates||(this.referenceCoordinates=f);const m=i(t,{active:n,context:r.current,currentCoordinates:f});if(m){const y=Om(m,f),v={x:0,y:0},{scrollableAncestors:b}=r.current;for(const w of b){const C=t.code,{isTop:S,isRight:N,isLeft:L,isBottom:j,maxScroll:E,minScroll:_}=qde(w),$=Htt(w),R={x:Math.min(C===$t.Right?$.right-$.width/2:$.right,Math.max(C===$t.Right?$.left:$.left+$.width/2,m.x)),y:Math.min(C===$t.Down?$.bottom-$.height/2:$.bottom,Math.max(C===$t.Down?$.top:$.top+$.height/2,m.y))},V=C===$t.Right&&!N||C===$t.Left&&!L,A=C===$t.Down&&!j||C===$t.Up&&!S;if(V&&R.x!==m.x){const q=w.scrollLeft+y.x,z=C===$t.Right&&q<=E.x||C===$t.Left&&q>=_.x;if(z&&!y.y){w.scrollTo({left:q,behavior:l});return}z?v.x=w.scrollLeft-q:v.x=C===$t.Right?w.scrollLeft-E.x:w.scrollLeft-_.x,v.x&&w.scrollBy({left:-v.x,behavior:l});break}else if(A&&R.y!==m.y){const q=w.scrollTop+y.y,z=C===$t.Down&&q<=E.y||C===$t.Up&&q>=_.y;if(z&&!y.x){w.scrollTo({top:q,behavior:l});return}z?v.y=w.scrollTop-q:v.y=C===$t.Down?w.scrollTop-E.y:w.scrollTop-_.y,v.y&&w.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,yp(Om(m,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}IX.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Vde,onActivation:o}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function pte(e){return!!(e&&"distance"in e)}function mte(e){return!!(e&&"delay"in e)}class RX{constructor(t,n,r){var o;r===void 0&&(r=Gtt(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=o0(i),this.documentListeners=new vm(this.document),this.listeners=new vm(r),this.windowListeners=new vm(bo(i)),this.initialCoordinates=(o=tU(a))!=null?o:os,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(xa.Resize,this.handleCancel),this.windowListeners.add(xa.DragStart,fte),this.windowListeners.add(xa.VisibilityChange,this.handleCancel),this.windowListeners.add(xa.ContextMenu,fte),this.documentListeners.add(xa.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mte(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(pte(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(xa.Click,Xtt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xa.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const h=(n=tU(t))!=null?n:os,d=Om(o,h);if(!r&&l){if(pte(l)){if(l.tolerance!=null&&EV(d,l.tolerance))return this.handleCancel();if(EV(d,l.distance))return this.handleStart()}if(mte(l)&&EV(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===$t.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ktt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $X extends RX{constructor(t){const{event:n}=t,r=o0(n.target);super(t,Ktt,r)}}$X.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Ytt={move:{name:"mousemove"},end:{name:"mouseup"}};var rU;(function(e){e[e.RightClick=2]="RightClick"})(rU||(rU={}));class Ztt extends RX{constructor(t){super(t,Ytt,o0(t.event.target))}}Ztt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===rU.RightClick?!1:(r==null||r({event:n}),!0)}}];const TV={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Jtt extends RX{constructor(t){super(t,TV)}static setup(){return window.addEventListener(TV.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(TV.move.name,t)};function t(){}}}Jtt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var km;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(km||(km={}));var bD;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bD||(bD={}));function Qtt(e){let{acceleration:t,activator:n=km.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:l=bD.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:f,delta:m,threshold:y}=e;const v=tnt({delta:m,disabled:!a}),[b,w]=dtt(),C=g.useRef({x:0,y:0}),S=g.useRef({x:0,y:0}),N=g.useMemo(()=>{switch(n){case km.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case km.DraggableRect:return o}},[n,o,h]),L=g.useRef(null),j=g.useCallback(()=>{const _=L.current;if(!_)return;const $=C.current.x*S.current.x,R=C.current.y*S.current.y;_.scrollBy($,R)},[]),E=g.useMemo(()=>l===bD.TreeOrder?[...d].reverse():d,[l,d]);g.useEffect(()=>{if(!a||!d.length||!N){w();return}for(const _ of E){if((r==null?void 0:r(_))===!1)continue;const $=d.indexOf(_),R=f[$];if(!R)continue;const{direction:V,speed:A}=qtt(_,R,N,t,y);for(const q of["x","y"])v[q][V[q]]||(A[q]=0,V[q]=0);if(A.x>0||A.y>0){w(),L.current=_,b(j,i),C.current=A,S.current=V;return}}C.current={x:0,y:0},S.current={x:0,y:0},w()},[t,j,r,w,a,i,JSON.stringify(N),JSON.stringify(v),b,d,E,f,JSON.stringify(y)])}const ent={x:{[Lr.Backward]:!1,[Lr.Forward]:!1},y:{[Lr.Backward]:!1,[Lr.Forward]:!1}};function tnt(e){let{delta:t,disabled:n}=e;const r=eU(t);return Dy(o=>{if(n||!r||!o)return ent;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Lr.Backward]:o.x[Lr.Backward]||a.x===-1,[Lr.Forward]:o.x[Lr.Forward]||a.x===1},y:{[Lr.Backward]:o.y[Lr.Backward]||a.y===-1,[Lr.Forward]:o.y[Lr.Forward]||a.y===1}}},[n,t,r])}function nnt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Dy(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function rnt(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...a]},[]),[e,t])}var Hm;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Hm||(Hm={}));var oU;(function(e){e.Optimized="optimized"})(oU||(oU={}));const yte=new Map;function ont(e,t){let{dragging:n,dependencies:r,config:o}=t;const[a,i]=g.useState(null),{frequency:l,measure:h,strategy:d}=o,f=g.useRef(e),m=C(),y=zm(m),v=g.useCallback(function(S){S===void 0&&(S=[]),!y.current&&i(N=>N===null?S:N.concat(S.filter(L=>!N.includes(L))))},[y]),b=g.useRef(null),w=Dy(S=>{if(m&&!n)return yte;if(!S||S===yte||f.current!==e||a!=null){const N=new Map;for(let L of e){if(!L)continue;if(a&&a.length>0&&!a.includes(L.id)&&L.rect.current){N.set(L.id,L.rect.current);continue}const j=L.node.current,E=j?new TX(h(j),j):null;L.rect.current=E,E&&N.set(L.id,E)}return N}return S},[e,a,n,m,h]);return g.useEffect(()=>{f.current=e},[e]),g.useEffect(()=>{m||v()},[n,m]),g.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),g.useEffect(()=>{m||typeof l!="number"||b.current!==null||(b.current=setTimeout(()=>{v(),b.current=null},l))},[l,m,v,...r]),{droppableRects:w,measureDroppableContainers:v,measuringScheduled:a!=null};function C(){switch(d){case Hm.Always:return!1;case Hm.BeforeDragging:return n;default:return!n}}}function Bde(e,t){return Dy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ant(e,t){return Bde(e,t)}function snt(e){let{callback:t,disabled:n}=e;const r=AX(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Oz(e){let{callback:t,disabled:n}=e;const r=AX(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function int(e){return new TX(a0(e),e)}function gte(e,t,n){t===void 0&&(t=int);const[r,o]=g.useState(null);function a(){o(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const f=t(e);return JSON.stringify(h)===JSON.stringify(f)?h:f})}const i=snt({callback(h){if(e)for(const d of h){const{type:f,target:m}=d;if(f==="childList"&&m instanceof HTMLElement&&m.contains(e)){a();break}}}}),l=Oz({callback:a});return Xs(()=>{a(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),r}function cnt(e){const t=Bde(e);return $de(e,t)}const xte=[];function lnt(e){const t=g.useRef(e),n=Dy(r=>e?r&&r!==xte&&e&&t.current&&e.parentNode===t.current.parentNode?r:zz(e):xte,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function unt(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(a=>{const i=AV(a.target);i&&n(l=>l?(l.set(i,nU(i)),new Map(l)):null)},[]);return g.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(h=>{const d=AV(h);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,nU(d)]):null}).filter(h=>h!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(h=>{const d=AV(h);d==null||d.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>yp(a,i),os):Hde(e):os,[e,t])}function vte(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==os;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Om(e,n.current):os}function dnt(e){g.useEffect(()=>{if(!Dz)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function hnt(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=i=>{a(i,t)},n},{}),[e,t])}function Fde(e){return g.useMemo(()=>e?Ptt(e):null,[e])}const kte=[];function fnt(e,t){t===void 0&&(t=a0);const[n]=e,r=Fde(n?bo(n):null),[o,a]=g.useState(kte);function i(){a(()=>e.length?e.map(h=>Ode(h)?r:new TX(t(h),h)):kte)}const l=Oz({callback:i});return Xs(()=>{l==null||l.disconnect(),i(),e.forEach(h=>l==null?void 0:l.observe(h))},[e]),o}function pnt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Py(t)?t:e}function mnt(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(d=>{for(const{target:f}of d)if(Py(f)){r(m=>{const y=t(f);return m?{...m,width:y.width,height:y.height}:y});break}},[t]),a=Oz({callback:o}),i=g.useCallback(d=>{const f=pnt(d);a==null||a.disconnect(),f&&(a==null||a.observe(f)),r(f?t(f):null)},[t,a]),[l,h]=vD(i);return g.useMemo(()=>({nodeRef:l,rect:n,setRef:h}),[n,l,h])}const ynt=[{sensor:$X,options:{}},{sensor:IX,options:{}}],gnt={current:{}},IP={draggable:{measure:hte},droppable:{measure:hte,strategy:Hm.WhileDragging,frequency:oU.Optimized},dragOverlay:{measure:a0}};class bm extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const xnt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kD},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:IP,measureDroppableContainers:kD,windowRect:null,measuringScheduled:!1},vnt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kD,draggableNodes:new Map,over:null,measureDroppableContainers:kD},qz=g.createContext(vnt),Ude=g.createContext(xnt);function knt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bm}}}function bnt(e,t){switch(t.type){case br.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case br.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case br.DragEnd:case br.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case br.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new bm(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case br.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new bm(e.droppable.containers);return i.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case br.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new bm(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function wnt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(qz),a=eU(r),i=eU(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!EX(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:h,node:d}=l;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[h.current,d.current]){if(!f)continue;const m=ptt(f);if(m){m.focus();break}}})}},[r,t,o,i,a]),null}function Mnt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function Snt(e){return g.useMemo(()=>({draggable:{...IP.draggable,...e==null?void 0:e.draggable},droppable:{...IP.droppable,...e==null?void 0:e.droppable},dragOverlay:{...IP.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Cnt(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const a=g.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;Xs(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),m=$de(f,r);if(i||(m.x=0),l||(m.y=0),a.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const y=Pde(d);y&&y.scrollBy({top:m.y,left:m.x})}},[t,i,l,r,n])}const Gde=g.createContext({...os,scaleX:1,scaleY:1});var bc;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(bc||(bc={}));const _nt=g.memo(function(t){var n,r,o,a;let{id:i,accessibility:l,autoScroll:h=!0,children:d,sensors:f=ynt,collisionDetection:m=Ltt,measuring:y,modifiers:v,...b}=t;const w=g.useReducer(bnt,void 0,knt),[C,S]=w,[N,L]=ktt(),[j,E]=g.useState(bc.Uninitialized),_=j===bc.Initialized,{draggable:{active:$,nodes:R,translate:V},droppable:{containers:A}}=C,q=$!=null?R.get($):null,z=g.useRef({initial:null,translated:null}),B=g.useMemo(()=>{var gn;return $!=null?{id:$,data:(gn=q==null?void 0:q.data)!=null?gn:gnt,rect:z}:null},[$,q]),P=g.useRef(null),[H,D]=g.useState(null),[U,W]=g.useState(null),K=zm(b,Object.values(b)),I=zy("DndDescribedBy",i),G=g.useMemo(()=>A.getEnabled(),[A]),X=Snt(y),{droppableRects:O,measureDroppableContainers:Q,measuringScheduled:ne}=ont(G,{dragging:_,dependencies:[V.x,V.y],config:X.droppable}),re=nnt(R,$),Z=g.useMemo(()=>U?tU(U):null,[U]),J=aa(),ae=ant(re,X.draggable.measure);Cnt({activeNode:$!=null?R.get($):null,config:J.layoutShiftCompensation,initialRect:ae,measure:X.draggable.measure});const ee=gte(re,X.draggable.measure,ae),Me=gte(re?re.parentElement:null),we=g.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:O,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=A.getNodeFor((n=we.current.over)==null?void 0:n.id),je=mnt({measure:X.dragOverlay.measure}),qe=(r=je.nodeRef.current)!=null?r:re,Ze=_?(o=je.rect)!=null?o:ee:null,De=!!(je.nodeRef.current&&je.rect),Re=cnt(De?null:ee),_t=Fde(qe?bo(qe):null),Qt=lnt(_?Te??re:null),fn=fnt(Qt),Ve=Mnt(v,{transform:{x:V.x-Re.x,y:V.y-Re.y,scaleX:1,scaleY:1},activatorEvent:U,active:B,activeNodeRect:ee,containerNodeRect:Me,draggingNodeRect:Ze,over:we.current.over,overlayNodeRect:je.rect,scrollableAncestors:Qt,scrollableAncestorRects:fn,windowRect:_t}),Vn=Z?yp(Z,V):null,mr=unt(Qt),qr=vte(mr),ge=vte(mr,[ee]),Se=yp(Ve,qr),He=Ze?Ttt(Ze,Ve):null,Be=B&&He?m({active:B,collisionRect:He,droppableRects:O,droppableContainers:G,pointerCoordinates:Vn}):null,gt=Rde(Be,"id"),[dt,pn]=g.useState(null),mn=De?Ve:yp(Ve,ge),$n=Att(mn,(a=dt==null?void 0:dt.rect)!=null?a:null,ee),yn=g.useRef(null),Pt=g.useCallback((gn,Sn)=>{let{sensor:Dn,options:Sr}=Sn;if(P.current==null)return;const ir=R.get(P.current);if(!ir)return;const Qn=gn.nativeEvent,oe=new Dn({active:P.current,activeNode:ir,event:Qn,options:Sr,context:we,onAbort(de){if(!R.get(de))return;const{onDragAbort:Ae}=K.current,ze={id:de};Ae==null||Ae(ze),N({type:"onDragAbort",event:ze})},onPending(de,be,Ae,ze){if(!R.get(de))return;const{onDragPending:Oe}=K.current,Fe={id:de,constraint:be,initialCoordinates:Ae,offset:ze};Oe==null||Oe(Fe),N({type:"onDragPending",event:Fe})},onStart(de){const be=P.current;if(be==null)return;const Ae=R.get(be);if(!Ae)return;const{onDragStart:ze}=K.current,Qe={activatorEvent:Qn,active:{id:be,data:Ae.data,rect:z}};Sa.unstable_batchedUpdates(()=>{ze==null||ze(Qe),E(bc.Initializing),S({type:br.DragStart,initialCoordinates:de,active:be}),N({type:"onDragStart",event:Qe}),D(yn.current),W(Qn)})},onMove(de){S({type:br.DragMove,coordinates:de})},onEnd:le(br.DragEnd),onCancel:le(br.DragCancel)});yn.current=oe;function le(de){return async function(){const{active:Ae,collisions:ze,over:Qe,scrollAdjustedTranslate:Oe}=we.current;let Fe=null;if(Ae&&Oe){const{cancelDrop:Ke}=K.current;Fe={activatorEvent:Qn,active:Ae,collisions:ze,delta:Oe,over:Qe},de===br.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(Fe))&&(de=br.DragCancel)}P.current=null,Sa.unstable_batchedUpdates(()=>{S({type:de}),E(bc.Uninitialized),pn(null),D(null),W(null),yn.current=null;const Ke=de===br.DragEnd?"onDragEnd":"onDragCancel";if(Fe){const rt=K.current[Ke];rt==null||rt(Fe),N({type:Ke,event:Fe})}})}}},[R]),Yt=g.useCallback((gn,Sn)=>(Dn,Sr)=>{const ir=Dn.nativeEvent,Qn=R.get(Sr);if(P.current!==null||!Qn||ir.dndKit||ir.defaultPrevented)return;const oe={active:Qn};gn(Dn,Sn.options,oe)===!0&&(ir.dndKit={capturedBy:Sn.sensor},P.current=Sr,Pt(Dn,Sn))},[R,Pt]),Pn=rnt(f,Yt);dnt(f),Xs(()=>{ee&&j===bc.Initializing&&E(bc.Initialized)},[ee,j]),g.useEffect(()=>{const{onDragMove:gn}=K.current,{active:Sn,activatorEvent:Dn,collisions:Sr,over:ir}=we.current;if(!Sn||!Dn)return;const Qn={active:Sn,activatorEvent:Dn,collisions:Sr,delta:{x:Se.x,y:Se.y},over:ir};Sa.unstable_batchedUpdates(()=>{gn==null||gn(Qn),N({type:"onDragMove",event:Qn})})},[Se.x,Se.y]),g.useEffect(()=>{const{active:gn,activatorEvent:Sn,collisions:Dn,droppableContainers:Sr,scrollAdjustedTranslate:ir}=we.current;if(!gn||P.current==null||!Sn||!ir)return;const{onDragOver:Qn}=K.current,oe=Sr.get(gt),le=oe&&oe.rect.current?{id:oe.id,rect:oe.rect.current,data:oe.data,disabled:oe.disabled}:null,de={active:gn,activatorEvent:Sn,collisions:Dn,delta:{x:ir.x,y:ir.y},over:le};Sa.unstable_batchedUpdates(()=>{pn(le),Qn==null||Qn(de),N({type:"onDragOver",event:de})})},[gt]),Xs(()=>{we.current={activatorEvent:U,active:B,activeNode:re,collisionRect:He,collisions:Be,droppableRects:O,draggableNodes:R,draggingNode:qe,draggingNodeRect:Ze,droppableContainers:A,over:dt,scrollableAncestors:Qt,scrollAdjustedTranslate:Se},z.current={initial:Ze,translated:He}},[B,re,Be,He,R,qe,Ze,O,A,dt,Qt,Se]),Qtt({...J,delta:V,draggingRect:He,pointerCoordinates:Vn,scrollableAncestors:Qt,scrollableAncestorRects:fn});const ra=g.useMemo(()=>({active:B,activeNode:re,activeNodeRect:ee,activatorEvent:U,collisions:Be,containerNodeRect:Me,dragOverlay:je,draggableNodes:R,droppableContainers:A,droppableRects:O,over:dt,measureDroppableContainers:Q,scrollableAncestors:Qt,scrollableAncestorRects:fn,measuringConfiguration:X,measuringScheduled:ne,windowRect:_t}),[B,re,ee,U,Be,Me,je,R,A,O,dt,Q,Qt,fn,X,ne,_t]),oa=g.useMemo(()=>({activatorEvent:U,activators:Pn,active:B,activeNodeRect:ee,ariaDescribedById:{draggable:I},dispatch:S,draggableNodes:R,over:dt,measureDroppableContainers:Q}),[U,Pn,B,ee,S,I,R,dt,Q]);return ce.createElement(Ede.Provider,{value:L},ce.createElement(qz.Provider,{value:oa},ce.createElement(Ude.Provider,{value:ra},ce.createElement(Gde.Provider,{value:$n},d)),ce.createElement(wnt,{disabled:(l==null?void 0:l.restoreFocus)===!1})),ce.createElement(Mtt,{...l,hiddenTextDescribedById:I}));function aa(){const gn=(H==null?void 0:H.autoScrollEnabled)===!1,Sn=typeof h=="object"?h.enabled===!1:h===!1,Dn=_&&!gn&&!Sn;return typeof h=="object"?{...h,enabled:Dn}:{enabled:Dn}}}),Nnt=g.createContext(null),bte="button",jnt="Draggable";function Lnt(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=zy(jnt),{activators:i,activatorEvent:l,active:h,activeNodeRect:d,ariaDescribedById:f,draggableNodes:m,over:y}=g.useContext(qz),{role:v=bte,roleDescription:b="draggable",tabIndex:w=0}=o??{},C=(h==null?void 0:h.id)===t,S=g.useContext(C?Gde:Nnt),[N,L]=vD(),[j,E]=vD(),_=hnt(i,t),$=zm(n);Xs(()=>(m.set(t,{id:t,key:a,node:N,activatorNode:j,data:$}),()=>{const V=m.get(t);V&&V.key===a&&m.delete(t)}),[m,t]);const R=g.useMemo(()=>({role:v,tabIndex:w,"aria-disabled":r,"aria-pressed":C&&v===bte?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[r,v,w,C,b,f.draggable]);return{active:h,activatorEvent:l,activeNodeRect:d,attributes:R,isDragging:C,listeners:r?void 0:_,node:N,over:y,setNodeRef:L,setActivatorNodeRef:E,transform:S}}function Ant(){return g.useContext(Ude)}const Ent="Droppable",Tnt={timeout:25};function Int(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=zy(Ent),{active:i,dispatch:l,over:h,measureDroppableContainers:d}=g.useContext(qz),f=g.useRef({disabled:n}),m=g.useRef(!1),y=g.useRef(null),v=g.useRef(null),{disabled:b,updateMeasurementsFor:w,timeout:C}={...Tnt,...o},S=zm(w??r),N=g.useCallback(()=>{if(!m.current){m.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),v.current=null},C)},[C]),L=Oz({callback:N,disabled:b||!i}),j=g.useCallback((R,V)=>{L&&(V&&(L.unobserve(V),m.current=!1),R&&L.observe(R))},[L]),[E,_]=vD(j),$=zm(t);return g.useEffect(()=>{!L||!E.current||(L.disconnect(),m.current=!1,L.observe(E.current))},[E,L]),g.useEffect(()=>(l({type:br.RegisterDroppable,element:{id:r,key:a,disabled:n,node:E,rect:y,data:$}}),()=>l({type:br.UnregisterDroppable,key:a,id:r})),[r]),g.useEffect(()=>{n!==f.current.disabled&&(l({type:br.SetDroppableDisabled,id:r,key:a,disabled:n}),f.current.disabled=n)},[r,a,n,l]),{active:i,rect:y,isOver:(h==null?void 0:h.id)===r,node:E,over:h,setNodeRef:_}}function PX(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Rnt(e,t){return e.reduce((n,r,o)=>{const a=t.get(r);return a&&(n[o]=a),n},Array(e.length))}function Cx(e){return e!==null&&e>=0}function $nt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pnt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Xde=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=PX(t,r,n),i=t[o],l=a[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},_x={scaleX:1,scaleY:1},Dnt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:a,overIndex:i}=e;const l=(t=a[n])!=null?t:r;if(!l)return null;if(o===n){const d=a[i];return d?{x:0,y:n<i?d.top+d.height-(l.top+l.height):d.top-l.top,..._x}:null}const h=znt(a,o,n);return o>n&&o<=i?{x:0,y:-l.height-h,..._x}:o<n&&o>=i?{x:0,y:l.height+h,..._x}:{x:0,y:0,..._x}};function znt(e,t,n){const r=e[t],o=e[t-1],a=e[t+1];return r?n<t?o?r.top-(o.top+o.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const Wde="Sortable",Kde=ce.createContext({activeIndex:-1,containerId:Wde,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Xde,disabled:{draggable:!1,droppable:!1}});function Ont(e){let{children:t,id:n,items:r,strategy:o=Xde,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:h,over:d,measureDroppableContainers:f}=Ant(),m=zy(Wde,n),y=l.rect!==null,v=g.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),b=i!=null,w=i?v.indexOf(i.id):-1,C=d?v.indexOf(d.id):-1,S=g.useRef(v),N=!$nt(v,S.current),L=C!==-1&&w===-1||N,j=Pnt(a);Xs(()=>{N&&b&&f(v)},[N,v,b,f]),g.useEffect(()=>{S.current=v},[v]);const E=g.useMemo(()=>({activeIndex:w,containerId:m,disabled:j,disableTransforms:L,items:v,overIndex:C,useDragOverlay:y,sortedRects:Rnt(v,h),strategy:o}),[w,m,j.draggable,j.droppable,L,v,C,h,y,o]);return ce.createElement(Kde.Provider,{value:E},t)}const qnt=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return PX(n,r,o).indexOf(t)},Hnt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:h,transition:d}=e;return!d||!r||l!==a&&o===i?!1:n?!0:i!==o&&t===h},Vnt={duration:200,easing:"ease"},Yde="transform",Bnt=qm.Transition.toString({property:Yde,duration:0,easing:"linear"}),Fnt={roleDescription:"sortable"};function Unt(e){let{disabled:t,index:n,node:r,rect:o}=e;const[a,i]=g.useState(null),l=g.useRef(n);return Xs(()=>{if(!t&&n!==l.current&&r.current){const h=o.current;if(h){const d=a0(r.current,{ignoreTransform:!0}),f={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(f.x||f.y)&&i(f)}}n!==l.current&&(l.current=n)},[t,n,r,o]),g.useEffect(()=>{a&&i(null)},[a]),a}function Gnt(e){let{animateLayoutChanges:t=Hnt,attributes:n,disabled:r,data:o,getNewIndex:a=qnt,id:i,strategy:l,resizeObserverConfig:h,transition:d=Vnt}=e;const{items:f,containerId:m,activeIndex:y,disabled:v,disableTransforms:b,sortedRects:w,overIndex:C,useDragOverlay:S,strategy:N}=g.useContext(Kde),L=Xnt(r,v),j=f.indexOf(i),E=g.useMemo(()=>({sortable:{containerId:m,index:j,items:f},...o}),[m,o,j,f]),_=g.useMemo(()=>f.slice(f.indexOf(i)),[f,i]),{rect:$,node:R,isOver:V,setNodeRef:A}=Int({id:i,data:E,disabled:L.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...h}}),{active:q,activatorEvent:z,activeNodeRect:B,attributes:P,setNodeRef:H,listeners:D,isDragging:U,over:W,setActivatorNodeRef:K,transform:I}=Lnt({id:i,data:E,attributes:{...Fnt,...n},disabled:L.draggable}),G=utt(A,H),X=!!q,O=X&&!b&&Cx(y)&&Cx(C),Q=!S&&U,ne=Q&&O?I:null,Z=O?ne??(l??N)({rects:w,activeNodeRect:B,activeIndex:y,overIndex:C,index:j}):null,J=Cx(y)&&Cx(C)?a({id:i,items:f,activeIndex:y,overIndex:C}):j,ae=q==null?void 0:q.id,ee=g.useRef({activeId:ae,items:f,newIndex:J,containerId:m}),Me=f!==ee.current.items,we=t({active:q,containerId:m,isDragging:U,isSorting:X,id:i,index:j,items:f,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:d,wasDragging:ee.current.activeId!=null}),Te=Unt({disabled:!we,index:j,node:R,rect:$});return g.useEffect(()=>{X&&ee.current.newIndex!==J&&(ee.current.newIndex=J),m!==ee.current.containerId&&(ee.current.containerId=m),f!==ee.current.items&&(ee.current.items=f)},[X,J,m,f]),g.useEffect(()=>{if(ae===ee.current.activeId)return;if(ae!=null&&ee.current.activeId==null){ee.current.activeId=ae;return}const qe=setTimeout(()=>{ee.current.activeId=ae},50);return()=>clearTimeout(qe)},[ae]),{active:q,activeIndex:y,attributes:P,data:E,rect:$,index:j,newIndex:J,items:f,isOver:V,isSorting:X,isDragging:U,listeners:D,node:R,overIndex:C,over:W,setNodeRef:G,setActivatorNodeRef:K,setDroppableNodeRef:A,setDraggableNodeRef:H,transform:Te??Z,transition:je()};function je(){if(Te||Me&&ee.current.newIndex===j)return Bnt;if(!(Q&&!EX(z)||!d)&&(X||we))return qm.Transition.toString({...d,property:Yde})}}function Xnt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function wD(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Wnt=[$t.Down,$t.Right,$t.Up,$t.Left],Knt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(Wnt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const h=[];a.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const y=o.get(m.id);if(y)switch(e.code){case $t.Down:r.top<y.top&&h.push(m);break;case $t.Up:r.top>y.top&&h.push(m);break;case $t.Left:r.left>y.left&&h.push(m);break;case $t.Right:r.left<y.left&&h.push(m);break}});const d=Ntt({collisionRect:r,droppableRects:o,droppableContainers:h});let f=Rde(d,"id");if(f===(i==null?void 0:i.id)&&d.length>1&&(f=d[1].id),f!=null){const m=a.get(n.id),y=a.get(f),v=y?o.get(y.id):null,b=y==null?void 0:y.node.current;if(b&&v&&m&&y){const C=zz(b).some((_,$)=>l[$]!==_),S=Zde(m,y),N=Ynt(m,y),L=C||!S?{x:0,y:0}:{x:N?r.width-v.width:0,y:N?r.height-v.height:0},j={x:v.left,y:v.top};return L.x&&L.y?j:Om(j,L)}}}};function Zde(e,t){return!wD(e)||!wD(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Ynt(e,t){return!wD(e)||!wD(t)||!Zde(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Znt({onClose:e}){return s.jsxs(Et,{className:"max-w-3xl",children:[s.jsx(qt,{children:s.jsx(Tt,{children:"Предложить улучшение или задать вопрос"})}),s.jsxs("div",{className:"py-4 space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Здесь небольшой гайд о том, как задавать/предлагать свои запросы правильно."}),s.jsx("p",{children:'Для того чтобы задать вопрос, сообщить об ошибке или предложить новую идею, перейдите на нашу страницу GitHub Issues. Нажмите на кнопку "New issue" и выберите подходящий шаблон. Для обычного вопроса можно создать пустой issue.'}),s.jsx("div",{className:"border rounded-lg overflow-hidden mt-4",children:s.jsx("img",{src:"/create_issue.png",alt:"How to create a GitHub issue",width:"1263",height:"622",className:"w-full h-auto"})})]}),s.jsxs(Kt,{children:[s.jsx(ie,{variant:"ghost",onClick:e,children:"Закрыть"}),s.jsx(ie,{asChild:!0,children:s.jsxs("a",{href:"https://github.com/blockmineJS/blockmine/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Перейти на GitHub"]})})]})]})}const Jnt=({bot:e,isCollapsed:t,botStatuses:n,onLinkClick:r,isDragging:o})=>{const{attributes:a,listeners:i,setNodeRef:l,transform:h,transition:d,isDragging:f}=Gnt({id:e.id}),m={transform:qm.Transform.toString(h),transition:d,opacity:f?.5:1},y=v=>{if(f||o)return v.preventDefault(),v.stopPropagation(),!1;r(v)};return s.jsx("div",{ref:l,style:m,...a,...i,onMouseDown:v=>{(f||o)&&(v.preventDefault(),v.stopPropagation())},children:s.jsxs(Kr,{to:`/bots/${e.id}`,onClick:y,"data-bot-id":e.id,className:({isActive:v})=>pe("flex items-center gap-2 rounded-md px-2 py-1.5 text-xs transition-all duration-200 ease-in-out cursor-move",v?"bg-gradient-to-r from-green-500/10 to-emerald-500/10 border border-green-500/20 text-green-600 shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted/50 hover:shadow-sm",t&&"justify-center"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:pe("w-1.5 h-1.5 rounded-full transition-all duration-200",n[e.id]==="running"?"bg-green-500 animate-pulse":"bg-gray-500")}),t&&s.jsx("div",{className:"w-5 h-5 bg-gradient-to-r from-blue-500 to-purple-500 rounded-md flex items-center justify-center shadow-sm",children:s.jsx("span",{className:"text-xs font-bold text-white",children:e.username.charAt(0).toUpperCase()})})]}),s.jsxs("div",{className:pe("flex flex-col overflow-hidden",t&&"hidden"),children:[s.jsx("span",{className:"font-medium truncate text-xs",children:e.username}),s.jsx("span",{className:"text-xs text-muted-foreground truncate leading-tight",children:e.note||`${e.server.host}:${e.server.port}`})]})]})})},Qnt=({bot:e,isCollapsed:t,botStatuses:n,onLinkClick:r})=>s.jsxs(Kr,{to:`/bots/${e.id}`,onClick:r,"data-bot-id":e.id,className:({isActive:o})=>pe("flex items-center gap-2 rounded-md px-2 py-1.5 text-xs transition-all duration-200 ease-in-out cursor-pointer",o?"bg-gradient-to-r from-green-500/10 to-emerald-500/10 border border-green-500/20 text-green-600 shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted/50 hover:shadow-sm",t&&"justify-center"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:pe("w-1.5 h-1.5 rounded-full transition-all duration-200",n[e.id]==="running"?"bg-green-500 animate-pulse":"bg-gray-500")}),t&&s.jsx("div",{className:"w-5 h-5 bg-gradient-to-r from-blue-500 to-purple-500 rounded-md flex items-center justify-center shadow-sm",children:s.jsx("span",{className:"text-xs font-bold text-white",children:e.username.charAt(0).toUpperCase()})})]}),s.jsxs("div",{className:pe("flex flex-col overflow-hidden",t&&"hidden"),children:[s.jsx("span",{className:"font-medium truncate text-xs",children:e.username}),s.jsx("span",{className:"text-xs text-muted-foreground truncate leading-tight",children:e.note||`${e.server.host}:${e.server.port}`})]})]}),ert=({onLinkClick:e,isCollapsed:t,isSheetOpen:n})=>{var E;const r=Le(_=>_.bots),o=Le(_=>_.botStatuses),a=Le(_=>_.hasPermission),i=Le(_=>_.updateBotOrder),l=Ea();Er();const{toast:h}=Jt(),[d,f]=g.useState(!1),[m,y]=g.useState({text:"Улучшить BlockMine",icon:s.jsx(ap,{className:"h-4 w-4 flex-shrink-0"})}),[v,b]=g.useState(!1);g.useEffect(()=>{const _=["Предложить улучшение","Предложить изменение","Задать вопрос","Улучшить BlockMine"],$=[s.jsx(ap,{className:"h-4 w-4 flex-shrink-0"},"lightbulb"),s.jsx(rm,{className:"h-4 w-4 flex-shrink-0"},"msg")],R=_[Math.floor(Math.random()*_.length)],V=$[Math.floor(Math.random()*$.length)];y({text:R,icon:V})},[]);const w=(E=l.pathname.match(/\/bots\/(\d+)/))==null?void 0:E[1],C=Stt(lte($X,{activationConstraint:{distance:12}}),lte(IX,{coordinateGetter:Knt})),S=g.useCallback(_=>{n||f(!0)},[n]),N=g.useCallback(async _=>{const{active:$,over:R}=_;if(setTimeout(()=>f(!1),100),$.id!==R.id){const V=r.findIndex(z=>z.id===$.id),A=r.findIndex(z=>z.id===R.id),q=[...r];try{await new Promise(P=>setTimeout(P,50));const z=PX(r,V,A);i(z);const B=await Ne(`/api/bots/${$.id}/sort-order`,{method:"PUT",body:JSON.stringify({newPosition:A+1})})}catch(z){console.error("[Drag] Ошибка:",z),i(q),h({title:"Ошибка",description:"Не удалось обновить порядок ботов",variant:"destructive"})}}},[r,i,h]);g.useEffect(()=>{n&&f(!1)},[n]),g.useEffect(()=>{if(w){const _=document.querySelector(`[data-bot-id="${w}"]`),$=_==null?void 0:_.closest(".custom-scrollbar");_&&$&&setTimeout(()=>{const R=$.getBoundingClientRect(),V=_.getBoundingClientRect();V.top>=R.top&&V.bottom<=R.bottom||_.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}},[w,r]),g.useEffect(()=>{const _=V=>{if(d&&!n)return V.preventDefault(),V.returnValue="",""},$=V=>{if(d&&!n)return V.preventDefault(),V.stopPropagation(),!1},R=V=>{if(d&&!n)return V.preventDefault(),V.stopPropagation(),!1};if(d&&!n)return window.addEventListener("beforeunload",_),document.addEventListener("click",$,!0),document.addEventListener("mousedown",R,!0),()=>{window.removeEventListener("beforeunload",_),document.removeEventListener("click",$,!0),document.removeEventListener("mousedown",R,!0)}},[d,n]);const L=({isActive:_})=>pe("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all",_?"bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/20 text-blue-600":"text-muted-foreground hover:text-foreground hover:bg-muted/50",t&&"justify-center"),j=(_,$)=>s.jsxs(s.Fragment,{children:[_,s.jsx("span",{className:pe("truncate",t&&"hidden"),children:$})]});return s.jsxs("nav",{className:"flex-1 flex flex-col gap-1 p-4 min-h-0 overflow-y-auto md:overflow-visible pb-20 md:pb-0 overscroll-contain",children:[s.jsx(Kr,{to:"/",end:!0,onClick:e,className:L,children:j(s.jsx(c1,{className:"h-4 w-4 flex-shrink-0"}),"Дашборд")}),a("task:list")&&s.jsx(Kr,{to:"/tasks",onClick:e,className:L,children:j(s.jsx(Ts,{className:"h-4 w-4 flex-shrink-0"}),"Планировщик")}),s.jsx(Kr,{to:"/graph-store",onClick:e,className:L,children:j(s.jsx(hm,{className:"h-4 w-4 flex-shrink-0"}),"Магазин графов")}),a("bot:update")&&s.jsx(Kr,{to:"/proxy-config",onClick:e,className:L,children:j(s.jsx($s,{className:"h-4 w-4 flex-shrink-0"}),"Прокси")}),s.jsxs(Ot,{open:v,onOpenChange:b,children:[s.jsx(yo,{asChild:!0,children:s.jsx(ie,{variant:"ghost",className:pe("w-full justify-start flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all text-muted-foreground hover:text-foreground hover:bg-muted/50",t&&"justify-center"),onClick:()=>{b(!0),typeof e=="function"&&e()},children:j(m.icon,m.text)})}),s.jsx(Znt,{onClose:()=>b(!1)})]}),s.jsx(ie,{variant:"ghost",className:pe("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all text-muted-foreground hover:text-foreground hover:bg-muted/50",t&&"justify-center"),onClick:async()=>{await Le.getState().fetchChangelog(),Le.setState({showChangelogDialog:!0}),e()},children:j(s.jsx(Ya,{className:"h-4 w-4 flex-shrink-0"}),"История версий")}),s.jsx(bi,{className:"my-2"}),!t&&s.jsx("div",{className:"px-3 py-1",children:s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Боты"})}),s.jsxs("div",{className:pe("flex-1 min-h-0 custom-scrollbar transition-all duration-200 md:overflow-y-auto",r.length>0&&"min-h-[96px]",r.length>=6&&"md:max-h-[35vh]"),children:[n?s.jsx("div",{className:"space-y-0.5",children:r.map(_=>s.jsx(Qnt,{bot:_,isCollapsed:t,botStatuses:o,onLinkClick:e},_.id))}):s.jsx(_nt,{sensors:C,collisionDetection:_tt,onDragStart:S,onDragEnd:N,children:s.jsx(Ont,{items:r.map(_=>_.id),strategy:Dnt,children:s.jsx("div",{className:"space-y-0.5",onMouseDown:_=>{d&&(_.preventDefault(),_.stopPropagation())},onClick:_=>{d&&(_.preventDefault(),_.stopPropagation())},children:r.map(_=>s.jsx(Jnt,{bot:_,isCollapsed:t,botStatuses:o,onLinkClick:e,isDragging:d},_.id))})})}),s.jsx("div",{className:"pb-1"})]})]})};function trt(){const e=Er(),t=Ea(),{toast:n}=Jt(),r=Le(R=>R.user),o=Le(R=>R.appVersion),a=Le(R=>R.servers),i=Le(R=>R.logout),l=Le(R=>R.createBot),h=Le(R=>R.fetchInitialData),d=Le(R=>R.hasPermission);Le(R=>R.theme),Le(R=>R.setTheme);const[f,m]=g.useState(!1),[y,v]=g.useState(!1),[b,w]=g.useState(!1),[C,S]=g.useState(!1),[N,L]=g.useState(()=>JSON.parse(localStorage.getItem("sidebar-collapsed"))||!1);g.useEffect(()=>{var R,V;(R=t.state)!=null&&R.openCreateBotModal&&(m(!0),e(t.pathname,{replace:!0,state:{}})),(V=t.state)!=null&&V.openImportBotModal&&(v(!0),e(t.pathname,{replace:!0,state:{}}))},[t.state,e]),g.useEffect(()=>{localStorage.setItem("sidebar-collapsed",JSON.stringify(N))},[N]);const j=async R=>{S(!0);try{const V=await l(R);V&&(m(!1),w(!1),e(`/bots/${V.id}`))}catch(V){console.error("Не удалось создать бота:",V)}finally{S(!1)}},E=R=>{v(!1),w(!1),h().then(()=>{n({title:"Успех!",description:`Бот "${R.username}" успешно импортирован.`}),e(`/bots/${R.id}`)})},_=()=>{w(!1),i()},$=R=>s.jsxs("div",{className:"flex flex-col h-full bg-gradient-to-b from-background via-muted/20 to-background overflow-hidden",children:[s.jsxs("div",{className:pe("p-4 border-b border-border/50",R?"text-center":""),children:[s.jsxs("div",{className:pe("flex items-center",R?"justify-center":"justify-between"),children:[s.jsxs("div",{className:pe("flex items-center gap-3",R&&"hidden"),children:[s.jsx("div",{className:"relative",children:s.jsx("img",{src:"/logo.png",alt:"BlockMineJS Logo",className:"w-10 h-10 rounded-lg shadow-lg bg-gradient-to-r from-blue-500 to-purple-500",style:{boxShadow:"0 0 24px 0 #6f6fff55"}})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"BlockMine"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r==null?void 0:r.username})]})]}),!R&&s.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>L(!N),className:"hidden md:flex hover:bg-muted/50",children:s.jsx(U2,{className:"h-4 w-4"})})]}),R&&s.jsxs("div",{className:"flex flex-col items-center mt-2",children:[s.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>L(!1),className:"mb-2 hover:bg-muted/50",children:s.jsx(G2,{className:"h-5 w-5"})}),s.jsx("div",{className:"relative mx-auto w-10 h-10",children:s.jsx("img",{src:"/logo.png",alt:"BlockMineJS Logo",className:"w-10 h-10 rounded-lg shadow-lg bg-gradient-to-r from-blue-500 to-purple-500",style:{boxShadow:"0 0 24px 0 #6f6fff55"}})})]})]}),s.jsx(ert,{onLinkClick:()=>w(!1),isCollapsed:R,isSheetOpen:b}),s.jsxs("div",{className:"mt-auto p-3 sm:p-4 border-t border-border/50 space-y-2.5",children:[d("panel:user:list")&&s.jsxs(Kr,{to:"/admin",onClick:()=>w(!1),className:({isActive:V})=>pe("flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all",V?"bg-gradient-to-r from-purple-500/10 to-pink-500/10 border border-purple-500/20 text-purple-600":"text-muted-foreground hover:text-foreground hover:bg-muted/50",R&&"justify-center"),children:[s.jsx(h1,{className:"h-4 w-4 flex-shrink-0"}),s.jsx("span",{className:pe(R&&"hidden"),children:"Администрирование"})]}),d("server:list")&&s.jsxs(Kr,{to:"/servers",onClick:()=>w(!1),className:({isActive:V})=>pe("flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all",V?"bg-gradient-to-r from-blue-500/10 to-cyan-500/10 border border-blue-500/20 text-blue-600":"text-muted-foreground hover:text-foreground hover:bg-muted/50",R&&"justify-center"),children:[s.jsx(Si,{className:"h-4 w-4 flex-shrink-0"}),s.jsx("span",{className:pe(R&&"hidden"),children:"Серверы"})]}),s.jsxs("div",{className:pe("flex flex-col gap-2",R?"px-1":"px-2.5"),children:[d("bot:create")&&s.jsxs(Ot,{open:f,onOpenChange:m,children:[s.jsx(yo,{asChild:!0,children:s.jsxs(ie,{variant:"outline",className:pe("w-full transition-all",R?"h-9 w-9 p-0":"h-9 bg-gradient-to-r from-green-500/10 to-emerald-500/10 border-green-500/20 text-green-600 hover:from-green-500/20 hover:to-emerald-500/20"),size:R?"icon":"default",children:[s.jsx(Ua,{className:pe("h-4 w-4",!R&&"mr-2")}),!R&&"Создать бота"]})}),s.jsxs(Et,{className:"h-[90vh] flex flex-col",children:[s.jsxs(yy,{children:[s.jsx(Tt,{children:"Создание нового бота"}),s.jsx(hn,{children:"Заполните информацию ниже, чтобы добавить нового бота в панель."})]}),s.jsx(XG,{servers:a,onFormSubmit:j,isSaving:C,isCreation:!0})]})]}),d("bot:import")&&s.jsxs(Ot,{open:y,onOpenChange:v,children:[s.jsx(yo,{asChild:!0,children:s.jsxs(ie,{variant:"outline",className:pe("w-full transition-all",R?"h-9 w-9 p-0":"h-9 bg-gradient-to-r from-blue-500/10 to-indigo-500/10 border-blue-500/20 text-blue-600 hover:from-blue-500/20 hover:to-indigo-500/20"),size:R?"icon":"default",children:[s.jsx(Qa,{className:pe("h-4 w-4",!R&&"mr-2")}),!R&&"Импорт бота"]})}),s.jsx(Yce,{onImportSuccess:E,onCancel:()=>v(!1),servers:a})]})]}),s.jsx(bi,{className:"my-2"}),s.jsx(sYe,{isCollapsed:R}),s.jsxs(ie,{variant:"ghost",className:pe("w-full transition-all",R?"h-9 w-9 p-0 justify-center":"h-9 justify-start px-3 text-muted-foreground hover:text-foreground hover:bg-muted/50"),onClick:_,children:[s.jsx(em,{className:pe("h-4 w-4",!R&&"mr-2")}),!R&&"Выйти"]}),s.jsxs("div",{className:pe("pt-2 border-t border-border/50 text-center text-xs text-muted-foreground",R&&"hidden"),children:[s.jsxs("a",{href:"https://github.com/blockmineJS/blockmine",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 hover:text-foreground transition-colors",children:[s.jsx(Ya,{className:"h-4 w-4"}),s.jsxs("span",{children:["BlockMine v",o]})]}),s.jsx(ie,{variant:"link",size:"sm",className:"text-xs h-auto p-0 mt-1 text-muted-foreground hover:text-primary",onClick:async()=>{await Le.getState().fetchChangelog(),Le.setState({showChangelogDialog:!0})},children:"Что нового?"})]})]})]});return s.jsxs("div",{className:pe("grid h-[100dvh] md:h-screen transition-[grid-template-columns] duration-300 ease-in-out",N?"md:grid-cols-[80px_1fr]":"md:grid-cols-[280px_1fr]"),children:[s.jsxs("div",{className:"fixed z-40 flex items-center gap-2",style:{top:"max(8px, env(safe-area-inset-top))",right:"max(8px, env(safe-area-inset-right))"},children:[s.jsx(KWe,{}),s.jsx(ltt,{})]}),s.jsx("div",{className:"md:hidden fixed z-50 top-[max(0.5rem,env(safe-area-inset-top))] left-[max(0.5rem,env(safe-area-inset-left))]",children:s.jsxs(pGe,{open:b,onOpenChange:w,children:[s.jsx(mGe,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full bg-background/80 backdrop-blur border","aria-label":"Открыть меню",children:s.jsx(tm,{className:"h-4 w-4"})})}),s.jsx(_ie,{side:"left",className:"p-0 w-full max-w-[85vw] sm:max-w-xs h-[100dvh] flex",children:$(!1)})]})}),s.jsx("aside",{className:"hidden md:block border-r",children:$(N)}),s.jsx("main",{className:"overflow-y-auto",children:s.jsx(hG,{})}),s.jsx(Wet,{})]})}const nrt=Vp("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Of=g.forwardRef(({className:e,variant:t,...n},r)=>s.jsx("div",{ref:r,role:"alert",className:pe(nrt({variant:t}),e),...n}));Of.displayName="Alert";const Jde=g.forwardRef(({className:e,...t},n)=>s.jsx("h5",{ref:n,className:pe("mb-1 font-medium leading-none tracking-tight",e),...t}));Jde.displayName="AlertTitle";const qf=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:pe("text-sm [&_p]:leading-relaxed",e),...t}));qf.displayName="AlertDescription";var Nx={exports:{}},IV,wte;function Qde(){return wte||(wte=1,IV=function(t,n){return function(){for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];return t.apply(n,o)}}),IV}var RV,Mte;function Jo(){if(Mte)return RV;Mte=1;var e=Qde(),t=Object.prototype.toString;function n(R){return t.call(R)==="[object Array]"}function r(R){return typeof R>"u"}function o(R){return R!==null&&!r(R)&&R.constructor!==null&&!r(R.constructor)&&typeof R.constructor.isBuffer=="function"&&R.constructor.isBuffer(R)}function a(R){return t.call(R)==="[object ArrayBuffer]"}function i(R){return typeof FormData<"u"&&R instanceof FormData}function l(R){var V;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?V=ArrayBuffer.isView(R):V=R&&R.buffer&&R.buffer instanceof ArrayBuffer,V}function h(R){return typeof R=="string"}function d(R){return typeof R=="number"}function f(R){return R!==null&&typeof R=="object"}function m(R){if(t.call(R)!=="[object Object]")return!1;var V=Object.getPrototypeOf(R);return V===null||V===Object.prototype}function y(R){return t.call(R)==="[object Date]"}function v(R){return t.call(R)==="[object File]"}function b(R){return t.call(R)==="[object Blob]"}function w(R){return t.call(R)==="[object Function]"}function C(R){return f(R)&&w(R.pipe)}function S(R){return typeof URLSearchParams<"u"&&R instanceof URLSearchParams}function N(R){return R.trim?R.trim():R.replace(/^\s+|\s+$/g,"")}function L(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function j(R,V){if(!(R===null||typeof R>"u"))if(typeof R!="object"&&(R=[R]),n(R))for(var A=0,q=R.length;A<q;A++)V.call(null,R[A],A,R);else for(var z in R)Object.prototype.hasOwnProperty.call(R,z)&&V.call(null,R[z],z,R)}function E(){var R={};function V(z,B){m(R[B])&&m(z)?R[B]=E(R[B],z):m(z)?R[B]=E({},z):n(z)?R[B]=z.slice():R[B]=z}for(var A=0,q=arguments.length;A<q;A++)j(arguments[A],V);return R}function _(R,V,A){return j(V,function(z,B){A&&typeof z=="function"?R[B]=e(z,A):R[B]=z}),R}function $(R){return R.charCodeAt(0)===65279&&(R=R.slice(1)),R}return RV={isArray:n,isArrayBuffer:a,isBuffer:o,isFormData:i,isArrayBufferView:l,isString:h,isNumber:d,isObject:f,isPlainObject:m,isUndefined:r,isDate:y,isFile:v,isBlob:b,isFunction:w,isStream:C,isURLSearchParams:S,isStandardBrowserEnv:L,forEach:j,merge:E,extend:_,trim:N,stripBOM:$},RV}var $V,Ste;function ehe(){if(Ste)return $V;Ste=1;var e=Jo();function t(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}return $V=function(r,o,a){if(!o)return r;var i;if(a)i=a(o);else if(e.isURLSearchParams(o))i=o.toString();else{var l=[];e.forEach(o,function(f,m){f===null||typeof f>"u"||(e.isArray(f)?m=m+"[]":f=[f],e.forEach(f,function(v){e.isDate(v)?v=v.toISOString():e.isObject(v)&&(v=JSON.stringify(v)),l.push(t(m)+"="+t(v))}))}),i=l.join("&")}if(i){var h=r.indexOf("#");h!==-1&&(r=r.slice(0,h)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r},$V}var PV,Cte;function rrt(){if(Cte)return PV;Cte=1;var e=Jo();function t(){this.handlers=[]}return t.prototype.use=function(r,o,a){return this.handlers.push({fulfilled:r,rejected:o,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1},t.prototype.eject=function(r){this.handlers[r]&&(this.handlers[r]=null)},t.prototype.forEach=function(r){e.forEach(this.handlers,function(a){a!==null&&r(a)})},PV=t,PV}var DV,_te;function ort(){if(_te)return DV;_te=1;var e=Jo();return DV=function(n,r){e.forEach(n,function(a,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(n[r]=a,delete n[i])})},DV}var zV,Nte;function the(){return Nte||(Nte=1,zV=function(t,n,r,o,a){return t.config=n,r&&(t.code=r),t.request=o,t.response=a,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}),zV}var OV,jte;function nhe(){if(jte)return OV;jte=1;var e=the();return OV=function(n,r,o,a,i){var l=new Error(n);return e(l,r,o,a,i)},OV}var qV,Lte;function art(){if(Lte)return qV;Lte=1;var e=nhe();return qV=function(n,r,o){var a=o.config.validateStatus;!o.status||!a||a(o.status)?n(o):r(e("Request failed with status code "+o.status,o.config,null,o.request,o))},qV}var HV,Ate;function srt(){if(Ate)return HV;Ate=1;var e=Jo();return HV=e.isStandardBrowserEnv()?function(){return{write:function(r,o,a,i,l,h){var d=[];d.push(r+"="+encodeURIComponent(o)),e.isNumber(a)&&d.push("expires="+new Date(a).toGMTString()),e.isString(i)&&d.push("path="+i),e.isString(l)&&d.push("domain="+l),h===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(r){var o=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),HV}var VV,Ete;function irt(){return Ete||(Ete=1,VV=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}),VV}var BV,Tte;function crt(){return Tte||(Tte=1,BV=function(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t}),BV}var FV,Ite;function lrt(){if(Ite)return FV;Ite=1;var e=irt(),t=crt();return FV=function(r,o){return r&&!e(o)?t(r,o):o},FV}var UV,Rte;function urt(){if(Rte)return UV;Rte=1;var e=Jo(),t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return UV=function(r){var o={},a,i,l;return r&&e.forEach(r.split(`
8164
+ `},wtt={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Mtt(e){let{announcements:t=wtt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=btt}=e;const{announce:a,announcement:i}=xtt(),l=zy("DndLiveRegion"),[h,d]=g.useState(!1);if(g.useEffect(()=>{d(!0)},[]),vtt(g.useMemo(()=>({onDragStart(m){let{active:y}=m;a(t.onDragStart({active:y}))},onDragMove(m){let{active:y,over:v}=m;t.onDragMove&&a(t.onDragMove({active:y,over:v}))},onDragOver(m){let{active:y,over:v}=m;a(t.onDragOver({active:y,over:v}))},onDragEnd(m){let{active:y,over:v}=m;a(t.onDragEnd({active:y,over:v}))},onDragCancel(m){let{active:y,over:v}=m;a(t.onDragCancel({active:y,over:v}))}}),[a,t])),!h)return null;const f=ce.createElement(ce.Fragment,null,ce.createElement(ytt,{id:r,value:o.draggable}),ce.createElement(gtt,{id:l,announcement:i}));return n?Sa.createPortal(f,n):f}var br;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(br||(br={}));function kD(){}function lte(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Stt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const os=Object.freeze({x:0,y:0});function Tde(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ide(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Ctt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ute(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Rde(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function dte(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const _tt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=dte(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,h=n.get(l);if(h){const d=Tde(dte(h),o);a.push({id:l,data:{droppableContainer:i,value:d}})}}return a.sort(Ide)},Ntt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ute(t),a=[];for(const i of r){const{id:l}=i,h=n.get(l);if(h){const d=ute(h),f=o.reduce((y,v,b)=>y+Tde(d[b],v),0),m=Number((f/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:m}})}}return a.sort(Ide)};function jtt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=a-n;if(r<o&&n<a){const h=t.width*t.height,d=e.width*e.height,f=i*l,m=f/(h+d-f);return Number(m.toFixed(4))}return 0}const Ltt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const h=jtt(l,t);h>0&&o.push({id:i,data:{droppableContainer:a,value:h}})}}return o.sort(Ctt)};function Att(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function $de(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:os}function Ett(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const Ttt=Ett(1);function Itt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Rtt(e,t,n){const r=Itt(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:l}=r,h=e.left-i-(1-o)*parseFloat(n),d=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,m=a?e.height/a:e.height;return{width:f,height:m,top:d,right:h+f,bottom:d+m,left:h}}const $tt={ignoreTransform:!1};function a0(e,t){t===void 0&&(t=$tt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=bo(e).getComputedStyle(e);d&&(n=Rtt(n,d,f))}const{top:r,left:o,width:a,height:i,bottom:l,right:h}=n;return{top:r,left:o,width:a,height:i,bottom:l,right:h}}function hte(e){return a0(e,{ignoreTransform:!0})}function Ptt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Dtt(e,t){return t===void 0&&(t=bo(e).getComputedStyle(e)),t.position==="fixed"}function ztt(e,t){t===void 0&&(t=bo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?n.test(a):!1})}function zz(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(LX(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Py(o)||Lde(o)||n.includes(o))return n;const a=bo(e).getComputedStyle(o);return o!==e&&ztt(o,a)&&n.push(o),Dtt(o,a)?n:r(o.parentNode)}return e?r(e):n}function Pde(e){const[t]=zz(e,1);return t??null}function AV(e){return!Dz||!e?null:r0(e)?e:jX(e)?LX(e)||e===o0(e).scrollingElement?window:Py(e)?e:null:null}function Dde(e){return r0(e)?e.scrollX:e.scrollLeft}function zde(e){return r0(e)?e.scrollY:e.scrollTop}function nU(e){return{x:Dde(e),y:zde(e)}}var Lr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Lr||(Lr={}));function Ode(e){return!Dz||!e?!1:e===document.scrollingElement}function qde(e){const t={x:0,y:0},n=Ode(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const Ott={x:.2,y:.2};function qtt(e,t,n,r,o){let{top:a,left:i,right:l,bottom:h}=n;r===void 0&&(r=10),o===void 0&&(o=Ott);const{isTop:d,isBottom:f,isLeft:m,isRight:y}=qde(e),v={x:0,y:0},b={x:0,y:0},w={height:t.height*o.y,width:t.width*o.x};return!d&&a<=t.top+w.height?(v.y=Lr.Backward,b.y=r*Math.abs((t.top+w.height-a)/w.height)):!f&&h>=t.bottom-w.height&&(v.y=Lr.Forward,b.y=r*Math.abs((t.bottom-w.height-h)/w.height)),!y&&l>=t.right-w.width?(v.x=Lr.Forward,b.x=r*Math.abs((t.right-w.width-l)/w.width)):!m&&i<=t.left+w.width&&(v.x=Lr.Backward,b.x=r*Math.abs((t.left+w.width-i)/w.width)),{direction:v,speed:b}}function Htt(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Hde(e){return e.reduce((t,n)=>yp(t,nU(n)),os)}function Vtt(e){return e.reduce((t,n)=>t+Dde(n),0)}function Btt(e){return e.reduce((t,n)=>t+zde(n),0)}function Ftt(e,t){if(t===void 0&&(t=a0),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Pde(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Utt=[["x",["left","right"],Vtt],["y",["top","bottom"],Btt]];class TX{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=zz(n),o=Hde(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of Utt)for(const h of i)Object.defineProperty(this,h,{get:()=>{const d=l(r),f=o[a]-d;return this.rect[h]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vm{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Gtt(e){const{EventTarget:t}=bo(e);return e instanceof t?e:o0(e)}function EV(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var xa;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(xa||(xa={}));function fte(e){e.preventDefault()}function Xtt(e){e.stopPropagation()}var $t;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})($t||($t={}));const Vde={start:[$t.Space,$t.Enter],cancel:[$t.Esc],end:[$t.Space,$t.Enter,$t.Tab]},Wtt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $t.Right:return{...n,x:n.x+25};case $t.Left:return{...n,x:n.x-25};case $t.Down:return{...n,y:n.y+25};case $t.Up:return{...n,y:n.y-25}}};class IX{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new vm(o0(n)),this.windowListeners=new vm(bo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xa.Resize,this.handleCancel),this.windowListeners.add(xa.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xa.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ftt(r),n(os)}handleKeyDown(t){if(EX(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=Vde,coordinateGetter:i=Wtt,scrollBehavior:l="smooth"}=o,{code:h}=t;if(a.end.includes(h)){this.handleEnd(t);return}if(a.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:os;this.referenceCoordinates||(this.referenceCoordinates=f);const m=i(t,{active:n,context:r.current,currentCoordinates:f});if(m){const y=Om(m,f),v={x:0,y:0},{scrollableAncestors:b}=r.current;for(const w of b){const C=t.code,{isTop:S,isRight:N,isLeft:L,isBottom:j,maxScroll:E,minScroll:_}=qde(w),$=Htt(w),R={x:Math.min(C===$t.Right?$.right-$.width/2:$.right,Math.max(C===$t.Right?$.left:$.left+$.width/2,m.x)),y:Math.min(C===$t.Down?$.bottom-$.height/2:$.bottom,Math.max(C===$t.Down?$.top:$.top+$.height/2,m.y))},V=C===$t.Right&&!N||C===$t.Left&&!L,A=C===$t.Down&&!j||C===$t.Up&&!S;if(V&&R.x!==m.x){const q=w.scrollLeft+y.x,z=C===$t.Right&&q<=E.x||C===$t.Left&&q>=_.x;if(z&&!y.y){w.scrollTo({left:q,behavior:l});return}z?v.x=w.scrollLeft-q:v.x=C===$t.Right?w.scrollLeft-E.x:w.scrollLeft-_.x,v.x&&w.scrollBy({left:-v.x,behavior:l});break}else if(A&&R.y!==m.y){const q=w.scrollTop+y.y,z=C===$t.Down&&q<=E.y||C===$t.Up&&q>=_.y;if(z&&!y.x){w.scrollTo({top:q,behavior:l});return}z?v.y=w.scrollTop-q:v.y=C===$t.Down?w.scrollTop-E.y:w.scrollTop-_.y,v.y&&w.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,yp(Om(m,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}IX.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Vde,onActivation:o}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function pte(e){return!!(e&&"distance"in e)}function mte(e){return!!(e&&"delay"in e)}class RX{constructor(t,n,r){var o;r===void 0&&(r=Gtt(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=o0(i),this.documentListeners=new vm(this.document),this.listeners=new vm(r),this.windowListeners=new vm(bo(i)),this.initialCoordinates=(o=tU(a))!=null?o:os,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(xa.Resize,this.handleCancel),this.windowListeners.add(xa.DragStart,fte),this.windowListeners.add(xa.VisibilityChange,this.handleCancel),this.windowListeners.add(xa.ContextMenu,fte),this.documentListeners.add(xa.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mte(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(pte(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(xa.Click,Xtt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xa.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const h=(n=tU(t))!=null?n:os,d=Om(o,h);if(!r&&l){if(pte(l)){if(l.tolerance!=null&&EV(d,l.tolerance))return this.handleCancel();if(EV(d,l.distance))return this.handleStart()}if(mte(l)&&EV(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===$t.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ktt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $X extends RX{constructor(t){const{event:n}=t,r=o0(n.target);super(t,Ktt,r)}}$X.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Ytt={move:{name:"mousemove"},end:{name:"mouseup"}};var rU;(function(e){e[e.RightClick=2]="RightClick"})(rU||(rU={}));class Ztt extends RX{constructor(t){super(t,Ytt,o0(t.event.target))}}Ztt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===rU.RightClick?!1:(r==null||r({event:n}),!0)}}];const TV={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Jtt extends RX{constructor(t){super(t,TV)}static setup(){return window.addEventListener(TV.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(TV.move.name,t)};function t(){}}}Jtt.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var km;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(km||(km={}));var bD;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bD||(bD={}));function Qtt(e){let{acceleration:t,activator:n=km.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:l=bD.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:f,delta:m,threshold:y}=e;const v=tnt({delta:m,disabled:!a}),[b,w]=dtt(),C=g.useRef({x:0,y:0}),S=g.useRef({x:0,y:0}),N=g.useMemo(()=>{switch(n){case km.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case km.DraggableRect:return o}},[n,o,h]),L=g.useRef(null),j=g.useCallback(()=>{const _=L.current;if(!_)return;const $=C.current.x*S.current.x,R=C.current.y*S.current.y;_.scrollBy($,R)},[]),E=g.useMemo(()=>l===bD.TreeOrder?[...d].reverse():d,[l,d]);g.useEffect(()=>{if(!a||!d.length||!N){w();return}for(const _ of E){if((r==null?void 0:r(_))===!1)continue;const $=d.indexOf(_),R=f[$];if(!R)continue;const{direction:V,speed:A}=qtt(_,R,N,t,y);for(const q of["x","y"])v[q][V[q]]||(A[q]=0,V[q]=0);if(A.x>0||A.y>0){w(),L.current=_,b(j,i),C.current=A,S.current=V;return}}C.current={x:0,y:0},S.current={x:0,y:0},w()},[t,j,r,w,a,i,JSON.stringify(N),JSON.stringify(v),b,d,E,f,JSON.stringify(y)])}const ent={x:{[Lr.Backward]:!1,[Lr.Forward]:!1},y:{[Lr.Backward]:!1,[Lr.Forward]:!1}};function tnt(e){let{delta:t,disabled:n}=e;const r=eU(t);return Dy(o=>{if(n||!r||!o)return ent;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Lr.Backward]:o.x[Lr.Backward]||a.x===-1,[Lr.Forward]:o.x[Lr.Forward]||a.x===1},y:{[Lr.Backward]:o.y[Lr.Backward]||a.y===-1,[Lr.Forward]:o.y[Lr.Forward]||a.y===1}}},[n,t,r])}function nnt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Dy(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function rnt(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...a]},[]),[e,t])}var Hm;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Hm||(Hm={}));var oU;(function(e){e.Optimized="optimized"})(oU||(oU={}));const yte=new Map;function ont(e,t){let{dragging:n,dependencies:r,config:o}=t;const[a,i]=g.useState(null),{frequency:l,measure:h,strategy:d}=o,f=g.useRef(e),m=C(),y=zm(m),v=g.useCallback(function(S){S===void 0&&(S=[]),!y.current&&i(N=>N===null?S:N.concat(S.filter(L=>!N.includes(L))))},[y]),b=g.useRef(null),w=Dy(S=>{if(m&&!n)return yte;if(!S||S===yte||f.current!==e||a!=null){const N=new Map;for(let L of e){if(!L)continue;if(a&&a.length>0&&!a.includes(L.id)&&L.rect.current){N.set(L.id,L.rect.current);continue}const j=L.node.current,E=j?new TX(h(j),j):null;L.rect.current=E,E&&N.set(L.id,E)}return N}return S},[e,a,n,m,h]);return g.useEffect(()=>{f.current=e},[e]),g.useEffect(()=>{m||v()},[n,m]),g.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),g.useEffect(()=>{m||typeof l!="number"||b.current!==null||(b.current=setTimeout(()=>{v(),b.current=null},l))},[l,m,v,...r]),{droppableRects:w,measureDroppableContainers:v,measuringScheduled:a!=null};function C(){switch(d){case Hm.Always:return!1;case Hm.BeforeDragging:return n;default:return!n}}}function Bde(e,t){return Dy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ant(e,t){return Bde(e,t)}function snt(e){let{callback:t,disabled:n}=e;const r=AX(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Oz(e){let{callback:t,disabled:n}=e;const r=AX(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function int(e){return new TX(a0(e),e)}function gte(e,t,n){t===void 0&&(t=int);const[r,o]=g.useState(null);function a(){o(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const f=t(e);return JSON.stringify(h)===JSON.stringify(f)?h:f})}const i=snt({callback(h){if(e)for(const d of h){const{type:f,target:m}=d;if(f==="childList"&&m instanceof HTMLElement&&m.contains(e)){a();break}}}}),l=Oz({callback:a});return Xs(()=>{a(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),r}function cnt(e){const t=Bde(e);return $de(e,t)}const xte=[];function lnt(e){const t=g.useRef(e),n=Dy(r=>e?r&&r!==xte&&e&&t.current&&e.parentNode===t.current.parentNode?r:zz(e):xte,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function unt(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(a=>{const i=AV(a.target);i&&n(l=>l?(l.set(i,nU(i)),new Map(l)):null)},[]);return g.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(h=>{const d=AV(h);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,nU(d)]):null}).filter(h=>h!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(h=>{const d=AV(h);d==null||d.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>yp(a,i),os):Hde(e):os,[e,t])}function vte(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==os;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Om(e,n.current):os}function dnt(e){g.useEffect(()=>{if(!Dz)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function hnt(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=i=>{a(i,t)},n},{}),[e,t])}function Fde(e){return g.useMemo(()=>e?Ptt(e):null,[e])}const kte=[];function fnt(e,t){t===void 0&&(t=a0);const[n]=e,r=Fde(n?bo(n):null),[o,a]=g.useState(kte);function i(){a(()=>e.length?e.map(h=>Ode(h)?r:new TX(t(h),h)):kte)}const l=Oz({callback:i});return Xs(()=>{l==null||l.disconnect(),i(),e.forEach(h=>l==null?void 0:l.observe(h))},[e]),o}function pnt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Py(t)?t:e}function mnt(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(d=>{for(const{target:f}of d)if(Py(f)){r(m=>{const y=t(f);return m?{...m,width:y.width,height:y.height}:y});break}},[t]),a=Oz({callback:o}),i=g.useCallback(d=>{const f=pnt(d);a==null||a.disconnect(),f&&(a==null||a.observe(f)),r(f?t(f):null)},[t,a]),[l,h]=vD(i);return g.useMemo(()=>({nodeRef:l,rect:n,setRef:h}),[n,l,h])}const ynt=[{sensor:$X,options:{}},{sensor:IX,options:{}}],gnt={current:{}},IP={draggable:{measure:hte},droppable:{measure:hte,strategy:Hm.WhileDragging,frequency:oU.Optimized},dragOverlay:{measure:a0}};class bm extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const xnt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kD},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:IP,measureDroppableContainers:kD,windowRect:null,measuringScheduled:!1},vnt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kD,draggableNodes:new Map,over:null,measureDroppableContainers:kD},qz=g.createContext(vnt),Ude=g.createContext(xnt);function knt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bm}}}function bnt(e,t){switch(t.type){case br.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case br.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case br.DragEnd:case br.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case br.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new bm(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case br.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new bm(e.droppable.containers);return i.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case br.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new bm(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function wnt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(qz),a=eU(r),i=eU(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!EX(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:h,node:d}=l;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[h.current,d.current]){if(!f)continue;const m=ptt(f);if(m){m.focus();break}}})}},[r,t,o,i,a]),null}function Mnt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function Snt(e){return g.useMemo(()=>({draggable:{...IP.draggable,...e==null?void 0:e.draggable},droppable:{...IP.droppable,...e==null?void 0:e.droppable},dragOverlay:{...IP.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Cnt(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const a=g.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;Xs(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),m=$de(f,r);if(i||(m.x=0),l||(m.y=0),a.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const y=Pde(d);y&&y.scrollBy({top:m.y,left:m.x})}},[t,i,l,r,n])}const Gde=g.createContext({...os,scaleX:1,scaleY:1});var bc;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(bc||(bc={}));const _nt=g.memo(function(t){var n,r,o,a;let{id:i,accessibility:l,autoScroll:h=!0,children:d,sensors:f=ynt,collisionDetection:m=Ltt,measuring:y,modifiers:v,...b}=t;const w=g.useReducer(bnt,void 0,knt),[C,S]=w,[N,L]=ktt(),[j,E]=g.useState(bc.Uninitialized),_=j===bc.Initialized,{draggable:{active:$,nodes:R,translate:V},droppable:{containers:A}}=C,q=$!=null?R.get($):null,z=g.useRef({initial:null,translated:null}),B=g.useMemo(()=>{var gn;return $!=null?{id:$,data:(gn=q==null?void 0:q.data)!=null?gn:gnt,rect:z}:null},[$,q]),P=g.useRef(null),[H,D]=g.useState(null),[U,W]=g.useState(null),K=zm(b,Object.values(b)),I=zy("DndDescribedBy",i),G=g.useMemo(()=>A.getEnabled(),[A]),X=Snt(y),{droppableRects:O,measureDroppableContainers:Q,measuringScheduled:ne}=ont(G,{dragging:_,dependencies:[V.x,V.y],config:X.droppable}),re=nnt(R,$),Z=g.useMemo(()=>U?tU(U):null,[U]),J=aa(),ae=ant(re,X.draggable.measure);Cnt({activeNode:$!=null?R.get($):null,config:J.layoutShiftCompensation,initialRect:ae,measure:X.draggable.measure});const ee=gte(re,X.draggable.measure,ae),Me=gte(re?re.parentElement:null),we=g.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:O,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=A.getNodeFor((n=we.current.over)==null?void 0:n.id),je=mnt({measure:X.dragOverlay.measure}),qe=(r=je.nodeRef.current)!=null?r:re,Ze=_?(o=je.rect)!=null?o:ee:null,De=!!(je.nodeRef.current&&je.rect),Re=cnt(De?null:ee),_t=Fde(qe?bo(qe):null),Qt=lnt(_?Te??re:null),fn=fnt(Qt),Ve=Mnt(v,{transform:{x:V.x-Re.x,y:V.y-Re.y,scaleX:1,scaleY:1},activatorEvent:U,active:B,activeNodeRect:ee,containerNodeRect:Me,draggingNodeRect:Ze,over:we.current.over,overlayNodeRect:je.rect,scrollableAncestors:Qt,scrollableAncestorRects:fn,windowRect:_t}),Vn=Z?yp(Z,V):null,mr=unt(Qt),qr=vte(mr),ge=vte(mr,[ee]),Se=yp(Ve,qr),He=Ze?Ttt(Ze,Ve):null,Be=B&&He?m({active:B,collisionRect:He,droppableRects:O,droppableContainers:G,pointerCoordinates:Vn}):null,gt=Rde(Be,"id"),[dt,pn]=g.useState(null),mn=De?Ve:yp(Ve,ge),$n=Att(mn,(a=dt==null?void 0:dt.rect)!=null?a:null,ee),yn=g.useRef(null),Pt=g.useCallback((gn,Sn)=>{let{sensor:Dn,options:Sr}=Sn;if(P.current==null)return;const ir=R.get(P.current);if(!ir)return;const Qn=gn.nativeEvent,oe=new Dn({active:P.current,activeNode:ir,event:Qn,options:Sr,context:we,onAbort(de){if(!R.get(de))return;const{onDragAbort:Ae}=K.current,ze={id:de};Ae==null||Ae(ze),N({type:"onDragAbort",event:ze})},onPending(de,be,Ae,ze){if(!R.get(de))return;const{onDragPending:Oe}=K.current,Fe={id:de,constraint:be,initialCoordinates:Ae,offset:ze};Oe==null||Oe(Fe),N({type:"onDragPending",event:Fe})},onStart(de){const be=P.current;if(be==null)return;const Ae=R.get(be);if(!Ae)return;const{onDragStart:ze}=K.current,Qe={activatorEvent:Qn,active:{id:be,data:Ae.data,rect:z}};Sa.unstable_batchedUpdates(()=>{ze==null||ze(Qe),E(bc.Initializing),S({type:br.DragStart,initialCoordinates:de,active:be}),N({type:"onDragStart",event:Qe}),D(yn.current),W(Qn)})},onMove(de){S({type:br.DragMove,coordinates:de})},onEnd:le(br.DragEnd),onCancel:le(br.DragCancel)});yn.current=oe;function le(de){return async function(){const{active:Ae,collisions:ze,over:Qe,scrollAdjustedTranslate:Oe}=we.current;let Fe=null;if(Ae&&Oe){const{cancelDrop:Ke}=K.current;Fe={activatorEvent:Qn,active:Ae,collisions:ze,delta:Oe,over:Qe},de===br.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(Fe))&&(de=br.DragCancel)}P.current=null,Sa.unstable_batchedUpdates(()=>{S({type:de}),E(bc.Uninitialized),pn(null),D(null),W(null),yn.current=null;const Ke=de===br.DragEnd?"onDragEnd":"onDragCancel";if(Fe){const rt=K.current[Ke];rt==null||rt(Fe),N({type:Ke,event:Fe})}})}}},[R]),Yt=g.useCallback((gn,Sn)=>(Dn,Sr)=>{const ir=Dn.nativeEvent,Qn=R.get(Sr);if(P.current!==null||!Qn||ir.dndKit||ir.defaultPrevented)return;const oe={active:Qn};gn(Dn,Sn.options,oe)===!0&&(ir.dndKit={capturedBy:Sn.sensor},P.current=Sr,Pt(Dn,Sn))},[R,Pt]),Pn=rnt(f,Yt);dnt(f),Xs(()=>{ee&&j===bc.Initializing&&E(bc.Initialized)},[ee,j]),g.useEffect(()=>{const{onDragMove:gn}=K.current,{active:Sn,activatorEvent:Dn,collisions:Sr,over:ir}=we.current;if(!Sn||!Dn)return;const Qn={active:Sn,activatorEvent:Dn,collisions:Sr,delta:{x:Se.x,y:Se.y},over:ir};Sa.unstable_batchedUpdates(()=>{gn==null||gn(Qn),N({type:"onDragMove",event:Qn})})},[Se.x,Se.y]),g.useEffect(()=>{const{active:gn,activatorEvent:Sn,collisions:Dn,droppableContainers:Sr,scrollAdjustedTranslate:ir}=we.current;if(!gn||P.current==null||!Sn||!ir)return;const{onDragOver:Qn}=K.current,oe=Sr.get(gt),le=oe&&oe.rect.current?{id:oe.id,rect:oe.rect.current,data:oe.data,disabled:oe.disabled}:null,de={active:gn,activatorEvent:Sn,collisions:Dn,delta:{x:ir.x,y:ir.y},over:le};Sa.unstable_batchedUpdates(()=>{pn(le),Qn==null||Qn(de),N({type:"onDragOver",event:de})})},[gt]),Xs(()=>{we.current={activatorEvent:U,active:B,activeNode:re,collisionRect:He,collisions:Be,droppableRects:O,draggableNodes:R,draggingNode:qe,draggingNodeRect:Ze,droppableContainers:A,over:dt,scrollableAncestors:Qt,scrollAdjustedTranslate:Se},z.current={initial:Ze,translated:He}},[B,re,Be,He,R,qe,Ze,O,A,dt,Qt,Se]),Qtt({...J,delta:V,draggingRect:He,pointerCoordinates:Vn,scrollableAncestors:Qt,scrollableAncestorRects:fn});const ra=g.useMemo(()=>({active:B,activeNode:re,activeNodeRect:ee,activatorEvent:U,collisions:Be,containerNodeRect:Me,dragOverlay:je,draggableNodes:R,droppableContainers:A,droppableRects:O,over:dt,measureDroppableContainers:Q,scrollableAncestors:Qt,scrollableAncestorRects:fn,measuringConfiguration:X,measuringScheduled:ne,windowRect:_t}),[B,re,ee,U,Be,Me,je,R,A,O,dt,Q,Qt,fn,X,ne,_t]),oa=g.useMemo(()=>({activatorEvent:U,activators:Pn,active:B,activeNodeRect:ee,ariaDescribedById:{draggable:I},dispatch:S,draggableNodes:R,over:dt,measureDroppableContainers:Q}),[U,Pn,B,ee,S,I,R,dt,Q]);return ce.createElement(Ede.Provider,{value:L},ce.createElement(qz.Provider,{value:oa},ce.createElement(Ude.Provider,{value:ra},ce.createElement(Gde.Provider,{value:$n},d)),ce.createElement(wnt,{disabled:(l==null?void 0:l.restoreFocus)===!1})),ce.createElement(Mtt,{...l,hiddenTextDescribedById:I}));function aa(){const gn=(H==null?void 0:H.autoScrollEnabled)===!1,Sn=typeof h=="object"?h.enabled===!1:h===!1,Dn=_&&!gn&&!Sn;return typeof h=="object"?{...h,enabled:Dn}:{enabled:Dn}}}),Nnt=g.createContext(null),bte="button",jnt="Draggable";function Lnt(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=zy(jnt),{activators:i,activatorEvent:l,active:h,activeNodeRect:d,ariaDescribedById:f,draggableNodes:m,over:y}=g.useContext(qz),{role:v=bte,roleDescription:b="draggable",tabIndex:w=0}=o??{},C=(h==null?void 0:h.id)===t,S=g.useContext(C?Gde:Nnt),[N,L]=vD(),[j,E]=vD(),_=hnt(i,t),$=zm(n);Xs(()=>(m.set(t,{id:t,key:a,node:N,activatorNode:j,data:$}),()=>{const V=m.get(t);V&&V.key===a&&m.delete(t)}),[m,t]);const R=g.useMemo(()=>({role:v,tabIndex:w,"aria-disabled":r,"aria-pressed":C&&v===bte?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[r,v,w,C,b,f.draggable]);return{active:h,activatorEvent:l,activeNodeRect:d,attributes:R,isDragging:C,listeners:r?void 0:_,node:N,over:y,setNodeRef:L,setActivatorNodeRef:E,transform:S}}function Ant(){return g.useContext(Ude)}const Ent="Droppable",Tnt={timeout:25};function Int(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=zy(Ent),{active:i,dispatch:l,over:h,measureDroppableContainers:d}=g.useContext(qz),f=g.useRef({disabled:n}),m=g.useRef(!1),y=g.useRef(null),v=g.useRef(null),{disabled:b,updateMeasurementsFor:w,timeout:C}={...Tnt,...o},S=zm(w??r),N=g.useCallback(()=>{if(!m.current){m.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),v.current=null},C)},[C]),L=Oz({callback:N,disabled:b||!i}),j=g.useCallback((R,V)=>{L&&(V&&(L.unobserve(V),m.current=!1),R&&L.observe(R))},[L]),[E,_]=vD(j),$=zm(t);return g.useEffect(()=>{!L||!E.current||(L.disconnect(),m.current=!1,L.observe(E.current))},[E,L]),g.useEffect(()=>(l({type:br.RegisterDroppable,element:{id:r,key:a,disabled:n,node:E,rect:y,data:$}}),()=>l({type:br.UnregisterDroppable,key:a,id:r})),[r]),g.useEffect(()=>{n!==f.current.disabled&&(l({type:br.SetDroppableDisabled,id:r,key:a,disabled:n}),f.current.disabled=n)},[r,a,n,l]),{active:i,rect:y,isOver:(h==null?void 0:h.id)===r,node:E,over:h,setNodeRef:_}}function PX(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Rnt(e,t){return e.reduce((n,r,o)=>{const a=t.get(r);return a&&(n[o]=a),n},Array(e.length))}function Cx(e){return e!==null&&e>=0}function $nt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pnt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Xde=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=PX(t,r,n),i=t[o],l=a[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},_x={scaleX:1,scaleY:1},Dnt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:a,overIndex:i}=e;const l=(t=a[n])!=null?t:r;if(!l)return null;if(o===n){const d=a[i];return d?{x:0,y:n<i?d.top+d.height-(l.top+l.height):d.top-l.top,..._x}:null}const h=znt(a,o,n);return o>n&&o<=i?{x:0,y:-l.height-h,..._x}:o<n&&o>=i?{x:0,y:l.height+h,..._x}:{x:0,y:0,..._x}};function znt(e,t,n){const r=e[t],o=e[t-1],a=e[t+1];return r?n<t?o?r.top-(o.top+o.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const Wde="Sortable",Kde=ce.createContext({activeIndex:-1,containerId:Wde,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Xde,disabled:{draggable:!1,droppable:!1}});function Ont(e){let{children:t,id:n,items:r,strategy:o=Xde,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:h,over:d,measureDroppableContainers:f}=Ant(),m=zy(Wde,n),y=l.rect!==null,v=g.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),b=i!=null,w=i?v.indexOf(i.id):-1,C=d?v.indexOf(d.id):-1,S=g.useRef(v),N=!$nt(v,S.current),L=C!==-1&&w===-1||N,j=Pnt(a);Xs(()=>{N&&b&&f(v)},[N,v,b,f]),g.useEffect(()=>{S.current=v},[v]);const E=g.useMemo(()=>({activeIndex:w,containerId:m,disabled:j,disableTransforms:L,items:v,overIndex:C,useDragOverlay:y,sortedRects:Rnt(v,h),strategy:o}),[w,m,j.draggable,j.droppable,L,v,C,h,y,o]);return ce.createElement(Kde.Provider,{value:E},t)}const qnt=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return PX(n,r,o).indexOf(t)},Hnt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:h,transition:d}=e;return!d||!r||l!==a&&o===i?!1:n?!0:i!==o&&t===h},Vnt={duration:200,easing:"ease"},Yde="transform",Bnt=qm.Transition.toString({property:Yde,duration:0,easing:"linear"}),Fnt={roleDescription:"sortable"};function Unt(e){let{disabled:t,index:n,node:r,rect:o}=e;const[a,i]=g.useState(null),l=g.useRef(n);return Xs(()=>{if(!t&&n!==l.current&&r.current){const h=o.current;if(h){const d=a0(r.current,{ignoreTransform:!0}),f={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(f.x||f.y)&&i(f)}}n!==l.current&&(l.current=n)},[t,n,r,o]),g.useEffect(()=>{a&&i(null)},[a]),a}function Gnt(e){let{animateLayoutChanges:t=Hnt,attributes:n,disabled:r,data:o,getNewIndex:a=qnt,id:i,strategy:l,resizeObserverConfig:h,transition:d=Vnt}=e;const{items:f,containerId:m,activeIndex:y,disabled:v,disableTransforms:b,sortedRects:w,overIndex:C,useDragOverlay:S,strategy:N}=g.useContext(Kde),L=Xnt(r,v),j=f.indexOf(i),E=g.useMemo(()=>({sortable:{containerId:m,index:j,items:f},...o}),[m,o,j,f]),_=g.useMemo(()=>f.slice(f.indexOf(i)),[f,i]),{rect:$,node:R,isOver:V,setNodeRef:A}=Int({id:i,data:E,disabled:L.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...h}}),{active:q,activatorEvent:z,activeNodeRect:B,attributes:P,setNodeRef:H,listeners:D,isDragging:U,over:W,setActivatorNodeRef:K,transform:I}=Lnt({id:i,data:E,attributes:{...Fnt,...n},disabled:L.draggable}),G=utt(A,H),X=!!q,O=X&&!b&&Cx(y)&&Cx(C),Q=!S&&U,ne=Q&&O?I:null,Z=O?ne??(l??N)({rects:w,activeNodeRect:B,activeIndex:y,overIndex:C,index:j}):null,J=Cx(y)&&Cx(C)?a({id:i,items:f,activeIndex:y,overIndex:C}):j,ae=q==null?void 0:q.id,ee=g.useRef({activeId:ae,items:f,newIndex:J,containerId:m}),Me=f!==ee.current.items,we=t({active:q,containerId:m,isDragging:U,isSorting:X,id:i,index:j,items:f,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:d,wasDragging:ee.current.activeId!=null}),Te=Unt({disabled:!we,index:j,node:R,rect:$});return g.useEffect(()=>{X&&ee.current.newIndex!==J&&(ee.current.newIndex=J),m!==ee.current.containerId&&(ee.current.containerId=m),f!==ee.current.items&&(ee.current.items=f)},[X,J,m,f]),g.useEffect(()=>{if(ae===ee.current.activeId)return;if(ae!=null&&ee.current.activeId==null){ee.current.activeId=ae;return}const qe=setTimeout(()=>{ee.current.activeId=ae},50);return()=>clearTimeout(qe)},[ae]),{active:q,activeIndex:y,attributes:P,data:E,rect:$,index:j,newIndex:J,items:f,isOver:V,isSorting:X,isDragging:U,listeners:D,node:R,overIndex:C,over:W,setNodeRef:G,setActivatorNodeRef:K,setDroppableNodeRef:A,setDraggableNodeRef:H,transform:Te??Z,transition:je()};function je(){if(Te||Me&&ee.current.newIndex===j)return Bnt;if(!(Q&&!EX(z)||!d)&&(X||we))return qm.Transition.toString({...d,property:Yde})}}function Xnt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function wD(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Wnt=[$t.Down,$t.Right,$t.Up,$t.Left],Knt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(Wnt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const h=[];a.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const y=o.get(m.id);if(y)switch(e.code){case $t.Down:r.top<y.top&&h.push(m);break;case $t.Up:r.top>y.top&&h.push(m);break;case $t.Left:r.left>y.left&&h.push(m);break;case $t.Right:r.left<y.left&&h.push(m);break}});const d=Ntt({collisionRect:r,droppableRects:o,droppableContainers:h});let f=Rde(d,"id");if(f===(i==null?void 0:i.id)&&d.length>1&&(f=d[1].id),f!=null){const m=a.get(n.id),y=a.get(f),v=y?o.get(y.id):null,b=y==null?void 0:y.node.current;if(b&&v&&m&&y){const C=zz(b).some((_,$)=>l[$]!==_),S=Zde(m,y),N=Ynt(m,y),L=C||!S?{x:0,y:0}:{x:N?r.width-v.width:0,y:N?r.height-v.height:0},j={x:v.left,y:v.top};return L.x&&L.y?j:Om(j,L)}}}};function Zde(e,t){return!wD(e)||!wD(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Ynt(e,t){return!wD(e)||!wD(t)||!Zde(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Znt({onClose:e}){return s.jsxs(Et,{className:"max-w-3xl",children:[s.jsx(qt,{children:s.jsx(Tt,{children:"Предложить улучшение или задать вопрос"})}),s.jsxs("div",{className:"py-4 space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Здесь небольшой гайд о том, как задавать/предлагать свои запросы правильно."}),s.jsx("p",{children:'Для того чтобы задать вопрос, сообщить об ошибке или предложить новую идею, перейдите на нашу страницу GitHub Issues. Нажмите на кнопку "New issue" и выберите подходящий шаблон. Для обычного вопроса можно создать пустой issue.'}),s.jsx("div",{className:"border rounded-lg overflow-hidden mt-4",children:s.jsx("img",{src:"/create_issue.png",alt:"How to create a GitHub issue",width:"1263",height:"622",className:"w-full h-auto"})})]}),s.jsxs(Kt,{children:[s.jsx(ie,{variant:"ghost",onClick:e,children:"Закрыть"}),s.jsx(ie,{asChild:!0,children:s.jsxs("a",{href:"https://github.com/blockmineJS/blockmine/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Перейти на GitHub"]})})]})]})}const Jnt=({bot:e,isCollapsed:t,botStatuses:n,onLinkClick:r,isDragging:o})=>{const{attributes:a,listeners:i,setNodeRef:l,transform:h,transition:d,isDragging:f}=Gnt({id:e.id}),m={transform:qm.Transform.toString(h),transition:d,opacity:f?.5:1},y=v=>{if(f||o)return v.preventDefault(),v.stopPropagation(),!1;r(v)};return s.jsx("div",{ref:l,style:m,...a,...i,onMouseDown:v=>{(f||o)&&(v.preventDefault(),v.stopPropagation())},children:s.jsxs(Kr,{to:`/bots/${e.id}`,onClick:y,"data-bot-id":e.id,className:({isActive:v})=>pe("flex items-center gap-2 rounded-md px-2 py-1.5 text-xs transition-all duration-200 ease-in-out cursor-move",v?"bg-gradient-to-r from-green-500/10 to-emerald-500/10 border border-green-500/20 text-green-600 shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted/50 hover:shadow-sm",t&&"justify-center"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:pe("w-1.5 h-1.5 rounded-full transition-all duration-200",n[e.id]==="running"?"bg-green-500 animate-pulse":"bg-gray-500")}),t&&s.jsx("div",{className:"w-5 h-5 bg-gradient-to-r from-blue-500 to-purple-500 rounded-md flex items-center justify-center shadow-sm",children:s.jsx("span",{className:"text-xs font-bold text-white",children:e.username.charAt(0).toUpperCase()})})]}),s.jsxs("div",{className:pe("flex flex-col overflow-hidden",t&&"hidden"),children:[s.jsx("span",{className:"font-medium truncate text-xs",children:e.username}),s.jsx("span",{className:"text-xs text-muted-foreground truncate leading-tight",children:e.note||`${e.server.host}:${e.server.port}`})]})]})})},Qnt=({bot:e,isCollapsed:t,botStatuses:n,onLinkClick:r})=>s.jsxs(Kr,{to:`/bots/${e.id}`,onClick:r,"data-bot-id":e.id,className:({isActive:o})=>pe("flex items-center gap-2 rounded-md px-2 py-1.5 text-xs transition-all duration-200 ease-in-out cursor-pointer",o?"bg-gradient-to-r from-green-500/10 to-emerald-500/10 border border-green-500/20 text-green-600 shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted/50 hover:shadow-sm",t&&"justify-center"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:pe("w-1.5 h-1.5 rounded-full transition-all duration-200",n[e.id]==="running"?"bg-green-500 animate-pulse":"bg-gray-500")}),t&&s.jsx("div",{className:"w-5 h-5 bg-gradient-to-r from-blue-500 to-purple-500 rounded-md flex items-center justify-center shadow-sm",children:s.jsx("span",{className:"text-xs font-bold text-white",children:e.username.charAt(0).toUpperCase()})})]}),s.jsxs("div",{className:pe("flex flex-col overflow-hidden",t&&"hidden"),children:[s.jsx("span",{className:"font-medium truncate text-xs",children:e.username}),s.jsx("span",{className:"text-xs text-muted-foreground truncate leading-tight",children:e.note||`${e.server.host}:${e.server.port}`})]})]}),ert=({onLinkClick:e,isCollapsed:t,isSheetOpen:n})=>{var E;const r=Le(_=>_.bots),o=Le(_=>_.botStatuses),a=Le(_=>_.hasPermission),i=Le(_=>_.updateBotOrder),l=Ea();Er();const{toast:h}=Jt(),[d,f]=g.useState(!1),[m,y]=g.useState({text:"Улучшить BlockMine",icon:s.jsx(ap,{className:"h-4 w-4 flex-shrink-0"})}),[v,b]=g.useState(!1);g.useEffect(()=>{const _=["Предложить улучшение","Предложить изменение","Задать вопрос","Улучшить BlockMine"],$=[s.jsx(ap,{className:"h-4 w-4 flex-shrink-0"},"lightbulb"),s.jsx(rm,{className:"h-4 w-4 flex-shrink-0"},"msg")],R=_[Math.floor(Math.random()*_.length)],V=$[Math.floor(Math.random()*$.length)];y({text:R,icon:V})},[]);const w=(E=l.pathname.match(/\/bots\/(\d+)/))==null?void 0:E[1],C=Stt(lte($X,{activationConstraint:{distance:12}}),lte(IX,{coordinateGetter:Knt})),S=g.useCallback(_=>{n||f(!0)},[n]),N=g.useCallback(async _=>{const{active:$,over:R}=_;if(setTimeout(()=>f(!1),100),$.id!==R.id){const V=r.findIndex(z=>z.id===$.id),A=r.findIndex(z=>z.id===R.id),q=[...r];try{await new Promise(D=>setTimeout(D,50));const z=PX(r,V,A);i(z);const P=r[A].sortOrder,H=await Ne(`/api/bots/${$.id}/sort-order`,{method:"PUT",body:JSON.stringify({newPosition:P,oldIndex:V,newIndex:A})})}catch(z){console.error("[Drag] Ошибка:",z),i(q),h({title:"Ошибка",description:"Не удалось обновить порядок ботов",variant:"destructive"})}}},[r,i,h]);g.useEffect(()=>{n&&f(!1)},[n]),g.useEffect(()=>{if(w){const _=document.querySelector(`[data-bot-id="${w}"]`),$=_==null?void 0:_.closest(".custom-scrollbar");_&&$&&setTimeout(()=>{const R=$.getBoundingClientRect(),V=_.getBoundingClientRect();V.top>=R.top&&V.bottom<=R.bottom||_.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}},[w,r]),g.useEffect(()=>{const _=V=>{if(d&&!n)return V.preventDefault(),V.returnValue="",""},$=V=>{if(d&&!n)return V.preventDefault(),V.stopPropagation(),!1},R=V=>{if(d&&!n)return V.preventDefault(),V.stopPropagation(),!1};if(d&&!n)return window.addEventListener("beforeunload",_),document.addEventListener("click",$,!0),document.addEventListener("mousedown",R,!0),()=>{window.removeEventListener("beforeunload",_),document.removeEventListener("click",$,!0),document.removeEventListener("mousedown",R,!0)}},[d,n]);const L=({isActive:_})=>pe("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all",_?"bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/20 text-blue-600":"text-muted-foreground hover:text-foreground hover:bg-muted/50",t&&"justify-center"),j=(_,$)=>s.jsxs(s.Fragment,{children:[_,s.jsx("span",{className:pe("truncate",t&&"hidden"),children:$})]});return s.jsxs("nav",{className:"flex-1 flex flex-col gap-1 p-4 min-h-0 overflow-y-auto md:overflow-visible pb-20 md:pb-0 overscroll-contain",children:[s.jsx(Kr,{to:"/",end:!0,onClick:e,className:L,children:j(s.jsx(c1,{className:"h-4 w-4 flex-shrink-0"}),"Дашборд")}),a("task:list")&&s.jsx(Kr,{to:"/tasks",onClick:e,className:L,children:j(s.jsx(Ts,{className:"h-4 w-4 flex-shrink-0"}),"Планировщик")}),s.jsx(Kr,{to:"/graph-store",onClick:e,className:L,children:j(s.jsx(hm,{className:"h-4 w-4 flex-shrink-0"}),"Магазин графов")}),a("bot:update")&&s.jsx(Kr,{to:"/proxy-config",onClick:e,className:L,children:j(s.jsx($s,{className:"h-4 w-4 flex-shrink-0"}),"Прокси")}),s.jsxs(Ot,{open:v,onOpenChange:b,children:[s.jsx(yo,{asChild:!0,children:s.jsx(ie,{variant:"ghost",className:pe("w-full justify-start flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all text-muted-foreground hover:text-foreground hover:bg-muted/50",t&&"justify-center"),onClick:()=>{b(!0),typeof e=="function"&&e()},children:j(m.icon,m.text)})}),s.jsx(Znt,{onClose:()=>b(!1)})]}),s.jsx(ie,{variant:"ghost",className:pe("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-all text-muted-foreground hover:text-foreground hover:bg-muted/50",t&&"justify-center"),onClick:async()=>{await Le.getState().fetchChangelog(),Le.setState({showChangelogDialog:!0}),e()},children:j(s.jsx(Ya,{className:"h-4 w-4 flex-shrink-0"}),"История версий")}),s.jsx(bi,{className:"my-2"}),!t&&s.jsx("div",{className:"px-3 py-1",children:s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Боты"})}),s.jsxs("div",{className:pe("flex-1 min-h-0 custom-scrollbar transition-all duration-200 md:overflow-y-auto",r.length>0&&"min-h-[96px]",r.length>=6&&"md:max-h-[35vh]"),children:[n?s.jsx("div",{className:"space-y-0.5",children:r.map(_=>s.jsx(Qnt,{bot:_,isCollapsed:t,botStatuses:o,onLinkClick:e},_.id))}):s.jsx(_nt,{sensors:C,collisionDetection:_tt,onDragStart:S,onDragEnd:N,children:s.jsx(Ont,{items:r.map(_=>_.id),strategy:Dnt,children:s.jsx("div",{className:"space-y-0.5",onMouseDown:_=>{d&&(_.preventDefault(),_.stopPropagation())},onClick:_=>{d&&(_.preventDefault(),_.stopPropagation())},children:r.map(_=>s.jsx(Jnt,{bot:_,isCollapsed:t,botStatuses:o,onLinkClick:e,isDragging:d},_.id))})})}),s.jsx("div",{className:"pb-1"})]})]})};function trt(){const e=Er(),t=Ea(),{toast:n}=Jt(),r=Le(R=>R.user),o=Le(R=>R.appVersion),a=Le(R=>R.servers),i=Le(R=>R.logout),l=Le(R=>R.createBot),h=Le(R=>R.fetchInitialData),d=Le(R=>R.hasPermission);Le(R=>R.theme),Le(R=>R.setTheme);const[f,m]=g.useState(!1),[y,v]=g.useState(!1),[b,w]=g.useState(!1),[C,S]=g.useState(!1),[N,L]=g.useState(()=>JSON.parse(localStorage.getItem("sidebar-collapsed"))||!1);g.useEffect(()=>{var R,V;(R=t.state)!=null&&R.openCreateBotModal&&(m(!0),e(t.pathname,{replace:!0,state:{}})),(V=t.state)!=null&&V.openImportBotModal&&(v(!0),e(t.pathname,{replace:!0,state:{}}))},[t.state,e]),g.useEffect(()=>{localStorage.setItem("sidebar-collapsed",JSON.stringify(N))},[N]);const j=async R=>{S(!0);try{const V=await l(R);V&&(m(!1),w(!1),e(`/bots/${V.id}`))}catch(V){console.error("Не удалось создать бота:",V)}finally{S(!1)}},E=R=>{v(!1),w(!1),h().then(()=>{n({title:"Успех!",description:`Бот "${R.username}" успешно импортирован.`}),e(`/bots/${R.id}`)})},_=()=>{w(!1),i()},$=R=>s.jsxs("div",{className:"flex flex-col h-full bg-gradient-to-b from-background via-muted/20 to-background overflow-hidden",children:[s.jsxs("div",{className:pe("p-4 border-b border-border/50",R?"text-center":""),children:[s.jsxs("div",{className:pe("flex items-center",R?"justify-center":"justify-between"),children:[s.jsxs("div",{className:pe("flex items-center gap-3",R&&"hidden"),children:[s.jsx("div",{className:"relative",children:s.jsx("img",{src:"/logo.png",alt:"BlockMineJS Logo",className:"w-10 h-10 rounded-lg shadow-lg bg-gradient-to-r from-blue-500 to-purple-500",style:{boxShadow:"0 0 24px 0 #6f6fff55"}})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"BlockMine"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r==null?void 0:r.username})]})]}),!R&&s.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>L(!N),className:"hidden md:flex hover:bg-muted/50",children:s.jsx(U2,{className:"h-4 w-4"})})]}),R&&s.jsxs("div",{className:"flex flex-col items-center mt-2",children:[s.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>L(!1),className:"mb-2 hover:bg-muted/50",children:s.jsx(G2,{className:"h-5 w-5"})}),s.jsx("div",{className:"relative mx-auto w-10 h-10",children:s.jsx("img",{src:"/logo.png",alt:"BlockMineJS Logo",className:"w-10 h-10 rounded-lg shadow-lg bg-gradient-to-r from-blue-500 to-purple-500",style:{boxShadow:"0 0 24px 0 #6f6fff55"}})})]})]}),s.jsx(ert,{onLinkClick:()=>w(!1),isCollapsed:R,isSheetOpen:b}),s.jsxs("div",{className:"mt-auto p-3 sm:p-4 border-t border-border/50 space-y-2.5",children:[d("panel:user:list")&&s.jsxs(Kr,{to:"/admin",onClick:()=>w(!1),className:({isActive:V})=>pe("flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all",V?"bg-gradient-to-r from-purple-500/10 to-pink-500/10 border border-purple-500/20 text-purple-600":"text-muted-foreground hover:text-foreground hover:bg-muted/50",R&&"justify-center"),children:[s.jsx(h1,{className:"h-4 w-4 flex-shrink-0"}),s.jsx("span",{className:pe(R&&"hidden"),children:"Администрирование"})]}),d("server:list")&&s.jsxs(Kr,{to:"/servers",onClick:()=>w(!1),className:({isActive:V})=>pe("flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all",V?"bg-gradient-to-r from-blue-500/10 to-cyan-500/10 border border-blue-500/20 text-blue-600":"text-muted-foreground hover:text-foreground hover:bg-muted/50",R&&"justify-center"),children:[s.jsx(Si,{className:"h-4 w-4 flex-shrink-0"}),s.jsx("span",{className:pe(R&&"hidden"),children:"Серверы"})]}),s.jsxs("div",{className:pe("flex flex-col gap-2",R?"px-1":"px-2.5"),children:[d("bot:create")&&s.jsxs(Ot,{open:f,onOpenChange:m,children:[s.jsx(yo,{asChild:!0,children:s.jsxs(ie,{variant:"outline",className:pe("w-full transition-all",R?"h-9 w-9 p-0":"h-9 bg-gradient-to-r from-green-500/10 to-emerald-500/10 border-green-500/20 text-green-600 hover:from-green-500/20 hover:to-emerald-500/20"),size:R?"icon":"default",children:[s.jsx(Ua,{className:pe("h-4 w-4",!R&&"mr-2")}),!R&&"Создать бота"]})}),s.jsxs(Et,{className:"h-[90vh] flex flex-col",children:[s.jsxs(yy,{children:[s.jsx(Tt,{children:"Создание нового бота"}),s.jsx(hn,{children:"Заполните информацию ниже, чтобы добавить нового бота в панель."})]}),s.jsx(XG,{servers:a,onFormSubmit:j,isSaving:C,isCreation:!0})]})]}),d("bot:import")&&s.jsxs(Ot,{open:y,onOpenChange:v,children:[s.jsx(yo,{asChild:!0,children:s.jsxs(ie,{variant:"outline",className:pe("w-full transition-all",R?"h-9 w-9 p-0":"h-9 bg-gradient-to-r from-blue-500/10 to-indigo-500/10 border-blue-500/20 text-blue-600 hover:from-blue-500/20 hover:to-indigo-500/20"),size:R?"icon":"default",children:[s.jsx(Qa,{className:pe("h-4 w-4",!R&&"mr-2")}),!R&&"Импорт бота"]})}),s.jsx(Yce,{onImportSuccess:E,onCancel:()=>v(!1),servers:a})]})]}),s.jsx(bi,{className:"my-2"}),s.jsx(sYe,{isCollapsed:R}),s.jsxs(ie,{variant:"ghost",className:pe("w-full transition-all",R?"h-9 w-9 p-0 justify-center":"h-9 justify-start px-3 text-muted-foreground hover:text-foreground hover:bg-muted/50"),onClick:_,children:[s.jsx(em,{className:pe("h-4 w-4",!R&&"mr-2")}),!R&&"Выйти"]}),s.jsxs("div",{className:pe("pt-2 border-t border-border/50 text-center text-xs text-muted-foreground",R&&"hidden"),children:[s.jsxs("a",{href:"https://github.com/blockmineJS/blockmine",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 hover:text-foreground transition-colors",children:[s.jsx(Ya,{className:"h-4 w-4"}),s.jsxs("span",{children:["BlockMine v",o]})]}),s.jsx(ie,{variant:"link",size:"sm",className:"text-xs h-auto p-0 mt-1 text-muted-foreground hover:text-primary",onClick:async()=>{await Le.getState().fetchChangelog(),Le.setState({showChangelogDialog:!0})},children:"Что нового?"})]})]})]});return s.jsxs("div",{className:pe("grid h-[100dvh] md:h-screen transition-[grid-template-columns] duration-300 ease-in-out",N?"md:grid-cols-[80px_1fr]":"md:grid-cols-[280px_1fr]"),children:[s.jsxs("div",{className:"fixed z-40 flex items-center gap-2",style:{top:"max(8px, env(safe-area-inset-top))",right:"max(8px, env(safe-area-inset-right))"},children:[s.jsx(KWe,{}),s.jsx(ltt,{})]}),s.jsx("div",{className:"md:hidden fixed z-50 top-[max(0.5rem,env(safe-area-inset-top))] left-[max(0.5rem,env(safe-area-inset-left))]",children:s.jsxs(pGe,{open:b,onOpenChange:w,children:[s.jsx(mGe,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full bg-background/80 backdrop-blur border","aria-label":"Открыть меню",children:s.jsx(tm,{className:"h-4 w-4"})})}),s.jsx(_ie,{side:"left",className:"p-0 w-full max-w-[85vw] sm:max-w-xs h-[100dvh] flex",children:$(!1)})]})}),s.jsx("aside",{className:"hidden md:block border-r",children:$(N)}),s.jsx("main",{className:"overflow-y-auto",children:s.jsx(hG,{})}),s.jsx(Wet,{})]})}const nrt=Vp("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Of=g.forwardRef(({className:e,variant:t,...n},r)=>s.jsx("div",{ref:r,role:"alert",className:pe(nrt({variant:t}),e),...n}));Of.displayName="Alert";const Jde=g.forwardRef(({className:e,...t},n)=>s.jsx("h5",{ref:n,className:pe("mb-1 font-medium leading-none tracking-tight",e),...t}));Jde.displayName="AlertTitle";const qf=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:pe("text-sm [&_p]:leading-relaxed",e),...t}));qf.displayName="AlertDescription";var Nx={exports:{}},IV,wte;function Qde(){return wte||(wte=1,IV=function(t,n){return function(){for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];return t.apply(n,o)}}),IV}var RV,Mte;function Jo(){if(Mte)return RV;Mte=1;var e=Qde(),t=Object.prototype.toString;function n(R){return t.call(R)==="[object Array]"}function r(R){return typeof R>"u"}function o(R){return R!==null&&!r(R)&&R.constructor!==null&&!r(R.constructor)&&typeof R.constructor.isBuffer=="function"&&R.constructor.isBuffer(R)}function a(R){return t.call(R)==="[object ArrayBuffer]"}function i(R){return typeof FormData<"u"&&R instanceof FormData}function l(R){var V;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?V=ArrayBuffer.isView(R):V=R&&R.buffer&&R.buffer instanceof ArrayBuffer,V}function h(R){return typeof R=="string"}function d(R){return typeof R=="number"}function f(R){return R!==null&&typeof R=="object"}function m(R){if(t.call(R)!=="[object Object]")return!1;var V=Object.getPrototypeOf(R);return V===null||V===Object.prototype}function y(R){return t.call(R)==="[object Date]"}function v(R){return t.call(R)==="[object File]"}function b(R){return t.call(R)==="[object Blob]"}function w(R){return t.call(R)==="[object Function]"}function C(R){return f(R)&&w(R.pipe)}function S(R){return typeof URLSearchParams<"u"&&R instanceof URLSearchParams}function N(R){return R.trim?R.trim():R.replace(/^\s+|\s+$/g,"")}function L(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function j(R,V){if(!(R===null||typeof R>"u"))if(typeof R!="object"&&(R=[R]),n(R))for(var A=0,q=R.length;A<q;A++)V.call(null,R[A],A,R);else for(var z in R)Object.prototype.hasOwnProperty.call(R,z)&&V.call(null,R[z],z,R)}function E(){var R={};function V(z,B){m(R[B])&&m(z)?R[B]=E(R[B],z):m(z)?R[B]=E({},z):n(z)?R[B]=z.slice():R[B]=z}for(var A=0,q=arguments.length;A<q;A++)j(arguments[A],V);return R}function _(R,V,A){return j(V,function(z,B){A&&typeof z=="function"?R[B]=e(z,A):R[B]=z}),R}function $(R){return R.charCodeAt(0)===65279&&(R=R.slice(1)),R}return RV={isArray:n,isArrayBuffer:a,isBuffer:o,isFormData:i,isArrayBufferView:l,isString:h,isNumber:d,isObject:f,isPlainObject:m,isUndefined:r,isDate:y,isFile:v,isBlob:b,isFunction:w,isStream:C,isURLSearchParams:S,isStandardBrowserEnv:L,forEach:j,merge:E,extend:_,trim:N,stripBOM:$},RV}var $V,Ste;function ehe(){if(Ste)return $V;Ste=1;var e=Jo();function t(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}return $V=function(r,o,a){if(!o)return r;var i;if(a)i=a(o);else if(e.isURLSearchParams(o))i=o.toString();else{var l=[];e.forEach(o,function(f,m){f===null||typeof f>"u"||(e.isArray(f)?m=m+"[]":f=[f],e.forEach(f,function(v){e.isDate(v)?v=v.toISOString():e.isObject(v)&&(v=JSON.stringify(v)),l.push(t(m)+"="+t(v))}))}),i=l.join("&")}if(i){var h=r.indexOf("#");h!==-1&&(r=r.slice(0,h)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r},$V}var PV,Cte;function rrt(){if(Cte)return PV;Cte=1;var e=Jo();function t(){this.handlers=[]}return t.prototype.use=function(r,o,a){return this.handlers.push({fulfilled:r,rejected:o,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1},t.prototype.eject=function(r){this.handlers[r]&&(this.handlers[r]=null)},t.prototype.forEach=function(r){e.forEach(this.handlers,function(a){a!==null&&r(a)})},PV=t,PV}var DV,_te;function ort(){if(_te)return DV;_te=1;var e=Jo();return DV=function(n,r){e.forEach(n,function(a,i){i!==r&&i.toUpperCase()===r.toUpperCase()&&(n[r]=a,delete n[i])})},DV}var zV,Nte;function the(){return Nte||(Nte=1,zV=function(t,n,r,o,a){return t.config=n,r&&(t.code=r),t.request=o,t.response=a,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}),zV}var OV,jte;function nhe(){if(jte)return OV;jte=1;var e=the();return OV=function(n,r,o,a,i){var l=new Error(n);return e(l,r,o,a,i)},OV}var qV,Lte;function art(){if(Lte)return qV;Lte=1;var e=nhe();return qV=function(n,r,o){var a=o.config.validateStatus;!o.status||!a||a(o.status)?n(o):r(e("Request failed with status code "+o.status,o.config,null,o.request,o))},qV}var HV,Ate;function srt(){if(Ate)return HV;Ate=1;var e=Jo();return HV=e.isStandardBrowserEnv()?function(){return{write:function(r,o,a,i,l,h){var d=[];d.push(r+"="+encodeURIComponent(o)),e.isNumber(a)&&d.push("expires="+new Date(a).toGMTString()),e.isString(i)&&d.push("path="+i),e.isString(l)&&d.push("domain="+l),h===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(r){var o=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),HV}var VV,Ete;function irt(){return Ete||(Ete=1,VV=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}),VV}var BV,Tte;function crt(){return Tte||(Tte=1,BV=function(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t}),BV}var FV,Ite;function lrt(){if(Ite)return FV;Ite=1;var e=irt(),t=crt();return FV=function(r,o){return r&&!e(o)?t(r,o):o},FV}var UV,Rte;function urt(){if(Rte)return UV;Rte=1;var e=Jo(),t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return UV=function(r){var o={},a,i,l;return r&&e.forEach(r.split(`
8165
8165
  `),function(d){if(l=d.indexOf(":"),a=e.trim(d.substr(0,l)).toLowerCase(),i=e.trim(d.substr(l+1)),a){if(o[a]&&t.indexOf(a)>=0)return;a==="set-cookie"?o[a]=(o[a]?o[a]:[]).concat([i]):o[a]=o[a]?o[a]+", "+i:i}}),o},UV}var GV,$te;function drt(){if($te)return GV;$te=1;var e=Jo();return GV=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),o;function a(i){var l=i;return n&&(r.setAttribute("href",l),l=r.href),r.setAttribute("href",l),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return o=a(window.location.href),function(l){var h=e.isString(l)?a(l):l;return h.protocol===o.protocol&&h.host===o.host}}():function(){return function(){return!0}}(),GV}var XV,Pte;function Dte(){if(Pte)return XV;Pte=1;var e=Jo(),t=art(),n=srt(),r=ehe(),o=lrt(),a=urt(),i=drt(),l=nhe();return XV=function(d){return new Promise(function(m,y){var v=d.data,b=d.headers,w=d.responseType;e.isFormData(v)&&delete b["Content-Type"];var C=new XMLHttpRequest;if(d.auth){var S=d.auth.username||"",N=d.auth.password?unescape(encodeURIComponent(d.auth.password)):"";b.Authorization="Basic "+btoa(S+":"+N)}var L=o(d.baseURL,d.url);C.open(d.method.toUpperCase(),r(L,d.params,d.paramsSerializer),!0),C.timeout=d.timeout;function j(){if(C){var _="getAllResponseHeaders"in C?a(C.getAllResponseHeaders()):null,$=!w||w==="text"||w==="json"?C.responseText:C.response,R={data:$,status:C.status,statusText:C.statusText,headers:_,config:d,request:C};t(m,y,R),C=null}}if("onloadend"in C?C.onloadend=j:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(j)},C.onabort=function(){C&&(y(l("Request aborted",d,"ECONNABORTED",C)),C=null)},C.onerror=function(){y(l("Network Error",d,null,C)),C=null},C.ontimeout=function(){var $="timeout of "+d.timeout+"ms exceeded";d.timeoutErrorMessage&&($=d.timeoutErrorMessage),y(l($,d,d.transitional&&d.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",C)),C=null},e.isStandardBrowserEnv()){var E=(d.withCredentials||i(L))&&d.xsrfCookieName?n.read(d.xsrfCookieName):void 0;E&&(b[d.xsrfHeaderName]=E)}"setRequestHeader"in C&&e.forEach(b,function($,R){typeof v>"u"&&R.toLowerCase()==="content-type"?delete b[R]:C.setRequestHeader(R,$)}),e.isUndefined(d.withCredentials)||(C.withCredentials=!!d.withCredentials),w&&w!=="json"&&(C.responseType=d.responseType),typeof d.onDownloadProgress=="function"&&C.addEventListener("progress",d.onDownloadProgress),typeof d.onUploadProgress=="function"&&C.upload&&C.upload.addEventListener("progress",d.onUploadProgress),d.cancelToken&&d.cancelToken.promise.then(function($){C&&(C.abort(),y($),C=null)}),v||(v=null),C.send(v)})},XV}var WV,zte;function DX(){if(zte)return WV;zte=1;var e=Jo(),t=ort(),n=the(),r={"Content-Type":"application/x-www-form-urlencoded"};function o(h,d){!e.isUndefined(h)&&e.isUndefined(h["Content-Type"])&&(h["Content-Type"]=d)}function a(){var h;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(h=Dte()),h}function i(h,d,f){if(e.isString(h))try{return(d||JSON.parse)(h),e.trim(h)}catch(m){if(m.name!=="SyntaxError")throw m}return(f||JSON.stringify)(h)}var l={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:a(),transformRequest:[function(d,f){return t(f,"Accept"),t(f,"Content-Type"),e.isFormData(d)||e.isArrayBuffer(d)||e.isBuffer(d)||e.isStream(d)||e.isFile(d)||e.isBlob(d)?d:e.isArrayBufferView(d)?d.buffer:e.isURLSearchParams(d)?(o(f,"application/x-www-form-urlencoded;charset=utf-8"),d.toString()):e.isObject(d)||f&&f["Content-Type"]==="application/json"?(o(f,"application/json"),i(d)):d}],transformResponse:[function(d){var f=this.transitional,m=f&&f.silentJSONParsing,y=f&&f.forcedJSONParsing,v=!m&&this.responseType==="json";if(v||y&&e.isString(d)&&d.length)try{return JSON.parse(d)}catch(b){if(v)throw b.name==="SyntaxError"?n(b,this,"E_JSON_PARSE"):b}return d}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(d){return d>=200&&d<300}};return l.headers={common:{Accept:"application/json, text/plain, */*"}},e.forEach(["delete","get","head"],function(d){l.headers[d]={}}),e.forEach(["post","put","patch"],function(d){l.headers[d]=e.merge(r)}),WV=l,WV}var KV,Ote;function hrt(){if(Ote)return KV;Ote=1;var e=Jo(),t=DX();return KV=function(r,o,a){var i=this||t;return e.forEach(a,function(h){r=h.call(i,r,o)}),r},KV}var YV,qte;function rhe(){return qte||(qte=1,YV=function(t){return!!(t&&t.__CANCEL__)}),YV}var ZV,Hte;function frt(){if(Hte)return ZV;Hte=1;var e=Jo(),t=hrt(),n=rhe(),r=DX();function o(a){a.cancelToken&&a.cancelToken.throwIfRequested()}return ZV=function(i){o(i),i.headers=i.headers||{},i.data=t.call(i,i.data,i.headers,i.transformRequest),i.headers=e.merge(i.headers.common||{},i.headers[i.method]||{},i.headers),e.forEach(["delete","get","head","post","put","patch","common"],function(d){delete i.headers[d]});var l=i.adapter||r.adapter;return l(i).then(function(d){return o(i),d.data=t.call(i,d.data,d.headers,i.transformResponse),d},function(d){return n(d)||(o(i),d&&d.response&&(d.response.data=t.call(i,d.response.data,d.response.headers,i.transformResponse))),Promise.reject(d)})},ZV}var JV,Vte;function ohe(){if(Vte)return JV;Vte=1;var e=Jo();return JV=function(n,r){r=r||{};var o={},a=["url","method","data"],i=["headers","auth","proxy","params"],l=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],h=["validateStatus"];function d(v,b){return e.isPlainObject(v)&&e.isPlainObject(b)?e.merge(v,b):e.isPlainObject(b)?e.merge({},b):e.isArray(b)?b.slice():b}function f(v){e.isUndefined(r[v])?e.isUndefined(n[v])||(o[v]=d(void 0,n[v])):o[v]=d(n[v],r[v])}e.forEach(a,function(b){e.isUndefined(r[b])||(o[b]=d(void 0,r[b]))}),e.forEach(i,f),e.forEach(l,function(b){e.isUndefined(r[b])?e.isUndefined(n[b])||(o[b]=d(void 0,n[b])):o[b]=d(void 0,r[b])}),e.forEach(h,function(b){b in r?o[b]=d(n[b],r[b]):b in n&&(o[b]=d(void 0,n[b]))});var m=a.concat(i).concat(l).concat(h),y=Object.keys(n).concat(Object.keys(r)).filter(function(b){return m.indexOf(b)===-1});return e.forEach(y,f),o},JV}const prt="0.21.4",mrt={version:prt};var QV,Bte;function yrt(){if(Bte)return QV;Bte=1;var e=mrt,t={};["object","boolean","number","function","string","symbol"].forEach(function(i,l){t[i]=function(d){return typeof d===i||"a"+(l<1?"n ":" ")+i}});var n={},r=e.version.split(".");function o(i,l){for(var h=l?l.split("."):r,d=i.split("."),f=0;f<3;f++){if(h[f]>d[f])return!0;if(h[f]<d[f])return!1}return!1}t.transitional=function(l,h,d){var f=h&&o(h);function m(y,v){return"[Axios v"+e.version+"] Transitional option '"+y+"'"+v+(d?". "+d:"")}return function(y,v,b){if(l===!1)throw new Error(m(v," has been removed in "+h));return f&&!n[v]&&(n[v]=!0,console.warn(m(v," has been deprecated since v"+h+" and will be removed in the near future"))),l?l(y,v,b):!0}};function a(i,l,h){if(typeof i!="object")throw new TypeError("options must be an object");for(var d=Object.keys(i),f=d.length;f-- >0;){var m=d[f],y=l[m];if(y){var v=i[m],b=v===void 0||y(v,m,i);if(b!==!0)throw new TypeError("option "+m+" must be "+b);continue}if(h!==!0)throw Error("Unknown option "+m)}}return QV={isOlderVersion:o,assertOptions:a,validators:t},QV}var eB,Fte;function grt(){if(Fte)return eB;Fte=1;var e=Jo(),t=ehe(),n=rrt(),r=frt(),o=ohe(),a=yrt(),i=a.validators;function l(h){this.defaults=h,this.interceptors={request:new n,response:new n}}return l.prototype.request=function(d){typeof d=="string"?(d=arguments[1]||{},d.url=arguments[0]):d=d||{},d=o(this.defaults,d),d.method?d.method=d.method.toLowerCase():this.defaults.method?d.method=this.defaults.method.toLowerCase():d.method="get";var f=d.transitional;f!==void 0&&a.assertOptions(f,{silentJSONParsing:i.transitional(i.boolean,"1.0.0"),forcedJSONParsing:i.transitional(i.boolean,"1.0.0"),clarifyTimeoutError:i.transitional(i.boolean,"1.0.0")},!1);var m=[],y=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(d)===!1||(y=y&&j.synchronous,m.unshift(j.fulfilled,j.rejected))});var v=[];this.interceptors.response.forEach(function(j){v.push(j.fulfilled,j.rejected)});var b;if(!y){var w=[r,void 0];for(Array.prototype.unshift.apply(w,m),w=w.concat(v),b=Promise.resolve(d);w.length;)b=b.then(w.shift(),w.shift());return b}for(var C=d;m.length;){var S=m.shift(),N=m.shift();try{C=S(C)}catch(L){N(L);break}}try{b=r(C)}catch(L){return Promise.reject(L)}for(;v.length;)b=b.then(v.shift(),v.shift());return b},l.prototype.getUri=function(d){return d=o(this.defaults,d),t(d.url,d.params,d.paramsSerializer).replace(/^\?/,"")},e.forEach(["delete","get","head","options"],function(d){l.prototype[d]=function(f,m){return this.request(o(m||{},{method:d,url:f,data:(m||{}).data}))}}),e.forEach(["post","put","patch"],function(d){l.prototype[d]=function(f,m,y){return this.request(o(y||{},{method:d,url:f,data:m}))}}),eB=l,eB}var tB,Ute;function ahe(){if(Ute)return tB;Ute=1;function e(t){this.message=t}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,tB=e,tB}var nB,Gte;function xrt(){if(Gte)return nB;Gte=1;var e=ahe();function t(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(i){r=i});var o=this;n(function(i){o.reason||(o.reason=new e(i),r(o.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.source=function(){var r,o=new t(function(i){r=i});return{token:o,cancel:r}},nB=t,nB}var rB,Xte;function vrt(){return Xte||(Xte=1,rB=function(t){return function(r){return t.apply(null,r)}}),rB}var oB,Wte;function krt(){return Wte||(Wte=1,oB=function(t){return typeof t=="object"&&t.isAxiosError===!0}),oB}var Kte;function brt(){if(Kte)return Nx.exports;Kte=1;var e=Jo(),t=Qde(),n=grt(),r=ohe(),o=DX();function a(l){var h=new n(l),d=t(n.prototype.request,h);return e.extend(d,n.prototype,h),e.extend(d,h),d}var i=a(o);return i.Axios=n,i.create=function(h){return a(r(i.defaults,h))},i.Cancel=ahe(),i.CancelToken=xrt(),i.isCancel=rhe(),i.all=function(h){return Promise.all(h)},i.spread=vrt(),i.isAxiosError=krt(),Nx.exports=i,Nx.exports.default=i,Nx.exports}var aB,Yte;function wrt(){return Yte||(Yte=1,aB=brt()),aB}var Mrt=wrt();const sB=Wc(Mrt);function Srt(){const e=Le(G=>G.login),t=Le(G=>G.isAuthenticated),n=Er(),[r,o]=g.useState(""),[a,i]=g.useState(""),[l,h]=g.useState(!1),[d,f]=g.useState(""),[m,y]=g.useState(!1),[v,b]=g.useState(1),[w,C]=g.useState(""),[S,N]=g.useState(""),[L,j]=g.useState(""),[E,_]=g.useState(""),[$,R]=g.useState(""),[V,A]=g.useState(!1),[q,z]=g.useState(""),[B,P]=g.useState(null),[H,D]=g.useState("");g.useEffect(()=>{t&&n("/",{replace:!0})},[t,n]),g.useEffect(()=>{m&&sB.get("/api/auth/config-path").then(G=>{D(G.data.configPath)}).catch(G=>{console.error("Не удалось загрузить путь к конфигу:",G)})},[m]);const U=async G=>{G.preventDefault(),h(!0),f("");try{await e(r,a)}catch(X){f(X.message||"Не удалось войти.")}finally{h(!1)}},W=async G=>{var X,O;if(G.preventDefault(),z(""),!w){z("Введите код восстановления");return}A(!0);try{const Q=await sB.post("/api/auth/recovery/verify",{recoveryCode:w});Q.data.success&&(N(Q.data.resetToken),j(Q.data.username),b(2),z(""))}catch(Q){z(((O=(X=Q.response)==null?void 0:X.data)==null?void 0:O.error)||"Ошибка при проверке кода")}finally{A(!1)}},K=async G=>{var X,O;if(G.preventDefault(),z(""),P(null),E!==$){z("Пароли не совпадают");return}if(E.length<4){z("Пароль должен содержать минимум 4 символа");return}A(!0);try{const Q=await sB.post("/api/auth/recovery/reset",{resetToken:S,newPassword:E});P({message:Q.data.message,username:Q.data.username}),o(Q.data.username),i(""),setTimeout(()=>{y(!1),I()},3e3)}catch(Q){z(((O=(X=Q.response)==null?void 0:X.data)==null?void 0:O.error)||"Ошибка при сбросе пароля")}finally{A(!1)}},I=()=>{b(1),C(""),N(""),j(""),_(""),R(""),z(""),P(null)};return s.jsxs("div",{className:"flex items-center justify-center min-h-screen bg-background",children:[s.jsxs(kt,{className:"w-full max-w-sm",children:[s.jsxs(rn,{children:[s.jsx(Wt,{className:"text-2xl",children:"Вход в BlockMine"}),s.jsx(Jn,{children:"Введите ваши учетные данные для доступа к панели."})]}),s.jsxs("form",{onSubmit:U,children:[s.jsxs(Bt,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"username",children:"Имя пользователя"}),s.jsx($e,{id:"username",value:r,onChange:G=>o(G.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"password",children:"Пароль"}),s.jsx($e,{id:"password",type:"password",value:a,onChange:G=>i(G.target.value),required:!0,autoComplete:"current-password"})]}),d&&s.jsx("p",{className:"text-sm text-destructive",children:d})]}),s.jsxs(Yp,{className:"flex flex-col gap-2",children:[s.jsxs(ie,{type:"submit",className:"w-full",disabled:l,children:[l&&s.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),"Войти"]}),s.jsxs(ie,{type:"button",variant:"link",className:"text-sm text-muted-foreground hover:text-primary",onClick:()=>y(!0),children:[s.jsx(op,{className:"mr-1 h-3 w-3"}),"Забыли пароль?"]})]})]})]}),s.jsx(Ot,{open:m,onOpenChange:G=>{y(G),G||I()},children:s.jsxs(Et,{children:[s.jsxs(qt,{children:[s.jsx(Tt,{children:v===1?"Проверка кода восстановления":"Установка нового пароля"}),s.jsx(hn,{children:v===1?"Введите код восстановления из конфигурационного файла":`Установите новый пароль для пользователя ${L}`})]}),B?s.jsx(Of,{className:"mt-4",children:s.jsxs(qf,{className:"text-green-600",children:[s.jsx("strong",{children:B.message}),s.jsx("br",{}),"Имя пользователя: ",s.jsx("strong",{children:B.username}),s.jsx("br",{}),"Вы можете использовать новый пароль для входа."]})}):v===1?s.jsxs("form",{onSubmit:W,children:[s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"recovery-code",children:"Код восстановления"}),s.jsx($e,{id:"recovery-code",placeholder:"bmr-xxxxxxxxxxxx",value:w,onChange:G=>C(G.target.value),required:!0,disabled:V,autoFocus:!0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Код восстановления находится в файле конфигурации:"}),H&&s.jsx("div",{className:"mt-2 p-2 bg-muted rounded-md",children:s.jsx("code",{className:"text-xs break-all select-all",children:H})})]}),q&&s.jsx(Of,{variant:"destructive",children:s.jsx(qf,{children:q})})]}),s.jsxs(Kt,{children:[s.jsx(ie,{type:"button",variant:"outline",onClick:()=>{y(!1),I()},disabled:V,children:"Отмена"}),s.jsxs(ie,{type:"submit",disabled:V||!w,children:[V&&s.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),"Проверить код"]})]})]}):s.jsxs("form",{onSubmit:K,children:[s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Of,{children:s.jsxs(qf,{children:["Код восстановления подтверждён. Пользователь: ",s.jsx("strong",{children:L})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"new-password",children:"Новый пароль"}),s.jsx($e,{id:"new-password",type:"password",value:E,onChange:G=>_(G.target.value),required:!0,disabled:V,autoFocus:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"confirm-password",children:"Подтвердите пароль"}),s.jsx($e,{id:"confirm-password",type:"password",value:$,onChange:G=>R(G.target.value),required:!0,disabled:V})]}),q&&s.jsx(Of,{variant:"destructive",children:s.jsx(qf,{children:q})})]}),s.jsxs(Kt,{children:[s.jsx(ie,{type:"button",variant:"outline",onClick:()=>b(1),disabled:V,children:"Назад"}),s.jsxs(ie,{type:"submit",disabled:V||!E||!$,children:[V&&s.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),"Сбросить пароль"]})]})]})]})})]})}function Crt(){const e=Le(b=>b.setupAdmin),t=Le(b=>b.isAuthenticated),n=Er(),[r,o]=g.useState(""),[a,i]=g.useState(""),[l,h]=g.useState(""),[d,f]=g.useState(!1),[m,y]=g.useState("");g.useEffect(()=>{t&&n("/",{replace:!0})},[t,n]);const v=async b=>{if(b.preventDefault(),a.length<4){y("Пароль должен содержать не менее 4 символов.");return}if(a!==l){y("Пароли не совпадают.");return}f(!0),y("");try{await e(r,a),Ht({title:"Добро пожаловать!",description:"Вы успешно вошли в систему."})}catch(w){y(w.message||"Не удалось создать аккаунт.")}finally{f(!1)}};return s.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:s.jsxs(kt,{className:"w-full max-w-sm",children:[s.jsxs(rn,{children:[s.jsx(Wt,{className:"text-2xl",children:"Первоначальная настройка"}),s.jsx(Jn,{children:"Создайте аккаунт администратора для панели BlockMine."})]}),s.jsxs("form",{onSubmit:v,children:[s.jsxs(Bt,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"username",children:"Имя администратора"}),s.jsx($e,{id:"username",value:r,onChange:b=>o(b.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"password",children:"Пароль (мин. 4 символа)"}),s.jsx($e,{id:"password",type:"password",value:a,onChange:b=>i(b.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(xe,{htmlFor:"confirmPassword",children:"Подтвердите пароль"}),s.jsx($e,{id:"confirmPassword",type:"password",value:l,onChange:b=>h(b.target.value),required:!0})]}),m&&s.jsx("p",{className:"text-sm text-destructive",children:m})]}),s.jsx(Yp,{children:s.jsxs(ie,{type:"submit",className:"w-full",disabled:d,children:[d&&s.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),"Создать"]})})]})]})})}function iB({title:e,value:t,icon:n,description:r,className:o}){return s.jsxs(kt,{className:pe("transition-all duration-200 hover:shadow-lg hover:scale-[1.02] border-0 shadow-sm",o),children:[s.jsxs(rn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Wt,{className:"text-sm font-medium text-muted-foreground",children:e}),n&&s.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-r from-blue-500/10 to-purple-500/10",children:s.jsx(n,{className:"h-4 w-4 text-blue-500"})})]}),s.jsxs(Bt,{children:[s.jsx("div",{className:"text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:t}),r&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r})]})]})}const Qo=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:pe("w-full caption-bottom text-sm",e),...t})}));Qo.displayName="Table";const ea=g.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:pe("[&_tr]:border-b",e),...t}));ea.displayName="TableHeader";const ta=g.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:pe("[&_tr:last-child]:border-0",e),...t}));ta.displayName="TableBody";const _rt=g.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:pe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));_rt.displayName="TableFooter";const At=g.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:pe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));At.displayName="TableRow";const st=g.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:pe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));st.displayName="TableHead";const Ye=g.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:pe("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ye.displayName="TableCell";const Nrt=g.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:pe("mt-4 text-sm text-muted-foreground",e),...t}));Nrt.displayName="TableCaption";function jrt({bots:e,botStatuses:t}){const{toast:n}=Jt(),r=Er(),o=async(a,i)=>{if(i==="restart"){try{await Ne(`/api/bots/${a.id}/stop`,{method:"POST"}),setTimeout(async()=>{await Ne(`/api/bots/${a.id}/start`,{method:"POST"}),n({title:"Команда отправлена",description:`Бот ${a.username} перезапускается.`})},2e3)}catch{}return}try{await Ne(`/api/bots/${a.id}/${i}`,{method:"POST"},`Команда ${i} отправлена боту.`)}catch{}};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx(Wt,{className:"text-base font-semibold",children:"Все боты"}),s.jsx(Jn,{className:"text-sm",children:"Быстрое управление состоянием всех ботов в системе"})]}),s.jsx("div",{className:"flex-grow overflow-hidden",children:s.jsx("div",{className:"border rounded-lg h-full overflow-y-auto bg-background/50",children:s.jsxs(Qo,{children:[s.jsx(ea,{children:s.jsxs(At,{className:"hover:bg-muted/30",children:[s.jsx(st,{className:"font-semibold",children:"Бот"}),s.jsx(st,{className:"font-semibold",children:"Статус"}),s.jsx(st,{className:"text-right font-semibold",children:"Действия"})]})}),s.jsx(ta,{children:e.map(a=>{const l=(t[a.id]||"stopped")==="running";return s.jsxs(At,{className:"hover:bg-muted/20 transition-colors",children:[s.jsx(Ye,{className:"font-medium",children:a.username}),s.jsx(Ye,{children:s.jsx("span",{className:`px-3 py-1 text-xs rounded-full font-medium ${l?"bg-green-500/10 text-green-600 border border-green-500/20":"bg-red-500/10 text-red-600 border border-red-500/20"}`,children:l?"Запущен":"Остановлен"})}),s.jsx(Ye,{className:"text-right",children:s.jsxs(oX,{children:[s.jsx(aX,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted/50",children:s.jsx(gc,{className:"h-4 w-4"})})}),s.jsxs(Lz,{align:"end",className:"w-48",children:[s.jsxs(Ma,{disabled:l,onClick:()=>o(a,"start"),className:"cursor-pointer",children:[s.jsx(Ec,{className:"mr-2 h-4 w-4"}),"Запустить"]}),s.jsxs(Ma,{disabled:!l,onClick:()=>o(a,"stop"),className:"text-destructive cursor-pointer",children:[s.jsx(Ic,{className:"mr-2 h-4 w-4"}),"Остановить"]}),s.jsxs(Ma,{disabled:!l,onClick:()=>o(a,"restart"),className:"cursor-pointer",children:[s.jsx(d1,{className:"mr-2 h-4 w-4"}),"Перезапустить"]}),s.jsxs(Ma,{onClick:()=>r(`/bots/${a.id}/console`),className:"cursor-pointer",children:[s.jsx(Uo,{className:"mr-2 h-4 w-4"}),"Консоль"]}),s.jsxs(Ma,{onClick:()=>r(`/bots/${a.id}/settings`),className:"cursor-pointer",children:[s.jsx(Fo,{className:"mr-2 h-4 w-4"}),"Настройки"]})]})]})})]},a.id)})})]})})})]})}const Zte=({value:e,max:t,colorClass:n,label:r})=>{const o=Math.min(100,e/t*100);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:r}),s.jsxs("span",{className:"font-mono font-medium",children:[e.toFixed(1),"%"]})]}),s.jsx("div",{className:"w-full bg-muted/50 rounded-full h-2 overflow-hidden",children:s.jsx("div",{className:`${n} h-2 rounded-full transition-all duration-300 ease-out`,style:{width:`${o}%`}})})]})};function Lrt({bots:e,resourceUsage:t}){const n=e.filter(r=>t[r.id]);return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx(Wt,{className:"text-base font-semibold",children:"Использование ресурсов"}),s.jsx(Jn,{className:"text-sm",children:"Нагрузка на CPU и использование RAM запущенными ботами"})]}),s.jsx("div",{className:"flex-grow overflow-y-auto",children:s.jsx("div",{className:"space-y-6",children:n.length>0?n.map(r=>{const o=t[r.id];return s.jsxs("div",{className:"p-4 rounded-lg border bg-background/50 hover:bg-background/70 transition-colors",children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("h4",{className:"font-semibold text-foreground",children:r.username}),s.jsxs(ot,{variant:"outline",className:"text-xs",children:["ID: ",r.id]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:s.jsx(Qf,{className:"h-4 w-4 text-blue-500"})}),s.jsx("div",{className:"flex-grow",children:s.jsx(Zte,{value:o.cpu,max:100,colorClass:"bg-gradient-to-r from-blue-500 to-blue-600",label:"CPU"})})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500/10",children:s.jsx(nm,{className:"h-4 w-4 text-green-500"})}),s.jsx("div",{className:"flex-grow",children:s.jsx(Zte,{value:o.memory,max:500,colorClass:"bg-gradient-to-r from-green-500 to-emerald-600",label:"RAM"})})]})]})]},r.id)}):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx("div",{className:"p-4 rounded-full bg-muted/50 mb-4",children:s.jsx(Qf,{className:"h-8 w-8 text-muted-foreground"})}),s.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:"Нет запущенных ботов"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Запустите ботов для мониторинга ресурсов"})]})})})]})}function Art(){const e=Le(b=>b.bots),t=Le(b=>b.botStatuses),n=Le(b=>b.resourceUsage),r=Le(b=>b.fetchInitialData),o=Le(b=>b.startAllBots),a=Le(b=>b.stopAllBots),i=Le(b=>b.hasPermission),{toast:l}=Jt(),h=Er(),[d,f]=g.useState(!1),m=g.useMemo(()=>{const b=e.filter(w=>t[w.id]==="running").length;return{totalBots:e.length,runningBots:b,stoppedBots:e.length-b}},[e,t]),y=async b=>{const w=b==="start"?"запустить":"остановить";window.confirm(`Вы уверены, что хотите ${w} ВСЕХ ботов?`)&&(b==="start"?await o():await a())},v=b=>{f(!1),r(),l({title:"Успех!",description:`Бот "${b.username}" успешно импортирован.`}),h(`/bots/${b.id}`)};return s.jsxs("div",{className:"flex flex-col h-full w-full p-4 sm:p-6 gap-4 sm:gap-6 overflow-y-auto",children:[s.jsxs("header",{className:"flex flex-col lg:flex-row items-start lg:items-center justify-between gap-4 p-4 sm:p-6 rounded-xl bg-gradient-to-r from-blue-500/5 via-purple-500/5 to-blue-500/5 border border-blue-500/10",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 rounded-lg bg-gradient-to-r from-blue-500 to-purple-500 shadow-lg",children:s.jsx(c1,{className:"h-6 w-6 text-white"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"Дашборд"}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Общая сводка по вашей системе BlockMineJS"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 sm:gap-3",children:[i("bot:import")&&s.jsxs(Ot,{open:d,onOpenChange:f,children:[s.jsx(yo,{asChild:!0,children:s.jsxs(ie,{variant:"outline",className:"border-blue-500/20 hover:bg-blue-500/5 hover:border-blue-500/40",children:[s.jsx(Qa,{className:"mr-2 h-4 w-4"}),"Импорт бота"]})}),s.jsx(Yce,{onImportSuccess:v,onCancel:()=>f(!1)})]}),i("bot:start_stop")&&s.jsxs(s.Fragment,{children:[s.jsxs(ie,{onClick:()=>y("start"),className:"bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white shadow-lg hover:shadow-xl transition-all duration-200",children:[s.jsx(Ec,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Запустить всех"})]}),s.jsxs(ie,{variant:"destructive",onClick:()=>y("stop"),className:"bg-gradient-to-r from-red-500 to-pink-500 hover:from-red-600 hover:to-pink-600 shadow-lg hover:shadow-xl transition-all duration-200",children:[s.jsx(Ic,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Остановить всех"})]})]})]})]}),s.jsxs("main",{className:"grid gap-4 sm:gap-6 md:grid-cols-2 lg:grid-cols-3 flex-grow",children:[s.jsx("div",{className:"md:col-span-1 space-y-4",children:s.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/5 to-purple-500/5 border border-blue-500/10",children:[s.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[s.jsx(Mi,{className:"h-5 w-5 text-blue-500"}),"Статистика системы"]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(iB,{title:"Всего ботов",value:m.totalBots,icon:r1,className:"border-blue-500/20 hover:border-blue-500/40 bg-gradient-to-r from-blue-500/5 to-blue-500/10"}),s.jsx(iB,{title:"Запущено",value:m.runningBots,icon:Ec,className:"border-green-500/20 hover:border-green-500/40 bg-gradient-to-r from-green-500/5 to-green-500/10"}),s.jsx(iB,{title:"Остановлено",value:m.stoppedBots,icon:Ic,className:"border-red-500/20 hover:border-red-500/40 bg-gradient-to-r from-red-500/5 to-red-500/10"})]})]})}),s.jsx("div",{className:"md:col-span-1 min-h-[420px] sm:min-h-[500px]",children:s.jsxs("div",{className:"h-full p-4 rounded-xl bg-gradient-to-r from-purple-500/5 to-pink-500/5 border border-purple-500/10",children:[s.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[s.jsx(f1,{className:"h-5 w-5 text-purple-500"}),"Быстрое управление"]}),s.jsx(jrt,{bots:e,botStatuses:t})]})}),s.jsx("div",{className:"md:col-span-1 min-h-[420px] sm:min-h-[500px]",children:s.jsxs("div",{className:"h-full p-4 rounded-xl bg-gradient-to-r from-emerald-500/5 to-teal-500/5 border border-emerald-500/10",children:[s.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[s.jsx(Mi,{className:"h-5 w-5 text-emerald-500"}),"Мониторинг ресурсов"]}),s.jsx(Lrt,{bots:e,resourceUsage:n})]})})]})]})}var Hz="Checkbox",[Ert,Pen]=or(Hz),[Trt,zX]=Ert(Hz);function Irt(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:a,form:i,name:l,onCheckedChange:h,required:d,value:f="on",internal_do_not_use_render:m}=e,[y,v]=Jr({prop:n,defaultProp:o??!1,onChange:h,caller:Hz}),[b,w]=g.useState(null),[C,S]=g.useState(null),N=g.useRef(!1),L=b?!!i||!!b.closest("form"):!0,j={checked:y,disabled:a,setChecked:v,control:b,setControl:w,name:l,form:i,value:f,hasConsumerStoppedPropagationRef:N,required:d,defaultChecked:$c(o)?!1:o,isFormControl:L,bubbleInput:C,setBubbleInput:S};return s.jsx(Trt,{scope:t,...j,children:Rrt(m)?m(j):r})}var she="CheckboxTrigger",ihe=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:a,value:i,disabled:l,checked:h,required:d,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:y,isFormControl:v,bubbleInput:b}=zX(she,e),w=ut(o,f),C=g.useRef(h);return g.useEffect(()=>{const S=a==null?void 0:a.form;if(S){const N=()=>m(C.current);return S.addEventListener("reset",N),()=>S.removeEventListener("reset",N)}},[a,m]),s.jsx(Pe.button,{type:"button",role:"checkbox","aria-checked":$c(h)?"mixed":h,"aria-required":d,"data-state":hhe(h),"data-disabled":l?"":void 0,disabled:l,value:i,...r,ref:w,onKeyDown:Ee(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Ee(n,S=>{m(N=>$c(N)?!0:!N),b&&v&&(y.current=S.isPropagationStopped(),y.current||S.stopPropagation())})})});ihe.displayName=she;var OX=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:i,disabled:l,value:h,onCheckedChange:d,form:f,...m}=e;return s.jsx(Irt,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:l,required:i,onCheckedChange:d,name:r,form:f,value:h,internal_do_not_use_render:({isFormControl:y})=>s.jsxs(s.Fragment,{children:[s.jsx(ihe,{...m,ref:t,__scopeCheckbox:n}),y&&s.jsx(dhe,{__scopeCheckbox:n})]})})});OX.displayName=Hz;var che="CheckboxIndicator",lhe=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=zX(che,n);return s.jsx(ar,{present:r||$c(a.checked)||a.checked===!0,children:s.jsx(Pe.span,{"data-state":hhe(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});lhe.displayName=che;var uhe="CheckboxBubbleInput",dhe=g.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:i,required:l,disabled:h,name:d,value:f,form:m,bubbleInput:y,setBubbleInput:v}=zX(uhe,e),b=ut(n,v),w=kz(a),C=yz(r);g.useEffect(()=>{const N=y;if(!N)return;const L=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(L,"checked").set,_=!o.current;if(w!==a&&E){const $=new Event("click",{bubbles:_});N.indeterminate=$c(a),E.call(N,$c(a)?!1:a),N.dispatchEvent($)}},[y,w,a,o]);const S=g.useRef($c(a)?!1:a);return s.jsx(Pe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??S.current,required:l,disabled:h,name:d,value:f,form:m,...t,tabIndex:-1,ref:b,style:{...t.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});dhe.displayName=uhe;function Rrt(e){return typeof e=="function"}function $c(e){return e==="indeterminate"}function hhe(e){return $c(e)?"indeterminate":e?"checked":"unchecked"}const Yr=g.forwardRef(({className:e,...t},n)=>s.jsx(OX,{ref:n,className:pe("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:s.jsx(lhe,{className:pe("flex items-center justify-center text-current"),children:s.jsx(Ka,{className:"h-4 w-4"})})}));Yr.displayName=OX.displayName;function $rt({bot:e,onCancel:t}){const[n,r]=g.useState(!1),[o,a]=g.useState({includeCommands:!0,includePermissions:!0,includePluginFiles:!0,includePluginDataStore:!0,includeEventGraphs:!0}),i=(h,d)=>{a(f=>({...f,[h]:d}))},l=async()=>{r(!0);const h=new URLSearchParams(o).toString(),d=`/api/bots/${e.id}/export?${h}`;try{const f=await Ne(d,{method:"GET"});if(f instanceof Blob){const m=window.URL.createObjectURL(f),y=document.createElement("a");y.href=m,y.setAttribute("download",`bot_${e.username}_export.zip`),document.body.appendChild(y),y.click(),y.parentNode.removeChild(y),window.URL.revokeObjectURL(m),Ht({title:"Успех!",description:"Экспорт бота запущен."}),t()}else throw new Error("Не удалось получить файл для скачивания от сервера.")}catch(f){console.error("Ошибка экспорта бота:",f)}finally{r(!1)}};return s.jsxs(Et,{children:[s.jsxs(qt,{children:[s.jsxs(Tt,{children:["Экспорт конфигурации: ",e.username]}),s.jsx(hn,{children:"Выберите данные, которые вы хотите включить в ZIP-архив."})]}),s.jsxs("div",{className:"py-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Yr,{id:"includeCommands",checked:o.includeCommands,onCheckedChange:h=>i("includeCommands",h)}),s.jsx(xe,{htmlFor:"includeCommands",children:"Настройки команд (алиасы, кулдауны и т.д.)"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Yr,{id:"includePermissions",checked:o.includePermissions,onCheckedChange:h=>i("includePermissions",h)}),s.jsx(xe,{htmlFor:"includePermissions",children:"Пользователи и права доступа"})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Yr,{id:"includePluginFiles",checked:o.includePluginFiles,onCheckedChange:h=>i("includePluginFiles",h)}),s.jsxs("div",{className:"grid gap-1.5 leading-none",children:[s.jsx(xe,{htmlFor:"includePluginFiles",children:"Включить файлы плагинов"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Сохраняет не только список плагинов, но и их файлы, включая конфиги. Рекомендуется для полного бэкапа."})]})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Yr,{id:"includePluginDataStore",checked:o.includePluginDataStore,onCheckedChange:h=>i("includePluginDataStore",h)}),s.jsxs("div",{className:"grid gap-1.5 leading-none",children:[s.jsx(xe,{htmlFor:"includePluginDataStore",children:"Базы данных плагинов"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Все значения, которые плагины хранили в своих базах данных (DataStore), будут сохранены."})]})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Yr,{id:"includeEventGraphs",checked:o.includeEventGraphs,onCheckedChange:h=>i("includeEventGraphs",h)}),s.jsxs("div",{className:"grid gap-1.5 leading-none",children:[s.jsx(xe,{htmlFor:"includeEventGraphs",children:"Графы событий (субграфы)"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Сохраняет все созданные графы событий и их настройки."})]})]})]}),s.jsxs(Kt,{children:[s.jsx(ie,{variant:"ghost",onClick:t,children:"Отмена"}),s.jsxs(ie,{onClick:l,disabled:n,children:[n?s.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Vo,{className:"mr-2 h-4 w-4"}),n?"Экспорт...":"Скачать архив"]})]})]})}var fhe="AlertDialog",[Prt,Den]=or(fhe,[lie]),$i=lie(),phe=e=>{const{__scopeAlertDialog:t,...n}=e,r=$i(t);return s.jsx(cz,{...r,...n,modal:!0})};phe.displayName=fhe;var Drt="AlertDialogTrigger",mhe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=$i(n);return s.jsx(TG,{...o,...r,ref:t})});mhe.displayName=Drt;var zrt="AlertDialogPortal",yhe=e=>{const{__scopeAlertDialog:t,...n}=e,r=$i(t);return s.jsx(lz,{...r,...n})};yhe.displayName=zrt;var Ort="AlertDialogOverlay",ghe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=$i(n);return s.jsx(Up,{...o,...r,ref:t})});ghe.displayName=Ort;var gp="AlertDialogContent",[qrt,Hrt]=Prt(gp),Vrt=dse("AlertDialogContent"),xhe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,a=$i(n),i=g.useRef(null),l=ut(t,i),h=g.useRef(null);return s.jsx(lGe,{contentName:gp,titleName:vhe,docsSlug:"alert-dialog",children:s.jsx(qrt,{scope:n,cancelRef:h,children:s.jsxs(Gp,{role:"alertdialog",...a,...o,ref:l,onOpenAutoFocus:Ee(o.onOpenAutoFocus,d=>{var f;d.preventDefault(),(f=h.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[s.jsx(Vrt,{children:r}),s.jsx(Frt,{contentRef:i})]})})})});xhe.displayName=gp;var vhe="AlertDialogTitle",khe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=$i(n);return s.jsx(ky,{...o,...r,ref:t})});khe.displayName=vhe;var bhe="AlertDialogDescription",whe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=$i(n);return s.jsx(by,{...o,...r,ref:t})});whe.displayName=bhe;var Brt="AlertDialogAction",Mhe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=$i(n);return s.jsx(uz,{...o,...r,ref:t})});Mhe.displayName=Brt;var She="AlertDialogCancel",Che=g.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=Hrt(She,n),a=$i(n),i=ut(t,o);return s.jsx(uz,{...a,...r,ref:i})});Che.displayName=She;var Frt=({contentRef:e})=>{const t=`\`${gp}\` requires a description for the component to be accessible for screen reader users.
8166
8166
 
8167
8167
  You can add a description to the \`${gp}\` by passing a \`${bhe}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
@@ -42,7 +42,7 @@
42
42
  <meta name="msapplication-TileColor" content="#da532c">
43
43
  <meta name="theme-color" content="#ffffff">
44
44
 
45
- <script type="module" crossorigin src="/assets/index-5m_JZxJ-.js"></script>
45
+ <script type="module" crossorigin src="/assets/index-DxdxTe6I.js"></script>
46
46
  <link rel="stylesheet" crossorigin href="/assets/index-BFd7YoAj.css">
47
47
  </head>
48
48
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockmine",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "Мощная панель управления ботами для Майнкрафта.",
5
5
  "author": "merka",
6
6
  "license": "MIT",