cohorte 2.7.0 → 2.8.0

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.
@@ -30,18 +30,19 @@ export const meta = {
30
30
  const MIN_ITEMS = 5
31
31
 
32
32
  // The Workflow runtime hands `args` to a script verbatim, so a caller that passes a
33
- // JSON-ENCODED STRING instead of a real object gets that string back here. The old
34
- // `typeof args === 'string' ? args.trim()` then took the whole blob as the value — which
35
- // is how a report landed on disk named `specs/reports/{"feature": "x"}.md`, and how
36
- // maxRounds/smoke were silently dropped on the same run. Parse it back into the object
37
- // it was meant to be; a bare slug stays valid shorthand.
33
+ // JSON-ENCODED STRING instead of a real object gets that string back here. Parse it
34
+ // back into the object it was meant to be. A bare slug is shorthand for the DOMAIN in
35
+ // this script mapping it to {feature, target} (review.js's keys, once copy-pasted
36
+ // here) left ARGS.domains undefined, which fell through to 'all': the shorthand
37
+ // "backend" dispatched code-editing implementers on EVERY big domain, not the one
38
+ // the caller named.
38
39
  const ARGS = (() => {
39
40
  if (typeof args === 'string') {
40
41
  const t = args.trim()
41
42
  if (t.startsWith('{')) {
42
43
  try { const o = JSON.parse(t); if (o && typeof o === 'object' && !Array.isArray(o)) return o } catch {}
43
44
  }
44
- return { feature: t, target: t }
45
+ return { domains: [t] }
45
46
  }
46
47
  return args && typeof args === 'object' ? args : {}
47
48
  })()
@@ -187,19 +188,31 @@ const verifyDomain = async (d, implHandoff) => {
187
188
  { model: 'haiku', label: `verify:${d.key}`, phase: 'Verify', schema: VERIFY, effort: 'low' },
188
189
  )
189
190
  // One bounded retry: re-dispatch the implementer on what verification rejected.
191
+ // The re-verify covers ONLY the retried items, so round 1's cleared list is carried
192
+ // forward — overwriting it un-ticked every item the first pass verified, and the
193
+ // next /cohorte-refactor re-dispatched finished work.
190
194
  if (v && (v.remaining.length || !v.gatesGreen) && byKey[d.key]) {
191
- const retryItems = v.remaining.length ? v.remaining : d.items
195
+ const cleared1 = v.cleared || []
196
+ // Never retry items round 1 already verified cleared: on a gates-red round with
197
+ // nothing remaining, retrying ALL items put the same lines in both `cleared` and
198
+ // `remaining` when the re-verifier died — ticked off the backlog AND reported open.
199
+ const retryItems = v.remaining.length ? v.remaining : d.items.filter(i => !cleared1.includes(i))
192
200
  log(`${d.key}: ${v.remaining.length} item(s) remaining${v.gatesGreen ? '' : ' + red gates'} — one retry round`)
193
201
  await agent(
194
202
  implementPrompt({ key: d.key, items: retryItems }) + (v.failures ? `\nGate failures to clear too:\n${v.failures}` : ''),
195
203
  { agentType: byKey[d.key].agent, label: `retry:${d.key}`, phase: 'Refactor' },
196
204
  )
197
- v = await agent(
205
+ const v2 = await agent(
198
206
  `Re-verify domain ${d.key} after a retry round — same procedure as before (gates redirected to ` +
199
207
  `specs/reports/refactor-verify.${d.key}.txt, per-item file:line check, verbatim cleared/remaining lines).\n` +
200
208
  'Items:\n' + retryItems.join('\n'),
201
209
  { model: 'haiku', label: `reverify:${d.key}`, phase: 'Verify', schema: VERIFY, effort: 'low' },
202
210
  )
211
+ // A dead re-verifier loses only the RETRY round's claim — round 1's verified
212
+ // clears stay cleared; the retried items stay open (unverified ≠ cleared).
213
+ v = v2
214
+ ? { ...v2, cleared: [...new Set(cleared1.concat(v2.cleared || []))] }
215
+ : { cleared: cleared1, remaining: retryItems, gatesGreen: false, failures: 'verifier died on the retry round' }
203
216
  }
204
217
  return { key: d.key, ...(v || { cleared: [], remaining: d.items, gatesGreen: false, failures: 'verifier died' }) }
205
218
  }
@@ -174,7 +174,7 @@ const profile = unwrapProfile(await agent(
174
174
  { agentType: 'profile-reader', label: 'profile', schema: PROFILE, effort: 'low' },
175
175
  ))
176
176
  if (!profile || profile.error) {
177
- return { verdict: 'ABORTED', reason: `profile unreadable: ${(profile && profile.error) || 'profile-reader returned nothing'}` }
177
+ return { verdict: 'ABORTED', aborted: 'profile', reason: `profile unreadable: ${(profile && profile.error) || 'profile-reader returned nothing'}` }
178
178
  }
179
179
  const cmds = profile.commands || {}
180
180
  const base = (profile.vcs && profile.vcs.default_branch) || 'main'
@@ -183,7 +183,7 @@ const surfaces = Array.isArray(profile.surfaces) ? profile.surfaces : []
183
183
  // guard compares against `surfaces` — an empty list makes them all vacuously
184
184
  // pass. Fail loudly here instead of finishing with nothing done.
185
185
  if (!surfaces.length) {
186
- return { verdict: 'ABORTED', reason: 'profile has no surfaces — nothing would be reviewed. the `yaml pipeline-profile` block in PIPELINE.md is empty or unparseable, or the profile-reader mis-returned; run /cohorte-doctor' }
186
+ return { verdict: 'ABORTED', aborted: 'profile', reason: 'profile has no surfaces — nothing would be reviewed. the `yaml pipeline-profile` block in PIPELINE.md is empty or unparseable, or the profile-reader mis-returned; run /cohorte-doctor' }
187
187
  }
188
188
  const quiet = (q, full) => (q && !String(q).startsWith('<') ? q : full ? `${full} 2>&1 | tail -40` : '')
189
189
  const checks = [cmds.typecheck, quiet(cmds.lint_quiet, cmds.lint), quiet(cmds.test_quiet, cmds.test)]
@@ -197,12 +197,16 @@ const pre = await agent(
197
197
  checks.map(c => JSON.stringify(c)).join(' ') + '\n' +
198
198
  '(<core> = .claude if .claude/pipeline/scripts/preflight.sh exists, else ~/.claude — probe with test -x. ' +
199
199
  'Script absent on both: run the quoted commands yourself, each appended to the same report file, stopping at the first failure.) ' +
200
- 'Return pass=true only on a fully green run. On failure set pass=false and put the raw last 40 lines of the report in `tail` — verbatim, no summarizing.',
200
+ 'Return pass=true only on a fully green run. On failure set pass=false, put the raw last 40 lines of the report ' +
201
+ 'in `tail` — verbatim, no summarizing — and in the same Bash call write the degraded machine verdict the ' +
202
+ `conversational /cohorte-review §0 writes, so an automated driver gets a diagnosis rather than silence: ` +
203
+ `printf '{"id":"${feature}","phase":"review","ts":"%s","aborted":"preflight","verdict":"BLOCK","blocking":null}' ` +
204
+ `"$(date -u +%Y-%m-%dT%H:%M:%SZ)" > specs/reports/${feature}.verdict.json`,
201
205
  { model: 'haiku', label: 'preflight', schema: PREFLIGHT, effort: 'low' },
202
206
  )
203
207
  if (!pre || !pre.pass) {
204
208
  return {
205
- verdict: 'ABORTED',
209
+ verdict: 'ABORTED', aborted: 'preflight',
206
210
  reason: 'preflight red — fix the mechanical failures (or run /cohorte-fix) before any review; no reviewer was spawned',
207
211
  failures: (pre && pre.tail) || 'preflight agent returned nothing',
208
212
  }
@@ -224,13 +228,34 @@ const staged = await agent(
224
228
  // feature nobody had looked at. Distinguish them.
225
229
  if (!staged) {
226
230
  return {
227
- verdict: 'ABORTED',
231
+ verdict: 'ABORTED', aborted: 'stage-diff',
228
232
  reason: 'the diff-staging agent died — no reviewer was spawned and nothing was reviewed',
229
233
  next: `re-run the review workflow, or /cohorte-review ${feature} conversationally`,
230
234
  }
231
235
  }
232
236
  const touched = staged.surfaces || []
233
- if (!touched.length) return { verdict: 'SHIP', reason: `no diff against ${base} — nothing to review`, findings: 0 }
237
+ if (!touched.length) {
238
+ // Nothing was reviewed, so nothing was certified: no DoD tick, no freshness stamp.
239
+ // `next` must say so — a driver relaying a bare "/cohorte-ship" here would point at
240
+ // a gate that (rightly) refuses. And verdict.json is written on EVERY run
241
+ // (cohorte-review.md §3) — leaving last round's REVISE on disk here would hand any
242
+ // driver reading the file a stale verdict.
243
+ await agent(
244
+ `Write EXACTLY this to specs/reports/${feature}.verdict.json (overwrite), substituting <ISO now> ` +
245
+ 'with `date -u +%Y-%m-%dT%H:%M:%SZ`, then return the single word done:\n' +
246
+ JSON.stringify({
247
+ id: feature, phase: 'review', ts: '<ISO now>', verdict: 'SHIP', findings: 0, blocking: 0,
248
+ security: 0, deferred: 0, unreviewed: [], severity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 },
249
+ surfaces: {}, blocking_items: [], fingerprint: '',
250
+ }),
251
+ { model: 'haiku', label: 'stage-verdict', effort: 'low' },
252
+ )
253
+ return {
254
+ verdict: 'SHIP', reason: `no diff against ${base} — nothing to review`,
255
+ findings: 0, blocking: 0, blockingItems: [], deferred: 0, unreviewedSurfaces: [],
256
+ next: `nothing to ship: the diff against ${base} is empty, so no review ran and no freshness stamp was written — check the branch/base (was the feature actually built here?)`,
257
+ }
258
+ }
234
259
  log(`Touched surfaces: ${touched.map(s => s.key).join(', ')}`)
235
260
 
236
261
  // ── Phases 3+4 — review each surface, cross-check its hard findings ─────────
@@ -287,6 +312,17 @@ const refuted = results.flatMap(r => r.refuted.map(f => ({ ...f, surface: r.key
287
312
  const deferredAll = results.flatMap(r => (r.deferred || []).map(f => ({ ...f, surface: r.key })))
288
313
  const counts = { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0 }
289
314
  for (const f of kept) counts[f.severity] = (counts[f.severity] || 0) + 1
315
+ // blocking = CRITICAL + security findings, each counted once — the conversational
316
+ // /cohorte-review §3's contract restated as a number, so blocking == 0 ⟺ verdict SHIP.
317
+ // blocking_items carry the finding's IDENTITY, not its wording: surface | file without
318
+ // `:line` (a fix that inserts lines shifts every line below it — a line-bearing identity
319
+ // would change every pass and drift detection would never fire) | the problem's first 8
320
+ // words, lowercased, runs of non-alphanumerics collapsed. Sorted, so two rounds with the
321
+ // same findings compare equal however the reviewers ordered them.
322
+ const blockingFindings = kept.filter(f => f.severity === 'CRITICAL' || f.kind === 'security')
323
+ const normProblem = p => String(p).toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim().split(' ').slice(0, 8).join(' ')
324
+ const blockingItems = [...new Set(blockingFindings.map(f =>
325
+ `${f.surface}|${String(f.file).replace(/:\d+$/, '')}|${normProblem(f.problem)}`))].sort()
290
326
  // Verdict from the findings that SURVIVED the cross-check (a refuted CRITICAL
291
327
  // must not force a fix loop): security ⇒ BLOCK, CRITICAL ⇒ REVISE, else SHIP —
292
328
  // but never SHIP while a surface went unreviewed (absence of evidence, not
@@ -318,15 +354,46 @@ const reportBody = [
318
354
  ...(refuted.length ? ['', '## Refuted by cross-check (no action needed)', '',
319
355
  refuted.map(f => `- ${f.file}:${f.line} · ${f.problem} — refuted: ${f.reason}`).join('\n')] : []),
320
356
  ].join('\n')
357
+ // The machine-readable verdict the conversational /cohorte-review §3 guarantees — the
358
+ // ONLY contract between the pipeline and an automated driver (the loop workflow), which
359
+ // parses no prose. Composed HERE so the staging agent substitutes two tokens and can
360
+ // invent nothing; the sha256 fingerprint is computed in its Bash (scripts have no crypto).
361
+ const verdictJson = JSON.stringify({
362
+ id: feature, phase: 'review', ts: '<ISO now>', verdict,
363
+ findings: kept.length, blocking: blockingFindings.length,
364
+ security: kept.filter(f => f.kind === 'security').length,
365
+ deferred: deferredAll.length, unreviewed,
366
+ severity: counts,
367
+ surfaces: Object.fromEntries(results.map(r => [r.key, {
368
+ verdict: r.report.verdict, findings: r.kept.length,
369
+ blocking: r.kept.filter(f => f.severity === 'CRITICAL' || f.kind === 'security').length,
370
+ }])),
371
+ blocking_items: blockingItems, fingerprint: '<FP>',
372
+ })
321
373
  const staging = await agent(
322
374
  `Stage a cohorte review report and its metrics, mechanically:\n` +
323
375
  `1. Write EXACTLY this content to specs/reports/${feature}.md (overwrite):\n<<<REPORT\n${reportBody}\nREPORT\n` +
324
- `2. Append one line to $(dirname "$(git rev-parse --git-common-dir)")/.claude/pipeline-metrics.jsonl: ` +
325
- `{"ts":"<ISO now>","feature":"${feature}","phase":"review","seconds":0,"surfaces":{${results.map(r => `"${r.key}":"${verdict}:${r.kept.length}"`).join(',')}}}\n` +
376
+ `2. Write EXACTLY this to specs/reports/${feature}.verdict.json (overwrite), substituting <ISO now> with ` +
377
+ '`date -u +%Y-%m-%dT%H:%M:%SZ` and <FP> with the fingerprint — computed in Bash, never by hand: ' +
378
+ (blockingItems.length
379
+ // POSIX-escape embedded quotes ('\'') rather than stripping them: a stripped quote
380
+ // makes the fingerprint disagree with the blocking_items in the same file, and with
381
+ // a conversational re-run computing it per the §3 contract.
382
+ ? `printf '%s\\n' ${blockingItems.map(i => `'${i.replace(/'/g, "'\\''")}'`).join(' ')} | LC_ALL=C sort | sha256sum | cut -c1-16 ` +
383
+ '(`shasum -a 256` then first 16 hex chars where there is no sha256sum):\n'
384
+ : 'the blocking list is empty, so <FP> is the empty string "":\n') +
385
+ `${verdictJson}\n` +
386
+ // Per-surface verdicts (not the merged one stamped on every row — one BLOCK used to
387
+ // mark ALL surfaces failed on the dashboard), and dead reviewers logged as "dead"
388
+ // per SCHEMA.md §Dead agents — an incomplete batch is the batch worth recording.
389
+ `3. Append one line to $(dirname "$(git rev-parse --git-common-dir)")/.claude/pipeline-metrics.jsonl: ` +
390
+ `{"ts":"<ISO now>","feature":"${feature}","phase":"review","seconds":0,"surfaces":{${
391
+ results.map(r => `"${r.key}":"${r.report.verdict}:${r.kept.length}"`)
392
+ .concat(unreviewed.map(k => `"${k}":"dead"`)).join(',')}}}\n` +
326
393
  // Deferred findings must land in the backlog on EVERY verdict — parked only on a
327
394
  // SHIP is parked nowhere the rest of the time, which is the leak this closes.
328
395
  (deferredAll.length
329
- ? `3. Route the deferred findings to specs/refactor-backlog.md (create it if absent): for each line below, ` +
396
+ ? `4. Route the deferred findings to specs/refactor-backlog.md (create it if absent): for each line below, ` +
330
397
  `append it under the \`## <domain>\` heading named in its prefix (create that heading if absent) — with \`>>\`, ` +
331
398
  `never by rewriting the file, and skip any whose file path + first words already appear there (grep -F first, ` +
332
399
  `they may be left from a prior round or an /cohorte-audit):\n` +
@@ -339,10 +406,10 @@ const staging = await agent(
339
406
  // HIGH/MEDIUM ones — certifying those for /cohorte-ship would ship known defects. A dead
340
407
  // reviewer already forced the verdict off SHIP, so `clean` covers that too.
341
408
  (clean
342
- ? `4. Stamp the freshness gate in specs/${feature}.md's front-matter, exactly as the conversational /cohorte-review §3 does ` +
409
+ ? `5. Stamp the freshness gate in specs/${feature}.md's front-matter, exactly as the conversational /cohorte-review §3 does ` +
343
410
  `(so /cohorte-ship can prove the reviewed code is what ships): BASE=$(git merge-base ${base} HEAD); set reviewed_base: $BASE and ` +
344
- `reviewed_digest: $(git diff $BASE -- . ':(exclude)specs/' | sha256sum | cut -c1-16). ` +
345
- '5. Tick the spec DoD boxes this run verified (spec conformance + copy language — review SHIP; tests/lint/typecheck — green preflight); leave the rest unticked.\n'
411
+ `reviewed_digest: $(git diff $BASE -- . ':(exclude)specs/' | sha256sum | cut -c1-16) — shasum -a 256, first 16 hex, where sha256sum is absent (macOS). ` +
412
+ '6. Tick the spec DoD boxes this run verified (spec conformance + copy language — review SHIP; tests/lint/typecheck — green preflight); leave the rest unticked.\n'
346
413
  : '') +
347
414
  'Return the single word: done.',
348
415
  { model: 'haiku', label: 'stage-report', effort: 'low' },
@@ -357,6 +424,8 @@ const staged_ok = staging != null && /done/i.test(String(staging))
357
424
  return {
358
425
  verdict,
359
426
  counts,
427
+ blocking: blockingFindings.length, // CRITICAL + security, each once — 0 ⟺ SHIP; what a driver reduces on
428
+ blockingItems, // the sorted identity list behind verdict.json's fingerprint
360
429
  deferred: deferredAll.length, // parked in the backlog for /cohorte-refactor — never blocking
361
430
  refutedByCrossCheck: refuted.length,
362
431
  reportStaged: staged_ok,
@@ -39,5 +39,5 @@
39
39
  Error generating stack: `+s.message+`
40
40
  `+s.stack}return{value:e,source:n,stack:l,digest:null}}function Js(e,n,t){return{value:e,source:null,stack:t??null,digest:n??null}}function qs(e,n){try{console.error(n.value)}catch(t){setTimeout(function(){throw t})}}var gd=typeof WeakMap=="function"?WeakMap:Map;function Uu(e,n,t){t=En(-1,t),t.tag=3,t.payload={element:null};var r=n.value;return t.callback=function(){gl||(gl=!0,pi=r),qs(e,n)},t}function Au(e,n,t){t=En(-1,t),t.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=n.value;t.payload=function(){return r(l)},t.callback=function(){qs(e,n)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){qs(e,n),typeof r!="function"&&(Bn===null?Bn=new Set([this]):Bn.add(this));var i=n.stack;this.componentDidCatch(n.value,{componentStack:i!==null?i:""})}),t}function Vu(e,n,t){var r=e.pingCache;if(r===null){r=e.pingCache=new gd;var l=new Set;r.set(n,l)}else l=r.get(n),l===void 0&&(l=new Set,r.set(n,l));l.has(t)||(l.add(t),e=Ld.bind(null,e,n,t),n.then(e,e))}function Bu(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function Hu(e,n,t,r,l){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(n=En(-1,1),n.tag=2,An(t,n,1))),t.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var yd=ge.ReactCurrentOwner,Ae=!1;function Ie(e,n,t,r){n.child=e===null?au(n,null,t,r):Et(n,e.child,t,r)}function Wu(e,n,t,r,l){t=t.render;var s=n.ref;return _t(n,l),r=Hs(e,n,t,r,s,l),t=Ws(),e!==null&&!Ae?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l,Cn(e,n,l)):(ae&&t&&Cs(n),n.flags|=1,Ie(e,n,r,l),n.child)}function Qu(e,n,t,r,l){if(e===null){var s=t.type;return typeof s=="function"&&!ki(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(n.tag=15,n.type=s,Ku(e,n,s,r,l)):(e=jl(t.type,null,r,n,n.mode,l),e.ref=n.ref,e.return=n,n.child=e)}if(s=e.child,(e.lanes&l)===0){var i=s.memoizedProps;if(t=t.compare,t=t!==null?t:bt,t(i,r)&&e.ref===n.ref)return Cn(e,n,l)}return n.flags|=1,e=Kn(s,r),e.ref=n.ref,e.return=n,n.child=e}function Ku(e,n,t,r,l){if(e!==null){var s=e.memoizedProps;if(bt(s,r)&&e.ref===n.ref)if(Ae=!1,n.pendingProps=r=s,(e.lanes&l)!==0)(e.flags&131072)!==0&&(Ae=!0);else return n.lanes=e.lanes,Cn(e,n,l)}return bs(e,n,t,r,l)}function Yu(e,n,t){var r=n.pendingProps,l=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},le(Lt,Ge),Ge|=t;else{if((t&1073741824)===0)return e=s!==null?s.baseLanes|t:t,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,le(Lt,Ge),Ge|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,le(Lt,Ge),Ge|=r}else s!==null?(r=s.baseLanes|t,n.memoizedState=null):r=t,le(Lt,Ge),Ge|=r;return Ie(e,n,l,t),n.child}function Xu(e,n){var t=n.ref;(e===null&&t!==null||e!==null&&e.ref!==t)&&(n.flags|=512,n.flags|=2097152)}function bs(e,n,t,r,l){var s=Ue(t)?Jn:ze.current;return s=wt(n,s),_t(n,l),t=Hs(e,n,t,r,s,l),r=Ws(),e!==null&&!Ae?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l,Cn(e,n,l)):(ae&&r&&Cs(n),n.flags|=1,Ie(e,n,t,l),n.child)}function Gu(e,n,t,r,l){if(Ue(t)){var s=!0;Xr(n)}else s=!1;if(_t(n,l),n.stateNode===null)fl(e,n),Fu(n,t,r),Zs(n,t,r,l),r=!0;else if(e===null){var i=n.stateNode,u=n.memoizedProps;i.props=u;var a=i.context,v=t.contextType;typeof v=="object"&&v!==null?v=be(v):(v=Ue(t)?Jn:ze.current,v=wt(n,v));var w=t.getDerivedStateFromProps,S=typeof w=="function"||typeof i.getSnapshotBeforeUpdate=="function";S||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==r||a!==v)&&$u(n,i,r,v),Un=!1;var x=n.memoizedState;i.state=x,rl(n,r,i,l),a=n.memoizedState,u!==r||x!==a||$e.current||Un?(typeof w=="function"&&(Gs(n,t,w,r),a=n.memoizedState),(u=Un||Du(n,t,u,r,x,a,v))?(S||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(n.flags|=4194308)):(typeof i.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=r,n.memoizedState=a),i.props=r,i.state=a,i.context=v,r=u):(typeof i.componentDidMount=="function"&&(n.flags|=4194308),r=!1)}else{i=n.stateNode,du(e,n),u=n.memoizedProps,v=n.type===n.elementType?u:un(n.type,u),i.props=v,S=n.pendingProps,x=i.context,a=t.contextType,typeof a=="object"&&a!==null?a=be(a):(a=Ue(t)?Jn:ze.current,a=wt(n,a));var _=t.getDerivedStateFromProps;(w=typeof _=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==S||x!==a)&&$u(n,i,r,a),Un=!1,x=n.memoizedState,i.state=x,rl(n,r,i,l);var R=n.memoizedState;u!==S||x!==R||$e.current||Un?(typeof _=="function"&&(Gs(n,t,_,r),R=n.memoizedState),(v=Un||Du(n,t,v,r,x,R,a)||!1)?(w||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,R,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,R,a)),typeof i.componentDidUpdate=="function"&&(n.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&x===e.memoizedState||(n.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&x===e.memoizedState||(n.flags|=1024),n.memoizedProps=r,n.memoizedState=R),i.props=r,i.state=R,i.context=a,r=v):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&x===e.memoizedState||(n.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&x===e.memoizedState||(n.flags|=1024),r=!1)}return ei(e,n,t,r,s,l)}function ei(e,n,t,r,l,s){Xu(e,n);var i=(n.flags&128)!==0;if(!r&&!i)return l&&eu(n,t,!1),Cn(e,n,s);r=n.stateNode,yd.current=n;var u=i&&typeof t.getDerivedStateFromError!="function"?null:r.render();return n.flags|=1,e!==null&&i?(n.child=Et(n,e.child,null,s),n.child=Et(n,null,u,s)):Ie(e,n,u,s),n.memoizedState=r.state,l&&eu(n,t,!0),n.child}function Zu(e){var n=e.stateNode;n.pendingContext?qo(e,n.pendingContext,n.pendingContext!==n.context):n.context&&qo(e,n.context,!1),Fs(e,n.containerInfo)}function Ju(e,n,t,r,l){return Nt(),Rs(l),n.flags|=256,Ie(e,n,t,r),n.child}var ni={dehydrated:null,treeContext:null,retryLane:0};function ti(e){return{baseLanes:e,cachePool:null,transitions:null}}function qu(e,n,t){var r=n.pendingProps,l=ce.current,s=!1,i=(n.flags&128)!==0,u;if((u=i)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(s=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),le(ce,l&1),e===null)return zs(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(i=r.children,e=r.fallback,s?(r=n.mode,s=n.child,i={mode:"hidden",children:i},(r&1)===0&&s!==null?(s.childLanes=0,s.pendingProps=i):s=Nl(i,r,0,null),e=ot(e,r,t,null),s.return=n,e.return=n,s.sibling=e,n.child=s,n.child.memoizedState=ti(t),n.memoizedState=ni,e):ri(n,i));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return xd(e,n,i,r,u,l,t);if(s){s=r.fallback,i=n.mode,l=e.child,u=l.sibling;var a={mode:"hidden",children:r.children};return(i&1)===0&&n.child!==l?(r=n.child,r.childLanes=0,r.pendingProps=a,n.deletions=null):(r=Kn(l,a),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?s=Kn(u,s):(s=ot(s,i,t,null),s.flags|=2),s.return=n,r.return=n,r.sibling=s,n.child=r,r=s,s=n.child,i=e.child.memoizedState,i=i===null?ti(t):{baseLanes:i.baseLanes|t,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~t,n.memoizedState=ni,r}return s=e.child,e=s.sibling,r=Kn(s,{mode:"visible",children:r.children}),(n.mode&1)===0&&(r.lanes=t),r.return=n,r.sibling=null,e!==null&&(t=n.deletions,t===null?(n.deletions=[e],n.flags|=16):t.push(e)),n.child=r,n.memoizedState=null,r}function ri(e,n){return n=Nl({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function dl(e,n,t,r){return r!==null&&Rs(r),Et(n,e.child,null,t),e=ri(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function xd(e,n,t,r,l,s,i){if(t)return n.flags&256?(n.flags&=-257,r=Js(Error(d(422))),dl(e,n,i,r)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(s=r.fallback,l=n.mode,r=Nl({mode:"visible",children:r.children},l,0,null),s=ot(s,l,i,null),s.flags|=2,r.return=n,s.return=n,r.sibling=s,n.child=r,(n.mode&1)!==0&&Et(n,e.child,null,i),n.child.memoizedState=ti(i),n.memoizedState=ni,s);if((n.mode&1)===0)return dl(e,n,i,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,s=Error(d(419)),r=Js(s,r,void 0),dl(e,n,i,r)}if(u=(i&e.childLanes)!==0,Ae||u){if(r=Ne,r!==null){switch(i&-i){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=(l&(r.suspendedLanes|i))!==0?0:l,l!==0&&l!==s.retryLane&&(s.retryLane=l,Nn(e,l),dn(r,e,l,-1))}return xi(),r=Js(Error(d(421))),dl(e,n,i,r)}return l.data==="$?"?(n.flags|=128,n.child=e.child,n=Td.bind(null,e),l._reactRetry=n,null):(e=s.treeContext,Xe=On(l.nextSibling),Ye=n,ae=!0,on=null,e!==null&&(Je[qe++]=Sn,Je[qe++]=jn,Je[qe++]=qn,Sn=e.id,jn=e.overflow,qn=n),n=ri(n,r.children),n.flags|=4096,n)}function bu(e,n,t){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n),Ms(e.return,n,t)}function li(e,n,t,r,l){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:l}:(s.isBackwards=n,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=l)}function ea(e,n,t){var r=n.pendingProps,l=r.revealOrder,s=r.tail;if(Ie(e,n,r.children,t),r=ce.current,(r&2)!==0)r=r&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bu(e,t,n);else if(e.tag===19)bu(e,t,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(le(ce,r),(n.mode&1)===0)n.memoizedState=null;else switch(l){case"forwards":for(t=n.child,l=null;t!==null;)e=t.alternate,e!==null&&ll(e)===null&&(l=t),t=t.sibling;t=l,t===null?(l=n.child,n.child=null):(l=t.sibling,t.sibling=null),li(n,!1,l,t,s);break;case"backwards":for(t=null,l=n.child,n.child=null;l!==null;){if(e=l.alternate,e!==null&&ll(e)===null){n.child=l;break}e=l.sibling,l.sibling=t,t=l,l=e}li(n,!0,t,null,s);break;case"together":li(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function fl(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Cn(e,n,t){if(e!==null&&(n.dependencies=e.dependencies),rt|=n.lanes,(t&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(d(153));if(n.child!==null){for(e=n.child,t=Kn(e,e.pendingProps),n.child=t,t.return=n;e.sibling!==null;)e=e.sibling,t=t.sibling=Kn(e,e.pendingProps),t.return=n;t.sibling=null}return n.child}function kd(e,n,t){switch(n.tag){case 3:Zu(n),Nt();break;case 5:mu(n);break;case 1:Ue(n.type)&&Xr(n);break;case 4:Fs(n,n.stateNode.containerInfo);break;case 10:var r=n.type._context,l=n.memoizedProps.value;le(el,r._currentValue),r._currentValue=l;break;case 13:if(r=n.memoizedState,r!==null)return r.dehydrated!==null?(le(ce,ce.current&1),n.flags|=128,null):(t&n.child.childLanes)!==0?qu(e,n,t):(le(ce,ce.current&1),e=Cn(e,n,t),e!==null?e.sibling:null);le(ce,ce.current&1);break;case 19:if(r=(t&n.childLanes)!==0,(e.flags&128)!==0){if(r)return ea(e,n,t);n.flags|=128}if(l=n.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),le(ce,ce.current),r)break;return null;case 22:case 23:return n.lanes=0,Yu(e,n,t)}return Cn(e,n,t)}var na,si,ta,ra;na=function(e,n){for(var t=n.child;t!==null;){if(t.tag===5||t.tag===6)e.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break;for(;t.sibling===null;){if(t.return===null||t.return===n)return;t=t.return}t.sibling.return=t.return,t=t.sibling}},si=function(){},ta=function(e,n,t,r){var l=e.memoizedProps;if(l!==r){e=n.stateNode,nt(vn.current);var s=null;switch(t){case"input":l=Ml(e,l),r=Ml(e,r),s=[];break;case"select":l=z({},l,{value:void 0}),r=z({},r,{value:void 0}),s=[];break;case"textarea":l=Fl(e,l),r=Fl(e,r),s=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Qr)}Ul(t,r);var i;t=null;for(v in l)if(!r.hasOwnProperty(v)&&l.hasOwnProperty(v)&&l[v]!=null)if(v==="style"){var u=l[v];for(i in u)u.hasOwnProperty(i)&&(t||(t={}),t[i]="")}else v!=="dangerouslySetInnerHTML"&&v!=="children"&&v!=="suppressContentEditableWarning"&&v!=="suppressHydrationWarning"&&v!=="autoFocus"&&(j.hasOwnProperty(v)?s||(s=[]):(s=s||[]).push(v,null));for(v in r){var a=r[v];if(u=l!=null?l[v]:void 0,r.hasOwnProperty(v)&&a!==u&&(a!=null||u!=null))if(v==="style")if(u){for(i in u)!u.hasOwnProperty(i)||a&&a.hasOwnProperty(i)||(t||(t={}),t[i]="");for(i in a)a.hasOwnProperty(i)&&u[i]!==a[i]&&(t||(t={}),t[i]=a[i])}else t||(s||(s=[]),s.push(v,t)),t=a;else v==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,u=u?u.__html:void 0,a!=null&&u!==a&&(s=s||[]).push(v,a)):v==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(v,""+a):v!=="suppressContentEditableWarning"&&v!=="suppressHydrationWarning"&&(j.hasOwnProperty(v)?(a!=null&&v==="onScroll"&&se("scroll",e),s||u===a||(s=[])):(s=s||[]).push(v,a))}t&&(s=s||[]).push("style",t);var v=s;(n.updateQueue=v)&&(n.flags|=4)}},ra=function(e,n,t,r){t!==r&&(n.flags|=4)};function mr(e,n){if(!ae)switch(e.tailMode){case"hidden":n=e.tail;for(var t=null;n!==null;)n.alternate!==null&&(t=n),n=n.sibling;t===null?e.tail=null:t.sibling=null;break;case"collapsed":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Le(e){var n=e.alternate!==null&&e.alternate.child===e.child,t=0,r=0;if(n)for(var l=e.child;l!==null;)t|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)t|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=t,n}function wd(e,n,t){var r=n.pendingProps;switch(_s(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Le(n),null;case 1:return Ue(n.type)&&Yr(),Le(n),null;case 3:return r=n.stateNode,Pt(),ie($e),ie(ze),As(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(qr(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,on!==null&&(vi(on),on=null))),si(e,n),Le(n),null;case 5:$s(n);var l=nt(ar.current);if(t=n.type,e!==null&&n.stateNode!=null)ta(e,n,t,r,l),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!r){if(n.stateNode===null)throw Error(d(166));return Le(n),null}if(e=nt(vn.current),qr(n)){r=n.stateNode,t=n.type;var s=n.memoizedProps;switch(r[hn]=n,r[lr]=s,e=(n.mode&1)!==0,t){case"dialog":se("cancel",r),se("close",r);break;case"iframe":case"object":case"embed":se("load",r);break;case"video":case"audio":for(l=0;l<nr.length;l++)se(nr[l],r);break;case"source":se("error",r);break;case"img":case"image":case"link":se("error",r),se("load",r);break;case"details":se("toggle",r);break;case"input":Di(r,s),se("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},se("invalid",r);break;case"textarea":Ui(r,s),se("invalid",r)}Ul(t,s),l=null;for(var i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="children"?typeof u=="string"?r.textContent!==u&&(s.suppressHydrationWarning!==!0&&Wr(r.textContent,u,e),l=["children",u]):typeof u=="number"&&r.textContent!==""+u&&(s.suppressHydrationWarning!==!0&&Wr(r.textContent,u,e),l=["children",""+u]):j.hasOwnProperty(i)&&u!=null&&i==="onScroll"&&se("scroll",r)}switch(t){case"input":wr(r),$i(r,s,!0);break;case"textarea":wr(r),Vi(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Qr)}r=l,n.updateQueue=r,r!==null&&(n.flags|=4)}else{i=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Bi(t)),e==="http://www.w3.org/1999/xhtml"?t==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(t,{is:r.is}):(e=i.createElement(t),t==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,t),e[hn]=n,e[lr]=r,na(e,n,!1,!1),n.stateNode=e;e:{switch(i=Al(t,r),t){case"dialog":se("cancel",e),se("close",e),l=r;break;case"iframe":case"object":case"embed":se("load",e),l=r;break;case"video":case"audio":for(l=0;l<nr.length;l++)se(nr[l],e);l=r;break;case"source":se("error",e),l=r;break;case"img":case"image":case"link":se("error",e),se("load",e),l=r;break;case"details":se("toggle",e),l=r;break;case"input":Di(e,r),l=Ml(e,r),se("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=z({},r,{value:void 0}),se("invalid",e);break;case"textarea":Ui(e,r),l=Fl(e,r),se("invalid",e);break;default:l=r}Ul(t,l),u=l;for(s in u)if(u.hasOwnProperty(s)){var a=u[s];s==="style"?Qi(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Hi(e,a)):s==="children"?typeof a=="string"?(t!=="textarea"||a!=="")&&Dt(e,a):typeof a=="number"&&Dt(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(j.hasOwnProperty(s)?a!=null&&s==="onScroll"&&se("scroll",e):a!=null&&we(e,s,a,i))}switch(t){case"input":wr(e),$i(e,r,!1);break;case"textarea":wr(e),Vi(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ne(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?at(e,!!r.multiple,s,!1):r.defaultValue!=null&&at(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Qr)}switch(t){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return Le(n),null;case 6:if(e&&n.stateNode!=null)ra(e,n,e.memoizedProps,r);else{if(typeof r!="string"&&n.stateNode===null)throw Error(d(166));if(t=nt(ar.current),nt(vn.current),qr(n)){if(r=n.stateNode,t=n.memoizedProps,r[hn]=n,(s=r.nodeValue!==t)&&(e=Ye,e!==null))switch(e.tag){case 3:Wr(r.nodeValue,t,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Wr(r.nodeValue,t,(e.mode&1)!==0)}s&&(n.flags|=4)}else r=(t.nodeType===9?t:t.ownerDocument).createTextNode(r),r[hn]=n,n.stateNode=r}return Le(n),null;case 13:if(ie(ce),r=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ae&&Xe!==null&&(n.mode&1)!==0&&(n.flags&128)===0)iu(),Nt(),n.flags|=98560,s=!1;else if(s=qr(n),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(d(318));if(s=n.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(d(317));s[hn]=n}else Nt(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Le(n),s=!1}else on!==null&&(vi(on),on=null),s=!0;if(!s)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=t,n):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(ce.current&1)!==0?ke===0&&(ke=3):xi())),n.updateQueue!==null&&(n.flags|=4),Le(n),null);case 4:return Pt(),si(e,n),e===null&&tr(n.stateNode.containerInfo),Le(n),null;case 10:return Is(n.type._context),Le(n),null;case 17:return Ue(n.type)&&Yr(),Le(n),null;case 19:if(ie(ce),s=n.memoizedState,s===null)return Le(n),null;if(r=(n.flags&128)!==0,i=s.rendering,i===null)if(r)mr(s,!1);else{if(ke!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(i=ll(e),i!==null){for(n.flags|=128,mr(s,!1),r=i.updateQueue,r!==null&&(n.updateQueue=r,n.flags|=4),n.subtreeFlags=0,r=t,t=n.child;t!==null;)s=t,e=r,s.flags&=14680066,i=s.alternate,i===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,s.type=i.type,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t=t.sibling;return le(ce,ce.current&1|2),n.child}e=e.sibling}s.tail!==null&&me()>Tt&&(n.flags|=128,r=!0,mr(s,!1),n.lanes=4194304)}else{if(!r)if(e=ll(i),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),mr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!ae)return Le(n),null}else 2*me()-s.renderingStartTime>Tt&&t!==1073741824&&(n.flags|=128,r=!0,mr(s,!1),n.lanes=4194304);s.isBackwards?(i.sibling=n.child,n.child=i):(t=s.last,t!==null?t.sibling=i:n.child=i,s.last=i)}return s.tail!==null?(n=s.tail,s.rendering=n,s.tail=n.sibling,s.renderingStartTime=me(),n.sibling=null,t=ce.current,le(ce,r?t&1|2:t&1),n):(Le(n),null);case 22:case 23:return yi(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&(n.mode&1)!==0?(Ge&1073741824)!==0&&(Le(n),n.subtreeFlags&6&&(n.flags|=8192)):Le(n),null;case 24:return null;case 25:return null}throw Error(d(156,n.tag))}function Sd(e,n){switch(_s(n),n.tag){case 1:return Ue(n.type)&&Yr(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Pt(),ie($e),ie(ze),As(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return $s(n),null;case 13:if(ie(ce),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(d(340));Nt()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ie(ce),null;case 4:return Pt(),null;case 10:return Is(n.type._context),null;case 22:case 23:return yi(),null;case 24:return null;default:return null}}var pl=!1,Te=!1,jd=typeof WeakSet=="function"?WeakSet:Set,P=null;function Rt(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){pe(e,n,r)}else t.current=null}function ii(e,n,t){try{t()}catch(r){pe(e,n,r)}}var la=!1;function Nd(e,n){if(ys=Ir,e=Do(),cs(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var i=0,u=-1,a=-1,v=0,w=0,S=e,x=null;n:for(;;){for(var _;S!==t||l!==0&&S.nodeType!==3||(u=i+l),S!==s||r!==0&&S.nodeType!==3||(a=i+r),S.nodeType===3&&(i+=S.nodeValue.length),(_=S.firstChild)!==null;)x=S,S=_;for(;;){if(S===e)break n;if(x===t&&++v===l&&(u=i),x===s&&++w===r&&(a=i),(_=S.nextSibling)!==null)break;S=x,x=S.parentNode}S=_}t=u===-1||a===-1?null:{start:u,end:a}}else t=null}t=t||{start:0,end:0}}else t=null;for(xs={focusedElem:e,selectionRange:t},Ir=!1,P=n;P!==null;)if(n=P,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,P=e;else for(;P!==null;){n=P;try{var R=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(R!==null){var L=R.memoizedProps,he=R.memoizedState,m=n.stateNode,f=m.getSnapshotBeforeUpdate(n.elementType===n.type?L:un(n.type,L),he);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var h=n.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(d(163))}}catch(E){pe(n,n.return,E)}if(e=n.sibling,e!==null){e.return=n.return,P=e;break}P=n.return}return R=la,la=!1,R}function hr(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&ii(n,t,s)}l=l.next}while(l!==r)}}function ml(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function oi(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function sa(e){var n=e.alternate;n!==null&&(e.alternate=null,sa(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[hn],delete n[lr],delete n[js],delete n[id],delete n[od])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ia(e){return e.tag===5||e.tag===3||e.tag===4}function oa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ia(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ui(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=Qr));else if(r!==4&&(e=e.child,e!==null))for(ui(e,n,t),e=e.sibling;e!==null;)ui(e,n,t),e=e.sibling}function ai(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ai(e,n,t),e=e.sibling;e!==null;)ai(e,n,t),e=e.sibling}var _e=null,an=!1;function Vn(e,n,t){for(t=t.child;t!==null;)ua(e,n,t),t=t.sibling}function ua(e,n,t){if(mn&&typeof mn.onCommitFiberUnmount=="function")try{mn.onCommitFiberUnmount(_r,t)}catch{}switch(t.tag){case 5:Te||Rt(t,n);case 6:var r=_e,l=an;_e=null,Vn(e,n,t),_e=r,an=l,_e!==null&&(an?(e=_e,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):_e.removeChild(t.stateNode));break;case 18:_e!==null&&(an?(e=_e,t=t.stateNode,e.nodeType===8?Ss(e.parentNode,t):e.nodeType===1&&Ss(e,t),Yt(e)):Ss(_e,t.stateNode));break;case 4:r=_e,l=an,_e=t.stateNode.containerInfo,an=!0,Vn(e,n,t),_e=r,an=l;break;case 0:case 11:case 14:case 15:if(!Te&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,i=s.destroy;s=s.tag,i!==void 0&&((s&2)!==0||(s&4)!==0)&&ii(t,n,i),l=l.next}while(l!==r)}Vn(e,n,t);break;case 1:if(!Te&&(Rt(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(u){pe(t,n,u)}Vn(e,n,t);break;case 21:Vn(e,n,t);break;case 22:t.mode&1?(Te=(r=Te)||t.memoizedState!==null,Vn(e,n,t),Te=r):Vn(e,n,t);break;default:Vn(e,n,t)}}function aa(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new jd),n.forEach(function(r){var l=Id.bind(null,e,r);t.has(r)||(t.add(r),r.then(l,l))})}}function cn(e,n){var t=n.deletions;if(t!==null)for(var r=0;r<t.length;r++){var l=t[r];try{var s=e,i=n,u=i;e:for(;u!==null;){switch(u.tag){case 5:_e=u.stateNode,an=!1;break e;case 3:_e=u.stateNode.containerInfo,an=!0;break e;case 4:_e=u.stateNode.containerInfo,an=!0;break e}u=u.return}if(_e===null)throw Error(d(160));ua(s,i,l),_e=null,an=!1;var a=l.alternate;a!==null&&(a.return=null),l.return=null}catch(v){pe(l,n,v)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)ca(n,e),n=n.sibling}function ca(e,n){var t=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(cn(n,e),yn(e),r&4){try{hr(3,e,e.return),ml(3,e)}catch(L){pe(e,e.return,L)}try{hr(5,e,e.return)}catch(L){pe(e,e.return,L)}}break;case 1:cn(n,e),yn(e),r&512&&t!==null&&Rt(t,t.return);break;case 5:if(cn(n,e),yn(e),r&512&&t!==null&&Rt(t,t.return),e.flags&32){var l=e.stateNode;try{Dt(l,"")}catch(L){pe(e,e.return,L)}}if(r&4&&(l=e.stateNode,l!=null)){var s=e.memoizedProps,i=t!==null?t.memoizedProps:s,u=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{u==="input"&&s.type==="radio"&&s.name!=null&&Fi(l,s),Al(u,i);var v=Al(u,s);for(i=0;i<a.length;i+=2){var w=a[i],S=a[i+1];w==="style"?Qi(l,S):w==="dangerouslySetInnerHTML"?Hi(l,S):w==="children"?Dt(l,S):we(l,w,S,v)}switch(u){case"input":Ol(l,s);break;case"textarea":Ai(l,s);break;case"select":var x=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!s.multiple;var _=s.value;_!=null?at(l,!!s.multiple,_,!1):x!==!!s.multiple&&(s.defaultValue!=null?at(l,!!s.multiple,s.defaultValue,!0):at(l,!!s.multiple,s.multiple?[]:"",!1))}l[lr]=s}catch(L){pe(e,e.return,L)}}break;case 6:if(cn(n,e),yn(e),r&4){if(e.stateNode===null)throw Error(d(162));l=e.stateNode,s=e.memoizedProps;try{l.nodeValue=s}catch(L){pe(e,e.return,L)}}break;case 3:if(cn(n,e),yn(e),r&4&&t!==null&&t.memoizedState.isDehydrated)try{Yt(n.containerInfo)}catch(L){pe(e,e.return,L)}break;case 4:cn(n,e),yn(e);break;case 13:cn(n,e),yn(e),l=e.child,l.flags&8192&&(s=l.memoizedState!==null,l.stateNode.isHidden=s,!s||l.alternate!==null&&l.alternate.memoizedState!==null||(fi=me())),r&4&&aa(e);break;case 22:if(w=t!==null&&t.memoizedState!==null,e.mode&1?(Te=(v=Te)||w,cn(n,e),Te=v):cn(n,e),yn(e),r&8192){if(v=e.memoizedState!==null,(e.stateNode.isHidden=v)&&!w&&(e.mode&1)!==0)for(P=e,w=e.child;w!==null;){for(S=P=w;P!==null;){switch(x=P,_=x.child,x.tag){case 0:case 11:case 14:case 15:hr(4,x,x.return);break;case 1:Rt(x,x.return);var R=x.stateNode;if(typeof R.componentWillUnmount=="function"){r=x,t=x.return;try{n=r,R.props=n.memoizedProps,R.state=n.memoizedState,R.componentWillUnmount()}catch(L){pe(r,t,L)}}break;case 5:Rt(x,x.return);break;case 22:if(x.memoizedState!==null){pa(S);continue}}_!==null?(_.return=x,P=_):pa(S)}w=w.sibling}e:for(w=null,S=e;;){if(S.tag===5){if(w===null){w=S;try{l=S.stateNode,v?(s=l.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(u=S.stateNode,a=S.memoizedProps.style,i=a!=null&&a.hasOwnProperty("display")?a.display:null,u.style.display=Wi("display",i))}catch(L){pe(e,e.return,L)}}}else if(S.tag===6){if(w===null)try{S.stateNode.nodeValue=v?"":S.memoizedProps}catch(L){pe(e,e.return,L)}}else if((S.tag!==22&&S.tag!==23||S.memoizedState===null||S===e)&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===e)break e;for(;S.sibling===null;){if(S.return===null||S.return===e)break e;w===S&&(w=null),S=S.return}w===S&&(w=null),S.sibling.return=S.return,S=S.sibling}}break;case 19:cn(n,e),yn(e),r&4&&aa(e);break;case 21:break;default:cn(n,e),yn(e)}}function yn(e){var n=e.flags;if(n&2){try{e:{for(var t=e.return;t!==null;){if(ia(t)){var r=t;break e}t=t.return}throw Error(d(160))}switch(r.tag){case 5:var l=r.stateNode;r.flags&32&&(Dt(l,""),r.flags&=-33);var s=oa(e);ai(e,s,l);break;case 3:case 4:var i=r.stateNode.containerInfo,u=oa(e);ui(e,u,i);break;default:throw Error(d(161))}}catch(a){pe(e,e.return,a)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ed(e,n,t){P=e,da(e)}function da(e,n,t){for(var r=(e.mode&1)!==0;P!==null;){var l=P,s=l.child;if(l.tag===22&&r){var i=l.memoizedState!==null||pl;if(!i){var u=l.alternate,a=u!==null&&u.memoizedState!==null||Te;u=pl;var v=Te;if(pl=i,(Te=a)&&!v)for(P=l;P!==null;)i=P,a=i.child,i.tag===22&&i.memoizedState!==null?ma(l):a!==null?(a.return=i,P=a):ma(l);for(;s!==null;)P=s,da(s),s=s.sibling;P=l,pl=u,Te=v}fa(e)}else(l.subtreeFlags&8772)!==0&&s!==null?(s.return=l,P=s):fa(e)}}function fa(e){for(;P!==null;){var n=P;if((n.flags&8772)!==0){var t=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:Te||ml(5,n);break;case 1:var r=n.stateNode;if(n.flags&4&&!Te)if(t===null)r.componentDidMount();else{var l=n.elementType===n.type?t.memoizedProps:un(n.type,t.memoizedProps);r.componentDidUpdate(l,t.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=n.updateQueue;s!==null&&pu(n,s,r);break;case 3:var i=n.updateQueue;if(i!==null){if(t=null,n.child!==null)switch(n.child.tag){case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}pu(n,i,t)}break;case 5:var u=n.stateNode;if(t===null&&n.flags&4){t=u;var a=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&t.focus();break;case"img":a.src&&(t.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var v=n.alternate;if(v!==null){var w=v.memoizedState;if(w!==null){var S=w.dehydrated;S!==null&&Yt(S)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(d(163))}Te||n.flags&512&&oi(n)}catch(x){pe(n,n.return,x)}}if(n===e){P=null;break}if(t=n.sibling,t!==null){t.return=n.return,P=t;break}P=n.return}}function pa(e){for(;P!==null;){var n=P;if(n===e){P=null;break}var t=n.sibling;if(t!==null){t.return=n.return,P=t;break}P=n.return}}function ma(e){for(;P!==null;){var n=P;try{switch(n.tag){case 0:case 11:case 15:var t=n.return;try{ml(4,n)}catch(a){pe(n,t,a)}break;case 1:var r=n.stateNode;if(typeof r.componentDidMount=="function"){var l=n.return;try{r.componentDidMount()}catch(a){pe(n,l,a)}}var s=n.return;try{oi(n)}catch(a){pe(n,s,a)}break;case 5:var i=n.return;try{oi(n)}catch(a){pe(n,i,a)}}}catch(a){pe(n,n.return,a)}if(n===e){P=null;break}var u=n.sibling;if(u!==null){u.return=n.return,P=u;break}P=n.return}}var Cd=Math.ceil,hl=ge.ReactCurrentDispatcher,ci=ge.ReactCurrentOwner,nn=ge.ReactCurrentBatchConfig,G=0,Ne=null,ye=null,Pe=0,Ge=0,Lt=Dn(0),ke=0,vr=null,rt=0,vl=0,di=0,gr=null,Ve=null,fi=0,Tt=1/0,_n=null,gl=!1,pi=null,Bn=null,yl=!1,Hn=null,xl=0,yr=0,mi=null,kl=-1,wl=0;function Me(){return(G&6)!==0?me():kl!==-1?kl:kl=me()}function Wn(e){return(e.mode&1)===0?1:(G&2)!==0&&Pe!==0?Pe&-Pe:ad.transition!==null?(wl===0&&(wl=io()),wl):(e=te,e!==0||(e=window.event,e=e===void 0?16:vo(e.type)),e)}function dn(e,n,t,r){if(50<yr)throw yr=0,mi=null,Error(d(185));Bt(e,t,r),((G&2)===0||e!==Ne)&&(e===Ne&&((G&2)===0&&(vl|=t),ke===4&&Qn(e,Pe)),Be(e,r),t===1&&G===0&&(n.mode&1)===0&&(Tt=me()+500,Gr&&$n()))}function Be(e,n){var t=e.callbackNode;ac(e,n);var r=Rr(e,e===Ne?Pe:0);if(r===0)t!==null&&ro(t),e.callbackNode=null,e.callbackPriority=0;else if(n=r&-r,e.callbackPriority!==n){if(t!=null&&ro(t),n===1)e.tag===0?ud(va.bind(null,e)):nu(va.bind(null,e)),ld(function(){(G&6)===0&&$n()}),t=null;else{switch(oo(r)){case 1:t=Yl;break;case 4:t=lo;break;case 16:t=Cr;break;case 536870912:t=so;break;default:t=Cr}t=Na(t,ha.bind(null,e))}e.callbackPriority=n,e.callbackNode=t}}function ha(e,n){if(kl=-1,wl=0,(G&6)!==0)throw Error(d(327));var t=e.callbackNode;if(It()&&e.callbackNode!==t)return null;var r=Rr(e,e===Ne?Pe:0);if(r===0)return null;if((r&30)!==0||(r&e.expiredLanes)!==0||n)n=Sl(e,r);else{n=r;var l=G;G|=2;var s=ya();(Ne!==e||Pe!==n)&&(_n=null,Tt=me()+500,st(e,n));do try{zd();break}catch(u){ga(e,u)}while(!0);Ts(),hl.current=s,G=l,ye!==null?n=0:(Ne=null,Pe=0,n=ke)}if(n!==0){if(n===2&&(l=Xl(e),l!==0&&(r=l,n=hi(e,l))),n===1)throw t=vr,st(e,0),Qn(e,r),Be(e,me()),t;if(n===6)Qn(e,r);else{if(l=e.current.alternate,(r&30)===0&&!_d(l)&&(n=Sl(e,r),n===2&&(s=Xl(e),s!==0&&(r=s,n=hi(e,s))),n===1))throw t=vr,st(e,0),Qn(e,r),Be(e,me()),t;switch(e.finishedWork=l,e.finishedLanes=r,n){case 0:case 1:throw Error(d(345));case 2:it(e,Ve,_n);break;case 3:if(Qn(e,r),(r&130023424)===r&&(n=fi+500-me(),10<n)){if(Rr(e,0)!==0)break;if(l=e.suspendedLanes,(l&r)!==r){Me(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=ws(it.bind(null,e,Ve,_n),n);break}it(e,Ve,_n);break;case 4:if(Qn(e,r),(r&4194240)===r)break;for(n=e.eventTimes,l=-1;0<r;){var i=31-ln(r);s=1<<i,i=n[i],i>l&&(l=i),r&=~s}if(r=l,r=me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cd(r/1960))-r,10<r){e.timeoutHandle=ws(it.bind(null,e,Ve,_n),r);break}it(e,Ve,_n);break;case 5:it(e,Ve,_n);break;default:throw Error(d(329))}}}return Be(e,me()),e.callbackNode===t?ha.bind(null,e):null}function hi(e,n){var t=gr;return e.current.memoizedState.isDehydrated&&(st(e,n).flags|=256),e=Sl(e,n),e!==2&&(n=Ve,Ve=t,n!==null&&vi(n)),e}function vi(e){Ve===null?Ve=e:Ve.push.apply(Ve,e)}function _d(e){for(var n=e;;){if(n.flags&16384){var t=n.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var r=0;r<t.length;r++){var l=t[r],s=l.getSnapshot;l=l.value;try{if(!sn(s(),l))return!1}catch{return!1}}}if(t=n.child,n.subtreeFlags&16384&&t!==null)t.return=n,n=t;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Qn(e,n){for(n&=~di,n&=~vl,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var t=31-ln(n),r=1<<t;e[t]=-1,n&=~r}}function va(e){if((G&6)!==0)throw Error(d(327));It();var n=Rr(e,0);if((n&1)===0)return Be(e,me()),null;var t=Sl(e,n);if(e.tag!==0&&t===2){var r=Xl(e);r!==0&&(n=r,t=hi(e,r))}if(t===1)throw t=vr,st(e,0),Qn(e,n),Be(e,me()),t;if(t===6)throw Error(d(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,it(e,Ve,_n),Be(e,me()),null}function gi(e,n){var t=G;G|=1;try{return e(n)}finally{G=t,G===0&&(Tt=me()+500,Gr&&$n())}}function lt(e){Hn!==null&&Hn.tag===0&&(G&6)===0&&It();var n=G;G|=1;var t=nn.transition,r=te;try{if(nn.transition=null,te=1,e)return e()}finally{te=r,nn.transition=t,G=n,(G&6)===0&&$n()}}function yi(){Ge=Lt.current,ie(Lt)}function st(e,n){e.finishedWork=null,e.finishedLanes=0;var t=e.timeoutHandle;if(t!==-1&&(e.timeoutHandle=-1,rd(t)),ye!==null)for(t=ye.return;t!==null;){var r=t;switch(_s(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Yr();break;case 3:Pt(),ie($e),ie(ze),As();break;case 5:$s(r);break;case 4:Pt();break;case 13:ie(ce);break;case 19:ie(ce);break;case 10:Is(r.type._context);break;case 22:case 23:yi()}t=t.return}if(Ne=e,ye=e=Kn(e.current,null),Pe=Ge=n,ke=0,vr=null,di=vl=rt=0,Ve=gr=null,et!==null){for(n=0;n<et.length;n++)if(t=et[n],r=t.interleaved,r!==null){t.interleaved=null;var l=r.next,s=t.pending;if(s!==null){var i=s.next;s.next=l,r.next=i}t.pending=r}et=null}return e}function ga(e,n){do{var t=ye;try{if(Ts(),sl.current=al,il){for(var r=de.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}il=!1}if(tt=0,je=xe=de=null,cr=!1,dr=0,ci.current=null,t===null||t.return===null){ke=1,vr=n,ye=null;break}e:{var s=e,i=t.return,u=t,a=n;if(n=Pe,u.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var v=a,w=u,S=w.tag;if((w.mode&1)===0&&(S===0||S===11||S===15)){var x=w.alternate;x?(w.updateQueue=x.updateQueue,w.memoizedState=x.memoizedState,w.lanes=x.lanes):(w.updateQueue=null,w.memoizedState=null)}var _=Bu(i);if(_!==null){_.flags&=-257,Hu(_,i,u,s,n),_.mode&1&&Vu(s,v,n),n=_,a=v;var R=n.updateQueue;if(R===null){var L=new Set;L.add(a),n.updateQueue=L}else R.add(a);break e}else{if((n&1)===0){Vu(s,v,n),xi();break e}a=Error(d(426))}}else if(ae&&u.mode&1){var he=Bu(i);if(he!==null){(he.flags&65536)===0&&(he.flags|=256),Hu(he,i,u,s,n),Rs(zt(a,u));break e}}s=a=zt(a,u),ke!==4&&(ke=2),gr===null?gr=[s]:gr.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,n&=-n,s.lanes|=n;var m=Uu(s,a,n);fu(s,m);break e;case 1:u=a;var f=s.type,h=s.stateNode;if((s.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Bn===null||!Bn.has(h)))){s.flags|=65536,n&=-n,s.lanes|=n;var E=Au(s,u,n);fu(s,E);break e}}s=s.return}while(s!==null)}ka(t)}catch(I){n=I,ye===t&&t!==null&&(ye=t=t.return);continue}break}while(!0)}function ya(){var e=hl.current;return hl.current=al,e===null?al:e}function xi(){(ke===0||ke===3||ke===2)&&(ke=4),Ne===null||(rt&268435455)===0&&(vl&268435455)===0||Qn(Ne,Pe)}function Sl(e,n){var t=G;G|=2;var r=ya();(Ne!==e||Pe!==n)&&(_n=null,st(e,n));do try{Pd();break}catch(l){ga(e,l)}while(!0);if(Ts(),G=t,hl.current=r,ye!==null)throw Error(d(261));return Ne=null,Pe=0,ke}function Pd(){for(;ye!==null;)xa(ye)}function zd(){for(;ye!==null&&!ec();)xa(ye)}function xa(e){var n=ja(e.alternate,e,Ge);e.memoizedProps=e.pendingProps,n===null?ka(e):ye=n,ci.current=null}function ka(e){var n=e;do{var t=n.alternate;if(e=n.return,(n.flags&32768)===0){if(t=wd(t,n,Ge),t!==null){ye=t;return}}else{if(t=Sd(t,n),t!==null){t.flags&=32767,ye=t;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ke=6,ye=null;return}}if(n=n.sibling,n!==null){ye=n;return}ye=n=e}while(n!==null);ke===0&&(ke=5)}function it(e,n,t){var r=te,l=nn.transition;try{nn.transition=null,te=1,Rd(e,n,t,r)}finally{nn.transition=l,te=r}return null}function Rd(e,n,t,r){do It();while(Hn!==null);if((G&6)!==0)throw Error(d(327));t=e.finishedWork;var l=e.finishedLanes;if(t===null)return null;if(e.finishedWork=null,e.finishedLanes=0,t===e.current)throw Error(d(177));e.callbackNode=null,e.callbackPriority=0;var s=t.lanes|t.childLanes;if(cc(e,s),e===Ne&&(ye=Ne=null,Pe=0),(t.subtreeFlags&2064)===0&&(t.flags&2064)===0||yl||(yl=!0,Na(Cr,function(){return It(),null})),s=(t.flags&15990)!==0,(t.subtreeFlags&15990)!==0||s){s=nn.transition,nn.transition=null;var i=te;te=1;var u=G;G|=4,ci.current=null,Nd(e,t),ca(t,e),Zc(xs),Ir=!!ys,xs=ys=null,e.current=t,Ed(t),nc(),G=u,te=i,nn.transition=s}else e.current=t;if(yl&&(yl=!1,Hn=e,xl=l),s=e.pendingLanes,s===0&&(Bn=null),lc(t.stateNode),Be(e,me()),n!==null)for(r=e.onRecoverableError,t=0;t<n.length;t++)l=n[t],r(l.value,{componentStack:l.stack,digest:l.digest});if(gl)throw gl=!1,e=pi,pi=null,e;return(xl&1)!==0&&e.tag!==0&&It(),s=e.pendingLanes,(s&1)!==0?e===mi?yr++:(yr=0,mi=e):yr=0,$n(),null}function It(){if(Hn!==null){var e=oo(xl),n=nn.transition,t=te;try{if(nn.transition=null,te=16>e?16:e,Hn===null)var r=!1;else{if(e=Hn,Hn=null,xl=0,(G&6)!==0)throw Error(d(331));var l=G;for(G|=4,P=e.current;P!==null;){var s=P,i=s.child;if((P.flags&16)!==0){var u=s.deletions;if(u!==null){for(var a=0;a<u.length;a++){var v=u[a];for(P=v;P!==null;){var w=P;switch(w.tag){case 0:case 11:case 15:hr(8,w,s)}var S=w.child;if(S!==null)S.return=w,P=S;else for(;P!==null;){w=P;var x=w.sibling,_=w.return;if(sa(w),w===v){P=null;break}if(x!==null){x.return=_,P=x;break}P=_}}}var R=s.alternate;if(R!==null){var L=R.child;if(L!==null){R.child=null;do{var he=L.sibling;L.sibling=null,L=he}while(L!==null)}}P=s}}if((s.subtreeFlags&2064)!==0&&i!==null)i.return=s,P=i;else e:for(;P!==null;){if(s=P,(s.flags&2048)!==0)switch(s.tag){case 0:case 11:case 15:hr(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,P=m;break e}P=s.return}}var f=e.current;for(P=f;P!==null;){i=P;var h=i.child;if((i.subtreeFlags&2064)!==0&&h!==null)h.return=i,P=h;else e:for(i=f;P!==null;){if(u=P,(u.flags&2048)!==0)try{switch(u.tag){case 0:case 11:case 15:ml(9,u)}}catch(I){pe(u,u.return,I)}if(u===i){P=null;break e}var E=u.sibling;if(E!==null){E.return=u.return,P=E;break e}P=u.return}}if(G=l,$n(),mn&&typeof mn.onPostCommitFiberRoot=="function")try{mn.onPostCommitFiberRoot(_r,e)}catch{}r=!0}return r}finally{te=t,nn.transition=n}}return!1}function wa(e,n,t){n=zt(t,n),n=Uu(e,n,1),e=An(e,n,1),n=Me(),e!==null&&(Bt(e,1,n),Be(e,n))}function pe(e,n,t){if(e.tag===3)wa(e,e,t);else for(;n!==null;){if(n.tag===3){wa(n,e,t);break}else if(n.tag===1){var r=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Bn===null||!Bn.has(r))){e=zt(t,e),e=Au(n,e,1),n=An(n,e,1),e=Me(),n!==null&&(Bt(n,1,e),Be(n,e));break}}n=n.return}}function Ld(e,n,t){var r=e.pingCache;r!==null&&r.delete(n),n=Me(),e.pingedLanes|=e.suspendedLanes&t,Ne===e&&(Pe&t)===t&&(ke===4||ke===3&&(Pe&130023424)===Pe&&500>me()-fi?st(e,0):di|=t),Be(e,n)}function Sa(e,n){n===0&&((e.mode&1)===0?n=1:(n=zr,zr<<=1,(zr&130023424)===0&&(zr=4194304)));var t=Me();e=Nn(e,n),e!==null&&(Bt(e,n,t),Be(e,t))}function Td(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Sa(e,t)}function Id(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(t=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(d(314))}r!==null&&r.delete(n),Sa(e,t)}var ja;ja=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||$e.current)Ae=!0;else{if((e.lanes&t)===0&&(n.flags&128)===0)return Ae=!1,kd(e,n,t);Ae=(e.flags&131072)!==0}else Ae=!1,ae&&(n.flags&1048576)!==0&&tu(n,Jr,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;fl(e,n),e=n.pendingProps;var l=wt(n,ze.current);_t(n,t),l=Hs(null,n,r,e,l,t);var s=Ws();return n.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Ue(r)?(s=!0,Xr(n)):s=!1,n.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ds(n),l.updater=cl,n.stateNode=l,l._reactInternals=n,Zs(n,r,e,t),n=ei(null,n,r,!0,s,t)):(n.tag=0,ae&&s&&Cs(n),Ie(null,n,l,t),n=n.child),n;case 16:r=n.elementType;e:{switch(fl(e,n),e=n.pendingProps,l=r._init,r=l(r._payload),n.type=r,l=n.tag=Od(r),e=un(r,e),l){case 0:n=bs(null,n,r,e,t);break e;case 1:n=Gu(null,n,r,e,t);break e;case 11:n=Wu(null,n,r,e,t);break e;case 14:n=Qu(null,n,r,un(r.type,e),t);break e}throw Error(d(306,r,""))}return n;case 0:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:un(r,l),bs(e,n,r,l,t);case 1:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:un(r,l),Gu(e,n,r,l,t);case 3:e:{if(Zu(n),e===null)throw Error(d(387));r=n.pendingProps,s=n.memoizedState,l=s.element,du(e,n),rl(n,r,null,t);var i=n.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},n.updateQueue.baseState=s,n.memoizedState=s,n.flags&256){l=zt(Error(d(423)),n),n=Ju(e,n,r,t,l);break e}else if(r!==l){l=zt(Error(d(424)),n),n=Ju(e,n,r,t,l);break e}else for(Xe=On(n.stateNode.containerInfo.firstChild),Ye=n,ae=!0,on=null,t=au(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Nt(),r===l){n=Cn(e,n,t);break e}Ie(e,n,r,t)}n=n.child}return n;case 5:return mu(n),e===null&&zs(n),r=n.type,l=n.pendingProps,s=e!==null?e.memoizedProps:null,i=l.children,ks(r,l)?i=null:s!==null&&ks(r,s)&&(n.flags|=32),Xu(e,n),Ie(e,n,i,t),n.child;case 6:return e===null&&zs(n),null;case 13:return qu(e,n,t);case 4:return Fs(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=Et(n,null,r,t):Ie(e,n,r,t),n.child;case 11:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:un(r,l),Wu(e,n,r,l,t);case 7:return Ie(e,n,n.pendingProps,t),n.child;case 8:return Ie(e,n,n.pendingProps.children,t),n.child;case 12:return Ie(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,l=n.pendingProps,s=n.memoizedProps,i=l.value,le(el,r._currentValue),r._currentValue=i,s!==null)if(sn(s.value,i)){if(s.children===l.children&&!$e.current){n=Cn(e,n,t);break e}}else for(s=n.child,s!==null&&(s.return=n);s!==null;){var u=s.dependencies;if(u!==null){i=s.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=En(-1,t&-t),a.tag=2;var v=s.updateQueue;if(v!==null){v=v.shared;var w=v.pending;w===null?a.next=a:(a.next=w.next,w.next=a),v.pending=a}}s.lanes|=t,a=s.alternate,a!==null&&(a.lanes|=t),Ms(s.return,t,n),u.lanes|=t;break}a=a.next}}else if(s.tag===10)i=s.type===n.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(d(341));i.lanes|=t,u=i.alternate,u!==null&&(u.lanes|=t),Ms(i,t,n),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===n){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}Ie(e,n,l.children,t),n=n.child}return n;case 9:return l=n.type,r=n.pendingProps.children,_t(n,t),l=be(l),r=r(l),n.flags|=1,Ie(e,n,r,t),n.child;case 14:return r=n.type,l=un(r,n.pendingProps),l=un(r.type,l),Qu(e,n,r,l,t);case 15:return Ku(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:un(r,l),fl(e,n),n.tag=1,Ue(r)?(e=!0,Xr(n)):e=!1,_t(n,t),Fu(n,r,l),Zs(n,r,l,t),ei(null,n,r,!0,e,t);case 19:return ea(e,n,t);case 22:return Yu(e,n,t)}throw Error(d(156,n.tag))};function Na(e,n){return to(e,n)}function Md(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tn(e,n,t,r){return new Md(e,n,t,r)}function ki(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Od(e){if(typeof e=="function")return ki(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fn)return 11;if(e===pn)return 14}return 2}function Kn(e,n){var t=e.alternate;return t===null?(t=tn(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function jl(e,n,t,r,l,s){var i=2;if(r=e,typeof e=="function")ki(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Ce:return ot(t.children,l,s,n);case Ze:i=8,l|=8;break;case Pn:return e=tn(12,t,n,l|2),e.elementType=Pn,e.lanes=s,e;case We:return e=tn(13,t,n,l),e.elementType=We,e.lanes=s,e;case rn:return e=tn(19,t,n,l),e.elementType=rn,e.lanes=s,e;case fe:return Nl(t,l,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xn:i=10;break e;case Xn:i=9;break e;case fn:i=11;break e;case pn:i=14;break e;case Fe:i=16,r=null;break e}throw Error(d(130,e==null?e:typeof e,""))}return n=tn(i,t,n,l),n.elementType=e,n.type=r,n.lanes=s,n}function ot(e,n,t,r){return e=tn(7,e,r,n),e.lanes=t,e}function Nl(e,n,t,r){return e=tn(22,e,r,n),e.elementType=fe,e.lanes=t,e.stateNode={isHidden:!1},e}function wi(e,n,t){return e=tn(6,e,null,n),e.lanes=t,e}function Si(e,n,t){return n=tn(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Dd(e,n,t,r,l){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gl(0),this.expirationTimes=Gl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ji(e,n,t,r,l,s,i,u,a){return e=new Dd(e,n,t,u,a),n===1?(n=1,s===!0&&(n|=8)):n=0,s=tn(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ds(s),e}function Fd(e,n,t){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Se,key:r==null?null:""+r,children:e,containerInfo:n,implementation:t}}function Ea(e){if(!e)return Fn;e=e._reactInternals;e:{if(Gn(e)!==e||e.tag!==1)throw Error(d(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Ue(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(d(171))}if(e.tag===1){var t=e.type;if(Ue(t))return bo(e,t,n)}return n}function Ca(e,n,t,r,l,s,i,u,a){return e=ji(t,r,!0,e,l,s,i,u,a),e.context=Ea(null),t=e.current,r=Me(),l=Wn(t),s=En(r,l),s.callback=n??null,An(t,s,l),e.current.lanes=l,Bt(e,l,r),Be(e,r),e}function El(e,n,t,r){var l=n.current,s=Me(),i=Wn(l);return t=Ea(t),n.context===null?n.context=t:n.pendingContext=t,n=En(s,i),n.payload={element:e},r=r===void 0?null:r,r!==null&&(n.callback=r),e=An(l,n,i),e!==null&&(dn(e,l,i,s),tl(e,l,i)),i}function Cl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function _a(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var t=e.retryLane;e.retryLane=t!==0&&t<n?t:n}}function Ni(e,n){_a(e,n),(e=e.alternate)&&_a(e,n)}function $d(){return null}var Pa=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ei(e){this._internalRoot=e}_l.prototype.render=Ei.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(d(409));El(e,n,null,null)},_l.prototype.unmount=Ei.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;lt(function(){El(null,e,null,null)}),n[kn]=null}};function _l(e){this._internalRoot=e}_l.prototype.unstable_scheduleHydration=function(e){if(e){var n=co();e={blockedOn:null,target:e,priority:n};for(var t=0;t<Tn.length&&n!==0&&n<Tn[t].priority;t++);Tn.splice(t,0,e),t===0&&mo(e)}};function Ci(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Pl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function za(){}function Ud(e,n,t,r,l){if(l){if(typeof r=="function"){var s=r;r=function(){var v=Cl(i);s.call(v)}}var i=Ca(n,r,e,0,null,!1,!1,"",za);return e._reactRootContainer=i,e[kn]=i.current,tr(e.nodeType===8?e.parentNode:e),lt(),i}for(;l=e.lastChild;)e.removeChild(l);if(typeof r=="function"){var u=r;r=function(){var v=Cl(a);u.call(v)}}var a=ji(e,0,!1,null,null,!1,!1,"",za);return e._reactRootContainer=a,e[kn]=a.current,tr(e.nodeType===8?e.parentNode:e),lt(function(){El(n,a,t,r)}),a}function zl(e,n,t,r,l){var s=t._reactRootContainer;if(s){var i=s;if(typeof l=="function"){var u=l;l=function(){var a=Cl(i);u.call(a)}}El(n,i,e,l)}else i=Ud(t,n,e,l,r);return Cl(i)}uo=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var t=Vt(n.pendingLanes);t!==0&&(Zl(n,t|1),Be(n,me()),(G&6)===0&&(Tt=me()+500,$n()))}break;case 13:lt(function(){var r=Nn(e,1);if(r!==null){var l=Me();dn(r,e,1,l)}}),Ni(e,1)}},Jl=function(e){if(e.tag===13){var n=Nn(e,134217728);if(n!==null){var t=Me();dn(n,e,134217728,t)}Ni(e,134217728)}},ao=function(e){if(e.tag===13){var n=Wn(e),t=Nn(e,n);if(t!==null){var r=Me();dn(t,e,n,r)}Ni(e,n)}},co=function(){return te},fo=function(e,n){var t=te;try{return te=e,n()}finally{te=t}},Hl=function(e,n,t){switch(n){case"input":if(Ol(e,t),n=t.name,t.type==="radio"&&n!=null){for(t=e;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<t.length;n++){var r=t[n];if(r!==e&&r.form===e.form){var l=Kr(r);if(!l)throw Error(d(90));Oi(r),Ol(r,l)}}}break;case"textarea":Ai(e,t);break;case"select":n=t.value,n!=null&&at(e,!!t.multiple,n,!1)}},Gi=gi,Zi=lt;var Ad={usingClientEntryPoint:!1,Events:[sr,xt,Kr,Yi,Xi,gi]},xr={findFiberByHostInstance:Zn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Vd={bundleType:xr.bundleType,version:xr.version,rendererPackageName:xr.rendererPackageName,rendererConfig:xr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ge.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=eo(e),e===null?null:e.stateNode},findFiberByHostInstance:xr.findFiberByHostInstance||$d,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rl.isDisabled&&Rl.supportsFiber)try{_r=Rl.inject(Vd),mn=Rl}catch{}}return He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ad,He.createPortal=function(e,n){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ci(n))throw Error(d(200));return Fd(e,n,null,t)},He.createRoot=function(e,n){if(!Ci(e))throw Error(d(299));var t=!1,r="",l=Pa;return n!=null&&(n.unstable_strictMode===!0&&(t=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onRecoverableError!==void 0&&(l=n.onRecoverableError)),n=ji(e,1,!1,null,null,t,!1,r,l),e[kn]=n.current,tr(e.nodeType===8?e.parentNode:e),new Ei(n)},He.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(d(188)):(e=Object.keys(e).join(","),Error(d(268,e)));return e=eo(n),e=e===null?null:e.stateNode,e},He.flushSync=function(e){return lt(e)},He.hydrate=function(e,n,t){if(!Pl(n))throw Error(d(200));return zl(null,e,n,!0,t)},He.hydrateRoot=function(e,n,t){if(!Ci(e))throw Error(d(405));var r=t!=null&&t.hydratedSources||null,l=!1,s="",i=Pa;if(t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),n=Ca(n,null,e,1,t??null,l,!1,s,i),e[kn]=n.current,tr(e),r)for(e=0;e<r.length;e++)t=r[e],l=t._getVersion,l=l(t._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[t,l]:n.mutableSourceEagerHydrationData.push(t,l);return new _l(n)},He.render=function(e,n,t){if(!Pl(n))throw Error(d(200));return zl(null,e,n,!1,t)},He.unmountComponentAtNode=function(e){if(!Pl(e))throw Error(d(40));return e._reactRootContainer?(lt(function(){zl(null,null,e,!1,function(){e._reactRootContainer=null,e[kn]=null})}),!0):!1},He.unstable_batchedUpdates=gi,He.unstable_renderSubtreeIntoContainer=function(e,n,t,r){if(!Pl(t))throw Error(d(200));if(e==null||e._reactInternals===void 0)throw Error(d(38));return zl(e,n,t,!1,r)},He.version="18.3.1-next-f1338f8080-20240426",He}var Fa;function Jd(){if(Fa)return zi.exports;Fa=1;function c(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(g){console.error(g)}}return c(),zi.exports=Zd(),zi.exports}var $a;function qd(){if($a)return Ll;$a=1;var c=Jd();return Ll.createRoot=c.createRoot,Ll.hydrateRoot=c.hydrateRoot,Ll}var bd=qd();async function Ii(c){let g="";try{g=(await c.json()).error||""}catch{}return g||`${c.status} ${c.statusText}`}async function ut(c){const g=await fetch(c);if(!g.ok)throw new Error(await Ii(g));return g.json()}async function Ua(c,g,d){const y=await fetch(c,{method:g,headers:{"content-type":"application/json"},body:JSON.stringify(d||{})});if(!y.ok)throw new Error(await Ii(y));return y.json()}async function Qa(c,g){const d=await fetch("/api/action",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)});if(!d.ok||!d.body)throw new Error(await Ii(d));const y=d.body.getReader(),j=new TextDecoder;let N="";const A=V=>V.replace(/\n__EXIT__ \d+\s*$/,""),M=4e5;let T=!1;const H=()=>{N.length<=M||(N=N.slice(N.length-M),T=!0)},X=()=>g((T?`… [earlier output trimmed]
41
41
  `:"")+A(N));for(;;){const{done:V,value:ee}=await y.read();if(V)break;N+=j.decode(ee,{stream:!0}),H(),X()}N+=j.decode(),H(),X();const B=N.match(/__EXIT__ (\d+)\s*$/);return B?parseInt(B[1],10):null}function Mi({freshness:c,latest:g,installMode:d}){return d==="none"?{label:"not installed",cls:"bad"}:c===0?{label:"up to date",cls:"ok"}:c===-1?{label:`update → ${g}`,cls:"warn"}:c===1?{label:"ahead of npm (dev)",cls:"dev"}:{label:"unknown",cls:"neutral"}}function ef({p:c,onOpen:g,onRemove:d}){if(!c.exists)return o.jsxs("div",{className:"project-card gone",children:[o.jsxs("div",{className:"pc-head",children:[o.jsx("span",{className:"pc-name",children:Aa(c.path)}),o.jsx("button",{className:"icon-btn",title:"remove",onClick:d,children:"✕"})]}),o.jsx("p",{className:"muted small",children:c.error||"path missing"})]});if(c.error)return o.jsxs("div",{className:"project-card",children:[o.jsxs("div",{className:"pc-head",children:[o.jsx("span",{className:"pc-name",children:c.name}),o.jsx("button",{className:"icon-btn",title:"remove",onClick:d,children:"✕"})]}),o.jsxs("p",{className:"muted small",children:["error: ",c.error]})]});const y=Mi(c.versions),j=c.summary;return o.jsxs("div",{className:"project-card",onClick:g,role:"button",tabIndex:0,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),g())},children:[o.jsxs("div",{className:"pc-head",children:[o.jsx("span",{className:"pc-name",children:c.name}),o.jsx("button",{className:"icon-btn",title:"stop tracking",onClick:N=>{N.stopPropagation(),d()},children:"✕"})]}),o.jsx("div",{className:"pc-path muted small mono",children:Aa(c.path)}),o.jsxs("div",{className:"pc-badges",children:[o.jsx("span",{className:`badge ${y.cls}`,children:y.label}),!c.hasProfile&&o.jsx("span",{className:"badge bad",children:"no profile"})]}),o.jsxs("div",{className:"pc-health",children:[j.bad>0&&o.jsx("span",{className:"pill bad",children:j.bad}),j.warn>0&&o.jsx("span",{className:"pill warn",children:j.warn}),o.jsx("span",{className:"pill ok",children:j.ok}),j.skip>0&&o.jsx("span",{className:"pill neutral",children:j.skip}),o.jsxs("span",{className:"muted small pc-counts",children:[c.surfaces," surfaces · ",c.specs," specs"]})]})]})}function Aa(c){const g=c.split(/[\\/]/);return g.length>3?"…/"+g.slice(-2).join("/"):c}function Ka({title:c,action:g,scope:d,project:y,command:j,confirmText:N,onClose:A,onChanged:M}){const[T,H]=Z.useState("confirm"),[X,B]=Z.useState(""),[V,ee]=Z.useState(null),oe=Z.useRef(null);Z.useEffect(()=>{oe.current&&(oe.current.scrollTop=oe.current.scrollHeight)},[X]);async function $(){H("running"),B("");try{const ve=await Qa({action:g,scope:d,project:y,command:j},B);ee(ve),H("done"),M&&M()}catch(ve){B(Oe=>`${Oe}
42
- [error] ${ve.message}`),ee(1),H("done")}}const K=j?`claude -p "${j}" (cwd: ${y})`:`node cli.js ${g}${d==="global"?" --global":y?` ${y}`:""}`;return o.jsx("div",{className:"modal-backdrop",onClick:T!=="running"?A:void 0,children:o.jsxs("div",{className:"modal",onClick:ve=>ve.stopPropagation(),children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("h3",{children:c}),T==="done"&&o.jsx("span",{className:`badge ${V===0?"ok":"bad"}`,children:V===0?"success":V==null?"disconnected":`exit ${V}`})]}),T==="confirm"?o.jsxs(o.Fragment,{children:[N?o.jsx("div",{className:"confirm-text",children:N}):o.jsx("p",{className:"muted",children:"This runs the pipeline CLI and modifies files on disk:"}),o.jsx("pre",{className:"cmd",children:K}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"primary",onClick:$,children:"Run"}),o.jsx("button",{className:"ghost",onClick:A,children:"Cancel"})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"run-log",ref:oe,children:X||"…"}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"ghost",onClick:A,disabled:T==="running",children:T==="running"?"running…":"Close"})})]})]})})}function nf({core:c,onChanged:g}){const[d,y]=Z.useState(null);if(!c)return o.jsx("div",{className:"core-banner muted",children:"Loading core…"});const j=c.global||{},N=Mi({freshness:c.globalFreshness,latest:c.latest,installMode:j.present?"global":"none"});return o.jsxs("div",{className:"core-banner",children:[o.jsxs("div",{className:"cb-left",children:[o.jsx("span",{className:"cb-title",children:"Global core"}),o.jsx("span",{className:"cb-version mono",children:j.present?j.version:"not installed"}),o.jsx("span",{className:`badge ${N.cls}`,children:N.label}),o.jsxs("span",{className:"muted small",children:["npm latest ",c.latest||"—"]})]}),o.jsxs("div",{className:"cb-actions",children:[o.jsx("button",{className:"primary",onClick:()=>y("update"),children:"Update core…"}),!j.present&&o.jsx("button",{className:"ghost",onClick:()=>y("install"),children:"Install…"})]}),d&&o.jsx(Ka,{title:d==="update"?"Update global core":"Install global core",action:d,scope:"global",onClose:()=>y(null),onChanged:g})]})}function tf({onPick:c,onClose:g}){const[d,y]=Z.useState(null),[j,N]=Z.useState(null);async function A(M){try{N(null);const T=await ut("/api/browse"+(M?`?dir=${encodeURIComponent(M)}`:""));y(T),T.error&&N(T.error)}catch(T){N(T.message)}}return Z.useEffect(()=>{A()},[]),o.jsx("div",{className:"modal-backdrop",onClick:g,children:o.jsxs("div",{className:"modal picker",onClick:M=>M.stopPropagation(),children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("h3",{children:"Pick a project folder"}),d&&d.isProject&&o.jsx("span",{className:"badge ok",children:"pipeline project"})]}),o.jsx("div",{className:"picker-path mono small",children:d?d.dir:"loading…"}),j&&o.jsxs("div",{className:"add-error",children:["⚠ ",j]}),o.jsxs("div",{className:"picker-list",children:[d&&d.parent&&o.jsx("button",{className:"picker-row up",onClick:()=>A(d.parent),children:"↑ .."}),d&&d.dirs.length===0&&o.jsx("div",{className:"muted small picker-empty",children:"no sub-folders"}),d&&d.dirs.map(M=>o.jsxs("button",{className:"picker-row",onClick:()=>A(M.path),children:[o.jsx("span",{className:"picker-icon",children:M.isProject?"◆":"▸"}),o.jsx("span",{className:"picker-name",children:M.name}),M.isProject&&o.jsx("span",{className:"badge ok small",children:"project"})]},M.path))]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"primary",disabled:!d,onClick:()=>c(d.dir),children:"Add this folder"}),o.jsx("button",{className:"ghost",onClick:g,children:"Cancel"})]})]})})}function rf({fleet:c,core:g,error:d,onOpen:y,onChanged:j}){const[N,A]=Z.useState(""),[M,T]=Z.useState(!1),[H,X]=Z.useState(null),[B,V]=Z.useState(!1);async function ee($){if(!(!$||!$.trim())){T(!0),X(null);try{await Ua("/api/projects","POST",{path:$.trim()}),A(""),j()}catch(K){X(K.message)}finally{T(!1)}}}async function oe($){try{await Ua("/api/projects","DELETE",{path:$}),j()}catch(K){X(K.message)}}return o.jsxs("main",{className:"fleet",children:[o.jsx(nf,{core:g,onChanged:j}),o.jsxs("div",{className:"fleet-head",children:[o.jsxs("h2",{children:["Tracked projects ",c&&o.jsx("span",{className:"badge neutral",children:c.length})]}),o.jsxs("div",{className:"add-wrap",children:[o.jsxs("form",{className:"add-form",onSubmit:$=>{$.preventDefault(),ee(N)},children:[o.jsx("input",{className:`path-input${H?" invalid":""}`,placeholder:"/absolute/path/to/a/pipeline/project",value:N,onChange:$=>{A($.target.value),H&&X(null)}}),o.jsx("button",{className:"ghost",type:"button",onClick:()=>V(!0),children:"Browse…"}),o.jsx("button",{className:"primary",type:"submit",disabled:M,children:M?"adding…":"+ add"})]}),H&&o.jsxs("div",{className:"add-error",children:["⚠ ",H]})]})]}),d&&o.jsxs("div",{className:"panel error",children:["API error — ",d]}),!c&&o.jsx("div",{className:"panel muted",children:"Loading fleet…"}),c&&c.length===0&&o.jsx("div",{className:"panel muted",children:"No projects tracked yet — add one above."}),o.jsx("div",{className:"fleet-grid",children:c&&c.map($=>o.jsx(ef,{p:$,onOpen:()=>y($.path),onRemove:()=>oe($.path)},$.path))}),B&&o.jsx(tf,{onClose:()=>V(!1),onPick:$=>{V(!1),ee($)}})]})}function lf({data:c}){if(!c)return o.jsxs("section",{className:"panel",children:[o.jsx("h2",{children:"Freshness"}),o.jsx("p",{className:"muted",children:"Loading…"})]});const{installedVersion:g,latest:d,freshness:y,installMode:j,pointer:N,global:A,bundled:M}=c,T=Mi({freshness:y,latest:d,installMode:j});return o.jsxs("section",{className:"panel",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Freshness"}),o.jsx("span",{className:`badge ${T.cls}`,children:T.label})]}),o.jsxs("div",{className:"rows",children:[o.jsx(Mt,{label:"Installed core",value:g||"—",strong:!0}),o.jsx(Mt,{label:"Latest on npm",value:d||"unreachable"}),o.jsx(Mt,{label:"Install mode",value:j}),A.present&&o.jsx(Mt,{label:"Global core",value:A.version,mono:!0}),M.present&&o.jsx(Mt,{label:"Bundled core",value:M.version,mono:!0}),N.present&&o.jsx(Mt,{label:"Repo pointer",value:`${N.mode||"?"} · core ${N.core_version||"?"}`,mono:!0})]}),y===-1&&o.jsxs("p",{className:"muted small fresh-hint",children:["→ run ",o.jsx("strong",{children:"Update-pipeline"})," (above) to refresh the core and reconcile this project."]})]})}function Mt({label:c,value:g,strong:d,mono:y}){return o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"row-label",children:c}),o.jsx("span",{className:`row-value${d?" strong":""}${y?" mono":""}`,children:g})]})}const sf={ok:"✓",warn:"!",bad:"✕",skip:"–"};function of({checks:c,summary:g}){return c?o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Health"}),o.jsxs("div",{className:"summary",children:[g.bad>0&&o.jsxs("span",{className:"badge bad",children:[g.bad," failing"]}),g.warn>0&&o.jsxs("span",{className:"badge warn",children:[g.warn," warning"]}),o.jsxs("span",{className:"badge ok",children:[g.ok," ok"]}),g.skip>0&&o.jsxs("span",{className:"badge neutral",children:[g.skip," n/a"]})]})]}),o.jsx("ul",{className:"checks",children:c.map(d=>o.jsxs("li",{className:`check ${d.status}`,children:[o.jsx("span",{className:`check-icon ${d.status}`,children:sf[d.status]}),o.jsxs("div",{className:"check-body",children:[o.jsxs("div",{className:"check-line",children:[o.jsx("span",{className:"check-label",children:d.label}),o.jsx("span",{className:"check-detail",children:d.detail})]}),d.fix&&o.jsxs("div",{className:"check-fix",children:["fix: ",o.jsx("code",{children:d.fix})]})]})]},d.id))})]}):o.jsxs("section",{className:"panel",children:[o.jsx("h2",{children:"Health"}),o.jsx("p",{className:"muted",children:"Loading…"})]})}function uf({profile:c}){if(!c)return o.jsxs("section",{className:"panel",children:[o.jsx("h2",{children:"Surfaces"}),o.jsxs("p",{className:"muted",children:["No PIPELINE.md profile — run ",o.jsx("code",{children:"/cohorte-init-pipeline"}),"."]})]});const g=c.surfaces||[];return o.jsxs("section",{className:"panel",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Surfaces ↔ agents"}),o.jsx("span",{className:"badge neutral",children:g.length})]}),c.one_liner&&o.jsx("p",{className:"muted small",style:{marginTop:0},children:c.one_liner}),o.jsx("div",{className:"surfaces",children:g.map(d=>o.jsxs("div",{className:"surface",children:[o.jsxs("div",{className:"surface-top",children:[o.jsx("span",{className:"surface-key",children:d.label||d.key}),d.model&&o.jsx("span",{className:`chip model-${d.model}`,children:d.model}),d.uses_design&&o.jsx("span",{className:"chip design",children:"design"})]}),o.jsxs("div",{className:"surface-meta",children:[o.jsxs("span",{className:"mono",children:["→ ",d.agent,".md"]}),o.jsx("span",{className:"muted mono",children:d.path})]}),Array.isArray(d.tools)&&o.jsx("div",{className:"surface-tools",children:d.tools.map(y=>o.jsx("span",{className:"tool",children:y},y))})]},d.key))})]})}const Va=[{key:"draft",label:"Draft"},{key:"frozen",label:"Frozen"},{key:"in-progress",label:"In progress"},{key:"in-review",label:"In review"},{key:"shipped",label:"Shipped"},{key:"blocked",label:"Blocked"}];function af({specs:c}){if(!c)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Specs board"}),o.jsx("p",{className:"muted",children:"Loading…"})]});const g={};for(const y of Va)g[y.key]=[];const d=[];for(const y of c)g[y.status]?g[y.status].push(y):d.push(y);return o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Specs board"}),o.jsx("span",{className:"badge neutral",children:c.length})]}),c.length===0?o.jsxs("p",{className:"muted",children:["No specs yet — run ",o.jsx("code",{children:"/cohorte-spec"})," to freeze one."]}):o.jsx("div",{className:"board-scroll",children:o.jsxs("div",{className:"board",children:[Va.map(y=>o.jsxs("div",{className:`col col-${y.key}`,children:[o.jsxs("div",{className:"col-head",children:[o.jsx("span",{children:y.label}),o.jsx("span",{className:"muted",children:g[y.key].length})]}),g[y.key].map(j=>o.jsx(Ba,{s:j},j.file))]},y.key)),d.length>0&&o.jsxs("div",{className:"col col-other",children:[o.jsxs("div",{className:"col-head",children:[o.jsx("span",{children:"Other"}),o.jsx("span",{className:"muted",children:d.length})]}),d.map(y=>o.jsx(Ba,{s:y,bad:!0},y.file))]})]})})]})}function Ba({s:c,bad:g}){return o.jsxs("div",{className:`spec-card${g?" bad":""}`,children:[o.jsx("div",{className:"spec-title",children:c.title||c.id}),o.jsxs("div",{className:"spec-meta muted small mono",children:[c.id,g&&c.status?` · status: ${c.status}`:""]}),c.loop&&o.jsxs("div",{className:"spec-loop muted small mono",children:["↻ left at pass ",c.loop.pass,c.loop.phase?` · /${c.loop.phase}`:""," by a retired driver"]}),c.branch&&o.jsxs("div",{className:"spec-branch muted small mono",children:["⑂ ",c.branch]})]})}function cf({data:c}){return!c||!c.enabled?null:o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{children:["Kanban ",o.jsx("span",{className:"muted small",children:"· obsidian"})]}),o.jsxs("span",{className:"badge neutral",title:c.boardRel,children:[c.total," cards"]})]}),o.jsx("div",{className:"board-scroll",children:o.jsx("div",{className:"kanban-board",children:c.columns.map(g=>o.jsxs("div",{className:`kanban-col${g.cards.length?"":" empty"}`,children:[o.jsxs("div",{className:"col-head",children:[o.jsx("span",{children:g.name}),o.jsx("span",{className:"muted",children:g.cards.length})]}),g.cards.map((d,y)=>o.jsx(ff,{card:d},y))]},g.name))})})]})}function df(c){try{return new Date(c).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return""}}function ff({card:c}){const g=c.prs||[],d=g.find(y=>y.state);return o.jsxs("div",{className:`kanban-card${c.done?" done":""}`,children:[o.jsx("div",{className:"kc-text",children:c.text}),(c.tags.length>0||g.length>0)&&o.jsxs("div",{className:"kc-tags",children:[g.map(y=>{const j=`kc-pr state-${(y.state||"unknown").toLowerCase()}${y.draft?" draft":""}`,N=`PR #${y.num}${y.inferred?" ≈":""}`;return y.url?o.jsx("a",{className:j,href:y.url,target:"_blank",rel:"noreferrer",title:y.inferred?"matched by branch":"",children:N},y.num):o.jsx("span",{className:`${j} flat`,children:N},y.num)}),c.tags.map(y=>o.jsxs("span",{className:"kc-tag",children:["#",y]},y))]}),d&&o.jsxs("div",{className:`kc-status state-${d.state.toLowerCase()}`,children:[d.draft?"draft":d.state.toLowerCase(),(d.mergedAt||d.createdAt)&&` · ${df(d.mergedAt||d.createdAt)}`]})]})}const Tl=["build","review","fix","smoke","cycle"];function Ha(c){if(c==null)return"—";if(c<60)return`${c}s`;const g=Math.floor(c/60);return g<60?`${g}m ${c%60?`${c%60}s`:""}`.trim():`${Math.floor(g/60)}h ${g%60}m`}function pf(c){const g=String(c).split(":")[0].trim().toLowerCase();return g===""?"neutral":g==="ok"||g==="ship"||g==="pass"?"ok":g==="revise"?"warn":"bad"}function mf({data:c}){if(!c)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Pipeline metrics"}),o.jsx("p",{className:"muted",children:"Loading…"})]});const g=c.features||[];return o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{children:["Pipeline metrics ",o.jsx("span",{className:"muted small",children:"· wall-clock per phase"})]}),c.present&&o.jsxs("span",{className:"badge neutral",children:[c.batches," batches"]})]}),!c.present||g.length===0?o.jsxs("p",{className:"muted",children:["No metrics yet — ",o.jsx("code",{children:"/cohorte-build"}),", ",o.jsx("code",{children:"/cohorte-review"})," and ",o.jsx("code",{children:"/cohorte-fix"})," ","append them to ",o.jsx("code",{children:".claude/pipeline-metrics.jsonl"}),"."]}):o.jsx("div",{className:"board-scroll",children:o.jsx("div",{className:"metrics-list",children:g.map(d=>o.jsx(hf,{f:d},d.feature))})})]})}function hf({f:c}){const g=Math.max(1,...Tl.map(y=>c.phases[y]?c.phases[y].seconds:0)),d=Object.keys(c.surfaces||{});return o.jsxs("div",{className:"metric-feature",children:[o.jsxs("div",{className:"mf-head",children:[o.jsx("span",{className:"mf-name",children:c.feature}),o.jsxs("span",{className:"mf-badges",children:[o.jsxs("span",{className:"badge neutral",children:["total ",Ha(c.totalSeconds)]}),o.jsxs("span",{className:`badge ${c.fixRounds>1?"warn":"neutral"}`,children:[c.fixRounds," fix round",c.fixRounds===1?"":"s"]}),c.cycleRounds>0&&o.jsxs("span",{className:"badge neutral",title:"verify→fix rounds inside the cycle workflow",children:["cycle ×",c.cycleRounds]})]})]}),o.jsx("div",{className:"phase-bars",children:Tl.map(y=>{const j=c.phases[y];return o.jsxs("div",{className:"phase-row",title:j?`${j.rounds} run${j.rounds===1?"":"s"}`:"not run",children:[o.jsx("span",{className:"phase-label",children:y}),o.jsx("span",{className:"phase-track",children:j&&o.jsx("span",{className:"phase-fill",style:{width:`${j.seconds/g*100}%`}})}),o.jsx("span",{className:"phase-value muted small",children:j?`${Ha(j.seconds)}${j.rounds>1?` ×${j.rounds}`:""}`:"—"})]},y)})}),d.length>0&&o.jsxs("table",{className:"surface-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"surface"}),Tl.map(y=>o.jsx("th",{children:y},y))]})}),o.jsx("tbody",{children:d.map(y=>o.jsxs("tr",{children:[o.jsx("td",{className:"st-key",children:y}),Tl.map(j=>{const N=c.surfaces[y].results[j];return o.jsx("td",{children:N==null?o.jsx("span",{className:"muted",children:"·"}):o.jsx("span",{className:`pill ${pf(N)}`,children:N})},j)})]},y))})]})]})}const Il=c=>c==null?"—":c>=100?`$${Math.round(c)}`:c>0&&c<.01?"<$0.01":`$${c.toFixed(2)}`,vf=c=>c==null?"—":c>=1e6?`${(c/1e6).toFixed(1)}M`:c>=1e3?`${Math.round(c/1e3)}k`:String(c),Wa=c=>c==null?"—":c>=3600?`${(c/3600).toFixed(1)}h`:c>=60?`${Math.round(c/60)}m`:`${Math.round(c)}s`;function gf({data:c}){if(!c)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Cost & runtime"}),o.jsx("p",{className:"muted",children:"Reading transcripts…"})]});if(!c.present)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Cost & runtime"}),o.jsxs("p",{className:"muted",children:[c.error||"No data."," Figures come from Claude Code's own transcripts in"," ",o.jsx("code",{children:"~/.claude/projects"})," — nothing to enable, but the project has to have been driven from this machine."]})]});const{totals:g,commands:d=[]}=c,y=[...d].sort((N,A)=>N.command==="(chat)"!=(A.command==="(chat)")?N.command==="(chat)"?1:-1:A.cost.total-N.cost.total),j=Math.max(...y.map(N=>N.cost.total),.01);return o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{children:["Cost & runtime ",o.jsx("span",{className:"muted small",children:"· from Claude Code transcripts"})]}),o.jsxs("span",{className:"badge neutral",children:[Il(g.cost)," total"]})]}),o.jsxs("p",{className:"muted small",children:[g.runs," runs · ",g.sessions," sessions · ",g.agents," subagents · prices as of"," ",c.pricesUpdated,". Wall is elapsed; active drops gaps longer than"," ",Math.round((c.idleGapSeconds||120)/60)," min."]}),o.jsxs("div",{className:"usage-list",children:[o.jsxs("div",{className:"usage-row usage-head",children:[o.jsx("span",{children:"command"}),o.jsx("span",{className:"usage-num",children:"runs"}),o.jsx("span",{className:"usage-num",children:"$/run"}),o.jsx("span",{className:"usage-bar-head",children:"$ total"}),o.jsx("span",{className:"usage-num",children:"tok/run"}),o.jsx("span",{className:"usage-num",children:"wall"}),o.jsx("span",{className:"usage-num",title:"Elapsed minus idle gaps — the time the command was actually working.",children:"active"}),o.jsx("span",{className:"usage-num",title:"Median subagents per run. A build or review reporting 0 did no fan-out at all.",children:"agents"})]}),y.map(N=>{const A=Object.values(N.tokensPerRun||{}).reduce((M,T)=>M+T,0);return o.jsxs("div",{className:`usage-row${N.command==="(chat)"?" usage-chat":""}`,children:[o.jsx("span",{className:"usage-cmd",children:N.command}),o.jsx("span",{className:"usage-num",children:N.runs}),o.jsx("span",{className:"usage-num",children:Il(N.cost.perRun)}),o.jsxs("span",{className:"usage-bar",title:Il(N.cost.total),children:[o.jsx("span",{className:"usage-fill",style:{width:`${Math.max(2,N.cost.total/j*100)}%`}}),o.jsx("span",{className:"usage-bar-label",children:Il(N.cost.total)})]}),o.jsx("span",{className:"usage-num",children:vf(A)}),o.jsx("span",{className:"usage-num",children:Wa(N.wallS.p50)}),o.jsx("span",{className:"usage-num",children:Wa(N.activeS.p50)}),o.jsx("span",{className:"usage-num",children:N.agents.perRunP50})]},N.command)})]}),o.jsxs("p",{className:"muted small",children:[o.jsx("code",{children:"(chat)"})," is every turn that named no command. Attributing a command typed inside a sentence is a heuristic — a long message that merely discusses one is not counted as running it."]})]})}function yf({project:c,onClose:g,onChanged:d}){const[y,j]=Z.useState("confirm"),[N,A]=Z.useState(!1),[M,T]=Z.useState(""),[H,X]=Z.useState(null),B=Z.useRef(null);Z.useEffect(()=>{B.current&&(B.current.scrollTop=B.current.scrollHeight)},[M]);async function V(){j("running"),T("");try{const ee=await Qa({action:"reset",project:c,purgeSpecs:N},T);X(ee),j("done"),d&&d()}catch(ee){T(oe=>`${oe}
42
+ [error] ${ve.message}`),ee(1),H("done")}}const K=j?`claude -p "${j}" (cwd: ${y})`:`node cli.js ${g}${d==="global"?" --global":y?` ${y}`:""}`;return o.jsx("div",{className:"modal-backdrop",onClick:T!=="running"?A:void 0,children:o.jsxs("div",{className:"modal",onClick:ve=>ve.stopPropagation(),children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("h3",{children:c}),T==="done"&&o.jsx("span",{className:`badge ${V===0?"ok":"bad"}`,children:V===0?"success":V==null?"disconnected":`exit ${V}`})]}),T==="confirm"?o.jsxs(o.Fragment,{children:[N?o.jsx("div",{className:"confirm-text",children:N}):o.jsx("p",{className:"muted",children:"This runs the pipeline CLI and modifies files on disk:"}),o.jsx("pre",{className:"cmd",children:K}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"primary",onClick:$,children:"Run"}),o.jsx("button",{className:"ghost",onClick:A,children:"Cancel"})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"run-log",ref:oe,children:X||"…"}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"ghost",onClick:A,disabled:T==="running",children:T==="running"?"running…":"Close"})})]})]})})}function nf({core:c,onChanged:g}){const[d,y]=Z.useState(null);if(!c)return o.jsx("div",{className:"core-banner muted",children:"Loading core…"});const j=c.global||{},N=Mi({freshness:c.globalFreshness,latest:c.latest,installMode:j.present?"global":"none"});return o.jsxs("div",{className:"core-banner",children:[o.jsxs("div",{className:"cb-left",children:[o.jsx("span",{className:"cb-title",children:"Global core"}),o.jsx("span",{className:"cb-version mono",children:j.present?j.version:"not installed"}),o.jsx("span",{className:`badge ${N.cls}`,children:N.label}),o.jsxs("span",{className:"muted small",children:["npm latest ",c.latest||"—"]})]}),o.jsxs("div",{className:"cb-actions",children:[o.jsx("button",{className:"primary",onClick:()=>y("update"),children:"Update core…"}),!j.present&&o.jsx("button",{className:"ghost",onClick:()=>y("install"),children:"Install…"})]}),d&&o.jsx(Ka,{title:d==="update"?"Update global core":"Install global core",action:d,scope:"global",onClose:()=>y(null),onChanged:g})]})}function tf({onPick:c,onClose:g}){const[d,y]=Z.useState(null),[j,N]=Z.useState(null);async function A(M){try{N(null);const T=await ut("/api/browse"+(M?`?dir=${encodeURIComponent(M)}`:""));y(T),T.error&&N(T.error)}catch(T){N(T.message)}}return Z.useEffect(()=>{A()},[]),o.jsx("div",{className:"modal-backdrop",onClick:g,children:o.jsxs("div",{className:"modal picker",onClick:M=>M.stopPropagation(),children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("h3",{children:"Pick a project folder"}),d&&d.isProject&&o.jsx("span",{className:"badge ok",children:"pipeline project"})]}),o.jsx("div",{className:"picker-path mono small",children:d?d.dir:"loading…"}),j&&o.jsxs("div",{className:"add-error",children:["⚠ ",j]}),o.jsxs("div",{className:"picker-list",children:[d&&d.parent&&o.jsx("button",{className:"picker-row up",onClick:()=>A(d.parent),children:"↑ .."}),d&&d.dirs.length===0&&o.jsx("div",{className:"muted small picker-empty",children:"no sub-folders"}),d&&d.dirs.map(M=>o.jsxs("button",{className:"picker-row",onClick:()=>A(M.path),children:[o.jsx("span",{className:"picker-icon",children:M.isProject?"◆":"▸"}),o.jsx("span",{className:"picker-name",children:M.name}),M.isProject&&o.jsx("span",{className:"badge ok small",children:"project"})]},M.path))]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"primary",disabled:!d,onClick:()=>c(d.dir),children:"Add this folder"}),o.jsx("button",{className:"ghost",onClick:g,children:"Cancel"})]})]})})}function rf({fleet:c,core:g,error:d,onOpen:y,onChanged:j}){const[N,A]=Z.useState(""),[M,T]=Z.useState(!1),[H,X]=Z.useState(null),[B,V]=Z.useState(!1);async function ee($){if(!(!$||!$.trim())){T(!0),X(null);try{await Ua("/api/projects","POST",{path:$.trim()}),A(""),j()}catch(K){X(K.message)}finally{T(!1)}}}async function oe($){try{await Ua("/api/projects","DELETE",{path:$}),j()}catch(K){X(K.message)}}return o.jsxs("main",{className:"fleet",children:[o.jsx(nf,{core:g,onChanged:j}),o.jsxs("div",{className:"fleet-head",children:[o.jsxs("h2",{children:["Tracked projects ",c&&o.jsx("span",{className:"badge neutral",children:c.length})]}),o.jsxs("div",{className:"add-wrap",children:[o.jsxs("form",{className:"add-form",onSubmit:$=>{$.preventDefault(),ee(N)},children:[o.jsx("input",{className:`path-input${H?" invalid":""}`,placeholder:"/absolute/path/to/a/pipeline/project",value:N,onChange:$=>{A($.target.value),H&&X(null)}}),o.jsx("button",{className:"ghost",type:"button",onClick:()=>V(!0),children:"Browse…"}),o.jsx("button",{className:"primary",type:"submit",disabled:M,children:M?"adding…":"+ add"})]}),H&&o.jsxs("div",{className:"add-error",children:["⚠ ",H]})]})]}),d&&o.jsxs("div",{className:"panel error",children:["API error — ",d]}),!c&&o.jsx("div",{className:"panel muted",children:"Loading fleet…"}),c&&c.length===0&&o.jsx("div",{className:"panel muted",children:"No projects tracked yet — add one above."}),o.jsx("div",{className:"fleet-grid",children:c&&c.map($=>o.jsx(ef,{p:$,onOpen:()=>y($.path),onRemove:()=>oe($.path)},$.path))}),B&&o.jsx(tf,{onClose:()=>V(!1),onPick:$=>{V(!1),ee($)}})]})}function lf({data:c}){if(!c)return o.jsxs("section",{className:"panel",children:[o.jsx("h2",{children:"Freshness"}),o.jsx("p",{className:"muted",children:"Loading…"})]});const{installedVersion:g,latest:d,freshness:y,installMode:j,pointer:N,global:A,bundled:M}=c,T=Mi({freshness:y,latest:d,installMode:j});return o.jsxs("section",{className:"panel",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Freshness"}),o.jsx("span",{className:`badge ${T.cls}`,children:T.label})]}),o.jsxs("div",{className:"rows",children:[o.jsx(Mt,{label:"Installed core",value:g||"—",strong:!0}),o.jsx(Mt,{label:"Latest on npm",value:d||"unreachable"}),o.jsx(Mt,{label:"Install mode",value:j}),A.present&&o.jsx(Mt,{label:"Global core",value:A.version,mono:!0}),M.present&&o.jsx(Mt,{label:"Bundled core",value:M.version,mono:!0}),N.present&&o.jsx(Mt,{label:"Repo pointer",value:`${N.mode||"?"} · core ${N.core_version||"?"}`,mono:!0})]}),y===-1&&o.jsxs("p",{className:"muted small fresh-hint",children:["→ run ",o.jsx("strong",{children:"Update-pipeline"})," (above) to refresh the core and reconcile this project."]})]})}function Mt({label:c,value:g,strong:d,mono:y}){return o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"row-label",children:c}),o.jsx("span",{className:`row-value${d?" strong":""}${y?" mono":""}`,children:g})]})}const sf={ok:"✓",warn:"!",bad:"✕",skip:"–"};function of({checks:c,summary:g}){return c?o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Health"}),o.jsxs("div",{className:"summary",children:[g.bad>0&&o.jsxs("span",{className:"badge bad",children:[g.bad," failing"]}),g.warn>0&&o.jsxs("span",{className:"badge warn",children:[g.warn," warning"]}),o.jsxs("span",{className:"badge ok",children:[g.ok," ok"]}),g.skip>0&&o.jsxs("span",{className:"badge neutral",children:[g.skip," n/a"]})]})]}),o.jsx("ul",{className:"checks",children:c.map(d=>o.jsxs("li",{className:`check ${d.status}`,children:[o.jsx("span",{className:`check-icon ${d.status}`,children:sf[d.status]}),o.jsxs("div",{className:"check-body",children:[o.jsxs("div",{className:"check-line",children:[o.jsx("span",{className:"check-label",children:d.label}),o.jsx("span",{className:"check-detail",children:d.detail})]}),d.fix&&o.jsxs("div",{className:"check-fix",children:["fix: ",o.jsx("code",{children:d.fix})]})]})]},d.id))})]}):o.jsxs("section",{className:"panel",children:[o.jsx("h2",{children:"Health"}),o.jsx("p",{className:"muted",children:"Loading…"})]})}function uf({profile:c}){if(!c)return o.jsxs("section",{className:"panel",children:[o.jsx("h2",{children:"Surfaces"}),o.jsxs("p",{className:"muted",children:["No PIPELINE.md profile — run ",o.jsx("code",{children:"/cohorte-init-pipeline"}),"."]})]});const g=c.surfaces||[];return o.jsxs("section",{className:"panel",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Surfaces ↔ agents"}),o.jsx("span",{className:"badge neutral",children:g.length})]}),c.one_liner&&o.jsx("p",{className:"muted small",style:{marginTop:0},children:c.one_liner}),o.jsx("div",{className:"surfaces",children:g.map(d=>o.jsxs("div",{className:"surface",children:[o.jsxs("div",{className:"surface-top",children:[o.jsx("span",{className:"surface-key",children:d.label||d.key}),d.model&&o.jsx("span",{className:`chip model-${d.model}`,children:d.model}),d.uses_design&&o.jsx("span",{className:"chip design",children:"design"})]}),o.jsxs("div",{className:"surface-meta",children:[o.jsxs("span",{className:"mono",children:["→ ",d.agent,".md"]}),o.jsx("span",{className:"muted mono",children:d.path})]}),Array.isArray(d.tools)&&o.jsx("div",{className:"surface-tools",children:d.tools.map(y=>o.jsx("span",{className:"tool",children:y},y))})]},d.key))})]})}const Va=[{key:"draft",label:"Draft"},{key:"frozen",label:"Frozen"},{key:"in-progress",label:"In progress"},{key:"in-review",label:"In review"},{key:"shipped",label:"Shipped"},{key:"blocked",label:"Blocked"}];function af({specs:c}){if(!c)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Specs board"}),o.jsx("p",{className:"muted",children:"Loading…"})]});const g={};for(const y of Va)g[y.key]=[];const d=[];for(const y of c)g[y.status]?g[y.status].push(y):d.push(y);return o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{children:"Specs board"}),o.jsx("span",{className:"badge neutral",children:c.length})]}),c.length===0?o.jsxs("p",{className:"muted",children:["No specs yet — run ",o.jsx("code",{children:"/cohorte-spec"})," to freeze one."]}):o.jsx("div",{className:"board-scroll",children:o.jsxs("div",{className:"board",children:[Va.map(y=>o.jsxs("div",{className:`col col-${y.key}`,children:[o.jsxs("div",{className:"col-head",children:[o.jsx("span",{children:y.label}),o.jsx("span",{className:"muted",children:g[y.key].length})]}),g[y.key].map(j=>o.jsx(Ba,{s:j},j.file))]},y.key)),d.length>0&&o.jsxs("div",{className:"col col-other",children:[o.jsxs("div",{className:"col-head",children:[o.jsx("span",{children:"Other"}),o.jsx("span",{className:"muted",children:d.length})]}),d.map(y=>o.jsx(Ba,{s:y,bad:!0},y.file))]})]})})]})}function Ba({s:c,bad:g}){return o.jsxs("div",{className:`spec-card${g?" bad":""}`,children:[o.jsx("div",{className:"spec-title",children:c.title||c.id}),o.jsxs("div",{className:"spec-meta muted small mono",children:[c.id,g&&c.status?` · status: ${c.status}`:""]}),c.loop&&o.jsxs("div",{className:"spec-loop muted small mono",children:["↻ left at pass ",c.loop.pass,c.loop.phase?` · /${c.loop.phase}`:""," by a retired driver"]}),c.branch&&o.jsxs("div",{className:"spec-branch muted small mono",children:["⑂ ",c.branch]})]})}function cf({data:c}){return!c||!c.enabled?null:o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{children:["Kanban ",o.jsx("span",{className:"muted small",children:"· obsidian"})]}),o.jsxs("span",{className:"badge neutral",title:c.boardRel,children:[c.total," cards"]})]}),o.jsx("div",{className:"board-scroll",children:o.jsx("div",{className:"kanban-board",children:c.columns.map(g=>o.jsxs("div",{className:`kanban-col${g.cards.length?"":" empty"}`,children:[o.jsxs("div",{className:"col-head",children:[o.jsx("span",{children:g.name}),o.jsx("span",{className:"muted",children:g.cards.length})]}),g.cards.map((d,y)=>o.jsx(ff,{card:d},y))]},g.name))})})]})}function df(c){try{return new Date(c).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return""}}function ff({card:c}){const g=c.prs||[],d=g.find(y=>y.state);return o.jsxs("div",{className:`kanban-card${c.done?" done":""}`,children:[o.jsx("div",{className:"kc-text",children:c.text}),(c.tags.length>0||g.length>0)&&o.jsxs("div",{className:"kc-tags",children:[g.map(y=>{const j=`kc-pr state-${(y.state||"unknown").toLowerCase()}${y.draft?" draft":""}`,N=`PR #${y.num}${y.inferred?" ≈":""}`;return y.url?o.jsx("a",{className:j,href:y.url,target:"_blank",rel:"noreferrer",title:y.inferred?"matched by branch":"",children:N},y.num):o.jsx("span",{className:`${j} flat`,children:N},y.num)}),c.tags.map(y=>o.jsxs("span",{className:"kc-tag",children:["#",y]},y))]}),d&&o.jsxs("div",{className:`kc-status state-${d.state.toLowerCase()}`,children:[d.draft?"draft":d.state.toLowerCase(),(d.mergedAt||d.createdAt)&&` · ${df(d.mergedAt||d.createdAt)}`]})]})}const Tl=["build","review","fix","smoke","cycle"];function Ha(c){if(c==null)return"—";if(c<60)return`${c}s`;const g=Math.floor(c/60);return g<60?`${g}m ${c%60?`${c%60}s`:""}`.trim():`${Math.floor(g/60)}h ${g%60}m`}function pf(c){const g=String(c).split(":")[0].trim().toLowerCase();return g===""||g==="skipped"?"neutral":g==="ok"||g==="ship"||g==="pass"?"ok":g==="revise"?"warn":"bad"}function mf({data:c}){if(!c)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Pipeline metrics"}),o.jsx("p",{className:"muted",children:"Loading…"})]});const g=c.features||[];return o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{children:["Pipeline metrics ",o.jsx("span",{className:"muted small",children:"· wall-clock per phase"})]}),c.present&&o.jsxs("span",{className:"badge neutral",children:[c.batches," batches"]})]}),!c.present||g.length===0?o.jsxs("p",{className:"muted",children:["No metrics yet — ",o.jsx("code",{children:"/cohorte-build"}),", ",o.jsx("code",{children:"/cohorte-review"})," and ",o.jsx("code",{children:"/cohorte-fix"})," ","append them to ",o.jsx("code",{children:".claude/pipeline-metrics.jsonl"}),"."]}):o.jsx("div",{className:"board-scroll",children:o.jsx("div",{className:"metrics-list",children:g.map(d=>o.jsx(hf,{f:d},d.feature))})})]})}function hf({f:c}){const g=Math.max(1,...Tl.map(y=>c.phases[y]?c.phases[y].seconds:0)),d=Object.keys(c.surfaces||{});return o.jsxs("div",{className:"metric-feature",children:[o.jsxs("div",{className:"mf-head",children:[o.jsx("span",{className:"mf-name",children:c.feature}),o.jsxs("span",{className:"mf-badges",children:[o.jsxs("span",{className:"badge neutral",children:["total ",Ha(c.totalSeconds)]}),o.jsxs("span",{className:`badge ${c.fixRounds>1?"warn":"neutral"}`,children:[c.fixRounds," fix round",c.fixRounds===1?"":"s"]}),c.cycleRounds>0&&o.jsxs("span",{className:"badge neutral",title:"verify→fix rounds inside the cycle workflow",children:["cycle ×",c.cycleRounds]})]})]}),o.jsx("div",{className:"phase-bars",children:Tl.map(y=>{const j=c.phases[y];return o.jsxs("div",{className:"phase-row",title:j?`${j.rounds} run${j.rounds===1?"":"s"}`:"not run",children:[o.jsx("span",{className:"phase-label",children:y}),o.jsx("span",{className:"phase-track",children:j&&o.jsx("span",{className:"phase-fill",style:{width:`${j.seconds/g*100}%`}})}),o.jsx("span",{className:"phase-value muted small",children:j?`${Ha(j.seconds)}${j.rounds>1?` ×${j.rounds}`:""}`:"—"})]},y)})}),d.length>0&&o.jsxs("table",{className:"surface-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"surface"}),Tl.map(y=>o.jsx("th",{children:y},y))]})}),o.jsx("tbody",{children:d.map(y=>o.jsxs("tr",{children:[o.jsx("td",{className:"st-key",children:y}),Tl.map(j=>{const N=c.surfaces[y].results[j];return o.jsx("td",{children:N==null?o.jsx("span",{className:"muted",children:"·"}):o.jsx("span",{className:`pill ${pf(N)}`,children:N})},j)})]},y))})]})]})}const Il=c=>c==null?"—":c>=100?`$${Math.round(c)}`:c>0&&c<.01?"<$0.01":`$${c.toFixed(2)}`,vf=c=>c==null?"—":c>=1e6?`${(c/1e6).toFixed(1)}M`:c>=1e3?`${Math.round(c/1e3)}k`:String(c),Wa=c=>c==null?"—":c>=3600?`${(c/3600).toFixed(1)}h`:c>=60?`${Math.round(c/60)}m`:`${Math.round(c)}s`;function gf({data:c}){if(!c)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Cost & runtime"}),o.jsx("p",{className:"muted",children:"Reading transcripts…"})]});if(!c.present)return o.jsxs("section",{className:"panel span2",children:[o.jsx("h2",{children:"Cost & runtime"}),o.jsxs("p",{className:"muted",children:[c.error||"No data."," Figures come from Claude Code's own transcripts in"," ",o.jsx("code",{children:"~/.claude/projects"})," — nothing to enable, but the project has to have been driven from this machine."]})]});const{totals:g,commands:d=[]}=c,y=[...d].sort((N,A)=>N.command==="(chat)"!=(A.command==="(chat)")?N.command==="(chat)"?1:-1:A.cost.total-N.cost.total),j=Math.max(...y.map(N=>N.cost.total),.01);return o.jsxs("section",{className:"panel span2",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{children:["Cost & runtime ",o.jsx("span",{className:"muted small",children:"· from Claude Code transcripts"})]}),o.jsxs("span",{className:"badge neutral",children:[Il(g.cost)," total"]})]}),o.jsxs("p",{className:"muted small",children:[g.runs," runs · ",g.sessions," sessions · ",g.agents," subagents · prices as of"," ",c.pricesUpdated,". Wall is elapsed; active drops gaps longer than"," ",Math.round((c.idleGapSeconds||120)/60)," min."]}),o.jsxs("div",{className:"usage-list",children:[o.jsxs("div",{className:"usage-row usage-head",children:[o.jsx("span",{children:"command"}),o.jsx("span",{className:"usage-num",children:"runs"}),o.jsx("span",{className:"usage-num",children:"$/run"}),o.jsx("span",{className:"usage-bar-head",children:"$ total"}),o.jsx("span",{className:"usage-num",children:"tok/run"}),o.jsx("span",{className:"usage-num",children:"wall"}),o.jsx("span",{className:"usage-num",title:"Elapsed minus idle gaps — the time the command was actually working.",children:"active"}),o.jsx("span",{className:"usage-num",title:"Median subagents per run. A build or review reporting 0 did no fan-out at all.",children:"agents"})]}),y.map(N=>{const A=Object.values(N.tokensPerRun||{}).reduce((M,T)=>M+T,0);return o.jsxs("div",{className:`usage-row${N.command==="(chat)"?" usage-chat":""}`,children:[o.jsx("span",{className:"usage-cmd",children:N.command}),o.jsx("span",{className:"usage-num",children:N.runs}),o.jsx("span",{className:"usage-num",children:Il(N.cost.perRun)}),o.jsxs("span",{className:"usage-bar",title:Il(N.cost.total),children:[o.jsx("span",{className:"usage-fill",style:{width:`${Math.max(2,N.cost.total/j*100)}%`}}),o.jsx("span",{className:"usage-bar-label",children:Il(N.cost.total)})]}),o.jsx("span",{className:"usage-num",children:vf(A)}),o.jsx("span",{className:"usage-num",children:Wa(N.wallS.p50)}),o.jsx("span",{className:"usage-num",children:Wa(N.activeS.p50)}),o.jsx("span",{className:"usage-num",children:N.agents.perRunP50})]},N.command)})]}),o.jsxs("p",{className:"muted small",children:[o.jsx("code",{children:"(chat)"})," is every turn that named no command. Attributing a command typed inside a sentence is a heuristic — a long message that merely discusses one is not counted as running it."]})]})}function yf({project:c,onClose:g,onChanged:d}){const[y,j]=Z.useState("confirm"),[N,A]=Z.useState(!1),[M,T]=Z.useState(""),[H,X]=Z.useState(null),B=Z.useRef(null);Z.useEffect(()=>{B.current&&(B.current.scrollTop=B.current.scrollHeight)},[M]);async function V(){j("running"),T("");try{const ee=await Qa({action:"reset",project:c,purgeSpecs:N},T);X(ee),j("done"),d&&d()}catch(ee){T(oe=>`${oe}
43
43
  [error] ${ee.message}`),X(1),j("done")}}return o.jsx("div",{className:"modal-backdrop",onClick:y!=="running"?g:void 0,children:o.jsxs("div",{className:"modal",onClick:ee=>ee.stopPropagation(),children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("h3",{children:"⚠ Reset pipeline"}),y==="done"&&o.jsx("span",{className:`badge ${H===0?"ok":"bad"}`,children:H===0?"done":H==null?"disconnected":`exit ${H}`})]}),y==="confirm"?o.jsxs(o.Fragment,{children:[o.jsxs("p",{children:["This wipes the project's pipeline footprint so it's managed ",o.jsx("strong",{children:"only"})," by the pipeline — removing any relics from old versions:"]}),o.jsxs("ul",{className:"reset-list",children:[o.jsxs("li",{children:[o.jsx("code",{children:".claude/"})," — core, rendered agents, gate-config, settings, pointer"]}),o.jsxs("li",{children:[o.jsx("code",{children:"PIPELINE.md"})," — the profile"]}),o.jsxs("li",{className:N?"":"muted",children:[o.jsx("code",{children:"specs/"})," — ",N?"will be removed too":"kept"]})]}),o.jsxs("p",{className:"reset-note",children:["Everything is first backed up to ",o.jsx("code",{children:".claude.bak-<timestamp>/"})," (reversible). The shared ",o.jsx("code",{children:"~/.claude"})," global core is never touched. Afterwards, run",o.jsx("code",{children:" /cohorte-init-pipeline"})," in Claude Code to regenerate the profile."]}),o.jsxs("label",{className:"reset-check",children:[o.jsx("input",{type:"checkbox",checked:N,onChange:ee=>A(ee.target.checked)}),"Also remove ",o.jsx("code",{children:"specs/"})," (your authored specs — kept in the backup)"]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"danger",onClick:V,children:"Reset pipeline"}),o.jsx("button",{className:"ghost",onClick:g,children:"Cancel"})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"run-log",ref:B,children:M||"…"}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"ghost",onClick:g,disabled:y==="running",children:y==="running"?"running…":"Close"})})]})]})})}const xf=o.jsxs("div",{children:[o.jsxs("p",{children:[o.jsx("strong",{children:"Runs Claude Code headless"})," (",o.jsx("code",{children:'claude -p "/cohorte-init-pipeline"'}),") in this project, autonomously (no permission prompts). It ",o.jsx("strong",{children:"consumes tokens"})," and needs the",o.jsx("code",{children:" claude"})," CLI authenticated."]}),o.jsxs("p",{className:"warn-line",children:["⚠ Headless skips the interactive interview — Claude ",o.jsx("strong",{children:"guesses"})," your stack, surfaces and gate instead of asking. ",o.jsxs("strong",{children:["Review the generated ",o.jsx("code",{children:"PIPELINE.md"})]}),"afterwards."]})]}),kf=o.jsx("div",{children:o.jsxs("p",{children:[o.jsx("strong",{children:"Runs Claude Code headless"})," (",o.jsx("code",{children:'claude -p "/cohorte-update-pipeline"'}),") in this project, autonomously. It refreshes the core and reconciles the generated files (re-renders agents, patches settings). ",o.jsx("strong",{children:"Consumes tokens"}),"; needs the ",o.jsx("code",{children:"claude"})," CLI authenticated."]})}),wf=o.jsxs("div",{children:[o.jsxs("p",{children:[o.jsx("strong",{children:"Runs Claude Code headless"})," (",o.jsx("code",{children:'claude -p "/cohorte-audit"'}),") in this project, autonomously (no permission prompts). It runs the mechanical gates + a convention/TDD audit and writes the prioritized backlog to ",o.jsx("code",{children:"specs/refactor-backlog.md"}),". Read-only on your source.",o.jsx("strong",{children:" Consumes tokens"})," (it dispatches agents); needs the ",o.jsx("code",{children:"claude"})," CLI authenticated."]}),o.jsxs("p",{className:"warn-line",children:["⚠ Headless means the run ",o.jsx("strong",{children:"starts without any prompt"})," and cannot ask you anything mid-run — and there is ",o.jsx("strong",{children:"no resume"}),": if the session dies, the run is gone (re-launch it). Prefer running ",o.jsx("code",{children:"/cohorte-audit"})," in a Claude Code session for anything you want to steer."]})]});function Sf({project:c}){const[g,d]=Z.useState(null),[y,j]=Z.useState(null),[N,A]=Z.useState(null),[M,T]=Z.useState(null),[H,X]=Z.useState(!1),[B,V]=Z.useState(null),[ee,oe]=Z.useState(null);async function $(){const we=encodeURIComponent(c),[ge,De,Se,Ce]=await Promise.allSettled([ut(`/api/state?project=${we}`),ut(`/api/kanban?project=${we}`),ut(`/api/metrics?project=${we}`),ut(`/api/usage?project=${we}`)]);ge.status==="fulfilled"?(d(ge.value),T(null)):T(ge.reason.message),j(De.status==="fulfilled"?De.value:{enabled:!1}),A(Se.status==="fulfilled"?Se.value:{present:!1,features:[],batches:0}),oe(Ce.status==="fulfilled"?Ce.value:{present:!1,error:"collector unreachable"})}Z.useEffect(()=>{d(null),j(null),A(null),oe(null),$();const we=setInterval($,15e3);return()=>clearInterval(we)},[c]);const K=g&&g.versions,ve=!!(g&&g.profile),Oe=ve||!!(K&&(K.bundled.present||K.pointer.present));return o.jsxs("main",{className:"grid",children:[o.jsxs("div",{className:"detail-crumb",children:[o.jsx("span",{className:"muted small mono",children:c}),g&&o.jsxs("div",{className:"detail-tools",children:[!ve&&o.jsx("button",{className:"tool-btn",onClick:()=>V({title:"Init pipeline (headless Claude)",command:"/cohorte-init-pipeline",confirmText:xf}),children:"Init-pipeline…"}),ve&&o.jsx("button",{className:"tool-btn",onClick:()=>V({title:"Update pipeline (headless Claude)",command:"/cohorte-update-pipeline",confirmText:kf}),children:"Update-pipeline…"}),ve&&o.jsx("button",{className:"tool-btn",onClick:()=>V({title:"Audit (headless Claude)",command:"/cohorte-audit",confirmText:wf}),children:"Audit…"}),Oe&&o.jsx("button",{className:"danger-ghost",onClick:()=>X(!0),children:"Reset pipeline…"})]})]}),M&&o.jsxs("div",{className:"panel error",children:["API error — ",M]}),!g&&!M&&o.jsx("div",{className:"panel muted",children:"Loading pipeline state…"}),o.jsx(lf,{data:g&&g.versions}),o.jsx(uf,{profile:g&&g.profile}),o.jsx(of,{checks:g&&g.checks,summary:g&&g.summary}),o.jsx(cf,{data:y}),y&&!y.enabled&&o.jsx(af,{specs:g&&g.specs}),o.jsx(gf,{data:ee}),o.jsx(mf,{data:N}),H&&o.jsx(yf,{project:c,onClose:()=>X(!1),onChanged:$}),B&&o.jsx(Ka,{title:B.title,action:"claude",command:B.command,confirmText:B.confirmText,project:c,onClose:()=>V(null),onChanged:$})]})}function jf(){const[c,g]=Z.useState(null),[d,y]=Z.useState(null),[j,N]=Z.useState(null),[A,M]=Z.useState(null);async function T(){try{M(null);const[H,X]=await Promise.all([ut("/api/fleet"),ut("/api/versions")]);g(H.projects),y(X)}catch(H){M(H.message)}}return Z.useEffect(()=>{if(j)return;T();const H=setInterval(T,15e3);return()=>clearInterval(H)},[j]),o.jsxs("div",{className:"app",children:[o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"brand",onClick:()=>N(null),style:{cursor:"pointer"},children:[o.jsx("span",{className:"dot"}),"cohorte ",o.jsx("span",{className:"muted",children:"· dashboard"})]}),j&&o.jsx("button",{className:"ghost",onClick:()=>N(null),children:"← all projects"})]}),j?o.jsx(Sf,{project:j}):o.jsx(rf,{fleet:c,core:d,error:A,onOpen:N,onChanged:T})]})}bd.createRoot(document.getElementById("root")).render(o.jsx(Yd.StrictMode,{children:o.jsx(jf,{})}));
@@ -7,7 +7,7 @@
7
7
  <link rel="icon" type="image/png" sizes="16x16" href="./favicon-16.png" />
8
8
  <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180.png" />
9
9
  <title>cohorte · dashboard</title>
10
- <script type="module" crossorigin src="./assets/index-D1rsbLat.js"></script>
10
+ <script type="module" crossorigin src="./assets/index-DO3_nq2Q.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-BZ_LQlEj.css">
12
12
  </head>
13
13
  <body>
@@ -106,7 +106,13 @@ function checkAgents(profile, projectRoot, layout) {
106
106
  let files = [];
107
107
  try { files = fs.readdirSync(agentsDir).filter(f => f.endsWith('.md')).map(f => f.slice(0, -3)); }
108
108
  catch { /* dir absent → handled by `missing` */ }
109
- const orphans = files.filter(f => !FIXED_AGENTS.has(f) && !surfaceAgents.includes(f));
109
+ // Orphan detection only makes sense against a PROJECT agents dir. A global install's
110
+ // agents dir (~/.claude/agents) is the user's shared Claude Code space — their personal
111
+ // agents and other cohorte projects' surface agents live there legitimately, and
112
+ // flagging them sent humans deleting files that were not this project's to judge.
113
+ const orphans = layout.scope === 'global'
114
+ ? []
115
+ : files.filter(f => !FIXED_AGENTS.has(f) && !surfaceAgents.includes(f));
110
116
 
111
117
  if (missing.length) {
112
118
  return mk('agents', 'Surfaces ↔ agents', 'bad',
@@ -376,7 +382,7 @@ function checkWorkflows(projectRoot, globalDir, installMode, all) {
376
382
  }
377
383
  const dir = path.join(cc.core, 'workflows');
378
384
  const agentsDir = cc.agents;
379
- const scripts = ['review.js', 'audit.js', 'refactor.js'];
385
+ const scripts = ['review.js', 'audit.js', 'refactor.js', 'loop.js'];
380
386
  const missing = scripts.filter(s => !exists(path.join(dir, s)));
381
387
  if (missing.length === scripts.length) {
382
388
  return mk('workflows', 'Workflows', 'warn',
@@ -116,7 +116,12 @@ function runAction(req, res, body, { pkgRoot }) {
116
116
  // target — so an unchecked path silently creates a pipeline tree in a directory
117
117
  // that does not exist (a typo in the fleet registry lands a phantom project on
118
118
  // disk). The other two runners already validate; this one never did.
119
- if (scope !== 'global' && project && !fs.existsSync(path.resolve(project))) {
119
+ if (scope !== 'global' && !project) {
120
+ // Without a target, cli.js would run against its own cwd — the cohorte package
121
+ // checkout itself, which is never the project the caller meant.
122
+ return sendJson(res, 400, { error: 'a project path is required for a project-scope action' });
123
+ }
124
+ if (scope !== 'global' && !fs.existsSync(path.resolve(project))) {
120
125
  return sendJson(res, 400, { error: `project path not found: ${project}` });
121
126
  }
122
127