mover-os 4.7.8 → 4.7.9
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.
- package/README.md +34 -24
- package/install.js +2197 -200
- package/package.json +1 -1
- package/src/dashboard/build.js +41 -3
- package/src/dashboard/lib/active-context-parser.js +16 -4
- package/src/dashboard/lib/agent-session.js +70 -49
- package/src/dashboard/lib/approval-registry.js +170 -0
- package/src/dashboard/lib/daily-note-resolver.js +20 -3
- package/src/dashboard/lib/date-utils.js +9 -1
- package/src/dashboard/lib/distribution-parser.js +69 -10
- package/src/dashboard/lib/drift-history.js +6 -1
- package/src/dashboard/lib/engine-default-fingerprints.json +53 -0
- package/src/dashboard/lib/engine-health.js +4 -1
- package/src/dashboard/lib/engine-writer.js +157 -11
- package/src/dashboard/lib/goal-forecast.js +154 -31
- package/src/dashboard/lib/library-indexer-v2.js +14 -0
- package/src/dashboard/lib/library-search.js +290 -0
- package/src/dashboard/lib/log-activation.sh +0 -0
- package/src/dashboard/lib/memory-index.js +61 -12
- package/src/dashboard/lib/pid-markers.js +80 -0
- package/src/dashboard/lib/regenerate-manifest.js +0 -0
- package/src/dashboard/lib/run-registry.js +75 -15
- package/src/dashboard/lib/state-core/backfill.js +298 -0
- package/src/dashboard/lib/state-core/dryrun.js +188 -0
- package/src/dashboard/lib/state-core/event-log.js +615 -0
- package/src/dashboard/lib/state-core/events.js +265 -0
- package/src/dashboard/lib/state-core/projections.js +376 -0
- package/src/dashboard/lib/state-core/start-close.js +162 -0
- package/src/dashboard/lib/state-core/trial.js +96 -0
- package/src/dashboard/lib/strategy-parser.js +3 -0
- package/src/dashboard/lib/suggested-now.js +2 -2
- package/src/dashboard/lib/transcript-parser.js +48 -8
- package/src/dashboard/server.js +422 -44
- package/src/dashboard/shortcut.js +0 -0
- package/src/dashboard/ui/dist/assets/index-ByVKPvLf.js +34 -0
- package/src/dashboard/ui/dist/assets/index-CCoKjUcC.js +161 -0
- package/src/dashboard/ui/dist/assets/index-CZWNQDt5.css +1 -0
- package/src/dashboard/ui/dist/index.html +2 -2
- package/src/dashboard/ui/dist/sw.js +1 -1
- package/src/dashboard/ui/dist/assets/index-598CSGOZ.js +0 -157
- package/src/dashboard/ui/dist/assets/index-BP--M69H.css +0 -1
- package/src/dashboard/ui/dist/assets/index-CidzmwSW.js +0 -34
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import{r as il}from"./index-ByVKPvLf.js";import{g as Ka}from"./xterm-CqkleIqs.js";var dt={exports:{}},jn={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Rs;function ll(){if(Rs)return jn;Rs=1;var n=il(),t=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(o,c,d){var u,h={},p=null,m=null;d!==void 0&&(p=""+d),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(m=c.ref);for(u in c)a.call(c,u)&&!i.hasOwnProperty(u)&&(h[u]=c[u]);if(o&&o.defaultProps)for(u in c=o.defaultProps,c)h[u]===void 0&&(h[u]=c[u]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:r.current}}return jn.Fragment=s,jn.jsx=l,jn.jsxs=l,jn}var Es;function ol(){return Es||(Es=1,dt.exports=ll()),dt.exports}var e=ol();const cl=`
|
|
10
|
+
.twk-panel{position:fixed;right:16px;bottom:16px;z-index:2147483646;width:280px;
|
|
11
|
+
max-height:calc(100vh - 32px);display:flex;flex-direction:column;
|
|
12
|
+
transform:scale(var(--dc-inv-zoom,1));transform-origin:bottom right;
|
|
13
|
+
background:rgba(250,249,247,.78);color:#29261b;
|
|
14
|
+
-webkit-backdrop-filter:blur(24px) saturate(160%);backdrop-filter:blur(24px) saturate(160%);
|
|
15
|
+
border:.5px solid rgba(255,255,255,.6);border-radius:14px;
|
|
16
|
+
box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 12px 40px rgba(0,0,0,.18);
|
|
17
|
+
font:11.5px/1.4 ui-sans-serif,system-ui,-apple-system,sans-serif;overflow:hidden}
|
|
18
|
+
.twk-hd{display:flex;align-items:center;justify-content:space-between;
|
|
19
|
+
padding:10px 8px 10px 14px;cursor:move;user-select:none}
|
|
20
|
+
.twk-hd b{font-size:12px;font-weight:600;letter-spacing:.01em}
|
|
21
|
+
.twk-x{appearance:none;border:0;background:transparent;color:rgba(41,38,27,.55);
|
|
22
|
+
width:22px;height:22px;border-radius:6px;cursor:default;font-size:13px;line-height:1}
|
|
23
|
+
.twk-x:hover{background:rgba(0,0,0,.06);color:#29261b}
|
|
24
|
+
.twk-body{padding:2px 14px 14px;display:flex;flex-direction:column;gap:10px;
|
|
25
|
+
overflow-y:auto;overflow-x:hidden;min-height:0;
|
|
26
|
+
scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.15) transparent}
|
|
27
|
+
.twk-body::-webkit-scrollbar{width:8px}
|
|
28
|
+
.twk-body::-webkit-scrollbar-track{background:transparent;margin:2px}
|
|
29
|
+
.twk-body::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:4px;
|
|
30
|
+
border:2px solid transparent;background-clip:content-box}
|
|
31
|
+
.twk-body::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25);
|
|
32
|
+
border:2px solid transparent;background-clip:content-box}
|
|
33
|
+
.twk-row{display:flex;flex-direction:column;gap:5px}
|
|
34
|
+
.twk-row-h{flex-direction:row;align-items:center;justify-content:space-between;gap:10px}
|
|
35
|
+
.twk-lbl{display:flex;justify-content:space-between;align-items:baseline;
|
|
36
|
+
color:rgba(41,38,27,.72)}
|
|
37
|
+
.twk-lbl>span:first-child{font-weight:500}
|
|
38
|
+
.twk-val{color:rgba(41,38,27,.5);font-variant-numeric:tabular-nums}
|
|
39
|
+
|
|
40
|
+
.twk-sect{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;
|
|
41
|
+
color:rgba(41,38,27,.45);padding:10px 0 0}
|
|
42
|
+
.twk-sect:first-child{padding-top:0}
|
|
43
|
+
|
|
44
|
+
.twk-field{appearance:none;box-sizing:border-box;width:100%;min-width:0;height:26px;padding:0 8px;
|
|
45
|
+
border:.5px solid rgba(0,0,0,.1);border-radius:7px;
|
|
46
|
+
background:rgba(255,255,255,.6);color:inherit;font:inherit;outline:none}
|
|
47
|
+
.twk-field:focus{border-color:rgba(0,0,0,.25);background:rgba(255,255,255,.85)}
|
|
48
|
+
select.twk-field{padding-right:22px;
|
|
49
|
+
background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='rgba(0,0,0,.5)' d='M0 0h10L5 6z'/></svg>");
|
|
50
|
+
background-repeat:no-repeat;background-position:right 8px center}
|
|
51
|
+
|
|
52
|
+
.twk-slider{appearance:none;-webkit-appearance:none;width:100%;height:4px;margin:6px 0;
|
|
53
|
+
border-radius:999px;background:rgba(0,0,0,.12);outline:none}
|
|
54
|
+
.twk-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;
|
|
55
|
+
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
56
|
+
border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default}
|
|
57
|
+
.twk-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%;
|
|
58
|
+
background:#fff;border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default}
|
|
59
|
+
|
|
60
|
+
.twk-seg{position:relative;display:flex;padding:2px;border-radius:8px;
|
|
61
|
+
background:rgba(0,0,0,.06);user-select:none}
|
|
62
|
+
.twk-seg-thumb{position:absolute;top:2px;bottom:2px;border-radius:6px;
|
|
63
|
+
background:rgba(255,255,255,.9);box-shadow:0 1px 2px rgba(0,0,0,.12);
|
|
64
|
+
transition:left .15s cubic-bezier(.3,.7,.4,1),width .15s}
|
|
65
|
+
.twk-seg.dragging .twk-seg-thumb{transition:none}
|
|
66
|
+
.twk-seg button{appearance:none;position:relative;z-index:1;flex:1;border:0;
|
|
67
|
+
background:transparent;color:inherit;font:inherit;font-weight:500;min-height:22px;
|
|
68
|
+
border-radius:6px;cursor:default;padding:4px 6px;line-height:1.2;
|
|
69
|
+
overflow-wrap:anywhere}
|
|
70
|
+
|
|
71
|
+
.twk-toggle{position:relative;width:32px;height:18px;border:0;border-radius:999px;
|
|
72
|
+
background:rgba(0,0,0,.15);transition:background .15s;cursor:default;padding:0}
|
|
73
|
+
.twk-toggle[data-on="1"]{background:#34c759}
|
|
74
|
+
.twk-toggle i{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;
|
|
75
|
+
background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .15s}
|
|
76
|
+
.twk-toggle[data-on="1"] i{transform:translateX(14px)}
|
|
77
|
+
|
|
78
|
+
.twk-num{display:flex;align-items:center;box-sizing:border-box;min-width:0;height:26px;padding:0 0 0 8px;
|
|
79
|
+
border:.5px solid rgba(0,0,0,.1);border-radius:7px;background:rgba(255,255,255,.6)}
|
|
80
|
+
.twk-num-lbl{font-weight:500;color:rgba(41,38,27,.6);cursor:ew-resize;
|
|
81
|
+
user-select:none;padding-right:8px}
|
|
82
|
+
.twk-num input{flex:1;min-width:0;height:100%;border:0;background:transparent;
|
|
83
|
+
font:inherit;font-variant-numeric:tabular-nums;text-align:right;padding:0 8px 0 0;
|
|
84
|
+
outline:none;color:inherit;-moz-appearance:textfield}
|
|
85
|
+
.twk-num input::-webkit-inner-spin-button,.twk-num input::-webkit-outer-spin-button{
|
|
86
|
+
-webkit-appearance:none;margin:0}
|
|
87
|
+
.twk-num-unit{padding-right:8px;color:rgba(41,38,27,.45)}
|
|
88
|
+
|
|
89
|
+
.twk-btn{appearance:none;height:26px;padding:0 12px;border:0;border-radius:7px;
|
|
90
|
+
background:rgba(0,0,0,.78);color:#fff;font:inherit;font-weight:500;cursor:default}
|
|
91
|
+
.twk-btn:hover{background:rgba(0,0,0,.88)}
|
|
92
|
+
.twk-btn.secondary{background:rgba(0,0,0,.06);color:inherit}
|
|
93
|
+
.twk-btn.secondary:hover{background:rgba(0,0,0,.1)}
|
|
94
|
+
|
|
95
|
+
.twk-swatch{appearance:none;-webkit-appearance:none;width:56px;height:22px;
|
|
96
|
+
border:.5px solid rgba(0,0,0,.1);border-radius:6px;padding:0;cursor:default;
|
|
97
|
+
background:transparent;flex-shrink:0}
|
|
98
|
+
.twk-swatch::-webkit-color-swatch-wrapper{padding:0}
|
|
99
|
+
.twk-swatch::-webkit-color-swatch{border:0;border-radius:5.5px}
|
|
100
|
+
.twk-swatch::-moz-color-swatch{border:0;border-radius:5.5px}
|
|
101
|
+
|
|
102
|
+
.twk-chips{display:flex;gap:6px}
|
|
103
|
+
.twk-chip{position:relative;appearance:none;flex:1;min-width:0;height:46px;
|
|
104
|
+
padding:0;border:0;border-radius:6px;overflow:hidden;cursor:default;
|
|
105
|
+
box-shadow:0 0 0 .5px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.06);
|
|
106
|
+
transition:transform .12s cubic-bezier(.3,.7,.4,1),box-shadow .12s}
|
|
107
|
+
.twk-chip:hover{transform:translateY(-1px);
|
|
108
|
+
box-shadow:0 0 0 .5px rgba(0,0,0,.18),0 4px 10px rgba(0,0,0,.12)}
|
|
109
|
+
.twk-chip[data-on="1"]{box-shadow:0 0 0 1.5px rgba(0,0,0,.85),
|
|
110
|
+
0 2px 6px rgba(0,0,0,.15)}
|
|
111
|
+
.twk-chip>span{position:absolute;top:0;bottom:0;right:0;width:34%;
|
|
112
|
+
display:flex;flex-direction:column;box-shadow:-1px 0 0 rgba(0,0,0,.1)}
|
|
113
|
+
.twk-chip>span>i{flex:1;box-shadow:0 -1px 0 rgba(0,0,0,.1)}
|
|
114
|
+
.twk-chip>span>i:first-child{box-shadow:none}
|
|
115
|
+
.twk-chip svg{position:absolute;top:6px;left:6px;width:13px;height:13px;
|
|
116
|
+
filter:drop-shadow(0 1px 1px rgba(0,0,0,.3))}
|
|
117
|
+
`;function dl(n){const[t,s]=React.useState(n),a=React.useCallback((r,i)=>{const l=typeof r=="object"&&r!==null?r:{[r]:i};s(o=>({...o,...l})),window.parent.postMessage({type:"__edit_mode_set_keys",edits:l},"*"),window.dispatchEvent(new CustomEvent("tweakchange",{detail:l}))},[]);return[t,a]}function ul({title:n="Tweaks",children:t}){const[s,a]=React.useState(!1),r=React.useRef(null),i=React.useRef({x:16,y:16}),l=React.useRef(null);React.useEffect(()=>()=>{l.current&&l.current()},[]);const o=16,c=React.useCallback(()=>{const h=r.current;if(!h)return;const p=h.offsetWidth,m=h.offsetHeight,g=Math.max(o,window.innerWidth-p-o),f=Math.max(o,window.innerHeight-m-o);i.current={x:Math.min(g,Math.max(o,i.current.x)),y:Math.min(f,Math.max(o,i.current.y))},h.style.right=i.current.x+"px",h.style.bottom=i.current.y+"px"},[]);React.useEffect(()=>{if(!s)return;if(c(),typeof ResizeObserver>"u")return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c);const h=new ResizeObserver(c);return h.observe(document.documentElement),()=>h.disconnect()},[s,c]),React.useEffect(()=>{const h=p=>{const m=p?.data?.type;m==="__activate_edit_mode"?a(!0):m==="__deactivate_edit_mode"&&a(!1)};return window.addEventListener("message",h),window.parent.postMessage({type:"__edit_mode_available"},"*"),()=>window.removeEventListener("message",h)},[]);const d=()=>{a(!1),window.parent.postMessage({type:"__edit_mode_dismissed"},"*")},u=h=>{const p=r.current;if(!p)return;const m=p.getBoundingClientRect(),g=h.clientX,f=h.clientY,v=window.innerWidth-m.right,x=window.innerHeight-m.bottom,b=A=>{i.current={x:v-(A.clientX-g),y:x-(A.clientY-f)},c()},j=()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",j),l.current=null};l.current=j,window.addEventListener("mousemove",b),window.addEventListener("mouseup",j)};return s?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:cl}),e.jsxs("div",{ref:r,className:"twk-panel","data-omelette-chrome":"",style:{right:i.current.x,bottom:i.current.y},children:[e.jsxs("div",{className:"twk-hd",onMouseDown:u,children:[e.jsx("b",{children:n}),e.jsx("button",{className:"twk-x","aria-label":"Close tweaks",onMouseDown:h=>h.stopPropagation(),onClick:d,children:"✕"})]}),e.jsx("div",{className:"twk-body",children:t})]})]}):null}function hl({label:n,children:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"twk-sect",children:n}),t]})}function yn({label:n,value:t,children:s,inline:a=!1}){return e.jsxs("div",{className:a?"twk-row twk-row-h":"twk-row",children:[e.jsxs("div",{className:"twk-lbl",children:[e.jsx("span",{children:n}),t!=null&&e.jsx("span",{className:"twk-val",children:t})]}),s]})}function ml({label:n,value:t,min:s=0,max:a=100,step:r=1,unit:i="",onChange:l}){return e.jsx(yn,{label:n,value:`${t}${i}`,children:e.jsx("input",{type:"range",className:"twk-slider",min:s,max:a,step:r,value:t,onChange:o=>l(Number(o.target.value))})})}function pl({label:n,value:t,onChange:s}){return e.jsxs("div",{className:"twk-row twk-row-h",children:[e.jsx("div",{className:"twk-lbl",children:e.jsx("span",{children:n})}),e.jsx("button",{type:"button",className:"twk-toggle","data-on":t?"1":"0",role:"switch","aria-checked":!!t,onClick:()=>s(!t),children:e.jsx("i",{})})]})}function fl({label:n,value:t,options:s,onChange:a}){const r=React.useRef(null),[i,l]=React.useState(!1),o=React.useRef(t);o.current=t;const c=React.useRef(null);React.useEffect(()=>()=>{c.current&&c.current()},[]);const d=x=>String(typeof x=="object"?x.label:x).length;if(!(s.reduce((x,b)=>Math.max(x,d(b)),0)<=({2:16,3:10}[s.length]??0))){const x=b=>{const j=s.find(A=>String(typeof A=="object"?A.value:A)===b);return j===void 0?b:typeof j=="object"?j.value:j};return e.jsx(Ja,{label:n,value:t,options:s,onChange:b=>a(x(b))})}const p=s.map(x=>typeof x=="object"?x:{value:x,label:x}),m=Math.max(0,p.findIndex(x=>x.value===t)),g=p.length,f=x=>{const b=r.current.getBoundingClientRect(),j=b.width-4,A=Math.floor((x-b.left-2)/j*g);return p[Math.max(0,Math.min(g-1,A))].value},v=x=>{l(!0);const b=f(x.clientX);b!==o.current&&a(b);const j=I=>{if(!r.current)return;const k=f(I.clientX);k!==o.current&&a(k)},A=()=>{l(!1),window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",A),c.current=null};c.current=A,window.addEventListener("pointermove",j),window.addEventListener("pointerup",A)};return e.jsx(yn,{label:n,children:e.jsxs("div",{ref:r,role:"radiogroup",onPointerDown:v,className:i?"twk-seg dragging":"twk-seg",children:[e.jsx("div",{className:"twk-seg-thumb",style:{left:`calc(2px + ${m} * (100% - 4px) / ${g})`,width:`calc((100% - 4px) / ${g})`}}),p.map(x=>e.jsx("button",{type:"button",role:"radio","aria-checked":x.value===t,children:x.label},x.value))]})})}function Ja({label:n,value:t,options:s,onChange:a}){return e.jsx(yn,{label:n,children:e.jsx("select",{className:"twk-field",value:t,onChange:r=>a(r.target.value),children:s.map(r=>{const i=typeof r=="object"?r.value:r,l=typeof r=="object"?r.label:r;return e.jsx("option",{value:i,children:l},i)})})})}function gl({label:n,value:t,placeholder:s,onChange:a}){return e.jsx(yn,{label:n,children:e.jsx("input",{className:"twk-field",type:"text",value:t,placeholder:s,onChange:r=>a(r.target.value)})})}function xl({label:n,value:t,min:s,max:a,step:r=1,unit:i="",onChange:l}){const o=h=>s!=null&&h<s?s:a!=null&&h>a?a:h,c=React.useRef({x:0,val:0}),d=React.useRef(null);React.useEffect(()=>()=>{d.current&&d.current()},[]);const u=h=>{h.preventDefault(),c.current={x:h.clientX,val:t};const p=(String(r).split(".")[1]||"").length,m=f=>{const v=f.clientX-c.current.x,x=c.current.val+v*r,b=Math.round(x/r)*r;l(o(Number(b.toFixed(p))))},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g),d.current=null};d.current=g,window.addEventListener("pointermove",m),window.addEventListener("pointerup",g)};return e.jsxs("div",{className:"twk-num",children:[e.jsx("span",{className:"twk-num-lbl",onPointerDown:u,children:n}),e.jsx("input",{type:"number",value:t,min:s,max:a,step:r,onChange:h=>l(o(Number(h.target.value)))}),i&&e.jsx("span",{className:"twk-num-unit",children:i})]})}function yl(n){const t=String(n).replace("#",""),s=t.length===3?t.replace(/./g,o=>o+o):t.padEnd(6,"0"),a=parseInt(s.slice(0,6),16);if(Number.isNaN(a))return!0;const r=a>>16&255,i=a>>8&255,l=a&255;return r*299+i*587+l*114>148e3}const vl=({light:n})=>e.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:e.jsx("path",{d:"M3 7.2 5.8 10 11 4.2",fill:"none",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",stroke:n?"rgba(0,0,0,.78)":"#fff"})});function wl({label:n,value:t,options:s,onChange:a}){if(!s||!s.length)return e.jsxs("div",{className:"twk-row twk-row-h",children:[e.jsx("div",{className:"twk-lbl",children:e.jsx("span",{children:n})}),e.jsx("input",{type:"color",className:"twk-swatch",value:t,onChange:l=>a(l.target.value)})]});const r=l=>String(JSON.stringify(l)).toLowerCase(),i=r(t);return e.jsx(yn,{label:n,children:e.jsx("div",{className:"twk-chips",role:"radiogroup",children:s.map((l,o)=>{const c=Array.isArray(l)?l:[l],[d,...u]=c,h=u.slice(0,4),p=r(l)===i;return e.jsxs("button",{type:"button",className:"twk-chip",role:"radio","aria-checked":p,"data-on":p?"1":"0","aria-label":c.join(", "),title:c.join(" · "),style:{background:d},onClick:()=>a(l),children:[h.length>0&&e.jsx("span",{children:h.map((m,g)=>e.jsx("i",{style:{background:m}},g))}),p&&e.jsx(vl,{light:yl(d)})]},o)})})})}function jl({label:n,onClick:t,secondary:s=!1}){return e.jsx("button",{type:"button",className:s?"twk-btn secondary":"twk-btn",onClick:t,children:n})}Object.assign(window,{useTweaks:dl,TweaksPanel:ul,TweakSection:hl,TweakRow:yn,TweakSlider:ml,TweakToggle:pl,TweakRadio:fl,TweakSelect:Ja,TweakText:gl,TweakNumber:xl,TweakColor:wl,TweakButton:jl});function kl(n,t){const[s,a]=React.useState(()=>{try{const i=localStorage.getItem(n);return i!==null?JSON.parse(i):t}catch{return t}}),r=React.useCallback(i=>{a(l=>{const o=typeof i=="function"?i(l):i;try{localStorage.setItem(n,JSON.stringify(o))}catch{}return o})},[n]);return[s,r]}function bl(n){const t=(n.textContent||"").replace(/\s+/g," ").trim();if(!t)return[];n.textContent="";const s=[];t.split(" ").forEach((l,o)=>{o&&n.appendChild(document.createTextNode(" "));const c=document.createElement("span");c.textContent=l,c.style.display="inline-block",n.appendChild(c),s.push(c)});const a=[];let r=null;s.forEach(l=>{const o=l.offsetTop;(r===null||Math.abs(o-r)>1)&&(a.push([]),r=o),a[a.length-1].push(l.textContent)}),n.textContent="";const i=[];return a.forEach((l,o)=>{const c=document.createElement("span");c.className="mrl-line";const d=document.createElement("span");d.className="mrl-inner",d.style.setProperty("--li",o),d.textContent=l.join(" "),c.appendChild(d),n.appendChild(c),i.push(d)}),i}function Nl({children:n,as:t="span",className:s="",onScroll:a=!1,delay:r=0,...i}){const l=t,o=React.useRef(null);return React.useLayoutEffect(()=>{const c=o.current;if(!c||document.documentElement.getAttribute("data-mmotion")==="off"||window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const h=c.innerHTML,p=bl(c);if(!p.length)return;r&&p.forEach(v=>{v.style.transitionDelay="calc("+r+"s + var(--li) * 0.1s)"}),c.classList.add("mrl-armed");let m=null,g=null;const f=()=>{o.current&&o.current.classList.add("mrl-in")};return a?(m=new IntersectionObserver(v=>{v.forEach(x=>{x.isIntersecting&&(f(),m&&m.disconnect())})},{threshold:0,rootMargin:"0px 0px -20% 0px"}),m.observe(c),g=setTimeout(f,3e3)):(c.offsetHeight,f()),()=>{m&&m.disconnect(),g&&clearTimeout(g),c&&(c.classList.remove("mrl-armed","mrl-in"),c.innerHTML=h)}},[typeof n=="string"?n:String(n),a,r]),e.jsx(l,{ref:o,className:("mrl "+s).trim(),...i,children:n})}window.Reveal=Nl;function ce({size:n=17,sw:t=1.5,children:s}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s})}const Gt={home:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M4 11l8-7 8 7v9a1 1 0 0 1-1 1h-5v-6h-4v6H5a1 1 0 0 1-1-1z"})}),compass:n=>e.jsxs(ce,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.6"}),e.jsx("path",{d:"m15.2 8.8-1.8 4.6-4.6 1.8 1.8-4.6z"})]}),receipt:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M6 3h12v18l-2-1.4L14 21l-2-1.4L10 21l-2-1.4L6 21zM9.5 8h5M9.5 12h5"})}),shelf:n=>e.jsxs(ce,{size:n,children:[e.jsx("path",{d:"M4.5 4h4v16h-4zM10.5 4h4v16h-4z"}),e.jsx("path",{d:"m17 5 3.8 14.7-3.4.9L13.6 6z"})]}),play:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M7 5.2c0-.9 1-1.5 1.8-1L19 10.9c.8.5.8 1.7 0 2.2L8.8 19.8c-.8.5-1.8-.1-1.8-1z"})}),gear:n=>e.jsxs(ce,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M12 2.8v2.4M12 18.8v2.4M21.2 12h-2.4M5.2 12H2.8M18.5 5.5l-1.7 1.7M7.2 16.8l-1.7 1.7M18.5 18.5l-1.7-1.7M7.2 7.2 5.5 5.5"})]}),search:n=>e.jsxs(ce,{size:n,children:[e.jsx("circle",{cx:"11",cy:"11",r:"6.5"}),e.jsx("path",{d:"m20 20-3.8-3.8"})]}),arrow:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M4 12h15m0 0-6-6m6 6-6 6"})}),arrowL:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M20 12H5m0 0 6-6m-6 6 6 6"})}),clock:n=>e.jsxs(ce,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),e.jsx("path",{d:"M12 7v5l3.2 1.8"})]}),check:n=>e.jsx(ce,{size:n,sw:2.4,children:e.jsx("path",{d:"m5 12.5 4.5 4.5L19 7"})}),x:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),xray:n=>e.jsxs(ce,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),e.jsx("path",{d:"M12 4.5V2M12 22v-2.5M4.5 12H2M22 12h-2.5"}),e.jsx("path",{d:"M7 7 5.6 5.6M18.4 18.4 17 17M17 7l1.4-1.4M5.6 18.4 7 17",opacity:"0.5"})]}),file:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),agent:n=>e.jsxs(ce,{size:n,children:[e.jsx("rect",{x:"5",y:"7",width:"14",height:"11",rx:"3"}),e.jsx("path",{d:"M12 7V4M9.5 12.5h.01M14.5 12.5h.01M9 21h6"})]}),bolt:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M13 2 5 13.5h6L11 22l8-11.5h-6z"})}),loop:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M20 12a8 8 0 1 1-2.34-5.66M20 3v4h-4"})}),cal:n=>e.jsxs(ce,{size:n,children:[e.jsx("rect",{x:"4",y:"5",width:"16",height:"15",rx:"2"}),e.jsx("path",{d:"M4 10h16M9 3v4M15 3v4"})]}),pause:n=>e.jsx(ce,{size:n,sw:2,children:e.jsx("path",{d:"M9 5v14M15 5v14"})}),moon:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M20 13.5A8 8 0 0 1 10.5 4 8 8 0 1 0 20 13.5z"})}),sun:n=>e.jsxs(ce,{size:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2.5v2M12 19.5v2M21.5 12h-2M4.5 12h-2M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4M18.7 18.7l-1.4-1.4M6.7 6.7 5.3 5.3"})]}),chat:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H9l-5 4z"})}),term:n=>e.jsxs(ce,{size:n,children:[e.jsx("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2.5"}),e.jsx("path",{d:"m7 9.5 3 2.5-3 2.5M12.5 14.5H17"})]}),shield:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M12 3 5 6v5c0 4.4 2.9 8 7 10 4.1-2 7-5.6 7-10V6z"})}),film:n=>e.jsxs(ce,{size:n,children:[e.jsx("rect",{x:"6.5",y:"3.5",width:"11",height:"17",rx:"2.5"}),e.jsx("path",{d:"M10.5 18h3"})]}),spark:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M12 3c.6 4.8 1.8 7.2 7 9-5.2 1.8-6.4 4.2-7 9-.6-4.8-1.8-7.2-7-9 5.2-1.8 6.4-4.2 7-9z"})}),bell:n=>e.jsx(ce,{size:n,children:e.jsx("path",{d:"M6 9.5a6 6 0 0 1 12 0c0 4 1.5 5.5 1.5 5.5h-15S6 13.5 6 9.5M10 19a2.2 2.2 0 0 0 4 0"})})};function Ga(n,t,s){const a=window.V3SRC[s]||{path:"source registry",anchor:"",parser:"unmapped key: "+s,status:"planned",confidence:1,updated:"unknown",fresh:"stale",excerpt:"This claim's source pointer isn't wired into the registry yet. The claim still comes from your record; the pointer is the missing piece, and that's a bug worth reporting."};window.dispatchEvent(new CustomEvent("mxray",{detail:{claim:n,value:t,srcKey:s,src:a}}))}function Sl({claim:n,value:t,src:s,children:a,as:r="span",className:i=""}){const l=r,o=React.useRef(null),[c,d]=React.useState(!1);React.useEffect(()=>{const h=o.current;h&&h.parentElement&&!h.parentElement.closest("button, a, [role='button']")&&d(!0)},[]);const u=h=>{h.stopPropagation(),Ga(n,t,s)};return e.jsxs(l,{ref:o,className:"m-x "+i,title:"Where's this from?",onClick:u,...c?{role:"button",tabIndex:0,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u(h))}}:{},children:[a,e.jsx("span",{className:"m-x-glyph",children:Gt.xray(12)})]})}function Cl({n}){return e.jsx("span",{className:"m-conf",title:"Confidence "+n+" of 5",children:[1,2,3,4,5].map(t=>e.jsx("i",{className:t<=n?"on":""},t))})}function Tl({pct:n,label:t,size:s=126}){const a=(s-14)/2,r=2*Math.PI*a;return e.jsxs("div",{className:"m-ring",style:{width:s,height:s},children:[e.jsxs("svg",{width:s,height:s,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"mRingGrad",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--m-gold-deep)"}),e.jsx("stop",{offset:"100%",stopColor:"var(--m-gold-2)"})]})}),e.jsx("circle",{className:"bg",cx:s/2,cy:s/2,r:a,fill:"none",strokeWidth:"7"}),e.jsx("circle",{className:"fg",cx:s/2,cy:s/2,r:a,fill:"none",strokeWidth:"7",strokeDasharray:r,strokeDashoffset:r*(1-n/100)})]}),e.jsx("div",{className:"num",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsxs("b",{className:"m-num",children:[n,"%"]}),e.jsx("span",{children:t})]})})]})}function Rl({title:n,line:t,action:s,onAction:a,cmd:r}){return e.jsxs("div",{className:"m-empty",children:[e.jsx("span",{className:"t m-serif",children:n}),e.jsx("span",{className:"l",children:t}),s?e.jsxs("button",{className:"m-cta-line",style:{marginTop:6},onClick:a,children:[s," ",r?e.jsx("span",{className:"m-path",style:{color:"inherit",opacity:.7},children:r}):null," ",Gt.arrow(14)]}):null]})}function El({title:n,sub:t,chip:s,chipTone:a,tools:r}){return e.jsxs("div",{className:"m-card-head",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"m-card-title",children:n}),t?e.jsx("p",{className:"m-card-sub",children:t}):null]}),s?e.jsx("span",{className:"m-chip"+(a?" is-"+a:""),style:{alignSelf:"center"},children:s}):null,e.jsx("div",{className:"m-card-tools",children:r})]})}Object.assign(window,{useStored3:kl,MI:ce,MIcons:Gt,openXray:Ga,X:Sl,Conf:Cl,Ring:Tl,Empty:Rl,Head:El});const Is={live:{label:"parser live",tone:"good"},partial:{label:"parser partial",tone:"warn"},planned:{label:"parser planned",tone:"mute"}};function Il(){const[n,t]=React.useState(null),[s,a]=React.useState(!1);React.useEffect(()=>{const d=h=>{t(h.detail),requestAnimationFrame(()=>a(!0))},u=h=>{h.key==="Escape"&&a(!1)};return window.addEventListener("mxray",d),window.addEventListener("keydown",u),()=>{window.removeEventListener("mxray",d),window.removeEventListener("keydown",u)}},[]);const r=()=>a(!1);if(!n)return null;const{claim:i,value:l,src:o}=n,c=Is[o.status]||Is.planned;return e.jsxs("div",{"aria-hidden":!s,style:{pointerEvents:s?"auto":"none"},children:[e.jsx("div",{className:"m-xray-scrim"+(s?" is-open":""),onClick:r}),e.jsxs("aside",{className:"m-xray"+(s?" is-open":""),role:"dialog","aria-label":"Where this comes from",children:[e.jsxs("div",{className:"m-xray-head",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{display:"flex",alignItems:"center",gap:8,marginBottom:9},children:[MIcons.xray(13)," Where this comes from"]}),e.jsx("h2",{className:"m-xray-claim",children:i}),l?e.jsx("p",{style:{marginTop:6,fontSize:14,color:"var(--m-ink-2)"},children:l}):null]}),e.jsx("button",{className:"m-xray-close",onClick:r,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"m-xray-body",children:[e.jsxs("div",{className:"m-xray-file",children:[e.jsxs("div",{className:"m-xray-file-bar",children:[MIcons.file(14),e.jsx("span",{className:"m-path",style:{color:"var(--m-ink-1)"},children:o.path}),e.jsx(Qa,{path:o.path}),e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:o.updated})]}),e.jsx("div",{className:"m-xray-anchor",children:o.anchor}),e.jsx("div",{className:"m-xray-excerpt",children:o.excerpt})]}),e.jsxs("div",{className:"m-xray-grid",children:[e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Confidence"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(Conf,{n:o.confidence})," ",e.jsxs("span",{className:"m-num",children:[o.confidence," / 5"]})]})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Parser"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:"m-dot is-"+(c.tone==="good"?"good":c.tone==="warn"?"warn":"off")}),e.jsx("span",{className:"m-mono",style:{fontSize:12},children:o.parser})]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--m-ink-3)",marginTop:4},children:c.label})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Last updated"}),e.jsx("div",{className:"v",children:o.updated})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Updated by"}),e.jsx("div",{className:"v m-mono",style:{fontSize:12.5},children:o.workflow})]})]}),o.emptyState?e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.55},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:"If this source were empty:"})," ",o.emptyState]}):null,e.jsxs("div",{className:"m-xray-actions",children:[e.jsxs("button",{className:"m-xray-act",children:[MIcons.file(15)," Open source ",e.jsx("span",{className:"sub m-mono",children:o.path.split("/").pop()})]}),e.jsxs("button",{className:"m-xray-act",children:[MIcons.agent(15)," Ask an agent ",e.jsx("span",{className:"sub",children:"about this claim"})]}),e.jsxs("button",{className:"m-xray-act",children:[MIcons.play(15)," Run workflow ",e.jsx("span",{className:"sub m-mono",children:o.workflow})]})]}),e.jsx("p",{style:{fontSize:11.5,lineHeight:1.6,color:"var(--m-ink-3)",margin:0},children:"All of this is a real file in your vault. The dashboard is a window onto it, and a pen that writes it. Nothing here is a number we made up."})]})]})]})}function Qa({path:n}){const[t,s]=React.useState(!1),a=r=>{r.stopPropagation();try{navigator.clipboard&&navigator.clipboard.writeText(n)}catch{}s(!0),setTimeout(()=>s(!1),1400)};return e.jsxs("button",{onClick:a,title:"Copy the file path",className:"m-xray-copy"+(t?" is-ok":""),style:{display:"inline-flex",alignItems:"center",gap:5,whiteSpace:"nowrap",flex:"0 0 auto"},children:[t?MIcons.check(10):MIcons.file(10)," ",t?"copied":"copy path"]})}function Ml({open:n,onClose:t,onNav:s,routes:a}){const[r,i]=React.useState(""),l=React.useRef(null);if(React.useEffect(()=>{n&&(i(""),setTimeout(()=>l.current&&l.current.focus(),30))},[n]),!n)return null;const o=a||window.V3.routes.map(u=>u.id),c=window.V3B.commands.filter(u=>!r||(u.c+" "+u.what).toLowerCase().includes(r.toLowerCase())),d=window.V3.routes.filter(u=>o.includes(u.id)&&r&&u.k.toLowerCase().includes(r.toLowerCase()));return e.jsx("div",{className:"m-pal-scrim",onClick:t,children:e.jsxs("div",{className:"m-pal",onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{className:"m-pal-input",children:[MIcons.term(17),e.jsx("input",{ref:l,value:r,onChange:u=>i(u.target.value),placeholder:"Run a workflow, jump to a route, ask an agent…",onKeyDown:u=>{u.key==="Escape"&&t()}}),e.jsx("kbd",{style:{fontSize:10,color:"var(--m-ink-3)",border:"1px solid var(--m-line)",borderRadius:6,padding:"2px 6px"},children:"esc"})]}),e.jsxs("div",{className:"m-pal-list",children:[d.map(u=>e.jsxs("button",{className:"m-pal-row",onClick:()=>{s(u.id),t()},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:MIcons[u.ic](15)}),e.jsxs("span",{className:"w",children:["Go to ",e.jsx("b",{style:{color:"var(--m-ink)"},children:u.k})]}),e.jsx("span",{className:"r",children:"route"})]},u.id)),c.map((u,h)=>e.jsxs("button",{className:"m-pal-row"+(h===0&&!d.length?" is-hot":""),onClick:t,children:[e.jsx("span",{className:"c",children:u.c}),e.jsx("span",{className:"w",children:u.what}),e.jsxs("span",{className:"r",children:["reads ",u.reads==="—"?"nothing":u.reads.split("·")[0].trim()]})]},u.c)),!c.length&&!d.length?e.jsxs("div",{style:{padding:"22px 16px",fontSize:13,color:"var(--m-ink-3)"},children:["Nothing matches. Try a workflow name like ",e.jsx("span",{className:"m-mono",style:{color:"var(--m-gold-2)"},children:"/morning"}),"."]}):null]})]})})}Object.assign(window,{XrayDrawer:Il,Palette:Ml,CopyPathBtn:Qa});function Za({c:n,style:t}){const[s,a]=React.useState(!1);if((window.__m6roll||"full")!=="full")return null;const r=()=>{try{navigator.clipboard&&navigator.clipboard.writeText(n)}catch{}a(!0),setTimeout(()=>a(!1),1300)};return e.jsxs("div",{className:"v6-termline",style:t,children:[e.jsx("span",{children:"Terminal:"}),e.jsx("code",{children:n}),e.jsxs("button",{className:"cp"+(s?" is-ok":""),onClick:r,title:"Copy the command",children:[s?MIcons.check(10):MIcons.term(10)," ",s?"copied":"copy"]})]})}function Al({moment:n,lines:t}){const[s,a]=React.useState(!1),[r,i]=React.useState(null),l=()=>{const o=new Date;let c=o.getHours();const d=String(o.getMinutes()).padStart(2,"0"),u=c>=12?"PM":"AM";c=c%12||12,i({lines:typeof t=="function"?t():t,when:o.toLocaleDateString("en-GB",{month:"long",day:"numeric"})+" · "+c+":"+d+" "+u}),a(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"v6cap-btn",onClick:l,title:"Mark this moment, preview what a capture would keep",children:[MIcons.film(11)," Capture this"]}),s&&r?e.jsx("div",{className:"v6j-scrim",style:{zIndex:82},onMouseDown:o=>{o.target===o.currentTarget&&a(!1)},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",style:{width:"min(480px, 100%)"},role:"dialog","aria-label":"Capture this","data-screen-label":"Capture preview, "+n,children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"Capture this"}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:()=>a(!1),"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",style:{padding:"20px 22px 22px"},children:[e.jsx("h2",{className:"v6j-q",style:{fontSize:21},children:n}),e.jsx("div",{className:"v6cap-lines",children:r.lines.map((o,c)=>e.jsx("p",{className:c===0?"big":"",children:o},c))}),e.jsxs("div",{className:"v6cap-meta",children:[e.jsx("span",{children:r.when}),e.jsx("span",{children:"exactly what's on screen, real data, nothing staged"})]}),e.jsx("p",{className:"v6cap-note",children:"Marked only. Saving, exporting and captions aren't built yet, nothing was written anywhere."}),e.jsx("div",{className:"v6-acts",style:{marginTop:16},children:e.jsxs("button",{className:"v6-run",onClick:()=>a(!1),autoFocus:!0,children:[MIcons.check(13)," Done"]})})]})]})}):null]})}function Kn(){try{return JSON.parse(localStorage.getItem("m6.check.urgent"))===!0}catch{return!1}}function Ll({it:n,red:t}){const[s,a]=React.useState(!1);return e.jsxs("div",{className:"v6c-item",children:[e.jsx("p",{className:"line",children:n.line}),e.jsxs("div",{className:"row",children:[e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("The record check, the fact",n.line,n.src),children:[MIcons.file(11)," ",n.f]}),e.jsx("button",{className:"v6-act2",style:{padding:"5px 11px",fontSize:11.5},onClick:()=>a(!s),children:s?"Hide the proposal":"Propose a fix"})]}),s?e.jsxs("div",{className:"fix",children:[n.fix,e.jsx(Za,{c:n.term,style:{marginTop:9}})]}):null]})}function Ol(){const n=window.V6CHECK,[t,s]=React.useState(Kn());React.useEffect(()=>{const r=()=>s(Kn());return window.addEventListener("m6check",r),()=>window.removeEventListener("m6check",r)},[]);const a=(t?[n.urgent]:[]).concat(n.items);return e.jsxs("section",{className:"v6c v6-glass",style:{marginTop:18},"data-screen-label":"Settings, record check","data-comment-anchor":"record-check",children:[e.jsxs("div",{className:"v6-honest-k",style:{marginBottom:0},children:[MIcons.loop(12)," ",n.title]}),e.jsx("p",{className:"sub",children:n.sub}),e.jsx("div",{style:{marginTop:8},children:a.length?a.map(r=>e.jsx(Ll,{it:r},r.id)):e.jsx("p",{className:"v6c-empty",children:n.empty})})]})}function Pl({onNav:n}){const[t,s]=React.useState(Kn());if(React.useEffect(()=>{const r=()=>s(Kn());return window.addEventListener("m6check",r),()=>window.removeEventListener("m6check",r)},[]),!t)return null;const a=window.V6CHECK.urgent;return e.jsxs("button",{className:"v6c-red m-rise",style:{"--i":1},onClick:()=>n("configure"),"data-screen-label":"Home, urgent record check",title:"Open the record check in Settings",children:[e.jsx("span",{className:"k",children:"Record check"}),e.jsx("span",{className:"line",children:a.line}),e.jsxs("span",{className:"go",children:["Open in Settings ",MIcons.arrow(12)]})]})}Object.assign(window,{TermLine:Za,CaptureMark:Al,RecordCheckSection:Ol,HomeRedLine:Pl});function Dl(n){const t=(n||"").trim(),s=t.toLowerCase(),a=window.V6SAY.byCmd,r=(i,l,o)=>({move:a[i],match:l,why:o});if(/\b(start|build|launch|spin up|make|begin)\b[\s\S]*\b(project|app|extension|product|channel|startup|business|saas|site|tool)\b|new project/.test(s)){const i=window.V6SAY.planFocus;return{kind:"friction",echo:t,line:i?"Your plan today: "+i+(/[.!?…]$/.test(i)?" ":". ")+"Starting a new project is a different move, intentional, or avoidance?":"Today has no written plan yet. Starting a new project before one exists, intentional, or avoidance?",after:{kind:"high",echo:t,primary:r("/capture",84,"A new idea is worth keeping, and worth checking against the bet before it gets your week."),runners:[r("/pivot-strategy",61,"If the pull is really about the strategy, change it on purpose."),r("/experiment",48,"Or shrink it to a small test with a number.")]}}}return/(done for today|i'?m done|call it a (day|night)|wrap(ping)? up|close (the |my )?day|finished for|log off|day('s| is) over|shutting down|heading to bed)/.test(s)?{kind:"chain",echo:t,title:"Close the day",journal:!0,why:"It sounds like the day is ending.",line:"Two moves, back to back: save today's receipts, then read what they say. It starts with four questions, your journal feeds the analysis.",steps:[r("/log",null,null),r("/analyse-day",null,null)]}:/(what'?s working|whats working|figure out what|what is working|which .{0,24}works|working and what)/.test(s)?{kind:"medium",echo:t,options:[r("/experiment",64,"“Figure out” usually hides a question worth testing. A small test gives you a real answer."),r("/analyse-day",58,"Or look backwards, the receipts you already have may answer it tonight.")]}:/(doubt|second.?guess|direction|wrong (bet|path|track)|pivot|is this the right|questioning (this|the))/.test(s)?{kind:"high",echo:t,primary:r("/pivot-strategy",92,"You've questioned your direction."),runners:[r("/analyse-day",54,"Check what the receipts say first."),r("/debug-resistance",41,"If the doubt is really avoidance, work through that instead.")]}:/(stuck|procrastinat|avoid|resist|can'?t (start|seem|focus|get going)|putting (it |this )?off|blocked|paralys|frozen|dragging)/.test(s)?{kind:"high",echo:t,primary:r("/debug-resistance",88,"You named the stuck feeling."),runners:[r("/ignite",62,"Skip the why for now and just get moving."),r("/capture",37,"Or park what's circling and come back to it.")]}:/(plan (my |the |to)?day|what should i do|where do i start|morning|start (my|the) day|today'?s plan)/.test(s)?{kind:"high",echo:t,primary:r("/morning",90,"You asked about today."),runners:[r("/ignite",48,"If the plan exists and starting is the hard part."),r("/review-week",33,"Or zoom out to the whole week.")]}:/tomorrow/.test(s)?{kind:"high",echo:t,primary:r("/plan-tomorrow",89,"You're looking past today."),runners:[r("/analyse-day",52,"Read today first, it feeds tomorrow's plan.")]}:/\bweek\b|weekly|sunday review/.test(s)?{kind:"high",echo:t,primary:r("/review-week",86,"You're thinking in weeks, not days."),runners:[r("/pivot-strategy",44,"If the week already told you the answer.")]}:/(\blog\b|just (did|shipped|sent|finished)|track th|record th|receipt)/.test(s)?{kind:"high",echo:t,primary:r("/log",91,"Sounds like something just got done."),runners:[r("/capture",39,"If it's a thought, not a result.")]}:/(save|note|remember|capture|thought|idea|don'?t forget)/.test(s)?{kind:"high",echo:t,primary:r("/capture",88,"You want to keep something before it slips."),runners:[r("/log",42,"If it's proof of work, it belongs in the receipts."),r("/harvest",30,"Or file what's already piled up.")]}:{kind:"low",echo:t,reframings:[{label:"Plan your day",say:"plan my day"},{label:"Work through being stuck",say:"i feel stuck"},{label:"Just save this note",say:"save a thought"}]}}function Fl(n,t,s){window.dispatchEvent(new CustomEvent("m6toast",{detail:{text:n,file:t,srcKey:s}}))}function _l(){const[n,t]=React.useState(null);return React.useEffect(()=>{let s;const a=r=>{t(r.detail),clearTimeout(s),s=setTimeout(()=>t(null),4200)};return window.addEventListener("m6toast",a),()=>{window.removeEventListener("m6toast",a),clearTimeout(s)}},[]),n?e.jsxs("button",{className:"v6-toast v6-glass",onClick:()=>{n.srcKey&&openXray(n.text,n.file,n.srcKey),t(null)},children:[MIcons.check(13)," ",e.jsx("span",{children:n.text})," ",n.file?e.jsx("span",{className:"f",children:n.file}):null]}):null}function Qt(){return e.jsx("span",{className:"v6-tag is-needs",title:"This move asks you questions. It waits for your answers, it never runs silently in the background.",children:"Needs you"})}function Zt({move:n,dense:t}){const s=(a,r,i)=>{const l=!!a.src;return e.jsxs("button",{className:"v6-file"+(r?" is-write":"")+(l?"":" is-plain"),title:l?"Open the real file":"Lives in your vault",onClick:l?o=>{o.stopPropagation(),openXray("What "+n.c+(r?" writes":" reads"),a.f+(a.note?", "+a.note:""),a.src)}:void 0,children:[MIcons.file(11)," ",a.f,r&&a.note?e.jsx("span",{className:"note",children:a.note}):null]},(r?"w":"r")+i)};return e.jsxs("div",{children:[e.jsxs("div",{className:"v6-files",style:t?{marginTop:9}:null,children:[e.jsx("span",{className:"lk",children:"Reads"}),n.reads.length?n.reads.map((a,r)=>s(a,!1,r)):e.jsx("span",{className:"v6-nothing",children:"nothing, it only writes"})]}),e.jsxs("div",{className:"v6-files",style:{marginTop:6},children:[e.jsx("span",{className:"lk",children:"Writes"}),n.writes.length?n.writes.map((a,r)=>s(a,!0,r)):e.jsx("span",{className:"v6-nothing",children:"nothing, it only reports"})]})]})}function zl({mv:n,recommended:t,runners:s,onSwap:a,onNav:r,exposeRun:i,showEnterHint:l}){const{move:o,match:c,why:d}=n,[u,h]=React.useState("idle"),[p,m]=React.useState(!1);React.useEffect(()=>{h("idle"),m(!1)},[o.c]);const g=React.useCallback(()=>{h(f=>f!=="idle"?f:(fetch("/api/health").then(v=>v.json()).then(v=>fetch("/api/workflow/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":v&&v.token},body:JSON.stringify({workflow:o.c,agent:"claude-code"})})).then(()=>h("done")).catch(v=>{console.warn("workflow run failed",v),h("done")}),"running"))},[o.c]);return React.useEffect(()=>{i&&i(g)},[i,g]),e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft"+(t?" is-rec":""),"data-screen-label":"Move card, "+o.c,children:[e.jsxs("div",{className:"v6-card-top",children:[e.jsx("span",{className:"runword",children:"Run"}),e.jsx("span",{className:"cmd",children:o.c}),c?e.jsxs("button",{className:"match v6-from",title:"Where's this from?",onClick:()=>openXray("Why this move matched",c+"%, your words matched the saved rule for "+o.c,"router"),children:["· ",e.jsxs("b",{children:[c,"%"]})," match"]}):null,o.needsYou?e.jsx(Qt,{}):null]}),e.jsx("p",{className:"v6-does",children:o.does}),d?e.jsxs("div",{className:"v6-why",children:[e.jsx("span",{className:"lk",children:"Why this"}),e.jsx("span",{children:d})]}):null,e.jsx(Zt,{move:o}),u==="idle"?e.jsxs("div",{className:"v6-acts",children:[e.jsxs("button",{className:"v6-run",onClick:g,children:[MIcons.play(13)," Run it"]}),e.jsxs("button",{className:"v6-act2",onClick:()=>{r&&r("run")},children:[MIcons.term(13)," Watch it work"]}),e.jsx("button",{className:"v6-act2",onClick:()=>m(!p),children:"What is this?"}),l?e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," runs it"]}):null]}):e.jsxs("div",{className:"v6-ranline"+(u==="running"?" is-running":""),children:[e.jsx("span",{className:"dot"}),u==="running"?e.jsxs("span",{children:["Working, reading ",o.reads.length?o.reads.map(f=>f.f).join(" and "):"nothing"," first…"]}):o.needsYou?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"It has questions for you. It's waiting in Run, not running silently."}),e.jsxs("button",{className:"v6-act2 go",onClick:()=>r&&r("run"),children:["Go answer them ",MIcons.arrow(12)]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Done. ",o.writes.length?o.writes[0].f+" updated"+(o.writes[0].note?", "+o.writes[0].note:""):"Nothing written."]}),e.jsxs("button",{className:"v6-act2 go",onClick:()=>r&&r("run"),children:["See the receipt ",MIcons.arrow(12)]})]})]}),p?e.jsxs("div",{className:"v6-more",children:[o.long," ",e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"It never runs without you pressing Run."})]}):null,s&&s.length?e.jsxs("div",{className:"v6-runners",children:[e.jsx("span",{className:"lk",children:"Not it? →"}),s.map(f=>e.jsxs("button",{className:"v6-runner",onClick:()=>a&&a(f),title:f.move.does,children:[e.jsx("span",{className:"c",children:f.move.c}),f.match?e.jsxs("span",{className:"pct",children:[f.match,"%"]}):null]},f.move.c))]}):null,e.jsx(TermLine,{c:o.c})]})}function Vl({res:n,onNav:t,exposeRun:s}){const[a,r]=React.useState(0),i=React.useCallback(()=>{if(n.journal&&window.v6OpenJournal){window.v6OpenJournal("evening");return}r(l=>{if(l!==0)return l;const o=n.steps&&n.steps[0]&&n.steps[0].move;return fetch("/api/health").then(c=>c.json()).then(c=>fetch("/api/workflow/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":c&&c.token},body:JSON.stringify({workflow:o&&o.c,agent:"claude-code"})})).then(c=>{if(!c.ok)throw new Error("HTTP "+c.status);r(2)}).catch(c=>{console.warn("chain run failed",c),r(3)}),1})},[n.journal,n.steps]);return React.useEffect(()=>{s&&s(i)},[s,i]),e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft is-rec","data-screen-label":"Chain card, "+n.title,children:[e.jsxs("div",{className:"v6-card-top",children:[e.jsx("span",{className:"runword",children:n.title}),e.jsxs("span",{className:"match",children:["· a chain of ",e.jsx("b",{children:"2"})," moves"]})]}),e.jsxs("div",{className:"v6-why",style:{marginTop:10},children:[e.jsx("span",{className:"lk",children:"Why this"}),e.jsxs("span",{children:[n.why," ",n.line]})]}),e.jsx("div",{className:"v6-chain",children:n.steps.map((l,o)=>e.jsxs("div",{className:"v6-beat",children:[e.jsxs("div",{className:"spine",children:[e.jsx("span",{className:"node"}),e.jsx("span",{className:"cord"})]}),e.jsxs("div",{className:"b",children:[e.jsxs("div",{className:"bh",children:[e.jsx("span",{className:"cmd",children:l.move.c}),e.jsx("span",{className:"nm",children:l.move.name}),l.move.needsYou?e.jsx(Qt,{}):null]}),e.jsx("p",{className:"bd",children:l.move.does}),e.jsx(Zt,{move:l.move,dense:!0}),a>0?o===0?e.jsx("p",{className:"bs"+(a===1?" is-on":""),children:a===1?"Running "+l.move.c+" for real…":a===3?"Could not start "+l.move.c+". Nothing ran.":l.move.c+" started for real. Watch it in Run."}):e.jsx("p",{className:"bs"+(a===2?" is-on":""),children:a===2?"Waiting on you, it has questions about today. It won't guess.":"Waits for the first move, then asks you about the day."}):null]})]},l.move.c))}),a===0?e.jsxs("div",{className:"v6-acts",style:{marginTop:4},children:[e.jsxs("button",{className:"v6-run",onClick:i,children:[MIcons.play(13)," ",n.journal?"Close the day":"Run the chain"]}),e.jsxs("button",{className:"v6-act2",onClick:()=>t&&t("run"),children:[MIcons.term(13)," Watch it work"]}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," runs it"]})]}):a===2?e.jsxs("div",{className:"v6-ranline",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{children:"Step 1 done. Step 2 is a conversation, it's waiting for you."}),e.jsxs("button",{className:"v6-act2 go",onClick:()=>t&&t("run"),children:["Go answer it ",MIcons.arrow(12)]})]}):e.jsxs("div",{className:"v6-ranline is-running",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{children:"Running the chain…"})]})]})}function Wl({res:n,onAnyway:t,onBack:s}){const[a,r]=React.useState(!1),[i,l]=React.useState(""),o=window.V6NO&&window.V6NO.grave,c=()=>{const d=i.trim();d&&t(d)};return e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft is-warn","data-screen-label":"Friction card, a check first",children:[e.jsxs("div",{className:"v6-kicker is-warn",children:[MIcons.shield(13)," A check first, against today's plan"]}),e.jsx("p",{className:"v6-plain",style:{marginTop:11},children:n.line}),o?e.jsx(GraveEcho,{}):null,a?e.jsxs("div",{className:"v6n-anyway",children:[e.jsx("p",{className:"lbl",children:"One line, what's different this time. It's logged with the old reason, side by side."}),e.jsx("textarea",{className:"v6j-ta",rows:2,autoFocus:!0,placeholder:"This time…",value:i,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),c())}}),e.jsxs("div",{className:"v6-acts",style:{marginTop:12},children:[e.jsxs("button",{className:"v6-run",onClick:c,disabled:!i.trim(),children:[MIcons.play(13)," Log it and go"]}),e.jsx("button",{className:"v6-act2",onClick:()=>r(!1),children:"Back"}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," logs it"]})]})]}):e.jsxs("div",{className:"v6-acts",children:[e.jsxs("button",{className:"v6-run",onClick:s,children:[MIcons.check(13)," You're right, drop it"]}),e.jsx("button",{className:"v6-act2",onClick:()=>r(!0),children:"Different this time, here's why"})]}),e.jsxs("p",{className:"v6-sub",style:{marginTop:12},children:[o?o.leaveNote+" ":"","Going ahead is logged as an override, it counts against the plan, openly."]})]})}function Bl({res:n,onSay:t,onBrowse:s}){return e.jsxs("div",{className:"v6-card v6-glass v6-pop-soft","data-screen-label":"Low confidence, did you mean",children:[e.jsx("p",{className:"v6-plain",children:"I'm not sure what you're after. Did you mean…"}),e.jsx("div",{className:"v6-reframes",children:n.reframings.map(a=>e.jsx("button",{className:"v6-reframe",onClick:()=>t(a.say),children:a.label},a.label))}),e.jsxs("button",{className:"v6-browse",onClick:s,children:["Or browse all moves ",MIcons.arrow(12)]})]})}Object.assign(window,{sayResolve:Dl,V6ToastHost:_l,MoveCard:zl,MoveFiles:Zt,ChainCard:Vl,FrictionCard:Wl,LowCard:Bl,NeedsYouTag:Qt,v6Toast:Fl});function es(){const n=new Date().getHours();return n<5?"night":n<12?"morning":n<18?"afternoon":"evening"}function er({q:n,sel:t,onPickMove:s,onPickRoute:a,onHover:r}){const i=n.slice(1).trim().toLowerCase(),l=window.__m6routes||window.V3.routes.map(u=>u.id),o=window.V3.routes.filter(u=>l.includes(u.id)&&i&&u.k.toLowerCase().includes(i)),c=window.V6SAY.moves.filter(u=>!i||(u.c+" "+u.name+" "+u.does).toLowerCase().includes(i)),d=o.map(u=>({kind:"route",r:u})).concat(c.map(u=>({kind:"move",m:u})));return d.length?e.jsx("div",{className:"v6-cmdlist",children:d.map((u,h)=>u.kind==="route"?e.jsxs("button",{className:"v6-cmdrow"+(h===t?" is-sel":""),onMouseEnter:()=>r(h),onClick:()=>a(u.r),children:[e.jsx("span",{style:{color:"var(--m-ink-2)",display:"inline-flex"},children:MIcons[u.r.ic](14)}),e.jsxs("span",{className:"w",children:["Go to ",e.jsx("b",{style:{color:"var(--m-ink)"},children:u.r.k})]}),e.jsx("span",{className:"r",children:"route"})]},"rt-"+u.r.id):e.jsxs("button",{className:"v6-cmdrow"+(h===t?" is-sel":""),onMouseEnter:()=>r(h),onClick:()=>s(u.m),children:[e.jsx("span",{className:"c",children:u.m.c}),e.jsx("span",{className:"w",children:u.m.does}),u.m.needsYou?e.jsx("span",{className:"r",children:"needs you"}):e.jsx("span",{className:"r",children:"runs solo"})]},u.m.c))}):e.jsxs("div",{className:"v6-cmdempty",children:["Nothing matches. Try a word like ",e.jsx("span",{className:"m-mono",style:{color:"var(--m-gold-2)"},children:"plan"})," or ",e.jsx("span",{className:"m-mono",style:{color:"var(--m-gold-2)"},children:"stuck"}),"."]})}function nr(n){const t=n.slice(1).trim().toLowerCase(),s=window.__m6routes||window.V3.routes.map(i=>i.id),a=window.V3.routes.filter(i=>s.includes(i.id)&&t&&i.k.toLowerCase().includes(t)),r=window.V6SAY.moves.filter(i=>!t||(i.c+" "+i.name+" "+i.does).toLowerCase().includes(t));return a.map(i=>({kind:"route",r:i})).concat(r.map(i=>({kind:"move",m:i})))}function tr({res:n,onSwapPrimary:t,onNav:s,onSay:a,onBrowse:r,onAnyway:i,onBack:l,exposeRun:o,inOverlay:c}){return n?e.jsxs("div",{className:"v6-results"+(c?" in-overlay":""),children:[n.echo?e.jsxs("p",{className:"v6-echo",children:["You said: ",e.jsxs("b",{children:["“",n.echo,"”"]})]}):null,n.kind==="high"?e.jsx(MoveCard,{mv:n.primary,recommended:!0,runners:n.runners,onSwap:t,onNav:s,exposeRun:o,showEnterHint:!0}):null,n.kind==="medium"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"v6-readline",children:"Two ways to read that:"}),n.options.map(d=>e.jsx(MoveCard,{mv:d,onNav:s},d.move.c))]}):null,n.kind==="chain"?e.jsx(ChainCard,{res:n,onNav:s,exposeRun:o}):null,n.kind==="low"?e.jsx(LowCard,{res:n,onSay:a,onBrowse:r}):null,n.kind==="friction"?e.jsx(FrictionCard,{res:n,onAnyway:i,onBack:l}):null,n.kind==="backed"?e.jsxs("p",{className:"v6-readline v6-pop-soft",style:{color:"var(--m-ink-2)"},children:[MIcons.check(13)," Good call. The thread is still the move, nothing was logged."]}):null]}):null}function sr({variant:n,onNav:t,onClose:s,autoFocus:a}){const[r,i]=React.useState(""),[l,o]=React.useState(null),[c,d]=React.useState(null),[u,h]=React.useState(0),p=React.useRef(null),m=React.useRef(null),g=n==="overlay",f=r.startsWith("/");React.useEffect(()=>{a&&setTimeout(()=>p.current&&p.current.focus(),40)},[a]);const v=w=>{t&&t(w),s&&s()},x=w=>{i(w),o(sayResolve(w)),d(w),m.current=null,p.current&&p.current.focus()},b=(w,N,C)=>{o({kind:"high",echo:null,primary:{move:w,match:null,why:null},runners:[]}),d(r),m.current=null},j=w=>{const N=w.target.value;i(N),h(0),l&&N!==c&&(o(null),d(null),m.current=null)},A=w=>{if(w.key==="Escape"){l||r?(o(null),d(null),i("")):s&&s(),w.stopPropagation();return}if(f){const N=nr(r);if(w.key==="ArrowDown"){w.preventDefault(),h(C=>Math.min(C+1,N.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),h(C=>Math.max(C-1,0));return}if(w.key==="Enter"){w.preventDefault();const C=N[u];if(!C)return;C.kind==="route"?v(C.r.id):b(C.m);return}return}if(w.key==="Enter"){if(w.preventDefault(),l&&c===r&&m.current){m.current();return}r.trim()&&x(r.trim())}},I=w=>{v6Toast("Logged as an override, with your reason","Override_Log.md","overrides"),window.dispatchEvent(new CustomEvent("m6no-changed"));try{localStorage.setItem("m6.no.overrode",JSON.stringify({when:new Date().toDateString(),reason:w||""}))}catch{}o(l.after)},k=()=>{i(""),d(null),o({kind:"backed"})},S=()=>{o(null),d(null),i("/"),h(0),p.current&&p.current.focus()},E=es(),L=window.V6SAY.chips[E]||window.V6SAY.chips.morning;return e.jsxs("div",{"data-screen-label":g?"Say it, overlay":"Say it, hero",children:[e.jsxs("div",{className:"v6-input "+(g?"is-overlay":"is-hero v6-glass"),children:[e.jsx("span",{className:"ico",children:MIcons.spark(17)}),e.jsx("input",{ref:p,value:r,onChange:j,onKeyDown:A,placeholder:"Say what's on your mind…","aria-label":"Say what's on your mind",spellCheck:"false"}),e.jsxs("span",{className:"v6-hint",children:[e.jsx("span",{className:"longhint",children:"type a thought, or / for commands"}),g?e.jsx("kbd",{className:"v6-kbd",children:"esc"}):e.jsx("kbd",{className:"v6-kbd",children:"⌘K"})]})]}),f?e.jsx("div",{className:g?"":"v6-glass v6-pop-soft",style:g?null:{marginTop:10,borderRadius:16},children:e.jsx(er,{q:r,sel:u,onHover:h,onPickRoute:w=>v(w.id),onPickMove:w=>b(w)})}):l?e.jsx(tr,{res:l,inOverlay:g,onNav:v,onSay:x,onBrowse:S,onAnyway:I,onBack:k,onSwapPrimary:w=>{const N=[l.primary].concat(l.runners.filter(C=>C.move.c!==w.move.c));o({kind:"high",echo:l.echo,primary:w,runners:N}),m.current=null},exposeRun:w=>{m.current=w}}):g?e.jsx("div",{className:"v6-results in-overlay",style:{paddingTop:14},children:e.jsxs("div",{className:"v6-chiprow",style:{marginTop:0},children:[e.jsx("span",{className:"lk",children:"Try"}),L.map(w=>e.jsx("button",{className:"v6-chip",onClick:()=>x(w.say),children:w.label},w.label))]})}):null]})}function Hl({onOpen:n}){return e.jsx("div",{className:"v6-barwrap",children:e.jsxs("button",{className:"v6-bar",onClick:n,title:"Say it, turn a thought into the right move (⌘K)",children:[MIcons.spark(14),e.jsx("span",{className:"ph",children:"Say what's on your mind…"}),e.jsx("kbd",{className:"v6-kbd",children:"⌘K"})]})})}function $l({onNav:n}){const t=es(),s=window.V6SAY.chips[t]||window.V6SAY.chips.morning,a=React.useRef(null),r=i=>{window.dispatchEvent(new CustomEvent("m6heroSay",{detail:i}))};return e.jsxs("div",{className:"v6-hero","data-coach":"say-it-hero","data-screen-label":"Home, Say it hero",children:[e.jsx(Xl,{onNav:n,ref:a}),e.jsxs("div",{className:"v6-chiprow",children:[e.jsx("span",{className:"lk",children:"Try"}),s.map(i=>e.jsx("button",{className:"v6-chip",onClick:()=>r(i.say),children:i.label},i.label))]}),e.jsxs("div",{className:"v6-chiprow",style:{marginTop:9},children:[e.jsx("span",{className:"lk",children:"Examples"}),window.V6SAY.examples.map(i=>e.jsxs("button",{className:"v6-chip is-ex",onClick:()=>r(i),children:[e.jsx("span",{className:"tag",children:"Example"})," “",i,"”"]},i))]})]})}const Xl=React.forwardRef(function({onNav:t},s){const[a,r]=React.useState(null);return React.useEffect(()=>{const i=l=>r({text:l.detail,t:Date.now()});return window.addEventListener("m6heroSay",i),()=>window.removeEventListener("m6heroSay",i)},[]),e.jsx(Yl,{seed:a,onNav:t})});function Yl({seed:n,onNav:t}){const[s,a]=React.useState(""),[r,i]=React.useState(null),[l,o]=React.useState(null),[c,d]=React.useState(0),u=React.useRef(null),h=React.useRef(null),p=s.startsWith("/"),m=React.useCallback(I=>{a(I),i(sayResolve(I)),o(I),h.current=null},[]);React.useEffect(()=>{n&&n.text&&m(n.text)},[n,m]);const g=I=>{t&&t(I)},f=I=>{i({kind:"high",echo:null,primary:{move:I,match:null,why:null},runners:[]}),o(s),h.current=null},v=I=>{const k=I.target.value;a(k),d(0),r&&k!==l&&(i(null),o(null),h.current=null)},x=I=>{if(I.key==="Escape"){i(null),o(null),a(""),I.stopPropagation();return}if(p){const k=nr(s);if(I.key==="ArrowDown"){I.preventDefault(),d(S=>Math.min(S+1,k.length-1));return}if(I.key==="ArrowUp"){I.preventDefault(),d(S=>Math.max(S-1,0));return}if(I.key==="Enter"){I.preventDefault();const S=k[c];if(!S)return;S.kind==="route"?g(S.r.id):f(S.m)}return}if(I.key==="Enter"){if(I.preventDefault(),r&&l===s&&h.current){h.current();return}s.trim()&&m(s.trim())}},b=()=>{i(null),o(null),a("/"),d(0),u.current&&u.current.focus()},j=I=>{v6Toast("Logged as an override, with your reason","Override_Log.md","overrides"),window.dispatchEvent(new CustomEvent("m6no-changed"));try{localStorage.setItem("m6.no.overrode",JSON.stringify({when:new Date().toDateString(),reason:I||""}))}catch{}i(r.after)},A=()=>{a(""),o(null),i({kind:"backed"})};return e.jsxs("div",{"data-screen-label":"Home, Say it box",children:[e.jsxs("div",{className:"v6-input is-hero v6-glass",children:[e.jsx("span",{className:"ico",children:MIcons.spark(17)}),e.jsx("input",{ref:u,value:s,onChange:v,onKeyDown:x,placeholder:"Say what's on your mind…","aria-label":"Say what's on your mind",spellCheck:"false"}),e.jsxs("span",{className:"v6-hint",children:[e.jsx("span",{className:"longhint",children:"type a thought, or / for commands"}),e.jsx("kbd",{className:"v6-kbd",children:"⌘K"})]})]}),p?e.jsx("div",{className:"v6-glass v6-pop-soft",style:{marginTop:10,borderRadius:16},children:e.jsx(er,{q:s,sel:c,onHover:d,onPickRoute:I=>g(I.id),onPickMove:f})}):e.jsx(tr,{res:r,onNav:g,onSay:m,onBrowse:b,onAnyway:j,onBack:A,onSwapPrimary:I=>{const k=[r.primary].concat(r.runners.filter(S=>S.move.c!==I.move.c));i({kind:"high",echo:r.echo,primary:I,runners:k}),h.current=null},exposeRun:I=>{h.current=I}})]})}function ql({open:n,onClose:t,onNav:s}){return React.useEffect(()=>{if(!n)return;const a=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n,t]),n?e.jsx("div",{className:"v6-scrim",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:e.jsxs("div",{className:"v6-overlay v6-glass v6-pop",role:"dialog","aria-label":"Say it",children:[e.jsx(sr,{variant:"overlay",onNav:s,onClose:t,autoFocus:!0}),e.jsxs("div",{className:"v6-overlay-foot",children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," runs the top match"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"↑↓"})," move"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"/"})," commands"]}),e.jsx("span",{className:"sp"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"esc"})," close"]})]})]})}):null}Object.assign(window,{SayBox:sr,SayItPinned:Hl,SayItHero:$l,SayItOverlay:ql,v6Slot:es});function Ul(n){const t=(n||"").trim();if(!t)return null;for(const s of window.V6J.pushes)if(s.re.test(t))return s.line;return t.length<window.V6J.minLen?window.V6J.pushShort:null}function Kl(){const n=new Date;let t=n.getHours();const s=String(n.getMinutes()).padStart(2,"0"),a=t>=12?"PM":"AM";t=t%12||12;const r=n.toLocaleDateString("en-GB",{month:"long",day:"numeric"});return t+":"+s+" "+a+" · "+r}function Ms({anchor:n}){const t=window.V6J.file;return e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("Your Journal, where this is saved",t.f+", ## Journal"+(n?" → "+n:""),t.src),children:[MIcons.file(11)," ",t.f," ",e.jsxs("span",{className:"note",children:["## Journal",n?" → "+n:""]})]})}function Jl({total:n,at:t}){return e.jsx("span",{className:"v6j-dots","aria-label":"Step "+(t+1)+" of "+n,children:Array.from({length:n}).map((s,a)=>e.jsx("i",{className:a<t?"is-done":a===t?"is-now":""},a))})}function Gl({value:n,onPick:t}){return e.jsx("div",{className:"v6j-scale",children:[1,2,3,4,5,6,7,8,9,10].map(s=>e.jsx("button",{className:"v6j-num"+(n===s?" is-on":""),onClick:()=>t(s),children:s},s))})}function Ql({q:n,state:t,setState:s,push:a,onAdvance:r,onSkip:i,dots:l}){const o=React.useRef(null);React.useEffect(()=>{o.current&&o.current.focus()},[n.id,a]);const c=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),r())},d=n.kind==="score+line"||n.kind==="score";return e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:n.q}),n.sub?e.jsx("p",{className:"v6j-sub",children:n.sub}):null,e.jsxs("div",{className:"v6j-answer",children:[n.kind==="wantshould"?e.jsxs("div",{className:"v6j-ws",style:{marginBottom:12},children:[e.jsxs("button",{className:t.ws==="want"?"is-on":"",onClick:()=>s({...t,ws:"want"}),children:[e.jsx("b",{children:"I want it"})," I'd pick this with nobody watching."]}),e.jsxs("button",{className:t.ws==="should"?"is-on":"",onClick:()=>s({...t,ws:"should"}),children:[e.jsx("b",{children:"I should"})," It's duty today, not pull."]})]}):null,d?e.jsx("div",{style:{marginBottom:n.kind==="score"?0:12},children:e.jsx(Gl,{value:t.score,onPick:u=>{s({...t,score:u}),n.kind==="score"&&setTimeout(r,240)}})}):null,n.kind!=="score"?e.jsx("textarea",{ref:o,className:"v6j-ta",rows:3,placeholder:n.ph,value:t.text||"",onChange:u=>s({...t,text:u.target.value}),onKeyDown:c}):null]}),a?e.jsxs("div",{className:"v6j-push",children:[e.jsx("span",{className:"lk",children:"Go deeper"}),e.jsx("span",{children:a})]}):null,e.jsxs("div",{className:"v6j-foot",children:[l,e.jsx("button",{className:"v6j-skip",onClick:i,children:"skip this one"}),e.jsxs("span",{className:"v6j-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," next · ",e.jsx("kbd",{className:"v6-kbd",children:"⇧↩"})," new line"]})]})]},n.id)}function ar({selfScore:n}){const t=window.V6J.record,s=n??7,a=Math.abs(s-t.score),r=s-t.score>1?t.why:s-t.score<-1?"You scored yourself under the record. The receipts say more happened than it felt like, the feeling was the noise, not the day.":"Your read matches the record. You saw today clearly, that's the skill this builds.",i=t.trend.concat([a]),l=a<=t.trend[t.trend.length-1];return e.jsxs("div",{className:"v6j-gapcard","data-screen-label":"What you thought vs what happened",children:[e.jsxs("div",{className:"v6-honest-k",children:[MIcons.xray(12)," What you thought vs what happened · today",e.jsx("span",{className:"sp"}),e.jsx(CaptureMark,{moment:"What you thought vs what happened",lines:()=>["You scored today "+s+". The record says "+t.score+".",r,"Off by "+i.slice(0,-1).join(" → ")+" → tonight: "+a+"."]})]}),e.jsxs("div",{className:"v6j-gapnums",children:[e.jsxs("div",{className:"v6j-gapnum",children:[e.jsx("span",{className:"n m-num",children:s}),e.jsx("span",{className:"l",children:"You scored yourself"})]}),e.jsx("span",{className:"v6j-gaparrow",children:MIcons.arrow(18)}),e.jsxs("button",{className:"v6j-gapnum is-record",style:{background:"none",border:"none",padding:0,textAlign:"left",cursor:"pointer"},title:"Where's this from?",onClick:()=>openXray("Your record's score, where it comes from","4, computed from today's plan vs today's receipts","metrics"),children:[e.jsx("span",{className:"n m-num",children:t.score}),e.jsx("span",{className:"l",children:"Your record says"})]})]}),e.jsxs("p",{className:"v6j-gapline",children:[e.jsx("span",{className:"lk",children:"The gap"}),r]}),e.jsxs("div",{className:"v6j-trend",children:[e.jsxs("button",{className:"seq v6-from",title:"Where's this from?",onClick:()=>openXray("The gap, day by day","Your evening score vs the record's, from your Daily Note, the session log, and Metrics_Log.md. Off by "+i.join(" → ")+".","metrics"),children:["off by ",i.slice(0,-1).join(" → ")," → ",e.jsxs("b",{children:["tonight: ",a]})]}),e.jsx("span",{children:l?"Your self-read is getting closer to reality.":"Tonight widened it, worth one honest look at why."})]})]})}function Zl({onMorning:n}){const[t]=useStored3("m6.alibi2",window.V6J.seedAlibi),[s,a]=useStored3("m6.alibi.hidden",!1);return!t||s?null:e.jsxs("section",{className:"v6j-frame m-rise",style:{"--i":2},"data-screen-label":"Home, the alibi, framed","data-comment-anchor":"alibi-frame",children:[e.jsxs("div",{className:"k",children:[MIcons.shield(12)," You predicted"]}),e.jsxs("p",{className:"quote",children:["“",t.text,"”"]}),e.jsxs("div",{className:"sig",children:[e.jsx("span",{className:"name",children:t.sig}),e.jsx("span",{children:t.when})]}),e.jsxs("div",{className:"foot",children:[e.jsx("span",{className:"q",children:"Is that how today goes?"}),e.jsx("button",{className:"v6j-act",onClick:()=>a(!0),children:"Not today"}),n?e.jsx("button",{className:"v6j-act",onClick:n,children:"Start the morning prime"}):null]})]})}function rr({mode:n,onClose:t,onNav:s}){const a=window.V6J[n],r=a.questions,[i,l]=React.useState("intro"),[o,c]=React.useState(0),[d,u]=useStored3("m6.journal."+n,{}),[h,p]=React.useState({}),[m,g]=React.useState(null),[f,v]=React.useState(!1),[x,b]=React.useState("idle"),[j,A]=React.useState(""),[,I]=useStored3("m6.alibi2",window.V6J.seedAlibi),[,k]=useStored3("m6.alibi.hidden",!1),S=n==="evening",E=r[o],L=r.length,w=()=>{l("q"),c(0),p({}),g(null),v(!1)},N=D=>{D||u(Y=>Object.assign({},Y,{[E.id]:h})),g(null),v(!1),p({}),o+1<r.length?c(o+1):S?(l("chain"),setChainSt(0)):l("done")},C=()=>{if(E.kind==="score"){if(h.score==null)return;N(!1);return}if(!(E.kind==="score+line"&&h.score==null)){if(!f){const D=Ul(h.text);if(D){g(D),v(!0);return}}N(!1)}},P=()=>{const D=j.trim();D&&(I({text:D,when:Kl(),sig:window.V3&&window.V3.name||"You"}),k(!1),v6Toast("Sealed, it'll be waiting tomorrow morning",window.V6J.file.f,window.V6J.file.src)),l("done")},M=React.useRef(!1),T=React.useRef(null);React.useEffect(()=>{if(!(i!=="done"||M.current)){M.current=!0;try{const D=d||{},Y=S?{score:D.score&&D.score.score!=null?D.score.score:void 0,scoreWhy:D.score&&D.score.text?D.score.text:void 0,winAvoidance:D.winavoid&&D.winavoid.text?D.winavoid.text:void 0,workedDidnt:D.worked&&D.worked.text?D.worked.text:void 0,doDifferently:D.differently&&D.differently.text?D.differently.text:void 0,alibi:j&&j.trim()?j.trim():void 0}:{wantVsShould:D.wantshould&&(D.wantshould.text||D.wantshould.ws)?[D.wantshould.ws,D.wantshould.text].filter(Boolean).join(". "):void 0,energy:D.energy&&D.energy.score!=null?D.energy.score:void 0,grateful:D.grateful&&D.grateful.text?D.grateful.text:void 0,picture:D.visual&&D.visual.text?D.visual.text:void 0};T.current=()=>{b("saving"),fetch("/api/health").then(z=>z.json()).then(z=>fetch("/api/journal",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":z&&z.token},body:JSON.stringify({mode:n,answers:Y})})).then(async z=>{let y=z&&z.ok;try{const V=await z.json();y=y&&V&&V.ok!==!1}catch{}b(y?"ok":"fail"),y||console.warn("journal save failed: server said no")}).catch(z=>{b("fail"),console.warn("journal save failed",z)})},T.current()}catch(D){b("fail"),console.warn("journal save failed",D)}}},[i]),React.useEffect(()=>{const D=Y=>{Y.key==="Escape"&&t()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t]),window.V6J.record;const F=(d.score&&d.score.score)!=null?d.score.score:null;return e.jsx("div",{className:"v6j-scrim",onMouseDown:D=>{D.target===D.currentTarget&&t()},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",role:"dialog","aria-label":a.kicker,"data-screen-label":"Journal, "+a.kicker,children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:a.kicker}),e.jsxs("span",{className:"voice",children:["in ",a.voice,"'s voice"]}),e.jsx("span",{className:"prog",children:i==="q"?"question "+(o+1)+" of "+r.length:i==="chain"?"the analysis":i==="alibi"?"one last thing":""}),e.jsx("button",{className:"v6j-close",onClick:t,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",children:[i==="intro"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:a.intro.title}),e.jsx("p",{className:"v6j-intro-line",children:a.intro.line}),e.jsxs("div",{className:"v6j-saved",style:{marginTop:14},children:[e.jsx("span",{children:"It writes to"})," ",e.jsx(Ms,{anchor:S?"### Evening":"### Morning"})]}),e.jsxs("div",{className:"v6-acts",style:{marginTop:22},children:[e.jsxs("button",{className:"v6-run",onClick:w,autoFocus:!0,children:[MIcons.play(13)," Begin"]}),e.jsx("button",{className:"v6-act2",onClick:t,children:"Not now"}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"esc"})," closes"]})]})]}):null,i==="q"?e.jsx(Ql,{q:E,state:h,setState:p,push:m,onAdvance:C,onSkip:()=>N(!0),dots:e.jsx(Jl,{total:L,at:o})}):null,i==="chain"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",style:{marginTop:0,fontSize:22},children:"Your read, against the record."}),e.jsx(ar,{selfScore:F}),e.jsxs("div",{className:"v6-acts",style:{marginTop:18},children:[e.jsxs("button",{className:"v6-run",onClick:()=>l("alibi"),autoFocus:!0,children:["One last thing ",MIcons.arrow(13)]}),e.jsx("button",{className:"v6-act2",onClick:()=>{s&&s("evidence"),t()},children:"See the full analysis"})]})]}):null,i==="alibi"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:window.V6J.evening.alibi.q}),e.jsx("p",{className:"v6j-sub",children:window.V6J.evening.alibi.sub}),e.jsx("div",{className:"v6j-answer",children:e.jsx("textarea",{className:"v6j-ta",rows:2,placeholder:window.V6J.evening.alibi.ph,autoFocus:!0,value:j,onChange:D=>A(D.target.value),onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),P())}})}),e.jsxs("div",{className:"v6j-foot",children:[e.jsx("button",{className:"v6j-skip",onClick:()=>l("done"),children:"skip this one"}),e.jsxs("span",{className:"v6j-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," seal it"]})]})]}):null,i==="done"?e.jsxs("div",{className:"v6j-step",children:[e.jsx("h2",{className:"v6j-q",children:S?"Day closed.":"Primed."}),e.jsx("p",{className:"v6j-intro-line",children:S?"Your journal is the one write that just happened. The full close below is yours to run.":"Tonight, /analyse-day compares this intention to what actually happened."}),e.jsxs("div",{className:"v6j-writes",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Journal"})," ",x==="ok"?e.jsx(Ms,{anchor:S?"### Evening":"### Morning"}):x==="fail"?e.jsxs("span",{children:[e.jsx("span",{style:{color:"var(--m-crit, #d98069)"},children:"Couldn't write it. Your answers are kept here."})," ",e.jsx("button",{className:"v6-act2",style:{padding:"2px 10px"},onClick:()=>T.current&&T.current(),children:"Retry"})]}):e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"writing…"})]}),S?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Full close"}),e.jsxs("button",{className:"v6-file",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"Run /log then /analyse-day to close today: save the receipts and compare my journal read to the record."})),s&&s("chat"),t()},children:[MIcons.file(11)," /log + /analyse-day ",e.jsx("span",{className:"note",children:"not run yet, draft it in Chat"})]})]}):null]}),e.jsxs("div",{className:"v6-acts",style:{marginTop:22},children:[e.jsxs("button",{className:"v6-run",onClick:t,autoFocus:!0,children:[MIcons.check(13)," Done"]}),S?e.jsx("button",{className:"v6-act2",onClick:()=>{s&&s("evidence"),t()},children:"See tonight's patterns"}):null]})]}):null]})]})})}function eo({onNav:n}){const[t,s]=React.useState(null);return React.useEffect(()=>{const a=r=>s(r.detail&&r.detail.mode||"evening");return window.addEventListener("m6journal",a),()=>window.removeEventListener("m6journal",a)},[]),t?e.jsx(rr,{mode:t,onClose:()=>s(null),onNav:n}):null}function no(n){window.dispatchEvent(new CustomEvent("m6journal",{detail:{mode:n}}))}Object.assign(window,{JournalSheet:rr,JournalHost:eo,V6AlibiFrame:Zl,v6OpenJournal:no,V6JGapCard:ar});function ir({f:n,src:t,note:s}){const a=t?()=>openXray("Where this comes from",n+(s?", "+s:""),t):void 0;return e.jsxs("button",{className:"v6-file"+(t?"":" is-plain"),onClick:a,title:t?"Open the real file":"Lives in your vault",children:[MIcons.file(11)," ",n,s?e.jsx("span",{className:"note",children:s}):null]})}function to({diff:n,answer:t}){return e.jsxs("div",{className:"v6f-change",children:[e.jsxs("div",{className:"v6f-change-bar",children:[MIcons.file(12),e.jsx("button",{className:"f",onClick:()=>openXray("The real file this step changed",n.f+", "+n.anchor,n.src),children:n.f}),e.jsx("span",{className:"a",children:n.anchor})]}),e.jsx("div",{className:"v6f-diff",children:n.lines.map((s,a)=>e.jsx("div",{className:"ln is-"+s.k,children:t?s.s.replace("{answer}",t):s.s},a))})]})}function so({step:n,isNow:t,answer:s,onAnswer:a}){const r=window.V6FEED.lanes[n.lane];return e.jsxs("div",{className:"v6f-step"+(n.lane==="term"?" is-term":"")+(t?" is-now":""),children:[e.jsx("span",{className:"v6f-time",children:n.t}),e.jsxs("span",{className:"v6f-wire",children:[e.jsx("span",{className:"node"}),e.jsx("span",{className:"cord"})]}),e.jsxs("div",{className:"v6f-row",children:[e.jsxs("div",{className:"v6f-said",children:[e.jsxs("div",{className:"v6f-meta",children:[e.jsx("button",{className:"v6f-lane v6-from"+(n.lane==="move"?" is-move":""),title:"Where's this from?",onClick:()=>openXray("This step, in the event log",n.t+", "+n.live,"events"),children:r.k}),n.needsYou?e.jsx(NeedsYouTag,{}):null,n.cost?e.jsx("button",{className:"v6f-cost v6-from",title:"Where's this from?, the usage meter",onClick:()=>openXray("What this step cost",n.cost+", this step used the agent. Steps that only read your files are free and unmetered.","billing"),children:n.cost}):null]}),e.jsx("p",{className:"v6f-live",children:n.live}),n.note?e.jsx("p",{className:"v6f-note",children:n.note}):null]}),n.diff?e.jsx(to,{diff:n.diff,answer:s}):n.readOnly?e.jsxs("div",{className:"v6f-reads",children:[e.jsxs("span",{className:"lbl",children:[n.readOnly.note," —"]}),n.readOnly.files.map(i=>e.jsx(ir,{f:i.f,src:i.src},i.f))]}):n.needsYou?e.jsxs("div",{className:"v6f-ask",children:[e.jsx("p",{className:"q",children:n.needsYou.q}),s?e.jsxs("p",{className:"answered",children:[MIcons.check(12)," You said: ",s,". It keeps going."]}):e.jsx("div",{className:"opts",children:n.needsYou.options.map(i=>e.jsx("button",{onClick:()=>a(i),children:i},i))})]}):null]})]})}function ao({onNav:n}){const t=window.V6FEED,[s,a]=React.useState(1),[r,i]=React.useState(null),[l,o]=React.useState(0),c=React.useRef(null),d=React.useRef(!0),u=t.steps.length;t.steps.findIndex(g=>g.needsYou);const h=s>u;React.useEffect(()=>{if(s>u)return;const g=t.steps[s-1];if(g&&g.needsYou&&!r)return;const f=setTimeout(()=>a(v=>v+1),s===u?1600:2100);return()=>clearTimeout(f)},[s,r,l]);const p=()=>{const g=c.current;g&&(d.current=g.scrollHeight-g.scrollTop-g.clientHeight<90)};React.useEffect(()=>{const g=c.current;g&&d.current&&(g.scrollTop=g.scrollHeight)},[s,r,h]);const m=()=>{a(1),i(null),d.current=!0,o(g=>g+1)};return e.jsxs("section",{className:"v6f v6-glass m-rise",style:{"--i":0},"data-screen-label":"Run, live work feed","data-comment-anchor":"live-feed",children:[e.jsxs("div",{className:"v6f-head",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"t",children:"Live work"}),e.jsx("span",{className:"m-chip is-mute",children:"Example"}),e.jsx("span",{className:"s",children:t.header.sub}),e.jsx("span",{className:"cap",children:e.jsx("b",{children:t.caption})}),e.jsx(CaptureMark,{moment:"The live work feed",lines:()=>{const g=t.steps.slice(0,4).map(f=>f.live);return["Watch it work, every line is a real file change."].concat(g)}})]}),e.jsxs("div",{className:"v6f-body",ref:c,onScroll:p,children:[t.steps.slice(0,Math.min(s,u)).map((g,f)=>e.jsx(so,{step:g,isNow:f===Math.min(s,u)-1&&!h,answer:g.needsYou||g.diff&&g.diff.lines.some(v=>v.s.includes("{answer}"))?r:null,onAnswer:v=>i(v)},g.id+"-"+l)),h?e.jsxs("div",{className:"v6f-step",children:[e.jsx("span",{className:"v6f-time",children:"9:35 PM"}),e.jsx("span",{className:"v6f-wire",children:e.jsx("span",{className:"node",style:{background:"var(--m-gold-2)"}})}),e.jsxs("div",{className:"v6f-result",children:[e.jsx("p",{className:"line",children:t.result.line}),e.jsx("div",{className:"files",children:t.result.files.map(g=>e.jsx(ir,{f:g.f,src:g.src,note:g.note},g.f))}),e.jsxs("div",{className:"meta",children:[e.jsx("span",{children:e.jsx("span",{className:"m-num",children:t.result.dur})}),e.jsxs("button",{className:"v6-from",style:{color:"var(--m-ink-3)"},title:"Where's this from?, the usage meter",onClick:()=>openXray("What tonight's run cost",t.result.cost+", "+t.result.costNote,"billing"),children:["cost ",e.jsx("b",{className:"m-num",style:{color:"var(--m-ink-2)",fontWeight:500},children:t.result.cost})]}),e.jsxs("button",{className:"m-link",style:{marginLeft:"auto"},onClick:()=>n&&n("evidence"),children:["The receipt, in Evidence ",MIcons.arrow(12)]})]}),e.jsx(TermLine,{c:"/plan-tomorrow"})]})]}):null]}),e.jsxs("div",{className:"v6f-foot",children:[e.jsx("span",{children:"Sessions you start in your own terminal appear here on their own."}),e.jsx("span",{className:"sp"}),e.jsxs("button",{onClick:m,children:[MIcons.loop(12)," Watch it again"]})]})]})}Object.assign(window,{LiveFeed:ao});function Jn(){return new Date().toDateString()}function As(){try{if(matchMedia("(prefers-reduced-motion: reduce)").matches)return!0;const n=document.querySelector("[data-mmotion]");return n&&n.getAttribute("data-mmotion")==="off"}catch{return!1}}function lr({to:n,prefix:t}){const[s,a]=React.useState(As()?n:0);return React.useEffect(()=>{if(As()){a(n);return}let r;const i=performance.now(),l=850,o=c=>{const d=Math.min(1,(c-i)/l),u=1-Math.pow(1-d,3);a(Math.round(u*n)),d<1&&(r=requestAnimationFrame(o))};return r=requestAnimationFrame(o),()=>cancelAnimationFrame(r)},[n]),e.jsxs("span",{className:"n m-num",children:[t,s]})}function ro({onClose:n}){const t=window.V6NO.no,[s,a]=useStored3("m6.no.overrode",null),[,r]=useStored3("m6.no.heard",null),[i,l]=React.useState(!1),[o,c]=React.useState("");React.useEffect(()=>{const m=g=>{g.key==="Escape"&&n()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n]);const d=()=>{r(Jn()),n()},[u,h]=React.useState(!1),p=()=>{const m=o.trim();!m||u||(h(!0),fetch("/api/health").then(g=>g.json()).then(g=>fetch("/api/override",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":g&&g.token},body:JSON.stringify({what:t.line,over:"the standing no",reason:m})})).then(g=>{if(!g.ok)throw new Error("HTTP "+g.status);return g.json()}).then(()=>{a({when:Jn(),reason:m}),v6Toast("Logged as an override, with your reason","pattern-manifest.json","overrides"),window.dispatchEvent(new CustomEvent("m6no-changed")),n()}).catch(g=>{console.warn("override log failed",g),v6Toast("Could not log the override, nothing was written","pattern-manifest.json","overrides")}).finally(()=>h(!1)))};return e.jsx("div",{className:"v6j-scrim",onMouseDown:m=>{m.target===m.currentTarget&&n()},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",role:"dialog","aria-label":"The standing no","data-screen-label":"The standing no, evidence",children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"The standing no"}),e.jsxs("span",{className:"v6n-held",style:{fontWeight:400,letterSpacing:"0.04em",textTransform:"none"},children:["holding since ",t.heldSince]}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:n,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",children:[e.jsx("p",{className:"v6n-bigline",children:t.line}),e.jsx("div",{className:"v6n-ev",children:t.evidence.map(m=>e.jsxs("div",{className:"v6n-ev-row",children:[e.jsx("span",{className:"s",children:m.s}),e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("The evidence behind the no",m.s,m.src),children:[MIcons.file(11)," ",m.f]})]},m.f+m.s.slice(0,12)))}),e.jsxs("div",{className:"v6n-costblock",children:[e.jsxs("div",{className:"top",children:[t.cost.days>=1?e.jsxs("div",{className:"v6n-costnum",children:[e.jsx(lr,{to:t.cost.days,prefix:"~"}),e.jsx("span",{className:"n",style:{fontSize:19},children:" days"}),e.jsx("span",{className:"l",children:"what going around it cost"})]}):null,e.jsxs("p",{className:"line",style:{flex:1,minWidth:200},children:["You've gone around this ",e.jsx("b",{className:"m-num",children:t.cost.times})," times. ",t.cost.line]})]}),e.jsxs("div",{className:"sub",children:[e.jsx("span",{style:{flex:1,minWidth:200},children:s?t.afterOverride:t.cost.sub}),e.jsxs("button",{className:"v6-file",onClick:()=>openXray("Where the cost is counted",(t.cost.days>=1?"~"+t.cost.days+" days across ":"")+t.cost.times+" overrides",t.cost.src),children:[MIcons.file(11)," ",t.cost.f]})]})]}),i?e.jsxs("div",{className:"v6n-anyway",children:[e.jsx("p",{className:"lbl",children:"One line, why this time is worth it. It goes in the log with today's date."}),e.jsx("textarea",{className:"v6j-ta",rows:2,autoFocus:!0,placeholder:"Because…",value:o,onChange:m=>c(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),p())}}),e.jsxs("div",{className:"v6-acts",style:{marginTop:12},children:[e.jsxs("button",{className:"v6-run",onClick:p,disabled:!o.trim()||u,children:[MIcons.play(13)," ",u?"Logging…":"Log it and go"]}),e.jsx("button",{className:"v6-act2",onClick:()=>l(!1),children:"Back"}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"↩"})," logs it"]})]})]}):e.jsxs("div",{className:"v6-acts",style:{marginTop:18},children:[e.jsxs("button",{className:"v6-run",onClick:d,autoFocus:!0,children:[MIcons.check(13)," I hear it"]}),s?e.jsx("span",{className:"v6-enter",style:{marginLeft:0},children:"overridden today, on the record"}):e.jsx("button",{className:"v6-act2",onClick:()=>l(!0),children:"I'm doing it anyway"}),e.jsx(CaptureMark,{moment:"The standing no",lines:()=>[t.line,t.why+", from your record.","Gone around "+t.cost.times+" times"+(t.cost.days>=1?" · ~"+t.cost.days+" days":"")+", counted from "+t.cost.f+"."]}),e.jsxs("span",{className:"v6-enter",children:[e.jsx("kbd",{className:"v6-kbd",children:"esc"})," closes"]})]})]})]})})}function io(){const n=window.V6NO.no,[t,s]=React.useState(()=>{try{return JSON.parse(localStorage.getItem("m6.no.mode"))||"active"}catch{return"active"}}),[a,r]=React.useState(!1),[i,l]=React.useState(0);React.useEffect(()=>{const h=m=>s(m.detail),p=()=>l(m=>m+1);return window.addEventListener("m6no-mode",h),window.addEventListener("m6no-changed",p),()=>{window.removeEventListener("m6no-mode",h),window.removeEventListener("m6no-changed",p)}},[]);let o=null,c=null;try{o=JSON.parse(localStorage.getItem("m6.no.heard"))}catch{}try{c=JSON.parse(localStorage.getItem("m6.no.overrode"))}catch{}const d=o===Jn(),u=c&&c.when===Jn();return t==="rest"?null:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"v6n-strip v6-glass m-rise"+(d||u?" is-heard":""),style:{"--i":1},onClick:()=>r(!0),"data-screen-label":"Home, the standing no","data-comment-anchor":"standing-no",title:"The evidence behind it, and what going around it has cost",children:[e.jsx("span",{className:"ico",children:MIcons.shield(16)}),e.jsxs("div",{className:"tx",children:[e.jsx("p",{className:"line",children:n.line}),e.jsxs("p",{className:"why",children:[n.why,", from your record."]})]}),u?e.jsx("span",{className:"state is-over",children:"Overridden today"}):d?e.jsx("span",{className:"state",children:"Heard this morning"}):null,e.jsxs("span",{className:"cost m-num",children:[n.cost.times," overrides",n.cost.days>=1?" · ~"+n.cost.days+" days":""]}),e.jsx("span",{className:"chev",children:MIcons.arrow(14)})]}),a?e.jsx(ro,{onClose:()=>r(!1)}):null]})}function lo(){const n=window.V6NO.svd,t=(s,a)=>e.jsxs("div",{className:"entry",children:[e.jsx("span",{className:"lk",style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",minWidth:64,whiteSpace:"nowrap"},children:a}),e.jsx("span",{className:"s",children:s.s}),e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("One side of the number",s.s,s.src),children:[MIcons.file(11)," ",s.f," ",e.jsx("span",{className:"note",children:s.note})]})]});return e.jsxs("section",{className:"v6j-gapcard m-rise",style:{"--i":1,marginTop:0,flex:1,minWidth:0},"data-screen-label":"Evidence, said vs did","data-comment-anchor":"said-vs-done",children:[e.jsxs("div",{className:"v6-honest-k",children:[MIcons.xray(12)," Said vs did, this week"]}),e.jsxs("div",{className:"v6j-gapnums",children:[e.jsxs("div",{className:"v6j-gapnum",children:[e.jsx("span",{className:"n",style:{fontSize:15,color:"var(--m-ink-3)"},children:"not measured"}),e.jsx("span",{className:"l",children:"went to building"})]}),e.jsx("span",{className:"v6j-gaparrow",children:MIcons.arrow(18)}),e.jsxs("div",{className:"v6j-gapnum is-record",children:[e.jsx("span",{className:"n",style:{fontSize:15,color:"var(--m-ink-3)"},children:"not measured"}),e.jsx("span",{className:"l",children:"went to shipping, the priority you named"})]})]}),e.jsx("div",{className:"entries v6n-svd",style:{padding:0,border:"none",background:"none",boxShadow:"none"},children:e.jsxs("div",{className:"entries",style:{marginTop:13,paddingTop:11,borderTop:"1px solid var(--m-line)",display:"flex",flexDirection:"column",gap:7},children:[t(n.said,"You said"),t(n.done,"It went")]})})]})}function oo(){const n=window.V6NO.grave;return e.jsxs("div",{className:"v6n-grave","data-screen-label":"Buried-idea warning",children:[e.jsxs("div",{className:"k",children:[MIcons.shield(11)," ",n.kicker]}),e.jsx("p",{className:"looks",children:n.looksLike}),e.jsxs("p",{className:"quote",children:["“",n.quote,"”"]}),e.jsxs("div",{className:"meta",children:[e.jsx("span",{children:e.jsx("b",{children:n.cost})}),e.jsxs("button",{className:"v6-file",title:"The exit interview, in the real file",onClick:()=>openXray("The exit interview, and why this matched",n.quote+" · "+n.looksLike,n.src),children:[MIcons.file(11)," ",n.f]})]})]})}Object.assign(window,{StandingNo:io,SaidVsDone:lo,GraveEcho:oo,V6NCount:lr});(function(){const n=window.V6RW;function t(f,v,x){return new Date(f,v-1,x)}function s(f){return f.getFullYear()+"-"+String(f.getMonth()+1).padStart(2,"0")+"-"+String(f.getDate()).padStart(2,"0")}const a=["January","February","March","April","May","June","July","August","September","October","November","December"];function r(f){return a[f.getMonth()]+" "+f.getDate()}const i=(()=>{const f=[],v=t(...n.start),x=t(...n.end);for(let b=new Date(v);b<=x;b.setDate(b.getDate()+1))f.push(new Date(b));return f})(),l=i.map(s),o=n.keyframes.map(f=>l.indexOf(f.d)),c=i.length-1;function d(f){let v=0;for(let x=0;x<o.length&&o[x]<=f;x++)v=x;return v}function u(){try{if(matchMedia("(prefers-reduced-motion: reduce)").matches)return!0;const f=document.querySelector("[data-mmotion]");return f&&f.getAttribute("data-mmotion")==="off"}catch{return!1}}function h({v:f}){const[v,x]=React.useState(f),b=React.useRef(f);return React.useEffect(()=>{if(f==null||b.current==null||u()){x(f),b.current=f;return}const j=b.current;if(b.current=f,j===f){x(f);return}let A;const I=performance.now(),k=320,S=E=>{const L=Math.min(1,(E-I)/k),w=1-Math.pow(1-L,2);x(Math.round(j+(f-j)*w)),L<1&&(A=requestAnimationFrame(S))};return A=requestAnimationFrame(S),()=>cancelAnimationFrame(A)},[f]),f==null?e.jsx("span",{className:"n is-dash",children:"none"}):e.jsx("span",{className:"n m-num",children:v})}function p({f,src:v}){return e.jsxs("button",{className:"v6-file",title:"Open the real file",onClick:()=>openXray("Your record on this date",f,v),children:[MIcons.file(11)," ",f]})}function m({onClose:f}){const[v,x]=React.useState(c),[b,j]=React.useState(!1),[A,I]=React.useState(!1),k=React.useRef(null),S=d(v),E=n.keyframes[S],L=i[v],w=l[v],N=n.dailies[w],C=w<n.moverDay1,P=v===c;React.useEffect(()=>{if(!b)return;let y,V=performance.now(),H=0;const R=Q=>{const je=Math.min(200,Q-V);V=Q,H+=je,x(se=>{if(se>=c)return j(!1),se;const ke=o.includes(se)?760:95;return H>=ke?(H=0,Math.min(se+1,c)):se}),y=requestAnimationFrame(R)};return y=requestAnimationFrame(R),()=>cancelAnimationFrame(y)},[b]);const M=()=>{if(u()){const y=o.find(V=>V>v);x(y??c);return}v>=c&&!b&&x(0),j(y=>!y)},T=y=>{const V=k.current.getBoundingClientRect(),H=Math.min(1,Math.max(0,(y-V.left)/V.width));return Math.round(H*c)},F=y=>{j(!1),I(!0),x(T(y.clientX));try{k.current.setPointerCapture(y.pointerId)}catch{}},D=y=>{A&&x(T(y.clientX))},Y=()=>{I(!1),x(y=>c-y<=3?c:y)};React.useEffect(()=>{const y=V=>{if(V.key==="Escape"){f();return}V.key==="ArrowLeft"&&(V.preventDefault(),j(!1),x(H=>Math.max(0,H-1))),V.key==="ArrowRight"&&(V.preventDefault(),j(!1),x(H=>Math.min(c,H+1))),V.key===" "&&(V.preventDefault(),M())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[f,v,b]);const z=y=>y/c*100+"%";return e.jsx("div",{className:"v6j-scrim",onMouseDown:y=>{y.target===y.currentTarget&&f()},children:e.jsxs("div",{className:"v6r-sheet v6-glass v6-pop",role:"dialog","aria-label":"Rewind, see any day","data-screen-label":"Rewind, the record over time",children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"Rewind"}),e.jsx("span",{className:"v6r-honest",children:n.honest}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:f,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsx("div",{className:"v6r-body",children:e.jsxs("div",{className:"v6r-grid",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"v6r-panel",children:[e.jsxs("div",{className:"k",children:[MIcons.compass?MIcons.compass(12):null," The bet, as of then ",e.jsx("span",{className:"when",children:P?"today":"on "+r(L)})]}),e.jsxs("div",{className:"v6r-x",children:[e.jsx("p",{className:"v6r-bet",children:E.bet}),E.since&&E.since!=="—"?e.jsxs("p",{className:"v6r-since",children:["held since ",E.since]}):null,e.jsx("p",{className:"v6r-strat",children:E.strategy}),E.calib?e.jsx("p",{className:"v6r-calib",children:E.calib}):null]},"bet"+S)]}),e.jsxs("div",{className:"v6r-panel",style:{marginTop:14},children:[e.jsxs("div",{className:"k",children:[MIcons.spark(12)," What changed"]}),e.jsxs("div",{className:"v6r-x",children:[e.jsx("p",{className:"v6r-ev",children:E.ev}),e.jsx("div",{className:"v6r-files",children:E.files.map(y=>e.jsx(p,{f:y.f,src:y.src},y.f+y.src))})]},"ev"+S)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"v6r-panel",children:[e.jsx("div",{className:"k",children:"The numbers, as of then"}),E.nums?e.jsxs("div",{className:"v6r-nums",children:[e.jsxs("div",{className:"v6r-num",children:[e.jsx(h,{v:E.nums.posts}),e.jsx("span",{className:"l",children:"posts shipped"})]}),e.jsxs("div",{className:"v6r-num",children:[e.jsx(h,{v:E.nums.convs}),e.jsx("span",{className:"l",children:"real conversations"})]}),e.jsxs("div",{className:"v6r-num",children:[e.jsx(h,{v:E.nums.streak}),e.jsx("span",{className:"l",children:"streak that day"})]}),e.jsxs("div",{className:"v6r-num",children:[e.jsx(h,{v:E.nums.overrides}),e.jsx("span",{className:"l",children:"overrides total"})]})]}):e.jsx("p",{className:"v6r-prenote",children:"No counted numbers yet"+(n.moverDay1?", the record starts counting on "+r(t(...String(n.moverDay1).split("-").map(Number)))+", Mover OS day one":"")+"."})]}),e.jsxs("div",{className:"v6r-panel v6r-day",style:{marginTop:14},children:[e.jsxs("div",{className:"k",children:["That day ",e.jsx("span",{className:"when",children:r(L)})]}),N?e.jsxs("div",{className:"v6r-x",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Plan"}),e.jsx("span",{children:N.plan})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Got"}),e.jsx("span",{children:N.got})]}),e.jsx("div",{className:"v6r-files",children:e.jsx(p,{f:"Daily/"+w+".md",src:"dailyNote"})})]},"day"+w):e.jsx("p",{className:"v6r-gap",children:C?n.gapBefore:n.gapAfter})]})]})]})}),e.jsxs("div",{className:"v6r-scrub","data-comment-anchor":"rewind-scrubber",children:[e.jsxs("div",{className:"v6r-scrub-top",children:[e.jsx("button",{className:"v6r-play",onClick:M,"aria-label":b?"Pause":"Play",title:u()?"Step to the next change":b?"Pause":"Play the record forward",children:b?MIcons.pause(15):MIcons.play(15)}),e.jsxs("span",{className:"v6r-readout",children:[r(L),e.jsx("span",{className:"y",children:L.getFullYear()})]}),e.jsx("button",{className:"v6r-today"+(P?" is-here":""),onClick:()=>{j(!1),x(c)},children:P?"Today":"Back to today"}),e.jsx(CaptureMark,{moment:"The record, rewound",lines:()=>[r(L)+", your record as it was.","The bet then: "+E.bet,E.ev]})]}),e.jsxs("div",{ref:k,className:"v6r-track"+(A?" is-drag":""),onPointerDown:F,onPointerMove:D,onPointerUp:Y,role:"slider","aria-label":"Rewind to a date","aria-valuemin":0,"aria-valuemax":c,"aria-valuenow":v,"aria-valuetext":r(L),tabIndex:0,children:[e.jsx("div",{className:"rail"}),e.jsx("div",{className:"fill",style:{width:z(v)}}),o.map((y,V)=>e.jsx("span",{className:"tick"+(y<=v?" is-passed":""),style:{left:z(y)},title:n.keyframes[V].ev},V)),e.jsx("span",{className:"todaymark",style:{left:z(c)}}),e.jsx("span",{className:"handle",style:{left:z(v)}})]}),e.jsxs("div",{className:"v6r-scrub-hints",children:[e.jsx("span",{children:"drag to any day"}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"←"})," ",e.jsx("kbd",{className:"v6-kbd",children:"→"})," a day at a time"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"v6-kbd",children:"space"})," ",u()?"next change":"play"]}),e.jsx("span",{children:"ticks are the days something changed"})]})]})]})})}function g(){const[f,v]=React.useState(!1);return React.useEffect(()=>{const x=()=>v(!0);return window.addEventListener("m6rewind",x),()=>window.removeEventListener("m6rewind",x)},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"v6r-pillrow m-rise",style:{"--i":2,margin:0,justifyContent:"flex-start"},children:e.jsxs("button",{className:"v6r-pill",onClick:()=>v(!0),"data-screen-label":"Home, rewind pill",title:"Re-read your record as it was on any date",children:[MIcons.loop(13)," Rewind, see any day"]})}),f?e.jsx(m,{onClose:()=>v(!1)}):null]})}Object.assign(window,{RewindPill:g,RewindStage:m})})();function ns(n){return window.V6MAP.use[n]||{n:0}}function co(n){return n===0?0:n<5?.3:n<16?.62:1}function uo({c:n,onOpen:t,onHover:s}){const a=window.V6SAY.byCmd[n],r=ns(n);return a?e.jsxs("button",{className:"v6m-tile",style:{"--use":co(r.n)},onClick:()=>t(n),onMouseEnter:()=>s(n),onMouseLeave:()=>s(null),"data-screen-label":"Move tile, "+n,children:[e.jsx("span",{className:"u m-num"+(r.n>0?" is-lit":""),children:r.n>0?"×"+r.n:"never"}),e.jsx("span",{className:"nm",children:a.name}),e.jsx("span",{className:"c",children:a.c})]}):null}function or({c:n,onClose:t,onNav:s}){const a=window.V6SAY.byCmd[n],r=ns(n);return React.useEffect(()=>{const i=l=>{l.key==="Escape"&&(l.stopPropagation(),t())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[t]),a?e.jsx("div",{className:"v6j-scrim",onMouseDown:i=>{i.target===i.currentTarget&&t()},children:e.jsxs("div",{className:"v6j-sheet v6-glass v6-pop",style:{width:"min(560px, 100%)"},role:"dialog","aria-label":a.name,"data-screen-label":"Move sheet, "+n,children:[e.jsxs("div",{className:"v6j-head",children:[e.jsx("span",{className:"k",children:"One move"}),e.jsx("span",{className:"voice",children:a.c}),e.jsx("span",{className:"prog"}),e.jsx("button",{className:"v6j-close",onClick:t,"aria-label":"Close",children:MIcons.x(14)})]}),e.jsxs("div",{className:"v6j-body",style:{padding:"18px 20px 20px"},children:[e.jsx(MoveCard,{mv:{move:a,match:null,why:null},onNav:i=>{s&&s(i),t()}}),e.jsxs("div",{className:"v6m-usage",children:[r.n>0?e.jsxs("span",{children:["You've run this ",e.jsx("b",{className:"m-num",style:{color:"var(--m-gold-2)"},children:r.n})," ",r.n===1?"time":"times",r.last?", last "+r.last:"","."]}):r.auto?e.jsxs("span",{children:["Never run by hand, ",r.auto,"."]}):e.jsx("span",{children:"Never run. First time's the cheapest it will ever be."}),e.jsxs("button",{className:"v6-file",title:"Where usage is counted",onClick:()=>openXray("Where usage is counted",a.c+", "+(r.n||0)+" runs in your session history",window.V6MAP.usageSrc.src),children:[MIcons.file(11)," ",window.V6MAP.usageSrc.f]})]})]})]})}):null}function ho({onNav:n}){const t=window.V6MAP,[s,a]=React.useState(null),[r,i]=React.useState(null),l=t.buckets.reduce((d,u)=>d+u.moves.length,0),o=t.buckets.reduce((d,u)=>d+u.moves.filter(h=>ns(h).n===0).length,0),c=r?window.V6SAY.byCmd[r]:null;return e.jsxs("section",{className:"v6m v6-glass m-rise",style:{"--i":2,marginTop:22},"data-screen-label":"Run, the moves map","data-comment-anchor":"moves-map",children:[e.jsxs("div",{className:"v6m-head",children:[e.jsx("span",{className:"t",children:t.title}),e.jsx("span",{className:"s",children:t.sub}),e.jsxs("span",{className:"never",children:[e.jsxs("span",{children:[e.jsx("b",{className:"m-num",style:{color:"var(--m-ink-1)"},children:o})," of ",e.jsx("b",{className:"m-num",children:l})," have never run, counted, not guessed"]}),e.jsxs("button",{className:"v6-file",title:"Where usage is counted",onClick:()=>openXray("Where usage is counted",o+" of "+l+" moves have never appeared in a session",t.usageSrc.src),children:[MIcons.file(11)," ",t.usageSrc.f]})]})]}),e.jsx("div",{className:"v6m-body",children:t.buckets.map(d=>e.jsxs("div",{className:"v6m-group",children:[e.jsxs("div",{className:"gk",children:[d.k," ",e.jsx("span",{className:"n",children:d.moves.length})]}),e.jsx("div",{className:"v6m-tiles",children:d.moves.map(u=>e.jsx(uo,{c:u,onOpen:a,onHover:i},u))})]},d.k))}),e.jsx("div",{className:"v6m-preview",children:c?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"c",children:c.c}),e.jsx("span",{children:c.does})]}):e.jsx("span",{className:"quiet",children:"Brighter tiles are the ones you actually use. Hover any tile for what it does; click to see its files and run it."})}),s?e.jsx(or,{c:s,onClose:()=>a(null),onNav:n}):null]})}Object.assign(window,{MovesMap:ho,MoveSheet:or});function mo({route:n,onNav:t,routes:s}){const a=s||window.V3.routes.map(r=>r.id);return e.jsxs("nav",{className:"m-rail","aria-label":"Sections",children:[e.jsx("span",{className:"m-rail-mark",children:"M"}),window.V3.routes.filter(r=>a.includes(r.id)).map(r=>e.jsxs("button",{className:"m-rail-item"+(n===r.id?" is-active":""),onClick:()=>t(r.id),children:[MIcons[r.ic](19),e.jsx("span",{children:r.k})]},r.id)),e.jsx("div",{className:"m-rail-foot",children:(()=>{const r=window.V3&&window.V3.name||"Operator";return e.jsx("span",{className:"m-rail-ava",title:r,children:r.charAt(0).toUpperCase()})})()})]})}function po({route:n,onPalette:t,sparse:s,setSparse:a}){const r=window.V3.routes.find(l=>l.id===n),i=window.V3;return e.jsxs("header",{className:"m-top",children:[e.jsx("span",{className:"m-top-route",children:r?r.k:""}),e.jsxs("span",{className:"m-top-date",children:[i.date," · Day ",s?window.V3SPARSE.day:i.day]}),e.jsxs("div",{className:"m-top-right",children:[e.jsxs("button",{className:"m-ghost"+(s?" is-on":""),onClick:()=>a(!s),title:"Preview the day-2 sparse-data state",children:[MIcons.moon(14)," ",s?"Day 2 state":"Day 41"]}),e.jsxs("button",{className:"m-search",onClick:t,children:[MIcons.search(14),e.jsx("span",{style:{fontSize:13},children:"Command palette"}),e.jsx("kbd",{children:"⌘K"})]}),e.jsx("button",{className:"m-ghost",style:{width:38,height:38,padding:0,justifyContent:"center",borderRadius:999},title:"Notifications",children:MIcons.bell(16)})]})]})}function fo({data:n}){return e.jsxs("div",{className:"m-strip m-rise",style:{"--i":6},children:[n.statusStrip.map(t=>e.jsxs("button",{className:"m-strip-cell",onClick:()=>openXray("System status, "+t.k,t.v,t.src),children:[t.warn?e.jsx("span",{className:"m-dot is-warn"}):null,e.jsx("span",{className:"k",children:t.k}),e.jsx("span",{children:t.v})]},t.k)),e.jsx("button",{className:"m-strip-cell",style:{flex:"0 0 auto"},onClick:()=>openXray("System status","System snapshot","cli"),children:e.jsxs("span",{style:{color:"var(--m-gold-2)",display:"inline-flex",alignItems:"center",gap:7,fontSize:11.5},children:[MIcons.xray(13)," Sources"]})})]})}function go({nudge:n,onNav:t}){return n?e.jsxs("div",{className:"m-nudge m-rise",style:{"--i":1},children:[e.jsx("span",{className:"m-dot is-warn"}),e.jsx("span",{children:n.line}),e.jsxs("button",{className:"m-link is-gold act",onClick:()=>t(n.route),children:[n.action," ",MIcons.arrow(13)]})]}):null}Object.assign(window,{Rail:mo,Topbar:po,StatusStrip:fo,Nudge:go});const Ls={live:{label:"parser live",tone:"good"},partial:{label:"parser partial",tone:"warn"},planned:{label:"parser planned",tone:"mute"}},Os={live:{label:"live now",cls:"is-live",color:"var(--m-gold-2)"},ok:{label:"fresh",cls:"is-good",color:"var(--m-good)"},stale:{label:"stale",cls:"is-warn",color:"var(--m-warn)"}};function xo(){const[n,t]=React.useState(null),[s,a]=React.useState(!1),[r,i]=React.useState(null);React.useEffect(()=>{const g=v=>{t(v.detail),i(null),requestAnimationFrame(()=>a(!0))},f=v=>{v.key==="Escape"&&a(!1)};return window.addEventListener("mxray",g),window.addEventListener("keydown",f),()=>{window.removeEventListener("mxray",g),window.removeEventListener("keydown",f)}},[]);const l=()=>a(!1);if(!n)return null;const{claim:o,value:c,src:d}=n,u=Ls[d.status]||Ls.planned,h=Os[d.fresh||(d.status==="planned"?"stale":"ok")]||Os.ok,p=(g,f)=>{i({k:g,line:f})},m=g=>{g&&fetch("/api/health").then(f=>f.json()).then(f=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":f&&f.token},body:JSON.stringify({filePath:g})})).catch(f=>console.warn("open source failed",f))};return e.jsxs("div",{"aria-hidden":!s,style:{pointerEvents:s?"auto":"none"},children:[e.jsx("div",{className:"m-xray-scrim"+(s?" is-open":""),onClick:l}),e.jsxs("aside",{className:"m-xray"+(s?" is-open":""),role:"dialog","aria-label":"Where this comes from",children:[e.jsxs("div",{className:"m-xray-head",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{display:"flex",alignItems:"center",gap:8,marginBottom:9},children:[MIcons.xray(13)," Where this comes from",e.jsx("span",{style:{fontWeight:400,letterSpacing:0,textTransform:"none",fontSize:11,color:"var(--m-ink-3)"},children:"every claim opens to its file"})]}),e.jsx("h2",{className:"m-xray-claim",children:o}),c?e.jsx("p",{style:{marginTop:6,fontSize:14,color:"var(--m-ink-2)"},children:c}):null]}),e.jsx("button",{className:"m-xray-close",onClick:l,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"m-xray-body",children:[e.jsxs("div",{className:"m-xray-file",children:[e.jsxs("div",{className:"m-xray-file-bar",children:[MIcons.file(14),e.jsx("span",{className:"m-path",style:{color:"var(--m-ink-1)"},children:d.path}),e.jsx(CopyPathBtn,{path:d.path}),e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:d.updated})]}),e.jsx("div",{className:"m-xray-anchor",children:d.anchor}),e.jsx("div",{className:"m-xray-excerpt",children:d.excerpt})]}),e.jsxs("div",{className:"m-xray-grid",children:[e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Confidence"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(Conf,{n:d.confidence})," ",e.jsxs("span",{className:"m-num",children:[d.confidence," / 5"]})]})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Parser"}),e.jsxs("div",{className:"v",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:"m-dot is-"+(u.tone==="good"?"good":u.tone==="warn"?"warn":"off")}),e.jsx("span",{className:"m-mono",style:{fontSize:12},children:d.parser})]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--m-ink-3)",marginTop:4},children:u.label})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Freshness"}),e.jsxs("div",{className:"v m4-xfresh",children:[e.jsx("span",{className:"m-dot "+h.cls,style:{background:h.color,boxShadow:"none"}}),e.jsx("span",{style:{color:h.color},children:h.label}),e.jsx("span",{style:{color:"var(--m-ink-3)"},children:d.updated})]})]}),e.jsxs("div",{className:"m-xray-cell",children:[e.jsx("div",{className:"k",children:"Written by"}),e.jsx("div",{className:"v m-mono",style:{fontSize:12.5},children:d.workflow})]})]}),d.changed?e.jsxs("div",{className:"m4-xchanged",children:[e.jsx("div",{className:"k",children:"What changed because of it"}),d.changed]}):null,d.emptyState?e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.55},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:"If this source were empty:"})," ",d.emptyState]}):null,e.jsxs("div",{className:"m-xray-actions",children:[e.jsxs("button",{className:"m-xray-act",onClick:()=>{m(d.path),p("open","Opened "+d.path.split("/").pop()+" at "+d.anchor)},children:[MIcons.file(15)," Open source ",e.jsx("span",{className:"sub m-mono",children:d.path.split("/").pop()})]}),e.jsxs("button",{className:"m-xray-act",onClick:()=>p("run","Use the newer X-Ray drawer to run "+d.workflow+"."),children:[MIcons.play(15)," Run workflow ",e.jsx("span",{className:"sub m-mono",children:d.workflow})]}),e.jsxs("button",{className:"m-xray-act",onClick:()=>p("ask","Use the newer X-Ray drawer to ask about this claim."),children:[MIcons.agent(15)," Ask an agent ",e.jsx("span",{className:"sub",children:"about this claim"})]}),r?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,padding:"10px 4px 0",fontSize:12.5,color:"var(--m-good)"},children:[MIcons.check(13)," ",e.jsx("span",{style:{color:"var(--m-ink-2)"},children:r.line})]}):null]}),e.jsx("p",{style:{fontSize:11.5,lineHeight:1.6,color:"var(--m-ink-3)",margin:0},children:"All of this is a real file in your vault. The dashboard is a window onto it, and a pen that writes it. Nothing here is a number we made up."})]})]})]})}Object.assign(window,{XrayDrawer:xo});function cr(){const n=new Date().getHours();return n<5?"night":n<12?"morning":n<18?"afternoon":"evening"}function Ze({what:n,src:t,doing:s}){const[a,r]=React.useState(!1),i=React.useRef(null);return React.useEffect(()=>{if(!a)return;const l=o=>{i.current&&!i.current.contains(o.target)&&r(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[a]),e.jsxs("span",{ref:i,style:{position:"relative",display:"inline-flex"},children:[e.jsx("button",{type:"button",className:"m4-hint","aria-label":"What is this?","aria-expanded":a,onClick:()=>r(!a),children:"?"}),a?e.jsxs("span",{className:"m4-hint-pop",role:"note",children:[n,s?e.jsxs(e.Fragment,{children:[" ",s]}):null,t?e.jsxs("span",{className:"s",children:["where this comes from: ",t]}):null]}):null]})}function dr({id:n,children:t}){const[s,a]=useStored3("m4.newhere."+n,!1);return s?null:e.jsxs("div",{className:"m4-newhere",role:"note",children:[e.jsx("span",{className:"tag",children:"New here"}),e.jsx("span",{className:"t",children:t}),e.jsx("button",{className:"x",onClick:()=>a(!0),"aria-label":"Got it, hide this",children:MIcons.x(12)})]})}const ut={};function ur(n,t){const[s,a]=React.useState(!ut[n]);return React.useEffect(()=>{if(ut[n])return;const r=setTimeout(()=>{ut[n]=!0,a(!1)},t||650);return()=>clearTimeout(r)},[n]),s}function yo({className:n,idle:t,running:s,done:a,icon:r,onDone:i,small:l}){const[o,c]=React.useState("idle"),d=()=>{o==="idle"&&(c("running"),setTimeout(()=>{c("done"),i&&i()},1100))},u=o==="running"?s||"Working…":o==="done"?a||"Done":t;return e.jsxs("button",{className:n||"m-cta-line",onClick:d,disabled:o==="running",style:{opacity:o==="running"?.7:1,...l?{padding:"8px 14px",fontSize:12}:{}},children:[o==="done"?MIcons.check(13):r||null," ",u]})}function vo({bet:n,compact:t}){return e.jsxs("div",{className:"m4-ledger","data-coach":"bet","data-comment-anchor":"bet-ledger",style:t?{marginTop:6}:null,children:[t?null:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:4},children:e.jsxs("span",{className:"m-kicker",children:[m4Lens().betKicker," · day ",e.jsxs("span",{className:"m-num",children:[n.day," of ",n.of]})]})}),e.jsxs("div",{className:"m4-ledger-row is-if",children:[e.jsx("span",{className:"lk",children:"IF I"}),e.jsx("span",{className:"lv",children:e.jsx(X,{claim:"The bet, the habit",value:n.iff,src:n.src,children:n.iff})})]}),e.jsxs("div",{className:"m4-ledger-row is-then",children:[e.jsx("span",{className:"lk",children:"THEN"}),e.jsx("span",{className:"lv",style:t?{fontSize:24}:null,children:e.jsx(X,{claim:"The bet, the result it should produce",value:n.then,src:n.src,children:n.then})})]}),e.jsxs("div",{className:"m4-ledger-row is-because",children:[e.jsx("span",{className:"lk",children:"SO FAR"}),e.jsx("span",{className:"lv","data-coach":"xray-demo",children:e.jsx(X,{claim:"The bet, the evidence so far",value:n.because,src:"metrics",children:n.because})})]}),e.jsxs("div",{className:"m4-ledger-row is-kill",children:[e.jsx("span",{className:"lk",children:"WRONG IF"}),e.jsx("span",{className:"lv",children:e.jsx(X,{claim:"The bet, what would prove it wrong",value:n.killIf,src:n.src,children:n.killIf})})]}),e.jsxs("div",{className:"m4-ledger-foot",children:[e.jsxs("span",{className:"m4-sacrifice",children:[e.jsx("span",{className:"lk",children:"GIVING UP"}),e.jsx(X,{claim:"What you're giving up for this bet",value:n.sacrifice,src:n.src,children:n.sacrifice})]}),t?null:e.jsxs("div",{className:"m-pace",style:{minWidth:240,maxWidth:330},children:[e.jsx(X,{claim:"Progress toward the goal",value:n.pace.value,src:n.pace.src,as:"span",className:"v m-num",children:n.pace.value}),e.jsx("div",{className:"m-pace-bar",children:e.jsx("i",{style:{width:n.pace.pct+"%"}})})]})]})]})}function wo({meta:n,D:t}){const s=Array.isArray(n.weekStrip)?n.weekStrip:[],a=n.streakNum!=null?n.streakNum:t.streak!=null?t.streak:null,r=n.streakNote||(a!=null?"day streak":null);return a==null&&!s.length?null:e.jsxs("span",{className:"m4-hero-streak",title:"One cell per day this week, filled when a note landed. Today stays open until you write one.",children:[s.length?e.jsx("span",{className:"strip","aria-hidden":"true",children:s.map((i,l)=>e.jsx("i",{className:(i.on?"on":"")+(i.today?" today":"")},l))}):null,a!=null?e.jsxs("span",{className:"lbl",children:[e.jsx("span",{className:"m-num",children:a})," ",r]}):null]})}function Ps({D:n,onNav:t,rollout:s}){const a=window.V3.greet[cr()],r=window.V3,i=n.bet,l=s==="new";return e.jsxs("section",{className:"m4-hero m-rise","data-coach":"home-hero",style:{"--i":0},"data-screen-label":"Home, hero",children:[e.jsx("div",{className:"m4-hero-img",style:{backgroundImage:"url('/assets/hero.png')"}}),e.jsx("div",{className:"m4-hero-veil"}),e.jsxs("div",{className:"in",children:[e.jsx("div",{className:"m4-hero-meta",children:e.jsx(wo,{meta:r,D:n})}),e.jsx(Reveal,{as:"h1",className:"m4-hero-greet",children:r.name?a+", "+r.name+".":a+"."}),l?e.jsx("p",{className:"m4-about",children:"This is your record. It remembers what you said you'd do, checks what you actually did, and keeps the proof. Start with one thing below."}):null,e.jsx(SayItHero,{onNav:t}),i?e.jsxs("button",{className:"m4-herobet",onClick:()=>t("strategy"),"data-coach":"bet",children:[e.jsx("span",{className:"lk",children:"Your bet"}),e.jsx("span",{className:"line",children:e.jsx(X,{claim:"Your bet",value:i.raw,src:i.src,children:i.outcome})}),i.support?e.jsx("span",{style:{display:"block",marginTop:7,fontSize:13.5,color:"var(--m-ink-2)",lineHeight:1.5},children:i.support}):null,i.progressText?e.jsxs("span",{className:"m4-betprog",style:{display:"block",marginTop:16},children:[i.progressPct!=null?e.jsx("span",{style:{display:"block",height:6,borderRadius:999,background:"rgba(227,196,137,0.10)",overflow:"hidden"},children:i.progressPct>0?e.jsx("span",{style:{display:"block",height:"100%",width:Math.min(100,i.progressPct)+"%",background:"linear-gradient(90deg, var(--m-gold-deep, #a8884e), var(--m-gold, #e3c489))",borderRadius:999}}):null}):null,e.jsxs("span",{style:{display:"block",marginTop:i.progressPct!=null?9:0,fontSize:12.5,color:"var(--m-ink-3)"},children:[i.progressText,i.countdown?" · "+i.countdown:""]})]}):i.countdown?e.jsx("span",{style:{display:"block",marginTop:12,fontSize:12.5,color:"var(--m-ink-3)"},children:i.countdown}):null,e.jsxs("span",{className:"foot",children:[e.jsx("span",{className:"m-chip"+(i.verdictTone==="good"?" is-good":i.verdictTone==="crit"?" is-crit":i.verdictTone==="warn"?" is-warn":""),children:i.verdictLabel}),e.jsxs("span",{className:"more",children:[i.rewrite?"Rewrite for clarity":"See the full plan in Strategy"," ",MIcons.arrow(13)]})]})]}):e.jsxs("button",{className:"m4-herobet",onClick:()=>t("strategy"),"data-coach":"bet",children:[e.jsx("span",{className:"lk",children:"Your bet"}),e.jsx("span",{className:"line",children:"Set your first bet."}),e.jsx("span",{style:{display:"block",marginTop:7,fontSize:13.5,color:"var(--m-ink-2)",lineHeight:1.5},children:"Pick one measurable outcome and a deadline."}),e.jsxs("span",{className:"foot",children:[e.jsx("span",{className:"m-chip",children:"Not set"}),e.jsxs("span",{className:"more",children:["Set it in Strategy ",MIcons.arrow(13)]})]})]})]})]})}function jo(){const n=window.V4T&&window.V4T.thread;if(!n||!n.state||!n.states||!n.states[n.state])return null;const t=n.state,s=n.states[t],a=t==="taut"?"M 4 50 L 96 50":t==="slack"?"M 4 42 Q 50 96 96 42":"M 4 44 Q 38 78 62 60 M 70 56 Q 84 48 96 44";return e.jsxs("button",{type:"button",className:"m4-threadstrip is-"+t,"data-screen-label":"Home, the thread",onClick:()=>openXray("The Thread, "+t,s.line,"thread"),title:"See the sessions that moved it",children:[e.jsx("span",{className:"lk",children:"today's work"}),e.jsx("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:e.jsx("path",{className:"m4t-thread-line"+(t==="frayed"?" is-frayed":""),d:a})}),e.jsx("span",{className:"lk",children:"the bet"}),e.jsx("span",{className:"line",children:s.line})]})}function Ds({D:n,focus:t}){const s=n.runNext,[a,r]=React.useState(!1),[i,l]=React.useState(!1),o=t.state==="running"||t.state==="paused";return e.jsxs("section",{className:"m-card m-rise",style:{"--i":1},"data-screen-label":"Home, What to do next","data-coach":"runnext",children:[e.jsxs("div",{className:"m-card-head",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{className:"m-kicker",style:{color:"var(--m-ink-2)"},children:"What to do next"}),e.jsx(Ze,{what:"The one thing that matters most today, picked from your plan and your goal.",doing:"Start it and Mover OS times it, saves the result, and checks it against your bet.",src:"today's note · daily-note-resolver"})]}),e.jsx("span",{className:"m-chip",style:{marginLeft:"auto"},children:s.chip})]}),e.jsx("h3",{className:"m4-runnext-title",children:e.jsx(X,{claim:"What to do next",value:s.title,src:s.src,children:s.title})}),e.jsxs("div",{className:"m-runnext-meta",children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:7},children:[MIcons.clock(14)," ",e.jsxs("span",{className:"m-num",children:[s.mins," min"]})]}),e.jsx("span",{children:s.block}),s.helper?e.jsx(X,{claim:"Helper, "+s.helper.name,value:s.helper.detail,src:s.helper.src||"skills",as:"span",className:"m-mono",children:e.jsxs("span",{style:{fontSize:11.5},children:["helper: ",s.helper.name]})}):null]}),e.jsxs("button",{type:"button",className:"m4-runnext-more","aria-expanded":i,onClick:()=>l(c=>!c),children:[e.jsx("span",{className:"ic","aria-hidden":"true",children:MIcons.arrow(11)})," Why this, and what it touches"]}),i?e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"m-runnext-why",children:e.jsx(X,{claim:"Why this, now",value:s.why,src:"strategy",children:s.why})}),e.jsxs("div",{className:"m4-files",children:[e.jsx("span",{className:"lk",children:"Looks at"}),s.reads.map(c=>e.jsx("span",{className:"f",children:c},c))]}),e.jsxs("div",{className:"m4-files",style:{marginTop:6},children:[e.jsx("span",{className:"lk",children:"Updates"}),s.writes.map(c=>e.jsx("span",{className:"f",style:{color:"var(--m-gold-2)"},children:c},c))]}),o?null:e.jsxs("p",{className:"m4-reassure",children:[MIcons.check(12)," Once you start, it keeps running and saves on its own, even if you close this tab."]})]}):null,e.jsxs("div",{className:"m-runnext-foot",children:[o?e.jsxs("div",{className:"m4-dock",style:{flex:1},children:[e.jsx("span",{className:"m-dot"+(t.state==="running"?" is-live":" is-warn")}),e.jsx("span",{className:"t",children:t.clock}),e.jsxs("span",{style:{color:"var(--m-ink-2)"},children:[t.state==="paused"?"paused":"in progress"," · ",s.title]}),e.jsxs("button",{className:"m-cta-line",style:{marginLeft:"auto",padding:"8px 14px",fontSize:12},onClick:t.openOverlay,children:["Open it ",MIcons.arrow(13)]})]}):e.jsxs(React.Fragment,{children:[e.jsxs("button",{className:"m-cta",onClick:t.start,"data-coach":"startblock",children:[MIcons.play(15)," Start now"]}),e.jsxs("button",{className:"m-cta-line",onClick:()=>r(!a),title:"Mover OS will warn you if you start something else during this time.",style:a?{background:"var(--m-gold-soft)"}:null,children:[a?MIcons.check(14):MIcons.shield(14)," ",a?"Protected":"Protect this time"]}),e.jsx(Ze,{what:"Protecting this time means Mover OS gently warns you if you start something else before it's done.",doing:"It never blocks you, it just keeps your own promise in view.",src:"Hooks/speed-bump.js"})]}),e.jsx("button",{className:"m-link m-link-src",style:{marginLeft:o?0:"auto"},"data-coach":"xray-demo",title:"Where this came from","aria-label":"Where this came from",onClick:()=>openXray("What to do next",s.title,s.src),children:MIcons.xray(13)})]})]})}function ko({it:n,notePath:t,onFlip:s}){const[a,r]=React.useState(n.done>=n.of),[i,l]=React.useState(!1),[o,c]=React.useState(null),[d,u]=React.useState(!1),h=async()=>{if(i)return;const x=!a;r(x),l(!0),c(null),x&&(u(!0),setTimeout(()=>u(!1),350)),s(x?1:-1);try{const b=await(await fetch("/api/health")).json(),j=await fetch("/api/checkbox/toggle",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":b&&b.token||""},body:JSON.stringify({filePath:t,itemText:n.raw,checked:x})}),A=await j.json().catch(()=>null);if(!j.ok||!A||!A.ok)throw new Error(A&&A.error||"HTTP "+j.status)}catch{r(!x),s(x?-1:1),c("could not write the tick, the note is unchanged")}finally{l(!1)}},p=a?"done":"todo",[m,g]=React.useState(!1),f=!!(n.k&&n.k.length>80),v=React.useRef(null);return e.jsxs("div",{className:"m-call-shell"+(m?" is-open":""),onKeyDown:f&&m?x=>{x.key==="Escape"&&(g(!1),v.current&&v.current.focus())}:void 0,children:[e.jsxs("button",{type:"button",className:"m-call-row is-"+p+(n.hot?" is-hot":""),"data-status":p,role:"checkbox","aria-checked":a,disabled:i,title:(f&&!m?n.k+`
|
|
118
|
+
|
|
119
|
+
`:"")+(a?"Untick it in today's note":"Tick it off in today's note"),onClick:h,children:[e.jsx("span",{className:"m-tick"+(a?" is-done":"")+(d?" is-pop":""),children:a?MIcons.check(12):null}),e.jsx("span",{className:"t",children:n.k}),o?e.jsx("span",{className:"m4-call-err",children:o}):null]}),f?e.jsx("button",{type:"button",ref:v,className:"m-call-more","aria-expanded":m,"aria-label":m?"Show one line":"Show the full task",title:m?"Show one line":"Show the full task",onClick:()=>g(x=>!x),children:e.jsx("span",{className:"ic","aria-hidden":"true",children:MIcons.arrow(12)})}):null]})}function bo({it:n,status:t}){const[s,a]=React.useState(!1),r=!!(n.k&&n.k.length>80),i=React.useRef(null);return e.jsxs("div",{className:"m-call-shell"+(s?" is-open":""),onKeyDown:r&&s?l=>{l.key==="Escape"&&(a(!1),i.current&&i.current.focus())}:void 0,children:[e.jsxs("div",{className:"m-call-row is-"+t+(n.hot?" is-hot":""),"data-status":t,title:n.dup?"Two tasks in the note share this exact text; tick this one in the note itself.":r&&!s?n.k:void 0,children:[e.jsx("span",{className:"m-tick"+(t==="done"?" is-done":t==="part"?" is-part":""),children:t==="done"?MIcons.check(12):t==="part"?e.jsx("span",{style:{fontSize:10},className:"m-num",children:n.done}):null}),e.jsx("span",{className:"t",children:n.k}),n.of>0&&!n.raw?e.jsxs("span",{className:"n m-num",children:[n.done," / ",n.of]}):null]}),r?e.jsx("button",{type:"button",ref:i,className:"m-call-more","aria-expanded":s,"aria-label":s?"Show one line":"Show the full task",title:s?"Show one line":"Show the full task",onClick:()=>a(l=>!l),children:e.jsx("span",{className:"ic","aria-hidden":"true",children:MIcons.arrow(12)})}):null]})}function No({D:n}){const t=n.todaysCall,[s,a]=React.useState(0),r=React.useCallback(c=>a(d=>d+c),[]),i=Math.max(0,Math.min(t.of||0,(t.done||0)+s)),l=(t.of||0)>0,o=l?Math.max(0,Math.min(100,i/t.of*100)):0;return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":2},"data-screen-label":"Home, Today's plan",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Today's plan"}),e.jsx(Ze,{what:"What you committed to today, written this morning from your goal and yesterday.",doing:"Tick off what you finished; tonight's review reads the rest.",src:"today's note · /morning"}),e.jsxs("div",{className:"tools",children:[e.jsx(SealEntryBtn,{small:!0}),l?e.jsx("span",{className:"m4-callprog","aria-hidden":"true",title:i+" of "+t.of+" done",children:e.jsx("span",{className:"bar",children:e.jsx("i",{style:{transform:"scaleX("+o/100+")"}})})}):null,l?e.jsx(X,{claim:"Today's plan",value:i+" of "+t.of+" done",src:t.src,as:"span",children:e.jsxs("span",{className:"count m-num",children:[i,e.jsxs("span",{className:"m-mute",style:{fontSize:13},children:[" / ",t.of]})]})}):null]})]}),e.jsx("div",{children:t.items.map((c,d)=>{if(c.raw&&!c.dup&&t.notePath)return e.jsx(ko,{it:c,notePath:t.notePath,onFlip:r},d+"·"+c.k);const u=c.done>=c.of&&c.of>0?"done":c.done>0?"part":"todo";return e.jsx(bo,{it:c,status:u},d+"·"+c.k)})})]})}function So({D:n,onNav:t,rollout:s}){const a=n.insight;return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":2,borderTop:"none",paddingTop:0},"data-screen-label":"Home, Receipts","data-coach":"receipts",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Receipts"}),e.jsx(Ze,{what:"A receipt is proof of something you did, Mover OS logs it for you, automatically.",doing:"The full list lives in Evidence; this is just today's.",src:"Metrics_Log.md · receipt-logger"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-link",onClick:()=>t("evidence"),children:["See all in Evidence ",MIcons.arrow(13)]})})]}),s==="growing"?e.jsx(dr,{id:"receipts",children:"This is new. Every work session, post, or decision leaves a receipt here so you can see what you actually did."}):null,e.jsxs("div",{children:[n.receipts.map(r=>e.jsxs("div",{className:"m-rec",style:{padding:"10px 2px"},children:[e.jsx("div",{className:"rail",children:e.jsx("span",{className:"m-dot"+(r.live?" is-live":"")})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(X,{claim:"Receipt, "+r.t,value:r.d,src:n.receiptsSrc||"sessions",as:"div",className:"t",children:r.t}),e.jsx("div",{className:"d",children:r.d})]}),r.live?e.jsx("span",{className:"m-chip tag",children:"happening now"}):r.tag?e.jsx("span",{className:"m-chip tag is-mute",children:r.tag}):null]},r.t)),n.receipts.length<=1?e.jsx(Empty,{title:n.receipts.length===0?"Nothing logged yet.":"One receipt so far.",line:"Every work session, post, and decision leaves one. By the end of week one this is your proof of what you did."}):null]}),a?e.jsxs("div",{className:"m4-insight",style:{borderTop:"1px solid var(--m-line)",marginTop:8},children:[e.jsx("div",{className:"m-kicker",style:{fontSize:9.5,marginBottom:8},children:"What your receipts show"}),e.jsx("p",{className:"line",children:e.jsx(X,{claim:"What your receipts show",value:a.sub,src:a.src,children:a.line})}),a.sub&&a.sub!==a.line?e.jsx("p",{className:"sub",children:a.sub}):null]}):n.insightEmpty?e.jsx("div",{className:"m4-insight",style:{borderTop:"1px solid var(--m-line)",marginTop:8},children:e.jsx("p",{className:"sub",style:{marginTop:0},children:n.insightEmpty})}):null]})}function Fs({D:n,onNav:t}){const s=n.agents||[];if(!s.length)return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":4},"data-screen-label":"Home, what's running",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Working in the background"}),e.jsx(Ze,{what:"Helpers (agents) doing small jobs for you right now.",doing:"This is just a status. You manage all of them in Run.",src:".claude/sessions · hook registry"})]}),e.jsx(Empty,{title:"No agents yet.",line:"Once an agent is connected it shows up here while it works. You set them up in Configure."})]});const a=s.filter(l=>l.state==="live"||l.state==="armed"),r=s.filter(l=>l.state==="error"),i=s.filter(l=>l.state==="unconfigured");return e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":4},"data-screen-label":"Home, what's running",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Working in the background"}),e.jsx(Ze,{what:"Helpers (agents) doing small jobs for you right now.",doing:"This is just a status. You manage all of them in Run.",src:".claude/sessions · hook registry"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-link",onClick:()=>t("run"),children:["Manage in Run ",MIcons.arrow(13)]})})]}),e.jsxs("div",{style:{display:"flex",gap:18,alignItems:"baseline",margin:"2px 0 12px",fontSize:12.5,color:"var(--m-ink-2)"},children:[e.jsxs("span",{children:[e.jsx("span",{className:"m-num",children:a.length})," ready"]}),i.length?e.jsxs("span",{className:"m-mute",children:[e.jsx("span",{className:"m-num",children:i.length})," not connected"]}):null,r.length?e.jsxs("span",{className:"m-warn",children:[e.jsx("span",{className:"m-num",children:r.length})," need attention"]}):null]}),a.map(l=>e.jsxs("div",{className:"m4-agent",children:[e.jsx("span",{className:"ic",children:MIcons.agent(15)}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"n",children:l.name}),l.doing&&l.doing.trim().toLowerCase()!=="ready"?e.jsx("div",{className:"d",children:l.doing}):null]}),e.jsxs("span",{className:"st m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"ready"]})]},l.name)),r.map(l=>e.jsxs("div",{className:"m4-agent is-error",children:[e.jsx("span",{className:"ic",style:{color:"var(--m-crit)"},children:MIcons.agent(15)}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"n",children:l.name}),e.jsxs("div",{className:"m4-err",style:{marginTop:6},children:[e.jsx("span",{style:{flex:1},children:l.doing}),e.jsx("button",{className:"m-mini",onClick:()=>t("configure"),children:"Open Configure"})]})]})]},l.name)),i.length?e.jsxs("button",{className:"m4-agent",onClick:()=>t("configure"),style:{width:"100%",textAlign:"left",background:"transparent",border:"none",borderTop:"1px solid var(--m-line)",cursor:"pointer",font:"inherit",color:"inherit"},children:[e.jsx("span",{className:"ic",style:{color:"var(--m-ink-3)"},children:MIcons.agent(15)}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"n",children:i.length===1?i[0].name:i.length+" agents ready to connect"}),e.jsx("div",{className:"d",children:"Connect in Configure to put them to work."})]}),e.jsxs("span",{className:"st m-link",children:["Connect ",MIcons.arrow(13)]})]}):null]})}function ht({label:n,sub:t}){return e.jsx("div",{className:"m4-looprow",children:e.jsxs("span",{className:"a",children:[n,t?e.jsx("span",{className:"b m-num",style:{marginLeft:8},children:t}):null]})})}function Co({D:n}){const t=n.loops,s=t.waiting.items.length,a=t.backlog.items.length,r=t.captures.items.length,i=!s&&!a&&!r,[l,o]=React.useState(!1);return l?e.jsxs("section",{className:"m4-sec m-rise",style:{"--i":5},"data-screen-label":"Home, open loops",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Loose ends"}),e.jsx(Ze,{what:"Things you're waiting on, plus stray tasks and ideas that don't have a home yet.",doing:"They live here so they stay out of your head and out of today's plan.",src:"Active_Context.md §3.5, §7, §8"}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m-link",onClick:()=>o(!1),children:"Fold away"})})]}),i?e.jsx(Empty,{title:"No loose ends.",line:"Hand something off, park a stray task, or jot down an idea, and it shows up here instead of cluttering your plan."}):e.jsxs("div",{className:"m4-loose-board",children:[e.jsxs("div",{className:"m4-loopgrp",children:[e.jsxs("div",{className:"gh",children:[e.jsx("span",{className:"k",children:"Waiting on someone"}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Waiting on someone",null,"waiting"),children:"where this comes from"})]}),t.waiting.items.map(c=>e.jsx(ht,{label:e.jsxs(e.Fragment,{children:[e.jsx("b",{style:{fontWeight:500},children:c.who}),c.what?e.jsxs(e.Fragment,{children:[" · ",c.what]}):null]}),sub:c.since},c.who)),t.waiting.items.length?null:e.jsx("div",{className:"m4-looprow",children:e.jsx("span",{className:"a m-mute",children:"Nothing pending from anyone."})})]}),e.jsxs("div",{className:"m4-loopgrp",children:[e.jsxs("div",{className:"gh",children:[e.jsx("span",{className:"k",children:"Stray tasks"}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Stray tasks",null,"backlog"),children:"where this comes from"})]}),t.backlog.items.map(c=>e.jsx(ht,{label:c.k,sub:c.age},c.k)),t.backlog.items.length?null:e.jsx("div",{className:"m4-looprow",children:e.jsx("span",{className:"a m-mute",children:"No stray tasks."})})]}),e.jsxs("div",{className:"m4-loopgrp",children:[e.jsxs("div",{className:"gh",children:[e.jsx("span",{className:"k",children:"Ideas to sort"}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Ideas to sort",null,"captures"),children:"where this comes from"})]}),t.captures.items.map(c=>e.jsx(ht,{label:e.jsx("span",{style:{color:"var(--m-ink-2)"},children:c})},c)),t.captures.items.length?null:e.jsx("div",{className:"m4-looprow",children:e.jsx("span",{className:"a m-mute",children:"Nothing to sort."})})]})]})]}):e.jsx("section",{className:"m4-sec m-rise",style:{"--i":5},"data-screen-label":"Home, open loops",children:e.jsxs("button",{type:"button",className:"m4-sec-head m4-peek",onClick:()=>o(!0),"aria-expanded":!1,children:[e.jsx("span",{className:"m-kicker",children:"Loose ends"}),e.jsx("span",{className:"m4-peek-sum",children:i?"none right now":s+" waiting, "+a+" stray, "+r+" to sort"}),e.jsx("span",{className:"m4-peek-chev","aria-hidden":"true",children:MIcons.arrow(12)})]})})}const To=[{k:"singleTest",lens:"pace"},{k:"distribution",lens:"pace"},{k:"calibration",lens:"thread"}];function Ro({num:n,unit:t,tone:s}){const a=parseFloat(String(n)),r=t?parseFloat(String(t).replace(/[^\d.]/g,"")):NaN;if(!isFinite(a)||!isFinite(r)||r<=0||a<=0)return null;const i=Math.max(3,Math.min(100,a/r*100)),l=s==="crit"?"var(--m-crit)":s==="warn"?"var(--m-warn)":"var(--m-data)";return e.jsx("span",{className:"m4-sigfill","aria-hidden":"true",children:e.jsx("i",{style:{width:i+"%",background:l}})})}function Eo({onNav:n}){const t=typeof window<"u"&&window.HOMEKPIS&&window.HOMEKPIS.tiles||[],s={};t.forEach(i=>{s[i.k]=i});const a=To.map(i=>({...i,tile:s[i.k]})).filter(i=>i.tile),r=i=>{try{localStorage.setItem("m4.evlens",JSON.stringify(i))}catch{}n("evidence")};return a.length?e.jsx("section",{className:"m4-signals m-rise","data-coach":"home-signals",style:{"--i":.5},"data-screen-label":"Home, signals","aria-label":"Today's signals",children:a.map(({k:i,lens:l,tile:o})=>{const c=o.measured===!0,d=o.tone==="crit"?" is-crit":o.tone==="warn"?" is-warn":"";return e.jsxs("button",{className:"m4-signal"+d,onClick:()=>r(l),title:"See the full view in Evidence · "+(o.cite||""),children:[e.jsx("span",{className:"k",children:o.title}),e.jsxs("span",{className:"row",children:[e.jsxs("span",{className:"v m-num"+(c?" is-data":" is-empty"),children:[o.num,o.unit?e.jsxs("span",{className:"u",children:[" ",o.unit]}):null]}),i==="singleTest"&&c?e.jsx(Ro,{num:o.num,unit:o.unit,tone:o.tone}):null]}),e.jsxs("span",{className:"s",children:[o.sub," ",MIcons.arrow(10)]})]},i)})}):null}function hr(){return e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel hero"}),e.jsxs("div",{className:"m4-grid",children:[e.jsxs("div",{className:"m4-col",children:[e.jsx("div",{className:"m4-skel",style:{height:300,borderRadius:"var(--m-r)"}}),e.jsx("div",{className:"m4-skel",style:{height:180}})]}),e.jsxs("div",{className:"m4-col",children:[e.jsx("div",{className:"m4-skel",style:{height:220}}),e.jsx("div",{className:"m4-skel",style:{height:140}})]})]})]})}function Io({D:n,onNav:t,focus:s,rollout:a}){const r=ur("home"),i=n.__v4,[l]=useStored3("m6.alibi2",window.V6J&&window.V6J.seedAlibi),[o]=useStored3("m6.alibi.hidden",!1),d=(i&&i.todaysCall&&i.todaysCall.of||0)===0&&!(l&&!o);if(r)return e.jsx(hr,{});const u=a||"full",h=u==="new",p=u==="full";return h?e.jsxs("div",{className:"m-wrap",children:[e.jsx(Ps,{D:i,onNav:t,rollout:u}),e.jsx("div",{className:"m4-grid is-single",children:e.jsx("div",{className:"m4-col",children:e.jsx(Ds,{D:i,focus:s})})})]}):e.jsxs("div",{className:"m-wrap",children:[e.jsx(Ps,{D:i,onNav:t,rollout:u}),e.jsxs("div",{className:"m4-standrow",children:[p?e.jsx(jo,{}):null,e.jsx(StandingNo,{}),e.jsx(HomeRedLine,{onNav:t}),p?e.jsx(Eo,{onNav:t}):null,p?e.jsx(Nudge,{nudge:i.nudge,onNav:t}):null]}),e.jsxs("div",{className:"m4-grid",children:[e.jsxs("div",{className:"m4-col"+(p?" has-thread":""),children:[p?e.jsx("div",{className:"m4-thread"+(window.V4T&&window.V4T.thread&&window.V4T.thread.state?" is-"+window.V4T.thread.state:""),"aria-hidden":"true",title:window.V4T&&window.V4T.thread&&window.V4T.thread.states&&window.V4T.thread.states[window.V4T.thread.state]?window.V4T.thread.states[window.V4T.thread.state].line:void 0}):null,e.jsx(Ds,{D:i,focus:s}),e.jsx(No,{D:i}),p?e.jsx(V6AlibiFrame,{onMorning:()=>v6OpenJournal("morning")}):null,p&&d?e.jsx(Fs,{D:i,onNav:t}):null]}),e.jsxs("div",{className:"m4-col",children:[p?e.jsx(So,{D:i,onNav:t,rollout:u}):null,p&&!d?e.jsx(Fs,{D:i,onNav:t}):null]})]}),p?e.jsx(Co,{D:i}):null,p?e.jsx(StatusStrip,{data:n}):null]})}Object.assign(window,{HomeView:Io,BetLedger:vo,Hint:Ze,NewHere:dr,RunBtn:yo,useSimLoad:ur,HomeSkeleton:hr,slot3:cr});const Mo="m4.focus.v1";function Ao(n){const[t,s]=useStored3(Mo,{state:"idle",startedAt:0,endedAt:0,pausedAcc:0,lastPauseAt:0,totalMin:60,logged:!1,overlay:!1,moved:null,saved:"idle"}),[,a]=React.useState(0);React.useEffect(()=>{if(t.state!=="running")return;const d=setInterval(()=>a(u=>u+1),1e3);return()=>clearInterval(d)},[t.state]);const r=()=>{if(!t.startedAt)return 0;const d=t.state==="done"&&t.endedAt?t.endedAt:Date.now(),u=t.state==="paused"&&t.lastPauseAt?d-t.lastPauseAt:0;return Math.max(0,d-t.startedAt-t.pausedAcc-u)},i=t.totalMin*60*1e3,l=Math.max(0,i-r()),o=String(Math.floor(l/6e4)).padStart(2,"0"),c=String(Math.floor(l%6e4/1e3)).padStart(2,"0");return{state:t.state,logged:t.logged,overlay:t.overlay,moved:t.moved==null?null:t.moved,saved:t.saved||"idle",startedAt:t.startedAt,endedAt:t.endedAt||0,clock:o+":"+c,pct:i?l/i*100:100,elapsedMin:Math.floor(r()/6e4),elapsedSec:Math.floor(r()/1e3),start:()=>s({state:"running",startedAt:Date.now(),endedAt:0,pausedAcc:0,lastPauseAt:0,totalMin:n&&n.mins||60,logged:!1,overlay:!0,moved:null,saved:"idle"}),pause:()=>s(d=>({...d,state:"paused",lastPauseAt:Date.now()})),resume:()=>s(d=>({...d,state:"running",pausedAcc:d.pausedAcc+(Date.now()-d.lastPauseAt),lastPauseAt:0})),end:()=>s(d=>({...d,state:"done",endedAt:Date.now(),overlay:!0,logged:!1,moved:null,saved:"idle"})),answer:d=>s(u=>({...u,logged:!0,moved:!!d})),markSaved:d=>s(u=>({...u,saved:d})),openOverlay:()=>s(d=>({...d,overlay:!0})),closeOverlay:()=>s(d=>({...d,overlay:!1})),dismiss:()=>s({state:"idle",startedAt:0,endedAt:0,pausedAcc:0,lastPauseAt:0,totalMin:60,logged:!1,overlay:!1,moved:null,saved:"idle"})}}function Lo({focus:n,D4:t}){const s=t.runNext,[a,r]=React.useState(!0),[i,l]=React.useState(!1);if(React.useEffect(()=>{const u=h=>{h.key==="Escape"&&n.closeOverlay()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[]),!n.overlay||n.state==="idle")return null;const o=280,c=(o-18)/2,d=2*Math.PI*c;if(n.state==="done"){const u=n.moved,h=f=>f.getHours()+":"+String(f.getMinutes()).padStart(2,"0"),p=(n.startedAt?h(new Date(n.startedAt))+"-":"ended ")+h(n.endedAt?new Date(n.endedAt):new Date),m=n.elapsedMin>=1?n.elapsedMin+" min":"under a minute";if(u==null&&n.elapsedSec<120&&!i)return e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Session too short to count","data-screen-label":"Focus session, too short",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.dismiss,children:[MIcons.x(14)," Close"]}),e.jsx("div",{className:"frame",style:{gridTemplateColumns:"1fr",maxWidth:640,textAlign:"left"},children:e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14},children:["Session ended · ",e.jsxs("span",{className:"m-num",children:[n.elapsedSec,"s"]})]}),e.jsx("h2",{className:"verdict m-serif",children:"Too short to count."}),e.jsx("p",{style:{fontSize:14.5,color:"var(--m-ink-2)",marginTop:12,lineHeight:1.6,maxWidth:"54ch"},children:"Under two minutes. Nothing was written; the record keeps real sessions only."}),e.jsxs("div",{className:"fbar",children:[e.jsx("button",{className:"m-cta",onClick:n.dismiss,children:"Back to your day"}),e.jsx("button",{className:"m-cta-line",onClick:()=>l(!0),children:"It was real, count it"})]})]})})]});const g=f=>{n.answer(f),n.markSaved("saving");const v="Focus session, "+m+' on "'+(s&&s.title||"the block")+'", '+(f?"moved the bet":"did not move the bet");fetch("/api/health").then(x=>x.json()).then(x=>fetch("/api/capture",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x&&x.token},body:JSON.stringify({text:v,tag:"focus"})})).then(x=>{if(!x.ok)throw new Error("HTTP "+x.status);n.markSaved("saved")}).catch(x=>{console.warn("focus receipt failed",x),n.markSaved("failed")})};return u==null?e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Session finished","data-screen-label":"Focus session, the question",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.dismiss,children:[MIcons.x(14)," Close"]}),e.jsx("div",{className:"frame",style:{gridTemplateColumns:"1fr",maxWidth:640,textAlign:"left"},children:e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14},children:["Session finished · ",e.jsx("span",{className:"m-num",children:m})," · ",e.jsx("span",{className:"m-num",children:p})]}),e.jsx("h2",{className:"verdict m-serif",children:"Did this session move your bet?"}),e.jsx("p",{style:{fontSize:14.5,color:"var(--m-ink-2)",marginTop:12,lineHeight:1.6,maxWidth:"54ch"},children:"Your answer goes into today's Daily Note with the time on it. Honest either way."}),e.jsxs("div",{className:"fbar",children:[e.jsx("button",{className:"m-cta",onClick:()=>g(!0),children:"It moved the bet"}),e.jsx("button",{className:"m-cta-line",onClick:()=>g(!1),children:"It didn't"})]})]})})]}):e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Session complete","data-screen-label":"Focus session, verdict",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.dismiss,children:[MIcons.x(14)," Close"]}),e.jsx("div",{className:"frame",style:{gridTemplateColumns:"1fr",maxWidth:640,textAlign:"left"},children:e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14},children:["Session finished · ",e.jsx("span",{className:"m-num",children:m})," · ",e.jsx("span",{className:"m-num",children:p})]}),e.jsx("h2",{className:"verdict m-serif"+(u?" is-good":""),children:u?"You moved your bet.":"This didn't move your bet."}),e.jsx("p",{style:{fontSize:14.5,color:"var(--m-ink-2)",marginTop:12,lineHeight:1.6,maxWidth:"54ch"},children:u?"Counted, with the session receipt. Tonight's review will have it.":"Saved honestly. Tonight's review will ask what happened."}),e.jsxs("div",{className:"receipt-card",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{className:"m-dot"+(u?" is-good":" is-warn")}),e.jsxs("span",{className:"rt",children:["Receipt · ",u?"session, moved the bet":"session, no move"]}),e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:p})]}),e.jsx("div",{className:"rw",children:n.saved==="saved"?e.jsxs("span",{style:{color:"var(--m-good)"},children:[MIcons.check(12)," Written to today's Daily Note, under Log."]}):n.saved==="failed"?e.jsx("span",{style:{color:"var(--m-warn)"},children:"Could not write the receipt. Nothing was saved; the session stays on this screen."}):e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"Writing to today's Daily Note…"})})]}),e.jsxs("div",{className:"fbar",children:[e.jsxs("button",{className:"m-cta",onClick:n.dismiss,children:["Back to your day ",MIcons.arrow(15)]}),n.saved==="failed"?e.jsx("button",{className:"m-cta-line",onClick:()=>g(u),children:"Try the write again"}):null]})]})})]})}return e.jsxs("div",{className:"m4-focus",role:"dialog","aria-label":"Focus session","data-screen-label":"Focus session, live",children:[e.jsxs("button",{className:"m-ghost esc",onClick:n.closeOverlay,children:[MIcons.arrowL(14)," Back to your day"]}),e.jsxs("div",{className:"frame",children:[e.jsxs("div",{className:"m4-fring",children:[e.jsxs("svg",{width:o,height:o,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"m4FocusGrad",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--m-gold-deep)"}),e.jsx("stop",{offset:"100%",stopColor:"var(--m-gold-2)"})]})}),e.jsx("circle",{className:"bg",cx:o/2,cy:o/2,r:c,fill:"none",strokeWidth:"9"}),e.jsx("circle",{className:"fg",cx:o/2,cy:o/2,r:c,fill:"none",strokeWidth:"9",strokeDasharray:d,strokeDashoffset:d*(1-n.pct/100)})]}),e.jsx("div",{className:"mid",children:e.jsxs("div",{children:[e.jsx("div",{className:"time",children:n.clock}),e.jsx("div",{className:"lbl",children:n.state==="paused"?"paused":"one focus session"})]})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"kicker-row",children:[e.jsx("span",{className:"m-kicker",children:"Focus session"}),e.jsx("span",{className:"m-chip"+(n.state==="paused"?" is-warn":""),children:n.state==="paused"?"paused":"in progress"}),e.jsxs("button",{type:"button",className:"m-chip is-mute",style:{cursor:"pointer",font:"inherit"},onClick:()=>r(!a),title:a?"Protected: you get a warning if you drift to something else this session. Click to turn off.":"Not protected: no drift warning this session. Click to turn on.",children:[MIcons.shield(11)," ",a?"protected":"not protected"]})]}),e.jsx("h2",{className:"task m-serif",children:s.title}),e.jsx("p",{className:"why",children:s.why}),e.jsxs("div",{className:"fgrid",children:[s.helper?e.jsxs("div",{className:"fkv",children:[e.jsx("div",{className:"k",children:"Helper"}),e.jsx("div",{className:"v",children:s.helper.name+" · "+s.helper.detail})]}):null,e.jsxs("div",{className:"fkv",children:[e.jsx("div",{className:"k",children:"Working set"}),e.jsxs("div",{className:"v",children:[s.reads.join(", "),s.writes&&s.writes.length?e.jsx("span",{style:{color:"var(--m-gold-2)"},children:" → "+s.writes.join(", ")}):null]})]}),e.jsxs("div",{className:"fkv",children:[e.jsx("div",{className:"k",children:"Where this came from"}),e.jsx("div",{className:"v",children:e.jsx("button",{className:"m-x",style:{fontFamily:"var(--m-mono)",fontSize:11.5,color:"var(--m-ink-1)"},onClick:()=>openXray("What to do next",s.title,s.src),children:"today's note · your plan"})})]})]}),e.jsxs("div",{className:"fbar",children:[n.state==="paused"?e.jsxs("button",{className:"m-cta",onClick:n.resume,children:[MIcons.play(15)," Resume"]}):e.jsxs("button",{className:"m-cta-line",onClick:n.pause,children:[MIcons.pause(14)," Pause"]}),e.jsx("button",{className:"m-cta-line",onClick:n.end,title:"The receipt writes when you end. The timer runs even if you close the tab.",children:"End session"})]})]})]})]})}Object.assign(window,{useFocusSession:Ao,FocusOverlay:Lo});const mr=[{id:"loop",k:"The cycle"},{id:"star",k:"Your goal"},{id:"life",k:"Ideas"},{id:"lab",k:"Experiments"},{id:"case",k:"Pushback"},{id:"board",k:"Advisors"},{id:"grave",k:"Buried ideas"}];function ts(n){const t=document.querySelector(".m-scroll"),s=document.getElementById("s4-"+n);if(!t||!s)return;const a=t.scrollTop+s.getBoundingClientRect().top-t.getBoundingClientRect().top-18;t.scrollTo({top:a,behavior:"smooth"})}function Oo({active:n,stuck:t}){return e.jsx("nav",{className:"m4-srail","aria-label":"Strategy sections",children:mr.map(s=>e.jsxs("button",{className:"it"+(n===s.id?" is-on":""),onClick:()=>ts(s.id),children:[e.jsx("span",{className:"d"+(t.includes(s.id)?" warn":"")}),s.k]},s.id))})}const _s={fresh:{word:"fresh",dot:"is-good"},live:{word:"live",dot:"is-live"},stale:{word:"stale",dot:"is-warn"},stuck:{word:"stuck",dot:"is-warn"},empty:{word:"not yet",dot:"is-off"}};function Po({S:n,sparse:t}){return e.jsxs("section",{id:"s4-loop",className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Strategy, The Loop","data-coach":"loop",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"The cycle"}),e.jsx(Hint,{what:"The whole loop your work runs in. Each step is run by one tool and updates one file.",doing:"Click a step to see where it comes from. Steps that are stuck glow.",src:"Workflows/ registry · moveros doctor"}),e.jsx("div",{className:"tools",children:e.jsx("span",{className:"m4-aside",children:"…then around again, daily"})})]}),e.jsxs("p",{className:"m4-sub",style:{maxWidth:"68em"},children:["How it fits together: ",e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:"your bet sets today's plan → you do the work → the work leaves receipts → the receipts become evidence → the evidence shapes tomorrow's plan"}),". When the evidence is strong enough, it changes the bet itself."]}),e.jsxs("div",{className:"m4-loop",children:[n.loop.map(s=>{const a=t&&n.loopOverride?Object.assign({},s,n.loopOverride[s.k]||{}):s,r=_s[a.status]||_s.empty;return e.jsxs("button",{className:"m4-stage"+(a.status==="stuck"?" is-stuck":a.status==="live"?" is-live":a.status==="empty"?" is-empty":""),onClick:()=>openXray("Loop stage: "+s.k,a.note+" · "+s.wf+" writes "+s.writes,s.src),children:[e.jsx("span",{className:"nm",children:s.k}),e.jsx("span",{className:"for",children:s.for}),e.jsxs("span",{className:"wf",children:[s.wf," ",e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:["→ ",s.writes]})]}),e.jsxs("span",{className:"stt",children:[e.jsx("span",{className:"m-dot "+r.dot,style:{width:6,height:6}}),r.word," · ",a.note]})]},s.k)}),e.jsxs("div",{className:"m4-loop-again",children:[e.jsx("span",{className:"nm",children:"…and around again"}),e.jsx("span",{className:"for",children:"The cycle runs every day. The bet only changes when the evidence has earned it."})]})]})]})}function Do({S:n,D4:t,sparse:s,onNav:a}){return e.jsxs("section",{id:"s4-star",className:"m4-sec","data-screen-label":"Strategy, North Star and domains",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Your goal · three areas"}),e.jsx(Hint,{what:"Your big goal and how close you are, then the three areas that carry it: Work, Vitality, and Faith.",doing:"All three run the same loop. None of them is a separate dashboard.",src:"Goals.md · goals-parser"})]}),e.jsx("p",{className:"m4-sub",children:"Your big goal and how close you are. The number, the distance, and the time left. Nothing else."}),s?e.jsx(Empty,{title:"No goals written yet.",line:"This appears once your goals are written: one main goal, then Work, Vitality, and Faith underneath it. The weekly review writes and keeps it up to date.",action:"Write your goals",cmd:"in the weekly review"}):e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"m4-star",children:[e.jsx("span",{className:"g",children:e.jsx(X,{claim:"Your main goal",value:n.northStar.goal,src:n.northStar.src,children:n.northStar.goal})}),e.jsx("span",{className:"dist m-num",children:n.northStar.distance}),n.northStar.pct!=="—"?e.jsxs("div",{className:"m-pace",style:{minWidth:180,maxWidth:260,flex:1},children:[e.jsx("div",{className:"m-pace-bar",children:e.jsx("i",{style:{width:n.northStar.pct+"%"}})}),e.jsxs("span",{className:"v m-num",style:{fontSize:11.5,color:"var(--m-ink-2)"},children:[n.northStar.pct,"%"]})]}):e.jsx("span",{style:{fontSize:11,color:"var(--m-ink-3)"},children:"not tracked yet"})]}),t.bet?e.jsxs("div",{style:{padding:"4px 0 14px"},children:[e.jsx(BetLedger,{bet:t.bet}),e.jsxs("div",{className:"m5-testing",children:[e.jsx("span",{className:"lk",children:"Testing this with"}),(n.lab||[]).filter(r=>r.bet).map(r=>e.jsxs("button",{className:"m-mini",onClick:()=>ts("lab"),children:[r.t," · ",e.jsxs("span",{className:"m-num",children:[r.runs," of ",r.target," ",r.unit]})]},r.id)),e.jsx("span",{className:"m5-testing-note",children:"The bet and the Lab are two views of the same question."})]})]}):null,n.domains.map(r=>e.jsxs("div",{className:"m4-domain",children:[e.jsxs("div",{children:[e.jsx("div",{className:"name",children:r.k}),e.jsx("div",{className:"pcts",children:r.pct!=="—"?e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"m-pace-bar",style:{width:64},children:e.jsx("i",{style:{width:r.pct+"%"}})}),e.jsxs("span",{className:"m-num",style:{fontSize:11,color:"var(--m-ink-3)"},children:[r.pct,"%"]})]}):e.jsx("span",{style:{fontSize:11,color:"var(--m-ink-3)"},children:"not tracked yet"})})]}),e.jsxs("div",{className:"rows",children:[r.hypothesis!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"The idea"}),e.jsx("span",{className:"v",children:r.hypothesis})]}):null,r.goal!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Goal"}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:r.k+": goal",value:r.goal,src:r.src,children:r.goal})})]}):null,r.today!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Today"}),e.jsx("span",{className:"v",children:r.today})]}):null,r.evidence!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"So far"}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:r.k+": evidence",value:r.evidence,src:r.evSrc,children:r.evidence})})]}):null,r.risk!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Risk"}),e.jsx("span",{className:"v",style:{color:r.risk==="None flagged"?"var(--m-ink-2)":"var(--m-warn)"},children:r.risk})]}):null,r.adjust!=="—"?e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Next move"}),e.jsx("span",{className:"v",children:r.adjust})]}):null,r.hypothesis==="—"&&r.goal==="—"&&r.today==="—"&&r.evidence==="—"&&r.risk==="—"&&r.adjust==="—"?e.jsx("div",{className:"row",children:e.jsx("span",{className:"v m-mute",children:"Not tracked yet."})}):null]})]},r.k))]})]})}function Fo({S:n,sparse:t}){return e.jsxs("section",{id:"s4-life",className:"m4-sec","data-screen-label":"Strategy, Idea Lifecycle",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"From idea to result"}),e.jsx(Hint,{what:"Where your ideas go, from a quick note, to a test, to a real project, to kept or dropped.",doing:"It ends in one of two places: written into your strategy, or buried for good.",src:"Active_Context.md §7 · Someday_Maybe.md · Experiments/"})]}),e.jsxs("p",{className:"m4-sub",children:["Where your ideas go: ",e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:"jot it down → maybe later → test it → make it a project → see the evidence → keep it or drop it"}),". Nothing is deleted, and nothing skips the test."]}),e.jsxs("div",{className:"m4-life",children:[n.lifecycle.map(s=>{const a=t&&n.lifecycleCounts?n.lifecycleCounts[s.k]:s.count,r=t?a?s.items.slice(0,a):[]:s.items;return e.jsxs("div",{className:"m4-life-col",children:[e.jsx("span",{className:"ct m-num",style:a===0?{color:"var(--m-ink-3)"}:null,children:a}),e.jsx("span",{className:"nm",children:s.k}),e.jsx("span",{className:"hint",children:s.hint}),r.length?e.jsx("ul",{children:r.map(i=>e.jsx("li",{children:i},i))}):e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)",lineHeight:1.45},children:t?"Empty. "+(s.k==="Brain dump"?"/capture fills this in one line.":s.wf+" feeds this stage."):"Empty."}),e.jsx("button",{className:"src m-x",onClick:()=>openXray("Lifecycle: "+s.k,s.hint,s.src),children:window.V3SRC[s.src].path.split("/").pop()})]},s.k)}),e.jsxs("div",{className:"m4-life-ends",children:[e.jsx("span",{className:"endh",children:"Keep it or drop it"}),n.lifecycleEnds.map(s=>e.jsxs("button",{className:"m4-life-end",onClick:()=>openXray("Lifecycle outcome: "+s.k,s.line,s.src),style:{textAlign:"left"},children:[e.jsx("span",{className:"k m-"+(s.tone==="good"?"good":"crit"),children:s.k}),e.jsx("span",{className:"l",children:t?s.tone==="good"?"No idea has earned a strategy line yet.":"Empty. May it stay that way for the right reasons.":s.line})]},s.k))]})]})]})}Object.assign(window,{StratRail:Oo,LoopSection:Po,StarSection:Do,LifecycleSection:Fo,S4_SECTIONS:mr,s4Scroll:ts});const ss=[{k:"Work",color:"var(--m-gold)",line:"the bet lives here"},{k:"Vitality",color:"var(--m-good)",line:"protects the work"},{k:"Faith",color:"var(--m-ink-2)",line:"keeps it honest"}],_o={running:"","time to decide":"is-warn","needs more data":"is-mute",kept:"is-good",dropped:"is-crit"},Pt=3;function Mn(n){return"exp-"+n}function Gn(n){return"02_Areas/Engine/Experiments/"+n+".md"}function zs(n,t){window.V3SRC[Mn(n.id)]||(window.V3SRC[Mn(n.id)]={path:Gn(n.id),anchor:"## Hypothesis",parser:"experiments-parser",status:"live",confidence:t?3:4,updated:t?"just now":"this week",fresh:"ok",workflow:"/experiment",excerpt:n.hyp+" Keep if: "+n.keep+" Drop if: "+n.drop,changed:t?"Written by the dashboard just now. Claude Code, Codex and Gemini can read and edit this file, it is not a dashboard-only object.":"The Lab card and the Bet's “testing this with” line both read from this file. The /experiment workflow writes it.",emptyState:"This file is created the moment the experiment starts."})}function zo(n){return(n||"experiment").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").split("-").slice(0,5).join("-")||"experiment"}function Vo({runs:n,target:t,color:s}){const a=Math.min(100,Math.round(n/Math.max(1,t)*100));return e.jsxs("span",{className:"m5-bar","aria-label":n+" of "+t,children:[e.jsx("span",{className:"tr",children:e.jsx("i",{style:{width:a+"%",background:s}})}),e.jsxs("span",{className:"n m-num",children:[n," of ",t]})]})}function Wo({e:n,color:t,onLogRun:s,onKeep:a,onDrop:r,onDelete:i,onReset:l,onToBet:o}){const[c,d]=React.useState(!1),[u,h]=React.useState(""),[p,m]=React.useState(!1),g=n.state==="kept"||n.state==="dropped";return e.jsxs("article",{className:"m5-exp"+(g?" is-done":""),children:[e.jsxs("div",{className:"hd",children:[e.jsx("span",{className:"m-chip "+(_o[n.state]||""),children:n.state}),n.bet?e.jsxs("button",{className:"m5-betlink",onClick:o,children:["tests the bet ",MIcons.arrow(11)]}):null,e.jsx("span",{style:{flex:1}}),e.jsxs("button",{className:"m5-src m-x",onClick:()=>openXray("Experiment, "+n.t,n.hyp,Mn(n.id)),children:["Experiments/",n.id,".md"]})]}),e.jsxs("p",{className:"hyp",children:[e.jsx(X,{claim:"Experiment, "+n.t,value:n.signal,src:Mn(n.id),children:n.hyp}),e.jsxs("span",{className:"win",children:[", ",n.window,"."]})]}),e.jsxs("p",{className:"chg",children:[e.jsx("span",{className:"lk",children:"Changing one thing:"})," ",n.change]}),e.jsxs("div",{className:"strip",children:[e.jsxs("span",{className:"cell",children:[e.jsx("span",{className:"lk",children:"Measuring"}),n.metric]}),e.jsxs("span",{className:"cell",children:[e.jsx("span",{className:"lk",children:n.unit||"runs"}),e.jsx(Vo,{runs:n.runs,target:n.target,color:t})]})]}),e.jsxs("div",{className:"m5-branches",children:[e.jsxs("div",{className:"br is-keep",children:[e.jsx("span",{className:"bk",children:"Keep if"}),e.jsx("span",{className:"bl",children:n.keep})]}),e.jsxs("div",{className:"br is-drop",children:[e.jsx("span",{className:"bk",children:"Drop if"}),e.jsx("span",{className:"bl",children:n.drop})]})]}),e.jsxs("p",{className:"sig",children:[n.signal,n.lesson?e.jsxs("span",{className:"lesson",children:[" · What you learned: ",n.lesson]}):null]}),c?e.jsxs("div",{className:"m5-dropask",children:[e.jsx("span",{className:"lk",children:"What did you learn?"}),e.jsx("input",{value:u,placeholder:"One honest sentence, it gets saved before this archives",onChange:f=>h(f.target.value)}),e.jsxs("div",{className:"row",children:[e.jsx("button",{className:"m-cta-line",style:{opacity:u.trim()?1:.45},disabled:!u.trim(),onClick:()=>{r(u.trim()),d(!1)},children:"Drop it, save the lesson"}),e.jsx("button",{className:"m-mini",onClick:()=>d(!1),children:"cancel"})]})]}):e.jsxs("div",{className:"acts",children:[n.state==="time to decide"?e.jsxs(React.Fragment,{children:[e.jsx("button",{className:"m-cta-line",onClick:a,children:"It worked, write it into Strategy"}),e.jsx("button",{className:"m-mini",onClick:()=>d(!0),children:"It didn't, drop it"})]}):null,n.state==="running"||n.state==="needs more data"?e.jsxs(React.Fragment,{children:[e.jsx("button",{className:"m-mini",onClick:s,children:"+ Log a run"}),n.state==="running"?e.jsx("button",{className:"m-mini",onClick:()=>d(!0),children:"drop early"}):null]}):null,n.kept_written?e.jsxs("span",{className:"m5-quiet",children:[MIcons.check(11)," written to Strategy.md"]}):null,e.jsx("span",{style:{flex:1}}),n.mine?p?e.jsxs("span",{className:"m5-confirm",children:["delete this experiment? ",e.jsx("button",{className:"m-mini is-danger",onClick:i,children:"yes, remove the file"})," ",e.jsx("button",{className:"m-mini",onClick:()=>m(!1),children:"no"})]}):e.jsx("button",{className:"m-mini",onClick:()=>m(!0),children:"delete"}):n.modified?e.jsx("button",{className:"m-mini",onClick:l,children:"reset example"}):null]})]})}const Vs=["The question","Your guess","One variable","Measure + sample","Decision rule","Review"];function Bo({countRunning:n,onStart:t,onCancel:s,existingIds:a}){const[r,i]=React.useState(0),[l,o]=React.useState({q:"",area:"Work",iff:"",then:"",change:"",metric:"",target:"",keep:"",drop:""}),c=x=>b=>o(Object.assign({},l,{[x]:b.target.value})),d=/\d/.test(l.then),u=/(\band\b|,|&|\+)/i.test(l.change),h=Number(l.target)>0,p=(n[l.area]||0)>=Pt,m=[l.q.trim().length>3,l.iff.trim()&&l.then.trim()&&d,l.change.trim()&&!u,l.metric.trim()&&h,l.keep.trim()&&l.drop.trim(),!p][r];let g=zo(l.q);for(;a.includes(g);)g+="-2";const f="If "+l.iff.trim().replace(/\.$/,"")+", "+l.then.trim().replace(/\.$/,"")+".",v=[e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"What are you testing?"}),e.jsx("input",{autoFocus:!0,value:l.q,placeholder:"In plain words, e.g. Does DMing 10 builders a day get real replies?",onChange:c("q")}),e.jsxs("div",{className:"arearow",children:[e.jsx("span",{className:"lk",children:"Which area is this about?"}),ss.map(x=>e.jsxs("button",{className:"m-mini"+(l.area===x.k?" is-sel":""),onClick:()=>o(Object.assign({},l,{area:x.k})),children:[e.jsx("span",{className:"dot",style:{background:x.color}}),x.k]},x.k))]})]},"0"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"Your guess, with a number."}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"IF (the one thing you'll change)"}),e.jsx("input",{autoFocus:!0,value:l.iff,placeholder:"e.g. I DM 10 builders every weekday",onChange:c("iff")})]}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"THEN (what should happen, with a number)"}),e.jsx("input",{value:l.then,placeholder:"e.g. at least 3 of 10 reply within a week",onChange:c("then")})]}),l.then.trim()&&!d?e.jsxs("p",{className:"m5-block",children:[e.jsx("span",{className:"m-chip is-warn",children:"no measurable target yet"})," Give it a number you can measure, a guess without a number can't run."]}):null]},"1"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"The one thing you're changing."}),e.jsx("input",{autoFocus:!0,value:l.change,placeholder:"Exactly one change, e.g. who I send DMs to",onChange:c("change")}),l.change.trim()&&u?e.jsxs("p",{className:"m5-block",children:[e.jsx("span",{className:"m-chip is-warn",children:"two changes"})," That's two changes, you won't know which one worked. Pick one."]}):null]},"2"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"How you'll measure it, and how many tries."}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"The metric"}),e.jsx("input",{autoFocus:!0,value:l.metric,placeholder:"e.g. replies per 10 DMs",onChange:c("metric")})]}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"Sample size (how many runs before judging)"}),e.jsx("input",{value:l.target,placeholder:"e.g. 50",inputMode:"numeric",onChange:c("target")})]}),e.jsx("p",{className:"m5-note",children:"The sample size locks in now, so the finish line can't move once you've started."})]},"3"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"Your decision rule, set before the first run."}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"Keep it if…"}),e.jsx("input",{autoFocus:!0,value:l.keep,placeholder:"e.g. 15 of 50 DMs get a real reply",onChange:c("keep")})]}),e.jsxs("label",{className:"lab",children:[e.jsx("span",{className:"lk",children:"Drop it if…"}),e.jsx("input",{value:l.drop,placeholder:"e.g. fewer than 8 of 50 reply",onChange:c("drop")})]}),e.jsxs("p",{className:"m5-note",children:["The rule decides, not your mood on day ",l.target||"N","."]})]},"4"),e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"ask",children:"Read it back."}),e.jsxs("p",{className:"m5-review-hyp",children:[f," ",e.jsxs("span",{className:"win",children:["— ",l.target," ","runs",", then the rule decides."]})]}),e.jsxs("div",{className:"m5-review-rows",children:[e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Changing"}),l.change]}),e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Measuring"}),l.metric]}),e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Keep if"}),l.keep]}),e.jsxs("div",{children:[e.jsx("span",{className:"lk",children:"Drop if"}),l.drop]})]}),e.jsxs("p",{className:"m5-note",children:["Will be saved to your vault → ",e.jsx("b",{className:"m-mono",children:Gn(g)}),", your agents can see it too."]}),p?e.jsxs("p",{className:"m5-block",children:[e.jsxs("span",{className:"m-chip is-warn",children:[Pt," already running in ",l.area]})," Finish or drop one first, more than three at once and none of them get honest attention."]}):null]},"5")][r];return e.jsxs("div",{className:"m5-guided",children:[e.jsxs("div",{className:"hd",children:[e.jsxs("span",{className:"m-kicker",style:{fontSize:10},children:["New experiment · step ",r+1," of ",Vs.length]}),e.jsx("span",{className:"dots",children:Vs.map((x,b)=>e.jsx("i",{className:b===r?"on":b<r?"done":""},x))}),e.jsx("button",{className:"m-mini",onClick:s,children:"cancel"})]}),v,e.jsxs("div",{className:"ft",children:[r>0?e.jsxs("button",{className:"m-mini",onClick:()=>i(r-1),children:[MIcons.arrowL(12)," back"]}):e.jsx("span",{}),r<5?e.jsxs("button",{className:"m-cta-line",style:{opacity:m?1:.4},disabled:!m,onClick:()=>i(r+1),children:["next ",MIcons.arrow(12)]}):e.jsx("button",{className:"m-cta",style:{opacity:m?1:.4},disabled:!m,onClick:()=>t({id:g,t:l.q.replace(/\?$/,""),area:l.area,bet:!1,mine:!0,q:l.q,hyp:f,change:l.change,metric:l.metric,runs:0,target:Number(l.target),unit:"runs",window:"testing "+l.target+" runs",keep:l.keep,drop:l.drop,signal:"No runs yet, first run today",state:"running"}),children:"Start the experiment"})]})]})}function Ho({S:n,sparse:t}){const[s,a]=React.useState(!1),[r,i]=useStored3("m5.lab.added",[]),[l,o]=useStored3("m5.lab.mods",{}),[c,d]=React.useState(null),u=React.useRef(null),h=k=>{d(k),clearTimeout(u.current),u.current=setTimeout(()=>d(null),6e3)},m=(t?[]:n.lab||[]).concat(r).map(k=>{const S=l[k.id]||{},E=S.runs!=null?S.runs:k.runs;let L=S.state||k.state;return L==="running"&&E>=k.target&&(L="time to decide"),Object.assign({},k,{runs:E,state:L,lesson:S.lesson,kept_written:S.kept_written,modified:!!l[k.id]})});m.forEach(k=>zs(k,k.mine));const g={};m.forEach(k=>{k.state==="running"&&(g[k.area]=(g[k.area]||0)+1)});const f=(k,S)=>o(Object.assign({},l,{[k]:Object.assign({},l[k]||{},S)})),v=k=>f(k.id,{runs:Math.min(k.target,k.runs+1),state:k.state==="needs more data"?"running":void 0}),x=k=>{f(k.id,{state:"kept",kept_written:!0}),h("Written into Strategy.md, the rule is in the plan now. The experiment file stays in your vault as the proof.")},b=(k,S)=>{f(k.id,{state:"dropped",lesson:S}),h("Lesson saved → Auto_Learnings.md, and the experiment is buried with its headstone. The file stays in your vault.")},j=k=>{i(r.filter(E=>E.id!==k.id));const S=Object.assign({},l);delete S[k.id],o(S),delete window.V3SRC[Mn(k.id)],h("Removed from your vault → "+Gn(k.id)+".")},A=k=>{const S=Object.assign({},l);delete S[k.id],o(S),h("Example reset to how it shipped.")},I=k=>{i(r.concat([k])),a(!1),zs(k,!0),h("Saved to your vault → "+Gn(k.id)+", your agents can see it too.")};return e.jsxs("section",{id:"s4-lab",className:"m4-sec","data-screen-label":"Strategy, The Lab","data-coach":"lab",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Experiments"}),e.jsx(Hint,{what:"Your workbench. Turn a question into a test: a guess with a number, one variable, a sample size, and a rule for deciding, all set before the first run.",doing:"Keep what wins, drop what doesn't, try the next thing. What passes gets written into your strategy.",src:"02_Areas/Engine/Experiments/ · experiments-parser"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-cta-line",style:{padding:"8px 15px",fontSize:12.5},onClick:()=>a(!0),children:[MIcons.spark(13)," New experiment"]})})]}),e.jsxs("p",{className:"m4-sub",children:["Test and keep what wins: guess → run it → measure → decide. Experiments you write here are saved as files in your vault, the same ones your terminal agents and the ",e.jsx("b",{className:"m-mono",style:{fontSize:"0.92em"},children:"/experiment"})," workflow use. The dashboard is a window into your system, not a separate app."]}),c?e.jsxs("p",{className:"m5-notice",children:[MIcons.check(12)," ",c]}):null,s?e.jsx(Bo,{countRunning:g,existingIds:m.map(k=>k.id),onStart:I,onCancel:()=>a(!1)}):null,t&&!m.length?s?null:e.jsx(Empty,{title:n.labEmpty.title,line:n.labEmpty.line,action:n.labEmpty.action,cmd:n.labEmpty.cmd}):ss.map(k=>{const S=m.filter(E=>E.area===k.k);return S.length?e.jsxs("div",{className:"m5-area",children:[e.jsxs("div",{className:"ah",children:[e.jsx("span",{className:"dot",style:{background:k.color}}),e.jsx("span",{className:"nm",children:k.k}),e.jsx("span",{className:"ln",children:k.line}),e.jsxs("span",{className:"ct m-num",children:[g[k.k]||0," of ",Pt," running slots used"]})]}),e.jsx("div",{className:"m5-grid",children:S.map(E=>e.jsx(Wo,{e:E,color:k.color,onLogRun:()=>v(E),onKeep:()=>x(E),onDrop:L=>b(E,L),onDelete:()=>j(E),onReset:()=>A(E),onToBet:()=>s4Scroll("star")},E.id))})]},k.k):null})]})}Object.assign(window,{LabSectionV5:Ho,M5_AREAS:ss});function $o(n,t){const s=[];return(n.loop||[]).some(o=>(t&&n.loopOverride?Object.assign({},o,n.loopOverride[o.k]||{}):o).status==="stuck")&&s.push("loop"),(n.pushback&&n.pushback.events||[]).some(o=>o.src==="overrides"&&o.tone==="crit")&&s.push("case"),s}function Wn({mode:n,children:t}){return n==="redacted"?e.jsx("span",{className:"m4-redact","aria-label":"redacted",children:t}):t}function pr({S:n,sparse:t}){const[s,a]=React.useState("private"),r=n.pushback,i=s==="private";return e.jsxs("section",{id:"s4-case",className:"m4-sec","data-screen-label":"Strategy, Pushback","data-coach":"pushback",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Pushback"}),e.jsx(Hint,{what:"The record arguing with you: things it refused, objections it raised, and times you went against it and what that cost.",doing:"Private by default because it's about you. Choose how much it shows.",src:"Refusal_Log.md · Red_Team_Dossier.md · Override_Log.md"}),e.jsx("div",{className:"tools",children:e.jsx("div",{className:"m4-case-modes",role:"tablist","aria-label":"Pushback visibility",children:["private","redacted","share-safe","full"].map(l=>e.jsx("button",{className:s===l?"is-on":"",onClick:()=>a(l),children:l},l))})})]}),t?e.jsx(Empty,{title:"Nothing on the record yet.",line:n.caseEmpty}):e.jsxs("div",{className:"m4-case"+(i?" m4-locked":""),children:[i?e.jsx("div",{className:"m4-lockmsg",children:e.jsxs("div",{className:"inn",children:[e.jsx("div",{style:{color:"var(--m-ink-3)",marginBottom:10},children:MIcons.shield(22)}),e.jsx("div",{className:"t m-serif",children:"Private."}),e.jsx("div",{className:"l",children:"This is about you: things the system refused, objections it raised, and times you overrode it. It stays sealed unless you open it."}),e.jsx("button",{className:"m-cta-line",style:{marginTop:16},onClick:()=>a("full"),children:"Open it"})]})}):null,e.jsx("p",{className:"m4-case-standing",children:e.jsx(X,{claim:"The standing objection",value:r.standing,src:r.standingSrc,children:s==="redacted"?e.jsxs(React.Fragment,{children:["The one thing it keeps pushing back on: ",e.jsx(Wn,{mode:s,children:"you protect build time and skip publish time"}),". Your bet says the opposite."]}):r.standing})}),e.jsxs("div",{className:"m4-push-list",children:[e.jsxs("div",{className:"ch",children:["When it pushed back, and what you did ",e.jsx("span",{className:"src",children:"Refusal_Log.md · Override_Log.md"})]}),r.events.map(l=>{const o=l.src==="overrides",c=s==="share-safe"&&o;return e.jsxs("div",{className:"m4-push-row",children:[e.jsx("div",{className:"d",children:l.d}),c?e.jsx("div",{className:"body",children:e.jsx("div",{className:"l m-mute",children:"A time you went against it, hidden in share-safe mode. It names people and costs."})}):e.jsxs("div",{className:"body",children:[e.jsx("div",{className:"l",children:e.jsx(Wn,{mode:s,children:e.jsx(X,{claim:"Pushback: "+l.d,value:l.what,src:l.src,children:l.what})})}),e.jsxs("div",{className:"r m-mute",children:["Its reason: ",e.jsx(Wn,{mode:s,children:l.reason})]})]}),e.jsxs("div",{className:"act",children:[e.jsx("span",{className:"you"+(l.you==="kept the no"?" is-kept":""),children:l.you}),c?null:e.jsx("div",{className:"o m-"+(l.tone==="good"?"good":l.tone==="crit"?"crit":"warn"),children:e.jsx(Wn,{mode:s,children:l.outcome})})]})]},l.d+l.what)})]})]})]})}function fr({S:n,sparse:t}){return e.jsxs("section",{id:"s4-board",className:"m4-sec","data-screen-label":"Strategy, The Board",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Advisors"}),e.jsx(Hint,{what:"Your own files weigh in on a big decision: your strategy, your goals, your past lessons, so you can see where they agree and disagree.",doing:"Disagreement is the point. Click an advisor to read the file it speaks from.",src:"six Engine files · one seat each"})]}),t?e.jsx(Empty,{title:"The advisors are mostly empty chairs.",line:n.boardEmpty}):e.jsxs("div",{className:"m4-board",children:[e.jsx("p",{className:"m4-sub",style:{margin:"0 0 4px"},children:n.board.purpose}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:19,margin:"2px 0 10px"},children:n.board.question}),n.board.seats.map(s=>e.jsxs("button",{className:"m4-seat"+(s.stance==="disagrees"?" is-dissent":""),onClick:()=>openXray("Advisor: "+s.file,s.says,s.src),style:{textAlign:"left"},children:[e.jsx("span",{className:"ava",children:s.file[0]}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsxs("span",{className:"f",children:[s.file,e.jsx("span",{className:"voice",children:s.voice})]}),e.jsx("span",{className:"says",style:{display:"block"},children:s.says})]}),e.jsx("span",{className:"stance m-chip "+(s.stance==="disagrees"?"is-warn":"is-mute"),children:s.stance})]},s.file)),e.jsxs("div",{className:"m4-board-verdict",children:[e.jsx("span",{style:{color:"var(--m-gold-2)"},children:MIcons.shield(18)}),n.board.verdict]})]})]})}function gr({S:n,sparse:t,onExit:s}){const a=n.graveyard;return e.jsxs("section",{id:"s4-grave",className:"m4-sec","data-screen-label":"Strategy, Graveyard","data-coach":"graveyard",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Buried ideas"}),e.jsx(Hint,{what:"Ideas that died, kept as lessons: what each one was, when it died, why, what it cost, what you learned, and what replaced it.",doing:"New ideas get checked against these. Don't bring one back without new proof.",src:"Active_Context.md §2 THE GRAVEYARD"}),e.jsx("div",{className:"tools",children:e.jsx("span",{className:"m4-aside",children:"don't bring these back"})})]}),t?e.jsx(Empty,{title:"Nothing has died yet.",line:n.graveyardEmpty}):e.jsxs("div",{className:"m4-grave",children:[a.entries.map(r=>{const i=o=>o&&o!=="—",l=i(r.by)||i(r.cost)||i(r.learned)||i(r.replaced);return e.jsxs("div",{className:"m4-stone",children:[e.jsxs("div",{children:[e.jsx("div",{className:"nm",children:r.name}),i(r.killed)?e.jsxs("div",{className:"kd",children:["died ",r.killed.replace(/^died /,"")]}):null]}),l?e.jsxs("div",{className:"det",children:[i(r.by)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Why it died:"})," ",e.jsx(X,{claim:"Killed: "+r.name,value:r.by,src:r.src,children:r.by}),e.jsx("br",{})]}):null,i(r.cost)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"What it cost:"})," ",r.cost,e.jsx("br",{})]}):null,i(r.learned)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"What you learned:"})," ",r.learned,e.jsx("br",{})]}):null,i(r.replaced)?e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"What replaced it:"})," ",r.replaced]}):null]}):null,r.exit!=="open"?e.jsx("button",{className:"m-mini",onClick:()=>s(r.name),children:"The full story"}):null]},r.name)}),a.lookalike&&a.lookalike.line&&a.lookalike.line!=="—"?e.jsxs("div",{className:"m4-lookalike",children:[e.jsx("span",{style:{color:"var(--m-warn)",marginTop:1},children:MIcons.bell(16)}),e.jsx("span",{style:{flex:1},children:e.jsx(X,{claim:"Lookalike warning",value:a.lookalike.line,src:a.lookalike.src,children:a.lookalike.line})}),e.jsxs("span",{className:"sim m-num",children:[a.lookalike.sim," alike"]})]}):null]})]})}const Xo={kept:"is-good",failed:"is-warn",open:"is-mute"};function xr({name:n,draftTitle:t,S:s,onClose:a}){React.useEffect(()=>{const l=o=>{o.key==="Escape"&&a()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[]);const r=n==="__draft__",i=r?{state:"open",stateLabel:"open · being written now",cost:"(counted at closeout: blocks spent, money, opportunity)",changed:"(what the system rewrites because this died)",learned:"(one honest sentence, no spin)",replaces:"(what takes its place, or nothing)",harder:"(is the replacement harder or easier, and is that good)",headstone:"(one line the Graveyard will remember it by)",src:"exitInterview"}:s.exitInterviews[n];return i?e.jsx("div",{className:"m4-exit-scrim",onClick:a,children:e.jsxs("div",{className:"m4-exit",onClick:l=>l.stopPropagation(),role:"dialog","aria-label":"Exit interview",children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:10},children:"Why it died"}),e.jsx("h2",{className:"t",children:r?t:n}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center"},children:[e.jsx("span",{className:"m-chip "+(Xo[i.state]||"is-mute"),children:i.stateLabel}),e.jsx("span",{style:{fontSize:11,color:"var(--m-ink-3)"},children:"three honest endings: kept · failed but learned from · still open"})]})]}),e.jsx("button",{className:"m-xray-close",onClick:a,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"rows",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What it cost"}),e.jsx("span",{className:"v",children:i.cost})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What changed"}),e.jsx("span",{className:"v",children:i.changed})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What was learned"}),e.jsx("span",{className:"v",children:i.learned})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"What replaces it"}),e.jsx("span",{className:"v",children:i.replaces})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Harder or easier"}),e.jsx("span",{className:"v",children:i.harder})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"k",children:"Remembered as"}),e.jsx("span",{className:"v head m-serif",children:i.headstone})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:22,alignItems:"center"},children:[r?e.jsx("button",{className:"m-cta",onClick:()=>{const l='Bury this idea in the Graveyard: "'+n+'". Remembered as: "'+i.headstone+'". Fill in what it cost and what replaces it from our record, then file it in Active_Context under THE GRAVEYARD.';window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:l})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"})),a()},children:"Send to your agent to bury"}):e.jsxs("button",{className:"m-cta-line",onClick:()=>{a(),openXray("Why it died: "+n,i.headstone,i.src)},children:[MIcons.xray(14)," Where this came from"]}),e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)"},children:"You can't just delete things here."})]})]})}):null}function Yo({D:n,onNav:t}){const s=useSimLoad("strategy"),a=n.__sparse,r=a?Object.assign({},window.V4S,window.V4SPARSE.strategy):window.V4S,i=n.__v4,[l,o]=React.useState("loop"),[c,d]=React.useState(null);return React.useEffect(()=>{if(s)return;const u=document.querySelector(".m-scroll");if(!u)return;const h=()=>{let p="loop";for(const m of S4_SECTIONS){const g=document.getElementById("s4-"+m.id);g&&g.getBoundingClientRect().top-u.getBoundingClientRect().top<140&&(p=m.id)}o(p)};return u.addEventListener("scroll",h,{passive:!0}),()=>u.removeEventListener("scroll",h)},[s]),s?e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:150,borderRadius:"var(--m-r)"}}),e.jsx("div",{className:"m4-skel",style:{height:320}}),e.jsx("div",{className:"m4-skel",style:{height:260}})]}):e.jsxs("div",{className:"m-wrap",children:[e.jsxs("div",{className:"m4-strat",children:[e.jsx(StratRail,{active:l,stuck:$o(r,a)}),e.jsxs("div",{className:"m4-strat-col",children:[e.jsx(LoopSection,{S:r,sparse:a}),e.jsx(StarSection,{S:r,D4:i,sparse:a,onNav:t}),e.jsx(LifecycleSection,{S:r,sparse:a}),e.jsx(LabSectionV5,{S:r,sparse:a}),e.jsx(pr,{S:r,sparse:a}),e.jsx(fr,{S:r,sparse:a}),e.jsx(gr,{S:r,sparse:a,onExit:u=>d({name:u})})]})]}),c?e.jsx(xr,{name:c.name,draftTitle:c.draftTitle,S:r,onClose:()=>d(null)}):null]})}Object.assign(window,{StrategyView:Yo,CaseSection:pr,BoardSection:fr,GraveSection:gr,ExitModal:xr});function Ne({kicker:n,hint:t,hintSrc:s,hintDo:a,srcKey:r,sub:i,children:l,first:o,label:c,coach:d}){return e.jsxs("section",{className:"m4e-row",style:o?{borderTop:"none",paddingTop:0}:null,"data-screen-label":c||"Evidence, "+n,"data-coach":d,children:[e.jsxs("div",{className:"m4e-row-head",children:[e.jsx("span",{className:"m-kicker",children:n}),e.jsx(Hint,{what:t,src:s,doing:a}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m4e-srcchip m-x",onClick:()=>openXray(n,i,r),children:[window.V3SRC[r].parser," · ",window.V3SRC[r].status]})})]}),i?e.jsx("p",{className:"m4e-sub",children:i}):null,l]})}function Ue({title:n,line:t,action:s,cmd:a}){return e.jsxs("div",{style:{padding:"10px 0 6px"},children:[e.jsx(Empty,{title:n,line:t}),s?e.jsx("div",{style:{marginTop:12},children:e.jsx(RunBtn,{className:"m-cta-line",idle:s+(a?" · "+a:""),running:"Running…",done:"Queued. Data lands tonight.",small:!0})}):null]})}function qo({E:n,sel:t,sparse:s}){if(s||!n.pace.actual||n.pace.actual.length<2)return e.jsx(Ne,{kicker:"Are you on pace?",first:!0,srcKey:"metrics",hint:"The pace your bet needs vs the pace your record shows.",hintSrc:"Metrics_Log.md · metrics-log-parser",sub:null,children:e.jsx(Ue,{title:"Pace needs a bet.",line:window.V4ESPARSE.paceEmpty,action:"Set your first bet",cmd:"in Strategy"})});const{actual:a,target:r,behind:i}=n.pace,l=a.concat(r),o=Math.min(...l),c=Math.max(...l),d=Math.max(1,(c-o)*.08),u=o-d,h=c+d,p=[u+(h-u)*.25,u+(h-u)*.5,u+(h-u)*.75],m=k=>Math.abs(k)>=1e3?"$"+(k/1e3).toFixed(1)+"k":"$"+Math.round(k),g=k=>k/(a.length-1)*100,f=k=>(1-(k-u)/(h-u))*100,v=k=>k.map((S,E)=>g(E)+","+f(S)).join(" "),x=Math.min(a.length-1,t+3),b=i!=="—"&&i!=null,j=n.days,A=j[0]?j[0].d:"start",I=j[j.length-1]?j[j.length-1].d:"today";return e.jsxs(Ne,{kicker:"Are you on pace?",first:!0,srcKey:"metrics",label:"Evidence, On pace?",hint:"The pace your bet promised vs the pace your record actually shows.",hintDo:"If the real line stays below target for three weeks, the 'wrong if' part of your bet is on the table.",hintSrc:"Metrics_Log.md · metrics-log-parser",sub:b?"Target vs your record. You're currently $"+i+" behind pace. Publishing is the move that closes the gap.":"Target vs your record, drawn from your goal forecast.",children:[e.jsxs("div",{className:"m4e-chart",children:[p.map((k,S)=>e.jsx("div",{className:"m4e-gridline",style:{top:f(k)+"%"},children:e.jsx("span",{className:"gl m-num",children:m(k)})},S)),e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("polyline",{points:v(r),fill:"none",stroke:"rgba(235,210,165,0.3)",strokeWidth:"1",strokeDasharray:"2.5 2.5",vectorEffect:"non-scaling-stroke"}),e.jsx("polyline",{points:v(a),fill:"none",stroke:"var(--m-gold)",strokeWidth:"2",vectorEffect:"non-scaling-stroke"})]}),e.jsx("div",{className:"m4e-pt",style:{left:g(x)+"%",bottom:100-f(a[x])+"%",background:"var(--m-gold-2)",boxShadow:"0 0 10px var(--m-gold-glow)"}}),b?e.jsx("div",{className:"m4e-note",style:{right:0,top:"14%"},children:e.jsxs("span",{className:"nl m-num",children:["−$",i," vs pace"]})}):null]}),e.jsxs("div",{className:"m4e-axis",children:[e.jsx("span",{children:A}),e.jsx("span",{children:I})]})]})}function Uo({E:n,sparse:t}){if(t||!n.cadence.cells||n.cadence.cells.length===0)return e.jsx(React.Fragment,{children:e.jsx(Ne,{kicker:"How often you publish",first:!0,srcKey:"streaks",hint:"A calendar strip of when you published, one box per day.",hintSrc:"Metrics_Log.md · streak-parser",children:e.jsx(Ue,{title:"No cadence on the books yet.",line:window.V4ESPARSE.cadenceEmpty,action:"Log today",cmd:"/log"})})});const s=n.cadence.cells;return e.jsxs(React.Fragment,{children:[e.jsxs(Ne,{kicker:"How often you publish",first:!0,srcKey:"streaks",label:"Evidence, How often you publish",hint:"When you published, one box per day. Gold is a real post, half-tone is a repost, dashed is today.",hintSrc:"Metrics_Log.md ## Streaks · streak-parser",sub:"This is the thing your whole bet rests on. "+n.cadence.total+" days published since "+n.cadence.startLabel+". Publish today and the streak holds.",children:[e.jsx("div",{className:"m4e-cal",children:s.slice(-14).map((a,r)=>e.jsx("div",{className:"cell "+a,children:a==="p"?"▲":a==="h"?"△":a==="t"?"…":""},r))}),e.jsxs("div",{className:"m4e-streaks m-num",children:[e.jsxs("span",{children:[e.jsx("b",{children:n.cadence.current})," current streak"]}),e.jsxs("span",{children:[e.jsx("b",{children:n.cadence.best})," best streak"]}),e.jsxs("span",{children:[e.jsx("b",{children:n.cadence.total})," published"]})]})]}),e.jsx(Ne,{kicker:"Are people using it?",srcKey:"activation",label:"Evidence, People using it",hint:"The one number that matters: people who actually started using it, not views.",hintDo:"Partial data; installs are counted, real use is checked by hand for now.",hintSrc:"telemetry/installs.json · activation-parser",sub:n.activation.line,children:e.jsxs("div",{className:"m4e-streaks m-num",style:{marginTop:2},children:[e.jsxs("span",{children:[e.jsx("b",{children:n.activation.installs})," installs"]}),e.jsxs("span",{children:[e.jsx("b",{children:n.activation.activated})," activated"]}),e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:["target: ",n.activation.target]})]})})]})}function Ko({E:n,sel:t,sparse:s}){if(s)return e.jsx(Ne,{kicker:"How good were your sessions?",first:!0,srcKey:"sessions",hint:"When a session started vs how much it produced: does later mean worse?",hintSrc:".claude/session-backups/ · activation-log",children:e.jsx(Ue,{title:"One session logged.",line:window.V4ESPARSE.sessionsEmpty,action:"Start a block"})});const a=d=>(d-6)/18*100,r=d=>d/3*78+8,i=n.rhythm||[],l=i.reduce((d,u)=>d+u,0),o=i.map((d,u)=>({h:u,v:d})).filter(d=>d.v>0).sort((d,u)=>u.v-d.v).slice(0,2),c=l>0&&o.length>=1?"Busiest hours: "+o.map(d=>d.h+":00").join(" and ")+", from "+l+" logged sessions.":null;return e.jsxs(React.Fragment,{children:[!n.sessions||n.sessions.length===0?e.jsx(Ne,{kicker:"How good were your sessions?",first:!0,srcKey:"sessions",label:"Evidence, Session quality",hint:"When a session started vs how much it produced: does later mean worse?",hintSrc:".claude/session-backups/ · activation-log",children:e.jsx(Ue,{title:"No session-level data yet.",line:window.V4ESPARSE.sessionsEmpty,action:"Start a block"})}):e.jsxs(Ne,{kicker:"How good were your sessions?",first:!0,srcKey:"sessions",label:"Evidence, Session quality",hint:"Each dot is one work session: when it started vs how much it produced (0 to 3).",hintDo:"Gold dots produced something. The day you picked above is circled.",hintSrc:".claude/session-backups/ · activation-log",sub:null,children:[e.jsxs("div",{className:"m4e-chart",style:{height:190},children:[[0,1,2,3].map(d=>e.jsx("div",{className:"m4e-gridline",style:{bottom:r(d)+"%",top:"auto"},children:e.jsx("span",{className:"gl m-num",style:{top:-14},children:d})},d)),n.sessions.map((d,u)=>e.jsx("button",{className:"m4e-dot"+(d.out>=2?" is-ship":"")+(d.di===t?" is-sel":""),style:{left:a(d.h)+"%",bottom:r(d.out)+"%"},title:n.days[d.di].d+" · "+(d.h|0)+":00 · output "+d.out,onClick:()=>openXray("Session: "+n.days[d.di].d,"Started "+(d.h|0)+":00, output "+d.out+" of 3","sessions")},u))]}),e.jsxs("div",{className:"m4e-axis",children:[e.jsx("span",{children:"6am"}),e.jsx("span",{children:"noon"}),e.jsx("span",{children:"6pm"}),e.jsx("span",{children:"midnight"})]})]}),l>0?e.jsxs(Ne,{kicker:"When you actually work",srcKey:"hourly",label:"Evidence, When you work",hint:"The hours real work actually happens, from your logged sessions.",hintSrc:".claude/session-backups/ · hourly-activity-parser",sub:c,children:[e.jsx("div",{className:"m4e-rhythm",children:i.map((d,u)=>e.jsx("div",{className:"b"+(d>=14?" hot":d>=8?" warm":""),style:{height:Math.max(2,d/22*100)+"%"},title:u+":00, "+d+" sessions"},u))}),e.jsxs("div",{className:"m4e-axis",children:[e.jsx("span",{children:"0"}),e.jsx("span",{children:"6"}),e.jsx("span",{children:"12"}),e.jsx("span",{children:"18"}),e.jsx("span",{children:"23"})]})]}):e.jsx(Ne,{kicker:"When you actually work",srcKey:"hourly",label:"Evidence, When you work",hint:"The hours real work actually happens, from your logged sessions.",hintSrc:".claude/session-backups/ · hourly-activity-parser",children:e.jsx(Ue,{title:"No hourly rhythm yet.",line:"This fills in once your sessions are logged across a few days."})})]})}function Jo({E:n,sparse:t}){return t?e.jsx(Ne,{kicker:"How sure are these patterns?",first:!0,srcKey:"learnings",hint:"Patterns get more certain (1 to 5) as nightly reviews keep confirming them.",hintSrc:"Auto_Learnings.md · learnings-parser",children:e.jsx(Ue,{title:"No patterns yet.",line:window.V4ESPARSE.patternsEmpty,action:"Run the nightly review",cmd:"/analyse-day"})}):e.jsxs(React.Fragment,{children:[e.jsx(Ne,{kicker:"How sure are these patterns?",first:!0,srcKey:"learnings",label:"Evidence, Patterns",hint:"Each pattern climbs a 1 to 5 scale, one step per week that confirms it.",hintDo:"At 4 or higher, a pattern can become a standing rule.",hintSrc:"Auto_Learnings.md · learnings-parser",sub:n.ladder.length+(n.ladder.length===1?" pattern so far. The steps show how sure it is.":" patterns so far. The steps show how sure each one is."),children:n.ladder.map(s=>e.jsxs("div",{className:"m4e-lad",children:[e.jsx("span",{className:"id",children:s.k}),e.jsx("span",{className:"l",children:e.jsx(X,{claim:s.k,value:s.line,src:s.src,children:s.line})}),e.jsx("span",{className:"steps","aria-label":"confidence path "+s.path.join("→"),children:s.path.map((a,r)=>e.jsx("i",{className:r===s.path.length-1&&a>=4?"on":"",style:{height:Math.max(4,a/5*30)+"px",...r===s.path.length-1?{background:a>=4?"var(--m-gold)":"rgba(235,210,165,0.4)"}:{}}},r))}),e.jsxs("span",{className:"cf m-num",children:[s.path[s.path.length-1]," / 5 · ",s.runs]})]},s.k))}),e.jsx(Ne,{kicker:"What moves together",srcKey:"correlations",label:"Evidence, What moves together",hint:"What tends to go up or down with what. This shows things move together, not that one causes the other; experiments test causes.",hintSrc:"Auto_Learnings.md ## Correlations · correlations-parser",sub:"The strongest pair already became an experiment. The weakest is flagged as a thin sample, not hidden.",children:n.correlations.map(s=>e.jsxs("div",{className:"m4e-cor"+(s.weak?" is-weak":""),children:[e.jsxs("span",{className:"pair",children:[s.a,e.jsx("span",{className:"arr",children:"↔"}),s.b]}),e.jsx("span",{className:"r m-num",children:s.r}),e.jsx("span",{className:"n",children:s.n})]},s.a))})]})}function Go({E:n,sparse:t}){return t?e.jsx(Ne,{kicker:"Said vs did",first:!0,srcKey:"saidDone",hint:"What you planned vs what you actually did, with what each gap cost.",hintSrc:"Daily/ + Metrics_Log.md · said-done-differ",children:e.jsx(Ue,{title:"Nothing to compare yet.",line:window.V4ESPARSE.saidDoneEmpty,action:"Write today's plan",cmd:"/morning"})}):e.jsxs(Ne,{kicker:"Said vs did",first:!0,srcKey:"saidDone",label:"Evidence, Said vs did",hint:"What you said you'd do against what the record shows. The cost column folds in the times you went off-plan.",hintDo:"This is what the objections in Pushback are built on.",hintSrc:"Daily notes + Metrics_Log.md · said-done-differ",sub:"Worked out from the record, not from memory. "+n.saidDone.filter(s=>s.tone==="warn").length+" of "+n.saidDone.length+" commitments are off.",children:[e.jsxs("div",{className:"m4e-sd hdr",children:[e.jsx("span",{children:"You said"}),e.jsx("span",{children:"You actually did"}),e.jsx("span",{children:"What the gap cost"})]}),n.saidDone.map(s=>e.jsxs("div",{className:"m4e-sd",children:[e.jsx("span",{className:"said",children:e.jsx(X,{claim:"Said, "+s.said,value:s.done,src:"saidDone",children:s.said})}),e.jsx("span",{className:"done"+(s.tone==="warn"?" is-warn":""),children:s.done}),e.jsx("span",{className:"cost",children:s.cost})]},s.said))]})}function Qo({E:n,sparse:t}){return e.jsxs(React.Fragment,{children:[e.jsx(Ne,{kicker:"Work · Vitality · Faith",first:!0,srcKey:"metrics",label:"Evidence, Your areas",hint:"Three areas as one record: a 14-day mini-chart each, same window as the day picker.",hintSrc:"Metrics_Log.md · metrics-log-parser",sub:t?window.V4ESPARSE.domainsLine:"One record, three areas. Work is the bet, Vitality protects it, Faith keeps it honest.",children:(t?n.domains.map(s=>({...s,spark:s.spark.map(()=>.15),line:"logging just began"})):n.domains).map(s=>e.jsxs("div",{className:"m4e-dom"+(s.tone==="good"?" is-good":""),children:[e.jsx("span",{className:"name",children:s.k}),e.jsx("span",{className:"spark","aria-hidden":"true",children:s.spark.map((a,r)=>e.jsx("i",{style:{height:Math.max(6,a*100)+"%"}},r))}),e.jsx("span",{className:"line",children:e.jsx(X,{claim:s.k+", 14 days",value:s.line,src:s.src,children:s.line})})]},s.k))}),e.jsx(Ne,{kicker:"Health data (planned)",srcKey:"health",label:"Evidence, Health data (planned)",hint:"Planned, not faked. Until you connect a health source, this reads from sleep you log yourself.",hintSrc:"Integrations/health · health-protocols-parser (planned)",children:e.jsx(Ue,{title:"No instrument connected.",line:"HRV, resting heart rate and recovery are planned inputs. When connected, this row becomes a recovery-vs-output chart. Until then it stays empty on purpose.",action:"Open Configure → Integrations"})})]})}function Zo({E:n}){const t=n.coverage,s=a=>a/t.of*100+"%";return e.jsxs("button",{className:"m4e-cov m-rise","data-coach":"evidence-coverage",style:{"--i":6,width:"100%"},onClick:()=>openXray("Source coverage",t.live+" live, "+t.partial+" partial, "+t.planned+" planned of "+t.of+" parsers","coverage"),"data-screen-label":"Evidence, Source coverage",children:[e.jsx("span",{className:"k",children:"Source coverage"}),e.jsxs("span",{className:"meter","aria-hidden":"true",children:[e.jsx("i",{className:"lv",style:{width:s(t.live)}}),e.jsx("i",{className:"pt",style:{width:s(t.partial)}}),e.jsx("i",{className:"pl",style:{width:s(t.planned)}})]}),e.jsxs("span",{className:"cnt m-num",children:[e.jsxs("span",{style:{color:"var(--m-gold-2)"},children:[t.live," live"]}),e.jsx("span",{style:{color:"var(--m-line-2)",margin:"0 6px"},children:"|"}),e.jsxs("span",{children:[t.partial," partial"]}),e.jsx("span",{style:{color:"var(--m-line-2)",margin:"0 6px"},children:"|"}),e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:[t.planned," planned of ",t.of]})]}),e.jsxs("span",{className:"cnt",style:{color:"var(--m-ink-3)"},children:["thinnest: ",t.thin[0]]}),e.jsxs("span",{style:{color:"var(--m-gold-2)",display:"inline-flex",alignItems:"center",gap:6,fontSize:11},children:[MIcons.xray(12)," Where's this from?"]})]})}Object.assign(window,{ERow:Ne,ETeach:Ue,PaceChart:qo,CadenceLens:Uo,SessionsLens:Ko,PatternsLens:Jo,SaidDoneLens:Go,DomainsLens:Qo,CoverageStrip:Zo});function yr(){window.dispatchEvent(new CustomEvent("m4seal"))}function as(){const n=new Date;return"m4.sealed."+n.getFullYear()+"-"+String(n.getMonth()+1).padStart(2,"0")+"-"+String(n.getDate()).padStart(2,"0")}function Dt({small:n}){const[t]=useStored3(as(),null);return e.jsxs("button",{className:n?"m-mini":"m-cta-line",onClick:yr,"data-coach":"seal-entry",title:"The nightly check-in: say how your day went from memory, then see what really happened.",children:[t?MIcons.check(12):MIcons.moon(12)," ",t?"Day closed":"Close the day"]})}function ec(){const[n,t]=React.useState(!1),[s,a]=React.useState("claim"),[r,i]=React.useState({}),[l,o]=React.useState(""),[c,d]=React.useState(""),[u,h]=useStored3(as(),null),[p,m]=React.useState(null),g=window.V4T.account;if(React.useEffect(()=>{const I=()=>{t(!0),a(u?"sealed":"claim")},k=S=>{S.key==="Escape"&&t(!1)};return window.addEventListener("m4seal",I),window.addEventListener("keydown",k),()=>{window.removeEventListener("m4seal",I),window.removeEventListener("keydown",k)}},[u]),!n)return null;const f=()=>g.claims.length?g.claims.map(k=>!!r[k.id]===k.recorded?0:1).reduce((k,S)=>k+S,0)/g.claims.length:null,v=u?u.gap:f(),x=g.claims.some(I=>r[I.id]&&!I.recorded),b=g.claims.some(I=>!r[I.id]&&I.recorded),j=v==null?"Nothing was recorded today to compare your memory against.":v===0?"What you said matched what actually happened. Nicely done.":x?"You remembered the day as better than it really was.":b?"You sold yourself short, you did more than you said.":"Your memory and what happened don't quite line up.",A=()=>{const I=f(),k=I==null?null:Math.round(I*100)/100,S={gap:k,reply:c.trim(),at:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})};h(S),a("sealed"),m("saving");const E="Sealed the day from memory"+(k!=null?", gap "+k.toFixed(2):", nothing recorded to compare")+(S.reply?", with a reply on record":"");fetch("/api/health").then(L=>L.json()).then(L=>fetch("/api/capture",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":L&&L.token},body:JSON.stringify({text:E,tag:"seal"})})).then(L=>{if(!L.ok)throw new Error("HTTP "+L.status);m("saved")}).catch(()=>m("failed"))};return e.jsxs("div",{className:"m4t-seal",role:"dialog","aria-label":"Sealed Account","data-screen-label":"Sealed Account, nightly closeout",children:[e.jsxs("button",{className:"m-ghost esc",onClick:()=>t(!1),children:[MIcons.x(14)," ",s==="sealed"?"Close":"Not now"]}),e.jsxs("div",{className:"frame",children:[s==="claim"?e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{marginBottom:14,display:"flex",alignItems:"center",gap:10},children:[m4Lens().sealKicker,window.V3&&window.V3.day!=null?" · day "+window.V3.day:"",e.jsx(Hint,{what:"The nightly check-in. First you say how your day went, from memory. Then what really happened shows up next to it.",doing:"The distance between the two is your 'gap', how well your memory matched reality.",src:"Sealed_Accounts.md · seal-parser"})]}),e.jsx("h2",{className:"m4t-prompt m-serif",children:m4Lens().sealPrompt}),e.jsxs("div",{className:"m4t-morning",children:[e.jsx("span",{className:"lk",children:"WHAT YOU PLANNED THIS MORNING"}),g.morning]}),e.jsx("div",{style:{marginTop:18},children:g.claims.map(I=>e.jsxs("div",{className:"m4t-claim"+(r[I.id]?" is-on":""),onClick:()=>i(k=>({...k,[I.id]:!k[I.id]})),role:"checkbox","aria-checked":!!r[I.id],tabIndex:0,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),i(S=>({...S,[I.id]:!S[I.id]})))},children:[e.jsx("span",{className:"box",children:r[I.id]?MIcons.check(12):null}),e.jsx("span",{className:"k",children:I.k})]},I.id))}),e.jsx("textarea",{className:"m4t-free",placeholder:"One honest sentence about the day, in your own words. (Optional.)",value:l,onChange:I=>o(I.target.value)}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:20,alignItems:"center"},children:[e.jsxs("button",{className:"m-cta",onClick:()=>a("reckon"),children:["See what really happened ",MIcons.arrow(15)]}),e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)"},children:"Nothing is judged yet. The record speaks next."})]})]}):null,s==="reckon"?e.jsxs("div",{children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:14},children:"Nightly check-in · the comparison"}),g.claims.length?e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"m4t-reck",children:[e.jsx("div",{className:"hd",children:"You said"}),e.jsx("div",{className:"hd",children:"What actually happened"}),g.claims.map(I=>e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"cell claim",children:[e.jsx("span",{className:"mark "+(!!r[I.id]===I.recorded?"m-good":"m-warn"),children:!!r[I.id]===I.recorded?"matches":"diverges"}),e.jsx("br",{}),r[I.id]?I.k:"Not claimed: "+I.k.toLowerCase()]}),e.jsx("div",{className:"cell rec",children:e.jsx(X,{claim:"Recorded, "+I.k,value:I.rec,src:"sealed",children:I.rec})})]},I.id))]}),e.jsxs("div",{className:"m4t-gap",children:[e.jsx("span",{className:"num m-num",children:f().toFixed(2)}),e.jsxs("span",{className:"lbl",children:["how far off you were",e.jsx("br",{}),"0 means your memory matched reality"]})]})]}):null,e.jsx("p",{className:"m4t-verdict m-serif",children:j}),e.jsx("div",{style:{display:"flex",gap:10,marginTop:14,flexWrap:"wrap"},children:e.jsx("button",{className:"m-cta-line",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"From tonight's check-in: "+g.repair.k+". Put it in tomorrow's plan."})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:g.repair.k})}),e.jsxs("div",{className:"m4t-rebut",children:[e.jsx("div",{className:"k",children:"Disagree? · optional"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--m-ink-2)",marginBottom:10,lineHeight:1.5},children:"Don't agree with this? Reply. Your reply becomes a claim the system tests over the next 7 days."}),e.jsx("textarea",{className:"m4t-free",style:{marginTop:0},placeholder:"e.g. “"+g.openClaim.line+"”",value:c,onChange:I=>d(I.target.value)})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:22,alignItems:"center"},children:[e.jsxs("button",{className:"m-cta",onClick:A,children:[MIcons.shield(15)," Close the day"]}),e.jsxs("button",{className:"m-link",onClick:()=>a("claim"),children:[MIcons.arrowL(13)," Back to what you said"]})]})]}):null,s==="sealed"?e.jsxs("div",{className:"m4t-sealed",children:[e.jsx("div",{className:"m4t-wax m-serif",children:"M"}),e.jsx("h2",{className:"m4t-prompt m-serif",style:{marginTop:22},children:"Day closed."}),e.jsxs("p",{style:{fontSize:14,color:"var(--m-ink-2)",marginTop:10,lineHeight:1.6},children:[window.V3&&window.V3.day!=null?"Day "+window.V3.day+" is closed.":"The day is closed."," ",(()=>{const I=u?u.gap:f();return I==null?"Nothing was recorded today to measure your memory against.":e.jsxs(React.Fragment,{children:["Your memory was off by ",e.jsx("span",{className:"m-num",style:{color:"var(--m-gold-2)"},children:I.toFixed(2)}),"."]})})(),u&&u.reply?" Your reply is on the record with it.":""]}),e.jsx("div",{className:"m4t-writes",children:p==="saved"?e.jsxs(React.Fragment,{children:["wrote → today's note ",e.jsxs("span",{style:{color:"var(--m-ink-3)"},children:["## Log · sealed",(()=>{const I=u?u.gap:f();return I!=null?", gap "+I.toFixed(2):""})()]})]}):p==="failed"?e.jsx("span",{style:{color:"var(--m-warn)"},children:"couldn't write the receipt, nothing was saved to the note"}):p==="saving"?"writing the receipt to today's note…":e.jsx("span",{style:{color:"var(--m-ink-3)"},children:"sealed on this screen only (reopened from an earlier seal)"})}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"center",marginTop:26},children:[e.jsxs("button",{className:"m-cta",onClick:()=>t(!1),children:["Good night ",MIcons.arrow(15)]}),e.jsx("button",{className:"m-cta-line",onClick:()=>{h(null),a("claim")},children:"Undo · redo it"})]})]}):null]},s)]})}function nc({sparse:n}){const t=window.V4T.account,[s]=useStored3(as(),null);if(n)return e.jsxs(ERow,{kicker:"Nightly close",first:!0,srcKey:"sealed",hint:"The nightly check-in: how you said the day went vs what really happened, with a score for how close they were.",hintSrc:"Sealed_Accounts.md · seal-parser",children:[e.jsx(Empty,{title:"No days closed yet.",line:window.V4TSPARSE.accountEmpty}),e.jsx("div",{style:{marginTop:14},children:e.jsx(Dt,{})})]});const r=t.gapTrend.map((i,l)=>i===null?null:[l/(t.gapTrend.length-1)*100,90-i/.5*80]).filter(Boolean).map(i=>i[0]+","+i[1]).join(" ");return e.jsx(React.Fragment,{children:e.jsxs(ERow,{kicker:"Nightly close",first:!0,srcKey:"sealed",label:"Evidence, Nightly close",hint:"The nightly check-in: you say how the day went from memory, then what really happened answers, and the gap scores how close you were.",hintDo:"Tonight's check-in opens from Home (Close the day) or right here.",hintSrc:"Sealed_Accounts.md · seal-parser",sub:t.gapNote,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:6},children:[e.jsxs("span",{style:{fontSize:12.5,color:"var(--m-ink-2)"},children:["Tonight: ",s?e.jsxs("span",{className:"m-good",children:["closed",s.gap!=null?e.jsxs(React.Fragment,{children:[" · off by ",e.jsx("span",{className:"m-num",children:s.gap.toFixed(2)})]}):null]}):e.jsx("span",{className:"m-warn",children:"not closed yet"})]}),e.jsx(Dt,{small:!0})]}),e.jsxs("div",{className:"m4t-trend",children:[e.jsx("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:e.jsx("polyline",{points:r,fill:"none",stroke:"var(--m-gold)",strokeWidth:"1.5",vectorEffect:"non-scaling-stroke"})}),e.jsx("span",{style:{position:"absolute",left:0,top:-4,fontFamily:"var(--m-mono)",fontSize:9.5,color:"var(--m-ink-3)"},children:"gap 0.50"}),e.jsx("span",{style:{position:"absolute",left:0,bottom:-4,fontFamily:"var(--m-mono)",fontSize:9.5,color:"var(--m-ink-3)"},children:"gap 0.00"}),e.jsx("span",{className:"m4e-note",style:{right:0,top:0},children:"narrowing three weeks straight: the story is learning to match the record"})]}),e.jsx("div",{style:{marginTop:18},children:t.history.map(i=>e.jsxs("div",{className:"m4t-hist",children:[e.jsx("span",{className:"d",children:i.d}),e.jsxs("span",{className:"g m-num",children:["gap ",i.gap.toFixed(2)]}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:"Seal, "+i.d,value:i.verdict,src:"sealed",children:i.verdict})}),e.jsxs("span",{className:"s",children:["sealed ",i.sealed]})]},i.d))}),e.jsxs("div",{className:"m4t-openclaim",children:[e.jsx("span",{style:{color:"var(--m-gold-2)",marginTop:2},children:MIcons.spark(15)}),e.jsxs("span",{style:{flex:1},children:[e.jsx("b",{style:{fontWeight:500},children:"Open disagreement you're testing:"})," “",t.openClaim.line,"”",e.jsxs("span",{style:{display:"block",marginTop:4,fontSize:11.5,color:"var(--m-ink-2)"},children:["filed ",t.openClaim.filed," · ",t.openClaim.window," · ",t.openClaim.status]})]}),e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Rebuttal claim",t.openClaim.line,"rebuttal"),children:"rebuttal-tracker"})]})]})})}Object.assign(window,{SealRitual:ec,SealEntryBtn:Dt,AccountLens:nc,openSeal:yr});const tc={kill:"is-crit",pivot:"",exp:"is-mute",evid:"is-good",strain:"is-warn",today:"is-mute"},sc={kill:"killed",pivot:"the pivot",exp:"experiment",evid:"evidence",strain:"pushback",today:"today"};function ac({sparse:n}){const t=window.V4T.replay,[s,a]=useStored3("m4.replay.idx",t.length-1),[r,i]=React.useState(!1),l=Math.min(Math.max(s,0),t.length-1),o=t[l];return React.useEffect(()=>{if(!r)return;if(l>=t.length-1){i(!1);return}const c=setTimeout(()=>a(l+1),1700);return()=>clearTimeout(c)},[r,l]),n?e.jsx(ERow,{kicker:"Strategy history",first:!0,srcKey:"replay",coach:"replay",hint:"Plays your strategy across time: guesses, experiments, changes of direction, and ideas you killed.",hintSrc:"Strategy.md revision history · strategy-history-parser",children:e.jsx(Empty,{title:"Not enough history to replay.",line:window.V4TSPARSE.replayEmpty})}):e.jsxs(ERow,{kicker:"Strategy history",first:!0,srcKey:"replay",label:"Evidence, Strategy history",coach:"replay",hint:"Your strategy file, played back like a recording: each frame is a real change you made, nothing invented.",hintDo:"Press play, or drag through the dots.",hintSrc:"Strategy.md revision history · strategy-history-parser",sub:"A mind changing, on the record: three ideas killed, one change of direction, one experiment, one pattern written in, one objection that still stands.",children:[e.jsxs("div",{className:"m4t-stage k-"+o.k,"data-screen-label":"Evidence, Replay frame",children:[e.jsx("span",{className:"kchip m-chip "+(tc[o.k]||"is-mute"),children:sc[o.k]}),e.jsxs("div",{children:[e.jsxs("div",{className:"date m-num",children:[o.d," · frame ",l+1," of ",t.length]}),e.jsx("h3",{className:"t m-serif",children:o.t}),e.jsx("p",{className:"x",children:o.x})]})]},l),e.jsx("div",{className:"m4t-track",role:"group","aria-label":"Replay timeline",children:t.map((c,d)=>e.jsxs(React.Fragment,{children:[d>0?e.jsx("span",{className:"seg","aria-hidden":"true"}):null,e.jsx("button",{className:"m4t-tick"+(d===l?" is-on":d<l?" is-past":""),onClick:()=>{i(!1),a(d)},title:c.d+" · "+c.t,"aria-label":c.d+" "+c.t,children:e.jsx("i",{})})]},c.d))}),e.jsxs("div",{className:"m4t-track-labels",children:[e.jsx("span",{children:t[0].d}),e.jsx("span",{children:t[t.length-1].d})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:16,alignItems:"center"},children:[r?e.jsxs("button",{className:"m-cta-line",onClick:()=>i(!1),children:[MIcons.pause(14)," Pause"]}):e.jsxs("button",{className:"m-cta",style:{padding:"11px 18px",fontSize:13.5},onClick:()=>{l>=t.length-1&&a(0),i(!0)},children:[MIcons.play(14)," ",l>=t.length-1?"Replay from the first kill":"Play"]}),e.jsxs("button",{className:"m-link",onClick:()=>openXray("Strategy Replay, "+o.d,o.t+". "+o.x,"replay"),children:[MIcons.xray(13)," Where's this from?"]})]})]})}function rc({sparse:n}){const t=window.V4T.thread,s=t.state;if(n)return e.jsx(ERow,{kicker:"On track?",first:!0,srcKey:"thread",hint:"One gold line from today's work to your bet. Tight when you're on it, loose when you're drifting, frayed after you keep going off-plan.",hintSrc:"sessions + Strategy.md · thread-tension-parser",children:e.jsx(Empty,{title:"No thread yet.",line:window.V4TSPARSE.threadEmpty})});const a=t.states[s],r=s==="taut"?"M 4 50 L 96 50":s==="slack"?"M 4 42 Q 50 96 96 42":"M 4 44 Q 38 78 62 60 M 70 56 Q 84 48 96 44";return e.jsxs(ERow,{kicker:"On track?",first:!0,srcKey:"thread",label:"Evidence, On track?",hint:"The one thing that's always moving in the app: how far today's work is from your bet, right now.",hintDo:"It runs quietly down the side of Home too. Tap the line to see the sessions that moved it.",hintSrc:"sessions + Strategy.md · thread-tension-parser",sub:"Tight when today's work is on the bet. Loose when you're drifting. Frayed after you keep going off-plan; it knits back together when you publish.",children:[e.jsxs("button",{className:"m4t-threadbox"+(s==="frayed"?" no-anim":""),style:{width:"100%",display:"block"},onClick:()=>openXray("The Thread, "+s,a.line,"thread"),title:"See the sessions that moved it",children:[e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("path",{className:"m4t-thread-line"+(s==="frayed"?" is-frayed":""),d:r}),s!=="frayed"?e.jsx("path",{className:"m4t-thread-pulse",d:r}):null]}),e.jsx("span",{className:"m4t-anchor",style:{left:0,top:"16%"},children:"today's work"}),e.jsx("span",{className:"m4t-anchor",style:{right:0,top:"16%"},children:"the bet"})]}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:19,marginTop:14,lineHeight:1.35},children:a.line}),e.jsxs("p",{style:{fontSize:12.5,color:"var(--m-ink-2)",marginTop:6},children:[a.sub,t.moved&&t.moved!=="—"?e.jsxs("span",{className:"m-mono",style:{fontSize:10.5,color:"var(--m-ink-3)"},children:[" · ",t.moved]}):null]})]})}function ic({sparse:n}){const t=window.V4T.bump;return e.jsxs(React.Fragment,{children:[e.jsx(ERow,{kicker:"The nudge",first:!0,srcKey:"speedbump",label:"Evidence, The nudge",coach:"speedbump",hint:"When you open something off-plan in the middle of a focus session, the screen dims to one calm interruption.",hintDo:"It fires for real here: open Library or Settings while a focus session is going.",hintSrc:"Hooks/speed-bump.js · hook-indexer",sub:"One question, two honest ways out. "+t.fired+".",children:e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{className:"m-cta-line",onClick:()=>window.dispatchEvent(new CustomEvent("m4bump")),children:"See the interruption"}),e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)"},children:"or set it off for real: start a focus session, then wander to Library."})]})}),e.jsx(ERow,{kicker:"Notes to your future self",srcKey:"tripwire",label:"Evidence, Notes to your future self",hint:"A note you leave yourself: if a condition trips, you see it before you carry on. Set off by a behavior, not a date.",hintDo:"When you do the thing it's watching for, the note shows up before you continue.",hintSrc:"Tripwires.md · tripwire-parser",sub:n?window.V4TSPARSE.tripwireEmpty:"Two notes on file: one went off and you answered it, one is still waiting.",children:n?e.jsx("div",{style:{marginTop:4},children:e.jsx("button",{className:"m-cta-line",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"Set a note to my future self (a tripwire): if I [the behavior to watch for], remind me: [the note]. File it in Active_Context under Notes To Future Self."})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:"Write your first note"})}):window.V4T.tripwires.map(s=>e.jsxs("article",{className:"m4t-wire",children:[e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsx("h3",{className:"promise m-serif",style:{flex:1},children:e.jsx(X,{claim:"Note to future you, the promise",value:s.promise,src:s.src,children:s.promise})}),e.jsx("span",{className:"m-chip "+(s.state==="fired"?"is-warn":"is-mute"),children:s.state==="fired"?"went off · "+s.firedAt:"waiting"})]}),e.jsxs("div",{className:"kv",children:[e.jsx("span",{className:"k",children:"Set off by"}),e.jsx("span",{className:"v",children:s.pattern})]}),e.jsxs("div",{className:"kv",children:[e.jsx("span",{className:"k",children:"Goes off when"}),e.jsx("span",{className:"v m-mono",style:{fontSize:11.5},children:s.condition})]}),e.jsxs("div",{className:"m4t-letter",children:[e.jsx("span",{className:"lk",children:"THE NOTE · written when you were sure"}),s.letter]}),s.thread.length?e.jsx("div",{children:s.thread.map((a,r)=>e.jsxs("div",{className:"m4t-reply",children:[e.jsx("span",{className:"who",children:a.who}),e.jsx("span",{className:"l",children:a.line})]},r))}):null]},s.promise))})]})}function lc({open:n,onReturn:t,onClose:s}){const[a,r]=React.useState(!1),[i,l]=React.useState(""),[o,c]=React.useState(!1),d=window.V4T.bump;return React.useEffect(()=>{n&&(r(!1),l(""),c(!1))},[n]),n?e.jsx("div",{className:"m4t-bump",role:"alertdialog","aria-label":"Speed bump","data-screen-label":"Speed Bump, interruption",children:e.jsxs("div",{className:"inn",children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:16},children:"Quick check"}),e.jsxs("h2",{className:"ask m-serif",children:[d.line,e.jsx("br",{}),d.ask]}),a?o?e.jsxs(React.Fragment,{children:[e.jsxs("p",{className:"l",style:{color:"var(--m-good)"},children:[MIcons.check(13)," Saved. It'll be scored in 7 days by what it cost."]}),e.jsx("div",{className:"btns",children:e.jsx("button",{className:"m-cta-line",onClick:s,children:"Continue"})})]}):e.jsxs(React.Fragment,{children:[e.jsx("textarea",{className:"m4t-free",style:{textAlign:"left",maxWidth:440},placeholder:"Why is this the right move? (Saved to your record.)",value:i,onChange:u=>l(u.target.value),autoFocus:!0}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{opacity:i.trim()?1:.5},disabled:!i.trim(),onClick:()=>c(!0),children:"Save it"}),e.jsx("button",{className:"m-link",onClick:()=>r(!1),children:"Back"})]})]}):e.jsxs(React.Fragment,{children:[e.jsx("p",{className:"l",children:"Your focus session is going and the thread still isn't published. This pause is the system keeping your own promise, not blocking you."}),e.jsxs("div",{className:"btns",children:[e.jsxs("button",{className:"m-cta",onClick:t,children:[MIcons.play(15)," You're right, start the session"]}),e.jsx("button",{className:"m-cta-line",onClick:()=>r(!0),children:"It's on purpose, here's why"})]})]}),e.jsxs("div",{className:"src",children:["where this comes from: ",window.V3SRC.speedbump.path," · fired ",d.fired]})]})}):null}Object.assign(window,{ReplayLens:ac,ThreadLens:rc,FrictionLens:ic,SpeedBump:lc});const Ws={gold:"var(--m-gold)",gold2:"var(--m-gold-2)",warn:"var(--m-warn)",ink:"rgba(235,210,165,0.45)",ink2:"rgba(235,210,165,0.2)"};function Bs(n){return Ws[window.V4E.catTone[n]]||Ws.ink2}function vr({days:n,sel:t,setSel:s}){const a=n[t];return e.jsxs("section",{className:"m4e-ruler m-rise",style:{"--i":0},"data-screen-label":"Evidence, Time Scrubber","data-coach":"scrubber",children:[e.jsxs("div",{className:"m4e-ruler-head",children:[e.jsxs("span",{className:"sel m-serif",children:[a.d,a.live?" · today":""]}),a.live?e.jsxs("span",{className:"m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"live"]}):null,e.jsx("span",{className:"note",children:a.note}),e.jsx(Hint,{what:"The slice of time you're looking at. Pick a day and the whole page answers for it: receipts, charts, results.",doing:"The arrows move one day at a time.",src:"Metrics_Log.md + Daily/ · per-day index"}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{className:"m-mini",onClick:()=>s(Math.max(0,t-1)),disabled:t===0,"aria-label":"Previous day",style:{opacity:t===0?.4:1},children:MIcons.arrowL(13)}),e.jsx("button",{className:"m-mini",onClick:()=>s(Math.min(n.length-1,t+1)),disabled:t===n.length-1,"aria-label":"Next day",style:{opacity:t===n.length-1?.4:1},children:MIcons.arrow(13)})]})]}),e.jsx("div",{className:"m4e-days",style:{gridTemplateColumns:"repeat("+n.length+", 1fr)"},children:n.map((r,i)=>e.jsxs("button",{className:"m4e-day"+(i===t?" is-on":""),onClick:()=>s(i),title:r.d+" · "+r.total+" receipts",children:[e.jsx("span",{className:"bar","aria-hidden":"true",children:Object.entries(r.c).map(([l,o])=>e.jsx("i",{className:l==="Publish"?"pub":l==="Override"||l==="Refusal"?"warn":"",style:{height:Math.max(3,o*6)+"px"}},l))}),e.jsx("span",{className:"pubdot"+(r.pub>=1?" on":""),"aria-hidden":"true"}),e.jsx("span",{className:"dl",children:r.d.split(" ")[1]})]},r.d))})]})}function oc({days:n,sel:t,setSel:s}){return e.jsxs("div",{className:"m4e-mini",children:[e.jsx("div",{className:"bars",style:{gridTemplateColumns:"repeat("+n.length+", 1fr)"},children:n.map((a,r)=>e.jsx("button",{className:"col",style:{opacity:r===t?1:.55},onClick:()=>s(r),title:a.d,children:Object.entries(a.c).map(([i,l])=>e.jsx("i",{style:{height:l*7+"px",background:Bs(i)}},i))},a.d))}),e.jsx("div",{className:"m4e-legend",children:["Publish","Run","Override","Insight","Faith","Decision","Refusal","Artifact","Person","Vitality"].map(a=>e.jsxs("span",{className:"li",children:[e.jsx("span",{className:"sw",style:{background:Bs(a)}}),a]},a))})]})}function wr({E:n,sel:t,setSel:s,sparse:a,onLens:r,onNav:i}){const l=n.days[t],o=a?null:n.strongest,c={contradiction:"var(--m-warn)",pattern:"var(--m-gold)",moved:"var(--m-gold-2)",needs:"rgba(235,210,165,0.35)"};return e.jsxs("section",{className:"m4e-row m-rise",style:{borderTop:"none",paddingTop:0,"--i":1},"data-screen-label":"Evidence, Receipts Intelligence","data-coach":"proof",children:[e.jsxs("div",{className:"m4e-row-head",children:[e.jsx("span",{className:"m-kicker",children:"What your receipts show"}),e.jsx(Hint,{what:"Not just a list: the chosen day's proof on the left, and what your whole record adds up to on the right.",doing:"Every receipt shows what it changed. Every finding opens to where it came from.",src:"Metrics_Log.md · receipt-logger + nightly review"}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Receipts",l.total+" receipts on "+l.d,"sessions"),children:"receipt-logger · live"})})]}),e.jsxs("div",{className:"m4e-proof",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"m4e-sub",style:{marginBottom:8},children:["What you did on ",e.jsx("b",{style:{color:"var(--m-ink-1)",fontWeight:500},children:l.d})," · ",e.jsx("span",{className:"m-num",children:l.total})," receipts"]}),l.receipts.map(d=>e.jsxs("div",{className:"m4e-rec",children:[e.jsx("span",{className:"tm m-num",children:d.time}),e.jsx("span",{className:"m4e-cat"+(d.cat==="Publish"?" is-gold":d.cat==="Override"||d.cat==="Refusal"?" is-warn":""),children:d.cat}),e.jsxs("span",{className:"t",children:[e.jsx(X,{claim:"Receipt, "+d.t,value:l.d+" · moved "+d.moved,src:"sessions",children:d.t}),e.jsxs("span",{className:"mv",style:{display:"block",marginTop:2},children:["changed → ",e.jsx("b",{children:d.moved})]})]}),d.live?e.jsxs("span",{className:"m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"live"]}):null]},d.t)),a?e.jsx("div",{style:{marginTop:14},children:e.jsx(Empty,{title:"Three receipts. That's the whole record.",line:"Honest is better than full. Each block, publish and decision adds a line; synthesis starts around day 10."})}):null]}),e.jsxs("div",{children:[o?e.jsxs("div",{className:"m4e-strong",children:[e.jsx("div",{className:"m-kicker",style:{fontSize:9.5,marginBottom:8},children:"The biggest thing right now"}),e.jsx("p",{className:"line",children:e.jsx(X,{claim:"The biggest thing right now",value:o.sub,src:o.src,children:o.line})}),e.jsx("p",{className:"sub",children:o.sub})]}):e.jsxs("div",{className:"m4e-strong",children:[e.jsx("div",{className:"m-kicker",style:{fontSize:9.5,marginBottom:8},children:"The biggest thing right now"}),e.jsx("p",{className:"sub",style:{marginTop:0},children:window.V4ESPARSE.strongestEmpty})]}),a?null:n.insights.map(d=>e.jsxs("div",{className:"m4e-ins",children:[e.jsx("span",{className:"kdot",style:{background:c[d.kind]},"aria-hidden":"true"}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{className:"l",children:e.jsx(X,{claim:"Insight, "+d.kind,value:d.sub,src:d.src,children:d.line})}),e.jsx("span",{className:"s",style:{display:"block"},children:d.sub}),e.jsxs("button",{className:"m-link is-gold act",onClick:()=>r(d.lens),children:[d.act," ",MIcons.arrow(12)]})]})]},d.line)),a?null:e.jsx(oc,{days:n.days,sel:t,setSel:s})]})]})]})}function jr({E:n,sparse:t}){if(t)return e.jsx(ERow,{kicker:"Who was right",srcKey:"scoreboard",hint:"Times you and the system disagreed, scored later by what they cost.",hintSrc:"Override_Log.md · override-outcome-parser",children:e.jsx(Empty,{title:"Nothing scored yet.",line:window.V4ESPARSE.scoreboardEmpty})});const s=n.scoreboard;if(s.scored===0&&(!s.calls||s.calls.length===0))return e.jsx(ERow,{kicker:"Who was right",srcKey:"scoreboard",hint:"Times you and the system disagreed, scored later by what they cost.",hintSrc:"Override_Log.md · override-outcome-parser",children:e.jsx(Empty,{title:"Nothing scored yet.",line:window.V4ESPARSE.scoreboardEmpty})});const a=s.sys>s.you?"The no has been right more often than you. Not always.":s.you>s.sys?"You have been right more often than the no. Not always.":"It's even so far. Each call is scored by what it cost.";return e.jsx(ERow,{kicker:"Who was right",srcKey:"scoreboard",label:"Evidence, Who was right",hint:"Every time you and the system disagreed, scored later by what the choice actually cost over the next week.",hintDo:"It cuts both ways: when the system is wrong, that's on the record too.",hintSrc:"Override_Log.md ## Scored calls · override-outcome-parser",sub:s.rule+" "+s.scored+" calls scored this quarter, "+s.pending+" still waiting on outcomes.",children:e.jsxs("div",{className:"m4e-score",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m4e-tally",children:[e.jsxs("span",{className:"side is-sys",children:[e.jsx("span",{className:"num m-num",children:s.sys}),e.jsx("span",{className:"who",style:{display:"block"},children:"the system"})]}),e.jsx("span",{className:"vs m-serif",children:"to"}),e.jsxs("span",{className:"side",children:[e.jsx("span",{className:"num m-num",children:s.you}),e.jsx("span",{className:"who",style:{display:"block"},children:"you"})]})]}),e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:16,color:"var(--m-ink-2)",marginTop:16,maxWidth:"24ch",lineHeight:1.4},children:a})]}),e.jsx("div",{children:s.calls.map(r=>e.jsxs("div",{className:"m4e-call",children:[e.jsx("span",{className:"d",children:r.d}),e.jsx("span",{className:"c",children:e.jsx(X,{claim:"Scored call, "+r.d,value:r.line,src:"scoreboard",children:r.call})}),e.jsx("span",{className:"m4e-won "+(r.won==="system"?"m-good":"m-warn"),children:r.won==="system"?"system was right":"you were right"}),e.jsx("span",{className:"o",children:r.line})]},r.d+r.call))})]})})}const Ft=[{id:"proof",k:"Receipts",grp:"Proof"},{id:"pace",k:"On pace?",grp:"Pace"},{id:"cadence",k:"How often you publish",grp:"Pace"},{id:"sessions",k:"Work sessions",grp:"Work"},{id:"patterns",k:"Patterns",grp:"Work"},{id:"said",k:"Said vs did",grp:"Integrity"},{id:"domains",k:"Your areas",grp:"Integrity"},{id:"account",k:"Nightly close",grp:"Integrity"},{id:"replay",k:"Strategy history",grp:"Integrity"},{id:"thread",k:"On track?",grp:"Integrity"},{id:"friction",k:"Nudges",grp:"Integrity"}];function cc({D:n,onNav:t,rollout:s}){const a=useSimLoad("evidence"),r=n.__sparse,i=r?Object.assign({},window.V4E,{days:window.V4ESPARSE.days}):window.V4E,[l,o]=useStored3("m4.evlens","proof"),[c,d]=React.useState(i.days.length-1);React.useEffect(()=>{d(i.days.length-1)},[r]);const u=Ft.some(p=>p.id===l)?l:"proof";if(React.useEffect(()=>{const p=m=>{const g=String(m.detail||"");g.includes('"replay"')?o("replay"):g.includes('"speedbump"')?o("friction"):(g.includes('"scrubber"')||g.includes('"proof"'))&&o("proof")};return window.addEventListener("m4-coach-seek",p),()=>window.removeEventListener("m4-coach-seek",p)},[]),a)return e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:120,borderRadius:"var(--m-r)"}}),e.jsx("div",{className:"m4-skel",style:{height:340}}),e.jsx("div",{className:"m4-skel",style:{height:240}})]});const h={proof:i.days[c].total,pace:null,cadence:null,sessions:i.sessions.length,patterns:i.ladder.length,said:i.saidDone.length,domains:3};return e.jsxs("div",{className:"m-wrap",children:[(s||"full")==="full"?e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,marginBottom:18,flexWrap:"wrap"},children:[e.jsx(SaidVsDone,{}),e.jsx("div",{style:{flex:"0 0 auto"},children:e.jsx(RewindPill,{})})]}):null,e.jsx(vr,{days:i.days,sel:c,setSel:d}),e.jsxs("div",{className:"m4e-room",children:[e.jsx("nav",{className:"m4e-lenses","aria-label":"Evidence lenses",children:["Proof","Pace","Work","Integrity"].map(p=>e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"m4e-lensgrp",children:p}),Ft.filter(m=>m.grp===p).map(m=>e.jsxs("button",{className:"m4e-lens"+(u===m.id?" is-on":""),onClick:()=>o(m.id),children:[m.k,!r&&h[m.id]?e.jsx("span",{className:"n m-num",children:h[m.id]}):null]},m.id))]},p))}),e.jsxs("div",{className:"m4e-main",children:[u==="proof"?e.jsxs(React.Fragment,{children:[e.jsx(wr,{E:i,sel:c,setSel:d,sparse:r,onLens:o,onNav:t}),e.jsx(jr,{E:i,sparse:r})]}):null,u==="pace"?e.jsx(PaceChart,{E:i,sel:c,sparse:r}):null,u==="cadence"?e.jsx(CadenceLens,{E:i,sparse:r}):null,u==="sessions"?e.jsx(SessionsLens,{E:i,sel:c,sparse:r}):null,u==="patterns"?e.jsx(PatternsLens,{E:i,sparse:r}):null,u==="said"?e.jsx(SaidDoneLens,{E:i,sparse:r}):null,u==="domains"?e.jsx(DomainsLens,{E:i,sparse:r}):null,u==="account"?e.jsx(AccountLens,{sparse:r}):null,u==="replay"?e.jsx(ReplayLens,{sparse:r}):null,u==="thread"?e.jsx(ThreadLens,{sparse:r}):null,u==="friction"?e.jsx(FrictionLens,{sparse:r}):null,e.jsx(CoverageStrip,{E:window.V4E})]})]})]})}Object.assign(window,{EvidenceView:cc,TimeRuler:vr,ReceiptsIntel:wr,Scoreboard:jr,M4E_LENSES:Ft});function _t(n){return n>=60?Math.floor(n/60)+"m "+String(n%60).padStart(2,"0")+"s":n+"s"}function kr({phase:n}){const t={plan:{k:"the plan",cls:"is-mute"},run:{k:"working",cls:""},approve:{k:"needs you",cls:"is-warn"},question:{k:"waiting for you",cls:"is-warn"},done:{k:"done",cls:"is-good"},stopped:{k:"stopped",cls:"is-warn"}},s=t[n]||t.run;return e.jsxs("span",{className:"m-chip "+s.cls,children:[n==="run"?e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}):null,s.k]})}function rs({files:n}){return e.jsx("span",{className:"v5r-files",children:n.map(t=>e.jsx("span",{className:"f",children:t},t))})}function An({r:n,stopped:t,onAgain:s,onNav:a,doneSteps:r}){return e.jsxs("div",{className:"v5r-receipt"+(t?" is-stopped":""),children:[e.jsxs("div",{className:"head",children:[e.jsx("span",{className:"m-dot "+(t?"is-warn":"is-good")}),e.jsx("span",{className:"t",children:t?"Stopped early, here's what got done.":"Done in "+n.dur+"."})]}),e.jsx("p",{className:"line",children:t?r&&r.length?"It finished: "+r.map(i=>i.live.toLowerCase()).join(", ")+".":"It stopped before finishing anything.":n.line}),t?null:e.jsxs("div",{className:"kv",children:[e.jsx("span",{className:"k",children:"Files changed"}),e.jsx(rs,{files:n.files})]}),e.jsxs("p",{className:"auto",children:[MIcons.check(12)," Saved to your record automatically, you didn't have to log anything."]}),e.jsxs("div",{className:"acts",children:[s?e.jsxs("button",{className:"m-cta-line",style:{padding:"9px 15px",fontSize:12.5},onClick:s,children:[MIcons.loop(13)," Do this again"]}):null,e.jsxs("button",{className:"m-link",onClick:()=>a&&a("evidence"),children:["See it in Evidence ",MIcons.arrow(13)]})]})]})}function dc({job:n,agentName:t,mirrored:s,onNav:a,onClose:r,autoStart:i}){const l=n.trace||[],[o,c]=React.useState(i?"run":"plan"),[d,u]=React.useState(0),[h,p]=React.useState(0),[m,g]=React.useState(0),[f,v]=React.useState("steps"),x="v5rs"+React.useId().replace(/:/g,""),[b,j]=React.useState({}),[A,I]=React.useState({}),[k,S]=React.useState(!1),[E,L]=React.useState(""),[w,N]=React.useState(!1),[C,P]=React.useState(""),[M,T]=React.useState([]),[F,D]=React.useState([]),[Y,z]=React.useState(""),[y,V]=React.useState([{who:"agent",line:"Here's my plan, "+(n.plan||[]).length+" steps. I won't start until you say so."}]),H=(q,G)=>V(re=>[...re,{who:q,line:G}]),R=l[d],Q=o==="run"&&R&&R.approval&&!b[d]&&!A[d];React.useEffect(()=>{if(!Q)return;if(!s){c("approve");return}const q=setTimeout(()=>{j(G=>({...G,[d]:!0})),H("agent","You said yes in your terminal, continuing.")},3e3);return()=>clearTimeout(q)},[Q,d,s]),React.useEffect(()=>{if(o!=="run"||Q)return;const q=setInterval(()=>{g(G=>G+1),p(G=>G+1)},1e3);return()=>clearInterval(q)},[o,Q]),React.useEffect(()=>{if(o==="run"){if(!R){c("done");return}if(!(h<R.secs)){if(k){c("stopped"),H("agent","Stopped, like you asked. Everything so far is saved.");return}if(d+1>=l.length){c("done"),H("agent","Done. "+n.receipt.line);return}u(d+1),p(0)}}},[h,o]);const je=()=>{c("run"),H("you","Start.")},se=()=>{c("plan"),u(0),p(0),g(0),j({}),I({}),S(!1),v("steps"),H("agent","Same plan, fresh run. Say the word.")},ke=()=>{j(q=>({...q,[d]:!0})),c("run"),H("you","Allow once.")},O=()=>{I(q=>({...q,[d]:!0})),H("you","No, skip that."),H("agent","Skipped. Moving on."),d+1>=l.length?c("done"):(u(d+1),p(0),c("run"))},W=()=>{if(o==="approve"){c("stopped"),H("you","Stop.");return}S(!0),H("you","Stop."),H("agent","I'll stop after the current step, it can't be cut mid-way.")},U=()=>{E.trim()&&(H("you",E.trim()),H("agent","Got it, I'll fold that in after the current step."),L(""))},K=()=>{C.trim()&&(T(q=>[...q,"Also: "+C.trim()]),H("you",C.trim()),H("agent","Added to the plan."),P(""),N(!1))},xe=(()=>{const G=["$ "+(t==="Codex"?"codex":t==="Gemini"?"agy":"claude")+" “"+n.ask+"”"];return o==="plan"?(G.push("○ plan ready · "+(n.plan||[]).length+" steps · waiting for go"),G.concat(F)):(l.forEach((re,fe)=>{if(!(fe>d&&o!=="done"&&o!=="stopped")){if(re.approval&&(fe<d||b[fe]||A[fe])&&G.push("? "+re.approval.line+" [y/n] "+(A[fe]?"n":"y")),A[fe]){G.push("– skipped: "+re.live.toLowerCase());return}fe<d||o==="done"?G.push("● "+re.live+(re.detail?" · "+re.detail:"")):fe===d&&(o==="run"||o==="approve")&&G.push("● "+re.live+"… "+h+"s")}}),o==="done"&&G.push("✓ receipt → Metrics_Log.md","done · "+n.receipt.dur),o==="stopped"&&G.push("✕ stopped by you · partial receipt written"),G.concat(F))})(),we=l.filter((q,G)=>G<d&&!A[G]).concat(o==="done"?[]:[]);return e.jsxs("article",{className:"v5r-session"+(o==="approve"?" is-attn":""),"data-screen-label":"Run, session: "+n.t,children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," ",t||"Claude Code"]}),e.jsx("h3",{className:"t",children:n.t}),e.jsx("span",{className:"v5r-extag",children:"Example, not a live run"}),s?e.jsx("span",{className:"m-chip is-mute",children:"from your terminal"}):null,e.jsx(kr,{phase:o})]}),e.jsx("div",{className:"v5r-tabs",role:"tablist","aria-label":"Session view",children:[["steps","Steps"],["chat","Chat"],["raw","Raw"]].map(([q,G])=>e.jsxs("button",{role:"tab",id:x+"-tab-"+q,"aria-controls":x+"-panel","aria-selected":f===q,className:f===q?"is-on":"",onClick:()=>v(q),children:[G,q==="raw"?e.jsx("span",{className:"adv",children:"advanced"}):null]},q))}),e.jsxs("div",{role:"tabpanel",id:x+"-panel","aria-labelledby":x+"-tab-"+f,children:[f==="steps"?e.jsx("div",{children:o==="plan"?e.jsxs("div",{className:"v5r-plan",children:[e.jsx("p",{className:"lead",children:"Before it does anything, here's the plan:"}),e.jsx("ol",{children:(n.plan||[]).concat(M).map((q,G)=>e.jsx("li",{children:q},G))}),s?e.jsxs("p",{className:"v5r-note",children:[MIcons.term(12)," It'll run in your terminal. This view follows along; you steer and approve there."]}):null,e.jsxs("div",{className:"acts",children:[e.jsxs("button",{className:"m-cta",onClick:je,children:[MIcons.play(14)," ",s?"Start in my terminal & watch":"Start"]}),e.jsx("button",{className:"m-cta-line",onClick:()=>N(!w),children:"Adjust"}),e.jsx("button",{className:"m-mini",onClick:r,children:"Cancel"})]}),w?e.jsxs("div",{className:"v5r-steer",style:{marginTop:10},children:[e.jsx("input",{value:C,onChange:q=>P(q.target.value),placeholder:"What should change about the plan?",onKeyDown:q=>{q.key==="Enter"&&K()},autoFocus:!0}),e.jsx("button",{className:"m-mini",onClick:K,children:"Add"})]}):null]}):e.jsxs("div",{children:[o==="run"||o==="approve"?e.jsxs("div",{className:"v5r-now",children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsx("span",{className:"big",children:Q||o==="approve"?"Waiting for your okay":R?R.live:"Finishing up"}),e.jsx("span",{className:"secs m-num",children:o==="run"&&!Q?"still working · "+h+"s · "+_t(m)+" total":_t(m)+" so far"})]}):null,e.jsx("div",{className:"v5r-steps",children:l.map((q,G)=>{const re=G<d||o==="done",fe=G===d&&(o==="run"||o==="approve");return e.jsxs("div",{className:"v5r-step"+(re?" is-done":fe?" is-cur":" is-todo")+(A[G]?" is-skip":""),children:[e.jsx("span",{className:"mk",children:A[G]?MIcons.x(11):re?MIcons.check(12):fe?e.jsx("span",{className:"m-dot is-live",style:{width:7,height:7}}):e.jsx("span",{className:"hollow"})}),e.jsxs("span",{className:"l",children:[q.live,A[G]?", skipped, you said no":""]}),re&&!A[G]&&q.detail?e.jsx("span",{className:"d",children:q.detail}):null]},G)})}),o==="approve"&&R&&R.approval?e.jsxs("div",{className:"v5r-approve",role:"alert",children:[e.jsxs("div",{className:"q",children:[e.jsx("b",{children:R.approval.line}),e.jsx(rs,{files:R.approval.files})]}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:ke,children:"Allow once"}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12.5},onClick:O,children:"Deny"}),e.jsx("button",{className:"m-mini",onClick:()=>v("raw"),children:"Open in terminal"})]})]}):null,o==="run"||o==="approve"?s?e.jsxs("p",{className:"v5r-note",children:[MIcons.term(12)," Steering and stopping happen in your terminal, this view follows along."]}):e.jsxs("div",{className:"v5r-steer",children:[e.jsx("input",{value:E,onChange:q=>L(q.target.value),placeholder:"Add an instruction, it folds it in as it works",onKeyDown:q=>{q.key==="Enter"&&U()}}),e.jsx("button",{className:"m-mini",onClick:U,children:"Send"}),e.jsx("button",{className:"m-mini stop",onClick:W,children:k?"Stopping after this step…":"Stop"})]}):null,o==="done"?e.jsx(An,{r:n.receipt,onAgain:se,onNav:a}):null,o==="stopped"?e.jsx(An,{r:n.receipt,stopped:!0,doneSteps:we,onAgain:se,onNav:a}):null]})}):null,f==="chat"?e.jsxs("div",{className:"v5r-chat",children:[y.map((q,G)=>e.jsxs("div",{className:"msg"+(q.who==="you"?" is-you":""),children:[e.jsx("span",{className:"who",children:q.who==="you"?"You":t||"Claude Code"}),e.jsx("span",{className:"l",children:q.line})]},G)),e.jsxs("div",{className:"v5r-steer",style:{marginTop:12},children:[e.jsx("input",{value:E,onChange:q=>L(q.target.value),placeholder:"Say something, instructions land mid-task",onKeyDown:q=>{q.key==="Enter"&&U()},disabled:s}),e.jsx("button",{className:"m-mini",onClick:U,disabled:s,children:"Send"})]}),s?e.jsx("p",{className:"v5r-note",children:"This conversation lives in your terminal, read-only here."}):null]}):null,f==="raw"?e.jsxs("div",{className:"v5r-raw",children:[xe.map((q,G)=>e.jsx("div",{className:"ln",children:q},G)),e.jsxs("div",{className:"in",children:[e.jsx("span",{className:"ps",children:"$"}),e.jsx("input",{value:Y,onChange:q=>z(q.target.value),placeholder:"type here, this is the raw session",onKeyDown:q=>{q.key==="Enter"&&Y.trim()&&(D(G=>[...G,"$ "+Y.trim(),"(example session, input recorded, not executed)"]),z(""))}})]})]}):null]})]})}function uc({job:n,agentName:t,onNav:s,onClose:a}){const r=n.trace||[],[i,l]=React.useState("question"),[o,c]=React.useState(""),[d,u]=React.useState(null),[h,p]=React.useState(0),[m,g]=React.useState(0);React.useEffect(()=>{if(i!=="run")return;const v=setInterval(()=>g(x=>x+1),900);return()=>clearInterval(v)},[i]),React.useEffect(()=>{if(i!=="run")return;const v=r[h];if(!v){l("done");return}if(!(m<v.secs)){if(h+1>=r.length){l("done");return}p(h+1),g(0)}},[m,i]);const f=()=>{o.trim()&&(u(o.trim()),c(""),l("run"))};return e.jsxs("article",{className:"v5r-session"+(i==="question"?" is-attn":""),"data-screen-label":"Run, conversation: "+n.t,children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.chat(15)," ",t||"Claude Code"]}),e.jsx("h3",{className:"t",children:n.t}),e.jsx("span",{className:"v5r-extag",children:"Example, not a live run"}),e.jsx(kr,{phase:i})]}),e.jsxs("p",{className:"v5r-note",style:{marginTop:2},children:["This one talks to you. It waits for your answer, it never runs off silently. ",e.jsxs("span",{className:"m-mono",style:{fontSize:10.5},children:["runs ",n.runs]})]}),i==="question"?e.jsxs("div",{className:"v5r-q",children:[e.jsx("p",{className:"q m-serif",children:n.question}),e.jsxs("div",{className:"v5r-steer",style:{marginTop:10},children:[e.jsx("input",{value:o,onChange:v=>c(v.target.value),placeholder:"Answer in a sentence — or just say “nothing”",onKeyDown:v=>{v.key==="Enter"&&f()}}),e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:f,children:"Answer"}),e.jsx("button",{className:"m-mini",onClick:a,children:"Not now"})]})]}):e.jsxs("div",{children:[d?e.jsxs("div",{className:"v5r-chat",style:{marginBottom:10},children:[e.jsxs("div",{className:"msg",children:[e.jsx("span",{className:"who",children:t||"Claude Code"}),e.jsx("span",{className:"l",children:n.question})]}),e.jsxs("div",{className:"msg is-you",children:[e.jsx("span",{className:"who",children:"You"}),e.jsx("span",{className:"l",children:d})]})]}):null,e.jsx("div",{className:"v5r-steps",children:r.map((v,x)=>{const b=x<h||i==="done",j=x===h&&i==="run";return e.jsxs("div",{className:"v5r-step"+(b?" is-done":j?" is-cur":" is-todo"),children:[e.jsx("span",{className:"mk",children:b?MIcons.check(12):j?e.jsx("span",{className:"m-dot is-live",style:{width:7,height:7}}):e.jsx("span",{className:"hollow"})}),e.jsx("span",{className:"l",children:v.live}),b&&v.detail?e.jsx("span",{className:"d",children:v.detail}):null]},x)})}),i==="done"?e.jsx(An,{r:n.receipt,onAgain:()=>{l("question"),p(0),g(0),u(null)},onNav:s}):null]})]})}function hc({s:n,onNav:t}){const[s,a]=React.useState(!1);return e.jsxs("article",{className:"v5r-session is-quiet","data-screen-label":"Run, watched terminal session",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.term(15)," ",n.agent]}),e.jsx("h3",{className:"t",children:n.t}),e.jsx("span",{className:"v5r-extag",children:"Example, not a live run"}),e.jsx("span",{className:"m-chip is-mute",children:"from your terminal"}),e.jsx("span",{className:"m-chip is-good",children:"done"})]}),e.jsx("p",{className:"v5r-note",style:{marginTop:2},children:n.note}),e.jsx("button",{className:"m-link",style:{marginTop:8},onClick:()=>a(!s),children:s?"Hide the steps":"Show the steps ("+n.steps.length+")"}),s?e.jsx("div",{className:"v5r-steps",style:{marginTop:6},children:n.steps.map((r,i)=>e.jsxs("div",{className:"v5r-step is-done",children:[e.jsx("span",{className:"mk",children:MIcons.check(12)}),e.jsx("span",{className:"l",children:r.live}),e.jsx("span",{className:"d",children:r.detail})]},i))}):null,e.jsx(An,{r:n.receipt,onAgain:null,onNav:t})]})}Object.assign(window,{SessionCard:dc,ConversationCard:uc,WatchedCard:hc,V5Receipt:An,V5Files:rs,v5fmt:_t});function mc({total:n,at:t}){const s=t+1,a=s>n;return e.jsxs("div",{className:"v5o-dots","aria-label":"Question "+s,children:[Array.from({length:n}).map((r,i)=>e.jsx("span",{className:"d"+(a||i<t?" is-done":i===t?" is-cur":"")},i)),e.jsx("span",{className:"k m-num",children:a?"question "+s:s+" of "+n+"+"})]})}function is({items:n}){return n.length?e.jsxs("div",{style:{marginTop:18},children:[e.jsx("span",{style:{display:"block",marginBottom:4,fontSize:11,color:"var(--m-ink-3)",fontFamily:"var(--m-mono)"},children:"Your record, built from your answers"}),e.jsx("div",{className:"v5r-steps",children:n.map((t,s)=>e.jsxs("div",{style:{"--i":s},className:"v5r-step "+(t.state==="saving"?"is-cur":t.state==="skip"?"is-done is-skip":"is-done"),children:[e.jsx("span",{className:"mk",children:t.state==="saving"?e.jsx("span",{className:"m-dot is-live",style:{width:7,height:7}}):t.state==="skip"?MIcons.x(11):MIcons.check(12)}),e.jsx("span",{className:"l",children:t.label}),e.jsx("span",{className:"d",children:t.file})]},s))})]}):null}function pc({beats:n,ready:t,onComplete:s}){const a=n&&n.length?n:[{key:"_read",label:"Reading your answers",file:null}],[r,i]=React.useState(0),l=React.useRef(!1);return React.useEffect(()=>{if(r>=a.length)return;const o=setTimeout(()=>i(c=>c+1),r===0?480:300);return()=>clearTimeout(o)},[r,a.length]),React.useEffect(()=>{if(l.current||r<a.length||!t)return;const o=setTimeout(()=>{l.current=!0,s&&s()},440);return()=>clearTimeout(o)},[r,a.length,t,s]),e.jsx("div",{className:"v5o-forge",role:"status","aria-label":"Composing your record",children:a.map((o,c)=>{const d=c<r?"is-done":c===r?"is-active":"is-pending";return e.jsxs("div",{className:"beat "+d,style:{"--i":c},children:[e.jsx("span",{className:"mk",children:c<r?e.jsx("span",{className:"check",children:MIcons.check(13)}):e.jsx("span",{className:"dot","aria-hidden":"true"})}),e.jsx("span",{className:"lab",children:o.label})]},o.key)})})}const We=(()=>{try{return new URLSearchParams(window.location.search).get("obx")}catch{return null}})(),fc={diagnosis:"You're running a marketing agency, team on Slack, docs in Drive. Mover OS is sharpest once it can see your real work, here's what to feed it first so day one isn't a blank slate.",groups:[{key:"work",label:"Work",sources:[{id:"notes-docs",label:"Upload your key docs & notes",why:"the docs and trackers you already have, so Mover reads them instead of asking.",action:"upload",status:"ready"},{id:"clients-leads",label:"Upload your leads / client list",why:"your pipeline, so Mover tracks who's waiting on what.",action:"upload",status:"ready"},{id:"slack",label:"Connect Slack",why:"your team's back-and-forth, so Mover sees what's in flight.",action:"connect",status:"planned"},{id:"gdrive",label:"Connect Google Drive",why:"your working docs in one place, instead of scattered.",action:"connect",status:"planned"}]},{key:"vitality",label:"Vitality",sources:[{id:"health-export",label:"Upload a health export",why:"your sleep and training data, so the battery is real, not guessed.",action:"upload",status:"ready"}]}]},Hs="[[SETUP_COMPLETE]]",gc=8;async function Ie(n,t,s){return(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":s},body:JSON.stringify(t)})).json()}function xc(n){const t=String(n||""),s=Array.from(t.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi));for(let a=s.length-1;a>=0;a--)try{const r=JSON.parse(s[a][1].trim());if(r&&typeof r=="object"&&r._kind==="mover-profile")return r}catch{}return null}function yc(n){try{const t=typeof n=="string"?JSON.parse(n):n||{},s=t.tool||t.name||t.tool_name||t.input&&t.input.tool||"",a=t.path||t.input&&(t.input.path||t.input.file_path)||"",r=a?` (${String(a).split("/").pop()})`:"";if(/write|edit|create/i.test(s))return`The assistant wants to write a file${r} to set up your record.`;if(/read/i.test(s))return`The assistant wants to read a file${r} on your machine.`;if(/bash|exec|command|shell|run/i.test(s))return"The assistant wants to run a setup command on your machine.";if(s)return`The assistant is requesting permission to use ${s}.`}catch{}return"The assistant is requesting permission to continue setting up."}function vc({onImport:n,onSkip:t}){const[s,a]=React.useState([]),[r,i]=React.useState(!1),[l,o]=React.useState(!1),c=React.useRef(null),d=h=>a(Array.from(h||[])),u=async()=>{if(!s.length||r)return;i(!0);const h=[];for(const p of s)try{h.push({name:p.name,content:await p.text()})}catch{}n(h)};return e.jsxs("div",{className:"v5o-import-step",style:{marginTop:18},children:[e.jsxs("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:["Bring your existing notes? ",e.jsx("span",{style:{color:"var(--m-ink-3)",fontWeight:400},children:"(optional)"})]}),e.jsx("p",{style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 12px"},children:"Drop exports from Apple Notes, Obsidian, Google Keep, or plain text. Used only to skip questions the system can already answer, files stay on your machine."}),e.jsxs("details",{className:"v5o-expguides",style:{margin:"0 0 12px"},children:[e.jsx("summary",{style:{fontSize:12,color:"var(--m-ink-3)",cursor:"pointer"},children:"How do I export my notes?"}),e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.6,padding:"8px 0 2px 2px"},children:[e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Apple Notes:"})," select notes, File, Export as PDF works but plain text is better: select a note's text, copy, paste into a .txt file. For many notes, the free Exporter app on the Mac App Store writes them all as markdown."]}),e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Google Keep:"})," takeout.google.com, deselect all, tick Keep, export. Unzip the download and drop the Takeout/Keep folder's files here."]}),e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Notion:"})," Settings, Export all workspace content, Markdown & CSV. Unzip and drop the .md files."]}),e.jsxs("p",{style:{margin:"0 0 6px"},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Obsidian:"})," your vault already is the files. Drop any .md straight from the vault folder."]}),e.jsxs("p",{style:{margin:0},children:[e.jsx("b",{style:{color:"var(--m-ink-2)",fontWeight:500},children:"Anything else:"})," any .txt or .md works. A messy dump is fine, the system reads for context, not tidiness."]})]})]}),e.jsx("div",{className:"v5o-drop"+(l?" is-over":"")+(s.length?" is-ready":""),style:{border:"1.5px dashed var(--m-line-2)",borderRadius:10,padding:"20px 16px",textAlign:"center",fontSize:13,color:"var(--m-ink-3)",cursor:"pointer",transition:"border-color .15s, color .15s, background .15s",...l?{borderColor:"var(--m-gold-line)",color:"var(--m-ink-2)",background:"rgba(227,196,137,0.04)"}:{}},onClick:()=>c.current&&c.current.click(),onDragOver:h=>{h.preventDefault(),o(!0)},onDragLeave:()=>o(!1),onDrop:h=>{h.preventDefault(),o(!1),d(h.dataTransfer.files)},role:"button",tabIndex:0,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),c.current&&c.current.click())},"aria-label":"Drop files here or click to choose",children:s.length?e.jsxs("span",{className:"rdy",children:[MIcons.check(12)," ",s.map(h=>h.name).join(", ")]}):"Drop files here, or click to choose"}),e.jsx("input",{ref:c,type:"file",multiple:!0,style:{display:"none"},onChange:h=>d(h.target.files)}),e.jsxs("div",{className:"acts",style:{marginTop:12},children:[e.jsxs("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},disabled:!s.length||r,onClick:u,children:[r?"Reading…":"Import"," ",r?null:MIcons.arrow(12)]}),e.jsx("button",{className:"m-mini",style:{marginLeft:8},disabled:r,onClick:t,children:"Skip"})]})]})}function br({skills:n,connectors:t,installAll:s}){const a=n||[],r=t||[];if(!a.length&&!r.length&&!s)return null;const i=(o,c)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{fontSize:14,color:"var(--m-ink)"},children:o.label||o.skill}),o.reason?e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)"},children:o.reason}):null]},c),l=o=>e.jsx("span",{style:{display:"block",marginBottom:8,fontSize:11,color:"var(--m-ink-3)",fontFamily:"var(--m-mono)"},children:o});return e.jsxs("div",{className:"v5o-rec-card",style:{marginTop:16},children:[l(s?"Recommended: the full core toolkit":"Skills matched to you"),!s&&a.length?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:a.map(i)}):null,!s&&r.length?e.jsxs("div",{style:{marginTop:a.length?14:0},children:[l("Connectors for your work"),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:r.map(i)})]}):null,e.jsxs("span",{style:{display:"block",marginTop:14,fontSize:11.5,color:"var(--m-ink-3)"},children:["Manage your skills any time with ",e.jsx("code",{style:{fontFamily:"var(--m-mono)",color:"var(--m-ink)"},children:"moveros sync"}),"."]})]})}function wc({messages:n,cycleKey:t}){const[s,a]=React.useState(0);React.useEffect(()=>{a(0);const i=setInterval(()=>a(l=>l+1),2200);return()=>clearInterval(i)},[t]);const r=n[s%n.length];return e.jsxs("div",{className:"v5r-now v5o-thinking",style:{paddingBottom:0},children:[e.jsx("span",{className:"m-dot is-live",style:{width:8,height:8},"aria-hidden":"true"}),e.jsx("span",{className:"big t-shimmer v5o-think-line","data-text":r,style:{marginLeft:10},"aria-live":"polite",children:r},r)]})}function Nr(n){return typeof n=="string"?n:n&&n.name||""}function jc({files:n}){const[t,s]=React.useState(null),a=(n||[]).filter(i=>i&&typeof i=="object"&&i.content);if(!a.length)return null;const r=a.find(i=>i.name===t)||null;return e.jsxs("div",{style:{margin:"10px 0 2px"},children:[e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.map(i=>e.jsx("button",{className:"m-mini","aria-expanded":t===i.name,onClick:()=>s(t===i.name?null:i.name),children:t===i.name?`Close ${i.name}.md`:`Read ${i.name}.md`},i.name))}),r?e.jsx("pre",{style:{maxHeight:300,overflow:"auto",whiteSpace:"pre-wrap",fontSize:12,lineHeight:1.55,color:"var(--m-ink-2)",border:"1px solid var(--m-line)",borderRadius:8,padding:"10px 12px",margin:"8px 0 0"},children:r.content}):null]})}function Sr({prophecy:n,finalFiles:t,recSkills:s,recConnectors:a,recInstallAll:r,recConnectPlan:i,recExternal:l,onConfirm:o,onBack:c,confirmBusy:d,backLabel:u}){return e.jsxs("div",{className:"v5o-card-in",style:{marginTop:16},children:[e.jsx("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:"Here's what I'll set up"}),n?e.jsx("p",{className:"m-serif v5o-prophecy",style:{fontSize:18,lineHeight:1.4,color:"var(--m-ink)",margin:"0 0 12px"},children:n}):null,e.jsx("p",{style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 10px"},children:"Your operating record, in your own words. Nothing is written until you say so, and you can change any of it later."}),t&&t.length>0?e.jsxs(React.Fragment,{children:[e.jsx(is,{items:t.map(h=>({label:"Ready",file:Nr(h)+".md",state:"done"}))}),e.jsx(jc,{files:t})]}):e.jsx("p",{className:"v5r-note",children:"I couldn't prepare a file preview just now, but your answers are captured. You can still write your files below, or close and run setup again."}),e.jsx(br,{skills:s,connectors:a,installAll:r}),e.jsx(ls,{plan:i}),e.jsx(Tr,{external:l}),e.jsxs("div",{className:"acts",style:{marginTop:14,display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13},onClick:o,disabled:!!d,children:d?"Writing…":e.jsxs(React.Fragment,{children:["Write my record ",MIcons.arrow(13)]})}),e.jsx("button",{className:"m-mini",onClick:c,disabled:!!d,children:u||"Not yet"})]})]})}function kc({onDone:n,onUseForm:t}){const s=React.useRef(null),a=React.useRef(null),r=React.useRef(null),i=React.useRef(0),l=React.useRef("booting"),o=React.useRef(null),[c,d]=React.useState("booting"),[u,h]=React.useState([]),[p,m]=React.useState(""),[g,f]=React.useState(!0),[v,x]=React.useState(null),[b,j]=React.useState(0),[A,I]=React.useState([]),[k,S]=React.useState(""),[E,L]=React.useState(0),[w,N]=React.useState([]),[C,P]=React.useState([]),[M,T]=React.useState(!1),[F,D]=React.useState(null),[Y,z]=React.useState(null),[y,V]=React.useState([]),[H,R]=React.useState(!1),[Q,je]=React.useState(""),[se,ke]=React.useState(""),O=(ne,he)=>h(Se=>[...Se,{who:ne,line:he}]);React.useEffect(()=>{l.current=c},[c]),React.useEffect(()=>{o.current=v},[v]);const W=React.useCallback((ne={})=>{const he=a.current;if(he){a.current=null;try{fetch("/api/session/end",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":s.current||""},body:JSON.stringify({sessionId:he}),keepalive:!!ne.keepalive}).catch(()=>{})}catch{}}},[]);React.useEffect(()=>()=>{r.current&&r.current.close(),W({keepalive:!0})},[W]),React.useEffect(()=>{(c==="done"||c==="failed")&&W()},[c,W]);const U=React.useCallback(async()=>{d("live"),await Ie("/api/session/send",{sessionId:a.current,text:"Begin the setup interview. Ask your first question."},s.current)},[]),K=React.useCallback(async ne=>{try{await Ie("/api/session/ingest",{sessionId:a.current,files:ne},s.current)}catch{}await U()},[U]),xe=React.useRef(!1),we=React.useCallback(async()=>{if(!xe.current){xe.current=!0,d("writing");try{const ne=await Ie("/api/session/finalize",{sessionId:a.current,dryRun:!1,toVault:!0},s.current);ne&&ne.ok&&ne.written||je("You already have an operating record. Keeping it untouched, opening your dashboard.")}catch{je("Couldn't write just now. You can run setup again any time.")}d("done"),setTimeout(n,2800)}},[n]);React.useEffect(()=>{let ne=!1;return We?(I(["Identity_Prime","Strategy","Goals","Mover_Dossier","Active_Context"]),ke("You're running a marketing agency and a homeschool app. The bet: 100 paying parents by September. Mover OS will keep pointing you back at it."),D(fc),z({connectors:[{id:"slack",label:"Slack",reason:"your team's back-and-forth, so Mover sees what's in flight",install:"claude mcp add slack -- npx -y @modelcontextprotocol/server-slack",attached:!1},{id:"stripe",label:"Stripe",reason:"revenue numbers from Stripe, not from memory",install:"claude mcp add stripe -- npx -y @stripe/mcp",attached:!0}],cliTools:[{id:"gh",label:"GitHub CLI",reason:"PRs and issues from the terminal",install:"brew install gh",installed:!0},{id:"ffmpeg",label:"ffmpeg",reason:"cut and convert video for content work",install:"brew install ffmpeg",installed:!1}]}),N([{label:"obsidian-suite",reason:"your notes already live in Obsidian"},{label:"marketing-skill",reason:"agency and content work"}]),V([{key:"_read",label:"Reading your answers",file:null},{key:"Identity_Prime",label:"Shaping who you are",file:"Identity_Prime.md"},{key:"Strategy",label:"Setting your strategy",file:"Strategy.md"},{key:"Goals",label:"Naming the bet",file:"Goals.md"},{key:"Mover_Dossier",label:"Taking stock of your leverage",file:"Mover_Dossier.md"},{key:"Active_Context",label:"Opening your working memory",file:"Active_Context.md"}]),f(!1),d(We==="writing"?"writing":We==="forge"?"finalizing":We==="agentdone"?"done":"preview"),()=>{ne=!0}):(r.current&&(r.current.close(),r.current=null),(async()=>{try{const he=await(await fetch("/api/health")).json();if(ne)return;s.current=he.token;const Se=await Ie("/api/session/start",{agent:"claude-code",setupDepth:"full"},he.token);if(ne){if(Se&&Se.ok&&Se.sessionId)try{fetch("/api/session/end",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":he.token||""},body:JSON.stringify({sessionId:Se.sessionId}),keepalive:!0}).catch(()=>{})}catch{}return}if(!Se.ok){S("No agent detected, you can set up in the terminal with `claude /setup`"),d("failed"),setTimeout(n,3e3);return}a.current=Se.sessionId;const sn=new EventSource("/api/session/events?id="+encodeURIComponent(Se.sessionId));r.current=sn,sn.onmessage=Je=>{if(ne)return;let me;try{me=JSON.parse(Je.data)}catch{return}if(me.kind==="assistant"){const _=me.text||"";if(_.indexOf(Hs)>=0){if(l.current==="finalizing"||l.current==="done")return;r.current&&(r.current.close(),r.current=null);const $=_.split(Hs),Z=($[0]||"").trim(),ae=($.slice(1).join(" ")||Z||"").trim(),oe=ae.replace(/```[\s\S]*?```/g,"").replace(/\s*[—–]\s*/g,", ").trim();oe&&ke(oe),Z&&O("agent",Z),d("finalizing"),f(!0);const Ae=Ie("/api/session/finalize",{sessionId:Se.sessionId,dryRun:!0,toVault:!0},he.token).then(pe=>{if(pe&&pe.ok&&pe.files){const an=(pe.files||[]).map(be=>({name:(be.path||"").split("/").pop().replace(/\.md$/,""),content:be.content||""})).filter(be=>be.name);I(an)}pe&&Array.isArray(pe.forge)&&pe.forge.length&&V(pe.forge)}).catch(()=>{}),$e=xc(_)||{},Ve=Ie("/api/setup/recommend",{profile:{...$e,work:$e.work||ae.replace(/```[\s\S]*?```/g,"").trim()}},he.token).then(pe=>{pe&&pe.ok&&(pe.installAll?T(!0):N((pe.recommended||[]).slice(0,4)),P((pe.connectors||[]).slice(0,3)),D(pe.connectPlan||null),z(pe.external||null))}).catch(()=>{});Promise.all([Ae,Ve]).finally(()=>{R(!0)});return}O("agent",_.replace(/\s*[—–]\s*/g,", ")),i.current+=1,j(i.current-1),f(!1)}else me.kind==="result"?o.current||f(!1):me.kind==="permission"?(f(!0),x({requestId:me.requestId,request:me.request}),d("permission")):me.kind==="auth_required"?(f(!0),S("Claude is installed on this computer but not signed in yet, so the interview can't start. Open a terminal, run claude, type /login and sign in, then come back and retry. Or answer the same questions as a form instead, no sign-in needed."),d("authRequired")):(me.kind==="closed"||me.kind==="error")&&l.current!=="finalizing"&&l.current!=="done"&&f(!0)},sn.onerror=()=>{},d("import")}catch{if(ne)return;r.current&&(r.current.close(),r.current=null),S("Couldn't reach the Mover OS server. You can set up in the terminal with `claude /setup`"),d("failed"),setTimeout(n,3e3)}})(),()=>{ne=!0})},[E]);const q=async ne=>{const he=(ne!==void 0?ne:p).trim();!he||g||c==="finalizing"||c==="done"||c==="failed"||(O("you",he),m(""),f(!0),await Ie("/api/session/send",{sessionId:a.current,text:he},s.current))},G=async ne=>{const he=v;!he||l.current==="finalizing"||l.current==="done"||(x(null),d("live"),O("you",ne==="allow"?"Allow once.":"Deny."),f(!0),await Ie("/api/session/approve",{sessionId:a.current,requestId:he.requestId,decision:ne},s.current))},re=g&&(c==="live"||c==="booting"),fe=u.length?u[u.length-1].who:null,_e=c==="booting"?"boot":fe==="you"?"answer":"first",tn=_e==="boot"?["Waking your co-founder","Connecting to Claude Code","Loading your context"]:_e==="answer"?["Reading your answer","Thinking it through","Choosing what to ask next"]:["Getting your first question ready","Thinking about where to start","Almost ready"];return e.jsxs("article",{className:"v5r-session is-attn v5o-card-in","data-screen-label":"First open, guided setup",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," Claude Code"]}),e.jsx("h3",{className:"t",children:"Setting up your operating record"}),e.jsx(mc,{total:gc,at:b})]}),c==="import"?e.jsx(vc,{onImport:K,onSkip:U}):null,c!=="import"?e.jsx("div",{className:"v5r-chat",style:{marginTop:14},children:u.slice(-6).map((ne,he)=>e.jsxs("div",{className:"msg"+(ne.who==="you"?" is-you":""),children:[e.jsx("span",{className:"who",children:ne.who==="you"?"You":"Claude Code"}),e.jsx("span",{className:"l",children:ne.line})]},he))}):null,re?e.jsx(wc,{messages:tn,cycleKey:_e}):null,c==="permission"&&v?e.jsxs("div",{className:"v5r-approve",role:"alert",children:[e.jsxs("div",{className:"q",children:[e.jsx("b",{children:"Permission requested"}),e.jsx("span",{className:"d",style:{display:"block",marginTop:4,fontSize:12.5,color:"var(--m-ink-2)"},children:yc(v.request)})]}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:()=>G("allow"),children:"Allow once"}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12.5},onClick:()=>G("deny"),children:"Deny"})]})]}):null,c==="live"&&!g?e.jsxs("div",{className:"v5o-q v5o-q-in",style:{marginTop:12},children:[e.jsx("textarea",{rows:2,value:p,placeholder:"Your answer…","aria-label":"Your answer",autoFocus:!0,onChange:ne=>m(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),q())}}),e.jsxs("div",{className:"acts",children:[e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13},disabled:!p.trim(),onClick:()=>q(),children:["Send ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12},onClick:()=>q("use your best guess"),children:"Use a sensible default"}),e.jsx("button",{className:"m-mini",onClick:()=>q("skip that one"),children:"Skip for now"})]})]}):null,c==="finalizing"?e.jsx(pc,{beats:y,ready:H,onComplete:()=>d("preview")}):null,c==="preview"?e.jsx(Sr,{prophecy:se,finalFiles:A,recSkills:w,recConnectors:C,recInstallAll:M,recConnectPlan:F,recExternal:Y,onConfirm:we,onBack:n}):null,c==="writing"?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsx("span",{className:"big t-shimmer","data-text":"Writing your record, in your words",children:"Writing your record, in your words"})]}):null,c==="done"?e.jsxs(React.Fragment,{children:[!Q&&A.length>0?e.jsx(is,{items:A.map(ne=>({label:"Written",file:Nr(ne)+".md",state:"done"}))}):null,Q?e.jsx("p",{className:"v5r-note",style:{marginTop:10},children:Q}):null,e.jsx(br,{skills:w,connectors:C,installAll:M}),e.jsx(ls,{plan:F}),e.jsx(Tr,{external:Y})]}):null,c==="failed"?e.jsx("p",{className:"v5r-note",style:{marginTop:12},children:k||"Setup is not available. You can run `claude /setup` in your terminal."}):null,c==="authRequired"?e.jsx(Cr,{message:k,onRetry:()=>{h([]),f(!0),d("boot"),L(ne=>ne+1)},onUseForm:t}):null]})}function Cr({message:n,onRetry:t,onUseForm:s}){return e.jsxs("div",{className:"v5o-hello",role:"dialog","aria-label":"Sign in needed",children:[e.jsx("h3",{className:"t",style:{fontSize:19,margin:"12px 0 8px"},children:"One sign-in needed."}),e.jsx("p",{className:"l",style:{maxWidth:"58ch"},children:n||"Claude is installed on this computer but not signed in yet, so the interview can't start. Open a terminal, run claude, type /login and sign in, then come back and retry. Or answer the same questions as a form instead, no sign-in needed."}),e.jsxs("div",{className:"foot",style:{display:"flex",gap:12,marginTop:14},children:[e.jsx("button",{className:"m-cta",onClick:t,children:"I signed in, retry"}),s?e.jsx("button",{className:"m-cta-line",onClick:s,children:"Use the form instead"}):null]})]})}function Tr({external:n}){const t=n&&n.connectors||[],s=n&&n.cliTools||[];if(!t.length&&!s.length)return null;const a=(r,i)=>e.jsxs("div",{className:"grp-row",style:{display:"flex",alignItems:"baseline",gap:10,padding:"7px 0",borderTop:"1px solid var(--m-line)"},children:[e.jsx("span",{style:{fontSize:13,color:"var(--m-ink-1)",flex:"0 0 auto"},children:r.label}),i?e.jsx("span",{className:"m-chip is-mute",style:{flex:"0 0 auto"},children:i}):null,e.jsx("span",{style:{fontSize:12,color:"var(--m-ink-3)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.reason}),!i&&r.install?e.jsx("button",{type:"button",className:"m-link",style:{marginLeft:"auto",flex:"0 0 auto",fontFamily:"var(--m-mono)",fontSize:10.5},title:"Copy: "+r.install,onClick:()=>{try{navigator.clipboard.writeText(r.install)}catch{}},children:"copy install"}):null]},r.id);return e.jsxs("div",{className:"v5o-connplan",style:{marginTop:14},children:[e.jsx("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:"Tools that fit what you told me"}),e.jsx("p",{style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 10px",lineHeight:1.5},children:"Matched from your answers. What you already have is marked; the rest are one copied command each, set them up whenever."}),t.map(r=>a(r,r.attached?"connected":null)),s.map(r=>a(r,r.installed?"installed":null))]})}function ls({plan:n}){return!n||!Array.isArray(n.groups)||!n.groups.length?null:e.jsxs("div",{className:"v5o-connplan",children:[e.jsx("span",{className:"m-kicker",style:{display:"block",marginBottom:6},children:"To be sharp from day one, feed me this"}),n.diagnosis?e.jsx("p",{className:"v5o-prophecy",style:{fontSize:13,color:"var(--m-ink-3)",margin:"0 0 12px",lineHeight:1.5},children:n.diagnosis}):null,n.groups.map((t,s)=>e.jsxs("div",{className:"grp",style:{"--i":s+1},children:[e.jsx("span",{className:"grp-h",children:t.label}),e.jsx("ul",{children:t.sources.map(a=>e.jsxs("li",{className:"src",children:[e.jsxs("div",{className:"body",children:[e.jsx("div",{className:"lab",children:a.label}),e.jsx("div",{className:"why",children:a.why})]}),e.jsx("span",{className:"chip "+(a.status==="ready"?"is-ready":"is-soon"),title:a.status==="ready"?"You can upload an export of this today":"Live connector on the way. Upload an export in the meantime.",children:a.status==="ready"?"Upload":"Soon"})]},a.id))})]},t.key)),e.jsx("p",{className:"foot",children:"Optional. Mover OS works without it and gets sharper as you feed it. Drop these in from your dashboard any time, and live connectors are on the way."})]})}function $s(n){n&&(n.style.height="auto",n.style.height=Math.min(n.scrollHeight,180)+"px",n.style.overflowY=n.scrollHeight>180?"auto":"hidden")}const mt=[{t:"Who you are",ids:["who","anti","leverage"]},{t:"The work",ids:["building","projects","metric","bottleneck"]},{t:"How you live",ids:["vitality","faith","how"]}];function bc({onDone:n}){const t=window.V5SETUP.questions,s=window.V5SETUP.connect,[a,r]=React.useState({}),[i,l]=React.useState(null),[o,c]=React.useState("form"),[d,u]=React.useState(-1),[h,p]=React.useState([]),[m,g]=React.useState(!1),[f,v]=React.useState(""),[x,b]=React.useState(null),[j,A]=React.useState([]),[I,k]=React.useState([]),[S,E]=React.useState([]),[L,w]=React.useState(!1),N=React.useRef(null),C=()=>{const T=D=>(a[D]||"").trim(),F=[];for(const D of t)F.push({role:"assistant",text:D.ask}),F.push({role:"user",text:T(D.id)||D.def});return F.push({role:"assistant",text:"[[SETUP_COMPLETE]]\n```json\n"+JSON.stringify({_kind:"mover-profile",currentSelf:T("who"),work:T("building"),outcome90:T("metric"),metric:T("metric"),projects:T("projects"),bottleneck:T("bottleneck"),antiidentity:T("anti"),leverage:T("leverage"),vitality:T("vitality"),vitalityTarget:T("vitality"),faith:T("faith"),purpose:T("faith"),energyWindows:T("how")})+"\n```"}),F},P=async()=>{if(m)return;g(!0),v("");const T=C();N.current=T;try{const F=await(await fetch("/api/health")).json(),D=await Ie("/api/session/finalize",{transcript:T,dryRun:!0,toVault:!0},F.token);if(!(D&&D.ok)){v("Couldn't prepare a preview. Try again, or run setup in your terminal."),g(!1);return}const Y=(D.files||[]).map(z=>({name:(z.path||"").split("/").pop().replace(/\.md$/,""),content:z.content||""})).filter(z=>z.name);A(Y),g(!1),c("preview")}catch{v("Couldn't reach the server to preview. Try again in a moment."),g(!1);return}(async()=>{try{const F=z=>(a[z]||"").trim(),D=await(await fetch("/api/health")).json(),Y=await Ie("/api/setup/recommend",{profile:{work:F("building"),projects:F("projects"),leverage:F("leverage"),tools:F("leverage"),vitality:F("vitality"),faith:F("faith")}},D.token);Y&&Y.ok&&(b(Y.connectPlan||null),Y.installAll?w(!0):k((Y.recommended||[]).slice(0,4)),E((Y.connectors||[]).slice(0,3)))}catch{}})()},M=async()=>{if(m)return;g(!0),v("");const T=N.current||C();let F=!1,D="";try{const Y=await(await fetch("/api/health")).json(),z=await Ie("/api/session/finalize",{transcript:T,dryRun:!1,toVault:!0},Y.token);F=!!(z&&z.ok&&z.written),F||(D=z&&z.error&&/already exists|SAFETY/i.test(z.error)?"You already have an operating record. Keeping it untouched.":"Couldn't write your record. Try again, or run setup in your terminal.")}catch{D="Couldn't reach the server to save. Try again in a moment."}if(g(!1),!F){v(D);return}c("writing"),u(0),t.forEach((Y,z)=>{setTimeout(()=>{const y=(a[Y.id]||"").trim();p(V=>[...V,{label:Y.saved+(y?"":" (a sensible default)"),file:Y.file,state:"done"}]),u(z+1)},300*(z+1))}),setTimeout(n,300*t.length+800)};return e.jsxs("article",{className:"v5r-session is-attn v5o-card-in","data-screen-label":"First open, setup without an agent",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.term(15)," No agent yet"]}),e.jsx("h3",{className:"t",children:"Set up your operating record"}),e.jsx("span",{className:"v5r-extag",children:"Short setup"})]}),e.jsx("p",{className:"v5r-note",style:{marginTop:4},children:"Short setup for when your AI isn't signed in yet. It writes your starting files; the full interview can go deeper later."}),o==="form"?e.jsxs("div",{className:"v5o-form",children:[(()=>{const T=new Set(mt.flatMap(z=>z.ids)),F=t.filter(z=>!T.has(z.id)).map(z=>z.id),D=mt.map((z,y)=>y===mt.length-1?{...z,ids:[...z.ids,...F]}:z),Y=z=>e.jsxs("div",{className:"v5o-field",children:[e.jsxs("label",{className:"fk",htmlFor:"v5o-"+z.id,children:[z.ask,e.jsxs("span",{className:"fto",children:["→ ",z.file]})]}),e.jsx("textarea",{id:"v5o-"+z.id,value:a[z.id]||"",placeholder:z.ph,rows:1,onChange:y=>{r(V=>({...V,[z.id]:y.target.value})),$s(y.target)}}),e.jsx("button",{className:"fdef",onClick:()=>{r(y=>({...y,[z.id]:z.def})),requestAnimationFrame(()=>$s(document.getElementById("v5o-"+z.id)))},children:"Use a sensible default"})]},z.id);return D.map(z=>{const y=z.ids.map(V=>t.find(H=>H.id===V)).filter(Boolean);return y.length?e.jsxs("section",{className:"v5o-chapter","aria-label":z.t,children:[e.jsx("div",{className:"v5o-chapkick",children:z.t}),y.map(Y)]},z.t):null})})(),e.jsxs("div",{className:"v5o-connect",children:[e.jsx("p",{className:"lead",children:s.lead}),e.jsx("div",{className:"opts",children:s.options.map(T=>e.jsxs("button",{className:i===T.id?"m-cta-line":"m-mini",style:i===T.id?{padding:"8px 14px",fontSize:12}:null,onClick:()=>l(i===T.id?null:T.id),children:[MIcons.agent(12)," Connect ",T.name]},T.id))}),i?e.jsxs("p",{className:"how",children:[e.jsxs("b",{children:[s.options.find(T=>T.id===i).name,":"]})," ",s.options.find(T=>T.id===i).how," Setup doesn't wait on this, finish here and it'll show up in Run."]}):e.jsx("p",{className:"how",children:s.later})]}),f?e.jsx("p",{className:"v5r-note",style:{marginTop:10,color:"var(--m-warn)"},children:f}):null,e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("button",{className:"m-cta",onClick:P,disabled:m,children:m?"Preparing…":e.jsxs(React.Fragment,{children:["Review my record ",MIcons.arrow(14)]})}),e.jsx("span",{style:{fontSize:11.5,color:"var(--m-ink-3)"},children:"Blank answers get defaults, you can change everything later."})]})]}):o==="preview"?e.jsxs(React.Fragment,{children:[e.jsx(Sr,{prophecy:(a.who||"").trim(),finalFiles:j,recSkills:I,recConnectors:S,recInstallAll:L,recConnectPlan:x,onConfirm:M,onBack:()=>c("form"),confirmBusy:m,backLabel:"Back"}),f?e.jsx("p",{className:"v5r-note",style:{marginTop:10,color:"var(--m-warn)"},children:f}):null]}):e.jsxs("div",{children:[d<t.length?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsxs("span",{className:"big",children:[t[Math.min(d,t.length-1)].saving,"…"]}),e.jsxs("span",{className:"secs",children:["writing ",t[Math.min(d,t.length-1)].file]})]}):null,e.jsx(is,{items:h}),e.jsx(ls,{plan:x})]})]})}function Nc({onContinue:n}){const[t,s]=React.useState(""),[a,r]=React.useState(""),[i,l]=React.useState("everyday"),[o,c]=React.useState(!1),[d,u]=React.useState(!0),[h,p]=React.useState(!1),[m,g]=React.useState(""),f=typeof window<"u"&&window.M4LENS&&Object.keys(window.M4LENS).length?window.M4LENS:{everyday:{name:"Everyday",who:"plain, simple words"},founder:{name:"Founder",who:"founders and operators"},muslim:{name:"Muslim",who:"barakah, niyyah, amanah"},secular:{name:"Secular",who:"secular self-accounting"}},v=async x=>{if(h)return;p(!0),g("");let b=!1;try{const j=await(await fetch("/api/health")).json(),A=await Ie("/api/config",{userName:t.trim()||null,vaultName:a.trim()||null,osName:a.trim()||null,lens:i},j.token);if(b=!!(A&&A.ok!==!1),d)try{await Ie("/api/setup/shortcut",{name:a.trim()},j.token)}catch{}}catch{b=!1}if(p(!1),!b&&!x){g("Couldn't save these. The system would fall back to defaults.");return}n()};return e.jsxs("div",{className:"v5o-hello v5o-card-in",role:"dialog","aria-label":"The basics",children:[e.jsxs("span",{className:"v5o-time",children:[MIcons.spark(12)," A few basics first"]}),e.jsx("h2",{className:"t m-serif",children:"Let's set the basics"}),e.jsx("p",{className:"l",children:"Your name, what to call your system, and how it should talk to you. You can change all of this later in Configure."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,marginTop:16},children:[e.jsxs("label",{className:"v5o-field v5o-stagger",style:{"--i":0},children:[e.jsx("span",{className:"fk",children:"What should I call you?"}),e.jsx("input",{value:t,placeholder:"e.g. Alex",onChange:x=>s(x.target.value)})]}),e.jsxs("label",{className:"v5o-field v5o-stagger",style:{"--i":1},children:[e.jsx("span",{className:"fk",children:"What do you want to name your system?"}),e.jsx("input",{value:a,placeholder:"e.g. Alex OS",onChange:x=>r(x.target.value)})]}),e.jsxs("div",{className:"v5o-field v5o-stagger",style:{"--i":2},children:[e.jsx("span",{className:"fk",children:"How should it talk to you?"}),o?e.jsxs(React.Fragment,{children:[e.jsx("div",{role:"radiogroup","aria-label":"Worldview lens",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(124px, 1fr))",gap:8,marginTop:6},children:Object.entries(f).map(([x,b],j)=>e.jsxs("button",{type:"button",role:"radio","aria-checked":i===x,onClick:()=>l(x),className:"v5o-lens v5o-stagger-sm"+(i===x?" is-on":""),style:{"--i":j},children:[e.jsx("span",{className:"nm",children:b.name}),e.jsx("span",{className:"wh",children:b.who}),e.jsx("span",{className:"tick","aria-hidden":"true",children:MIcons.check(10)})]},x))}),e.jsx("p",{style:{fontSize:11.5,color:"var(--m-ink-3)",marginTop:6},children:"Only the wording changes; the system is the same. The Muslim wording is opt-in, never forced."})]}):e.jsxs("p",{style:{margin:"4px 0 0",fontSize:13,color:"var(--m-ink-2)"},children:[f[i]&&f[i].name||"Everyday",", ",f[i]&&f[i].who||"plain words","."," ",e.jsx("button",{type:"button",className:"m-link",style:{fontSize:12.5},onClick:()=>c(!0),children:"Change"})]})]}),e.jsxs("label",{className:"v5o-stagger",style:{"--i":3,display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--m-ink-2)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:d,onChange:x=>u(x.target.checked)}),"Add a desktop shortcut to reopen this dashboard"]})]}),e.jsxs("div",{className:"foot",style:{marginTop:18},children:[e.jsx("button",{className:"m-cta",onClick:()=>v(!1),disabled:h,children:h?"Saving…":e.jsxs(React.Fragment,{children:["Continue ",MIcons.arrow(15)]})}),m?e.jsxs("p",{role:"alert",style:{marginTop:10,fontSize:12.5,color:"var(--m-crit, #d98069)"},children:[m," ",e.jsx("button",{className:"m-link",style:{fontSize:12.5},onClick:()=>v(!1),children:"Retry"})," ","·"," ",e.jsx("button",{className:"m-link",style:{fontSize:12.5,color:"var(--m-ink-3)"},onClick:()=>v(!0),children:"Continue anyway"})]}):null]})]})}function Sc(){return e.jsxs("article",{className:"v5r-session is-attn v5o-card-in","data-screen-label":"First open, checking for an agent",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," Setup"]}),e.jsx("h3",{className:"t",children:"Getting your setup ready"})]}),e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0,marginTop:14},children:[e.jsx("span",{className:"m-dot is-live",style:{width:8,height:8},"aria-hidden":"true"}),e.jsx("span",{className:"big",style:{marginLeft:10},children:"Checking for a connected agent…"})]})]})}function Cc({phase:n}){const t=[{k:"install",lbl:"Installed"},{k:"welcome",lbl:"Welcome"},{k:"basics",lbl:"Basics"},{k:"setup",lbl:"Setup"},{k:"done",lbl:"Done"}],s=Math.max(1,t.findIndex(a=>a.k===n));return e.jsx("div",{className:"v5o-rail","aria-label":"Step "+(s+1)+" of "+t.length,children:t.map((a,r)=>e.jsxs(React.Fragment,{children:[r>0?e.jsx("span",{className:"bar"+(r<=s?" is-filled":""),"aria-hidden":"true"}):null,e.jsxs("span",{className:"stop"+(r<s?" is-done":r===s?" is-cur":""),children:[e.jsx("span",{className:"node","aria-hidden":"true"}),e.jsx("span",{className:"lbl",children:a.lbl})]})]},a.k))})}function Tc({agentConnected:n,onFinish:t,onWalkthrough:s,onTour:a}){const r=window.V5SETUP.welcome,i=window.V5SETUP.finish,[l,o]=React.useState(()=>We==="basics"?"basics":We==="done"?"done":We==="preview"||We==="forge"||We==="writing"||We==="agentdone"?"setup":"welcome"),c=We?!0:n,[d,u]=React.useState(!1),[h,p]=React.useState(!1),m=React.useCallback(async()=>{try{const g=await(await fetch("/api/health")).json();await Ie("/api/config",{onboardingSkipped:!0},g.token)}catch{}t()},[t]);return e.jsx("div",{className:"v5o-scrim","data-screen-label":"First open, "+l,children:e.jsxs("div",{className:"v5o-col",children:[e.jsxs("div",{className:"v5o-brand",children:[e.jsx("span",{className:"wm",children:"Mover OS"}),e.jsx("span",{className:"sub",children:"First open"})]}),e.jsx(Cc,{phase:l}),l==="welcome"?e.jsxs("div",{className:"v5o-hello is-welcome",role:"dialog","aria-label":"Welcome",children:[e.jsxs("span",{className:"v5o-time",children:[MIcons.spark(12)," First open · guided setup · skippable"]}),e.jsx("h2",{className:"t m-serif",children:r.t}),e.jsx("p",{className:"l",children:r.l}),e.jsxs("div",{className:"foot",children:[e.jsxs("button",{className:"m-cta",onClick:()=>o("basics"),children:[r.cta," ",MIcons.arrow(15)]}),e.jsx("button",{className:"m-link",onClick:m,children:r.skip})]})]},"welcome"):l==="basics"?e.jsx(Nc,{onContinue:()=>o("setup")}):l==="setup"?e.jsxs(React.Fragment,{children:[c===null?e.jsx(Sc,{}):c==="authRequired"&&!d&&!h?e.jsx(Cr,{onRetry:()=>p(!0),onUseForm:()=>u(!0)}):(c===!0||h)&&!d?e.jsx(kc,{onDone:()=>o("done"),onUseForm:()=>u(!0)}):e.jsx(bc,{onDone:()=>o("done")}),e.jsx("button",{className:"m-link",style:{alignSelf:"center"},onClick:m,children:"Skip the rest, defaults will fill in"})]}):e.jsxs("div",{className:"v5o-hello is-done",role:"dialog","aria-label":"You're set",children:[e.jsxs("svg",{className:"v5o-seal",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{className:"ring",cx:"12",cy:"12",r:"9.4",pathLength:"1"}),e.jsx("path",{className:"tick",d:"M7.6 12.4l2.8 2.8L16.4 9.2",pathLength:"1"})]}),e.jsxs("span",{className:"v5o-time",children:[MIcons.check(12)," Setup finished"]}),e.jsx("h2",{className:"t m-serif",children:i.t}),e.jsx("p",{className:"l",children:i.l}),e.jsx("div",{style:{marginTop:16},children:e.jsx(V5Files,{files:i.files})}),e.jsxs("p",{style:{fontSize:12.5,lineHeight:1.5,color:"var(--m-ink-3)",margin:"12px 0 0"},children:["Next, a quick tour of the dashboard. Each day, run ",e.jsx("code",{style:{fontFamily:"var(--m-mono)",color:"var(--m-ink)"},children:"/morning"})," in your agent to begin."]}),e.jsxs("div",{className:"foot",children:[e.jsxs("button",{className:"m-cta v5o-cta-invite",onClick:()=>{a?a():t()},children:["Show me around ",MIcons.arrow(15)]}),e.jsxs("button",{className:"m-cta-line",onClick:()=>{if(s)s();else{try{localStorage.setItem("m5.setup.done",JSON.stringify(!0))}catch{}window.location.href="/walkthrough"}},children:["Learn the daily commands ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-link",onClick:t,children:i.cta})]})]},"done")]})})}Object.assign(window,{OnboardingFlow:Tc});const Tn=[{id:"welcome",step:1,title:"You're set up. Now let's operate.",body:"Setup extracted who you are and built your Engine. This walkthrough teaches you how to RUN it. Eight steps, eight minutes. No reading, only doing.",doThis:'Type "ready" to begin.',checkpoint:"User says they are ready or asks a question. Either counts, they are engaged."},{id:"first-workflow",step:2,title:"Drive the system with workflows.",body:"This is not a chatbot. You run commands. The core command is /morning, it loads your Engine files, checks your energy, and sets your Single Test for the session. Without /morning, you are flying blind.",doThis:"Open a Claude Code session (a terminal, type `claude`). Run: /morning",checkpoint:"User confirms they ran /morning, or asks where Claude Code is."},{id:"one-chat",step:3,title:"One session. Not ten tabs.",body:"Every new Claude Code window starts from zero, no memory of the last one. Your Engine files ARE the persistent memory. Opening a new window mid-task means re-loading all that context, which costs tokens and minutes.",doThis:"For today: stay in the Claude Code session where you ran /morning. Do not open a new window unless you run /morning first.",checkpoint:"User acknowledges the habit. No file action needed."},{id:"compact",step:4,title:"Compact before context breaks down.",body:"After a long session, responses get shallower, the model is losing the thread. /compact compresses the conversation while re-loading your Engine context. Not 'start over', 'keep going with a clear head'. Use it when responses feel off.",doThis:"In your Claude Code session: type /compact. If the session is short, run it anyway so you know what it does.",checkpoint:"User ran /compact, or confirms they understand when to use it."},{id:"verify-files",step:5,title:"The files are the truth. Not the chat.",body:"The chat transcript is temporary. Every workflow writes its output to a file, Daily Note, Active_Context.md, plan.md. If it's only in the chat, it's gone when you close the session. Always verify: did that land in a file?",doThis:"Open Obsidian. Navigate to 02_Areas/Engine/. Confirm Active_Context.md exists and has content from setup.",checkpoint:"User confirms they saw Active_Context.md with content. That is proof the system is working."},{id:"discover",step:6,title:"Every workflow tells you what comes next.",body:"You do not need to memorize 25 commands. Every workflow ends with a handoff, a specific suggestion for what to run next. Today that chain is: /morning → work → /log → /analyse-day → /plan-tomorrow. You ran /morning. /log is next.",doThis:"In your Claude Code session: type /log, the end-of-session capture. Read its output and note what it suggests you run after.",checkpoint:"User ran /log and reports what it suggested. Any answer is correct, they have seen the handoff pattern live."},{id:"daily-loop",step:7,title:"The loop that keeps the system alive.",body:"Run this every day and the system compounds. Skip it and it decays. The loop: /morning to start → work → /log to capture → /analyse-day to audit → /plan-tomorrow to set tomorrow. This is not optional ceremony. This is the product.",doThis:"Say the loop back from memory, just the five steps.",checkpoint:"User gives some version of: morning, work, log, analyse-day, plan-tomorrow."},{id:"first-plan",step:8,title:"Close the loop before you leave.",body:"Do not walk away without a plan for tomorrow. /plan-tomorrow pulls from your strategy, backlogs, and today's work. It gives you a clear first task for tomorrow morning. This is the bridge from 'I installed this' to 'I am actually using this'.",doThis:"In your Claude Code session: type /plan-tomorrow. Confirm you have a plan for tomorrow when it finishes.",checkpoint:"User confirms they ran /plan-tomorrow and have a plan for tomorrow. Done-gate."}],Ln=Tn.length,Rc=["You are the Mover OS walkthrough guide.","Your ONLY job: teach the user to operate the system in 8 steps, taking no more than 8 minutes total.","Do NOT re-explain what Mover OS is, what Engine files are, or what setup covered.","Each turn: acknowledge the user's last action in ONE sentence, then give the next step's instruction clearly.","Keep every response under 4 sentences. No exceptions.","Do NOT use numbered lists, bullet points, or headings in your responses. Prose only.","Do NOT run any tools and do NOT read files, you have no tools in this session.","You may reference file names (like Active_Context.md or plan.md) but never their contents.","Tone: warm but fast. A co-founder showing someone the system in a short video call, not a teacher at a whiteboard.","When the user confirms they completed step 8 (running /plan-tomorrow and having a plan for tomorrow), emit the exact token [[WALKTHROUGH_COMPLETE]] on its own line, then write one sentence that says they are ready to operate the system.","CRITICAL: Only emit [[WALKTHROUGH_COMPLETE]] after the user has confirmed step 8. Not before."].join(" "),Xs="[[WALKTHROUGH_COMPLETE]]";async function kn(n,t,s){return(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":s},body:JSON.stringify(t)})).json()}function Ec(n,t){return["Begin the walkthrough. The user just completed setup.",`Current step: ${n.step}/${Ln}, "${n.title}".`,`What to teach: ${n.body}`,`The action for the user: ${n.doThis}`,`How to verify: ${n.checkpoint}`,"Give your response now. Max 4 sentences."].join(" ")}function Ic(n){return[`The user confirmed step ${n.step-1} is done.`,`Next step: ${n.step}/${Ln}, "${n.title}".`,`What to teach: ${n.body}`,`The action for the user: ${n.doThis}`,`How to verify: ${n.checkpoint}`,"Give your response now. Max 4 sentences."].join(" ")}function Mc({total:n,at:t}){return e.jsxs("div",{className:"v5o-dots","aria-label":"Step "+Math.min(t+1,n)+" of "+n,children:[Array.from({length:n}).map((s,a)=>e.jsx("span",{className:"d"+(a<t?" is-done":a===t?" is-cur":"")},a)),e.jsxs("span",{className:"k m-num",children:[Math.min(t+1,n)," of ",n]})]})}function Ac({step:n,state:t}){return e.jsxs("div",{className:"v5r-step",style:{marginBottom:12,padding:"12px 14px",borderRadius:12,borderLeft:t==="done"?"3px solid var(--m-good)":"3px solid var(--m-gold)",background:t==="done"?"rgba(169,191,130,0.04)":"rgba(227,196,137,0.05)",opacity:t==="done"?.72:1,transition:"opacity .3s, border-color .3s"},children:[e.jsxs("div",{style:{fontSize:10.5,letterSpacing:".1em",textTransform:"uppercase",color:"var(--m-ink-3)",marginBottom:4},children:["Step ",e.jsx("span",{style:{color:"var(--m-gold-2)",fontWeight:600},children:n.step})," of ",Ln,t==="done"?e.jsx("span",{style:{marginLeft:8,color:"var(--m-good)",fontSize:11},children:MIcons.check(11)}):null]}),e.jsx("div",{style:{fontFamily:"var(--m-serif)",fontSize:17,lineHeight:1.35,color:"var(--m-ink)",marginBottom:6},children:n.title}),e.jsx("div",{style:{fontSize:13,color:"var(--m-ink-2)",lineHeight:1.6,marginBottom:8},children:n.body}),t!=="done"?e.jsxs("div",{style:{padding:"9px 12px",borderRadius:9,background:"var(--m-gold-soft)",border:"1px solid var(--m-gold-line)",fontSize:13,color:"var(--m-gold-2)"},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--m-gold)",letterSpacing:".04em"},children:"Do this · "}),n.doThis]}):null]})}function Lc({onFinish:n}){const t=React.useRef(null),s=React.useRef(null),a=React.useRef(null),r=React.useRef("booting"),i=React.useRef(null),l=React.useRef(0),o=React.useRef(new Set),[c,d]=React.useState("booting"),[u,h]=React.useState([]),[p,m]=React.useState(""),[g,f]=React.useState(!0),[v,x]=React.useState(null),[b,j]=React.useState(0),[A,I]=React.useState(""),[k,S]=React.useState(""),[E,L]=React.useState([]),w=(M,T)=>h(F=>[...F,{who:M,line:T}]);React.useEffect(()=>{r.current=c},[c]),React.useEffect(()=>{i.current=v},[v]),React.useEffect(()=>{c==="live"&&E.length===0&&L([{step:Tn[0],state:"active"}])},[c]),React.useEffect(()=>()=>{a.current&&a.current.close()},[]),React.useEffect(()=>{let M=!1;return(async()=>{try{const T=await(await fetch("/api/health")).json();if(M)return;t.current=T.token;const F=await kn("/api/session/start",{agent:"claude-code",systemPrompt:Rc},T.token);if(M)return;if(!F.ok){I("No agent connected, you can run the walkthrough in the terminal with `claude /walkthrough`"),d("failed"),setTimeout(n,3e3);return}s.current=F.sessionId;const D=new EventSource("/api/session/events?id="+encodeURIComponent(F.sessionId));a.current=D,D.onmessage=z=>{if(M)return;let y;try{y=JSON.parse(z.data)}catch{return}if(y.kind==="assistant"){const V=y.text||"";if(V.indexOf(Xs)>=0){if(r.current==="finalizing"||r.current==="done")return;a.current&&(a.current.close(),a.current=null);const H=V.split(Xs),R=(H[0]||"").trim(),Q=H.slice(1).join(" ").trim();R&&w("agent",R),S(Q),d("finalizing"),setTimeout(()=>{d("done"),setTimeout(n,3200)},900);return}w("agent",V),f(!1)}else y.kind==="result"?i.current||f(!1):y.kind==="permission"?(f(!0),x({requestId:y.requestId,request:y.request}),d("permission")):(y.kind==="closed"||y.kind==="error")&&r.current!=="finalizing"&&r.current!=="done"&&f(!0)},D.onerror=()=>{},d("live");const Y=Tn[0];await kn("/api/session/send",{sessionId:F.sessionId,text:Ec(Y,!0)},T.token)}catch{if(M)return;a.current&&(a.current.close(),a.current=null),I("Couldn't reach the Mover OS server. Run `claude /walkthrough` in your terminal."),d("failed"),setTimeout(n,3e3)}})(),()=>{M=!0}},[]);const N=async M=>{const T=(M!==void 0?M:p).trim();if(!T||g||c==="finalizing"||c==="done"||c==="failed")return;w("you",T),m(""),f(!0);const F=Tn[l.current];if(F){o.current.add(F.id);const z=l.current;L(y=>y.map((V,H)=>H===z?{...V,state:"done"}:V)),j(Math.min(o.current.size,Ln-1))}l.current+=1;const D=Tn[l.current];if(!D){const z=T+`
|
|
120
|
+
|
|
121
|
+
[SYSTEM: The user confirmed step 8 is complete. Emit [[WALKTHROUGH_COMPLETE]] on its own line, then write one closing sentence that says they are ready to operate the system.]`;await kn("/api/session/send",{sessionId:s.current,text:z},t.current),setTimeout(()=>{r.current!=="finalizing"&&r.current!=="done"&&(a.current&&(a.current.close(),a.current=null),d("finalizing"),setTimeout(()=>{d("done"),setTimeout(n,3200)},900))},12e3);return}L(z=>[...z,{step:D,state:"active"}]);const Y=T+`
|
|
122
|
+
|
|
123
|
+
[SYSTEM: `+Ic(D)+"]";await kn("/api/session/send",{sessionId:s.current,text:Y},t.current)},C=async M=>{const T=v;!T||r.current==="finalizing"||r.current==="done"||(x(null),d("live"),w("you",M==="allow"?"Allow once.":"Deny."),f(!0),await kn("/api/session/approve",{sessionId:s.current,requestId:T.requestId,decision:M},t.current))},P=g&&(c==="live"||c==="booting");return e.jsxs("article",{className:"v5r-session is-attn","data-screen-label":"Operating walkthrough, guided agent session",children:[e.jsxs("div",{className:"v5r-shead",children:[e.jsxs("span",{className:"agent",children:[MIcons.agent(15)," Claude Code"]}),e.jsx("h3",{className:"t",children:"Learning to operate Mover OS"}),e.jsx(Mc,{total:Ln,at:b})]}),E.length>0?e.jsx("div",{style:{marginTop:14},children:E.map((M,T)=>e.jsx(Ac,{step:M.step,state:T===E.length-1?M.state:"done"},M.step.id))}):null,c!=="booting"?e.jsx("div",{className:"v5r-chat",style:{marginTop:12},children:u.slice(-6).map((M,T)=>e.jsxs("div",{className:"msg"+(M.who==="you"?" is-you":""),children:[e.jsx("span",{className:"who",children:M.who==="you"?"You":"Claude Code"}),e.jsx("span",{className:"l",children:M.line})]},T))}):null,P?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"m-dot is-live",style:{width:8,height:8},"aria-hidden":"true"}),e.jsx("span",{className:"big",style:{marginLeft:10},children:c==="booting"?"Starting walkthrough session…":"Thinking…"})]}):null,c==="permission"&&v?e.jsxs("div",{className:"v5r-approve",role:"alert",children:[e.jsxs("div",{className:"q",children:[e.jsx("b",{children:"Permission requested"}),e.jsx("span",{className:"d",style:{display:"block",marginTop:4,fontSize:12.5,color:"var(--m-ink-3)"},children:JSON.stringify(v.request||"").slice(0,180)})]}),e.jsxs("div",{className:"btns",children:[e.jsx("button",{className:"m-cta",style:{padding:"9px 16px",fontSize:12.5},onClick:()=>C("allow"),children:"Allow once"}),e.jsx("button",{className:"m-cta-line",style:{padding:"9px 14px",fontSize:12.5},onClick:()=>C("deny"),children:"Deny"})]})]}):null,c==="live"||c==="permission"?e.jsxs("div",{className:"v5o-q",style:{marginTop:12},children:[e.jsx("textarea",{rows:2,value:p,placeholder:"Your response…",disabled:g,autoFocus:!g,onChange:M=>m(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),N())}}),e.jsxs("div",{className:"acts",children:[e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13},disabled:g||!p.trim(),onClick:()=>N(),children:["Send ",MIcons.arrow(13)]}),e.jsx("button",{className:"m-mini",disabled:g,onClick:()=>N("done"),children:"Mark done"})]})]}):null,c==="finalizing"?e.jsxs("div",{className:"v5r-now",style:{paddingBottom:0},children:[e.jsx("span",{className:"pulse","aria-hidden":"true"}),e.jsx("span",{className:"big",children:"Confirming you're ready…"})]}):null,c==="done"?e.jsxs("div",{style:{textAlign:"center",padding:"28px 0 8px"},children:[e.jsx("div",{style:{fontFamily:"var(--m-serif)",fontSize:22,color:"var(--m-ink)",marginBottom:8},children:"Engine is live."}),e.jsx("p",{style:{fontSize:14,color:"var(--m-ink-2)",maxWidth:380,margin:"0 auto 20px",lineHeight:1.6},children:k||"You know how to drive it. Run /morning every session, follow the handoffs, and the system compounds every day."})]}):null,c==="failed"?e.jsx("p",{className:"v5r-note",style:{marginTop:12},children:A||"Walkthrough is not available. Run `claude /walkthrough` in your terminal."}):null]})}function Oc({onFinish:n}){return e.jsx("div",{className:"v5o-scrim","data-screen-label":"Operating walkthrough",children:e.jsxs("div",{className:"v5o-col",children:[e.jsxs("div",{className:"v5o-brand",children:[e.jsx("span",{className:"wm",children:"Mover OS"}),e.jsx("span",{className:"sub",children:"Walkthrough"})]}),e.jsx(Lc,{onFinish:n}),e.jsx("button",{className:"m-link",style:{alignSelf:"center",marginTop:8},onClick:n,children:"Skip, I'll explore on my own"})]})})}Object.assign(window,{WalkthroughFlow:Oc});const at=()=>window.V5RUN;function Pc(n,t){return{id:"custom",t:n,kind:"steps",runs:"agent task",ask:n,plan:["Understand what you asked","Read the files it needs","Do the work, step by step","Check the result","Save a receipt"],trace:[{live:"Reading what it needs",detail:"3 files",secs:3},{live:"Doing the work",detail:"step by step",secs:5,approval:{line:(t||"Claude")+" wants to edit 2 files.",files:["it shows you which, before touching them"]}},{live:"Checking the result",detail:"looks right",secs:3},{live:"Saving to your record",detail:"receipt written",secs:2}],receipt:{line:"Done: “"+n+"”.",files:["shown here when it's a real run"],dur:"2m 04s"}}}function Dc({rollout:n,mode:t,setMode:s,agent:a,setAgent:r,care:i,setCare:l,onSpawn:o}){const c=at(),[d,u]=React.useState(""),h=n==="new";c.agents.find(g=>g.id===a)||c.agents[0];const p=c.careDisabled[a]||[],m=g=>{const f=(g||d).trim();f&&(o(f),u(""))};return e.jsxs("section",{className:"v5r-ask m-rise",style:{"--i":0},"data-coach":"usecases","data-screen-label":"Run, ask",children:[e.jsxs("div",{className:"v5r-ask-head",children:[e.jsxs("div",{children:[e.jsx("span",{className:"m-kicker",children:"What do you want done?"}),e.jsx(Hint,{what:"Say it in normal words, no commands to learn. The agent shows you its plan before it does anything.",doing:"You watch every step in plain English, and approve anything risky.",src:"Workflows/ registry"})]}),e.jsx("div",{className:"v5r-mode",role:"radiogroup","aria-label":"How to run",children:["watch","power"].map(g=>e.jsxs("button",{className:t===g?"is-on":"",role:"radio","aria-checked":t===g,onClick:()=>s(g),children:[c.modes[g].k,e.jsx("span",{className:"tag",children:c.modes[g].tag})]},g))})]}),c.modes[t]?e.jsx("p",{className:"v5r-modeline",children:t==="watch"?"Follows the agent sessions you run, here in plain English. Steering and approvals stay in your terminal.":"Start, steer, and approve agents from this page. Runs in the background, uses your agent credits."}):null,e.jsxs("div",{className:"v5r-askrow",children:[e.jsx("input",{className:"big",value:d,onChange:g=>u(g.target.value),placeholder:"Type it like you'd say it, e.g. “clean up my notes from today”",onKeyDown:g=>{g.key==="Enter"&&m()}}),e.jsxs("button",{className:"m-cta",onClick:()=>m(),children:[t==="watch"?"Plan it & watch":"Show me the plan"," ",MIcons.arrow(14)]})]}),e.jsx("div",{className:"v5r-chips",children:c.chips.map(g=>e.jsx("button",{className:"m-mini",onClick:()=>m(g),children:g},g))}),h?e.jsx("p",{className:"v5r-note",style:{marginTop:12},children:"Run a few things and you'll get to pick which agent does the work, and how much freedom it has."}):e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"v5r-agents",role:"radiogroup","aria-label":"Who does the work",children:c.agents.map(g=>{const f=g.id==="terminal"?!0:g.connected===!0,v=f?"ready":"not connected";return e.jsxs("button",{className:"v5r-agent"+(a===g.id?" is-on":"")+(f?"":" is-idle"),role:"radio","aria-checked":a===g.id,onClick:()=>r(g.id),"aria-label":g.name+", "+v,children:[e.jsxs("span",{className:"nm",children:[g.id==="terminal"?MIcons.term(13):MIcons.agent(13)," ",g.name,e.jsx("span",{className:"st"+(f?"":" is-off"),children:v})]}),e.jsx("span",{className:"ln",children:g.line})]},g.id)})}),a!=="terminal"?e.jsxs("div",{className:"v5r-carerow",children:[e.jsx("span",{className:"k",children:"How careful?"}),e.jsx("div",{className:"v5r-care",role:"radiogroup","aria-label":"Care level",children:c.careLevels.map(g=>{const f=p.includes(g.id);return e.jsx("button",{className:(i===g.id&&!f?"is-on":"")+(f?" is-off":""),role:"radio","aria-checked":i===g.id&&!f,disabled:f,onClick:()=>l(g.id),children:g.k},g.id)})}),e.jsx("span",{className:"v5r-note",style:{margin:0},children:c.careNotes[a]})]}):e.jsxs("p",{className:"v5r-note",style:{marginTop:10},children:[MIcons.term(12)," ",c.careNotes.terminal]})]})]})}function Fc({onNav:n}){const t=at(),[s,a]=React.useState(!1);return e.jsxs("aside",{className:"v5r-rail","data-screen-label":"Run, side rail","aria-label":"Agents, what's next, and what you finished today",children:[e.jsxs("div",{className:"grp",children:[e.jsx("span",{className:"gk",children:"Your agents"}),t.agents.filter(r=>r.id!=="terminal").map(r=>{const i=r.connected===!0;return e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"m-dot "+(i?"is-good":"is-off")}),e.jsx("span",{className:"t",children:r.name}),e.jsx("span",{className:"s",children:i?"ready":"not connected"})]},r.id)})]}),e.jsxs("div",{className:"grp",children:[e.jsx("span",{className:"gk",children:"Next up"}),t.queue.length>0?t.queue.map(r=>e.jsxs("button",{className:"row is-link",onClick:()=>n("home"),title:"See the plan on Home","aria-label":r.t+", "+r.when,children:[e.jsx("span",{className:"m-dot is-mute"}),e.jsx("span",{className:"t",children:r.t}),e.jsx("span",{className:"s",children:r.when})]},r.t)):e.jsx("p",{className:"v5r-railempty",children:"No next step queued. Run /plan-tomorrow and the system fills this in."})]}),e.jsxs("div",{className:"grp",children:[e.jsx("span",{className:"gk",children:"Done today"}),t.doneToday.length>0?e.jsxs(React.Fragment,{children:[t.doneToday.map(r=>e.jsxs("button",{className:"row is-link",onClick:()=>n("evidence"),title:"See the receipt in Evidence","aria-label":"Done: "+r.t,children:[e.jsx("span",{style:{color:"var(--m-good)",display:"inline-flex"},children:MIcons.check(11)}),e.jsx("span",{className:"t",children:r.t}),r.dur?e.jsx("span",{className:"s m-data",children:r.dur}):null,e.jsx("span",{className:"s m-num",children:r.d})]},r.t+(r.d||""))),e.jsxs("button",{className:"m-link",style:{marginTop:8},onClick:()=>n("evidence"),children:["All receipts in Evidence ",MIcons.arrow(12)]})]}):e.jsx("p",{className:"v5r-railempty",children:"Nothing logged today yet. Finished work shows up here as it lands."})]}),e.jsxs("div",{className:"grp",style:{borderBottom:"none"},children:[e.jsxs("button",{className:"m-link",onClick:()=>a(!s),children:[MIcons.term(12)," Open in terminal instead"]}),s?e.jsx("p",{className:"v5r-note",style:{marginTop:8},children:"Run any agent in your own terminal, like normal. Your sessions show up here on their own, nothing extra to do."}):null]})]})}function _c({rollout:n,onStart:t}){const s=at(),a=n==="new"?s.jobs.slice(0,3):s.jobs;return e.jsxs("section",{className:"m4-sec",style:{marginTop:34},"data-screen-label":"Run, common jobs",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Common jobs"}),e.jsx(Hint,{what:"The things you'll ask for most, one tap each. Every card shows what it reads and what it changes.",doing:"Jobs that need your input talk to you. They never run off silently.",src:"Workflows/ registry"})]}),e.jsx("div",{className:"v5r-jobs",children:a.map(r=>e.jsxs("div",{className:"v5r-job",children:[e.jsxs("div",{className:"hd",children:[e.jsx("span",{className:"t m-serif",children:r.t}),r.kind==="conversation"?e.jsx("span",{className:"m-chip is-mute",children:"asks you questions"}):null]}),e.jsx("p",{className:"w",children:r.what}),e.jsxs("dl",{className:"io",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"runs"}),e.jsx("dd",{children:e.jsx("b",{children:r.runs})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"reads"}),e.jsx("dd",{children:r.reads})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"changes"}),e.jsx("dd",{children:r.writes})]})]}),e.jsxs("button",{className:"m-cta-line",style:{padding:"8px 14px",fontSize:12,alignSelf:"flex-start"},onClick:()=>t(r),"aria-label":"Start: "+r.t,children:[MIcons.play(12)," Start"]})]},r.id))})]})}const Ys=[{k:"Daily rhythm",ids:["/morning","/plan-tomorrow","/log","/analyse-day","/reboot","/overview"]},{k:"Strategy",ids:["/review-week","/pivot-strategy","/refactor-plan","/ignite","/experiment","/research"]},{k:"Knowledge",ids:["/capture","/harvest","/debrief","/mover-ideas","/screenshot","/history"]},{k:"System",ids:["/setup","/walkthrough","/update","/migrate","/mover-check","/mover-report","/debug-resistance"]}];function zc(n){const t=Ys.map(a=>({k:a.k,items:[]})),s={k:"More",items:[]};return n.forEach(a=>{const r=Ys.findIndex(i=>i.ids.includes(a.c));r>=0?t[r].items.push(a):s.items.push(a)}),s.items.length&&t.push(s),t.filter(a=>a.items.length>0)}function Vc(){const[n,t]=React.useState(!1),s=window.V3B&&window.V3B.commands||[],a=zc(s);return e.jsxs("section",{className:"m4-sec","data-screen-label":"Run, all commands",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"All commands"}),e.jsx(Hint,{what:"The raw list, for power users. Everything here is already covered by the cards above.",src:"CLI registry + Workflows/"}),e.jsx("div",{className:"tools",children:e.jsxs("button",{className:"m-link v5r-cmdtoggle"+(n?" is-open":""),onClick:()=>t(!n),"aria-expanded":n,children:[e.jsx("span",{className:"chev",children:MIcons.arrow(12)}),n?"Hide":"Show"," ",s.length," commands",e.jsx("span",{className:"adv",children:"advanced"})]})})]}),n?e.jsx("div",{className:"v5r-cmdgroups",children:a.map(r=>e.jsxs("div",{className:"v5r-cmdgroup",children:[e.jsx("span",{className:"gk",children:r.k}),r.items.map(i=>e.jsxs("div",{className:"m-cmd",children:[e.jsx("button",{className:"c m-x",onClick:()=>openXray("Command "+i.c,i.what,"workflows"),children:i.c}),e.jsxs("span",{children:[e.jsx("span",{className:"w",children:i.what}),e.jsxs("span",{className:"io",style:{display:"block"},children:["reads ",i.reads," to changes ",i.writes]})]}),e.jsx("span",{className:"meta",children:i.last&&i.last!=="—"?e.jsxs("span",{children:["last ",i.last]}):null})]},i.c))]},r.k))}):null]})}function Wc({D:n,onNav:t,focus:s,rollout:a}){const r=useSimLoad("run"),i=at(),[l,o]=useStored3("m5.runmode","watch"),[c,d]=useStored3("m5.agent","claude"),[u,h]=useStored3("m5.care","ask"),p=a==="new",m=(i.agents.find(A=>A.id===c)||i.agents[0]).name,[g,f]=React.useState(()=>[{key:"ex1",type:"session",job:i.exampleJob,agentName:"Claude Code",mirrored:!1},{key:"ex2",type:"conversation",job:i.jobs.find(A=>A.id==="close_day"),agentName:"Claude Code"},{key:"ex3",type:"watched"}]),v=A=>f(I=>I.filter(k=>k.key!==A)),x=A=>{const I=A.toLowerCase(),S={"plan today":"plan_today","close the day":"close_day","review my code":"review_code","research a decision":"research"}[I],E=S?i.jobs.find(w=>w.id===S):null;if(E){b(E);return}const L=l==="watch"||c==="terminal";f(w=>[{key:"s"+Date.now(),type:"session",job:Pc(A,m),agentName:c==="terminal"?"Your terminal":m,mirrored:L},...w])},b=A=>{if(A.kind==="focus"){s.state==="idle"?s.start():s.openOverlay();return}const I=l==="watch"||c==="terminal",k=A.kind==="conversation"?"conversation":"session";f(S=>S.some(E=>E.job&&E.job.id===A.id&&E.key.startsWith("s"))?S:[{key:"s"+Date.now(),type:k,job:A,agentName:c==="terminal"?"Your terminal":m,mirrored:I},...S])};if(r)return e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:180,borderRadius:16}}),e.jsx("div",{className:"m4-skel",style:{height:380,borderRadius:"var(--m-r)"}})]});const j=s.state==="running"||s.state==="paused";return e.jsxs("div",{className:"m-wrap",children:[e.jsx(LiveFeed,{onNav:t}),e.jsx("div",{style:{marginTop:22},children:e.jsx(Dc,{rollout:a,mode:l,setMode:o,agent:c,setAgent:d,care:u,setCare:h,onSpawn:x})}),e.jsx(MovesMap,{onNav:t}),j?e.jsxs("div",{className:"m4r-live m-rise",style:{"--i":1,marginTop:18},children:[e.jsx("span",{className:"m-dot is-live"}),e.jsx("span",{className:"t",children:s.clock}),e.jsx("span",{style:{color:"var(--m-ink-1)"},children:"Focus session in progress"}),e.jsxs("button",{className:"m-cta-line",style:{marginLeft:"auto",padding:"8px 14px",fontSize:12},onClick:s.openOverlay,children:["Open it ",MIcons.arrow(13)]})]}):null,e.jsxs("div",{className:"v5r"+(p?" is-single":""),style:{marginTop:22},children:[e.jsxs("div",{className:"v5r-main",children:[e.jsxs("div",{className:"m4-sec-head",style:{marginBottom:4},children:[e.jsx("span",{className:"m-kicker",children:"Sessions"}),e.jsx(Hint,{what:"Each card is one piece of work: the plan first, then every step as it happens, then a receipt.",doing:"Work you do in your own terminal shows up here too, so everything lands in one place.",src:".claude/sessions · session reader"})]}),g.map(A=>A.type==="watched"?e.jsx(WatchedCard,{s:i.terminalWatch,onNav:t},A.key):A.type==="conversation"?e.jsx(ConversationCard,{job:A.job,agentName:A.agentName,onNav:t,onClose:()=>v(A.key)},A.key):e.jsx(SessionCard,{job:A.job,agentName:A.agentName,mirrored:A.mirrored,onNav:t,onClose:()=>v(A.key)},A.key))]}),p?null:e.jsx(Fc,{onNav:t})]}),e.jsx(_c,{rollout:a,onStart:b}),a==="full"?e.jsx(Vc,{}):null]})}Object.assign(window,{RunView:Wc});const qs=[{id:"index",k:"What's in here"},{id:"graph",k:"What's driving this"},{id:"voice",k:"Your writing voice"}];function Bc({L:n,group:t,setGroup:s}){return e.jsx("div",{className:"m4l-bento","data-screen-label":"Library, what's in this system",children:n.bento.map(a=>e.jsxs("button",{className:"m4l-cell"+(t===a.k?" is-on":""),onClick:()=>s(t===a.k?"All":a.k),children:[e.jsx("span",{className:"n m-num",children:a.n}),e.jsx("span",{className:"k",children:a.k}),e.jsx("span",{className:"l",children:a.line})]},a.k))})}function Hc({L:n,sparse:t}){const[s,a]=useStored3("m4.libgroup","All"),[r,i]=React.useState(""),l=(n.bento.find(c=>c.k===s)||{}).types||null,o=n.items.filter(c=>(!l||l.includes(c.g))&&(!r||(c.t+" "+c.sum+" "+c.path).toLowerCase().includes(r.toLowerCase())));return e.jsxs(React.Fragment,{children:[t?e.jsx("p",{className:"m4-sub",style:{margin:0},children:window.V4LSPARSE.note}):e.jsxs("div",{className:"m4l-ledge",children:[e.jsx("span",{className:"n m-num",children:n.indexedCount}),e.jsx("span",{className:"u",children:"indexed"}),e.jsx("span",{className:"sep","aria-hidden":"true"}),e.jsx("span",{className:"hint",children:"Pick a shelf or search."})]}),e.jsx(Bc,{L:n,group:s,setGroup:a}),e.jsxs("div",{className:"m4l-search",children:[MIcons.search(15),e.jsx("input",{value:r,onChange:c=>i(c.target.value),placeholder:s==="All"?"Search everything…":"Search "+s.toLowerCase()+"…","aria-label":"Search the vault"}),e.jsxs("span",{className:"m4-aside m-num",children:[o.length," shown",s!=="All"?" · ":"",s!=="All"?e.jsx("button",{className:"m-link",onClick:()=>a("All"),children:"show all"}):null]})]}),e.jsxs("section",{"data-screen-label":"Library, index",children:[o.map(c=>e.jsxs("div",{className:"m4l-row"+(c.stale?" is-stale":""),children:[e.jsxs("span",{children:[e.jsxs("span",{className:"t",children:[e.jsx("span",{className:"g",children:c.g}),c.t,c.stale?e.jsx("span",{className:"m4-sr",children:"stale"}):null]}),e.jsxs("span",{className:"path",children:[c.path," · ",c.mod]})]}),e.jsx("span",{className:"sum",children:c.redacted?e.jsxs("span",{children:[e.jsx("span",{className:"m4-redact",children:"redacted on this surface"})," · ",c.sum]}):c.sum}),c.usedBy!=="—"?e.jsxs("span",{className:"use",children:["used by ",e.jsx("b",{children:c.usedBy})]}):null,e.jsxs("span",{className:"acts",children:[e.jsxs("button",{className:"m-mini",onClick:()=>openXray(c.t,c.sum,c.src),"aria-label":"Where is "+c.t+" from?",children:[MIcons.xray(11)," Where's this from?"]}),e.jsx($c,{label:c.t})]})]},c.path)),o.length?null:e.jsx(Empty,{title:"Nothing matches.",line:"Try another shelf, or clear the search. Nothing is hidden; everything in here is indexed."})]})]})}function $c({label:n}){const[t,s]=React.useState(!1);return t?e.jsxs("span",{style:{fontSize:10.5,color:"var(--m-good)",display:"inline-flex",gap:5,alignItems:"center"},children:[MIcons.check(11)," opened"]}):e.jsx("button",{className:"m-mini",onClick:()=>s(!0),"aria-label":n?"Open "+n:"Open",children:"open"})}function Xc({L:n,sparse:t}){const[s,a]=React.useState("The Bet"),r=React.useRef(null),[i,l]=React.useState([]),o=n.graph,c=o.traces[s]||null,d=n.graphStat,u=d?d.files+" files, "+d.edges+" edges drive the dashboard":"Live map of which files drive the dashboard.",h=(p,m)=>c?p===2?m===s:p===1?c.eng.includes(m):c.inp.includes(m):!1;return React.useEffect(()=>{if(t)return;const p=()=>{const g=r.current;if(!g)return;const f=g.getBoundingClientRect(),v=[],x=(b,j)=>{const A=g.querySelector('[data-gn="'+b+"-"+j+'"]');if(!A)return null;const I=A.getBoundingClientRect();return{l:I.left-f.left,r:I.right-f.left,y:I.top-f.top+I.height/2}};o.e01.forEach(([b,j])=>{const A=x(0,b),I=x(1,j);A&&I&&v.push({x1:A.r,y1:A.y,x2:I.l,y2:I.y,lit:h(0,o.cols[0].nodes[b])&&h(1,o.cols[1].nodes[j])})}),o.e12.forEach(([b,j])=>{const A=x(1,b),I=x(2,j);A&&I&&v.push({x1:A.r,y1:A.y,x2:I.l,y2:I.y,lit:h(1,o.cols[1].nodes[b])&&h(2,o.cols[2].nodes[j])})}),l(v)},m=setTimeout(p,80);return window.addEventListener("resize",p),()=>{clearTimeout(m),window.removeEventListener("resize",p)}},[s,t]),t?e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"What's driving this"}),e.jsx(Hint,{what:"Which files are powering the dashboard right now, drawn as a simple three-column flow.",src:"vault-graph-parser.js"})]}),e.jsx(Empty,{title:"This is waiting on a sync.",line:window.V4LSPARSE.graphEmpty,action:"Index your files",cmd:"moveros sync"})]}):e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, vault graph",children:[e.jsxs("div",{className:"m4-sec-head m4l-ghead",children:[e.jsx("span",{className:"m-kicker",children:"What's driving this"}),e.jsx(Hint,{what:"One question, answered clearly: which files are powering the dashboard right now?",doing:"Pick something on screen to trace it back through your files to what produced it.",src:"src/parsers/vault-graph-parser.js"}),e.jsxs("div",{className:"m4l-tracepick",role:"group","aria-label":"Trace a surface back to its files",children:[e.jsx("span",{className:"tk",children:"Trace"}),Object.keys(o.traces).map(p=>e.jsx("button",{className:"m-mini"+(p===s?" is-on":""),"aria-pressed":p===s,onClick:()=>a(p),children:p},p))]}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Vault graph",u,"vaultgraph"),children:"vault-graph-parser · live"})})]}),e.jsx("div",{className:"m4l-graph",children:e.jsxs("div",{className:"m4l-gcols",ref:r,children:[e.jsx("svg",{className:"m4l-gsvg","aria-hidden":"true",children:i.map((p,m)=>e.jsx("line",{x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,className:p.lit?"is-lit":""},m))}),o.cols.map((p,m)=>e.jsxs("div",{className:"m4l-gcol",children:[e.jsx("div",{className:"ck",children:p.k}),p.nodes.map((g,f)=>{const v=h(m,g),x=c&&!v,b=m===2&&!o.traces[g];return e.jsxs("button",{"data-gn":m+"-"+f,"aria-disabled":b?!0:void 0,className:"m4l-gnode"+(v?" is-lit":"")+(x?" is-dim":""),"aria-label":m===2?o.traces[g]?"Trace "+g+" back to its files":g:"Open "+g,onClick:()=>m===2?a(o.traces[g]?g:s):openXray("Graph node: "+g,"Feeds "+(m===0?"your record":"the dashboard"),o.src),children:[g,m===1?e.jsx("span",{className:"mono",children:"02_Areas/Engine/"}):null]},g)})]},p.k))]})}),e.jsxs("div",{className:"m4l-tracebar",role:"note","aria-label":"How "+s+" is built",children:[e.jsx("span",{className:"nm",children:s}),e.jsx("span",{className:"cn",children:"via"}),((o.traces[s]||{}).eng||[]).map(p=>e.jsx("span",{className:"f",children:p},p)),e.jsx("span",{className:"cn",children:"from"}),((o.traces[s]||{}).inp||[]).map(p=>e.jsx("span",{className:"f",children:p},p))]})]})}function Yc({L:n}){const t=e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Your writing voice"}),e.jsx(Hint,{what:"How your writing sounds. Your helpers draft in this voice instead of generic AI prose.",src:"02_Areas/Engine/Voice_DNA.md · voice-dna-parser"}),e.jsx("div",{className:"tools",children:e.jsx("button",{className:"m4e-srcchip m-x",onClick:()=>openXray("Voice DNA",n.voice.calibration,"voice"),children:"voice-dna-parser · live"})})]});return n.voice.lines.length?e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[t,e.jsxs("div",{style:{maxWidth:560},children:[n.voice.lines.map(s=>e.jsx("p",{style:{fontFamily:"var(--m-serif)",fontSize:22,lineHeight:1.35,padding:"10px 0",borderTop:"1px solid var(--m-line)"},children:s},s)),e.jsxs("p",{className:"m4-sub",style:{marginTop:10},children:[n.voice.calibration," Recalibrate in Settings, Profile."]})]})]}):e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[t,e.jsx(Empty,{title:"No voice calibration yet.",line:n.voice.calibration,action:"Harvest your Voice_DNA.md",cmd:"/harvest Voice_DNA.md"})]})}function qc({D:n,onNav:t}){const s=useSimLoad("library"),a=n.__sparse,[r,i]=useStored3("m4.liblens","index"),l=qs.some(o=>o.id===r)?r:"index";return s?e.jsxs("div",{className:"m-wrap","aria-hidden":"true",children:[e.jsx("div",{className:"m4-skel",style:{height:50,borderRadius:14}}),e.jsx("div",{className:"m4-skel",style:{height:460,borderRadius:"var(--m-r)"}})]}):e.jsx("div",{className:"m-wrap",children:e.jsxs("div",{className:"m4l-room",children:[e.jsx("nav",{className:"m4e-lenses",role:"tablist","aria-label":"Library lenses",children:qs.map(o=>e.jsx("button",{role:"tab","aria-selected":l===o.id,className:"m4e-lens"+(l===o.id?" is-on":""),onClick:()=>i(o.id),"data-coach":o.id==="graph"?"libgraph":null,children:o.k},o.id))}),e.jsxs("div",{className:"m4l-main",role:"tabpanel","data-coach":"libindex",children:[l==="index"?e.jsx(Hc,{L:window.V4L,sparse:a}):null,l==="graph"?e.jsx(Xc,{L:window.V4L,sparse:a}):null,l==="voice"?e.jsx(Yc,{L:window.V4L}):null]})]})})}Object.assign(window,{LibraryView:qc});function Be({title:n,hint:t,hintSrc:s,hintDo:a,children:r,coach:i}){return e.jsxs("section",{className:"m4c-sec","data-screen-label":"Settings: "+n,"data-coach":i,children:[e.jsxs("div",{className:"m4-sec-head",style:{marginBottom:10},children:[e.jsx("span",{className:"m-kicker",children:n}),t?e.jsx(Hint,{what:t,src:s,doing:a}):null]}),r]})}function Rr({on:n,onChange:t,label:s}){return e.jsx("button",{className:"m4c-tog"+(n?" is-on":""),role:"switch","aria-checked":n,"aria-label":s,onClick:()=>t(!n),children:e.jsx("i",{})})}function Uc(){const[n,t]=useStored3("m4.lens","everyday"),s=window.M4LENS[n]||window.M4LENS.everyday,[a,r]=useStored3("m4.lens.custom",{bet:"The Wager",seal:"The Closing",receipts:"The Trail"}),i=n==="custom"?Object.assign({},s,{betKicker:a.bet,sealKicker:a.seal,receipts:a.receipts,sealPrompt:"What was today, in your words?"}):s,l=React.useCallback(async c=>{try{const d=await(await fetch("/api/health")).json();await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":d.token},body:JSON.stringify(c)})}catch{}},[]);React.useEffect(()=>{(async()=>{try{const c=await(await fetch("/api/health")).json(),d=await(await fetch("/api/config",{headers:{"X-Mover-Token":c.token}})).json(),u=d&&d.ok&&d.config;u&&u.lens&&u.lens!==n&&t(u.lens),u&&u.lensCustom&&r(Object.assign({},a,u.lensCustom))}catch{}})()},[]);const o=c=>{t(c),l({lens:c})};return e.jsxs(Be,{title:"Your words",coach:"lens",hint:"Pick the words that fit you. The app stays the same; only the wording changes.",hintDo:"Everyday is the default. The Muslim wording is opt-in only, never forced.",hintSrc:"Settings · word map",children:[e.jsx("div",{className:"m4c-lenses",role:"radiogroup","aria-label":"Worldview lens",children:Object.entries(window.M4LENS).map(([c,d])=>e.jsxs("button",{className:"m4c-lens"+(n===c?" is-on":""),role:"radio","aria-checked":n===c,onClick:()=>o(c),children:[e.jsx("span",{className:"n",children:d.name}),e.jsx("span",{className:"w",children:d.who}),e.jsx("span",{className:"terms",children:d.terms.join(" · ")})]},c))}),n==="custom"?e.jsx("div",{className:"m4c-customwords",children:[["bet","the commitment"],["seal","the closeout"],["receipts","the proof"]].map(([c,d])=>e.jsxs("label",{className:"m4c-cwf",children:[e.jsxs("span",{className:"lbl",children:["Your word for ",d]}),e.jsx("input",{className:"m4t-free",style:{minHeight:0,padding:"10px 14px"},value:a[c],onChange:u=>r(Object.assign({},a,{[c]:u.target.value})),onBlur:()=>l({lensCustom:a})})]},c))}):null,e.jsxs("div",{className:"m4c-preview",children:[e.jsxs("div",{className:"bar",children:[MIcons.spark(12)," Preview · this is how Home and the nightly check-in read in the ",i.name," wording"]}),e.jsxs("div",{className:"inn",children:[e.jsxs("span",{className:"pk",children:[i.betKicker," · day 17 of 90"]}),e.jsx("p",{className:"pl m-serif",children:i.betLine}),e.jsxs("p",{className:"ps",children:[e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:i.sealKicker}),", tonight: “",i.sealPrompt,"” · proof column header: ",e.jsx("b",{style:{fontWeight:500,color:"var(--m-ink-1)"},children:i.receipts})]})]})]}),e.jsx("p",{className:"m4-sub",style:{marginTop:10},children:"Applied live to the Home proof column and the nightly check-in. Nothing about your record itself changes."})]})}function Kc(){const[n,t]=useStored3("m4.guided.done",!1);return e.jsxs(Be,{title:"Walkthrough",coach:"guided",hint:"Walks you through each part of the dashboard, pointing at the real thing on screen.",hintDo:"On the first time you open the dashboard. Restart it here any time.",hintSrc:"Settings · walkthrough",children:[e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["Walkthrough",e.jsx("span",{className:"s",children:"A guide showing you around your own record. A few stops, skippable."})]}),e.jsx("span",{className:"v",children:n?"finished or skipped":"on · starts on Home"}),e.jsx(Rr,{on:!n,label:"Walkthrough",onChange:s=>{t(!s),window.dispatchEvent(new CustomEvent(s?"m4tour":"m4tour-off"))}})]}),e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["Show me the intro again",e.jsx("span",{className:"s",children:"Starts from the welcome, right now."})]}),e.jsx("span",{className:"v"}),e.jsxs("button",{className:"m-cta-line",style:{padding:"9px 16px",fontSize:12.5},onClick:()=>{t(!1),window.dispatchEvent(new CustomEvent("m4tour"))},children:[MIcons.spark(13)," Show me around"]})]})]})}function Jc({sparse:n}){const t=window.V4C.oath,[s,a]=React.useState(t.consequences[0]),[r,i]=React.useState(t.tone.current);return e.jsxs(Be,{title:"Promises with stakes",hint:"A rare, opt-in tool: a promise you lock in, with a consequence you choose up front and a way to make it right.",hintDo:"It never fires on ordinary slip-ups. One possible consequence: the system stops saying 'we' until you've made it right.",hintSrc:"Oaths.md · oath-parser (partial)",children:[n?e.jsx("p",{className:"m4-sub",children:window.V4CSPARSE.oathNote}):e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["Active promise",e.jsxs("span",{className:"s",children:[t.active.sealed," · ",t.history]})]}),e.jsxs("span",{className:"v",children:[e.jsx("span",{style:{fontFamily:"var(--m-serif)",fontSize:17,color:"var(--m-ink)"},children:t.active.line}),e.jsxs("span",{style:{display:"block",marginTop:5},children:["If you break it: ",t.active.repair]})]}),e.jsxs("span",{className:"m-chip is-good",children:[t.active.state," · ",t.active.left]})]}),e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["What happens if you break it",e.jsx("span",{className:"s",children:"You pick this before you lock the promise in. Never imposed."})]}),e.jsx("span",{className:"v",style:{display:"flex",gap:7,flexWrap:"wrap"},children:t.consequences.map(l=>e.jsx("button",{className:"m-mini","aria-pressed":l===s,style:l===s?{color:"var(--m-gold-2)",borderColor:"var(--m-gold-line)",background:"var(--m-gold-soft)"}:null,onClick:()=>a(l),children:l},l))}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["How it talks to you",e.jsx("span",{className:"s",children:"The everyday tone. A broken promise temporarily overrides it."})]}),e.jsx("span",{className:"v",style:{display:"flex",gap:7,flexWrap:"wrap"},children:t.tone.options.map(l=>e.jsx("button",{className:"m-mini","aria-pressed":l===r,style:l===r?{color:"var(--m-gold-2)",borderColor:"var(--m-gold-line)",background:"var(--m-gold-soft)"}:null,onClick:()=>i(l),children:l},l))}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-wd",children:[e.jsxs("div",{className:"v",children:[e.jsxs("span",{className:"lk",children:["NORMAL · “",r,"”"]}),t.withdrawalDemo.warm]}),e.jsxs("div",{className:"v is-cold",children:[e.jsx("span",{className:"lk",children:"AFTER A BROKEN PROMISE · STOPS SAYING “WE” FOR 48H"}),t.withdrawalDemo.cold]})]})]})}function Gc({C:n}){const t=n.agents;return e.jsxs(Be,{title:"Your agents",hint:"The AI tools connected to this system: what they watch and what that costs.",hintDo:"Connecting one is optional. The dashboard works fine just watching your terminal.",hintSrc:"CLI registry · agents",children:[t.list.map(s=>e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:[s.k,e.jsx("span",{className:"s",children:s.line})]}),e.jsx("span",{className:"v"}),e.jsx("span",{className:"m-chip "+(s.state==="connected"?"is-good":"is-mute"),children:s.state})]},s.k)),e.jsxs("div",{className:"m4c-cost2",role:"note","aria-label":"Connecting and cost",children:[e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"To connect one"}),e.jsx("span",{className:"vv",children:"install its CLI; it appears here on the next check"})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"Terminal watch"}),e.jsx("span",{className:"vv",children:"free, no credits"})]}),e.jsxs("div",{className:"row",children:[e.jsx("span",{className:"lk",children:"In dashboard"}),e.jsx("span",{className:"vv",children:"uses agent credits"})]})]})]})}const Qc=[{id:"settings",k:"Settings"},{id:"profile",k:"Profile"},{id:"words",k:"Words"},{id:"privacy",k:"Privacy"},{id:"agents",k:"Agents"},{id:"apps",k:"Integrations"},{id:"system",k:"System"},{id:"advanced",k:"Advanced"}];function Zc(){const[n,t]=React.useState("idle"),s=()=>{t("running"),fetch("/api/health").then(a=>a.json()).then(a=>fetch("/api/refresh",{method:"POST",headers:{"X-Mover-Token":a&&a.token}})).then(a=>{if(!a.ok)throw new Error("HTTP "+a.status);window.location.reload()}).catch(a=>{console.warn("check now failed",a),t("fail")})};return e.jsx("button",{className:"m-mini",onClick:s,disabled:n==="running",children:n==="running"?"re-reading the vault…":n==="fail"?"couldn't re-check, try again":"check now"})}function ed({D:n,onNav:t}){const s=useSimLoad("configure"),a=n.__sparse,r=window.V4C,i=a?window.V4CSPARSE.engineHealth:r.engineHealth,[l,o]=React.useState(!1),[c,d]=useStored3("m4.cfgtab","settings"),u=Qc.filter(m=>m.id!=="settings"||typeof window.V8Prefs=="function"),h=u[0]?u[0].id:"profile",p=u.some(m=>m.id===c)?c:h;return React.useEffect(()=>{const m=g=>{const f=g.detail||"";f.includes('"lens"')&&d("words"),f.includes('"guided"')&&d("profile"),f.includes("configure-system")&&d("system"),f.includes("configure-settings")&&d("settings")};return window.addEventListener("m4-coach-seek",m),()=>window.removeEventListener("m4-coach-seek",m)},[]),s?e.jsx("div",{className:"m-wrap","aria-hidden":"true",children:e.jsxs("div",{className:"m4c-ledger",children:[e.jsx("div",{className:"m4-skel",style:{height:120,borderRadius:16}}),e.jsx("div",{className:"m4-skel",style:{height:280,marginTop:24}})]})}):e.jsx("div",{className:"m-wrap",children:e.jsxs("div",{className:"m4c-ledger",children:[e.jsx("nav",{className:"m4c-tabs","aria-label":"Settings sections",children:u.map(m=>e.jsx("button",{className:"m-lib-tab"+(p===m.id?" is-on":""),onClick:()=>d(m.id),children:m.k},m.id))}),p==="settings"&&typeof window.V8Prefs=="function"?e.jsx(window.V8Prefs,{}):null,p==="profile"?e.jsxs(React.Fragment,{children:[e.jsxs(Be,{title:"Profile",hint:"Who this record belongs to, and the list of strengths your advisors argue from.",hintSrc:"Architect_Dossier.md · dossier-parser",children:[e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",children:"Operator"}),e.jsx("span",{className:"v",children:[r.profile.name,r.profile.tz,r.profile.boundary].filter(Boolean).join(" · ")}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-row",style:{alignItems:"start"},children:[e.jsxs("span",{className:"k",children:["Your strengths",e.jsx("span",{className:"s",children:"Shown in full only here. Hidden everywhere else."})]}),e.jsx("span",{className:"v",children:e.jsx(X,{claim:"Your strengths",value:r.profile.dossier,src:"dossier",children:r.profile.dossier})}),e.jsxs("button",{className:"m-mini",onClick:()=>openXray("Your strengths",r.profile.dossier,"dossier"),children:[MIcons.xray(11)," Source"]})]}),e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["Your writing voice",e.jsx("span",{className:"s",children:"How your writing sounds. Browse it in Library."})]}),e.jsx("span",{className:"v",children:e.jsx("span",{className:"m-chip"+(r.profile.voiceState==="no calibration yet"?" is-mute":""),children:r.profile.voiceState})}),e.jsx("button",{className:"m-mini",onClick:()=>t("library"),children:"open in Library"})]})]}),e.jsx(Kc,{})]}):null,p==="words"?e.jsx(Uc,{}):null,p==="privacy"?e.jsx(Be,{title:"Privacy",hint:"What stays sealed, what gets hidden, and what never leaves your machine.",hintSrc:"Settings · redaction rules",children:r.privacy.map(m=>e.jsx(nd,{p:m},m.k))}):null,p==="agents"?e.jsx(Gc,{C:r}):null,p==="apps"?e.jsx(Be,{title:"Connected apps",hint:"Wearables are optional, not the core. Manual logs and the numbers you already have come first.",hintSrc:"Settings · integrations",children:r.integrations.map(m=>e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",children:m.k}),e.jsx("span",{className:"v",children:m.line}),e.jsx("span",{className:"m-chip "+(m.state==="connected"?"is-good":"is-mute"),children:m.state})]},m.k))}):null,p==="system"?e.jsxs(React.Fragment,{children:[e.jsx(RecordCheckSection,{}),e.jsxs(Be,{title:"Where your files live",coach:"configure-system",hint:"Everything here is plain files on your machine. Yours to read, move, or take elsewhere.",hintSrc:"vault · moveros doctor",children:[e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",children:"Your vault"}),e.jsx("span",{className:"v m-mono",style:{fontSize:12},children:window.MSTATE&&window.MSTATE.vaultPath?window.MSTATE.vaultPath+", plain Markdown, no lock-in":"not detected yet, plain Markdown, no lock-in"}),e.jsx("span",{})]}),e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:["System check",e.jsx("span",{className:"s",children:"Looks for broken parsers, hooks and paths."})]}),e.jsx("span",{className:"v",children:(()=>{if(!i.length)return e.jsx("span",{className:"m-chip is-mute",children:"not checked yet"});const m=i.filter(g=>g.state==="stale").length;return m>0?e.jsxs("span",{className:"m-chip is-warn",children:[m," need attention"]}):e.jsx("span",{className:"m-chip is-good",children:"all clear"})})()}),e.jsx(Zc,{})]})]}),e.jsx(Be,{title:"File freshness",hint:"How up to date the files the whole dashboard reads are. A stale strategy is why the 'Adjust' step glows on the cycle.",hintSrc:"Engine/ · moveros doctor",children:i.map(m=>e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k m-mono",style:{fontSize:12},children:m.f}),e.jsx("span",{className:"v",children:m.age}),e.jsx("button",{className:"m-chip "+(m.state==="stale"?"is-warn":m.state==="live"?"":"is-good"),onClick:()=>openXray("File health: "+m.f,m.age,m.src),children:m.state})]},m.f))})]}):null,p==="advanced"?e.jsxs(React.Fragment,{children:[e.jsx(Jc,{sparse:a}),e.jsx(Be,{title:"Your tweaks",hint:"Changes you've made to how the system works, saved so updates respect them.",hintSrc:"Active_Context.md ## My Customizations",children:a?e.jsx("p",{className:"m4-sub",children:window.V4CSPARSE.customizationsEmpty}):r.customizations.map(m=>e.jsxs("div",{className:"m4c-row",children:[e.jsx("span",{className:"k",style:{fontWeight:400,color:"var(--m-ink-2)"},children:m}),e.jsx("span",{}),e.jsx("button",{className:"m-mini",onClick:()=>openXray("Customization",m,"customizations"),children:MIcons.xray(11)})]},m))}),e.jsx(Be,{title:"Danger zone",hint:"Slow, reversible where possible, and always saved.",hintSrc:"Settings",children:e.jsx("div",{className:"m4c-danger",children:e.jsxs("div",{className:"m4c-row",style:{borderTop:"none"},children:[e.jsxs("span",{className:"k m-crit",children:["Reset learnings",e.jsx("span",{className:"s",children:"Wipes Auto_Learnings.md. Patterns rebuild from zero. Buried ideas are never touched."})]}),e.jsx("span",{className:"v","aria-live":"polite",children:l?e.jsxs("span",{className:"m-warn",children:["Queued. A backup writes first: 04_Archives/learnings-",new Date().toISOString().slice(0,10),".md"]}):""}),e.jsx("button",{className:"m-mini","aria-expanded":l,style:{borderColor:"rgba(217,128,105,0.4)",color:"var(--m-crit)"},onClick:()=>o(!0),children:l?"queued":"reset…"})]})})})]}):null]})})}function nd({p:n}){const[t,s]=React.useState(n.on);return e.jsxs("div",{className:"m4c-row",children:[e.jsxs("span",{className:"k",children:[n.k,n.note?e.jsx("span",{className:"s",children:n.note}):null]}),e.jsx("span",{className:"v",children:n.v}),e.jsx(Rr,{on:t,onChange:s,label:n.k})]})}Object.assign(window,{ConfigureView:ed});const td=[{id:"bet",chapter:"Home",route:"home",sel:'[data-coach="bet"], [data-coach="home-hero"]',side:"right",t:"Your bet",l:"Your one promise in plain words: do this, and this happens by a date. It's read straight from your Strategy file, and tapping it opens the whole thing."},{id:"say-it-hero",chapter:"Home",route:"home",sel:'[data-coach="say-it-hero"]',side:"bottom",t:"Say what you want",l:"Type a plain sentence and the system routes it to the right action or screen. No commands to memorize; it reads your intent and moves you."},{id:"home-signals",chapter:"Home",route:"home",sel:'[data-coach="home-signals"]',side:"bottom",t:"Today's signals",l:"Three honest gauges: your Single Test, this week's distribution, and how calibrated you are. A dash means it isn't measured yet, never a guess."},{id:"runnext",chapter:"Home",route:"home",sel:'[data-coach="runnext"]',side:"right",t:"What to do next",l:"The single highest-leverage thing right now, with the why, the time, and the files it touches. Pulled from your plan and strategy, not invented."},{id:"xray",chapter:"Home",route:"home",sel:'[data-coach="xray-demo"]',side:"left",interactive:!0,t:"See where anything comes from",l:"Nothing here is decoration: every number opens to the file it came from. Try it, click “Where this came from.” (Esc closes it again.)"},{id:"receipts",chapter:"Home",route:"home",sel:'[data-coach="receipts"]',side:"left",t:"Receipts",l:"Proof of what you actually did today, logged for you as you work. This is today's; Evidence holds the full set, checkable down to the file."},{id:"strategy-bet",chapter:"Strategy",route:"strategy",sel:'[data-coach="strategy-bet"]',side:"bottom",t:"The bet, as a contract",l:"Your live bet written like a signed resolution: the claim, the measured number against target, the risk, and the line that kills it. All from your Strategy file."},{id:"strategy-engine",chapter:"Strategy",route:"strategy",sel:'[data-coach="strategy-engine"], [data-coach="loop"]',side:"bottom",t:"The operating loop",l:"Every stage of your system as one pipeline, each run by a workflow and writing one file. A stage glows when it's stalled, so your eye lands on what's blocked."},{id:"lab",chapter:"Strategy",route:"strategy",sel:'[data-coach="lab"]',side:"bottom",t:"Experiments",l:"Small tests with a start, an end, and a verdict. Each is a real file in your vault; nothing reaches the bet without evidence behind it."},{id:"strategy-pivot-gate",chapter:"Strategy",route:"strategy",sel:'[data-coach="strategy-pivot-gate"], [data-coach="pushback"]',side:"bottom",t:"Should the bet keep running?",l:"One honest read on whether to hold or pivot, fusing your numbers with what your advisor files actually say. Dissent surfaces first, not last."},{id:"graveyard",chapter:"Strategy",route:"strategy",sel:'[data-coach="graveyard"]',side:"top",t:"Buried ideas",l:"Ideas that died, kept as lessons with what each one cost. New ideas get checked against these before they quietly sneak back in."},{id:"evidence-instrument",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-instrument"]',side:"bottom",t:"The record",l:"A timeline of your real work beats and what you shipped, day by day. Scrub to any day and the whole screen answers for it."},{id:"evidence-readout",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-readout"]',side:"bottom",t:"The read-out",l:"The selected day in full: the biggest signal, the flagged findings, and every receipt with its source. All from your logged record, nothing inferred."},{id:"evidence-dossier",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-dossier"]',side:"top",t:"The dossier",l:"A self-answering index of every metric this dashboard claims, each row showing its own number. Open one to check the working behind it."},{id:"evidence-coverage",chapter:"Evidence",route:"evidence",sel:'[data-coach="evidence-coverage"]',side:"top",t:"How honest this is",l:"How many of the parsers behind these numbers are live versus still planned. The system tells you what it can't prove yet, out loud."},{id:"run-launcher",chapter:"Run",route:"run",sel:'[data-coach="run-launcher"]',side:"bottom",t:"Run a task",l:"Say what you want done in plain words, or pick a workflow. It runs your real agent at your vault and streams the work back to you here."},{id:"run-terminal-list",chapter:"Run",route:"run",sel:'[data-coach="run-terminal-list"]',side:"top",t:"Watch it work",l:"Every run shows the live agent stream, plain and interruptible. You see each step as it happens, not just a result at the end."},{id:"run-workflow-shelf",chapter:"Run",route:"run",sel:'[data-coach="run-workflow-shelf"]',side:"top",t:"Your workflows",l:"All the commands that drive the system, each showing what it reads, what it changes, and its risk. One tap runs any of them and watches."},{id:"library-orrery",chapter:"Library",route:"library",sel:'[data-coach="library-orrery"]',side:"bottom",t:"What's connected",l:"Your vault as a map: the most-linked notes at the center, drawn from the real wiki-links between your files. Click a node to trace it."},{id:"library-index",chapter:"Library",route:"library",sel:'[data-coach="library-panel-index"]',side:"bottom",t:"What's in here",l:"The same library as a searchable catalog: every cheatsheet, principle, SOP, and entity, grouped by shelf. The map showed the connections; this is the contents."},{id:"library-voice",chapter:"Library",route:"library",sel:'[data-coach="library-panel-voice"]',side:"bottom",t:"Your writing voice",l:"Read from your Voice_DNA.md: the patterns that make writing sound like you, so anything the system drafts in your name matches your voice, not generic AI."},{id:"configure-settings",chapter:"Settings",route:"configure",sel:'[data-coach="configure-settings"]',side:"bottom",t:"Your settings",l:"The handful of keys the whole system reads: your name, vault, agent, review day, and more. Edits save straight to your config file."},{id:"configure-seal",chapter:"Settings",route:"configure",sel:'[data-coach="configure-seal"]',side:"right",t:"Local by default",l:"Your data stays on your machine; nothing is sent anywhere. Flip the preview to see exactly what gets hidden when you share a screen."},{id:"configure-system",chapter:"Settings",route:"configure",sel:'[data-coach="configure-system"]',side:"top",t:"Where your files live",l:"Plain Markdown on your machine, no lock-in. This tab also runs the system check that looks for broken parsers, hooks, and paths."}],Us=[{id:"model",eyebrow:"How it works · 1 of 3",t:"Three parts, one system.",l:"Your Engine is a set of plain files that hold who you are and what you're working toward. Your agent is how you talk to it. This dashboard is the window onto both, kept honest.",diagram:"model"},{id:"loop",eyebrow:"How it works · 2 of 3",t:"One loop, run every day.",l:"You drive the system with a short daily rhythm. Each step is a workflow you run in your agent, and each one writes its result back into your Engine files. Skip it and the system goes stale; run it and it compounds.",diagram:"loop"},{id:"files",eyebrow:"How it works · 3 of 3",t:"The files are the truth.",l:"The chat with your agent is temporary and fades each session. Your Engine files are permanent, and everything on this dashboard is read from them. When a session runs long, compaction refreshes the agent from those same files, so it never loses the thread.",diagram:"files"}];function sd({kind:n}){const t=(a,r,i)=>e.jsxs("div",{style:{flex:1,minWidth:0,textAlign:"center",padding:"14px 10px",borderRadius:12,border:"1px solid "+(i?"var(--m-gold-line)":"var(--m-line-2)"),background:i?"rgba(227,196,137,0.05)":"rgba(255,255,255,0.015)"},children:[e.jsx("div",{style:{fontSize:13.5,color:"var(--m-ink)",fontWeight:560},children:a}),e.jsx("div",{style:{fontSize:11,color:"var(--m-ink-3)",marginTop:3},children:r})]}),s=e.jsx("span",{style:{color:"var(--m-gold-2)",flex:"0 0 auto"},"aria-hidden":"true",children:MIcons.arrow(15)});if(n==="model")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:20},children:[t("Engine files","the brain",!0),s,t("Your agent","how you talk to it"),s,t("This dashboard","the window")]});if(n==="loop"){const a=["/morning","work","/log","/analyse-day","/plan-tomorrow"];return e.jsxs("div",{style:{marginTop:20},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",justifyContent:"center"},children:a.map((r,i)=>e.jsxs(React.Fragment,{children:[e.jsx("span",{style:{fontFamily:"var(--m-mono)",fontSize:12,padding:"6px 10px",borderRadius:8,border:"1px solid "+(i===0?"var(--m-gold-line)":"var(--m-line-2)"),color:i===0?"var(--m-gold-2)":"var(--m-ink-2)",whiteSpace:"nowrap"},children:r}),i<a.length-1?e.jsx("span",{style:{color:"var(--m-ink-3)",flex:"0 0 auto"},"aria-hidden":"true",children:MIcons.arrow(12)}):null]},r))}),e.jsx("div",{style:{textAlign:"center",fontSize:11.5,color:"var(--m-ink-3)",marginTop:13},children:"Each step writes its result back to your Engine files."})]})}return e.jsxs("div",{style:{display:"flex",gap:10,marginTop:20},children:[e.jsxs("div",{style:{flex:1,padding:"14px 12px",borderRadius:12,border:"1px dashed var(--m-line-2)",opacity:.72},children:[e.jsx("div",{style:{fontSize:12.5,color:"var(--m-ink-2)"},children:"The chat"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--m-ink-3)",marginTop:3},children:"fades each session"})]}),e.jsxs("div",{style:{flex:1,padding:"14px 12px",borderRadius:12,border:"1px solid var(--m-gold-line)",background:"rgba(227,196,137,0.05)"},children:[e.jsx("div",{style:{fontSize:12.5,color:"var(--m-ink)"},children:"Your files"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--m-ink-3)",marginTop:3},children:"stay, and the dashboard reads them"})]})]})}function ad({route:n,onNav:t,onFinish:s,allowed:a}){const r=React.useMemo(()=>td.filter(P=>!a||a.includes(P.route)),[a]),[i,l]=React.useState("welcome"),[o,c]=React.useState(0),[d,u]=React.useState(0),[h,p]=React.useState(null),[m,g]=React.useState(!1),[f,v]=React.useState(0),x=r[o];React.useEffect(()=>{if(i!=="tour"||!x||!x.interactive)return;const P=()=>g(!0);return window.addEventListener("mxray",P),()=>window.removeEventListener("mxray",P)},[i,o]),React.useEffect(()=>{if(i!=="tour"||!x)return;let P=!0;p(null),n!==x.route&&t(x.route);let M=0;const T=()=>{if(!P)return;const z=document.querySelector(x.sel);if(!z){if(window.dispatchEvent(new CustomEvent("m4-coach-seek",{detail:x.sel})),M++<9){setTimeout(T,180);return}P&&(g(!1),v(V=>V+1),o+1<r.length?c(o+1):l("done"));return}const y=document.querySelector(".m-scroll");if(y){const V=y.getBoundingClientRect(),H=z.getBoundingClientRect();(H.top<V.top+70||H.bottom>V.bottom-70)&&y.scrollTo({top:y.scrollTop+H.top-V.top-110,behavior:"smooth"})}setTimeout(()=>{P&&F()},480)},F=()=>{const z=document.querySelector(x.sel);if(!z)return;const y=z.getBoundingClientRect();p({x:y.left,y:y.top,w:y.width,h:y.height})};T();const D=()=>F();window.addEventListener("resize",D);const Y=document.querySelector(".m-scroll");return Y&&Y.addEventListener("scroll",D,{passive:!0}),()=>{P=!1,window.removeEventListener("resize",D),Y&&Y.removeEventListener("scroll",D)}},[i,o]);const b=()=>{o+1<r.length?(c(o+1),g(!1)):l("done")},j=()=>s();if(i==="welcome")return e.jsx("div",{className:"m4-welcome-scrim",children:e.jsxs("div",{className:"m4-welcome",role:"dialog","aria-label":"Welcome",children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:14},children:"Guided · the tour"}),e.jsx("h2",{className:"t m-serif",children:"Let me show you around."}),e.jsx("p",{className:"l",children:"First how the system works and how your data flows through it, then a walk through your whole dashboard, screen by screen. Each stop points at the real thing and names what it is and where its numbers come from. Skip any time, and restart it whenever from the toolbar."}),e.jsxs("div",{className:"foot",children:[e.jsxs("button",{className:"m-cta",onClick:()=>l("concepts"),children:["Show me around ",MIcons.arrow(15)]}),e.jsx("button",{className:"m-link",onClick:j,children:"Skip, I'll find my way"})]})]})});if(i==="concepts"){const P=Us[d],M=d===Us.length-1;return e.jsx("div",{className:"m4-welcome-scrim",children:e.jsxs("div",{className:"m4-welcome",role:"dialog","aria-label":P.t,style:{maxWidth:540},children:[e.jsx("div",{className:"m-kicker",style:{marginBottom:14},children:P.eyebrow}),e.jsx("h2",{className:"t m-serif",children:P.t}),e.jsx("p",{className:"l",children:P.l}),e.jsx(sd,{kind:P.diagram}),e.jsxs("div",{className:"foot",style:{marginTop:22},children:[e.jsxs("button",{className:"m-cta",onClick:()=>M?l("tour"):u(d+1),children:[M?"See my dashboard":"Next"," ",MIcons.arrow(15)]}),d>0?e.jsx("button",{className:"m-link",onClick:()=>u(d-1),children:"Back"}):e.jsx("button",{className:"m-link",onClick:()=>l("tour"),children:"Skip to the tour"})]})]})})}if(i==="done")return e.jsx("div",{className:"m4-welcome-scrim",children:e.jsxs("div",{className:"m4-welcome",role:"dialog","aria-label":"Tour finished",style:{maxWidth:470},children:[e.jsx("h2",{className:"t m-serif",children:"That's the whole system."}),e.jsx("p",{className:"l",children:"One thing to carry with you: anything you can click opens to the file it came from. The rest is just your record, kept honestly. Restart this walkthrough any time from the toolbar."}),e.jsx("div",{className:"foot",children:e.jsxs("button",{className:"m-cta",onClick:()=>{t("home"),j()},children:["Begin the day ",MIcons.arrow(15)]})})]})});if(!h)return i==="tour"&&x?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(10,10,12,0.55)",display:"flex",alignItems:"flex-end",justifyContent:"center",pointerEvents:"none"},"aria-hidden":"true",children:e.jsxs("span",{style:{marginBottom:46,padding:"7px 15px",borderRadius:999,background:"rgba(20,20,24,0.92)",border:"1px solid var(--m-line-2)",fontSize:11.5,letterSpacing:".04em",color:"var(--m-ink-3)",fontFamily:"var(--m-mono)"},children:[x.chapter?x.chapter+" · ":"",x.t]})}):null;const A=12,I={left:h.x-A,top:h.y-A,width:h.w+A*2,height:h.h+A*2},k=320,S=230,E=window.innerWidth,L=window.innerHeight;let w,N;x.side==="right"&&I.left+I.width+k+36<E?(w=I.left+I.width+20,N=Math.min(Math.max(I.top,18),L-S-18)):x.side==="left"&&I.left-k-36>0?(w=I.left-k-20,N=Math.min(Math.max(I.top,18),L-S-18)):x.side==="top"&&I.top-S-30>0?(w=Math.min(Math.max(I.left,18),E-k-18),N=I.top-S-4):(w=Math.min(Math.max(I.left,18),E-k-18),N=I.top+I.height+18+S<L?I.top+I.height+18:Math.max(18,I.top-S-4));const C=x.interactive&&!m;return e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"m4-coach-hole",style:I}),e.jsxs("div",{className:"m4-coach",style:{left:w,top:N},role:"dialog","aria-label":"Tour, "+x.t,children:[e.jsxs("div",{className:"step m-num",children:[x.chapter?e.jsx("span",{style:{color:"var(--m-gold-2)",fontWeight:600,letterSpacing:".09em",marginRight:8},children:x.chapter.toUpperCase()}):null,o+1-f," of ",r.length-f]}),e.jsx("h3",{className:"t m-serif",children:x.t}),e.jsx("p",{className:"l",children:x.l}),e.jsxs("div",{className:"foot",children:[x.interactive&&m?e.jsxs("span",{className:"didit",children:[MIcons.check(13)," That's the gesture."]}):null,e.jsxs("button",{className:"m-cta",style:{padding:"10px 18px",fontSize:13,opacity:C?.45:1},disabled:C,onClick:b,children:[C?"Try it first":o+1===r.length?"Got it, finish":"Got it, next"," ",C?null:MIcons.arrow(13)]}),e.jsx("button",{className:"skip",onClick:j,style:{marginLeft:"auto"},children:"Skip"})]})]})]})}Object.assign(window,{GuidedMode:ad});const dn={fresh:{word:"fresh",cls:"is-fresh"},live:{word:"live",cls:"is-live"},stale:{word:"stale",cls:"is-stale"},stuck:{word:"stuck",cls:"is-stuck"},empty:{word:"not yet",cls:"is-empty"}},rd=["live","stuck","stale","fresh","empty"];function Er({S:n,sparse:t}){const a=(n.loop||[]).map(w=>t&&n.loopOverride?Object.assign({},w,n.loopOverride[w.k]||{}):w),[r,i]=React.useState(null),l=e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"The cycle"}),e.jsxs("span",{className:"v8cyc-aside",children:[a.length||0," steps · runs daily"]})]});if(!a.length)return e.jsxs("section",{id:"s4-loop",className:"m4-sec v8cyc-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Strategy, The cycle",children:[l,window.Empty?e.jsx(window.Empty,{title:"The loop hasn't run yet",line:"It fills in as the engine writes its first files."}):null]});const o=a.length,c=460,d=c/2,u=c/2,h=176,p=w=>(-90+360/o*w)*(Math.PI/180),m=(w,N)=>d+N*Math.cos(w),g=(w,N)=>u+N*Math.sin(w),f=w=>w/c*100,v=w=>a.findIndex(N=>N.status===w),x=v("stuck"),b=v("live"),j=x>=0?x:b>=0?b:0,A=r??j,I=a[A],k=dn[I.status]||dn.empty,S=a.map((w,N)=>{const C=(-90+360/o*(N+.5))*(Math.PI/180);return{x:m(C,h),y:g(C,h),deg:-90+360/o*(N+.5)+90}}),E=rd.filter(w=>a.some(N=>N.status===w)),L=w=>window.openXray&&window.openXray("Loop stage: "+w.k,w.note+" · "+w.wf+" writes "+w.writes,w.src);return e.jsxs("section",{id:"s4-loop",className:"m4-sec v8cyc-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Strategy, The cycle","data-coach":"loop",children:[l,e.jsxs("div",{className:"v8cyc",children:[e.jsxs("div",{className:"v8cyc-ring",children:[e.jsxs("svg",{className:"v8cyc-svg",viewBox:`0 0 ${c} ${c}`,"aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{className:"v8cyc-track",cx:d,cy:u,r:h,pathLength:"1"}),S.map((w,N)=>e.jsx("path",{className:"v8cyc-arrow",d:"M -2.4 -3.4 L 2.4 0 L -2.4 3.4",transform:`translate(${w.x} ${w.y}) rotate(${w.deg})`},N))]}),e.jsxs("button",{type:"button",className:"v8cyc-core "+k.cls,onClick:()=>L(I),"aria-label":`Now: ${I.k}, ${k.word}. ${I.note}. Open source.`,children:[e.jsx("span",{className:"v8cyc-core-k",children:r!=null?"stage":x>=0?"stalled":b>=0?"now live":"the loop"}),e.jsx("span",{className:"v8cyc-core-n",children:I.k}),e.jsxs("span",{className:"v8cyc-core-s",children:[e.jsx("i",{className:"v8cyc-dot"}),k.word]})]}),a.map((w,N)=>{const C=p(N),P=dn[w.status]||dn.empty,M=N===A,T=Math.cos(C),F=Math.sin(C),D=Math.abs(T)<.34?F<0?"top":"bottom":T>0?"right":"left";return e.jsxs("button",{type:"button",className:"v8cyc-node "+P.cls+(M?" is-focus":""),style:{left:f(m(C,h))+"%",top:f(g(C,h))+"%","--i":N},onMouseEnter:()=>i(N),onMouseLeave:()=>i(null),onFocus:()=>i(N),onBlur:()=>i(null),onClick:()=>L(w),"aria-label":`${w.k}: ${P.word}. ${w.note}. ${w.wf}. Open source.`,children:[e.jsx("span",{className:"v8cyc-glow","aria-hidden":"true"}),e.jsx("span",{className:"v8cyc-pip","aria-hidden":"true"}),e.jsxs("span",{className:"v8cyc-lbl side-"+D,"aria-hidden":"true",children:[e.jsx("b",{className:"v8cyc-num",children:String(N+1).padStart(2,"0")}),e.jsx("span",{className:"v8cyc-name",children:w.k})]})]},w.k)})]}),E.length?e.jsx("div",{className:"v8cyc-legend","aria-hidden":"true",children:E.map(w=>e.jsxs("span",{className:"lg "+dn[w].cls,children:[e.jsx("i",{className:"v8cyc-dot"}),dn[w].word]},w))}):null]})]})}const id={good:"is-good",warn:"is-warn",crit:"is-crit",neutral:"is-neutral"},ld=n=>{if(typeof n!="string")return n;let t=n.trim();for(let s=0;s<6;s++){let a=t.replace(/^\s*[-•*]\s+/,"");if(a=a.replace(/^\s*(status|context|the goal|the idea|hero|hypothesis|note|sub|testing\s*\(day\s*\d+\)|the positioning\s*\(v[\d.]+\)|active hypothesis(?:\s*\([^)]*\))?)\s*[::\-–—]*\s*/i,""),a===t)break;t=a}return t.replace(/^["'“‘]+/,"").replace(/["'”’]+$/,"").trim()},Ge=n=>n!=null&&String(n).trim()!==""&&String(n).trim()!=="—";function od({k:n}){return e.jsx("div",{className:"v8s2-band v8s2-band-"+(n||"a"),"aria-hidden":"true"})}const cd=n=>typeof n=="string"?n.replace(/\*\*/g,"").replace(/[*_`>#]/g,"").replace(/^\s*[-•]\s+/gm,"").replace(/\s*\n\s*/g," ").replace(/\s+/g," ").trim():n,un=n=>ld(cd(n));function Ir({d:n}){const t=n.k==="Work",s=t&&window.V8BET&&window.V8BET.available?window.V8BET:null,a=!!(s&&s.target!=null&&s.current!=null),r=a?s.progressPct!=null?s.progressPct:Math.round(s.current/Math.max(1,s.target)*100):null,i=a&&s.tone||"neutral",l=a?s.status?s.status.replace(/[-_]/g," "):"testing":"not testing yet",o=un(n.hypothesis),c=un(n.goal),d=Ge(n.risk)?un(n.risk):null,u=t&&window.V4&&window.V4.bet?un(window.V4.bet.sacrifice):null,h=a?s.current+" of "+s.target+" "+s.unit+(s.daysRemaining!=null?", "+s.daysRemaining+" days left":""):null,m=(window.V4S&&window.V4S.lab||[]).filter(v=>v&&v.area&&String(v.area).toLowerCase()===n.k.toLowerCase()),g=()=>window.openXray&&window.openXray(n.k+", the full bet",[Ge(o)&&"If I: "+o,Ge(c)&&"Then: "+c,"So far: "+(h||"not tracked yet"),"Wrong if: "+(d||"not set yet"),Ge(u)&&"Giving up: "+u,Ge(n.evidence)&&"Evidence: "+un(n.evidence)].filter(Boolean).join(`
|
|
124
|
+
|
|
125
|
+
`),n.src||"strategy"),f=!a;return e.jsxs("article",{className:"v8s2-hyp "+(id[i]||"")+(f?" is-dormant":" is-focal"),children:[e.jsxs("div",{className:"v8s2-hyp-head",children:[e.jsx("h3",{className:"v8s2-hyp-name",children:n.k}),e.jsx("span",{className:"v8s2-hyp-status",children:l}),r!=null?e.jsxs("span",{className:"v8s2-hyp-pct m-num",children:[r,e.jsx("span",{className:"v8s2-pctsign",children:"%"})]}):null]}),Ge(o)?e.jsx("p",{className:"v8s2-aim",children:o}):null,a?e.jsx("div",{className:"v8s2-bar",children:e.jsx("span",{className:"v8s2-bar-fill",style:{width:Math.max(2,Math.min(100,r))+"%"}})}):null,e.jsxs("dl",{className:"v8s2-hyp-rows",children:[Ge(c)?e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Target"}),e.jsx("dd",{children:c})]}):null,e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"So far"}),e.jsx("dd",{className:h?"":"v8s2-mute",children:h||"Not tracking this yet."})]}),e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Wrong if"}),e.jsx("dd",{className:d?"":"v8s2-unset",children:d||"Not set yet, what would prove this wrong?"})]}),Ge(u)?e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Sacrifice"}),e.jsx("dd",{children:u})]}):null,m.length?e.jsxs("div",{className:"v8s2-hrow",children:[e.jsx("dt",{children:"Tests"}),e.jsxs("dd",{children:[m.length," running: ",m.slice(0,2).map(v=>un(v.t)).join(", "),m.length>2?", …":""]})]}):null]}),e.jsx("button",{className:"v8s2-hyp-more",onClick:g,children:"Read the full bet →"})]})}function Mr({S:n}){const t=n&&n.domains||[];return t.length?e.jsxs("section",{id:"s4-star",className:"v8s2-goals","data-screen-label":"Strategy, your bets",children:[e.jsxs("div",{className:"v8s2-sec-head",children:[e.jsx("h2",{className:"v8s2-h",children:"Your bets"}),e.jsx("span",{className:"v8s2-sub",children:"one bet per domain: what you're going for, and what would prove it wrong"})]}),e.jsx("div",{className:"v8s2-areas",children:t.map(s=>e.jsx(Ir,{d:s},s.k))})]}):null}function dd({D:n,onNav:t}){const s=n.__sparse,a=s?Object.assign({},window.V4S,window.V4SPARSE.strategy):window.V4S,r=window,[i,l]=React.useState(null);return typeof r.StrategyView=="function"&&typeof r.LabSectionV5!="function"?e.jsx("div",{className:"v8-strat","data-screen-label":"Strategy (v8 distinctive)",children:e.jsx(r.StrategyView,{D:n,onNav:t})}):e.jsxs("div",{className:"v8-strat v8s2","data-screen-label":"Strategy (v8 digestible)",children:[e.jsxs("div",{className:"v8s2-wrap",children:[e.jsxs("header",{className:"v8s2-hero",children:[e.jsx("div",{className:"v8s2-hero-band","aria-hidden":"true"}),e.jsxs("div",{className:"v8s2-hero-in",children:[e.jsx("span",{className:"v8s2-eyebrow",children:"Strategy · the lab"}),e.jsx("h1",{className:"v8s2-hero-h",children:"What you're testing, and where each bet stands"})]})]}),e.jsx(Er,{S:a,sparse:s}),e.jsx(Mr,{S:a}),e.jsxs("div",{className:"v8s2-deep",children:[r.LabSectionV5?e.jsx(r.LabSectionV5,{S:a,sparse:s}):null,r.CaseSection?e.jsx(r.CaseSection,{S:a,sparse:s}):null,r.BoardSection?e.jsx(r.BoardSection,{S:a,sparse:s}):null,r.GraveSection?e.jsx(r.GraveSection,{S:a,sparse:s,onExit:o=>l({name:o})}):null]})]}),i&&r.ExitModal?e.jsx(r.ExitModal,{name:i.name,draftTitle:i.draftTitle,S:a,onClose:()=>l(null)}):null]})}Object.assign(window,{StrategyViewV8:dd,LoopCycleV8:Er,StrategyGoalsV8:Mr,V8DomainCard:Ir,V8Band:od});const ee=window,Ks={live:{cls:"is-live",word:"live now"},fresh:{cls:"is-fresh",word:"fresh"},stale:{cls:"is-stale",word:"going stale"},stuck:{cls:"is-stuck",word:"stalled"},empty:{cls:"is-empty",word:"not yet"}};function Pe(n){if(typeof n!="string")return n;let t=n.replace(/\*\*/g,"").replace(/[*_`>#]/g,"").replace(/\s*\n\s*/g," ").replace(/\s+/g," ").trim();for(let s=0;s<6;s++){let a=t.replace(/^\s*[-•*]\s+/,"");if(a=a.replace(/^\s*(status|context|the goal|the idea|hero|hypothesis|note|sub|testing\s*\(day\s*\d+\)|the positioning\s*\(v[\d.]+\)|active hypothesis(?:\s*\([^)]*\))?)\s*[::.\-]*\s*/i,""),a===t)break;t=a}return t.replace(/^["'“‘]+/,"").replace(/["'”’]+$/,"").trim()}const ge=n=>n!=null&&String(n).trim()!==""&&String(n).trim()!=="—";function ud(n){const t=Pe(n||""),s=t.indexOf(" (");return s>12?t.slice(0,s).trim():t}function os(n){return React.useCallback(t=>{const s=t.key,a=s==="ArrowRight"||s==="ArrowDown"||s==="j"||s==="J";if(!a&&!(s==="ArrowLeft"||s==="ArrowUp"||s==="k"||s==="K"))return;const i=n.current;if(!i)return;const l=Array.from(i.querySelectorAll("[data-peekrow]"));if(!l.length)return;const o=l.indexOf(document.activeElement);let c=o<0?0:o+(a?1:-1);c=Math.max(0,Math.min(l.length-1,c)),c!==o&&(t.preventDefault(),l[c].focus())},[n])}function Ar({S:n}){const t=n&&n.domains||[],s=t.find(N=>N&&N.k==="Work")||t[0]||{},a=ee.V8BET&&ee.V8BET.available&&ee.V8BET||null,r=ee.V4&&ee.V4.bet||{},i=a&&a.current!=null?a.current:null,l=a&&a.target!=null?a.target:null,o=a&&a.unit||s.goalUnit||"",c=a&&a.daysRemaining!=null?a.daysRemaining:null,d=i!=null&&l!=null,u=ud(s.goal)||Pe(r.iff)||"",h=ge(r.statusPlain)?r.statusPlain:null,p=r.statusTone||a?.tone||"neutral",m=(n&&n.loop||[]).find(N=>N&&N.k==="Evidence"),g=m&&m.status==="stuck",f=m&&typeof m.note=="string"?(m.note.match(/^ran (.+)$/)||[])[1]:null,v=f?"Your last progress check was "+f:"You haven't run a nightly progress check yet",x=g?v+", so the number may be running on old data":ge(r.because)?Pe(r.because):null,b=ge(r.sacrifice)?Pe(r.sacrifice):null,j=ge(r.killIf),A=d?Math.max(3,Math.min(100,Math.round(i/Math.max(1,l)*100))):0,I=d?Math.max(0,l-i):null,k=d&&c!=null&&c>0&&I>0?Math.ceil(I/Math.max(1,c)):null,S=g?{label:"Refresh your progress",cmd:"/analyse-day",why:f?"Last counted "+f+".":"No progress check has run yet.",title:"Your progress check is stale",body:v+". Running /analyse-day re-reads your receipts and refreshes the number above, so the bet isn't judged on old data.",src:m&&m.src||"learnings"}:{label:"Set a kill line",cmd:"/pivot-strategy",why:"Name the one outcome that would prove this bet wrong.",title:"No kill line on file",body:"What single outcome would prove this bet wrong? Filing it via /pivot-strategy lets the bet end honestly instead of quietly drifting.",src:s.src||"strategy"},E=()=>ee.openXray&&ee.openXray(S.title,S.body,S.src),L=c==null?null:c>=0?c+" days left":Math.abs(c)+(Math.abs(c)===1?" day":" days")+" past the deadline",w=()=>ee.openXray&&ee.openXray("The bet, in full",["Claim: "+(u||"not recorded"),d?"So far: "+i+" of "+l+" "+o+(L?", "+L:""):"So far: not measured","Status: "+(h||"not recorded"),x?"Watch-out: "+x:null,b?"What you're giving up: "+b:null,"What would prove it wrong: "+(j?Pe(r.killIf):"not set yet")].filter(Boolean).join(`
|
|
126
|
+
|
|
127
|
+
`),s.src||"strategy");return e.jsxs("article",{className:"v9-sr tone-"+p,"data-coach":"strategy-bet","data-screen-label":"Strategy, the bet on the table",children:[e.jsxs("header",{className:"v9-sr-head",children:[e.jsx("span",{className:"v9-sr-eyebrow",children:"The bet on the table"}),h?e.jsx("span",{className:"v9-sr-status",children:h}):null]}),e.jsx(Reveal,{as:"h1",className:"v9-sr-claim",children:u||"No bet on file yet"}),e.jsx("div",{className:"v9-sr-measure",children:d?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"v9-sr-count m-num",children:[i,e.jsx("span",{className:"v9-sr-slash",children:"/"}),l]}),e.jsx("span",{className:"v9-sr-unit",children:o})]}):e.jsx("span",{className:"v9-sr-unmeasured",children:"Not tracking a number yet."})}),d?e.jsxs("div",{className:"v9-sr-wire",role:"img","aria-label":i+" of "+l+" "+o+(L?", "+L:"")+(k?", about "+k+" a day to clear it":""),children:[e.jsxs("div",{className:"v9-sr-wire-track",children:[e.jsx("div",{className:"v9-sr-wire-fill",style:{transform:"scaleX("+A/100+")"}}),e.jsx("div",{className:"v9-sr-wire-line"+(c!=null&&c<0?" is-past":"")})]}),c!=null&&c<0&&L?e.jsxs("span",{className:"v9-sr-wire-note is-past",children:[L[0].toUpperCase()+L.slice(1),"."]}):k?e.jsxs("span",{className:"v9-sr-wire-note",children:["About ",k," a day from here to clear the line."]}):null]}):null,e.jsxs("div",{className:"v9-sr-move",children:[e.jsxs("button",{type:"button",className:"v9-sr-act",onClick:E,children:[S.label,e.jsx("span",{className:"v9-sr-act-cmd",children:S.cmd})]}),e.jsx("p",{className:"v9-sr-why",children:S.why})]}),e.jsx("button",{type:"button",className:"v9-sr-full",onClick:w,children:"Read the full bet"})]})}function Lr({S:n}){const t=n&&n.loop||[],s=React.useRef(null),a=os(s);if(!t.length)return e.jsxs("section",{className:"v9-engine","data-coach":"strategy-engine","data-screen-label":"Strategy, the engine",children:[e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"The engine"})}),ee.Empty?e.jsx(ee.Empty,{title:"The loop hasn't run yet",line:"It fills in as the engine writes its first files."}):null]});const r=t.filter(c=>c.status==="live").length,i=t.filter(c=>c.status==="stuck"),l=i.length>0?i.length+(i.length===1?" stage stalled":" stages stalled")+" · "+r+" live":r+" of "+t.length+" stages live",o=c=>ee.openXray&&ee.openXray("Loop stage: "+c.k,(ge(c.note)?c.note:"no state yet")+(ge(c.wf)?" · "+c.wf:"")+(ge(c.writes)?" writes "+c.writes:""),c.src);return e.jsxs("section",{className:"v9-engine","data-coach":"strategy-engine","data-screen-label":"Strategy, the engine",children:[e.jsxs("div",{className:"v9-sec-head",children:[e.jsx("span",{className:"v9-sec-h",children:"The engine"}),e.jsx("span",{className:"v9-sec-aside",children:l})]}),e.jsx("div",{className:"v9-strip",ref:s,role:"group","aria-label":"The 11-stage operating loop",onKeyDown:a,children:t.map((c,d)=>{const u=Ks[c.status]||Ks.empty,h=t[d-1],p=d>0&&(c.status==="stuck"||h&&h.status==="stuck"),m=c.status==="live"||c.status==="stuck";return e.jsxs(React.Fragment,{children:[d>0?e.jsx("span",{className:"v9-strip-link"+(p?" is-broken":""),"aria-hidden":"true"}):null,e.jsxs("button",{type:"button","data-peekrow":!0,className:"v9-node "+u.cls+(m?" is-named":""),onClick:()=>o(c),"aria-label":c.k+": "+u.word+(ge(c.note)?", "+c.note:"")+". Open source.",children:[e.jsx("span",{className:"v9-node-dot","aria-hidden":"true"}),e.jsx("span",{className:"v9-node-name","aria-hidden":"true",children:c.k})]})]},c.k)})})]})}function hd({progress:n}){const t=n;if(!t||!t.type)return null;if(t.type==="scalar"){const s=t.available&&t.current!=null,a=s&&t.progressPct!=null?Math.max(2,Math.min(100,t.progressPct)):0,r=t.targetText||(t.target!=null?String(t.target):null);return e.jsxs("div",{className:"v9-shape","aria-label":"scalar trajectory",children:[e.jsxs("div",{className:"v9-shape-line",children:[e.jsx("span",{className:"v9-shape-tag",children:"scalar"}),e.jsx("span",{className:"v9-shape-now"+(s?"":" v9-dash"),children:s?t.current:" "}),r?e.jsxs("span",{className:"v9-shape-aim",children:["toward ",r]}):null]}),e.jsx("div",{className:"v9-gauge-track",children:e.jsx("div",{className:"v9-gauge-fill",style:{transform:"scaleX("+a/100+")"}})}),s?null:e.jsx("span",{className:"v9-shape-note",children:"no reading logged yet"})]})}if(t.type==="streak"){const s=t.currentStreak,a=s!=null;return e.jsxs("div",{className:"v9-shape v9-shape-inline","aria-label":"practice streak",children:[e.jsx("span",{className:"v9-shape-tag",children:"streak"}),e.jsx("span",{className:"v9-shape-now"+(a?"":" v9-dash"),children:a?s+(s===1?" day":" days"):" "}),e.jsx("span",{className:"v9-shape-note",children:a?t.todayDone?"today done":"today open":t.note||"not measured yet"})]})}if(t.type==="chain"){const s=t.stages||[];return s.length?e.jsxs("div",{className:"v9-shape","aria-label":"conversion chain",children:[e.jsx("span",{className:"v9-shape-tag",children:"chain"}),e.jsx("div",{className:"v9-chain-row",children:s.map((a,r)=>e.jsxs(React.Fragment,{children:[r?e.jsx("span",{className:"v9-chain-arrow","aria-hidden":"true",children:"›"}):null,e.jsxs("span",{className:"v9-chain-node"+(a.current!=null?" is-live":""),children:[e.jsx("span",{className:"v9-chain-label",children:a.label}),e.jsx("span",{className:"v9-chain-val"+(a.current!=null?"":" v9-dash"),children:a.current!=null?a.current:" "})]})]},r))}),e.jsx("span",{className:"v9-shape-note",children:t.note})]}):e.jsxs("div",{className:"v9-shape v9-shape-inline","aria-label":"conversion chain",children:[e.jsx("span",{className:"v9-shape-tag",children:"chain"}),e.jsx("span",{className:"v9-shape-note",children:t.note})]})}if(t.type==="single"){const s=t.available&&t.current!=null&&t.target!=null;return e.jsxs("div",{className:"v9-shape v9-shape-inline","aria-label":"single tripwire",children:[e.jsx("span",{className:"v9-shape-tag",children:"single"}),e.jsx("span",{className:"v9-shape-now"+(s?"":" v9-dash"),children:s?t.current+" / "+t.target+(t.unit?" "+t.unit:""):" "}),s?null:e.jsx("span",{className:"v9-shape-note",children:"no reading logged yet"})]})}return null}function Or({d:n}){const t=Pe(n.hypothesis),s=ge(n.goal)?Pe(n.goal):null,a=n.pct!=null&&n.pct!=="—"&&!isNaN(Number(n.pct)),r=ge(n.measurement),i=a?"testing":r?"measuring · "+n.measurement:"not testing yet",l=()=>ee.openXray&&ee.openXray(n.k+": the bet",[t?"Aim: "+t:null,r?"Measured by: "+n.measurement:null,"Target: "+(s||"unfiled"),"Kill condition: "+(ge(n.risk)?Pe(n.risk):"unfiled")].filter(Boolean).join(`
|
|
128
|
+
|
|
129
|
+
`),n.src||"goals");return e.jsxs("button",{type:"button","data-peekrow":!0,className:"v9-stub"+(a?" is-live":""),onClick:l,"aria-label":n.k+" bet. Open source.",children:[e.jsxs("div",{className:"v9-stub-head",children:[e.jsx("span",{className:"v9-stub-name",children:n.k}),e.jsx("span",{className:"v9-stub-state",children:i})]}),t?e.jsx("p",{className:"v9-stub-aim",children:t}):null,e.jsx(hd,{progress:n.progress}),s||ge(n.risk)?e.jsxs("div",{className:"v9-stub-rows",children:[e.jsx("span",{className:"v9-stub-k",children:"Target"}),e.jsx("span",{className:"v9-stub-v"+(s?"":" v9-unsigned-flat"),children:s||"unfiled"}),e.jsx("span",{className:"v9-stub-k",children:"Kill if"}),e.jsx("span",{className:"v9-stub-v"+(ge(n.risk)?"":" v9-unsigned-flat"),children:ge(n.risk)?Pe(n.risk):"unfiled"})]}):e.jsxs("div",{className:"v9-stub-rows",children:[e.jsx("span",{className:"v9-stub-k",children:"Target · kill if"}),e.jsx("span",{className:"v9-stub-v v9-unsigned-flat",children:"both unfiled"})]})]})}function md({S:n,sparse:t,labEmpty:s,lab:a,onExit:r}){const i=(n&&n.board||{}).seats||[],l=i.filter(p=>p.stance==="disagrees").length,o=n&&n.graveyard&&n.graveyard.entries&&n.graveyard.entries.length||0,[c,d]=React.useState(l>0),u=[];s||u.push(a.length+" experiment"+(a.length===1?"":"s")),i.length&&u.push(l===0?"no objections":l+" objection"+(l===1?"":"s")),o&&u.push(o+" buried idea"+(o===1?"":"s"));const h=u.length?u.join(" · "):"nothing on it yet";return e.jsxs("section",{className:"v9-docket","data-screen-label":"Strategy, the docket",children:[e.jsxs("button",{type:"button",className:"v9-docket-sum","aria-expanded":c,onClick:()=>d(p=>!p),children:[e.jsx("span",{className:"v9-sec-h",children:"The docket"}),e.jsx("span",{className:"v9-docket-line",children:h}),e.jsx("span",{className:"ic","aria-hidden":"true",children:MIcons.arrow(11)})]}),c?e.jsxs("div",{className:"v9-docket-body",children:[!s&&ee.LabSectionV5?e.jsx(ee.LabSectionV5,{S:n,sparse:t}):null,e.jsx(Pr,{S:n}),ee.GraveSection?e.jsx(ee.GraveSection,{S:n,sparse:t,onExit:r}):null]}):null]})}function Pr({S:n}){const t=React.useRef(null),s=os(t),r=(n&&n.board||{}).seats||[];if(!r.length)return null;r.filter(f=>f.stance==="agrees");const i=r.filter(f=>f.stance==="disagrees");r.filter(f=>f.stance==="silent");const l=ee.V8BET&&ee.V8BET.available&&ee.V8BET||null,o=l&&ge(l.status)?String(l.status).replace(/[-_]/g," "):null,c=l?l.tone==="warn"||l.tone==="crit":!1,d=(n&&n.loop||[]).filter(f=>f&&f.status==="stuck").length,u=i.length>0||c,h=f=>ee.openXray&&ee.openXray(f.file+", "+f.stance,Pe(f.says),f.src),p=()=>ee.openXray&&ee.openXray("Reconsider the bet","When the evidence turns, this is where you change the system, not just tweak a variable. Run /pivot-strategy.","strategy"),g=(i.length?i.length+" of your files "+(i.length===1?"disagrees":"disagree"):c?"the numbers are off track"+(o?" ("+o+")":""):"nothing's contradicting it yet")+(d>0?", and the engine has "+d+" stalled stage"+(d===1?"":"s"):"")+".";return e.jsxs("section",{className:"v9-gate","data-coach":"strategy-pivot-gate","data-screen-label":"Strategy, pivot check",ref:t,onKeyDown:s,children:[e.jsxs("div",{className:"v9-sec-head",children:[e.jsx("span",{className:"v9-sec-h",children:"Keep going, or pivot?"}),e.jsx("span",{className:"v9-gate-verdict "+(u?"is-flag":"is-keep"),children:u?"Keep going, with a flag":"Keep going"})]}),e.jsx("p",{className:"v9-gate-reading",children:g.charAt(0).toUpperCase()+g.slice(1)}),i.length?e.jsx("div",{className:"v9-gate-dissent",children:i.map(f=>e.jsxs("button",{type:"button","data-peekrow":!0,className:"v9-gate-row",onClick:()=>h(f),"aria-label":f.file+" objects: "+Pe(f.says)+". Open source.",children:[e.jsx("span",{className:"v9-gate-tag",children:"Objection"}),e.jsx("span",{className:"v9-gate-file",children:f.file}),e.jsx("span",{className:"v9-gate-says",children:Pe(f.says)})]},f.file))}):null,e.jsx("div",{className:"v9-gate-foot",children:e.jsxs("button",{type:"button",className:"v9-gate-act",onClick:p,children:["Reconsider the bet ",e.jsx("span",{className:"v9-gate-cmd",children:"/pivot-strategy"})]})})]})}function Dr({S:n}){const t=n&&n.lab||[],s=t.filter(l=>l&&l.bet),a=t.filter(l=>l&&!l.bet),r=l=>ee.openXray&&ee.openXray("Experiment: "+(l.t||"untitled"),[ge(l.hyp)?"Hypothesis: "+Pe(l.hyp):null,ge(l.change)?"Changing: "+l.change:null,ge(l.metric)?"Measured by: "+l.metric:null,l.runs!=null&&l.target!=null?"Progress: "+l.runs+" of "+l.target+" runs":null].filter(Boolean).join(`
|
|
130
|
+
|
|
131
|
+
`),"experiments"),i=()=>ee.openXray&&ee.openXray("Test this bet","Change one thing, measure it, keep it or kill it. /experiment starts one against this bet.","strategy");return e.jsxs("section",{className:"v9bx"+(s.length?"":" is-fold"),"data-coach":"lab","data-screen-label":"Strategy, what's testing the bet",children:[s.length?e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"What's testing this bet"})}):null,s.length?e.jsx("div",{className:"v9bx-list",children:s.map(l=>e.jsxs("button",{type:"button",className:"v9bx-exp",onClick:()=>r(l),"aria-label":"Experiment: "+l.t+". Open source.",children:[e.jsx("span",{className:"v9bx-exp-t",children:l.t}),ge(l.change)?e.jsxs("span",{className:"v9bx-exp-var",children:[l.change,ge(l.metric)?" → "+l.metric:""]}):null,l.runs!=null&&l.target!=null?e.jsxs("span",{className:"v9bx-exp-prog m-num",children:[l.runs,"/",l.target]}):null]},l.id))}):e.jsxs("button",{type:"button",className:"v9bx-empty",onClick:i,children:[e.jsx("span",{className:"v9bx-empty-line",children:a.length?a.length+(a.length===1?" experiment is":" experiments are")+" running, but none is wired to this bet.":"Nothing is testing this bet yet."}),e.jsx("span",{className:"v9bx-empty-cmd",children:"/experiment"})]})]})}function pd({D:n,onNav:t}){const s=n&&n.__sparse,a=s?Object.assign({},ee.V4S,ee.V4SPARSE&&ee.V4SPARSE.strategy):ee.V4S,[r,i]=React.useState(null),l=React.useRef(null),o=os(l),c=(a&&a.domains?a.domains:[]).find(v=>v&&v.k==="Work"),d=!!(ee.V8BET&&ee.V8BET.available&&ee.V8BET.current!=null),u=!c||!ge(c.goal)&&!d;if(!a||!(a.domains&&a.domains.length)||u)return typeof ee.StrategyViewV8=="function"?e.jsx(ee.StrategyViewV8,{D:n,onNav:t}):typeof ee.StrategyView=="function"?e.jsx("div",{className:"v9-strat v8-strat",children:e.jsx(ee.StrategyView,{D:n,onNav:t})}):null;const p=(a.domains||[]).filter(v=>v&&v.k!=="Work"),m=a.lab||[],g=!s&&m.length===0,f=typeof ee.LabSectionV5=="function";return e.jsxs("div",{className:"v9-strat v8-strat","data-screen-label":"Strategy (v9, The Standing)",children:[e.jsxs("div",{className:"v9-wrap",children:[e.jsx(Ar,{S:a}),e.jsx(Dr,{S:a}),e.jsx(Lr,{S:a}),p.length?e.jsxs("section",{className:"v9-others","data-screen-label":"Strategy, the other bets",children:[e.jsx("div",{className:"v9-sec-head",children:e.jsx("span",{className:"v9-sec-h",children:"The other bets"})}),e.jsx("div",{className:"v9-stubs",ref:l,onKeyDown:o,children:p.map(v=>e.jsx(Or,{d:v},v.k))})]}):null,f?e.jsx(md,{S:a,sparse:s,labEmpty:g,lab:m,onExit:v=>i({name:v})}):null]}),r&&ee.ExitModal?e.jsx(ee.ExitModal,{name:r.name,draftTitle:r.draftTitle,S:a,onClose:()=>i(null)}):null]})}Object.assign(window,{StrategyViewV9:pd,SignedResolution:Ar,V9BetTest:Dr,LoopStripV9:Lr,DomainStubV9:Or,V9Advisors:Pr});const en=(n,t)=>window.MIcons&&typeof window.MIcons[n]=="function"?window.MIcons[n](t):null;function Fr(){const n=window.V8FP;if(!n||!n.available||!n.top||!n.top.length)return null;const t=a=>{if(!a)return null;try{const r=Math.floor((Date.now()-new Date(a).getTime())/864e5);return r<=0?"today":r===1?"yesterday":r<30?r+"d ago":r<365?Math.floor(r/30)+"mo ago":Math.floor(r/365)+"y ago"}catch{return null}},s=a=>a>=n.max*.5?3:a>=n.max*.18?2:1;return e.jsxs("section",{className:"v8fp","data-screen-label":"Run, your command fingerprint",children:[e.jsxs("div",{className:"v8fp-head",children:[e.jsx("span",{className:"m-kicker",children:"How you actually work"}),e.jsxs("span",{className:"v8fp-sum",children:[e.jsx("b",{className:"m-num",children:n.distinct})," commands",n.totalRuns!=null?e.jsxs(React.Fragment,{children:[" · ",e.jsx("b",{className:"m-num",children:n.totalRuns})," runs"]}):null]}),e.jsxs("button",{className:"v6-file v8fp-file",title:"Where usage is counted",onClick:()=>openXray("Where usage is counted",n.distinct+" commands across your session history, by real count, never estimated",n.srcKey),children:[en("file",11)," ",n.srcFile]})]}),e.jsx("div",{className:"v8fp-rows",role:"list","aria-label":"Your most-used commands",children:n.top.map((a,r)=>{const i=n.max?Math.max(3,Math.round(a.n/n.max*100)):0,l=t(a.lastIso);return e.jsxs("button",{type:"button",className:"v8fp-row","data-tier":s(a.n),style:{"--i":r},onClick:()=>openXray(a.label,a.n+" runs"+(l?", last used "+l:"")+", counted from your session history",n.srcKey),title:a.label+", "+a.n+" runs"+(l?", last "+l:""),children:[e.jsx("span",{className:"v8fp-rank m-num",children:r+1}),e.jsx("span",{className:"v8fp-cmd",children:a.label}),e.jsx("span",{className:"v8fp-track",children:e.jsx("i",{style:{width:i+"%"}})}),e.jsx("span",{className:"v8fp-n m-num",children:a.n})]},a.cmd)})}),n.more>0?e.jsxs("div",{className:"v8fp-tail",children:["+",n.more," more, used less often"]}):null]})}let qn=null;async function Qn(){if(qn)return qn;try{const n=await(await fetch("/api/health")).json();return qn=n.token,n.token}catch{return null}}async function Js(n,t){const s=async()=>{const r=await Qn();return fetch(n,{...t||{},headers:{...t&&t.headers||{},"X-Mover-Token":r||""}})};let a=await s();return a&&(a.status===401||a.status===403)&&(qn=null,a=await s()),a}const _r=[{id:"claude-code",name:"Claude Code"},{id:"codex",name:"Codex"},{id:"gemini",name:"Gemini"}],fd={"claude-code":{efforts:["low","medium","high","xhigh","max"],models:["sonnet","opus","haiku","fable"]},codex:{efforts:["low","medium","high","xhigh"],models:["gpt-5.5","gpt-5.6-terra","gpt-5.6-sol","gpt-5.6-luna"]},gemini:{efforts:[],models:[]}},gd=[["yolo","auto-approve everything (runs unattended)"],["auto_edit","auto-approve edits only"],["default","ask before actions (can stall a headless run)"],["plan","read-only plan mode"]];function xd(){const[n,t]=React.useState({loaded:!1,agent:null,prefs:{}});React.useEffect(()=>{let a=!0;return(async()=>{try{const r=await Qn(),i=await(await fetch("/api/config",{headers:{"X-Mover-Token":r||""}})).json();if(!a)return;const l=i&&i.ok&&i.config||{};t({loaded:!0,agent:l.preferredAgent||null,prefs:l.providerPrefs||{}})}catch{a&&t({loaded:!0,agent:null,prefs:{}})}})(),()=>{a=!1}},[]);const s=React.useCallback(async a=>{try{const r=await Qn();await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":r||""},body:JSON.stringify(a)})}catch{}},[]);return{...n,persist:s}}const Gs=[{k:"Daily rhythm",ids:["/morning","/plan-tomorrow","/log","/analyse-day","/reboot","/overview"]},{k:"Strategy",ids:["/review-week","/pivot-strategy","/refactor-plan","/ignite","/experiment","/research"]},{k:"Knowledge",ids:["/capture","/harvest","/debrief","/mover-ideas","/screenshot","/history"]},{k:"System",ids:["/setup","/walkthrough","/update","/migrate","/mover-check","/mover-report","/debug-resistance"]}],Qs={0:{k:"low",t:"low risk"},1:{k:"med",t:"medium risk"},2:{k:"high",t:"high risk"}};function yd(n){const t=Gs.map(a=>({k:a.k,items:[]})),s={k:"More",items:[]};return(n||[]).forEach(a=>{const r=Gs.findIndex(i=>i.ids.includes(a.c));r>=0?t[r].items.push(a):s.items.push(a)}),s.items.length&&t.push(s),t.filter(a=>a.items.length>0)}function vd(n){if(n==null||n<0)return"";const t=Math.floor(n/1e3);return Math.floor(t/60)+":"+String(t%60).padStart(2,"0")}function wd(){const[n,t]=React.useState(null);return React.useEffect(()=>{let s=!0;return(async()=>{try{const a=await(await fetch("/api/agents/detect")).json();if(!s)return;const r=new Set;a&&a.ok&&Array.isArray(a.agents)&&a.agents.forEach(i=>{i&&i.present&&i.id&&r.add(i.id)}),t(r)}catch{s&&t(new Set)}})(),()=>{s=!1}},[]),n}function jd({status:n}){const t=n==="running"||n==="starting"||n==="stopping"?"is-run":n==="done"?"is-done":n==="failed"||n==="exited"?"is-fail":"is-mute";return e.jsx("span",{className:"rcon-dot "+t,"aria-hidden":"true"})}function kd(n){return n.status==="starting"?"starting…":n.status==="running"?"running":n.status==="stopping"?"stopping…":n.status==="stopped"?"stopped":n.status==="done"?"finished":n.status==="exited"?n.exit!=null?"exited (code "+n.exit+")":"exited":n.status==="failed"?"failed":n.status}function bd({run:n,open:t,onToggle:s,onStopWatch:a,onStopRun:r,onHide:i,tick:l}){const o=React.useRef(null);React.useEffect(()=>{t&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t,n.output,l]);const c=n.status==="running"||n.status==="starting"||n.status==="stopping",d=vd((n.ended||Date.now())-n.started),u=(_r.find(h=>h.id===n.agent)||{}).name||n.agent;return e.jsxs("article",{className:"rcon-run"+(c?" is-live":"")+(n.status==="failed"?" is-fail":""),"data-screen-label":"Run, a real run",children:[e.jsxs("button",{className:"rcon-run-head",onClick:s,"aria-expanded":t,children:[e.jsx(jd,{status:n.status}),e.jsx("span",{className:"rcon-run-label",children:n.label}),e.jsxs("span",{className:"rcon-run-agent",children:[en("agent",11)," ",u,n.model||n.effort?e.jsx("span",{className:"rcon-run-tune",title:"What this run launched with",children:[n.model,n.effort].filter(Boolean).join(" · ")}):null]}),e.jsx("span",{className:"rcon-run-status st-"+n.status,children:kd(n)}),e.jsx("span",{className:"rcon-run-time m-num",children:d}),e.jsx("span",{className:"rcon-chev"+(t?" is-open":""),children:en("arrow",12)})]}),t?e.jsxs("div",{className:"rcon-run-body",children:[e.jsxs("pre",{className:"rcon-term",ref:o,tabIndex:0,"aria-label":"Agent output",children:[n.output?n.output:c?"Waiting for the agent to respond…":"No output.",c?e.jsx("span",{className:"rcon-caret",children:"▌"}):null]}),e.jsx("div",{className:"rcon-run-acts",children:c?e.jsxs(React.Fragment,{children:[e.jsx("button",{className:"m-cta-line rcon-stop",onClick:r,title:"Stop the agent process for real.",children:"Stop run"}),e.jsx("button",{className:"m-mini",onClick:a,title:"Stop following the stream here. The run keeps going in the background, reopen this card to watch it again.",children:"Stop watching"})]}):e.jsxs(React.Fragment,{children:[!n.workflow&&n.output?e.jsx("button",{className:"m-mini",title:"Carry this exchange into a live session with memory",onClick:()=>{const h=String(n.output).trim().slice(-300);window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:'Continuing from a one-shot run. I said: "'+n.label+'". You answered: "…'+h+'". My follow-up: '})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:"Continue in Chat"}):null,e.jsx("button",{className:"m-mini",onClick:i,children:"Hide"})]})})]}):null]})}function Nd({agent:n,setAgent:t,runnable:s,onRun:a,tune:r,setTune:i}){const[l,o]=React.useState(""),c=()=>{const f=l.trim();f&&(a({prompt:f,label:f}),o(""))},d=["/morning","/plan-tomorrow","/log","/analyse-day"],u=fd[n]||{efforts:[],models:[]},h=r||{},[p,m]=React.useState(h.model||"");React.useEffect(()=>{m(h.model||"")},[n,h.model]);const g=()=>{const f=p.trim();(h.model||"")!==f&&i({model:f||null})};return e.jsxs("section",{className:"rcon-launch","data-coach":"run-launcher","data-screen-label":"Run, start a task",children:[e.jsxs("div",{className:"rcon-launch-head",children:[e.jsx("span",{className:"m-kicker",children:"Run a task, watch it work"}),e.jsxs("span",{className:"rcon-launch-note",children:["One job, hands off: your real agent runs it against the vault, streams here, ends with an exit code. For a back-and-forth that remembers, ",e.jsx("button",{type:"button",className:"m-link",style:{font:"inherit",padding:0},onClick:()=>window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"})),children:"use Chat"}),"."]})]}),e.jsxs("div",{className:"rcon-askrow",children:[e.jsx("textarea",{className:"rcon-ask",rows:2,value:l,"aria-label":"Task for the agent",placeholder:"Say it plainly, e.g. “summarise what changed in my vault this week”",onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),c())}}),e.jsxs("button",{className:"m-cta rcon-go",onClick:c,disabled:!l.trim(),children:["Run & watch ",en("arrow",14)]})]}),e.jsxs("div",{className:"rcon-launch-foot",children:[e.jsx("div",{className:"rcon-agents",role:"radiogroup","aria-label":"Which agent runs the work",children:_r.map(f=>{const v=s==null?f.id==="claude-code":s.has(f.id),x=s==null;return e.jsxs("button",{type:"button",role:"radio","aria-checked":n===f.id,className:"rcon-agent"+(n===f.id?" is-on":"")+(v?"":" is-off"),disabled:!v&&!x,onClick:()=>v&&t(f.id),title:v?f.name+", installed":f.name+", not installed or not runnable",children:[e.jsx("span",{className:"rcon-adot"+(v?" is-ready":"")}),f.name]},f.id)})}),e.jsx("div",{className:"rcon-quick",children:d.map(f=>e.jsxs("button",{className:"m-mini rcon-qchip",onClick:()=>a({workflow:f,label:f}),title:"Run "+f+" and watch it",children:[en("play",11)," ",f]},f))})]}),e.jsxs("div",{className:"rcon-tune","data-screen-label":"Run, model and effort for this run",children:[e.jsxs("label",{className:"rcon-tune-field",children:[e.jsx("span",{className:"k",children:"Model"}),e.jsx("input",{className:"rcon-tune-in",type:"text",list:"rcon-models-"+n,value:p,placeholder:"provider default",spellCheck:!1,onChange:f=>m(f.target.value),onBlur:g,onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),g(),f.currentTarget.blur())}}),e.jsx("datalist",{id:"rcon-models-"+n,children:u.models.map(f=>e.jsx("option",{value:f},f))})]}),u.efforts.length?e.jsxs("div",{className:"rcon-tune-field",role:"radiogroup","aria-label":"Effort for this run",children:[e.jsx("span",{className:"k",children:"Effort"}),e.jsx("div",{className:"rcon-effs",children:u.efforts.map(f=>e.jsx("button",{type:"button",role:"radio","aria-checked":(h.effort||"")===f,className:"rcon-eff"+((h.effort||"")===f?" is-on":""),title:(h.effort||"")===f?"Click again to go back to the provider default":"Run at "+f+" effort",onClick:()=>i({effort:h.effort===f?null:f}),children:f},f))})]}):null,n==="gemini"?e.jsxs("label",{className:"rcon-tune-field",children:[e.jsx("span",{className:"k",children:"Approvals"}),e.jsx("select",{className:"rcon-tune-in is-select",value:h.approvalMode||"yolo",onChange:f=>i({approvalMode:f.target.value}),children:gd.map(([f,v])=>e.jsx("option",{value:f,children:v},f))})]}):null]})]})}function Sd({onRun:n}){const t=window.V3B&&window.V3B.commands||[],s=yd(t),[a,r]=React.useState(null);return s.length?e.jsxs("section",{className:"rcon-shelf","data-coach":"run-workflow-shelf","data-screen-label":"Run, workflows",children:[e.jsxs("div",{className:"rcon-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Workflows"}),e.jsxs("span",{className:"rcon-sec-note",children:[t.length," commands · what each reads, changes, and how risky it is"]})]}),e.jsx("div",{className:"rcon-wf-groups",children:s.map(i=>e.jsxs("div",{className:"rcon-wf-group",children:[e.jsx("span",{className:"rcon-wf-gk",children:i.k}),e.jsx("div",{className:"rcon-wf-list",children:i.items.map(l=>{const o=Qs[l.risk]||Qs[0],c=l.last&&l.last!=="—"?l.last:null,d=a===l.c,u=l.reads&&l.reads!=="—"?l.reads:null,h=l.writes&&l.writes!=="—"?l.writes:null;return e.jsxs("div",{className:"rcon-wf"+(d?" is-open":""),children:[e.jsxs("button",{type:"button",className:"rcon-wf-row","aria-expanded":d,onClick:()=>r(d?null:l.c),children:[e.jsx("span",{className:"rcon-wf-cmd",children:l.c}),e.jsx("span",{className:"rcon-wf-risk r-"+o.k,title:o.t,children:o.k}),c?e.jsx("span",{className:"rcon-wf-last",style:{marginLeft:"auto"},children:c}):null]}),e.jsx("button",{type:"button",className:"rcon-wf-go",onClick:()=>n({workflow:l.c,label:l.c}),"aria-label":"Run "+l.c+" and watch it",title:"Run "+l.c+" and watch it",children:en("play",13)}),d?e.jsxs("div",{className:"rcon-wf-detail",children:[l.what?e.jsx("p",{className:"rcon-wf-desc",children:l.what}):null,e.jsxs("div",{className:"rcon-wf-io",children:[u?e.jsxs("span",{children:[e.jsx("i",{children:"reads"})," ",u]}):null,h?e.jsxs("span",{children:[e.jsx("i",{children:"changes"})," ",h]}):null,!u&&!h?e.jsx("span",{className:"is-quiet",children:"io not declared yet"}):null]}),e.jsxs("button",{className:"m-cta-line rcon-wf-run",onClick:()=>n({workflow:l.c,label:l.c}),"aria-label":"Run "+l.c+" and watch it",children:[en("play",12)," Run & watch"]})]}):null]},l.c)})})]},i.k))})]}):e.jsxs("section",{className:"rcon-shelf","data-coach":"run-workflow-shelf","data-screen-label":"Run, workflows",children:[e.jsx("div",{className:"rcon-sec-head",children:e.jsx("span",{className:"m-kicker",children:"Workflows"})}),e.jsxs("p",{className:"rcon-empty",children:["No workflows found. Reinstall or run ",e.jsx("code",{children:"/mover-check"}),"."]})]})}function zr(){const n=wd(),t=xd(),[s,a]=React.useState("claude-code"),[r,i]=React.useState({}),l=React.useRef(!1);React.useEffect(()=>{t.loaded&&(i(C=>Object.keys(C).length?C:t.prefs||{}),t.agent&&!l.current&&a(t.agent))},[t.loaded]);const o=React.useCallback(C=>{l.current=!0,a(C),t.persist({preferredAgent:C})},[t.persist]),c=React.useCallback(C=>{i(P=>({...P,[s]:{...P[s]||{},...C}})),t.persist({providerPrefs:{[s]:C}})},[s,t.persist]),[d,u]=React.useState([]),[h,p]=React.useState(null),[m,g]=React.useState(0),f=React.useRef(0),v=React.useRef({}),x=React.useRef({}),b=React.useRef({}),j=React.useCallback((C,P)=>{u(M=>M.map(T=>T.id===C?{...T,...P}:T))},[]);React.useEffect(()=>{let C=!0;return(async()=>{try{const P=await(await fetch("/api/runs")).json();if(!C||!P||!P.ok||!Array.isArray(P.runs))return;u(P.runs.map(T=>({id:"s"+T.id,serverId:T.id,agent:T.agent,label:T.label,workflow:null,status:T.status,output:"",started:T.started,ended:T.ended,exit:T.exit,truncated:T.truncated})));let M=null;try{M=localStorage.getItem("m8.run.watch")||null}catch{}if(M){const T=P.runs.find(F=>String(F.id)===M);if(T)if(p("s"+T.id),T.status==="running"||T.status==="starting"||T.status==="stopping")k("s"+T.id,T.id);else try{const F=await(await fetch("/api/runs/get?id="+encodeURIComponent(T.id))).json();F&&F.ok&&F.run&&(x.current["s"+T.id]=!0,j("s"+T.id,{output:F.run.output||"",truncated:F.run.truncated}))}catch{}}}catch{}})(),()=>{C=!1}},[]);const A=d.some(C=>C.status==="running"||C.status==="starting"||C.status==="stopping");React.useEffect(()=>{if(!A)return;const C=setInterval(()=>g(P=>P+1),1e3);return()=>clearInterval(C)},[A]),React.useEffect(()=>{if(!A)return;const C=setInterval(async()=>{try{const P=await(await fetch("/api/runs")).json();if(!P||!P.ok||!Array.isArray(P.runs))return;const M={};P.runs.forEach(T=>{M[T.id]=T}),u(T=>T.map(F=>{const D=F.serverId&&M[F.serverId];return D&&!v.current[F.id]&&D.status!==F.status?F.status==="stopping"&&D.status==="running"?F:{...F,status:D.status,ended:D.ended,exit:D.exit}:F}))}catch{}},4e3);return()=>clearInterval(C)},[A]),React.useEffect(()=>()=>{Object.values(v.current).forEach(C=>{try{C.abort()}catch{}})},[]);const I=React.useCallback(async(C,P)=>{try{if(!P.ok||!P.body){j(C,{status:"failed",output:"Could not stream the run (HTTP "+P.status+").",ended:Date.now()});return}const M=P.body.getReader(),T=new TextDecoder;let F="";for(;;){const{value:V,done:H}=await M.read();if(H)break;F+=T.decode(V,{stream:!0}),j(C,{output:F})}const D=F.match(/exited with code (-?\d+)/),Y=/failed to start/i.test(F),z=D?Number(D[1]):null,y=Y?"failed":z==null||z===0?"done":"exited";u(V=>V.map(H=>H.id!==C?H:H.status==="stopping"?{...H,status:"stopped",ended:Date.now()}:H.status==="stopped"?{...H,ended:Date.now()}:{...H,status:y,exit:z,ended:Date.now()}))}catch(M){M&&M.name==="AbortError"||j(C,{status:"failed",ended:Date.now(),output:"[stream error] "+(M&&M.message||M)})}finally{delete v.current[C]}},[j]),k=React.useCallback(async(C,P)=>{if(v.current[C])return;x.current[C]=!0;const M=new AbortController;v.current[C]=M;let T;try{T=await fetch("/api/runs/stream?id="+encodeURIComponent(P),{signal:M.signal})}catch{delete v.current[C];return}await I(C,T)},[I]),S=React.useCallback(async({prompt:C,workflow:P,label:M})=>{const T="r"+ ++f.current,F=r[s]||{};u(H=>[{id:T,serverId:null,agent:s,model:F.model||null,effort:F.effort||null,label:M||P||C||"task",workflow:P||null,status:"starting",output:"",started:Date.now(),ended:null,exit:null},...H]),p(T),x.current[T]=!0;const D=await Qn(),Y=new AbortController;v.current[T]=Y;const z={model:F.model||void 0,effort:F.effort||void 0,approvalMode:F.approvalMode||void 0};let y;try{y=await fetch(P?"/api/workflow/run":"/api/agent/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":D||""},body:JSON.stringify(P?{workflow:P,agent:s,...z}:{agent:s,prompt:C,...z}),signal:Y.signal})}catch(H){delete v.current[T],H&&H.name==="AbortError"||j(T,{status:"failed",ended:Date.now(),output:"[stream error] "+(H&&H.message||H)});return}const V=y.headers.get("X-Mover-Run-Id");if(V)try{localStorage.setItem("m8.run.watch",String(V))}catch{}if(b.current[T]){if(delete b.current[T],j(T,{status:"stopping",serverId:V||null}),V)try{await Js("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:V})})}catch{}await I(T,y);return}j(T,{status:"running",serverId:V||null}),await I(T,y)},[s,r,j,I]),E=React.useCallback(C=>{const P=h!==C.id;p(P?C.id:null);try{P&&C.serverId?localStorage.setItem("m8.run.watch",String(C.serverId)):localStorage.removeItem("m8.run.watch")}catch{}!P||x.current[C.id]||!C.serverId||(C.status==="running"||C.status==="starting"||C.status==="stopping"?k(C.id,C.serverId):(x.current[C.id]=!0,(async()=>{try{const M=await(await fetch("/api/runs/get?id="+encodeURIComponent(C.serverId))).json();M&&M.ok&&M.run&&j(C.id,{output:M.run.output||"",truncated:M.run.truncated})}catch{}})()))},[h,k,j]),L=React.useCallback(C=>{const P=v.current[C.id];if(P)try{P.abort()}catch{}delete x.current[C.id],h===C.id&&p(null);try{localStorage.removeItem("m8.run.watch")}catch{}},[h]),w=React.useCallback(async C=>{if(j(C.id,{status:"stopping"}),!C.serverId){b.current[C.id]=!0;return}try{await Js("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:C.serverId})})}catch{}},[j]),N=C=>{u(P=>P.filter(M=>M.id!==C)),h===C&&p(null)};return e.jsxs("div",{className:"rcon",children:[e.jsx(Nd,{agent:s,setAgent:o,runnable:n,onRun:S,tune:r[s]||{},setTune:c}),e.jsxs("section",{className:"rcon-runs","data-coach":"run-terminal-list","data-screen-label":"Run, your runs",children:[e.jsxs("div",{className:"rcon-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Runs"}),d.length?e.jsxs("span",{className:"rcon-sec-note",children:[d.length," kept · click any to watch the stream"]}):null]}),d.length===0?e.jsxs("div",{className:"rcon-empty-well",children:[e.jsx("span",{className:"rcon-empty-mk",children:en("term",16)}),e.jsx("p",{children:"Nothing running yet. Start a task above, or run a workflow below."}),e.jsx("span",{className:"rcon-empty-sub",children:"You'll watch the real agent work here, line by line, to a real exit code. Runs stay here when you leave and come back."})]}):e.jsx("div",{className:"rcon-run-list",children:d.map(C=>e.jsx(bd,{run:C,open:h===C.id,onToggle:()=>E(C),onStopWatch:()=>L(C),onStopRun:()=>w(C),onHide:()=>N(C.id),tick:m},C.id))})]}),e.jsx(Sd,{onRun:S})]})}function Cd(){return e.jsxs("div",{className:"v8-run is-real","data-screen-label":"Run (v8, real console)",children:[e.jsx(zr,{}),e.jsx(Fr,{})]})}Object.assign(window,{RunViewV8:Cd,V8Fingerprint:Fr,RealRunConsole:zr});const pt=(n,t)=>window.MIcons&&typeof window.MIcons[n]=="function"?window.MIcons[n](t):null;async function Bn(){try{return(await(await fetch("/api/health")).json()).token||""}catch{return""}}function ft(n){const t=JSON.stringify(n||"").toLowerCase();return/\brm \b|rmdir|git push|--force|\bforce\b|\bdelete\b|drop table|truncate|\bsudo\b|chmod 777|>\s*\/|mkfs/.test(t)?"high":/\bedit\b|\bwrite\b|\bbash\b|\bmove\b|\bmkdir\b|\bchmod\b|\binstall\b|multiedit|notebookedit/.test(t)?"write":"read"}function Td(n){if(!n)return"approve this action";const t=n.input||n.tool_input||n.params||n;if(t&&typeof t.command=="string")return t.command;if(t&&typeof t.file_path=="string")return t.file_path;const s=n.tool_name||n.name||n.tool||n.request&&n.request.tool_name||"";let a="";try{a=JSON.stringify(t).replace(/^{|}$/g,"").slice(0,160)}catch{}return[s,a].filter(Boolean).join(" ")}function Zs(n){const t=n.ended||Date.now(),s=Math.max(0,Math.round((t-n.started)/1e3));return s<60?s+"s":Math.floor(s/60)+"m "+s%60+"s"}function Rd({run:n,onToggle:t,onStop:s,onAsk:a,tick:r}){const i=n.status==="starting"||n.status==="running"||n.status==="stopping",l={starting:"starting",running:"running",stopping:"stopping",stopped:"stopped",done:"finished",exited:"exited "+(n.exit==null?"":n.exit),failed:"failed"}[n.status]||n.status,o=React.useRef(null);return React.useEffect(()=>{i&&n.open&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n.output,i,n.open]),e.jsxs("div",{className:"v8c-run is-"+n.status,role:"group","aria-label":"One-shot run: "+n.label,children:[e.jsxs("button",{className:"v8c-run-head",onClick:t,"aria-expanded":n.open,children:[e.jsx("span",{className:"v8c-dot is-"+(i?"streaming":n.status==="done"?"ready":n.status==="failed"?"error":"idle"),"aria-hidden":"true"}),e.jsx("span",{className:"v8c-run-label",children:n.label}),e.jsxs("span",{className:"v8c-run-meta",children:[n.agent,n.model?" · "+n.model:"",n.effort?" · "+n.effort:""," · ",i?Zs(n)+"":l+" · "+Zs(n)]}),e.jsx("span",{className:"v8c-run-chev","aria-hidden":"true",children:n.open?"▾":"▸"})]}),n.open?e.jsx("pre",{className:"v8c-run-out",ref:o,children:n.output||(n.status==="starting"?"Launching the agent…":"No output.")}):null,e.jsxs("div",{className:"v8c-run-act",children:[i?e.jsx("button",{className:"v8c-btn is-deny",onClick:s,disabled:n.status==="stopping",children:n.status==="stopping"?"Stopping…":"Stop run"}):e.jsx("button",{className:"v8c-btn is-deny",onClick:a,children:"Ask about this"}),i?e.jsx("span",{className:"v8c-run-note",children:"Runs free of the conversation. Also on the Run screen."}):null]})]})}function Ed(){const[n,t]=React.useState([]),[s,a]=React.useState("connecting"),[r,i]=useStored3("m8.chat.model",""),[l,o]=React.useState(!1),c=async O=>{const W=[];for(const U of Array.from(O||[]))try{W.push({name:U.name,content:await U.text()})}catch{}if(W.length){if(!f.current){T("No live conversation to import into yet. Send one message first, then drop the files again.");return}try{const U=x.current||await Bn(),K=await(await fetch("/api/session/ingest",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":U},body:JSON.stringify({sessionId:f.current,files:W})})).json();K&&K.ok&&K.injected?T("Read "+W.length+" file"+(W.length===1?"":"s")+" into this conversation's context. Ask me about them, or carry on."):T("Nothing usable in "+(W.length===1?"that file":"those files")+". Plain text and markdown work best.")}catch{T("The import didn't reach the server. The conversation is unaffected; try the drop again.")}}},[d,u]=React.useState(null),[h,p]=React.useState(""),[m,g]=React.useState(""),f=React.useRef(null),v=React.useRef(null),x=React.useRef(""),b=React.useRef(null),j=React.useRef(!0),A=React.useRef(null),I=React.useRef(0),k=React.useRef(0),S=React.useRef({}),E=React.useRef({}),L=React.useRef(null),[w,N]=React.useState(0);React.useEffect(()=>{const O=U=>{p(String(U)),window.__v8chatPrefill="",setTimeout(()=>{A.current&&A.current.focus()},50)};window.__v8chatPrefill&&O(window.__v8chatPrefill);const W=U=>{!U||!U.detail||O(U.detail)};return window.addEventListener("v8chat-prefill",W),()=>window.removeEventListener("v8chat-prefill",W)},[]);const C=()=>{const O=b.current;O&&(j.current=O.scrollHeight-O.scrollTop-O.clientHeight<64)};React.useEffect(()=>{j.current&&b.current&&(b.current.scrollTop=b.current.scrollHeight)});const P=O=>t(W=>[...W,{id:"u"+W.length,who:"user",text:O}]),M=React.useCallback(()=>t(O=>O.map(W=>W.streaming?{...W,streaming:!1}:W)),[]),T=O=>t(W=>{const U=W[W.length-1];if(U&&U.who==="agent"&&U.streaming){const K=W.slice();return K[K.length-1]={...U,text:U.text+O},K}return[...W,{id:"a"+W.length,who:"agent",text:O,streaming:!0}]}),F=React.useCallback((O,W)=>{t(U=>U.map(K=>K.id===O&&K.who==="run"?{...K,...W}:K))},[]),D=n.some(O=>O.who==="run"&&(O.status==="starting"||O.status==="running"||O.status==="stopping"));React.useEffect(()=>{if(!D)return;const O=setInterval(()=>N(W=>W+1),1e3);return()=>clearInterval(O)},[D]);const Y=async()=>{const O=h.trim();if(!O)return;if(p(""),j.current=!0,A.current&&(A.current.style.height="auto"),!L.current)try{const re=await(await fetch("/api/config",{headers:{"X-Mover-Token":x.current||await Bn()}})).json(),fe=re&&re.config||{};L.current={agent:fe.preferredAgent||"claude-code",prefs:fe.providerPrefs||{}}}catch{L.current={agent:"claude-code",prefs:{}}}const W=L.current.agent||"claude-code",U=(L.current.prefs||{})[W]||{},K="run"+ ++k.current+"-"+Date.now();t(re=>[...re,{id:K,who:"run",agent:W,model:U.model||null,effort:U.effort||null,label:O.length>90?O.slice(0,87)+"…":O,status:"starting",output:"",serverId:null,started:Date.now(),ended:null,exit:null,open:!0}]);const xe=x.current||await Bn(),we=new AbortController;S.current[K]=we;let q;try{q=await fetch("/api/agent/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":xe||""},body:JSON.stringify({agent:W,prompt:O,model:U.model||void 0,effort:U.effort||void 0,approvalMode:U.approvalMode||void 0}),signal:we.signal})}catch(re){delete S.current[K],re&&re.name==="AbortError"||F(K,{status:"failed",ended:Date.now(),output:"[stream error] "+(re&&re.message||re)});return}const G=q.headers.get("X-Mover-Run-Id");if(E.current[K]){if(delete E.current[K],F(K,{status:"stopping",serverId:G||null}),G)try{await fetch("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":xe||""},body:JSON.stringify({id:G})})}catch{}}else F(K,{status:"running",serverId:G||null});try{if(!q.ok||!q.body){F(K,{status:"failed",output:"Could not stream the run (HTTP "+q.status+").",ended:Date.now()});return}const re=q.body.getReader(),fe=new TextDecoder;let _e="",tn=!1;for(;;){const{value:Je,done:me}=await re.read();if(me)break;if(_e+=fe.decode(Je,{stream:!0}),!tn){const _=_e.match(/agent=\S+ model=(\S+) effort=(\S+)/);if(_){tn=!0,F(K,{output:_e,model:_[1],effort:_[2]});continue}}F(K,{output:_e})}const ne=_e.match(/exited with code (-?\d+)/),he=/failed to start/i.test(_e),Se=ne?Number(ne[1]):null,sn=he?"failed":Se==null||Se===0?"done":"exited";t(Je=>Je.map(me=>me.id!==K||me.who!=="run"?me:me.status==="stopping"||me.status==="stopped"?{...me,status:"stopped",ended:Date.now()}:{...me,status:sn,exit:Se,ended:Date.now()}))}catch(re){re&&re.name==="AbortError"||F(K,{status:"failed",ended:Date.now(),output:"[stream error] "+(re&&re.message||re)})}finally{delete S.current[K]}},z=async O=>{if(F(O.id,{status:"stopping"}),!O.serverId){E.current[O.id]=!0;return}try{await fetch("/api/runs/stop",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x.current||""},body:JSON.stringify({id:O.serverId})})}catch{}},y=O=>{const W=(O.output||"").trim().slice(-400);p('About the run "'+O.label+'"'+(W?' (it ended with: "…'+W.slice(-160).replace(/\s+/g," ")+'")':"")+". "),setTimeout(()=>A.current&&A.current.focus(),0)};React.useEffect(()=>()=>{Object.values(S.current).forEach(O=>{try{O.abort()}catch{}})},[]);const V=React.useCallback(async O=>{const W=typeof O=="string"?O:r;try{v.current&&v.current.close()}catch{}a("connecting"),g("");const U=await Bn();if(x.current=U,f.current){const we=f.current;f.current=null;try{fetch("/api/session/end",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":U},body:JSON.stringify({sessionId:we})}).catch(()=>{})}catch{}}let K;try{K=await(await fetch("/api/session/start",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":U},body:JSON.stringify({agent:"claude-code",mode:"chat",...W?{model:W}:{}})})).json()}catch{a("error"),g("Could not reach the dashboard server.");return}if(!K||!K.ok||!K.sessionId){a("error"),g(K&&K.error||"The agent session did not start. Is `claude` installed and on PATH?");return}f.current=K.sessionId,window.__moverChatLive=!0;const xe=new EventSource("/api/session/events?id="+encodeURIComponent(K.sessionId));v.current=xe,xe.onopen=()=>a(we=>we==="streaming"?we:"ready"),xe.onmessage=we=>{let q;try{q=JSON.parse(we.data)}catch{return}q.kind==="assistant"?(T(q.text),a("streaming")):q.kind==="result"?(M(),a("ready")):q.kind==="permission"?(u({requestId:q.requestId,request:q.request}),I.current=Date.now()):q.kind==="error"?(M(),g(q.message||"The agent reported an error."),a("error"),window.__moverChatLive=!1):q.kind==="closed"&&(M(),a("idle"),window.__moverChatLive=!1)},xe.onerror=()=>a(we=>we==="streaming"||we==="error"?we:"connecting")},[r]);React.useEffect(()=>{V();const O=()=>{if(window.__moverChatLive=!1,!!f.current)try{fetch("/api/session/end",{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-Mover-Token":x.current},body:JSON.stringify({sessionId:f.current})})}catch{}};return window.addEventListener("pagehide",O),()=>{window.removeEventListener("pagehide",O);try{v.current&&v.current.close()}catch{}O()}},[V]),React.useEffect(()=>{const O=n.length&&n[n.length-1].streaming;if(s!=="streaming"||!O)return;const W=setTimeout(()=>{M(),a(U=>U==="streaming"?"idle":U)},25e3);return()=>clearTimeout(W)},[s,n,M]);const H=async()=>{const O=h.trim();if(!(!O||!f.current||s==="streaming")){P(O),p(""),j.current=!0,a("streaming"),A.current&&(A.current.style.height="auto");try{await fetch("/api/session/send",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x.current},body:JSON.stringify({sessionId:f.current,text:O})})}catch{g("Could not send your message."),a("error")}}},R=async O=>{if(!d||Date.now()-I.current<300)return;const W=d;u(null);try{await fetch("/api/session/approve",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":x.current},body:JSON.stringify({sessionId:f.current,requestId:W.requestId,decision:O})})}catch{}};React.useEffect(()=>{if(!d)return;const O=W=>{W.key==="Escape"&&Date.now()-I.current>=300&&R("deny")};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[d]);const Q=O=>{if(O.key==="Enter"&&(O.metaKey||O.ctrlKey)){O.preventDefault(),Y();return}O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),H())},je=O=>{p(O.target.value);const W=A.current;W&&(W.style.height="auto",W.style.height=Math.min(W.scrollHeight,168)+"px")},se=s==="streaming",ke=n.length&&n[n.length-1].streaming;return e.jsxs("div",{className:"v8-chat"+(l?" is-dragover":""),"data-screen-label":"Chat, talk to your co-founder",onDragOver:O=>{O.dataTransfer&&Array.from(O.dataTransfer.types||[]).includes("Files")&&(O.preventDefault(),o(!0))},onDragLeave:O=>{(O.currentTarget===O.target||!O.currentTarget.contains(O.relatedTarget))&&o(!1)},onDrop:O=>{O.preventDefault(),o(!1),c(O.dataTransfer&&O.dataTransfer.files)},children:[e.jsxs("div",{className:"v8c-head",children:[e.jsxs("span",{className:"v8c-title",children:[pt("chat",17)," Chat"]}),e.jsxs("span",{className:"v8c-state",children:[e.jsxs("select",{className:"v8c-model",value:r,"aria-label":"Model for this conversation",title:"Model for this conversation. Changing it restarts the conversation.",onChange:O=>{const W=O.target.value;i(W),t([]),V(W)},children:[e.jsx("option",{value:"",children:"default model"}),e.jsx("option",{value:"sonnet",children:"sonnet"}),e.jsx("option",{value:"opus",children:"opus"}),e.jsx("option",{value:"haiku",children:"haiku"}),e.jsx("option",{value:"fable",children:"fable"})]}),e.jsx("span",{className:"v8c-dot is-"+s,"aria-hidden":"true"}),e.jsx("span",{className:"v8c-status","aria-live":"polite",children:s==="streaming"?"thinking…":s==="ready"?"ready":s==="connecting"?"connecting…":s==="error"?"offline":"idle"})]})]}),e.jsxs("div",{className:"v8c-log",ref:b,onScroll:C,role:"log","aria-live":"polite","aria-atomic":"false","aria-label":"Conversation",children:[n.length===0&&s!=="error"?e.jsxs("div",{className:"v8c-empty",children:[e.jsx("div",{className:"v8c-empty-h m-serif",children:window.Reveal?e.jsx(window.Reveal,{as:"span",children:"Your co-founder, inside the vault."}):"Your co-founder, inside the vault."}),e.jsx("div",{className:"v8c-empty-p",children:"Full tool access. It reads and edits your files and runs commands, and you approve each action."}),e.jsx("div",{className:"v8c-chips",children:(()=>{const O=window.MSTATE||{},W=["What should I work on right now?"];O.strategy&&O.strategy.singleTest&&W.push("Where does my bet stand?"),O.daily&&O.daily.today&&O.daily.today.exists?W.push("What's left on today's plan?"):W.push("Set up today's plan with me.");const U=Array.isArray(O.suggestedNow)&&O.suggestedNow[0]&&O.suggestedNow[0].workflow;return U&&W.length<4&&W.push("Why are you suggesting "+U+"?"),W.slice(0,3).map(K=>e.jsx("button",{className:"v8c-chip",onClick:()=>{p(K),setTimeout(()=>A.current&&A.current.focus(),0)},children:K},K))})()})]}):null,n.map(O=>O.who==="run"?e.jsx(Rd,{run:O,tick:w,onToggle:()=>F(O.id,{open:!O.open}),onStop:()=>z(O),onAsk:()=>y(O)},O.id):e.jsx("div",{className:"v8c-msg is-"+O.who,children:e.jsxs("div",{className:"v8c-bubble",children:[O.text,O.streaming?e.jsx("span",{className:"v8c-caret","aria-hidden":"true"}):null]})},O.id)),se&&!ke?e.jsx("div",{className:"v8c-msg is-agent",children:e.jsxs("div",{className:"v8c-bubble v8c-typing","aria-label":"thinking",children:[e.jsx("i",{}),e.jsx("i",{}),e.jsx("i",{})]})}):null,d?e.jsxs("div",{className:"v8c-perm is-"+ft(d.request),role:"region","aria-label":"Approval required",children:[e.jsxs("div",{className:"v8c-perm-h",children:[e.jsx("span",{className:"v8c-badge",children:ft(d.request)==="high"?"destructive":ft(d.request)==="write"?"writes files":"reads"}),"The agent wants to run"]}),e.jsx("pre",{className:"v8c-perm-cmd",children:Td(d.request)}),e.jsxs("div",{className:"v8c-perm-act",children:[e.jsxs("button",{className:"v8c-btn is-allow",onClick:()=>R("allow"),autoFocus:!0,children:["Allow ",e.jsx("kbd",{children:"↵"})]}),e.jsxs("button",{className:"v8c-btn is-deny",onClick:()=>R("deny"),children:["Deny ",e.jsx("kbd",{children:"esc"})]})]})]}):null,m?e.jsxs("div",{className:"v8c-err",role:"alert",children:[e.jsx("b",{children:"Something went wrong."})," ",e.jsx("span",{children:m}),e.jsx("button",{className:"v8c-relink",onClick:V,children:"Reconnect"})]}):null]}),e.jsxs("div",{className:"v8c-composer",children:[e.jsx("textarea",{ref:A,className:"v8c-input",rows:1,value:h,placeholder:"Message your co-founder… · Enter to send, Shift+Enter for a new line",onChange:je,onKeyDown:Q,disabled:s==="error","aria-label":"Message"}),e.jsx("button",{className:"v8c-runbtn",onClick:Y,disabled:!h.trim(),title:h.trim()?"Run as a one-shot task. It works on its own while the conversation stays free. Cmd+Enter":"Type a task first, then run it as a one-shot","aria-label":"Run as a one-shot task",children:pt("play",16)||"Run"}),e.jsx("button",{className:"v8c-send",onClick:H,disabled:!h.trim()||se,title:se?"Thinking…":"Send","aria-label":"Send",children:se?e.jsx("span",{className:"v8c-spin","aria-hidden":"true"}):pt("arrow",18)||"→"})]})]})}Object.assign(window,{ChatViewV8:Ed});function Vr({days:n,sel:t,setSel:s}){const a=n||[];if(!a.length)return null;const r=840,i=132,l=18,o=i-26,c=16,d=Math.max(1,...a.map(w=>w.total||0)),u=(r-l*2)/Math.max(1,a.length-1),h=w=>l+u*w,p=w=>(w.total||0)/d*(o-c),m=w=>o-p(w),g=(w,N)=>w/N*100;a.map((w,N)=>h(N)+","+m(w)).join(" ");const f=a.map((w,N)=>[h(N),m(w)]),v=w=>{let N="";for(let C=0;C<w.length-1;C++){const P=w[C-1]||w[C],M=w[C],T=w[C+1],F=w[C+2]||T,D=.16;N+=" C"+(M[0]+(T[0]-P[0])*D).toFixed(2)+" "+(M[1]+(T[1]-P[1])*D).toFixed(2)+" "+(T[0]-(F[0]-M[0])*D).toFixed(2)+" "+(T[1]-(F[1]-M[1])*D).toFixed(2)+" "+T[0].toFixed(2)+" "+T[1].toFixed(2)}return N},x=f.length>1?"M"+f[0][0]+" "+f[0][1]+v(f):"",b=f.length>1?"M"+h(0)+" "+o+" L"+f[0][0]+" "+f[0][1]+v(f)+" L"+h(a.length-1)+" "+o+" Z":"",j=a[t]||a[a.length-1],A=a.reduce((w,N)=>w+(N.total||0),0),I=a.filter(w=>w.pub).length,k=React.useRef(null),[S,E]=React.useState(!1),L=w=>{const N=k.current;if(!N||a.length<2)return;const C=N.getBoundingClientRect(),P=(w-C.left)/C.width,M=Math.round((P*r-l)/u);s(Math.max(0,Math.min(a.length-1,M)))};return e.jsxs("section",{className:"v8cad-sec","data-screen-label":"Evidence, cadence",children:[e.jsxs("div",{className:"v8cad-head",children:[e.jsx("span",{className:"m-kicker",children:"The record"}),e.jsxs("span",{className:"v8cad-total",children:[e.jsx("span",{className:"v8cad-total-n m-num",children:A}),e.jsxs("span",{className:"v8cad-total-u",children:["receipts in ",a.length," days · ",I," published"]})]}),e.jsxs("span",{className:"v8cad-sel",children:[e.jsx("b",{children:j.d}),e.jsx("span",{className:"v8cad-sel-n m-num",children:j.total||0})," receipts",j.pub?e.jsx("span",{className:"v8cad-sel-pub",children:"· published"}):null]})]}),e.jsxs("div",{className:"v8cad",ref:k,style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:w=>{E(!0);try{w.currentTarget.setPointerCapture(w.pointerId)}catch{}L(w.clientX)},onPointerMove:w=>{S&&L(w.clientX)},onPointerUp:()=>E(!1),onPointerCancel:()=>E(!1),children:[e.jsxs("svg",{className:"v8cad-svg",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("line",{className:"v8cad-base",x1:l,y1:o,x2:r-l,y2:o}),e.jsx("path",{className:"v8cad-area",d:b}),e.jsx("path",{className:"v8cad-trace",d:x,pathLength:"1",fill:"none"}),a.map((w,N)=>e.jsxs("g",{style:{"--i":N},children:[e.jsx("line",{className:"v8cad-stem"+(w.pub?" is-pub":"")+(N===t?" is-sel":""),x1:h(N),y1:o,x2:h(N),y2:m(w)}),w.pub?e.jsx("circle",{className:"v8cad-pip",cx:h(N),cy:m(w),r:"3.4"}):null,N===t?e.jsx("circle",{className:"v8cad-sel-dot",cx:h(N),cy:m(w),r:"4"}):null]},N))]}),e.jsx("div",{className:"v8cad-axis",children:a.map((w,N)=>e.jsx("button",{type:"button",className:"v8cad-day"+(N===t?" is-sel":""),style:{left:g(h(N),r)+"%"},onClick:()=>s(N),"aria-label":w.d+", "+(w.total||0)+" receipts"+(w.pub?", published":""),children:e.jsx("span",{className:"v8cad-dl",children:(w.d||"").replace(/^[A-Za-z]+ /,"")})},N))})]})]})}function Id({D:n,onNav:t,rollout:s}){const a=window,r=a.EvidenceView,i=n&&n.__sparse,l=i?Object.assign({},a.V4E,{days:(a.V4ESPARSE||{}).days}):a.V4E,[o,c]=a.useStored3?a.useStored3("m4.evlens","proof"):React.useState("proof"),[d,u]=React.useState((l&&l.days?l.days.length:1)-1);if(React.useEffect(()=>{l&&l.days&&u(l.days.length-1)},[i]),!l||!l.days||typeof a.ReceiptsIntel!="function"||typeof a.M4E_LENSES>"u")return e.jsx("div",{className:"v8-ev",children:typeof r=="function"?e.jsx(r,{D:n,onNav:t,rollout:s}):null});const h=a.M4E_LENSES,p=h.some(g=>g.id===o)?o:"proof",m={proof:l.days[d]?l.days[d].total:null,pace:null,cadence:null,sessions:(l.sessions||[]).length,patterns:(l.ladder||[]).length,said:(l.saidDone||[]).length,domains:3};return e.jsx("div",{className:"v8-ev","data-screen-label":"Evidence (v8 distinctive)",children:e.jsxs("div",{className:"m-wrap",children:[e.jsx(Vr,{days:l.days,sel:d,setSel:u}),(s||"full")==="full"?e.jsxs("div",{className:"v8ev-saidrow",style:{display:"flex",alignItems:"flex-start",gap:16,marginBottom:18,flexWrap:"wrap"},children:[a.SaidVsDone?e.jsx(a.SaidVsDone,{}):null,a.RewindPill?e.jsx("div",{style:{flex:"0 0 auto"},children:e.jsx(a.RewindPill,{})}):null]}):null,e.jsx("div",{className:"v8ev-sep","aria-hidden":"true"}),e.jsxs("div",{className:"m4e-room",children:[e.jsx("nav",{className:"m4e-lenses","aria-label":"Evidence lenses",children:["Proof","Pace","Work","Integrity"].map(g=>e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"m4e-lensgrp",children:g}),h.filter(f=>f.grp===g).map(f=>e.jsxs("button",{className:"m4e-lens"+(p===f.id?" is-on":""),onClick:()=>c(f.id),children:[f.k,!i&&m[f.id]?e.jsx("span",{className:"n m-num",children:m[f.id]}):null]},f.id))]},g))}),e.jsxs("div",{className:"m4e-main",children:[p==="proof"?e.jsxs(React.Fragment,{children:[e.jsx(a.ReceiptsIntel,{E:l,sel:d,setSel:u,sparse:i,onLens:c,onNav:t}),a.Scoreboard?e.jsx(a.Scoreboard,{E:l,sparse:i}):null]}):null,p==="pace"&&a.PaceChart?e.jsx(a.PaceChart,{E:l,sel:d,sparse:i}):null,p==="cadence"&&a.CadenceLens?e.jsx(a.CadenceLens,{E:l,sparse:i}):null,p==="sessions"&&a.SessionsLens?e.jsx(a.SessionsLens,{E:l,sel:d,sparse:i}):null,p==="patterns"&&a.PatternsLens?e.jsx(a.PatternsLens,{E:l,sparse:i}):null,p==="said"&&a.SaidDoneLens?e.jsx(a.SaidDoneLens,{E:l,sparse:i}):null,p==="domains"&&a.DomainsLens?e.jsx(a.DomainsLens,{E:l,sparse:i}):null,p==="account"&&a.AccountLens?e.jsx(a.AccountLens,{sparse:i}):null,p==="replay"&&a.ReplayLens?e.jsx(a.ReplayLens,{sparse:i}):null,p==="thread"&&a.ThreadLens?e.jsx(a.ThreadLens,{sparse:i}):null,p==="friction"&&a.FrictionLens?e.jsx(a.FrictionLens,{sparse:i}):null,a.CoverageStrip?e.jsx(a.CoverageStrip,{E:a.V4E}):null]})]})]})})}Object.assign(window,{EvidenceViewV8:Id,V8Cadence:Vr});function Md(n){return(n||[]).filter(t=>(t.total||0)>0).length}const Ad={Publish:"pub",Override:"notch",Refusal:"notch",Insight:"split",Decision:"bar",Run:"dot",Faith:"ring",Artifact:"dot",Person:"dot",Vitality:"dot"},Fn=()=>window.MSTATE||{},De=n=>n!=null&&n!==""&&n!=="—"&&!(typeof n=="number"&&Number.isNaN(n));function On(n){try{return new Date(n+"T12:00:00Z").toLocaleDateString("en-GB",{month:"short",day:"numeric",timeZone:"UTC"})}catch{return n||"unknown date"}}function Ld(n){if(typeof n!="string"||!n.trim())return null;let t=n.replace(/\s*\[[^\]]*\]\s*$/,"").trim();t=t.replace(/^.*?(single test|the goal|focus)\s*(\([^)]*\))?\s*[::-]\s*/i,"");const s=t.search(/\.\s*(current|so far|status|now)\b/i);return s>12&&(t=t.slice(0,s)),t.replace(/\.+\s*$/,"").trim()||null}function Wr({days:n,sel:t,setSel:s,sparse:a}){const r=n||[];if(!r.length)return null;const i=Md(r),l=!a&&i>=7,o=860,c=150,d=18,u=18,h=104,p=130,m=Math.max(1,...r.map(M=>M.total||0)),g=(o-d*2)/Math.max(1,r.length-1),f=M=>d+g*M,v=M=>h-(M.total||0)/m*(h-u),x=M=>M/o*100,b=r.map((M,T)=>[f(T),v(M)]),j=M=>{let T="";for(let F=1;F<M.length;F++)T+=" L"+M[F][0].toFixed(2)+" "+M[F][1].toFixed(2);return T},A=l&&b.length>1?"M"+b[0][0]+" "+b[0][1]+j(b):"",I=l&&b.length>1?"M"+f(0)+" "+h+" L"+b[0][0]+" "+b[0][1]+j(b)+" L"+f(r.length-1)+" "+h+" Z":"",k=r.reduce((M,T)=>M+(T.total||0),0),S=r.filter(M=>M.pub).length,E=r[t]||r[r.length-1],L=React.useRef(null),[w,N]=React.useState(!1),C=M=>{const T=L.current;if(!T||r.length<2)return;const F=T.getBoundingClientRect(),D=Math.round(((M-F.left)/F.width*o-d)/g);s(Math.max(0,Math.min(r.length-1,D)))},P=M=>{M.key==="ArrowLeft"?(M.preventDefault(),s(Math.max(0,t-1))):M.key==="ArrowRight"&&(M.preventDefault(),s(Math.min(r.length-1,t+1)))};return e.jsxs("section",{className:"v9i","data-coach":"evidence-instrument","data-screen-label":"Evidence, the record",children:[e.jsxs("div",{className:"v9i-head",children:[e.jsxs("span",{className:"v9i-tot",children:[e.jsx("span",{className:"v9i-tot-n m-num",children:k}),e.jsxs("span",{className:"v9i-tot-u",children:["receipts in ",r.length," days · ",e.jsx("span",{className:"m-num",children:S})," published"]})]}),e.jsxs("span",{className:"v9i-sel",children:[e.jsx("b",{children:E.d})," ",e.jsx("span",{className:"m-num",children:E.total??0}),E.pub?e.jsx("span",{className:"v9i-shipped",children:"shipped"}):null]})]}),e.jsxs("div",{className:"v9i-plot",ref:L,style:{cursor:"ew-resize",touchAction:"none"},tabIndex:0,role:"img",onKeyDown:P,"aria-label":k+" receipts across "+r.length+" days, "+S+" published. Selected "+(E.d||"")+".",onPointerDown:M=>{N(!0);try{M.currentTarget.setPointerCapture(M.pointerId)}catch{}C(M.clientX)},onPointerMove:M=>{w&&C(M.clientX)},onPointerUp:()=>N(!1),onPointerCancel:()=>N(!1),children:[e.jsxs("svg",{className:"v9i-svg",viewBox:"0 0 "+o+" "+c,preserveAspectRatio:"none","aria-hidden":"true",children:[e.jsx("line",{className:"v9i-base",x1:d,y1:h,x2:o-d,y2:h}),e.jsx("line",{className:"v9i-publane",x1:d,y1:p,x2:o-d,y2:p}),l?e.jsx("path",{className:"v9i-area",d:I}):null,l?e.jsx("path",{className:"v9i-trace",d:A,pathLength:"1",fill:"none"}):null,r.map((M,T)=>e.jsx("g",{style:{"--i":T},children:e.jsx("line",{className:"v9i-stem"+(T===t?" is-sel":""),x1:f(T),y1:h,x2:f(T),y2:v(M)})},T)),e.jsx("line",{className:"v9i-plumb",x1:f(t),y1:u-4,x2:f(t),y2:p+9})]}),e.jsx("div",{className:"v9i-pips","aria-hidden":"true",children:r.map((M,T)=>M.pub?e.jsx("span",{className:"v9i-pip"+(M.live?" is-live":""),style:{left:x(f(T))+"%"},title:M.d+" · published"},T):null)}),e.jsx("div",{className:"v9i-axis",children:r.map((M,T)=>e.jsx("button",{type:"button",className:"v9i-day"+(T===t?" is-sel":""),style:{left:x(f(T))+"%"},onClick:()=>s(T),"aria-label":M.d+", "+(M.total||0)+" receipts"+(M.pub?", published":""),children:e.jsx("span",{className:"v9i-dl",children:(M.d||"").replace(/^[A-Za-z]+ /,"")})},T))})]}),l?null:e.jsx("p",{className:"v9i-gate",children:a?"The trace draws once seven days are on the record.":"Seven days of receipts draw the trace."})]})}function Br({E:n,sel:t,sparse:s,onNav:a}){const r=window,i=n.days[t]||n.days[n.days.length-1],l=s?null:n.strongest,o={contradiction:"var(--m-warn)",pattern:"var(--m-gold)",moved:"var(--m-gold-2)",needs:"rgba(235,210,165,0.35)"};return e.jsxs("section",{className:"v9r","data-coach":"evidence-readout","data-screen-label":"Evidence, the read-out",children:[e.jsxs("div",{className:"v9r-verdict",children:[e.jsx("span",{className:"m-kicker",children:"The biggest thing right now"}),l?e.jsx("p",{className:"v9r-vline",children:r.X?e.jsx(r.X,{claim:"The biggest thing right now",value:l.sub,src:l.src,children:l.line}):l.line}):e.jsx("p",{className:"v9r-vline is-null",children:r.V4ESPARSE&&r.V4ESPARSE.strongestEmpty||"Synthesis starts at about ten days on the record."}),!s&&(n.insights||[]).length?e.jsx("div",{className:"v9r-flags",children:n.insights.map(c=>e.jsxs("button",{type:"button",className:"v9r-flag",title:c.sub,"aria-label":"Finding: "+c.line,onClick:()=>r.openXray?r.openXray("Finding · "+(c.kind||""),c.line,c.src):null,children:[e.jsx("span",{className:"v9r-flagdot",style:{background:o[c.kind]||"var(--m-line-2)"},"aria-hidden":"true"}),e.jsx("span",{className:"v9r-flagl",children:c.line})]},c.line))}):null]}),e.jsxs("div",{className:"v9r-day",children:[e.jsxs("div",{className:"v9r-dayhead",children:[e.jsx("b",{children:i.d}),i.total!=null?e.jsxs("span",{children:[e.jsx("span",{className:"m-num",children:i.total})," ",i.total===1?"receipt":"receipts"]}):null,i.live?e.jsxs("span",{className:"v9r-live",children:[e.jsx("span",{className:"m-dot is-live"}),"live"]}):null]}),(i.receipts||[]).filter(c=>c.t&&c.t!=="—").map((c,d)=>e.jsxs("button",{type:"button",className:"v9r-rec",onClick:()=>r.openXray?r.openXray("Receipt · "+c.t,i.d+" · "+c.cat+" · moved "+c.moved,"sessions"):null,"aria-label":(c.time&&c.time!=="—"?c.time+" ":"")+c.cat+": "+c.t+", moved "+c.moved,children:[e.jsx("span",{className:"v9r-tm m-num",children:c.time&&c.time!=="—"?c.time:""}),e.jsx("span",{className:"v9cat is-"+(Ad[c.cat]||"dot")+(c.cat==="Publish"?" is-gold":""),title:c.cat,"aria-hidden":"true"}),e.jsxs("span",{className:"v9r-t",children:[c.t,e.jsxs("span",{className:"v9r-mv",children:["moved ",e.jsx("b",{children:c.moved})]})]}),c.live?e.jsxs("span",{className:"m-chip",children:[e.jsx("span",{className:"m-dot is-live",style:{width:6,height:6}}),"live"]}):null]},c.t+d)),s?e.jsx(r.Empty,{title:"Three receipts. That's the whole record.",line:"Honest beats full. Each block, publish, and decision adds a line; synthesis starts around day ten."}):null]})]})}function Od({calls:n}){const t=window,[s,a]=React.useState(!1);return e.jsxs("div",{className:"v9b-calls",children:[e.jsxs("button",{type:"button",className:"v9b-callstog",onClick:()=>a(!s),"aria-expanded":s,children:[s?"Hide":"Show"," the ",n.length," scored ",n.length===1?"call":"calls",t.MIcons?t.MIcons.arrow(12):null]}),s?e.jsx("div",{className:"v9b-calllist",children:n.map((r,i)=>e.jsxs("div",{className:"v9b-call",children:[e.jsx("span",{className:"v9b-call-d",children:r.d}),e.jsx("span",{className:"v9b-call-c",children:r.call}),e.jsx("span",{className:"v9b-call-w "+(r.won==="system"?"is-sys":"is-you"),children:r.won==="system"?"system":"you"}),e.jsx("span",{className:"v9b-call-o",children:r.line})]},(r.d||"")+i))}):null]})}function Hr({E:n,sparse:t}){const s=window,a=n.scoreboard||{};if(t||(a.scored||0)===0&&(!a.calls||!a.calls.length)){const u=!t&&Number.isFinite(a.pending)&&a.pending>0?a.pending:0;return e.jsxs("div",{className:"v9b is-null",children:[e.jsx("span",{className:"m-kicker",children:"Who was right"}),e.jsx("p",{className:"v9b-null",children:u>0?u+" override"+(u===1?"":"s")+" on record, none scored. Scoring starts when outcomes are measured.":s.V4ESPARSE&&s.V4ESPARSE.scoreboardEmpty||"Nothing scored yet. The first time you and the no disagree and it's scored, it lands here."})]})}const i=Number.isFinite(a.sys)?a.sys:0,l=Number.isFinite(a.you)?a.you:0,o=Number.isFinite(a.pending)?a.pending:0,d=(Number.isFinite(a.scored)?a.scored:i+l)<5?"Not enough scored yet to say. Each call is scored by what it cost.":i>l?"The no has been right more often than you. Not always.":l>i?"You have been right more often than the no. Not always.":"Even so far. Each call is scored by what it cost.";return e.jsxs("div",{className:"v9b",children:[e.jsxs("div",{className:"v9b-head",children:[e.jsx("span",{className:"m-kicker",children:"Who was right"}),e.jsxs("span",{className:"v9b-rule",children:[e.jsx("span",{className:"m-num",children:a.scored??0})," scored · ",e.jsx("span",{className:"m-num",children:o})," pending"]})]}),e.jsxs("div",{className:"v9b-rail",role:"img","aria-label":"System "+i+", you "+l+", "+o+" pending",children:[e.jsxs("span",{className:"v9b-seg is-sys"+(i>=l?" is-lead":""),style:{flexGrow:i+.04},children:[e.jsx("span",{className:"m-num",children:a.sys??0}),e.jsx("span",{className:"v9b-who",children:"the system"})]}),e.jsxs("span",{className:"v9b-seg is-you"+(l>i?" is-lead":""),style:{flexGrow:l+.04},children:[e.jsx("span",{className:"m-num",children:a.you??0}),e.jsx("span",{className:"v9b-who",children:"you"})]})]}),o>0?e.jsxs("div",{className:"v9b-pend","aria-label":o+" calls still scoring",children:[Array.from({length:Math.min(o,14)}).map((u,h)=>e.jsx("span",{className:"v9b-pip","aria-hidden":"true"},h)),e.jsxs("span",{className:"v9b-pendl",children:[o," still scoring"]})]}):null,e.jsx("p",{className:"v9b-verdict",children:d}),a.calls&&a.calls.length?e.jsx(Od,{calls:a.calls}):null]})}function $r({sparse:n}){const t=window,s=Fn(),a=Ld(s.daily&&s.daily.today&&s.daily.today.focus||t.V4&&t.V4.bet&&t.V4.bet.iff),r=s.distribution||{},i=s.streak||{},l=s.activation||{},o=De(r.total7d)?r.total7d:null,c=De(r.delta7d)?r.delta7d:null,d=De(i.currentStreak)?i.currentStreak:null,u=l&&l.available&&De(l.workflowRuns7d)?l.workflowRuns7d:null,h=s.sessionTime||{},p=h.available&&h.last7d&&h.last7d.minutes>0?Math.round(h.last7d.minutes/6)/10:null,m=s.activeContext&&s.activeContext.workflowState||null,g=(()=>{if(!m)return null;const k=7*864e5;let S=0;for(const[E,L]of Object.entries(m)){if(!/_last_run$/.test(E))continue;const w=Date.parse(String(L));Number.isFinite(w)&&Date.now()-w<=k&&(S+=1)}return S})();if(n||!a&&o==null&&d==null&&p==null)return null;const f=[];p!=null&&f.push({k:p+"h tracked this week",warm:!0,src:"sessions"}),d!=null&&f.push({k:d===0?"no days logged in a row":d+" day"+(d===1?"":"s")+" logged in a row",warm:d>=7,src:"streaks"}),o!=null&&f.push({k:o+" receipt"+(o===1?"":"s")+" this week"+(c!=null&&c!==0?" ("+(c>0?"+":"")+c+")":""),warm:o>0,src:"metrics"}),g!=null&&g>0?f.push({k:g+" workflow"+(g===1?"":"s")+" ran this week",warm:!0,src:"context"}):u!=null&&f.push({k:u+" run"+(u===1?"":"s")+" from this dashboard this week",warm:u>0,src:"activation"});const v=s.goalForecast||{},x=!!(v.available&&v.target);let b;const j=[];p!=null&&p>=5&&j.push(p+"h tracked"),d!=null&&d>=7&&j.push("a "+d+"-day streak");const A=j.length>0||o!=null&&o>0;if(x&&v.status==="complete")b="Called: "+v.current+" of "+v.target+" "+v.unit+". The test is met. Write the next one while the win is warm.";else if(x&&v.status==="failed")b="The test expired"+(v.daysRemaining!=null?" "+Math.abs(v.daysRemaining)+" day"+(Math.abs(v.daysRemaining)===1?"":"s")+" ago":"")+" at "+v.current+" of "+v.target+" "+v.unit+". The record can't push a dead deadline. Call the verdict with /pivot-strategy: keep it, kill it, or set a new dated gate.";else if(x&&(v.kind==="adoption"||v.kind==="distribution")){const k=v.needed===1?String(v.unit||"").replace(/s$/,""):v.unit,S="The test needs "+v.needed+" more "+k+(v.deadline?" by "+On(v.deadline):"")+(v.requiredPerDay!=null&&v.requiredPerDay>0?" ("+v.requiredPerDay+" a day)":"")+".";o!=null&&o>0?b=S+(v.kind==="distribution"?" This week filed "+o+" receipt"+(o===1?"":"s")+" toward it.":" This week put "+o+" receipt"+(o===1?"":"s")+" behind it; the counter moves when those convert."):o===0?b=S+(A&&j.length?" You're showing up ("+j.join(", ")+") and zero receipts touched it this week. Hours hold the door open; receipts move the counter.":" The record is quiet this week. One receipt against the test beats a clean streak beside it."):b=S+" The push is invisible right now because no receipts are being measured; log actions with /log so they count."}else x?b="The test is stated in "+(v.kind==="revenue"?"money":v.kind==="vitality"?"vitality terms":"terms")+" this record can't measure yet, so it holds judgment"+(j.length?" (it can witness "+j.join(" and ")+")":"")+". Log outcomes with /log so a receipt source exists to connect.":!g&&u===0&&A?b="You're showing up"+(j.length?" ("+j.join(", ")+")":"")+", but no workflow left a timestamp this week, so the loop that turns work into measured proof is idle. The work is happening; the proof isn't being filed.":A?b="The record backs the intent: you're on it"+(o!=null?", "+o+" receipt"+(o===1?"":"s")+" this week":"")+".":b="The record is quiet this week. If the focus still stands, the next move is to put one receipt against it.";const I=()=>t.openXray&&a&&t.openXray("What you said",a,"strategy");return e.jsxs("section",{className:"v9k","data-screen-label":"Evidence, did you do what you said",children:[e.jsx("div",{className:"v9k-head",children:e.jsx("span",{className:"m-kicker",children:"Did you do what you said?"})}),e.jsxs("div",{className:"v9k-grid",children:[e.jsxs("div",{className:"v9k-col v9k-said",children:[e.jsx("span",{className:"v9k-lab",children:"You said"}),a?e.jsx("button",{type:"button",className:"v9k-saidline",onClick:I,"aria-label":"You said: "+a+". Open source.",children:a}):e.jsx("span",{className:"v9k-saidline is-null",children:"No focus on file. Set one with /morning."})]}),e.jsx("span",{className:"v9k-vs","aria-hidden":"true",children:"vs"}),e.jsxs("div",{className:"v9k-col v9k-did",children:[e.jsx("span",{className:"v9k-lab",children:"The record"}),f.length?e.jsx("div",{className:"v9k-chips",children:f.map((k,S)=>e.jsx("button",{type:"button",className:"v9k-chip"+(k.warm?" is-warm":" is-cold"),onClick:()=>t.openXray&&t.openXray("From the record",k.k,k.src),"aria-label":k.k+". Open source.",children:k.k},S))}):e.jsx("span",{className:"v9k-saidline is-null",children:"Nothing on the record this week yet."})]})]}),e.jsx("p",{className:"v9k-verdict",children:b})]})}const gt=[{id:"volume",k:"Volume",sub:"receipts over time",src:"metrics"},{id:"cadence",k:"Cadence",sub:"days on the record",src:"streaks"},{id:"rhythm",k:"Rhythm",sub:"when you work",src:"sessions"},{id:"pace",k:"Pace",sub:"toward the goal",src:"metrics"}];function Pd(){const n=Fn(),t=(n.distribution&&n.distribution.days||[]).filter(f=>f&&f.date),s=t.findIndex(f=>f.exists!==!1),a=s>=0?t.slice(s):t,r=[7,30,90].filter(f=>f<a.length).concat(["all"]),[i,l]=React.useState(30),o=r.includes(i)?i:r[0],[c,d]=React.useState(-1);if(!a.length)return e.jsx("p",{className:"v9dl-null",children:"No publishing volume on the record yet."});const u=o==="all"?a:a.slice(-o),h=Math.max(1,...u.map(f=>f.count||0)),p=u.reduce((f,v)=>f+(v.count||0),0),m=u.filter(f=>(f.count||0)>0).length,g=c>=0&&c<u.length?u[c]:null;return e.jsxs("div",{className:"v9dl-facet",children:[e.jsxs("div",{className:"v9dl-facethead",children:[e.jsxs("span",{className:"v9dl-stat",children:[e.jsx("span",{className:"m-num",children:p})," receipts · ",e.jsx("span",{className:"m-num",children:m})," of ",u.length," days active"]}),e.jsx("div",{className:"v9dl-steps",role:"group","aria-label":"time window",children:r.map(f=>e.jsx("button",{type:"button",className:"v9dl-step"+(f===o?" is-on":""),onClick:()=>{l(f),d(-1)},"aria-pressed":f===o,title:f==="all"?"Every day since the record began":"Last "+f+" days",children:f==="all"?"all":f+"d"},f))})]}),e.jsx("div",{className:"v9dl-tape",role:"img","aria-label":p+" receipts across "+u.length+" days",style:{height:Math.min(96,Math.max(30,Math.min(h,12)*7+12)),...u.length>120?{gap:1}:{}},onMouseLeave:()=>d(-1),children:u.map((f,v)=>{const x=f.count||0;return e.jsx("button",{type:"button",className:"v9dl-day"+(v===c?" is-sel":"")+(x===0?" is-zero":""),onMouseEnter:()=>d(v),onFocus:()=>d(v),onClick:()=>d(v),"aria-label":On(f.date)+", "+x+" receipts",children:x===0?e.jsx("span",{className:"v9dl-zero","aria-hidden":"true"}):Array.from({length:Math.min(x,12)}).map((b,j)=>e.jsx("i",{className:"v9dl-tick"+(x>12&&j===11?" is-over":""),"aria-hidden":"true"},j))},f.date)})}),e.jsx("div",{className:"v9dl-readline",children:g?e.jsxs("span",{children:[e.jsx("b",{children:On(g.date)})," · ",e.jsx("span",{className:"m-num",children:g.count||0})," receipts"]}):e.jsx("span",{className:"is-quiet",children:"Each notch is one filed receipt; a dot is a day with none. Hover a day for its count."})})]})}function Dd(){const n=Fn(),t=n.streak||{},s=(t.days||[]).filter(x=>x&&x.date),a=De(t.currentStreak)?t.currentStreak:null,r=De(t.longestStreak)?t.longestStreak:null,i=De(t.totalDays)?t.totalDays:null,l=De(t.coverage)?Math.round(t.coverage*100):null,[o,c]=React.useState(null);if(!s.length&&a==null)return e.jsx("p",{className:"v9dl-null",children:"No daily-note history on the record yet."});const d=(n.distribution&&n.distribution.days||[]).reduce((x,b)=>(b&&b.date&&(x[b.date]=b.count||0),x),{}),u=s.slice(-182),h=x=>(new Date(x+"T12:00:00").getDay()+6)%7,p=[];for(let x=0;x<h(u[0].date);x++)p.push(null);u.forEach(x=>p.push(x));const m=[];for(let x=0;x<p.length;x+=7)m.push(p.slice(x,x+7));const g=(x,b)=>{const j=x.find(Boolean);if(!j)return"";const A=new Date(j.date+"T12:00:00");return b===0?A.toLocaleDateString([],{month:"short"}):x.some(I=>I&&new Date(I.date+"T12:00:00").getDate()===1)?A.toLocaleDateString([],{month:"short"}):""},f=x=>{if(!x.exists)return 0;const b=d[x.date]||0;return b===0?1:b<=1?2:b<=3?3:4},v=x=>{if(!x.exists)return On(x.date)+" · no note";const b=d[x.date]||0;return On(x.date)+" · note kept"+(b>0?" · "+b+" receipt"+(b===1?"":"s"):"")};return e.jsxs("div",{className:"v9dl-facet",children:[e.jsx("div",{className:"v9dl-facethead",children:e.jsxs("span",{className:"v9dl-stat",children:[a!=null?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"m-num",children:a}),"-day streak now"]}):"no streak data",r!=null?e.jsxs(e.Fragment,{children:[" · best ",e.jsx("span",{className:"m-num",children:r})]}):null,l!=null?e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"m-num",children:[l,"%"]})," of days kept"]}):null]})}),e.jsx("div",{className:"v9dl-cal2",role:"group","aria-label":"Daily-note calendar, "+u.length+" days"+(a!=null?", current streak "+a+" days":""),onMouseLeave:()=>c(null),children:m.map((x,b)=>e.jsxs("div",{className:"v9dl-cal2week",children:[e.jsx("span",{className:"v9dl-cal2mon","aria-hidden":"true",children:g(x,b)}),x.map((j,A)=>j?e.jsx("button",{type:"button",className:"v9dl-cell2 is-l"+f(j)+(o&&o.date===j.date?" is-sel":""),onMouseEnter:()=>c(j),onFocus:()=>c(j),onClick:()=>c(j),"aria-label":v(j),title:v(j)},A):e.jsx("span",{className:"v9dl-cell2 is-pad","aria-hidden":"true"},A))]},b))}),e.jsx("div",{className:"v9dl-readline",children:o?e.jsx("span",{children:e.jsx("b",{children:v(o)})}):i!=null?e.jsxs("span",{className:"is-quiet",children:[e.jsx("span",{className:"m-num",children:i})," days tracked. A filled square is a day with a note; receipts deepen it. Hover a day to read it."]}):e.jsx("span",{className:"is-quiet",children:"A filled square is a day you kept a note; receipts deepen it."})})]})}function Fd(){const t=Fn().hourlyActivity||{},s=Array.isArray(t.hours)?t.hours:[],a=s.reduce((o,c)=>o+(c&&c.count||0),0);if(!t.available||a===0)return e.jsx("p",{className:"v9dl-null",children:"No work-rhythm on the record yet. It fills as the engine logs when you work."});const r=Math.max(1,...s.map(o=>o&&o.count||0)),i=De(t.peakHour)?t.peakHour:null,l=o=>o===0?"12a":o<12?o+"a":o===12?"12p":o-12+"p";return e.jsxs("div",{className:"v9dl-facet",children:[e.jsx("div",{className:"v9dl-facethead",children:e.jsxs("span",{className:"v9dl-stat",children:[e.jsxs("button",{type:"button",className:"m-x",style:{font:"inherit",color:"inherit",padding:0},title:a+" timestamped entries in your Daily Note session logs, last 14 days. Click for the source.",onClick:()=>window.openXray&&window.openXray("Work rhythm",a+" timestamped entries (### HH:MM lines) in your Daily Note session logs over the last 14 days, bucketed by hour.","hourly"),children:[e.jsx("span",{className:"m-num",children:a})," log entries · 14 days"]}),i!=null?e.jsxs(e.Fragment,{children:[" · peaks around ",e.jsx("b",{children:l(i)})]}):null]})}),e.jsx("div",{className:"v9dl-clock",role:"img","aria-label":"Work rhythm by hour"+(i!=null?", peaks around "+l(i):""),children:Array.from({length:24}).map((o,c)=>{const d=(s.find(u=>u&&u.hour===c)||{}).count||0;return e.jsxs("span",{className:"v9dl-hour",title:l(c)+" · "+d,children:[e.jsx("span",{className:"v9dl-hbar"+(i===c&&d>0?" is-peak":""),style:{height:Math.max(2,Math.round(d/r*100))+"%"}}),c%6===0?e.jsx("span",{className:"v9dl-hlab",children:l(c)}):null]},c)})}),e.jsx("div",{className:"v9dl-readline",children:e.jsx("span",{className:"is-quiet",children:"Each bar is one hour of the day, counted from your session logs over the last 14 days. Taller means more entries landed then."})})]})}function _d(){const t=Fn().goalForecast||{},s=De(t.current)?t.current:null,a=De(t.target)?t.target:null,r=De(t.daysRemaining)?t.daysRemaining:null,i=t.unit||"";if(s==null||a==null)return e.jsx("p",{className:"v9dl-null",children:"No bet with a number yet. Set one with /pivot-strategy and the pace draws here."});const l=Math.max(2,Math.min(100,Math.round(s/Math.max(1,a)*100))),o=Math.max(0,a-s),c=r!=null&&r>0&&o>0?Math.ceil(o/r):null,d=De(t.status)&&/risk|unlikely|fail|behind/i.test(t.status)?"is-warn":"";return e.jsxs("div",{className:"v9dl-facet",children:[e.jsx("div",{className:"v9dl-facethead",children:e.jsxs("span",{className:"v9dl-stat",children:[e.jsx("span",{className:"m-num",children:s}),e.jsx("span",{className:"v9dl-slash",children:"/"}),e.jsx("span",{className:"m-num",children:a})," ",i,r!=null?r>=0?e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"m-num",children:r})," days left"]}):e.jsxs(e.Fragment,{children:[" · expired ",e.jsx("span",{className:"m-num",children:Math.abs(r)})," days ago"]}):null]})}),e.jsx("div",{className:"v9dl-burn "+d,role:"img","aria-label":s+" of "+a+" "+i+(c?", about "+c+" a day to clear it":""),children:e.jsxs("div",{className:"v9dl-burn-track",children:[e.jsx("div",{className:"v9dl-burn-fill",style:{width:l+"%"}}),e.jsx("div",{className:"v9dl-burn-line"})]})}),e.jsx("div",{className:"v9dl-readline",children:c!=null?e.jsxs("span",{children:["You need about ",e.jsx("b",{children:c})," a day for the next ",e.jsx("span",{className:"m-num",children:r})," days to clear the line. ",e.jsx("span",{className:"m-num",children:o})," to go."]}):o===0?e.jsx("span",{children:"Cleared. The line is met."}):e.jsxs("span",{className:"is-quiet",children:[e.jsx("span",{className:"m-num",children:o})," still to go."]})})]})}function Xr({sparse:n,onNav:t}){const s=window,[a,r]=s.useStored3?s.useStored3("m9.evdial","volume"):React.useState("volume"),i=gt.find(o=>o.id===a)||gt[0],l=a==="cadence"?Dd:a==="rhythm"?Fd:a==="pace"?_d:Pd;return e.jsxs("section",{className:"v9dl","data-coach":"evidence-dossier","data-screen-label":"Evidence, the dial",children:[e.jsxs("div",{className:"v9dl-head",children:[e.jsx("span",{className:"m-kicker",children:"The record, up close"}),s.Hint?e.jsx(s.Hint,{what:"The same record read four ways, volume, cadence, rhythm, and pace, each off real vault data.",doing:"Flipping a facet re-draws it here; nothing navigates away. Open the source on any one.",src:"distribution · streaks · hourlyActivity · goalForecast"}):null]}),e.jsx("div",{className:"v9dl-tabs",role:"tablist","aria-label":"record facets",children:gt.map(o=>e.jsxs("button",{type:"button",role:"tab","aria-selected":o.id===a,className:"v9dl-tab"+(o.id===a?" is-on":""),onClick:()=>r(o.id),children:[e.jsx("span",{className:"v9dl-tab-k",children:o.k}),e.jsx("span",{className:"v9dl-tab-s",children:o.sub})]},o.id))}),e.jsx("div",{className:"v9dl-stage",children:e.jsx(l,{})},a),e.jsx("div",{className:"v9dl-foot",children:e.jsxs("button",{type:"button",className:"v9dl-src",onClick:()=>s.openXray&&s.openXray(i.k+" · "+i.sub,"Read straight from the vault: "+i.src+". No value here is invented.",i.src),children:[s.MIcons&&s.MIcons.xray?s.MIcons.xray(11):null," Where this comes from"]})})]})}const zd=[{k:"Time per domain",why:"sessions tag a project, not a Work/Vitality/Faith domain"},{k:"Per-session output",why:"no per-session result rows in the vault yet"},{k:"Vitality & Faith practice",why:"no practice log parsed yet"},{k:"Sealed nightly claims",why:"the closeout ledger isn't parsed yet"}];function Yr(){const n=window,t=n.MSTATE&&n.MSTATE.sessionTime||{},s=t.available&&t.last7d&&t.last7d.minutes>0?Math.round(t.last7d.minutes/6)/10:null,a=n.V4T&&Array.isArray(n.V4T.replay)?n.V4T.replay.length:0,r=n.V4T&&n.V4T.thread&&n.V4T.thread.state?n.V4T.thread.state:null,i=[{k:"Publishing volume",n:"all-time",src:"metrics"},{k:"Cadence & streak",n:"real",src:"streaks"},{k:"Work rhythm",n:"by hour",src:"sessions"},{k:"Time tracked",n:s!=null?s+"h/wk":"real",src:"sessions"},{k:"Pace to the goal",n:"live",src:"metrics"},{k:"Who was right (the no)",n:"scored",src:"overrides"},{k:"Patterns",n:"from learnings",src:"learnings"}];a>1&&i.push({k:"Strategy revisions",n:a+" frames",src:"replay"}),r&&i.push({k:"Drift, the thread",n:r,src:"thread"});const l=zd.concat(a>1?[]:[{k:"Strategy-revision history",why:"only the current strategy is on file"}]),[o,c]=React.useState(!1);return e.jsxs("section",{className:"v9cov","data-coach":"evidence-coverage","data-screen-label":"Evidence, what's measured",children:[e.jsxs("button",{type:"button",className:"v9cov-peek",onClick:()=>c(!o),"aria-expanded":o,children:[e.jsx("span",{className:"m-kicker",children:"What's measured, what isn't"}),e.jsxs("span",{className:"v9cov-sum",children:[e.jsx("span",{className:"m-num",children:i.length})," measured, ",e.jsx("span",{className:"m-num",children:l.length})," on the roadmap"]}),e.jsx("span",{className:"v9cov-chev"+(o?" is-open":""),"aria-hidden":"true",children:n.MIcons?n.MIcons.arrow(12):null})]}),o?e.jsxs("div",{className:"v9cov-grid",children:[e.jsxs("div",{className:"v9cov-col",children:[e.jsx("span",{className:"v9cov-lab is-on",children:"Proven from your vault"}),e.jsx("div",{className:"v9cov-list",children:i.map(d=>e.jsxs("button",{type:"button",className:"v9cov-item is-on",onClick:()=>n.openXray&&n.openXray(d.k,"Measured directly from "+d.src+".",d.src),"aria-label":d.k+", measured. Open source.",children:[e.jsx("span",{className:"v9cov-dot","aria-hidden":"true"}),e.jsx("span",{className:"v9cov-k",children:d.k}),e.jsx("span",{className:"v9cov-n m-num",children:d.n})]},d.k))})]}),e.jsxs("div",{className:"v9cov-col",children:[e.jsx("span",{className:"v9cov-lab is-off",children:"Not measured yet"}),e.jsx("div",{className:"v9cov-list",children:l.map(d=>e.jsxs("div",{className:"v9cov-item is-off",children:[e.jsx("span",{className:"v9cov-dot","aria-hidden":"true"}),e.jsx("span",{className:"v9cov-k",children:d.k}),e.jsx("span",{className:"v9cov-why",children:d.why})]},d.k))})]})]}):null,o?e.jsx("p",{className:"v9cov-oath",children:"This record only shows what the vault can prove."}):null]})}function qr({onNav:n}){const t=window,s=t.MSTATE||null;if(!s)return null;const a=c=>()=>{t.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:c})),n?n("chat"):t.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},r=[],i=s.goalForecast;i&&i.available&&(i.status==="failed"||i.daysRemaining!=null&&i.daysRemaining<0)&&r.push({k:"bet",move:"The bet expired without a verdict. Call it: revise the test, or write the next one.",fact:(i.current!=null&&i.target!=null?i.current+" of "+i.target+", ":"")+"deadline passed · goal-forecast",label:"Draft /pivot-strategy in Chat",go:a("/pivot-strategy")});const l=s.daily&&s.daily.today;l&&(!l.exists||l.tasksTotal==null||l.tasksTotal===0)&&r.push({k:"plan",move:"Write the day before it writes itself: one focus, a few tasks.",fact:(l.exists?"today's note has no plan in it":"no note for today yet")+" · daily-note-resolver",label:"Draft /morning in Chat",go:a("/morning")});const o=s.distribution;return o&&o.available===!0&&o.todayCount===0&&r.push({k:"ship",move:"One small publish today keeps the thread taut.",fact:(o.total7d??0)+" receipts this week, none today · distribution-parser",label:"Draft it in Chat",go:a("What's the smallest publishable piece from my current plan? Draft it with me.")}),r.length?e.jsxs("section",{className:"v9p","data-screen-label":"Evidence, what to do about it",children:[e.jsx("div",{className:"v9p-head",children:e.jsx("span",{className:"m-kicker",children:"What to do about it"})}),r.slice(0,3).map(c=>e.jsxs("div",{className:"v9p-row",children:[e.jsxs("div",{className:"v9p-tx",children:[e.jsx("p",{className:"v9p-move",children:c.move}),e.jsx("span",{className:"v9p-fact m-mono",children:c.fact})]}),e.jsx("button",{type:"button",className:"m-cta-line v9p-go",onClick:c.go,children:c.label})]},c.k))]}):null}function Vd({D:n,onNav:t,rollout:s}){const a=window,r=a.EvidenceView,i=n&&n.__sparse,l=i?Object.assign({},a.V4E,{days:(a.V4ESPARSE||{}).days}):a.V4E,[o,c]=React.useState((l&&l.days?l.days.length:1)-1);return React.useEffect(()=>{l&&l.days&&c(l.days.length-1)},[i]),!l||!l.days||typeof a.X!="function"||typeof a.M4E_LENSES>"u"?e.jsx("div",{className:"v9-ev",children:typeof r=="function"?e.jsx(r,{D:n,onNav:t,rollout:s}):null}):e.jsx("div",{className:"v9-ev","data-screen-label":"Evidence (v9 proof)",children:e.jsxs("div",{className:"m-wrap",children:[e.jsx(Wr,{days:l.days,sel:o,setSel:c,sparse:i}),a.RewindPill?e.jsx("div",{className:"v9-rewind-top",children:e.jsx(a.RewindPill,{})}):null,e.jsx($r,{sparse:i}),e.jsxs("div",{className:"v9-readrow",children:[e.jsx(Br,{E:l,sel:o,sparse:i,onNav:t}),e.jsx(Hr,{E:l,sparse:i})]}),e.jsx(Xr,{sparse:i,onNav:t}),(()=>{const d=a.ReplayLens&&a.V4T&&Array.isArray(a.V4T.replay)&&a.V4T.replay.length>1,u=a.ThreadLens&&a.V4T&&a.V4T.thread;return!d&&!u?null:e.jsxs("div",{className:"v9-lensrow"+(d&&u?"":" is-solo"),children:[u?e.jsx(a.ThreadLens,{sparse:i}):null,d?e.jsx(a.ReplayLens,{sparse:i}):null]})})(),e.jsx(Yr,{}),e.jsx(qr,{onNav:t})]})})}Object.assign(window,{EvidenceViewV9:Vd,V9Instrument:Wr,V9Readout:Br,V9Balance:Hr,V9Reckon:$r,V9Dial:Xr,V9Covenant:Yr,V9Propose:qr});const zt=(n,t)=>typeof MIcons<"u"&&MIcons[n]?MIcons[n](t):null,cs={good:"is-good",warn:"is-warn",crit:"is-crit",neutral:"is-neutral"},Ur=(n,t,s)=>window.openXray&&window.openXray(n,t||"",s||"home");function Kr(){const n=window.STATUSACTION;if(!n||!n.move||!n.move.label)return null;const t=n.state==="ON_TRACK"?"good":n.state==="OFF_TRACK"?"warn":"neutral",s=n.move.workflow,a=()=>Ur(n.headline||"Right now",n.move.why||n.line||"",n.cite||"statusaction");return e.jsxs("section",{className:"v8lp-hero "+cs[t],"data-screen-label":"Home, right now",children:[n.headline?e.jsx("div",{className:"v8lp-hero-state",children:n.headline}):null,e.jsx("h1",{className:"v8lp-hero-move",children:n.move.label}),n.move.why?e.jsx("p",{className:"v8lp-hero-why",children:n.move.why}):null,e.jsx("div",{className:"v8lp-hero-act",children:s?e.jsxs("button",{className:"v8lp-cmd",onClick:a,title:"Where this comes from",children:[e.jsx("span",{className:"v8lp-cmd-glyph",children:zt("arrow",14)}),e.jsx("span",{className:"v8lp-cmd-text m-mono",children:s})]}):e.jsxs("button",{className:"v8lp-cmd is-work",onClick:a,title:"Where this comes from",children:[e.jsx("span",{className:"v8lp-cmd-text",children:"This is the work"}),e.jsx("span",{className:"v8lp-cmd-glyph",children:zt("file",12)})]})})]})}function Jr({onNav:n}){const t=window.V8BET;if(!t||!t.available||t.target==null||t.current==null)return null;const s=cs[t.tone]||"is-neutral";t.progressPct!=null?t.progressPct:Math.round(t.current/Math.max(1,t.target)*100);const a=t.status?t.status.replace(/[-_]/g," "):null,r=Math.min(t.target,24),i=Array.from({length:r},(l,o)=>Math.round((o+1)/r*t.target)<=t.current);return e.jsxs("button",{className:"v8lp-bet "+s,onClick:()=>typeof n=="function"&&n("strategy"),title:"See the strategy","data-screen-label":"Home, the bet",children:[e.jsx("span",{className:"v8lp-bet-seg","aria-hidden":"true",children:i.map((l,o)=>e.jsx("span",{className:"v8lp-bet-tick"+(l?" is-on":"")},o))}),e.jsxs("span",{className:"v8lp-bet-read",children:[e.jsx("b",{className:"m-num",children:t.current}),e.jsxs("span",{className:"v8lp-bet-of",children:["of ",t.target]}),t.unit?e.jsx("span",{className:"v8lp-bet-unit",children:t.unit}):null]}),a?e.jsx("span",{className:"v8lp-bet-status",children:a}):null,t.daysRemaining!=null?e.jsxs("span",{className:"v8lp-bet-days",children:[e.jsx("b",{className:"m-num",children:t.daysRemaining})," days left"]}):null,e.jsx("span",{className:"v8lp-bet-go",children:zt("arrow",13)})]})}const Wd={distribution:"Distribution",plan:"Today's plan",streak:"Day streak",calibration:"Calibration",singleTest:"The bet"},Bd={distribution:"last 7 days"};function Gr(){const n=window.HOMEKPIS;if(!n||!Array.isArray(n.tiles)||!n.tiles.length)return null;const t=n.tiles.filter(s=>s&&s.k!=="singleTest");return t.length?e.jsx("div",{className:"v8lp-kpis","data-screen-label":"Home, the facts",children:t.map(s=>{const a=s.unit?String(s.unit).trim():"",r=/^\/\s*\d+$/.test(a)?a:null,i=/^Drift\b/.test(s.title||"")?"Drift":Wd[s.k]||s.k,l=Bd[s.k]||s.sub||"";return e.jsxs("button",{className:"v8lp-kpi "+(cs[s.tone]||""),onClick:()=>Ur(s.title||i,s.sub||"",s.cite||s.k),title:s.title||i,children:[e.jsxs("span",{className:"v8lp-kpi-fig",children:[e.jsx("span",{className:"v8lp-kpi-num m-num"+(s.num==="—"?" is-null":s.measured?" is-data":""),children:s.num==="—"?"none":s.num}),r?e.jsx("span",{className:"v8lp-kpi-denom m-num",children:r}):null]}),e.jsx("span",{className:"v8lp-kpi-label",children:i}),l?e.jsx("span",{className:"v8lp-kpi-sub",children:l}):null]},s.k)})}):null}function Qr(){const n=window.V4&&window.V4.todaysCall;if(!n||!Array.isArray(n.items)||!n.items.length)return null;const t=n.items.length===1&&/no plan/i.test(n.items[0].k||"");return e.jsxs("div",{className:"v8lp-today","data-screen-label":"Home, today",children:[e.jsxs("div",{className:"v8lp-today-head",children:[e.jsx("span",{className:"v8lp-eyebrow",children:"Today"}),!t&&n.of?e.jsxs("span",{className:"v8lp-today-count m-num",children:[n.done,e.jsxs("span",{children:[" / ",n.of]})]}):null]}),t?e.jsx("p",{className:"v8lp-today-empty",children:"No plan written for today."}):e.jsx("ul",{className:"v8lp-today-list",children:n.items.map((s,a)=>{const r=s.of?s.done>=s.of:!!s.done;return e.jsxs("li",{className:"v8lp-today-item"+(r?" is-done":"")+(s.hot&&!r?" is-hot":""),children:[e.jsx("span",{className:"v8lp-today-tick","aria-hidden":"true"}),e.jsx("span",{className:"v8lp-today-k",children:s.k})]},a)})})]})}function Hd(n){const t=window.V3||{},s=window.STATUSACTION,a=window.V8BET,r=window.HOMEKPIS,i=window.SayItHero,l=!(s&&s.move)&&!(a&&a.available)&&!(r&&r.tiles&&r.tiles.length);return e.jsx("div",{className:"v8-home v8lp","data-screen-label":"Home (launchpad)",children:e.jsxs("div",{className:"v8lp-wrap",children:[e.jsxs("div",{className:"v8lp-meta",children:[t.date?e.jsx("span",{children:t.date}):null,t.date&&t.day?e.jsx("span",{className:"v8lp-meta-dot",children:"·"}):null,t.day?e.jsxs("span",{children:["Day ",t.day]}):null]}),typeof i=="function"?e.jsx("div",{className:"v8lp-say",children:e.jsx(i,{onNav:n.onNav})}):null,l?e.jsxs("section",{className:"v8lp-hero is-neutral",children:[e.jsx("div",{className:"v8lp-hero-state",children:"Can't read the engine."}),e.jsx("h1",{className:"v8lp-hero-move",children:"Start the server, then refresh."}),e.jsx("p",{className:"v8lp-hero-why",children:"Home reads from your live vault. Nothing here is invented."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Kr,{}),e.jsx(Jr,{onNav:n.onNav}),e.jsx(Gr,{}),e.jsx(Qr,{})]})]})})}Object.assign(window,{HomeViewV8:Hd,V8Move:Kr,V8BetChip:Jr,V8Kpis:Gr,V8Today:Qr});function Zr(){const[n,t]=React.useState(!1);return e.jsxs("section",{className:"v8seal","data-coach":"configure-seal","data-screen-label":"Configure, the seal",children:[e.jsx("div",{className:"v8seal-mark",children:e.jsxs("svg",{viewBox:"0 0 104 104",className:"v8seal-svg","aria-hidden":"true",children:[e.jsx("circle",{className:"v8seal-ring",cx:"52",cy:"52",r:"49",pathLength:"1"}),e.jsx("circle",{className:"v8seal-ring2",cx:"52",cy:"52",r:"41"}),e.jsx("circle",{className:"v8seal-ring3",cx:"52",cy:"52",r:"32"}),e.jsx("circle",{className:"v8seal-key",cx:"52",cy:"46",r:"6.5"}),e.jsx("path",{className:"v8seal-stem",d:"M45.5 71 L52 53 L58.5 71 Z"})]})}),e.jsxs("div",{className:"v8seal-body",children:[e.jsxs("div",{className:"v8seal-head",children:[e.jsx("span",{className:"m-kicker",children:"Your record stays yours"}),e.jsxs("span",{className:"v8seal-posture",children:[e.jsx("span",{className:"v8seal-pdot"}),"Local · no data sent"]})]}),e.jsxs("div",{className:"v8seal-prev"+(n?" is-hidden":""),children:[e.jsxs("span",{className:"v8seal-line",children:[e.jsx("span",{className:"nm",children:"a name"}),e.jsx("span",{className:"sep",children:" · "}),e.jsx("span",{className:"amt",children:"an amount"}),e.jsx("span",{className:"sep",children:" · "}),e.jsx("span",{className:"file",children:"a note.md"})]}),e.jsx("button",{className:"v8seal-toggle",type:"button","aria-pressed":n,onClick:()=>t(s=>!s),children:n?"Reveal":"Hide names & money"})]}),e.jsx("span",{className:"v8seal-note",children:"Preview of the redaction. It hides names and money on a shared screen. No real record is shown here."})]})]})}function $d(){const[n,t]=React.useState(null),[s,a]=React.useState(null),r=React.useRef(null),i=React.useCallback(async()=>{if(r.current)return r.current;try{const S=await(await fetch("/api/health")).json();return r.current=S.token,S.token}catch{return null}},[]);React.useEffect(()=>{(async()=>{try{const S=await i(),E=await(await fetch("/api/config",{headers:{"X-Mover-Token":S}})).json();t(E&&E.ok&&E.config?E.config:{})}catch{t({})}})()},[]);const l=S=>{a(S),setTimeout(()=>a(E=>E===S?null:E),1500)},o=React.useCallback(async(S,E)=>{try{const L=await i();(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":L},body:JSON.stringify(S)})).ok&&l(E)}catch{}},[i]);if(!n)return null;const c=(S,E)=>t(L=>({...L,[S]:E})),d=S=>o({[S]:n[S]},S),u=(S,E)=>{c(S,E),o({[S]:E},S)},h=S=>E=>c(S,E.target.value===""?"":Number(E.target.value)),p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],m=[["claude-code","Claude Code"],["codex","Codex CLI"],["gemini","Gemini CLI"]],g=["low","normal","high"],f=({k:S})=>s===S?e.jsx("span",{className:"v8prefs-saved",children:"saved"}):e.jsx("span",{className:"v8prefs-saved is-idle"}),v={"claude-code":["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"],gemini:[]},x=n.preferredAgent||"claude-code",b=(m.find(([S])=>S===x)||[null,x])[1],j=(n.providerPrefs||{})[x]||{},A=S=>t(E=>({...E,providerPrefs:{...E.providerPrefs||{},[x]:{...(E.providerPrefs||{})[x]||{},...S}}})),I=(S,E)=>{A(S),o({providerPrefs:{[x]:S}},E)},k=(S,E)=>{A({[S]:E}),o({providerPrefs:{[x]:{[S]:E}}},"pp."+S)};return e.jsxs("section",{className:"v8prefs","data-coach":"configure-settings","data-screen-label":"Configure, your settings",children:[e.jsxs("div",{className:"m4-sec-head",style:{marginBottom:10},children:[e.jsx("span",{className:"m-kicker",children:"Your settings"}),e.jsx("span",{className:"v8prefs-aside",children:"~/.mover/config.json · saved as you change them"})]}),e.jsxs("div",{className:"v8prefs-grid",children:[e.jsxs("label",{className:"v8prefs-row",children:[e.jsx("span",{className:"k",children:"What we call you"}),e.jsx("input",{className:"v8prefs-in",type:"text",value:n.userName??"",placeholder:"Your name",onChange:S=>c("userName",S.target.value),onBlur:()=>d("userName")}),e.jsx(f,{k:"userName"})]}),e.jsxs("label",{className:"v8prefs-row is-wide",children:[e.jsxs("span",{className:"k",children:["Your vault",e.jsx("span",{className:"s",children:"Where your files live. The whole system reads from here."})]}),e.jsx("input",{className:"v8prefs-in m-mono",type:"text",value:n.vaultPath??"",placeholder:"/path/to/vault",onChange:S=>c("vaultPath",S.target.value),onBlur:()=>d("vaultPath")}),e.jsx(f,{k:"vaultPath"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Default agent",e.jsx("span",{className:"s",children:"Which assistant runs your workflows."})]}),e.jsxs("select",{className:"v8prefs-in",value:n.preferredAgent??"",onChange:S=>u("preferredAgent",S.target.value),children:[e.jsx("option",{value:"",children:"Auto-detect"}),m.map(([S,E])=>e.jsx("option",{value:S,children:E},S))]}),e.jsx(f,{k:"preferredAgent"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Run model, ",b,e.jsx("span",{className:"s",children:"Any model its CLI accepts. Empty = the provider's own default."})]}),e.jsx("input",{className:"v8prefs-in m-mono",type:"text",value:j.model??"",placeholder:"provider default",spellCheck:!1,onChange:S=>A({model:S.target.value}),onBlur:()=>k("model",String(j.model||"").trim()||null)}),e.jsx(f,{k:"pp.model"})]}),v[x]&&v[x].length?e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Run effort, ",b,e.jsx("span",{className:"s",children:"Reasoning effort for runs. Empty = the provider's own default."})]}),e.jsxs("select",{className:"v8prefs-in",value:j.effort??"",onChange:S=>I({effort:S.target.value||null},"pp.effort"),children:[e.jsx("option",{value:"",children:"provider default"}),v[x].map(S=>e.jsx("option",{value:S,children:S},S))]}),e.jsx(f,{k:"pp.effort"})]}):null,x==="gemini"?e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Gemini approvals",e.jsx("span",{className:"s",children:"What a run may do without asking. Unattended runs need yolo."})]}),e.jsx("select",{className:"v8prefs-in",value:j.approvalMode??"yolo",onChange:S=>I({approvalMode:S.target.value},"pp.approvalMode"),children:["yolo","auto_edit","default","plan"].map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx(f,{k:"pp.approvalMode"})]}):null,e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Pushback intensity",e.jsx("span",{className:"s",children:"How hard the system pushes back when you go off-plan."})]}),e.jsx("select",{className:"v8prefs-in",value:n.frictionSensitivity??"normal",onChange:S=>u("frictionSensitivity",S.target.value),children:g.map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx(f,{k:"frictionSensitivity"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Weekly review day",e.jsx("span",{className:"s",children:"When /review-week is due."})]}),e.jsx("select",{className:"v8prefs-in",value:n.reviewDay??"Sunday",onChange:S=>u("reviewDay",S.target.value),children:p.map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx(f,{k:"reviewDay"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Evening starts",e.jsx("span",{className:"s",children:"Hour the wind-down zone begins (24h)."})]}),e.jsx("input",{className:"v8prefs-in",type:"number",min:"0",max:"23",value:n.eveningZoneStart??"",placeholder:"17",onChange:h("eveningZoneStart"),onBlur:()=>d("eveningZoneStart")}),e.jsx(f,{k:"eveningZoneStart"})]}),e.jsxs("label",{className:"v8prefs-row",children:[e.jsxs("span",{className:"k",children:["Sleep target",e.jsx("span",{className:"s",children:"Target hours; /plan-tomorrow derives your bedtime from it."})]}),e.jsx("input",{className:"v8prefs-in",type:"number",min:"3",max:"12",step:"0.5",value:n.sleepTarget??"",placeholder:"7",onChange:h("sleepTarget"),onBlur:()=>d("sleepTarget")}),e.jsx(f,{k:"sleepTarget"})]})]})]})}function Xd(n){const t=window.ConfigureView;return typeof t!="function"?null:e.jsxs("div",{className:"v8-cfg","data-screen-label":"Configure (v8 distinctive)",children:[e.jsx(Zr,{}),e.jsx(t,{...n})]})}Object.assign(window,{ConfigureViewV8:Xd,V8Seal:Zr,V8Prefs:$d});const ea=[{id:"index",k:"What's in here"},{id:"graph",k:"What's most connected"},{id:"voice",k:"Your writing voice"}];function ei({GR:n,sparse:t}){const[s,a]=React.useState(null),[r,i]=React.useState(null);if(t||!n||!n.rings||n.rings.every(N=>!N.length))return window.Empty?e.jsx(window.Empty,{title:"This is waiting on a sync.",line:window.V4LSPARSE&&window.V4LSPARSE.graphEmpty||"Index your files to draw the map.",action:"Index your files",cmd:"moveros sync"}):null;const l=560,o=l/2,c=l/2,d=[96,168,236],u=n.rings.map(N=>N.length),h=(N,C)=>(-90+360/Math.max(1,u[N])*C)*(Math.PI/180),p=(N,C)=>o+d[N]*Math.cos(h(N,C)),m=(N,C)=>c+d[N]*Math.sin(h(N,C)),g=N=>N/l*100,f=(N,C)=>n.rings[N][C],v=(N,C)=>N+"-"+C,x={};(n.edges||[]).forEach(([N,C,P,M])=>{(x[v(N,C)]=x[v(N,C)]||new Set).add(v(P,M)),(x[v(P,M)]=x[v(P,M)]||new Set).add(v(N,C))});const b=s||r,j=b?v(b.r,b.i):null,A=(N,C)=>{if(!j)return!1;const P=v(N,C);return P===j||x[j]&&x[j].has(P)},I=(n.edges||[]).map(([N,C,P,M])=>({x1:p(N,C),y1:m(N,C),x2:p(P,M),y2:m(P,M),lit:j?A(N,C)&&A(P,M):!1})),k=N=>N.broken?"is-broken":"role-"+String(N.role||"Vault").toLowerCase(),S=b?(()=>{const N=f(b.r,b.i);return N?{name:N.name,role:N.broken?"referenced, but no file exists yet":N.role+" · "+N.deg+" links"}:null})():n.center?{name:n.center.name,role:"the most-linked file in your vault"}:null,E=(N,C)=>{const P=f(N,C),M=3.5+Math.sqrt(P.deg)*2.4,T=A(N,C),F=!!j&&!T,D=p(N,C)>=o?"r":"l",Y=r&&r.r===N&&r.i===C;return e.jsxs("button",{type:"button",className:"v8orb-node "+k(P)+(T?" is-lit":"")+(F?" is-dim":"")+(Y?" is-pinned":""),style:{left:g(p(N,C))+"%",top:g(m(N,C))+"%","--r":M*2+"px"},onMouseEnter:()=>a({r:N,i:C}),onMouseLeave:()=>a(null),onFocus:()=>a({r:N,i:C}),onBlur:()=>a(null),onClick:()=>{i(Y?null:{r:N,i:C}),window.openXray&&window.openXray("Graph node: "+P.name,P.deg+" links · "+(P.broken?"referenced but no file exists":P.role),n.src)},"aria-label":P.name+", "+P.deg+" links"+(P.broken?", referenced but missing":""),children:[e.jsx("span",{className:"v8orb-pip","aria-hidden":"true"}),e.jsx("span",{className:"v8orb-lbl side-"+D,"aria-hidden":"true",children:P.name})]},N+"-"+C)},L=n.rings.flatMap((N,C)=>N.map((P,M)=>({...P,ri:C,i:M}))).sort((N,C)=>C.deg-N.deg).slice(0,8),w=n.stat;return e.jsxs("section",{id:"s8-orb",className:"m4-sec v8orb-sec","data-coach":"library-orrery",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, vault graph",children:[e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"What's most connected"}),w?e.jsxs("span",{className:"v8orb-stat","aria-label":w.notes+" notes, "+w.links+" links",children:[e.jsxs("span",{className:"v8orb-stat-pair",children:[e.jsx("b",{className:"v8orb-stat-n m-num",children:w.notes}),e.jsx("span",{className:"v8orb-stat-u",children:"notes"})]}),e.jsxs("span",{className:"v8orb-stat-pair",children:[e.jsx("b",{className:"v8orb-stat-n m-num",children:w.links}),e.jsx("span",{className:"v8orb-stat-u",children:"links"})]})]}):e.jsx("span",{className:"v8orb-aside",children:"real links only"})]}),e.jsxs("div",{className:"v8orb",children:[e.jsxs("div",{className:"v8orb-ring",children:[e.jsxs("svg",{className:"v8orb-svg",viewBox:`0 0 ${l} ${l}`,"aria-hidden":"true",focusable:"false",children:[d.map((N,C)=>e.jsx("circle",{className:"v8orb-track",cx:o,cy:c,r:N},C)),I.map((N,C)=>e.jsx("line",{className:"v8orb-edge"+(N.lit?" is-lit":""),x1:N.x1,y1:N.y1,x2:N.x2,y2:N.y2,pathLength:"1",style:{"--i":C}},C))]}),e.jsxs("div",{className:"v8orb-core",children:[e.jsx("span",{className:"v8orb-core-k",children:b?"file":"the vault"}),e.jsx("span",{className:"v8orb-core-n",children:S?S.name:"no links yet"}),e.jsx("span",{className:"v8orb-core-s",children:S?S.role:"your most-linked files"})]}),[0,1,2].map(N=>e.jsx(React.Fragment,{children:n.rings[N].map((C,P)=>E(N,P))},"r"+N))]}),e.jsxs("div",{className:"v8orb-legend",children:[e.jsxs("div",{className:"v8orb-rings-key",role:"group","aria-label":"Node colour by folder",children:[e.jsx("span",{className:"rk role-engine",children:"Engine"}),e.jsx("span",{className:"rk role-library",children:"Library"}),e.jsx("span",{className:"rk role-projects",children:"Projects"}),e.jsx("span",{className:"rk is-broken",children:"missing"})]}),e.jsx("span",{className:"v8orb-hint",children:"Inner ring is most linked. Click a file to light what it connects to."}),w&&(w.orphans||w.broken)?e.jsxs("div",{className:"v8orb-health",children:[e.jsx("b",{className:"m-num",children:w.orphans})," notes link to nothing",w.broken?e.jsxs(e.Fragment,{children:[" · ",e.jsx("b",{className:"m-num",children:w.broken})," links point to a missing file"]}):null]}):null]})]}),L.length?e.jsxs("div",{className:"v8orb-files",children:[e.jsx("span",{className:"v8orb-files-k",children:"Most connected"}),e.jsx("ul",{className:"v8orb-files-list",children:L.map(N=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"v8orb-frow"+(r&&r.r===N.ri&&r.i===N.i?" is-on":""),onClick:()=>{i({r:N.ri,i:N.i}),window.openXray&&window.openXray("Graph node: "+N.name,N.deg+" links · "+(N.broken?"referenced but missing":N.role),n.src)},children:[e.jsx("span",{className:"v8orb-fname",children:N.name}),e.jsx("span",{className:"v8orb-frole",children:N.broken?"referenced, no file":N.role}),e.jsx("span",{className:"v8orb-fdeg m-num",children:N.deg})]})},N.ri+"-"+N.name))})]}):null]})}const na=/\.(md|txt|sh|js|mjs|ps1|canvas|json)$/i;function Yd(n){fetch("/api/health").then(t=>t.json()).then(t=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":t&&t.token},body:JSON.stringify({filePath:(t&&t.vault||"").replace(/\/+$/,"")+"/"+n})})).catch(()=>{})}function ta({text:n,needle:t}){if(!n)return null;const s=t?n.toLowerCase().indexOf(t.toLowerCase()):-1;return s===-1?e.jsx(React.Fragment,{children:n}):e.jsxs(React.Fragment,{children:[n.slice(0,s),e.jsx("b",{className:"v8cat-mark",children:n.slice(s,s+t.length)}),n.slice(s+t.length)]})}function ni({L:n,sparse:t}){const[s,a]=window.useStored3?window.useStored3("m4.libgroup","All"):React.useState("All"),[r,i]=React.useState(""),[l,o]=React.useState(null),[c,d]=React.useState(!1),[u,h]=React.useState(!1),[p,m]=React.useState(null),g=n.bento||[],f=g.find(y=>y.k===s)||null,v=f?f.types:null,x=f&&f.id||"",b=r.trim(),j=!t&&b.length>=2&&x!=="cli",A=n.items||[],I=!f||A.some(y=>f.types.includes(y.g)),k=!t&&!!f&&x!=="cli"&&!I&&!j,S=A.filter(y=>(!v||v.includes(y.g))&&(!r||(y.t+" "+y.sum+" "+y.path).toLowerCase().includes(r.toLowerCase())));if(React.useEffect(()=>{if(!j){o(null),d(!1);return}let y=!1;d(!0);const V=setTimeout(()=>{const H=f&&s!=="All"?"&shelf="+encodeURIComponent(x):"";fetch("/api/library/search?q="+encodeURIComponent(b)+H+"&limit=60").then(R=>R.json()).then(R=>{y||(R&&R.ok?(o(R),h(!1)):(o(null),h(!0)))}).catch(()=>{y||(o(null),h(!0))}).finally(()=>{y||d(!1)})},250);return()=>{y=!0,clearTimeout(V)}},[j,b,x,s]),React.useEffect(()=>{if(!k){m(null);return}let y=!1;return fetch("/api/library/search?shelf="+encodeURIComponent(x)+"&limit=100").then(V=>V.json()).then(V=>{y||m(V&&V.ok?V:{failed:!0})}).catch(()=>{y||m({failed:!0})}),()=>{y=!0}},[k,x]),t)return window.Empty?e.jsx(window.Empty,{title:"Nothing indexed yet.",line:window.V4LSPARSE&&window.V4LSPARSE.note||"Run a sync to index your vault."}):null;const E=y=>{if(y.nameOnly&&!na.test(y.name)&&y.root==="vault"){Yd(y.relPath);return}window.openFileView&&window.openFileView(y.relPath,y.passage||"",{root:y.root,line:y.line})},L=(y,V)=>e.jsxs("button",{type:"button",className:"v8cat-row is-hit",onClick:()=>E(y),"aria-label":y.name+(y.line?", opens at line "+y.line:", matched by name"),children:[e.jsx("span",{className:"v8cat-t",children:e.jsx(ta,{text:y.name,needle:b})}),e.jsx("span",{className:"v8cat-sum",children:y.passage?e.jsx(ta,{text:y.passage,needle:b}):na.test(y.name)?"matched by file name":"matched by file name · not a text file, opens in its own app"}),e.jsx("span",{className:"v8cat-mod m-num",children:y.line?"line "+y.line:""})]},y.root+":"+y.relPath+":"+V),w=y=>e.jsxs("button",{type:"button",className:"v8cat-row",onClick:()=>E(y),"aria-label":"Open "+y.name,children:[e.jsx("span",{className:"v8cat-t",children:y.name}),e.jsx("span",{className:"v8cat-sum",children:y.relPath}),e.jsx("span",{className:"v8cat-mod",children:y.mtime?y.mtime.slice(0,10):""})]},y.root+":"+y.relPath),N={};S.forEach(y=>{(N[y.g]=N[y.g]||[]).push(y)});const C=Object.keys(N).sort((y,V)=>N[V].length-N[y].length),P={};(l&&l.results||[]).forEach(y=>{(P[y.shelfLabel]=P[y.shelfLabel]||[]).push(y)});const M=Object.keys(P).sort((y,V)=>P[V].length-P[y].length),T=l&&l.coverage?(()=>{const y=l.coverage,V=["Contents searched across "+(y.indexed||[]).length+" shelves"];return(y.notIndexable||[]).forEach(H=>V.push(H.label+" excluded: "+String(H.reason||"").toLowerCase().replace(/\.$/,""))),(y.missing||[]).length&&V.push(y.missing.map(H=>H.label).join(", ")+" not found on disk"),V.join(" · ")})():null,F=j&&l&&!u,D=!F&&!k&&x!=="cli",Y=F?l.results.length:k?(p&&p.results||[]).length:S.length,z=y=>e.jsxs("button",{type:"button",className:"v8cat-row"+(y.stale?" is-stale":""),onClick:()=>window.openXray&&window.openXray(y.t,y.sum,y.src),"aria-label":y.t+(y.stale?", not touched in over a month":""),title:y.stale?"Not touched in over a month":void 0,children:[e.jsx("span",{className:"v8cat-t",children:y.t}),e.jsxs("span",{className:"v8cat-sum",children:[y.redacted?"redacted on this surface · ":"",y.sum]}),e.jsx("span",{className:"v8cat-mod",children:y.mod})]},y.path);return e.jsxs(React.Fragment,{children:[e.jsxs("div",{className:"v8cat-ledge",children:[e.jsx("span",{className:"n m-num",children:n.indexedCount}),e.jsx("span",{className:"u",children:"indexed"})]}),(()=>{const y=/^(skills|hooks|workflows|cli commands)$/i,V=g.filter(Q=>!y.test(Q.k)),H=g.filter(Q=>y.test(Q.k)),R=Q=>e.jsxs("button",{type:"button",className:"v8cat-shelf"+(s===Q.k?" is-on":""),onClick:()=>a(s===Q.k?"All":Q.k),children:[e.jsx("span",{className:"n m-num",children:Q.n==="—"||Q.n==null?" ":Q.n}),e.jsx("span",{className:"k",children:Q.k})]},Q.k);return e.jsxs(React.Fragment,{children:[e.jsx("div",{className:"v8cat-shelves",children:V.map(R)}),H.length?e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"v8cat-shelfband",children:"The system's own parts, indexed so search covers them too"}),e.jsx("div",{className:"v8cat-shelves is-system",children:H.map(R)})]}):null]})})(),e.jsxs("div",{className:"v8cat-search",children:[window.MIcons?window.MIcons.search(15):null,e.jsx("input",{value:r,onChange:y=>i(y.target.value),placeholder:s==="All"?"Search everything…":"Search "+s.toLowerCase()+"…","aria-label":"Search the vault"}),e.jsxs("span",{className:"m4-aside m-num",children:[c?"searching…":Y+(F?" found":" shown"),F&&l.truncated?" · first "+l.results.length:"",s!=="All"?e.jsx("button",{className:"m-link",style:{marginLeft:8},onClick:()=>a("All"),children:"show all"}):null]})]}),F&&T?e.jsx("p",{className:"v8cat-cover",children:T}):null,j&&u?e.jsx("p",{className:"v8cat-cover is-warn",children:"Content search is unreachable right now · matching names and summaries of the filed notes only."}):null,e.jsxs("section",{className:"v8cat","data-screen-label":"Library, catalog",children:[F?l.results.length?M.map(y=>e.jsxs("div",{className:"v8cat-grp",children:[e.jsxs("div",{className:"v8cat-grp-head",children:[e.jsx("span",{className:"gk",children:y}),e.jsx("span",{className:"gn m-num",children:P[y].length})]}),P[y].map(L)]},y)):window.Empty?e.jsx(window.Empty,{title:"Nothing matches.",line:"Every shelf's file contents were searched. Try a shorter word."}):null:null,k?p===null?e.jsx("p",{className:"v8cat-cover",children:"Listing the shelf…"}):p.failed?window.Empty?e.jsx(window.Empty,{title:"Can't list this shelf right now.",line:"The index endpoint didn't answer. The count above is still real."}):null:p.results&&p.results.length?e.jsxs("div",{className:"v8cat-grp",children:[e.jsxs("div",{className:"v8cat-grp-head",children:[e.jsx("span",{className:"gk",children:s}),e.jsx("span",{className:"gn m-num",children:p.results.length})]}),p.results.map(w)]}):window.Empty?e.jsx(window.Empty,{title:"This shelf is empty on disk.",line:"Nothing is hidden; there are no files behind this count yet."}):null:null,x==="cli"&&window.Empty?e.jsx(window.Empty,{title:"CLI commands are not files.",line:"They are terminal commands with usage counts. There is no text to search or open; the count above is the real registry size."}):null,D?e.jsxs(React.Fragment,{children:[C.map(y=>e.jsxs("div",{className:"v8cat-grp",children:[e.jsxs("div",{className:"v8cat-grp-head",children:[e.jsx("span",{className:"gk",children:y}),e.jsx("span",{className:"gn m-num",children:N[y].length})]}),N[y].map(z)]},y)),!S.length&&window.Empty?e.jsx(window.Empty,{title:"Nothing matches.",line:"Try another shelf or clear the search. Nothing is hidden."}):null]}):null]})]})}function qd(n){if(!n)return null;try{const t=new Date(n);return isNaN(t.getTime())?null:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return null}}function Ud({L:n}){const t=n.voice||{},s=e.jsxs("div",{className:"m4-sec-head",children:[e.jsx("span",{className:"m-kicker",children:"Your writing voice"}),e.jsx("span",{className:"v8orb-aside",children:"Voice_DNA.md"})]});if(!t.available)return e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[s,window.Empty?e.jsx(window.Empty,{title:"No Voice_DNA.md yet.",line:"Once you set a writing voice, its fingerprint shows here, with your own sample passages."}):null]});const a=qd(t.lastUpdated),r=Array.isArray(t.samples)?t.samples:[],i=Array.isArray(t.traits)?t.traits:[],o=([t.rulesCount?`${t.rulesCount} writing rules`:null,t.bannedCount?`${t.bannedCount} banned phrases`:null,t.sampleCount?`${t.sampleCount} sample${t.sampleCount===1?"":"s"}`:null].filter(Boolean).join(" · ")||"voice rules on file")+(a?` · updated ${a}`:""),c=Array.isArray(t.rules)?t.rules:[],d=Array.isArray(t.banned)?t.banned:[];return e.jsxs("section",{className:"m4-sec",style:{borderTop:"none",paddingTop:0},"data-screen-label":"Library, Voice DNA",children:[s,e.jsxs("div",{className:"v8voice-state",children:[e.jsx("span",{className:"v8voice-badge",children:t.calibrated?"Calibrated":"On file"}),e.jsx("span",{className:"v8voice-meta",children:o}),e.jsxs("span",{className:"v8voice-acts",children:[e.jsx("button",{type:"button",className:"m-link",onClick:()=>window.openFileView&&window.openFileView("02_Areas/Engine/Voice_DNA.md"),children:"Read it"}),e.jsx("button",{type:"button",className:"m-link",onClick:()=>{fetch("/api/health").then(u=>u.json()).then(u=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":u&&u.token},body:JSON.stringify({filePath:(u&&u.vault||"").replace(/\/+$/,"")+"/02_Areas/Engine/Voice_DNA.md"})})).catch(()=>{})},children:"Edit in Obsidian"}),e.jsx("button",{type:"button",className:"m-link",onClick:()=>{window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:"Retrain my writing voice: read 02_Areas/Engine/Voice_DNA.md, then ask me for 2 or 3 fresh sample passages I have written recently, and propose an updated Voice_DNA.md for my approval before writing anything."})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"}))},children:"Retrain in Chat"})]})]}),i.length?e.jsx("div",{className:"v8voice-traits",children:i.map((u,h)=>e.jsx("span",{className:"v8voice-trait",children:u},h))}):null,r.length?e.jsx("div",{className:"v8voice",children:r.map((u,h)=>e.jsxs("div",{className:"v8voice-line",children:[e.jsx("b",{className:"v8voice-n",children:String(h+1).padStart(2,"0")}),e.jsx("span",{className:"v8voice-t",children:u})]},h))}):null,c.length||d.length?e.jsxs("div",{className:"v8voice-defn",children:[c.length?e.jsxs("div",{className:"v8voice-col",children:[e.jsx("span",{className:"v8voice-col-k",children:"How it reads"}),e.jsx("ul",{className:"v8voice-rules",children:c.map((u,h)=>e.jsx("li",{children:u},h))})]}):null,d.length?e.jsxs("div",{className:"v8voice-col",children:[e.jsx("span",{className:"v8voice-col-k",children:"Words it avoids"}),e.jsx("div",{className:"v8voice-banned",children:d.map((u,h)=>e.jsx("span",{className:"v8voice-ban",children:u},h))})]}):null]}):r.length?null:e.jsx("p",{className:"v8voice-note",children:"Calibrated. The rules and banned phrases live in Voice_DNA.md."})]})}function Kd({D:n,onNav:t}){const s=window.LibraryView,a=n&&n.__sparse,r=window.V4L,[i,l]=window.useStored3?window.useStored3("m4.liblens","graph"):React.useState("graph"),o=ea.some(c=>c.id===i)?i:"graph";return React.useEffect(()=>{const c=d=>{const u=d&&d.detail||"";(u.includes("library-orrery")||u.includes("library-panel-graph"))&&l("graph"),u.includes("library-panel-index")&&l("index"),u.includes("library-panel-voice")&&l("voice")};return window.addEventListener("m4-coach-seek",c),()=>window.removeEventListener("m4-coach-seek",c)},[]),!r&&typeof s=="function"?e.jsx("div",{className:"v8-lib",children:e.jsx(s,{D:n,onNav:t})}):e.jsx("div",{className:"v8-lib","data-screen-label":"Library (v8 distinctive)",children:e.jsx("div",{className:"m-wrap",children:e.jsxs("div",{className:"m4l-room",children:[e.jsx("nav",{className:"m4e-lenses",role:"tablist","aria-label":"Library lenses",children:ea.map(c=>e.jsx("button",{role:"tab","aria-selected":o===c.id,className:"m4e-lens"+(o===c.id?" is-on":""),onClick:()=>l(c.id),children:c.k},c.id))}),e.jsxs("div",{className:"m4l-main",role:"tabpanel","data-coach":"library-panel-"+o,children:[o==="index"?e.jsx(ni,{L:r,sparse:a}):null,o==="graph"?e.jsx(ei,{GR:r.graphReal,sparse:a}):null,o==="voice"?e.jsx(Ud,{L:r}):null]})]})})})}Object.assign(window,{LibraryViewV8:Kd,V8Orrery:ei,V8Index:ni});function Jd(n,t){const s={};return(n[n.length-1]===""?[...n,""]:n).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const Gd=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Zd={};function sa(n,t){return(Zd.jsx?Qd:Gd).test(n)}const eu=/[ \t\n\f\r]/g;function nu(n){return typeof n=="object"?n.type==="text"?aa(n.value):!1:aa(n)}function aa(n){return n.replace(eu,"")===""}class _n{constructor(t,s,a){this.normal=s,this.property=t,a&&(this.space=a)}}_n.prototype.normal={};_n.prototype.property={};_n.prototype.space=void 0;function ti(n,t){const s={},a={};for(const r of n)Object.assign(s,r.property),Object.assign(a,r.normal);return new _n(s,a,t)}function Vt(n){return n.toLowerCase()}class Me{constructor(t,s){this.attribute=s,this.property=t}}Me.prototype.attribute="";Me.prototype.booleanish=!1;Me.prototype.boolean=!1;Me.prototype.commaOrSpaceSeparated=!1;Me.prototype.commaSeparated=!1;Me.prototype.defined=!1;Me.prototype.mustUseProperty=!1;Me.prototype.number=!1;Me.prototype.overloadedBoolean=!1;Me.prototype.property="";Me.prototype.spaceSeparated=!1;Me.prototype.space=void 0;let tu=0;const te=on(),ye=on(),Wt=on(),B=on(),ue=on(),gn=on(),Oe=on();function on(){return 2**++tu}const Bt=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:ye,commaOrSpaceSeparated:Oe,commaSeparated:gn,number:B,overloadedBoolean:Wt,spaceSeparated:ue},Symbol.toStringTag,{value:"Module"})),xt=Object.keys(Bt);class ds extends Me{constructor(t,s,a,r){let i=-1;if(super(t,s),ra(this,"space",r),typeof a=="number")for(;++i<xt.length;){const l=xt[i];ra(this,xt[i],(a&Bt[l])===Bt[l])}}}ds.prototype.defined=!0;function ra(n,t,s){s&&(n[t]=s)}function vn(n){const t={},s={};for(const[a,r]of Object.entries(n.properties)){const i=new ds(a,n.transform(n.attributes||{},a),r,n.space);n.mustUseProperty&&n.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),t[a]=i,s[Vt(a)]=a,s[Vt(i.attribute)]=a}return new _n(t,s,n.space)}const si=vn({properties:{ariaActiveDescendant:null,ariaAtomic:ye,ariaAutoComplete:null,ariaBusy:ye,ariaChecked:ye,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:ue,ariaCurrent:null,ariaDescribedBy:ue,ariaDetails:null,ariaDisabled:ye,ariaDropEffect:ue,ariaErrorMessage:null,ariaExpanded:ye,ariaFlowTo:ue,ariaGrabbed:ye,ariaHasPopup:null,ariaHidden:ye,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ue,ariaLevel:B,ariaLive:null,ariaModal:ye,ariaMultiLine:ye,ariaMultiSelectable:ye,ariaOrientation:null,ariaOwns:ue,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:ye,ariaReadOnly:ye,ariaRelevant:null,ariaRequired:ye,ariaRoleDescription:ue,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:ye,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(n,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ai(n,t){return t in n?n[t]:t}function ri(n,t){return ai(n,t.toLowerCase())}const su=vn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gn,acceptCharset:ue,accessKey:ue,action:null,allow:null,allowFullScreen:te,allowPaymentRequest:te,allowUserMedia:te,alt:null,as:null,async:te,autoCapitalize:null,autoComplete:ue,autoFocus:te,autoPlay:te,blocking:ue,capture:null,charSet:null,checked:te,cite:null,className:ue,cols:B,colSpan:null,content:null,contentEditable:ye,controls:te,controlsList:ue,coords:B|gn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:te,defer:te,dir:null,dirName:null,disabled:te,download:Wt,draggable:ye,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:te,formTarget:null,headers:ue,height:B,hidden:Wt,high:B,href:null,hrefLang:null,htmlFor:ue,httpEquiv:ue,id:null,imageSizes:null,imageSrcSet:null,inert:te,inputMode:null,integrity:null,is:null,isMap:te,itemId:null,itemProp:ue,itemRef:ue,itemScope:te,itemType:ue,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:te,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:te,muted:te,name:null,nonce:null,noModule:te,noValidate:te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:te,optimum:B,pattern:null,ping:ue,placeholder:null,playsInline:te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:te,referrerPolicy:null,rel:ue,required:te,reversed:te,rows:B,rowSpan:B,sandbox:ue,scope:null,scoped:te,seamless:te,selected:te,shadowRootClonable:te,shadowRootDelegatesFocus:te,shadowRootMode:null,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:ye,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:te,useMap:null,value:ye,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ue,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:te,declare:te,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:te,noHref:te,noShade:te,noWrap:te,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:ye,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:te,disableRemotePlayback:te,prefix:null,property:null,results:B,security:null,unselectable:null},space:"html",transform:ri}),au=vn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Oe,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:ue,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:te,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:gn,g2:gn,glyphName:gn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:Oe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ue,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oe,rev:Oe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oe,requiredFeatures:Oe,requiredFonts:Oe,requiredFormats:Oe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:Oe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oe,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ai}),ii=vn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,t){return"xlink:"+t.slice(5).toLowerCase()}}),li=vn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ri}),oi=vn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,t){return"xml:"+t.slice(3).toLowerCase()}}),ru={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},iu=/[A-Z]/g,ia=/-[a-z]/g,lu=/^data[-\w.:]+$/i;function ou(n,t){const s=Vt(t);let a=t,r=Me;if(s in n.normal)return n.property[n.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&lu.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(ia,du);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!ia.test(i)){let l=i.replace(iu,cu);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}r=ds}return new r(a,t)}function cu(n){return"-"+n.toLowerCase()}function du(n){return n.charAt(1).toUpperCase()}const uu=ti([si,su,ii,li,oi],"html"),us=ti([si,au,ii,li,oi],"svg");function hu(n){return n.join(" ").trim()}var hn={},yt,la;function mu(){if(la)return yt;la=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,s=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,r=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,c=`
|
|
132
|
+
`,d="/",u="*",h="",p="comment",m="declaration";function g(v,x){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];x=x||{};var b=1,j=1;function A(M){var T=M.match(t);T&&(b+=T.length);var F=M.lastIndexOf(c);j=~F?M.length-F:j+M.length}function I(){var M={line:b,column:j};return function(T){return T.position=new k(M),L(),T}}function k(M){this.start=M,this.end={line:b,column:j},this.source=x.source}k.prototype.content=v;function S(M){var T=new Error(x.source+":"+b+":"+j+": "+M);if(T.reason=M,T.filename=x.source,T.line=b,T.column=j,T.source=v,!x.silent)throw T}function E(M){var T=M.exec(v);if(T){var F=T[0];return A(F),v=v.slice(F.length),T}}function L(){E(s)}function w(M){var T;for(M=M||[];T=N();)T!==!1&&M.push(T);return M}function N(){var M=I();if(!(d!=v.charAt(0)||u!=v.charAt(1))){for(var T=2;h!=v.charAt(T)&&(u!=v.charAt(T)||d!=v.charAt(T+1));)++T;if(T+=2,h===v.charAt(T-1))return S("End of comment missing");var F=v.slice(2,T-2);return j+=2,A(F),v=v.slice(T),j+=2,M({type:p,comment:F})}}function C(){var M=I(),T=E(a);if(T){if(N(),!E(r))return S("property missing ':'");var F=E(i),D=M({type:m,property:f(T[0].replace(n,h)),value:F?f(F[0].replace(n,h)):h});return E(l),D}}function P(){var M=[];w(M);for(var T;T=C();)T!==!1&&(M.push(T),w(M));return M}return L(),P()}function f(v){return v?v.replace(o,h):h}return yt=g,yt}var oa;function pu(){if(oa)return hn;oa=1;var n=hn&&hn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(hn,"__esModule",{value:!0}),hn.default=s;const t=n(mu());function s(a,r){let i=null;if(!a||typeof a!="string")return i;const l=(0,t.default)(a),o=typeof r=="function";return l.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:u}=c;o?r(d,u,c):u&&(i=i||{},i[d]=u)}),i}return hn}var bn={},ca;function fu(){if(ca)return bn;ca=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,s=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,i=function(d){return!d||s.test(d)||n.test(d)},l=function(d,u){return u.toUpperCase()},o=function(d,u){return"".concat(u,"-")},c=function(d,u){return u===void 0&&(u={}),i(d)?d:(d=d.toLowerCase(),u.reactCompat?d=d.replace(r,o):d=d.replace(a,o),d.replace(t,l))};return bn.camelCase=c,bn}var Nn,da;function gu(){if(da)return Nn;da=1;var n=Nn&&Nn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=n(pu()),s=fu();function a(r,i){var l={};return!r||typeof r!="string"||(0,t.default)(r,function(o,c){o&&c&&(l[(0,s.camelCase)(o,i)]=c)}),l}return a.default=a,Nn=a,Nn}var xu=gu();const yu=Ka(xu),ci=di("end"),hs=di("start");function di(n){return t;function t(s){const a=s&&s.position&&s.position[n]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function vu(n){const t=hs(n),s=ci(n);if(t&&s)return{start:t,end:s}}function Rn(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?ua(n.position):"start"in n||"end"in n?ua(n):"line"in n||"column"in n?Ht(n):""}function Ht(n){return ha(n&&n.line)+":"+ha(n&&n.column)}function ua(n){return Ht(n&&n.start)+"-"+Ht(n&&n.end)}function ha(n){return n&&typeof n=="number"?n:1}class Te extends Error{constructor(t,s,a){super(),typeof s=="string"&&(a=s,s=void 0);let r="",i={},l=!1;if(s&&("line"in s&&"column"in s?i={place:s}:"start"in s&&"end"in s?i={place:s}:"type"in s?i={ancestors:[s],place:s.position}:i={...s}),typeof t=="string"?r=t:!i.cause&&t&&(l=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof a=="string"){const c=a.indexOf(":");c===-1?i.ruleId=a:(i.source=a.slice(0,c),i.ruleId=a.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=Rn(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Te.prototype.file="";Te.prototype.name="";Te.prototype.reason="";Te.prototype.message="";Te.prototype.stack="";Te.prototype.column=void 0;Te.prototype.line=void 0;Te.prototype.ancestors=void 0;Te.prototype.cause=void 0;Te.prototype.fatal=void 0;Te.prototype.place=void 0;Te.prototype.ruleId=void 0;Te.prototype.source=void 0;const ms={}.hasOwnProperty,wu=new Map,ju=/[A-Z]/g,ku=new Set(["table","tbody","thead","tfoot","tr"]),bu=new Set(["td","th"]),ui="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Nu(n,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const s=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=Au(s,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=Mu(s,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?us:uu,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=hi(r,n,void 0);return i&&typeof i!="string"?i:r.create(n,r.Fragment,{children:i||void 0},void 0)}function hi(n,t,s){if(t.type==="element")return Su(n,t,s);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Cu(n,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ru(n,t,s);if(t.type==="mdxjsEsm")return Tu(n,t);if(t.type==="root")return Eu(n,t,s);if(t.type==="text")return Iu(n,t)}function Su(n,t,s){const a=n.schema;let r=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(r=us,n.schema=r),n.ancestors.push(t);const i=pi(n,t.tagName,!1),l=Lu(n,t);let o=fs(n,t);return ku.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!nu(c):!0})),mi(n,l,i,t),ps(l,o),n.ancestors.pop(),n.schema=a,n.create(t,i,l,s)}function Cu(n,t){if(t.data&&t.data.estree&&n.evaluater){const a=t.data.estree.body[0];return a.type,n.evaluater.evaluateExpression(a.expression)}Pn(n,t.position)}function Tu(n,t){if(t.data&&t.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(t.data.estree);Pn(n,t.position)}function Ru(n,t,s){const a=n.schema;let r=a;t.name==="svg"&&a.space==="html"&&(r=us,n.schema=r),n.ancestors.push(t);const i=t.name===null?n.Fragment:pi(n,t.name,!0),l=Ou(n,t),o=fs(n,t);return mi(n,l,i,t),ps(l,o),n.ancestors.pop(),n.schema=a,n.create(t,i,l,s)}function Eu(n,t,s){const a={};return ps(a,fs(n,t)),n.create(t,n.Fragment,a,s)}function Iu(n,t){return t.value}function mi(n,t,s,a){typeof s!="string"&&s!==n.Fragment&&n.passNode&&(t.node=a)}function ps(n,t){if(t.length>0){const s=t.length>1?t:t[0];s&&(n.children=s)}}function Mu(n,t,s){return a;function a(r,i,l,o){const d=Array.isArray(l.children)?s:t;return o?d(i,l,o):d(i,l)}}function Au(n,t){return s;function s(a,r,i,l){const o=Array.isArray(i.children),c=hs(a);return t(r,i,l,o,{columnNumber:c?c.column-1:void 0,fileName:n,lineNumber:c?c.line:void 0},void 0)}}function Lu(n,t){const s={};let a,r;for(r in t.properties)if(r!=="children"&&ms.call(t.properties,r)){const i=Pu(n,r,t.properties[r]);if(i){const[l,o]=i;n.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&bu.has(t.tagName)?a=o:s[l]=o}}if(a){const i=s.style||(s.style={});i[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return s}function Ou(n,t){const s={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&n.evaluater){const i=a.data.estree.body[0];i.type;const l=i.expression;l.type;const o=l.properties[0];o.type,Object.assign(s,n.evaluater.evaluateExpression(o.argument))}else Pn(n,t.position);else{const r=a.name;let i;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&n.evaluater){const o=a.value.data.estree.body[0];o.type,i=n.evaluater.evaluateExpression(o.expression)}else Pn(n,t.position);else i=a.value===null?!0:a.value;s[r]=i}return s}function fs(n,t){const s=[];let a=-1;const r=n.passKeys?new Map:wu;for(;++a<t.children.length;){const i=t.children[a];let l;if(n.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=r.get(c)||0;l=c+"-"+d,r.set(c,d+1)}}const o=hi(n,i,l);o!==void 0&&s.push(o)}return s}function Pu(n,t,s){const a=ou(n.schema,t);if(!(s==null||typeof s=="number"&&Number.isNaN(s))){if(Array.isArray(s)&&(s=a.commaSeparated?Jd(s):hu(s)),a.property==="style"){let r=typeof s=="object"?s:Du(n,String(s));return n.stylePropertyNameCase==="css"&&(r=Fu(r)),["style",r]}return[n.elementAttributeNameCase==="react"&&a.space?ru[a.property]||a.property:a.attribute,s]}}function Du(n,t){try{return yu(t,{reactCompat:!0})}catch(s){if(n.ignoreInvalidStyle)return{};const a=s,r=new Te("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=n.filePath||void 0,r.url=ui+"#cannot-parse-style-attribute",r}}function pi(n,t,s){let a;if(!s)a={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,l;for(;++i<r.length;){const o=sa(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}a=l}else a=sa(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const r=a.value;return ms.call(n.components,r)?n.components[r]:r}if(n.evaluater)return n.evaluater.evaluateExpression(a);Pn(n)}function Pn(n,t){const s=new Te("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw s.file=n.filePath||void 0,s.url=ui+"#cannot-handle-mdx-estrees-without-createevaluater",s}function Fu(n){const t={};let s;for(s in n)ms.call(n,s)&&(t[_u(s)]=n[s]);return t}function _u(n){let t=n.replace(ju,zu);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function zu(n){return"-"+n.toLowerCase()}const vt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Vu={};function gs(n,t){const s=Vu,a=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,r=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return fi(n,a,r)}function fi(n,t,s){if(Wu(n)){if("value"in n)return n.type==="html"&&!s?"":n.value;if(t&&"alt"in n&&n.alt)return n.alt;if("children"in n)return ma(n.children,t,s)}return Array.isArray(n)?ma(n,t,s):""}function ma(n,t,s){const a=[];let r=-1;for(;++r<n.length;)a[r]=fi(n[r],t,s);return a.join("")}function Wu(n){return!!(n&&typeof n=="object")}const pa=document.createElement("i");function xs(n){const t="&"+n+";";pa.innerHTML=t;const s=pa.textContent;return s.charCodeAt(s.length-1)===59&&n!=="semi"||s===t?!1:s}function Fe(n,t,s,a){const r=n.length;let i=0,l;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,s=s>0?s:0,a.length<1e4)l=Array.from(a),l.unshift(t,s),n.splice(...l);else for(s&&n.splice(t,s);i<a.length;)l=a.slice(i,i+1e4),l.unshift(t,0),n.splice(...l),i+=1e4,t+=1e4}function ze(n,t){return n.length>0?(Fe(n,n.length,0,t),n):t}const fa={}.hasOwnProperty;function gi(n){const t={};let s=-1;for(;++s<n.length;)Bu(t,n[s]);return t}function Bu(n,t){let s;for(s in t){const r=(fa.call(n,s)?n[s]:void 0)||(n[s]={}),i=t[s];let l;if(i)for(l in i){fa.call(r,l)||(r[l]=[]);const o=i[l];Hu(r[l],Array.isArray(o)?o:o?[o]:[])}}}function Hu(n,t){let s=-1;const a=[];for(;++s<t.length;)(t[s].add==="after"?n:a).push(t[s]);Fe(n,0,0,a)}function xi(n,t){const s=Number.parseInt(n,t);return s<9||s===11||s>13&&s<32||s>126&&s<160||s>55295&&s<57344||s>64975&&s<65008||(s&65535)===65535||(s&65535)===65534||s>1114111?"�":String.fromCodePoint(s)}function He(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Re=nn(/[A-Za-z]/),Ce=nn(/[\dA-Za-z]/),$u=nn(/[#-'*+\--9=?A-Z^-~]/);function Zn(n){return n!==null&&(n<32||n===127)}const $t=nn(/\d/),Xu=nn(/[\dA-Fa-f]/),Yu=nn(/[!-/:-@[-`{-~]/);function J(n){return n!==null&&n<-2}function de(n){return n!==null&&(n<0||n===32)}function ie(n){return n===-2||n===-1||n===32}const rt=nn(/\p{P}|\p{S}/u),ln=nn(/\s/);function nn(n){return t;function t(s){return s!==null&&s>-1&&n.test(String.fromCharCode(s))}}function wn(n){const t=[];let s=-1,a=0,r=0;for(;++s<n.length;){const i=n.charCodeAt(s);let l="";if(i===37&&Ce(n.charCodeAt(s+1))&&Ce(n.charCodeAt(s+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(l=String.fromCharCode(i));else if(i>55295&&i<57344){const o=n.charCodeAt(s+1);i<56320&&o>56319&&o<57344?(l=String.fromCharCode(i,o),r=1):l="�"}else l=String.fromCharCode(i);l&&(t.push(n.slice(a,s),encodeURIComponent(l)),a=s+r+1,l=""),r&&(s+=r,r=0)}return t.join("")+n.slice(a)}function le(n,t,s,a){const r=a?a-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(c){return ie(c)?(n.enter(s),o(c)):t(c)}function o(c){return ie(c)&&i++<r?(n.consume(c),o):(n.exit(s),t(c))}}const qu={tokenize:Uu};function Uu(n){const t=n.attempt(this.parser.constructs.contentInitial,a,r);let s;return t;function a(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),le(n,t,"linePrefix")}function r(o){return n.enter("paragraph"),i(o)}function i(o){const c=n.enter("chunkText",{contentType:"text",previous:s});return s&&(s.next=c),s=c,l(o)}function l(o){if(o===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(o);return}return J(o)?(n.consume(o),n.exit("chunkText"),i):(n.consume(o),l)}}const Ku={tokenize:Ju},ga={tokenize:Gu};function Ju(n){const t=this,s=[];let a=0,r,i,l;return o;function o(j){if(a<s.length){const A=s[a];return t.containerState=A[1],n.attempt(A[0].continuation,c,d)(j)}return d(j)}function c(j){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const A=t.events.length;let I=A,k;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){k=t.events[I][1].end;break}x(a);let S=A;for(;S<t.events.length;)t.events[S][1].end={...k},S++;return Fe(t.events,I+1,0,t.events.slice(A)),t.events.length=S,d(j)}return o(j)}function d(j){if(a===s.length){if(!r)return p(j);if(r.currentConstruct&&r.currentConstruct.concrete)return g(j);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},n.check(ga,u,h)(j)}function u(j){return r&&b(),x(a),p(j)}function h(j){return t.parser.lazy[t.now().line]=a!==s.length,l=t.now().offset,g(j)}function p(j){return t.containerState={},n.attempt(ga,m,g)(j)}function m(j){return a++,s.push([t.currentConstruct,t.containerState]),p(j)}function g(j){if(j===null){r&&b(),x(0),n.consume(j);return}return r=r||t.parser.flow(t.now()),n.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),f(j)}function f(j){if(j===null){v(n.exit("chunkFlow"),!0),x(0),n.consume(j);return}return J(j)?(n.consume(j),v(n.exit("chunkFlow")),a=0,t.interrupt=void 0,o):(n.consume(j),f)}function v(j,A){const I=t.sliceStream(j);if(A&&I.push(null),j.previous=i,i&&(i.next=j),i=j,r.defineSkip(j.start),r.write(I),t.parser.lazy[j.start.line]){let k=r.events.length;for(;k--;)if(r.events[k][1].start.offset<l&&(!r.events[k][1].end||r.events[k][1].end.offset>l))return;const S=t.events.length;let E=S,L,w;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(L){w=t.events[E][1].end;break}L=!0}for(x(a),k=S;k<t.events.length;)t.events[k][1].end={...w},k++;Fe(t.events,E+1,0,t.events.slice(S)),t.events.length=k}}function x(j){let A=s.length;for(;A-- >j;){const I=s[A];t.containerState=I[1],I[0].exit.call(t,n)}s.length=j}function b(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Gu(n,t,s){return le(n,n.attempt(this.parser.constructs.document,t,s),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function xn(n){if(n===null||de(n)||ln(n))return 1;if(rt(n))return 2}function it(n,t,s){const a=[];let r=-1;for(;++r<n.length;){const i=n[r].resolveAll;i&&!a.includes(i)&&(t=i(t,s),a.push(i))}return t}const Xt={name:"attention",resolveAll:Qu,tokenize:Zu};function Qu(n,t){let s=-1,a,r,i,l,o,c,d,u;for(;++s<n.length;)if(n[s][0]==="enter"&&n[s][1].type==="attentionSequence"&&n[s][1]._close){for(a=s;a--;)if(n[a][0]==="exit"&&n[a][1].type==="attentionSequence"&&n[a][1]._open&&t.sliceSerialize(n[a][1]).charCodeAt(0)===t.sliceSerialize(n[s][1]).charCodeAt(0)){if((n[a][1]._close||n[s][1]._open)&&(n[s][1].end.offset-n[s][1].start.offset)%3&&!((n[a][1].end.offset-n[a][1].start.offset+n[s][1].end.offset-n[s][1].start.offset)%3))continue;c=n[a][1].end.offset-n[a][1].start.offset>1&&n[s][1].end.offset-n[s][1].start.offset>1?2:1;const h={...n[a][1].end},p={...n[s][1].start};xa(h,-c),xa(p,c),l={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...n[a][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...n[s][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...n[a][1].end},end:{...n[s][1].start}},r={type:c>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},n[a][1].end={...l.start},n[s][1].start={...o.end},d=[],n[a][1].end.offset-n[a][1].start.offset&&(d=ze(d,[["enter",n[a][1],t],["exit",n[a][1],t]])),d=ze(d,[["enter",r,t],["enter",l,t],["exit",l,t],["enter",i,t]]),d=ze(d,it(t.parser.constructs.insideSpan.null,n.slice(a+1,s),t)),d=ze(d,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),n[s][1].end.offset-n[s][1].start.offset?(u=2,d=ze(d,[["enter",n[s][1],t],["exit",n[s][1],t]])):u=0,Fe(n,a-1,s-a+3,d),s=a+d.length-u-2;break}}for(s=-1;++s<n.length;)n[s][1].type==="attentionSequence"&&(n[s][1].type="data");return n}function Zu(n,t){const s=this.parser.constructs.attentionMarkers.null,a=this.previous,r=xn(a);let i;return l;function l(c){return i=c,n.enter("attentionSequence"),o(c)}function o(c){if(c===i)return n.consume(c),o;const d=n.exit("attentionSequence"),u=xn(c),h=!u||u===2&&r||s.includes(c),p=!r||r===2&&u||s.includes(a);return d._open=!!(i===42?h:h&&(r||!p)),d._close=!!(i===42?p:p&&(u||!h)),t(c)}}function xa(n,t){n.column+=t,n.offset+=t,n._bufferIndex+=t}const eh={name:"autolink",tokenize:nh};function nh(n,t,s){let a=0;return r;function r(m){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(m),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),i}function i(m){return Re(m)?(n.consume(m),l):m===64?s(m):d(m)}function l(m){return m===43||m===45||m===46||Ce(m)?(a=1,o(m)):d(m)}function o(m){return m===58?(n.consume(m),a=0,c):(m===43||m===45||m===46||Ce(m))&&a++<32?(n.consume(m),o):(a=0,d(m))}function c(m){return m===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(m),n.exit("autolinkMarker"),n.exit("autolink"),t):m===null||m===32||m===60||Zn(m)?s(m):(n.consume(m),c)}function d(m){return m===64?(n.consume(m),u):$u(m)?(n.consume(m),d):s(m)}function u(m){return Ce(m)?h(m):s(m)}function h(m){return m===46?(n.consume(m),a=0,u):m===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(m),n.exit("autolinkMarker"),n.exit("autolink"),t):p(m)}function p(m){if((m===45||Ce(m))&&a++<63){const g=m===45?p:h;return n.consume(m),g}return s(m)}}const zn={partial:!0,tokenize:th};function th(n,t,s){return a;function a(i){return ie(i)?le(n,r,"linePrefix")(i):r(i)}function r(i){return i===null||J(i)?t(i):s(i)}}const yi={continuation:{tokenize:ah},exit:rh,name:"blockQuote",tokenize:sh};function sh(n,t,s){const a=this;return r;function r(l){if(l===62){const o=a.containerState;return o.open||(n.enter("blockQuote",{_container:!0}),o.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(l),n.exit("blockQuoteMarker"),i}return s(l)}function i(l){return ie(l)?(n.enter("blockQuotePrefixWhitespace"),n.consume(l),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),t):(n.exit("blockQuotePrefix"),t(l))}}function ah(n,t,s){const a=this;return r;function r(l){return ie(l)?le(n,i,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return n.attempt(yi,t,s)(l)}}function rh(n){n.exit("blockQuote")}const vi={name:"characterEscape",tokenize:ih};function ih(n,t,s){return a;function a(i){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(i),n.exit("escapeMarker"),r}function r(i){return Yu(i)?(n.enter("characterEscapeValue"),n.consume(i),n.exit("characterEscapeValue"),n.exit("characterEscape"),t):s(i)}}const wi={name:"characterReference",tokenize:lh};function lh(n,t,s){const a=this;let r=0,i,l;return o;function o(h){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(h),n.exit("characterReferenceMarker"),c}function c(h){return h===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(h),n.exit("characterReferenceMarkerNumeric"),d):(n.enter("characterReferenceValue"),i=31,l=Ce,u(h))}function d(h){return h===88||h===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(h),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),i=6,l=Xu,u):(n.enter("characterReferenceValue"),i=7,l=$t,u(h))}function u(h){if(h===59&&r){const p=n.exit("characterReferenceValue");return l===Ce&&!xs(a.sliceSerialize(p))?s(h):(n.enter("characterReferenceMarker"),n.consume(h),n.exit("characterReferenceMarker"),n.exit("characterReference"),t)}return l(h)&&r++<i?(n.consume(h),u):s(h)}}const ya={partial:!0,tokenize:ch},va={concrete:!0,name:"codeFenced",tokenize:oh};function oh(n,t,s){const a=this,r={partial:!0,tokenize:I};let i=0,l=0,o;return c;function c(k){return d(k)}function d(k){const S=a.events[a.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=k,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===o?(l++,n.consume(k),u):l<3?s(k):(n.exit("codeFencedFenceSequence"),ie(k)?le(n,h,"whitespace")(k):h(k))}function h(k){return k===null||J(k)?(n.exit("codeFencedFence"),a.interrupt?t(k):n.check(ya,f,A)(k)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||J(k)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),h(k)):ie(k)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),le(n,m,"whitespace")(k)):k===96&&k===o?s(k):(n.consume(k),p)}function m(k){return k===null||J(k)?h(k):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||J(k)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),h(k)):k===96&&k===o?s(k):(n.consume(k),g)}function f(k){return n.attempt(r,A,v)(k)}function v(k){return n.enter("lineEnding"),n.consume(k),n.exit("lineEnding"),x}function x(k){return i>0&&ie(k)?le(n,b,"linePrefix",i+1)(k):b(k)}function b(k){return k===null||J(k)?n.check(ya,f,A)(k):(n.enter("codeFlowValue"),j(k))}function j(k){return k===null||J(k)?(n.exit("codeFlowValue"),b(k)):(n.consume(k),j)}function A(k){return n.exit("codeFenced"),t(k)}function I(k,S,E){let L=0;return w;function w(T){return k.enter("lineEnding"),k.consume(T),k.exit("lineEnding"),N}function N(T){return k.enter("codeFencedFence"),ie(T)?le(k,C,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):C(T)}function C(T){return T===o?(k.enter("codeFencedFenceSequence"),P(T)):E(T)}function P(T){return T===o?(L++,k.consume(T),P):L>=l?(k.exit("codeFencedFenceSequence"),ie(T)?le(k,M,"whitespace")(T):M(T)):E(T)}function M(T){return T===null||J(T)?(k.exit("codeFencedFence"),S(T)):E(T)}}}function ch(n,t,s){const a=this;return r;function r(l){return l===null?s(l):(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),i)}function i(l){return a.parser.lazy[a.now().line]?s(l):t(l)}}const wt={name:"codeIndented",tokenize:uh},dh={partial:!0,tokenize:hh};function uh(n,t,s){const a=this;return r;function r(d){return n.enter("codeIndented"),le(n,i,"linePrefix",5)(d)}function i(d){const u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?l(d):s(d)}function l(d){return d===null?c(d):J(d)?n.attempt(dh,l,c)(d):(n.enter("codeFlowValue"),o(d))}function o(d){return d===null||J(d)?(n.exit("codeFlowValue"),l(d)):(n.consume(d),o)}function c(d){return n.exit("codeIndented"),t(d)}}function hh(n,t,s){const a=this;return r;function r(l){return a.parser.lazy[a.now().line]?s(l):J(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),r):le(n,i,"linePrefix",5)(l)}function i(l){const o=a.events[a.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):J(l)?r(l):s(l)}}const mh={name:"codeText",previous:fh,resolve:ph,tokenize:gh};function ph(n){let t=n.length-4,s=3,a,r;if((n[s][1].type==="lineEnding"||n[s][1].type==="space")&&(n[t][1].type==="lineEnding"||n[t][1].type==="space")){for(a=s;++a<t;)if(n[a][1].type==="codeTextData"){n[s][1].type="codeTextPadding",n[t][1].type="codeTextPadding",s+=2,t-=2;break}}for(a=s-1,t++;++a<=t;)r===void 0?a!==t&&n[a][1].type!=="lineEnding"&&(r=a):(a===t||n[a][1].type==="lineEnding")&&(n[r][1].type="codeTextData",a!==r+2&&(n[r][1].end=n[a-1][1].end,n.splice(r+2,a-r-2),t-=a-r-2,a=r+2),r=void 0);return n}function fh(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gh(n,t,s){let a=0,r,i;return l;function l(h){return n.enter("codeText"),n.enter("codeTextSequence"),o(h)}function o(h){return h===96?(n.consume(h),a++,o):(n.exit("codeTextSequence"),c(h))}function c(h){return h===null?s(h):h===32?(n.enter("space"),n.consume(h),n.exit("space"),c):h===96?(i=n.enter("codeTextSequence"),r=0,u(h)):J(h)?(n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),c):(n.enter("codeTextData"),d(h))}function d(h){return h===null||h===32||h===96||J(h)?(n.exit("codeTextData"),c(h)):(n.consume(h),d)}function u(h){return h===96?(n.consume(h),r++,u):r===a?(n.exit("codeTextSequence"),n.exit("codeText"),t(h)):(i.type="codeTextData",d(h))}}class xh{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,s){const a=s??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,s,a){const r=s||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return a&&Sn(this.left,a),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const s=this.left.splice(t,Number.POSITIVE_INFINITY);Sn(this.right,s.reverse())}else{const s=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sn(this.left,s.reverse())}}}function Sn(n,t){let s=0;if(t.length<1e4)n.push(...t);else for(;s<t.length;)n.push(...t.slice(s,s+1e4)),s+=1e4}function ji(n){const t={};let s=-1,a,r,i,l,o,c,d;const u=new xh(n);for(;++s<u.length;){for(;s in t;)s=t[s];if(a=u.get(s),s&&a[1].type==="chunkFlow"&&u.get(s-1)[1].type==="listItemPrefix"&&(c=a[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,yh(u,s)),s=t[s],d=!0);else if(a[1]._container){for(i=s,r=void 0;i--;)if(l=u.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(r&&(u.get(r)[1].type="lineEndingBlank"),l[1].type="lineEnding",r=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;r&&(a[1].end={...u.get(r)[1].start},o=u.slice(r,s),o.unshift(a),u.splice(r,s-r+1,o))}}return Fe(n,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function yh(n,t){const s=n.get(t)[1],a=n.get(t)[2];let r=t-1;const i=[];let l=s._tokenizer;l||(l=a.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,c=[],d={};let u,h,p=-1,m=s,g=0,f=0;const v=[f];for(;m;){for(;n.get(++r)[1]!==m;);i.push(r),m._tokenizer||(u=a.sliceStream(m),m.next||u.push(null),h&&l.defineSkip(m.start),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(u),m._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=s;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,v.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(l.events=[],m?(m._tokenizer=void 0,m.previous=void 0):v.pop(),p=v.length;p--;){const x=o.slice(v[p],v[p+1]),b=i.pop();c.push([b,b+x.length-1]),n.splice(b,2,x)}for(c.reverse(),p=-1;++p<c.length;)d[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return d}const vh={resolve:jh,tokenize:kh},wh={partial:!0,tokenize:bh};function jh(n){return ji(n),n}function kh(n,t){let s;return a;function a(o){return n.enter("content"),s=n.enter("chunkContent",{contentType:"content"}),r(o)}function r(o){return o===null?i(o):J(o)?n.check(wh,l,i)(o):(n.consume(o),r)}function i(o){return n.exit("chunkContent"),n.exit("content"),t(o)}function l(o){return n.consume(o),n.exit("chunkContent"),s.next=n.enter("chunkContent",{contentType:"content",previous:s}),s=s.next,r}}function bh(n,t,s){const a=this;return r;function r(l){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),le(n,i,"linePrefix")}function i(l){if(l===null||J(l))return s(l);const o=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):n.interrupt(a.parser.constructs.flow,s,t)(l)}}function ki(n,t,s,a,r,i,l,o,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return h;function h(x){return x===60?(n.enter(a),n.enter(r),n.enter(i),n.consume(x),n.exit(i),p):x===null||x===32||x===41||Zn(x)?s(x):(n.enter(a),n.enter(l),n.enter(o),n.enter("chunkString",{contentType:"string"}),f(x))}function p(x){return x===62?(n.enter(i),n.consume(x),n.exit(i),n.exit(r),n.exit(a),t):(n.enter(o),n.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(n.exit("chunkString"),n.exit(o),p(x)):x===null||x===60||J(x)?s(x):(n.consume(x),x===92?g:m)}function g(x){return x===60||x===62||x===92?(n.consume(x),m):m(x)}function f(x){return!u&&(x===null||x===41||de(x))?(n.exit("chunkString"),n.exit(o),n.exit(l),n.exit(a),t(x)):u<d&&x===40?(n.consume(x),u++,f):x===41?(n.consume(x),u--,f):x===null||x===32||x===40||Zn(x)?s(x):(n.consume(x),x===92?v:f)}function v(x){return x===40||x===41||x===92?(n.consume(x),f):f(x)}}function bi(n,t,s,a,r,i){const l=this;let o=0,c;return d;function d(m){return n.enter(a),n.enter(r),n.consume(m),n.exit(r),n.enter(i),u}function u(m){return o>999||m===null||m===91||m===93&&!c||m===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?s(m):m===93?(n.exit(i),n.enter(r),n.consume(m),n.exit(r),n.exit(a),t):J(m)?(n.enter("lineEnding"),n.consume(m),n.exit("lineEnding"),u):(n.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||J(m)||o++>999?(n.exit("chunkString"),u(m)):(n.consume(m),c||(c=!ie(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(n.consume(m),o++,h):h(m)}}function Ni(n,t,s,a,r,i){let l;return o;function o(p){return p===34||p===39||p===40?(n.enter(a),n.enter(r),n.consume(p),n.exit(r),l=p===40?41:p,c):s(p)}function c(p){return p===l?(n.enter(r),n.consume(p),n.exit(r),n.exit(a),t):(n.enter(i),d(p))}function d(p){return p===l?(n.exit(i),c(l)):p===null?s(p):J(p)?(n.enter("lineEnding"),n.consume(p),n.exit("lineEnding"),le(n,d,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===l||p===null||J(p)?(n.exit("chunkString"),d(p)):(n.consume(p),p===92?h:u)}function h(p){return p===l||p===92?(n.consume(p),u):u(p)}}function En(n,t){let s;return a;function a(r){return J(r)?(n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),s=!0,a):ie(r)?le(n,a,s?"linePrefix":"lineSuffix")(r):t(r)}}const Nh={name:"definition",tokenize:Ch},Sh={partial:!0,tokenize:Th};function Ch(n,t,s){const a=this;let r;return i;function i(m){return n.enter("definition"),l(m)}function l(m){return bi.call(a,n,o,s,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return r=He(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),m===58?(n.enter("definitionMarker"),n.consume(m),n.exit("definitionMarker"),c):s(m)}function c(m){return de(m)?En(n,d)(m):d(m)}function d(m){return ki(n,u,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return n.attempt(Sh,h,h)(m)}function h(m){return ie(m)?le(n,p,"whitespace")(m):p(m)}function p(m){return m===null||J(m)?(n.exit("definition"),a.parser.defined.push(r),t(m)):s(m)}}function Th(n,t,s){return a;function a(o){return de(o)?En(n,r)(o):s(o)}function r(o){return Ni(n,i,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return ie(o)?le(n,l,"whitespace")(o):l(o)}function l(o){return o===null||J(o)?t(o):s(o)}}const Rh={name:"hardBreakEscape",tokenize:Eh};function Eh(n,t,s){return a;function a(i){return n.enter("hardBreakEscape"),n.consume(i),r}function r(i){return J(i)?(n.exit("hardBreakEscape"),t(i)):s(i)}}const Ih={name:"headingAtx",resolve:Mh,tokenize:Ah};function Mh(n,t){let s=n.length-2,a=3,r,i;return n[a][1].type==="whitespace"&&(a+=2),s-2>a&&n[s][1].type==="whitespace"&&(s-=2),n[s][1].type==="atxHeadingSequence"&&(a===s-1||s-4>a&&n[s-2][1].type==="whitespace")&&(s-=a+1===s?2:4),s>a&&(r={type:"atxHeadingText",start:n[a][1].start,end:n[s][1].end},i={type:"chunkText",start:n[a][1].start,end:n[s][1].end,contentType:"text"},Fe(n,a,s-a+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),n}function Ah(n,t,s){let a=0;return r;function r(u){return n.enter("atxHeading"),i(u)}function i(u){return n.enter("atxHeadingSequence"),l(u)}function l(u){return u===35&&a++<6?(n.consume(u),l):u===null||de(u)?(n.exit("atxHeadingSequence"),o(u)):s(u)}function o(u){return u===35?(n.enter("atxHeadingSequence"),c(u)):u===null||J(u)?(n.exit("atxHeading"),t(u)):ie(u)?le(n,o,"whitespace")(u):(n.enter("atxHeadingText"),d(u))}function c(u){return u===35?(n.consume(u),c):(n.exit("atxHeadingSequence"),o(u))}function d(u){return u===null||u===35||de(u)?(n.exit("atxHeadingText"),o(u)):(n.consume(u),d)}}const Lh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wa=["pre","script","style","textarea"],Oh={concrete:!0,name:"htmlFlow",resolveTo:Fh,tokenize:_h},Ph={partial:!0,tokenize:Vh},Dh={partial:!0,tokenize:zh};function Fh(n){let t=n.length;for(;t--&&!(n[t][0]==="enter"&&n[t][1].type==="htmlFlow"););return t>1&&n[t-2][1].type==="linePrefix"&&(n[t][1].start=n[t-2][1].start,n[t+1][1].start=n[t-2][1].start,n.splice(t-2,2)),n}function _h(n,t,s){const a=this;let r,i,l,o,c;return d;function d(R){return u(R)}function u(R){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(R),h}function h(R){return R===33?(n.consume(R),p):R===47?(n.consume(R),i=!0,f):R===63?(n.consume(R),r=3,a.interrupt?t:y):Re(R)?(n.consume(R),l=String.fromCharCode(R),v):s(R)}function p(R){return R===45?(n.consume(R),r=2,m):R===91?(n.consume(R),r=5,o=0,g):Re(R)?(n.consume(R),r=4,a.interrupt?t:y):s(R)}function m(R){return R===45?(n.consume(R),a.interrupt?t:y):s(R)}function g(R){const Q="CDATA[";return R===Q.charCodeAt(o++)?(n.consume(R),o===Q.length?a.interrupt?t:C:g):s(R)}function f(R){return Re(R)?(n.consume(R),l=String.fromCharCode(R),v):s(R)}function v(R){if(R===null||R===47||R===62||de(R)){const Q=R===47,je=l.toLowerCase();return!Q&&!i&&wa.includes(je)?(r=1,a.interrupt?t(R):C(R)):Lh.includes(l.toLowerCase())?(r=6,Q?(n.consume(R),x):a.interrupt?t(R):C(R)):(r=7,a.interrupt&&!a.parser.lazy[a.now().line]?s(R):i?b(R):j(R))}return R===45||Ce(R)?(n.consume(R),l+=String.fromCharCode(R),v):s(R)}function x(R){return R===62?(n.consume(R),a.interrupt?t:C):s(R)}function b(R){return ie(R)?(n.consume(R),b):w(R)}function j(R){return R===47?(n.consume(R),w):R===58||R===95||Re(R)?(n.consume(R),A):ie(R)?(n.consume(R),j):w(R)}function A(R){return R===45||R===46||R===58||R===95||Ce(R)?(n.consume(R),A):I(R)}function I(R){return R===61?(n.consume(R),k):ie(R)?(n.consume(R),I):j(R)}function k(R){return R===null||R===60||R===61||R===62||R===96?s(R):R===34||R===39?(n.consume(R),c=R,S):ie(R)?(n.consume(R),k):E(R)}function S(R){return R===c?(n.consume(R),c=null,L):R===null||J(R)?s(R):(n.consume(R),S)}function E(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||de(R)?I(R):(n.consume(R),E)}function L(R){return R===47||R===62||ie(R)?j(R):s(R)}function w(R){return R===62?(n.consume(R),N):s(R)}function N(R){return R===null||J(R)?C(R):ie(R)?(n.consume(R),N):s(R)}function C(R){return R===45&&r===2?(n.consume(R),F):R===60&&r===1?(n.consume(R),D):R===62&&r===4?(n.consume(R),V):R===63&&r===3?(n.consume(R),y):R===93&&r===5?(n.consume(R),z):J(R)&&(r===6||r===7)?(n.exit("htmlFlowData"),n.check(Ph,H,P)(R)):R===null||J(R)?(n.exit("htmlFlowData"),P(R)):(n.consume(R),C)}function P(R){return n.check(Dh,M,H)(R)}function M(R){return n.enter("lineEnding"),n.consume(R),n.exit("lineEnding"),T}function T(R){return R===null||J(R)?P(R):(n.enter("htmlFlowData"),C(R))}function F(R){return R===45?(n.consume(R),y):C(R)}function D(R){return R===47?(n.consume(R),l="",Y):C(R)}function Y(R){if(R===62){const Q=l.toLowerCase();return wa.includes(Q)?(n.consume(R),V):C(R)}return Re(R)&&l.length<8?(n.consume(R),l+=String.fromCharCode(R),Y):C(R)}function z(R){return R===93?(n.consume(R),y):C(R)}function y(R){return R===62?(n.consume(R),V):R===45&&r===2?(n.consume(R),y):C(R)}function V(R){return R===null||J(R)?(n.exit("htmlFlowData"),H(R)):(n.consume(R),V)}function H(R){return n.exit("htmlFlow"),t(R)}}function zh(n,t,s){const a=this;return r;function r(l){return J(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),i):s(l)}function i(l){return a.parser.lazy[a.now().line]?s(l):t(l)}}function Vh(n,t,s){return a;function a(r){return n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),n.attempt(zn,t,s)}}const Wh={name:"htmlText",tokenize:Bh};function Bh(n,t,s){const a=this;let r,i,l;return o;function o(y){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(y),c}function c(y){return y===33?(n.consume(y),d):y===47?(n.consume(y),I):y===63?(n.consume(y),j):Re(y)?(n.consume(y),E):s(y)}function d(y){return y===45?(n.consume(y),u):y===91?(n.consume(y),i=0,g):Re(y)?(n.consume(y),b):s(y)}function u(y){return y===45?(n.consume(y),m):s(y)}function h(y){return y===null?s(y):y===45?(n.consume(y),p):J(y)?(l=h,D(y)):(n.consume(y),h)}function p(y){return y===45?(n.consume(y),m):h(y)}function m(y){return y===62?F(y):y===45?p(y):h(y)}function g(y){const V="CDATA[";return y===V.charCodeAt(i++)?(n.consume(y),i===V.length?f:g):s(y)}function f(y){return y===null?s(y):y===93?(n.consume(y),v):J(y)?(l=f,D(y)):(n.consume(y),f)}function v(y){return y===93?(n.consume(y),x):f(y)}function x(y){return y===62?F(y):y===93?(n.consume(y),x):f(y)}function b(y){return y===null||y===62?F(y):J(y)?(l=b,D(y)):(n.consume(y),b)}function j(y){return y===null?s(y):y===63?(n.consume(y),A):J(y)?(l=j,D(y)):(n.consume(y),j)}function A(y){return y===62?F(y):j(y)}function I(y){return Re(y)?(n.consume(y),k):s(y)}function k(y){return y===45||Ce(y)?(n.consume(y),k):S(y)}function S(y){return J(y)?(l=S,D(y)):ie(y)?(n.consume(y),S):F(y)}function E(y){return y===45||Ce(y)?(n.consume(y),E):y===47||y===62||de(y)?L(y):s(y)}function L(y){return y===47?(n.consume(y),F):y===58||y===95||Re(y)?(n.consume(y),w):J(y)?(l=L,D(y)):ie(y)?(n.consume(y),L):F(y)}function w(y){return y===45||y===46||y===58||y===95||Ce(y)?(n.consume(y),w):N(y)}function N(y){return y===61?(n.consume(y),C):J(y)?(l=N,D(y)):ie(y)?(n.consume(y),N):L(y)}function C(y){return y===null||y===60||y===61||y===62||y===96?s(y):y===34||y===39?(n.consume(y),r=y,P):J(y)?(l=C,D(y)):ie(y)?(n.consume(y),C):(n.consume(y),M)}function P(y){return y===r?(n.consume(y),r=void 0,T):y===null?s(y):J(y)?(l=P,D(y)):(n.consume(y),P)}function M(y){return y===null||y===34||y===39||y===60||y===61||y===96?s(y):y===47||y===62||de(y)?L(y):(n.consume(y),M)}function T(y){return y===47||y===62||de(y)?L(y):s(y)}function F(y){return y===62?(n.consume(y),n.exit("htmlTextData"),n.exit("htmlText"),t):s(y)}function D(y){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(y),n.exit("lineEnding"),Y}function Y(y){return ie(y)?le(n,z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):z(y)}function z(y){return n.enter("htmlTextData"),l(y)}}const ys={name:"labelEnd",resolveAll:Yh,resolveTo:qh,tokenize:Uh},Hh={tokenize:Kh},$h={tokenize:Jh},Xh={tokenize:Gh};function Yh(n){let t=-1;const s=[];for(;++t<n.length;){const a=n[t][1];if(s.push(n[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const r=a.type==="labelImage"?4:2;a.type="data",t+=r}}return n.length!==s.length&&Fe(n,0,n.length,s),n}function qh(n,t){let s=n.length,a=0,r,i,l,o;for(;s--;)if(r=n[s][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;n[s][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(l){if(n[s][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=s,r.type!=="labelLink")){a=2;break}}else r.type==="labelEnd"&&(l=s);const c={type:n[i][1].type==="labelLink"?"link":"image",start:{...n[i][1].start},end:{...n[n.length-1][1].end}},d={type:"label",start:{...n[i][1].start},end:{...n[l][1].end}},u={type:"labelText",start:{...n[i+a+2][1].end},end:{...n[l-2][1].start}};return o=[["enter",c,t],["enter",d,t]],o=ze(o,n.slice(i+1,i+a+3)),o=ze(o,[["enter",u,t]]),o=ze(o,it(t.parser.constructs.insideSpan.null,n.slice(i+a+4,l-3),t)),o=ze(o,[["exit",u,t],n[l-2],n[l-1],["exit",d,t]]),o=ze(o,n.slice(l+1)),o=ze(o,[["exit",c,t]]),Fe(n,i,n.length,o),n}function Uh(n,t,s){const a=this;let r=a.events.length,i,l;for(;r--;)if((a.events[r][1].type==="labelImage"||a.events[r][1].type==="labelLink")&&!a.events[r][1]._balanced){i=a.events[r][1];break}return o;function o(p){return i?i._inactive?h(p):(l=a.parser.defined.includes(He(a.sliceSerialize({start:i.end,end:a.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(p),n.exit("labelMarker"),n.exit("labelEnd"),c):s(p)}function c(p){return p===40?n.attempt(Hh,u,l?u:h)(p):p===91?n.attempt($h,u,l?d:h)(p):l?u(p):h(p)}function d(p){return n.attempt(Xh,u,h)(p)}function u(p){return t(p)}function h(p){return i._balanced=!0,s(p)}}function Kh(n,t,s){return a;function a(h){return n.enter("resource"),n.enter("resourceMarker"),n.consume(h),n.exit("resourceMarker"),r}function r(h){return de(h)?En(n,i)(h):i(h)}function i(h){return h===41?u(h):ki(n,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return de(h)?En(n,c)(h):u(h)}function o(h){return s(h)}function c(h){return h===34||h===39||h===40?Ni(n,d,s,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function d(h){return de(h)?En(n,u)(h):u(h)}function u(h){return h===41?(n.enter("resourceMarker"),n.consume(h),n.exit("resourceMarker"),n.exit("resource"),t):s(h)}}function Jh(n,t,s){const a=this;return r;function r(o){return bi.call(a,n,i,l,"reference","referenceMarker","referenceString")(o)}function i(o){return a.parser.defined.includes(He(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(o):s(o)}function l(o){return s(o)}}function Gh(n,t,s){return a;function a(i){return n.enter("reference"),n.enter("referenceMarker"),n.consume(i),n.exit("referenceMarker"),r}function r(i){return i===93?(n.enter("referenceMarker"),n.consume(i),n.exit("referenceMarker"),n.exit("reference"),t):s(i)}}const Qh={name:"labelStartImage",resolveAll:ys.resolveAll,tokenize:Zh};function Zh(n,t,s){const a=this;return r;function r(o){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(o),n.exit("labelImageMarker"),i}function i(o){return o===91?(n.enter("labelMarker"),n.consume(o),n.exit("labelMarker"),n.exit("labelImage"),l):s(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?s(o):t(o)}}const em={name:"labelStartLink",resolveAll:ys.resolveAll,tokenize:nm};function nm(n,t,s){const a=this;return r;function r(l){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(l),n.exit("labelMarker"),n.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in a.parser.constructs?s(l):t(l)}}const jt={name:"lineEnding",tokenize:tm};function tm(n,t){return s;function s(a){return n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),le(n,t,"linePrefix")}}const Un={name:"thematicBreak",tokenize:sm};function sm(n,t,s){let a=0,r;return i;function i(d){return n.enter("thematicBreak"),l(d)}function l(d){return r=d,o(d)}function o(d){return d===r?(n.enter("thematicBreakSequence"),c(d)):a>=3&&(d===null||J(d))?(n.exit("thematicBreak"),t(d)):s(d)}function c(d){return d===r?(n.consume(d),a++,c):(n.exit("thematicBreakSequence"),ie(d)?le(n,o,"whitespace")(d):o(d))}}const Ee={continuation:{tokenize:lm},exit:cm,name:"list",tokenize:im},am={partial:!0,tokenize:dm},rm={partial:!0,tokenize:om};function im(n,t,s){const a=this,r=a.events[a.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,l=0;return o;function o(m){const g=a.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||m===a.containerState.marker:$t(m)){if(a.containerState.type||(a.containerState.type=g,n.enter(g,{_container:!0})),g==="listUnordered")return n.enter("listItemPrefix"),m===42||m===45?n.check(Un,s,d)(m):d(m);if(!a.interrupt||m===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),c(m)}return s(m)}function c(m){return $t(m)&&++l<10?(n.consume(m),c):(!a.interrupt||l<2)&&(a.containerState.marker?m===a.containerState.marker:m===41||m===46)?(n.exit("listItemValue"),d(m)):s(m)}function d(m){return n.enter("listItemMarker"),n.consume(m),n.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||m,n.check(zn,a.interrupt?s:u,n.attempt(am,p,h))}function u(m){return a.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return ie(m)?(n.enter("listItemPrefixWhitespace"),n.consume(m),n.exit("listItemPrefixWhitespace"),p):s(m)}function p(m){return a.containerState.size=i+a.sliceSerialize(n.exit("listItemPrefix"),!0).length,t(m)}}function lm(n,t,s){const a=this;return a.containerState._closeFlow=void 0,n.check(zn,r,i);function r(o){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,le(n,t,"listItemIndent",a.containerState.size+1)(o)}function i(o){return a.containerState.furtherBlankLines||!ie(o)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,l(o)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,n.attempt(rm,t,l)(o))}function l(o){return a.containerState._closeFlow=!0,a.interrupt=void 0,le(n,n.attempt(Ee,t,s),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function om(n,t,s){const a=this;return le(n,r,"listItemIndent",a.containerState.size+1);function r(i){const l=a.events[a.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===a.containerState.size?t(i):s(i)}}function cm(n){n.exit(this.containerState.type)}function dm(n,t,s){const a=this;return le(n,r,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const l=a.events[a.events.length-1];return!ie(i)&&l&&l[1].type==="listItemPrefixWhitespace"?t(i):s(i)}}const ja={name:"setextUnderline",resolveTo:um,tokenize:hm};function um(n,t){let s=n.length,a,r,i;for(;s--;)if(n[s][0]==="enter"){if(n[s][1].type==="content"){a=s;break}n[s][1].type==="paragraph"&&(r=s)}else n[s][1].type==="content"&&n.splice(s,1),!i&&n[s][1].type==="definition"&&(i=s);const l={type:"setextHeading",start:{...n[a][1].start},end:{...n[n.length-1][1].end}};return n[r][1].type="setextHeadingText",i?(n.splice(r,0,["enter",l,t]),n.splice(i+1,0,["exit",n[a][1],t]),n[a][1].end={...n[i][1].end}):n[a][1]=l,n.push(["exit",l,t]),n}function hm(n,t,s){const a=this;let r;return i;function i(d){let u=a.events.length,h;for(;u--;)if(a.events[u][1].type!=="lineEnding"&&a.events[u][1].type!=="linePrefix"&&a.events[u][1].type!=="content"){h=a.events[u][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||h)?(n.enter("setextHeadingLine"),r=d,l(d)):s(d)}function l(d){return n.enter("setextHeadingLineSequence"),o(d)}function o(d){return d===r?(n.consume(d),o):(n.exit("setextHeadingLineSequence"),ie(d)?le(n,c,"lineSuffix")(d):c(d))}function c(d){return d===null||J(d)?(n.exit("setextHeadingLine"),t(d)):s(d)}}const mm={tokenize:pm};function pm(n){const t=this,s=n.attempt(zn,a,n.attempt(this.parser.constructs.flowInitial,r,le(n,n.attempt(this.parser.constructs.flow,r,n.attempt(vh,r)),"linePrefix")));return s;function a(i){if(i===null){n.consume(i);return}return n.enter("lineEndingBlank"),n.consume(i),n.exit("lineEndingBlank"),t.currentConstruct=void 0,s}function r(i){if(i===null){n.consume(i);return}return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),t.currentConstruct=void 0,s}}const fm={resolveAll:Ci()},gm=Si("string"),xm=Si("text");function Si(n){return{resolveAll:Ci(n==="text"?ym:void 0),tokenize:t};function t(s){const a=this,r=this.parser.constructs[n],i=s.attempt(r,l,o);return l;function l(u){return d(u)?i(u):o(u)}function o(u){if(u===null){s.consume(u);return}return s.enter("data"),s.consume(u),c}function c(u){return d(u)?(s.exit("data"),i(u)):(s.consume(u),c)}function d(u){if(u===null)return!0;const h=r[u];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(a,a.previous))return!0}return!1}}}function Ci(n){return t;function t(s,a){let r=-1,i;for(;++r<=s.length;)i===void 0?s[r]&&s[r][1].type==="data"&&(i=r,r++):(!s[r]||s[r][1].type!=="data")&&(r!==i+2&&(s[i][1].end=s[r-1][1].end,s.splice(i+2,r-i-2),r=i+2),i=void 0);return n?n(s,a):s}}function ym(n,t){let s=0;for(;++s<=n.length;)if((s===n.length||n[s][1].type==="lineEnding")&&n[s-1][1].type==="data"){const a=n[s-1][1],r=t.sliceStream(a);let i=r.length,l=-1,o=0,c;for(;i--;){const d=r[i];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(d===-2)c=!0,o++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&s===n.length&&(o=0),o){const d={type:s===n.length||c||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:a.start._bufferIndex+l,_index:a.start._index+i,line:a.end.line,column:a.end.column-o,offset:a.end.offset-o},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(n.splice(s,0,["enter",d,t],["exit",d,t]),s+=2)}s++}return n}const vm={42:Ee,43:Ee,45:Ee,48:Ee,49:Ee,50:Ee,51:Ee,52:Ee,53:Ee,54:Ee,55:Ee,56:Ee,57:Ee,62:yi},wm={91:Nh},jm={[-2]:wt,[-1]:wt,32:wt},km={35:Ih,42:Un,45:[ja,Un],60:Oh,61:ja,95:Un,96:va,126:va},bm={38:wi,92:vi},Nm={[-5]:jt,[-4]:jt,[-3]:jt,33:Qh,38:wi,42:Xt,60:[eh,Wh],91:em,92:[Rh,vi],93:ys,95:Xt,96:mh},Sm={null:[Xt,fm]},Cm={null:[42,95]},Tm={null:[]},Rm=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Cm,contentInitial:wm,disable:Tm,document:vm,flow:km,flowInitial:jm,insideSpan:Sm,string:bm,text:Nm},Symbol.toStringTag,{value:"Module"}));function Em(n,t,s){let a={_bufferIndex:-1,_index:0,line:s&&s.line||1,column:s&&s.column||1,offset:s&&s.offset||0};const r={},i=[];let l=[],o=[];const c={attempt:S(I),check:S(k),consume:b,enter:j,exit:A,interrupt:S(k,{interrupt:!0})},d={code:null,containerState:{},defineSkip:f,events:[],now:g,parser:n,previous:null,sliceSerialize:p,sliceStream:m,write:h};let u=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function h(N){return l=ze(l,N),v(),l[l.length-1]!==null?[]:(E(t,0),d.events=it(i,d.events,d),d.events)}function p(N,C){return Mm(m(N),C)}function m(N){return Im(l,N)}function g(){const{_bufferIndex:N,_index:C,line:P,column:M,offset:T}=a;return{_bufferIndex:N,_index:C,line:P,column:M,offset:T}}function f(N){r[N.line]=N.column,w()}function v(){let N;for(;a._index<l.length;){const C=l[a._index];if(typeof C=="string")for(N=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===N&&a._bufferIndex<C.length;)x(C.charCodeAt(a._bufferIndex));else x(C)}}function x(N){u=u(N)}function b(N){J(N)?(a.line++,a.column=1,a.offset+=N===-3?2:1,w()):N!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===l[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=N}function j(N,C){const P=C||{};return P.type=N,P.start=g(),d.events.push(["enter",P,d]),o.push(P),P}function A(N){const C=o.pop();return C.end=g(),d.events.push(["exit",C,d]),C}function I(N,C){E(N,C.from)}function k(N,C){C.restore()}function S(N,C){return P;function P(M,T,F){let D,Y,z,y;return Array.isArray(M)?H(M):"tokenize"in M?H([M]):V(M);function V(se){return ke;function ke(O){const W=O!==null&&se[O],U=O!==null&&se.null,K=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(U)?U:U?[U]:[]];return H(K)(O)}}function H(se){return D=se,Y=0,se.length===0?F:R(se[Y])}function R(se){return ke;function ke(O){return y=L(),z=se,se.partial||(d.currentConstruct=se),se.name&&d.parser.constructs.disable.null.includes(se.name)?je():se.tokenize.call(C?Object.assign(Object.create(d),C):d,c,Q,je)(O)}}function Q(se){return N(z,y),T}function je(se){return y.restore(),++Y<D.length?R(D[Y]):F}}}function E(N,C){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&Fe(d.events,C,d.events.length-C,N.resolve(d.events.slice(C),d)),N.resolveTo&&(d.events=N.resolveTo(d.events,d))}function L(){const N=g(),C=d.previous,P=d.currentConstruct,M=d.events.length,T=Array.from(o);return{from:M,restore:F};function F(){a=N,d.previous=C,d.currentConstruct=P,d.events.length=M,o=T,w()}}function w(){a.line in r&&a.column<2&&(a.column=r[a.line],a.offset+=r[a.line]-1)}}function Im(n,t){const s=t.start._index,a=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let l;if(s===r)l=[n[s].slice(a,i)];else{if(l=n.slice(s,r),a>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(a):l.shift()}i>0&&l.push(n[r].slice(0,i))}return l}function Mm(n,t){let s=-1;const a=[];let r;for(;++s<n.length;){const i=n[s];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
|
|
133
|
+
`;break}case-3:{l=`\r
|
|
134
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&r)continue;l=" ";break}default:l=String.fromCharCode(i)}r=i===-2,a.push(l)}return a.join("")}function Am(n){const a={constructs:gi([Rm,...(n||{}).extensions||[]]),content:r(qu),defined:[],document:r(Ku),flow:r(mm),lazy:{},string:r(gm),text:r(xm)};return a;function r(i){return l;function l(o){return Em(a,i,o)}}}function Lm(n){for(;!ji(n););return n}const ka=/[\0\t\n\r]/g;function Om(){let n=1,t="",s=!0,a;return r;function r(i,l,o){const c=[];let d,u,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),h=0,t="",s&&(i.charCodeAt(0)===65279&&h++,s=void 0);h<i.length;){if(ka.lastIndex=h,d=ka.exec(i),p=d&&d.index!==void 0?d.index:i.length,m=i.charCodeAt(p),!d){t=i.slice(h);break}if(m===10&&h===p&&a)c.push(-3),a=void 0;else switch(a&&(c.push(-5),a=void 0),h<p&&(c.push(i.slice(h,p)),n+=p-h),m){case 0:{c.push(65533),n++;break}case 9:{for(u=Math.ceil(n/4)*4,c.push(-2);n++<u;)c.push(-1);break}case 10:{c.push(-4),n=1;break}default:a=!0,n=1}h=p+1}return o&&(a&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Pm=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Dm(n){return n.replace(Pm,Fm)}function Fm(n,t,s){if(t)return t;if(s.charCodeAt(0)===35){const r=s.charCodeAt(1),i=r===120||r===88;return xi(s.slice(i?2:1),i?16:10)}return xs(s)||n}const Ti={}.hasOwnProperty;function _m(n,t,s){return t&&typeof t=="object"&&(s=t,t=void 0),zm(s)(Lm(Am(s).document().write(Om()(n,t,!0))))}function zm(n){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(tn),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(G),blockQuote:i(U),characterEscape:L,characterReference:L,codeFenced:i(K),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:i(K,l),codeText:i(xe,l),codeTextData:L,data:L,codeFlowValue:L,definition:i(we),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:i(q),hardBreakEscape:i(re),hardBreakTrailing:i(re),htmlFlow:i(fe,l),htmlFlowData:L,htmlText:i(fe,l),htmlTextData:L,image:i(_e),label:l,link:i(tn),listItem:i(he),listItemValue:p,listOrdered:i(ne,h),listUnordered:i(ne),paragraph:i(Se),reference:R,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:i(G),strong:i(sn),thematicBreak:i(me)},exit:{atxHeading:c(),atxHeadingSequence:I,autolink:c(),autolinkEmail:W,autolinkProtocol:O,blockQuote:c(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:je,characterReferenceMarkerNumeric:je,characterReferenceValue:se,characterReference:ke,codeFenced:c(v),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:w,codeIndented:c(x),codeText:c(T),codeTextData:w,data:w,definition:c(),definitionDestinationString:A,definitionLabelString:b,definitionTitleString:j,emphasis:c(),hardBreakEscape:c(C),hardBreakTrailing:c(C),htmlFlow:c(P),htmlFlowData:w,htmlText:c(M),htmlTextData:w,image:c(D),label:z,labelText:Y,lineEnding:N,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Q,resourceDestinationString:y,resourceTitleString:V,resource:H,setextHeading:c(E),setextHeadingLineSequence:S,setextHeadingText:k,strong:c(),thematicBreak:c()}};Ri(t,(n||{}).mdastExtensions||[]);const s={};return a;function a(_){let $={type:"root",children:[]};const Z={stack:[$],tokenStack:[],config:t,enter:o,exit:d,buffer:l,resume:u,data:s},ae=[];let oe=-1;for(;++oe<_.length;)if(_[oe][1].type==="listOrdered"||_[oe][1].type==="listUnordered")if(_[oe][0]==="enter")ae.push(oe);else{const Ae=ae.pop();oe=r(_,Ae,oe)}for(oe=-1;++oe<_.length;){const Ae=t[_[oe][0]];Ti.call(Ae,_[oe][1].type)&&Ae[_[oe][1].type].call(Object.assign({sliceSerialize:_[oe][2].sliceSerialize},Z),_[oe][1])}if(Z.tokenStack.length>0){const Ae=Z.tokenStack[Z.tokenStack.length-1];(Ae[1]||ba).call(Z,void 0,Ae[0])}for($.position={start:Qe(_.length>0?_[0][1].start:{line:1,column:1,offset:0}),end:Qe(_.length>0?_[_.length-2][1].end:{line:1,column:1,offset:0})},oe=-1;++oe<t.transforms.length;)$=t.transforms[oe]($)||$;return $}function r(_,$,Z){let ae=$-1,oe=-1,Ae=!1,$e,Ve,pe,an;for(;++ae<=Z;){const be=_[ae];switch(be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{be[0]==="enter"?oe++:oe--,an=void 0;break}case"lineEndingBlank":{be[0]==="enter"&&($e&&!an&&!oe&&!pe&&(pe=ae),an=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:an=void 0}if(!oe&&be[0]==="enter"&&be[1].type==="listItemPrefix"||oe===-1&&be[0]==="exit"&&(be[1].type==="listUnordered"||be[1].type==="listOrdered")){if($e){let cn=ae;for(Ve=void 0;cn--;){const qe=_[cn];if(qe[1].type==="lineEnding"||qe[1].type==="lineEndingBlank"){if(qe[0]==="exit")continue;Ve&&(_[Ve][1].type="lineEndingBlank",Ae=!0),qe[1].type="lineEnding",Ve=cn}else if(!(qe[1].type==="linePrefix"||qe[1].type==="blockQuotePrefix"||qe[1].type==="blockQuotePrefixWhitespace"||qe[1].type==="blockQuoteMarker"||qe[1].type==="listItemIndent"))break}pe&&(!Ve||pe<Ve)&&($e._spread=!0),$e.end=Object.assign({},Ve?_[Ve][1].start:be[1].end),_.splice(Ve||ae,0,["exit",$e,be[2]]),ae++,Z++}if(be[1].type==="listItemPrefix"){const cn={type:"listItem",_spread:!1,start:Object.assign({},be[1].start),end:void 0};$e=cn,_.splice(ae,0,["enter",cn,be[2]]),ae++,Z++,pe=void 0,an=!0}}}return _[$][1]._spread=Ae,Z}function i(_,$){return Z;function Z(ae){o.call(this,_(ae),ae),$&&$.call(this,ae)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(_,$,Z){this.stack[this.stack.length-1].children.push(_),this.stack.push(_),this.tokenStack.push([$,Z||void 0]),_.position={start:Qe($.start),end:void 0}}function c(_){return $;function $(Z){_&&_.call(this,Z),d.call(this,Z)}}function d(_,$){const Z=this.stack.pop(),ae=this.tokenStack.pop();if(ae)ae[0].type!==_.type&&($?$.call(this,_,ae[0]):(ae[1]||ba).call(this,_,ae[0]));else throw new Error("Cannot close `"+_.type+"` ("+Rn({start:_.start,end:_.end})+"): it’s not open");Z.position.end=Qe(_.end)}function u(){return gs(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(_){if(this.data.expectingFirstListItemValue){const $=this.stack[this.stack.length-2];$.start=Number.parseInt(this.sliceSerialize(_),10),this.data.expectingFirstListItemValue=void 0}}function m(){const _=this.resume(),$=this.stack[this.stack.length-1];$.lang=_}function g(){const _=this.resume(),$=this.stack[this.stack.length-1];$.meta=_}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const _=this.resume(),$=this.stack[this.stack.length-1];$.value=_.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const _=this.resume(),$=this.stack[this.stack.length-1];$.value=_.replace(/(\r?\n|\r)$/g,"")}function b(_){const $=this.resume(),Z=this.stack[this.stack.length-1];Z.label=$,Z.identifier=He(this.sliceSerialize(_)).toLowerCase()}function j(){const _=this.resume(),$=this.stack[this.stack.length-1];$.title=_}function A(){const _=this.resume(),$=this.stack[this.stack.length-1];$.url=_}function I(_){const $=this.stack[this.stack.length-1];if(!$.depth){const Z=this.sliceSerialize(_).length;$.depth=Z}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function S(_){const $=this.stack[this.stack.length-1];$.depth=this.sliceSerialize(_).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function L(_){const Z=this.stack[this.stack.length-1].children;let ae=Z[Z.length-1];(!ae||ae.type!=="text")&&(ae=Je(),ae.position={start:Qe(_.start),end:void 0},Z.push(ae)),this.stack.push(ae)}function w(_){const $=this.stack.pop();$.value+=this.sliceSerialize(_),$.position.end=Qe(_.end)}function N(_){const $=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Z=$.children[$.children.length-1];Z.position.end=Qe(_.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes($.type)&&(L.call(this,_),w.call(this,_))}function C(){this.data.atHardBreak=!0}function P(){const _=this.resume(),$=this.stack[this.stack.length-1];$.value=_}function M(){const _=this.resume(),$=this.stack[this.stack.length-1];$.value=_}function T(){const _=this.resume(),$=this.stack[this.stack.length-1];$.value=_}function F(){const _=this.stack[this.stack.length-1];if(this.data.inReference){const $=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=$,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function D(){const _=this.stack[this.stack.length-1];if(this.data.inReference){const $=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=$,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function Y(_){const $=this.sliceSerialize(_),Z=this.stack[this.stack.length-2];Z.label=Dm($),Z.identifier=He($).toLowerCase()}function z(){const _=this.stack[this.stack.length-1],$=this.resume(),Z=this.stack[this.stack.length-1];if(this.data.inReference=!0,Z.type==="link"){const ae=_.children;Z.children=ae}else Z.alt=$}function y(){const _=this.resume(),$=this.stack[this.stack.length-1];$.url=_}function V(){const _=this.resume(),$=this.stack[this.stack.length-1];$.title=_}function H(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function Q(_){const $=this.resume(),Z=this.stack[this.stack.length-1];Z.label=$,Z.identifier=He(this.sliceSerialize(_)).toLowerCase(),this.data.referenceType="full"}function je(_){this.data.characterReferenceType=_.type}function se(_){const $=this.sliceSerialize(_),Z=this.data.characterReferenceType;let ae;Z?(ae=xi($,Z==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ae=xs($);const oe=this.stack[this.stack.length-1];oe.value+=ae}function ke(_){const $=this.stack.pop();$.position.end=Qe(_.end)}function O(_){w.call(this,_);const $=this.stack[this.stack.length-1];$.url=this.sliceSerialize(_)}function W(_){w.call(this,_);const $=this.stack[this.stack.length-1];$.url="mailto:"+this.sliceSerialize(_)}function U(){return{type:"blockquote",children:[]}}function K(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function we(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function q(){return{type:"emphasis",children:[]}}function G(){return{type:"heading",depth:0,children:[]}}function re(){return{type:"break"}}function fe(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function tn(){return{type:"link",title:null,url:"",children:[]}}function ne(_){return{type:"list",ordered:_.type==="listOrdered",start:null,spread:_._spread,children:[]}}function he(_){return{type:"listItem",spread:_._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function sn(){return{type:"strong",children:[]}}function Je(){return{type:"text",value:""}}function me(){return{type:"thematicBreak"}}}function Qe(n){return{line:n.line,column:n.column,offset:n.offset}}function Ri(n,t){let s=-1;for(;++s<t.length;){const a=t[s];Array.isArray(a)?Ri(n,a):Vm(n,a)}}function Vm(n,t){let s;for(s in t)if(Ti.call(t,s))switch(s){case"canContainEols":{const a=t[s];a&&n[s].push(...a);break}case"transforms":{const a=t[s];a&&n[s].push(...a);break}case"enter":case"exit":{const a=t[s];a&&Object.assign(n[s],a);break}}}function ba(n,t){throw n?new Error("Cannot close `"+n.type+"` ("+Rn({start:n.start,end:n.end})+"): a different token (`"+t.type+"`, "+Rn({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rn({start:t.start,end:t.end})+") is still open")}function Wm(n){const t=this;t.parser=s;function s(a){return _m(a,{...t.data("settings"),...n,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Bm(n,t){const s={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(t),!0)};return n.patch(t,s),n.applyData(t,s)}function Hm(n,t){const s={type:"element",tagName:"br",properties:{},children:[]};return n.patch(t,s),[n.applyData(t,s),{type:"text",value:`
|
|
135
|
+
`}]}function $m(n,t){const s=t.value?t.value+`
|
|
136
|
+
`:"",a={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(a.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:a,children:[{type:"text",value:s}]};return t.meta&&(i.data={meta:t.meta}),n.patch(t,i),i=n.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},n.patch(t,i),i}function Xm(n,t){const s={type:"element",tagName:"del",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function Ym(n,t){const s={type:"element",tagName:"em",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function qm(n,t){const s=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),r=wn(a.toLowerCase()),i=n.footnoteOrder.indexOf(a);let l,o=n.footnoteCounts.get(a);o===void 0?(o=0,n.footnoteOrder.push(a),l=n.footnoteOrder.length):l=i+1,o+=1,n.footnoteCounts.set(a,o);const c={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+r,id:s+"fnref-"+r+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};n.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return n.patch(t,d),n.applyData(t,d)}function Um(n,t){const s={type:"element",tagName:"h"+t.depth,properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function Km(n,t){if(n.options.allowDangerousHtml){const s={type:"raw",value:t.value};return n.patch(t,s),n.applyData(t,s)}}function Ei(n,t){const s=t.referenceType;let a="]";if(s==="collapsed"?a+="[]":s==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const r=n.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const l=r[r.length-1];return l&&l.type==="text"?l.value+=a:r.push({type:"text",value:a}),r}function Jm(n,t){const s=String(t.identifier).toUpperCase(),a=n.definitionById.get(s);if(!a)return Ei(n,t);const r={src:wn(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(r.title=a.title);const i={type:"element",tagName:"img",properties:r,children:[]};return n.patch(t,i),n.applyData(t,i)}function Gm(n,t){const s={src:wn(t.url)};t.alt!==null&&t.alt!==void 0&&(s.alt=t.alt),t.title!==null&&t.title!==void 0&&(s.title=t.title);const a={type:"element",tagName:"img",properties:s,children:[]};return n.patch(t,a),n.applyData(t,a)}function Qm(n,t){const s={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};n.patch(t,s);const a={type:"element",tagName:"code",properties:{},children:[s]};return n.patch(t,a),n.applyData(t,a)}function Zm(n,t){const s=String(t.identifier).toUpperCase(),a=n.definitionById.get(s);if(!a)return Ei(n,t);const r={href:wn(a.url||"")};a.title!==null&&a.title!==void 0&&(r.title=a.title);const i={type:"element",tagName:"a",properties:r,children:n.all(t)};return n.patch(t,i),n.applyData(t,i)}function ep(n,t){const s={href:wn(t.url)};t.title!==null&&t.title!==void 0&&(s.title=t.title);const a={type:"element",tagName:"a",properties:s,children:n.all(t)};return n.patch(t,a),n.applyData(t,a)}function np(n,t,s){const a=n.all(t),r=s?tp(s):Ii(t),i={},l=[];if(typeof t.checked=="boolean"){const u=a[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},a.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<a.length;){const u=a[o];(r||o!==0||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
|
|
137
|
+
`}),u.type==="element"&&u.tagName==="p"&&!r?l.push(...u.children):l.push(u)}const c=a[a.length-1];c&&(r||c.type!=="element"||c.tagName!=="p")&&l.push({type:"text",value:`
|
|
138
|
+
`});const d={type:"element",tagName:"li",properties:i,children:l};return n.patch(t,d),n.applyData(t,d)}function tp(n){let t=!1;if(n.type==="list"){t=n.spread||!1;const s=n.children;let a=-1;for(;!t&&++a<s.length;)t=Ii(s[a])}return t}function Ii(n){const t=n.spread;return t??n.children.length>1}function sp(n,t){const s={},a=n.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(s.start=t.start);++r<a.length;){const l=a[r];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){s.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:s,children:n.wrap(a,!0)};return n.patch(t,i),n.applyData(t,i)}function ap(n,t){const s={type:"element",tagName:"p",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function rp(n,t){const s={type:"root",children:n.wrap(n.all(t))};return n.patch(t,s),n.applyData(t,s)}function ip(n,t){const s={type:"element",tagName:"strong",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}function lp(n,t){const s=n.all(t),a=s.shift(),r=[];if(a){const l={type:"element",tagName:"thead",properties:{},children:n.wrap([a],!0)};n.patch(t.children[0],l),r.push(l)}if(s.length>0){const l={type:"element",tagName:"tbody",properties:{},children:n.wrap(s,!0)},o=hs(t.children[1]),c=ci(t.children[t.children.length-1]);o&&c&&(l.position={start:o,end:c}),r.push(l)}const i={type:"element",tagName:"table",properties:{},children:n.wrap(r,!0)};return n.patch(t,i),n.applyData(t,i)}function op(n,t,s){const a=s?s.children:void 0,i=(a?a.indexOf(t):1)===0?"th":"td",l=s&&s.type==="table"?s.align:void 0,o=l?l.length:t.children.length;let c=-1;const d=[];for(;++c<o;){const h=t.children[c],p={},m=l?l[c]:void 0;m&&(p.align=m);let g={type:"element",tagName:i,properties:p,children:[]};h&&(g.children=n.all(h),n.patch(h,g),g=n.applyData(h,g)),d.push(g)}const u={type:"element",tagName:"tr",properties:{},children:n.wrap(d,!0)};return n.patch(t,u),n.applyData(t,u)}function cp(n,t){const s={type:"element",tagName:"td",properties:{},children:n.all(t)};return n.patch(t,s),n.applyData(t,s)}const Na=9,Sa=32;function dp(n){const t=String(n),s=/\r?\n|\r/g;let a=s.exec(t),r=0;const i=[];for(;a;)i.push(Ca(t.slice(r,a.index),r>0,!0),a[0]),r=a.index+a[0].length,a=s.exec(t);return i.push(Ca(t.slice(r),r>0,!1)),i.join("")}function Ca(n,t,s){let a=0,r=n.length;if(t){let i=n.codePointAt(a);for(;i===Na||i===Sa;)a++,i=n.codePointAt(a)}if(s){let i=n.codePointAt(r-1);for(;i===Na||i===Sa;)r--,i=n.codePointAt(r-1)}return r>a?n.slice(a,r):""}function up(n,t){const s={type:"text",value:dp(String(t.value))};return n.patch(t,s),n.applyData(t,s)}function hp(n,t){const s={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(t,s),n.applyData(t,s)}const mp={blockquote:Bm,break:Hm,code:$m,delete:Xm,emphasis:Ym,footnoteReference:qm,heading:Um,html:Km,imageReference:Jm,image:Gm,inlineCode:Qm,linkReference:Zm,link:ep,listItem:np,list:sp,paragraph:ap,root:rp,strong:ip,table:lp,tableCell:cp,tableRow:op,text:up,thematicBreak:hp,toml:Hn,yaml:Hn,definition:Hn,footnoteDefinition:Hn};function Hn(){}const Mi=-1,lt=0,In=1,et=2,vs=3,ws=4,js=5,ks=6,Ai=7,Li=8,pp=typeof self=="object"?self:globalThis,Ta=(n,t)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new pp[n](t)},fp=(n,t)=>{const s=(r,i)=>(n.set(i,r),r),a=r=>{if(n.has(r))return n.get(r);const[i,l]=t[r];switch(i){case lt:case Mi:return s(l,r);case In:{const o=s([],r);for(const c of l)o.push(a(c));return o}case et:{const o=s({},r);for(const[c,d]of l)o[a(c)]=a(d);return o}case vs:return s(new Date(l),r);case ws:{const{source:o,flags:c}=l;return s(new RegExp(o,c),r)}case js:{const o=s(new Map,r);for(const[c,d]of l)o.set(a(c),a(d));return o}case ks:{const o=s(new Set,r);for(const c of l)o.add(a(c));return o}case Ai:{const{name:o,message:c}=l;return s(Ta(o,c),r)}case Li:return s(BigInt(l),r);case"BigInt":return s(Object(BigInt(l)),r);case"ArrayBuffer":return s(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:o}=new Uint8Array(l);return s(new DataView(o),l)}}return s(Ta(i,l),r)};return a},Ra=n=>fp(new Map,n)(0),mn="",{toString:gp}={},{keys:xp}=Object,Cn=n=>{const t=typeof n;if(t!=="object"||!n)return[lt,t];const s=gp.call(n).slice(8,-1);switch(s){case"Array":return[In,mn];case"Object":return[et,mn];case"Date":return[vs,mn];case"RegExp":return[ws,mn];case"Map":return[js,mn];case"Set":return[ks,mn];case"DataView":return[In,s]}return s.includes("Array")?[In,s]:s.includes("Error")?[Ai,s]:[et,s]},$n=([n,t])=>n===lt&&(t==="function"||t==="symbol"),yp=(n,t,s,a)=>{const r=(l,o)=>{const c=a.push(l)-1;return s.set(o,c),c},i=l=>{if(s.has(l))return s.get(l);let[o,c]=Cn(l);switch(o){case lt:{let u=l;switch(c){case"bigint":o=Li,u=l.toString();break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return r([Mi],l)}return r([o,u],l)}case In:{if(c){let p=l;return c==="DataView"?p=new Uint8Array(l.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(l)),r([c,[...p]],l)}const u=[],h=r([o,u],l);for(const p of l)u.push(i(p));return h}case et:{if(c)switch(c){case"BigInt":return r([c,l.toString()],l);case"Boolean":case"Number":case"String":return r([c,l.valueOf()],l)}if(t&&"toJSON"in l)return i(l.toJSON());const u=[],h=r([o,u],l);for(const p of xp(l))(n||!$n(Cn(l[p])))&&u.push([i(p),i(l[p])]);return h}case vs:return r([o,l.toISOString()],l);case ws:{const{source:u,flags:h}=l;return r([o,{source:u,flags:h}],l)}case js:{const u=[],h=r([o,u],l);for(const[p,m]of l)(n||!($n(Cn(p))||$n(Cn(m))))&&u.push([i(p),i(m)]);return h}case ks:{const u=[],h=r([o,u],l);for(const p of l)(n||!$n(Cn(p)))&&u.push(i(p));return h}}const{message:d}=l;return r([o,{name:c,message:d}],l)};return i},Ea=(n,{json:t,lossy:s}={})=>{const a=[];return yp(!(t||s),!!t,new Map,a)(n),a},nt=typeof structuredClone=="function"?(n,t)=>t&&("json"in t||"lossy"in t)?Ra(Ea(n,t)):structuredClone(n):(n,t)=>Ra(Ea(n,t));function vp(n,t){const s=[{type:"text",value:"↩"}];return t>1&&s.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),s}function wp(n,t){return"Back to reference "+(n+1)+(t>1?"-"+t:"")}function jp(n){const t=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",s=n.options.footnoteBackContent||vp,a=n.options.footnoteBackLabel||wp,r=n.options.footnoteLabel||"Footnotes",i=n.options.footnoteLabelTagName||"h2",l=n.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c<n.footnoteOrder.length;){const d=n.footnoteById.get(n.footnoteOrder[c]);if(!d)continue;const u=n.all(d),h=String(d.identifier).toUpperCase(),p=wn(h.toLowerCase());let m=0;const g=[],f=n.footnoteCounts.get(h);for(;f!==void 0&&++m<=f;){g.length>0&&g.push({type:"text",value:" "});let b=typeof s=="string"?s:s(c,m);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(c,m),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const v=u[u.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const b=v.children[v.children.length-1];b&&b.type==="text"?b.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else u.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:n.wrap(u,!0)};n.patch(d,x),o.push(x)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...nt(l),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
|
|
139
|
+
`},{type:"element",tagName:"ol",properties:{},children:n.wrap(o,!0)},{type:"text",value:`
|
|
140
|
+
`}]}}const ot=(function(n){if(n==null)return Sp;if(typeof n=="function")return ct(n);if(typeof n=="object")return Array.isArray(n)?kp(n):bp(n);if(typeof n=="string")return Np(n);throw new Error("Expected function, string, or object as test")});function kp(n){const t=[];let s=-1;for(;++s<n.length;)t[s]=ot(n[s]);return ct(a);function a(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function bp(n){const t=n;return ct(s);function s(a){const r=a;let i;for(i in n)if(r[i]!==t[i])return!1;return!0}}function Np(n){return ct(t);function t(s){return s&&s.type===n}}function ct(n){return t;function t(s,a,r){return!!(Cp(s)&&n.call(this,s,typeof a=="number"?a:void 0,r||void 0))}}function Sp(){return!0}function Cp(n){return n!==null&&typeof n=="object"&&"type"in n}const Oi=[],Tp=!0,Yt=!1,Rp="skip";function Pi(n,t,s,a){let r;typeof t=="function"&&typeof s!="function"?(a=s,s=t):r=t;const i=ot(r),l=a?-1:1;o(n,void 0,[])();function o(c,d,u){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=Oi,g,f,v;if((!t||i(c,d,u[u.length-1]||void 0))&&(m=Ep(s(c,u)),m[0]===Yt))return m;if("children"in c&&c.children){const x=c;if(x.children&&m[0]!==Rp)for(f=(a?x.children.length:-1)+l,v=u.concat(x);f>-1&&f<x.children.length;){const b=x.children[f];if(g=o(b,f,v)(),g[0]===Yt)return g;f=typeof g[1]=="number"?g[1]:f+l}}return m}}}function Ep(n){return Array.isArray(n)?n:typeof n=="number"?[Tp,n]:n==null?Oi:[n]}function bs(n,t,s,a){let r,i,l;typeof t=="function"&&typeof s!="function"?(i=void 0,l=t,r=s):(i=t,l=s,r=a),Pi(n,i,o,r);function o(c,d){const u=d[d.length-1],h=u?u.children.indexOf(c):void 0;return l(c,h,u)}}const qt={}.hasOwnProperty,Ip={};function Mp(n,t){const s=t||Ip,a=new Map,r=new Map,i=new Map,l={...mp,...s.handlers},o={all:d,applyData:Lp,definitionById:a,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:l,one:c,options:s,patch:Ap,wrap:Pp};return bs(n,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const h=u.type==="definition"?a:r,p=String(u.identifier).toUpperCase();h.has(p)||h.set(p,u)}}),o;function c(u,h){const p=u.type,m=o.handlers[p];if(qt.call(o.handlers,p)&&m)return m(o,u,h);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in u){const{children:f,...v}=u,x=nt(v);return x.children=o.all(u),x}return nt(u)}return(o.options.unknownHandler||Op)(o,u,h)}function d(u){const h=[];if("children"in u){const p=u.children;let m=-1;for(;++m<p.length;){const g=o.one(p[m],u);if(g){if(m&&p[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Ia(g.value)),!Array.isArray(g)&&g.type==="element")){const f=g.children[0];f&&f.type==="text"&&(f.value=Ia(f.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function Ap(n,t){n.position&&(t.position=vu(n))}function Lp(n,t){let s=t;if(n&&n.data){const a=n.data.hName,r=n.data.hChildren,i=n.data.hProperties;if(typeof a=="string")if(s.type==="element")s.tagName=a;else{const l="children"in s?s.children:[s];s={type:"element",tagName:a,properties:{},children:l}}s.type==="element"&&i&&Object.assign(s.properties,nt(i)),"children"in s&&s.children&&r!==null&&r!==void 0&&(s.children=r)}return s}function Op(n,t){const s=t.data||{},a="value"in t&&!(qt.call(s,"hProperties")||qt.call(s,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:n.all(t)};return n.patch(t,a),n.applyData(t,a)}function Pp(n,t){const s=[];let a=-1;for(t&&s.push({type:"text",value:`
|
|
141
|
+
`});++a<n.length;)a&&s.push({type:"text",value:`
|
|
142
|
+
`}),s.push(n[a]);return t&&n.length>0&&s.push({type:"text",value:`
|
|
143
|
+
`}),s}function Ia(n){let t=0,s=n.charCodeAt(t);for(;s===9||s===32;)t++,s=n.charCodeAt(t);return n.slice(t)}function Ma(n,t){const s=Mp(n,t),a=s.one(n,void 0),r=jp(s),i=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
|
|
144
|
+
`},r),i}function Dp(n,t){return n&&"run"in n?async function(s,a){const r=Ma(s,{file:a,...t});await n.run(r,a)}:function(s,a){return Ma(s,{file:a,...n||t})}}function Aa(n){if(n)throw n}var kt,La;function Fp(){if(La)return kt;La=1;var n=Object.prototype.hasOwnProperty,t=Object.prototype.toString,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},i=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var u=n.call(d,"constructor"),h=d.constructor&&d.constructor.prototype&&n.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!u&&!h)return!1;var p;for(p in d);return typeof p>"u"||n.call(d,p)},l=function(d,u){s&&u.name==="__proto__"?s(d,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):d[u.name]=u.newValue},o=function(d,u){if(u==="__proto__")if(n.call(d,u)){if(a)return a(d,u).value}else return;return d[u]};return kt=function c(){var d,u,h,p,m,g,f=arguments[0],v=1,x=arguments.length,b=!1;for(typeof f=="boolean"&&(b=f,f=arguments[1]||{},v=2),(f==null||typeof f!="object"&&typeof f!="function")&&(f={});v<x;++v)if(d=arguments[v],d!=null)for(u in d)h=o(f,u),p=o(d,u),f!==p&&(b&&p&&(i(p)||(m=r(p)))?(m?(m=!1,g=h&&r(h)?h:[]):g=h&&i(h)?h:{},l(f,{name:u,newValue:c(b,g,p)})):typeof p<"u"&&l(f,{name:u,newValue:p}));return f},kt}var _p=Fp();const bt=Ka(_p);function Ut(n){if(typeof n!="object"||n===null)return!1;const t=Object.getPrototypeOf(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function zp(){const n=[],t={run:s,use:a};return t;function s(...r){let i=-1;const l=r.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);o(null,...r);function o(c,...d){const u=n[++i];let h=-1;if(c){l(c);return}for(;++h<r.length;)(d[h]===null||d[h]===void 0)&&(d[h]=r[h]);r=d,u?Vp(u,o)(...d):l(null,...d)}}function a(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return n.push(r),t}}function Vp(n,t){let s;return a;function a(...l){const o=n.length>l.length;let c;o&&l.push(r);try{c=n.apply(this,l)}catch(d){const u=d;if(o&&s)throw u;return r(u)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,r):c instanceof Error?r(c):i(c))}function r(l,...o){s||(s=!0,t(l,...o))}function i(l){r(null,l)}}const Xe={basename:Wp,dirname:Bp,extname:Hp,join:$p,sep:"/"};function Wp(n,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vn(n);let s=0,a=-1,r=n.length,i;if(t===void 0||t.length===0||t.length>n.length){for(;r--;)if(n.codePointAt(r)===47){if(i){s=r+1;break}}else a<0&&(i=!0,a=r+1);return a<0?"":n.slice(s,a)}if(t===n)return"";let l=-1,o=t.length-1;for(;r--;)if(n.codePointAt(r)===47){if(i){s=r+1;break}}else l<0&&(i=!0,l=r+1),o>-1&&(n.codePointAt(r)===t.codePointAt(o--)?o<0&&(a=r):(o=-1,a=l));return s===a?a=l:a<0&&(a=n.length),n.slice(s,a)}function Bp(n){if(Vn(n),n.length===0)return".";let t=-1,s=n.length,a;for(;--s;)if(n.codePointAt(s)===47){if(a){t=s;break}}else a||(a=!0);return t<0?n.codePointAt(0)===47?"/":".":t===1&&n.codePointAt(0)===47?"//":n.slice(0,t)}function Hp(n){Vn(n);let t=n.length,s=-1,a=0,r=-1,i=0,l;for(;t--;){const o=n.codePointAt(t);if(o===47){if(l){a=t+1;break}continue}s<0&&(l=!0,s=t+1),o===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||s<0||i===0||i===1&&r===s-1&&r===a+1?"":n.slice(r,s)}function $p(...n){let t=-1,s;for(;++t<n.length;)Vn(n[t]),n[t]&&(s=s===void 0?n[t]:s+"/"+n[t]);return s===void 0?".":Xp(s)}function Xp(n){Vn(n);const t=n.codePointAt(0)===47;let s=Yp(n,!t);return s.length===0&&!t&&(s="."),s.length>0&&n.codePointAt(n.length-1)===47&&(s+="/"),t?"/"+s:s}function Yp(n,t){let s="",a=0,r=-1,i=0,l=-1,o,c;for(;++l<=n.length;){if(l<n.length)o=n.codePointAt(l);else{if(o===47)break;o=47}if(o===47){if(!(r===l-1||i===1))if(r!==l-1&&i===2){if(s.length<2||a!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(c=s.lastIndexOf("/"),c!==s.length-1){c<0?(s="",a=0):(s=s.slice(0,c),a=s.length-1-s.lastIndexOf("/")),r=l,i=0;continue}}else if(s.length>0){s="",a=0,r=l,i=0;continue}}t&&(s=s.length>0?s+"/..":"..",a=2)}else s.length>0?s+="/"+n.slice(r+1,l):s=n.slice(r+1,l),a=l-r-1;r=l,i=0}else o===46&&i>-1?i++:i=-1}return s}function Vn(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const qp={cwd:Up};function Up(){return"/"}function Kt(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Kp(n){if(typeof n=="string")n=new URL(n);else if(!Kt(n)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(n.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Jp(n)}function Jp(n){if(n.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=n.pathname;let s=-1;for(;++s<t.length;)if(t.codePointAt(s)===37&&t.codePointAt(s+1)===50){const a=t.codePointAt(s+2);if(a===70||a===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const Nt=["history","path","basename","stem","extname","dirname"];class Di{constructor(t){let s;t?Kt(t)?s={path:t}:typeof t=="string"||Gp(t)?s={value:t}:s=t:s={},this.cwd="cwd"in s?"":qp.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Nt.length;){const i=Nt[a];i in s&&s[i]!==void 0&&s[i]!==null&&(this[i]=i==="history"?[...s[i]]:s[i])}let r;for(r in s)Nt.includes(r)||(this[r]=s[r])}get basename(){return typeof this.path=="string"?Xe.basename(this.path):void 0}set basename(t){Ct(t,"basename"),St(t,"basename"),this.path=Xe.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Xe.dirname(this.path):void 0}set dirname(t){Oa(this.basename,"dirname"),this.path=Xe.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Xe.extname(this.path):void 0}set extname(t){if(St(t,"extname"),Oa(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xe.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Kt(t)&&(t=Kp(t)),Ct(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Xe.basename(this.path,this.extname):void 0}set stem(t){Ct(t,"stem"),St(t,"stem"),this.path=Xe.join(this.dirname||"",t+(this.extname||""))}fail(t,s,a){const r=this.message(t,s,a);throw r.fatal=!0,r}info(t,s,a){const r=this.message(t,s,a);return r.fatal=void 0,r}message(t,s,a){const r=new Te(t,s,a);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function St(n,t){if(n&&n.includes(Xe.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Xe.sep+"`")}function Ct(n,t){if(!n)throw new Error("`"+t+"` cannot be empty")}function Oa(n,t){if(!n)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Gp(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Qp=(function(n){const a=this.constructor.prototype,r=a[n],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,a),i}),Zp={}.hasOwnProperty;class Ns extends Qp{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=zp()}copy(){const t=new Ns;let s=-1;for(;++s<this.attachers.length;){const a=this.attachers[s];t.use(...a)}return t.data(bt(!0,{},this.namespace)),t}data(t,s){return typeof t=="string"?arguments.length===2?(Et("data",this.frozen),this.namespace[t]=s,this):Zp.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Et("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[s,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const r=s.call(t,...a);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const s=Xn(t),a=this.parser||this.Parser;return Tt("parse",a),a(String(s),s)}process(t,s){const a=this;return this.freeze(),Tt("process",this.parser||this.Parser),Rt("process",this.compiler||this.Compiler),s?r(void 0,s):new Promise(r);function r(i,l){const o=Xn(t),c=a.parse(o);a.run(c,o,function(u,h,p){if(u||!h||!p)return d(u);const m=h,g=a.stringify(m,p);tf(g)?p.value=g:p.result=g,d(u,p)});function d(u,h){u||!h?l(u):i?i(h):s(void 0,h)}}}processSync(t){let s=!1,a;return this.freeze(),Tt("processSync",this.parser||this.Parser),Rt("processSync",this.compiler||this.Compiler),this.process(t,r),Da("processSync","process",s),a;function r(i,l){s=!0,Aa(i),a=l}}run(t,s,a){Pa(t),this.freeze();const r=this.transformers;return!a&&typeof s=="function"&&(a=s,s=void 0),a?i(void 0,a):new Promise(i);function i(l,o){const c=Xn(s);r.run(t,c,d);function d(u,h,p){const m=h||t;u?o(u):l?l(m):a(void 0,m,p)}}}runSync(t,s){let a=!1,r;return this.run(t,s,i),Da("runSync","run",a),r;function i(l,o){Aa(l),r=o,a=!0}}stringify(t,s){this.freeze();const a=Xn(s),r=this.compiler||this.Compiler;return Rt("stringify",r),Pa(t),r(t,a)}use(t,...s){const a=this.attachers,r=this.namespace;if(Et("use",this.frozen),t!=null)if(typeof t=="function")c(t,s);else if(typeof t=="object")Array.isArray(t)?o(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...h]=d;c(u,h)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(d.plugins),d.settings&&(r.settings=bt(!0,r.settings,d.settings))}function o(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const h=d[u];i(h)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let h=-1,p=-1;for(;++h<a.length;)if(a[h][0]===d){p=h;break}if(p===-1)a.push([d,...u]);else if(u.length>0){let[m,...g]=u;const f=a[p][1];Ut(f)&&Ut(m)&&(m=bt(!0,f,m)),a[p]=[d,m,...g]}}}}const ef=new Ns().freeze();function Tt(n,t){if(typeof t!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Rt(n,t){if(typeof t!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function Et(n,t){if(t)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pa(n){if(!Ut(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Da(n,t,s){if(!s)throw new Error("`"+n+"` finished async. Use `"+t+"` instead")}function Xn(n){return nf(n)?n:new Di(n)}function nf(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function tf(n){return typeof n=="string"||sf(n)}function sf(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const af="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fa=[],_a={allowDangerousHtml:!0},rf=/^(https?|ircs?|mailto|xmpp)$/i,lf=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function of(n){const t=cf(n),s=df(n);return uf(t.runSync(t.parse(s),s),n)}function cf(n){const t=n.rehypePlugins||Fa,s=n.remarkPlugins||Fa,a=n.remarkRehypeOptions?{...n.remarkRehypeOptions,..._a}:_a;return ef().use(Wm).use(s).use(Dp,a).use(t)}function df(n){const t=n.children||"",s=new Di;return typeof t=="string"&&(s.value=t),s}function uf(n,t){const s=t.allowedElements,a=t.allowElement,r=t.components,i=t.disallowedElements,l=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||hf;for(const u of lf)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+af+u.id,void 0);return bs(n,d),Nu(n,{Fragment:e.Fragment,components:r,ignoreInvalidStyle:!0,jsx:e.jsx,jsxs:e.jsxs,passKeys:!0,passNode:!0});function d(u,h,p){if(u.type==="raw"&&p&&typeof h=="number")return l?p.children.splice(h,1):p.children[h]={type:"text",value:u.value},h;if(u.type==="element"){let m;for(m in vt)if(Object.hasOwn(vt,m)&&Object.hasOwn(u.properties,m)){const g=u.properties[m],f=vt[m];(f===null||f.includes(u.tagName))&&(u.properties[m]=c(String(g||""),m,u))}}if(u.type==="element"){let m=s?!s.includes(u.tagName):i?i.includes(u.tagName):!1;if(!m&&a&&typeof h=="number"&&(m=!a(u,h,p)),m&&p&&typeof h=="number")return o&&u.children?p.children.splice(h,1,...u.children):p.children.splice(h,1),h}}}function hf(n){const t=n.indexOf(":"),s=n.indexOf("?"),a=n.indexOf("#"),r=n.indexOf("/");return t===-1||r!==-1&&t>r||s!==-1&&t>s||a!==-1&&t>a||rf.test(n.slice(0,t))?n:""}function za(n,t){const s=String(n);if(typeof t!="string")throw new TypeError("Expected character");let a=0,r=s.indexOf(t);for(;r!==-1;)a++,r=s.indexOf(t,r+t.length);return a}function mf(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function pf(n,t,s){const r=ot((s||{}).ignore||[]),i=ff(t);let l=-1;for(;++l<i.length;)Pi(n,"text",o);function o(d,u){let h=-1,p;for(;++h<u.length;){const m=u[h],g=p?p.children:void 0;if(r(m,g?g.indexOf(m):void 0,p))return;p=m}if(p)return c(d,u)}function c(d,u){const h=u[u.length-1],p=i[l][0],m=i[l][1];let g=0;const v=h.children.indexOf(d);let x=!1,b=[];p.lastIndex=0;let j=p.exec(d.value);for(;j;){const A=j.index,I={index:j.index,input:j.input,stack:[...u,d]};let k=m(...j,I);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?p.lastIndex=A+1:(g!==A&&b.push({type:"text",value:d.value.slice(g,A)}),Array.isArray(k)?b.push(...k):k&&b.push(k),g=A+j[0].length,x=!0),!p.global)break;j=p.exec(d.value)}return x?(g<d.value.length&&b.push({type:"text",value:d.value.slice(g)}),h.children.splice(v,1,...b)):b=[d],v+b.length}}function ff(n){const t=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const s=!n[0]||Array.isArray(n[0])?n:[n];let a=-1;for(;++a<s.length;){const r=s[a];t.push([gf(r[0]),xf(r[1])])}return t}function gf(n){return typeof n=="string"?new RegExp(mf(n),"g"):n}function xf(n){return typeof n=="function"?n:function(){return n}}const It="phrasing",Mt=["autolink","link","image","label"];function yf(){return{transforms:[Sf],enter:{literalAutolink:wf,literalAutolinkEmail:At,literalAutolinkHttp:At,literalAutolinkWww:At},exit:{literalAutolink:Nf,literalAutolinkEmail:bf,literalAutolinkHttp:jf,literalAutolinkWww:kf}}}function vf(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:It,notInConstruct:Mt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:It,notInConstruct:Mt},{character:":",before:"[ps]",after:"\\/",inConstruct:It,notInConstruct:Mt}]}}function wf(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function At(n){this.config.enter.autolinkProtocol.call(this,n)}function jf(n){this.config.exit.autolinkProtocol.call(this,n)}function kf(n){this.config.exit.data.call(this,n);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(n)}function bf(n){this.config.exit.autolinkEmail.call(this,n)}function Nf(n){this.exit(n)}function Sf(n){pf(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Cf],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Tf]],{ignore:["link","linkReference"]})}function Cf(n,t,s,a,r){let i="";if(!Fi(r)||(/^w/i.test(t)&&(s=t+s,t="",i="http://"),!Rf(s)))return!1;const l=Ef(s+a);if(!l[0])return!1;const o={type:"link",title:null,url:i+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[o,{type:"text",value:l[1]}]:o}function Tf(n,t,s,a){return!Fi(a,!0)||/[-\d_]$/.test(s)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+s,children:[{type:"text",value:t+"@"+s}]}}function Rf(n){const t=n.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Ef(n){const t=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!t)return[n,void 0];n=n.slice(0,t.index);let s=t[0],a=s.indexOf(")");const r=za(n,"(");let i=za(n,")");for(;a!==-1&&r>i;)n+=s.slice(0,a+1),s=s.slice(a+1),a=s.indexOf(")"),i++;return[n,s]}function Fi(n,t){const s=n.input.charCodeAt(n.index-1);return(n.index===0||ln(s)||rt(s))&&(!t||s!==47)}_i.peek=_f;function If(){this.buffer()}function Mf(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function Af(){this.buffer()}function Lf(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function Of(n){const t=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=He(this.sliceSerialize(n)).toLowerCase(),s.label=t}function Pf(n){this.exit(n)}function Df(n){const t=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=He(this.sliceSerialize(n)).toLowerCase(),s.label=t}function Ff(n){this.exit(n)}function _f(){return"["}function _i(n,t,s,a){const r=s.createTracker(a);let i=r.move("[^");const l=s.enter("footnoteReference"),o=s.enter("reference");return i+=r.move(s.safe(s.associationId(n),{after:"]",before:i})),o(),l(),i+=r.move("]"),i}function zf(){return{enter:{gfmFootnoteCallString:If,gfmFootnoteCall:Mf,gfmFootnoteDefinitionLabelString:Af,gfmFootnoteDefinition:Lf},exit:{gfmFootnoteCallString:Of,gfmFootnoteCall:Pf,gfmFootnoteDefinitionLabelString:Df,gfmFootnoteDefinition:Ff}}}function Vf(n){let t=!1;return n&&n.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:s,footnoteReference:_i},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function s(a,r,i,l){const o=i.createTracker(l);let c=o.move("[^");const d=i.enter("footnoteDefinition"),u=i.enter("label");return c+=o.move(i.safe(i.associationId(a),{before:c,after:"]"})),u(),c+=o.move("]:"),a.children&&a.children.length>0&&(o.shift(4),c+=o.move((t?`
|
|
145
|
+
`:" ")+i.indentLines(i.containerFlow(a,o.current()),t?zi:Wf))),d(),c}}function Wf(n,t,s){return t===0?n:zi(n,t,s)}function zi(n,t,s){return(s?"":" ")+n}const Bf=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Vi.peek=qf;function Hf(){return{canContainEols:["delete"],enter:{strikethrough:Xf},exit:{strikethrough:Yf}}}function $f(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Bf}],handlers:{delete:Vi}}}function Xf(n){this.enter({type:"delete",children:[]},n)}function Yf(n){this.exit(n)}function Vi(n,t,s,a){const r=s.createTracker(a),i=s.enter("strikethrough");let l=r.move("~~");return l+=s.containerPhrasing(n,{...r.current(),before:l,after:"~"}),l+=r.move("~~"),i(),l}function qf(){return"~"}function Uf(n){return n.length}function Kf(n,t){const s=t||{},a=(s.align||[]).concat(),r=s.stringLength||Uf,i=[],l=[],o=[],c=[];let d=0,u=-1;for(;++u<n.length;){const f=[],v=[];let x=-1;for(n[u].length>d&&(d=n[u].length);++x<n[u].length;){const b=Jf(n[u][x]);if(s.alignDelimiters!==!1){const j=r(b);v[x]=j,(c[x]===void 0||j>c[x])&&(c[x]=j)}f.push(b)}l[u]=f,o[u]=v}let h=-1;if(typeof a=="object"&&"length"in a)for(;++h<d;)i[h]=Va(a[h]);else{const f=Va(a);for(;++h<d;)i[h]=f}h=-1;const p=[],m=[];for(;++h<d;){const f=i[h];let v="",x="";f===99?(v=":",x=":"):f===108?v=":":f===114&&(x=":");let b=s.alignDelimiters===!1?1:Math.max(1,c[h]-v.length-x.length);const j=v+"-".repeat(b)+x;s.alignDelimiters!==!1&&(b=v.length+b+x.length,b>c[h]&&(c[h]=b),m[h]=b),p[h]=j}l.splice(1,0,p),o.splice(1,0,m),u=-1;const g=[];for(;++u<l.length;){const f=l[u],v=o[u];h=-1;const x=[];for(;++h<d;){const b=f[h]||"";let j="",A="";if(s.alignDelimiters!==!1){const I=c[h]-(v[h]||0),k=i[h];k===114?j=" ".repeat(I):k===99?I%2?(j=" ".repeat(I/2+.5),A=" ".repeat(I/2-.5)):(j=" ".repeat(I/2),A=j):A=" ".repeat(I)}s.delimiterStart!==!1&&!h&&x.push("|"),s.padding!==!1&&!(s.alignDelimiters===!1&&b==="")&&(s.delimiterStart!==!1||h)&&x.push(" "),s.alignDelimiters!==!1&&x.push(j),x.push(b),s.alignDelimiters!==!1&&x.push(A),s.padding!==!1&&x.push(" "),(s.delimiterEnd!==!1||h!==d-1)&&x.push("|")}g.push(s.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
|
|
146
|
+
`)}function Jf(n){return n==null?"":String(n)}function Va(n){const t=typeof n=="string"?n.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Gf(n,t,s,a){const r=s.enter("blockquote"),i=s.createTracker(a);i.move("> "),i.shift(2);const l=s.indentLines(s.containerFlow(n,i.current()),Qf);return r(),l}function Qf(n,t,s){return">"+(s?"":" ")+n}function Zf(n,t){return Wa(n,t.inConstruct,!0)&&!Wa(n,t.notInConstruct,!1)}function Wa(n,t,s){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return s;let a=-1;for(;++a<t.length;)if(n.includes(t[a]))return!0;return!1}function Ba(n,t,s,a){let r=-1;for(;++r<s.unsafe.length;)if(s.unsafe[r].character===`
|
|
147
|
+
`&&Zf(s.stack,s.unsafe[r]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
148
|
+
`}function eg(n,t){const s=String(n);let a=s.indexOf(t),r=a,i=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===r?++i>l&&(l=i):i=1,r=a+t.length,a=s.indexOf(t,r);return l}function ng(n,t){return!!(t.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function tg(n){const t=n.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function sg(n,t,s,a){const r=tg(s),i=n.value||"",l=r==="`"?"GraveAccent":"Tilde";if(ng(n,s)){const h=s.enter("codeIndented"),p=s.indentLines(i,ag);return h(),p}const o=s.createTracker(a),c=r.repeat(Math.max(eg(i,r)+1,3)),d=s.enter("codeFenced");let u=o.move(c);if(n.lang){const h=s.enter(`codeFencedLang${l}`);u+=o.move(s.safe(n.lang,{before:u,after:" ",encode:["`"],...o.current()})),h()}if(n.lang&&n.meta){const h=s.enter(`codeFencedMeta${l}`);u+=o.move(" "),u+=o.move(s.safe(n.meta,{before:u,after:`
|
|
149
|
+
`,encode:["`"],...o.current()})),h()}return u+=o.move(`
|
|
150
|
+
`),i&&(u+=o.move(i+`
|
|
151
|
+
`)),u+=o.move(c),d(),u}function ag(n,t,s){return(s?"":" ")+n}function Ss(n){const t=n.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function rg(n,t,s,a){const r=Ss(s),i=r==='"'?"Quote":"Apostrophe",l=s.enter("definition");let o=s.enter("label");const c=s.createTracker(a);let d=c.move("[");return d+=c.move(s.safe(s.associationId(n),{before:d,after:"]",...c.current()})),d+=c.move("]: "),o(),!n.url||/[\0- \u007F]/.test(n.url)?(o=s.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(s.safe(n.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(o=s.enter("destinationRaw"),d+=c.move(s.safe(n.url,{before:d,after:n.title?" ":`
|
|
152
|
+
`,...c.current()}))),o(),n.title&&(o=s.enter(`title${i}`),d+=c.move(" "+r),d+=c.move(s.safe(n.title,{before:d,after:r,...c.current()})),d+=c.move(r),o()),l(),d}function ig(n){const t=n.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Dn(n){return"&#x"+n.toString(16).toUpperCase()+";"}function tt(n,t,s){const a=xn(n),r=xn(t);return a===void 0?r===void 0?s==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Wi.peek=lg;function Wi(n,t,s,a){const r=ig(s),i=s.enter("emphasis"),l=s.createTracker(a),o=l.move(r);let c=l.move(s.containerPhrasing(n,{after:r,before:o,...l.current()}));const d=c.charCodeAt(0),u=tt(a.before.charCodeAt(a.before.length-1),d,r);u.inside&&(c=Dn(d)+c.slice(1));const h=c.charCodeAt(c.length-1),p=tt(a.after.charCodeAt(0),h,r);p.inside&&(c=c.slice(0,-1)+Dn(h));const m=l.move(r);return i(),s.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},o+c+m}function lg(n,t,s){return s.options.emphasis||"*"}function og(n,t){let s=!1;return bs(n,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return s=!0,Yt}),!!((!n.depth||n.depth<3)&&gs(n)&&(t.options.setext||s))}function cg(n,t,s,a){const r=Math.max(Math.min(6,n.depth||1),1),i=s.createTracker(a);if(og(n,s)){const u=s.enter("headingSetext"),h=s.enter("phrasing"),p=s.containerPhrasing(n,{...i.current(),before:`
|
|
153
|
+
`,after:`
|
|
154
|
+
`});return h(),u(),p+`
|
|
155
|
+
`+(r===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
156
|
+
`))+1))}const l="#".repeat(r),o=s.enter("headingAtx"),c=s.enter("phrasing");i.move(l+" ");let d=s.containerPhrasing(n,{before:"# ",after:`
|
|
157
|
+
`,...i.current()});return/^[\t ]/.test(d)&&(d=Dn(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,s.options.closeAtx&&(d+=" "+l),c(),o(),d}Bi.peek=dg;function Bi(n){return n.value||""}function dg(){return"<"}Hi.peek=ug;function Hi(n,t,s,a){const r=Ss(s),i=r==='"'?"Quote":"Apostrophe",l=s.enter("image");let o=s.enter("label");const c=s.createTracker(a);let d=c.move("![");return d+=c.move(s.safe(n.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),o(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(o=s.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(s.safe(n.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(o=s.enter("destinationRaw"),d+=c.move(s.safe(n.url,{before:d,after:n.title?" ":")",...c.current()}))),o(),n.title&&(o=s.enter(`title${i}`),d+=c.move(" "+r),d+=c.move(s.safe(n.title,{before:d,after:r,...c.current()})),d+=c.move(r),o()),d+=c.move(")"),l(),d}function ug(){return"!"}$i.peek=hg;function $i(n,t,s,a){const r=n.referenceType,i=s.enter("imageReference");let l=s.enter("label");const o=s.createTracker(a);let c=o.move("![");const d=s.safe(n.alt,{before:c,after:"]",...o.current()});c+=o.move(d+"]["),l();const u=s.stack;s.stack=[],l=s.enter("reference");const h=s.safe(s.associationId(n),{before:c,after:"]",...o.current()});return l(),s.stack=u,i(),r==="full"||!d||d!==h?c+=o.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function hg(){return"!"}Xi.peek=mg;function Xi(n,t,s){let a=n.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(a);)r+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++i<s.unsafe.length;){const l=s.unsafe[i],o=s.compilePattern(l);let c;if(l.atBreak)for(;c=o.exec(a);){let d=c.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(c.index+1)}}return r+a+r}function mg(){return"`"}function Yi(n,t){const s=gs(n);return!!(!t.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(s===n.url||"mailto:"+s===n.url)&&/^[a-z][a-z+.-]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}qi.peek=pg;function qi(n,t,s,a){const r=Ss(s),i=r==='"'?"Quote":"Apostrophe",l=s.createTracker(a);let o,c;if(Yi(n,s)){const u=s.stack;s.stack=[],o=s.enter("autolink");let h=l.move("<");return h+=l.move(s.containerPhrasing(n,{before:h,after:">",...l.current()})),h+=l.move(">"),o(),s.stack=u,h}o=s.enter("link"),c=s.enter("label");let d=l.move("[");return d+=l.move(s.containerPhrasing(n,{before:d,after:"](",...l.current()})),d+=l.move("]("),c(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(c=s.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(s.safe(n.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(c=s.enter("destinationRaw"),d+=l.move(s.safe(n.url,{before:d,after:n.title?" ":")",...l.current()}))),c(),n.title&&(c=s.enter(`title${i}`),d+=l.move(" "+r),d+=l.move(s.safe(n.title,{before:d,after:r,...l.current()})),d+=l.move(r),c()),d+=l.move(")"),o(),d}function pg(n,t,s){return Yi(n,s)?"<":"["}Ui.peek=fg;function Ui(n,t,s,a){const r=n.referenceType,i=s.enter("linkReference");let l=s.enter("label");const o=s.createTracker(a);let c=o.move("[");const d=s.containerPhrasing(n,{before:c,after:"]",...o.current()});c+=o.move(d+"]["),l();const u=s.stack;s.stack=[],l=s.enter("reference");const h=s.safe(s.associationId(n),{before:c,after:"]",...o.current()});return l(),s.stack=u,i(),r==="full"||!d||d!==h?c+=o.move(h+"]"):r==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function fg(){return"["}function Cs(n){const t=n.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function gg(n){const t=Cs(n),s=n.options.bulletOther;if(!s)return t==="*"?"-":"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(s===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+s+"`) to be different");return s}function xg(n){const t=n.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ki(n){const t=n.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function yg(n,t,s,a){const r=s.enter("list"),i=s.bulletCurrent;let l=n.ordered?xg(s):Cs(s);const o=n.ordered?l==="."?")":".":gg(s);let c=t&&s.bulletLastUsed?l===s.bulletLastUsed:!1;if(!n.ordered){const u=n.children?n.children[0]:void 0;if((l==="*"||l==="-")&&u&&(!u.children||!u.children[0])&&s.stack[s.stack.length-1]==="list"&&s.stack[s.stack.length-2]==="listItem"&&s.stack[s.stack.length-3]==="list"&&s.stack[s.stack.length-4]==="listItem"&&s.indexStack[s.indexStack.length-1]===0&&s.indexStack[s.indexStack.length-2]===0&&s.indexStack[s.indexStack.length-3]===0&&(c=!0),Ki(s)===l&&u){let h=-1;for(;++h<n.children.length;){const p=n.children[h];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(l=o),s.bulletCurrent=l;const d=s.containerFlow(n,a);return s.bulletLastUsed=l,s.bulletCurrent=i,r(),d}function vg(n){const t=n.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function wg(n,t,s,a){const r=vg(s);let i=s.bulletCurrent||Cs(s);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(s.options.incrementListMarker===!1?0:t.children.indexOf(n))+i);let l=i.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||n.spread))&&(l=Math.ceil(l/4)*4);const o=s.createTracker(a);o.move(i+" ".repeat(l-i.length)),o.shift(l);const c=s.enter("listItem"),d=s.indentLines(s.containerFlow(n,o.current()),u);return c(),d;function u(h,p,m){return p?(m?"":" ".repeat(l))+h:(m?i:i+" ".repeat(l-i.length))+h}}function jg(n,t,s,a){const r=s.enter("paragraph"),i=s.enter("phrasing"),l=s.containerPhrasing(n,a);return i(),r(),l}const kg=ot(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function bg(n,t,s,a){return(n.children.some(function(l){return kg(l)})?s.containerPhrasing:s.containerFlow).call(s,n,a)}function Ng(n){const t=n.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ji.peek=Sg;function Ji(n,t,s,a){const r=Ng(s),i=s.enter("strong"),l=s.createTracker(a),o=l.move(r+r);let c=l.move(s.containerPhrasing(n,{after:r,before:o,...l.current()}));const d=c.charCodeAt(0),u=tt(a.before.charCodeAt(a.before.length-1),d,r);u.inside&&(c=Dn(d)+c.slice(1));const h=c.charCodeAt(c.length-1),p=tt(a.after.charCodeAt(0),h,r);p.inside&&(c=c.slice(0,-1)+Dn(h));const m=l.move(r+r);return i(),s.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},o+c+m}function Sg(n,t,s){return s.options.strong||"*"}function Cg(n,t,s,a){return s.safe(n.value,a)}function Tg(n){const t=n.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Rg(n,t,s){const a=(Ki(s)+(s.options.ruleSpaces?" ":"")).repeat(Tg(s));return s.options.ruleSpaces?a.slice(0,-1):a}const Gi={blockquote:Gf,break:Ba,code:sg,definition:rg,emphasis:Wi,hardBreak:Ba,heading:cg,html:Bi,image:Hi,imageReference:$i,inlineCode:Xi,link:qi,linkReference:Ui,list:yg,listItem:wg,paragraph:jg,root:bg,strong:Ji,text:Cg,thematicBreak:Rg};function Eg(){return{enter:{table:Ig,tableData:Ha,tableHeader:Ha,tableRow:Ag},exit:{codeText:Lg,table:Mg,tableData:Lt,tableHeader:Lt,tableRow:Lt}}}function Ig(n){const t=n._align;this.enter({type:"table",align:t.map(function(s){return s==="none"?null:s}),children:[]},n),this.data.inTable=!0}function Mg(n){this.exit(n),this.data.inTable=void 0}function Ag(n){this.enter({type:"tableRow",children:[]},n)}function Lt(n){this.exit(n)}function Ha(n){this.enter({type:"tableCell",children:[]},n)}function Lg(n){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Og));const s=this.stack[this.stack.length-1];s.type,s.value=t,this.exit(n)}function Og(n,t){return t==="|"?t:n}function Pg(n){const t=n||{},s=t.tableCellPadding,a=t.tablePipeAlign,r=t.stringLength,i=s?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
158
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:l,tableCell:c,tableRow:o}};function l(m,g,f,v){return d(u(m,f,v),m.align)}function o(m,g,f,v){const x=h(m,f,v),b=d([x]);return b.slice(0,b.indexOf(`
|
|
159
|
+
`))}function c(m,g,f,v){const x=f.enter("tableCell"),b=f.enter("phrasing"),j=f.containerPhrasing(m,{...v,before:i,after:i});return b(),x(),j}function d(m,g){return Kf(m,{align:g,alignDelimiters:a,padding:s,stringLength:r})}function u(m,g,f){const v=m.children;let x=-1;const b=[],j=g.enter("table");for(;++x<v.length;)b[x]=h(v[x],g,f);return j(),b}function h(m,g,f){const v=m.children;let x=-1;const b=[],j=g.enter("tableRow");for(;++x<v.length;)b[x]=c(v[x],m,g,f);return j(),b}function p(m,g,f){let v=Gi.inlineCode(m,g,f);return f.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Dg(){return{exit:{taskListCheckValueChecked:$a,taskListCheckValueUnchecked:$a,paragraph:_g}}}function Fg(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:zg}}}function $a(n){const t=this.stack[this.stack.length-2];t.type,t.checked=n.type==="taskListCheckValueChecked"}function _g(n){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const s=this.stack[this.stack.length-1];s.type;const a=s.children[0];if(a&&a.type==="text"){const r=t.children;let i=-1,l;for(;++i<r.length;){const o=r[i];if(o.type==="paragraph"){l=o;break}}l===s&&(a.value=a.value.slice(1),a.value.length===0?s.children.shift():s.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,s.position.start=Object.assign({},a.position.start)))}}this.exit(n)}function zg(n,t,s,a){const r=n.children[0],i=typeof n.checked=="boolean"&&r&&r.type==="paragraph",l="["+(n.checked?"x":" ")+"] ",o=s.createTracker(a);i&&o.move(l);let c=Gi.listItem(n,t,s,{...a,...o.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(u){return u+l}}function Vg(){return[yf(),zf(),Hf(),Eg(),Dg()]}function Wg(n){return{extensions:[vf(),Vf(n),$f(),Pg(n),Fg()]}}const Bg={tokenize:Ug,partial:!0},Qi={tokenize:Kg,partial:!0},Zi={tokenize:Jg,partial:!0},el={tokenize:Gg,partial:!0},Hg={tokenize:Qg,partial:!0},nl={name:"wwwAutolink",tokenize:Yg,previous:sl},tl={name:"protocolAutolink",tokenize:qg,previous:al},Ke={name:"emailAutolink",tokenize:Xg,previous:rl},Ye={};function $g(){return{text:Ye}}let rn=48;for(;rn<123;)Ye[rn]=Ke,rn++,rn===58?rn=65:rn===91&&(rn=97);Ye[43]=Ke;Ye[45]=Ke;Ye[46]=Ke;Ye[95]=Ke;Ye[72]=[Ke,tl];Ye[104]=[Ke,tl];Ye[87]=[Ke,nl];Ye[119]=[Ke,nl];function Xg(n,t,s){const a=this;let r,i;return l;function l(h){return!Jt(h)||!rl.call(a,a.previous)||Ts(a.events)?s(h):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),o(h))}function o(h){return Jt(h)?(n.consume(h),o):h===64?(n.consume(h),c):s(h)}function c(h){return h===46?n.check(Hg,u,d)(h):h===45||h===95||Ce(h)?(i=!0,n.consume(h),c):u(h)}function d(h){return n.consume(h),r=!0,c}function u(h){return i&&r&&Re(a.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),t(h)):s(h)}}function Yg(n,t,s){const a=this;return r;function r(l){return l!==87&&l!==119||!sl.call(a,a.previous)||Ts(a.events)?s(l):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(Bg,n.attempt(Qi,n.attempt(Zi,i),s),s)(l))}function i(l){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),t(l)}}function qg(n,t,s){const a=this;let r="",i=!1;return l;function l(h){return(h===72||h===104)&&al.call(a,a.previous)&&!Ts(a.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),n.consume(h),o):s(h)}function o(h){if(Re(h)&&r.length<5)return r+=String.fromCodePoint(h),n.consume(h),o;if(h===58){const p=r.toLowerCase();if(p==="http"||p==="https")return n.consume(h),c}return s(h)}function c(h){return h===47?(n.consume(h),i?d:(i=!0,c)):s(h)}function d(h){return h===null||Zn(h)||de(h)||ln(h)||rt(h)?s(h):n.attempt(Qi,n.attempt(Zi,u),s)(h)}function u(h){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),t(h)}}function Ug(n,t,s){let a=0;return r;function r(l){return(l===87||l===119)&&a<3?(a++,n.consume(l),r):l===46&&a===3?(n.consume(l),i):s(l)}function i(l){return l===null?s(l):t(l)}}function Kg(n,t,s){let a,r,i;return l;function l(d){return d===46||d===95?n.check(el,c,o)(d):d===null||de(d)||ln(d)||d!==45&&rt(d)?c(d):(i=!0,n.consume(d),l)}function o(d){return d===95?a=!0:(r=a,a=void 0),n.consume(d),l}function c(d){return r||a||!i?s(d):t(d)}}function Jg(n,t){let s=0,a=0;return r;function r(l){return l===40?(s++,n.consume(l),r):l===41&&a<s?i(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?n.check(el,t,i)(l):l===null||de(l)||ln(l)?t(l):(n.consume(l),r)}function i(l){return l===41&&a++,n.consume(l),r}}function Gg(n,t,s){return a;function a(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(n.consume(o),a):o===38?(n.consume(o),i):o===93?(n.consume(o),r):o===60||o===null||de(o)||ln(o)?t(o):s(o)}function r(o){return o===null||o===40||o===91||de(o)||ln(o)?t(o):a(o)}function i(o){return Re(o)?l(o):s(o)}function l(o){return o===59?(n.consume(o),a):Re(o)?(n.consume(o),l):s(o)}}function Qg(n,t,s){return a;function a(i){return n.consume(i),r}function r(i){return Ce(i)?s(i):t(i)}}function sl(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||de(n)}function al(n){return!Re(n)}function rl(n){return!(n===47||Jt(n))}function Jt(n){return n===43||n===45||n===46||n===95||Ce(n)}function Ts(n){let t=n.length,s=!1;for(;t--;){const a=n[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){s=!0;break}if(a._gfmAutolinkLiteralWalkedInto){s=!1;break}}return n.length>0&&!s&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),s}const Zg={tokenize:lx,partial:!0};function ex(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ax,continuation:{tokenize:rx},exit:ix}},text:{91:{name:"gfmFootnoteCall",tokenize:sx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nx,resolveTo:tx}}}}function nx(n,t,s){const a=this;let r=a.events.length;const i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l;for(;r--;){const c=a.events[r][1];if(c.type==="labelImage"){l=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!l||!l._balanced)return s(c);const d=He(a.sliceSerialize({start:l.end,end:a.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?s(c):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(c),n.exit("gfmFootnoteCallLabelMarker"),t(c))}}function tx(n,t){let s=n.length;for(;s--;)if(n[s][1].type==="labelImage"&&n[s][0]==="enter"){n[s][1];break}n[s+1][1].type="data",n[s+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},n[s+3][1].start),end:Object.assign({},n[n.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},n[s+3][1].end),end:Object.assign({},n[s+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},n[n.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[n[s+1],n[s+2],["enter",a,t],n[s+3],n[s+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t],n[n.length-2],n[n.length-1],["exit",a,t]];return n.splice(s,n.length-s+1,...o),n}function sx(n,t,s){const a=this,r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let i=0,l;return o;function o(h){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(h),n.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?s(h):(n.enter("gfmFootnoteCallMarker"),n.consume(h),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!l||h===null||h===91||de(h))return s(h);if(h===93){n.exit("chunkString");const p=n.exit("gfmFootnoteCallString");return r.includes(He(a.sliceSerialize(p)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(h),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),t):s(h)}return de(h)||(l=!0),i++,n.consume(h),h===92?u:d}function u(h){return h===91||h===92||h===93?(n.consume(h),i++,d):d(h)}}function ax(n,t,s){const a=this,r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let i,l=0,o;return c;function c(g){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(g),n.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(g),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",u):s(g)}function u(g){if(l>999||g===93&&!o||g===null||g===91||de(g))return s(g);if(g===93){n.exit("chunkString");const f=n.exit("gfmFootnoteDefinitionLabelString");return i=He(a.sliceSerialize(f)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(g),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),p}return de(g)||(o=!0),l++,n.consume(g),g===92?h:u}function h(g){return g===91||g===92||g===93?(n.consume(g),l++,u):u(g)}function p(g){return g===58?(n.enter("definitionMarker"),n.consume(g),n.exit("definitionMarker"),r.includes(i)||r.push(i),le(n,m,"gfmFootnoteDefinitionWhitespace")):s(g)}function m(g){return t(g)}}function rx(n,t,s){return n.check(zn,t,n.attempt(Zg,t,s))}function ix(n){n.exit("gfmFootnoteDefinition")}function lx(n,t,s){const a=this;return le(n,r,"gfmFootnoteDefinitionIndent",5);function r(i){const l=a.events[a.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(i):s(i)}}function ox(n){let s=(n||{}).singleTilde;const a={name:"strikethrough",tokenize:i,resolveAll:r};return s==null&&(s=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function r(l,o){let c=-1;for(;++c<l.length;)if(l[c][0]==="enter"&&l[c][1].type==="strikethroughSequenceTemporary"&&l[c][1]._close){let d=c;for(;d--;)if(l[d][0]==="exit"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._open&&l[c][1].end.offset-l[c][1].start.offset===l[d][1].end.offset-l[d][1].start.offset){l[c][1].type="strikethroughSequence",l[d][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},l[d][1].start),end:Object.assign({},l[c][1].end)},h={type:"strikethroughText",start:Object.assign({},l[d][1].end),end:Object.assign({},l[c][1].start)},p=[["enter",u,o],["enter",l[d][1],o],["exit",l[d][1],o],["enter",h,o]],m=o.parser.constructs.insideSpan.null;m&&Fe(p,p.length,0,it(m,l.slice(d+1,c),o)),Fe(p,p.length,0,[["exit",h,o],["enter",l[c][1],o],["exit",l[c][1],o],["exit",u,o]]),Fe(l,d-1,c-d+3,p),c=d+p.length-2;break}}for(c=-1;++c<l.length;)l[c][1].type==="strikethroughSequenceTemporary"&&(l[c][1].type="data");return l}function i(l,o,c){const d=this.previous,u=this.events;let h=0;return p;function p(g){return d===126&&u[u.length-1][1].type!=="characterEscape"?c(g):(l.enter("strikethroughSequenceTemporary"),m(g))}function m(g){const f=xn(d);if(g===126)return h>1?c(g):(l.consume(g),h++,m);if(h<2&&!s)return c(g);const v=l.exit("strikethroughSequenceTemporary"),x=xn(g);return v._open=!x||x===2&&!!f,v._close=!f||f===2&&!!x,o(g)}}}class cx{constructor(){this.map=[]}add(t,s,a){dx(this,t,s,a)}consume(t){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let s=this.map.length;const a=[];for(;s>0;)s-=1,a.push(t.slice(this.map[s][0]+this.map[s][1]),this.map[s][2]),t.length=this.map[s][0];a.push(t.slice()),t.length=0;let r=a.pop();for(;r;){for(const i of r)t.push(i);r=a.pop()}this.map.length=0}}function dx(n,t,s,a){let r=0;if(!(s===0&&a.length===0)){for(;r<n.map.length;){if(n.map[r][0]===t){n.map[r][1]+=s,n.map[r][2].push(...a);return}r+=1}n.map.push([t,s,a])}}function ux(n,t){let s=!1;const a=[];for(;t<n.length;){const r=n[t];if(s){if(r[0]==="enter")r[1].type==="tableContent"&&a.push(n[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(n[t-1][1].type==="tableDelimiterMarker"){const i=a.length-1;a[i]=a[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(s=!0);t+=1}return a}function hx(){return{flow:{null:{name:"table",tokenize:mx,resolveAll:px}}}}function mx(n,t,s){const a=this;let r=0,i=0,l;return o;function o(w){let N=a.events.length-1;for(;N>-1;){const M=a.events[N][1].type;if(M==="lineEnding"||M==="linePrefix")N--;else break}const C=N>-1?a.events[N][1].type:null,P=C==="tableHead"||C==="tableRow"?k:c;return P===k&&a.parser.lazy[a.now().line]?s(w):P(w)}function c(w){return n.enter("tableHead"),n.enter("tableRow"),d(w)}function d(w){return w===124||(l=!0,i+=1),u(w)}function u(w){return w===null?s(w):J(w)?i>1?(i=0,a.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(w),n.exit("lineEnding"),m):s(w):ie(w)?le(n,u,"whitespace")(w):(i+=1,l&&(l=!1,r+=1),w===124?(n.enter("tableCellDivider"),n.consume(w),n.exit("tableCellDivider"),l=!0,u):(n.enter("data"),h(w)))}function h(w){return w===null||w===124||de(w)?(n.exit("data"),u(w)):(n.consume(w),w===92?p:h)}function p(w){return w===92||w===124?(n.consume(w),h):h(w)}function m(w){return a.interrupt=!1,a.parser.lazy[a.now().line]?s(w):(n.enter("tableDelimiterRow"),l=!1,ie(w)?le(n,g,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):g(w))}function g(w){return w===45||w===58?v(w):w===124?(l=!0,n.enter("tableCellDivider"),n.consume(w),n.exit("tableCellDivider"),f):I(w)}function f(w){return ie(w)?le(n,v,"whitespace")(w):v(w)}function v(w){return w===58?(i+=1,l=!0,n.enter("tableDelimiterMarker"),n.consume(w),n.exit("tableDelimiterMarker"),x):w===45?(i+=1,x(w)):w===null||J(w)?A(w):I(w)}function x(w){return w===45?(n.enter("tableDelimiterFiller"),b(w)):I(w)}function b(w){return w===45?(n.consume(w),b):w===58?(l=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(w),n.exit("tableDelimiterMarker"),j):(n.exit("tableDelimiterFiller"),j(w))}function j(w){return ie(w)?le(n,A,"whitespace")(w):A(w)}function A(w){return w===124?g(w):w===null||J(w)?!l||r!==i?I(w):(n.exit("tableDelimiterRow"),n.exit("tableHead"),t(w)):I(w)}function I(w){return s(w)}function k(w){return n.enter("tableRow"),S(w)}function S(w){return w===124?(n.enter("tableCellDivider"),n.consume(w),n.exit("tableCellDivider"),S):w===null||J(w)?(n.exit("tableRow"),t(w)):ie(w)?le(n,S,"whitespace")(w):(n.enter("data"),E(w))}function E(w){return w===null||w===124||de(w)?(n.exit("data"),S(w)):(n.consume(w),w===92?L:E)}function L(w){return w===92||w===124?(n.consume(w),E):E(w)}}function px(n,t){let s=-1,a=!0,r=0,i=[0,0,0,0],l=[0,0,0,0],o=!1,c=0,d,u,h;const p=new cx;for(;++s<n.length;){const m=n[s],g=m[1];m[0]==="enter"?g.type==="tableHead"?(o=!1,c!==0&&(Xa(p,t,c,d,u),u=void 0,c=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(s,0,[["enter",d,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(a=!0,h=void 0,i=[0,0,0,0],l=[0,s+1,0,0],o&&(o=!1,u={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(s,0,[["enter",u,t]])),r=g.type==="tableDelimiterRow"?2:u?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(a=!1,l[2]===0&&(i[1]!==0&&(l[0]=l[1],h=Yn(p,t,i,r,void 0,h),i=[0,0,0,0]),l[2]=s)):g.type==="tableCellDivider"&&(a?a=!1:(i[1]!==0&&(l[0]=l[1],h=Yn(p,t,i,r,void 0,h)),i=l,l=[i[1],s,0,0])):g.type==="tableHead"?(o=!0,c=s):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=s,i[1]!==0?(l[0]=l[1],h=Yn(p,t,i,r,s,h)):l[1]!==0&&(h=Yn(p,t,l,r,s,h)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(l[3]=s)}for(c!==0&&Xa(p,t,c,d,u),p.consume(t.events),s=-1;++s<t.events.length;){const m=t.events[s];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=ux(t.events,s))}return n}function Yn(n,t,s,a,r,i){const l=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",o="tableContent";s[0]!==0&&(i.end=Object.assign({},fn(t.events,s[0])),n.add(s[0],0,[["exit",i,t]]));const c=fn(t.events,s[1]);if(i={type:l,start:Object.assign({},c),end:Object.assign({},c)},n.add(s[1],0,[["enter",i,t]]),s[2]!==0){const d=fn(t.events,s[2]),u=fn(t.events,s[3]),h={type:o,start:Object.assign({},d),end:Object.assign({},u)};if(n.add(s[2],0,[["enter",h,t]]),a!==2){const p=t.events[s[2]],m=t.events[s[3]];if(p[1].end=Object.assign({},m[1].end),p[1].type="chunkText",p[1].contentType="text",s[3]>s[2]+1){const g=s[2]+1,f=s[3]-s[2]-1;n.add(g,f,[])}}n.add(s[3]+1,0,[["exit",h,t]])}return r!==void 0&&(i.end=Object.assign({},fn(t.events,r)),n.add(r,0,[["exit",i,t]]),i=void 0),i}function Xa(n,t,s,a,r){const i=[],l=fn(t.events,s);r&&(r.end=Object.assign({},l),i.push(["exit",r,t])),a.end=Object.assign({},l),i.push(["exit",a,t]),n.add(s+1,0,i)}function fn(n,t){const s=n[t],a=s[0]==="enter"?"start":"end";return s[1][a]}const fx={name:"tasklistCheck",tokenize:xx};function gx(){return{text:{91:fx}}}function xx(n,t,s){const a=this;return r;function r(c){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?s(c):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(c),n.exit("taskListCheckMarker"),i)}function i(c){return de(c)?(n.enter("taskListCheckValueUnchecked"),n.consume(c),n.exit("taskListCheckValueUnchecked"),l):c===88||c===120?(n.enter("taskListCheckValueChecked"),n.consume(c),n.exit("taskListCheckValueChecked"),l):s(c)}function l(c){return c===93?(n.enter("taskListCheckMarker"),n.consume(c),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),o):s(c)}function o(c){return J(c)?t(c):ie(c)?n.check({tokenize:yx},t,s)(c):s(c)}}function yx(n,t,s){return le(n,a,"whitespace");function a(r){return r===null?s(r):t(r)}}function vx(n){return gi([$g(),ex(),ox(n),hx(),gx()])}const wx={};function jx(n){const t=this,s=n||wx,a=t.data(),r=a.micromarkExtensions||(a.micromarkExtensions=[]),i=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);r.push(vx(s)),i.push(Vg()),l.push(Wg(s))}const Le=window.React;function kx(n){return(n||"").replace(/\[\[([^\|\]]+)(?:\|([^\]]+))?\]\]/g,(t,s,a)=>"["+(a||s)+"](mover-wiki://"+encodeURIComponent(String(s).trim())+")")}let pn=null;function Ya(n){return!n||/^([a-zA-Z]:[\\/]|\/)/.test(n)?Promise.resolve(n):pn!=null?Promise.resolve((pn?pn.replace(/\/+$/,"")+"/":"")+n):fetch("/api/health").then(t=>t.json()).then(t=>(pn=t&&t.vault||"",(pn?pn.replace(/\/+$/,"")+"/":"")+n)).catch(()=>n)}function bx(n,t,s){if(!n)return;const a=s||{};window.dispatchEvent(new CustomEvent("mfileview",{detail:{path:n,anchor:t||"",root:a.root||"vault",line:a.line!=null?a.line:null}}))}function Nx(){const[n,t]=Le.useState(null),[s,a]=Le.useState(""),[r,i]=Le.useState("vault"),[l,o]=Le.useState(null),[c,d]=Le.useState(!1),[u,h]=Le.useState(""),[p,m]=Le.useState(null),[g,f]=Le.useState(!1),[v,x]=Le.useState(null),b=Le.useRef(null);Le.useEffect(()=>{const E=w=>{const N=w&&w.detail||{};N.path&&(t(N.path),a(N.anchor||""),i(N.root||"vault"),o(N.line!=null?N.line:null),d(!0))},L=w=>{w.key==="Escape"&&d(!1)};return window.addEventListener("mfileview",E),window.addEventListener("keydown",L),()=>{window.removeEventListener("mfileview",E),window.removeEventListener("keydown",L)}},[]),Le.useEffect(()=>{if(!n){h(""),m(null),x(null);return}let E=!1;return f(!0),x(null),(r&&r!=="vault"?Promise.resolve(n):Ya(n)).then(L=>fetch("/api/file/read?path="+encodeURIComponent(L)+(r&&r!=="vault"?"&root="+encodeURIComponent(r):""))).then(L=>L.json()).then(L=>{if(!E){if(!L||!L.ok){x(L&&L.error||"Couldn't read this file."),h("");return}h(kx(L.content||"")),m({mtime:L.mtime,size:L.size})}}).catch(L=>{E||x(L&&L.message?L.message:"Network error")}).finally(()=>{E||f(!1)}),()=>{E=!0}},[n,r]),Le.useEffect(()=>{if(g||!u||!s&&l==null)return;const E=setTimeout(()=>{const L=b.current;if(!L)return;let w=null;if(s){const N=P=>String(P||"").replace(/[#*_`>\[\]()|-]/g," ").replace(/\s+/g," ").trim().toLowerCase(),C=N(s).slice(0,120);if(C){const P=L.querySelectorAll("p, li, h1, h2, h3, h4, h5, h6, td, blockquote, code, span.m-fview-ln");for(const M of P)if(N(M.textContent).includes(C)){w=M;break}}}!w&&l!=null&&(w=L.querySelector('[data-fline="'+l+'"]')),w&&(w.classList.add("m-fview-hit"),w.scrollIntoView({block:"center"}),setTimeout(()=>{try{w.classList.remove("m-fview-hit")}catch{}},3200))},80);return()=>clearTimeout(E)},[g,u,s,l]);const j=()=>d(!1),A=()=>{n&&Promise.all([Ya(n),fetch("/api/health").then(E=>E.json())]).then(([E,L])=>fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":L&&L.token},body:JSON.stringify({filePath:E})})).catch(E=>console.warn("open in obsidian failed",E))},I=E=>{try{const L=(n||"").replace(/\/[^/]+$/,"");t(L+"/"+E+".md"),a("")}catch{}},k=n?n.split("/").pop()||n:"",S=p?Math.round((p.size||0)/1024*10)/10:null;return e.jsxs("div",{className:"m-fview-root","aria-hidden":!c,style:{pointerEvents:c?"auto":"none"},children:[e.jsx("div",{className:"m-fview-scrim"+(c?" is-open":""),onClick:j}),e.jsxs("aside",{className:"m-fview"+(c?" is-open":""),role:"dialog","aria-label":"Viewing "+k,children:[e.jsxs("header",{className:"m-fview-head",children:[e.jsxs("div",{className:"m-fview-head-l",children:[e.jsxs("div",{className:"m-kicker m-fview-kicker",children:[MIcons.file(12)," Viewing your vault"]}),e.jsx("div",{className:"m-fview-name",children:k}),p?e.jsxs("div",{className:"m-fview-meta m-mono",children:[S," KB",p.mtime?" · modified "+p.mtime.slice(0,10):""]}):null]}),e.jsxs("div",{className:"m-fview-head-r",children:[r==="vault"?e.jsx("button",{className:"m-fview-ext",onClick:A,children:"Edit in Obsidian ↗"}):null,e.jsx("button",{className:"m-fview-close",onClick:j,"aria-label":"Close",children:MIcons.x(15)})]})]}),e.jsxs("div",{className:"m-fview-path m-mono",children:[n,l!=null?" · line "+l:s?" · "+s:""]}),e.jsxs("div",{className:"m-fview-body",ref:b,children:[g?e.jsx("div",{className:"m-fview-state",children:"Reading the file…"}):null,v?e.jsx("div",{className:"m-fview-state is-err",children:v}):null,!g&&!v&&u?/\.md$/i.test(n||"")?e.jsx("article",{className:"m-fview-prose",children:e.jsx(of,{remarkPlugins:[jx],components:{a:({href:E,children:L,...w})=>{if(typeof E=="string"&&E.indexOf("mover-wiki://")===0){const N=decodeURIComponent(E.slice(13));return e.jsx("button",{type:"button",className:"m-fview-wiki",onClick:()=>I(N),children:L})}return e.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",...w,children:L})}},children:u})}):e.jsx("pre",{className:"m-fview-code m-mono",children:u.split(`
|
|
160
|
+
`).map((E,L)=>e.jsx("span",{className:"m-fview-ln","data-fline":L+1,children:E+`
|
|
161
|
+
`},L))}):null,!g&&!v&&!u&&n?e.jsx("div",{className:"m-fview-state",children:"This file is empty."}):null]}),e.jsx("p",{className:"m-fview-oath",children:r==="vault"?"This is the real file in your vault, shown exactly as it's saved. Nothing here is a number we made up.":"This is the real file on disk, shown exactly as it's saved. Nothing here is a number we made up."})]})]})}Object.assign(window,{FileViewerDrawer:Nx,openFileView:bx});const qa={live:{label:"parser live",tone:"good"},partial:{label:"parser partial",tone:"warn"},planned:{label:"parser planned",tone:"mute"}},Ua={live:{label:"live now",cls:"is-live",color:"var(--m-gold-2)"},ok:{label:"fresh",cls:"is-good",color:"var(--m-good)"},stale:{label:"stale",cls:"is-warn",color:"var(--m-warn)"}};function Sx(){const[n,t]=window.React.useState(null),[s,a]=window.React.useState(!1),[r,i]=window.React.useState(null),l=window.React.useRef(null),o=window.React.useRef(null);window.React.useEffect(()=>{const j=I=>{o.current=document.activeElement,t(I.detail),i(null),requestAnimationFrame(()=>a(!0))},A=I=>{I.key==="Escape"&&a(!1)};return window.addEventListener("mxray",j),window.addEventListener("keydown",A),()=>{window.removeEventListener("mxray",j),window.removeEventListener("keydown",A)}},[]),window.React.useEffect(()=>{if(s){const A=setTimeout(()=>{l.current&&l.current.focus()},60);return()=>clearTimeout(A)}const j=o.current;j&&document.contains(j)&&typeof j.focus=="function"&&j.focus()},[s]);const c=()=>a(!1);if(!n)return null;const{claim:d,value:u,src:h}=n,p=qa[h.status]||qa.planned,m=Ua[h.fresh||(h.status==="planned"?"stale":"ok")]||Ua.ok,g=(j,A)=>{i({k:j,line:A})},f=()=>{if(!h.workflow){g("run","No workflow is wired to this source yet.");return}g("run","Starting "+h.workflow+"…"),fetch("/api/health").then(j=>j.json()).then(j=>fetch("/api/workflow/run",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":j&&j.token},body:JSON.stringify({workflow:h.workflow,agent:"claude-code"})})).then(j=>{if(!j.ok)throw new Error("HTTP "+j.status);g("run",h.workflow+" is running for real. Watch it in Run.")}).catch(j=>{console.warn("xray run failed",j),g("run","Could not start "+h.workflow+". Nothing ran.")})},v=()=>{const j='About this claim: "'+d+'" (source: '+(h.path||h.anchor||"the record")+"). Is it right, and what should I do with it?";window.dispatchEvent(new CustomEvent("v8chat-prefill",{detail:j})),window.dispatchEvent(new CustomEvent("m4-nav",{detail:"chat"})),c()},x=()=>{h.path&&openFileView(h.path,h.anchor)},b=()=>{h.path&&fetch("/api/health").then(j=>j.json()).then(j=>{const A=j&&j.vault||"",I=/^([a-zA-Z]:[\\/]|\/)/.test(h.path)?h.path:(A?A.replace(/\/+$/,"")+"/":"")+h.path;return fetch("/api/file/open",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":j&&j.token},body:JSON.stringify({filePath:I})})}).catch(j=>console.warn("open in obsidian failed",j))};return e.jsxs("div",{"aria-hidden":!s,style:{pointerEvents:s?"auto":"none"},children:[e.jsx("div",{className:"m-xray-scrim"+(s?" is-open":""),onClick:c}),e.jsxs("aside",{className:"m-xray"+(s?" is-open":""),role:"dialog","aria-label":"Where this comes from",tabIndex:-1,ref:l,children:[e.jsxs("div",{className:"m-xray-head",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"m-kicker",style:{display:"flex",alignItems:"center",gap:8,marginBottom:9},children:[MIcons.xray(13)," Where this comes from"]}),e.jsx("h2",{className:"m-xray-claim",children:d}),u?e.jsx("p",{style:{marginTop:6,fontSize:14,color:"var(--m-ink-2)"},children:u}):null,e.jsxs("p",{className:"m-xray-provline",children:[e.jsx(Conf,{n:h.confidence}),e.jsx("span",{className:"sep","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"m-dot is-"+(p.tone==="good"?"good":p.tone==="warn"?"warn":"off")}),e.jsx("span",{className:"m-mono",children:h.parser}),e.jsx("span",{className:"sep","aria-hidden":"true",children:"·"}),e.jsx("span",{style:{color:m.color},children:m.label}),h.workflow?e.jsxs(React.Fragment,{children:[e.jsx("span",{className:"sep","aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["written by ",e.jsx("span",{className:"m-mono",children:h.workflow})]})]}):null]})]}),e.jsx("button",{className:"m-xray-close",onClick:c,"aria-label":"Close",children:MIcons.x(15)})]}),e.jsxs("div",{className:"m-xray-body",children:[e.jsxs("div",{className:"m-xray-file",children:[e.jsxs("div",{className:"m-xray-file-bar",children:[MIcons.file(14),e.jsx("span",{className:"m-path",style:{color:"var(--m-ink-1)"},children:h.path}),e.jsx(CopyPathBtn,{path:h.path}),h.updated&&!/^unknown$/i.test(String(h.updated).trim())?e.jsx("span",{className:"m-chip is-mute",style:{marginLeft:"auto"},children:h.updated}):null]}),e.jsxs("div",{className:"m-xray-excerpt",children:[h.anchor?e.jsx("div",{className:"m-xray-anchor",children:h.anchor}):null,h.excerpt]}),e.jsxs("button",{className:"m-xray-readfull",onClick:x,disabled:!h.path,children:[MIcons.file(14)," Read the full file",e.jsx("span",{className:"m-xray-readfull-sub m-mono",children:h.path?h.path.split("/").pop():"no file recorded"}),e.jsx("span",{className:"m-xray-readfull-arr",children:"→"})]})]}),h.changed?e.jsxs("div",{className:"m4-xchanged",children:[e.jsx("div",{className:"k",children:"What changed because of it"}),h.changed]}):null,h.emptyState&&h.status!=="live"?e.jsxs("div",{style:{fontSize:12,color:"var(--m-ink-3)",lineHeight:1.55},children:[e.jsx("span",{style:{color:"var(--m-ink-2)"},children:"If this source were empty:"})," ",h.emptyState]}):null,e.jsxs("div",{className:"m-xray-foot",children:[e.jsxs("button",{className:"m-xray-footact",onClick:b,disabled:!h.path,children:[MIcons.file(13)," Edit in Obsidian"]}),h.workflow?e.jsxs("button",{className:"m-xray-footact",onClick:f,children:[MIcons.play(13)," Run ",e.jsx("span",{className:"m-mono",children:h.workflow})]}):null,e.jsxs("button",{className:"m-xray-footact",onClick:v,children:[MIcons.agent(13)," Ask about this"]})]}),r?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,padding:"2px 4px 0",fontSize:12.5,color:"var(--m-good)"},children:[MIcons.check(13)," ",e.jsx("span",{style:{color:"var(--m-ink-2)"},children:r.line})]}):null,e.jsx("p",{style:{fontSize:11.5,lineHeight:1.6,color:"var(--m-ink-3)",margin:0},children:"Nothing here is a number we made up."})]})]})]})}Object.assign(window,{XrayDrawer:Sx});const ve=window.React;function Cx(n){try{const t=Math.max(0,(Date.now()-new Date(n).getTime())/1e3);if(t<90)return"just now";const s=t/60;if(s<60)return Math.round(s)+"m ago";const a=s/60;if(a<24)return Math.round(a)+"h ago";const r=a/24;if(r<7)return Math.round(r)+"d ago";const i=r/7;if(i<4)return Math.round(i)+"w ago";const l=new Date(n),o=new Date;return l.toLocaleDateString(void 0,l.getFullYear()===o.getFullYear()?{day:"numeric",month:"short"}:{day:"numeric",month:"short",year:"numeric"})}catch{return""}}function Tx(){const[n,t]=ve.useState(!1),[s,a]=ve.useState(null),[r,i]=ve.useState(!1),[l,o]=ve.useState(null),[c,d]=ve.useState(0),u=ve.useRef(null),h=ve.useCallback(()=>{i(!0),o(null),fetch("/api/recent?limit=12").then(m=>m.json()).then(m=>{if(!m||!m.ok){o(m&&m.error||"Couldn't load recent writes."),a([]);return}const g=m.files||[];a(g);const f=Date.now()-24*3600*1e3;d(g.filter(v=>new Date(v.mtime).getTime()>f).length)}).catch(m=>{o(m&&m.message?m.message:"Network error"),a([])}).finally(()=>i(!1))},[]);ve.useEffect(()=>{h()},[h]),ve.useEffect(()=>{if(!n)return;h();const m=f=>{u.current&&!u.current.contains(f.target)&&t(!1)},g=f=>{f.key==="Escape"&&t(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",g)}},[n,h]);const p=m=>{t(!1),openFileView(m.path)};return e.jsxs("div",{className:"m-bell",ref:u,children:[e.jsxs("button",{className:"m-bell-btn"+(n?" is-open":""),onClick:()=>t(m=>!m),title:"What just changed","aria-label":"What just changed","aria-expanded":n,children:[MIcons.bell(16),c>0?e.jsx("span",{className:"m-bell-dot","aria-hidden":"true"}):null]}),n?e.jsxs("div",{className:"m-bell-pop",role:"menu",children:[e.jsxs("div",{className:"m-bell-head",children:[e.jsx("span",{className:"m-kicker",children:"What just changed"}),e.jsx("span",{className:"m-bell-sub",children:"your Engine files, newest first"})]}),e.jsxs("div",{className:"m-bell-list",children:[r&&s==null?e.jsx("div",{className:"m-bell-state",children:"Looking…"}):null,l?e.jsx("div",{className:"m-bell-state is-err",children:l}):null,s&&s.length===0&&!r?e.jsx("div",{className:"m-bell-state",children:"Nothing written yet."}):null,s&&s.map((m,g)=>e.jsxs("button",{className:"m-bell-row",role:"menuitem",onClick:()=>p(m),title:m.path,children:[MIcons.file(13),e.jsx("span",{className:"m-bell-name",children:m.name.replace(/\.md$/,"")}),e.jsx("span",{className:"m-bell-time m-mono",children:Cx(m.mtime)})]},g))]}),e.jsx("div",{className:"m-bell-foot m-mono",children:"02_Areas/Engine/"})]}):null]})}const Rx=[{id:"home",k:"Home"},{id:"chat",k:"Chat"},{id:"strategy",k:"Strategy"},{id:"evidence",k:"Evidence"},{id:"library",k:"Library"},{id:"run",k:"Run"},{id:"configure",k:"Settings"}],Ex=[["Blocking","Blocks me"],["Annoying","Annoying"],["Cosmetic","Small thing"]];function Ix({route:n}){const[t,s]=ve.useState(!1),[a,r]=ve.useState("bug"),[i,l]=ve.useState(""),[o,c]=ve.useState("idle"),[d,u]=ve.useState(""),[h,p]=ve.useState(!0),[m,g]=ve.useState("app"),[f,v]=ve.useState("Annoying"),x=(window.V3&&Array.isArray(window.V3.routes)&&window.V3.routes.length?window.V3.routes:Rx).map(E=>({id:E.id,k:E.k})),b=(x.find(E=>E.id===m)||{}).k||"",[j,A]=ve.useState([]),I=ve.useRef(null);ve.useEffect(()=>{if(!t)return;const E=w=>{I.current&&!I.current.contains(w.target)&&s(!1)},L=w=>{w.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",L)}},[t]);const k=async()=>{if(!(!i.trim()||o==="sending")){c("sending");try{const E=await(await fetch("/api/health")).json(),L=await(await fetch("/api/report",{method:"POST",headers:{"Content-Type":"application/json","X-Mover-Token":E&&E.token},body:JSON.stringify({type:a,description:i.trim(),...a!=="comment"?{where:m}:{},...a==="bug"?{severity:f}:{},...a==="bug"&&h&&j.length?{errors:j}:{}})})).json();L&&L.ok&&L.delivered?(c("sent"),l("")):(c("failed"),u(L&&L.error||"Couldn't reach the developer's server."))}catch{c("failed"),u("Couldn't reach the local server.")}}},S=()=>{try{navigator.clipboard.writeText(`[${a}]${a!=="comment"&&m!=="app"&&b?` (${b} screen)`:""} ${i.trim()}`)}catch{}};return e.jsxs("div",{className:"m-bell",ref:I,children:[e.jsx("button",{className:"m-ghost"+(t?" is-open":""),onClick:()=>{s(E=>!E),c("idle"),A([...window.__moverErrs||[]]),g(n&&x.some(E=>E.id===n)?n:"app")},title:"Report a problem or send an idea to the developer","aria-expanded":t,children:"Report"}),t?e.jsxs("div",{className:"m-bell-pop m-report-pop",role:"dialog","aria-label":"Report to the developer",children:[e.jsxs("div",{className:"m-bell-head",children:[e.jsx("span",{className:"m-kicker",children:"Report to the developer"}),e.jsx("span",{className:"m-bell-sub",children:"read by the person who builds this"})]}),o==="sent"?e.jsxs("div",{className:"m-report-body",children:[e.jsx("p",{className:"m-report-done",children:"Sent. Thank you, every report gets read."}),e.jsx("button",{className:"m-mini",onClick:()=>{c("idle")},children:"Send another"})]}):e.jsxs("div",{className:"m-report-body",children:[e.jsx("div",{className:"m-report-kinds",role:"radiogroup","aria-label":"What kind",children:[["bug","Something broke"],["feature","An idea"],["comment","A comment"]].map(([E,L])=>e.jsx("button",{className:"m-mini"+(a===E?" is-on":""),role:"radio","aria-checked":a===E,onClick:()=>r(E),children:L},E))}),a!=="comment"?e.jsxs("label",{className:"m-report-where",children:[e.jsx("span",{children:a==="bug"?"Where it broke":"Which screen it's about"}),e.jsxs("select",{value:m,onChange:E=>g(E.target.value),children:[x.map(E=>e.jsxs("option",{value:E.id,children:[E.k,E.id===n?" (this screen)":""]},E.id)),e.jsx("option",{value:"app",children:"Not one screen"})]})]}):null,a==="bug"?e.jsx("div",{className:"m-report-kinds m-report-sev",role:"radiogroup","aria-label":"How bad",children:Ex.map(([E,L])=>e.jsx("button",{className:"m-mini"+(f===E?" is-on":""),role:"radio","aria-checked":f===E,onClick:()=>v(E),children:L},E))}):null,e.jsx("textarea",{className:"m-report-text",rows:4,value:i,placeholder:a==="bug"?m!=="app"&&b?`On ${b}: what did you click, what did you expect, what happened instead?`:"What did you do, what did you expect, what happened instead?":"What happened, in your words. What you expected helps too.",onChange:E=>l(E.target.value)}),a==="bug"&&j.length?e.jsxs("div",{className:"m-report-errwrap",children:[e.jsxs("label",{className:"m-report-errs",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:E=>p(E.target.checked)}),"Attach these technical details (",j.length," error",j.length>1?"s":""," this session, auto-redacted). Please read them before sending:"]}),h?e.jsx("ul",{className:"m-report-errlines",children:j.map((E,L)=>e.jsx("li",{children:E},L))}):null]}):null,o==="failed"?e.jsxs("p",{className:"m-report-fail",children:[d," ",e.jsx("button",{className:"m-mini",onClick:S,children:"Copy it instead"})]}):null,e.jsxs("div",{className:"m-report-foot",children:[e.jsx("button",{className:"m-cta m-report-send",disabled:!i.trim()||o==="sending",onClick:k,children:o==="sending"?"Sending…":"Send"}),e.jsxs("span",{className:"m-report-priv",children:["Sent with it: app version, platform, agent names",a!=="comment"?", the screen name above":"",". Never your files."]})]})]})]}):null]})}Object.assign(window,{BellMenu:Tx,ReportMenu:Ix});const st={new:{label:"New",sub:"days 1–3",day:2,streak:1,sparse:!0,routes:["home","chat","strategy","run"],note:"Just getting started, only the essentials are showing."},growing:{label:"Growing",sub:"days 4–7",day:6,streak:5,sparse:!1,routes:["home","chat","strategy","evidence","run"],note:"More of the dashboard is unlocking as you use it."},full:{label:"Full",sub:"day 8+",day:41,streak:9,sparse:!1,routes:["home","chat","strategy","evidence","library","run","configure"],note:"The complete dashboard. Everything is on."}},Ot=["new","growing","full"];function Mx({route:n,onPalette:t,rollout:s,setRollout:a,onTour:r,realDay:i}){const l=window.V3.routes.find(u=>u.id===n),o=st[s]||st.full,c=i??o.day,d=()=>{const u=Ot.indexOf(s);a(Ot[(u+1)%Ot.length])};return e.jsxs("header",{className:"m-top",children:[e.jsx("span",{className:"m-top-route",children:l?l.k:""}),e.jsxs("span",{className:"m-top-date",children:[window.V3.date," · Day ",e.jsx("span",{className:"m-num",children:c})]}),n!=="home"?e.jsx(SayItPinned,{onOpen:t}):null,e.jsxs("div",{className:"m-top-right",children:[e.jsx(ReportMenu,{route:n}),e.jsx(BellMenu,{}),(()=>{try{return localStorage.getItem("m4.dev")==="1"}catch{return!1}})()?e.jsxs("button",{className:"m-ghost",onClick:d,title:"Dev preview of the staged rollout: how much of the dashboard a new operator sees vs an experienced one. Click to cycle.",children:[MIcons.moon(14)," ",o.label," · ",o.sub]}):null,e.jsxs("button",{className:"m-ghost",onClick:r,title:"Restart the walkthrough",children:[MIcons.spark(14)," Show me around"]})]})]})}function Ax(){const n=window.__moverStateError,[t,s]=React.useState(!1);return!n||t?null:e.jsxs("div",{role:"alert",style:{position:"fixed",left:"50%",bottom:18,transform:"translateX(-50%)",zIndex:90,display:"flex",alignItems:"center",gap:12,padding:"10px 16px",borderRadius:12,background:"var(--m-card, #15120e)",border:"1px solid rgba(217, 128, 105, 0.35)",boxShadow:"0 12px 32px -12px rgba(0,0,0,0.8)",fontSize:13,color:"var(--m-ink-1)"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:99,background:"var(--m-crit, #d98069)",flex:"0 0 auto"}}),e.jsxs("span",{children:[n," What you see is placeholder, not your record."]}),e.jsx("button",{className:"m-link",style:{color:"var(--m-gold-2)"},onClick:()=>location.reload(),children:"Retry"}),e.jsx("button",{"aria-label":"Close",className:"m-link",style:{color:"var(--m-ink-3)",padding:"2px 4px"},onClick:()=>s(!0),children:"×"})]})}function Lx(){const[n,t]=useTweaks({rollout:window.__moverRollout??"full",accent:"gold",glow:1,motion:!0,agent:"connected"}),[s,a]=useStored3("m4.route","home");React.useEffect(()=>{const O=U=>{U&&U.detail&&a(String(U.detail))},W=U=>{U&&U.detail&&(window.__v8chatPrefill=String(U.detail))};return window.addEventListener("m4-nav",O),window.addEventListener("v8chat-prefill",W),()=>{window.removeEventListener("m4-nav",O),window.removeEventListener("v8chat-prefill",W)}},[a]),React.useEffect(()=>{let O=null;const W=600*1e3,U=()=>{if(document.visibilityState==="hidden"){O=Date.now();return}if(!O||Date.now()-O<W){O=null;return}O=null;const K=window.__m6routeNow||"";K==="chat"||K==="run"||window.__moverChatLive||document.querySelector(".v6j-scrim, .v5o-scrim, .m-xray-scrim.is-open, .m-fview-scrim.is-open, .m-pal-scrim")||location.reload()};return document.addEventListener("visibilitychange",U),()=>document.removeEventListener("visibilitychange",U)},[]);const[r,i]=useStored3("m4.guided.done",!1),[l,o]=useStored3("m5.setup.done",!1),[c,d]=useStored3("m6.no.mode","active"),[u,h]=React.useState(()=>{try{return JSON.parse(localStorage.getItem("m6.check.urgent"))===!0}catch{return!1}}),[p,m]=React.useState(!1),[g,f]=React.useState(null),[v,x]=React.useState(!1),[b,j]=React.useState(null),[A,I]=React.useState(!1),[k,S]=React.useState(()=>{try{return new URLSearchParams(window.location.search).get("onboarding")==="1"}catch{return!1}}),E=st[n.rollout]?n.rollout:"full",L=st[E],w=L.sparse,N=L.routes,C=w?Object.assign({},window.V3,window.V3SPARSE):window.V3,P=w?Object.assign({},window.V4,window.V4SPARSE.home):window.V4,M=window.V3&&window.V3.day!=null?Math.max(1,window.V3.day):L.day,T=window.V3?window.V3.streakNum!=null?window.V3.streakNum:null:L.streak,F=Object.assign({},C,{day:M,streak:T,__v4:Object.assign({},P,{day:M,streak:T}),__sparse:w,__rollout:E}),D=useFocusSession(F.__v4.runNext);React.useEffect(()=>{N.includes(s)||a("home")},[E]),React.useEffect(()=>{const O=W=>{(W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="k"&&(W.preventDefault(),m(U=>!U))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[]),React.useEffect(()=>{const O=()=>m(!1);return window.addEventListener("m6journal",O),()=>window.removeEventListener("m6journal",O)},[]),React.useEffect(()=>{let O=!0;return fetch("/api/agents/detect").then(W=>W.json()).then(W=>{if(!O)return;const U=W&&Array.isArray(W.agents)?W.agents:[],K=U.find(xe=>xe&&xe.id==="claude-code");K&&K.present&&!K.authed?f("authRequired"):f(U.some(xe=>xe&&xe.runnable))}).catch(()=>{O&&f(!1)}),(async()=>{let W=!1,U=!1;try{const K=await(await fetch("/api/health")).json();W=!!(K&&K.enginePresent)}catch{W=!1}try{const K=await(await fetch("/api/config")).json();U=!!(K&&K.config&&K.config.onboardingSkipped)}catch{}if(O&&(j(W),I(U),!W&&!U))try{localStorage.getItem("m5.setup.done")==="true"&&o(!1)}catch{}})(),()=>{O=!1}},[]),React.useEffect(()=>{!l&&b===!0&&!k&&o(!0)},[b,l,k]);const Y=N.includes(s)?s:"home";window.__m6routes=N,window.__m6roll=E,window.__m6routeNow=Y;const z={home:HomeView,strategy:window.StrategyViewV9||window.StrategyViewV8||StrategyView,evidence:window.EvidenceViewV9||window.EvidenceViewV8||EvidenceView,library:window.LibraryViewV8||LibraryView,run:window.RunViewV8||RunView,configure:window.ConfigureViewV8||ConfigureView,chat:()=>null}[Y]||HomeView,[y,V]=React.useState(!1);React.useEffect(()=>{s==="chat"&&V(!0)},[s]);const H=!r&&l,R=()=>{o(!0),i(!0),t("rollout","new"),a("home")},Q=React.useCallback(()=>{try{localStorage.setItem("m4.runlens",JSON.stringify("start")),localStorage.setItem("m4.liblens",JSON.stringify("index")),localStorage.setItem("m4.evlens",JSON.stringify("proof"))}catch{}i(!1),a("home")},[]);React.useEffect(()=>{const O=()=>i(!0);return window.addEventListener("m4tour",Q),window.addEventListener("m4tour-off",O),()=>{window.removeEventListener("m4tour",Q),window.removeEventListener("m4tour-off",O)}},[Q]);const[je,se]=React.useState(!1),ke=React.useRef(!1);return React.useEffect(()=>{const O=()=>se(!0);return window.addEventListener("m4bump",O),()=>window.removeEventListener("m4bump",O)},[]),React.useEffect(()=>{if(D.state!=="running"){ke.current=!1;return}(s==="library"||s==="configure")&&!ke.current&&(ke.current=!0,se(!0))},[s,D.state]),e.jsxs("div",{className:"m-app","data-maccent":n.accent!=="gold"?n.accent:null,"data-mmotion":n.motion?null:"off",style:{"--m-glow":n.glow},children:[e.jsx(Rail,{route:Y,onNav:a,routes:N}),e.jsxs("div",{className:"m-maincol",children:[e.jsx(Mx,{route:Y,onPalette:()=>m(!0),rollout:E,setRollout:O=>t("rollout",O),onTour:Q,realDay:M}),e.jsx("main",{className:"m-scroll",style:Y==="chat"?{display:"none"}:null,"aria-hidden":Y==="chat"?!0:void 0,children:e.jsx(z,{D:F,onNav:a,onPalette:()=>m(!0),focus:D,rollout:E})},Y+"-"+E),y&&window.ChatViewV8?e.jsx("main",{className:"m-scroll",style:{display:Y==="chat"?"":"none"},"aria-hidden":Y==="chat"?void 0:!0,children:e.jsx(window.ChatViewV8,{})}):null]}),e.jsx(FocusOverlay,{focus:D,D4:F.__v4}),e.jsx(SealRitual,{}),e.jsx(SpeedBump,{open:je,onClose:()=>se(!1),onReturn:()=>{se(!1),a("home"),D.state==="idle"?D.start():D.openOverlay()}}),H?e.jsx(GuidedMode,{route:Y,onNav:a,onFinish:()=>i(!0),allowed:N}):null,!l&&(k||b===!1&&!A)?e.jsx(OnboardingFlow,{agentConnected:n.agent==="none"?!1:g,onFinish:R,onWalkthrough:()=>{R(),x(!0)},onTour:()=>{S(!1),o(!0),i(!1)}}):null,v?e.jsx(WalkthroughFlow,{onFinish:()=>x(!1)}):null,e.jsx(SayItOverlay,{open:p,onClose:()=>m(!1),onNav:a}),e.jsx(JournalHost,{onNav:a}),e.jsx(V6ToastHost,{}),e.jsx(XrayDrawer,{}),e.jsx(FileViewerDrawer,{}),e.jsx(Ax,{}),e.jsxs(TweaksPanel,{title:"Tweaks",children:[e.jsxs(TweakSection,{label:"How much is unlocked",children:[e.jsx(TweakRadio,{label:"Rollout",value:E,options:[{value:"new",label:"New"},{value:"growing",label:"Growing"},{value:"full",label:"Full"}],onChange:O=>t("rollout",O)}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:L.note})]}),e.jsx(TweakSection,{label:"Walkthrough",children:e.jsx(TweakButton,{label:"Show me around again",onClick:()=>i(!1),secondary:!0})}),e.jsxs(TweakSection,{label:"First open",children:[e.jsx(TweakRadio,{label:"Agent",value:n.agent==="none"?"none":"connected",options:[{value:"connected",label:"Connected"},{value:"none",label:"None yet"}],onChange:O=>t("agent",O)}),e.jsx(TweakButton,{label:"Replay first-open setup",onClick:()=>{S(!0),o(!1)},secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:n.agent==="none"?"Setup runs as a plain form, with a connect step, never blocked on an agent.":"Setup runs as a guided back-and-forth with your agent."})]}),e.jsxs(TweakSection,{label:"Journal",children:[e.jsx(TweakButton,{label:"Open the evening close",onClick:()=>v6OpenJournal("evening"),secondary:!0}),e.jsx(TweakButton,{label:"Open the morning prime",onClick:()=>v6OpenJournal("morning"),secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"The evening close also opens from “Close the day” in the Say it box."})]}),e.jsxs(TweakSection,{label:"The standing no",children:[e.jsx(TweakRadio,{label:"State",value:c,options:[{value:"active",label:"Holding"},{value:"rest",label:"At rest"}],onChange:O=>{d(O),window.dispatchEvent(new CustomEvent("m6no-mode",{detail:O}))}}),e.jsx(TweakButton,{label:"Reset heard / overridden",onClick:()=>{try{localStorage.removeItem("m6.no.heard"),localStorage.removeItem("m6.no.overrode")}catch{}window.dispatchEvent(new CustomEvent("m6no-changed"))},secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"“At rest” hides the strip entirely, a no is never invented, and an empty one is never shown."})]}),e.jsxs(TweakSection,{label:"Record check",children:[e.jsx(TweakRadio,{label:"Urgent example",value:u?"on":"off",options:[{value:"off",label:"None (default)"},{value:"on",label:"Show one"}],onChange:O=>{h(O==="on");try{localStorage.setItem("m6.check.urgent",JSON.stringify(O==="on"))}catch{}window.dispatchEvent(new CustomEvent("m6check"))}}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"The record check lives in Settings → System. It reaches Home only for a genuinely urgent issue, this toggle demos that."})]}),e.jsxs(TweakSection,{label:"Views",children:[e.jsx(TweakButton,{label:"Open Rewind",onClick:()=>{a("evidence"),setTimeout(()=>window.dispatchEvent(new CustomEvent("m6rewind")),450)},secondary:!0}),e.jsx("p",{style:{margin:"8px 2px 0",fontSize:11.5,lineHeight:1.5,color:"var(--m-ink-3)"},children:"Rewind lives in Evidence, the small pill by “Said vs did.” The moves map is on Run."})]}),e.jsxs(TweakSection,{label:"Look & feel",children:[e.jsx(TweakRadio,{label:"Accent",value:n.accent,options:[{value:"gold",label:"Gold"},{value:"champagne",label:"Champ."},{value:"ember",label:"Ember"}],onChange:O=>t("accent",O)}),e.jsx(TweakSlider,{label:"Glow",min:0,max:1.6,step:.1,value:n.glow,onChange:O=>t("glow",O)}),e.jsx(TweakToggle,{label:"Motion",value:n.motion,onChange:O=>t("motion",O)})]})]})]})}ReactDOM.createRoot(document.getElementById("root")).render(e.jsx(Lx,{}));
|