commandmate 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +21 -21
  3. package/.next/app-path-routes-manifest.json +1 -1
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/cache/config.json +3 -3
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/1.pack +0 -0
  9. package/.next/cache/webpack/client-production/2.pack +0 -0
  10. package/.next/cache/webpack/client-production/index.pack +0 -0
  11. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  12. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  13. package/.next/cache/webpack/server-production/0.pack +0 -0
  14. package/.next/cache/webpack/server-production/index.pack +0 -0
  15. package/.next/next-server.js.nft.json +1 -1
  16. package/.next/prerender-manifest.json +1 -1
  17. package/.next/required-server-files.json +1 -1
  18. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/app/update-check/route.js +1 -1
  20. package/.next/server/app/api/repositories/route.js +1 -1
  21. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  22. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  23. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  24. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  25. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  26. package/.next/server/app/page_client-reference-manifest.js +1 -1
  27. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/worktrees/[id]/page.js +3 -3
  29. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  30. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  31. package/.next/server/app-paths-manifest.json +10 -10
  32. package/.next/server/chunks/2509.js +1 -0
  33. package/.next/server/chunks/369.js +1 -1
  34. package/.next/server/chunks/7536.js +1 -1
  35. package/.next/server/chunks/7808.js +1 -1
  36. package/.next/server/chunks/8693.js +1 -1
  37. package/.next/server/chunks/8744.js +1 -1
  38. package/.next/server/chunks/9238.js +1 -1
  39. package/.next/server/middleware-build-manifest.js +1 -1
  40. package/.next/server/pages/500.html +1 -1
  41. package/.next/server/server-reference-manifest.json +1 -1
  42. package/.next/static/chunks/9178-88850a7c48deea07.js +1 -0
  43. package/.next/static/chunks/app/worktrees/[id]/page-d9a7913679eccfd9.js +1 -0
  44. package/.next/static/chunks/{webpack-af8567a485ade35a.js → webpack-e6531fcf859d9451.js} +1 -1
  45. package/.next/static/css/897ffb669f47c97b.css +3 -0
  46. package/.next/trace +5 -5
  47. package/README.md +154 -181
  48. package/dist/server/src/config/auto-yes-config.js +44 -2
  49. package/dist/server/src/lib/auto-yes-manager.js +135 -16
  50. package/dist/server/src/lib/response-poller.js +92 -39
  51. package/package.json +8 -7
  52. package/.next/static/chunks/8864-2f60eadc8404fdd0.js +0 -1
  53. package/.next/static/chunks/app/worktrees/[id]/page-dc0dde49ed95076f.js +0 -1
  54. package/.next/static/css/7c6675f6f65b4990.css +0 -3
  55. /package/.next/static/{ZTtC8-q8xrYUSilnXmMHl → oUEq-Bd47xtkJcFDOI6rr}/_buildManifest.js +0 -0
  56. /package/.next/static/{ZTtC8-q8xrYUSilnXmMHl → oUEq-Bd47xtkJcFDOI6rr}/_ssgManifest.js +0 -0
@@ -15,10 +15,13 @@ exports.calculateBackoffInterval = calculateBackoffInterval;
15
15
  exports.isAutoYesExpired = isAutoYesExpired;
16
16
  exports.getAutoYesState = getAutoYesState;
17
17
  exports.setAutoYesEnabled = setAutoYesEnabled;
18
+ exports.disableAutoYes = disableAutoYes;
18
19
  exports.clearAllAutoYesStates = clearAllAutoYesStates;
19
20
  exports.getActivePollerCount = getActivePollerCount;
20
21
  exports.clearAllPollerStates = clearAllPollerStates;
21
22
  exports.getLastServerResponseTimestamp = getLastServerResponseTimestamp;
23
+ exports.executeRegexWithTimeout = executeRegexWithTimeout;
24
+ exports.checkStopCondition = checkStopCondition;
22
25
  exports.startAutoYesPolling = startAutoYesPolling;
23
26
  exports.stopAutoYesPolling = stopAutoYesPolling;
24
27
  exports.stopAllAutoYesPolling = stopAllAutoYesPolling;
@@ -130,14 +133,9 @@ function getAutoYesState(worktreeId) {
130
133
  const state = autoYesStates.get(worktreeId);
131
134
  if (!state)
132
135
  return null;
133
- // Auto-disable if expired
136
+ // Auto-disable if expired (Issue #314: delegate to disableAutoYes)
134
137
  if (isAutoYesExpired(state)) {
135
- const disabledState = {
136
- ...state,
137
- enabled: false,
138
- };
139
- autoYesStates.set(worktreeId, disabledState);
140
- return disabledState;
138
+ return disableAutoYes(worktreeId, 'expired');
141
139
  }
142
140
  return state;
143
141
  }
@@ -145,8 +143,10 @@ function getAutoYesState(worktreeId) {
145
143
  * Set the auto-yes enabled state for a worktree
146
144
  * @param duration - Optional duration in milliseconds (must be an ALLOWED_DURATIONS value).
147
145
  * Defaults to DEFAULT_AUTO_YES_DURATION (1 hour) when omitted.
146
+ * @param stopPattern - Optional regex pattern for stop condition (Issue #314).
147
+ * When terminal output matches this pattern, auto-yes is automatically disabled.
148
148
  */
149
- function setAutoYesEnabled(worktreeId, enabled, duration) {
149
+ function setAutoYesEnabled(worktreeId, enabled, duration, stopPattern) {
150
150
  if (enabled) {
151
151
  const now = Date.now();
152
152
  const effectiveDuration = duration ?? auto_yes_config_1.DEFAULT_AUTO_YES_DURATION;
@@ -154,21 +154,38 @@ function setAutoYesEnabled(worktreeId, enabled, duration) {
154
154
  enabled: true,
155
155
  enabledAt: now,
156
156
  expiresAt: now + effectiveDuration,
157
+ stopPattern,
157
158
  };
158
159
  autoYesStates.set(worktreeId, state);
159
160
  return state;
160
161
  }
161
162
  else {
162
- const existing = autoYesStates.get(worktreeId);
163
- const state = {
164
- enabled: false,
165
- enabledAt: existing?.enabledAt ?? 0,
166
- expiresAt: existing?.expiresAt ?? 0,
167
- };
168
- autoYesStates.set(worktreeId, state);
169
- return state;
163
+ // Issue #314: Delegate disable path to disableAutoYes()
164
+ return disableAutoYes(worktreeId);
170
165
  }
171
166
  }
167
+ /**
168
+ * Disable auto-yes for a worktree with an optional reason.
169
+ * Preserves existing state fields (enabledAt, expiresAt, stopPattern) for inspection.
170
+ *
171
+ * Issue #314: Centralized disable logic for expiration, stop pattern match, and manual disable.
172
+ *
173
+ * @param worktreeId - Worktree identifier
174
+ * @param reason - Optional reason for disabling ('expired' | 'stop_pattern_matched')
175
+ * @returns Updated auto-yes state
176
+ */
177
+ function disableAutoYes(worktreeId, reason) {
178
+ const existing = autoYesStates.get(worktreeId);
179
+ const state = {
180
+ enabled: false,
181
+ enabledAt: existing?.enabledAt ?? 0,
182
+ expiresAt: existing?.expiresAt ?? 0,
183
+ stopPattern: existing?.stopPattern,
184
+ stopReason: reason,
185
+ };
186
+ autoYesStates.set(worktreeId, state);
187
+ return state;
188
+ }
172
189
  /**
173
190
  * Clear all auto-yes states.
174
191
  * @internal Exported for testing purposes only.
@@ -254,6 +271,77 @@ function incrementErrorCount(worktreeId) {
254
271
  function isDuplicatePrompt(pollerState, promptKey) {
255
272
  return pollerState.lastAnsweredPromptKey === promptKey;
256
273
  }
274
+ // =============================================================================
275
+ // Stop Condition (Issue #314)
276
+ // =============================================================================
277
+ /**
278
+ * Execute a regex test with timeout protection.
279
+ * Uses synchronous execution with safe-regex2 pre-validation as the primary defense.
280
+ *
281
+ * Note: Node.js is single-threaded, so true async timeout requires Worker threads.
282
+ * The safe-regex2 pre-validation in validateStopPattern() prevents catastrophic
283
+ * backtracking patterns from reaching this function. The timeoutMs parameter is
284
+ * reserved for future Worker thread implementation.
285
+ *
286
+ * @internal Exported for testing purposes only.
287
+ * @param regex - Pre-compiled RegExp to test
288
+ * @param text - Text to test against
289
+ * @param _timeoutMs - Reserved for future timeout implementation (default: 100ms)
290
+ * @returns true/false for match result, null if execution failed
291
+ */
292
+ function executeRegexWithTimeout(regex, text,
293
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
294
+ _timeoutMs = 100) {
295
+ try {
296
+ return regex.test(text);
297
+ }
298
+ catch {
299
+ return null;
300
+ }
301
+ }
302
+ /**
303
+ * Check if the terminal output matches the stop condition pattern.
304
+ * If matched, disables auto-yes and stops polling for the worktree.
305
+ *
306
+ * Security: Pattern is re-validated before execution to handle cases where
307
+ * a previously valid pattern becomes invalid (e.g., state corruption).
308
+ *
309
+ * @internal Exported for testing purposes only.
310
+ * @param worktreeId - Worktree identifier
311
+ * @param cleanOutput - ANSI-stripped terminal output to check
312
+ * @returns true if stop condition matched and auto-yes was disabled
313
+ */
314
+ function checkStopCondition(worktreeId, cleanOutput) {
315
+ const autoYesState = getAutoYesState(worktreeId);
316
+ if (!autoYesState?.stopPattern)
317
+ return false;
318
+ const validation = (0, auto_yes_config_1.validateStopPattern)(autoYesState.stopPattern);
319
+ if (!validation.valid) {
320
+ console.warn('[Auto-Yes] Invalid stop pattern, disabling', { worktreeId });
321
+ disableAutoYes(worktreeId);
322
+ return false;
323
+ }
324
+ try {
325
+ const regex = new RegExp(autoYesState.stopPattern);
326
+ const matched = executeRegexWithTimeout(regex, cleanOutput);
327
+ if (matched === null) {
328
+ // Execution failed - disable to prevent future errors
329
+ console.warn('[Auto-Yes] Stop condition check failed, disabling pattern', { worktreeId });
330
+ disableAutoYes(worktreeId);
331
+ return false;
332
+ }
333
+ if (matched) {
334
+ disableAutoYes(worktreeId, 'stop_pattern_matched');
335
+ stopAutoYesPolling(worktreeId);
336
+ console.warn('[Auto-Yes] Stop condition matched, auto-yes disabled', { worktreeId });
337
+ return true;
338
+ }
339
+ }
340
+ catch {
341
+ console.warn('[Auto-Yes] Stop condition check error', { worktreeId });
342
+ }
343
+ return false;
344
+ }
257
345
  /**
258
346
  * Internal polling function that recursively schedules itself via setTimeout.
259
347
  * Captures tmux output, detects prompts, and sends auto-responses when appropriate.
@@ -304,6 +392,36 @@ async function pollAutoYes(worktreeId, cliToolId) {
304
392
  scheduleNextPoll(worktreeId, cliToolId);
305
393
  return;
306
394
  }
395
+ // 2.7. Check stop condition (Issue #314)
396
+ // After thinking check, before prompt detection: if terminal output matches
397
+ // the stop pattern, disable auto-yes and stop polling immediately.
398
+ //
399
+ // Delta-based check: Only check NEW output since Auto-Yes was enabled.
400
+ // On the first poll, establish the baseline output length (skip check to
401
+ // avoid matching pre-existing terminal content like shell prompts or paths).
402
+ // On subsequent polls, check only the output delta (new content appended).
403
+ // If the buffer shrank (tmux scrollback shifted), reset baseline and skip
404
+ // that cycle to avoid false positives from old content.
405
+ if (pollerState.stopCheckBaselineLength < 0) {
406
+ // First poll: set baseline, skip stop condition check
407
+ pollerState.stopCheckBaselineLength = cleanOutput.length;
408
+ }
409
+ else {
410
+ const baseline = pollerState.stopCheckBaselineLength;
411
+ if (cleanOutput.length > baseline) {
412
+ // Output grew: check only new content (delta)
413
+ const newContent = cleanOutput.substring(baseline);
414
+ pollerState.stopCheckBaselineLength = cleanOutput.length;
415
+ if (checkStopCondition(worktreeId, newContent)) {
416
+ return;
417
+ }
418
+ }
419
+ else if (cleanOutput.length < baseline) {
420
+ // Buffer shrank (old lines dropped from scrollback): reset baseline
421
+ pollerState.stopCheckBaselineLength = cleanOutput.length;
422
+ }
423
+ // If length unchanged: no new content, skip check
424
+ }
307
425
  // 3. Detect prompt
308
426
  const promptOptions = (0, cli_patterns_1.buildDetectPromptOptions)(cliToolId);
309
427
  const promptDetection = (0, prompt_detector_1.detectPrompt)(cleanOutput, promptOptions);
@@ -413,6 +531,7 @@ function startAutoYesPolling(worktreeId, cliToolId) {
413
531
  currentInterval: exports.POLLING_INTERVAL_MS,
414
532
  lastServerResponseTimestamp: null,
415
533
  lastAnsweredPromptKey: null, // S2-F003: initialized to null
534
+ stopCheckBaselineLength: -1, // Issue #314 fix: -1 = first poll (baseline not set)
416
535
  };
417
536
  autoYesPollerStates.set(worktreeId, pollerState);
418
537
  // Start polling immediately
@@ -17,6 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.cleanClaudeResponse = cleanClaudeResponse;
19
19
  exports.cleanGeminiResponse = cleanGeminiResponse;
20
+ exports.resolveExtractionStartIndex = resolveExtractionStartIndex;
20
21
  exports.startPolling = startPolling;
21
22
  exports.stopPolling = stopPolling;
22
23
  exports.stopAllPolling = stopAllPolling;
@@ -72,6 +73,31 @@ const GEMINI_LOADING_INDICATORS = [
72
73
  function incompleteResult(lineCount) {
73
74
  return { response: '', isComplete: false, lineCount };
74
75
  }
76
+ /**
77
+ * Build a complete ExtractionResult for a detected prompt.
78
+ *
79
+ * Shared between Claude early prompt detection (section 3-4, site 1) and
80
+ * fallback prompt detection (section 3-4, site 2) in extractResponse().
81
+ * Applies resolveExtractionStartIndex() to limit extraction to lastCapturedLine
82
+ * onwards, then strips ANSI codes for safe DB storage (Stage 4 MF-001).
83
+ *
84
+ * @param lines - The trimmed tmux buffer lines array
85
+ * @param lastCapturedLine - Number of lines previously captured
86
+ * @param totalLines - Total line count in the buffer
87
+ * @param bufferReset - External buffer reset flag
88
+ * @param cliToolId - CLI tool identifier
89
+ * @param findRecentUserPromptIndex - Callback to locate the most recent user prompt
90
+ * @returns ExtractionResult with isComplete: true and ANSI-stripped response
91
+ */
92
+ function buildPromptExtractionResult(lines, lastCapturedLine, totalLines, bufferReset, cliToolId, findRecentUserPromptIndex) {
93
+ const startIndex = resolveExtractionStartIndex(lastCapturedLine, totalLines, bufferReset, cliToolId, findRecentUserPromptIndex);
94
+ const extractedLines = lines.slice(startIndex);
95
+ return {
96
+ response: (0, cli_patterns_1.stripAnsi)(extractedLines.join('\n')),
97
+ isComplete: true,
98
+ lineCount: totalLines,
99
+ };
100
+ }
75
101
  /**
76
102
  * Active pollers map: "worktreeId:cliToolId" -> NodeJS.Timeout
77
103
  */
@@ -223,6 +249,64 @@ function cleanGeminiResponse(response) {
223
249
  }
224
250
  return cleanedLines.join('\n').trim();
225
251
  }
252
+ /**
253
+ * Determine the start index for response extraction based on buffer state.
254
+ * Shared between normal response extraction and prompt detection paths.
255
+ *
256
+ * Implements a 4-branch decision tree for startIndex determination:
257
+ * 1. bufferWasReset -> findRecentUserPromptIndex(40) + 1, or 0 if not found
258
+ * 2. cliToolId === 'codex' -> Math.max(0, lastCapturedLine)
259
+ * 3. lastCapturedLine >= totalLines - 5 (scroll boundary) ->
260
+ * findRecentUserPromptIndex(50) + 1, or totalLines - 40 if not found
261
+ * 4. Normal case -> Math.max(0, lastCapturedLine)
262
+ *
263
+ * `bufferWasReset` is computed internally from `lastCapturedLine`, `totalLines`,
264
+ * and `bufferReset`. Callers do NOT need to pre-compute `bufferWasReset`.
265
+ * (Design: MF-001 responsibility boundary)
266
+ *
267
+ * Design references:
268
+ * - Issue #326 design policy section 3-2 (4-branch startIndex table)
269
+ * - Stage 4 SF-001: Defensive validation (negative lastCapturedLine clamped to 0)
270
+ * - Stage 1 SF-001: findRecentUserPromptIndex as callback for SRP/testability
271
+ *
272
+ * @param lastCapturedLine - Number of lines previously captured from the tmux buffer.
273
+ * Negative values are defensively clamped to 0 (Stage 4 SF-001).
274
+ * @param totalLines - Total number of (non-empty-trailing) lines in the current tmux buffer.
275
+ * @param bufferReset - External flag indicating the buffer was reset (e.g., session restart).
276
+ * Combined with `lastCapturedLine >= totalLines` to derive internal `bufferWasReset`.
277
+ * @param cliToolId - CLI tool identifier. Affects branch 2 (Codex-specific path).
278
+ * Note: When called from the Claude early prompt detection path (section 3-4),
279
+ * cliToolId is always 'claude', making the Codex branch unreachable in that context.
280
+ * The parameter is retained for the function's generality across all call sites.
281
+ * @param findRecentUserPromptIndex - Callback that searches the tmux buffer backwards
282
+ * for the most recent user prompt line within a given window size.
283
+ * Returns the line index (>= 0) if found, or -1 if not found.
284
+ * @returns The 0-based line index from which response extraction should begin.
285
+ *
286
+ * @internal Exported for testing only
287
+ */
288
+ function resolveExtractionStartIndex(lastCapturedLine, totalLines, bufferReset, cliToolId, findRecentUserPromptIndex) {
289
+ // Defensive validation: clamp negative values to 0 (Stage 4 SF-001)
290
+ lastCapturedLine = Math.max(0, lastCapturedLine);
291
+ // Compute bufferWasReset internally (MF-001: responsibility boundary)
292
+ const bufferWasReset = lastCapturedLine >= totalLines || bufferReset;
293
+ // Branch 1: Buffer was reset - find the most recent user prompt as anchor
294
+ if (bufferWasReset) {
295
+ const foundUserPrompt = findRecentUserPromptIndex(40);
296
+ return foundUserPrompt >= 0 ? foundUserPrompt + 1 : 0;
297
+ }
298
+ // Branch 2: Codex uses lastCapturedLine directly (Codex-specific TUI behavior)
299
+ if (cliToolId === 'codex') {
300
+ return Math.max(0, lastCapturedLine);
301
+ }
302
+ // Branch 3: Near scroll boundary - buffer may have scrolled, search for user prompt
303
+ if (lastCapturedLine >= totalLines - 5) {
304
+ const foundUserPrompt = findRecentUserPromptIndex(50);
305
+ return foundUserPrompt >= 0 ? foundUserPrompt + 1 : Math.max(0, totalLines - 40);
306
+ }
307
+ // Branch 4: Normal case - start from lastCapturedLine
308
+ return Math.max(0, lastCapturedLine);
309
+ }
226
310
  /**
227
311
  * Extract CLI tool response from tmux output
228
312
  * Detects when a CLI tool has completed a response by looking for tool-specific patterns
@@ -278,13 +362,8 @@ function extractResponse(output, lastCapturedLine, cliToolId) {
278
362
  const fullOutput = lines.join('\n');
279
363
  const promptDetection = detectPromptWithOptions(fullOutput, cliToolId);
280
364
  if (promptDetection.isPrompt) {
281
- // Return the full output as a complete interactive prompt
282
- // Use the cleaned output without ANSI codes
283
- return {
284
- response: (0, cli_patterns_1.stripAnsi)(fullOutput),
285
- isComplete: true,
286
- lineCount: totalLines,
287
- };
365
+ // Prompt detection uses full buffer for accuracy, but return only lastCapturedLine onwards
366
+ return buildPromptExtractionResult(lines, lastCapturedLine, totalLines, bufferReset, cliToolId, findRecentUserPromptIndex);
288
367
  }
289
368
  }
290
369
  // Strip ANSI codes before pattern matching
@@ -302,32 +381,9 @@ function extractResponse(output, lastCapturedLine, cliToolId) {
302
381
  // CLI tool has completed response
303
382
  // Extract the response content from lastCapturedLine to the separator (not just last 20 lines)
304
383
  const responseLines = [];
305
- // Handle tmux buffer scrolling: if lastCapturedLine >= totalLines, the buffer has scrolled
306
- // In this case, we need to find the response in the current visible buffer
307
- let startIndex;
308
- // For all tools: check if buffer has been reset/cleared (startIndex would be >= totalLines)
309
- // This happens when a session is restarted or buffer is cleared
310
- const bufferWasReset = lastCapturedLine >= totalLines || bufferReset;
311
- if (bufferWasReset) {
312
- // Buffer was reset - find the most recent user prompt
313
- const foundUserPrompt = findRecentUserPromptIndex(40);
314
- startIndex = foundUserPrompt >= 0 ? foundUserPrompt + 1 : 0;
315
- }
316
- else if (cliToolId === 'codex') {
317
- // Normal case for Codex: use lastCapturedLine
318
- startIndex = Math.max(0, lastCapturedLine);
319
- }
320
- else if (lastCapturedLine >= totalLines - 5) {
321
- // Buffer may have scrolled - look for the start of the new response
322
- // Find the last user input prompt to identify where the response starts
323
- const foundUserPrompt = findRecentUserPromptIndex(50);
324
- // Start extraction from after the user prompt, or from a safe earlier point
325
- startIndex = foundUserPrompt >= 0 ? foundUserPrompt + 1 : Math.max(0, totalLines - 40);
326
- }
327
- else {
328
- // Normal case: start from lastCapturedLine
329
- startIndex = Math.max(0, lastCapturedLine);
330
- }
384
+ // Determine start index for response extraction using shared helper
385
+ // Handles buffer reset, Codex-specific logic, scroll boundary, and normal cases
386
+ const startIndex = resolveExtractionStartIndex(lastCapturedLine, totalLines, bufferReset, cliToolId, findRecentUserPromptIndex);
331
387
  let endIndex = totalLines; // Track where extraction actually ended
332
388
  for (let i = startIndex; i < totalLines; i++) {
333
389
  const line = lines[i];
@@ -415,12 +471,9 @@ function extractResponse(output, lastCapturedLine, cliToolId) {
415
471
  const fullOutput = lines.join('\n');
416
472
  const promptDetection = detectPromptWithOptions(fullOutput, cliToolId);
417
473
  if (promptDetection.isPrompt) {
418
- // This is an interactive prompt - consider it complete
419
- return {
420
- response: fullOutput,
421
- isComplete: true,
422
- lineCount: totalLines,
423
- };
474
+ // Prompt detection uses full buffer for accuracy, but return only lastCapturedLine onwards
475
+ // stripAnsi is applied inside buildPromptExtractionResult (Stage 4 MF-001: XSS risk mitigation)
476
+ return buildPromptExtractionResult(lines, lastCapturedLine, totalLines, bufferReset, cliToolId, findRecentUserPromptIndex);
424
477
  }
425
478
  // Not a prompt, but we may have a partial response in progress (even if Claude shows a spinner)
426
479
  const responseLines = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandmate",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Git worktree management with Claude CLI and tmux sessions",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -36,13 +36,13 @@
36
36
  "prepublishOnly": "npm run build:all",
37
37
  "start": "NODE_ENV=production node dist/server/server.js",
38
38
  "lint": "next lint",
39
- "test": "vitest",
40
- "test:ui": "vitest --ui",
41
- "test:coverage": "vitest --coverage",
42
- "test:unit": "vitest run tests/unit",
43
- "test:integration": "vitest run tests/integration",
39
+ "test": "NODE_ENV=test vitest",
40
+ "test:ui": "NODE_ENV=test vitest --ui",
41
+ "test:coverage": "NODE_ENV=test vitest --coverage",
42
+ "test:unit": "NODE_ENV=test vitest run tests/unit",
43
+ "test:integration": "NODE_ENV=test vitest run tests/integration",
44
44
  "test:e2e": "playwright test",
45
- "test:watch": "vitest --watch",
45
+ "test:watch": "NODE_ENV=test vitest --watch",
46
46
  "db:init": "tsx scripts/init-db.ts",
47
47
  "db:reset": "rm -f db.sqlite && npm run db:init"
48
48
  },
@@ -67,6 +67,7 @@
67
67
  "rehype-highlight": "^7.0.2",
68
68
  "rehype-sanitize": "^6.0.0",
69
69
  "remark-gfm": "^4.0.1",
70
+ "safe-regex2": "^5.0.0",
70
71
  "uuid": "^13.0.0",
71
72
  "ws": "^8.18.3",
72
73
  "xterm": "^5.3.0",
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8864],{47866:function(e){"use strict";let{entries:t,setPrototypeOf:n,isFrozen:r,getPrototypeOf:a,getOwnPropertyDescriptor:o}=Object,{freeze:i,seal:l,create:c}=Object,{apply:s,construct:u}="undefined"!=typeof Reflect&&Reflect;i||(i=function(e){return e}),l||(l=function(e){return e}),s||(s=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];return e.apply(t,r)}),u||(u=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});let f=N(Array.prototype.forEach),d=N(Array.prototype.lastIndexOf),p=N(Array.prototype.pop),m=N(Array.prototype.push),h=N(Array.prototype.splice),y=N(String.prototype.toLowerCase),g=N(String.prototype.toString),b=N(String.prototype.match),T=N(String.prototype.replace),k=N(String.prototype.indexOf),A=N(String.prototype.trim),v=N(Object.prototype.hasOwnProperty),_=N(RegExp.prototype.test),E=(K=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(K,t)});function N(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return s(e,t,r)}}function S(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:y;n&&n(e,null);let o=t.length;for(;o--;){let n=t[o];if("string"==typeof n){let e=a(n);e!==n&&(r(t)||(t[o]=e),n=e)}e[n]=!0}return e}function x(e){let n=c(null);for(let[r,a]of t(e))v(e,r)&&(Array.isArray(a)?n[r]=function(e){for(let t=0;t<e.length;t++)v(e,t)||(e[t]=null);return e}(a):a&&"object"==typeof a&&a.constructor===Object?n[r]=x(a):n[r]=a);return n}function w(e,t){for(;null!==e;){let n=o(e,t);if(n){if(n.get)return N(n.get);if("function"==typeof n.value)return N(n.value)}e=a(e)}return function(){return null}}let M=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),C=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),D=i(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),R=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),L=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),I=i(["#text"]),P=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),z=i(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),H=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),U=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),j=l(/\{\{[\w\W]*|[\w\W]*\}\}/gm),F=l(/<%[\w\W]*|[\w\W]*%>/gm),Z=l(/\$\{[\w\W]*/gm),B=l(/^data-[\-\w.\u00B7-\uFFFF]+$/),G=l(/^aria-[\-\w]+$/),W=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),q=l(/^(?:\w+script|data):/i),Y=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),V=l(/^html$/i);var K,X=Object.freeze({__proto__:null,ARIA_ATTR:G,ATTR_WHITESPACE:Y,CUSTOM_ELEMENT:l(/^[a-z][.\w]*(-[.\w]+)+$/i),DATA_ATTR:B,DOCTYPE_NAME:V,ERB_EXPR:F,IS_ALLOWED_URI:W,IS_SCRIPT_OR_DATA:q,MUSTACHE_EXPR:j,TMPLIT_EXPR:Z});let $={element:1,text:3,progressingInstruction:7,comment:8,document:9},J=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let a="dompurify"+(n?"#"+n:"");try{return e.createPolicy(a,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Q=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};var ee=function e(){let n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,a=t=>e(t);if(a.version="3.3.1",a.removed=[],!r||!r.document||r.document.nodeType!==$.document||!r.Element)return a.isSupported=!1,a;let{document:o}=r,l=o,s=l.currentScript,{DocumentFragment:u,HTMLTemplateElement:N,Node:j,Element:F,NodeFilter:Z,NamedNodeMap:B=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:G,DOMParser:q,trustedTypes:Y}=r,K=F.prototype,ee=w(K,"cloneNode"),et=w(K,"remove"),en=w(K,"nextSibling"),er=w(K,"childNodes"),ea=w(K,"parentNode");if("function"==typeof N){let e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let eo="",{implementation:ei,createNodeIterator:el,createDocumentFragment:ec,getElementsByTagName:es}=o,{importNode:eu}=l,ef=Q();a.isSupported="function"==typeof t&&"function"==typeof ea&&ei&&void 0!==ei.createHTMLDocument;let{MUSTACHE_EXPR:ed,ERB_EXPR:ep,TMPLIT_EXPR:em,DATA_ATTR:eh,ARIA_ATTR:ey,IS_SCRIPT_OR_DATA:eg,ATTR_WHITESPACE:eb,CUSTOM_ELEMENT:eT}=X,{IS_ALLOWED_URI:ek}=X,eA=null,ev=S({},[...M,...O,...C,...R,...I]),e_=null,eE=S({},[...P,...z,...H,...U]),eN=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),eS=null,ex=null,ew=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),eM=!0,eO=!0,eC=!1,eD=!0,eR=!1,eL=!0,eI=!1,eP=!1,ez=!1,eH=!1,eU=!1,ej=!1,eF=!0,eZ=!1,eB=!0,eG=!1,eW={},eq=null,eY=S({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),eV=null,eK=S({},["audio","video","img","source","image","track"]),eX=null,e$=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),eJ="http://www.w3.org/1998/Math/MathML",eQ="http://www.w3.org/2000/svg",e0="http://www.w3.org/1999/xhtml",e1=e0,e2=!1,e7=null,e5=S({},[eJ,eQ,e0],g),e9=S({},["mi","mo","mn","ms","mtext"]),e4=S({},["annotation-xml"]),e6=S({},["title","style","font","a","script"]),e3=null,e8=["application/xhtml+xml","text/html"],te=null,tt=null,tn=o.createElement("form"),tr=function(e){return e instanceof RegExp||e instanceof Function},ta=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!tt||tt!==e){if(e&&"object"==typeof e||(e={}),e=x(e),te="application/xhtml+xml"===(e3=-1===e8.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?g:y,eA=v(e,"ALLOWED_TAGS")?S({},e.ALLOWED_TAGS,te):ev,e_=v(e,"ALLOWED_ATTR")?S({},e.ALLOWED_ATTR,te):eE,e7=v(e,"ALLOWED_NAMESPACES")?S({},e.ALLOWED_NAMESPACES,g):e5,eX=v(e,"ADD_URI_SAFE_ATTR")?S(x(e$),e.ADD_URI_SAFE_ATTR,te):e$,eV=v(e,"ADD_DATA_URI_TAGS")?S(x(eK),e.ADD_DATA_URI_TAGS,te):eK,eq=v(e,"FORBID_CONTENTS")?S({},e.FORBID_CONTENTS,te):eY,eS=v(e,"FORBID_TAGS")?S({},e.FORBID_TAGS,te):x({}),ex=v(e,"FORBID_ATTR")?S({},e.FORBID_ATTR,te):x({}),eW=!!v(e,"USE_PROFILES")&&e.USE_PROFILES,eM=!1!==e.ALLOW_ARIA_ATTR,eO=!1!==e.ALLOW_DATA_ATTR,eC=e.ALLOW_UNKNOWN_PROTOCOLS||!1,eD=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,eR=e.SAFE_FOR_TEMPLATES||!1,eL=!1!==e.SAFE_FOR_XML,eI=e.WHOLE_DOCUMENT||!1,eH=e.RETURN_DOM||!1,eU=e.RETURN_DOM_FRAGMENT||!1,ej=e.RETURN_TRUSTED_TYPE||!1,ez=e.FORCE_BODY||!1,eF=!1!==e.SANITIZE_DOM,eZ=e.SANITIZE_NAMED_PROPS||!1,eB=!1!==e.KEEP_CONTENT,eG=e.IN_PLACE||!1,ek=e.ALLOWED_URI_REGEXP||W,e1=e.NAMESPACE||e0,e9=e.MATHML_TEXT_INTEGRATION_POINTS||e9,e4=e.HTML_INTEGRATION_POINTS||e4,eN=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&tr(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(eN.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&tr(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(eN.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(eN.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),eR&&(eO=!1),eU&&(eH=!0),eW&&(eA=S({},I),e_=[],!0===eW.html&&(S(eA,M),S(e_,P)),!0===eW.svg&&(S(eA,O),S(e_,z),S(e_,U)),!0===eW.svgFilters&&(S(eA,C),S(e_,z),S(e_,U)),!0===eW.mathMl&&(S(eA,R),S(e_,H),S(e_,U))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?ew.tagCheck=e.ADD_TAGS:(eA===ev&&(eA=x(eA)),S(eA,e.ADD_TAGS,te))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?ew.attributeCheck=e.ADD_ATTR:(e_===eE&&(e_=x(e_)),S(e_,e.ADD_ATTR,te))),e.ADD_URI_SAFE_ATTR&&S(eX,e.ADD_URI_SAFE_ATTR,te),e.FORBID_CONTENTS&&(eq===eY&&(eq=x(eq)),S(eq,e.FORBID_CONTENTS,te)),e.ADD_FORBID_CONTENTS&&(eq===eY&&(eq=x(eq)),S(eq,e.ADD_FORBID_CONTENTS,te)),eB&&(eA["#text"]=!0),eI&&S(eA,["html","head","body"]),eA.table&&(S(eA,["tbody"]),delete eS.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw E('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw E('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');eo=(n=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===n&&(n=J(Y,s)),null!==n&&"string"==typeof eo&&(eo=n.createHTML(""));i&&i(e),tt=e}},to=S({},[...O,...C,...D]),ti=S({},[...R,...L]),tl=function(e){let t=ea(e);t&&t.tagName||(t={namespaceURI:e1,tagName:"template"});let n=y(e.tagName),r=y(t.tagName);return!!e7[e.namespaceURI]&&(e.namespaceURI===eQ?t.namespaceURI===e0?"svg"===n:t.namespaceURI===eJ?"svg"===n&&("annotation-xml"===r||e9[r]):!!to[n]:e.namespaceURI===eJ?t.namespaceURI===e0?"math"===n:t.namespaceURI===eQ?"math"===n&&e4[r]:!!ti[n]:e.namespaceURI===e0?(t.namespaceURI!==eQ||!!e4[r])&&(t.namespaceURI!==eJ||!!e9[r])&&!ti[n]&&(e6[n]||!to[n]):"application/xhtml+xml"===e3&&!!e7[e.namespaceURI])},tc=function(e){m(a.removed,{element:e});try{ea(e).removeChild(e)}catch(t){et(e)}},ts=function(e,t){try{m(a.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){m(a.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e){if(eH||eU)try{tc(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}},tu=function(e){let t=null,r=null;if(ez)e="<remove></remove>"+e;else{let t=b(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===e3&&e1===e0&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let a=n?n.createHTML(e):e;if(e1===e0)try{t=new q().parseFromString(a,e3)}catch(e){}if(!t||!t.documentElement){t=ei.createDocument(e1,"template",null);try{t.documentElement.innerHTML=e2?eo:a}catch(e){}}let i=t.body||t.documentElement;return(e&&r&&i.insertBefore(o.createTextNode(r),i.childNodes[0]||null),e1===e0)?es.call(t,eI?"html":"body")[0]:eI?t.documentElement:i},tf=function(e){return el.call(e.ownerDocument||e,e,Z.SHOW_ELEMENT|Z.SHOW_COMMENT|Z.SHOW_TEXT|Z.SHOW_PROCESSING_INSTRUCTION|Z.SHOW_CDATA_SECTION,null)},td=function(e){return e instanceof G&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof B)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},tp=function(e){return"function"==typeof j&&e instanceof j};function tm(e,t,n){f(e,e=>{e.call(a,t,n,tt)})}let th=function(e){let t=null;if(tm(ef.beforeSanitizeElements,e,null),td(e))return tc(e),!0;let n=te(e.nodeName);if(tm(ef.uponSanitizeElement,e,{tagName:n,allowedTags:eA}),eL&&e.hasChildNodes()&&!tp(e.firstElementChild)&&_(/<[/\w!]/g,e.innerHTML)&&_(/<[/\w!]/g,e.textContent)||e.nodeType===$.progressingInstruction||eL&&e.nodeType===$.comment&&_(/<[/\w]/g,e.data))return tc(e),!0;if(!(ew.tagCheck instanceof Function&&ew.tagCheck(n))&&(!eA[n]||eS[n])){if(!eS[n]&&tg(n)&&(eN.tagNameCheck instanceof RegExp&&_(eN.tagNameCheck,n)||eN.tagNameCheck instanceof Function&&eN.tagNameCheck(n)))return!1;if(eB&&!eq[n]){let t=ea(e)||e.parentNode,n=er(e)||e.childNodes;if(n&&t){let r=n.length;for(let a=r-1;a>=0;--a){let r=ee(n[a],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,en(e))}}}return tc(e),!0}return e instanceof F&&!tl(e)||("noscript"===n||"noembed"===n||"noframes"===n)&&_(/<\/no(script|embed|frames)/i,e.innerHTML)?(tc(e),!0):(eR&&e.nodeType===$.text&&(t=e.textContent,f([ed,ep,em],e=>{t=T(t,e," ")}),e.textContent!==t&&(m(a.removed,{element:e.cloneNode()}),e.textContent=t)),tm(ef.afterSanitizeElements,e,null),!1)},ty=function(e,t,n){if(eF&&("id"===t||"name"===t)&&(n in o||n in tn))return!1;if(eO&&!ex[t]&&_(eh,t));else if(eM&&_(ey,t));else if(ew.attributeCheck instanceof Function&&ew.attributeCheck(t,e));else if(!e_[t]||ex[t]){if(!(tg(e)&&(eN.tagNameCheck instanceof RegExp&&_(eN.tagNameCheck,e)||eN.tagNameCheck instanceof Function&&eN.tagNameCheck(e))&&(eN.attributeNameCheck instanceof RegExp&&_(eN.attributeNameCheck,t)||eN.attributeNameCheck instanceof Function&&eN.attributeNameCheck(t,e))||"is"===t&&eN.allowCustomizedBuiltInElements&&(eN.tagNameCheck instanceof RegExp&&_(eN.tagNameCheck,n)||eN.tagNameCheck instanceof Function&&eN.tagNameCheck(n))))return!1}else if(eX[t]);else if(_(ek,T(n,eb,"")));else if(("src"===t||"xlink:href"===t||"href"===t)&&"script"!==e&&0===k(n,"data:")&&eV[e]);else if(eC&&!_(eg,T(n,eb,"")));else if(n)return!1;return!0},tg=function(e){return"annotation-xml"!==e&&b(e,eT)},tb=function(e){tm(ef.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||td(e))return;let r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:e_,forceKeepAttr:void 0},o=t.length;for(;o--;){let{name:i,namespaceURI:l,value:c}=t[o],s=te(i),u="value"===i?c:A(c);if(r.attrName=s,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,tm(ef.uponSanitizeAttribute,e,r),u=r.attrValue,eZ&&("id"===s||"name"===s)&&(ts(i,e),u="user-content-"+u),eL&&_(/((--!?|])>)|<\/(style|title|textarea)/i,u)||"attributename"===s&&b(u,"href")){ts(i,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr||!eD&&_(/\/>/i,u)){ts(i,e);continue}eR&&f([ed,ep,em],e=>{u=T(u,e," ")});let d=te(e.nodeName);if(!ty(d,s,u)){ts(i,e);continue}if(n&&"object"==typeof Y&&"function"==typeof Y.getAttributeType){if(l);else switch(Y.getAttributeType(d,s)){case"TrustedHTML":u=n.createHTML(u);break;case"TrustedScriptURL":u=n.createScriptURL(u)}}if(u!==c)try{l?e.setAttributeNS(l,i,u):e.setAttribute(i,u),td(e)?tc(e):p(a.removed)}catch(t){ts(i,e)}}tm(ef.afterSanitizeAttributes,e,null)},tT=function e(t){let n=null,r=tf(t);for(tm(ef.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)tm(ef.uponSanitizeShadowNode,n,null),th(n),tb(n),n.content instanceof u&&e(n.content);tm(ef.afterSanitizeShadowDOM,t,null)};return a.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,i=null,c=null;if((e2=!e)&&(e="<!-->"),"string"!=typeof e&&!tp(e)){if("function"==typeof e.toString){if("string"!=typeof(e=e.toString()))throw E("dirty is not a string, aborting")}else throw E("toString is not a function")}if(!a.isSupported)return e;if(eP||ta(t),a.removed=[],"string"==typeof e&&(eG=!1),eG){if(e.nodeName){let t=te(e.nodeName);if(!eA[t]||eS[t])throw E("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof j)(o=(r=tu("<!---->")).ownerDocument.importNode(e,!0)).nodeType===$.element&&"BODY"===o.nodeName?r=o:"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!eH&&!eR&&!eI&&-1===e.indexOf("<"))return n&&ej?n.createHTML(e):e;if(!(r=tu(e)))return eH?null:ej?eo:""}r&&ez&&tc(r.firstChild);let s=tf(eG?e:r);for(;i=s.nextNode();)th(i),tb(i),i.content instanceof u&&tT(i.content);if(eG)return e;if(eH){if(eU)for(c=ec.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(e_.shadowroot||e_.shadowrootmode)&&(c=eu.call(l,c,!0)),c}let d=eI?r.outerHTML:r.innerHTML;return eI&&eA["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&_(V,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),eR&&f([ed,ep,em],e=>{d=T(d,e," ")}),n&&ej?n.createHTML(d):d},a.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ta(e),eP=!0},a.clearConfig=function(){tt=null,eP=!1},a.isValidAttribute=function(e,t,n){return tt||ta({}),ty(te(e),te(t),n)},a.addHook=function(e,t){"function"==typeof t&&m(ef[e],t)},a.removeHook=function(e,t){if(void 0!==t){let n=d(ef[e],t);return -1===n?void 0:h(ef[e],n,1)[0]}return p(ef[e])},a.removeHooks=function(e){ef[e]=[]},a.removeAllHooks=function(){ef=Q()},a}();e.exports=ee},47835:function(e,t,n){e.exports=self.DOMPurify||(self.DOMPurify=n(47866).default||n(47866))},30401:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},10407:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},93807:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]])},78867:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},42208:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},88964:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]])},48736:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},79548:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("folder-input",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]])},56475:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])},49465:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},14924:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},51817:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},47416:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]])},74440:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]])},45675:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},83229:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},18930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},76865:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},17689:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]])},30166:function(e,t,n){"use strict";n.d(t,{default:function(){return a.a}});var r=n(55775),a=n.n(r)},55775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=n(47043);n(57437),n(2265);let a=r._(n(15602));function o(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let o={...r,...t};return(0,a.default)({...o,modules:null==(n=o.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81523:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let r=n(18993);function a(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},15602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(57437),a=n(2265),o=n(81523),i=n(70049);function l(e){return{default:e&&"default"in e?e.default:e}}let c={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},s=function(e){let t={...c,...e},n=(0,a.lazy)(()=>t.loader().then(l)),s=t.loading;function u(e){let l=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(i.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(o.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(a.Suspense,{fallback:l,children:c})}return u.displayName="LoadableComponent",u}},70049:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return o}});let r=n(57437),a=n(20544);function o(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,a.getExpectedRequestStore)("next/dynamic css"),o=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));o.push(...t)}}return 0===o.length?null:(0,r.jsx)(r.Fragment,{children:o.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},57792:function(){},57934:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var r=n(7085),a=n(41738);let o=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],i={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...o,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...o],h2:[["className","sr-only"]],img:[...o,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...o,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...o],table:[...o],ul:[...o,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},l={}.hasOwnProperty;function c(e,t){if(t&&"object"==typeof t)switch("string"==typeof t.type?t.type:""){case"comment":return function(e,t){if(e.schema.allowComments){let e="string"==typeof t.value?t.value:"",n=e.indexOf("-->"),r={type:"comment",value:n<0?e:e.slice(0,n)};return d(r,t),r}}(e,t);case"doctype":return function(e,t){if(e.schema.allowDoctypes){let e={type:"doctype"};return d(e,t),e}}(e,t);case"element":return function(e,t){let n="string"==typeof t.tagName?t.tagName:"";e.stack.push(n);let r=s(e,t.children),a=function(e,t){let n;let r=e.stack[e.stack.length-1],a=e.schema.attributes,o=e.schema.required,i=a&&l.call(a,r)?a[r]:void 0,c=a&&l.call(a,"*")?a["*"]:void 0,s=t&&"object"==typeof t?t:{},f={};for(n in s)if(l.call(s,n)){let t=s[n],r=u(e,p(i,n),n,t);null==r&&(r=u(e,p(c,n),n,t)),null!=r&&(f[n]=r)}if(o&&l.call(o,r)){let e=o[r];for(n in e)l.call(e,n)&&!l.call(f,n)&&(f[n]=e[n])}return f}(e,t.properties);e.stack.pop();let o=!1;if(n&&"*"!==n&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&l.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(o=!1;++r<t.length;)e.stack.includes(t[r])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let i={type:"element",tagName:n,properties:a,children:r};return d(i,t),i}(e,t);case"root":return function(e,t){let n={type:"root",children:s(e,t.children)};return d(n,t),n}(e,t);case"text":return function(e,t){let n={type:"text",value:"string"==typeof t.value?t.value:""};return d(n,t),n}(0,t)}}function s(e,t){let n=[];if(Array.isArray(t)){let r=-1;for(;++r<t.length;){let a=c(e,t[r]);a&&(Array.isArray(a)?n.push(...a):n.push(a))}}return n}function u(e,t,n,r){return t?Array.isArray(r)?function(e,t,n,r){let a=-1,o=[];for(;++a<r.length;){let i=f(e,t,n,r[a]);("number"==typeof i||"string"==typeof i)&&o.push(i)}return o}(e,t,n,r):f(e,t,n,r):void 0}function f(e,t,n,r){if(("boolean"==typeof r||"number"==typeof r||"string"==typeof r)&&function(e,t,n){let r=e.schema.protocols&&l.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||0===r.length)return!0;let a=String(n),o=a.indexOf(":"),i=a.indexOf("?"),c=a.indexOf("#"),s=a.indexOf("/");if(o<0||s>-1&&o>s||i>-1&&o>i||c>-1&&o>c)return!0;let u=-1;for(;++u<r.length;){let e=r[u];if(o===e.length&&a.slice(0,e.length)===e)return!0}return!1}(e,n,r)){if("object"==typeof t&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let a=t[n];if(a&&"object"==typeof a&&"flags"in a){if(a.test(String(r))){e=!0;break}}else if(a===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function d(e,t){let n=(0,a.FK)(t);t.data&&(e.data=(0,r.ZP)(t.data)),n&&(e.position=n)}function p(e,t){let n;let r=-1;if(e)for(;++r<e.length;){let a=e[r],o="string"==typeof a?a:a[0];if(o===t)return a;"data*"===o&&(n=a)}if(t.length>4&&"data"===t.slice(0,4).toLowerCase())return n}function m(e){return function(t){return function(e,t){let n={type:"root",children:[]},r=c({schema:t?{...i,...t}:i,stack:[]},e);return r&&(Array.isArray(r)?1===r.length?n=r[0]:n.children=r:n=r),n}(t,e)}}}}]);