@agent-plan/pi-adapter 0.2.19-next.1 → 0.2.19-next.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AA0tBtF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA+6F9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AA6uBtF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA67F9D"}
package/dist/index.js CHANGED
@@ -68,6 +68,29 @@ setWriteNotifyHook(() => {
68
68
  let previousContextPercent = 0;
69
69
  let autoHandoffTriggered = false;
70
70
  let plannerSessionEnabled = false;
71
+ // In-process guard bypass (per session, NOT persisted/shared). The edit/write
72
+ // guard is advisory in Pi (warns "NO ACTIVE TASK" but does not block). When a
73
+ // bypass is active the warning is silenced for the window. Lives in memory only:
74
+ // not on disk, not in git, not shared across agents/sessions on the same folder.
75
+ let guardBypassUntil = "";
76
+ function authorizeGuardBypass(durationMinutes = 15) {
77
+ const until = new Date(Date.now() + durationMinutes * 60_000).toISOString();
78
+ guardBypassUntil = until;
79
+ return until;
80
+ }
81
+ function clearGuardBypass() { guardBypassUntil = ""; }
82
+ function isGuardBypassed() {
83
+ if (!guardBypassUntil)
84
+ return false;
85
+ const until = Date.parse(guardBypassUntil);
86
+ if (!Number.isFinite(until))
87
+ return false;
88
+ if (until <= Date.now()) {
89
+ guardBypassUntil = "";
90
+ return false;
91
+ }
92
+ return true;
93
+ }
71
94
  let startupResumePromptPending = false;
72
95
  let startupResumeSummaryPending = false;
73
96
  let plannerHeavyInitDone = false; // runs migrate/heal/refreshResume once per session, not every turn
@@ -393,7 +416,7 @@ async function buildHandoffMarkdown(st, reason, overrides) {
393
416
  ...recentActivityLines,
394
417
  "",
395
418
  "## Reminder",
396
- "- When work is fully resumed and this handoff is no longer needed, clear the phase handoff with handoff clear <ref> (or /planner handoff clear).",
419
+ "- This handoff is KEPT until a task in this phase starts (then auto-archived to .planner/handoff-archive/) or the phase completes. No need to clear it manually.",
397
420
  ].join("\n");
398
421
  }
399
422
  async function writeProjectHandoff(st, reason, overrides) {
@@ -734,6 +757,10 @@ export default function planPiExtension(pi) {
734
757
  const handoffs = await st.listHandoffs().catch(() => []);
735
758
  if (handoffs.length > 0) {
736
759
  ctx.ui.notify(`ℹ️ ${handoffs.length} phase handoff(s) pending — review with /planner handoff list.`, "info");
760
+ // Mark each handoff as read (recap presented). Do NOT clear — content is
761
+ // kept until a task in the phase starts (auto-archived) or phase completes.
762
+ for (const h of handoffs)
763
+ await st.markHandoffRead(h.phaseId).catch(() => { });
737
764
  }
738
765
  }
739
766
  // If the user declined enablement, skip EVERYTHING (no web prompt, no migration, no summary).
@@ -862,6 +889,8 @@ export default function planPiExtension(pi) {
862
889
  return; // nothing to enforce yet
863
890
  if (guard.inProgressTaskIds.length > 0)
864
891
  return; // a task is open → we're good
892
+ if (isGuardBypassed())
893
+ return; // user authorized proceeding without a task
865
894
  const focusHint = guard.focusTaskId
866
895
  ? `Il task più probabile è ${guard.focusTaskId} — ${guard.focusTaskTitle}. Avvialo con: \`/planner task start ${guard.focusTaskId}\``
867
896
  : `Scegli un task dal piano e avvialo con \`/planner task start <taskId>\`.`;
@@ -1532,6 +1561,8 @@ export default function planPiExtension(pi) {
1532
1561
  openQuestions: [], decisions: [], acceptedDecisions: [], completionCriteria: [], taskIds: [], tasks: [],
1533
1562
  createdAt: nowISO(), updatedAt: nowISO(),
1534
1563
  handoff: "", handoffUpdatedAt: "",
1564
+ handoffReadAt: "",
1565
+ handoffHistory: [],
1535
1566
  };
1536
1567
  await st.savePhase(phase);
1537
1568
  await st.updateFeatures((doc) => {
@@ -1977,12 +2008,16 @@ export default function planPiExtension(pi) {
1977
2008
  ctx.ui.notify(`Task "${task.title}" is already in-progress.`, "info");
1978
2009
  return;
1979
2010
  }
1980
- // Hygiene notice (non-blocking): surface an existing handoff but never
1981
- // block task_start — the handoff is a captured-context artifact, not a
1982
- // lock (a small modification after writing a handoff should start without
1983
- // forcing deletion, which would lose context).
1984
- if ((await st.listHandoffs()).length > 0) {
1985
- ctx.ui.notify("ℹ️ One or more phases have a pending handoff — if relevant to the task you're starting, read it with /planner handoff show <ref>, then clear with /planner handoff clear. Proceeding with task start.", "info");
2011
+ // Auto-archive the handoff on THIS task's phase (reason: task-started) —
2012
+ // the agent is now actively working, so the captured context is consumed.
2013
+ // Other phases' handoffs are left untouched (informational, non-blocking).
2014
+ if ((phase.handoff ?? "") !== "") {
2015
+ await st.clearPhaseHandoff(phase.id, "task-started").catch(() => { });
2016
+ ctx.ui.notify("📦 Archived handoff for this phase (task started) — recover via /planner handoff list + .planner/handoff-archive/.", "info");
2017
+ }
2018
+ const _otherHandoffs = (await st.listHandoffs()).filter((h) => h.phaseId !== phase.id);
2019
+ if (_otherHandoffs.length > 0) {
2020
+ ctx.ui.notify(`ℹ️ ${_otherHandoffs.length} other phase handoff(s) pending — review with /planner handoff list if relevant.`, "info");
1986
2021
  }
1987
2022
  const now = nowISO();
1988
2023
  // Record status change in the incremental statusLog.
@@ -2139,7 +2174,7 @@ export default function planPiExtension(pi) {
2139
2174
  ctx.ui.notify(r.error, "warning");
2140
2175
  return;
2141
2176
  }
2142
- await st.clearPhaseHandoff(r.phase.id);
2177
+ await st.clearPhaseHandoff(r.phase.id, "manual");
2143
2178
  ctx.ui.notify(`Cleared handoff on ${r.compositeRef}`, "info");
2144
2179
  return;
2145
2180
  }
@@ -2221,12 +2256,12 @@ export default function planPiExtension(pi) {
2221
2256
  try {
2222
2257
  if (a === "bypass") {
2223
2258
  const mins = parseInt(subArgs.trim(), 10);
2224
- const until = await st.authorizeGuardBypass(Number.isFinite(mins) && mins > 0 ? mins : 15);
2225
- ctx.ui.notify(`Guard bypass authorized until ${until}. edit/write will work without a task in-progress for that window.`, "info");
2259
+ const until = authorizeGuardBypass(Number.isFinite(mins) && mins > 0 ? mins : 15);
2260
+ ctx.ui.notify(`Guard bypass authorized until ${until}. edit/write advisory warnings silenced for that window (per-session, not shared).`, "info");
2226
2261
  }
2227
2262
  else {
2228
- await st.clearGuardBypass();
2229
- ctx.ui.notify("Guard bypass revoked. edit/write now requires a task in-progress again.", "info");
2263
+ clearGuardBypass();
2264
+ ctx.ui.notify("Guard bypass revoked. edit/write advisory warnings re-enabled.", "info");
2230
2265
  }
2231
2266
  }
2232
2267
  catch (e) {
@@ -2666,7 +2701,7 @@ export default function planPiExtension(pi) {
2666
2701
  const r = await resolvePhaseForHandoff(st, undefined);
2667
2702
  if (!r.ok)
2668
2703
  return { content: [{ type: "text", text: `⚠️ plan_delete_handoff is deprecated — use handoff_clear. ${r.error}` }], details: { deprecated: true, error: r.error } };
2669
- await st.clearPhaseHandoff(r.phase.id);
2704
+ await st.clearPhaseHandoff(r.phase.id, "manual");
2670
2705
  return { content: [{ type: "text", text: `⚠️ plan_delete_handoff is deprecated — cleared handoff on ${r.compositeRef} (phase.handoff). Prefer handoff_clear.` }], details: { deprecated: true, phaseRef: r.compositeRef, phaseId: r.phase.id } };
2671
2706
  },
2672
2707
  });
@@ -2764,36 +2799,36 @@ export default function planPiExtension(pi) {
2764
2799
  const r = await resolvePhaseForHandoff(st, params.phaseRef);
2765
2800
  if (!r.ok)
2766
2801
  return { content: [{ type: "text", text: `❌ ${r.error}` }], details: { error: r.error } };
2767
- await st.clearPhaseHandoff(r.phase.id);
2768
- return { content: [{ type: "text", text: `✅ Cleared handoff on ${r.compositeRef}. (handoffUpdatedAt preserved as audit)` }], details: { phaseRef: r.compositeRef, phaseId: r.phase.id } };
2802
+ await st.clearPhaseHandoff(r.phase.id, "manual");
2803
+ return { content: [{ type: "text", text: `✅ Cleared handoff on ${r.compositeRef} (handoffUpdatedAt preserved as audit; archived to .planner/handoff-archive/).` }], details: { phaseRef: r.compositeRef, phaseId: r.phase.id } };
2769
2804
  },
2770
2805
  });
2771
2806
  pi.registerTool({
2772
2807
  name: "plan_authorize_bypass",
2773
2808
  label: "Plan Authorize Guard Bypass",
2774
- description: "Authorize a temporary guard bypass (default 15 minutes) so edit/write tools can proceed even when no task is in-progress. Use this ONLY after the user explicitly authorizes proceeding without a task. Harness-agnostic: stored in resume.json so all adapters respect it.",
2809
+ description: "Authorize a temporary guard bypass (default 15 minutes) so the edit/write advisory guard stops warning when no task is in-progress. Per-session in-memory: not persisted, not shared across agents. Use ONLY after the user explicitly authorizes proceeding without a task.",
2775
2810
  parameters: Type.Object({
2776
2811
  durationMinutes: Type.Optional(Type.Number({ description: "Bypass window in minutes. Default 15." })),
2777
2812
  }),
2778
2813
  async execute(_id, params, _signal, _onUpdate, ctx) {
2779
- const st = await requirePlan(ctx);
2780
- if (!st)
2814
+ const ok = await requirePlan(ctx);
2815
+ if (!ok)
2781
2816
  return { content: [{ type: "text", text: "No .planner/ found." }], details: {} };
2782
2817
  const mins = params.durationMinutes ?? 15;
2783
- const until = await st.authorizeGuardBypass(mins);
2784
- return { content: [{ type: "text", text: `Guard bypass authorized until ${until}. edit/write is allowed without a task in-progress for ${mins} minutes.` }], details: { until } };
2818
+ const until = authorizeGuardBypass(mins);
2819
+ return { content: [{ type: "text", text: `Guard bypass authorized until ${until}. Advisory edit/write warnings silenced for ${mins} minutes (per-session, not shared).` }], details: { until } };
2785
2820
  },
2786
2821
  });
2787
2822
  pi.registerTool({
2788
2823
  name: "plan_clear_bypass",
2789
2824
  label: "Plan Clear Guard Bypass",
2790
- description: "Revoke any active guard bypass so edit/write again requires a task in-progress.",
2825
+ description: "Revoke the per-session guard bypass so the edit/write advisory warnings resume.",
2791
2826
  parameters: Type.Object({}),
2792
2827
  async execute(_id, _params, _signal, _onUpdate, ctx) {
2793
- const st = await requirePlan(ctx);
2794
- if (!st)
2828
+ const ok = await requirePlan(ctx);
2829
+ if (!ok)
2795
2830
  return { content: [{ type: "text", text: "No .planner/ found." }], details: {} };
2796
- await st.clearGuardBypass();
2831
+ clearGuardBypass();
2797
2832
  return { content: [{ type: "text", text: "Guard bypass revoked." }], details: { cleared: true } };
2798
2833
  },
2799
2834
  });
@@ -2881,7 +2916,7 @@ export default function planPiExtension(pi) {
2881
2916
  return doc;
2882
2917
  });
2883
2918
  await st.writeGenerated();
2884
- return { content: [{ type: "text", text: `Feature created: ${feature.id}` }], details: feature };
2919
+ return { content: [{ type: "text", text: `✅ Feature created: ${formatFeatureRef(feature.number)} — ${feature.name}${feature.shortId ? ` · ${feature.shortId}` : ""}` }], details: feature };
2885
2920
  },
2886
2921
  });
2887
2922
  pi.registerTool({
@@ -2956,7 +2991,7 @@ export default function planPiExtension(pi) {
2956
2991
  if (!feature)
2957
2992
  return { content: [{ type: "text", text: `Feature not found: ${params.featureId}` }], details: {} };
2958
2993
  await st.writeGenerated();
2959
- return { content: [{ type: "text", text: `Feature updated: ${feature.id} (${feature.status})` }], details: feature };
2994
+ return { content: [{ type: "text", text: `✅ Feature updated: ${formatFeatureRef(feature.number)} — ${feature.name}${feature.shortId ? ` · ${feature.shortId}` : ""}` }], details: feature };
2960
2995
  },
2961
2996
  });
2962
2997
  pi.registerTool({
@@ -3072,6 +3107,8 @@ export default function planPiExtension(pi) {
3072
3107
  openQuestions: [], decisions: [], acceptedDecisions: [], completionCriteria: [], taskIds: [], tasks: [],
3073
3108
  createdAt: now, updatedAt: now,
3074
3109
  handoff: "", handoffUpdatedAt: "",
3110
+ handoffReadAt: "",
3111
+ handoffHistory: [],
3075
3112
  };
3076
3113
  await st.savePhase(phase);
3077
3114
  // Atomic: serialize concurrent phase_create linking to the same feature.
@@ -3087,7 +3124,8 @@ export default function planPiExtension(pi) {
3087
3124
  });
3088
3125
  if (!phase)
3089
3126
  return { content: [{ type: "text", text: "Phase creation failed." }], details: {} };
3090
- return { content: [{ type: "text", text: `Phase created: ${phase.id}` }], details: phase };
3127
+ const phaseCreateFeatures = (await st.loadFeatures()).features;
3128
+ return { content: [{ type: "text", text: `✅ Phase created: ${formatPhaseRef(phase.number, featureNumberOfPhase(phase, phaseCreateFeatures))} — ${phase.title}${phase.shortId ? ` · ${phase.shortId}` : ""}` }], details: phase };
3091
3129
  },
3092
3130
  });
3093
3131
  pi.registerTool({
@@ -3176,7 +3214,8 @@ export default function planPiExtension(pi) {
3176
3214
  phase.updatedAt = nowISO();
3177
3215
  await st.savePhase(phase);
3178
3216
  await st.writeGenerated();
3179
- return { content: [{ type: "text", text: `Phase updated: ${phase.id} (${phase.status})` }], details: phase };
3217
+ const phaseUpdateFeatures = (await st.loadFeatures()).features;
3218
+ return { content: [{ type: "text", text: `✅ Phase updated: ${formatPhaseRef(phase.number, featureNumberOfPhase(phase, phaseUpdateFeatures))} — ${phase.title}${phase.shortId ? ` · ${phase.shortId}` : ""}` }], details: phase };
3180
3219
  },
3181
3220
  });
3182
3221
  pi.registerTool({
@@ -3744,12 +3783,12 @@ export default function planPiExtension(pi) {
3744
3783
  "═══════════════════════════════════════════════════════════════",
3745
3784
  "MANDATORY OPERATIONAL PROTOCOL (violation = execution failure):",
3746
3785
  "═══════════════════════════════════════════════════════════════",
3747
- "1. HANDOFF HYGIENE: If one or more phases have a pending handoff (entity-scoped, phase.handoff), present the list, read the relevant one with handoff show <ref>, then CLEAR it with handoff clear <ref> once consumed. Handoffs are non-blocking context artifacts, not locks — they never block task_start.",
3786
+ "1. HANDOFF HYGIENE: If one or more phases have a pending handoff (entity-scoped, phase.handoff), present the list, read the relevant one with handoff show <ref> for context. Handoffs are KEPT until a task in the phase starts (auto-archived to .planner/handoff-archive/) or the phase completes — no manual clear needed. They are non-blocking context artifacts, not locks — they never block task_start.",
3748
3787
  "2. TASK LIFECYCLE: BEFORE coding ANY file: call task_start. AFTER finishing work on ANY task: call task_complete. No exceptions. No 'I'll do it later'. NOTE: Planner operations (plan_write_handoff / /planner handoff, task_start, task_complete, task_update, status reads) are NOT code edits. They are ALWAYS allowed regardless of task state — you may write/refresh the handoff even when no task is in-progress (e.g., all tasks done, or capturing state mid-flight). Never refuse to write a handoff because 'no task is open'; that is incorrect.",
3749
3788
  "3. IMMEDIATE SYNC: Update task status AT THE EXACT MOMENT of transition. Start = task_start NOW. Done = task_complete NOW. Blocked = task_update with motivation NOW. Never batch status updates.",
3750
3789
  "4. BLOCKED MOTIVATION: Transitions to blocked/canceled/rejected/deferred/waiting/planned(from non-planned) MUST include a detailed 'motivation' parameter. Write it as if the next person has zero context.",
3751
3790
  "5. NO SHORTCUTS: If a tool blocks you, follow the protocol. Bypasses are for emergencies only, not for convenience.",
3752
- "6. ENTITY REFERENCES: When you mention a feature/phase/task in chat, use its composite ID (F00x / P00x / T00x, e.g. T003(P002/F001)) or its 5-char shortId (e.g. UUXD1) — NEVER a raw UUID like bd6ed366. Tool responses already show these refs (compositeRef, shortId); reuse them.",
3791
+ "6. ENTITY REFERENCES: When you mention a feature/phase/task in chat, PREFER its 5-char shortId (globally unique, e.g. UUXD1). The composite T00x is per-phase and AMBIGUOUS unless fully qualified as T00x(P00x/F00x) — do NOT use bare 'T00x'. NEVER a raw UUID like bd6ed366. Tool responses already show shortId + compositeRef; reuse them.",
3753
3792
  "═══════════════════════════════════════════════════════════════",
3754
3793
  "",
3755
3794
  // ── Project details ──
@@ -3824,7 +3863,7 @@ export default function planPiExtension(pi) {
3824
3863
  ...handoffs.map((h, i) => ` [${i + 1}] ${h.compositeRef} — ${h.updatedAt} — "${h.firstLine}"`),
3825
3864
  handoffs.length > 0 ? "Read the relevant one with handoff show <ref> (or /planner handoff show <ref>) as previous-session context, but validate it against the current planner state, ordering, and dependencies before treating any target as the next task." : "",
3826
3865
  handoffs.length > 0 ? "If planner state shows no task/phase in-progress, do NOT present a handoff target as the current focus; present it only as a candidate to validate." : "",
3827
- handoffs.length > 0 ? "Once a handoff is fully consumed and work is safely resumed, clear it with handoff clear <ref> (or /planner handoff clear)." : "",
3866
+ handoffs.length > 0 ? "Handoffs are KEPT until a task in the phase starts (auto-archived to .planner/handoff-archive/) or the phase completes — read with handoff show <ref> for context; no manual clear needed." : "",
3828
3867
  "Plan tools available: project_set_language_preferences, plan_init, project_update, requirement_list, requirement_create, requirement_update, requirement_delete, plan_get, feature_list, feature_get, feature_create, feature_update, feature_delete, phase_list, phase_get, phase_create, phase_update, phase_delete, task_list, task_get, task_create, task_update, task_delete, task_start, task_complete, plan_render, plan_get_handoff, plan_write_handoff, plan_delete_handoff, handoff_list, handoff_show, handoff_write, handoff_clear, plan_authorize_bypass, plan_clear_bypass",
3829
3868
  ].filter(Boolean).join("\n");
3830
3869
  contextBlockCache = contextBlock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-plan/pi-adapter",
3
- "version": "0.2.19-next.1",
3
+ "version": "0.2.19-next.3",
4
4
  "private": false,
5
5
  "description": "Pi agent extension for Agent Plan — structured project planning in .planner/",
6
6
  "keywords": [
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "typebox": "^1.1.24",
30
30
  "zod": "^3.24.0",
31
- "@agent-plan/core": "0.2.19-next.1",
32
- "@agent-plan/server": "0.2.19-next.1"
31
+ "@agent-plan/core": "0.2.19-next.3",
32
+ "@agent-plan/server": "0.2.19-next.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@earendil-works/pi-coding-agent": "^0.74.0",
@@ -194,7 +194,7 @@ Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}
194
194
  To pick up a draggable item, press the space bar.
195
195
  While dragging, use the arrow keys to move the item.
196
196
  Press space again to drop the item in its new position, or press escape to cancel.
197
- `},IR={onDragStart(t){let{active:a}=t;return"Picked up draggable item "+a.id+"."},onDragOver(t){let{active:a,over:r}=t;return r?"Draggable item "+a.id+" was moved over droppable area "+r.id+".":"Draggable item "+a.id+" is no longer over a droppable area."},onDragEnd(t){let{active:a,over:r}=t;return r?"Draggable item "+a.id+" was dropped over droppable area "+r.id:"Draggable item "+a.id+" was dropped."},onDragCancel(t){let{active:a}=t;return"Dragging was cancelled. Draggable item "+a.id+" was dropped."}};function QR(t){let{announcements:a=IR,container:r,hiddenTextDescribedById:i,screenReaderInstructions:u=XR}=t;const{announce:o,announcement:h}=VR(),m=_u("DndLiveRegion"),[p,g]=v.useState(!1);if(v.useEffect(()=>{g(!0)},[]),FR(v.useMemo(()=>({onDragStart(b){let{active:w}=b;o(a.onDragStart({active:w}))},onDragMove(b){let{active:w,over:S}=b;a.onDragMove&&o(a.onDragMove({active:w,over:S}))},onDragOver(b){let{active:w,over:S}=b;o(a.onDragOver({active:w,over:S}))},onDragEnd(b){let{active:w,over:S}=b;o(a.onDragEnd({active:w,over:S}))},onDragCancel(b){let{active:w,over:S}=b;o(a.onDragCancel({active:w,over:S}))}}),[o,a])),!p)return null;const x=un.createElement(un.Fragment,null,un.createElement(qR,{id:i,value:u.draggable}),un.createElement(YR,{id:m,announcement:h}));return r?Zl.createPortal(x,r):x}var Ln;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ln||(Ln={}));function Rc(){}function PR(t,a){return v.useMemo(()=>({sensor:t,options:a??{}}),[t,a])}function KR(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];return v.useMemo(()=>[...a].filter(i=>i!=null),[...a])}const ll=Object.freeze({x:0,y:0});function ZR(t,a){return Math.sqrt(Math.pow(t.x-a.x,2)+Math.pow(t.y-a.y,2))}function JR(t,a){const r=wc(t);if(!r)return"0 0";const i={x:(r.x-a.left)/a.width*100,y:(r.y-a.top)/a.height*100};return i.x+"% "+i.y+"%"}function WR(t,a){let{data:{value:r}}=t,{data:{value:i}}=a;return r-i}function eN(t,a){let{data:{value:r}}=t,{data:{value:i}}=a;return i-r}function tN(t,a){if(!t||t.length===0)return null;const[r]=t;return r[a]}function Ly(t,a,r){return a===void 0&&(a=t.left),r===void 0&&(r=t.top),{x:a+t.width*.5,y:r+t.height*.5}}const nN=t=>{let{collisionRect:a,droppableRects:r,droppableContainers:i}=t;const u=Ly(a,a.left,a.top),o=[];for(const h of i){const{id:m}=h,p=r.get(m);if(p){const g=ZR(Ly(p),u);o.push({id:m,data:{droppableContainer:h,value:g}})}}return o.sort(WR)};function aN(t,a){const r=Math.max(a.top,t.top),i=Math.max(a.left,t.left),u=Math.min(a.left+a.width,t.left+t.width),o=Math.min(a.top+a.height,t.top+t.height),h=u-i,m=o-r;if(i<u&&r<o){const p=a.width*a.height,g=t.width*t.height,x=h*m,b=x/(p+g-x);return Number(b.toFixed(4))}return 0}const lN=t=>{let{collisionRect:a,droppableRects:r,droppableContainers:i}=t;const u=[];for(const o of i){const{id:h}=o,m=r.get(h);if(m){const p=aN(m,a);p>0&&u.push({id:h,data:{droppableContainer:o,value:p}})}}return u.sort(eN)};function rN(t,a,r){return{...t,scaleX:a&&r?a.width/r.width:1,scaleY:a&&r?a.height/r.height:1}}function vb(t,a){return t&&a?{x:t.left-a.left,y:t.top-a.top}:ll}function sN(t){return function(r){for(var i=arguments.length,u=new Array(i>1?i-1:0),o=1;o<i;o++)u[o-1]=arguments[o];return u.reduce((h,m)=>({...h,top:h.top+t*m.y,bottom:h.bottom+t*m.y,left:h.left+t*m.x,right:h.right+t*m.x}),{...r})}}const iN=sN(1);function yb(t){if(t.startsWith("matrix3d(")){const a=t.slice(9,-1).split(/, /);return{x:+a[12],y:+a[13],scaleX:+a[0],scaleY:+a[5]}}else if(t.startsWith("matrix(")){const a=t.slice(7,-1).split(/, /);return{x:+a[4],y:+a[5],scaleX:+a[0],scaleY:+a[3]}}return null}function uN(t,a,r){const i=yb(a);if(!i)return t;const{scaleX:u,scaleY:o,x:h,y:m}=i,p=t.left-h-(1-u)*parseFloat(r),g=t.top-m-(1-o)*parseFloat(r.slice(r.indexOf(" ")+1)),x=u?t.width/u:t.width,b=o?t.height/o:t.height;return{width:x,height:b,top:g,right:p+x,bottom:g+b,left:p}}const oN={ignoreTransform:!1};function ui(t,a){a===void 0&&(a=oN);let r=t.getBoundingClientRect();if(a.ignoreTransform){const{transform:g,transformOrigin:x}=oa(t).getComputedStyle(t);g&&(r=uN(r,g,x))}const{top:i,left:u,width:o,height:h,bottom:m,right:p}=r;return{top:i,left:u,width:o,height:h,bottom:m,right:p}}function zy(t){return ui(t,{ignoreTransform:!0})}function cN(t){const a=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:a,bottom:r,width:a,height:r}}function dN(t,a){return a===void 0&&(a=oa(t).getComputedStyle(t)),a.position==="fixed"}function fN(t,a){a===void 0&&(a=oa(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(u=>{const o=a[u];return typeof o=="string"?r.test(o):!1})}function lm(t,a){const r=[];function i(u){if(a!=null&&r.length>=a||!u)return r;if(am(u)&&u.scrollingElement!=null&&!r.includes(u.scrollingElement))return r.push(u.scrollingElement),r;if(!Mu(u)||mb(u)||r.includes(u))return r;const o=oa(t).getComputedStyle(u);return u!==t&&fN(u,o)&&r.push(u),dN(u,o)?r:i(u.parentNode)}return t?i(t):r}function xb(t){const[a]=lm(t,1);return a??null}function sh(t){return!Bc||!t?null:si(t)?t:nm(t)?am(t)||t===ii(t).scrollingElement?window:Mu(t)?t:null:null}function bb(t){return si(t)?t.scrollX:t.scrollLeft}function Sb(t){return si(t)?t.scrollY:t.scrollTop}function Ch(t){return{x:bb(t),y:Sb(t)}}var Hn;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Hn||(Hn={}));function Eb(t){return!Bc||!t?!1:t===document.scrollingElement}function wb(t){const a={x:0,y:0},r=Eb(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},i={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},u=t.scrollTop<=a.y,o=t.scrollLeft<=a.x,h=t.scrollTop>=i.y,m=t.scrollLeft>=i.x;return{isTop:u,isLeft:o,isBottom:h,isRight:m,maxScroll:i,minScroll:a}}const hN={x:.2,y:.2};function mN(t,a,r,i,u){let{top:o,left:h,right:m,bottom:p}=r;i===void 0&&(i=10),u===void 0&&(u=hN);const{isTop:g,isBottom:x,isLeft:b,isRight:w}=wb(t),S={x:0,y:0},R={x:0,y:0},C={height:a.height*u.y,width:a.width*u.x};return!g&&o<=a.top+C.height?(S.y=Hn.Backward,R.y=i*Math.abs((a.top+C.height-o)/C.height)):!x&&p>=a.bottom-C.height&&(S.y=Hn.Forward,R.y=i*Math.abs((a.bottom-C.height-p)/C.height)),!w&&m>=a.right-C.width?(S.x=Hn.Forward,R.x=i*Math.abs((a.right-C.width-m)/C.width)):!b&&h<=a.left+C.width&&(S.x=Hn.Backward,R.x=i*Math.abs((a.left+C.width-h)/C.width)),{direction:S,speed:R}}function pN(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:h}=window;return{top:0,left:0,right:o,bottom:h,width:o,height:h}}const{top:a,left:r,right:i,bottom:u}=t.getBoundingClientRect();return{top:a,left:r,right:i,bottom:u,width:t.clientWidth,height:t.clientHeight}}function Rb(t){return t.reduce((a,r)=>Js(a,Ch(r)),ll)}function gN(t){return t.reduce((a,r)=>a+bb(r),0)}function vN(t){return t.reduce((a,r)=>a+Sb(r),0)}function Nb(t,a){if(a===void 0&&(a=ui),!t)return;const{top:r,left:i,bottom:u,right:o}=a(t);xb(t)&&(u<=0||o<=0||r>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const yN=[["x",["left","right"],gN],["y",["top","bottom"],vN]];class rm{constructor(a,r){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 i=lm(r),u=Rb(i);this.rect={...a},this.width=a.width,this.height=a.height;for(const[o,h,m]of yN)for(const p of h)Object.defineProperty(this,p,{get:()=>{const g=m(i),x=u[o]-g;return this.rect[p]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hu{constructor(a){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=a}add(a,r,i){var u;(u=this.target)==null||u.addEventListener(a,r,i),this.listeners.push([a,r,i])}}function xN(t){const{EventTarget:a}=oa(t);return t instanceof a?t:ii(t)}function ih(t,a){const r=Math.abs(t.x),i=Math.abs(t.y);return typeof a=="number"?Math.sqrt(r**2+i**2)>a:"x"in a&&"y"in a?r>a.x&&i>a.y:"x"in a?r>a.x:"y"in a?i>a.y:!1}var Xa;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Xa||(Xa={}));function Uy(t){t.preventDefault()}function bN(t){t.stopPropagation()}var Ct;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ct||(Ct={}));const Tb={start:[Ct.Space,Ct.Enter],cancel:[Ct.Esc],end:[Ct.Space,Ct.Enter,Ct.Tab]},SN=(t,a)=>{let{currentCoordinates:r}=a;switch(t.code){case Ct.Right:return{...r,x:r.x+25};case Ct.Left:return{...r,x:r.x-25};case Ct.Down:return{...r,y:r.y+25};case Ct.Up:return{...r,y:r.y-25}}};class jb{constructor(a){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=a;const{event:{target:r}}=a;this.props=a,this.listeners=new hu(ii(r)),this.windowListeners=new hu(oa(r)),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:a,onStart:r}=this.props,i=a.node.current;i&&Nb(i),r(ll)}handleKeyDown(a){if(qc(a)){const{active:r,context:i,options:u}=this.props,{keyboardCodes:o=Tb,coordinateGetter:h=SN,scrollBehavior:m="smooth"}=u,{code:p}=a;if(o.end.includes(p)){this.handleEnd(a);return}if(o.cancel.includes(p)){this.handleCancel(a);return}const{collisionRect:g}=i.current,x=g?{x:g.left,y:g.top}:ll;this.referenceCoordinates||(this.referenceCoordinates=x);const b=h(a,{active:r,context:i.current,currentCoordinates:x});if(b){const w=Ec(b,x),S={x:0,y:0},{scrollableAncestors:R}=i.current;for(const C of R){const N=a.code,{isTop:z,isRight:I,isLeft:q,isBottom:Q,maxScroll:ee,minScroll:te}=wb(C),D=pN(C),j={x:Math.min(N===Ct.Right?D.right-D.width/2:D.right,Math.max(N===Ct.Right?D.left:D.left+D.width/2,b.x)),y:Math.min(N===Ct.Down?D.bottom-D.height/2:D.bottom,Math.max(N===Ct.Down?D.top:D.top+D.height/2,b.y))},re=N===Ct.Right&&!I||N===Ct.Left&&!q,ue=N===Ct.Down&&!Q||N===Ct.Up&&!z;if(re&&j.x!==b.x){const xe=C.scrollLeft+w.x,pe=N===Ct.Right&&xe<=ee.x||N===Ct.Left&&xe>=te.x;if(pe&&!w.y){C.scrollTo({left:xe,behavior:m});return}pe?S.x=C.scrollLeft-xe:S.x=N===Ct.Right?C.scrollLeft-ee.x:C.scrollLeft-te.x,S.x&&C.scrollBy({left:-S.x,behavior:m});break}else if(ue&&j.y!==b.y){const xe=C.scrollTop+w.y,pe=N===Ct.Down&&xe<=ee.y||N===Ct.Up&&xe>=te.y;if(pe&&!w.x){C.scrollTo({top:xe,behavior:m});return}pe?S.y=C.scrollTop-xe:S.y=N===Ct.Down?C.scrollTop-ee.y:C.scrollTop-te.y,S.y&&C.scrollBy({top:-S.y,behavior:m});break}}this.handleMove(a,Js(Ec(b,this.referenceCoordinates),S))}}}handleMove(a,r){const{onMove:i}=this.props;a.preventDefault(),i(r)}handleEnd(a){const{onEnd:r}=this.props;a.preventDefault(),this.detach(),r()}handleCancel(a){const{onCancel:r}=this.props;a.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jb.activators=[{eventName:"onKeyDown",handler:(t,a,r)=>{let{keyboardCodes:i=Tb,onActivation:u}=a,{active:o}=r;const{code:h}=t.nativeEvent;if(i.start.includes(h)){const m=o.activatorNode.current;return m&&t.target!==m?!1:(t.preventDefault(),u==null||u({event:t.nativeEvent}),!0)}return!1}}];function Hy(t){return!!(t&&"distance"in t)}function By(t){return!!(t&&"delay"in t)}class sm{constructor(a,r,i){var u;i===void 0&&(i=xN(a.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=a,this.events=r;const{event:o}=a,{target:h}=o;this.props=a,this.events=r,this.document=ii(h),this.documentListeners=new hu(this.document),this.listeners=new hu(i),this.windowListeners=new hu(oa(h)),this.initialCoordinates=(u=wc(o))!=null?u:ll,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:a,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(a.move.name,this.handleMove,{passive:!1}),this.listeners.add(a.end.name,this.handleEnd),a.cancel&&this.listeners.add(a.cancel.name,this.handleCancel),this.windowListeners.add(Xa.Resize,this.handleCancel),this.windowListeners.add(Xa.DragStart,Uy),this.windowListeners.add(Xa.VisibilityChange,this.handleCancel),this.windowListeners.add(Xa.ContextMenu,Uy),this.documentListeners.add(Xa.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(By(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Hy(r)){this.handlePending(r);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(a,r){const{active:i,onPending:u}=this.props;u(i,a,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:a}=this,{onStart:r}=this.props;a&&(this.activated=!0,this.documentListeners.add(Xa.Click,bN,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xa.SelectionChange,this.removeTextSelection),r(a))}handleMove(a){var r;const{activated:i,initialCoordinates:u,props:o}=this,{onMove:h,options:{activationConstraint:m}}=o;if(!u)return;const p=(r=wc(a))!=null?r:ll,g=Ec(u,p);if(!i&&m){if(Hy(m)){if(m.tolerance!=null&&ih(g,m.tolerance))return this.handleCancel();if(ih(g,m.distance))return this.handleStart()}if(By(m)&&ih(g,m.tolerance))return this.handleCancel();this.handlePending(m,g);return}a.cancelable&&a.preventDefault(),h(p)}handleEnd(){const{onAbort:a,onEnd:r}=this.props;this.detach(),this.activated||a(this.props.active),r()}handleCancel(){const{onAbort:a,onCancel:r}=this.props;this.detach(),this.activated||a(this.props.active),r()}handleKeydown(a){a.code===Ct.Esc&&this.handleCancel()}removeTextSelection(){var a;(a=this.document.getSelection())==null||a.removeAllRanges()}}const EN={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class im extends sm{constructor(a){const{event:r}=a,i=ii(r.target);super(a,EN,i)}}im.activators=[{eventName:"onPointerDown",handler:(t,a)=>{let{nativeEvent:r}=t,{onActivation:i}=a;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const wN={move:{name:"mousemove"},end:{name:"mouseup"}};var Ah;(function(t){t[t.RightClick=2]="RightClick"})(Ah||(Ah={}));class RN extends sm{constructor(a){super(a,wN,ii(a.event.target))}}RN.activators=[{eventName:"onMouseDown",handler:(t,a)=>{let{nativeEvent:r}=t,{onActivation:i}=a;return r.button===Ah.RightClick?!1:(i==null||i({event:r}),!0)}}];const uh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class NN extends sm{constructor(a){super(a,uh)}static setup(){return window.addEventListener(uh.move.name,a,{capture:!1,passive:!1}),function(){window.removeEventListener(uh.move.name,a)};function a(){}}}NN.activators=[{eventName:"onTouchStart",handler:(t,a)=>{let{nativeEvent:r}=t,{onActivation:i}=a;const{touches:u}=r;return u.length>1?!1:(i==null||i({event:r}),!0)}}];var mu;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(mu||(mu={}));var Nc;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nc||(Nc={}));function TN(t){let{acceleration:a,activator:r=mu.Pointer,canScroll:i,draggingRect:u,enabled:o,interval:h=5,order:m=Nc.TreeOrder,pointerCoordinates:p,scrollableAncestors:g,scrollableAncestorRects:x,delta:b,threshold:w}=t;const S=DN({delta:b,disabled:!o}),[R,C]=zR(),N=v.useRef({x:0,y:0}),z=v.useRef({x:0,y:0}),I=v.useMemo(()=>{switch(r){case mu.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case mu.DraggableRect:return u}},[r,u,p]),q=v.useRef(null),Q=v.useCallback(()=>{const te=q.current;if(!te)return;const D=N.current.x*z.current.x,j=N.current.y*z.current.y;te.scrollBy(D,j)},[]),ee=v.useMemo(()=>m===Nc.TreeOrder?[...g].reverse():g,[m,g]);v.useEffect(()=>{if(!o||!g.length||!I){C();return}for(const te of ee){if((i==null?void 0:i(te))===!1)continue;const D=g.indexOf(te),j=x[D];if(!j)continue;const{direction:re,speed:ue}=mN(te,j,I,a,w);for(const xe of["x","y"])S[xe][re[xe]]||(ue[xe]=0,re[xe]=0);if(ue.x>0||ue.y>0){C(),q.current=te,R(Q,h),N.current=ue,z.current=re;return}}N.current={x:0,y:0},z.current={x:0,y:0},C()},[a,Q,i,C,o,h,JSON.stringify(I),JSON.stringify(S),R,g,ee,x,JSON.stringify(w)])}const jN={x:{[Hn.Backward]:!1,[Hn.Forward]:!1},y:{[Hn.Backward]:!1,[Hn.Forward]:!1}};function DN(t){let{delta:a,disabled:r}=t;const i=Sc(a);return ku(u=>{if(r||!i||!u)return jN;const o={x:Math.sign(a.x-i.x),y:Math.sign(a.y-i.y)};return{x:{[Hn.Backward]:u.x[Hn.Backward]||o.x===-1,[Hn.Forward]:u.x[Hn.Forward]||o.x===1},y:{[Hn.Backward]:u.y[Hn.Backward]||o.y===-1,[Hn.Forward]:u.y[Hn.Forward]||o.y===1}}},[r,a,i])}function CN(t,a){const r=a!=null?t.get(a):void 0,i=r?r.node.current:null;return ku(u=>{var o;return a==null?null:(o=i??u)!=null?o:null},[i,a])}function AN(t,a){return v.useMemo(()=>t.reduce((r,i)=>{const{sensor:u}=i,o=u.activators.map(h=>({eventName:h.eventName,handler:a(h.handler,i)}));return[...r,...o]},[]),[t,a])}var Su;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Su||(Su={}));var Oh;(function(t){t.Optimized="optimized"})(Oh||(Oh={}));const $y=new Map;function ON(t,a){let{dragging:r,dependencies:i,config:u}=a;const[o,h]=v.useState(null),{frequency:m,measure:p,strategy:g}=u,x=v.useRef(t),b=N(),w=bu(b),S=v.useCallback(function(z){z===void 0&&(z=[]),!w.current&&h(I=>I===null?z:I.concat(z.filter(q=>!I.includes(q))))},[w]),R=v.useRef(null),C=ku(z=>{if(b&&!r)return $y;if(!z||z===$y||x.current!==t||o!=null){const I=new Map;for(let q of t){if(!q)continue;if(o&&o.length>0&&!o.includes(q.id)&&q.rect.current){I.set(q.id,q.rect.current);continue}const Q=q.node.current,ee=Q?new rm(p(Q),Q):null;q.rect.current=ee,ee&&I.set(q.id,ee)}return I}return z},[t,o,r,b,p]);return v.useEffect(()=>{x.current=t},[t]),v.useEffect(()=>{b||S()},[r,b]),v.useEffect(()=>{o&&o.length>0&&h(null)},[JSON.stringify(o)]),v.useEffect(()=>{b||typeof m!="number"||R.current!==null||(R.current=setTimeout(()=>{S(),R.current=null},m))},[m,b,S,...i]),{droppableRects:C,measureDroppableContainers:S,measuringScheduled:o!=null};function N(){switch(g){case Su.Always:return!1;case Su.BeforeDragging:return r;default:return!r}}}function um(t,a){return ku(r=>t?r||(typeof a=="function"?a(t):t):null,[a,t])}function MN(t,a){return um(t,a)}function kN(t){let{callback:a,disabled:r}=t;const i=$c(a),u=v.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(i)},[i,r]);return v.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function Yc(t){let{callback:a,disabled:r}=t;const i=$c(a),u=v.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(i)},[r]);return v.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function _N(t){return new rm(ui(t),t)}function qy(t,a,r){a===void 0&&(a=_N);const[i,u]=v.useState(null);function o(){u(p=>{if(!t)return null;if(t.isConnected===!1){var g;return(g=p??r)!=null?g:null}const x=a(t);return JSON.stringify(p)===JSON.stringify(x)?p:x})}const h=kN({callback(p){if(t)for(const g of p){const{type:x,target:b}=g;if(x==="childList"&&b instanceof HTMLElement&&b.contains(t)){o();break}}}}),m=Yc({callback:o});return al(()=>{o(),t?(m==null||m.observe(t),h==null||h.observe(document.body,{childList:!0,subtree:!0})):(m==null||m.disconnect(),h==null||h.disconnect())},[t]),i}function LN(t){const a=um(t);return vb(t,a)}const Yy=[];function zN(t){const a=v.useRef(t),r=ku(i=>t?i&&i!==Yy&&t&&a.current&&t.parentNode===a.current.parentNode?i:lm(t):Yy,[t]);return v.useEffect(()=>{a.current=t},[t]),r}function UN(t){const[a,r]=v.useState(null),i=v.useRef(t),u=v.useCallback(o=>{const h=sh(o.target);h&&r(m=>m?(m.set(h,Ch(h)),new Map(m)):null)},[]);return v.useEffect(()=>{const o=i.current;if(t!==o){h(o);const m=t.map(p=>{const g=sh(p);return g?(g.addEventListener("scroll",u,{passive:!0}),[g,Ch(g)]):null}).filter(p=>p!=null);r(m.length?new Map(m):null),i.current=t}return()=>{h(t),h(o)};function h(m){m.forEach(p=>{const g=sh(p);g==null||g.removeEventListener("scroll",u)})}},[u,t]),v.useMemo(()=>t.length?a?Array.from(a.values()).reduce((o,h)=>Js(o,h),ll):Rb(t):ll,[t,a])}function Vy(t,a){a===void 0&&(a=[]);const r=v.useRef(null);return v.useEffect(()=>{r.current=null},a),v.useEffect(()=>{const i=t!==ll;i&&!r.current&&(r.current=t),!i&&r.current&&(r.current=null)},[t]),r.current?Ec(t,r.current):ll}function HN(t){v.useEffect(()=>{if(!Bc)return;const a=t.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of a)r==null||r()}},t.map(a=>{let{sensor:r}=a;return r}))}function BN(t,a){return v.useMemo(()=>t.reduce((r,i)=>{let{eventName:u,handler:o}=i;return r[u]=h=>{o(h,a)},r},{}),[t,a])}function Db(t){return v.useMemo(()=>t?cN(t):null,[t])}const Fy=[];function $N(t,a){a===void 0&&(a=ui);const[r]=t,i=Db(r?oa(r):null),[u,o]=v.useState(Fy);function h(){o(()=>t.length?t.map(p=>Eb(p)?i:new rm(a(p),p)):Fy)}const m=Yc({callback:h});return al(()=>{m==null||m.disconnect(),h(),t.forEach(p=>m==null?void 0:m.observe(p))},[t]),u}function Cb(t){if(!t)return null;if(t.children.length>1)return t;const a=t.children[0];return Mu(a)?a:t}function qN(t){let{measure:a}=t;const[r,i]=v.useState(null),u=v.useCallback(g=>{for(const{target:x}of g)if(Mu(x)){i(b=>{const w=a(x);return b?{...b,width:w.width,height:w.height}:w});break}},[a]),o=Yc({callback:u}),h=v.useCallback(g=>{const x=Cb(g);o==null||o.disconnect(),x&&(o==null||o.observe(x)),i(x?a(x):null)},[a,o]),[m,p]=bc(h);return v.useMemo(()=>({nodeRef:m,rect:r,setRef:p}),[r,m,p])}const YN=[{sensor:im,options:{}},{sensor:jb,options:{}}],VN={current:{}},fc={draggable:{measure:zy},droppable:{measure:zy,strategy:Su.WhileDragging,frequency:Oh.Optimized},dragOverlay:{measure:ui}};class pu extends Map{get(a){var r;return a!=null&&(r=super.get(a))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(a=>{let{disabled:r}=a;return!r})}getNodeFor(a){var r,i;return(r=(i=this.get(a))==null?void 0:i.node.current)!=null?r:void 0}}const FN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Rc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fc,measureDroppableContainers:Rc,windowRect:null,measuringScheduled:!1},Ab={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Rc,draggableNodes:new Map,over:null,measureDroppableContainers:Rc},Lu=v.createContext(Ab),Ob=v.createContext(FN);function GN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pu}}}function XN(t,a){switch(a.type){case Ln.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:a.initialCoordinates,active:a.active}};case Ln.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:a.coordinates.x-t.draggable.initialCoordinates.x,y:a.coordinates.y-t.draggable.initialCoordinates.y}}};case Ln.DragEnd:case Ln.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ln.RegisterDroppable:{const{element:r}=a,{id:i}=r,u=new pu(t.droppable.containers);return u.set(i,r),{...t,droppable:{...t.droppable,containers:u}}}case Ln.SetDroppableDisabled:{const{id:r,key:i,disabled:u}=a,o=t.droppable.containers.get(r);if(!o||i!==o.key)return t;const h=new pu(t.droppable.containers);return h.set(r,{...o,disabled:u}),{...t,droppable:{...t.droppable,containers:h}}}case Ln.UnregisterDroppable:{const{id:r,key:i}=a,u=t.droppable.containers.get(r);if(!u||i!==u.key)return t;const o=new pu(t.droppable.containers);return o.delete(r),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function IN(t){let{disabled:a}=t;const{active:r,activatorEvent:i,draggableNodes:u}=v.useContext(Lu),o=Sc(i),h=Sc(r==null?void 0:r.id);return v.useEffect(()=>{if(!a&&!i&&o&&h!=null){if(!qc(o)||document.activeElement===o.target)return;const m=u.get(h);if(!m)return;const{activatorNode:p,node:g}=m;if(!p.current&&!g.current)return;requestAnimationFrame(()=>{for(const x of[p.current,g.current]){if(!x)continue;const b=BR(x);if(b){b.focus();break}}})}},[i,a,u,h,o]),null}function Mb(t,a){let{transform:r,...i}=a;return t!=null&&t.length?t.reduce((u,o)=>o({transform:u,...i}),r):r}function QN(t){return v.useMemo(()=>({draggable:{...fc.draggable,...t==null?void 0:t.draggable},droppable:{...fc.droppable,...t==null?void 0:t.droppable},dragOverlay:{...fc.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function PN(t){let{activeNode:a,measure:r,initialRect:i,config:u=!0}=t;const o=v.useRef(!1),{x:h,y:m}=typeof u=="boolean"?{x:u,y:u}:u;al(()=>{if(!h&&!m||!a){o.current=!1;return}if(o.current||!i)return;const g=a==null?void 0:a.node.current;if(!g||g.isConnected===!1)return;const x=r(g),b=vb(x,i);if(h||(b.x=0),m||(b.y=0),o.current=!0,Math.abs(b.x)>0||Math.abs(b.y)>0){const w=xb(g);w&&w.scrollBy({top:b.y,left:b.x})}},[a,h,m,i,r])}const Vc=v.createContext({...ll,scaleX:1,scaleY:1});var Dr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Dr||(Dr={}));const KN=v.memo(function(a){var r,i,u,o;let{id:h,accessibility:m,autoScroll:p=!0,children:g,sensors:x=YN,collisionDetection:b=lN,measuring:w,modifiers:S,...R}=a;const C=v.useReducer(XN,void 0,GN),[N,z]=C,[I,q]=GR(),[Q,ee]=v.useState(Dr.Uninitialized),te=Q===Dr.Initialized,{draggable:{active:D,nodes:j,translate:re},droppable:{containers:ue}}=N,xe=D!=null?j.get(D):null,pe=v.useRef({initial:null,translated:null}),Te=v.useMemo(()=>{var Yt;return D!=null?{id:D,data:(Yt=xe==null?void 0:xe.data)!=null?Yt:VN,rect:pe}:null},[D,xe]),Ae=v.useRef(null),[Re,B]=v.useState(null),[V,de]=v.useState(null),fe=bu(R,Object.values(R)),Ne=_u("DndDescribedBy",h),O=v.useMemo(()=>ue.getEnabled(),[ue]),X=QN(w),{droppableRects:se,measureDroppableContainers:ce,measuringScheduled:we}=ON(O,{dragging:te,dependencies:[re.x,re.y],config:X.droppable}),Se=CN(j,D),He=v.useMemo(()=>V?wc(V):null,[V]),it=Qt(),Fe=MN(Se,X.draggable.measure);PN({activeNode:D!=null?j.get(D):null,config:it.layoutShiftCompensation,initialRect:Fe,measure:X.draggable.measure});const et=qy(Se,X.draggable.measure,Fe),en=qy(Se?Se.parentElement:null),qt=v.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ut=ue.getNodeFor((r=qt.current.over)==null?void 0:r.id),le=qN({measure:X.dragOverlay.measure}),Le=(i=le.nodeRef.current)!=null?i:Se,at=te?(u=le.rect)!=null?u:et:null,Xt=!!(le.nodeRef.current&&le.rect),Cn=LN(Xt?null:et),pn=Db(Le?oa(Le):null),_t=zN(te?ut??Se:null),Wt=$N(_t),Yn=Mb(S,{transform:{x:re.x-Cn.x,y:re.y-Cn.y,scaleX:1,scaleY:1},activatorEvent:V,active:Te,activeNodeRect:et,containerNodeRect:en,draggingNodeRect:at,over:qt.current.over,overlayNodeRect:le.rect,scrollableAncestors:_t,scrollableAncestorRects:Wt,windowRect:pn}),ye=He?Js(He,re):null,Oe=UN(_t),ze=Vy(Oe),Ge=Vy(Oe,[et]),lt=Js(Yn,ze),At=at?iN(at,Yn):null,Ot=Te&&At?b({active:Te,collisionRect:At,droppableRects:se,droppableContainers:O,pointerCoordinates:ye}):null,tn=tN(Ot,"id"),[It,ca]=v.useState(null),gn=Xt?Yn:Js(Yn,Ge),J=rN(gn,(o=It==null?void 0:It.rect)!=null?o:null,et),St=v.useRef(null),Lt=v.useCallback((Yt,gt)=>{let{sensor:zt,options:Rt}=gt;if(Ae.current==null)return;const nn=j.get(Ae.current);if(!nn)return;const Pt=Yt.nativeEvent,Ut=new zt({active:Ae.current,activeNode:nn,event:Pt,options:Rt,context:qt,onAbort(Ke){if(!j.get(Ke))return;const{onDragAbort:An}=fe.current,A={id:Ke};An==null||An(A),I({type:"onDragAbort",event:A})},onPending(Ke,Sn,An,A){if(!j.get(Ke))return;const{onDragPending:H}=fe.current,K={id:Ke,constraint:Sn,initialCoordinates:An,offset:A};H==null||H(K),I({type:"onDragPending",event:K})},onStart(Ke){const Sn=Ae.current;if(Sn==null)return;const An=j.get(Sn);if(!An)return;const{onDragStart:A}=fe.current,_={activatorEvent:Pt,active:{id:Sn,data:An.data,rect:pe}};Zl.unstable_batchedUpdates(()=>{A==null||A(_),ee(Dr.Initializing),z({type:Ln.DragStart,initialCoordinates:Ke,active:Sn}),I({type:"onDragStart",event:_}),B(St.current),de(Pt)})},onMove(Ke){z({type:Ln.DragMove,coordinates:Ke})},onEnd:dt(Ln.DragEnd),onCancel:dt(Ln.DragCancel)});St.current=Ut;function dt(Ke){return async function(){const{active:An,collisions:A,over:_,scrollAdjustedTranslate:H}=qt.current;let K=null;if(An&&H){const{cancelDrop:ne}=fe.current;K={activatorEvent:Pt,active:An,collisions:A,delta:H,over:_},Ke===Ln.DragEnd&&typeof ne=="function"&&await Promise.resolve(ne(K))&&(Ke=Ln.DragCancel)}Ae.current=null,Zl.unstable_batchedUpdates(()=>{z({type:Ke}),ee(Dr.Uninitialized),ca(null),B(null),de(null),St.current=null;const ne=Ke===Ln.DragEnd?"onDragEnd":"onDragCancel";if(K){const Ee=fe.current[ne];Ee==null||Ee(K),I({type:ne,event:K})}})}}},[j]),er=v.useCallback((Yt,gt)=>(zt,Rt)=>{const nn=zt.nativeEvent,Pt=j.get(Rt);if(Ae.current!==null||!Pt||nn.dndKit||nn.defaultPrevented)return;const Ut={active:Pt};Yt(zt,gt.options,Ut)===!0&&(nn.dndKit={capturedBy:gt.sensor},Ae.current=Rt,Lt(zt,gt))},[j,Lt]),Zn=AN(x,er);HN(x),al(()=>{et&&Q===Dr.Initializing&&ee(Dr.Initialized)},[et,Q]),v.useEffect(()=>{const{onDragMove:Yt}=fe.current,{active:gt,activatorEvent:zt,collisions:Rt,over:nn}=qt.current;if(!gt||!zt)return;const Pt={active:gt,activatorEvent:zt,collisions:Rt,delta:{x:lt.x,y:lt.y},over:nn};Zl.unstable_batchedUpdates(()=>{Yt==null||Yt(Pt),I({type:"onDragMove",event:Pt})})},[lt.x,lt.y]),v.useEffect(()=>{const{active:Yt,activatorEvent:gt,collisions:zt,droppableContainers:Rt,scrollAdjustedTranslate:nn}=qt.current;if(!Yt||Ae.current==null||!gt||!nn)return;const{onDragOver:Pt}=fe.current,Ut=Rt.get(tn),dt=Ut&&Ut.rect.current?{id:Ut.id,rect:Ut.rect.current,data:Ut.data,disabled:Ut.disabled}:null,Ke={active:Yt,activatorEvent:gt,collisions:zt,delta:{x:nn.x,y:nn.y},over:dt};Zl.unstable_batchedUpdates(()=>{ca(dt),Pt==null||Pt(Ke),I({type:"onDragOver",event:Ke})})},[tn]),al(()=>{qt.current={activatorEvent:V,active:Te,activeNode:Se,collisionRect:At,collisions:Ot,droppableRects:se,draggableNodes:j,draggingNode:Le,draggingNodeRect:at,droppableContainers:ue,over:It,scrollableAncestors:_t,scrollAdjustedTranslate:lt},pe.current={initial:at,translated:At}},[Te,Se,Ot,At,j,Le,at,se,ue,It,_t,lt]),TN({...it,delta:re,draggingRect:At,pointerCoordinates:ye,scrollableAncestors:_t,scrollableAncestorRects:Wt});const Nl=v.useMemo(()=>({active:Te,activeNode:Se,activeNodeRect:et,activatorEvent:V,collisions:Ot,containerNodeRect:en,dragOverlay:le,draggableNodes:j,droppableContainers:ue,droppableRects:se,over:It,measureDroppableContainers:ce,scrollableAncestors:_t,scrollableAncestorRects:Wt,measuringConfiguration:X,measuringScheduled:we,windowRect:pn}),[Te,Se,et,V,Ot,en,le,j,ue,se,It,ce,_t,Wt,X,we,pn]),$e=v.useMemo(()=>({activatorEvent:V,activators:Zn,active:Te,activeNodeRect:et,ariaDescribedById:{draggable:Ne},dispatch:z,draggableNodes:j,over:It,measureDroppableContainers:ce}),[V,Zn,Te,et,z,Ne,j,It,ce]);return un.createElement(gb.Provider,{value:q},un.createElement(Lu.Provider,{value:$e},un.createElement(Ob.Provider,{value:Nl},un.createElement(Vc.Provider,{value:J},g)),un.createElement(IN,{disabled:(m==null?void 0:m.restoreFocus)===!1})),un.createElement(QR,{...m,hiddenTextDescribedById:Ne}));function Qt(){const Yt=(Re==null?void 0:Re.autoScrollEnabled)===!1,gt=typeof p=="object"?p.enabled===!1:p===!1,zt=te&&!Yt&&!gt;return typeof p=="object"?{...p,enabled:zt}:{enabled:zt}}}),ZN=v.createContext(null),Gy="button",JN="Draggable";function WN(t){let{id:a,data:r,disabled:i=!1,attributes:u}=t;const o=_u(JN),{activators:h,activatorEvent:m,active:p,activeNodeRect:g,ariaDescribedById:x,draggableNodes:b,over:w}=v.useContext(Lu),{role:S=Gy,roleDescription:R="draggable",tabIndex:C=0}=u??{},N=(p==null?void 0:p.id)===a,z=v.useContext(N?Vc:ZN),[I,q]=bc(),[Q,ee]=bc(),te=BN(h,a),D=bu(r);al(()=>(b.set(a,{id:a,key:o,node:I,activatorNode:Q,data:D}),()=>{const re=b.get(a);re&&re.key===o&&b.delete(a)}),[b,a]);const j=v.useMemo(()=>({role:S,tabIndex:C,"aria-disabled":i,"aria-pressed":N&&S===Gy?!0:void 0,"aria-roledescription":R,"aria-describedby":x.draggable}),[i,S,C,N,R,x.draggable]);return{active:p,activatorEvent:m,activeNodeRect:g,attributes:j,isDragging:N,listeners:i?void 0:te,node:I,over:w,setNodeRef:q,setActivatorNodeRef:ee,transform:z}}function kb(){return v.useContext(Ob)}const e2="Droppable",t2={timeout:25};function n2(t){let{data:a,disabled:r=!1,id:i,resizeObserverConfig:u}=t;const o=_u(e2),{active:h,dispatch:m,over:p,measureDroppableContainers:g}=v.useContext(Lu),x=v.useRef({disabled:r}),b=v.useRef(!1),w=v.useRef(null),S=v.useRef(null),{disabled:R,updateMeasurementsFor:C,timeout:N}={...t2,...u},z=bu(C??i),I=v.useCallback(()=>{if(!b.current){b.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(z.current)?z.current:[z.current]),S.current=null},N)},[N]),q=Yc({callback:I,disabled:R||!h}),Q=v.useCallback((j,re)=>{q&&(re&&(q.unobserve(re),b.current=!1),j&&q.observe(j))},[q]),[ee,te]=bc(Q),D=bu(a);return v.useEffect(()=>{!q||!ee.current||(q.disconnect(),b.current=!1,q.observe(ee.current))},[ee,q]),v.useEffect(()=>(m({type:Ln.RegisterDroppable,element:{id:i,key:o,disabled:r,node:ee,rect:w,data:D}}),()=>m({type:Ln.UnregisterDroppable,key:o,id:i})),[i]),v.useEffect(()=>{r!==x.current.disabled&&(m({type:Ln.SetDroppableDisabled,id:i,key:o,disabled:r}),x.current.disabled=r)},[i,o,r,m]),{active:h,rect:w,isOver:(p==null?void 0:p.id)===i,node:ee,over:p,setNodeRef:te}}function a2(t){let{animation:a,children:r}=t;const[i,u]=v.useState(null),[o,h]=v.useState(null),m=Sc(r);return!r&&!i&&m&&u(m),al(()=>{if(!o)return;const p=i==null?void 0:i.key,g=i==null?void 0:i.props.id;if(p==null||g==null){u(null);return}Promise.resolve(a(g,o)).then(()=>{u(null)})},[a,i,o]),un.createElement(un.Fragment,null,r,i?v.cloneElement(i,{ref:h}):null)}const l2={x:0,y:0,scaleX:1,scaleY:1};function r2(t){let{children:a}=t;return un.createElement(Lu.Provider,{value:Ab},un.createElement(Vc.Provider,{value:l2},a))}const s2={position:"fixed",touchAction:"none"},i2=t=>qc(t)?"transform 250ms ease":void 0,u2=v.forwardRef((t,a)=>{let{as:r,activatorEvent:i,adjustScale:u,children:o,className:h,rect:m,style:p,transform:g,transition:x=i2}=t;if(!m)return null;const b=u?g:{...g,scaleX:1,scaleY:1},w={...s2,width:m.width,height:m.height,top:m.top,left:m.left,transform:Or.Transform.toString(b),transformOrigin:u&&i?JR(i,m):void 0,transition:typeof x=="function"?x(i):x,...p};return un.createElement(r,{className:h,style:w,ref:a},o)}),o2=t=>a=>{let{active:r,dragOverlay:i}=a;const u={},{styles:o,className:h}=t;if(o!=null&&o.active)for(const[m,p]of Object.entries(o.active))p!==void 0&&(u[m]=r.node.style.getPropertyValue(m),r.node.style.setProperty(m,p));if(o!=null&&o.dragOverlay)for(const[m,p]of Object.entries(o.dragOverlay))p!==void 0&&i.node.style.setProperty(m,p);return h!=null&&h.active&&r.node.classList.add(h.active),h!=null&&h.dragOverlay&&i.node.classList.add(h.dragOverlay),function(){for(const[p,g]of Object.entries(u))r.node.style.setProperty(p,g);h!=null&&h.active&&r.node.classList.remove(h.active)}},c2=t=>{let{transform:{initial:a,final:r}}=t;return[{transform:Or.Transform.toString(a)},{transform:Or.Transform.toString(r)}]},d2={duration:250,easing:"ease",keyframes:c2,sideEffects:o2({styles:{active:{opacity:"0"}}})};function f2(t){let{config:a,draggableNodes:r,droppableContainers:i,measuringConfiguration:u}=t;return $c((o,h)=>{if(a===null)return;const m=r.get(o);if(!m)return;const p=m.node.current;if(!p)return;const g=Cb(h);if(!g)return;const{transform:x}=oa(h).getComputedStyle(h),b=yb(x);if(!b)return;const w=typeof a=="function"?a:h2(a);return Nb(p,u.draggable.measure),w({active:{id:o,data:m.data,node:p,rect:u.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:h,rect:u.dragOverlay.measure(g)},droppableContainers:i,measuringConfiguration:u,transform:b})})}function h2(t){const{duration:a,easing:r,sideEffects:i,keyframes:u}={...d2,...t};return o=>{let{active:h,dragOverlay:m,transform:p,...g}=o;if(!a)return;const x={x:m.rect.left-h.rect.left,y:m.rect.top-h.rect.top},b={scaleX:p.scaleX!==1?h.rect.width*p.scaleX/m.rect.width:1,scaleY:p.scaleY!==1?h.rect.height*p.scaleY/m.rect.height:1},w={x:p.x-x.x,y:p.y-x.y,...b},S=u({...g,active:h,dragOverlay:m,transform:{initial:p,final:w}}),[R]=S,C=S[S.length-1];if(JSON.stringify(R)===JSON.stringify(C))return;const N=i==null?void 0:i({active:h,dragOverlay:m,...g}),z=m.node.animate(S,{duration:a,easing:r,fill:"forwards"});return new Promise(I=>{z.onfinish=()=>{N==null||N(),I()}})}}let Xy=0;function m2(t){return v.useMemo(()=>{if(t!=null)return Xy++,Xy},[t])}const p2=un.memo(t=>{let{adjustScale:a=!1,children:r,dropAnimation:i,style:u,transition:o,modifiers:h,wrapperElement:m="div",className:p,zIndex:g=999}=t;const{activatorEvent:x,active:b,activeNodeRect:w,containerNodeRect:S,draggableNodes:R,droppableContainers:C,dragOverlay:N,over:z,measuringConfiguration:I,scrollableAncestors:q,scrollableAncestorRects:Q,windowRect:ee}=kb(),te=v.useContext(Vc),D=m2(b==null?void 0:b.id),j=Mb(h,{activatorEvent:x,active:b,activeNodeRect:w,containerNodeRect:S,draggingNodeRect:N.rect,over:z,overlayNodeRect:N.rect,scrollableAncestors:q,scrollableAncestorRects:Q,transform:te,windowRect:ee}),re=um(w),ue=f2({config:i,draggableNodes:R,droppableContainers:C,measuringConfiguration:I}),xe=re?N.setRef:void 0;return un.createElement(r2,null,un.createElement(a2,{animation:ue},b&&D?un.createElement(u2,{key:D,id:b.id,ref:xe,as:m,activatorEvent:x,adjustScale:a,className:p,transition:o,rect:re,style:{zIndex:g,...u},transform:j},r):null))});function gu(t,a,r){const i=t.slice();return i.splice(r<0?i.length+r:r,0,i.splice(a,1)[0]),i}function g2(t,a){return t.reduce((r,i,u)=>{const o=a.get(i);return o&&(r[u]=o),r},Array(t.length))}function ec(t){return t!==null&&t>=0}function v2(t,a){if(t===a)return!0;if(t.length!==a.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==a[r])return!1;return!0}function y2(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const _b=t=>{let{rects:a,activeIndex:r,overIndex:i,index:u}=t;const o=gu(a,i,r),h=a[u],m=o[u];return!m||!h?null:{x:m.left-h.left,y:m.top-h.top,scaleX:m.width/h.width,scaleY:m.height/h.height}},tc={scaleX:1,scaleY:1},om=t=>{var a;let{activeIndex:r,activeNodeRect:i,index:u,rects:o,overIndex:h}=t;const m=(a=o[r])!=null?a:i;if(!m)return null;if(u===r){const g=o[h];return g?{x:0,y:r<h?g.top+g.height-(m.top+m.height):g.top-m.top,...tc}:null}const p=x2(o,u,r);return u>r&&u<=h?{x:0,y:-m.height-p,...tc}:u<r&&u>=h?{x:0,y:m.height+p,...tc}:{x:0,y:0,...tc}};function x2(t,a,r){const i=t[a],u=t[a-1],o=t[a+1];return i?r<a?u?i.top-(u.top+u.height):o?o.top-(i.top+i.height):0:o?o.top-(i.top+i.height):u?i.top-(u.top+u.height):0:0}const Lb="Sortable",zb=un.createContext({activeIndex:-1,containerId:Lb,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_b,disabled:{draggable:!1,droppable:!1}});function cm(t){let{children:a,id:r,items:i,strategy:u=_b,disabled:o=!1}=t;const{active:h,dragOverlay:m,droppableRects:p,over:g,measureDroppableContainers:x}=kb(),b=_u(Lb,r),w=m.rect!==null,S=v.useMemo(()=>i.map(te=>typeof te=="object"&&"id"in te?te.id:te),[i]),R=h!=null,C=h?S.indexOf(h.id):-1,N=g?S.indexOf(g.id):-1,z=v.useRef(S),I=!v2(S,z.current),q=N!==-1&&C===-1||I,Q=y2(o);al(()=>{I&&R&&x(S)},[I,S,R,x]),v.useEffect(()=>{z.current=S},[S]);const ee=v.useMemo(()=>({activeIndex:C,containerId:b,disabled:Q,disableTransforms:q,items:S,overIndex:N,useDragOverlay:w,sortedRects:g2(S,p),strategy:u}),[C,b,Q.draggable,Q.droppable,q,S,N,p,w,u]);return un.createElement(zb.Provider,{value:ee},a)}const b2=t=>{let{id:a,items:r,activeIndex:i,overIndex:u}=t;return gu(r,i,u).indexOf(a)},S2=t=>{let{containerId:a,isSorting:r,wasDragging:i,index:u,items:o,newIndex:h,previousItems:m,previousContainerId:p,transition:g}=t;return!g||!i||m!==o&&u===h?!1:r?!0:h!==u&&a===p},E2={duration:200,easing:"ease"},Ub="transform",w2=Or.Transition.toString({property:Ub,duration:0,easing:"linear"}),R2={roleDescription:"sortable"};function N2(t){let{disabled:a,index:r,node:i,rect:u}=t;const[o,h]=v.useState(null),m=v.useRef(r);return al(()=>{if(!a&&r!==m.current&&i.current){const p=u.current;if(p){const g=ui(i.current,{ignoreTransform:!0}),x={x:p.left-g.left,y:p.top-g.top,scaleX:p.width/g.width,scaleY:p.height/g.height};(x.x||x.y)&&h(x)}}r!==m.current&&(m.current=r)},[a,r,i,u]),v.useEffect(()=>{o&&h(null)},[o]),o}function T2(t){let{animateLayoutChanges:a=S2,attributes:r,disabled:i,data:u,getNewIndex:o=b2,id:h,strategy:m,resizeObserverConfig:p,transition:g=E2}=t;const{items:x,containerId:b,activeIndex:w,disabled:S,disableTransforms:R,sortedRects:C,overIndex:N,useDragOverlay:z,strategy:I}=v.useContext(zb),q=j2(i,S),Q=x.indexOf(h),ee=v.useMemo(()=>({sortable:{containerId:b,index:Q,items:x},...u}),[b,u,Q,x]),te=v.useMemo(()=>x.slice(x.indexOf(h)),[x,h]),{rect:D,node:j,isOver:re,setNodeRef:ue}=n2({id:h,data:ee,disabled:q.droppable,resizeObserverConfig:{updateMeasurementsFor:te,...p}}),{active:xe,activatorEvent:pe,activeNodeRect:Te,attributes:Ae,setNodeRef:Re,listeners:B,isDragging:V,over:de,setActivatorNodeRef:fe,transform:Ne}=WN({id:h,data:ee,attributes:{...R2,...r},disabled:q.draggable}),O=LR(ue,Re),X=!!xe,se=X&&!R&&ec(w)&&ec(N),ce=!z&&V,we=ce&&se?Ne:null,He=se?we??(m??I)({rects:C,activeNodeRect:Te,activeIndex:w,overIndex:N,index:Q}):null,it=ec(w)&&ec(N)?o({id:h,items:x,activeIndex:w,overIndex:N}):Q,Fe=xe==null?void 0:xe.id,et=v.useRef({activeId:Fe,items:x,newIndex:it,containerId:b}),en=x!==et.current.items,qt=a({active:xe,containerId:b,isDragging:V,isSorting:X,id:h,index:Q,items:x,newIndex:et.current.newIndex,previousItems:et.current.items,previousContainerId:et.current.containerId,transition:g,wasDragging:et.current.activeId!=null}),ut=N2({disabled:!qt,index:Q,node:j,rect:D});return v.useEffect(()=>{X&&et.current.newIndex!==it&&(et.current.newIndex=it),b!==et.current.containerId&&(et.current.containerId=b),x!==et.current.items&&(et.current.items=x)},[X,it,b,x]),v.useEffect(()=>{if(Fe===et.current.activeId)return;if(Fe!=null&&et.current.activeId==null){et.current.activeId=Fe;return}const Le=setTimeout(()=>{et.current.activeId=Fe},50);return()=>clearTimeout(Le)},[Fe]),{active:xe,activeIndex:w,attributes:Ae,data:ee,rect:D,index:Q,newIndex:it,items:x,isOver:re,isSorting:X,isDragging:V,listeners:B,node:j,overIndex:N,over:de,setNodeRef:O,setActivatorNodeRef:fe,setDroppableNodeRef:ue,setDraggableNodeRef:Re,transform:ut??He,transition:le()};function le(){if(ut||en&&et.current.newIndex===Q)return w2;if(!(ce&&!qc(pe)||!g)&&(X||qt))return Or.Transition.toString({...g,property:Ub})}}function j2(t,a){var r,i;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:a.draggable,droppable:(i=t==null?void 0:t.droppable)!=null?i:a.droppable}}Ct.Down,Ct.Right,Ct.Up,Ct.Left;const Fc=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],Gc=[{value:"draft",label:"Draft"},{value:"discovery",label:"Discovery"},{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],zu=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],ru=Fc.map(t=>t.value),su=Gc.map(t=>t.value),iu=zu.map(t=>t.value);function oh(t,a,r){if(t.includes(a)){const i=t.filter(u=>u!==a);return i.length===0?[...r]:i}return[...t,a]}function ch(t,a){return a.includes(t)}function gl(t,a){return`agent-plan:dashboard:${t}:${a}`}function dh(t,a,r){if(typeof window>"u")return a;try{const i=window.localStorage.getItem(t);if(!i)return a;const u=JSON.parse(i);if(!Array.isArray(u))return a;const o=`${t}-schema`,h=r.slice().sort().join(",");if(window.localStorage.getItem(o)!==h)return window.localStorage.setItem(o,h),a;const p=u.filter(g=>typeof g=="string"&&r.includes(g));return p.length>0?p:a}catch{return a}}function fh(t,a,r){typeof window>"u"||(window.localStorage.setItem(t,JSON.stringify(a)),window.localStorage.setItem(`${t}-schema`,r.slice().sort().join(",")))}function hh(t,a){if(typeof window>"u")return a;const r=window.localStorage.getItem(t);return r===null?a:r==="true"}const Iy={featureNumbers:null,phaseNumbers:null,taskNumbers:null,shortIds:null,status:null,featureStatus:null,phaseStatus:null,text:null},Qy=/^(feature-status|phase-status|feature|phase|task|id|status|title):(.*)$/i;function Hb(t){return t.split(",").map(a=>a.trim()).filter(a=>a.length>0)}function D2(t){return new Set(Hb(t).map(a=>Number(a)).filter(a=>Number.isFinite(a)&&a>0))}function Py(t){const a=t.toUpperCase();return a==="AND"||a==="OR"}function mh(t,a){const r=t??new Set;for(const i of D2(a))r.add(i);return r}function C2(t,a){const r=t??new Set;for(const i of Hb(a).map(u=>u.toUpperCase()))r.add(i);return r}function A2(t){const a=t.trim();if(!a)return{...Iy};const r={...Iy},i=[],u=[];let o=0;for(;o<a.length;){const m=a[o];if(m==='"'){const p=a.indexOf('"',o+1);if(p===-1){u.push(a.slice(o+1));break}u.push(a.slice(o+1,p)),o=p+1}else if(m===" ")o+=1;else{let p=o;for(;p<a.length&&a[p]!==" ";)p+=1;u.push(a.slice(o,p)),o=p}}let h=0;for(;h<u.length;){const m=u[h];if(Py(m)){h+=1;continue}const p=m.match(Qy);if(p){const g=(p[1]??"").toLowerCase();let x=p[2]??"";if(x.trim()===""&&h+1<u.length){let b=h+1;for(;b<u.length&&Py(u[b]);)b+=1;b<u.length&&!u[b].match(Qy)&&(x=u[b],h=b)}if(g==="feature"){const b=mh(r.featureNumbers,x);b.size&&(r.featureNumbers=b)}else if(g==="phase"){const b=mh(r.phaseNumbers,x);b.size&&(r.phaseNumbers=b)}else if(g==="task"){const b=mh(r.taskNumbers,x);b.size&&(r.taskNumbers=b)}else if(g==="id"){const b=C2(r.shortIds,x);b.size&&(r.shortIds=b)}else g==="status"?x.trim()&&(r.status=x.toLowerCase()):g==="feature-status"?x.trim()&&(r.featureStatus=x.toLowerCase()):g==="phase-status"?x.trim()&&(r.phaseStatus=x.toLowerCase()):g==="title"&&x.trim()&&(r.text=x.toLowerCase())}else i.push(m.toLowerCase());h+=1}return i.length>0&&!r.text&&(r.text=i.join(" ")),r}function O2(t){return!!(t.featureNumbers||t.phaseNumbers||t.taskNumbers||t.shortIds||t.status||t.featureStatus||t.phaseStatus||t.text)}function M2(t,a){if(t.featureNumbers&&!t.featureNumbers.has(a.feature.number)||t.phaseNumbers&&!t.phaseNumbers.has(a.phase.number)||t.taskNumbers&&!t.taskNumbers.has(a.task.number)||t.shortIds&&!(t.shortIds.has(a.task.shortId??"")||t.shortIds.has(a.phase.shortId??"")||t.shortIds.has(a.feature.shortId??""))||t.status&&a.task.status!==t.status||t.featureStatus&&a.feature.status!==t.featureStatus||t.phaseStatus&&a.phase.status!==t.phaseStatus)return!1;if(t.text){const r=t.text;if(![a.task.title,a.task.shortId??"",a.phase.title,a.phase.shortId??"",a.feature.name,a.feature.shortId??""].join(" ").toLowerCase().includes(r))return!1}return!0}function k2({features:t,phases:a,projectStorageScope:r}){const i=gl(r,"show-all-features"),u=gl(r,"tree-open-mode"),o=gl(r,"expanded-features"),h=gl(r,"expanded-phases"),m=gl(r,"feature-status-filters"),p=gl(r,"phase-status-filters"),g=gl(r,"task-status-filters"),x=gl(r,"hide-done"),b=gl(r,"hide-planned"),w=gl(r,"only-active-branches"),[S,R]=v.useState(""),C=v.useMemo(()=>kR(t,a),[t,a]),N=v.useMemo(()=>A2(S),[S]),z=O2(N),{matchedTaskIds:I,matchedFeatureIds:q,matchedPhaseIds:Q}=v.useMemo(()=>{const ye=new Set,Oe=new Set,ze=new Set;if(!z)return{matchedTaskIds:ye,matchedFeatureIds:Oe,matchedPhaseIds:ze};for(const Ge of C)for(const lt of Ge.allPhases)for(const At of lt.allTasks)M2(N,{feature:Ge.feature,phase:lt.phase,task:At})&&(ye.add(At.id),Oe.add(Ge.feature.id),ze.add(lt.phase.id));return{matchedTaskIds:ye,matchedFeatureIds:Oe,matchedPhaseIds:ze}},[z,N,C]),[ee,te]=v.useState(()=>{if(typeof window>"u")return!0;const ye=window.localStorage.getItem(i);return ye===null?!0:ye==="true"}),[D,j]=v.useState(()=>{if(typeof window>"u")return"all";const ye=window.localStorage.getItem(u);return ye==="smart"||ye==="none"||ye==="all"?ye:"all"}),[re,ue]=v.useState(()=>{if(typeof window>"u")return[];try{const ye=window.localStorage.getItem(o);return ye?JSON.parse(ye):[]}catch{return[]}}),[xe,pe]=v.useState(()=>{if(typeof window>"u")return[];try{const ye=window.localStorage.getItem(h);return ye?JSON.parse(ye):[]}catch{return[]}}),[Te,Ae]=v.useState(()=>dh(m,ru,ru)),[Re,B]=v.useState(()=>dh(p,su,su)),[V,de]=v.useState(()=>dh(g,iu,iu)),[fe,Ne]=v.useState(()=>hh(x,!1)),[O,X]=v.useState(()=>hh(b,!1)),[se,ce]=v.useState(()=>hh(w,!1)),[we,Se]=v.useState([]),[He,it]=v.useState([]),[Fe,et]=v.useState([]),en=v.useRef({});v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(i,String(ee))},[ee,i]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(u,D)},[D,u]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(o,JSON.stringify(re))},[re,o]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(h,JSON.stringify(xe))},[xe,h]),v.useEffect(()=>{typeof window>"u"||fh(m,Te,ru)},[Te,m]),v.useEffect(()=>{typeof window>"u"||fh(p,Re,su)},[Re,p]),v.useEffect(()=>{typeof window>"u"||fh(g,V,iu)},[V,g]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(x,String(fe))},[fe,x]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(b,String(O))},[O,b]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(w,String(se))},[se,w]),v.useEffect(()=>()=>{Object.values(en.current).forEach(ye=>window.clearTimeout(ye)),en.current={}},[]);const qt=v.useMemo(()=>{let ye=[...Te];return fe&&(ye=ye.filter(Oe=>Oe!=="done")),O&&(ye=ye.filter(Oe=>Oe!=="planned")),ye},[Te,fe,O]),ut=v.useMemo(()=>{let ye=[...Re];return fe&&(ye=ye.filter(Oe=>Oe!=="done")),O&&(ye=ye.filter(Oe=>Oe!=="planned"&&Oe!=="draft")),ye},[Re,fe,O]),le=v.useMemo(()=>{let ye=[...V];return fe&&(ye=ye.filter(Oe=>Oe!=="done")),O&&(ye=ye.filter(Oe=>Oe!=="planned")),ye},[V,fe,O]),Le=v.useMemo(()=>{if(z)return C.map(ze=>({...ze,allPhases:ze.allPhases.map(Ge=>({...Ge,allTasks:Ge.allTasks.filter(lt=>I.has(lt.id))})).filter(Ge=>Ge.allTasks.length>0)})).filter(ze=>ze.allPhases.length>0);const ye=!ee||se;return(ee?C:C.filter(ze=>ze.isActive)).filter(({feature:ze})=>ch(ze.status,qt)).map(ze=>({...ze,allPhases:ze.allPhases.filter(({phase:Ge,hasActiveTask:lt})=>ch(Ge.status,ut)?ye?Ge.status==="in-progress"||Ge.status==="discovery"||lt:!0:!1).map(Ge=>({...Ge,allTasks:Ge.allTasks.filter(lt=>!!ch(lt.status,le))})).filter(Ge=>Ge.allTasks.length>0||ee||!ye)})).filter(({hasActiveTask:ze,allPhases:Ge})=>ye?ze||Ge.some(lt=>lt.hasActiveTask):Ge.length>0||ee)},[z,I,C,qt,ut,le,se,ee]);v.useEffect(()=>{if(D==="none"){ue([]),pe([]);return}if(D==="all"){ue(Le.filter(({feature:ze})=>ze.status!=="done").map(({feature:ze})=>ze.id)),pe(Le.flatMap(({allPhases:ze})=>ze.map(({phase:Ge})=>Ge.id)));return}const ye=new Set(Le.map(({feature:ze})=>ze.id)),Oe=new Set(Le.flatMap(({allPhases:ze})=>ze.map(({phase:Ge})=>Ge.id)));ue(ze=>ze.filter(Ge=>ye.has(Ge))),pe(ze=>ze.filter(Ge=>Oe.has(Ge)))},[Le,D]),v.useEffect(()=>{z&&(j("smart"),ue(Array.from(q)),pe(Array.from(Q)))},[z,q,Q]);const at=ye=>{j("smart"),ue(Oe=>Oe.includes(ye)?Oe.filter(ze=>ze!==ye):[...Oe,ye])},Xt=ye=>{j("smart"),pe(Oe=>Oe.includes(ye)?Oe.filter(ze=>ze!==ye):[...Oe,ye])},Cn=()=>{j("smart"),ue(Le.map(({feature:ye})=>ye.id)),pe(Le.flatMap(({allPhases:ye})=>ye.map(({phase:Oe})=>Oe.id)))};return v.useEffect(()=>{const ye=(ze,Ge)=>{const lt=Ge.filter(At=>!!At);for(const At of lt){const Ot=`${ze}:${At}`,tn=ze==="feature"?Se:ze==="phase"?it:et;tn(It=>It.includes(At)?It:[...It,At]),en.current[Ot]!==void 0&&window.clearTimeout(en.current[Ot]),en.current[Ot]=window.setTimeout(()=>{tn(It=>It.filter(ca=>ca!==At)),delete en.current[Ot]},CR)}},Oe=ze=>{var At,Ot,tn,It,ca,gn;const lt=ze.detail;if(lt!=null&&lt.type){if(lt.type==="features-updated"){const J=((At=lt.data)==null?void 0:At.featureId)??((Ot=lt.data)==null?void 0:Ot.id);ye("feature",[J]),J&&(j("smart"),ue(St=>St.includes(J)?St:[...St,J]));return}if(lt.type==="phases-updated"){const J=(tn=lt.data)==null?void 0:tn.featureId,St=((It=lt.data)==null?void 0:It.phaseId)??((ca=lt.data)==null?void 0:ca.id);ye("phase",[St]),ye("feature",[J]),ye("task",[(gn=lt.data)==null?void 0:gn.taskId]),j("smart"),J&&ue(Lt=>Lt.includes(J)?Lt:[...Lt,J]),St&&pe(Lt=>Lt.includes(St)?Lt:[...Lt,St])}}};return window.addEventListener("agent-plan:ws-event",Oe),()=>{window.removeEventListener("agent-plan:ws-event",Oe)}},[]),{workTree:C,displayedWorkTree:Le,treeOpenMode:D,setTreeOpenMode:j,expandAll:Cn,expandedFeatureIds:re,expandedPhaseIds:xe,toggleExpandedFeature:at,toggleExpandedPhase:Xt,recentFeatureIds:we,recentPhaseIds:He,recentTaskIds:Fe,showAllFeatures:ee,setShowAllFeatures:te,featureStatusFilters:Te,phaseStatusFilters:Re,taskStatusFilters:V,hideDone:fe,setHideDone:Ne,hidePlanned:O,setHidePlanned:X,onlyActiveBranches:se,setOnlyActiveBranches:ce,resetFilters:()=>{te(!0),Ne(!1),X(!1),Ae(ru),B(su),de(iu),ce(!1),j("all")},toggleFeatureStatusFilter:ye=>Ae(Oe=>oh(Oe,ye,ru)),togglePhaseStatusFilter:ye=>B(Oe=>oh(Oe,ye,su)),toggleTaskStatusFilter:ye=>de(Oe=>oh(Oe,ye,iu)),searchQuery:S,setSearchQuery:R,searchActive:z,matchedTaskIds:I,matchedFeatureIds:q,matchedPhaseIds:Q}}const Bb=v.createContext(null);function dm({id:t,children:a}){const r=T2({id:t}),i={transform:Or.Transform.toString(r.transform),transition:r.transition};return d.jsx(Bb.Provider,{value:r,children:d.jsx("div",{ref:r.setNodeRef,style:i,className:r.isDragging?"ap-sortable--dragging":"",children:a})})}function fm(){const t=v.useContext(Bb);return t?d.jsx("button",{type:"button",className:"drag-handle","aria-label":"Drag to reorder",title:"Drag to reorder",...t.listeners,...t.attributes,children:d.jsx(jw,{className:"h-4 w-4"})}):null}const hm="mt-1 block min-w-0 break-words font-mono text-sm font-semibold leading-snug [overflow-wrap:anywhere]";function _2(){return d.jsx("span",{className:"rounded-full bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--accent)]",children:"Updated"})}function ni({status:t,doneTasks:a,totalTasks:r,recentlyChanged:i,className:u}){const o=a!=null&&r!=null;return d.jsxs("div",{className:u,children:[i?d.jsx(_2,{}):null,o?d.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",a,"/",r||0,")"]}):null,d.jsx("span",{className:"shrink-0",children:d.jsx(Oa,{status:t})})]})}function L2({entry:t,expanded:a,recentlyChanged:r,onToggle:i,isPhaseExpanded:u,onTogglePhase:o,isPhaseRecentlyChanged:h,isTaskRecentlyChanged:m,highlightedTaskIds:p}){const{feature:g,totalTasks:x,doneTasks:b,allPhases:w,hasActiveTask:S}=t;return d.jsxs("div",{className:`surface-card min-w-0 px-3 py-3 transition-colors sm:px-4 ${g.status==="in-progress"?"ap-in-progress":S?"border-[color:var(--color-status-in-progress)]/40 bg-[color:color-mix(in_srgb,var(--color-status-in-progress)_7%,transparent)]":""} ${g.status==="done"?"!opacity-70 !bg-[color:color-mix(in_srgb,var(--color-status-done)_10%,transparent)] !border-[color:color-mix(in_srgb,var(--color-status-done)_35%,transparent)]":""} ${r?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[d.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 rounded-[12px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${r?"bg-[color:color-mix(in_srgb,var(--accent)_10%,transparent)]":""}`,children:[d.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[d.jsx("button",{type:"button",onClick:i,className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":a?`Collapse feature ${g.name}`:`Expand feature ${g.name}`,"aria-expanded":a,children:d.jsx(tb,{className:`h-4 w-4 transition ${a?"rotate-90":"rotate-0"}`})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fm,{}),d.jsx(Wl,{id:li({featureNum:g.number}),children:d.jsx(Jl,{featureNum:g.number})}),g.shortId?d.jsx(ri,{shortId:g.shortId}):null,S?d.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),d.jsx(ni,{status:g.status,doneTasks:b,totalTasks:x,recentlyChanged:r,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),d.jsx(wt,{to:`/features/${g.id}`,className:`entity-link--feature ${hm} underline-offset-4 hover:underline`,children:g.name})]})]}),d.jsx(ni,{status:g.status,doneTasks:b,totalTasks:x,recentlyChanged:r,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),a&&w.length>0?d.jsx("div",{className:"mt-2 ml-1.5 grid grid-cols-1 gap-2 border-l border-[var(--border)] pl-3 sm:ml-4 sm:pl-4",children:d.jsx(cm,{items:w.map(R=>R.phase.id),strategy:om,children:w.map(R=>d.jsx(dm,{id:R.phase.id,children:d.jsx(z2,{feature:g,phaseEntry:R,expanded:u(R.phase.id),recentlyChanged:h(R.phase.id),onToggle:()=>o(R.phase.id),isTaskRecentlyChanged:m,highlightedTaskIds:p})},R.phase.id))})}):null]})}function z2({feature:t,phaseEntry:a,expanded:r,recentlyChanged:i,onToggle:u,isTaskRecentlyChanged:o,highlightedTaskIds:h}){const{phase:m,totalTasks:p,doneTasks:g,allTasks:x,hasActiveTask:b}=a;return d.jsxs("div",{className:`work-tree-row grid min-w-0 grid-cols-1 gap-2 rounded-[12px] p-3 transition-colors ${m.status==="in-progress"?"ap-in-progress":b?"border border-[color:color-mix(in_srgb,var(--color-status-in-progress)_35%,transparent)] bg-[color:color-mix(in_srgb,var(--color-status-in-progress)_6%,transparent)]":""} ${m.status==="done"?"opacity-70 bg-[color:color-mix(in_srgb,var(--color-status-done)_6%,transparent)]":""} ${i?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[d.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${i?"bg-[color:color-mix(in_srgb,var(--accent)_8%,transparent)]":""}`,children:[d.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[d.jsx("button",{type:"button",onClick:u,className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":r?`Collapse phase ${m.title}`:`Expand phase ${m.title}`,"aria-expanded":r,children:d.jsx(tb,{className:`h-4 w-4 transition ${r?"rotate-90":"rotate-0"}`})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fm,{}),d.jsx(Wl,{id:li({featureNum:t==null?void 0:t.number,phaseNum:m.number}),children:d.jsx(Jl,{featureNum:t==null?void 0:t.number,phaseNum:m.number})}),m.shortId?d.jsx(ri,{shortId:m.shortId}):null,m.handoff?d.jsx(tm,{updatedAt:m.handoffUpdatedAt}):null,b?d.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),d.jsx(ni,{status:m.status,doneTasks:g,totalTasks:p,recentlyChanged:i,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),d.jsx(wt,{to:`/features/${t.id}/phases/${m.id}`,className:`entity-link--phase ${hm} underline-offset-4 hover:underline`,children:m.title})]})]}),d.jsx(ni,{status:m.status,doneTasks:g,totalTasks:p,recentlyChanged:i,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),r?x.length>0?d.jsx("div",{className:"ml-1.5 grid grid-cols-1 gap-1 border-l border-[var(--border)] pl-3 sm:ml-4 sm:pl-4",children:d.jsx(cm,{items:x.map(w=>w.id),strategy:om,children:x.map(w=>d.jsx(dm,{id:w.id,children:d.jsx(U2,{feature:t,phase:m,task:w,recentlyChanged:o(w.id),highlighted:h==null?void 0:h.has(w.id)})},w.id))})}):d.jsx("p",{className:"ml-1.5 text-xs italic text-[var(--text-subtle)] sm:ml-4",children:"No tasks"}):null]})}function U2({feature:t,phase:a,task:r,recentlyChanged:i,highlighted:u}){return d.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-2 py-2 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${r.status==="in-progress"?"ap-in-progress":""} ${r.status==="done"?"opacity-60 bg-[color:color-mix(in_srgb,var(--color-status-done)_6%,transparent)] text-[var(--text-muted)]":""} ${i?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""} ${u?"ap-search-hit":""}`,children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fm,{}),d.jsx(Wl,{id:li({featureNum:t==null?void 0:t.number,phaseNum:a.number,taskNum:r.number}),children:d.jsx(Jl,{featureNum:t==null?void 0:t.number,phaseNum:a.number,taskNum:r.number})}),r.shortId?d.jsx(ri,{shortId:r.shortId}):null,r.status==="in-progress"?d.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),d.jsx(ni,{status:r.status,recentlyChanged:i,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),d.jsx(wt,{to:`/features/${t.id}/phases/${a.id}/tasks/${r.id}`,className:`entity-link--task ${hm} underline-offset-4 hover:underline`,children:r.title})]}),d.jsx(ni,{status:r.status,recentlyChanged:i,className:"hidden shrink-0 items-center gap-2 sm:flex"})]})}var k=(function(t){return t.FIELD_NAME="FIELD_NAME",t.COLON="COLON",t.VALUE="VALUE",t.QUOTED_VALUE="QUOTED_VALUE",t.AND="AND",t.OR="OR",t.NOT="NOT",t.COMPARISON_OP="COMPARISON_OP",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.SAVED_SEARCH="SAVED_SEARCH",t.HISTORY_REF="HISTORY_REF",t.PREFIX_OP="PREFIX_OP",t.WILDCARD="WILDCARD",t.REGEX="REGEX",t.RANGE="RANGE",t.TILDE="TILDE",t.BOOST="BOOST",t.WHITESPACE="WHITESPACE",t.UNKNOWN="UNKNOWN",t})({}),ra=(function(t){return t[t.EXPECT_TERM=0]="EXPECT_TERM",t[t.EXPECT_VALUE=1]="EXPECT_VALUE",t})(ra||{}),Ks=class{constructor(t,a){mn(this,"input");mn(this,"pos");mn(this,"state");mn(this,"tokens");mn(this,"options");this.input=t,this.pos=0,this.state=ra.EXPECT_TERM,this.tokens=[],this.options=a||{}}tokenize(){for(this.tokens=[],this.pos=0,this.state=ra.EXPECT_TERM;this.pos<this.input.length;)this.state===ra.EXPECT_VALUE?this.readValue():this.readTerm();return this.tokens}peek(){return this.input[this.pos]}peekAt(t){return this.input[this.pos+t]}advance(){return this.input[this.pos++]}isWhitespace(t){return t===" "||t===" "||t===`
197
+ `},IR={onDragStart(t){let{active:a}=t;return"Picked up draggable item "+a.id+"."},onDragOver(t){let{active:a,over:r}=t;return r?"Draggable item "+a.id+" was moved over droppable area "+r.id+".":"Draggable item "+a.id+" is no longer over a droppable area."},onDragEnd(t){let{active:a,over:r}=t;return r?"Draggable item "+a.id+" was dropped over droppable area "+r.id:"Draggable item "+a.id+" was dropped."},onDragCancel(t){let{active:a}=t;return"Dragging was cancelled. Draggable item "+a.id+" was dropped."}};function QR(t){let{announcements:a=IR,container:r,hiddenTextDescribedById:i,screenReaderInstructions:u=XR}=t;const{announce:o,announcement:h}=VR(),m=_u("DndLiveRegion"),[p,g]=v.useState(!1);if(v.useEffect(()=>{g(!0)},[]),FR(v.useMemo(()=>({onDragStart(b){let{active:w}=b;o(a.onDragStart({active:w}))},onDragMove(b){let{active:w,over:S}=b;a.onDragMove&&o(a.onDragMove({active:w,over:S}))},onDragOver(b){let{active:w,over:S}=b;o(a.onDragOver({active:w,over:S}))},onDragEnd(b){let{active:w,over:S}=b;o(a.onDragEnd({active:w,over:S}))},onDragCancel(b){let{active:w,over:S}=b;o(a.onDragCancel({active:w,over:S}))}}),[o,a])),!p)return null;const x=un.createElement(un.Fragment,null,un.createElement(qR,{id:i,value:u.draggable}),un.createElement(YR,{id:m,announcement:h}));return r?Zl.createPortal(x,r):x}var Ln;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ln||(Ln={}));function Rc(){}function PR(t,a){return v.useMemo(()=>({sensor:t,options:a??{}}),[t,a])}function KR(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];return v.useMemo(()=>[...a].filter(i=>i!=null),[...a])}const ll=Object.freeze({x:0,y:0});function ZR(t,a){return Math.sqrt(Math.pow(t.x-a.x,2)+Math.pow(t.y-a.y,2))}function JR(t,a){const r=wc(t);if(!r)return"0 0";const i={x:(r.x-a.left)/a.width*100,y:(r.y-a.top)/a.height*100};return i.x+"% "+i.y+"%"}function WR(t,a){let{data:{value:r}}=t,{data:{value:i}}=a;return r-i}function eN(t,a){let{data:{value:r}}=t,{data:{value:i}}=a;return i-r}function tN(t,a){if(!t||t.length===0)return null;const[r]=t;return r[a]}function Ly(t,a,r){return a===void 0&&(a=t.left),r===void 0&&(r=t.top),{x:a+t.width*.5,y:r+t.height*.5}}const nN=t=>{let{collisionRect:a,droppableRects:r,droppableContainers:i}=t;const u=Ly(a,a.left,a.top),o=[];for(const h of i){const{id:m}=h,p=r.get(m);if(p){const g=ZR(Ly(p),u);o.push({id:m,data:{droppableContainer:h,value:g}})}}return o.sort(WR)};function aN(t,a){const r=Math.max(a.top,t.top),i=Math.max(a.left,t.left),u=Math.min(a.left+a.width,t.left+t.width),o=Math.min(a.top+a.height,t.top+t.height),h=u-i,m=o-r;if(i<u&&r<o){const p=a.width*a.height,g=t.width*t.height,x=h*m,b=x/(p+g-x);return Number(b.toFixed(4))}return 0}const lN=t=>{let{collisionRect:a,droppableRects:r,droppableContainers:i}=t;const u=[];for(const o of i){const{id:h}=o,m=r.get(h);if(m){const p=aN(m,a);p>0&&u.push({id:h,data:{droppableContainer:o,value:p}})}}return u.sort(eN)};function rN(t,a,r){return{...t,scaleX:a&&r?a.width/r.width:1,scaleY:a&&r?a.height/r.height:1}}function vb(t,a){return t&&a?{x:t.left-a.left,y:t.top-a.top}:ll}function sN(t){return function(r){for(var i=arguments.length,u=new Array(i>1?i-1:0),o=1;o<i;o++)u[o-1]=arguments[o];return u.reduce((h,m)=>({...h,top:h.top+t*m.y,bottom:h.bottom+t*m.y,left:h.left+t*m.x,right:h.right+t*m.x}),{...r})}}const iN=sN(1);function yb(t){if(t.startsWith("matrix3d(")){const a=t.slice(9,-1).split(/, /);return{x:+a[12],y:+a[13],scaleX:+a[0],scaleY:+a[5]}}else if(t.startsWith("matrix(")){const a=t.slice(7,-1).split(/, /);return{x:+a[4],y:+a[5],scaleX:+a[0],scaleY:+a[3]}}return null}function uN(t,a,r){const i=yb(a);if(!i)return t;const{scaleX:u,scaleY:o,x:h,y:m}=i,p=t.left-h-(1-u)*parseFloat(r),g=t.top-m-(1-o)*parseFloat(r.slice(r.indexOf(" ")+1)),x=u?t.width/u:t.width,b=o?t.height/o:t.height;return{width:x,height:b,top:g,right:p+x,bottom:g+b,left:p}}const oN={ignoreTransform:!1};function ui(t,a){a===void 0&&(a=oN);let r=t.getBoundingClientRect();if(a.ignoreTransform){const{transform:g,transformOrigin:x}=oa(t).getComputedStyle(t);g&&(r=uN(r,g,x))}const{top:i,left:u,width:o,height:h,bottom:m,right:p}=r;return{top:i,left:u,width:o,height:h,bottom:m,right:p}}function zy(t){return ui(t,{ignoreTransform:!0})}function cN(t){const a=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:a,bottom:r,width:a,height:r}}function dN(t,a){return a===void 0&&(a=oa(t).getComputedStyle(t)),a.position==="fixed"}function fN(t,a){a===void 0&&(a=oa(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(u=>{const o=a[u];return typeof o=="string"?r.test(o):!1})}function lm(t,a){const r=[];function i(u){if(a!=null&&r.length>=a||!u)return r;if(am(u)&&u.scrollingElement!=null&&!r.includes(u.scrollingElement))return r.push(u.scrollingElement),r;if(!Mu(u)||mb(u)||r.includes(u))return r;const o=oa(t).getComputedStyle(u);return u!==t&&fN(u,o)&&r.push(u),dN(u,o)?r:i(u.parentNode)}return t?i(t):r}function xb(t){const[a]=lm(t,1);return a??null}function sh(t){return!Bc||!t?null:si(t)?t:nm(t)?am(t)||t===ii(t).scrollingElement?window:Mu(t)?t:null:null}function bb(t){return si(t)?t.scrollX:t.scrollLeft}function Sb(t){return si(t)?t.scrollY:t.scrollTop}function Ch(t){return{x:bb(t),y:Sb(t)}}var Hn;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Hn||(Hn={}));function Eb(t){return!Bc||!t?!1:t===document.scrollingElement}function wb(t){const a={x:0,y:0},r=Eb(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},i={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},u=t.scrollTop<=a.y,o=t.scrollLeft<=a.x,h=t.scrollTop>=i.y,m=t.scrollLeft>=i.x;return{isTop:u,isLeft:o,isBottom:h,isRight:m,maxScroll:i,minScroll:a}}const hN={x:.2,y:.2};function mN(t,a,r,i,u){let{top:o,left:h,right:m,bottom:p}=r;i===void 0&&(i=10),u===void 0&&(u=hN);const{isTop:g,isBottom:x,isLeft:b,isRight:w}=wb(t),S={x:0,y:0},R={x:0,y:0},C={height:a.height*u.y,width:a.width*u.x};return!g&&o<=a.top+C.height?(S.y=Hn.Backward,R.y=i*Math.abs((a.top+C.height-o)/C.height)):!x&&p>=a.bottom-C.height&&(S.y=Hn.Forward,R.y=i*Math.abs((a.bottom-C.height-p)/C.height)),!w&&m>=a.right-C.width?(S.x=Hn.Forward,R.x=i*Math.abs((a.right-C.width-m)/C.width)):!b&&h<=a.left+C.width&&(S.x=Hn.Backward,R.x=i*Math.abs((a.left+C.width-h)/C.width)),{direction:S,speed:R}}function pN(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:h}=window;return{top:0,left:0,right:o,bottom:h,width:o,height:h}}const{top:a,left:r,right:i,bottom:u}=t.getBoundingClientRect();return{top:a,left:r,right:i,bottom:u,width:t.clientWidth,height:t.clientHeight}}function Rb(t){return t.reduce((a,r)=>Js(a,Ch(r)),ll)}function gN(t){return t.reduce((a,r)=>a+bb(r),0)}function vN(t){return t.reduce((a,r)=>a+Sb(r),0)}function Nb(t,a){if(a===void 0&&(a=ui),!t)return;const{top:r,left:i,bottom:u,right:o}=a(t);xb(t)&&(u<=0||o<=0||r>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const yN=[["x",["left","right"],gN],["y",["top","bottom"],vN]];class rm{constructor(a,r){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 i=lm(r),u=Rb(i);this.rect={...a},this.width=a.width,this.height=a.height;for(const[o,h,m]of yN)for(const p of h)Object.defineProperty(this,p,{get:()=>{const g=m(i),x=u[o]-g;return this.rect[p]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hu{constructor(a){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=a}add(a,r,i){var u;(u=this.target)==null||u.addEventListener(a,r,i),this.listeners.push([a,r,i])}}function xN(t){const{EventTarget:a}=oa(t);return t instanceof a?t:ii(t)}function ih(t,a){const r=Math.abs(t.x),i=Math.abs(t.y);return typeof a=="number"?Math.sqrt(r**2+i**2)>a:"x"in a&&"y"in a?r>a.x&&i>a.y:"x"in a?r>a.x:"y"in a?i>a.y:!1}var Xa;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Xa||(Xa={}));function Uy(t){t.preventDefault()}function bN(t){t.stopPropagation()}var Ct;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ct||(Ct={}));const Tb={start:[Ct.Space,Ct.Enter],cancel:[Ct.Esc],end:[Ct.Space,Ct.Enter,Ct.Tab]},SN=(t,a)=>{let{currentCoordinates:r}=a;switch(t.code){case Ct.Right:return{...r,x:r.x+25};case Ct.Left:return{...r,x:r.x-25};case Ct.Down:return{...r,y:r.y+25};case Ct.Up:return{...r,y:r.y-25}}};class jb{constructor(a){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=a;const{event:{target:r}}=a;this.props=a,this.listeners=new hu(ii(r)),this.windowListeners=new hu(oa(r)),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:a,onStart:r}=this.props,i=a.node.current;i&&Nb(i),r(ll)}handleKeyDown(a){if(qc(a)){const{active:r,context:i,options:u}=this.props,{keyboardCodes:o=Tb,coordinateGetter:h=SN,scrollBehavior:m="smooth"}=u,{code:p}=a;if(o.end.includes(p)){this.handleEnd(a);return}if(o.cancel.includes(p)){this.handleCancel(a);return}const{collisionRect:g}=i.current,x=g?{x:g.left,y:g.top}:ll;this.referenceCoordinates||(this.referenceCoordinates=x);const b=h(a,{active:r,context:i.current,currentCoordinates:x});if(b){const w=Ec(b,x),S={x:0,y:0},{scrollableAncestors:R}=i.current;for(const C of R){const N=a.code,{isTop:z,isRight:I,isLeft:q,isBottom:Q,maxScroll:ee,minScroll:te}=wb(C),D=pN(C),j={x:Math.min(N===Ct.Right?D.right-D.width/2:D.right,Math.max(N===Ct.Right?D.left:D.left+D.width/2,b.x)),y:Math.min(N===Ct.Down?D.bottom-D.height/2:D.bottom,Math.max(N===Ct.Down?D.top:D.top+D.height/2,b.y))},re=N===Ct.Right&&!I||N===Ct.Left&&!q,ue=N===Ct.Down&&!Q||N===Ct.Up&&!z;if(re&&j.x!==b.x){const xe=C.scrollLeft+w.x,pe=N===Ct.Right&&xe<=ee.x||N===Ct.Left&&xe>=te.x;if(pe&&!w.y){C.scrollTo({left:xe,behavior:m});return}pe?S.x=C.scrollLeft-xe:S.x=N===Ct.Right?C.scrollLeft-ee.x:C.scrollLeft-te.x,S.x&&C.scrollBy({left:-S.x,behavior:m});break}else if(ue&&j.y!==b.y){const xe=C.scrollTop+w.y,pe=N===Ct.Down&&xe<=ee.y||N===Ct.Up&&xe>=te.y;if(pe&&!w.x){C.scrollTo({top:xe,behavior:m});return}pe?S.y=C.scrollTop-xe:S.y=N===Ct.Down?C.scrollTop-ee.y:C.scrollTop-te.y,S.y&&C.scrollBy({top:-S.y,behavior:m});break}}this.handleMove(a,Js(Ec(b,this.referenceCoordinates),S))}}}handleMove(a,r){const{onMove:i}=this.props;a.preventDefault(),i(r)}handleEnd(a){const{onEnd:r}=this.props;a.preventDefault(),this.detach(),r()}handleCancel(a){const{onCancel:r}=this.props;a.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jb.activators=[{eventName:"onKeyDown",handler:(t,a,r)=>{let{keyboardCodes:i=Tb,onActivation:u}=a,{active:o}=r;const{code:h}=t.nativeEvent;if(i.start.includes(h)){const m=o.activatorNode.current;return m&&t.target!==m?!1:(t.preventDefault(),u==null||u({event:t.nativeEvent}),!0)}return!1}}];function Hy(t){return!!(t&&"distance"in t)}function By(t){return!!(t&&"delay"in t)}class sm{constructor(a,r,i){var u;i===void 0&&(i=xN(a.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=a,this.events=r;const{event:o}=a,{target:h}=o;this.props=a,this.events=r,this.document=ii(h),this.documentListeners=new hu(this.document),this.listeners=new hu(i),this.windowListeners=new hu(oa(h)),this.initialCoordinates=(u=wc(o))!=null?u:ll,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:a,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(a.move.name,this.handleMove,{passive:!1}),this.listeners.add(a.end.name,this.handleEnd),a.cancel&&this.listeners.add(a.cancel.name,this.handleCancel),this.windowListeners.add(Xa.Resize,this.handleCancel),this.windowListeners.add(Xa.DragStart,Uy),this.windowListeners.add(Xa.VisibilityChange,this.handleCancel),this.windowListeners.add(Xa.ContextMenu,Uy),this.documentListeners.add(Xa.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(By(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Hy(r)){this.handlePending(r);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(a,r){const{active:i,onPending:u}=this.props;u(i,a,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:a}=this,{onStart:r}=this.props;a&&(this.activated=!0,this.documentListeners.add(Xa.Click,bN,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xa.SelectionChange,this.removeTextSelection),r(a))}handleMove(a){var r;const{activated:i,initialCoordinates:u,props:o}=this,{onMove:h,options:{activationConstraint:m}}=o;if(!u)return;const p=(r=wc(a))!=null?r:ll,g=Ec(u,p);if(!i&&m){if(Hy(m)){if(m.tolerance!=null&&ih(g,m.tolerance))return this.handleCancel();if(ih(g,m.distance))return this.handleStart()}if(By(m)&&ih(g,m.tolerance))return this.handleCancel();this.handlePending(m,g);return}a.cancelable&&a.preventDefault(),h(p)}handleEnd(){const{onAbort:a,onEnd:r}=this.props;this.detach(),this.activated||a(this.props.active),r()}handleCancel(){const{onAbort:a,onCancel:r}=this.props;this.detach(),this.activated||a(this.props.active),r()}handleKeydown(a){a.code===Ct.Esc&&this.handleCancel()}removeTextSelection(){var a;(a=this.document.getSelection())==null||a.removeAllRanges()}}const EN={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class im extends sm{constructor(a){const{event:r}=a,i=ii(r.target);super(a,EN,i)}}im.activators=[{eventName:"onPointerDown",handler:(t,a)=>{let{nativeEvent:r}=t,{onActivation:i}=a;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const wN={move:{name:"mousemove"},end:{name:"mouseup"}};var Ah;(function(t){t[t.RightClick=2]="RightClick"})(Ah||(Ah={}));class RN extends sm{constructor(a){super(a,wN,ii(a.event.target))}}RN.activators=[{eventName:"onMouseDown",handler:(t,a)=>{let{nativeEvent:r}=t,{onActivation:i}=a;return r.button===Ah.RightClick?!1:(i==null||i({event:r}),!0)}}];const uh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class NN extends sm{constructor(a){super(a,uh)}static setup(){return window.addEventListener(uh.move.name,a,{capture:!1,passive:!1}),function(){window.removeEventListener(uh.move.name,a)};function a(){}}}NN.activators=[{eventName:"onTouchStart",handler:(t,a)=>{let{nativeEvent:r}=t,{onActivation:i}=a;const{touches:u}=r;return u.length>1?!1:(i==null||i({event:r}),!0)}}];var mu;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(mu||(mu={}));var Nc;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nc||(Nc={}));function TN(t){let{acceleration:a,activator:r=mu.Pointer,canScroll:i,draggingRect:u,enabled:o,interval:h=5,order:m=Nc.TreeOrder,pointerCoordinates:p,scrollableAncestors:g,scrollableAncestorRects:x,delta:b,threshold:w}=t;const S=DN({delta:b,disabled:!o}),[R,C]=zR(),N=v.useRef({x:0,y:0}),z=v.useRef({x:0,y:0}),I=v.useMemo(()=>{switch(r){case mu.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case mu.DraggableRect:return u}},[r,u,p]),q=v.useRef(null),Q=v.useCallback(()=>{const te=q.current;if(!te)return;const D=N.current.x*z.current.x,j=N.current.y*z.current.y;te.scrollBy(D,j)},[]),ee=v.useMemo(()=>m===Nc.TreeOrder?[...g].reverse():g,[m,g]);v.useEffect(()=>{if(!o||!g.length||!I){C();return}for(const te of ee){if((i==null?void 0:i(te))===!1)continue;const D=g.indexOf(te),j=x[D];if(!j)continue;const{direction:re,speed:ue}=mN(te,j,I,a,w);for(const xe of["x","y"])S[xe][re[xe]]||(ue[xe]=0,re[xe]=0);if(ue.x>0||ue.y>0){C(),q.current=te,R(Q,h),N.current=ue,z.current=re;return}}N.current={x:0,y:0},z.current={x:0,y:0},C()},[a,Q,i,C,o,h,JSON.stringify(I),JSON.stringify(S),R,g,ee,x,JSON.stringify(w)])}const jN={x:{[Hn.Backward]:!1,[Hn.Forward]:!1},y:{[Hn.Backward]:!1,[Hn.Forward]:!1}};function DN(t){let{delta:a,disabled:r}=t;const i=Sc(a);return ku(u=>{if(r||!i||!u)return jN;const o={x:Math.sign(a.x-i.x),y:Math.sign(a.y-i.y)};return{x:{[Hn.Backward]:u.x[Hn.Backward]||o.x===-1,[Hn.Forward]:u.x[Hn.Forward]||o.x===1},y:{[Hn.Backward]:u.y[Hn.Backward]||o.y===-1,[Hn.Forward]:u.y[Hn.Forward]||o.y===1}}},[r,a,i])}function CN(t,a){const r=a!=null?t.get(a):void 0,i=r?r.node.current:null;return ku(u=>{var o;return a==null?null:(o=i??u)!=null?o:null},[i,a])}function AN(t,a){return v.useMemo(()=>t.reduce((r,i)=>{const{sensor:u}=i,o=u.activators.map(h=>({eventName:h.eventName,handler:a(h.handler,i)}));return[...r,...o]},[]),[t,a])}var Su;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Su||(Su={}));var Oh;(function(t){t.Optimized="optimized"})(Oh||(Oh={}));const $y=new Map;function ON(t,a){let{dragging:r,dependencies:i,config:u}=a;const[o,h]=v.useState(null),{frequency:m,measure:p,strategy:g}=u,x=v.useRef(t),b=N(),w=bu(b),S=v.useCallback(function(z){z===void 0&&(z=[]),!w.current&&h(I=>I===null?z:I.concat(z.filter(q=>!I.includes(q))))},[w]),R=v.useRef(null),C=ku(z=>{if(b&&!r)return $y;if(!z||z===$y||x.current!==t||o!=null){const I=new Map;for(let q of t){if(!q)continue;if(o&&o.length>0&&!o.includes(q.id)&&q.rect.current){I.set(q.id,q.rect.current);continue}const Q=q.node.current,ee=Q?new rm(p(Q),Q):null;q.rect.current=ee,ee&&I.set(q.id,ee)}return I}return z},[t,o,r,b,p]);return v.useEffect(()=>{x.current=t},[t]),v.useEffect(()=>{b||S()},[r,b]),v.useEffect(()=>{o&&o.length>0&&h(null)},[JSON.stringify(o)]),v.useEffect(()=>{b||typeof m!="number"||R.current!==null||(R.current=setTimeout(()=>{S(),R.current=null},m))},[m,b,S,...i]),{droppableRects:C,measureDroppableContainers:S,measuringScheduled:o!=null};function N(){switch(g){case Su.Always:return!1;case Su.BeforeDragging:return r;default:return!r}}}function um(t,a){return ku(r=>t?r||(typeof a=="function"?a(t):t):null,[a,t])}function MN(t,a){return um(t,a)}function kN(t){let{callback:a,disabled:r}=t;const i=$c(a),u=v.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(i)},[i,r]);return v.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function Yc(t){let{callback:a,disabled:r}=t;const i=$c(a),u=v.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(i)},[r]);return v.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function _N(t){return new rm(ui(t),t)}function qy(t,a,r){a===void 0&&(a=_N);const[i,u]=v.useState(null);function o(){u(p=>{if(!t)return null;if(t.isConnected===!1){var g;return(g=p??r)!=null?g:null}const x=a(t);return JSON.stringify(p)===JSON.stringify(x)?p:x})}const h=kN({callback(p){if(t)for(const g of p){const{type:x,target:b}=g;if(x==="childList"&&b instanceof HTMLElement&&b.contains(t)){o();break}}}}),m=Yc({callback:o});return al(()=>{o(),t?(m==null||m.observe(t),h==null||h.observe(document.body,{childList:!0,subtree:!0})):(m==null||m.disconnect(),h==null||h.disconnect())},[t]),i}function LN(t){const a=um(t);return vb(t,a)}const Yy=[];function zN(t){const a=v.useRef(t),r=ku(i=>t?i&&i!==Yy&&t&&a.current&&t.parentNode===a.current.parentNode?i:lm(t):Yy,[t]);return v.useEffect(()=>{a.current=t},[t]),r}function UN(t){const[a,r]=v.useState(null),i=v.useRef(t),u=v.useCallback(o=>{const h=sh(o.target);h&&r(m=>m?(m.set(h,Ch(h)),new Map(m)):null)},[]);return v.useEffect(()=>{const o=i.current;if(t!==o){h(o);const m=t.map(p=>{const g=sh(p);return g?(g.addEventListener("scroll",u,{passive:!0}),[g,Ch(g)]):null}).filter(p=>p!=null);r(m.length?new Map(m):null),i.current=t}return()=>{h(t),h(o)};function h(m){m.forEach(p=>{const g=sh(p);g==null||g.removeEventListener("scroll",u)})}},[u,t]),v.useMemo(()=>t.length?a?Array.from(a.values()).reduce((o,h)=>Js(o,h),ll):Rb(t):ll,[t,a])}function Vy(t,a){a===void 0&&(a=[]);const r=v.useRef(null);return v.useEffect(()=>{r.current=null},a),v.useEffect(()=>{const i=t!==ll;i&&!r.current&&(r.current=t),!i&&r.current&&(r.current=null)},[t]),r.current?Ec(t,r.current):ll}function HN(t){v.useEffect(()=>{if(!Bc)return;const a=t.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of a)r==null||r()}},t.map(a=>{let{sensor:r}=a;return r}))}function BN(t,a){return v.useMemo(()=>t.reduce((r,i)=>{let{eventName:u,handler:o}=i;return r[u]=h=>{o(h,a)},r},{}),[t,a])}function Db(t){return v.useMemo(()=>t?cN(t):null,[t])}const Fy=[];function $N(t,a){a===void 0&&(a=ui);const[r]=t,i=Db(r?oa(r):null),[u,o]=v.useState(Fy);function h(){o(()=>t.length?t.map(p=>Eb(p)?i:new rm(a(p),p)):Fy)}const m=Yc({callback:h});return al(()=>{m==null||m.disconnect(),h(),t.forEach(p=>m==null?void 0:m.observe(p))},[t]),u}function Cb(t){if(!t)return null;if(t.children.length>1)return t;const a=t.children[0];return Mu(a)?a:t}function qN(t){let{measure:a}=t;const[r,i]=v.useState(null),u=v.useCallback(g=>{for(const{target:x}of g)if(Mu(x)){i(b=>{const w=a(x);return b?{...b,width:w.width,height:w.height}:w});break}},[a]),o=Yc({callback:u}),h=v.useCallback(g=>{const x=Cb(g);o==null||o.disconnect(),x&&(o==null||o.observe(x)),i(x?a(x):null)},[a,o]),[m,p]=bc(h);return v.useMemo(()=>({nodeRef:m,rect:r,setRef:p}),[r,m,p])}const YN=[{sensor:im,options:{}},{sensor:jb,options:{}}],VN={current:{}},fc={draggable:{measure:zy},droppable:{measure:zy,strategy:Su.WhileDragging,frequency:Oh.Optimized},dragOverlay:{measure:ui}};class pu extends Map{get(a){var r;return a!=null&&(r=super.get(a))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(a=>{let{disabled:r}=a;return!r})}getNodeFor(a){var r,i;return(r=(i=this.get(a))==null?void 0:i.node.current)!=null?r:void 0}}const FN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Rc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fc,measureDroppableContainers:Rc,windowRect:null,measuringScheduled:!1},Ab={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Rc,draggableNodes:new Map,over:null,measureDroppableContainers:Rc},Lu=v.createContext(Ab),Ob=v.createContext(FN);function GN(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pu}}}function XN(t,a){switch(a.type){case Ln.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:a.initialCoordinates,active:a.active}};case Ln.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:a.coordinates.x-t.draggable.initialCoordinates.x,y:a.coordinates.y-t.draggable.initialCoordinates.y}}};case Ln.DragEnd:case Ln.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ln.RegisterDroppable:{const{element:r}=a,{id:i}=r,u=new pu(t.droppable.containers);return u.set(i,r),{...t,droppable:{...t.droppable,containers:u}}}case Ln.SetDroppableDisabled:{const{id:r,key:i,disabled:u}=a,o=t.droppable.containers.get(r);if(!o||i!==o.key)return t;const h=new pu(t.droppable.containers);return h.set(r,{...o,disabled:u}),{...t,droppable:{...t.droppable,containers:h}}}case Ln.UnregisterDroppable:{const{id:r,key:i}=a,u=t.droppable.containers.get(r);if(!u||i!==u.key)return t;const o=new pu(t.droppable.containers);return o.delete(r),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function IN(t){let{disabled:a}=t;const{active:r,activatorEvent:i,draggableNodes:u}=v.useContext(Lu),o=Sc(i),h=Sc(r==null?void 0:r.id);return v.useEffect(()=>{if(!a&&!i&&o&&h!=null){if(!qc(o)||document.activeElement===o.target)return;const m=u.get(h);if(!m)return;const{activatorNode:p,node:g}=m;if(!p.current&&!g.current)return;requestAnimationFrame(()=>{for(const x of[p.current,g.current]){if(!x)continue;const b=BR(x);if(b){b.focus();break}}})}},[i,a,u,h,o]),null}function Mb(t,a){let{transform:r,...i}=a;return t!=null&&t.length?t.reduce((u,o)=>o({transform:u,...i}),r):r}function QN(t){return v.useMemo(()=>({draggable:{...fc.draggable,...t==null?void 0:t.draggable},droppable:{...fc.droppable,...t==null?void 0:t.droppable},dragOverlay:{...fc.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function PN(t){let{activeNode:a,measure:r,initialRect:i,config:u=!0}=t;const o=v.useRef(!1),{x:h,y:m}=typeof u=="boolean"?{x:u,y:u}:u;al(()=>{if(!h&&!m||!a){o.current=!1;return}if(o.current||!i)return;const g=a==null?void 0:a.node.current;if(!g||g.isConnected===!1)return;const x=r(g),b=vb(x,i);if(h||(b.x=0),m||(b.y=0),o.current=!0,Math.abs(b.x)>0||Math.abs(b.y)>0){const w=xb(g);w&&w.scrollBy({top:b.y,left:b.x})}},[a,h,m,i,r])}const Vc=v.createContext({...ll,scaleX:1,scaleY:1});var Dr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Dr||(Dr={}));const KN=v.memo(function(a){var r,i,u,o;let{id:h,accessibility:m,autoScroll:p=!0,children:g,sensors:x=YN,collisionDetection:b=lN,measuring:w,modifiers:S,...R}=a;const C=v.useReducer(XN,void 0,GN),[N,z]=C,[I,q]=GR(),[Q,ee]=v.useState(Dr.Uninitialized),te=Q===Dr.Initialized,{draggable:{active:D,nodes:j,translate:re},droppable:{containers:ue}}=N,xe=D!=null?j.get(D):null,pe=v.useRef({initial:null,translated:null}),Te=v.useMemo(()=>{var Yt;return D!=null?{id:D,data:(Yt=xe==null?void 0:xe.data)!=null?Yt:VN,rect:pe}:null},[D,xe]),Ae=v.useRef(null),[Re,B]=v.useState(null),[V,de]=v.useState(null),fe=bu(R,Object.values(R)),Ne=_u("DndDescribedBy",h),O=v.useMemo(()=>ue.getEnabled(),[ue]),X=QN(w),{droppableRects:se,measureDroppableContainers:ce,measuringScheduled:we}=ON(O,{dragging:te,dependencies:[re.x,re.y],config:X.droppable}),Se=CN(j,D),He=v.useMemo(()=>V?wc(V):null,[V]),it=Qt(),Fe=MN(Se,X.draggable.measure);PN({activeNode:D!=null?j.get(D):null,config:it.layoutShiftCompensation,initialRect:Fe,measure:X.draggable.measure});const et=qy(Se,X.draggable.measure,Fe),en=qy(Se?Se.parentElement:null),qt=v.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ut=ue.getNodeFor((r=qt.current.over)==null?void 0:r.id),le=qN({measure:X.dragOverlay.measure}),Le=(i=le.nodeRef.current)!=null?i:Se,at=te?(u=le.rect)!=null?u:et:null,Xt=!!(le.nodeRef.current&&le.rect),Cn=LN(Xt?null:et),pn=Db(Le?oa(Le):null),_t=zN(te?ut??Se:null),Wt=$N(_t),Yn=Mb(S,{transform:{x:re.x-Cn.x,y:re.y-Cn.y,scaleX:1,scaleY:1},activatorEvent:V,active:Te,activeNodeRect:et,containerNodeRect:en,draggingNodeRect:at,over:qt.current.over,overlayNodeRect:le.rect,scrollableAncestors:_t,scrollableAncestorRects:Wt,windowRect:pn}),ye=He?Js(He,re):null,Oe=UN(_t),ze=Vy(Oe),Ge=Vy(Oe,[et]),lt=Js(Yn,ze),At=at?iN(at,Yn):null,Ot=Te&&At?b({active:Te,collisionRect:At,droppableRects:se,droppableContainers:O,pointerCoordinates:ye}):null,tn=tN(Ot,"id"),[It,ca]=v.useState(null),gn=Xt?Yn:Js(Yn,Ge),J=rN(gn,(o=It==null?void 0:It.rect)!=null?o:null,et),St=v.useRef(null),Lt=v.useCallback((Yt,gt)=>{let{sensor:zt,options:Rt}=gt;if(Ae.current==null)return;const nn=j.get(Ae.current);if(!nn)return;const Pt=Yt.nativeEvent,Ut=new zt({active:Ae.current,activeNode:nn,event:Pt,options:Rt,context:qt,onAbort(Ke){if(!j.get(Ke))return;const{onDragAbort:An}=fe.current,A={id:Ke};An==null||An(A),I({type:"onDragAbort",event:A})},onPending(Ke,Sn,An,A){if(!j.get(Ke))return;const{onDragPending:H}=fe.current,K={id:Ke,constraint:Sn,initialCoordinates:An,offset:A};H==null||H(K),I({type:"onDragPending",event:K})},onStart(Ke){const Sn=Ae.current;if(Sn==null)return;const An=j.get(Sn);if(!An)return;const{onDragStart:A}=fe.current,_={activatorEvent:Pt,active:{id:Sn,data:An.data,rect:pe}};Zl.unstable_batchedUpdates(()=>{A==null||A(_),ee(Dr.Initializing),z({type:Ln.DragStart,initialCoordinates:Ke,active:Sn}),I({type:"onDragStart",event:_}),B(St.current),de(Pt)})},onMove(Ke){z({type:Ln.DragMove,coordinates:Ke})},onEnd:dt(Ln.DragEnd),onCancel:dt(Ln.DragCancel)});St.current=Ut;function dt(Ke){return async function(){const{active:An,collisions:A,over:_,scrollAdjustedTranslate:H}=qt.current;let K=null;if(An&&H){const{cancelDrop:ne}=fe.current;K={activatorEvent:Pt,active:An,collisions:A,delta:H,over:_},Ke===Ln.DragEnd&&typeof ne=="function"&&await Promise.resolve(ne(K))&&(Ke=Ln.DragCancel)}Ae.current=null,Zl.unstable_batchedUpdates(()=>{z({type:Ke}),ee(Dr.Uninitialized),ca(null),B(null),de(null),St.current=null;const ne=Ke===Ln.DragEnd?"onDragEnd":"onDragCancel";if(K){const Ee=fe.current[ne];Ee==null||Ee(K),I({type:ne,event:K})}})}}},[j]),er=v.useCallback((Yt,gt)=>(zt,Rt)=>{const nn=zt.nativeEvent,Pt=j.get(Rt);if(Ae.current!==null||!Pt||nn.dndKit||nn.defaultPrevented)return;const Ut={active:Pt};Yt(zt,gt.options,Ut)===!0&&(nn.dndKit={capturedBy:gt.sensor},Ae.current=Rt,Lt(zt,gt))},[j,Lt]),Zn=AN(x,er);HN(x),al(()=>{et&&Q===Dr.Initializing&&ee(Dr.Initialized)},[et,Q]),v.useEffect(()=>{const{onDragMove:Yt}=fe.current,{active:gt,activatorEvent:zt,collisions:Rt,over:nn}=qt.current;if(!gt||!zt)return;const Pt={active:gt,activatorEvent:zt,collisions:Rt,delta:{x:lt.x,y:lt.y},over:nn};Zl.unstable_batchedUpdates(()=>{Yt==null||Yt(Pt),I({type:"onDragMove",event:Pt})})},[lt.x,lt.y]),v.useEffect(()=>{const{active:Yt,activatorEvent:gt,collisions:zt,droppableContainers:Rt,scrollAdjustedTranslate:nn}=qt.current;if(!Yt||Ae.current==null||!gt||!nn)return;const{onDragOver:Pt}=fe.current,Ut=Rt.get(tn),dt=Ut&&Ut.rect.current?{id:Ut.id,rect:Ut.rect.current,data:Ut.data,disabled:Ut.disabled}:null,Ke={active:Yt,activatorEvent:gt,collisions:zt,delta:{x:nn.x,y:nn.y},over:dt};Zl.unstable_batchedUpdates(()=>{ca(dt),Pt==null||Pt(Ke),I({type:"onDragOver",event:Ke})})},[tn]),al(()=>{qt.current={activatorEvent:V,active:Te,activeNode:Se,collisionRect:At,collisions:Ot,droppableRects:se,draggableNodes:j,draggingNode:Le,draggingNodeRect:at,droppableContainers:ue,over:It,scrollableAncestors:_t,scrollAdjustedTranslate:lt},pe.current={initial:at,translated:At}},[Te,Se,Ot,At,j,Le,at,se,ue,It,_t,lt]),TN({...it,delta:re,draggingRect:At,pointerCoordinates:ye,scrollableAncestors:_t,scrollableAncestorRects:Wt});const Nl=v.useMemo(()=>({active:Te,activeNode:Se,activeNodeRect:et,activatorEvent:V,collisions:Ot,containerNodeRect:en,dragOverlay:le,draggableNodes:j,droppableContainers:ue,droppableRects:se,over:It,measureDroppableContainers:ce,scrollableAncestors:_t,scrollableAncestorRects:Wt,measuringConfiguration:X,measuringScheduled:we,windowRect:pn}),[Te,Se,et,V,Ot,en,le,j,ue,se,It,ce,_t,Wt,X,we,pn]),$e=v.useMemo(()=>({activatorEvent:V,activators:Zn,active:Te,activeNodeRect:et,ariaDescribedById:{draggable:Ne},dispatch:z,draggableNodes:j,over:It,measureDroppableContainers:ce}),[V,Zn,Te,et,z,Ne,j,It,ce]);return un.createElement(gb.Provider,{value:q},un.createElement(Lu.Provider,{value:$e},un.createElement(Ob.Provider,{value:Nl},un.createElement(Vc.Provider,{value:J},g)),un.createElement(IN,{disabled:(m==null?void 0:m.restoreFocus)===!1})),un.createElement(QR,{...m,hiddenTextDescribedById:Ne}));function Qt(){const Yt=(Re==null?void 0:Re.autoScrollEnabled)===!1,gt=typeof p=="object"?p.enabled===!1:p===!1,zt=te&&!Yt&&!gt;return typeof p=="object"?{...p,enabled:zt}:{enabled:zt}}}),ZN=v.createContext(null),Gy="button",JN="Draggable";function WN(t){let{id:a,data:r,disabled:i=!1,attributes:u}=t;const o=_u(JN),{activators:h,activatorEvent:m,active:p,activeNodeRect:g,ariaDescribedById:x,draggableNodes:b,over:w}=v.useContext(Lu),{role:S=Gy,roleDescription:R="draggable",tabIndex:C=0}=u??{},N=(p==null?void 0:p.id)===a,z=v.useContext(N?Vc:ZN),[I,q]=bc(),[Q,ee]=bc(),te=BN(h,a),D=bu(r);al(()=>(b.set(a,{id:a,key:o,node:I,activatorNode:Q,data:D}),()=>{const re=b.get(a);re&&re.key===o&&b.delete(a)}),[b,a]);const j=v.useMemo(()=>({role:S,tabIndex:C,"aria-disabled":i,"aria-pressed":N&&S===Gy?!0:void 0,"aria-roledescription":R,"aria-describedby":x.draggable}),[i,S,C,N,R,x.draggable]);return{active:p,activatorEvent:m,activeNodeRect:g,attributes:j,isDragging:N,listeners:i?void 0:te,node:I,over:w,setNodeRef:q,setActivatorNodeRef:ee,transform:z}}function kb(){return v.useContext(Ob)}const e2="Droppable",t2={timeout:25};function n2(t){let{data:a,disabled:r=!1,id:i,resizeObserverConfig:u}=t;const o=_u(e2),{active:h,dispatch:m,over:p,measureDroppableContainers:g}=v.useContext(Lu),x=v.useRef({disabled:r}),b=v.useRef(!1),w=v.useRef(null),S=v.useRef(null),{disabled:R,updateMeasurementsFor:C,timeout:N}={...t2,...u},z=bu(C??i),I=v.useCallback(()=>{if(!b.current){b.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(z.current)?z.current:[z.current]),S.current=null},N)},[N]),q=Yc({callback:I,disabled:R||!h}),Q=v.useCallback((j,re)=>{q&&(re&&(q.unobserve(re),b.current=!1),j&&q.observe(j))},[q]),[ee,te]=bc(Q),D=bu(a);return v.useEffect(()=>{!q||!ee.current||(q.disconnect(),b.current=!1,q.observe(ee.current))},[ee,q]),v.useEffect(()=>(m({type:Ln.RegisterDroppable,element:{id:i,key:o,disabled:r,node:ee,rect:w,data:D}}),()=>m({type:Ln.UnregisterDroppable,key:o,id:i})),[i]),v.useEffect(()=>{r!==x.current.disabled&&(m({type:Ln.SetDroppableDisabled,id:i,key:o,disabled:r}),x.current.disabled=r)},[i,o,r,m]),{active:h,rect:w,isOver:(p==null?void 0:p.id)===i,node:ee,over:p,setNodeRef:te}}function a2(t){let{animation:a,children:r}=t;const[i,u]=v.useState(null),[o,h]=v.useState(null),m=Sc(r);return!r&&!i&&m&&u(m),al(()=>{if(!o)return;const p=i==null?void 0:i.key,g=i==null?void 0:i.props.id;if(p==null||g==null){u(null);return}Promise.resolve(a(g,o)).then(()=>{u(null)})},[a,i,o]),un.createElement(un.Fragment,null,r,i?v.cloneElement(i,{ref:h}):null)}const l2={x:0,y:0,scaleX:1,scaleY:1};function r2(t){let{children:a}=t;return un.createElement(Lu.Provider,{value:Ab},un.createElement(Vc.Provider,{value:l2},a))}const s2={position:"fixed",touchAction:"none"},i2=t=>qc(t)?"transform 250ms ease":void 0,u2=v.forwardRef((t,a)=>{let{as:r,activatorEvent:i,adjustScale:u,children:o,className:h,rect:m,style:p,transform:g,transition:x=i2}=t;if(!m)return null;const b=u?g:{...g,scaleX:1,scaleY:1},w={...s2,width:m.width,height:m.height,top:m.top,left:m.left,transform:Or.Transform.toString(b),transformOrigin:u&&i?JR(i,m):void 0,transition:typeof x=="function"?x(i):x,...p};return un.createElement(r,{className:h,style:w,ref:a},o)}),o2=t=>a=>{let{active:r,dragOverlay:i}=a;const u={},{styles:o,className:h}=t;if(o!=null&&o.active)for(const[m,p]of Object.entries(o.active))p!==void 0&&(u[m]=r.node.style.getPropertyValue(m),r.node.style.setProperty(m,p));if(o!=null&&o.dragOverlay)for(const[m,p]of Object.entries(o.dragOverlay))p!==void 0&&i.node.style.setProperty(m,p);return h!=null&&h.active&&r.node.classList.add(h.active),h!=null&&h.dragOverlay&&i.node.classList.add(h.dragOverlay),function(){for(const[p,g]of Object.entries(u))r.node.style.setProperty(p,g);h!=null&&h.active&&r.node.classList.remove(h.active)}},c2=t=>{let{transform:{initial:a,final:r}}=t;return[{transform:Or.Transform.toString(a)},{transform:Or.Transform.toString(r)}]},d2={duration:250,easing:"ease",keyframes:c2,sideEffects:o2({styles:{active:{opacity:"0"}}})};function f2(t){let{config:a,draggableNodes:r,droppableContainers:i,measuringConfiguration:u}=t;return $c((o,h)=>{if(a===null)return;const m=r.get(o);if(!m)return;const p=m.node.current;if(!p)return;const g=Cb(h);if(!g)return;const{transform:x}=oa(h).getComputedStyle(h),b=yb(x);if(!b)return;const w=typeof a=="function"?a:h2(a);return Nb(p,u.draggable.measure),w({active:{id:o,data:m.data,node:p,rect:u.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:h,rect:u.dragOverlay.measure(g)},droppableContainers:i,measuringConfiguration:u,transform:b})})}function h2(t){const{duration:a,easing:r,sideEffects:i,keyframes:u}={...d2,...t};return o=>{let{active:h,dragOverlay:m,transform:p,...g}=o;if(!a)return;const x={x:m.rect.left-h.rect.left,y:m.rect.top-h.rect.top},b={scaleX:p.scaleX!==1?h.rect.width*p.scaleX/m.rect.width:1,scaleY:p.scaleY!==1?h.rect.height*p.scaleY/m.rect.height:1},w={x:p.x-x.x,y:p.y-x.y,...b},S=u({...g,active:h,dragOverlay:m,transform:{initial:p,final:w}}),[R]=S,C=S[S.length-1];if(JSON.stringify(R)===JSON.stringify(C))return;const N=i==null?void 0:i({active:h,dragOverlay:m,...g}),z=m.node.animate(S,{duration:a,easing:r,fill:"forwards"});return new Promise(I=>{z.onfinish=()=>{N==null||N(),I()}})}}let Xy=0;function m2(t){return v.useMemo(()=>{if(t!=null)return Xy++,Xy},[t])}const p2=un.memo(t=>{let{adjustScale:a=!1,children:r,dropAnimation:i,style:u,transition:o,modifiers:h,wrapperElement:m="div",className:p,zIndex:g=999}=t;const{activatorEvent:x,active:b,activeNodeRect:w,containerNodeRect:S,draggableNodes:R,droppableContainers:C,dragOverlay:N,over:z,measuringConfiguration:I,scrollableAncestors:q,scrollableAncestorRects:Q,windowRect:ee}=kb(),te=v.useContext(Vc),D=m2(b==null?void 0:b.id),j=Mb(h,{activatorEvent:x,active:b,activeNodeRect:w,containerNodeRect:S,draggingNodeRect:N.rect,over:z,overlayNodeRect:N.rect,scrollableAncestors:q,scrollableAncestorRects:Q,transform:te,windowRect:ee}),re=um(w),ue=f2({config:i,draggableNodes:R,droppableContainers:C,measuringConfiguration:I}),xe=re?N.setRef:void 0;return un.createElement(r2,null,un.createElement(a2,{animation:ue},b&&D?un.createElement(u2,{key:D,id:b.id,ref:xe,as:m,activatorEvent:x,adjustScale:a,className:p,transition:o,rect:re,style:{zIndex:g,...u},transform:j},r):null))});function gu(t,a,r){const i=t.slice();return i.splice(r<0?i.length+r:r,0,i.splice(a,1)[0]),i}function g2(t,a){return t.reduce((r,i,u)=>{const o=a.get(i);return o&&(r[u]=o),r},Array(t.length))}function ec(t){return t!==null&&t>=0}function v2(t,a){if(t===a)return!0;if(t.length!==a.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==a[r])return!1;return!0}function y2(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const _b=t=>{let{rects:a,activeIndex:r,overIndex:i,index:u}=t;const o=gu(a,i,r),h=a[u],m=o[u];return!m||!h?null:{x:m.left-h.left,y:m.top-h.top,scaleX:m.width/h.width,scaleY:m.height/h.height}},tc={scaleX:1,scaleY:1},om=t=>{var a;let{activeIndex:r,activeNodeRect:i,index:u,rects:o,overIndex:h}=t;const m=(a=o[r])!=null?a:i;if(!m)return null;if(u===r){const g=o[h];return g?{x:0,y:r<h?g.top+g.height-(m.top+m.height):g.top-m.top,...tc}:null}const p=x2(o,u,r);return u>r&&u<=h?{x:0,y:-m.height-p,...tc}:u<r&&u>=h?{x:0,y:m.height+p,...tc}:{x:0,y:0,...tc}};function x2(t,a,r){const i=t[a],u=t[a-1],o=t[a+1];return i?r<a?u?i.top-(u.top+u.height):o?o.top-(i.top+i.height):0:o?o.top-(i.top+i.height):u?i.top-(u.top+u.height):0:0}const Lb="Sortable",zb=un.createContext({activeIndex:-1,containerId:Lb,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_b,disabled:{draggable:!1,droppable:!1}});function cm(t){let{children:a,id:r,items:i,strategy:u=_b,disabled:o=!1}=t;const{active:h,dragOverlay:m,droppableRects:p,over:g,measureDroppableContainers:x}=kb(),b=_u(Lb,r),w=m.rect!==null,S=v.useMemo(()=>i.map(te=>typeof te=="object"&&"id"in te?te.id:te),[i]),R=h!=null,C=h?S.indexOf(h.id):-1,N=g?S.indexOf(g.id):-1,z=v.useRef(S),I=!v2(S,z.current),q=N!==-1&&C===-1||I,Q=y2(o);al(()=>{I&&R&&x(S)},[I,S,R,x]),v.useEffect(()=>{z.current=S},[S]);const ee=v.useMemo(()=>({activeIndex:C,containerId:b,disabled:Q,disableTransforms:q,items:S,overIndex:N,useDragOverlay:w,sortedRects:g2(S,p),strategy:u}),[C,b,Q.draggable,Q.droppable,q,S,N,p,w,u]);return un.createElement(zb.Provider,{value:ee},a)}const b2=t=>{let{id:a,items:r,activeIndex:i,overIndex:u}=t;return gu(r,i,u).indexOf(a)},S2=t=>{let{containerId:a,isSorting:r,wasDragging:i,index:u,items:o,newIndex:h,previousItems:m,previousContainerId:p,transition:g}=t;return!g||!i||m!==o&&u===h?!1:r?!0:h!==u&&a===p},E2={duration:200,easing:"ease"},Ub="transform",w2=Or.Transition.toString({property:Ub,duration:0,easing:"linear"}),R2={roleDescription:"sortable"};function N2(t){let{disabled:a,index:r,node:i,rect:u}=t;const[o,h]=v.useState(null),m=v.useRef(r);return al(()=>{if(!a&&r!==m.current&&i.current){const p=u.current;if(p){const g=ui(i.current,{ignoreTransform:!0}),x={x:p.left-g.left,y:p.top-g.top,scaleX:p.width/g.width,scaleY:p.height/g.height};(x.x||x.y)&&h(x)}}r!==m.current&&(m.current=r)},[a,r,i,u]),v.useEffect(()=>{o&&h(null)},[o]),o}function T2(t){let{animateLayoutChanges:a=S2,attributes:r,disabled:i,data:u,getNewIndex:o=b2,id:h,strategy:m,resizeObserverConfig:p,transition:g=E2}=t;const{items:x,containerId:b,activeIndex:w,disabled:S,disableTransforms:R,sortedRects:C,overIndex:N,useDragOverlay:z,strategy:I}=v.useContext(zb),q=j2(i,S),Q=x.indexOf(h),ee=v.useMemo(()=>({sortable:{containerId:b,index:Q,items:x},...u}),[b,u,Q,x]),te=v.useMemo(()=>x.slice(x.indexOf(h)),[x,h]),{rect:D,node:j,isOver:re,setNodeRef:ue}=n2({id:h,data:ee,disabled:q.droppable,resizeObserverConfig:{updateMeasurementsFor:te,...p}}),{active:xe,activatorEvent:pe,activeNodeRect:Te,attributes:Ae,setNodeRef:Re,listeners:B,isDragging:V,over:de,setActivatorNodeRef:fe,transform:Ne}=WN({id:h,data:ee,attributes:{...R2,...r},disabled:q.draggable}),O=LR(ue,Re),X=!!xe,se=X&&!R&&ec(w)&&ec(N),ce=!z&&V,we=ce&&se?Ne:null,He=se?we??(m??I)({rects:C,activeNodeRect:Te,activeIndex:w,overIndex:N,index:Q}):null,it=ec(w)&&ec(N)?o({id:h,items:x,activeIndex:w,overIndex:N}):Q,Fe=xe==null?void 0:xe.id,et=v.useRef({activeId:Fe,items:x,newIndex:it,containerId:b}),en=x!==et.current.items,qt=a({active:xe,containerId:b,isDragging:V,isSorting:X,id:h,index:Q,items:x,newIndex:et.current.newIndex,previousItems:et.current.items,previousContainerId:et.current.containerId,transition:g,wasDragging:et.current.activeId!=null}),ut=N2({disabled:!qt,index:Q,node:j,rect:D});return v.useEffect(()=>{X&&et.current.newIndex!==it&&(et.current.newIndex=it),b!==et.current.containerId&&(et.current.containerId=b),x!==et.current.items&&(et.current.items=x)},[X,it,b,x]),v.useEffect(()=>{if(Fe===et.current.activeId)return;if(Fe!=null&&et.current.activeId==null){et.current.activeId=Fe;return}const Le=setTimeout(()=>{et.current.activeId=Fe},50);return()=>clearTimeout(Le)},[Fe]),{active:xe,activeIndex:w,attributes:Ae,data:ee,rect:D,index:Q,newIndex:it,items:x,isOver:re,isSorting:X,isDragging:V,listeners:B,node:j,overIndex:N,over:de,setNodeRef:O,setActivatorNodeRef:fe,setDroppableNodeRef:ue,setDraggableNodeRef:Re,transform:ut??He,transition:le()};function le(){if(ut||en&&et.current.newIndex===Q)return w2;if(!(ce&&!qc(pe)||!g)&&(X||qt))return Or.Transition.toString({...g,property:Ub})}}function j2(t,a){var r,i;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:a.draggable,droppable:(i=t==null?void 0:t.droppable)!=null?i:a.droppable}}Ct.Down,Ct.Right,Ct.Up,Ct.Left;const Fc=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],Gc=[{value:"draft",label:"Draft"},{value:"discovery",label:"Discovery"},{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],zu=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],ru=Fc.map(t=>t.value),su=Gc.map(t=>t.value),iu=zu.map(t=>t.value);function oh(t,a,r){if(t.includes(a)){const i=t.filter(u=>u!==a);return i.length===0?[...r]:i}return[...t,a]}function ch(t,a){return a.includes(t)}function gl(t,a){return`agent-plan:dashboard:${t}:${a}`}function dh(t,a,r){if(typeof window>"u")return a;try{const i=window.localStorage.getItem(t);if(!i)return a;const u=JSON.parse(i);if(!Array.isArray(u))return a;const o=`${t}-schema`,h=r.slice().sort().join(",");if(window.localStorage.getItem(o)!==h)return window.localStorage.setItem(o,h),a;const p=u.filter(g=>typeof g=="string"&&r.includes(g));return p.length>0?p:a}catch{return a}}function fh(t,a,r){typeof window>"u"||(window.localStorage.setItem(t,JSON.stringify(a)),window.localStorage.setItem(`${t}-schema`,r.slice().sort().join(",")))}function hh(t,a){if(typeof window>"u")return a;const r=window.localStorage.getItem(t);return r===null?a:r==="true"}const Iy={featureNumbers:null,phaseNumbers:null,taskNumbers:null,shortIds:null,status:null,featureStatus:null,phaseStatus:null,text:null},Qy=/^(feature-status|phase-status|feature|phase|task|id|status|title):(.*)$/i;function Hb(t){return t.split(",").map(a=>a.trim()).filter(a=>a.length>0)}function D2(t){return new Set(Hb(t).map(a=>Number(a)).filter(a=>Number.isFinite(a)&&a>0))}function Py(t){const a=t.toUpperCase();return a==="AND"||a==="OR"}function mh(t,a){const r=t??new Set;for(const i of D2(a))r.add(i);return r}function C2(t,a){const r=t??new Set;for(const i of Hb(a).map(u=>u.toUpperCase()))r.add(i);return r}function A2(t){const a=t.trim();if(!a)return{...Iy};const r={...Iy},i=[],u=[];let o=0;for(;o<a.length;){const m=a[o];if(m==='"'){const p=a.indexOf('"',o+1);if(p===-1){u.push(a.slice(o+1));break}u.push(a.slice(o+1,p)),o=p+1}else if(m===" ")o+=1;else{let p=o;for(;p<a.length&&a[p]!==" ";)p+=1;u.push(a.slice(o,p)),o=p}}let h=0;for(;h<u.length;){const m=u[h];if(Py(m)){h+=1;continue}const p=m.match(Qy);if(p){const g=(p[1]??"").toLowerCase();let x=p[2]??"";if(x.trim()===""&&h+1<u.length){let b=h+1;for(;b<u.length&&Py(u[b]);)b+=1;b<u.length&&!u[b].match(Qy)&&(x=u[b],h=b)}if(g==="feature"){const b=mh(r.featureNumbers,x);b.size&&(r.featureNumbers=b)}else if(g==="phase"){const b=mh(r.phaseNumbers,x);b.size&&(r.phaseNumbers=b)}else if(g==="task"){const b=mh(r.taskNumbers,x);b.size&&(r.taskNumbers=b)}else if(g==="id"){const b=C2(r.shortIds,x);b.size&&(r.shortIds=b)}else g==="status"?x.trim()&&(r.status=x.toLowerCase()):g==="feature-status"?x.trim()&&(r.featureStatus=x.toLowerCase()):g==="phase-status"?x.trim()&&(r.phaseStatus=x.toLowerCase()):g==="title"&&x.trim()&&(r.text=x.toLowerCase())}else i.push(m.toLowerCase());h+=1}return i.length>0&&!r.text&&(r.text=i.join(" ")),r}function O2(t){return!!(t.featureNumbers||t.phaseNumbers||t.taskNumbers||t.shortIds||t.status||t.featureStatus||t.phaseStatus||t.text)}function M2(t,a){if(t.featureNumbers&&!t.featureNumbers.has(a.feature.number)||t.phaseNumbers&&!t.phaseNumbers.has(a.phase.number)||t.taskNumbers&&!t.taskNumbers.has(a.task.number)||t.shortIds&&!(t.shortIds.has(a.task.shortId??"")||t.shortIds.has(a.phase.shortId??"")||t.shortIds.has(a.feature.shortId??""))||t.status&&a.task.status!==t.status||t.featureStatus&&a.feature.status!==t.featureStatus||t.phaseStatus&&a.phase.status!==t.phaseStatus)return!1;if(t.text){const r=t.text;if(![a.task.title,a.task.shortId??"",a.phase.title,a.phase.shortId??"",a.feature.name,a.feature.shortId??""].join(" ").toLowerCase().includes(r))return!1}return!0}function k2({features:t,phases:a,projectStorageScope:r}){const i=gl(r,"show-all-features"),u=gl(r,"tree-open-mode"),o=gl(r,"expanded-features"),h=gl(r,"expanded-phases"),m=gl(r,"feature-status-filters"),p=gl(r,"phase-status-filters"),g=gl(r,"task-status-filters"),x=gl(r,"hide-done"),b=gl(r,"hide-planned"),w=gl(r,"only-active-branches"),[S,R]=v.useState(""),C=v.useMemo(()=>kR(t,a),[t,a]),N=v.useMemo(()=>A2(S),[S]),z=O2(N),{matchedTaskIds:I,matchedFeatureIds:q,matchedPhaseIds:Q}=v.useMemo(()=>{const ye=new Set,Oe=new Set,ze=new Set;if(!z)return{matchedTaskIds:ye,matchedFeatureIds:Oe,matchedPhaseIds:ze};for(const Ge of C)for(const lt of Ge.allPhases)for(const At of lt.allTasks)M2(N,{feature:Ge.feature,phase:lt.phase,task:At})&&(ye.add(At.id),Oe.add(Ge.feature.id),ze.add(lt.phase.id));return{matchedTaskIds:ye,matchedFeatureIds:Oe,matchedPhaseIds:ze}},[z,N,C]),[ee,te]=v.useState(()=>{if(typeof window>"u")return!0;const ye=window.localStorage.getItem(i);return ye===null?!0:ye==="true"}),[D,j]=v.useState(()=>{if(typeof window>"u")return"all";const ye=window.localStorage.getItem(u);return ye==="smart"||ye==="none"||ye==="all"?ye:"all"}),[re,ue]=v.useState(()=>{if(typeof window>"u")return[];try{const ye=window.localStorage.getItem(o);return ye?JSON.parse(ye):[]}catch{return[]}}),[xe,pe]=v.useState(()=>{if(typeof window>"u")return[];try{const ye=window.localStorage.getItem(h);return ye?JSON.parse(ye):[]}catch{return[]}}),[Te,Ae]=v.useState(()=>dh(m,ru,ru)),[Re,B]=v.useState(()=>dh(p,su,su)),[V,de]=v.useState(()=>dh(g,iu,iu)),[fe,Ne]=v.useState(()=>hh(x,!1)),[O,X]=v.useState(()=>hh(b,!1)),[se,ce]=v.useState(()=>hh(w,!1)),[we,Se]=v.useState([]),[He,it]=v.useState([]),[Fe,et]=v.useState([]),en=v.useRef({});v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(i,String(ee))},[ee,i]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(u,D)},[D,u]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(o,JSON.stringify(re))},[re,o]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(h,JSON.stringify(xe))},[xe,h]),v.useEffect(()=>{typeof window>"u"||fh(m,Te,ru)},[Te,m]),v.useEffect(()=>{typeof window>"u"||fh(p,Re,su)},[Re,p]),v.useEffect(()=>{typeof window>"u"||fh(g,V,iu)},[V,g]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(x,String(fe))},[fe,x]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(b,String(O))},[O,b]),v.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(w,String(se))},[se,w]),v.useEffect(()=>()=>{Object.values(en.current).forEach(ye=>window.clearTimeout(ye)),en.current={}},[]);const qt=v.useMemo(()=>{let ye=[...Te];return fe&&(ye=ye.filter(Oe=>Oe!=="done")),O&&(ye=ye.filter(Oe=>Oe!=="planned")),ye},[Te,fe,O]),ut=v.useMemo(()=>{let ye=[...Re];return fe&&(ye=ye.filter(Oe=>Oe!=="done")),O&&(ye=ye.filter(Oe=>Oe!=="planned"&&Oe!=="draft")),ye},[Re,fe,O]),le=v.useMemo(()=>{let ye=[...V];return fe&&(ye=ye.filter(Oe=>Oe!=="done")),O&&(ye=ye.filter(Oe=>Oe!=="planned")),ye},[V,fe,O]),Le=v.useMemo(()=>{if(z)return C.map(ze=>({...ze,allPhases:ze.allPhases.map(Ge=>({...Ge,allTasks:Ge.allTasks.filter(lt=>I.has(lt.id))})).filter(Ge=>Ge.allTasks.length>0)})).filter(ze=>ze.allPhases.length>0);const ye=!ee||se;return(ee?C:C.filter(ze=>ze.isActive)).filter(({feature:ze})=>ch(ze.status,qt)).map(ze=>({...ze,allPhases:ze.allPhases.filter(({phase:Ge,hasActiveTask:lt})=>ch(Ge.status,ut)?ye?Ge.status==="in-progress"||Ge.status==="discovery"||lt:!0:!1).map(Ge=>({...Ge,allTasks:Ge.allTasks.filter(lt=>!!ch(lt.status,le))})).filter(Ge=>Ge.allTasks.length>0||ee||!ye)})).filter(({hasActiveTask:ze,allPhases:Ge})=>ye?ze||Ge.some(lt=>lt.hasActiveTask):Ge.length>0||ee)},[z,I,C,qt,ut,le,se,ee]);v.useEffect(()=>{if(D==="none"){ue([]),pe([]);return}if(D==="all"){ue(Le.filter(({feature:ze})=>ze.status!=="done").map(({feature:ze})=>ze.id)),pe(Le.flatMap(({allPhases:ze})=>ze.map(({phase:Ge})=>Ge.id)));return}const ye=new Set(Le.map(({feature:ze})=>ze.id)),Oe=new Set(Le.flatMap(({allPhases:ze})=>ze.map(({phase:Ge})=>Ge.id)));ue(ze=>ze.filter(Ge=>ye.has(Ge))),pe(ze=>ze.filter(Ge=>Oe.has(Ge)))},[Le,D]),v.useEffect(()=>{z&&(j("smart"),ue(Array.from(q)),pe(Array.from(Q)))},[z,q,Q]);const at=ye=>{j("smart"),ue(Oe=>Oe.includes(ye)?Oe.filter(ze=>ze!==ye):[...Oe,ye])},Xt=ye=>{j("smart"),pe(Oe=>Oe.includes(ye)?Oe.filter(ze=>ze!==ye):[...Oe,ye])},Cn=()=>{j("smart"),ue(Le.map(({feature:ye})=>ye.id)),pe(Le.flatMap(({allPhases:ye})=>ye.map(({phase:Oe})=>Oe.id)))};return v.useEffect(()=>{const ye=(ze,Ge)=>{const lt=Ge.filter(At=>!!At);for(const At of lt){const Ot=`${ze}:${At}`,tn=ze==="feature"?Se:ze==="phase"?it:et;tn(It=>It.includes(At)?It:[...It,At]),en.current[Ot]!==void 0&&window.clearTimeout(en.current[Ot]),en.current[Ot]=window.setTimeout(()=>{tn(It=>It.filter(ca=>ca!==At)),delete en.current[Ot]},CR)}},Oe=ze=>{var At,Ot,tn,It,ca,gn;const lt=ze.detail;if(lt!=null&&lt.type){if(lt.type==="features-updated"){const J=((At=lt.data)==null?void 0:At.featureId)??((Ot=lt.data)==null?void 0:Ot.id);ye("feature",[J]),J&&(j("smart"),ue(St=>St.includes(J)?St:[...St,J]));return}if(lt.type==="phases-updated"){const J=(tn=lt.data)==null?void 0:tn.featureId,St=((It=lt.data)==null?void 0:It.phaseId)??((ca=lt.data)==null?void 0:ca.id);ye("phase",[St]),ye("feature",[J]),ye("task",[(gn=lt.data)==null?void 0:gn.taskId]),j("smart"),J&&ue(Lt=>Lt.includes(J)?Lt:[...Lt,J]),St&&pe(Lt=>Lt.includes(St)?Lt:[...Lt,St])}}};return window.addEventListener("agent-plan:ws-event",Oe),()=>{window.removeEventListener("agent-plan:ws-event",Oe)}},[]),{workTree:C,displayedWorkTree:Le,treeOpenMode:D,setTreeOpenMode:j,expandAll:Cn,expandedFeatureIds:re,expandedPhaseIds:xe,toggleExpandedFeature:at,toggleExpandedPhase:Xt,recentFeatureIds:we,recentPhaseIds:He,recentTaskIds:Fe,showAllFeatures:ee,setShowAllFeatures:te,featureStatusFilters:Te,phaseStatusFilters:Re,taskStatusFilters:V,hideDone:fe,setHideDone:Ne,hidePlanned:O,setHidePlanned:X,onlyActiveBranches:se,setOnlyActiveBranches:ce,resetFilters:()=>{te(!0),Ne(!1),X(!1),Ae(ru),B(su),de(iu),ce(!1),j("all")},toggleFeatureStatusFilter:ye=>Ae(Oe=>oh(Oe,ye,ru)),togglePhaseStatusFilter:ye=>B(Oe=>oh(Oe,ye,su)),toggleTaskStatusFilter:ye=>de(Oe=>oh(Oe,ye,iu)),searchQuery:S,setSearchQuery:R,searchActive:z,matchedTaskIds:I,matchedFeatureIds:q,matchedPhaseIds:Q}}const Bb=v.createContext(null);function dm({id:t,children:a}){const r=T2({id:t}),i={transform:Or.Transform.toString(r.transform),transition:r.transition};return d.jsx(Bb.Provider,{value:r,children:d.jsx("div",{ref:r.setNodeRef,style:i,className:r.isDragging?"ap-sortable--dragging":"",children:a})})}function fm(){const t=v.useContext(Bb);return t?d.jsx("button",{type:"button",className:"drag-handle","aria-label":"Drag to reorder",title:"Drag to reorder",...t.listeners,...t.attributes,children:d.jsx(jw,{className:"h-4 w-4"})}):null}const hm="mt-1 block min-w-0 break-words font-mono text-sm font-semibold leading-snug [overflow-wrap:anywhere]";function _2(){return d.jsx("span",{className:"rounded-full bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--accent)]",children:"Updated"})}function ni({status:t,doneTasks:a,totalTasks:r,recentlyChanged:i,className:u}){const o=a!=null&&r!=null;return d.jsxs("div",{className:u,children:[i?d.jsx(_2,{}):null,o?d.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",a,"/",r||0,")"]}):null,d.jsx("span",{className:"shrink-0",children:d.jsx(Oa,{status:t})})]})}function L2({entry:t,expanded:a,recentlyChanged:r,onToggle:i,isPhaseExpanded:u,onTogglePhase:o,isPhaseRecentlyChanged:h,isTaskRecentlyChanged:m,highlightedTaskIds:p}){const{feature:g,totalTasks:x,doneTasks:b,allPhases:w,hasActiveTask:S}=t;return d.jsxs("div",{className:`surface-card min-w-0 px-3 py-3 transition-colors sm:px-4 ${S?"ap-in-progress":g.status==="in-progress"?"border-[color:var(--color-status-in-progress)]/40 bg-[color:color-mix(in_srgb,var(--color-status-in-progress)_7%,transparent)]":""} ${g.status==="done"?"!opacity-70 !bg-[color:color-mix(in_srgb,var(--color-status-done)_10%,transparent)] !border-[color:color-mix(in_srgb,var(--color-status-done)_35%,transparent)]":""} ${r?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[d.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 rounded-[12px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${r?"bg-[color:color-mix(in_srgb,var(--accent)_10%,transparent)]":""}`,children:[d.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[d.jsx("button",{type:"button",onClick:i,className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":a?`Collapse feature ${g.name}`:`Expand feature ${g.name}`,"aria-expanded":a,children:d.jsx(tb,{className:`h-4 w-4 transition ${a?"rotate-90":"rotate-0"}`})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fm,{}),d.jsx(Wl,{id:li({featureNum:g.number}),children:d.jsx(Jl,{featureNum:g.number})}),g.shortId?d.jsx(ri,{shortId:g.shortId}):null,S?d.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),d.jsx(ni,{status:g.status,doneTasks:b,totalTasks:x,recentlyChanged:r,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),d.jsx(wt,{to:`/features/${g.id}`,className:`entity-link--feature ${hm} underline-offset-4 hover:underline`,children:g.name})]})]}),d.jsx(ni,{status:g.status,doneTasks:b,totalTasks:x,recentlyChanged:r,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),a&&w.length>0?d.jsx("div",{className:"mt-2 ml-1.5 grid grid-cols-1 gap-2 border-l border-[var(--border)] pl-3 sm:ml-4 sm:pl-4",children:d.jsx(cm,{items:w.map(R=>R.phase.id),strategy:om,children:w.map(R=>d.jsx(dm,{id:R.phase.id,children:d.jsx(z2,{feature:g,phaseEntry:R,expanded:u(R.phase.id),recentlyChanged:h(R.phase.id),onToggle:()=>o(R.phase.id),isTaskRecentlyChanged:m,highlightedTaskIds:p})},R.phase.id))})}):null]})}function z2({feature:t,phaseEntry:a,expanded:r,recentlyChanged:i,onToggle:u,isTaskRecentlyChanged:o,highlightedTaskIds:h}){const{phase:m,totalTasks:p,doneTasks:g,allTasks:x,hasActiveTask:b}=a;return d.jsxs("div",{className:`work-tree-row grid min-w-0 grid-cols-1 gap-2 rounded-[12px] p-3 transition-colors ${b?"ap-in-progress":m.status==="in-progress"?"border border-[color:color-mix(in_srgb,var(--color-status-in-progress)_35%,transparent)] bg-[color:color-mix(in_srgb,var(--color-status-in-progress)_6%,transparent)]":""} ${m.status==="done"?"opacity-70 bg-[color:color-mix(in_srgb,var(--color-status-done)_6%,transparent)]":""} ${i?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[d.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${i?"bg-[color:color-mix(in_srgb,var(--accent)_8%,transparent)]":""}`,children:[d.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[d.jsx("button",{type:"button",onClick:u,className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":r?`Collapse phase ${m.title}`:`Expand phase ${m.title}`,"aria-expanded":r,children:d.jsx(tb,{className:`h-4 w-4 transition ${r?"rotate-90":"rotate-0"}`})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fm,{}),d.jsx(Wl,{id:li({featureNum:t==null?void 0:t.number,phaseNum:m.number}),children:d.jsx(Jl,{featureNum:t==null?void 0:t.number,phaseNum:m.number})}),m.shortId?d.jsx(ri,{shortId:m.shortId}):null,m.handoff?d.jsx(tm,{updatedAt:m.handoffUpdatedAt}):null,b?d.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),d.jsx(ni,{status:m.status,doneTasks:g,totalTasks:p,recentlyChanged:i,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),d.jsx(wt,{to:`/features/${t.id}/phases/${m.id}`,className:`entity-link--phase ${hm} underline-offset-4 hover:underline`,children:m.title})]})]}),d.jsx(ni,{status:m.status,doneTasks:g,totalTasks:p,recentlyChanged:i,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),r?x.length>0?d.jsx("div",{className:"ml-1.5 grid grid-cols-1 gap-1 border-l border-[var(--border)] pl-3 sm:ml-4 sm:pl-4",children:d.jsx(cm,{items:x.map(w=>w.id),strategy:om,children:x.map(w=>d.jsx(dm,{id:w.id,children:d.jsx(U2,{feature:t,phase:m,task:w,recentlyChanged:o(w.id),highlighted:h==null?void 0:h.has(w.id)})},w.id))})}):d.jsx("p",{className:"ml-1.5 text-xs italic text-[var(--text-subtle)] sm:ml-4",children:"No tasks"}):null]})}function U2({feature:t,phase:a,task:r,recentlyChanged:i,highlighted:u}){return d.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-2 py-2 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${r.status==="in-progress"?"ap-in-progress":""} ${r.status==="done"?"opacity-60 bg-[color:color-mix(in_srgb,var(--color-status-done)_6%,transparent)] text-[var(--text-muted)]":""} ${i?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""} ${u?"ap-search-hit":""}`,children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(fm,{}),d.jsx(Wl,{id:li({featureNum:t==null?void 0:t.number,phaseNum:a.number,taskNum:r.number}),children:d.jsx(Jl,{featureNum:t==null?void 0:t.number,phaseNum:a.number,taskNum:r.number})}),r.shortId?d.jsx(ri,{shortId:r.shortId}):null,r.status==="in-progress"?d.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),d.jsx(ni,{status:r.status,recentlyChanged:i,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),d.jsx(wt,{to:`/features/${t.id}/phases/${a.id}/tasks/${r.id}`,className:`entity-link--task ${hm} underline-offset-4 hover:underline`,children:r.title})]}),d.jsx(ni,{status:r.status,recentlyChanged:i,className:"hidden shrink-0 items-center gap-2 sm:flex"})]})}var k=(function(t){return t.FIELD_NAME="FIELD_NAME",t.COLON="COLON",t.VALUE="VALUE",t.QUOTED_VALUE="QUOTED_VALUE",t.AND="AND",t.OR="OR",t.NOT="NOT",t.COMPARISON_OP="COMPARISON_OP",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.SAVED_SEARCH="SAVED_SEARCH",t.HISTORY_REF="HISTORY_REF",t.PREFIX_OP="PREFIX_OP",t.WILDCARD="WILDCARD",t.REGEX="REGEX",t.RANGE="RANGE",t.TILDE="TILDE",t.BOOST="BOOST",t.WHITESPACE="WHITESPACE",t.UNKNOWN="UNKNOWN",t})({}),ra=(function(t){return t[t.EXPECT_TERM=0]="EXPECT_TERM",t[t.EXPECT_VALUE=1]="EXPECT_VALUE",t})(ra||{}),Ks=class{constructor(t,a){mn(this,"input");mn(this,"pos");mn(this,"state");mn(this,"tokens");mn(this,"options");this.input=t,this.pos=0,this.state=ra.EXPECT_TERM,this.tokens=[],this.options=a||{}}tokenize(){for(this.tokens=[],this.pos=0,this.state=ra.EXPECT_TERM;this.pos<this.input.length;)this.state===ra.EXPECT_VALUE?this.readValue():this.readTerm();return this.tokens}peek(){return this.input[this.pos]}peekAt(t){return this.input[this.pos+t]}advance(){return this.input[this.pos++]}isWhitespace(t){return t===" "||t===" "||t===`
198
198
  `||t==="\r"}isAlpha(t){return/[a-zA-Z_]/.test(t)}isAlphaNumeric(t){return/[a-zA-Z0-9_.\-]/.test(t)}readWhitespace(){const t=this.pos;for(;this.pos<this.input.length&&this.isWhitespace(this.peek());)this.advance();this.tokens.push({type:k.WHITESPACE,value:this.input.slice(t,this.pos),start:t,end:this.pos})}readQuotedString(){const t=this.pos,a=this.advance();for(;this.pos<this.input.length;){const r=this.advance();if(r==="\\"&&this.pos<this.input.length)this.advance();else if(r===a)break}this.tokens.push({type:k.QUOTED_VALUE,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.tryReadModifier(),this.state=ra.EXPECT_TERM}readTerm(){const t=this.peek();if(this.isWhitespace(t)){this.readWhitespace();return}if(t==='"'){this.readQuotedString();return}if(t==="("){this.tokens.push({type:k.LPAREN,value:"(",start:this.pos,end:this.pos+1}),this.advance();return}if(t===")"){this.tokens.push({type:k.RPAREN,value:")",start:this.pos,end:this.pos+1}),this.advance();return}if(t==="~"||t==="^"){const r=this.pos,i=t==="~"?k.TILDE:k.BOOST;for(this.advance();this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:i,value:this.input.slice(r,this.pos),start:r,end:this.pos});return}if(t==="["||t==="{"){this.readRangeValue();return}if(t==="#"&&this.options.savedSearches){this.readSavedSearch();return}if(t==="!"&&this.options.historySearch){this.readHistoryRef();return}if(t==="-"||t==="+"){const r=this.peekAt(1);if(r&&(this.isAlpha(r)||r==='"'||r==="("||r==="#"||r==="!"||r==="["||r==="{")||!r||r===")"||r===" "||r===" "||r===`
199
199
  `||r==="\r"){this.tokens.push({type:k.PREFIX_OP,value:t,start:this.pos,end:this.pos+1}),this.advance();return}}if(t==="&"&&this.peekAt(1)==="&"){this.tokens.push({type:k.AND,value:"&&",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if(t==="|"&&this.peekAt(1)==="|"){this.tokens.push({type:k.OR,value:"||",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if((t===">"||t==="<")&&this.state===ra.EXPECT_TERM){const r=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:k.COMPARISON_OP,value:this.input.slice(r,this.pos),start:r,end:this.pos}),this.state=ra.EXPECT_VALUE;return}if(t==="/"){this.readRegex();return}const a=this.pos;for(;this.pos<this.input.length&&!this.isWhitespace(this.peek())&&this.peek()!=="("&&this.peek()!==")"&&this.peek()!=='"'&&this.peek()!=="~"&&this.peek()!=="^"&&!(this.peek()==="&"&&this.peekAt(1)==="&")&&!(this.peek()==="|"&&this.peekAt(1)==="|");){if(this.peek()==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(this.peek()===":"){this.pos>a&&this.tokens.push({type:k.FIELD_NAME,value:this.input.slice(a,this.pos),start:a,end:this.pos}),this.tokens.push({type:k.COLON,value:":",start:this.pos,end:this.pos+1}),this.advance(),this.state=ra.EXPECT_VALUE;return}this.advance()}if(this.pos>a){const r=this.input.slice(a,this.pos),i=r.toUpperCase();i==="AND"?this.tokens.push({type:k.AND,value:r,start:a,end:this.pos}):i==="OR"?this.tokens.push({type:k.OR,value:r,start:a,end:this.pos}):i==="NOT"?this.tokens.push({type:k.NOT,value:r,start:a,end:this.pos}):r.includes("*")||r.includes("?")?this.tokens.push({type:k.WILDCARD,value:r,start:a,end:this.pos}):this.tokens.push({type:k.VALUE,value:r,start:a,end:this.pos}),this.tryReadModifier()}}readValue(){const t=this.peek();if(this.isWhitespace(t)){this.readWhitespace(),this.state=ra.EXPECT_TERM;return}if(t==='"'){this.readQuotedString(),this.state=ra.EXPECT_TERM;return}if(t==="("||t===")"){this.state=ra.EXPECT_TERM,this.readTerm();return}if(t===">"||t==="<"){const r=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:k.COMPARISON_OP,value:this.input.slice(r,this.pos),start:r,end:this.pos});return}if(t==="["||t==="{"){this.readRangeValue();return}if(t==="/"){this.readRegex(),this.state=ra.EXPECT_TERM;return}const a=this.pos;for(;this.pos<this.input.length&&!this.isWhitespace(this.peek())&&this.peek()!==")"&&this.peek()!=="("&&this.peek()!=='"'&&this.peek()!=="~"&&this.peek()!=="^";){if(this.peek()==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}this.advance()}if(this.pos>a){const r=this.input.slice(a,this.pos);r.includes("*")||r.includes("?")?this.tokens.push({type:k.WILDCARD,value:r,start:a,end:this.pos}):this.tokens.push({type:k.VALUE,value:r,start:a,end:this.pos}),this.tryReadModifier()}this.state=ra.EXPECT_TERM}readRangeValue(){const t=this.pos;for(this.advance();this.pos<this.input.length&&this.peek()!=="]"&&this.peek()!=="}";)this.advance();this.pos<this.input.length&&(this.peek()==="]"||this.peek()==="}")&&this.advance(),this.tokens.push({type:k.RANGE,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.state=ra.EXPECT_TERM}tryReadModifier(){for(;this.pos<this.input.length&&(this.peek()==="~"||this.peek()==="^");){const t=this.pos,a=this.advance()==="~"?k.TILDE:k.BOOST;for(;this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:a,value:this.input.slice(t,this.pos),start:t,end:this.pos})}}readRegex(){const t=this.pos;for(this.advance();this.pos<this.input.length;){const a=this.peek();if(a==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(a==="/"){this.advance(),this.tokens.push({type:k.REGEX,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.tryReadModifier(),this.state=ra.EXPECT_TERM;return}this.advance()}this.tokens.push({type:k.VALUE,value:this.input.slice(t,this.pos),start:t,end:this.pos}),this.state=ra.EXPECT_TERM}readSavedSearch(){const t=this.pos;for(this.advance();this.pos<this.input.length&&this.isAlphaNumeric(this.peek());)this.advance();this.tokens.push({type:k.SAVED_SEARCH,value:this.input.slice(t,this.pos),start:t,end:this.pos})}readHistoryRef(){const t=this.pos;for(this.advance();this.pos<this.input.length&&this.isAlphaNumeric(this.peek());)this.advance();this.tokens.push({type:k.HISTORY_REF,value:this.input.slice(t,this.pos),start:t,end:this.pos})}},ls=class{constructor(t){mn(this,"tokens");mn(this,"pos");mn(this,"nonWsTokens");mn(this,"errors",[]);this.tokens=t,this.nonWsTokens=t.filter(a=>a.type!==k.WHITESPACE),this.pos=0}getErrors(){return this.errors}isUnclosedQuote(t){if(t.type!==k.QUOTED_VALUE)return!1;const a=t.value;if(a.length<2)return!0;const r=a[0];return a[a.length-1]!==r}stripQuotes(t){const a=t.value;return this.isUnclosedQuote(t)?a.slice(1):a.slice(1,-1)}checkUnclosedQuote(t){this.isUnclosedQuote(t)&&this.errors.push({type:"Error",value:t.value[0],message:"Missing closing quote",start:t.start,end:t.start+1})}parse(){if(this.nonWsTokens.length===0)return null;let t=this.parseOr();for(;this.peek();){const a=this.peek();if(a.type===k.RPAREN)this.advance(),this.errors.push({type:"Error",value:a.value,message:"Unexpected closing parenthesis",start:a.start,end:a.end});else{const r=this.parseOr();t={type:"BooleanExpr",operator:"AND",left:t,right:r,implicit:!0,start:t.start,end:r.end}}}return t}peek(){return this.nonWsTokens[this.pos]}advance(){return this.nonWsTokens[this.pos++]}match(t){var a;if(((a=this.peek())==null?void 0:a.type)===t)return this.advance()}parseOr(){var a;let t=this.parseAnd();for(;((a=this.peek())==null?void 0:a.type)===k.OR;){const r=this.advance(),i=this.parseAnd();if(i.type==="Error"&&i.value===""){this.errors.push({type:"Error",value:r.value,message:"Missing search term after OR",start:r.start,end:r.end});break}t={type:"BooleanExpr",operator:"OR",left:t,right:i,sourceOperator:r.value,start:t.start,end:i.end}}return t}parseAnd(){let t=this.parseNot();for(;;){const a=this.peek();if(!a)break;if(a.type===k.AND){const r=this.advance(),i=this.parseNot();if(i.type==="Error"&&i.value===""){this.errors.push({type:"Error",value:r.value,message:"Missing search term after AND",start:r.start,end:r.end});break}t={type:"BooleanExpr",operator:"AND",left:t,right:i,sourceOperator:r.value,start:t.start,end:i.end}}else{if(a.type===k.OR||a.type===k.RPAREN)break;{const r=this.parseNot();t={type:"BooleanExpr",operator:"AND",left:t,right:r,implicit:!0,start:t.start,end:r.end}}}}return t}parseNot(){var t;if(((t=this.peek())==null?void 0:t.type)===k.NOT){const a=this.advance(),r=this.parsePrimary();return r.type==="Error"&&r.value===""?(this.errors.push({type:"Error",value:a.value,message:"Missing search term after NOT",start:a.start,end:a.end}),r):{type:"Not",expression:r,sourceOperator:a.value,start:a.start,end:r.end}}return this.parsePrimary()}applyGroupBoost(t){var a;if(((a=this.peek())==null?void 0:a.type)===k.BOOST){const r=this.advance(),i=r.value.slice(1),u=parseFloat(i);t.boost=isNaN(u)?1:u,t.end=r.end}return t}applyModifiers(t){var a,r;if(t.type!=="BareTerm"&&t.type!=="FieldValue")return t;if(((a=this.peek())==null?void 0:a.type)===k.TILDE){const i=this.advance(),u=i.value.slice(1),o=parseInt(u,10);t.quoted?t.proximity=isNaN(o)?0:o:t.fuzzy=isNaN(o)?0:o,t.end=i.end}if(((r=this.peek())==null?void 0:r.type)===k.BOOST){const i=this.advance(),u=i.value.slice(1),o=parseFloat(u);t.boost=isNaN(o)?1:o,t.end=i.end}return t}parseRangeBound(t,a){const r=t.length-t.trimStart().length,i=t.trim();return i.startsWith('"')&&i.endsWith('"')&&i.length>=2?{value:i.slice(1,-1),quoted:!0,valueStart:a+r,valueEnd:a+r+i.length}:i.startsWith('"')?{value:i.slice(1),quoted:!0,valueStart:a+r,valueEnd:a+r+i.length}:{value:i,quoted:!1,valueStart:a+r,valueEnd:a+r+i.length}}parseRange(t){const a=t.value,r=a[0],i=r==="[",u=a[a.length-1],o=u==="]"||u==="}",h=u==="]";o||this.errors.push({type:"Error",value:r,message:"Unclosed range expression",start:t.start,end:t.start+1});const m=o?a.slice(1,-1):a.slice(1),p=m.match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/),g=t.start+1;if(!p){this.errors.push({type:"Error",value:a,message:"Range expression missing TO keyword",start:t.start,end:t.end});const S=this.parseRangeBound(m,g);return{type:"Range",lower:S.value,upper:"",lowerInclusive:i,upperInclusive:o?h:!0,lowerQuoted:S.quoted,upperQuoted:!1,lowerStart:S.valueStart,lowerEnd:S.valueEnd,upperStart:t.end,upperEnd:t.end,start:t.start,end:t.end}}const x=this.parseRangeBound(p[1],g),b=g+p[1].length+(m.length-p[1].length-p[2].length),w=this.parseRangeBound(p[2],b);return{type:"Range",lower:x.value,upper:w.value,lowerInclusive:i,upperInclusive:o?h:!0,lowerQuoted:x.quoted,upperQuoted:w.quoted,lowerStart:x.valueStart,lowerEnd:x.valueEnd,upperStart:w.valueStart,upperEnd:w.valueEnd,start:t.start,end:t.end}}parsePrimary(){var r,i,u;const t=this.peek();if(!t)return{type:"Error",value:"",message:"Unexpected end of input",start:this.nonWsTokens.length>0?this.nonWsTokens[this.nonWsTokens.length-1].end:0,end:this.nonWsTokens.length>0?this.nonWsTokens[this.nonWsTokens.length-1].end:0};if(t.type===k.AND){const o=this.advance();return this.errors.push({type:"Error",value:o.value,message:"Unexpected AND",start:o.start,end:o.end}),this.parsePrimary()}if(t.type===k.OR){const o=this.advance();return this.errors.push({type:"Error",value:o.value,message:"Unexpected OR",start:o.start,end:o.end}),this.parsePrimary()}if(t.type===k.PREFIX_OP){const o=this.advance(),h=this.parsePrimary();return o.value==="-"?{type:"Not",expression:h,sourceOperator:o.value,start:o.start,end:h.end}:{...h,start:o.start}}if(t.type===k.LPAREN){const o=this.advance();if(!this.peek()||this.peek().type===k.RPAREN){const g=this.match(k.RPAREN);g||this.errors.push({type:"Error",value:o.value,message:"Unclosed parenthesis",start:o.start,end:o.end});const x={type:"Group",expression:{type:"BareTerm",value:"",quoted:!1,start:o.end,end:o.end},start:o.start,end:g?g.end:o.end};return this.applyGroupBoost(x)}const h=this.parseOr(),m=this.match(k.RPAREN);m||this.errors.push({type:"Error",value:o.value,message:"Missing closing parenthesis",start:o.start,end:o.end});const p={type:"Group",expression:h,start:o.start,end:m?m.end:h.end};return this.applyGroupBoost(p)}if(t.type===k.SAVED_SEARCH){const o=this.advance();return{type:"SavedSearch",name:o.value.slice(1),start:o.start,end:o.end}}if(t.type===k.HISTORY_REF){const o=this.advance();return{type:"HistoryRef",ref:o.value.slice(1),start:o.start,end:o.end}}if(t.type===k.FIELD_NAME){const o=this.advance(),h=this.match(k.COLON);if(h){let m=":";const p=this.match(k.COMPARISON_OP);if(p&&(m=p.value),((r=this.peek())==null?void 0:r.type)===k.LPAREN){const x=this.advance();if(!this.peek()||this.peek().type===k.RPAREN){const R=this.match(k.RPAREN);R||this.errors.push({type:"Error",value:x.value,message:"Unclosed parenthesis",start:x.start,end:x.end});const C={type:"FieldGroup",field:o.value,expression:{type:"BareTerm",value:"",quoted:!1,start:x.end,end:x.end},start:o.start,end:R?R.end:x.end};return this.applyGroupBoost(C)}const b=this.parseOr(),w=this.match(k.RPAREN);w||this.errors.push({type:"Error",value:x.value,message:"Missing closing parenthesis",start:x.start,end:x.end});const S={type:"FieldGroup",field:o.value,expression:b,start:o.start,end:w?w.end:b.end};return this.applyGroupBoost(S)}if(((i=this.peek())==null?void 0:i.type)===k.RANGE){const x=this.advance(),b=this.parseRange(x);return b.field=o.value,b.start=o.start,b}if(((u=this.peek())==null?void 0:u.type)===k.REGEX){const x=this.advance();return{type:"Regex",pattern:x.value.slice(1,-1),start:o.start,end:x.end}}const g=this.peek();if(g&&(g.type===k.VALUE||g.type===k.QUOTED_VALUE||g.type===k.WILDCARD)){const x=this.advance(),b=x.type===k.QUOTED_VALUE;b&&this.checkUnclosedQuote(x);const w=b?this.stripQuotes(x):x.value;return this.applyModifiers({type:"FieldValue",field:o.value,operator:m,value:w,quoted:b,start:o.start,end:x.end})}return{type:"FieldValue",field:o.value,operator:m,value:"",quoted:!1,start:o.start,end:p?p.end:h.end}}return{type:"BareTerm",value:o.value,quoted:!1,start:o.start,end:o.end}}if(t.type===k.COMPARISON_OP){const o=this.advance(),h=this.peek();if(h&&(h.type===k.VALUE||h.type===k.QUOTED_VALUE)){const m=this.advance();return{type:"BareTerm",value:o.value+m.value,quoted:!1,start:o.start,end:m.end}}return{type:"Error",value:o.value,message:"Comparison operator without value",start:o.start,end:o.end}}if(t.type===k.QUOTED_VALUE){const o=this.advance();return this.checkUnclosedQuote(o),this.applyModifiers({type:"BareTerm",value:this.stripQuotes(o),quoted:!0,start:o.start,end:o.end})}if(t.type===k.WILDCARD){const o=this.advance();return this.applyModifiers({type:"BareTerm",value:o.value,quoted:!1,start:o.start,end:o.end})}if(t.type===k.RANGE){const o=this.advance();return this.parseRange(o)}if(t.type===k.REGEX){const o=this.advance();return{type:"Regex",pattern:o.value.slice(1,-1),start:o.start,end:o.end}}if(t.type===k.VALUE){const o=this.advance();return this.applyModifiers({type:"BareTerm",value:o.value,quoted:!1,start:o.start,end:o.end})}if(t.type===k.RPAREN){const o=this.advance();return this.errors.push({type:"Error",value:o.value,message:"Unexpected closing parenthesis",start:o.start,end:o.end}),{type:"Error",value:o.value,message:"Unexpected closing parenthesis",start:o.start,end:o.end}}const a=this.advance();return{type:"Error",value:a.value,message:`Unexpected token: ${a.value}`,start:a.start,end:a.end}}static getCursorContext(t,a){let r,i;for(const o of t)if(o.type!==k.WHITESPACE){if(a>=o.start&&a<=o.end){r=o;break}o.end<=a&&(i=o)}const u=o=>{let h=0;for(let m=o;m>=0;m--){const p=t[m];if(p.type!==k.WHITESPACE){if(p.type===k.RPAREN){h++;continue}if(p.type===k.LPAREN){if(h>0){h--;continue}for(let g=m-1;g>=0;g--)if(t[g].type!==k.WHITESPACE){if(t[g].type===k.COLON){for(let x=g-1;x>=0;x--)if(t[x].type!==k.WHITESPACE){if(t[x].type===k.FIELD_NAME)return t[x].value;break}}break}}}}return""};if((r==null?void 0:r.type)===k.COLON){let o="";const h=t.indexOf(r);for(let m=h-1;m>=0;m--){if(t[m].type===k.FIELD_NAME){o=t[m].value;break}if(t[m].type!==k.WHITESPACE)break}if(!o&&a===r.start)return{type:"FIELD_NAME",partial:"",token:r};if(a===r.end){for(let m=h+1;m<t.length;m++)if(t[m].type!==k.WHITESPACE){if(t[m].type===k.VALUE||t[m].type===k.QUOTED_VALUE||t[m].type===k.WILDCARD||t[m].type===k.RANGE)return{type:"FIELD_VALUE",partial:t[m].type===k.QUOTED_VALUE?t[m].value.slice(1,t[m].value.endsWith('"')||t[m].value.endsWith("'")?-1:void 0):t[m].value,fieldName:o,token:t[m]};break}}return{type:"FIELD_VALUE",partial:"",fieldName:o,token:void 0}}if((r==null?void 0:r.type)===k.SAVED_SEARCH)return{type:"SAVED_SEARCH",partial:r.value.slice(1),token:r};if((r==null?void 0:r.type)===k.HISTORY_REF)return{type:"HISTORY_REF",partial:r.value.slice(1),token:r};if((r==null?void 0:r.type)===k.RANGE){const o=t.indexOf(r);let h="";for(let m=o-1;m>=0;m--){if(t[m].type===k.FIELD_NAME){h=t[m].value;break}if(!(t[m].type===k.WHITESPACE||t[m].type===k.COLON))break}return{type:"RANGE",partial:"",fieldName:h,token:r}}if((i==null?void 0:i.type)===k.COLON||(i==null?void 0:i.type)===k.COMPARISON_OP){const o=t.indexOf(i);let h="";for(let m=o-1;m>=0;m--){if(t[m].type===k.FIELD_NAME){h=t[m].value;break}if(!(t[m].type===k.WHITESPACE||t[m].type===k.COLON||t[m].type===k.COMPARISON_OP))break}return r&&(r.type===k.VALUE||r.type===k.QUOTED_VALUE||r.type===k.WILDCARD)?{type:"FIELD_VALUE",partial:r.type===k.QUOTED_VALUE?r.value.slice(1,r.value.endsWith('"')||r.value.endsWith("'")?-1:void 0):r.value,fieldName:h,token:r}:{type:"FIELD_VALUE",partial:"",fieldName:h,token:i}}if((r==null?void 0:r.type)===k.VALUE||(r==null?void 0:r.type)===k.QUOTED_VALUE||(r==null?void 0:r.type)===k.WILDCARD){const o=t.indexOf(r);for(let h=o-1;h>=0;h--)if(t[h].type!==k.WHITESPACE){if(t[h].type===k.COLON||t[h].type===k.COMPARISON_OP){let m="";for(let p=h-1;p>=0;p--){if(t[p].type===k.FIELD_NAME){m=t[p].value;break}if(!(t[p].type===k.WHITESPACE||t[p].type===k.COLON||t[p].type===k.COMPARISON_OP))break}return{type:"FIELD_VALUE",partial:r.type===k.QUOTED_VALUE?r.value.slice(1,r.value.endsWith('"')||r.value.endsWith("'")?-1:void 0):r.value,fieldName:m,token:r}}break}}if((r==null?void 0:r.type)===k.QUOTED_VALUE)return{type:"FIELD_NAME",partial:r.value,token:r};if((r==null?void 0:r.type)===k.FIELD_NAME||(r==null?void 0:r.type)===k.VALUE){const o=u(t.indexOf(r));return o?{type:"FIELD_VALUE",partial:r.value,fieldName:o,token:r}:{type:"FIELD_NAME",partial:r.value,token:r}}if((i==null?void 0:i.type)===k.PREFIX_OP){const o=u(t.indexOf(i));return o?{type:"FIELD_VALUE",partial:"",fieldName:o,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(i&&(i.type===k.AND||i.type===k.OR||i.type===k.NOT)){const o=u(t.indexOf(i));return o?{type:"FIELD_VALUE",partial:"",fieldName:o,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(t.length===0||t.every(o=>o.type===k.WHITESPACE))return{type:"EMPTY",partial:""};if((r==null?void 0:r.type)===k.LPAREN||(i==null?void 0:i.type)===k.LPAREN){const o=(r==null?void 0:r.type)===k.LPAREN?r:i,h=u(t.indexOf(o));return h?{type:"FIELD_VALUE",partial:"",fieldName:h,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if((r==null?void 0:r.type)===k.TILDE||(r==null?void 0:r.type)===k.BOOST)return{type:"OPERATOR",partial:""};if(i&&(i.type===k.VALUE||i.type===k.QUOTED_VALUE||i.type===k.RPAREN||i.type===k.RANGE||i.type===k.TILDE||i.type===k.BOOST)){const o=u(t.indexOf(i));return o?{type:"FIELD_VALUE",partial:"",fieldName:o,token:void 0}:{type:"OPERATOR",partial:""}}return{type:"FIELD_NAME",partial:"",token:void 0}}};function Mh(t,a){if(a<t.start||a>t.end)return null;if(t.type==="BooleanExpr"){const r=Mh(t.left,a);if(r)return r;const i=Mh(t.right,a);return i||null}return t}function H2(t,a,r){if(!t)return null;const i=Mh(t,r);if(!i)return null;let u=i.start,o=i.end;const h=a.slice(o).match(/^(\s+(?:AND|OR|&&|\|\|)\s+|\s+)(?=\S)/i);if(h)return o+=h[0].length,{start:u,end:o};const m=a.slice(0,u).match(/(\s+(?:AND|OR|&&|\|\|)\s+|\s+)$/i);return m&&m.index!==void 0&&m.index>0&&(u-=m[0].length),{start:u,end:o}}var B2={fieldName:"#0550ae",fieldValue:"#1a7f37",operator:"#cf222e",booleanOp:"#8250df",quoted:"#0a3069",paren:"#656d76",savedSearch:"#bf8700",historyRef:"#6639ba",wildcard:"#953800",error:"#cf222e",background:"#ffffff",text:"#1f2328",placeholder:"#656d76",cursor:"#1f2328",dropdownSelected:"#0969da",dropdownHover:"#f6f8fa",regexDelimiter:"#cf222e",regexCharClass:"#0550ae",regexGroup:"#656d76",regexEscape:"#953800",regexQuantifier:"#8250df",regexAnchor:"#cf222e",regexAlternation:"#8250df",regexText:"#0a3069",matchedParenBg:"#fff3cd",warning:"#d4a72c",valueTypes:{}},$2={fontFamily:"'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace",fontSize:"14px",lineHeight:"1.5",inputMinHeight:"40px",inputPadding:"8px 12px",inputBorderWidth:"2px",inputBorderColor:"#d0d7de",inputBorderRadius:"8px",inputFocusBorderColor:"#0969da",inputFocusShadow:"0 0 0 3px rgba(9, 105, 218, 0.3)",dropdownBorderColor:"#d0d7de",dropdownBorderRadius:"8px",dropdownShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",dropdownMaxHeight:"300px",dropdownMinWidth:"200px",dropdownMaxWidth:"400px",dropdownZIndex:99999,dropdownItemPadding:"6px 12px",dropdownItemFontSize:"13px",dropdownItemContentGap:"8px",typeBadgeBg:"#eef1f5",typeBadgeSelectedBg:"rgba(255,255,255,0.2)",typeBadgeColor:"#656d76",typeBadgeSelectedColor:"#ffffff"},q2=["AND","OR","NOT"];function Ky(t){return t.replace(/\r\n/g,`
200
200
  `).replace(/\r/g,`
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Agent Plan</title>
7
- <script type="module" crossorigin src="/assets/index-CZ27vQH6.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-BQmx1zqk.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Jy8Yy6I4.css">
9
9
  </head>
10
10
  <body>