@mavea/mavea 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +6 -2
- package/bin/mavea.mjs +40 -8
- package/dist/.vite/manifest.json +393 -393
- package/dist/assets/{AnnotationLayer-Cccb12ps.js → AnnotationLayer-BsAcAd59.js} +0 -0
- package/dist/assets/{AppCommandPalette-DdOPNZ0e.js → AppCommandPalette-Cucwjk5N.js} +1 -1
- package/dist/assets/{CheckLogRail-BibJTid0.js → CheckLogRail-vq2lZ7a5.js} +1 -1
- package/dist/assets/ConversationVideoStudio-Df892wqs.js +1 -0
- package/dist/assets/{CourseLessonReader-D29Kix4f.js → CourseLessonReader-DKQimh2S.js} +2 -2
- package/dist/assets/{CoursesApp-DcDsS_ZS.js → CoursesApp-LeqL6dWT.js} +1 -1
- package/dist/assets/{DashPresent-BDWgO9am.js → DashPresent-DZcRdu6R.js} +1 -1
- package/dist/assets/{DashboardDetail-BrnAdWfy.js → DashboardDetail-2XL-J4rS.js} +2 -2
- package/dist/assets/{DashboardLoopGate-NxMcQ4rD.js → DashboardLoopGate-B95S4oKR.js} +2 -2
- package/dist/assets/DashboardLoopRuntime-Wzk85QXi.js +1 -0
- package/dist/assets/{DashboardsApp-DxyMn3x_.js → DashboardsApp-ZGuT2QBi.js} +2 -2
- package/dist/assets/{DeepZoomApp-nNjqoyYE.js → DeepZoomApp-CPOsar8c.js} +1 -1
- package/dist/assets/{DelegatePanel-DN_ZL0j7.js → DelegatePanel-BkTtUMSl.js} +1 -1
- package/dist/assets/{DemoGallery-DrSlMsnu.js → DemoGallery-BcQ9yz2u.js} +1 -1
- package/dist/assets/{DropSelect-GwIXHA5o.js → DropSelect-GKioj__f.js} +1 -1
- package/dist/assets/{ExportModal-DBUjC71U.js → ExportModal-1pWr-c7I.js} +1 -1
- package/dist/assets/{ExtractionPreview-D4M6eXqb.js → ExtractionPreview-TKyfEqwM.js} +1 -1
- package/dist/assets/{FeatureUseNotice-Bda9jr3W.js → FeatureUseNotice-pQe4YHgJ.js} +1 -1
- package/dist/assets/{FlagshipCommandPalette-DAO849RC.js → FlagshipCommandPalette-D1pv3hfZ.js} +1 -1
- package/dist/assets/{FlagshipShowcase-g2x-1c70.js → FlagshipShowcase-CCFFcaL7.js} +1 -1
- package/dist/assets/{FlashcardsApp-BUKzCr65.js → FlashcardsApp-Dbe-8UkQ.js} +1 -1
- package/dist/assets/{GalleryApp-ot_A7ZF-.js → GalleryApp-CCLYcEqn.js} +1 -1
- package/dist/assets/{HonestByDesign-DgZFEpEx.js → HonestByDesign-ByOR1sRQ.js} +1 -1
- package/dist/assets/{HowItWorks-DPFpdeGE.js → HowItWorks-Dllc30ph.js} +1 -1
- package/dist/assets/{LegalApp-C56kWdmK.js → LegalApp-CpblxmmB.js} +1 -1
- package/dist/assets/{LegalMarkdownDocument-BBTHuW_M.js → LegalMarkdownDocument-CmxHsXlb.js} +1 -1
- package/dist/assets/{LegalPageShell-hMA-7JLf.js → LegalPageShell-CDD6D6T_.js} +1 -1
- package/dist/assets/{LibraryOverlay-DSUWcUe4.js → LibraryOverlay-CHmubwG3.js} +1 -1
- package/dist/assets/{LiveApp-B62EMybC.js → LiveApp-CSbjhgzM.js} +4 -4
- package/dist/assets/{LiveSettings-BITIaMoT.js → LiveSettings-B4T6x41n.js} +3 -3
- package/dist/assets/{MindMapViewerDrawer-CKdJtHno.js → MindMapViewerDrawer-BLRBWsTz.js} +1 -1
- package/dist/assets/{MindShape-B3lg_z4X.js → MindShape-CaDuLyGa.js} +1 -1
- package/dist/assets/{PinToDashboard-DpQjBLPa.js → PinToDashboard-ChK2Ou73.js} +1 -1
- package/dist/assets/{PlanReview-CrTbmMAd.js → PlanReview-Dg6VE0xF.js} +1 -1
- package/dist/assets/{PresentationDeck-CfYadu9V.js → PresentationDeck-oEd6TXdN.js} +1 -1
- package/dist/assets/{PrismApp-bRKK_3JA.js → PrismApp-Bju264hL.js} +2 -2
- package/dist/assets/{PrismBriefingPlayer-ChJj6hSS.js → PrismBriefingPlayer-BY0RREUu.js} +2 -2
- package/dist/assets/{PrismOverlay-Pp6ZKmTc.js → PrismOverlay-DOWyOUVW.js} +3 -3
- package/dist/assets/{PrismWorkbench-BCV7r4Oa.js → PrismWorkbench-9RonO2uv.js} +1 -1
- package/dist/assets/{PrivacyApp-A2Bu6LVd.js → PrivacyApp-CBPMqUEA.js} +1 -1
- package/dist/assets/{ReplayCard-B6NYiYzQ.js → ReplayCard-BnX73r9n.js} +2 -2
- package/dist/assets/{ReplayOverlay-BJKtJ-vc.js → ReplayOverlay-B-Ok0mEs.js} +1 -1
- package/dist/assets/{RippleApp-BXt7tenS.js → RippleApp-BnIUhIA0.js} +2 -2
- package/dist/assets/{RippleOverlay-BSxubBwj.js → RippleOverlay-C9W7uVOp.js} +2 -2
- package/dist/assets/{SeeDontRead-0He5hS2C.js → SeeDontRead-ByW9HnOj.js} +1 -1
- package/dist/assets/{ShareModal-xYdZWJxy.js → ShareModal-Mo-dkgAZ.js} +2 -2
- package/dist/assets/{ShipCourse-Dg6kCWyH.js → ShipCourse-CT_F9oJH.js} +1 -1
- package/dist/assets/{SignatureLoop-QPwB2oNN.js → SignatureLoop-DejFTZ-Y.js} +1 -1
- package/dist/assets/{SynthesisApp-DrCq6NDa.js → SynthesisApp-6W04mrMU.js} +2 -2
- package/dist/assets/{SynthesisOverlay-DCa-2Pz_.js → SynthesisOverlay-DDyFFiO8.js} +1 -1
- package/dist/assets/{TermsApp-zcPDYfuh.js → TermsApp-ZzlhrXhd.js} +1 -1
- package/dist/assets/{TopicCanvas-Bw4bMFpe.js → TopicCanvas-CkqP92SC.js} +2 -2
- package/dist/assets/{TourPrism-DbinDupp.js → TourPrism-Cng4h9Ly.js} +1 -1
- package/dist/assets/{TrackerTile-CrT9u1I4.js → TrackerTile-DuUsFQTj.js} +2 -2
- package/dist/assets/{TwoSurfaces-L0CDuyOZ.js → TwoSurfaces-BeYMvVuX.js} +1 -1
- package/dist/assets/{WorldOverlay-BcjqG1BR.js → WorldOverlay-DeVpS8HE.js} +1 -1
- package/dist/assets/{WowFeatures-CwBk4ZMO.js → WowFeatures-D58JgpLg.js} +1 -1
- package/dist/assets/{ZoomDeck-DlnesweX.js → ZoomDeck-CPG2XQhr.js} +1 -1
- package/dist/assets/{backup-685QrAjt.js → backup-CtEvuZoL.js} +1 -1
- package/dist/assets/canvas-Ct-O9Jok.js +1 -0
- package/dist/assets/{capture-DgJLQ_0-.js → capture-CgaD86-q.js} +1 -1
- package/dist/assets/{catalog-Db9GWM6N.js → catalog-DfIYAG3v.js} +1 -1
- package/dist/assets/{confirmAdd-CZ829Mbx.js → confirmAdd-CxWIORcu.js} +1 -1
- package/dist/assets/{dashboardEvents-CiayRLrH.js → dashboardEvents-D1OP4ARB.js} +1 -1
- package/dist/assets/{deepen-DAeHHFiI.js → deepen-BhP9OmH3.js} +1 -1
- package/dist/assets/{effort-jJe4iMIq.js → effort-Bqti44UZ.js} +1 -1
- package/dist/assets/{generateBeats-COflu5Zi.js → generateBeats-CtffeoEa.js} +1 -1
- package/dist/assets/{generateLive-DGwnpIip.js → generateLive-D5M8v38b.js} +1 -1
- package/dist/assets/{index-LiHcEJt_.js → index-CdUH6Eo9.js} +3 -3
- package/dist/assets/{kokoro-DXRj0KQX.js → kokoro-D15HDMcP.js} +1 -1
- package/dist/assets/{liveSchema-DyfND6P2.js → liveSchema-B8Y9HZxd.js} +1 -1
- package/dist/assets/{loader-DgMLGfAC.js → loader-ChcXMM9W.js} +2 -2
- package/dist/assets/{notes-DzIAEESd.js → notes-BG5pIVAJ.js} +1 -1
- package/dist/assets/{perfProbe-ezVn1mOu.js → perfProbe-DaLsQQBb.js} +1 -1
- package/dist/assets/{pin-BPGVDgnq.js → pin-BcKMUOiV.js} +1 -1
- package/dist/assets/{portal-B9DmFo6J.js → portal-BIN_aqvw.js} +1 -1
- package/dist/assets/{prewarm-BgUqAJbF.js → prewarm-CyvSJKv4.js} +1 -1
- package/dist/assets/{quietHours-DyynzDyC.js → quietHours-D1nboK5q.js} +1 -1
- package/dist/assets/{registry-BlujNlQJ.js → registry-BFQQpjO2.js} +1 -1
- package/dist/assets/{registry-D06LKiUk.js → registry-C8FuGbOr.js} +1 -1
- package/dist/assets/{registry-CEV5h2cu.css → registry-CIcGBgtK.css} +1 -1
- package/dist/assets/{registry-BJEvFgoL.js → registry-CcHxIYQN.js} +1 -1
- package/dist/assets/{registry-BT6ydF33.js → registry-DPBJYRmC.js} +1 -1
- package/dist/assets/registry-DdVZGvkL.js +48 -0
- package/dist/assets/{registry-7tKTrzeZ.js → registry-DdgeK4fY.js} +1 -1
- package/dist/assets/{registry-Bl7zAWKt.js → registry-Dt0wu9rC.js} +1 -1
- package/dist/assets/{relate-aQFFr11O.js → relate-CqYpFpsO.js} +1 -1
- package/dist/assets/{replay-CalqEgdW.js → replay-NognvQfM.js} +1 -1
- package/dist/assets/{select-wEtBn9U6.js → select-Dp-OeZfq.js} +1 -1
- package/dist/assets/shard054-CNzJxw2V.js +1 -0
- package/dist/assets/{useDashboardLoop-ifcuVRo-.js → useDashboardLoop-C3iCNS8X.js} +3 -3
- package/dist/assets/{useStudy-CySgE3Cx.js → useStudy-CwCIyiTb.js} +1 -1
- package/dist/assets/{walkSync-DBne70gg.js → walkSync-DC9iE0BX.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ConversationVideoStudio-DMIPUCcq.js +0 -1
- package/dist/assets/DashboardLoopRuntime-Dsy9u1wa.js +0 -1
- package/dist/assets/canvas-C3O7MEA3.js +0 -1
- package/dist/assets/registry-KRYoVMCh.js +0 -48
- package/dist/assets/shard054-BoC-LNYu.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compiler-runtime-qQQXpJgv.js";import{t}from"./jsx-runtime-DeHZSEgm.js";import{ot as n}from"./index-
|
|
1
|
+
import{t as e}from"./compiler-runtime-qQQXpJgv.js";import{t}from"./jsx-runtime-DeHZSEgm.js";import{ot as n}from"./index-CdUH6Eo9.js";import{r}from"./info-CiqHR5cs.js";var i=e(),a=t(),o=[`No sign-up`,`No install`,`Key-free tour`,`Keys session-only`];function s(e){let t=(0,i.c)(16),{onEnterLive:s}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,a.jsxs)(n,{eyebrow:`Yours in seconds`,children:[`No account. `,(0,a.jsx)(`em`,{children:`Your engine.`})]}),t[0]=u):u=t[0];let d,f,p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,a.jsx)(`div`,{className:`fl-surface-tag insight`,children:`Instant · no sign-up`}),f=(0,a.jsx)(`div`,{className:`fl-surface-title`,children:`Nothing to sign up for`}),p=(0,a.jsx)(`p`,{className:`fl-surface-body`,children:`No account, no waitlist, no install. The tour and demos run key-free; Live starts the moment you paste a key.`}),t[1]=d,t[2]=f,t[3]=p):(d=t[1],f=t[2],p=t[3]);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,a.jsx)(`div`,{className:`fl-surface-chips`,children:o.map(l)}),t[4]=m):m=t[4];let h;t[5]===s?h=t[6]:(h=(0,a.jsxs)(`div`,{className:`fl-surface`,children:[d,f,p,m,(0,a.jsx)(`button`,{type:`button`,className:`fl-ghost-btn`,onClick:()=>s(),children:`Open Mavéa →`})]}),t[5]=s,t[6]=h);let g,_,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,a.jsx)(`div`,{className:`fl-surface-tag live`,children:`Live · your model`}),_=(0,a.jsx)(`div`,{className:`fl-surface-title`,children:`Bring your own keys`}),v=(0,a.jsx)(`p`,{className:`fl-surface-body`,children:`Anthropic, OpenAI, Gemini, Grok, OpenRouter. Same beautiful canvas, your engine.`}),t[7]=g,t[8]=_,t[9]=v):(g=t[7],_=t[8],v=t[9]);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,a.jsx)(`div`,{className:`fl-surface-chips`,children:r.map(c)}),t[10]=y):y=t[10];let b;t[11]===s?b=t[12]:(b=(0,a.jsxs)(`div`,{className:`fl-surface live`,children:[g,_,v,y,(0,a.jsx)(`button`,{type:`button`,className:`fl-ghost-btn live`,onClick:()=>s(),children:`Open Live →`})]}),t[11]=s,t[12]=b);let x;return t[13]!==b||t[14]!==h?(x=(0,a.jsxs)(a.Fragment,{children:[u,(0,a.jsxs)(`div`,{className:`fl-surfaces`,children:[h,b]})]}),t[13]=b,t[14]=h,t[15]=x):x=t[15],x}function c(e){return(0,a.jsx)(`span`,{className:`fl-surface-chip fl-model-chip`,children:e.label},e.id)}function l(e){return(0,a.jsx)(`span`,{className:`fl-surface-chip`,children:e},e)}export{s as TwoSurfaces};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lens-ChFJD9il.js","assets/display-CAb_PiGv.js","assets/facts-BUGuVUIc.js","assets/types-DuEbJpIA.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./react-BZJXY1be.js";import{t}from"./compiler-runtime-qQQXpJgv.js";import{t as n}from"./jsx-runtime-DeHZSEgm.js";import{n as r,t as i}from"./preload-helper-CiWYd9n-.js";import{a,i as o,s}from"./spokenText-C88IQJ0M.js";import{i as c,n as l,t as u}from"./loader-DgMLGfAC.js";import{t as d}from"./useFocusTrap-CJmpNZv2.js";import{r as f,t as p}from"./useSpatialCanvas-CfmZOXXP.js";import{i as m}from"./format-q0LwBjID.js";import{a as h,i as g,n as _,r as v}from"./scale-Bcgfo6Hp.js";import{t as y}from"./spreadLabels-CQ8hufvK.js";import{a as b,i as x,n as S,t as C}from"./display-CAb_PiGv.js";import{t as w}from"./types-C42I77wh.js";import{r as T,t as E}from"./sourceHost-BV3t2XDb.js";import{r as D}from"./stepDriver-DwjFet6U.js";import{c as O,l as k,o as A,u as j}from"./walkSync-DBne70gg.js";import{n as M}from"./emphasize-BqCIst-B.js";import{c as N,s as P,t as F}from"./validate-sGUCmPAs.js";import{n as I,s as L}from"./receipts-D7zveV-I.js";import{n as R,r as z}from"./value-Dx7DZob4.js";import{t as B}from"./types-DuEbJpIA.js";import{n as V,t as H}from"./engine-BiM6INsW.js";var U=e(),W=t(),G=n();function ee(e){return e.kind}var K=.33,te=.1,q=.005;function ne(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return`would barely change`;let n=Math.abs(e)>1e-9?Math.abs(e):1,r=(t-e)/n,i=Math.abs(r);if(i<=q)return`would barely change`;let a=r>0?`rise`:`fall`;return i>=K?`would ${a} meaningfully`:i>=te?`would ${a} somewhat`:`would ${a} slightly`}var re=.6;function ie(e){if(!Number.isFinite(e))return null;let t=e-1,n=Math.abs(t);if(n<=.005)return null;let r=t>0?`stronger`:`weaker`;return n>=re?`much ${r}`:n>=K?r:`slightly ${r}`}function ae(e){let t=[];for(let n of e?.points??[]){let e=P(n.t);e===null||!Number.isFinite(n.value)||t.push({t:e,v:n.value})}return t.sort((e,t)=>e.t-t.t)}function oe(e,t){let n=e.date?P(e.date.t):null;if(n!==null){let t=e.date?.until?P(e.date.until):null;return t!==null&&t>n?{start:n,end:t}:{start:n}}if(t.length===0)return null;let r=t[0].t,i=t[t.length-1].t;return i>r?{start:r,end:i}:{start:r}}function se(e){return e.filter(e=>e.from!==e.to)}function ce(e){return se(e).map((e,t)=>({id:e.id??`${e.from}->${e.to}#${t}`,from:e.from,to:e.to,sign:e.sign,...e.relation===void 0?{}:{kind:e.relation},...typeof e.weight==`number`?{weight:e.weight}:{},...e.provisional?{provisional:!0}:{}}))}function le(e){let t=[],n=(e,r,i=0)=>{if(i>1)return;let a=ae(e.series),o=e.unit??e.series?.unit,s=oe(e,a);t.push({id:e.id,label:e.label,role:e.role,depth:e.depth,tier:e.tier,...e.value===void 0?{}:{value:e.value},...o===void 0?{}:{unit:o},...a.length>0?{series:a}:{},...s?{date:s}:{},...s&&e.date&&w(e.date.tier??`T0`)?{dateGrounded:!0}:{},...e.domain===void 0?{}:{domain:e.domain},...r===void 0?{}:{parentId:r}});for(let t of e.children??[])n(t,e.id,i+1)};for(let t of e.nodes)n(t);return{nodes:t,edges:ce(e.edges),outcomeId:e.outcomeId}}var ue={w:1090,h:650},de=1.4,fe=86*de;160*de;var pe=116*de,me=9/(11*de),J=e=>String(Math.round(e*100)/100),he=e=>e&&/^[a-z-]{1,24}$/.test(e)?` morph-edge--rel-${e}`:``,ge=525949.2*60*1e3,Y=e=>1970+e/ge,_e=e=>(e-1970)*ge,ve=6e4,ye=60*ve,be={minute:ve,hour:ye,day:24*ye,month:ge/12},xe=[{grain:`minute`,n:1},{grain:`minute`,n:5},{grain:`minute`,n:10},{grain:`minute`,n:15},{grain:`minute`,n:30},{grain:`hour`,n:1},{grain:`hour`,n:2},{grain:`hour`,n:3},{grain:`hour`,n:6},{grain:`hour`,n:12},{grain:`day`,n:1},{grain:`day`,n:2},{grain:`day`,n:5},{grain:`day`,n:10},{grain:`month`,n:1},{grain:`month`,n:2},{grain:`month`,n:3},{grain:`month`,n:6}],X=3,Se=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Ce=64;function we(e){let t=new Date(0);return t.setUTCFullYear(Math.floor(e/12),(e%12+12)%12,1),t.setUTCHours(0,0,0,0),t.getTime()}function Te(e,t,n){if(t.grain===`month`){let r=new Date(e),i=Math.floor((r.getUTCFullYear()*12+r.getUTCMonth())/t.n)*t.n,a=we(i);return n&&a<e?we(i+t.n):a}let r=be[t.grain]*t.n,i=Math.floor(e/r)*r;return n&&i<e?i+r:i}function Ee(e,t){let n=new Date(e);if(!Number.isFinite(n.getTime()))return String(Math.round(Y(e)));let r=`${Se[n.getUTCMonth()]} ${n.getUTCFullYear()}`;if(t===`month`)return r;let i=`${n.getUTCDate()} ${r}`;if(t===`day`||n.getUTCHours()===0&&n.getUTCMinutes()===0)return i;let a=e=>String(e).padStart(2,`0`);return`${a(n.getUTCHours())}:${a(n.getUTCMinutes())}`}function De(e,t){if(t.grain!==`month`)return e+be[t.grain]*t.n;let n=new Date(e);return we(n.getUTCFullYear()*12+n.getUTCMonth()+t.n)}function Oe(e,t,n){let r=Te(_e(e),n,!1),i=Te(_e(t),n,!0),a=[];for(let e=r;e<=i&&a.length<Ce;e=De(e,n))a.push({year:Y(e),text:Ee(e,n.grain)});return{domain:[Y(r),Y(i)],ticks:a}}function ke(e,t,n){let r=Math.max(1,Math.round(v(t-e,n))),i=Math.floor(e/r)*r,a=Math.ceil(t/r)*r,o=[];for(let e=i;e<=a&&o.length<Ce;e+=r)o.push({year:e,text:String(e)});return{domain:[i,a],ticks:o}}function Ae(e,t,n=6){let[r,i]=e<t?[e,t]:[e-.5,t+.5];if(i-r>=X)return ke(r,i,n);let a=(i-r)*ge/n,o=xe[xe.length-1],s=1/0;for(let e of xe){let t=Math.abs(Math.log(be[e.grain]*e.n/a));t<s&&(s=t,o=e)}return Oe(r,i,o)}var je=8,Z=12,Me=16,Ne=6,Pe=12+Math.ceil(15.525*de);function Q(e,t,n,r=ue){let i=new Map;if(e.length===0)return{positions:i,band:null,bbox:t};let a=pe+Me,o=44*de+Ne,s=Math.max(t.w,r.w),c=Math.max(1,Math.floor((s-24+Me)/a)),l=Math.min(e.length,c),u=Math.ceil(e.length/c),d=l*pe+(l-1)*Me,f={id:`shelf`,x:t.x,y:t.y+t.h+je,w:Math.max(t.w,d+24),h:Pe+Ne+u*o-Ne+Z,className:`morph-shelf`,label:n};return e.forEach((e,t)=>{i.set(e.id,{x:f.x+Z+t%c*a,y:f.y+Pe+Ne+Math.floor(t/c)*o,w:116,h:44,face:`entry`,shelved:!0})}),{positions:i,band:f,bbox:{x:t.x,y:t.y,w:Math.max(t.w,f.w),h:f.y+f.h-t.y}}}var Fe=440,Ie=2,Le=1.25,$=320;function Re(e){if(!(e===void 0||!Number.isFinite(e))){if(e<.995)return`weaker`;if(e>1.005)return`stronger`}}function ze(){let e=(0,W.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`marker`,{id:`mv-arrow`,className:`mv-marker mv-marker-up`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:13,markerHeight:13,orient:`auto`,children:(0,G.jsx)(`path`,{d:`M0.5 1 L9.5 5 L0.5 9 Z`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(`marker`,{id:`mv-arrow-damp`,className:`mv-marker mv-marker-down`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:17,markerHeight:17,orient:`auto`,children:(0,G.jsx)(`path`,{d:`M8 0.6 L8 9.4`})}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsx)(`marker`,{id:`mv-arrow-open`,className:`mv-marker mv-marker-open`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:13,markerHeight:13,orient:`auto`,children:(0,G.jsx)(`path`,{d:`M1 1.4 L9 5 L1 8.6 Z`})}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(`marker`,{id:`mv-arrow-ring`,className:`mv-marker mv-marker-ring`,viewBox:`0 0 10 10`,refX:`7.4`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:13,markerHeight:13,orient:`auto`,children:(0,G.jsx)(`circle`,{cx:`5`,cy:`5`,r:`3`})}),e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(`defs`,{children:[t,n,r,i,(0,G.jsx)(`marker`,{id:`mv-dot`,className:`mv-marker mv-marker-dot`,viewBox:`0 0 10 10`,refX:`5`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:9,markerHeight:9,orient:`auto`,children:(0,G.jsx)(`circle`,{cx:`5`,cy:`5`,r:`2.6`})})]}),e[4]=a):a=e[4],a}function Be(e,t){let n=(0,W.c)(5),r;n[0]===e.current?r=n[1]:(r=()=>{let t=e.current;if(!t||window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let n=t.querySelectorAll(`[data-draw]:not(.m-draw-path):not([data-drawn])`),r=Array.from(n,He);n.forEach((e,t)=>{let n=r[t];n!==null&&(e.style.setProperty(`--path-len`,`${n}px`),e.style.setProperty(`--delay`,`${Fe}ms`),e.classList.add(`m-draw-path`))});let i=Ve;return t.addEventListener(`animationend`,i),()=>t.removeEventListener(`animationend`,i)},n[0]=e.current,n[1]=r);let i;n[2]!==t||n[3]!==e?(i=[e,t],n[2]=t,n[3]=e,n[4]=i):i=n[4],(0,U.useEffect)(r,i)}function Ve(e){if(e.animationName!==`mavea-draw`)return;let t=e.target;t.classList.remove(`m-draw-path`),t.style.removeProperty(`--path-len`),t.style.removeProperty(`--delay`),t.dataset.drawn=``}function He(e){return typeof e.getTotalLength==`function`?e.getTotalLength():null}function Ue(e){let t=(0,W.c)(33),{chrome:n,bbox:r,exiting:i,onSettle:a}=e,o=(0,U.useRef)(null);Be(o,n.paths);let s=i?``:void 0,c=i?!0:void 0,l=r.w,u=r.h,d=`${r.x} ${r.y} ${r.w} ${r.h}`,f;t[0]===n.bands?f=t[1]:(f=n.bands.map(Ge),t[0]=n.bands,t[1]=f);let p;t[2]===n.paths?p=t[3]:(p=n.paths.map(We),t[2]=n.paths,t[3]=p);let m;t[4]!==r.h||t[5]!==r.w||t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,G.jsxs)(`svg`,{ref:o,className:`mv-chrome-svg`,width:l,height:u,viewBox:d,"aria-hidden":`true`,children:[f,p]}),t[4]=r.h,t[5]=r.w,t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;if(t[10]!==r.x||t[11]!==r.y||t[12]!==n.bands){let e;t[14]!==r.x||t[15]!==r.y?(e=e=>e.label===void 0?null:(0,G.jsx)(`div`,{className:`mv-shelf-label`,style:{left:e.x-r.x+12,top:e.y-r.y+12},children:e.label},`${e.id}:label`),t[14]=r.x,t[15]=r.y,t[16]=e):e=t[16],h=n.bands.map(e),t[10]=r.x,t[11]=r.y,t[12]=n.bands,t[13]=h}else h=t[13];let g;if(t[17]!==r.x||t[18]!==r.y||t[19]!==n.labels){let e;t[21]!==r.x||t[22]!==r.y?(e=e=>(0,G.jsx)(`div`,{className:`mv-chrome-label ${e.className}`,"data-anchor":e.anchor??`start`,style:{left:e.x-r.x,top:e.y-r.y},children:e.text},e.id),t[21]=r.x,t[22]=r.y,t[23]=e):e=t[23],g=n.labels.map(e),t[17]=r.x,t[18]=r.y,t[19]=n.labels,t[20]=g}else g=t[20];let _;t[24]!==g||t[25]!==h?(_=(0,G.jsxs)(`div`,{className:`mv-chrome-labels`,children:[h,g]}),t[24]=g,t[25]=h,t[26]=_):_=t[26];let v;return t[27]!==a||t[28]!==s||t[29]!==_||t[30]!==c||t[31]!==m?(v=(0,G.jsxs)(`div`,{className:`mv-chrome`,"data-exiting":s,onTransitionEnd:a,"aria-hidden":c,children:[m,_]}),t[27]=a,t[28]=s,t[29]=_,t[30]=c,t[31]=m,t[32]=v):v=t[32],v}function We(e){return(0,G.jsx)(`path`,{className:e.className,d:e.d,fill:`none`,"data-draw":e.draw?``:void 0},e.id)}function Ge(e){return(0,G.jsx)(`rect`,{className:`mv-band ${e.className}`,x:e.x,y:e.y,width:e.w,height:e.h,rx:12},e.id)}function Ke(e){if(e instanceof Element)return e.closest(`.mv-node`)?.dataset.id}var qe=(0,U.memo)(function(e){let t=(0,W.c)(49),{nodes:n,edges:r,layout:i,exiting:a,settleExit:o,activate:s,lod:c,renderFace:l,onNodeClick:u,onEdgeClick:d,selectedId:f,litEdgeId:p}=e,m=(0,U.useRef)(null);Be(m,i.edgePaths);let{bbox:h}=i,g;if(t[0]!==r||t[1]!==n){let e=new Map(n.map(Ye));g=new Map;for(let t of r){let n=e.get(t.from);n!==void 0&&Number.isFinite(n)&&g.set(t.id,n)}t[0]=r,t[1]=n,t[2]=g}else g=t[2];let _=g,v;t[3]!==a||t[4]!==o?(v=a&&(0,G.jsx)(Ue,{chrome:a.layout.chrome,bbox:a.layout.bbox,exiting:!0,onSettle:()=>o(a.token)},a.token),t[3]=a,t[4]=o,t[5]=v):v=t[5];let y;t[6]!==h||t[7]!==i.chrome||t[8]!==i.rep?(y=(0,G.jsx)(Ue,{chrome:i.chrome,bbox:h},i.rep),t[6]=h,t[7]=i.chrome,t[8]=i.rep,t[9]=y):y=t[9];let b=h.w,x=h.h,S=`${h.x} ${h.y} ${h.w} ${h.h}`,C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(ze,{}),t[10]=C):C=t[10];let w;if(t[11]!==_||t[12]!==i.edgePaths||t[13]!==p||t[14]!==d){let e;t[16]!==_||t[17]!==p||t[18]!==d?(e=e=>(0,G.jsxs)(`g`,{className:`mv-edge-g`,"data-lit":p===e.id?``:void 0,"data-shift":Re(_.get(e.id)),style:_.has(e.id)?{"--mv-shift":_.get(e.id)}:void 0,onClick:d?()=>d(e.id):void 0,children:[d&&(0,G.jsx)(`path`,{className:`mv-edge-hit`,d:e.d,fill:`none`}),(0,G.jsx)(`path`,{className:e.className,d:e.d,fill:`none`,"data-draw":``,style:e.width===void 0?void 0:{"--mv-edge-w":e.width}})]},e.id),t[16]=_,t[17]=p,t[18]=d,t[19]=e):e=t[19],w=i.edgePaths.map(e),t[11]=_,t[12]=i.edgePaths,t[13]=p,t[14]=d,t[15]=w}else w=t[15];let T;t[20]!==h.h||t[21]!==h.w||t[22]!==S||t[23]!==w?(T=(0,G.jsxs)(`svg`,{ref:m,className:`mv-edges`,width:b,height:x,viewBox:S,"aria-hidden":`true`,children:[C,w]}),t[20]=h.h,t[21]=h.w,t[22]=S,t[23]=w,t[24]=T):T=t[24];let E;if(t[25]!==s||t[26]!==h.x||t[27]!==h.y||t[28]!==i.positions||t[29]!==c||t[30]!==n||t[31]!==u||t[32]!==l||t[33]!==f){let e;t[35]!==s||t[36]!==h.x||t[37]!==h.y||t[38]!==i.positions||t[39]!==c||t[40]!==u||t[41]!==l||t[42]!==f?(e=(e,t)=>{let n=i.positions.get(e.id);if(!n)return null;let r={"--nx":`${n.x+n.w/2-h.x}px`,"--ny":`${n.y+n.h/2-h.y}px`,"--mv-i":t,...e.shift===void 0?{}:{"--mv-shift":e.shift}},a=u!==void 0&&!n.folded,o=l?.(e,`entry`);return(0,G.jsxs)(`div`,{className:`mv-node`,"data-id":e.id,"data-role":e.role,"data-tier":e.tier,"data-domain":e.domain,"data-series":e.series?.length?``:void 0,"data-face":n.face,"data-shelved":n.shelved?``:void 0,"data-folded":n.folded?``:void 0,"data-shift":Re(e.shift),"data-selected":f===e.id?``:void 0,"data-lod":c,style:r,"aria-hidden":n.folded?!0:void 0,role:a?`button`:void 0,tabIndex:a?0:void 0,onClick:a?()=>s(e):void 0,onKeyDown:a?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),u?.(e))}:void 0,children:[(0,G.jsxs)(`div`,{className:`mv-face mv-face-card`,children:[(0,G.jsx)(`span`,{className:`mv-label`,children:e.label}),(0,G.jsxs)(`span`,{className:`mv-card-foot`,children:[e.domain!==void 0&&(0,G.jsx)(`span`,{className:`mv-domain`,title:e.domain,"aria-label":e.domain}),e.value!==void 0&&(0,G.jsxs)(`span`,{className:`mv-value`,children:[e.value.toLocaleString(),e.unit??``]}),l?.(e,`card`),e.tier!==void 0&&(0,G.jsx)(`span`,{className:`mv-tier`,children:e.tier})]})]}),(0,G.jsx)(`div`,{className:`mv-face mv-face-entry`,children:(0,G.jsxs)(`span`,{className:`mv-label`,children:[o,o?` `:null,e.label]})}),(0,G.jsx)(`div`,{className:`mv-face mv-face-mark`,children:l?.(e,`mark`)})]},e.id)},t[35]=s,t[36]=h.x,t[37]=h.y,t[38]=i.positions,t[39]=c,t[40]=u,t[41]=l,t[42]=f,t[43]=e):e=t[43],E=n.map(e),t[25]=s,t[26]=h.x,t[27]=h.y,t[28]=i.positions,t[29]=c,t[30]=n,t[31]=u,t[32]=l,t[33]=f,t[34]=E}else E=t[34];let D;return t[44]!==v||t[45]!==y||t[46]!==T||t[47]!==E?(D=(0,G.jsxs)(G.Fragment,{children:[v,y,T,E]}),t[44]=v,t[45]=y,t[46]=T,t[47]=E,t[48]=D):D=t[48],D});function Je({stage:e,world:t,renderFace:n,onNodeClick:r,onEdgeClick:i,selectedId:a,litEdgeId:o}){let{cam:s,layout:c,exiting:l,lod:u,settleExit:d,morphing:f,settle:p}=e,{viewportRef:m,zoomAtClient:h,pan:g}=s,[_,v]=(0,U.useState)(!1),y=(0,U.useRef)(new Map),b=(0,U.useRef)(0),x=(0,U.useRef)(!1),S=(0,U.useRef)(!1),C=(0,U.useRef)(!1),w=(0,U.useRef)({x:0,y:0}),T=(0,U.useCallback)((t,n,r,i)=>{if(x.current){h(t,n,r);return}e.pinch(t,n,r,i)!==`zoom`&&(x.current=!0)},[e,h]),E=(0,U.useRef)(T);E.current=T,(0,U.useEffect)(()=>{let e=m.current;if(!e)return;let t,n=e=>{if(e.preventDefault(),p(),e.ctrlKey){E.current(Math.exp(-e.deltaY/100),e.clientX,e.clientY,Ke(e.target)),clearTimeout(t),t=setTimeout(()=>{x.current=!1},$);return}h(e.deltaY<0?1.12:1/1.12,e.clientX,e.clientY)};return e.addEventListener(`wheel`,n,{passive:!1}),()=>{clearTimeout(t),e.removeEventListener(`wheel`,n)}},[m,h,p]);let D=()=>{let[e,t]=[...y.current.values()];return{x:(e.x+t.x)/2,y:(e.y+t.y)/2,d:Math.hypot(e.x-t.x,e.y-t.y)}},O=(0,U.useCallback)(e=>{if(p(),y.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),y.current.size>=2){e.currentTarget.setPointerCapture(e.pointerId),S.current=!1,v(!1),b.current=0;return}S.current=!0,C.current=!1,v(!0),w.current={x:e.clientX,y:e.clientY}},[p]),k=(0,U.useRef)({dx:0,dy:0}),A=(0,U.useRef)(0),j=(0,U.useCallback)(()=>{A.current!==0&&(cancelAnimationFrame(A.current),A.current=0);let{dx:e,dy:t}=k.current;(e!==0||t!==0)&&(k.current={dx:0,dy:0},g(e,t))},[g]),M=(0,U.useCallback)((e,t)=>{k.current.dx+=e,k.current.dy+=t,A.current===0&&(A.current=requestAnimationFrame(()=>{A.current=0;let e=k.current;k.current={dx:0,dy:0},(e.dx!==0||e.dy!==0)&&g(e.dx,e.dy)}))},[g]);(0,U.useEffect)(()=>()=>cancelAnimationFrame(A.current),[]);let N=(0,U.useCallback)(e=>{let t=y.current;if(!t.has(e.pointerId))return;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size>=2){let{x:t,y:n,d:r}=D();if(b.current===0){b.current=r;return}let i=r/b.current;(i>Le||i<1/Le)&&(b.current=r,E.current(i,t,n,Ke(e.target)));return}if(!S.current)return;let n=e.clientX-w.current.x,r=e.clientY-w.current.y;Math.abs(n)+Math.abs(r)>Ie&&!C.current&&(C.current=!0,e.currentTarget.setPointerCapture(e.pointerId)),w.current={x:e.clientX,y:e.clientY},M(n,r)},[M]),P=(0,U.useCallback)(e=>{j(),y.current.delete(e.pointerId),y.current.size<2&&(b.current=0,x.current=!1),y.current.size===0&&(S.current=!1,v(!1)),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},[j]),F=(0,U.useCallback)(e=>{C.current||r?.(e)},[r]),I=(0,U.useCallback)(e=>{e.propertyName===`transform`&&p()},[p]),{bbox:L}=c,R={transform:s.transform,width:L.w,height:L.h,"--mv-cam-scale":s.camera.scale};return(0,G.jsx)(`div`,{className:`mv-viewport`,ref:m,"data-panning":_?`true`:void 0,style:{"--mv-cam-scale":s.camera.scale},onPointerDown:O,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:(0,G.jsx)(`div`,{className:`mv-world`,style:R,"data-morphing":f?``:void 0,onTransitionEnd:I,children:(0,G.jsx)(qe,{nodes:t.nodes,edges:t.edges,layout:c,exiting:l,settleExit:d,activate:F,lod:u,renderFace:n,onNodeClick:r,onEdgeClick:i,selectedId:a,litEdgeId:o})})})}function Ye(e){return[e.id,e.shift]}function Xe(e,t){return e===`in`?`zoom-camera`:t?`ascend`:`zoom-camera`}var Ze=880,Qe=340,$e=468,et=56,tt=26,nt=16,rt=7,it=30*de;function at(e){let t=(e.series??[]).filter(e=>Number.isFinite(e.t)&&Number.isFinite(e.v)).map(e=>({t:Y(e.t),v:e.v})).sort((e,t)=>e.t-t.t);return t.length>0?{node:e,points:t}:null}var ot=e=>at(e)!==null;function st(e,t){let n=e*Math.max(et,(t-1)*it+30)+(e-1)*tt,r=Math.min($e,Math.max(Qe,n)),i=Math.max(it,Math.min(tt,r/(4*e)));return{h:(r-(e-1)*i)/e,gap:i}}function ct(e,t,n){let[r,i]=e===t?_(e,t,n):[e,t],a=v(i-r,n),o=[Math.floor(r/a)*a,Math.ceil(i/a)*a];return{domain:o,ticks:h(o[0]-a*1e-9,o[1],a)}}function lt(e){let t=1/0,n=-1/0,r=new Map;for(let i of e){let e=new Map;for(let a of i.nodes){let i=at(a);if(!i)continue;let o=a.unit??``,s=r.get(o);s||r.set(o,s={lo:1/0,hi:-1/0,marks:0}),e.set(o,(e.get(o)??0)+1);for(let e of i.points)t=Math.min(t,e.t),n=Math.max(n,e.t),s.lo=Math.min(s.lo,e.v),s.hi=Math.max(s.hi,e.v)}for(let[t,n]of e){let e=r.get(t);e.marks=Math.max(e.marks,n)}}if(t===1/0)return null;let i=1;for(let e of r.values())i=Math.max(i,e.marks);let{h:a,gap:o}=st(r.size,i),s=Math.max(2,Math.min(5,Math.round(a/60))),c=[],l=new Map;for(let[e,t]of r){let{domain:n,ticks:r}=ct(t.lo,t.hi,s);l.set(e,c.length),c.push({unit:e,domain:n,ticks:r,top:c.length*(a+o),h:a})}let u=Ae(t,n);return{x:u.domain,xTicks:u.ticks,bands:c,bandOf:l,height:c.length*a+(c.length-1)*o}}function ut(e,t){let n=new Map,r=new Map;for(let t of e){let e=r.get(t.band);e?e.push(t):r.set(t.band,[t])}for(let[e,i]of r){let{top:r,bottom:a}=t(e);i.sort((e,t)=>e.x-t.x||e.y-t.y||e.id.localeCompare(t.id));let o=[],s=()=>{if(o.length!==0){for(let[e,t]of y(o,{gap:it,top:r,bottom:a}))n.set(e,t);o=[]}};for(let e of i)o.length>0&&e.x-o[o.length-1].x>=it&&s(),o.push(e);s()}return n}function dt(e,t,n){let r=[],i=[];for(let n of e.nodes){let e=at(n);e&&t?r.push(e):i.push(n)}let a=new Map,o={bands:[],paths:[],labels:[]},s=1/0,c=-1/0,l=56;if(r.length>0&&t){let e=g(t.x,[56,56+Ze]),n=t.bands.map(e=>g(e.domain,[56+e.top+e.h,56+e.top])),i=e=>t.bandOf.get(e.unit??``)??0;t.bands.forEach((e,r)=>{let i=n[r];for(let t of e.ticks)o.paths.push({id:`grid:${r}:${t}`,d:`M ${J(56)} ${J(i(t))} L ${J(56+Ze)} ${J(i(t))}`,className:`morph-gridline`}),o.labels.push({id:`ytick:${r}:${t}`,x:46,y:i(t)+4,text:String(t),className:`morph-axis-label`,anchor:`end`}),s=Math.min(s,46-String(t).length*rt);t.bands.length>1&&o.labels.push({id:`unit:${r}`,x:56,y:56+e.top-11,text:e.unit===``?`no unit`:e.unit,className:`morph-axis-label`,anchor:`start`})}),t.xTicks.forEach((n,r)=>{let i=e(n.year);o.labels.push({id:`xtick:${r}`,x:i,y:56+t.height+22,text:n.text,className:`morph-axis-label`,anchor:`middle`});let a=n.text.length*rt/2;s=Math.min(s,i-a),c=Math.max(c,i+a)}),s=Math.min(s,56),c=Math.max(c,56+Ze),l=Math.max(l,56+t.height+28);let u=[...r].sort((e,t)=>e.node.id.localeCompare(t.node.id)),d=u.map(t=>{let r=i(t.node),a=t.points[t.points.length-1];return{id:t.node.id,band:r,x:e(a.t),y:n[r](a.v)}}),f=ut(d,e=>({top:56+t.bands[e].top,bottom:56+t.bands[e].top+t.bands[e].h})),p=new Map,m=new Map;for(let e of d){let t=m.get(e.band);t?t.push(e):m.set(e.band,[e])}t.bands.forEach((e,t)=>{let n=m.get(t);if(n===void 0||n.length===0)return;let r=y(n.map(e=>({id:e.id,y:f.get(e.id)??e.y})),{gap:nt,top:56+e.top+6,bottom:56+e.top+e.h-6});for(let[e,t]of r)p.set(e,t)}),u.forEach((t,r)=>{let{x:i,y:s}=d[r],l=n[d[r].band],u=t.points.map((t,n)=>`${n===0?`M`:`L`} ${J(e(t.t))} ${J(l(t.v))}`).join(` `),m=t.node.id;o.paths.push({id:`series:${m}`,d:u,className:`morph-series`,draw:!0});let h=f.get(t.node.id)??s;Math.abs(h-s)>.01&&o.paths.push({id:`leader:${t.node.id}`,d:`M ${J(i)} ${J(s)} L ${J(i)} ${J(h)}`,className:`morph-tick`}),a.set(m,{x:i-15,y:h-15,w:30,h:30,face:`mark`});let g=i+15+8;o.labels.push({id:`label:${t.node.id}`,x:g,y:(p.get(t.node.id)??h)+4,text:t.node.label,className:`morph-series-label`,anchor:`start`}),c=Math.max(c,g+t.node.label.length*rt)})}let u=Q(i,s===1/0?{x:0,y:0,w:112,h:112}:{x:s-56,y:0,w:c-s+112,h:l+56},`${i.length} with nothing measured over time — the chart cannot plot these`,n);u.band&&o.bands.push(u.band);for(let[e,t]of u.positions)a.set(e,t);return{positions:a,edgePaths:[],chrome:o,bbox:u.bbox}}var ft=(e,t)=>({rep:`chart`,...dt(e,lt([e]),t?.viewport??ue)}),pt=new WeakMap;function mt(e,t){let n=new Set;for(let r of e)r.from===r.to||!t(r)||(n.add(r.from),n.add(r.to));return n}function ht(e){let t=pt.get(e);if(t)return t;let n=mt(e.edges,e=>typeof e.weight==`number`);return pt.set(e,n),n}var gt=340,_t=4,vt=fe+30,yt=3;function bt(e,t){return e.parentId===void 0&&ht(t).has(e.id)}var xt=(e,t)=>{let n=t?.viewport??ue,r=e.nodes.filter(e=>e.parentId===void 0),i=r.filter(t=>bt(t,e)),a=r.filter(t=>!bt(t,e)),o=e.nodes.filter(e=>e.parentId!==void 0),s=new Map,c={bands:[],paths:[],labels:[]},l=[],u=new Set(i.map(e=>e.id)),d=e.edges.filter(e=>e.from!==e.to&&typeof e.weight==`number`&&u.has(e.from)&&u.has(e.to)),f=i.reduce((e,t)=>Math.min(e,t.depth??0),1/0),p=new Map;for(let e of d)p.set(e.from,(p.get(e.from)??0)+(e.weight??0));let m=i.reduce((e,t)=>Math.max(e,Number.isFinite(f)?(t.depth??0)-f:0),0),h=e=>{let t=Number.isFinite(f)?(e.depth??0)-f:0;return m<=0?0:m<_t?t:Math.round(t/m*3)},g=new Map;for(let e of i){let t=h(e),n=g.get(t);n?n.push(e):g.set(t,[e])}for(let e of g.values())e.sort((e,t)=>(p.get(t.id)??0)-(p.get(e.id)??0)||e.id.localeCompare(t.id));let _=Math.max(1,...[...g.values()].map(e=>e.length));for(let[e,t]of g){let n=(_-t.length)*vt/2;t.forEach((t,r)=>{s.set(t.id,{x:56+e*gt,y:56+n+r*vt,w:200,h:64,face:`card`})})}for(let e of d){let t=s.get(e.from),n=s.get(e.to),r=t.x+t.w,i=t.y+t.h/2,a=n.x,o=n.y+n.h/2,c=(r+a)/2,u=Math.min(1,Math.max(0,e.weight??0));l.push({id:e.id,d:`M ${J(r)} ${J(i)} C ${J(c)} ${J(i)} ${J(c)} ${J(o)} ${J(a)} ${J(o)}`,className:`morph-edge morph-ribbon`+he(e.kind),width:yt+u*23})}for(let e of o){let t=(e.parentId===void 0?void 0:s.get(e.parentId))??{x:56,y:56};s.set(e.id,{x:t.x,y:t.y,w:200,h:64,face:`card`,folded:!0})}let v=Q(a,{x:0,y:0,w:112+(Math.max(1,...[...g.keys()].map(e=>e+1))-1)*gt+200,h:112+_*vt},`${a.length} with no measured share — the ribbons cannot size these`,n);for(let[e,t]of v.positions)s.set(e,t);return v.band&&c.bands.push(v.band),{rep:`flow`,positions:s,edgePaths:l,chrome:c,bbox:v.bbox}},St=200;function Ct(e,t=24){let n=e.length;if(n<2)return;let r=e.map(e=>Math.max(e.w,e.h)),i=2*[...r].sort((e,t)=>e-t)[n>>1],a=[];for(let e=0;e<n;e++)r[e]>i&&a.push(e);a.length>n/8&&(a=[]);let o=Array(n).fill(!0);for(let e of a)o[e]=!1;let s=0;for(let e=0;e<n;e++)o[e]&&(s=Math.max(s,r[e]));s=Math.max(s+t,1);let c=(n,r)=>{let i=e[n],a=e[r],o=a.x+a.w/2-(i.x+i.w/2),s=a.y+a.h/2-(i.y+i.h/2);o===0&&s===0&&(o=n-r,s=r-n);let c=(i.w+a.w)/2+t-Math.abs(o),l=(i.h+a.h)/2+t-Math.abs(s);if(c<=0||l<=0)return!1;if(c<=l){let e=c/2*(o<0?-1:1);i.x-=e,a.x+=e}else{let e=l/2*(s<0?-1:1);i.y-=e,a.y+=e}return!0},l=Array(n),u=new Map;for(let t=0;t<St;t++){u.clear();let t=[],r=[],i=[];for(let a=0;a<n;a++){if(!o[a])continue;let n=e[a],c=Math.floor((n.x+n.w/2)/s),d=Math.floor((n.y+n.h/2)/s),f=u.get(c);f===void 0&&(f=new Map,u.set(c,f));let p=f.get(d);p===void 0&&(p=i.length,f.set(d,p),t.push(c),r.push(d),i.push([])),i[p].push(a),l[a]=p}let d=i.map((e,n)=>{let a=[];for(let e=-1;e<=1;e++){let o=u.get(t[n]+e);if(o!==void 0)for(let e=-1;e<=1;e++){let t=o.get(r[n]+e);if(t!==void 0)for(let e of i[t])a.push(e)}}return a.sort((e,t)=>e-t)}),f=Array(i.length).fill(0),p=!1,m=0;for(let e=0;e<n;e++){for(;m<a.length&&a[m]<=e;)m++;if(!o[e]){for(let t=e+1;t<n;t++)c(e,t)&&(p=!0);continue}let t=l[e],r=d[t],i=f[t];for(;i<r.length&&r[i]<=e;)i++;f[t]=i;let s=m;for(;i<r.length||s<a.length;){let t=s>=a.length||i<r.length&&r[i]<a[s]?r[i++]:a[s++];c(e,t)&&(p=!0)}}if(!p)break}}var wt=300,Tt=fe+4,Et=4,Dt=fe+Et,Ot=wt-200,kt=200+Et,At=96,jt=30,Mt=20,Nt=18,Pt=15,Ft=2.5,It=1/1.4,Lt=1.7,Rt=2.6,zt={rows:1,reach:0};function Bt(e,t){let n=e.map(e=>t(e.id).rows).sort((e,t)=>t-e),r=e.map(e=>t(e.id).reach).sort((e,t)=>t-e),i=[0],a=0;for(let e of n)i.push(a+=e);return{size:e.length,rows:a,tallest:i,reaches:r}}function Vt(e,t){let n=[],r=[],i=[],a=[];for(let o of e){let e=Math.max(1,Math.min(o.size,Math.ceil(o.rows/t))),s=Math.ceil(o.size/e),c=Math.ceil(o.size/s);i.push(n.length),a.push(s);for(let e=0;e<c;e++)n.push(o.tallest[Math.min(s,o.size-e*s)]),r.push(200+(o.reaches[e]??0))}return{rows:n,widths:r,start:i,per:a}}function Ht(e,t){let n=[],r=[],i=[];for(let a=0;a<e.rows.length;a++){let o=Math.floor(a/t),s=a%t===0?0:n[a-1]+e.widths[a-1]+Ot;n.push(s),r[o]=Math.max(r[o]??1,e.rows[a]),i[o]=Math.max(i[o]??0,s+e.widths[a])}return{columnX:n,bandRows:r,bandW:i}}var Ut=12;function Wt(e,t){let n=n=>{let r=(t.h-(n-1)*At-112)/n,i=Math.max(2,Math.floor((r-64)/Tt)+1),a=Vt(e,i),o=Math.max(1,Math.ceil(a.rows.length/n)),{bandRows:s,bandW:c}=Ht(a,o),l=200;for(let e of c)l=Math.max(l,e);let u=(n-1)*At;for(let e=0;e<n;e++)u+=((s[e]??1)-1)*Tt+64;return{bands:n,rowCap:i,perBand:o,fit:Math.min(t.w/(l+112),t.h/(u+112)),aspect:l/u}},r=n(1);if(e.length<2||r.fit>=It)return r;let i=r;for(let e=2;e<=Ut;e++){let t=n(e);if(t.fit>=It&&t.aspect<=Ft)return t;if(t.fit>i.fit&&(i=t),t.perBand===1)break}return i}function Gt(e,t,n){let r=Wt(t,n),i=Vt(t,r.rowCap),{columnX:a,bandRows:o}=Ht(i,r.perBand),s=new Map,c=new Map;e.forEach((e,t)=>{s.set(e,i.start[t]),c.set(e,i.per[t])});let l=o.length>0?o:[1],u=[],d=[],f=[],p=0;for(let e of l){let t=(e-1)*Tt+64;u.push(p+t/2),d.push(t),p+=t,f.push(p+At/2),p+=At}return{perBand:r.perBand,columnRows:i.rows,columnX:a,startOf:s,splitOf:c,centreY:u,height:d,gutterY:f}}function Kt(e,t){let n=new Map,r=new Set;for(let t of e)typeof t.depth==`number`&&Number.isFinite(t.depth)?(n.set(t.id,t.depth),r.add(t.id)):n.set(t.id,0);let i=t.edges.filter(e=>e.from!==e.to&&n.has(e.from)&&n.has(e.to)),a=new Map,o=new Map(e.map(e=>[e.id,0]));for(let e of i){let t=a.get(e.from);t===void 0?a.set(e.from,[e.to]):t.push(e.to),o.set(e.to,o.get(e.to)+1)}let s=(e,t)=>r.has(e)?t:t+1,c=e.filter(e=>o.get(e.id)===0).map(e=>e.id),l=new Set;for(let e=0;e<c.length;e++){let t=c[e];l.add(t);let r=n.get(t);for(let e of a.get(t)??[]){let t=s(e,r);t>n.get(e)&&n.set(e,t);let i=o.get(e)-1;o.set(e,i),i===0&&c.push(e)}}if(l.size<e.length){let t=i.filter(e=>!l.has(e.to));for(let r=e.length;r>0;r--){let e=!1;for(let r of t){let t=s(r.to,n.get(r.from));t>n.get(r.to)&&(n.set(r.to,t),e=!0)}if(!e)break}}let u=t.outcomeId;if(u!==void 0&&n.has(u)&&!r.has(u)&&(a.get(u)?.length??0)===0){let e=-1/0;for(let t of n.values())t>e&&(e=t);n.set(u,e)}return n}function qt(e,t){let n=new Map(e.map(e=>[e.id,0])),r=new Map(e.map(e=>[e.id,0])),i=new Map,a=0;for(let o of e)for(let e of t.get(o.id)??[]){if(e===o.id||!n.has(e))continue;let t=i.get(e);t===void 0?i.set(e,[o.id]):t.push(o.id),r.set(o.id,r.get(o.id)+1),a++}if(a===0)return n;let o=e.filter(e=>r.get(e.id)===0).map(e=>e.id);for(let e=0;e<o.length;e++){let t=o[e],a=n.get(t);for(let e of i.get(t)??[]){a+1>n.get(e)&&n.set(e,a+1);let t=r.get(e)-1;r.set(e,t),t===0&&o.push(e)}}return n}function Jt(e,t){let n=new Map,r=new Set,i=[],a=new Set;for(let o of e){if(n.has(o.id))continue;i.length=0,a.clear();let e=o,s=0,c=!1;for(;;){let o=e.parentId===void 0?void 0:t.get(e.parentId);if(o===void 0){n.set(e.id,null);break}if(i.push(e),a.add(e.id),n.has(o.id)){c=r.has(o.id),s=n.get(o.id)??0;break}if(a.has(o.id)){c=!0;break}e=o}if(c)for(let e of i)n.set(e.id,null),r.add(e.id);else for(let e=i.length-1;e>=0;e--)n.set(i[e].id,++s)}return n}function Yt(e,t){let n=new Map(e.nodes.map(e=>[e.id,e])),r=Jt(e.nodes,n),i=e.nodes.filter(e=>r.get(e.id)===null),a=e.nodes.filter(e=>r.get(e.id)!==null).sort((e,t)=>r.get(e.id)-r.get(t.id)||e.id.localeCompare(t.id)),o=t?.expandedIds,s=t?.previous,c=new Map,l=Kt(i,e),u=new Set(i.map(e=>e.id)),d=new Set;for(let e of a){let t=e.parentId;o?.has(t)===!0&&(u.has(t)||d.has(t))&&d.add(e.id)}let f=new Map,p=e=>f.get(e)??zt;for(let e=a.length-1;e>=0;e--){let t=a[e];if(!d.has(t.id))continue;let n=p(t.id),r=f.get(t.parentId);f.set(t.parentId,{rows:(r?.rows??0)+n.rows,reach:Math.max(r?.reach??0,kt+n.reach)})}let m=new Map,h=new Map;for(let e of a){let t=h.get(e.parentId)??0;m.set(e.id,t),h.set(e.parentId,t+p(e.id).rows)}let g=new Map;for(let t of e.edges)!u.has(t.from)||!u.has(t.to)||(g.has(t.to)||g.set(t.to,[]),g.get(t.to).push(t.from));let _=new Map;for(let e of i){let t=l.get(e.id),n=_.get(t);n===void 0?_.set(t,[e]):n.push(e)}let v=[..._.keys()].sort((e,t)=>e-t),y=t?.viewport??ue,b=Gt(v,v.map(e=>Bt(_.get(e),p)),y),x=new Map;for(let e of v){let t=_.get(e),n=qt(t,g),r=t.map((e,t)=>{let r=(g.get(e.id)??[]).map(e=>c.get(e)?.y).filter(e=>e!==void 0);return{n:e,bary:r.length?r.reduce((e,t)=>e+t,0)/r.length:s?.get(e.id)?.y??t*Tt,rank:n.get(e.id)}});r.sort((e,t)=>e.rank-t.rank||e.bary-t.bary||e.n.id.localeCompare(t.n.id));let i=b.startOf.get(e),a=b.splitOf.get(e),o=[],l=[];r.forEach((e,t)=>{let n=Math.floor(t/a);o.push(l[n]??0),l[n]=(l[n]??0)+p(e.n.id).rows}),r.forEach((e,t)=>{let n=Math.floor(t/a),r=i+n,s=Math.floor(r/b.perBand),u=p(e.n.id).rows;x.set(e.n.id,s),c.set(e.n.id,{x:b.columnX[r],y:b.centreY[s]+(o[t]+(u-1)/2-(l[n]-1)/2)*Tt})})}for(let e of a){let t=e.parentId,n=c.get(t);if(x.set(e.id,x.get(t)??0),d.has(e.id)){let r=p(e.id).rows,i=h.get(t);c.set(e.id,{x:n.x+kt,y:n.y+(m.get(e.id)+(r-1)/2-(i-1)/2)*Dt})}else c.set(e.id,{x:n.x,y:n.y})}if(d.size>0){let e=[...i,...a.filter(e=>d.has(e.id))],t=e.map(e=>{let t=c.get(e.id);return{x:t.x-100,y:t.y-fe/2,w:200,h:fe}});Ct(t,Et),e.forEach((e,n)=>{c.set(e.id,{x:t[n].x+100,y:t[n].y+fe/2})});for(let e of a){if(d.has(e.id))continue;let t=c.get(e.parentId);c.set(e.id,{x:t.x,y:t.y})}}let S=1/0,C=1/0,w=-1/0,T=-1/0;for(let e of c.values())S=Math.min(S,e.x-100),C=Math.min(C,e.y-32),w=Math.max(w,e.x+100),T=Math.max(T,e.y+32);let E=c.size===0,D=E?0:56-S,O=E?0:56-C,k=new Map;for(let t of e.nodes){let e=c.get(t.id);k.set(t.id,{x:e.x+D-100,y:e.y+O-32,w:200,h:64,face:`card`,...r.get(t.id)!==null&&!d.has(t.id)?{folded:!0}:{}})}let A=e=>u.has(e)||d.has(e),j=E?56:w+D,M=e.edges.filter(e=>A(e.from)&&A(e.to)).map(e=>{let t=k.get(e.from),n=k.get(e.to),r=x.get(e.from)??0,i=x.get(e.to)??0,a=r===i?-1:Math.max(r,i)-1;return{e,from:t,to:n,gutter:a,vertical:a<0&&n.x<=t.x&&Math.abs(n.y-t.y)>1}}),N=new Map,P=new Map,F=new Map,I=(e,t)=>void e.set(t,(e.get(t)??0)+1);for(let e of M)e.gutter>=0&&I(N,e.gutter),!e.vertical&&(I(P,e.e.to),I(F,e.e.from));let L=new Map,R=new Map,z=new Map,B=(e,t,n)=>e.y+e.h/2+(n-(t-1)/2)*Math.min(Pt,e.h/(t+1)),V=[];for(let{e,from:t,to:n,gutter:r,vertical:i}of M){let a;if(i){let e=t.x+t.w/2,r=n.x+n.w/2,i=n.y>t.y,o=i?t.y+t.h:t.y,s=i?n.y:n.y+n.h,c=(o+s)/2;a=`M ${J(e)} ${J(o)} C ${J(e)} ${J(c)} ${J(r)} ${J(c)} ${J(r)} ${J(s)}`}else{let i=z.get(e.from)??0,o=R.get(e.to)??0;z.set(e.from,i+1),R.set(e.to,o+1);let s=t.x+t.w,c=B(t,F.get(e.from),i),l=n.x,u=B(n,P.get(e.to),o);if(r<0){let e=(s+l)/2;a=`M ${J(s)} ${J(c)} C ${J(e)} ${J(c)} ${J(e)} ${J(u)} ${J(l)} ${J(u)}`}else{let e=N.get(r),t=L.get(r)??0;L.set(r,t+1);let n=Math.min(Nt,(At-32)/Math.max(1,e)),i=b.gutterY[r]+O+(t-(e-1)/2)*n,o=j+jt,d=Math.min(l,56)-jt,f=(o+d)/2;a=`M ${J(s)} ${J(c)} C ${J(o)} ${J(c)} ${J(o)} ${J(i)} ${J(f)} ${J(i)} C ${J(d)} ${J(i)} ${J(d)} ${J(u)} ${J(l)} ${J(u)}`}}V.push({id:e.id,d:a,className:`morph-edge`+he(e.kind)+(e.sign===-1?` morph-edge--damp`:``)+(e.provisional?` morph-edge--provisional`:``)+(r<0?``:` morph-edge--wrap`),...typeof e.weight==`number`&&Number.isFinite(e.weight)?{width:Lt+Math.min(1,Math.max(0,e.weight))*Rt}:{}})}let H=E?{x:0,y:0,w:112,h:112}:{x:0,y:0,w:w-S+112,h:T-C+112};return{positions:k,edgePaths:V,chrome:{bands:E||b.centreY.length<2?[]:b.centreY.map((e,t)=>{let n=Math.max(H.y,e-b.height[t]/2+O-Mt),r=Math.min(H.y+H.h,e+b.height[t]/2+O+Mt);return{id:`reading-band:${t}`,x:56-Mt,y:n,w:j-56+40,h:Math.max(0,r-n),className:`morph-reading-band`}}),paths:[],labels:[]},bbox:H}}var Xt=(e,t)=>({rep:`graph`,...Yt(e,t)}),Zt=920,Qt=16,$t=44+Qt,en=12,tn=8,nn=12;function rn(e){if(!e.date||!Number.isFinite(e.date.start))return null;let t=Y(e.date.start),n=e.date.end;return{node:e,startYear:t,...n!==void 0&&Number.isFinite(n)&&n>e.date.start?{endYear:Y(n)}:{}}}var an=e=>rn(e)!==null;function on(e){let t=1/0,n=-1/0;for(let r of e)for(let e of r.nodes){let r=rn(e);r&&(t=Math.min(t,r.startYear),n=Math.max(n,r.endYear??r.startYear))}return t===1/0?null:Ae(t,n,6)}function sn(e){let t=1;for(;t<e;)t*=2;let n=Array(t*2).fill(1/0),r=0;return(e,i)=>{let a=1;if(n[1]<=i)for(;a<t;)a=n[a*2]<=i?a*2:a*2+1;else a=t+r++;let o=a-t;for(n[a]=e;a>1;)a>>=1,n[a]=Math.min(n[a*2],n[a*2+1]);return o}}function cn(e,t,n){let r=[],i=[];for(let n of e.nodes){let e=rn(n);e&&t?r.push(e):i.push(n)}r.sort((e,t)=>e.startYear-t.startYear||e.node.id.localeCompare(t.node.id));let a=new Map,o={bands:[],paths:[],labels:[]},s=[],c=1/0,l=-1/0,u=56;if(r.length>0&&t){let n=g(t.domain,[56,56+Zt]),i=sn(r.length);for(let e of r){let t=n(e.startYear),r=e.endYear===void 0?t:n(e.endYear),s=e.endYear===void 0?t-80:t,d=Math.min(s,t)-32,f=Math.max(s+160,r)+32,p=56+i(f+nn,d)*$t;a.set(e.node.id,{x:s,y:p,w:160,h:44,face:`entry`}),e.endYear!==void 0&&o.bands.push({id:`period:${e.node.id}`,x:t,y:p-6,w:Math.max(r-t,2),h:56,className:`morph-period`}),c=Math.min(c,d),l=Math.max(l,f),u=Math.max(u,p+44)}let d=u+Qt+en;o.paths.push({id:`axis`,d:`M ${J(56)} ${J(d)} L ${J(56+Zt)} ${J(d)}`,className:`morph-axis`}),t.ticks.forEach((e,t)=>{let r=n(e.year);o.paths.push({id:`tick:${t}`,d:`M ${J(r)} ${J(d)} L ${J(r)} ${J(d+tn)}`,className:`morph-tick`}),o.labels.push({id:`tick-label:${t}`,x:r,y:d+tn+16,text:e.text,className:`morph-axis-label`,anchor:`middle`}),c=Math.min(c,r-e.text.length*3.5),l=Math.max(l,r+e.text.length*3.5)}),c=Math.min(c,56),l=Math.max(l,56+Zt),u=d+tn+20;let f=new Set(r.map(e=>e.node.id));for(let t of e.edges){if(t.from===t.to||!f.has(t.from)||!f.has(t.to))continue;let e=a.get(t.from),n=a.get(t.to),r=e.x+e.w/2,i=n.x+n.w/2,o=e.y,c=n.y,l=Math.min(72,Math.max(20,Math.abs(i-r)*.2));s.push({id:t.id,d:`M ${J(r)} ${J(o)} C ${J(r)} ${J(o-l)} ${J(i)} ${J(c-l)} ${J(i)} ${J(c)}`,className:`morph-edge morph-edge--faint`+he(t.kind)})}}let d=Q(i,c===1/0?{x:0,y:0,w:112,h:112}:{x:c-56,y:0,w:l-c+112,h:u+56},`${i.length} with no date — the timeline cannot place these`,n);d.band&&o.bands.push(d.band);for(let[e,t]of d.positions)a.set(e,t);return{positions:a,edgePaths:s,chrome:o,bbox:d.bbox}}var ln=(e,t)=>({rep:`timeline`,...cn(e,on([e]),t?.viewport??ue)}),un={min:me,max:2.2},dn=56,fn=1300,pn=1300,mn=.7,hn=120,gn=120,_n=[`graph`,`flow`,`timeline`,`chart`],vn={graph:Xt,timeline:ln,chart:ft,flow:xt},yn={graph:`What caused what`,timeline:`The same causes, in time`,chart:`How much each one moved`,flow:`How much each one contributed`},bn={graph:()=>!0,timeline:an,chart:ot,flow:bt},xn=2,Sn=1/3;function Cn(e,t){let n=t.nodes.filter(e=>e.parentId===void 0);if(n.length===0)return!1;let r=n.filter(n=>bn[e](n,t)).length;return r>=Math.min(xn,n.length)&&r/n.length>=Sn}var wn=e=>({x:0,y:0,w:e.w,h:e.h}),Tn=(e,t,n)=>[t-e.x,n-e.y];function En(e,t,n){let r=e.positions.get(t);if(!r)return null;let i=r.x,a=r.y,o=r.x+r.w,s=r.y+r.h;for(let r of n.get(t)??[]){let t=e.positions.get(r);!t||t.folded||(i=Math.min(i,t.x),a=Math.min(a,t.y),o=Math.max(o,t.x+t.w),s=Math.max(s,t.y+t.h))}let[c,l]=Tn(e.bbox,i-hn,a-hn);return{x:c,y:l,w:o-i+240,h:s-a+240}}function Dn(e){let{world:t,onAscend:n,driverId:r,insetBottom:i}=e,[a,o]=(0,U.useState)(e.initialRep??`graph`),[s,c]=(0,U.useState)(()=>new Set),[l,u]=(0,U.useState)(null),d=p({clamp:un,margin:dn,...i===void 0?{}:{insetBottom:i}}),m=(0,U.useRef)(void 0),{viewport:h}=d,g=(0,U.useMemo)(()=>h?{w:Math.max(1,h.w-112),h:Math.max(1,h.h-112)}:void 0,[h]),_=(0,U.useMemo)(()=>vn[a](t,{expandedIds:s,previous:m.current,...g?{viewport:g}:{}}),[a,t,s,g]);(0,U.useEffect)(()=>{let e=new Map;for(let[t,n]of _.positions)e.set(t,{x:n.x,y:n.y});m.current=e},[_]);let v=(0,U.useRef)(a);v.current=a;let y=(0,U.useRef)(_);y.current=_;let b=(0,U.useRef)(d.camera);b.current=d.camera;let x=(0,U.useRef)(s);x.current=s;let S=(0,U.useRef)(n);S.current=n;let[C,w]=(0,U.useState)(null),{endFlight:T}=d,E=(0,U.useCallback)(()=>{w({layout:y.current,rep:v.current,expandedIds:x.current}),T()},[T]),O=(0,U.useRef)(0),k=(0,U.useRef)(void 0);(0,U.useEffect)(()=>()=>clearTimeout(k.current),[]);let A=(0,U.useCallback)(e=>{if(e===v.current)return;let t=++O.current;u({layout:y.current,token:t}),clearTimeout(k.current),k.current=setTimeout(()=>{t===O.current&&u(null)},fn),v.current=e,o(e)},[]),j=(0,U.useCallback)(e=>{e===O.current&&(clearTimeout(k.current),u(null))},[]),M=(0,U.useRef)(null),N=(0,U.useCallback)(e=>{let t=new Set(x.current);t.delete(e)||(t.add(e),M.current=e),c(t)},[]),P=(0,U.useMemo)(()=>{let e=new Map;for(let n of t.nodes){if(n.parentId===void 0)continue;let t=e.get(n.parentId);t?t.push(n.id):e.set(n.parentId,[n.id])}return e},[t]),{fitTo:F,setCamera:I,viewportRef:L}=d;(0,U.useEffect)(()=>{let e=M.current;if(M.current=null,e!==null){let t=En(_,e,P);if(t){F(t);return}}F(wn(_.bbox))},[_,P,F,I,L]);let R=(0,U.useMemo)(()=>new Map(t.nodes.map(e=>[e.id,e.parentId])),[t]),z=(0,U.useMemo)(()=>{let e=new Set;for(let t of R.values())t!==void 0&&e.add(t);return e},[R]),B=(0,U.useCallback)(e=>{let t=0,n=e,r=new Set;for(;n!==void 0&&!r.has(n);)r.add(n),n=R.get(n),n!==void 0&&(t+=1);return t},[R]),{zoomAtClient:V}=d,H=(0,U.useCallback)((e,t,n,r)=>{if(e>=1)return r!==void 0&&z.has(r)&&!x.current.has(r)?(N(r),`expand`):(V(e,t,n),`zoom`);let i=L.current?.getBoundingClientRect();if(Xe(`out`,!!i&&(i.width>0||i.height>0)&&f(b.current,wn(y.current.bbox),{w:i.width,h:i.height},dn,un))===`zoom-camera`)return V(e,t,n),`zoom`;let a=[...x.current];if(a.length>0){let e=a[0],t=B(e);for(let n of a){let r=B(n);r>t&&(e=n,t=r)}return N(e),`collapse`}return S.current?.(),`ascend`},[z,N,V,L,B]),W=(0,U.useCallback)(e=>{let t=y.current,n=e===null?void 0:t.positions.get(e);if(!n||n.folded){F(wn(t.bbox));return}let[r,i]=Tn(t.bbox,n.x-gn,n.y-gn);F({x:r,y:i,w:n.w+240,h:n.h+240})},[F]);(0,U.useEffect)(()=>{if(r!==void 0)return D(r,{count:_n.length,setIndex:e=>A(_n[Math.min(_n.length-1,Math.max(0,Math.trunc(e)))]),spokenFor:()=>void 0,captionFor:e=>{let t=_n[e];return t?yn[t]:void 0}})},[r,A]);let G=C?.layout!==_||d.flying;return(0,U.useEffect)(()=>{if(!G)return;let e=setTimeout(E,pn);return()=>clearTimeout(e)},[G,_,E]),{rep:a,setRep:A,layout:_,exiting:l,settleExit:j,expandedIds:s,toggleExpand:N,cam:d,morphing:G,settle:E,lod:d.camera.scale>=mn?`near`:`far`,pinch:H,focusNode:W}}function On({label:e,min:t,max:n,step:r=1,value:i,onChange:a,format:o,color:s=`var(--presence)`}){let c=n-t||1,l=(i-t)/c*100;return(0,G.jsxs)(`label`,{className:`viz-ctl`,style:{"--ctl-c":s,"--ctl-pct":l+`%`},children:[(0,G.jsx)(`span`,{className:`viz-ctl-label`,children:e}),(0,G.jsx)(`input`,{type:`range`,className:`viz-ctl-range`,min:t,max:n,step:r,value:i,"aria-label":e,onChange:e=>a(Number(e.target.value))}),(0,G.jsx)(`span`,{className:`viz-ctl-val tab-num`,children:o?o(i):i.toLocaleString()})]})}var kn=`No cause is established yet, so there is nothing to push on.`;function An(e){let t=(0,W.c)(17),{levers:n,onSet:r,onReset:i}=e,a;t[0]===n?a=t[1]:(a=n.every(Mn),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`WHAT IF`}),t[2]=s):s=t[2];let c;t[3]!==i||t[4]!==o?(c=(0,G.jsxs)(`div`,{className:`tr-levers-head`,children:[s,(0,G.jsx)(`button`,{type:`button`,className:`tr-reset`,onClick:i,disabled:o,children:`Reset`})]}),t[3]=i,t[4]=o,t[5]=c):c=t[5];let l;t[6]===n.length?l=t[7]:(l=n.length===0&&(0,G.jsx)(`p`,{className:`tr-levers-empty`,children:kn}),t[6]=n.length,t[7]=l);let u;if(t[8]!==n||t[9]!==r){let e;t[11]===r?e=t[12]:(e=e=>(0,G.jsx)(On,{label:e.label,min:0,max:100,value:e.pct,onChange:t=>r(e.id,t),format:jn},e.id),t[11]=r,t[12]=e),u=n.map(e),t[8]=n,t[9]=r,t[10]=u}else u=t[10];let d;return t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,G.jsxs)(`div`,{className:`tr-levers`,children:[c,l,u]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function jn(e){return`${e}%`}function Mn(e){return e.pct===100}var Nn=(0,U.memo)(An),Pn=(0,U.createContext)(null);function Fn(){return(0,U.useContext)(Pn)}function In(e){let t=(0,W.c)(19),{id:n,className:r}=e,i=Fn(),a,o,s,c,l,u;if(t[0]!==r||t[1]!==n||t[2]!==i){u=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i?.registry.values.get(n);if(!e){u=null;break bb0}let d=`tr-num`+(r?` ${r}`:``);if(e.kind===`structure`){u=(0,G.jsx)(`span`,{className:`${d} tr-num-qual`,"data-status":`structure`,children:e.resolution.raw});break bb0}a=`button`,o=d,s=ee(e),t[9]!==n||t[10]!==i?(c=e=>i?.open(n,e.currentTarget),t[9]=n,t[10]=i,t[11]=c):c=t[11],l=x(e)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u}else a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8];if(u!==Symbol.for(`react.early_return_sentinel`))return u;let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{className:`tr-sr`,children:`, source available`}),t[12]=d):d=t[12];let f;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==l?(f=(0,G.jsxs)(`button`,{type:a,className:o,"data-status":s,onClick:c,children:[l,d]}),t[13]=a,t[14]=o,t[15]=s,t[16]=c,t[17]=l,t[18]=f):f=t[18],f}var Ln=8,Rn=6;function zn(e,t,n){return Math.max(Ln,Math.min(e,n-t-Ln))}function Bn(e,t,n){if(!(e.width>0||e.height>0||e.left>0||e.top>0))return{left:zn((n.w-t.w)/2,t.w,n.w),top:zn((n.h-t.h)/2,t.h,n.h)};let r=e.bottom+Rn,i=e.top-Rn-t.h,a=r+t.h+Ln>n.h&&i>=Ln;return{left:zn(e.left,t.w,n.w),top:zn(a?i:r,t.h,n.h)}}var Vn=320,Hn=340,Un=8;function Wn(e){let t=(0,W.c)(64),{registry:n,valueId:r,anchorRect:i,trail:a,hinted:o,onMarkHinted:s,onDrill:c,onBack:l,onNavigate:u,onDismiss:f}=e,p=(0,U.useRef)(null),m;t[0]===f?m=t[1]:(m={onEscape:f},t[0]=f,t[1]=m),d(p,m);let[h]=(0,U.useState)(!o),g,_;t[2]===s?(g=t[3],_=t[4]):(g=()=>s(),_=[s],t[2]=s,t[3]=g,t[4]=_),(0,U.useEffect)(g,_);let v=(0,U.useRef)(!0),y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{v.current||p.current?.focus({preventScroll:!0}),v.current=!1},t[5]=y):y=t[5];let w;t[6]===r?w=t[7]:(w=[r],t[6]=r,t[7]=w),(0,U.useEffect)(y,w);let D,O;t[8]===f?(D=t[9],O=t[10]):(D=()=>{let e=e=>{let t=p.current;t&&e.target instanceof Node&&!t.contains(e.target)&&f()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},O=[f],t[8]=f,t[9]=D,t[10]=O),(0,U.useEffect)(D,O);let k=n.values,A,j,M,N,P,F,I,L,R,z,B,V,H,K;if(t[11]!==i||t[12]!==l||t[13]!==c||t[14]!==u||t[15]!==n.usedIn||t[16]!==n.values||t[17]!==a||t[18]!==r){V=Symbol.for(`react.early_return_sentinel`);bb0:{if(K=k.get(r),!K){V=null;break bb0}let e=ee(K),o=K.scope,s=n.usedIn.get(r)??[],d=K.kind===`grounded`?K.resolution.receipt:null,f=K.kind===`grounded`&&K.resolution.tier===`T1`,m=d?.url?T(d.url):null,h=d?d.host??(d.url?E(d.url):null):null,g=K.kind===`calculated`?K.calc.inputs:[],_=g.slice(0,Un),v=g.length-_.length,y;t[33]!==n.values||t[34]!==a?(y=a.length>0?n.values.get(a[a.length-1]):void 0,t[33]=n.values,t[34]=a,t[35]=y):y=t[35];let w=y,D;t[36]===i?D=t[37]:(D=Bn(i,{w:Vn,h:Hn},{w:window.innerWidth,h:window.innerHeight}),t[36]=i,t[37]=D);let{left:O,top:U}=D;H=p,A=`tr-card`,j=`dialog`,M=`false`,N=`Where ${K.label} came from`,P=-1,t[38]!==O||t[39]!==U?(F={left:O,top:U,width:Vn,maxHeight:Hn},t[38]=O,t[39]=U,t[40]=F):F=t[40];let W;t[41]!==l||t[42]!==w?(W=w&&(0,G.jsxs)(`button`,{type:`button`,className:`tr-back`,onClick:l,"aria-label":`Back to ${w.label}`,children:[`‹ back`,(0,G.jsxs)(`span`,{className:`tr-back-to`,children:[` to `,w.label]})]}),t[41]=l,t[42]=w,t[43]=W):W=t[43],I=(0,G.jsxs)(`header`,{className:`tr-head`,children:[W,(0,G.jsx)(`span`,{className:`tr-badge`,"data-status":e,children:C[e]}),(0,G.jsx)(`p`,{className:`tr-figure`,children:x(K)}),(0,G.jsx)(`p`,{className:`tr-label`,children:K.label})]}),L=d&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`SOURCE`}),d.quote&&(0,G.jsxs)(`blockquote`,{className:`tr-quote`,children:[`“`,d.quote,`”`]}),f?(0,G.jsx)(`p`,{className:`tr-host`,children:b(d)}):h&&(0,G.jsxs)(`p`,{className:`tr-host`,children:[m?(0,G.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer noopener`,children:h}):h,d.date&&(0,G.jsxs)(`span`,{className:`tr-date`,children:[` · `,d.date]})]})]}),R=o&&(o.region||o.period||o.unit)&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`SCOPE`}),(0,G.jsx)(`p`,{className:`tr-chips`,children:[o.region,o.period,o.unit].filter(Kn).map(Gn)})]}),z=K.kind===`calculated`&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`CALCULATION`}),(0,G.jsx)(`p`,{className:`tr-formula`,children:S(K.calc.formula,e=>n.values.get(e)?.label)}),(0,G.jsx)(`ul`,{className:`tr-inputs`,children:_.map(e=>{let t=n.values.get(e);return(0,G.jsx)(`li`,{children:t?(0,G.jsxs)(`button`,{type:`button`,className:`tr-input`,onClick:()=>c(e),children:[(0,G.jsx)(`span`,{className:`tr-input-label`,children:t.label}),(0,G.jsx)(`span`,{className:`tr-input-val`,children:x(t)})]}):(0,G.jsx)(`span`,{className:`tr-input tr-input-missing`,children:e})},e)})}),v>0&&(0,G.jsxs)(`p`,{className:`tr-more`,children:[`…and `,v,` more`]}),K.calc.note&&(0,G.jsx)(`p`,{className:`tr-note`,children:K.calc.note})]}),B=s.length>0&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`USED IN`}),(0,G.jsx)(`ul`,{className:`tr-used`,children:s.map(e=>(0,G.jsx)(`li`,{children:u?(0,G.jsx)(`button`,{type:`button`,className:`tr-usedin`,onClick:()=>u(e),children:e.label}):(0,G.jsx)(`span`,{className:`tr-usedin tr-usedin-flat`,children:e.label})},`${e.surface}:${e.id}:${e.label}`))})]})}t[11]=i,t[12]=l,t[13]=c,t[14]=u,t[15]=n.usedIn,t[16]=n.values,t[17]=a,t[18]=r,t[19]=A,t[20]=j,t[21]=M,t[22]=N,t[23]=P,t[24]=F,t[25]=I,t[26]=L,t[27]=R,t[28]=z,t[29]=B,t[30]=V,t[31]=H,t[32]=K}else A=t[19],j=t[20],M=t[21],N=t[22],P=t[23],F=t[24],I=t[25],L=t[26],R=t[27],z=t[28],B=t[29],V=t[30],H=t[31],K=t[32];if(V!==Symbol.for(`react.early_return_sentinel`))return V;let te;t[44]!==K.kind||t[45]!==K.resolution?(te=K.kind===`illustrative`&&(0,G.jsxs)(`p`,{className:`tr-caveat`,children:[`Illustrative — shows the shape, not a measured fact. `,K.resolution.illustrative]}),t[44]=K.kind,t[45]=K.resolution,t[46]=te):te=t[46];let q;t[47]===h?q=t[48]:(q=h&&(0,G.jsx)(`p`,{className:`tr-hint`,children:`Any figure like this one opens its own receipt.`}),t[47]=h,t[48]=q);let ne;return t[49]!==A||t[50]!==j||t[51]!==M||t[52]!==N||t[53]!==P||t[54]!==F||t[55]!==I||t[56]!==L||t[57]!==R||t[58]!==z||t[59]!==B||t[60]!==te||t[61]!==q||t[62]!==H?(ne=(0,G.jsxs)(`div`,{ref:H,className:A,role:j,"aria-modal":M,"aria-label":N,tabIndex:P,style:F,children:[I,L,R,z,B,te,q]}),t[49]=A,t[50]=j,t[51]=M,t[52]=N,t[53]=P,t[54]=F,t[55]=I,t[56]=L,t[57]=R,t[58]=z,t[59]=B,t[60]=te,t[61]=q,t[62]=H,t[63]=ne):ne=t[63],ne}function Gn(e){return(0,G.jsx)(`span`,{className:`tr-chip`,children:e},e)}function Kn(e){return!!e}function qn(e){let t=(0,W.c)(23),{registry:n,onNavigate:r,children:i,ref:a}=e,[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(null),t[0]=u):u=t[0];let d;t[1]===n?d=t[2]:(d=[n],t[1]=n,t[2]=d),(0,U.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>s(null),t[3]=f):f=t[3];let p=f,m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>({dismiss:p}),h=[p],t[4]=m,t[5]=h):(m=t[4],h=t[5]),(0,U.useImperativeHandle)(a,m,h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(e,t)=>{t.focus(),s({valueId:e,anchorRect:t.getBoundingClientRect(),trail:[]})},t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>l(!0),t[7]=v):v=t[7];let y=v,b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{s(t=>t&&{valueId:e,anchorRect:t.anchorRect,trail:[...t.trail,t.valueId]})},t[8]=b):b=t[8];let x=b,S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{s(Jn)},t[9]=S):S=t[9];let C=S,w;t[10]!==c||t[11]!==r||t[12]!==n?(w={registry:n,open:_,onNavigate:r,hinted:c,markHinted:y},t[10]=c,t[11]=r,t[12]=n,t[13]=w):w=t[13];let T=w,E;t[14]!==o||t[15]!==c||t[16]!==r||t[17]!==n?(E=o&&(0,G.jsx)(Wn,{registry:n,valueId:o.valueId,anchorRect:o.anchorRect,trail:o.trail,hinted:c,onMarkHinted:y,onDrill:x,onBack:C,onNavigate:r,onDismiss:p}),t[14]=o,t[15]=c,t[16]=r,t[17]=n,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==E||t[21]!==T?(D=(0,G.jsxs)(Pn.Provider,{value:T,children:[i,E]}),t[19]=i,t[20]=E,t[21]=T,t[22]=D):D=t[22],D}function Jn(e){let t=e?.trail[e.trail.length-1];return!e||t===void 0?e:{valueId:t,anchorRect:e.anchorRect,trail:e.trail.slice(0,-1)}}var Yn=`Recomputed locally from the causes above — a model of what would happen, never an observation.`,Xn=`What was actually measured. This column never moves when a lever is pulled.`;function Zn(e,t){return(e>0?`+`:``)+m(e,t)}function Qn(e){return e!==null&&Number.isFinite(e)&&e>=0&&e<=1}function $n(e){return e.exactBase===null?`nothing measured stands behind this outcome`:`not every step is grounded, so the total stays unmeasured`}function er(e){let t=(0,W.c)(22),{baseline:n,current:r,unit:i,active:a,observedNote:o}=e,s;t[0]!==n.exactBase||t[1]!==n.fullyGrounded||t[2]!==i?(s=n.fullyGrounded&&n.exactBase!==null?m(n.exactBase,i):null,t[0]=n.exactBase,t[1]=n.fullyGrounded,t[2]=i,t[3]=s):s=t[3];let c=s,l=r.exactBase??n.exactBase,u=a?`1`:void 0,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{className:`tr-chip tr-wi-chip`,title:Xn,children:`OBSERVED`}),t[4]=d):d=t[4];let f;t[5]!==n||t[6]!==c||t[7]!==o?(f=(0,G.jsxs)(`div`,{className:`tr-wi-col`,children:[d,c===null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`tr-wi-figure tr-wi-dash`,children:`—`}),(0,G.jsx)(`p`,{className:`tr-wi-note tr-wi-why`,children:o??$n(n)})]}):(0,G.jsx)(`p`,{className:`tr-wi-figure`,children:c})]}),t[5]=n,t[6]=c,t[7]=o,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==l||t[11]!==r.exactDelta||t[12]!==r.explainedPct||t[13]!==r.fullyGrounded||t[14]!==r.relBase||t[15]!==r.relCur||t[16]!==i?(p=a&&(0,G.jsxs)(`div`,{className:`tr-wi-col tr-wi-hypo`,"data-world":`hypothetical`,children:[(0,G.jsx)(`span`,{className:`tr-chip tr-wi-chip tr-wi-chip-hypo`,title:Yn,children:`HYPOTHETICAL (MODELED)`}),r.fullyGrounded&&l!==null&&r.exactDelta!==null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`tr-wi-figure`,children:m(l+r.exactDelta,i)}),(0,G.jsx)(`p`,{className:`tr-wi-delta`,children:Zn(r.exactDelta,i)}),Qn(r.explainedPct)&&(0,G.jsxs)(`p`,{className:`tr-wi-note`,children:[Math.round(r.explainedPct*100),`% explained`]})]}):r.relCur===null?(0,G.jsx)(`p`,{className:`tr-wi-figure tr-wi-dash`,children:`—`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`tr-wi-figure tr-wi-phrase`,children:ne(r.relBase??0,r.relCur)}),(0,G.jsx)(`p`,{className:`tr-wi-note`,children:`relative, not measured`})]})]}),t[9]=a,t[10]=l,t[11]=r.exactDelta,t[12]=r.explainedPct,t[13]=r.fullyGrounded,t[14]=r.relBase,t[15]=r.relCur,t[16]=i,t[17]=p):p=t[17];let h;return t[18]!==u||t[19]!==f||t[20]!==p?(h=(0,G.jsxs)(`div`,{className:`tr-wi`,"data-active":u,children:[f,p]}),t[18]=u,t[19]=f,t[20]=p,t[21]=h):h=t[21],h}var tr=(0,U.memo)(er);function nr(e){return{id:e.id,label:e.label,role:e.role,depth:e.depth,tier:e.tier,...e.value===void 0?{}:{value:e.value},...e.unit?{unit:e.unit}:{},...e.receipt?{receipt:e.receipt}:{}}}function rr(e){let t=e.receipts?.[0]??e.receipt;return{from:e.from,to:e.to,sign:e.sign,tier:e.tier,...e.verb?{verb:e.verb}:{},...e.weight===void 0?{}:{weight:e.weight},...t&&!e.provisional?{receipt:t}:{},...e.provisional?{provisional:!0}:{}}}function ir(e){return{center:e.title,outcomeId:e.outcomeId,nodes:e.nodes.map(nr),edges:e.edges.map(rr),provenance:{...e.provenance.illustrative?{illustrative:!0}:{},...e.provenance.notes?.length?{notes:e.provenance.notes}:{}}}}var ar=e=>`node:${e}`,or=(e,t)=>`node:${e}@${t}`;function sr(e,t){let n=e.provenance.illustrative===!0,r=[],i=[],a=[],o=new Map,s=[],c=new Map,l=(e,t,n)=>{!e||o.has(e.id)||(o.set(e.id,e),s.push(t),i.push(n))},u=(e,t)=>{c.set(e.id,e.label),r.push({id:e.id,label:e.label,role:e.role,...e.detail===void 0?{}:{detail:e.detail},...e.domain===void 0?{}:{domain:e.domain},...t===void 0?{}:{parentId:t}});let i=e.series,a=e.unit??i?.unit,o=t=>({valueId:t,surface:`node`,id:e.id,label:e.label});if(e.value!==void 0){let t=ar(e.id);l(R(t,e.label,e.value,e.tier,a,e.receipt,n),o(t),{valueId:t,entityId:e.id})}if(i)for(let t of i.points){let r=or(e.id,t.t),a=R(r,`${e.label} · ${t.t}`,t.value,i.tier,i.unit,t.receipt??i.receipt,n,t.t);l(a,o(r),{valueId:r,entityId:e.id,at:t.t})}for(let t of e.children??[])u(t,e.id)};for(let t of e.nodes)u(t);return se(e.edges).forEach((e,n)=>{let r=`${c.get(e.from)??e.from} ${e.verb??`→`} ${c.get(e.to)??e.to}`,i=t.edges[n]?.id;if(i!==void 0){a.push({id:i,from:e.from,to:e.to,...e.relation===void 0?{}:{kind:e.relation},...e.sign===void 0?{}:{sign:e.sign},...e.weight===void 0?{}:{weight:e.weight}});for(let t of[e.from,e.to])s.push({valueId:ar(t),surface:`edge`,id:i,label:r})}}),{title:e.title,entities:r,relations:a,facts:i,trust:z(o,s),outcomeId:e.outcomeId,...n?{illustrative:n}:{}}}var cr=1100;function lr(e,t,n,r){let i=!1,a=e=>{i||(i=!0,r(e))};(async()=>{for(let r=Math.max(0,t);r<e.length;r++){let t=e[r];if(!t)continue;if(n.isCancelled()){a(`cancelled`);return}let i=O(t.say),o=n.speakLine?.(t.say)??null,s=o?await j(o):!1;if(n.isCancelled()){a(`cancelled`);return}n.apply(t,r),o&&s?await k(o,i,cr):await A(i)}a(n.isCancelled()?`cancelled`:`complete`)})()}function ur({beats:e,apply:t,speakLine:n}){let[r,i]=(0,U.useState)(-1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(0),c=(0,U.useRef)(e);c.current=e;let l=(0,U.useRef)(t);l.current=t;let u=(0,U.useRef)(n);u.current=n;let d=(0,U.useCallback)(()=>{s.current+=1,o(!1)},[]),f=(0,U.useCallback)(e=>{let t=s.current+=1;o(!0),lr(c.current,e,{speakLine:e=>u.current?.(e)??null,apply:(e,t)=>{i(t),l.current(e,t)},isCancelled:()=>s.current!==t},()=>{s.current===t&&o(!1)})},[]);(0,U.useEffect)(()=>()=>void(s.current+=1),[]),(0,U.useEffect)(()=>{s.current+=1,o(!1),i(-1)},[e]);let p=(0,U.useCallback)(()=>{if(a){d();return}let e=c.current.length;e!==0&&f(r>=0&&r<e-1?r:0)},[a,r,f,d]),m=(0,U.useCallback)(e=>{let t=c.current.length;t!==0&&f(Math.min(Math.max(e,0),t-1))},[f]),h=(0,U.useCallback)(()=>{d(),i(-1)},[d]);return{index:r,playing:a,caption:r>=0?e[r]?.caption??null:null,toggle:p,seek:m,reset:h}}function dr(e){let t=(0,W.c)(28),{count:n,index:r,playing:i,caption:a,expanded:o,onToggle:s,onSeek:c}=e;if(n===0)return null;let l=Math.min(Math.max(r,-1),n-1),u=i?``:void 0,d=o?``:void 0,f=`${o?108:54}px`,p;t[0]===f?p=t[1]:(p={"--wo-transport-h":f},t[0]=f,t[1]=p);let m=p,h=i?`Pause the walkthrough`:`Walk me through it`,g=i?`❙❙`:`▶`,_;t[2]===g?_=t[3]:(_=(0,G.jsx)(`span`,{className:`wo-play-glyph`,"aria-hidden":`true`,children:g}),t[2]=g,t[3]=_);let v=i?`Pause`:`Walk me through it`,y;t[4]===v?y=t[5]:(y=(0,G.jsx)(`span`,{className:`wo-play-label`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==s||t[7]!==y||t[8]!==h||t[9]!==_?(b=(0,G.jsxs)(`button`,{type:`button`,className:`wo-play`,onClick:s,"aria-label":h,children:[_,y]}),t[6]=s,t[7]=y,t[8]=h,t[9]=_,t[10]=b):b=t[10];let x;t[11]!==l||t[12]!==n||t[13]!==o||t[14]!==c?(x=o&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`wo-track`,role:`group`,"aria-label":`Walkthrough beats`,children:Array.from({length:n},(e,t)=>(0,G.jsx)(`button`,{type:`button`,className:`wo-tick`,"data-state":t<l?`past`:t===l?`now`:`ahead`,onClick:()=>c(t),"aria-label":`Beat ${t+1} of ${n}`,"aria-current":t===l?`step`:void 0},t))}),(0,G.jsxs)(`span`,{className:`wo-transport-count`,"aria-hidden":`true`,children:[l<0?n:l+1,`/`,n]})]}),t[11]=l,t[12]=n,t[13]=o,t[14]=c,t[15]=x):x=t[15];let S;t[16]!==b||t[17]!==x?(S=(0,G.jsxs)(`div`,{className:`wo-transport-row`,children:[b,x]}),t[16]=b,t[17]=x,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==o?(C=o&&(0,G.jsx)(`p`,{className:`wo-caption`,"aria-live":`polite`,children:a===null?``:M(a)}),t[19]=a,t[20]=o,t[21]=C):C=t[21];let w;return t[22]!==u||t[23]!==S||t[24]!==C||t[25]!==d||t[26]!==m?(w=(0,G.jsxs)(`div`,{className:`wo-transport`,"data-playing":u,"data-open":d,style:m,children:[S,C]}),t[22]=u,t[23]=S,t[24]=C,t[25]=d,t[26]=m,t[27]=w):w=t[27],w}var fr=170,pr={contributes:`fed by`,causes:`driven by`,dampens:`held back by`,enables:`made possible by`,correlates:`moving together with`},mr={1:`pushed up by`,[-1]:`pushed down by`};function hr(e){let t=e.split(` `,1)[0]??``;return t.length===0||/[A-Z]/.test(t.slice(1))?e:e[0].toLowerCase()+e.slice(1)}var gr={graph:`And that is how the causes fit together.`,timeline:`And here are the same causes, in time.`,chart:`And here is what each one actually measured.`,flow:`And here is how much each one contributed.`};function _r(e,t){let n=e.values.get(ar(t));if(!n||n.kind===`structure`)return null;let r=x(n);return n.kind===`illustrative`?{say:`Illustratively, about ${r}.`,shown:`Illustratively, about ${r}.`}:{say:`Measured at ${r}.`,shown:`Measured at ${r}.`}}function vr(e){return e.kind?e.kind===`dampens`||e.kind===`enables`||e.kind===`correlates`:e.sign===-1}function yr(e){return e.kind&&pr[e.kind]?pr[e.kind]:mr[e.sign??1]??`fed by`}function br(e){let t=e.nodes.filter(e=>e.parentId===void 0),n=new Set(t.map(e=>e.id)),r=e.edges.filter(e=>n.has(e.from)&&n.has(e.to)),i=new Map(t.map(e=>[e.id,e.depth??0])),a=new Map;for(let e of r)a.set(e.from,(a.get(e.from)??0)+(e.weight??0));let o=new Map(t.map(e=>[e.id,0]));for(let e of r)o.set(e.to,(o.get(e.to)??0)+1);let s=(e,t)=>(i.get(e)??0)-(i.get(t)??0)||(a.get(t)??0)-(a.get(e)??0)||(e<t?-1:+(e>t)),c=t.filter(e=>o.get(e.id)===0).map(e=>e.id),l=[],u=new Set;for(;c.length>0;){c.sort(s);let e=c.shift();if(!(e===void 0||u.has(e))){u.add(e),l.push(e);for(let t of r){if(t.from!==e)continue;let n=(o.get(t.to)??0)-1;o.set(t.to,n),n<=0&&!u.has(t.to)&&c.push(t.to)}}}for(let e of t.map(e=>e.id).sort(s))u.has(e)||l.push(e);return l}function xr(e,t,n,r={}){let i=br(t);if(i.length<2)return[];let c=new Map(e.nodes.map(e=>[e.id,e])),l=new Map(t.nodes.map(e=>[e.id,e.label])),u=new Map(i.map((e,t)=>[e,t])),d=e=>t.edges.filter(t=>t.to===e&&u.has(t.from)&&(u.get(t.from)??0)<(u.get(e)??0)).sort((e,t)=>(t.weight??0)-(e.weight??0)||(e.id<t.id?-1:1))[0],f=[],p=i.at(-1)===e.outcomeId?i.length-1:i.length,m=p===1?`One cause, one outcome. Here is how it connects.`:`${p} causes, one outcome. Here is how they connect.`;f.push({nodeId:e.outcomeId,wide:!0,rep:`graph`,say:m,caption:m});let h=null;for(let[t,r]of i.entries()){let u=c.get(r),p=l.get(r)??r,m=d(r),g=r===e.outcomeId&&t===i.length-1,_=m?l.get(m.from)??m.from:null,v;v=g?m?`And it ends here: ${hr(p)}, ${yr(m)} ${m.from===h?`it`:hr(_??``)}.`:`And it ends here: ${hr(p)}.`:m?m.from===h?vr(m)?`Then ${hr(p)}, ${yr(m)} it.`:`Then ${hr(p)}.`:`${p}, ${yr(m)} ${hr(_??``)}.`:t===0?`It starts with ${hr(p)}.`:`Alongside it: ${p}.`,h=r;let y=[v],b=[v],x=_r(n,r);x&&(y.push(x.say),b.push(x.shown));let S=u?.detail;S&&(y.push(s(a(S),fr)),b.push(s(o(S),fr))),f.push({nodeId:r,...m?{edgeId:m.id}:{},say:y.join(` `),caption:b.join(` `)})}if(r.closeOn){let t=gr[r.closeOn];f.push({nodeId:e.outcomeId,wide:!0,rep:r.closeOn,say:t,caption:t})}return f}r();var Sr=[{rep:`graph`,label:`Graph`},{rep:`flow`,label:`Contribution`},{rep:`timeline`,label:`Over time`},{rep:`chart`,label:`As a chart`}],Cr={graph:`Left to right is what led to what. Colour is the direction of the push; thickness is how much of the outcome the link explains.`,timeline:`Left to right is WHEN, read against the axis below; a bar is how long a cause lasted. Height only keeps entries from overlapping — it means nothing.`,chart:`Each mark is a cause plotted against its own measured history. Causes with nothing measured are held aside rather than drawn at zero.`,flow:`Ribbon thickness is how much of the outcome that link was MEASURED to explain. A cause whose links carry no measured share is held aside rather than drawn thin, which would read as a finding nobody made.`},wr=`an illustrative world measures nothing, so there is no baseline`;function Tr(e,t){for(let n of e){if(n.id===t)return n.children;let e=n.children===void 0?void 0:Tr(n.children,t);if(e)return e}}function Er(e){let{value:t,...n}=e;return n}function Dr(e,t){let n=new Map;for(let[r,i]of e.relativeByNode){let e=t.relativeByNode.get(r)??0;i>0&&n.set(r,e/i)}return n}function Or(e,t,n,r){return{exactBase:n??null,exactDelta:e.outcomeDelta,explainedPct:e.explainedPct,fullyGrounded:e.fullyGrounded&&!r,relBase:t.relativeOutcome,relCur:e.relativeOutcome}}function kr(e){let t=(0,W.c)(12),{spec:n,question:r,failed:i,onRetry:a,onClose:o,view:s,onExpandNode:c,autoWalk:l,speakLine:u}=e;if(n){let e;return t[0]!==l||t[1]!==o||t[2]!==c||t[3]!==u||t[4]!==n||t[5]!==s?(e=(0,G.jsx)(jr,{spec:n,view:s,onClose:o,onExpandNode:c,autoWalk:l,speakLine:u}),t[0]=l,t[1]=o,t[2]=c,t[3]=u,t[4]=n,t[5]=s,t[6]=e):e=t[6],e}let d=r??``,f=i===!0,p;return t[7]!==o||t[8]!==a||t[9]!==d||t[10]!==f?(p=(0,G.jsx)(Ar,{title:d,failed:f,onRetry:a,onClose:o}),t[7]=o,t[8]=a,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function Ar(e){let t=(0,W.c)(17),{title:n,failed:r,onRetry:i,onClose:a}=e,o=`Living answer: ${n}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`wo-kicker`,children:`THE LIVING ANSWER`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,G.jsxs)(`div`,{className:`wo-title`,children:[s,(0,G.jsx)(`h2`,{children:n})]}),t[1]=n,t[2]=c);let l;t[3]===a?l=t[4]:(l=a&&(0,G.jsx)(`div`,{className:`wo-head-actions`,children:(0,G.jsx)(`button`,{type:`button`,className:`wo-btn wo-btn-close`,onClick:a,"aria-label":`Close`,children:`✕`})}),t[3]=a,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,G.jsxs)(`header`,{className:`wo-head`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==r||t[9]!==i?(d=(0,G.jsx)(`div`,{className:`wo-shell`,role:`status`,"aria-live":`polite`,children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`wo-shell-line`,children:`This world didn’t come back.`}),(0,G.jsx)(`p`,{className:`wo-shell-note`,children:`Nothing was built, and Mavéa won’t stand in a causal web it can’t source. The answer behind this card is untouched.`}),i&&(0,G.jsx)(`button`,{type:`button`,className:`wo-btn`,onClick:i,children:`Try again`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`wo-shell-pulse`,"aria-hidden":`true`}),(0,G.jsx)(`p`,{className:`wo-shell-line`,children:`Building this world…`}),(0,G.jsx)(`p`,{className:`wo-shell-note`,children:`One model call, grounded in what this answer already found. Once it is built it is kept — re-opening it, and replaying this turn, costs nothing.`})]})}),t[8]=r,t[9]=i,t[10]=d):d=t[10];let f;t[11]!==u||t[12]!==d?(f=(0,G.jsxs)(`div`,{className:`wo-panel`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==o||t[15]!==f?(p=(0,G.jsx)(`section`,{className:`wo-scrim`,"aria-label":o,children:f}),t[14]=o,t[15]=f,t[16]=p):p=t[16],p}function jr({spec:e,view:t,onClose:n,onExpandNode:r,autoWalk:a,speakLine:o}){let[s,d]=(0,U.useState)(()=>new Map),[f,p]=(0,U.useState)(null),m=(0,U.useMemo)(()=>{if(s.size===0)return e;let t=e;for(let[e,n]of s)t=F(t,e,n);return t},[e,s]),h=m.provenance.illustrative===!0,g=(0,U.useMemo)(()=>le(m),[m]),_=(0,U.useMemo)(()=>sr(m,g),[m,g]),v=_.trust,y=(0,U.useMemo)(()=>ir(m),[m]),[b,x]=(0,U.useState)(()=>new Map),[S,C]=(0,U.useState)(null),[w,T]=(0,U.useState)(!1),E=(0,U.useMemo)(()=>[...b.values()].some(e=>e!==100),[b]),D=(0,U.useMemo)(()=>[...b].map(([e,t])=>({nodeId:e,pct:t/100})),[b]),O=(0,U.useMemo)(()=>H(y,[]),[y]),k=(0,U.useMemo)(()=>H(y,D),[y,D]),A=(0,U.useMemo)(()=>E?Dr(O,k):null,[E,O,k]),j=(0,U.useDeferredValue)(A),M=(0,U.useCallback)(e=>Cn(e,g),[g]),P=t&&M(t)?t:void 0,R=Dn({world:g,insetBottom:w?108:54,...P?{initialRep:P}:{}}),{rep:z,setRep:W,expandedIds:ee,toggleExpand:K}=R;(0,U.useEffect)(()=>{P&&W(P)},[P,W]);let te=(0,U.useMemo)(()=>{let e=g.nodes.map(e=>{let t=Er(e),n=j?.get(e.parentId??e.id),r=N(e.label);return{...t,label:r,...n===void 0?{}:{shift:n}}});return{...g,nodes:e}},[g,j]),q=(0,U.useMemo)(()=>{let e=new Map,t=n=>{e.set(n.id,n);for(let e of n.children??[])t(e)};for(let e of m.nodes)t(e);return e},[m]),ne=(0,U.useMemo)(()=>{let e=se(m.edges);return new Map(g.edges.map((t,n)=>[t.id,e[n]]))},[g,m]),re=(0,U.useMemo)(()=>new Set(g.nodes.map(e=>e.parentId).filter(e=>e!==void 0)),[g]),ae=(0,U.useRef)(null),oe=(0,U.useCallback)(()=>ae.current?.dismiss(),[]),ce=(0,U.useCallback)(e=>{(e.surface===`node`||e.surface===`edge`)&&C({kind:e.surface,id:e.id})},[]),[ue,de]=(0,U.useState)(void 0),fe=M(`timeline`)?`timeline`:void 0,[pe,me]=(0,U.useState)([]);(0,U.useEffect)(()=>{let e=globalThis.requestIdleCallback,t=()=>me(xr(m,g,v,fe?{closeOn:fe}:{}));if(typeof e==`function`){let n=e(t,{timeout:2e3});return()=>globalThis.cancelIdleCallback?.(n)}let n=setTimeout(t,1);return()=>clearTimeout(n)},[m,g,v,fe]);let{focusNode:J}=R,he=(0,U.useCallback)(e=>{e.rep&&W(e.rep),C({kind:`node`,id:e.nodeId}),de(e.edgeId),e.wide?J(null):e.rep||J(e.nodeId)},[J,W]),{index:ge,playing:Y,caption:_e,toggle:ve,seek:ye,reset:be}=ur((0,U.useMemo)(()=>({beats:pe,apply:he,...o?{speakLine:o}:{}}),[pe,he,o]));(0,U.useEffect)(()=>{T(Y||ge>=0)},[Y,ge]);let xe=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!a||xe.current||pe.length===0||(xe.current=!0,ve())},[a,pe.length,ve]);let X=(0,U.useCallback)(()=>{be(),de(void 0)},[be]),Se=(0,U.useRef)(n);Se.current=n;let Ce=(0,U.useRef)(ve);Ce.current=ve;let we=(0,U.useRef)(X);we.current=X,(0,U.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){we.current(),Se.current?.();return}(e.key===` `||e.key===`Spacebar`)&&(e.target?.closest(`button, input, select, textarea, [contenteditable="true"]`)||(e.preventDefault(),Ce.current()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let Te=(0,U.useCallback)(e=>{X(),C({kind:`node`,id:e.id})},[X]),Ee=(0,U.useCallback)(e=>{X(),C({kind:`edge`,id:e})},[X]),De=(0,U.useCallback)((e,t)=>{X(),x(n=>new Map(n).set(e,t))},[X]),Oe=(0,U.useCallback)(()=>{X(),x(new Map)},[X]),ke=(0,U.useCallback)(e=>g.nodes.find(t=>t.id===e)?.parentId===void 0,[g]),Ae=(0,U.useCallback)(e=>{!r||f!==null||(p(e),r(e,m).then(t=>{p(null);let n=t===null?void 0:Tr(t.nodes,e);n?.length&&(d(t=>new Map(t).set(e,n)),ke(e)?K(e):C({kind:`node`,id:e}))},()=>p(null)))},[r,ke,f,m,K]),je=(0,U.useCallback)((e,t)=>{if(t===`entry`&&z===`timeline`){let t=q.get(e.id),n=t?.date,r=t?.series?.points,i=n?.until!==void 0||(r?.length??0)>1,a=n?.t??r?.[0]?.t;return i||!a?null:(0,G.jsx)(`span`,{className:`wo-when`,"data-said":e.dateGrounded?``:void 0,children:a})}if(t!==`card`)return null;let n=ee.has(e.id),i=re.has(e.id),a=e.parentId===void 0,o=!i&&r!==void 0,s=i&&a,c=f===e.id;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(In,{id:ar(e.id),className:`wo-num`}),e.shift!==void 0&&ie(e.shift)!==null&&(0,G.jsx)(`span`,{className:`wo-shift`,"data-dir":e.shift<1?`down`:`up`,children:ie(e.shift)}),(s||o)&&(0,G.jsx)(`button`,{type:`button`,className:`wo-expand`,"aria-expanded":n,"aria-busy":c||void 0,disabled:c||o&&f!==null,"aria-label":`${s&&n?`Fold up`:`Break down`} ${e.label}`,onClick:t=>{t.stopPropagation(),s?K(e.id):Ae(e.id)},children:c?`breaking down…`:s&&n?`fold up`:`break down`})]})},[re,ee,K,r,f,Ae,q,z]),Z=q.get(m.outcomeId),Me=(0,U.useMemo)(()=>Or(O,O,Z?.value,h),[O,Z?.value,h]),Ne=(0,U.useMemo)(()=>Or(k,O,Z?.value,h),[k,O,Z?.value,h]),Pe=(0,U.useMemo)(()=>({causes:m.nodes.length,links:m.edges.length,sourced:m.nodes.filter(e=>e.receipt!==void 0).length}),[m]),Q=S?.kind===`node`?q.get(S.id):void 0,Fe=(0,U.useMemo)(()=>Q===void 0?[]:B(_,Q.id),[_,Q]),[Ie,Le]=(0,U.useState)(null);(0,U.useEffect)(()=>{if(Q===void 0){Le(null);return}let e=!0;return(async()=>{let{hierarchyLens:t}=await i(async()=>{let{hierarchyLens:e}=await import(`./lens-ChFJD9il.js`);return{hierarchyLens:e}},__vite__mapDeps([0,1,2,3]));if(!e)return;let n=t.compile(_,Q.id);if(n===null){Le(null);return}await c(l([n.block]));let r=u(n.block.type);e&&r&&Le({plan:n,render:r})})(),()=>{e=!1}},[_,Q]);let $=S?.kind===`edge`?ne.get(S.id):void 0,Re=(0,U.useMemo)(()=>m.nodes.filter(e=>e.role===`root`).map(e=>({id:e.id,label:N(e.label),pct:b.get(e.id)??100})),[m.nodes,b]);return(0,G.jsx)(qn,{registry:v,onNavigate:ce,ref:ae,children:(0,G.jsx)(`section`,{className:`wo-scrim`,"aria-label":`Living answer: ${m.title}`,children:(0,G.jsxs)(`div`,{className:`wo-panel`,children:[(0,G.jsxs)(`header`,{className:`wo-head`,children:[(0,G.jsxs)(`div`,{className:`wo-title`,children:[(0,G.jsx)(`span`,{className:`wo-kicker`,children:`THE LIVING ANSWER`}),(0,G.jsx)(`h2`,{children:m.title})]}),(0,G.jsxs)(`div`,{className:`wo-head-actions`,children:[(0,G.jsx)(`div`,{className:`wo-views`,role:`group`,"aria-label":`View`,children:Sr.filter(e=>M(e.rep)).map(e=>(0,G.jsx)(`button`,{type:`button`,className:`wo-chip`,"aria-pressed":z===e.rep,onClick:()=>{X(),W(e.rep)},children:e.label},e.rep))}),(0,G.jsx)(`button`,{type:`button`,className:`wo-btn`,onClick:Oe,disabled:!E,children:`Reset`}),n&&(0,G.jsx)(`button`,{type:`button`,className:`wo-btn wo-btn-close`,onClick:n,"aria-label":`Close`,children:`✕`})]})]}),h&&(0,G.jsx)(`div`,{className:`wo-banner wo-banner-illustrative`,children:`Illustrative model — shows the shape, not your numbers.`}),(0,G.jsx)(`p`,{className:`wo-legend`,children:Cr[z]}),(0,G.jsxs)(`div`,{className:`wo-body`,children:[(0,G.jsxs)(`div`,{className:`wo-stage`,onWheelCapture:oe,onPointerDownCapture:oe,children:[(0,G.jsx)(Je,{stage:R,world:te,renderFace:je,onNodeClick:Te,onEdgeClick:Ee,selectedId:S?.kind===`node`?S.id:void 0,litEdgeId:ue}),(0,G.jsx)(dr,{count:pe.length,index:ge,playing:Y,caption:_e,expanded:w,onToggle:ve,onSeek:ye})]}),(0,G.jsxs)(`aside`,{className:`wo-rail`,children:[(0,G.jsx)(Nn,{levers:Re,onSet:De,onReset:Oe}),(0,G.jsx)(tr,{baseline:Me,current:Ne,unit:Z?.unit,active:E,observedNote:h?wr:void 0}),(0,G.jsxs)(`div`,{className:`wo-detail`,children:[(0,G.jsx)(`span`,{className:`wo-rail-kicker`,children:`EVIDENCE`}),!S&&(0,G.jsxs)(`div`,{className:`wo-standing`,children:[(0,G.jsxs)(`dl`,{className:`wo-facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Causes`}),(0,G.jsx)(`dd`,{children:Pe.causes})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Links`}),(0,G.jsx)(`dd`,{children:Pe.links})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:h?`Illustrative`:`With a source`}),(0,G.jsx)(`dd`,{children:h?`every cause`:Pe.sourced})]})]}),Z&&(0,G.jsxs)(`p`,{className:`wo-standing-outcome`,children:[(0,G.jsx)(`span`,{className:`wo-standing-lead`,children:`It ends at`}),` `,Z.label,Z.detail?(0,G.jsx)(`span`,{className:`wo-standing-note`,children:Z.detail}):null]}),(0,G.jsx)(`p`,{className:`wo-hint`,children:`Tap a cause or a link to see what stands behind it.`})]}),Q&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`wo-detail-title`,children:Q.label}),Q.detail&&(0,G.jsx)(`p`,{className:`wo-detail-note`,children:Q.detail}),(0,G.jsx)(`p`,{className:`wo-detail-figure`,children:(0,G.jsx)(In,{id:ar(Q.id)})}),Q.series&&(0,G.jsx)(`ul`,{className:`wo-series`,children:Q.series.points.map((e,t)=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`wo-series-t`,children:e.t}),(0,G.jsx)(In,{id:or(Q.id,e.t)})]},`${e.t}:${t}`))}),(Ie||Fe.length>0)&&(0,G.jsxs)(`div`,{className:`wo-parts`,children:[(0,G.jsx)(`span`,{className:`wo-rail-kicker`,children:`WHAT THIS IS MADE OF`}),Ie?Ie.render(Ie.plan.block.props,{delay:0}):(0,G.jsx)(`ul`,{className:`wo-part-list`,children:Fe.map(e=>(0,G.jsx)(`li`,{children:N(e.label)},e.id))})]})]}),$&&(0,G.jsx)(V,{relation:L($.relation),sign:$.sign,status:$.status??I($),receipts:$.receipts??($.receipt?[$.receipt]:[]),counter:$.counter,provisional:$.provisional})]})]})]})]})})})}export{kr as WorldOverlay};
|
|
2
|
+
import{t as e}from"./react-BZJXY1be.js";import{t}from"./compiler-runtime-qQQXpJgv.js";import{t as n}from"./jsx-runtime-DeHZSEgm.js";import{n as r,t as i}from"./preload-helper-CiWYd9n-.js";import{a,i as o,s}from"./spokenText-C88IQJ0M.js";import{i as c,n as l,t as u}from"./loader-ChcXMM9W.js";import{t as d}from"./useFocusTrap-CJmpNZv2.js";import{r as f,t as p}from"./useSpatialCanvas-CfmZOXXP.js";import{i as m}from"./format-q0LwBjID.js";import{a as h,i as g,n as _,r as v}from"./scale-Bcgfo6Hp.js";import{t as y}from"./spreadLabels-CQ8hufvK.js";import{a as b,i as x,n as S,t as C}from"./display-CAb_PiGv.js";import{t as w}from"./types-C42I77wh.js";import{r as T,t as E}from"./sourceHost-BV3t2XDb.js";import{r as D}from"./stepDriver-DwjFet6U.js";import{c as O,l as k,o as A,u as j}from"./walkSync-DC9iE0BX.js";import{n as M}from"./emphasize-BqCIst-B.js";import{c as N,s as P,t as F}from"./validate-sGUCmPAs.js";import{n as I,s as L}from"./receipts-D7zveV-I.js";import{n as R,r as z}from"./value-Dx7DZob4.js";import{t as B}from"./types-DuEbJpIA.js";import{n as V,t as H}from"./engine-BiM6INsW.js";var U=e(),W=t(),G=n();function ee(e){return e.kind}var K=.33,te=.1,q=.005;function ne(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return`would barely change`;let n=Math.abs(e)>1e-9?Math.abs(e):1,r=(t-e)/n,i=Math.abs(r);if(i<=q)return`would barely change`;let a=r>0?`rise`:`fall`;return i>=K?`would ${a} meaningfully`:i>=te?`would ${a} somewhat`:`would ${a} slightly`}var re=.6;function ie(e){if(!Number.isFinite(e))return null;let t=e-1,n=Math.abs(t);if(n<=.005)return null;let r=t>0?`stronger`:`weaker`;return n>=re?`much ${r}`:n>=K?r:`slightly ${r}`}function ae(e){let t=[];for(let n of e?.points??[]){let e=P(n.t);e===null||!Number.isFinite(n.value)||t.push({t:e,v:n.value})}return t.sort((e,t)=>e.t-t.t)}function oe(e,t){let n=e.date?P(e.date.t):null;if(n!==null){let t=e.date?.until?P(e.date.until):null;return t!==null&&t>n?{start:n,end:t}:{start:n}}if(t.length===0)return null;let r=t[0].t,i=t[t.length-1].t;return i>r?{start:r,end:i}:{start:r}}function se(e){return e.filter(e=>e.from!==e.to)}function ce(e){return se(e).map((e,t)=>({id:e.id??`${e.from}->${e.to}#${t}`,from:e.from,to:e.to,sign:e.sign,...e.relation===void 0?{}:{kind:e.relation},...typeof e.weight==`number`?{weight:e.weight}:{},...e.provisional?{provisional:!0}:{}}))}function le(e){let t=[],n=(e,r,i=0)=>{if(i>1)return;let a=ae(e.series),o=e.unit??e.series?.unit,s=oe(e,a);t.push({id:e.id,label:e.label,role:e.role,depth:e.depth,tier:e.tier,...e.value===void 0?{}:{value:e.value},...o===void 0?{}:{unit:o},...a.length>0?{series:a}:{},...s?{date:s}:{},...s&&e.date&&w(e.date.tier??`T0`)?{dateGrounded:!0}:{},...e.domain===void 0?{}:{domain:e.domain},...r===void 0?{}:{parentId:r}});for(let t of e.children??[])n(t,e.id,i+1)};for(let t of e.nodes)n(t);return{nodes:t,edges:ce(e.edges),outcomeId:e.outcomeId}}var ue={w:1090,h:650},de=1.4,fe=86*de;160*de;var pe=116*de,me=9/(11*de),J=e=>String(Math.round(e*100)/100),he=e=>e&&/^[a-z-]{1,24}$/.test(e)?` morph-edge--rel-${e}`:``,ge=525949.2*60*1e3,Y=e=>1970+e/ge,_e=e=>(e-1970)*ge,ve=6e4,ye=60*ve,be={minute:ve,hour:ye,day:24*ye,month:ge/12},xe=[{grain:`minute`,n:1},{grain:`minute`,n:5},{grain:`minute`,n:10},{grain:`minute`,n:15},{grain:`minute`,n:30},{grain:`hour`,n:1},{grain:`hour`,n:2},{grain:`hour`,n:3},{grain:`hour`,n:6},{grain:`hour`,n:12},{grain:`day`,n:1},{grain:`day`,n:2},{grain:`day`,n:5},{grain:`day`,n:10},{grain:`month`,n:1},{grain:`month`,n:2},{grain:`month`,n:3},{grain:`month`,n:6}],X=3,Se=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Ce=64;function we(e){let t=new Date(0);return t.setUTCFullYear(Math.floor(e/12),(e%12+12)%12,1),t.setUTCHours(0,0,0,0),t.getTime()}function Te(e,t,n){if(t.grain===`month`){let r=new Date(e),i=Math.floor((r.getUTCFullYear()*12+r.getUTCMonth())/t.n)*t.n,a=we(i);return n&&a<e?we(i+t.n):a}let r=be[t.grain]*t.n,i=Math.floor(e/r)*r;return n&&i<e?i+r:i}function Ee(e,t){let n=new Date(e);if(!Number.isFinite(n.getTime()))return String(Math.round(Y(e)));let r=`${Se[n.getUTCMonth()]} ${n.getUTCFullYear()}`;if(t===`month`)return r;let i=`${n.getUTCDate()} ${r}`;if(t===`day`||n.getUTCHours()===0&&n.getUTCMinutes()===0)return i;let a=e=>String(e).padStart(2,`0`);return`${a(n.getUTCHours())}:${a(n.getUTCMinutes())}`}function De(e,t){if(t.grain!==`month`)return e+be[t.grain]*t.n;let n=new Date(e);return we(n.getUTCFullYear()*12+n.getUTCMonth()+t.n)}function Oe(e,t,n){let r=Te(_e(e),n,!1),i=Te(_e(t),n,!0),a=[];for(let e=r;e<=i&&a.length<Ce;e=De(e,n))a.push({year:Y(e),text:Ee(e,n.grain)});return{domain:[Y(r),Y(i)],ticks:a}}function ke(e,t,n){let r=Math.max(1,Math.round(v(t-e,n))),i=Math.floor(e/r)*r,a=Math.ceil(t/r)*r,o=[];for(let e=i;e<=a&&o.length<Ce;e+=r)o.push({year:e,text:String(e)});return{domain:[i,a],ticks:o}}function Ae(e,t,n=6){let[r,i]=e<t?[e,t]:[e-.5,t+.5];if(i-r>=X)return ke(r,i,n);let a=(i-r)*ge/n,o=xe[xe.length-1],s=1/0;for(let e of xe){let t=Math.abs(Math.log(be[e.grain]*e.n/a));t<s&&(s=t,o=e)}return Oe(r,i,o)}var je=8,Z=12,Me=16,Ne=6,Pe=12+Math.ceil(15.525*de);function Q(e,t,n,r=ue){let i=new Map;if(e.length===0)return{positions:i,band:null,bbox:t};let a=pe+Me,o=44*de+Ne,s=Math.max(t.w,r.w),c=Math.max(1,Math.floor((s-24+Me)/a)),l=Math.min(e.length,c),u=Math.ceil(e.length/c),d=l*pe+(l-1)*Me,f={id:`shelf`,x:t.x,y:t.y+t.h+je,w:Math.max(t.w,d+24),h:Pe+Ne+u*o-Ne+Z,className:`morph-shelf`,label:n};return e.forEach((e,t)=>{i.set(e.id,{x:f.x+Z+t%c*a,y:f.y+Pe+Ne+Math.floor(t/c)*o,w:116,h:44,face:`entry`,shelved:!0})}),{positions:i,band:f,bbox:{x:t.x,y:t.y,w:Math.max(t.w,f.w),h:f.y+f.h-t.y}}}var Fe=440,Ie=2,Le=1.25,$=320;function Re(e){if(!(e===void 0||!Number.isFinite(e))){if(e<.995)return`weaker`;if(e>1.005)return`stronger`}}function ze(){let e=(0,W.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`marker`,{id:`mv-arrow`,className:`mv-marker mv-marker-up`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:13,markerHeight:13,orient:`auto`,children:(0,G.jsx)(`path`,{d:`M0.5 1 L9.5 5 L0.5 9 Z`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(`marker`,{id:`mv-arrow-damp`,className:`mv-marker mv-marker-down`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:17,markerHeight:17,orient:`auto`,children:(0,G.jsx)(`path`,{d:`M8 0.6 L8 9.4`})}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsx)(`marker`,{id:`mv-arrow-open`,className:`mv-marker mv-marker-open`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:13,markerHeight:13,orient:`auto`,children:(0,G.jsx)(`path`,{d:`M1 1.4 L9 5 L1 8.6 Z`})}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(`marker`,{id:`mv-arrow-ring`,className:`mv-marker mv-marker-ring`,viewBox:`0 0 10 10`,refX:`7.4`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:13,markerHeight:13,orient:`auto`,children:(0,G.jsx)(`circle`,{cx:`5`,cy:`5`,r:`3`})}),e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(`defs`,{children:[t,n,r,i,(0,G.jsx)(`marker`,{id:`mv-dot`,className:`mv-marker mv-marker-dot`,viewBox:`0 0 10 10`,refX:`5`,refY:`5`,markerUnits:`userSpaceOnUse`,markerWidth:9,markerHeight:9,orient:`auto`,children:(0,G.jsx)(`circle`,{cx:`5`,cy:`5`,r:`2.6`})})]}),e[4]=a):a=e[4],a}function Be(e,t){let n=(0,W.c)(5),r;n[0]===e.current?r=n[1]:(r=()=>{let t=e.current;if(!t||window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let n=t.querySelectorAll(`[data-draw]:not(.m-draw-path):not([data-drawn])`),r=Array.from(n,He);n.forEach((e,t)=>{let n=r[t];n!==null&&(e.style.setProperty(`--path-len`,`${n}px`),e.style.setProperty(`--delay`,`${Fe}ms`),e.classList.add(`m-draw-path`))});let i=Ve;return t.addEventListener(`animationend`,i),()=>t.removeEventListener(`animationend`,i)},n[0]=e.current,n[1]=r);let i;n[2]!==t||n[3]!==e?(i=[e,t],n[2]=t,n[3]=e,n[4]=i):i=n[4],(0,U.useEffect)(r,i)}function Ve(e){if(e.animationName!==`mavea-draw`)return;let t=e.target;t.classList.remove(`m-draw-path`),t.style.removeProperty(`--path-len`),t.style.removeProperty(`--delay`),t.dataset.drawn=``}function He(e){return typeof e.getTotalLength==`function`?e.getTotalLength():null}function Ue(e){let t=(0,W.c)(33),{chrome:n,bbox:r,exiting:i,onSettle:a}=e,o=(0,U.useRef)(null);Be(o,n.paths);let s=i?``:void 0,c=i?!0:void 0,l=r.w,u=r.h,d=`${r.x} ${r.y} ${r.w} ${r.h}`,f;t[0]===n.bands?f=t[1]:(f=n.bands.map(Ge),t[0]=n.bands,t[1]=f);let p;t[2]===n.paths?p=t[3]:(p=n.paths.map(We),t[2]=n.paths,t[3]=p);let m;t[4]!==r.h||t[5]!==r.w||t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,G.jsxs)(`svg`,{ref:o,className:`mv-chrome-svg`,width:l,height:u,viewBox:d,"aria-hidden":`true`,children:[f,p]}),t[4]=r.h,t[5]=r.w,t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;if(t[10]!==r.x||t[11]!==r.y||t[12]!==n.bands){let e;t[14]!==r.x||t[15]!==r.y?(e=e=>e.label===void 0?null:(0,G.jsx)(`div`,{className:`mv-shelf-label`,style:{left:e.x-r.x+12,top:e.y-r.y+12},children:e.label},`${e.id}:label`),t[14]=r.x,t[15]=r.y,t[16]=e):e=t[16],h=n.bands.map(e),t[10]=r.x,t[11]=r.y,t[12]=n.bands,t[13]=h}else h=t[13];let g;if(t[17]!==r.x||t[18]!==r.y||t[19]!==n.labels){let e;t[21]!==r.x||t[22]!==r.y?(e=e=>(0,G.jsx)(`div`,{className:`mv-chrome-label ${e.className}`,"data-anchor":e.anchor??`start`,style:{left:e.x-r.x,top:e.y-r.y},children:e.text},e.id),t[21]=r.x,t[22]=r.y,t[23]=e):e=t[23],g=n.labels.map(e),t[17]=r.x,t[18]=r.y,t[19]=n.labels,t[20]=g}else g=t[20];let _;t[24]!==g||t[25]!==h?(_=(0,G.jsxs)(`div`,{className:`mv-chrome-labels`,children:[h,g]}),t[24]=g,t[25]=h,t[26]=_):_=t[26];let v;return t[27]!==a||t[28]!==s||t[29]!==_||t[30]!==c||t[31]!==m?(v=(0,G.jsxs)(`div`,{className:`mv-chrome`,"data-exiting":s,onTransitionEnd:a,"aria-hidden":c,children:[m,_]}),t[27]=a,t[28]=s,t[29]=_,t[30]=c,t[31]=m,t[32]=v):v=t[32],v}function We(e){return(0,G.jsx)(`path`,{className:e.className,d:e.d,fill:`none`,"data-draw":e.draw?``:void 0},e.id)}function Ge(e){return(0,G.jsx)(`rect`,{className:`mv-band ${e.className}`,x:e.x,y:e.y,width:e.w,height:e.h,rx:12},e.id)}function Ke(e){if(e instanceof Element)return e.closest(`.mv-node`)?.dataset.id}var qe=(0,U.memo)(function(e){let t=(0,W.c)(49),{nodes:n,edges:r,layout:i,exiting:a,settleExit:o,activate:s,lod:c,renderFace:l,onNodeClick:u,onEdgeClick:d,selectedId:f,litEdgeId:p}=e,m=(0,U.useRef)(null);Be(m,i.edgePaths);let{bbox:h}=i,g;if(t[0]!==r||t[1]!==n){let e=new Map(n.map(Ye));g=new Map;for(let t of r){let n=e.get(t.from);n!==void 0&&Number.isFinite(n)&&g.set(t.id,n)}t[0]=r,t[1]=n,t[2]=g}else g=t[2];let _=g,v;t[3]!==a||t[4]!==o?(v=a&&(0,G.jsx)(Ue,{chrome:a.layout.chrome,bbox:a.layout.bbox,exiting:!0,onSettle:()=>o(a.token)},a.token),t[3]=a,t[4]=o,t[5]=v):v=t[5];let y;t[6]!==h||t[7]!==i.chrome||t[8]!==i.rep?(y=(0,G.jsx)(Ue,{chrome:i.chrome,bbox:h},i.rep),t[6]=h,t[7]=i.chrome,t[8]=i.rep,t[9]=y):y=t[9];let b=h.w,x=h.h,S=`${h.x} ${h.y} ${h.w} ${h.h}`,C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(ze,{}),t[10]=C):C=t[10];let w;if(t[11]!==_||t[12]!==i.edgePaths||t[13]!==p||t[14]!==d){let e;t[16]!==_||t[17]!==p||t[18]!==d?(e=e=>(0,G.jsxs)(`g`,{className:`mv-edge-g`,"data-lit":p===e.id?``:void 0,"data-shift":Re(_.get(e.id)),style:_.has(e.id)?{"--mv-shift":_.get(e.id)}:void 0,onClick:d?()=>d(e.id):void 0,children:[d&&(0,G.jsx)(`path`,{className:`mv-edge-hit`,d:e.d,fill:`none`}),(0,G.jsx)(`path`,{className:e.className,d:e.d,fill:`none`,"data-draw":``,style:e.width===void 0?void 0:{"--mv-edge-w":e.width}})]},e.id),t[16]=_,t[17]=p,t[18]=d,t[19]=e):e=t[19],w=i.edgePaths.map(e),t[11]=_,t[12]=i.edgePaths,t[13]=p,t[14]=d,t[15]=w}else w=t[15];let T;t[20]!==h.h||t[21]!==h.w||t[22]!==S||t[23]!==w?(T=(0,G.jsxs)(`svg`,{ref:m,className:`mv-edges`,width:b,height:x,viewBox:S,"aria-hidden":`true`,children:[C,w]}),t[20]=h.h,t[21]=h.w,t[22]=S,t[23]=w,t[24]=T):T=t[24];let E;if(t[25]!==s||t[26]!==h.x||t[27]!==h.y||t[28]!==i.positions||t[29]!==c||t[30]!==n||t[31]!==u||t[32]!==l||t[33]!==f){let e;t[35]!==s||t[36]!==h.x||t[37]!==h.y||t[38]!==i.positions||t[39]!==c||t[40]!==u||t[41]!==l||t[42]!==f?(e=(e,t)=>{let n=i.positions.get(e.id);if(!n)return null;let r={"--nx":`${n.x+n.w/2-h.x}px`,"--ny":`${n.y+n.h/2-h.y}px`,"--mv-i":t,...e.shift===void 0?{}:{"--mv-shift":e.shift}},a=u!==void 0&&!n.folded,o=l?.(e,`entry`);return(0,G.jsxs)(`div`,{className:`mv-node`,"data-id":e.id,"data-role":e.role,"data-tier":e.tier,"data-domain":e.domain,"data-series":e.series?.length?``:void 0,"data-face":n.face,"data-shelved":n.shelved?``:void 0,"data-folded":n.folded?``:void 0,"data-shift":Re(e.shift),"data-selected":f===e.id?``:void 0,"data-lod":c,style:r,"aria-hidden":n.folded?!0:void 0,role:a?`button`:void 0,tabIndex:a?0:void 0,onClick:a?()=>s(e):void 0,onKeyDown:a?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),u?.(e))}:void 0,children:[(0,G.jsxs)(`div`,{className:`mv-face mv-face-card`,children:[(0,G.jsx)(`span`,{className:`mv-label`,children:e.label}),(0,G.jsxs)(`span`,{className:`mv-card-foot`,children:[e.domain!==void 0&&(0,G.jsx)(`span`,{className:`mv-domain`,title:e.domain,"aria-label":e.domain}),e.value!==void 0&&(0,G.jsxs)(`span`,{className:`mv-value`,children:[e.value.toLocaleString(),e.unit??``]}),l?.(e,`card`),e.tier!==void 0&&(0,G.jsx)(`span`,{className:`mv-tier`,children:e.tier})]})]}),(0,G.jsx)(`div`,{className:`mv-face mv-face-entry`,children:(0,G.jsxs)(`span`,{className:`mv-label`,children:[o,o?` `:null,e.label]})}),(0,G.jsx)(`div`,{className:`mv-face mv-face-mark`,children:l?.(e,`mark`)})]},e.id)},t[35]=s,t[36]=h.x,t[37]=h.y,t[38]=i.positions,t[39]=c,t[40]=u,t[41]=l,t[42]=f,t[43]=e):e=t[43],E=n.map(e),t[25]=s,t[26]=h.x,t[27]=h.y,t[28]=i.positions,t[29]=c,t[30]=n,t[31]=u,t[32]=l,t[33]=f,t[34]=E}else E=t[34];let D;return t[44]!==v||t[45]!==y||t[46]!==T||t[47]!==E?(D=(0,G.jsxs)(G.Fragment,{children:[v,y,T,E]}),t[44]=v,t[45]=y,t[46]=T,t[47]=E,t[48]=D):D=t[48],D});function Je({stage:e,world:t,renderFace:n,onNodeClick:r,onEdgeClick:i,selectedId:a,litEdgeId:o}){let{cam:s,layout:c,exiting:l,lod:u,settleExit:d,morphing:f,settle:p}=e,{viewportRef:m,zoomAtClient:h,pan:g}=s,[_,v]=(0,U.useState)(!1),y=(0,U.useRef)(new Map),b=(0,U.useRef)(0),x=(0,U.useRef)(!1),S=(0,U.useRef)(!1),C=(0,U.useRef)(!1),w=(0,U.useRef)({x:0,y:0}),T=(0,U.useCallback)((t,n,r,i)=>{if(x.current){h(t,n,r);return}e.pinch(t,n,r,i)!==`zoom`&&(x.current=!0)},[e,h]),E=(0,U.useRef)(T);E.current=T,(0,U.useEffect)(()=>{let e=m.current;if(!e)return;let t,n=e=>{if(e.preventDefault(),p(),e.ctrlKey){E.current(Math.exp(-e.deltaY/100),e.clientX,e.clientY,Ke(e.target)),clearTimeout(t),t=setTimeout(()=>{x.current=!1},$);return}h(e.deltaY<0?1.12:1/1.12,e.clientX,e.clientY)};return e.addEventListener(`wheel`,n,{passive:!1}),()=>{clearTimeout(t),e.removeEventListener(`wheel`,n)}},[m,h,p]);let D=()=>{let[e,t]=[...y.current.values()];return{x:(e.x+t.x)/2,y:(e.y+t.y)/2,d:Math.hypot(e.x-t.x,e.y-t.y)}},O=(0,U.useCallback)(e=>{if(p(),y.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),y.current.size>=2){e.currentTarget.setPointerCapture(e.pointerId),S.current=!1,v(!1),b.current=0;return}S.current=!0,C.current=!1,v(!0),w.current={x:e.clientX,y:e.clientY}},[p]),k=(0,U.useRef)({dx:0,dy:0}),A=(0,U.useRef)(0),j=(0,U.useCallback)(()=>{A.current!==0&&(cancelAnimationFrame(A.current),A.current=0);let{dx:e,dy:t}=k.current;(e!==0||t!==0)&&(k.current={dx:0,dy:0},g(e,t))},[g]),M=(0,U.useCallback)((e,t)=>{k.current.dx+=e,k.current.dy+=t,A.current===0&&(A.current=requestAnimationFrame(()=>{A.current=0;let e=k.current;k.current={dx:0,dy:0},(e.dx!==0||e.dy!==0)&&g(e.dx,e.dy)}))},[g]);(0,U.useEffect)(()=>()=>cancelAnimationFrame(A.current),[]);let N=(0,U.useCallback)(e=>{let t=y.current;if(!t.has(e.pointerId))return;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size>=2){let{x:t,y:n,d:r}=D();if(b.current===0){b.current=r;return}let i=r/b.current;(i>Le||i<1/Le)&&(b.current=r,E.current(i,t,n,Ke(e.target)));return}if(!S.current)return;let n=e.clientX-w.current.x,r=e.clientY-w.current.y;Math.abs(n)+Math.abs(r)>Ie&&!C.current&&(C.current=!0,e.currentTarget.setPointerCapture(e.pointerId)),w.current={x:e.clientX,y:e.clientY},M(n,r)},[M]),P=(0,U.useCallback)(e=>{j(),y.current.delete(e.pointerId),y.current.size<2&&(b.current=0,x.current=!1),y.current.size===0&&(S.current=!1,v(!1)),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},[j]),F=(0,U.useCallback)(e=>{C.current||r?.(e)},[r]),I=(0,U.useCallback)(e=>{e.propertyName===`transform`&&p()},[p]),{bbox:L}=c,R={transform:s.transform,width:L.w,height:L.h,"--mv-cam-scale":s.camera.scale};return(0,G.jsx)(`div`,{className:`mv-viewport`,ref:m,"data-panning":_?`true`:void 0,style:{"--mv-cam-scale":s.camera.scale},onPointerDown:O,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:(0,G.jsx)(`div`,{className:`mv-world`,style:R,"data-morphing":f?``:void 0,onTransitionEnd:I,children:(0,G.jsx)(qe,{nodes:t.nodes,edges:t.edges,layout:c,exiting:l,settleExit:d,activate:F,lod:u,renderFace:n,onNodeClick:r,onEdgeClick:i,selectedId:a,litEdgeId:o})})})}function Ye(e){return[e.id,e.shift]}function Xe(e,t){return e===`in`?`zoom-camera`:t?`ascend`:`zoom-camera`}var Ze=880,Qe=340,$e=468,et=56,tt=26,nt=16,rt=7,it=30*de;function at(e){let t=(e.series??[]).filter(e=>Number.isFinite(e.t)&&Number.isFinite(e.v)).map(e=>({t:Y(e.t),v:e.v})).sort((e,t)=>e.t-t.t);return t.length>0?{node:e,points:t}:null}var ot=e=>at(e)!==null;function st(e,t){let n=e*Math.max(et,(t-1)*it+30)+(e-1)*tt,r=Math.min($e,Math.max(Qe,n)),i=Math.max(it,Math.min(tt,r/(4*e)));return{h:(r-(e-1)*i)/e,gap:i}}function ct(e,t,n){let[r,i]=e===t?_(e,t,n):[e,t],a=v(i-r,n),o=[Math.floor(r/a)*a,Math.ceil(i/a)*a];return{domain:o,ticks:h(o[0]-a*1e-9,o[1],a)}}function lt(e){let t=1/0,n=-1/0,r=new Map;for(let i of e){let e=new Map;for(let a of i.nodes){let i=at(a);if(!i)continue;let o=a.unit??``,s=r.get(o);s||r.set(o,s={lo:1/0,hi:-1/0,marks:0}),e.set(o,(e.get(o)??0)+1);for(let e of i.points)t=Math.min(t,e.t),n=Math.max(n,e.t),s.lo=Math.min(s.lo,e.v),s.hi=Math.max(s.hi,e.v)}for(let[t,n]of e){let e=r.get(t);e.marks=Math.max(e.marks,n)}}if(t===1/0)return null;let i=1;for(let e of r.values())i=Math.max(i,e.marks);let{h:a,gap:o}=st(r.size,i),s=Math.max(2,Math.min(5,Math.round(a/60))),c=[],l=new Map;for(let[e,t]of r){let{domain:n,ticks:r}=ct(t.lo,t.hi,s);l.set(e,c.length),c.push({unit:e,domain:n,ticks:r,top:c.length*(a+o),h:a})}let u=Ae(t,n);return{x:u.domain,xTicks:u.ticks,bands:c,bandOf:l,height:c.length*a+(c.length-1)*o}}function ut(e,t){let n=new Map,r=new Map;for(let t of e){let e=r.get(t.band);e?e.push(t):r.set(t.band,[t])}for(let[e,i]of r){let{top:r,bottom:a}=t(e);i.sort((e,t)=>e.x-t.x||e.y-t.y||e.id.localeCompare(t.id));let o=[],s=()=>{if(o.length!==0){for(let[e,t]of y(o,{gap:it,top:r,bottom:a}))n.set(e,t);o=[]}};for(let e of i)o.length>0&&e.x-o[o.length-1].x>=it&&s(),o.push(e);s()}return n}function dt(e,t,n){let r=[],i=[];for(let n of e.nodes){let e=at(n);e&&t?r.push(e):i.push(n)}let a=new Map,o={bands:[],paths:[],labels:[]},s=1/0,c=-1/0,l=56;if(r.length>0&&t){let e=g(t.x,[56,56+Ze]),n=t.bands.map(e=>g(e.domain,[56+e.top+e.h,56+e.top])),i=e=>t.bandOf.get(e.unit??``)??0;t.bands.forEach((e,r)=>{let i=n[r];for(let t of e.ticks)o.paths.push({id:`grid:${r}:${t}`,d:`M ${J(56)} ${J(i(t))} L ${J(56+Ze)} ${J(i(t))}`,className:`morph-gridline`}),o.labels.push({id:`ytick:${r}:${t}`,x:46,y:i(t)+4,text:String(t),className:`morph-axis-label`,anchor:`end`}),s=Math.min(s,46-String(t).length*rt);t.bands.length>1&&o.labels.push({id:`unit:${r}`,x:56,y:56+e.top-11,text:e.unit===``?`no unit`:e.unit,className:`morph-axis-label`,anchor:`start`})}),t.xTicks.forEach((n,r)=>{let i=e(n.year);o.labels.push({id:`xtick:${r}`,x:i,y:56+t.height+22,text:n.text,className:`morph-axis-label`,anchor:`middle`});let a=n.text.length*rt/2;s=Math.min(s,i-a),c=Math.max(c,i+a)}),s=Math.min(s,56),c=Math.max(c,56+Ze),l=Math.max(l,56+t.height+28);let u=[...r].sort((e,t)=>e.node.id.localeCompare(t.node.id)),d=u.map(t=>{let r=i(t.node),a=t.points[t.points.length-1];return{id:t.node.id,band:r,x:e(a.t),y:n[r](a.v)}}),f=ut(d,e=>({top:56+t.bands[e].top,bottom:56+t.bands[e].top+t.bands[e].h})),p=new Map,m=new Map;for(let e of d){let t=m.get(e.band);t?t.push(e):m.set(e.band,[e])}t.bands.forEach((e,t)=>{let n=m.get(t);if(n===void 0||n.length===0)return;let r=y(n.map(e=>({id:e.id,y:f.get(e.id)??e.y})),{gap:nt,top:56+e.top+6,bottom:56+e.top+e.h-6});for(let[e,t]of r)p.set(e,t)}),u.forEach((t,r)=>{let{x:i,y:s}=d[r],l=n[d[r].band],u=t.points.map((t,n)=>`${n===0?`M`:`L`} ${J(e(t.t))} ${J(l(t.v))}`).join(` `),m=t.node.id;o.paths.push({id:`series:${m}`,d:u,className:`morph-series`,draw:!0});let h=f.get(t.node.id)??s;Math.abs(h-s)>.01&&o.paths.push({id:`leader:${t.node.id}`,d:`M ${J(i)} ${J(s)} L ${J(i)} ${J(h)}`,className:`morph-tick`}),a.set(m,{x:i-15,y:h-15,w:30,h:30,face:`mark`});let g=i+15+8;o.labels.push({id:`label:${t.node.id}`,x:g,y:(p.get(t.node.id)??h)+4,text:t.node.label,className:`morph-series-label`,anchor:`start`}),c=Math.max(c,g+t.node.label.length*rt)})}let u=Q(i,s===1/0?{x:0,y:0,w:112,h:112}:{x:s-56,y:0,w:c-s+112,h:l+56},`${i.length} with nothing measured over time — the chart cannot plot these`,n);u.band&&o.bands.push(u.band);for(let[e,t]of u.positions)a.set(e,t);return{positions:a,edgePaths:[],chrome:o,bbox:u.bbox}}var ft=(e,t)=>({rep:`chart`,...dt(e,lt([e]),t?.viewport??ue)}),pt=new WeakMap;function mt(e,t){let n=new Set;for(let r of e)r.from===r.to||!t(r)||(n.add(r.from),n.add(r.to));return n}function ht(e){let t=pt.get(e);if(t)return t;let n=mt(e.edges,e=>typeof e.weight==`number`);return pt.set(e,n),n}var gt=340,_t=4,vt=fe+30,yt=3;function bt(e,t){return e.parentId===void 0&&ht(t).has(e.id)}var xt=(e,t)=>{let n=t?.viewport??ue,r=e.nodes.filter(e=>e.parentId===void 0),i=r.filter(t=>bt(t,e)),a=r.filter(t=>!bt(t,e)),o=e.nodes.filter(e=>e.parentId!==void 0),s=new Map,c={bands:[],paths:[],labels:[]},l=[],u=new Set(i.map(e=>e.id)),d=e.edges.filter(e=>e.from!==e.to&&typeof e.weight==`number`&&u.has(e.from)&&u.has(e.to)),f=i.reduce((e,t)=>Math.min(e,t.depth??0),1/0),p=new Map;for(let e of d)p.set(e.from,(p.get(e.from)??0)+(e.weight??0));let m=i.reduce((e,t)=>Math.max(e,Number.isFinite(f)?(t.depth??0)-f:0),0),h=e=>{let t=Number.isFinite(f)?(e.depth??0)-f:0;return m<=0?0:m<_t?t:Math.round(t/m*3)},g=new Map;for(let e of i){let t=h(e),n=g.get(t);n?n.push(e):g.set(t,[e])}for(let e of g.values())e.sort((e,t)=>(p.get(t.id)??0)-(p.get(e.id)??0)||e.id.localeCompare(t.id));let _=Math.max(1,...[...g.values()].map(e=>e.length));for(let[e,t]of g){let n=(_-t.length)*vt/2;t.forEach((t,r)=>{s.set(t.id,{x:56+e*gt,y:56+n+r*vt,w:200,h:64,face:`card`})})}for(let e of d){let t=s.get(e.from),n=s.get(e.to),r=t.x+t.w,i=t.y+t.h/2,a=n.x,o=n.y+n.h/2,c=(r+a)/2,u=Math.min(1,Math.max(0,e.weight??0));l.push({id:e.id,d:`M ${J(r)} ${J(i)} C ${J(c)} ${J(i)} ${J(c)} ${J(o)} ${J(a)} ${J(o)}`,className:`morph-edge morph-ribbon`+he(e.kind),width:yt+u*23})}for(let e of o){let t=(e.parentId===void 0?void 0:s.get(e.parentId))??{x:56,y:56};s.set(e.id,{x:t.x,y:t.y,w:200,h:64,face:`card`,folded:!0})}let v=Q(a,{x:0,y:0,w:112+(Math.max(1,...[...g.keys()].map(e=>e+1))-1)*gt+200,h:112+_*vt},`${a.length} with no measured share — the ribbons cannot size these`,n);for(let[e,t]of v.positions)s.set(e,t);return v.band&&c.bands.push(v.band),{rep:`flow`,positions:s,edgePaths:l,chrome:c,bbox:v.bbox}},St=200;function Ct(e,t=24){let n=e.length;if(n<2)return;let r=e.map(e=>Math.max(e.w,e.h)),i=2*[...r].sort((e,t)=>e-t)[n>>1],a=[];for(let e=0;e<n;e++)r[e]>i&&a.push(e);a.length>n/8&&(a=[]);let o=Array(n).fill(!0);for(let e of a)o[e]=!1;let s=0;for(let e=0;e<n;e++)o[e]&&(s=Math.max(s,r[e]));s=Math.max(s+t,1);let c=(n,r)=>{let i=e[n],a=e[r],o=a.x+a.w/2-(i.x+i.w/2),s=a.y+a.h/2-(i.y+i.h/2);o===0&&s===0&&(o=n-r,s=r-n);let c=(i.w+a.w)/2+t-Math.abs(o),l=(i.h+a.h)/2+t-Math.abs(s);if(c<=0||l<=0)return!1;if(c<=l){let e=c/2*(o<0?-1:1);i.x-=e,a.x+=e}else{let e=l/2*(s<0?-1:1);i.y-=e,a.y+=e}return!0},l=Array(n),u=new Map;for(let t=0;t<St;t++){u.clear();let t=[],r=[],i=[];for(let a=0;a<n;a++){if(!o[a])continue;let n=e[a],c=Math.floor((n.x+n.w/2)/s),d=Math.floor((n.y+n.h/2)/s),f=u.get(c);f===void 0&&(f=new Map,u.set(c,f));let p=f.get(d);p===void 0&&(p=i.length,f.set(d,p),t.push(c),r.push(d),i.push([])),i[p].push(a),l[a]=p}let d=i.map((e,n)=>{let a=[];for(let e=-1;e<=1;e++){let o=u.get(t[n]+e);if(o!==void 0)for(let e=-1;e<=1;e++){let t=o.get(r[n]+e);if(t!==void 0)for(let e of i[t])a.push(e)}}return a.sort((e,t)=>e-t)}),f=Array(i.length).fill(0),p=!1,m=0;for(let e=0;e<n;e++){for(;m<a.length&&a[m]<=e;)m++;if(!o[e]){for(let t=e+1;t<n;t++)c(e,t)&&(p=!0);continue}let t=l[e],r=d[t],i=f[t];for(;i<r.length&&r[i]<=e;)i++;f[t]=i;let s=m;for(;i<r.length||s<a.length;){let t=s>=a.length||i<r.length&&r[i]<a[s]?r[i++]:a[s++];c(e,t)&&(p=!0)}}if(!p)break}}var wt=300,Tt=fe+4,Et=4,Dt=fe+Et,Ot=wt-200,kt=200+Et,At=96,jt=30,Mt=20,Nt=18,Pt=15,Ft=2.5,It=1/1.4,Lt=1.7,Rt=2.6,zt={rows:1,reach:0};function Bt(e,t){let n=e.map(e=>t(e.id).rows).sort((e,t)=>t-e),r=e.map(e=>t(e.id).reach).sort((e,t)=>t-e),i=[0],a=0;for(let e of n)i.push(a+=e);return{size:e.length,rows:a,tallest:i,reaches:r}}function Vt(e,t){let n=[],r=[],i=[],a=[];for(let o of e){let e=Math.max(1,Math.min(o.size,Math.ceil(o.rows/t))),s=Math.ceil(o.size/e),c=Math.ceil(o.size/s);i.push(n.length),a.push(s);for(let e=0;e<c;e++)n.push(o.tallest[Math.min(s,o.size-e*s)]),r.push(200+(o.reaches[e]??0))}return{rows:n,widths:r,start:i,per:a}}function Ht(e,t){let n=[],r=[],i=[];for(let a=0;a<e.rows.length;a++){let o=Math.floor(a/t),s=a%t===0?0:n[a-1]+e.widths[a-1]+Ot;n.push(s),r[o]=Math.max(r[o]??1,e.rows[a]),i[o]=Math.max(i[o]??0,s+e.widths[a])}return{columnX:n,bandRows:r,bandW:i}}var Ut=12;function Wt(e,t){let n=n=>{let r=(t.h-(n-1)*At-112)/n,i=Math.max(2,Math.floor((r-64)/Tt)+1),a=Vt(e,i),o=Math.max(1,Math.ceil(a.rows.length/n)),{bandRows:s,bandW:c}=Ht(a,o),l=200;for(let e of c)l=Math.max(l,e);let u=(n-1)*At;for(let e=0;e<n;e++)u+=((s[e]??1)-1)*Tt+64;return{bands:n,rowCap:i,perBand:o,fit:Math.min(t.w/(l+112),t.h/(u+112)),aspect:l/u}},r=n(1);if(e.length<2||r.fit>=It)return r;let i=r;for(let e=2;e<=Ut;e++){let t=n(e);if(t.fit>=It&&t.aspect<=Ft)return t;if(t.fit>i.fit&&(i=t),t.perBand===1)break}return i}function Gt(e,t,n){let r=Wt(t,n),i=Vt(t,r.rowCap),{columnX:a,bandRows:o}=Ht(i,r.perBand),s=new Map,c=new Map;e.forEach((e,t)=>{s.set(e,i.start[t]),c.set(e,i.per[t])});let l=o.length>0?o:[1],u=[],d=[],f=[],p=0;for(let e of l){let t=(e-1)*Tt+64;u.push(p+t/2),d.push(t),p+=t,f.push(p+At/2),p+=At}return{perBand:r.perBand,columnRows:i.rows,columnX:a,startOf:s,splitOf:c,centreY:u,height:d,gutterY:f}}function Kt(e,t){let n=new Map,r=new Set;for(let t of e)typeof t.depth==`number`&&Number.isFinite(t.depth)?(n.set(t.id,t.depth),r.add(t.id)):n.set(t.id,0);let i=t.edges.filter(e=>e.from!==e.to&&n.has(e.from)&&n.has(e.to)),a=new Map,o=new Map(e.map(e=>[e.id,0]));for(let e of i){let t=a.get(e.from);t===void 0?a.set(e.from,[e.to]):t.push(e.to),o.set(e.to,o.get(e.to)+1)}let s=(e,t)=>r.has(e)?t:t+1,c=e.filter(e=>o.get(e.id)===0).map(e=>e.id),l=new Set;for(let e=0;e<c.length;e++){let t=c[e];l.add(t);let r=n.get(t);for(let e of a.get(t)??[]){let t=s(e,r);t>n.get(e)&&n.set(e,t);let i=o.get(e)-1;o.set(e,i),i===0&&c.push(e)}}if(l.size<e.length){let t=i.filter(e=>!l.has(e.to));for(let r=e.length;r>0;r--){let e=!1;for(let r of t){let t=s(r.to,n.get(r.from));t>n.get(r.to)&&(n.set(r.to,t),e=!0)}if(!e)break}}let u=t.outcomeId;if(u!==void 0&&n.has(u)&&!r.has(u)&&(a.get(u)?.length??0)===0){let e=-1/0;for(let t of n.values())t>e&&(e=t);n.set(u,e)}return n}function qt(e,t){let n=new Map(e.map(e=>[e.id,0])),r=new Map(e.map(e=>[e.id,0])),i=new Map,a=0;for(let o of e)for(let e of t.get(o.id)??[]){if(e===o.id||!n.has(e))continue;let t=i.get(e);t===void 0?i.set(e,[o.id]):t.push(o.id),r.set(o.id,r.get(o.id)+1),a++}if(a===0)return n;let o=e.filter(e=>r.get(e.id)===0).map(e=>e.id);for(let e=0;e<o.length;e++){let t=o[e],a=n.get(t);for(let e of i.get(t)??[]){a+1>n.get(e)&&n.set(e,a+1);let t=r.get(e)-1;r.set(e,t),t===0&&o.push(e)}}return n}function Jt(e,t){let n=new Map,r=new Set,i=[],a=new Set;for(let o of e){if(n.has(o.id))continue;i.length=0,a.clear();let e=o,s=0,c=!1;for(;;){let o=e.parentId===void 0?void 0:t.get(e.parentId);if(o===void 0){n.set(e.id,null);break}if(i.push(e),a.add(e.id),n.has(o.id)){c=r.has(o.id),s=n.get(o.id)??0;break}if(a.has(o.id)){c=!0;break}e=o}if(c)for(let e of i)n.set(e.id,null),r.add(e.id);else for(let e=i.length-1;e>=0;e--)n.set(i[e].id,++s)}return n}function Yt(e,t){let n=new Map(e.nodes.map(e=>[e.id,e])),r=Jt(e.nodes,n),i=e.nodes.filter(e=>r.get(e.id)===null),a=e.nodes.filter(e=>r.get(e.id)!==null).sort((e,t)=>r.get(e.id)-r.get(t.id)||e.id.localeCompare(t.id)),o=t?.expandedIds,s=t?.previous,c=new Map,l=Kt(i,e),u=new Set(i.map(e=>e.id)),d=new Set;for(let e of a){let t=e.parentId;o?.has(t)===!0&&(u.has(t)||d.has(t))&&d.add(e.id)}let f=new Map,p=e=>f.get(e)??zt;for(let e=a.length-1;e>=0;e--){let t=a[e];if(!d.has(t.id))continue;let n=p(t.id),r=f.get(t.parentId);f.set(t.parentId,{rows:(r?.rows??0)+n.rows,reach:Math.max(r?.reach??0,kt+n.reach)})}let m=new Map,h=new Map;for(let e of a){let t=h.get(e.parentId)??0;m.set(e.id,t),h.set(e.parentId,t+p(e.id).rows)}let g=new Map;for(let t of e.edges)!u.has(t.from)||!u.has(t.to)||(g.has(t.to)||g.set(t.to,[]),g.get(t.to).push(t.from));let _=new Map;for(let e of i){let t=l.get(e.id),n=_.get(t);n===void 0?_.set(t,[e]):n.push(e)}let v=[..._.keys()].sort((e,t)=>e-t),y=t?.viewport??ue,b=Gt(v,v.map(e=>Bt(_.get(e),p)),y),x=new Map;for(let e of v){let t=_.get(e),n=qt(t,g),r=t.map((e,t)=>{let r=(g.get(e.id)??[]).map(e=>c.get(e)?.y).filter(e=>e!==void 0);return{n:e,bary:r.length?r.reduce((e,t)=>e+t,0)/r.length:s?.get(e.id)?.y??t*Tt,rank:n.get(e.id)}});r.sort((e,t)=>e.rank-t.rank||e.bary-t.bary||e.n.id.localeCompare(t.n.id));let i=b.startOf.get(e),a=b.splitOf.get(e),o=[],l=[];r.forEach((e,t)=>{let n=Math.floor(t/a);o.push(l[n]??0),l[n]=(l[n]??0)+p(e.n.id).rows}),r.forEach((e,t)=>{let n=Math.floor(t/a),r=i+n,s=Math.floor(r/b.perBand),u=p(e.n.id).rows;x.set(e.n.id,s),c.set(e.n.id,{x:b.columnX[r],y:b.centreY[s]+(o[t]+(u-1)/2-(l[n]-1)/2)*Tt})})}for(let e of a){let t=e.parentId,n=c.get(t);if(x.set(e.id,x.get(t)??0),d.has(e.id)){let r=p(e.id).rows,i=h.get(t);c.set(e.id,{x:n.x+kt,y:n.y+(m.get(e.id)+(r-1)/2-(i-1)/2)*Dt})}else c.set(e.id,{x:n.x,y:n.y})}if(d.size>0){let e=[...i,...a.filter(e=>d.has(e.id))],t=e.map(e=>{let t=c.get(e.id);return{x:t.x-100,y:t.y-fe/2,w:200,h:fe}});Ct(t,Et),e.forEach((e,n)=>{c.set(e.id,{x:t[n].x+100,y:t[n].y+fe/2})});for(let e of a){if(d.has(e.id))continue;let t=c.get(e.parentId);c.set(e.id,{x:t.x,y:t.y})}}let S=1/0,C=1/0,w=-1/0,T=-1/0;for(let e of c.values())S=Math.min(S,e.x-100),C=Math.min(C,e.y-32),w=Math.max(w,e.x+100),T=Math.max(T,e.y+32);let E=c.size===0,D=E?0:56-S,O=E?0:56-C,k=new Map;for(let t of e.nodes){let e=c.get(t.id);k.set(t.id,{x:e.x+D-100,y:e.y+O-32,w:200,h:64,face:`card`,...r.get(t.id)!==null&&!d.has(t.id)?{folded:!0}:{}})}let A=e=>u.has(e)||d.has(e),j=E?56:w+D,M=e.edges.filter(e=>A(e.from)&&A(e.to)).map(e=>{let t=k.get(e.from),n=k.get(e.to),r=x.get(e.from)??0,i=x.get(e.to)??0,a=r===i?-1:Math.max(r,i)-1;return{e,from:t,to:n,gutter:a,vertical:a<0&&n.x<=t.x&&Math.abs(n.y-t.y)>1}}),N=new Map,P=new Map,F=new Map,I=(e,t)=>void e.set(t,(e.get(t)??0)+1);for(let e of M)e.gutter>=0&&I(N,e.gutter),!e.vertical&&(I(P,e.e.to),I(F,e.e.from));let L=new Map,R=new Map,z=new Map,B=(e,t,n)=>e.y+e.h/2+(n-(t-1)/2)*Math.min(Pt,e.h/(t+1)),V=[];for(let{e,from:t,to:n,gutter:r,vertical:i}of M){let a;if(i){let e=t.x+t.w/2,r=n.x+n.w/2,i=n.y>t.y,o=i?t.y+t.h:t.y,s=i?n.y:n.y+n.h,c=(o+s)/2;a=`M ${J(e)} ${J(o)} C ${J(e)} ${J(c)} ${J(r)} ${J(c)} ${J(r)} ${J(s)}`}else{let i=z.get(e.from)??0,o=R.get(e.to)??0;z.set(e.from,i+1),R.set(e.to,o+1);let s=t.x+t.w,c=B(t,F.get(e.from),i),l=n.x,u=B(n,P.get(e.to),o);if(r<0){let e=(s+l)/2;a=`M ${J(s)} ${J(c)} C ${J(e)} ${J(c)} ${J(e)} ${J(u)} ${J(l)} ${J(u)}`}else{let e=N.get(r),t=L.get(r)??0;L.set(r,t+1);let n=Math.min(Nt,(At-32)/Math.max(1,e)),i=b.gutterY[r]+O+(t-(e-1)/2)*n,o=j+jt,d=Math.min(l,56)-jt,f=(o+d)/2;a=`M ${J(s)} ${J(c)} C ${J(o)} ${J(c)} ${J(o)} ${J(i)} ${J(f)} ${J(i)} C ${J(d)} ${J(i)} ${J(d)} ${J(u)} ${J(l)} ${J(u)}`}}V.push({id:e.id,d:a,className:`morph-edge`+he(e.kind)+(e.sign===-1?` morph-edge--damp`:``)+(e.provisional?` morph-edge--provisional`:``)+(r<0?``:` morph-edge--wrap`),...typeof e.weight==`number`&&Number.isFinite(e.weight)?{width:Lt+Math.min(1,Math.max(0,e.weight))*Rt}:{}})}let H=E?{x:0,y:0,w:112,h:112}:{x:0,y:0,w:w-S+112,h:T-C+112};return{positions:k,edgePaths:V,chrome:{bands:E||b.centreY.length<2?[]:b.centreY.map((e,t)=>{let n=Math.max(H.y,e-b.height[t]/2+O-Mt),r=Math.min(H.y+H.h,e+b.height[t]/2+O+Mt);return{id:`reading-band:${t}`,x:56-Mt,y:n,w:j-56+40,h:Math.max(0,r-n),className:`morph-reading-band`}}),paths:[],labels:[]},bbox:H}}var Xt=(e,t)=>({rep:`graph`,...Yt(e,t)}),Zt=920,Qt=16,$t=44+Qt,en=12,tn=8,nn=12;function rn(e){if(!e.date||!Number.isFinite(e.date.start))return null;let t=Y(e.date.start),n=e.date.end;return{node:e,startYear:t,...n!==void 0&&Number.isFinite(n)&&n>e.date.start?{endYear:Y(n)}:{}}}var an=e=>rn(e)!==null;function on(e){let t=1/0,n=-1/0;for(let r of e)for(let e of r.nodes){let r=rn(e);r&&(t=Math.min(t,r.startYear),n=Math.max(n,r.endYear??r.startYear))}return t===1/0?null:Ae(t,n,6)}function sn(e){let t=1;for(;t<e;)t*=2;let n=Array(t*2).fill(1/0),r=0;return(e,i)=>{let a=1;if(n[1]<=i)for(;a<t;)a=n[a*2]<=i?a*2:a*2+1;else a=t+r++;let o=a-t;for(n[a]=e;a>1;)a>>=1,n[a]=Math.min(n[a*2],n[a*2+1]);return o}}function cn(e,t,n){let r=[],i=[];for(let n of e.nodes){let e=rn(n);e&&t?r.push(e):i.push(n)}r.sort((e,t)=>e.startYear-t.startYear||e.node.id.localeCompare(t.node.id));let a=new Map,o={bands:[],paths:[],labels:[]},s=[],c=1/0,l=-1/0,u=56;if(r.length>0&&t){let n=g(t.domain,[56,56+Zt]),i=sn(r.length);for(let e of r){let t=n(e.startYear),r=e.endYear===void 0?t:n(e.endYear),s=e.endYear===void 0?t-80:t,d=Math.min(s,t)-32,f=Math.max(s+160,r)+32,p=56+i(f+nn,d)*$t;a.set(e.node.id,{x:s,y:p,w:160,h:44,face:`entry`}),e.endYear!==void 0&&o.bands.push({id:`period:${e.node.id}`,x:t,y:p-6,w:Math.max(r-t,2),h:56,className:`morph-period`}),c=Math.min(c,d),l=Math.max(l,f),u=Math.max(u,p+44)}let d=u+Qt+en;o.paths.push({id:`axis`,d:`M ${J(56)} ${J(d)} L ${J(56+Zt)} ${J(d)}`,className:`morph-axis`}),t.ticks.forEach((e,t)=>{let r=n(e.year);o.paths.push({id:`tick:${t}`,d:`M ${J(r)} ${J(d)} L ${J(r)} ${J(d+tn)}`,className:`morph-tick`}),o.labels.push({id:`tick-label:${t}`,x:r,y:d+tn+16,text:e.text,className:`morph-axis-label`,anchor:`middle`}),c=Math.min(c,r-e.text.length*3.5),l=Math.max(l,r+e.text.length*3.5)}),c=Math.min(c,56),l=Math.max(l,56+Zt),u=d+tn+20;let f=new Set(r.map(e=>e.node.id));for(let t of e.edges){if(t.from===t.to||!f.has(t.from)||!f.has(t.to))continue;let e=a.get(t.from),n=a.get(t.to),r=e.x+e.w/2,i=n.x+n.w/2,o=e.y,c=n.y,l=Math.min(72,Math.max(20,Math.abs(i-r)*.2));s.push({id:t.id,d:`M ${J(r)} ${J(o)} C ${J(r)} ${J(o-l)} ${J(i)} ${J(c-l)} ${J(i)} ${J(c)}`,className:`morph-edge morph-edge--faint`+he(t.kind)})}}let d=Q(i,c===1/0?{x:0,y:0,w:112,h:112}:{x:c-56,y:0,w:l-c+112,h:u+56},`${i.length} with no date — the timeline cannot place these`,n);d.band&&o.bands.push(d.band);for(let[e,t]of d.positions)a.set(e,t);return{positions:a,edgePaths:s,chrome:o,bbox:d.bbox}}var ln=(e,t)=>({rep:`timeline`,...cn(e,on([e]),t?.viewport??ue)}),un={min:me,max:2.2},dn=56,fn=1300,pn=1300,mn=.7,hn=120,gn=120,_n=[`graph`,`flow`,`timeline`,`chart`],vn={graph:Xt,timeline:ln,chart:ft,flow:xt},yn={graph:`What caused what`,timeline:`The same causes, in time`,chart:`How much each one moved`,flow:`How much each one contributed`},bn={graph:()=>!0,timeline:an,chart:ot,flow:bt},xn=2,Sn=1/3;function Cn(e,t){let n=t.nodes.filter(e=>e.parentId===void 0);if(n.length===0)return!1;let r=n.filter(n=>bn[e](n,t)).length;return r>=Math.min(xn,n.length)&&r/n.length>=Sn}var wn=e=>({x:0,y:0,w:e.w,h:e.h}),Tn=(e,t,n)=>[t-e.x,n-e.y];function En(e,t,n){let r=e.positions.get(t);if(!r)return null;let i=r.x,a=r.y,o=r.x+r.w,s=r.y+r.h;for(let r of n.get(t)??[]){let t=e.positions.get(r);!t||t.folded||(i=Math.min(i,t.x),a=Math.min(a,t.y),o=Math.max(o,t.x+t.w),s=Math.max(s,t.y+t.h))}let[c,l]=Tn(e.bbox,i-hn,a-hn);return{x:c,y:l,w:o-i+240,h:s-a+240}}function Dn(e){let{world:t,onAscend:n,driverId:r,insetBottom:i}=e,[a,o]=(0,U.useState)(e.initialRep??`graph`),[s,c]=(0,U.useState)(()=>new Set),[l,u]=(0,U.useState)(null),d=p({clamp:un,margin:dn,...i===void 0?{}:{insetBottom:i}}),m=(0,U.useRef)(void 0),{viewport:h}=d,g=(0,U.useMemo)(()=>h?{w:Math.max(1,h.w-112),h:Math.max(1,h.h-112)}:void 0,[h]),_=(0,U.useMemo)(()=>vn[a](t,{expandedIds:s,previous:m.current,...g?{viewport:g}:{}}),[a,t,s,g]);(0,U.useEffect)(()=>{let e=new Map;for(let[t,n]of _.positions)e.set(t,{x:n.x,y:n.y});m.current=e},[_]);let v=(0,U.useRef)(a);v.current=a;let y=(0,U.useRef)(_);y.current=_;let b=(0,U.useRef)(d.camera);b.current=d.camera;let x=(0,U.useRef)(s);x.current=s;let S=(0,U.useRef)(n);S.current=n;let[C,w]=(0,U.useState)(null),{endFlight:T}=d,E=(0,U.useCallback)(()=>{w({layout:y.current,rep:v.current,expandedIds:x.current}),T()},[T]),O=(0,U.useRef)(0),k=(0,U.useRef)(void 0);(0,U.useEffect)(()=>()=>clearTimeout(k.current),[]);let A=(0,U.useCallback)(e=>{if(e===v.current)return;let t=++O.current;u({layout:y.current,token:t}),clearTimeout(k.current),k.current=setTimeout(()=>{t===O.current&&u(null)},fn),v.current=e,o(e)},[]),j=(0,U.useCallback)(e=>{e===O.current&&(clearTimeout(k.current),u(null))},[]),M=(0,U.useRef)(null),N=(0,U.useCallback)(e=>{let t=new Set(x.current);t.delete(e)||(t.add(e),M.current=e),c(t)},[]),P=(0,U.useMemo)(()=>{let e=new Map;for(let n of t.nodes){if(n.parentId===void 0)continue;let t=e.get(n.parentId);t?t.push(n.id):e.set(n.parentId,[n.id])}return e},[t]),{fitTo:F,setCamera:I,viewportRef:L}=d;(0,U.useEffect)(()=>{let e=M.current;if(M.current=null,e!==null){let t=En(_,e,P);if(t){F(t);return}}F(wn(_.bbox))},[_,P,F,I,L]);let R=(0,U.useMemo)(()=>new Map(t.nodes.map(e=>[e.id,e.parentId])),[t]),z=(0,U.useMemo)(()=>{let e=new Set;for(let t of R.values())t!==void 0&&e.add(t);return e},[R]),B=(0,U.useCallback)(e=>{let t=0,n=e,r=new Set;for(;n!==void 0&&!r.has(n);)r.add(n),n=R.get(n),n!==void 0&&(t+=1);return t},[R]),{zoomAtClient:V}=d,H=(0,U.useCallback)((e,t,n,r)=>{if(e>=1)return r!==void 0&&z.has(r)&&!x.current.has(r)?(N(r),`expand`):(V(e,t,n),`zoom`);let i=L.current?.getBoundingClientRect();if(Xe(`out`,!!i&&(i.width>0||i.height>0)&&f(b.current,wn(y.current.bbox),{w:i.width,h:i.height},dn,un))===`zoom-camera`)return V(e,t,n),`zoom`;let a=[...x.current];if(a.length>0){let e=a[0],t=B(e);for(let n of a){let r=B(n);r>t&&(e=n,t=r)}return N(e),`collapse`}return S.current?.(),`ascend`},[z,N,V,L,B]),W=(0,U.useCallback)(e=>{let t=y.current,n=e===null?void 0:t.positions.get(e);if(!n||n.folded){F(wn(t.bbox));return}let[r,i]=Tn(t.bbox,n.x-gn,n.y-gn);F({x:r,y:i,w:n.w+240,h:n.h+240})},[F]);(0,U.useEffect)(()=>{if(r!==void 0)return D(r,{count:_n.length,setIndex:e=>A(_n[Math.min(_n.length-1,Math.max(0,Math.trunc(e)))]),spokenFor:()=>void 0,captionFor:e=>{let t=_n[e];return t?yn[t]:void 0}})},[r,A]);let G=C?.layout!==_||d.flying;return(0,U.useEffect)(()=>{if(!G)return;let e=setTimeout(E,pn);return()=>clearTimeout(e)},[G,_,E]),{rep:a,setRep:A,layout:_,exiting:l,settleExit:j,expandedIds:s,toggleExpand:N,cam:d,morphing:G,settle:E,lod:d.camera.scale>=mn?`near`:`far`,pinch:H,focusNode:W}}function On({label:e,min:t,max:n,step:r=1,value:i,onChange:a,format:o,color:s=`var(--presence)`}){let c=n-t||1,l=(i-t)/c*100;return(0,G.jsxs)(`label`,{className:`viz-ctl`,style:{"--ctl-c":s,"--ctl-pct":l+`%`},children:[(0,G.jsx)(`span`,{className:`viz-ctl-label`,children:e}),(0,G.jsx)(`input`,{type:`range`,className:`viz-ctl-range`,min:t,max:n,step:r,value:i,"aria-label":e,onChange:e=>a(Number(e.target.value))}),(0,G.jsx)(`span`,{className:`viz-ctl-val tab-num`,children:o?o(i):i.toLocaleString()})]})}var kn=`No cause is established yet, so there is nothing to push on.`;function An(e){let t=(0,W.c)(17),{levers:n,onSet:r,onReset:i}=e,a;t[0]===n?a=t[1]:(a=n.every(Mn),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`WHAT IF`}),t[2]=s):s=t[2];let c;t[3]!==i||t[4]!==o?(c=(0,G.jsxs)(`div`,{className:`tr-levers-head`,children:[s,(0,G.jsx)(`button`,{type:`button`,className:`tr-reset`,onClick:i,disabled:o,children:`Reset`})]}),t[3]=i,t[4]=o,t[5]=c):c=t[5];let l;t[6]===n.length?l=t[7]:(l=n.length===0&&(0,G.jsx)(`p`,{className:`tr-levers-empty`,children:kn}),t[6]=n.length,t[7]=l);let u;if(t[8]!==n||t[9]!==r){let e;t[11]===r?e=t[12]:(e=e=>(0,G.jsx)(On,{label:e.label,min:0,max:100,value:e.pct,onChange:t=>r(e.id,t),format:jn},e.id),t[11]=r,t[12]=e),u=n.map(e),t[8]=n,t[9]=r,t[10]=u}else u=t[10];let d;return t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,G.jsxs)(`div`,{className:`tr-levers`,children:[c,l,u]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function jn(e){return`${e}%`}function Mn(e){return e.pct===100}var Nn=(0,U.memo)(An),Pn=(0,U.createContext)(null);function Fn(){return(0,U.useContext)(Pn)}function In(e){let t=(0,W.c)(19),{id:n,className:r}=e,i=Fn(),a,o,s,c,l,u;if(t[0]!==r||t[1]!==n||t[2]!==i){u=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i?.registry.values.get(n);if(!e){u=null;break bb0}let d=`tr-num`+(r?` ${r}`:``);if(e.kind===`structure`){u=(0,G.jsx)(`span`,{className:`${d} tr-num-qual`,"data-status":`structure`,children:e.resolution.raw});break bb0}a=`button`,o=d,s=ee(e),t[9]!==n||t[10]!==i?(c=e=>i?.open(n,e.currentTarget),t[9]=n,t[10]=i,t[11]=c):c=t[11],l=x(e)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u}else a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8];if(u!==Symbol.for(`react.early_return_sentinel`))return u;let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{className:`tr-sr`,children:`, source available`}),t[12]=d):d=t[12];let f;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==l?(f=(0,G.jsxs)(`button`,{type:a,className:o,"data-status":s,onClick:c,children:[l,d]}),t[13]=a,t[14]=o,t[15]=s,t[16]=c,t[17]=l,t[18]=f):f=t[18],f}var Ln=8,Rn=6;function zn(e,t,n){return Math.max(Ln,Math.min(e,n-t-Ln))}function Bn(e,t,n){if(!(e.width>0||e.height>0||e.left>0||e.top>0))return{left:zn((n.w-t.w)/2,t.w,n.w),top:zn((n.h-t.h)/2,t.h,n.h)};let r=e.bottom+Rn,i=e.top-Rn-t.h,a=r+t.h+Ln>n.h&&i>=Ln;return{left:zn(e.left,t.w,n.w),top:zn(a?i:r,t.h,n.h)}}var Vn=320,Hn=340,Un=8;function Wn(e){let t=(0,W.c)(64),{registry:n,valueId:r,anchorRect:i,trail:a,hinted:o,onMarkHinted:s,onDrill:c,onBack:l,onNavigate:u,onDismiss:f}=e,p=(0,U.useRef)(null),m;t[0]===f?m=t[1]:(m={onEscape:f},t[0]=f,t[1]=m),d(p,m);let[h]=(0,U.useState)(!o),g,_;t[2]===s?(g=t[3],_=t[4]):(g=()=>s(),_=[s],t[2]=s,t[3]=g,t[4]=_),(0,U.useEffect)(g,_);let v=(0,U.useRef)(!0),y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{v.current||p.current?.focus({preventScroll:!0}),v.current=!1},t[5]=y):y=t[5];let w;t[6]===r?w=t[7]:(w=[r],t[6]=r,t[7]=w),(0,U.useEffect)(y,w);let D,O;t[8]===f?(D=t[9],O=t[10]):(D=()=>{let e=e=>{let t=p.current;t&&e.target instanceof Node&&!t.contains(e.target)&&f()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},O=[f],t[8]=f,t[9]=D,t[10]=O),(0,U.useEffect)(D,O);let k=n.values,A,j,M,N,P,F,I,L,R,z,B,V,H,K;if(t[11]!==i||t[12]!==l||t[13]!==c||t[14]!==u||t[15]!==n.usedIn||t[16]!==n.values||t[17]!==a||t[18]!==r){V=Symbol.for(`react.early_return_sentinel`);bb0:{if(K=k.get(r),!K){V=null;break bb0}let e=ee(K),o=K.scope,s=n.usedIn.get(r)??[],d=K.kind===`grounded`?K.resolution.receipt:null,f=K.kind===`grounded`&&K.resolution.tier===`T1`,m=d?.url?T(d.url):null,h=d?d.host??(d.url?E(d.url):null):null,g=K.kind===`calculated`?K.calc.inputs:[],_=g.slice(0,Un),v=g.length-_.length,y;t[33]!==n.values||t[34]!==a?(y=a.length>0?n.values.get(a[a.length-1]):void 0,t[33]=n.values,t[34]=a,t[35]=y):y=t[35];let w=y,D;t[36]===i?D=t[37]:(D=Bn(i,{w:Vn,h:Hn},{w:window.innerWidth,h:window.innerHeight}),t[36]=i,t[37]=D);let{left:O,top:U}=D;H=p,A=`tr-card`,j=`dialog`,M=`false`,N=`Where ${K.label} came from`,P=-1,t[38]!==O||t[39]!==U?(F={left:O,top:U,width:Vn,maxHeight:Hn},t[38]=O,t[39]=U,t[40]=F):F=t[40];let W;t[41]!==l||t[42]!==w?(W=w&&(0,G.jsxs)(`button`,{type:`button`,className:`tr-back`,onClick:l,"aria-label":`Back to ${w.label}`,children:[`‹ back`,(0,G.jsxs)(`span`,{className:`tr-back-to`,children:[` to `,w.label]})]}),t[41]=l,t[42]=w,t[43]=W):W=t[43],I=(0,G.jsxs)(`header`,{className:`tr-head`,children:[W,(0,G.jsx)(`span`,{className:`tr-badge`,"data-status":e,children:C[e]}),(0,G.jsx)(`p`,{className:`tr-figure`,children:x(K)}),(0,G.jsx)(`p`,{className:`tr-label`,children:K.label})]}),L=d&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`SOURCE`}),d.quote&&(0,G.jsxs)(`blockquote`,{className:`tr-quote`,children:[`“`,d.quote,`”`]}),f?(0,G.jsx)(`p`,{className:`tr-host`,children:b(d)}):h&&(0,G.jsxs)(`p`,{className:`tr-host`,children:[m?(0,G.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer noopener`,children:h}):h,d.date&&(0,G.jsxs)(`span`,{className:`tr-date`,children:[` · `,d.date]})]})]}),R=o&&(o.region||o.period||o.unit)&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`SCOPE`}),(0,G.jsx)(`p`,{className:`tr-chips`,children:[o.region,o.period,o.unit].filter(Kn).map(Gn)})]}),z=K.kind===`calculated`&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`CALCULATION`}),(0,G.jsx)(`p`,{className:`tr-formula`,children:S(K.calc.formula,e=>n.values.get(e)?.label)}),(0,G.jsx)(`ul`,{className:`tr-inputs`,children:_.map(e=>{let t=n.values.get(e);return(0,G.jsx)(`li`,{children:t?(0,G.jsxs)(`button`,{type:`button`,className:`tr-input`,onClick:()=>c(e),children:[(0,G.jsx)(`span`,{className:`tr-input-label`,children:t.label}),(0,G.jsx)(`span`,{className:`tr-input-val`,children:x(t)})]}):(0,G.jsx)(`span`,{className:`tr-input tr-input-missing`,children:e})},e)})}),v>0&&(0,G.jsxs)(`p`,{className:`tr-more`,children:[`…and `,v,` more`]}),K.calc.note&&(0,G.jsx)(`p`,{className:`tr-note`,children:K.calc.note})]}),B=s.length>0&&(0,G.jsxs)(`section`,{className:`tr-sec`,children:[(0,G.jsx)(`h3`,{className:`tr-sec-title`,children:`USED IN`}),(0,G.jsx)(`ul`,{className:`tr-used`,children:s.map(e=>(0,G.jsx)(`li`,{children:u?(0,G.jsx)(`button`,{type:`button`,className:`tr-usedin`,onClick:()=>u(e),children:e.label}):(0,G.jsx)(`span`,{className:`tr-usedin tr-usedin-flat`,children:e.label})},`${e.surface}:${e.id}:${e.label}`))})]})}t[11]=i,t[12]=l,t[13]=c,t[14]=u,t[15]=n.usedIn,t[16]=n.values,t[17]=a,t[18]=r,t[19]=A,t[20]=j,t[21]=M,t[22]=N,t[23]=P,t[24]=F,t[25]=I,t[26]=L,t[27]=R,t[28]=z,t[29]=B,t[30]=V,t[31]=H,t[32]=K}else A=t[19],j=t[20],M=t[21],N=t[22],P=t[23],F=t[24],I=t[25],L=t[26],R=t[27],z=t[28],B=t[29],V=t[30],H=t[31],K=t[32];if(V!==Symbol.for(`react.early_return_sentinel`))return V;let te;t[44]!==K.kind||t[45]!==K.resolution?(te=K.kind===`illustrative`&&(0,G.jsxs)(`p`,{className:`tr-caveat`,children:[`Illustrative — shows the shape, not a measured fact. `,K.resolution.illustrative]}),t[44]=K.kind,t[45]=K.resolution,t[46]=te):te=t[46];let q;t[47]===h?q=t[48]:(q=h&&(0,G.jsx)(`p`,{className:`tr-hint`,children:`Any figure like this one opens its own receipt.`}),t[47]=h,t[48]=q);let ne;return t[49]!==A||t[50]!==j||t[51]!==M||t[52]!==N||t[53]!==P||t[54]!==F||t[55]!==I||t[56]!==L||t[57]!==R||t[58]!==z||t[59]!==B||t[60]!==te||t[61]!==q||t[62]!==H?(ne=(0,G.jsxs)(`div`,{ref:H,className:A,role:j,"aria-modal":M,"aria-label":N,tabIndex:P,style:F,children:[I,L,R,z,B,te,q]}),t[49]=A,t[50]=j,t[51]=M,t[52]=N,t[53]=P,t[54]=F,t[55]=I,t[56]=L,t[57]=R,t[58]=z,t[59]=B,t[60]=te,t[61]=q,t[62]=H,t[63]=ne):ne=t[63],ne}function Gn(e){return(0,G.jsx)(`span`,{className:`tr-chip`,children:e},e)}function Kn(e){return!!e}function qn(e){let t=(0,W.c)(23),{registry:n,onNavigate:r,children:i,ref:a}=e,[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(null),t[0]=u):u=t[0];let d;t[1]===n?d=t[2]:(d=[n],t[1]=n,t[2]=d),(0,U.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>s(null),t[3]=f):f=t[3];let p=f,m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>({dismiss:p}),h=[p],t[4]=m,t[5]=h):(m=t[4],h=t[5]),(0,U.useImperativeHandle)(a,m,h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(e,t)=>{t.focus(),s({valueId:e,anchorRect:t.getBoundingClientRect(),trail:[]})},t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>l(!0),t[7]=v):v=t[7];let y=v,b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{s(t=>t&&{valueId:e,anchorRect:t.anchorRect,trail:[...t.trail,t.valueId]})},t[8]=b):b=t[8];let x=b,S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{s(Jn)},t[9]=S):S=t[9];let C=S,w;t[10]!==c||t[11]!==r||t[12]!==n?(w={registry:n,open:_,onNavigate:r,hinted:c,markHinted:y},t[10]=c,t[11]=r,t[12]=n,t[13]=w):w=t[13];let T=w,E;t[14]!==o||t[15]!==c||t[16]!==r||t[17]!==n?(E=o&&(0,G.jsx)(Wn,{registry:n,valueId:o.valueId,anchorRect:o.anchorRect,trail:o.trail,hinted:c,onMarkHinted:y,onDrill:x,onBack:C,onNavigate:r,onDismiss:p}),t[14]=o,t[15]=c,t[16]=r,t[17]=n,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==E||t[21]!==T?(D=(0,G.jsxs)(Pn.Provider,{value:T,children:[i,E]}),t[19]=i,t[20]=E,t[21]=T,t[22]=D):D=t[22],D}function Jn(e){let t=e?.trail[e.trail.length-1];return!e||t===void 0?e:{valueId:t,anchorRect:e.anchorRect,trail:e.trail.slice(0,-1)}}var Yn=`Recomputed locally from the causes above — a model of what would happen, never an observation.`,Xn=`What was actually measured. This column never moves when a lever is pulled.`;function Zn(e,t){return(e>0?`+`:``)+m(e,t)}function Qn(e){return e!==null&&Number.isFinite(e)&&e>=0&&e<=1}function $n(e){return e.exactBase===null?`nothing measured stands behind this outcome`:`not every step is grounded, so the total stays unmeasured`}function er(e){let t=(0,W.c)(22),{baseline:n,current:r,unit:i,active:a,observedNote:o}=e,s;t[0]!==n.exactBase||t[1]!==n.fullyGrounded||t[2]!==i?(s=n.fullyGrounded&&n.exactBase!==null?m(n.exactBase,i):null,t[0]=n.exactBase,t[1]=n.fullyGrounded,t[2]=i,t[3]=s):s=t[3];let c=s,l=r.exactBase??n.exactBase,u=a?`1`:void 0,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{className:`tr-chip tr-wi-chip`,title:Xn,children:`OBSERVED`}),t[4]=d):d=t[4];let f;t[5]!==n||t[6]!==c||t[7]!==o?(f=(0,G.jsxs)(`div`,{className:`tr-wi-col`,children:[d,c===null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`tr-wi-figure tr-wi-dash`,children:`—`}),(0,G.jsx)(`p`,{className:`tr-wi-note tr-wi-why`,children:o??$n(n)})]}):(0,G.jsx)(`p`,{className:`tr-wi-figure`,children:c})]}),t[5]=n,t[6]=c,t[7]=o,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==l||t[11]!==r.exactDelta||t[12]!==r.explainedPct||t[13]!==r.fullyGrounded||t[14]!==r.relBase||t[15]!==r.relCur||t[16]!==i?(p=a&&(0,G.jsxs)(`div`,{className:`tr-wi-col tr-wi-hypo`,"data-world":`hypothetical`,children:[(0,G.jsx)(`span`,{className:`tr-chip tr-wi-chip tr-wi-chip-hypo`,title:Yn,children:`HYPOTHETICAL (MODELED)`}),r.fullyGrounded&&l!==null&&r.exactDelta!==null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`tr-wi-figure`,children:m(l+r.exactDelta,i)}),(0,G.jsx)(`p`,{className:`tr-wi-delta`,children:Zn(r.exactDelta,i)}),Qn(r.explainedPct)&&(0,G.jsxs)(`p`,{className:`tr-wi-note`,children:[Math.round(r.explainedPct*100),`% explained`]})]}):r.relCur===null?(0,G.jsx)(`p`,{className:`tr-wi-figure tr-wi-dash`,children:`—`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`tr-wi-figure tr-wi-phrase`,children:ne(r.relBase??0,r.relCur)}),(0,G.jsx)(`p`,{className:`tr-wi-note`,children:`relative, not measured`})]})]}),t[9]=a,t[10]=l,t[11]=r.exactDelta,t[12]=r.explainedPct,t[13]=r.fullyGrounded,t[14]=r.relBase,t[15]=r.relCur,t[16]=i,t[17]=p):p=t[17];let h;return t[18]!==u||t[19]!==f||t[20]!==p?(h=(0,G.jsxs)(`div`,{className:`tr-wi`,"data-active":u,children:[f,p]}),t[18]=u,t[19]=f,t[20]=p,t[21]=h):h=t[21],h}var tr=(0,U.memo)(er);function nr(e){return{id:e.id,label:e.label,role:e.role,depth:e.depth,tier:e.tier,...e.value===void 0?{}:{value:e.value},...e.unit?{unit:e.unit}:{},...e.receipt?{receipt:e.receipt}:{}}}function rr(e){let t=e.receipts?.[0]??e.receipt;return{from:e.from,to:e.to,sign:e.sign,tier:e.tier,...e.verb?{verb:e.verb}:{},...e.weight===void 0?{}:{weight:e.weight},...t&&!e.provisional?{receipt:t}:{},...e.provisional?{provisional:!0}:{}}}function ir(e){return{center:e.title,outcomeId:e.outcomeId,nodes:e.nodes.map(nr),edges:e.edges.map(rr),provenance:{...e.provenance.illustrative?{illustrative:!0}:{},...e.provenance.notes?.length?{notes:e.provenance.notes}:{}}}}var ar=e=>`node:${e}`,or=(e,t)=>`node:${e}@${t}`;function sr(e,t){let n=e.provenance.illustrative===!0,r=[],i=[],a=[],o=new Map,s=[],c=new Map,l=(e,t,n)=>{!e||o.has(e.id)||(o.set(e.id,e),s.push(t),i.push(n))},u=(e,t)=>{c.set(e.id,e.label),r.push({id:e.id,label:e.label,role:e.role,...e.detail===void 0?{}:{detail:e.detail},...e.domain===void 0?{}:{domain:e.domain},...t===void 0?{}:{parentId:t}});let i=e.series,a=e.unit??i?.unit,o=t=>({valueId:t,surface:`node`,id:e.id,label:e.label});if(e.value!==void 0){let t=ar(e.id);l(R(t,e.label,e.value,e.tier,a,e.receipt,n),o(t),{valueId:t,entityId:e.id})}if(i)for(let t of i.points){let r=or(e.id,t.t),a=R(r,`${e.label} · ${t.t}`,t.value,i.tier,i.unit,t.receipt??i.receipt,n,t.t);l(a,o(r),{valueId:r,entityId:e.id,at:t.t})}for(let t of e.children??[])u(t,e.id)};for(let t of e.nodes)u(t);return se(e.edges).forEach((e,n)=>{let r=`${c.get(e.from)??e.from} ${e.verb??`→`} ${c.get(e.to)??e.to}`,i=t.edges[n]?.id;if(i!==void 0){a.push({id:i,from:e.from,to:e.to,...e.relation===void 0?{}:{kind:e.relation},...e.sign===void 0?{}:{sign:e.sign},...e.weight===void 0?{}:{weight:e.weight}});for(let t of[e.from,e.to])s.push({valueId:ar(t),surface:`edge`,id:i,label:r})}}),{title:e.title,entities:r,relations:a,facts:i,trust:z(o,s),outcomeId:e.outcomeId,...n?{illustrative:n}:{}}}var cr=1100;function lr(e,t,n,r){let i=!1,a=e=>{i||(i=!0,r(e))};(async()=>{for(let r=Math.max(0,t);r<e.length;r++){let t=e[r];if(!t)continue;if(n.isCancelled()){a(`cancelled`);return}let i=O(t.say),o=n.speakLine?.(t.say)??null,s=o?await j(o):!1;if(n.isCancelled()){a(`cancelled`);return}n.apply(t,r),o&&s?await k(o,i,cr):await A(i)}a(n.isCancelled()?`cancelled`:`complete`)})()}function ur({beats:e,apply:t,speakLine:n}){let[r,i]=(0,U.useState)(-1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(0),c=(0,U.useRef)(e);c.current=e;let l=(0,U.useRef)(t);l.current=t;let u=(0,U.useRef)(n);u.current=n;let d=(0,U.useCallback)(()=>{s.current+=1,o(!1)},[]),f=(0,U.useCallback)(e=>{let t=s.current+=1;o(!0),lr(c.current,e,{speakLine:e=>u.current?.(e)??null,apply:(e,t)=>{i(t),l.current(e,t)},isCancelled:()=>s.current!==t},()=>{s.current===t&&o(!1)})},[]);(0,U.useEffect)(()=>()=>void(s.current+=1),[]),(0,U.useEffect)(()=>{s.current+=1,o(!1),i(-1)},[e]);let p=(0,U.useCallback)(()=>{if(a){d();return}let e=c.current.length;e!==0&&f(r>=0&&r<e-1?r:0)},[a,r,f,d]),m=(0,U.useCallback)(e=>{let t=c.current.length;t!==0&&f(Math.min(Math.max(e,0),t-1))},[f]),h=(0,U.useCallback)(()=>{d(),i(-1)},[d]);return{index:r,playing:a,caption:r>=0?e[r]?.caption??null:null,toggle:p,seek:m,reset:h}}function dr(e){let t=(0,W.c)(28),{count:n,index:r,playing:i,caption:a,expanded:o,onToggle:s,onSeek:c}=e;if(n===0)return null;let l=Math.min(Math.max(r,-1),n-1),u=i?``:void 0,d=o?``:void 0,f=`${o?108:54}px`,p;t[0]===f?p=t[1]:(p={"--wo-transport-h":f},t[0]=f,t[1]=p);let m=p,h=i?`Pause the walkthrough`:`Walk me through it`,g=i?`❙❙`:`▶`,_;t[2]===g?_=t[3]:(_=(0,G.jsx)(`span`,{className:`wo-play-glyph`,"aria-hidden":`true`,children:g}),t[2]=g,t[3]=_);let v=i?`Pause`:`Walk me through it`,y;t[4]===v?y=t[5]:(y=(0,G.jsx)(`span`,{className:`wo-play-label`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==s||t[7]!==y||t[8]!==h||t[9]!==_?(b=(0,G.jsxs)(`button`,{type:`button`,className:`wo-play`,onClick:s,"aria-label":h,children:[_,y]}),t[6]=s,t[7]=y,t[8]=h,t[9]=_,t[10]=b):b=t[10];let x;t[11]!==l||t[12]!==n||t[13]!==o||t[14]!==c?(x=o&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`wo-track`,role:`group`,"aria-label":`Walkthrough beats`,children:Array.from({length:n},(e,t)=>(0,G.jsx)(`button`,{type:`button`,className:`wo-tick`,"data-state":t<l?`past`:t===l?`now`:`ahead`,onClick:()=>c(t),"aria-label":`Beat ${t+1} of ${n}`,"aria-current":t===l?`step`:void 0},t))}),(0,G.jsxs)(`span`,{className:`wo-transport-count`,"aria-hidden":`true`,children:[l<0?n:l+1,`/`,n]})]}),t[11]=l,t[12]=n,t[13]=o,t[14]=c,t[15]=x):x=t[15];let S;t[16]!==b||t[17]!==x?(S=(0,G.jsxs)(`div`,{className:`wo-transport-row`,children:[b,x]}),t[16]=b,t[17]=x,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==o?(C=o&&(0,G.jsx)(`p`,{className:`wo-caption`,"aria-live":`polite`,children:a===null?``:M(a)}),t[19]=a,t[20]=o,t[21]=C):C=t[21];let w;return t[22]!==u||t[23]!==S||t[24]!==C||t[25]!==d||t[26]!==m?(w=(0,G.jsxs)(`div`,{className:`wo-transport`,"data-playing":u,"data-open":d,style:m,children:[S,C]}),t[22]=u,t[23]=S,t[24]=C,t[25]=d,t[26]=m,t[27]=w):w=t[27],w}var fr=170,pr={contributes:`fed by`,causes:`driven by`,dampens:`held back by`,enables:`made possible by`,correlates:`moving together with`},mr={1:`pushed up by`,[-1]:`pushed down by`};function hr(e){let t=e.split(` `,1)[0]??``;return t.length===0||/[A-Z]/.test(t.slice(1))?e:e[0].toLowerCase()+e.slice(1)}var gr={graph:`And that is how the causes fit together.`,timeline:`And here are the same causes, in time.`,chart:`And here is what each one actually measured.`,flow:`And here is how much each one contributed.`};function _r(e,t){let n=e.values.get(ar(t));if(!n||n.kind===`structure`)return null;let r=x(n);return n.kind===`illustrative`?{say:`Illustratively, about ${r}.`,shown:`Illustratively, about ${r}.`}:{say:`Measured at ${r}.`,shown:`Measured at ${r}.`}}function vr(e){return e.kind?e.kind===`dampens`||e.kind===`enables`||e.kind===`correlates`:e.sign===-1}function yr(e){return e.kind&&pr[e.kind]?pr[e.kind]:mr[e.sign??1]??`fed by`}function br(e){let t=e.nodes.filter(e=>e.parentId===void 0),n=new Set(t.map(e=>e.id)),r=e.edges.filter(e=>n.has(e.from)&&n.has(e.to)),i=new Map(t.map(e=>[e.id,e.depth??0])),a=new Map;for(let e of r)a.set(e.from,(a.get(e.from)??0)+(e.weight??0));let o=new Map(t.map(e=>[e.id,0]));for(let e of r)o.set(e.to,(o.get(e.to)??0)+1);let s=(e,t)=>(i.get(e)??0)-(i.get(t)??0)||(a.get(t)??0)-(a.get(e)??0)||(e<t?-1:+(e>t)),c=t.filter(e=>o.get(e.id)===0).map(e=>e.id),l=[],u=new Set;for(;c.length>0;){c.sort(s);let e=c.shift();if(!(e===void 0||u.has(e))){u.add(e),l.push(e);for(let t of r){if(t.from!==e)continue;let n=(o.get(t.to)??0)-1;o.set(t.to,n),n<=0&&!u.has(t.to)&&c.push(t.to)}}}for(let e of t.map(e=>e.id).sort(s))u.has(e)||l.push(e);return l}function xr(e,t,n,r={}){let i=br(t);if(i.length<2)return[];let c=new Map(e.nodes.map(e=>[e.id,e])),l=new Map(t.nodes.map(e=>[e.id,e.label])),u=new Map(i.map((e,t)=>[e,t])),d=e=>t.edges.filter(t=>t.to===e&&u.has(t.from)&&(u.get(t.from)??0)<(u.get(e)??0)).sort((e,t)=>(t.weight??0)-(e.weight??0)||(e.id<t.id?-1:1))[0],f=[],p=i.at(-1)===e.outcomeId?i.length-1:i.length,m=p===1?`One cause, one outcome. Here is how it connects.`:`${p} causes, one outcome. Here is how they connect.`;f.push({nodeId:e.outcomeId,wide:!0,rep:`graph`,say:m,caption:m});let h=null;for(let[t,r]of i.entries()){let u=c.get(r),p=l.get(r)??r,m=d(r),g=r===e.outcomeId&&t===i.length-1,_=m?l.get(m.from)??m.from:null,v;v=g?m?`And it ends here: ${hr(p)}, ${yr(m)} ${m.from===h?`it`:hr(_??``)}.`:`And it ends here: ${hr(p)}.`:m?m.from===h?vr(m)?`Then ${hr(p)}, ${yr(m)} it.`:`Then ${hr(p)}.`:`${p}, ${yr(m)} ${hr(_??``)}.`:t===0?`It starts with ${hr(p)}.`:`Alongside it: ${p}.`,h=r;let y=[v],b=[v],x=_r(n,r);x&&(y.push(x.say),b.push(x.shown));let S=u?.detail;S&&(y.push(s(a(S),fr)),b.push(s(o(S),fr))),f.push({nodeId:r,...m?{edgeId:m.id}:{},say:y.join(` `),caption:b.join(` `)})}if(r.closeOn){let t=gr[r.closeOn];f.push({nodeId:e.outcomeId,wide:!0,rep:r.closeOn,say:t,caption:t})}return f}r();var Sr=[{rep:`graph`,label:`Graph`},{rep:`flow`,label:`Contribution`},{rep:`timeline`,label:`Over time`},{rep:`chart`,label:`As a chart`}],Cr={graph:`Left to right is what led to what. Colour is the direction of the push; thickness is how much of the outcome the link explains.`,timeline:`Left to right is WHEN, read against the axis below; a bar is how long a cause lasted. Height only keeps entries from overlapping — it means nothing.`,chart:`Each mark is a cause plotted against its own measured history. Causes with nothing measured are held aside rather than drawn at zero.`,flow:`Ribbon thickness is how much of the outcome that link was MEASURED to explain. A cause whose links carry no measured share is held aside rather than drawn thin, which would read as a finding nobody made.`},wr=`an illustrative world measures nothing, so there is no baseline`;function Tr(e,t){for(let n of e){if(n.id===t)return n.children;let e=n.children===void 0?void 0:Tr(n.children,t);if(e)return e}}function Er(e){let{value:t,...n}=e;return n}function Dr(e,t){let n=new Map;for(let[r,i]of e.relativeByNode){let e=t.relativeByNode.get(r)??0;i>0&&n.set(r,e/i)}return n}function Or(e,t,n,r){return{exactBase:n??null,exactDelta:e.outcomeDelta,explainedPct:e.explainedPct,fullyGrounded:e.fullyGrounded&&!r,relBase:t.relativeOutcome,relCur:e.relativeOutcome}}function kr(e){let t=(0,W.c)(12),{spec:n,question:r,failed:i,onRetry:a,onClose:o,view:s,onExpandNode:c,autoWalk:l,speakLine:u}=e;if(n){let e;return t[0]!==l||t[1]!==o||t[2]!==c||t[3]!==u||t[4]!==n||t[5]!==s?(e=(0,G.jsx)(jr,{spec:n,view:s,onClose:o,onExpandNode:c,autoWalk:l,speakLine:u}),t[0]=l,t[1]=o,t[2]=c,t[3]=u,t[4]=n,t[5]=s,t[6]=e):e=t[6],e}let d=r??``,f=i===!0,p;return t[7]!==o||t[8]!==a||t[9]!==d||t[10]!==f?(p=(0,G.jsx)(Ar,{title:d,failed:f,onRetry:a,onClose:o}),t[7]=o,t[8]=a,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function Ar(e){let t=(0,W.c)(17),{title:n,failed:r,onRetry:i,onClose:a}=e,o=`Living answer: ${n}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`wo-kicker`,children:`THE LIVING ANSWER`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,G.jsxs)(`div`,{className:`wo-title`,children:[s,(0,G.jsx)(`h2`,{children:n})]}),t[1]=n,t[2]=c);let l;t[3]===a?l=t[4]:(l=a&&(0,G.jsx)(`div`,{className:`wo-head-actions`,children:(0,G.jsx)(`button`,{type:`button`,className:`wo-btn wo-btn-close`,onClick:a,"aria-label":`Close`,children:`✕`})}),t[3]=a,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,G.jsxs)(`header`,{className:`wo-head`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==r||t[9]!==i?(d=(0,G.jsx)(`div`,{className:`wo-shell`,role:`status`,"aria-live":`polite`,children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`wo-shell-line`,children:`This world didn’t come back.`}),(0,G.jsx)(`p`,{className:`wo-shell-note`,children:`Nothing was built, and Mavéa won’t stand in a causal web it can’t source. The answer behind this card is untouched.`}),i&&(0,G.jsx)(`button`,{type:`button`,className:`wo-btn`,onClick:i,children:`Try again`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`wo-shell-pulse`,"aria-hidden":`true`}),(0,G.jsx)(`p`,{className:`wo-shell-line`,children:`Building this world…`}),(0,G.jsx)(`p`,{className:`wo-shell-note`,children:`One model call, grounded in what this answer already found. Once it is built it is kept — re-opening it, and replaying this turn, costs nothing.`})]})}),t[8]=r,t[9]=i,t[10]=d):d=t[10];let f;t[11]!==u||t[12]!==d?(f=(0,G.jsxs)(`div`,{className:`wo-panel`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==o||t[15]!==f?(p=(0,G.jsx)(`section`,{className:`wo-scrim`,"aria-label":o,children:f}),t[14]=o,t[15]=f,t[16]=p):p=t[16],p}function jr({spec:e,view:t,onClose:n,onExpandNode:r,autoWalk:a,speakLine:o}){let[s,d]=(0,U.useState)(()=>new Map),[f,p]=(0,U.useState)(null),m=(0,U.useMemo)(()=>{if(s.size===0)return e;let t=e;for(let[e,n]of s)t=F(t,e,n);return t},[e,s]),h=m.provenance.illustrative===!0,g=(0,U.useMemo)(()=>le(m),[m]),_=(0,U.useMemo)(()=>sr(m,g),[m,g]),v=_.trust,y=(0,U.useMemo)(()=>ir(m),[m]),[b,x]=(0,U.useState)(()=>new Map),[S,C]=(0,U.useState)(null),[w,T]=(0,U.useState)(!1),E=(0,U.useMemo)(()=>[...b.values()].some(e=>e!==100),[b]),D=(0,U.useMemo)(()=>[...b].map(([e,t])=>({nodeId:e,pct:t/100})),[b]),O=(0,U.useMemo)(()=>H(y,[]),[y]),k=(0,U.useMemo)(()=>H(y,D),[y,D]),A=(0,U.useMemo)(()=>E?Dr(O,k):null,[E,O,k]),j=(0,U.useDeferredValue)(A),M=(0,U.useCallback)(e=>Cn(e,g),[g]),P=t&&M(t)?t:void 0,R=Dn({world:g,insetBottom:w?108:54,...P?{initialRep:P}:{}}),{rep:z,setRep:W,expandedIds:ee,toggleExpand:K}=R;(0,U.useEffect)(()=>{P&&W(P)},[P,W]);let te=(0,U.useMemo)(()=>{let e=g.nodes.map(e=>{let t=Er(e),n=j?.get(e.parentId??e.id),r=N(e.label);return{...t,label:r,...n===void 0?{}:{shift:n}}});return{...g,nodes:e}},[g,j]),q=(0,U.useMemo)(()=>{let e=new Map,t=n=>{e.set(n.id,n);for(let e of n.children??[])t(e)};for(let e of m.nodes)t(e);return e},[m]),ne=(0,U.useMemo)(()=>{let e=se(m.edges);return new Map(g.edges.map((t,n)=>[t.id,e[n]]))},[g,m]),re=(0,U.useMemo)(()=>new Set(g.nodes.map(e=>e.parentId).filter(e=>e!==void 0)),[g]),ae=(0,U.useRef)(null),oe=(0,U.useCallback)(()=>ae.current?.dismiss(),[]),ce=(0,U.useCallback)(e=>{(e.surface===`node`||e.surface===`edge`)&&C({kind:e.surface,id:e.id})},[]),[ue,de]=(0,U.useState)(void 0),fe=M(`timeline`)?`timeline`:void 0,[pe,me]=(0,U.useState)([]);(0,U.useEffect)(()=>{let e=globalThis.requestIdleCallback,t=()=>me(xr(m,g,v,fe?{closeOn:fe}:{}));if(typeof e==`function`){let n=e(t,{timeout:2e3});return()=>globalThis.cancelIdleCallback?.(n)}let n=setTimeout(t,1);return()=>clearTimeout(n)},[m,g,v,fe]);let{focusNode:J}=R,he=(0,U.useCallback)(e=>{e.rep&&W(e.rep),C({kind:`node`,id:e.nodeId}),de(e.edgeId),e.wide?J(null):e.rep||J(e.nodeId)},[J,W]),{index:ge,playing:Y,caption:_e,toggle:ve,seek:ye,reset:be}=ur((0,U.useMemo)(()=>({beats:pe,apply:he,...o?{speakLine:o}:{}}),[pe,he,o]));(0,U.useEffect)(()=>{T(Y||ge>=0)},[Y,ge]);let xe=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!a||xe.current||pe.length===0||(xe.current=!0,ve())},[a,pe.length,ve]);let X=(0,U.useCallback)(()=>{be(),de(void 0)},[be]),Se=(0,U.useRef)(n);Se.current=n;let Ce=(0,U.useRef)(ve);Ce.current=ve;let we=(0,U.useRef)(X);we.current=X,(0,U.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){we.current(),Se.current?.();return}(e.key===` `||e.key===`Spacebar`)&&(e.target?.closest(`button, input, select, textarea, [contenteditable="true"]`)||(e.preventDefault(),Ce.current()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let Te=(0,U.useCallback)(e=>{X(),C({kind:`node`,id:e.id})},[X]),Ee=(0,U.useCallback)(e=>{X(),C({kind:`edge`,id:e})},[X]),De=(0,U.useCallback)((e,t)=>{X(),x(n=>new Map(n).set(e,t))},[X]),Oe=(0,U.useCallback)(()=>{X(),x(new Map)},[X]),ke=(0,U.useCallback)(e=>g.nodes.find(t=>t.id===e)?.parentId===void 0,[g]),Ae=(0,U.useCallback)(e=>{!r||f!==null||(p(e),r(e,m).then(t=>{p(null);let n=t===null?void 0:Tr(t.nodes,e);n?.length&&(d(t=>new Map(t).set(e,n)),ke(e)?K(e):C({kind:`node`,id:e}))},()=>p(null)))},[r,ke,f,m,K]),je=(0,U.useCallback)((e,t)=>{if(t===`entry`&&z===`timeline`){let t=q.get(e.id),n=t?.date,r=t?.series?.points,i=n?.until!==void 0||(r?.length??0)>1,a=n?.t??r?.[0]?.t;return i||!a?null:(0,G.jsx)(`span`,{className:`wo-when`,"data-said":e.dateGrounded?``:void 0,children:a})}if(t!==`card`)return null;let n=ee.has(e.id),i=re.has(e.id),a=e.parentId===void 0,o=!i&&r!==void 0,s=i&&a,c=f===e.id;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(In,{id:ar(e.id),className:`wo-num`}),e.shift!==void 0&&ie(e.shift)!==null&&(0,G.jsx)(`span`,{className:`wo-shift`,"data-dir":e.shift<1?`down`:`up`,children:ie(e.shift)}),(s||o)&&(0,G.jsx)(`button`,{type:`button`,className:`wo-expand`,"aria-expanded":n,"aria-busy":c||void 0,disabled:c||o&&f!==null,"aria-label":`${s&&n?`Fold up`:`Break down`} ${e.label}`,onClick:t=>{t.stopPropagation(),s?K(e.id):Ae(e.id)},children:c?`breaking down…`:s&&n?`fold up`:`break down`})]})},[re,ee,K,r,f,Ae,q,z]),Z=q.get(m.outcomeId),Me=(0,U.useMemo)(()=>Or(O,O,Z?.value,h),[O,Z?.value,h]),Ne=(0,U.useMemo)(()=>Or(k,O,Z?.value,h),[k,O,Z?.value,h]),Pe=(0,U.useMemo)(()=>({causes:m.nodes.length,links:m.edges.length,sourced:m.nodes.filter(e=>e.receipt!==void 0).length}),[m]),Q=S?.kind===`node`?q.get(S.id):void 0,Fe=(0,U.useMemo)(()=>Q===void 0?[]:B(_,Q.id),[_,Q]),[Ie,Le]=(0,U.useState)(null);(0,U.useEffect)(()=>{if(Q===void 0){Le(null);return}let e=!0;return(async()=>{let{hierarchyLens:t}=await i(async()=>{let{hierarchyLens:e}=await import(`./lens-ChFJD9il.js`);return{hierarchyLens:e}},__vite__mapDeps([0,1,2,3]));if(!e)return;let n=t.compile(_,Q.id);if(n===null){Le(null);return}await c(l([n.block]));let r=u(n.block.type);e&&r&&Le({plan:n,render:r})})(),()=>{e=!1}},[_,Q]);let $=S?.kind===`edge`?ne.get(S.id):void 0,Re=(0,U.useMemo)(()=>m.nodes.filter(e=>e.role===`root`).map(e=>({id:e.id,label:N(e.label),pct:b.get(e.id)??100})),[m.nodes,b]);return(0,G.jsx)(qn,{registry:v,onNavigate:ce,ref:ae,children:(0,G.jsx)(`section`,{className:`wo-scrim`,"aria-label":`Living answer: ${m.title}`,children:(0,G.jsxs)(`div`,{className:`wo-panel`,children:[(0,G.jsxs)(`header`,{className:`wo-head`,children:[(0,G.jsxs)(`div`,{className:`wo-title`,children:[(0,G.jsx)(`span`,{className:`wo-kicker`,children:`THE LIVING ANSWER`}),(0,G.jsx)(`h2`,{children:m.title})]}),(0,G.jsxs)(`div`,{className:`wo-head-actions`,children:[(0,G.jsx)(`div`,{className:`wo-views`,role:`group`,"aria-label":`View`,children:Sr.filter(e=>M(e.rep)).map(e=>(0,G.jsx)(`button`,{type:`button`,className:`wo-chip`,"aria-pressed":z===e.rep,onClick:()=>{X(),W(e.rep)},children:e.label},e.rep))}),(0,G.jsx)(`button`,{type:`button`,className:`wo-btn`,onClick:Oe,disabled:!E,children:`Reset`}),n&&(0,G.jsx)(`button`,{type:`button`,className:`wo-btn wo-btn-close`,onClick:n,"aria-label":`Close`,children:`✕`})]})]}),h&&(0,G.jsx)(`div`,{className:`wo-banner wo-banner-illustrative`,children:`Illustrative model — shows the shape, not your numbers.`}),(0,G.jsx)(`p`,{className:`wo-legend`,children:Cr[z]}),(0,G.jsxs)(`div`,{className:`wo-body`,children:[(0,G.jsxs)(`div`,{className:`wo-stage`,onWheelCapture:oe,onPointerDownCapture:oe,children:[(0,G.jsx)(Je,{stage:R,world:te,renderFace:je,onNodeClick:Te,onEdgeClick:Ee,selectedId:S?.kind===`node`?S.id:void 0,litEdgeId:ue}),(0,G.jsx)(dr,{count:pe.length,index:ge,playing:Y,caption:_e,expanded:w,onToggle:ve,onSeek:ye})]}),(0,G.jsxs)(`aside`,{className:`wo-rail`,children:[(0,G.jsx)(Nn,{levers:Re,onSet:De,onReset:Oe}),(0,G.jsx)(tr,{baseline:Me,current:Ne,unit:Z?.unit,active:E,observedNote:h?wr:void 0}),(0,G.jsxs)(`div`,{className:`wo-detail`,children:[(0,G.jsx)(`span`,{className:`wo-rail-kicker`,children:`EVIDENCE`}),!S&&(0,G.jsxs)(`div`,{className:`wo-standing`,children:[(0,G.jsxs)(`dl`,{className:`wo-facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Causes`}),(0,G.jsx)(`dd`,{children:Pe.causes})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Links`}),(0,G.jsx)(`dd`,{children:Pe.links})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:h?`Illustrative`:`With a source`}),(0,G.jsx)(`dd`,{children:h?`every cause`:Pe.sourced})]})]}),Z&&(0,G.jsxs)(`p`,{className:`wo-standing-outcome`,children:[(0,G.jsx)(`span`,{className:`wo-standing-lead`,children:`It ends at`}),` `,Z.label,Z.detail?(0,G.jsx)(`span`,{className:`wo-standing-note`,children:Z.detail}):null]}),(0,G.jsx)(`p`,{className:`wo-hint`,children:`Tap a cause or a link to see what stands behind it.`})]}),Q&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`wo-detail-title`,children:Q.label}),Q.detail&&(0,G.jsx)(`p`,{className:`wo-detail-note`,children:Q.detail}),(0,G.jsx)(`p`,{className:`wo-detail-figure`,children:(0,G.jsx)(In,{id:ar(Q.id)})}),Q.series&&(0,G.jsx)(`ul`,{className:`wo-series`,children:Q.series.points.map((e,t)=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`wo-series-t`,children:e.t}),(0,G.jsx)(In,{id:or(Q.id,e.t)})]},`${e.t}:${t}`))}),(Ie||Fe.length>0)&&(0,G.jsxs)(`div`,{className:`wo-parts`,children:[(0,G.jsx)(`span`,{className:`wo-rail-kicker`,children:`WHAT THIS IS MADE OF`}),Ie?Ie.render(Ie.plan.block.props,{delay:0}):(0,G.jsx)(`ul`,{className:`wo-part-list`,children:Fe.map(e=>(0,G.jsx)(`li`,{children:N(e.label)},e.id))})]})]}),$&&(0,G.jsx)(V,{relation:L($.relation),sign:$.sign,status:$.status??I($),receipts:$.receipts??($.receipt?[$.receipt]:[]),counter:$.counter,provisional:$.provisional})]})]})]})]})})})}export{kr as WorldOverlay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compiler-runtime-qQQXpJgv.js";import{t}from"./jsx-runtime-DeHZSEgm.js";import{ot as n}from"./index-LiHcEJt_.js";import{t as r}from"./Orb-D8lhTdmY.js";var i=e(),a=t();function o(e){let t=(0,i.c)(17),{reverse:n,eyebrow:r,eyebrowTone:o,title:s,body:c,visual:l}=e,u=`fl-panel`+(n?` reverse`:``),d=`fl-panel-eyebrow tone-`+o,f;t[0]!==r||t[1]!==d?(f=(0,a.jsx)(`div`,{className:d,children:r}),t[0]=r,t[1]=d,t[2]=f):f=t[2];let p;t[3]===s?p=t[4]:(p=(0,a.jsx)(`h3`,{className:`fl-panel-title`,children:s}),t[3]=s,t[4]=p);let m;t[5]===c?m=t[6]:(m=(0,a.jsx)(`p`,{className:`fl-panel-body`,children:c}),t[5]=c,t[6]=m);let h;t[7]!==f||t[8]!==p||t[9]!==m?(h=(0,a.jsxs)(`div`,{className:`fl-panel-copy`,children:[f,p,m]}),t[7]=f,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;t[11]===l?g=t[12]:(g=(0,a.jsx)(`div`,{className:`fl-panel-visual`,children:l}),t[11]=l,t[12]=g);let _;return t[13]!==u||t[14]!==h||t[15]!==g?(_=(0,a.jsxs)(`div`,{className:u,children:[h,g]}),t[13]=u,t[14]=h,t[15]=g,t[16]=_):_=t[16],_}var s=[`46%`,`52%`,`50%`,`58%`,`74%`,`100%`],c=[[24,72],[98,98],[173,116],[247,98],[322,66],[396,36]],l=[`Q1`,`Q2`,`Q3`,`Q4`,`Q5`,`Q6`];function u(){let e=(0,i.c)(12),t,n,r,o,s,u,m,h,g;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)){let i=c.map(p).join(` `);u=`fl-card fl-pen`,m=(0,a.jsxs)(`div`,{className:`fl-pen-head`,children:[(0,a.jsx)(`span`,{className:`fl-ink-label`,children:`Revenue · the road back`}),(0,a.jsxs)(`span`,{className:`fl-pen-value`,children:[`$4.2M`,(0,a.jsx)(`i`,{className:`fl-pen-delta`,children:`▲ recovering`})]})]}),t=`fl-pen-plot`,n=`0 0 420 184`,r=`true`,o=(0,a.jsx)(`defs`,{children:(0,a.jsxs)(`linearGradient`,{id:`fl-pen-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,a.jsx)(`stop`,{offset:`0`,className:`fl-pen-fill-top`}),(0,a.jsx)(`stop`,{offset:`1`,className:`fl-pen-fill-bot`})]})}),s=(0,a.jsxs)(`g`,{className:`fl-pen-grid`,children:[(0,a.jsx)(`line`,{x1:`24`,y1:`48`,x2:`396`,y2:`48`}),(0,a.jsx)(`line`,{x1:`24`,y1:`84`,x2:`396`,y2:`84`}),(0,a.jsx)(`line`,{x1:`24`,y1:`120`,x2:`396`,y2:`120`}),(0,a.jsx)(`line`,{x1:`24`,y1:`150`,x2:`396`,y2:`150`,className:`base`})]}),h=(0,a.jsx)(`path`,{className:`fl-pen-area`,d:`M${i.replace(/ /g,` L`)} L396,150 L24,150 Z`}),g=(0,a.jsx)(`polyline`,{className:`fl-pen-line`,points:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s,e[5]=u,e[6]=m,e[7]=h,e[8]=g}else t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],u=e[5],m=e[6],h=e[7],g=e[8];let _;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,a.jsx)(`g`,{className:`fl-pen-dots`,children:c.map(f)}),e[9]=_):_=e[9];let v;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,a.jsxs)(`svg`,{className:t,viewBox:n,"aria-hidden":r,children:[o,s,h,g,_,(0,a.jsx)(`g`,{className:`fl-pen-axis`,children:l.map(d)}),(0,a.jsx)(`path`,{className:`fl-pen-trend`,pathLength:1,d:`M166,126 C232,122 300,86 384,44 M384,44 l-13,1 m13,-1 l-3,12`}),(0,a.jsx)(`path`,{className:`fl-pen-star`,pathLength:1,d:`M396,18 L399,26 L407,26 L401,32 L403,40 L396,35 L389,40 L391,32 L385,26 L393,26 Z`})]}),e[10]=v):v=e[10];let y;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,a.jsxs)(`div`,{className:u,children:[m,v,(0,a.jsxs)(`div`,{className:`fl-pen-options`,children:[(0,a.jsxs)(`span`,{className:`fl-pen-chip`,children:[`Cut marketing`,(0,a.jsx)(`svg`,{viewBox:`0 0 120 26`,preserveAspectRatio:`none`,"aria-hidden":`true`,className:`fl-pen-strike`,children:(0,a.jsx)(`path`,{pathLength:1,d:`M5,15 C34,10 74,18 115,10`})})]}),(0,a.jsx)(`span`,{className:`fl-pen-chip kept`,children:`Raise prices ✓`})]})]}),e[11]=y):y=e[11],y}function d(e,t){return(0,a.jsx)(`text`,{x:c[t][0],y:`172`,children:e},e)}function f(e,t){let[n,r]=e;return(0,a.jsx)(`circle`,{cx:n,cy:r,r:`3.2`},t)}function p(e){let[t,n]=e;return`${t},${n}`}var m=[{id:`bars`,d:`M6,26 V14 M14,26 V6 M22,26 V18`,label:`chart`},{id:`line`,d:`M4,24 L11,14 L18,18 L26,6`,label:`trend`},{id:`donut`,d:`M14,4 A10,10 0 1 1 4,14`,label:`share`},{id:`pin`,d:`M14,4 a8,8 0 0 1 8,8 c0,6 -8,14 -8,14 s-8,-8 -8,-14 a8,8 0 0 1 8,-8`,label:`map`},{id:`steps`,d:`M4,24 H12 V16 H20 V8 H26`,label:`timeline`},{id:`net`,d:`M6,22 L14,8 L24,20 M6,22 L24,20`,label:`network`},{id:`gauge`,d:`M4,22 A11,11 0 0 1 26,22 M15,22 L21,12`,label:`gauge`},{id:`rows`,d:`M5,8 H25 M5,15 H25 M5,22 H17`,label:`table`}];function h(){return(0,a.jsx)(`div`,{className:`fl-card fl-instruments`,children:m.map((e,t)=>(0,a.jsxs)(`span`,{className:`fl-instrument`,style:{"--in-i":String(t)},children:[(0,a.jsx)(`svg`,{viewBox:`0 0 30 30`,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{d:e.d})}),e.label]},e.id))})}function g(){let e=(0,i.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(`div`,{className:`fl-ink-label`,children:`Revenue · last 6 quarters`}),e[0]=t):t=e[0];let n,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,a.jsx)(`div`,{className:`fl-ink-bars`,children:s.map(_)}),r=(0,a.jsx)(`span`,{className:`fl-hl-sweep`}),e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,a.jsxs)(`div`,{className:`fl-card fl-ink`,children:[t,(0,a.jsxs)(`div`,{className:`fl-ink-plot`,children:[n,r,(0,a.jsxs)(`span`,{className:`fl-hl-chip`,children:[(0,a.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{d:`M3 21l3.2-.9L18 8.3l-2.3-2.3L4 17.6 3 21z M14.7 7l2.3 2.3`})}),`Ask about this`]})]})]}),e[3]=o):o=e[3],o}function _(e,t){return(0,a.jsx)(`div`,{className:`fl-ink-barcol`,children:(0,a.jsx)(`div`,{className:`fl-ink-bar`+(e===`100%`?` peak`:``),style:{height:e}})},t)}function v(){return(0,a.jsxs)(`div`,{className:`fl-card fl-ghostwrap`,children:[(0,a.jsxs)(`div`,{className:`fl-ghost-said`,children:[(0,a.jsx)(`span`,{className:`fl-wave`,"aria-hidden":`true`,children:Array.from({length:12},(e,t)=>(0,a.jsx)(`i`,{style:{"--i":String(t)}},t))}),(0,a.jsxs)(`span`,{className:`fl-ghost-words`,children:[`“…and how does that compare to last year, and`,(0,a.jsx)(`span`,{className:`fl-caret`}),`”`]})]}),(0,a.jsxs)(`div`,{className:`fl-ghost-cards`,children:[(0,a.jsxs)(`div`,{className:`fl-ghost`,children:[(0,a.jsx)(`div`,{className:`fl-ghost-tag`,children:`Forming…`}),(0,a.jsxs)(`div`,{className:`fl-ghost-bars`,children:[(0,a.jsx)(`i`,{style:{height:`50%`}}),(0,a.jsx)(`i`,{style:{height:`80%`}}),(0,a.jsx)(`i`,{style:{height:`65%`}})]})]}),(0,a.jsxs)(`div`,{className:`fl-ghost delay`,children:[(0,a.jsx)(`div`,{className:`fl-ghost-tag`,children:`Forming…`}),(0,a.jsx)(`svg`,{viewBox:`0 0 120 50`,"aria-hidden":`true`,children:(0,a.jsx)(`polyline`,{points:`0,42 24,30 48,34 72,18 96,22 120,8`})})]})]})]})}var y=[{label:`Runway: 14mo`,meta:`4×`,x:92,y:52,tone:`blue`},{label:`Hiring freeze`,meta:`a worry`,x:86,y:200,tone:`amber`},{label:`Ship velocity`,meta:`slowing`,x:300,y:204,tone:`amber`},{label:`Churn signal`,meta:`watch`,x:300,y:50,tone:`pink`},{label:`Pricing`,meta:`your idea`,x:206,y:226,tone:`green`}],b=[[0,3],[3,2],[1,4],[4,2],[0,1]];function x(){let e=(0,i.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(`svg`,{className:`fl-mindmap-links`,viewBox:`0 0 420 264`,"aria-hidden":`true`,children:b.map(C)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,a.jsxs)(`div`,{className:`fl-card fl-mindmap`,children:[t,(0,a.jsx)(`div`,{className:`fl-mindmap-hub`,children:(0,a.jsx)(r,{size:46})}),y.map(S)]}),e[1]=n):n=e[1],n}function S(e){return(0,a.jsxs)(`div`,{className:`fl-node tone-`+e.tone,style:{left:`${e.x/420*100}%`,top:`${e.y/264*100}%`},children:[(0,a.jsx)(`div`,{className:`fl-node-label`,children:e.label}),(0,a.jsx)(`div`,{className:`fl-node-meta`,children:e.meta})]},e.label)}function C(e,t){let[n,r]=e,i=y[n],o=y[r],s=(i.x+o.x)/2,c=(i.y+o.y)/2-20;return(0,a.jsx)(`path`,{d:`M${i.x},${i.y} Q${s},${c} ${o.x},${o.y}`},t)}var w=[{icon:`⌨`,label:`Type it`},{icon:`🎙`,label:`Say it`},{icon:`▦`,label:`Drag a card`}];function T(){let e=(0,i.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(`span`,{className:`fl-blank-num good`,children:`$2.1M`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,a.jsxs)(`span`,{className:`fl-blank-hole`,children:[`your burn / mo`,(0,a.jsx)(`span`,{className:`fl-caret`})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,a.jsxs)(`div`,{className:`fl-blank-sentence`,children:[`With `,t,` in the bank and a burn of`,` `,n,`, your runway is `,(0,a.jsx)(`span`,{className:`fl-blank-pending`,children:`— months`}),`.`]}),e[2]=r):r=e[2];let o;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,a.jsxs)(`div`,{className:`fl-card fl-blank`,children:[r,(0,a.jsx)(`div`,{className:`fl-blank-options`,"aria-hidden":`true`,children:w.map(E)})]}),e[3]=o):o=e[3],o}function E(e){return(0,a.jsxs)(`span`,{className:`fl-blank-btn`,children:[(0,a.jsx)(`span`,{className:`fl-blank-icon`,children:e.icon}),e.label]},e.label)}var D=[`“ARR climbed to $15.1M — up 21%.”`,`“The trend held steady all quarter.”`,`“North America still leads, at 54%.”`];function O(){return(0,a.jsxs)(`div`,{className:`fl-card fl-walk`,children:[(0,a.jsx)(`div`,{className:`fl-ink-label`,children:`Q3 revenue · read to you`}),(0,a.jsxs)(`div`,{className:`fl-walk-stage`,children:[(0,a.jsxs)(`div`,{className:`fl-walk-presenter`,children:[(0,a.jsx)(r,{size:44,className:`fl-walk-orb`}),(0,a.jsxs)(`div`,{className:`fl-walk-say`,children:[(0,a.jsx)(`span`,{className:`fl-wave`,"aria-hidden":`true`,children:Array.from({length:8},(e,t)=>(0,a.jsx)(`i`,{style:{"--i":String(t)}},t))}),(0,a.jsx)(`span`,{className:`fl-walk-caps`,children:D.map((e,t)=>(0,a.jsx)(`span`,{className:`fl-walk-line l${t+1}`,children:e},e))})]})]}),(0,a.jsxs)(`div`,{className:`fl-walk-items`,children:[(0,a.jsxs)(`div`,{className:`fl-walk-item`,children:[(0,a.jsx)(`span`,{className:`fl-walk-k`,children:`ARR`}),(0,a.jsx)(`span`,{className:`fl-walk-v`,children:`$15.1M`}),(0,a.jsx)(`span`,{className:`fl-walk-up`,children:`▲ 21%`})]}),(0,a.jsx)(`div`,{className:`fl-walk-item`,children:(0,a.jsx)(`svg`,{className:`fl-walk-spark`,viewBox:`0 0 120 26`,"aria-hidden":`true`,children:(0,a.jsx)(`polyline`,{points:`2,20 22,17 42,19 62,11 82,13 100,6 118,3`})})}),(0,a.jsxs)(`div`,{className:`fl-walk-item`,children:[(0,a.jsx)(`span`,{className:`fl-walk-k`,children:`N. America`}),(0,a.jsx)(`span`,{className:`fl-walk-v`,children:`54%`})]}),(0,a.jsx)(`span`,{className:`fl-walk-spot`,"aria-hidden":`true`})]})]})]})}function k(){let e=(0,i.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsxs)(n,{eyebrow:`Things a chat window can’t do`,children:[`It’s a `,(0,a.jsx)(`em`,{children:`friend at the whiteboard.`})]}),e[0]=t):t=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,a.jsx)(o,{eyebrow:`Highlight is the interface`,eyebrowTone:`presence`,title:`Highlight the answer to ask.`,body:`Drag across a bar, a row, a figure — the highlight grabs exactly what’s under it, and your next question is grounded on that piece, not the whole answer.`,visual:(0,a.jsx)(g,{})}),e[1]=r):r=e[1];let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,a.jsx)(o,{reverse:!0,eyebrow:`And the pen is in its hand`,eyebrowTone:`amber`,title:`It draws on its own answers.`,body:`A trend arrow along the recovery, a star on the number that matters, a strike through the option it rules out — the whiteboard marks a good teacher leaves.`,visual:(0,a.jsx)(u,{})}),e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,a.jsx)(o,{eyebrow:`It answers while you talk`,eyebrowTone:`blue`,title:`The answer forms mid-sentence.`,body:`Dashed “ghost” cards sketch the answer taking shape behind your words — and reshape live as your question turns. You see it thinking with you, not after you.`,visual:(0,a.jsx)(v,{})}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,a.jsx)(o,{reverse:!0,eyebrow:`Watch it map your thinking`,eyebrowTone:`green`,title:`Ramble. Get a map of your mind.`,body:`Themes emerge from what you actually said — never fixed buckets — with the tensions between them drawn in. A minute of talking becomes a structure you can see.`,visual:(0,a.jsx)(x,{})}),e[4]=l):l=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,a.jsx)(o,{eyebrow:`The Blank Space`,eyebrowTone:`pink`,title:`It won’t guess. It leaves a space.`,body:`When an answer needs a number only you have, Mavéa leaves a glowing hole to fill — type it, say it, or drag a card in. Uncertainty, made honest and interactive.`,visual:(0,a.jsx)(T,{})}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,a.jsx)(o,{reverse:!0,eyebrow:`One canvas, many instruments`,eyebrowTone:`presence`,title:`The answer picks its shape.`,body:`Charts, maps, timelines, networks, tables — hundreds of visual instruments on one canvas, and each answer reaches for the ones that fit.`,visual:(0,a.jsx)(h,{})}),e[6]=f):f=e[6];let p;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,a.jsxs)(a.Fragment,{children:[t,(0,a.jsxs)(`div`,{className:`fl-panels`,children:[r,s,c,l,d,f,(0,a.jsx)(o,{eyebrow:`It reads the answer to you`,eyebrowTone:`presence`,title:`It points, and talks you through.`,body:`Mavéa doesn’t drop a wall of cards and leave. It spotlights each part and speaks to it — walking you through the answer a piece at a time, the way a friend at the whiteboard would.`,visual:(0,a.jsx)(O,{})})]})]}),e[7]=p):p=e[7],p}export{k as WowFeatures};
|
|
1
|
+
import{t as e}from"./compiler-runtime-qQQXpJgv.js";import{t}from"./jsx-runtime-DeHZSEgm.js";import{ot as n}from"./index-CdUH6Eo9.js";import{t as r}from"./Orb-D8lhTdmY.js";var i=e(),a=t();function o(e){let t=(0,i.c)(17),{reverse:n,eyebrow:r,eyebrowTone:o,title:s,body:c,visual:l}=e,u=`fl-panel`+(n?` reverse`:``),d=`fl-panel-eyebrow tone-`+o,f;t[0]!==r||t[1]!==d?(f=(0,a.jsx)(`div`,{className:d,children:r}),t[0]=r,t[1]=d,t[2]=f):f=t[2];let p;t[3]===s?p=t[4]:(p=(0,a.jsx)(`h3`,{className:`fl-panel-title`,children:s}),t[3]=s,t[4]=p);let m;t[5]===c?m=t[6]:(m=(0,a.jsx)(`p`,{className:`fl-panel-body`,children:c}),t[5]=c,t[6]=m);let h;t[7]!==f||t[8]!==p||t[9]!==m?(h=(0,a.jsxs)(`div`,{className:`fl-panel-copy`,children:[f,p,m]}),t[7]=f,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;t[11]===l?g=t[12]:(g=(0,a.jsx)(`div`,{className:`fl-panel-visual`,children:l}),t[11]=l,t[12]=g);let _;return t[13]!==u||t[14]!==h||t[15]!==g?(_=(0,a.jsxs)(`div`,{className:u,children:[h,g]}),t[13]=u,t[14]=h,t[15]=g,t[16]=_):_=t[16],_}var s=[`46%`,`52%`,`50%`,`58%`,`74%`,`100%`],c=[[24,72],[98,98],[173,116],[247,98],[322,66],[396,36]],l=[`Q1`,`Q2`,`Q3`,`Q4`,`Q5`,`Q6`];function u(){let e=(0,i.c)(12),t,n,r,o,s,u,m,h,g;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)){let i=c.map(p).join(` `);u=`fl-card fl-pen`,m=(0,a.jsxs)(`div`,{className:`fl-pen-head`,children:[(0,a.jsx)(`span`,{className:`fl-ink-label`,children:`Revenue · the road back`}),(0,a.jsxs)(`span`,{className:`fl-pen-value`,children:[`$4.2M`,(0,a.jsx)(`i`,{className:`fl-pen-delta`,children:`▲ recovering`})]})]}),t=`fl-pen-plot`,n=`0 0 420 184`,r=`true`,o=(0,a.jsx)(`defs`,{children:(0,a.jsxs)(`linearGradient`,{id:`fl-pen-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,a.jsx)(`stop`,{offset:`0`,className:`fl-pen-fill-top`}),(0,a.jsx)(`stop`,{offset:`1`,className:`fl-pen-fill-bot`})]})}),s=(0,a.jsxs)(`g`,{className:`fl-pen-grid`,children:[(0,a.jsx)(`line`,{x1:`24`,y1:`48`,x2:`396`,y2:`48`}),(0,a.jsx)(`line`,{x1:`24`,y1:`84`,x2:`396`,y2:`84`}),(0,a.jsx)(`line`,{x1:`24`,y1:`120`,x2:`396`,y2:`120`}),(0,a.jsx)(`line`,{x1:`24`,y1:`150`,x2:`396`,y2:`150`,className:`base`})]}),h=(0,a.jsx)(`path`,{className:`fl-pen-area`,d:`M${i.replace(/ /g,` L`)} L396,150 L24,150 Z`}),g=(0,a.jsx)(`polyline`,{className:`fl-pen-line`,points:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s,e[5]=u,e[6]=m,e[7]=h,e[8]=g}else t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],u=e[5],m=e[6],h=e[7],g=e[8];let _;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,a.jsx)(`g`,{className:`fl-pen-dots`,children:c.map(f)}),e[9]=_):_=e[9];let v;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,a.jsxs)(`svg`,{className:t,viewBox:n,"aria-hidden":r,children:[o,s,h,g,_,(0,a.jsx)(`g`,{className:`fl-pen-axis`,children:l.map(d)}),(0,a.jsx)(`path`,{className:`fl-pen-trend`,pathLength:1,d:`M166,126 C232,122 300,86 384,44 M384,44 l-13,1 m13,-1 l-3,12`}),(0,a.jsx)(`path`,{className:`fl-pen-star`,pathLength:1,d:`M396,18 L399,26 L407,26 L401,32 L403,40 L396,35 L389,40 L391,32 L385,26 L393,26 Z`})]}),e[10]=v):v=e[10];let y;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,a.jsxs)(`div`,{className:u,children:[m,v,(0,a.jsxs)(`div`,{className:`fl-pen-options`,children:[(0,a.jsxs)(`span`,{className:`fl-pen-chip`,children:[`Cut marketing`,(0,a.jsx)(`svg`,{viewBox:`0 0 120 26`,preserveAspectRatio:`none`,"aria-hidden":`true`,className:`fl-pen-strike`,children:(0,a.jsx)(`path`,{pathLength:1,d:`M5,15 C34,10 74,18 115,10`})})]}),(0,a.jsx)(`span`,{className:`fl-pen-chip kept`,children:`Raise prices ✓`})]})]}),e[11]=y):y=e[11],y}function d(e,t){return(0,a.jsx)(`text`,{x:c[t][0],y:`172`,children:e},e)}function f(e,t){let[n,r]=e;return(0,a.jsx)(`circle`,{cx:n,cy:r,r:`3.2`},t)}function p(e){let[t,n]=e;return`${t},${n}`}var m=[{id:`bars`,d:`M6,26 V14 M14,26 V6 M22,26 V18`,label:`chart`},{id:`line`,d:`M4,24 L11,14 L18,18 L26,6`,label:`trend`},{id:`donut`,d:`M14,4 A10,10 0 1 1 4,14`,label:`share`},{id:`pin`,d:`M14,4 a8,8 0 0 1 8,8 c0,6 -8,14 -8,14 s-8,-8 -8,-14 a8,8 0 0 1 8,-8`,label:`map`},{id:`steps`,d:`M4,24 H12 V16 H20 V8 H26`,label:`timeline`},{id:`net`,d:`M6,22 L14,8 L24,20 M6,22 L24,20`,label:`network`},{id:`gauge`,d:`M4,22 A11,11 0 0 1 26,22 M15,22 L21,12`,label:`gauge`},{id:`rows`,d:`M5,8 H25 M5,15 H25 M5,22 H17`,label:`table`}];function h(){return(0,a.jsx)(`div`,{className:`fl-card fl-instruments`,children:m.map((e,t)=>(0,a.jsxs)(`span`,{className:`fl-instrument`,style:{"--in-i":String(t)},children:[(0,a.jsx)(`svg`,{viewBox:`0 0 30 30`,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{d:e.d})}),e.label]},e.id))})}function g(){let e=(0,i.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(`div`,{className:`fl-ink-label`,children:`Revenue · last 6 quarters`}),e[0]=t):t=e[0];let n,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,a.jsx)(`div`,{className:`fl-ink-bars`,children:s.map(_)}),r=(0,a.jsx)(`span`,{className:`fl-hl-sweep`}),e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,a.jsxs)(`div`,{className:`fl-card fl-ink`,children:[t,(0,a.jsxs)(`div`,{className:`fl-ink-plot`,children:[n,r,(0,a.jsxs)(`span`,{className:`fl-hl-chip`,children:[(0,a.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{d:`M3 21l3.2-.9L18 8.3l-2.3-2.3L4 17.6 3 21z M14.7 7l2.3 2.3`})}),`Ask about this`]})]})]}),e[3]=o):o=e[3],o}function _(e,t){return(0,a.jsx)(`div`,{className:`fl-ink-barcol`,children:(0,a.jsx)(`div`,{className:`fl-ink-bar`+(e===`100%`?` peak`:``),style:{height:e}})},t)}function v(){return(0,a.jsxs)(`div`,{className:`fl-card fl-ghostwrap`,children:[(0,a.jsxs)(`div`,{className:`fl-ghost-said`,children:[(0,a.jsx)(`span`,{className:`fl-wave`,"aria-hidden":`true`,children:Array.from({length:12},(e,t)=>(0,a.jsx)(`i`,{style:{"--i":String(t)}},t))}),(0,a.jsxs)(`span`,{className:`fl-ghost-words`,children:[`“…and how does that compare to last year, and`,(0,a.jsx)(`span`,{className:`fl-caret`}),`”`]})]}),(0,a.jsxs)(`div`,{className:`fl-ghost-cards`,children:[(0,a.jsxs)(`div`,{className:`fl-ghost`,children:[(0,a.jsx)(`div`,{className:`fl-ghost-tag`,children:`Forming…`}),(0,a.jsxs)(`div`,{className:`fl-ghost-bars`,children:[(0,a.jsx)(`i`,{style:{height:`50%`}}),(0,a.jsx)(`i`,{style:{height:`80%`}}),(0,a.jsx)(`i`,{style:{height:`65%`}})]})]}),(0,a.jsxs)(`div`,{className:`fl-ghost delay`,children:[(0,a.jsx)(`div`,{className:`fl-ghost-tag`,children:`Forming…`}),(0,a.jsx)(`svg`,{viewBox:`0 0 120 50`,"aria-hidden":`true`,children:(0,a.jsx)(`polyline`,{points:`0,42 24,30 48,34 72,18 96,22 120,8`})})]})]})]})}var y=[{label:`Runway: 14mo`,meta:`4×`,x:92,y:52,tone:`blue`},{label:`Hiring freeze`,meta:`a worry`,x:86,y:200,tone:`amber`},{label:`Ship velocity`,meta:`slowing`,x:300,y:204,tone:`amber`},{label:`Churn signal`,meta:`watch`,x:300,y:50,tone:`pink`},{label:`Pricing`,meta:`your idea`,x:206,y:226,tone:`green`}],b=[[0,3],[3,2],[1,4],[4,2],[0,1]];function x(){let e=(0,i.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(`svg`,{className:`fl-mindmap-links`,viewBox:`0 0 420 264`,"aria-hidden":`true`,children:b.map(C)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,a.jsxs)(`div`,{className:`fl-card fl-mindmap`,children:[t,(0,a.jsx)(`div`,{className:`fl-mindmap-hub`,children:(0,a.jsx)(r,{size:46})}),y.map(S)]}),e[1]=n):n=e[1],n}function S(e){return(0,a.jsxs)(`div`,{className:`fl-node tone-`+e.tone,style:{left:`${e.x/420*100}%`,top:`${e.y/264*100}%`},children:[(0,a.jsx)(`div`,{className:`fl-node-label`,children:e.label}),(0,a.jsx)(`div`,{className:`fl-node-meta`,children:e.meta})]},e.label)}function C(e,t){let[n,r]=e,i=y[n],o=y[r],s=(i.x+o.x)/2,c=(i.y+o.y)/2-20;return(0,a.jsx)(`path`,{d:`M${i.x},${i.y} Q${s},${c} ${o.x},${o.y}`},t)}var w=[{icon:`⌨`,label:`Type it`},{icon:`🎙`,label:`Say it`},{icon:`▦`,label:`Drag a card`}];function T(){let e=(0,i.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(`span`,{className:`fl-blank-num good`,children:`$2.1M`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,a.jsxs)(`span`,{className:`fl-blank-hole`,children:[`your burn / mo`,(0,a.jsx)(`span`,{className:`fl-caret`})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,a.jsxs)(`div`,{className:`fl-blank-sentence`,children:[`With `,t,` in the bank and a burn of`,` `,n,`, your runway is `,(0,a.jsx)(`span`,{className:`fl-blank-pending`,children:`— months`}),`.`]}),e[2]=r):r=e[2];let o;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,a.jsxs)(`div`,{className:`fl-card fl-blank`,children:[r,(0,a.jsx)(`div`,{className:`fl-blank-options`,"aria-hidden":`true`,children:w.map(E)})]}),e[3]=o):o=e[3],o}function E(e){return(0,a.jsxs)(`span`,{className:`fl-blank-btn`,children:[(0,a.jsx)(`span`,{className:`fl-blank-icon`,children:e.icon}),e.label]},e.label)}var D=[`“ARR climbed to $15.1M — up 21%.”`,`“The trend held steady all quarter.”`,`“North America still leads, at 54%.”`];function O(){return(0,a.jsxs)(`div`,{className:`fl-card fl-walk`,children:[(0,a.jsx)(`div`,{className:`fl-ink-label`,children:`Q3 revenue · read to you`}),(0,a.jsxs)(`div`,{className:`fl-walk-stage`,children:[(0,a.jsxs)(`div`,{className:`fl-walk-presenter`,children:[(0,a.jsx)(r,{size:44,className:`fl-walk-orb`}),(0,a.jsxs)(`div`,{className:`fl-walk-say`,children:[(0,a.jsx)(`span`,{className:`fl-wave`,"aria-hidden":`true`,children:Array.from({length:8},(e,t)=>(0,a.jsx)(`i`,{style:{"--i":String(t)}},t))}),(0,a.jsx)(`span`,{className:`fl-walk-caps`,children:D.map((e,t)=>(0,a.jsx)(`span`,{className:`fl-walk-line l${t+1}`,children:e},e))})]})]}),(0,a.jsxs)(`div`,{className:`fl-walk-items`,children:[(0,a.jsxs)(`div`,{className:`fl-walk-item`,children:[(0,a.jsx)(`span`,{className:`fl-walk-k`,children:`ARR`}),(0,a.jsx)(`span`,{className:`fl-walk-v`,children:`$15.1M`}),(0,a.jsx)(`span`,{className:`fl-walk-up`,children:`▲ 21%`})]}),(0,a.jsx)(`div`,{className:`fl-walk-item`,children:(0,a.jsx)(`svg`,{className:`fl-walk-spark`,viewBox:`0 0 120 26`,"aria-hidden":`true`,children:(0,a.jsx)(`polyline`,{points:`2,20 22,17 42,19 62,11 82,13 100,6 118,3`})})}),(0,a.jsxs)(`div`,{className:`fl-walk-item`,children:[(0,a.jsx)(`span`,{className:`fl-walk-k`,children:`N. America`}),(0,a.jsx)(`span`,{className:`fl-walk-v`,children:`54%`})]}),(0,a.jsx)(`span`,{className:`fl-walk-spot`,"aria-hidden":`true`})]})]})]})}function k(){let e=(0,i.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsxs)(n,{eyebrow:`Things a chat window can’t do`,children:[`It’s a `,(0,a.jsx)(`em`,{children:`friend at the whiteboard.`})]}),e[0]=t):t=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,a.jsx)(o,{eyebrow:`Highlight is the interface`,eyebrowTone:`presence`,title:`Highlight the answer to ask.`,body:`Drag across a bar, a row, a figure — the highlight grabs exactly what’s under it, and your next question is grounded on that piece, not the whole answer.`,visual:(0,a.jsx)(g,{})}),e[1]=r):r=e[1];let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,a.jsx)(o,{reverse:!0,eyebrow:`And the pen is in its hand`,eyebrowTone:`amber`,title:`It draws on its own answers.`,body:`A trend arrow along the recovery, a star on the number that matters, a strike through the option it rules out — the whiteboard marks a good teacher leaves.`,visual:(0,a.jsx)(u,{})}),e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,a.jsx)(o,{eyebrow:`It answers while you talk`,eyebrowTone:`blue`,title:`The answer forms mid-sentence.`,body:`Dashed “ghost” cards sketch the answer taking shape behind your words — and reshape live as your question turns. You see it thinking with you, not after you.`,visual:(0,a.jsx)(v,{})}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,a.jsx)(o,{reverse:!0,eyebrow:`Watch it map your thinking`,eyebrowTone:`green`,title:`Ramble. Get a map of your mind.`,body:`Themes emerge from what you actually said — never fixed buckets — with the tensions between them drawn in. A minute of talking becomes a structure you can see.`,visual:(0,a.jsx)(x,{})}),e[4]=l):l=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,a.jsx)(o,{eyebrow:`The Blank Space`,eyebrowTone:`pink`,title:`It won’t guess. It leaves a space.`,body:`When an answer needs a number only you have, Mavéa leaves a glowing hole to fill — type it, say it, or drag a card in. Uncertainty, made honest and interactive.`,visual:(0,a.jsx)(T,{})}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,a.jsx)(o,{reverse:!0,eyebrow:`One canvas, many instruments`,eyebrowTone:`presence`,title:`The answer picks its shape.`,body:`Charts, maps, timelines, networks, tables — hundreds of visual instruments on one canvas, and each answer reaches for the ones that fit.`,visual:(0,a.jsx)(h,{})}),e[6]=f):f=e[6];let p;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,a.jsxs)(a.Fragment,{children:[t,(0,a.jsxs)(`div`,{className:`fl-panels`,children:[r,s,c,l,d,f,(0,a.jsx)(o,{eyebrow:`It reads the answer to you`,eyebrowTone:`presence`,title:`It points, and talks you through.`,body:`Mavéa doesn’t drop a wall of cards and leave. It spotlights each part and speaks to it — walking you through the answer a piece at a time, the way a friend at the whiteboard would.`,visual:(0,a.jsx)(O,{})})]})]}),e[7]=p):p=e[7],p}export{k as WowFeatures};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-BZJXY1be.js";import{t}from"./compiler-runtime-qQQXpJgv.js";import{t as n}from"./jsx-runtime-DeHZSEgm.js";import{n as r}from"./icons-gLFQTv74.js";import{t as i}from"./useFocusTrap-CJmpNZv2.js";import{t as a}from"./portal-
|
|
1
|
+
import{t as e}from"./react-BZJXY1be.js";import{t}from"./compiler-runtime-qQQXpJgv.js";import{t as n}from"./jsx-runtime-DeHZSEgm.js";import{n as r}from"./icons-gLFQTv74.js";import{t as i}from"./useFocusTrap-CJmpNZv2.js";import{t as a}from"./portal-BIN_aqvw.js";import{t as o}from"./useZoomGesture-CN0p0lHL.js";var s=e(),c=t(),l=n();function u(e){let t=(0,c.c)(52),{model:n,level:u,onLevel:d,onJump:f,onClose:p}=e,m=(0,s.useRef)(null);i(m);let h;t[0]!==u||t[1]!==p||t[2]!==d?(h=e=>{e===`out`?d(`breath`):u===`breath`?d(`chapters`):p()},t[0]=u,t[1]=p,t[2]=d,t[3]=h):h=t[3],o(m,h);let g,_;t[4]!==u||t[5]!==p||t[6]!==d?(g=()=>{let e=e=>{e.key===`Escape`?(e.preventDefault(),p()):e.key===`ArrowRight`?(e.preventDefault(),u===`chapters`&&d(`breath`)):e.key===`ArrowLeft`&&(e.preventDefault(),u===`breath`?d(`chapters`):p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_=[u,p,d],t[4]=u,t[5]=p,t[6]=d,t[7]=g,t[8]=_):(g=t[7],_=t[8]),(0,s.useEffect)(g,_);let v;t[9]===p?v=t[10]:(v=e=>{e.target===e.currentTarget&&p()},t[9]=p,t[10]=v);let y=v,b;t[11]===y?b=t[12]:(b=e=>{(e.key===`Enter`||e.key===` `)&&(e.key===` `&&e.preventDefault(),y(e))},t[11]=y,t[12]=b);let x=`zoom-deck level-`+u,S;t[13]===p?S=t[14]:(S=(0,l.jsx)(`button`,{type:`button`,className:`zoom-level`,onClick:p,children:`Canvas`}),t[13]=p,t[14]=S);let C=`zoom-level`+(u===`chapters`?` active`:``),w=u===`chapters`,T;t[15]===d?T=t[16]:(T=()=>d(`chapters`),t[15]=d,t[16]=T);let E;t[17]!==T||t[18]!==C||t[19]!==w?(E=(0,l.jsx)(`button`,{type:`button`,className:C,"aria-pressed":w,onClick:T,children:`Chapters`}),t[17]=T,t[18]=C,t[19]=w,t[20]=E):E=t[20];let D=`zoom-level`+(u===`breath`?` active`:``),O=u===`breath`,k;t[21]===d?k=t[22]:(k=()=>d(`breath`),t[21]=d,t[22]=k);let A;t[23]!==D||t[24]!==O||t[25]!==k?(A=(0,l.jsx)(`button`,{type:`button`,className:D,"aria-pressed":O,onClick:k,children:`One breath`}),t[23]=D,t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==E||t[28]!==A||t[29]!==S?(j=(0,l.jsxs)(`div`,{className:`zoom-levelbar`,role:`group`,"aria-label":`Zoom level`,children:[S,E,A]}),t[27]=E,t[28]=A,t[29]=S,t[30]=j):j=t[30];let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,l.jsx)(r.x,{}),t[31]=M):M=t[31];let N;t[32]===p?N=t[33]:(N=(0,l.jsx)(`button`,{type:`button`,className:`zoom-close`,onClick:p,"aria-label":`Close zoom`,title:`Close`,children:M}),t[32]=p,t[33]=N);let P;t[34]!==j||t[35]!==N?(P=(0,l.jsxs)(`header`,{className:`zoom-toolbar`,children:[j,N]}),t[34]=j,t[35]=N,t[36]=P):P=t[36];let F;t[37]!==u||t[38]!==n.heading||t[39]!==n.meta||t[40]!==n.rows||t[41]!==f||t[42]!==d?(F=u===`breath`?(0,l.jsxs)(`div`,{className:`zoom-breath`,children:[(0,l.jsxs)(`p`,{className:`zoom-breath-line`,children:[n.heading.replace(/, so far\.$/,``),`: `,n.rows.map((e,t)=>(0,l.jsxs)(`button`,{type:`button`,className:`zoom-breath-topic`,onClick:()=>d(`chapters`),children:[e.title,t<n.rows.length-1?` · `:``]},e.frameIndex))]}),(0,l.jsxs)(`p`,{className:`zoom-meta`,children:[n.meta,` · one breath`]})]}):(0,l.jsxs)(`div`,{className:`zoom-chapters`,children:[(0,l.jsxs)(`header`,{className:`zoom-head`,children:[(0,l.jsx)(`span`,{className:`zoom-title`,children:n.heading}),(0,l.jsx)(`span`,{className:`zoom-meta`,children:n.meta})]}),(0,l.jsx)(`ul`,{className:`zoom-rows`,children:n.rows.map(e=>(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,className:`zoom-row`,onClick:()=>f(e.frameIndex),children:[(0,l.jsxs)(`span`,{className:`zoom-row-title`,children:[e.title,(0,l.jsx)(`span`,{className:`zoom-row-clock`,children:e.clock})]}),(0,l.jsx)(`span`,{className:`zoom-row-line`,children:e.line}),e.corrected&&(0,l.jsx)(`span`,{className:`zoom-row-corrected`,children:e.corrected})]})},e.frameIndex))})]}),t[37]=u,t[38]=n.heading,t[39]=n.meta,t[40]=n.rows,t[41]=f,t[42]=d,t[43]=F):F=t[43];let I;t[44]!==P||t[45]!==F||t[46]!==x?(I=(0,l.jsxs)(`div`,{ref:m,className:x,role:`dialog`,"aria-modal":`true`,"aria-label":`Conversation zoomed out`,tabIndex:-1,children:[P,F]}),t[44]=P,t[45]=F,t[46]=x,t[47]=I):I=t[47];let L;return t[48]!==y||t[49]!==I||t[50]!==b?(L=(0,l.jsx)(a,{children:(0,l.jsx)(`div`,{className:`zoom-scrim`,role:`button`,tabIndex:0,"aria-label":`Close`,onClick:y,onKeyDown:b,children:I})}),t[48]=y,t[49]=I,t[50]=b,t[51]=L):L=t[51],L}export{u as ZoomDeck};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./catalog-
|
|
1
|
+
import{n as e}from"./catalog-DfIYAG3v.js";import{t}from"./facts-BUGuVUIc.js";import{t as n}from"./blockTypes-DUDdP3pB.js";import{validateLiveResponse as r}from"./liveSchema-B8Y9HZxd.js";import{F as i,m as a,x as o}from"./store-Ba9vzL4H.js";import{i as s,t as c}from"./useLiveConfig-B4CmBiAK.js";import{i as l,r as u,s as d}from"./store-BwyOArJl.js";import{a as f,l as p,o as m}from"./store-BWLbFXiY.js";import{a as h,c as g,r as _,s as v}from"./store-D2IJF4SA.js";import{r as y,s as b,t as x}from"./store-D-f8ZuaK.js";import{c as S,l as C,u as w}from"./store-B2Rpbqgg.js";var T=25e6,E=32,D=5e5,O=256,k=32768,A=24,j={dashboards:{count:24,entryBytes:1e6},memory:{count:50,entryBytes:16e3},flashcards:{count:1e3,entryBytes:32e3},library:{count:12,entryBytes:24e4},atlas:{count:500,entryBytes:16e3},courses:{count:60,entryBytes:3e5}},M=Object.freeze([{id:`provider-api-keys`,reason:`credential`},{id:`search-api-keys`,reason:`credential`},{id:`github-token`,reason:`credential`},{id:`active-session-and-turn-history`,reason:`not-yet-portable`},{id:`turn-bookmarks`,reason:`not-yet-portable`},{id:`dashboard-refresh-ledger`,reason:`not-yet-portable`},{id:`dashboard-morning-briefing`,reason:`not-yet-portable`},{id:`dashboard-budget-open-and-optimizer-state`,reason:`device-preference`},{id:`course-generated-frame-cache`,reason:`ephemeral-cache`},{id:`course-checkpoint-cache`,reason:`ephemeral-cache`},{id:`course-mastery`,reason:`not-yet-portable`},{id:`ripple-course-progress-and-metadata`,reason:`not-yet-portable`},{id:`ripple-tracked-items`,reason:`not-yet-portable`},{id:`appearance-audio-performance-preferences`,reason:`device-preference`},{id:`setup-tour-demo-and-feature-hints`,reason:`device-preference`},{id:`legal-acceptance-record`,reason:`device-preference`},{id:`one-shot-navigation-seeds`,reason:`ephemeral-cache`}]);async function N(){await Promise.all([i(),p(),d(),b()])}async function P(){await N();let e=S();return{app:`mavea`,kind:`backup`,version:1,exportedAt:Date.now(),data:{dashboards:a(),memory:f(),flashcards:_(),study:h(),library:u(),atlas:x(),courses:{courses:e,progress:Object.fromEntries(e.map(e=>[e.id,C(e.id)]))},settings:JSON.parse(c())}}}async function F(){let e=JSON.stringify(await P()),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t);try{let e=document.createElement(`a`);e.href=n,e.download=`mavea-backup-${new Date().toISOString().slice(0,10)}.json`,e.click()}finally{URL.revokeObjectURL(n)}}function I(e){return typeof TextEncoder==`function`?new TextEncoder().encode(e).byteLength:e.length*2}function L(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function R(e){let t=0,n=(e,r)=>{if(t+=1,t>D||r>E)throw Error(`That backup is too complex to import safely.`);if(typeof e==`string`&&e.length>k)throw Error(`That backup contains an oversized text field.`);if(Array.isArray(e)){for(let t of e)n(t,r+1);return}if(L(e)){let t=Object.entries(e);if(t.length>O)throw Error(`That backup contains an oversized object.`);for(let[e,i]of t){if(e.length>256)throw Error(`That backup contains an oversized field name.`);n(i,r+1)}}};n(e,0)}function z(e,t){try{return L(e)&&I(JSON.stringify(e))<=t}catch{return!1}}function B(e,t){let n=Array.isArray(e)?e:[],{count:r,entryBytes:i}=j[t],a=n.slice(0,r).filter(e=>z(e,i));return{incoming:n.length,entries:a,rejected:n.length-a.length}}var V=new Set([...n,...t.map(e=>e.type)]);async function H(t){let n=new Set,r=e=>{if(Array.isArray(e))for(let t of e.slice(0,A))L(t)&&typeof t.type==`string`&&n.add(t.type)};for(let e of t)if(L(e.spec)&&r(e.spec.blocks),Array.isArray(e.widgets))for(let t of e.widgets)L(t)&&r([t.block]);await e(n)}function U(e,t){return!Array.isArray(e)||e.length>A?null:r({title:t||`Imported canvas`,blocks:e},V,A,!0)}function W(e){if(!Array.isArray(e.blocks)||e.blocks.length>A)return null;let t=r({title:e.title,sub:e.sub,narration:e.opener,topic:e.topic,blocks:e.blocks,sources:e.sources,bend:e.bend,blanks:e.blanks,track:e.track},V,A,!0);return t?{id:`live`,workspace:`Live`,title:t.title,sub:t.sub,opener:t.narration,context:[],blocks:t.blocks,proof:null,...t.topic?{topic:t.topic}:{},...t.track?{track:t.track}:{},...t.bend?{bend:t.bend}:{},...t.blanks?.length?{blanks:t.blanks,awaiting:!0}:{},...t.sources?.length?{sources:t.sources}:{},extras:{},group:`home`,suggests:[],keywords:[]}:null}async function G(e){await H(e);let t=[];for(let n of e){if(!L(n.spec))continue;let e=W(n.spec);e&&t.push({...n,spec:e})}return t}async function K(e){return await H(e),e.map(e=>{if(!Array.isArray(e.widgets))return e;let t=[];for(let n of e.widgets.slice(0,12)){if(!L(n))continue;let e=U([n.block],`Imported dashboard widget`)?.blocks[0];e&&t.push({id:typeof n.id==`string`?n.id:``,block:e,span:n.span===2||n.span===3?n.span:1,fromSource:typeof n.fromSource==`string`?n.fromSource:``,...typeof n.metricId==`string`?{metricId:n.metricId}:{},...typeof n.refreshQuery==`string`?{refreshQuery:n.refreshQuery}:{}})}return{...e,widgets:t}})}function q(e){if(!L(e))return[];let t=[],n=e=>typeof e==`string`||Array.isArray(e)?e.length>0:L(e)?Object.keys(e).length>0:e!=null;return Object.prototype.hasOwnProperty.call(e,`keys`)&&n(e.keys)&&t.push(`provider-api-keys`),Object.prototype.hasOwnProperty.call(e,`searchKeys`)&&n(e.searchKeys)&&t.push(`search-api-keys`),[`githubToken`,`github_token`,`ghToken`].some(t=>Object.prototype.hasOwnProperty.call(e,t)&&n(e[t]))&&t.push(`github-token`),t}function J(e,t,n){return{incoming:t,accepted:n,rejected:t-n,limit:j[e].count}}async function Y(e){let t=I(e);if(t>25e6)throw Error(`That file is too large to be a Mavéa backup.`);let n;try{n=JSON.parse(e)}catch{throw Error(`This file isn’t valid JSON — it may be corrupted or not a Mavéa backup.`)}if(R(n),!L(n)||n.app!==`mavea`||n.kind!==`backup`||typeof n.version!=`number`||!Number.isSafeInteger(n.version)||n.version<1||!L(n.data))throw Error(`This file isn’t a Mavéa backup.`);let r=n.data,i=B(r.dashboards,`dashboards`),a=B(r.memory,`memory`),o=B(r.flashcards,`flashcards`),s=B(r.library,`library`),c=B(r.atlas,`atlas`),l=L(r.courses)?r.courses:{},u=B(l.courses,`courses`),[d,f]=await Promise.all([K(i.entries),G(s.entries)]),p={};if(L(l.progress)){let e=new Set(u.entries.flatMap(e=>typeof e.id==`string`&&e.id?[e.id]:[]));for(let[t,n]of Object.entries(l.progress))e.has(t)&&z(n,15e4)&&(p[t]=n)}let m={app:`mavea`,kind:`backup`,version:n.version,exportedAt:typeof n.exportedAt==`number`&&Number.isFinite(n.exportedAt)?n.exportedAt:0,data:{dashboards:d,memory:a.entries,flashcards:o.entries,study:r.study,library:f,atlas:c.entries,courses:{courses:u.entries,progress:p},...L(r.settings)?{settings:r.settings}:{}}},h={dashboards:J(`dashboards`,i.incoming,d.length),memory:J(`memory`,a.incoming,a.entries.length),flashcards:J(`flashcards`,o.incoming,o.entries.length),library:J(`library`,s.incoming,f.length),atlas:J(`atlas`,c.incoming,c.entries.length),courses:J(`courses`,u.incoming,u.entries.length)},g=q(r.settings),_=n.version>1,v=new Set([`durability-unverified`,`import-may-evict-existing`,`stores-excluded`]);return g.length&&v.add(`credentials-ignored`),_&&v.add(`future-version`),Object.values(h).some(e=>e.rejected>0)&&v.add(`entries-rejected`),{bundle:m,preflight:{version:n.version,versionAhead:_,byteLength:t,credentialsPresent:g,warnings:[...v],excludedStores:M,sections:h}}}function X(e){let t=new Set;for(let n of e)L(n)&&typeof n.id==`string`&&n.id&&t.add(n.id);return t}function Z(e,t,n,r,i){let a=X(n),o=X(r),s=X(i),c=0,l=0;for(let e of a)o.has(e)&&(c+=1);for(let e of o)s.has(e)||(l+=1);return{...e,accepted:t,rejected:e.incoming-t,conflicts:c,evictedExisting:l}}async function Q(e){let[{bundle:t,preflight:n}]=await Promise.all([Y(e),N()]),{data:r}=t,i={dashboards:a(),memory:f(),flashcards:_(),library:u(),atlas:x(),courses:S()},c=o(r.dashboards??[]),d=m(r.memory??[]),p=v(r.flashcards??[]),h=g(r.study),b=l(r.library??[]),C=y(r.atlas??[]),T=r.courses?w(r.courses.courses,r.courses.progress):0,E=!1,D=[...n.credentialsPresent];if(r.settings){let e=s(JSON.stringify(r.settings),{mode:`merge`,preserveSecretState:!0});E=e.appliedFields.length>0,D=[...new Set([...D,...e.credentialsIgnored])]}let O={dashboards:a(),memory:f(),flashcards:_(),library:u(),atlas:x(),courses:S()},k={dashboards:Z(n.sections.dashboards,c,r.dashboards??[],i.dashboards,O.dashboards),memory:Z(n.sections.memory,d,r.memory??[],i.memory,O.memory),flashcards:Z(n.sections.flashcards,p,r.flashcards??[],i.flashcards,O.flashcards),library:Z(n.sections.library,b,r.library??[],i.library,O.library),atlas:Z(n.sections.atlas,C,r.atlas??[],i.atlas,O.atlas),courses:Z(n.sections.courses,T,r.courses?.courses??[],i.courses,O.courses)},A=new Set(n.warnings);return D.length&&A.add(`credentials-ignored`),Object.values(k).some(e=>e.rejected>0)&&A.add(`entries-rejected`),Object.values(k).some(e=>e.evictedExisting>0)&&A.add(`import-may-evict-existing`),{dashboards:c,memory:d,flashcards:p,studyStyle:h,library:b,atlas:C,courses:T,settingsApplied:E,versionAhead:n.versionAhead,credentialsIgnored:D,warnings:[...A],excludedStores:M,durability:`best-effort-unverified`,preflight:n,sections:k}}export{T as MAX_BACKUP_BYTES,F as downloadBackup,Q as importBackup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./ReplayCard-BnX73r9n.js";import"./TopicCanvas-CkqP92SC.js";import"./CanvasSkeleton-BmGjJHUQ.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/src-DG1n-LFe.js","assets/rolldown-runtime-DkW27tQK.js","assets/__vite-browser-external-gfE6fZcA.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./preload-helper-CiWYd9n-.js";import{F as n,N as r,f as i}from"./index-LiHcEJt_.js";import{C as a,i as o,m as s}from"./kokoro-DXRj0KQX.js";async function c(e,t,n){let r=Array(e.length),i=0,a=!1,o=async()=>{for(;!a;){let t=i++;if(t>=e.length)return;try{r[t]=await n(e[t],t)}catch(e){throw a=!0,e}}},s=Math.max(1,Math.min(t,e.length));return await Promise.all(Array.from({length:s},o)),r}var l=24e3,u=.15,d=.18,f=240,p=.008,m=.89,h=6;async function g(e,t){let n=a(e).trim().slice(0,f);if(!n)return new Float32Array;for(let e=0;e<2;e++)try{let e=await fetch(`/tts/v1/audio/speech`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:`kokoro`,input:n,voice:o(`mavea`),response_format:`pcm`,speed:1}),signal:t});if(e.ok)return s(new Uint8Array(await e.arrayBuffer()),null).samples}catch{if(t?.aborted)return new Float32Array}return new Float32Array}async function _(e,t,r){let i=e.slides,a=i.map(e=>Math.max(800,Math.round(e.durationMs))),o=n(),s=i.map(e=>e.voiceover.trim()),f=s.find(Boolean);if(o===null||typeof OfflineAudioContext>`u`)return{buffer:null,timings:a,missing:s.filter(Boolean).length,...f?{firstMissingLine:f}:{}};let _=0,v=await c(i,2,async e=>{let n=await g(e.voiceover,t);return r?.(++_,i.length),n}),y=s.filter(Boolean).length,b=v.filter(e=>e.length>0).length,x=Math.max(0,y-b),S=s.find((e,t)=>e&&v[t].length===0);if(b===0)return{buffer:null,timings:a,missing:x,...S?{firstMissingLine:S}:{}};let C=i.map((e,t)=>{let n=v[t].length/l*1e3;return Math.round(n>0?Math.max(a[t],n+d*1e3):a[t])}),w=0;for(let e of v)for(let t=0;t<e.length;t++)w=Math.max(w,Math.abs(e[t]));let ee=w>0?Math.min(h,m/w):1,T=.65+C.reduce((e,t)=>e+t/1e3,0),E=new OfflineAudioContext(1,Math.ceil(T*o),o),D=E.createGain();D.gain.value=ee,D.connect(E.destination);let O=u;return C.forEach((e,t)=>{let n=v[t];if(n.length){let e=E.createBuffer(1,n.length,l);e.getChannelData(0).set(n);let t=E.createBufferSource();t.buffer=e;let r=E.createGain(),i=n.length/l,a=Math.min(p,i/2);r.gain.setValueAtTime(0,O),r.gain.linearRampToValueAtTime(1,O+a),r.gain.setValueAtTime(1,O+i-a),r.gain.linearRampToValueAtTime(0,O+i),t.connect(r).connect(D),t.start(O)}O+=e/1e3}),{buffer:await E.startRendering(),timings:C,missing:x,...S?{firstMissingLine:S}:{}}}function v(e){let t=r();if(!t)return null;let{ctx:n,release:i}=t;if(typeof n.createMediaStreamDestination!=`function`)return i(),null;let a=n.createMediaStreamDestination(),o=n.createBufferSource();o.buffer=e,o.connect(a);let s=!1;return{stream:a.stream,start(){s||(s=!0,n.state!==`running`&&n.resume().catch(()=>{}),o.start())},stop(){try{o.stop()}catch{}try{o.disconnect()}catch{}i()}}}function y(e,t,n){return t+Math.max(0,n-e)}function b(e,t){return!Number.isFinite(t)||t<=0||e>=t?null:Math.max(0,e)}function x(e){let t=r();if(!t)return null;let{ctx:n,release:i}=t,a=n.createGain();a.connect(n.destination);let o=null,s=0,c=0,l=!1,u=()=>{try{o?.stop(),o?.disconnect()}catch{}o=null},d=t=>{u(),o=n.createBufferSource(),o.buffer=e,o.connect(a),o.start(0,t),s=t,c=n.currentTime,l=!1};return{play(){n.state!==`running`&&n.resume().catch(()=>{}),d(0)},setMuted(e){a.gain.value=+!e},pause(){l||!o||(s=Math.min(e.duration,y(c,s,n.currentTime)),u(),l=!0)},resume(){if(!l)return;l=!1;let t=b(s,e.duration);t!==null&&(n.state!==`running`&&n.resume().catch(()=>{}),d(t))},stop(){u();try{a.disconnect()}catch{}i()}}}var S=`opus`,C=[{container:`mp4`,mimeType:`video/mp4`,video:`av1`,audio:S},{container:`webm`,mimeType:`video/webm`,video:`vp9`,audio:S},{container:`webm`,mimeType:`video/webm`,video:`vp8`,audio:S}],w=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`];async function ee(e,t){if(t.audio&&!await e.canEncodeAudio(S,{numberOfChannels:t.audio.numberOfChannels,sampleRate:t.audio.sampleRate,bitrate:t.audioBitrate??192e3}).catch(()=>!1))return null;for(let n of C)if(await e.canEncodeVideo(n.video,{width:t.width,height:t.height,bitrate:t.videoBitrate}).catch(()=>!1))return n;return null}function T(){return typeof MediaRecorder>`u`||typeof MediaRecorder.isTypeSupported!=`function`?null:w.find(e=>MediaRecorder.isTypeSupported(e))??null}function E(e,{fps:t,capS:n}){let r=null,i=!0;return{realtime:!1,accepting:()=>i,async end(a){if(r===null||!i)return;let o=r;r=null;try{await e.add(o,Math.max(1/t,Math.min(a,n)-o))}catch{i=!1}},begin(e){i&&(r=e)},finish(){if(i){i=!1;try{e.close()}catch{}}}}}function D(){return{realtime:!0,accepting:()=>!0,async end(){},begin(){},finish(){}}}function O(e){let t=e.effect?.getComputedTiming();return t?.progress!==null&&t?.progress!==void 0}function k(e){let t=e.effect;return!t||!(`target`in t)?null:t.target}function te(e){let t=new WeakMap,n=[];return{refresh(r){n=e.getAnimations({subtree:!0}).map(e=>{if(!t.has(e)){t.set(e,r);try{e.pause()}catch{}}return{animation:e,target:k(e)}})},seek(e){for(let{animation:r}of n)try{r.currentTime=e-(t.get(r)??0)}catch{}},activeInside(e){return n.some(({animation:t,target:n})=>n!==null&&e.contains(n)&&O(t))},activeOutside(e){return n.some(({animation:t,target:n})=>!(e&&n&&e.contains(n))&&O(t))},release(){for(let{animation:e}of n)try{e.play()}catch{}n=[]}}}var A=201326592,j=864e5,M=256,N=32,P=/^mavea-video-(\d{13})-[a-z0-9]+[.](?:webm|mp4)$/,F=new WeakSet;async function I(e,t=Date.now()){let n=0,r=0;try{let i=e.entries();try{for(;n<M;){let a=await i.next();if(a.done)break;n+=1;let[o,s]=a.value;if(r>=N||s.kind!==`file`)continue;let c=P.exec(o);if(!c)continue;let l=Number(c[1]);if(!(!Number.isSafeInteger(l)||t-l<j))try{await e.removeEntry(o),r+=1}catch{}}}finally{await i.return?.()}}catch{}return r}function L(e){F.has(e)||(F.add(e),I(e))}async function R(e=`webm`){if(typeof navigator>`u`)return null;let t=navigator.storage;if(!t?.getDirectory)return null;try{let n=await t.getDirectory();L(n);let r=`mavea-video-${Date.now()}-${Math.random().toString(36).slice(2)}.${e}`,i=await n.getFileHandle(r,{create:!0});return{handle:i,name:r,root:n,writable:await i.createWritable()}}catch{return null}}async function ne(e,t=`webm`){let n=await R(t);return n?{target:new e(n.writable,{chunked:!0,chunkSize:4194304}),async finish(){return{blob:await n.handle.getFile(),dispose:()=>n.root.removeEntry(n.name).catch(()=>{})}},async discard(){await n.writable.abort().catch(()=>{}),await n.root.removeEntry(n.name).catch(()=>{})}}:null}async function re(){let e=await R();if(e){let t=!1,n=null,r=Promise.resolve();return{write(i){t||!i.size||(r=r.then(()=>e.writable.write(i)).catch(e=>{n=e instanceof Error?e:Error(`temporary-video-write-failed`)}))},async finish(){if(await r,n)throw n;return await e.writable.close(),{blob:await e.handle.getFile(),dispose:()=>e.root.removeEntry(e.name).catch(()=>{})}},async discard(){t=!0,await r.catch(()=>{}),await e.writable.abort().catch(()=>{}),await e.root.removeEntry(e.name).catch(()=>{})}}}let t=[],n=0,r=null,i=!1;return{write(e){if(!(i||!e.size||r)){if(n+=e.size,n>A){r=Error(`temporary-video-storage-unavailable`),t.length=0;return}t.push(e)}},async finish(){if(r)throw r;return{blob:new Blob(t,{type:`video/webm`})}},async discard(){i=!0,t.length=0}}}e();var z={balanced:{fps:15,bitrate:6e6},high:{fps:24,bitrate:7e6},ultra:{fps:24,bitrate:8e6}};function ie(e,t=i()){let n=z[e],r=t===`lite`?{fps:12,bitrate:6e6}:{fps:24,bitrate:8e6};return{fps:Math.min(n.fps,r.fps),bitrate:Math.min(n.bitrate,r.bitrate)}}function ae(e){let{fps:t,bitrate:n}=ie(e);return`up to ${t} fps · ${Math.round(n/1e6)} Mbps`}async function oe(){try{let{Output:e,Mp4OutputFormat:n,WebMOutputFormat:r,BufferTarget:i,StreamTarget:a,CanvasSource:o,AudioBufferSource:s,canEncodeVideo:c,canEncodeAudio:l}=await t(async()=>{let{Output:e,Mp4OutputFormat:t,WebMOutputFormat:n,BufferTarget:r,StreamTarget:i,CanvasSource:a,AudioBufferSource:o,canEncodeVideo:s,canEncodeAudio:c}=await import(`./src-DG1n-LFe.js`);return{Output:e,Mp4OutputFormat:t,WebMOutputFormat:n,BufferTarget:r,StreamTarget:i,CanvasSource:a,AudioBufferSource:o,canEncodeVideo:s,canEncodeAudio:c}},__vite__mapDeps([0,1,2]));return{Output:e,Mp4OutputFormat:n,WebMOutputFormat:r,BufferTarget:i,StreamTarget:a,CanvasSource:o,AudioBufferSource:s,canEncodeVideo:c,canEncodeAudio:l}}catch{return null}}async function se(){try{return await t(()=>import(`./dist-DRo0JOkC.js`),[])}catch{return null}}var ce={"9:16":{w:1080,h:1920},"1:1":{w:1080,h:1080},"16:9":{w:1920,h:1080}},le=12,B=400,ue=500;function de(e,t){let n=performance.now(),r=0,i=0,a=()=>{n=performance.now(),r++},o=new MutationObserver(e=>{n=performance.now();for(let n of e)t&&(n.target===t||t.contains(n.target))?i++:r++});return o.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),e.addEventListener(`load`,a,!0),e.addEventListener(`scroll`,a,!0),{still(){return performance.now()-n<B||typeof e.getAnimations!=`function`||e.querySelector(`canvas, video`)?!1:e.getAnimations({subtree:!0}).every(e=>e.playState!==`running`)},changes:()=>r,layerChanges:()=>i,hasLiveMedia:()=>!!e.querySelector(`canvas, video`),dispose(){o.disconnect(),e.removeEventListener(`load`,a,!0),e.removeEventListener(`scroll`,a,!0)}}}function V(){if(typeof document>`u`)return!1;let e=T()!==null,t=typeof VideoEncoder<`u`&&globalThis.AudioEncoder!==void 0;return e||t}async function H(e){let t=ie(e.quality??`high`),n=e.fps??t.fps,r=e.bitrate??t.bitrate,i=e.background??`#05070c`,{w:a,h:o}=e.dims??ce[e.aspect],s=e.maxDurationMs??1/0,c=s/1e3,l=await se();if(!l)throw Error(`rasterizer-unavailable`);let u=typeof VideoEncoder<`u`&&globalThis.AudioEncoder!==void 0?await oe():null,d=u?await ee(u,{width:a,height:o,videoBitrate:r,audio:e.audioBuffer}):null,f=!!(d&&u),p=!!e.cues&&Number.isFinite(s)&&f&&typeof e.el.getAnimations==`function`,m=e.el.clientWidth||a,h=Math.min(3,Math.max(1,a/m)),g=p&&e.liveLayer?e.el.querySelector(e.liveLayer.selector):null,_=g instanceof HTMLElement?g:null,y=_?e.liveLayer?.bleed??0:0,b=_?.getBoundingClientRect(),x=b?{w:Math.ceil(b.width+y*2),h:Math.ceil(b.height+y*2)}:null,S=_?document.createElement(`canvas`):null;S&&(S.width=a,S.height=o);let C=S?.getContext(`2d`,{alpha:!1})??null,w=!!(_&&x&&C),O,k=null;try{O=await l.createContext(e.el,{scale:h,backgroundColor:i,filter:w?e=>e!==_:void 0}),w&&_&&x&&(k=await l.createContext(_,{scale:h,backgroundColor:null,width:x.w,height:x.h,style:{padding:`${y}px`}}))}catch{throw Error(`rasterizer-unavailable`)}let A=_&&k&&S&&C?{el:_,context:k,canvas:S,ctx:C}:null,j=0,M=0,N=null,P=()=>{M++,M>=le&&!N&&(N=Error(`rasterizer-failed`))},F=de(e.el,A?.el??null),I=()=>{F.dispose(),l.destroyContext(O),k&&l.destroyContext(k)},L=document.createElement(`canvas`);L.width=a,L.height=o;let R=L.getContext(`2d`,{alpha:!1});R.fillStyle=i,R.fillRect(0,0,a,o);let z=document.createElement(`canvas`);z.width=Math.round(a/2),z.height=Math.round(o/2);let ae=z.getContext(`2d`),B=!1,V=()=>{ae&&(ae.drawImage(L,0,0,z.width,z.height),B=!0)},H=()=>new Blob([],{type:`image/png`}),fe=async()=>(!B&&j>0&&V(),B?await new Promise(e=>z.toBlob(e,`image/png`))??H():H()),U=async e=>{let t;try{t=await l.domToCanvas(e)}catch{return P(),null}return!t.width||!t.height?(P(),null):(M=0,t)},pe=0,me=()=>{if(j++,!e.onFrame)return;let t=performance.now();t-pe<ue||(pe=t,e.onFrame(L))},W={scale:1,offsetX:0,offsetY:0},he=(e,t)=>{let n=Math.max(a/t.width,o/t.height),r=t.width*n,s=t.height*n;W={scale:n,offsetX:(a-r)/2,offsetY:(o-s)/2},e.fillStyle=i,e.fillRect(0,0,a,o),e.drawImage(t,W.offsetX,W.offsetY,r,s)},ge=async()=>{let e=await U(O);return e?(he(R,e),me(),!0):!1},G={x:0,y:0,w:x?.w??0,h:x?.h??0},_e=()=>{if(!A)return;let t=e.el.getBoundingClientRect(),n=A.el.getBoundingClientRect();G={...G,x:n.left-t.left-y,y:n.top-t.top-y}};_e();let ve=async(e,t)=>{if(!A)return ge();let n=e?await U(O):null;if(e&&!n)return!1;let r=t?await U(A.context):null;if(t&&!r)return!1;n&&he(A.ctx,n);let i=W.scale*h,a=Math.round(W.offsetX+G.x*i),o=Math.round(W.offsetY+G.y*i),s=Math.round(G.w*i),c=Math.round(G.h*i);return n?R.drawImage(A.canvas,0,0):R.drawImage(A.canvas,a,o,s,c,a,o,s,c),r&&R.drawImage(r,a,o,s,c),me(),!0},K=0,ye=null,be=()=>ye===null?K:performance.now()-ye,q=!0,J=0,Y=e.cues??[],xe=async e=>{let t=!1;for(;J<Y.length&&Y[J].atMs<=e;)await Y[J].apply(),J++,t=!0;return t},Se=async t=>{let r=te(e.el),i=-1,a=-1,o=-1,s=!1,l=!1;try{for(let u=0;q&&t.accepting()&&!N;u++){let d=u/n;if(d>=c)break;let f=d*1e3;if(e.gate&&await e.gate(),!q)break;let p=await xe(f);p&&_e(),(p||F.changes()+F.layerChanges()!==i)&&(r.refresh(f),i=F.changes()+F.layerChanges()),r.seek(f);let m=F.changes(),h=F.layerChanges(),g=m!==a,_=h!==o,v=r.activeOutside(A?.el??null),y=A?r.activeInside(A.el):!1,b=F.hasLiveMedia(),x=u===0||g||v||s||b,S=!!A&&(x||_||y||l);if(s=v,l=y,x||S){await t.end(d);let e=A?await ve(x,S):await ge();if(!q||!t.accepting()||N)break;e&&(a=m,o=h),t.begin(d)}K=Math.min((u+1)/n,c)*1e3,!B&&d>1.2&&j>2&&M===0&&V(),await new Promise(e=>setTimeout(e,0))}}finally{r.release()}},Ce=async t=>{let r=performance.now();ye=r;let i=!0;for(;q&&t.accepting()&&!N;){let a=performance.now();if(e.gate&&await e.gate(),!q)break;if(await xe(performance.now()-r),i||!F.still()){if(await t.end((performance.now()-r)/1e3),await ge(),!q||!t.accepting()||N)break;t.begin(i?0:(performance.now()-r)/1e3),i=!1}let o=performance.now()-r;if(K=o,o>=s)break;!B&&o>1200&&j>2&&M===0&&V();let c=performance.now()-a;await new Promise(e=>setTimeout(e,Math.max(0,1e3/n-c)))}},we=e=>p&&!e.realtime?Se(e):Ce(e);if(d&&u){let t=await ne(u.StreamTarget,d.container),i=t?null:new u.BufferTarget,a=new u.Output({format:d.container===`mp4`?new u.Mp4OutputFormat:new u.WebMOutputFormat,target:t?.target??i}),o=new u.CanvasSource(L,{codec:d.video,bitrate:r});a.addVideoTrack(o);let s=null;if(e.audioBuffer){let t=new u.AudioBufferSource({codec:d.audio,bitrate:192e3});a.addAudioTrack(t);let n=e.audioBuffer;s=async()=>{try{await t.add(n),t.close()}catch{}}}await a.start(),s?.();let l=E(o,{fps:n,capS:c}),f=we(l);f.catch(()=>{});let p=()=>{q=!1,I(),L.width=L.height=0,z.width=z.height=0,A&&(A.canvas.width=A.canvas.height=0)};return{done:()=>f,async stop(){if(q=!1,N||j===0)throw a.cancel?.(),t?.discard(),p(),N??Error(`rasterizer-failed`);await l.end(be()/1e3);let n=await fe();l.finish(),await a.finalize();let r=t?await t.finish():null;return p(),{blob:r?.blob??new Blob([i?.buffer??new ArrayBuffer(0)],{type:d.mimeType}),type:d.mimeType,poster:n,hasAudio:!!e.audioBuffer,durationMs:Math.round(be()),dispose:r?.dispose}},cancel(){q=!1,a.cancel?.(),t?.discard(),p()}}}let Te=L.captureStream(n),Ee=new MediaStream(Te.getVideoTracks()),De=e.audioBuffer?v(e.audioBuffer):null,Oe=De?.stream.getAudioTracks()[0]??null;Oe&&Ee.addTrack(Oe);let ke=T();if(!ke)throw I(),L.width=L.height=0,z.width=z.height=0,Error(`open-codec-unavailable`);let X=new MediaRecorder(Ee,{mimeType:ke,videoBitsPerSecond:r}),Z=await re();X.ondataavailable=e=>Z.write(e.data);let Ae=new Promise(e=>{X.addEventListener(`stop`,()=>e(),{once:!0})}),Q=()=>{try{X.state!==`inactive`&&X.stop()}catch{}};X.start(1e3),De?.start();let je=we(D()).finally(()=>{(N||K>=s)&&Q()});je.catch(()=>{});let $=()=>{q=!1,I();for(let e of Ee.getTracks())e.stop();De?.stop(),L.width=L.height=0,z.width=z.height=0,A&&(A.canvas.width=A.canvas.height=0)};return{done:()=>je,async stop(){if(q=!1,N||j===0)throw Q(),Z.discard(),$(),N??Error(`rasterizer-failed`);let e=await fe();Q(),await Ae;try{let t=await Z.finish(),n=Math.round(be());return $(),{blob:t.blob,type:ke,poster:e,hasAudio:!!Oe,durationMs:n,dispose:t.dispose}}catch(e){throw await Z.discard(),$(),e}},cancel(){q=!1,Q(),Z.discard(),$()}}}export{T as a,g as c,H as i,c as l,V as n,x as o,ae as r,_ as s,ie as t};
|
|
2
|
+
import{n as e,t}from"./preload-helper-CiWYd9n-.js";import{F as n,N as r,f as i}from"./index-CdUH6Eo9.js";import{C as a,i as o,m as s}from"./kokoro-D15HDMcP.js";async function c(e,t,n){let r=Array(e.length),i=0,a=!1,o=async()=>{for(;!a;){let t=i++;if(t>=e.length)return;try{r[t]=await n(e[t],t)}catch(e){throw a=!0,e}}},s=Math.max(1,Math.min(t,e.length));return await Promise.all(Array.from({length:s},o)),r}var l=24e3,u=.15,d=.18,f=240,p=.008,m=.89,h=6;async function g(e,t){let n=a(e).trim().slice(0,f);if(!n)return new Float32Array;for(let e=0;e<2;e++)try{let e=await fetch(`/tts/v1/audio/speech`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:`kokoro`,input:n,voice:o(`mavea`),response_format:`pcm`,speed:1}),signal:t});if(e.ok)return s(new Uint8Array(await e.arrayBuffer()),null).samples}catch{if(t?.aborted)return new Float32Array}return new Float32Array}async function _(e,t,r){let i=e.slides,a=i.map(e=>Math.max(800,Math.round(e.durationMs))),o=n(),s=i.map(e=>e.voiceover.trim()),f=s.find(Boolean);if(o===null||typeof OfflineAudioContext>`u`)return{buffer:null,timings:a,missing:s.filter(Boolean).length,...f?{firstMissingLine:f}:{}};let _=0,v=await c(i,2,async e=>{let n=await g(e.voiceover,t);return r?.(++_,i.length),n}),y=s.filter(Boolean).length,b=v.filter(e=>e.length>0).length,x=Math.max(0,y-b),S=s.find((e,t)=>e&&v[t].length===0);if(b===0)return{buffer:null,timings:a,missing:x,...S?{firstMissingLine:S}:{}};let C=i.map((e,t)=>{let n=v[t].length/l*1e3;return Math.round(n>0?Math.max(a[t],n+d*1e3):a[t])}),w=0;for(let e of v)for(let t=0;t<e.length;t++)w=Math.max(w,Math.abs(e[t]));let ee=w>0?Math.min(h,m/w):1,T=.65+C.reduce((e,t)=>e+t/1e3,0),E=new OfflineAudioContext(1,Math.ceil(T*o),o),D=E.createGain();D.gain.value=ee,D.connect(E.destination);let O=u;return C.forEach((e,t)=>{let n=v[t];if(n.length){let e=E.createBuffer(1,n.length,l);e.getChannelData(0).set(n);let t=E.createBufferSource();t.buffer=e;let r=E.createGain(),i=n.length/l,a=Math.min(p,i/2);r.gain.setValueAtTime(0,O),r.gain.linearRampToValueAtTime(1,O+a),r.gain.setValueAtTime(1,O+i-a),r.gain.linearRampToValueAtTime(0,O+i),t.connect(r).connect(D),t.start(O)}O+=e/1e3}),{buffer:await E.startRendering(),timings:C,missing:x,...S?{firstMissingLine:S}:{}}}function v(e){let t=r();if(!t)return null;let{ctx:n,release:i}=t;if(typeof n.createMediaStreamDestination!=`function`)return i(),null;let a=n.createMediaStreamDestination(),o=n.createBufferSource();o.buffer=e,o.connect(a);let s=!1;return{stream:a.stream,start(){s||(s=!0,n.state!==`running`&&n.resume().catch(()=>{}),o.start())},stop(){try{o.stop()}catch{}try{o.disconnect()}catch{}i()}}}function y(e,t,n){return t+Math.max(0,n-e)}function b(e,t){return!Number.isFinite(t)||t<=0||e>=t?null:Math.max(0,e)}function x(e){let t=r();if(!t)return null;let{ctx:n,release:i}=t,a=n.createGain();a.connect(n.destination);let o=null,s=0,c=0,l=!1,u=()=>{try{o?.stop(),o?.disconnect()}catch{}o=null},d=t=>{u(),o=n.createBufferSource(),o.buffer=e,o.connect(a),o.start(0,t),s=t,c=n.currentTime,l=!1};return{play(){n.state!==`running`&&n.resume().catch(()=>{}),d(0)},setMuted(e){a.gain.value=+!e},pause(){l||!o||(s=Math.min(e.duration,y(c,s,n.currentTime)),u(),l=!0)},resume(){if(!l)return;l=!1;let t=b(s,e.duration);t!==null&&(n.state!==`running`&&n.resume().catch(()=>{}),d(t))},stop(){u();try{a.disconnect()}catch{}i()}}}var S=`opus`,C=[{container:`mp4`,mimeType:`video/mp4`,video:`av1`,audio:S},{container:`webm`,mimeType:`video/webm`,video:`vp9`,audio:S},{container:`webm`,mimeType:`video/webm`,video:`vp8`,audio:S}],w=[`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`];async function ee(e,t){if(t.audio&&!await e.canEncodeAudio(S,{numberOfChannels:t.audio.numberOfChannels,sampleRate:t.audio.sampleRate,bitrate:t.audioBitrate??192e3}).catch(()=>!1))return null;for(let n of C)if(await e.canEncodeVideo(n.video,{width:t.width,height:t.height,bitrate:t.videoBitrate}).catch(()=>!1))return n;return null}function T(){return typeof MediaRecorder>`u`||typeof MediaRecorder.isTypeSupported!=`function`?null:w.find(e=>MediaRecorder.isTypeSupported(e))??null}function E(e,{fps:t,capS:n}){let r=null,i=!0;return{realtime:!1,accepting:()=>i,async end(a){if(r===null||!i)return;let o=r;r=null;try{await e.add(o,Math.max(1/t,Math.min(a,n)-o))}catch{i=!1}},begin(e){i&&(r=e)},finish(){if(i){i=!1;try{e.close()}catch{}}}}}function D(){return{realtime:!0,accepting:()=>!0,async end(){},begin(){},finish(){}}}function O(e){let t=e.effect?.getComputedTiming();return t?.progress!==null&&t?.progress!==void 0}function k(e){let t=e.effect;return!t||!(`target`in t)?null:t.target}function te(e){let t=new WeakMap,n=[];return{refresh(r){n=e.getAnimations({subtree:!0}).map(e=>{if(!t.has(e)){t.set(e,r);try{e.pause()}catch{}}return{animation:e,target:k(e)}})},seek(e){for(let{animation:r}of n)try{r.currentTime=e-(t.get(r)??0)}catch{}},activeInside(e){return n.some(({animation:t,target:n})=>n!==null&&e.contains(n)&&O(t))},activeOutside(e){return n.some(({animation:t,target:n})=>!(e&&n&&e.contains(n))&&O(t))},release(){for(let{animation:e}of n)try{e.play()}catch{}n=[]}}}var A=201326592,j=864e5,M=256,N=32,P=/^mavea-video-(\d{13})-[a-z0-9]+[.](?:webm|mp4)$/,F=new WeakSet;async function I(e,t=Date.now()){let n=0,r=0;try{let i=e.entries();try{for(;n<M;){let a=await i.next();if(a.done)break;n+=1;let[o,s]=a.value;if(r>=N||s.kind!==`file`)continue;let c=P.exec(o);if(!c)continue;let l=Number(c[1]);if(!(!Number.isSafeInteger(l)||t-l<j))try{await e.removeEntry(o),r+=1}catch{}}}finally{await i.return?.()}}catch{}return r}function L(e){F.has(e)||(F.add(e),I(e))}async function R(e=`webm`){if(typeof navigator>`u`)return null;let t=navigator.storage;if(!t?.getDirectory)return null;try{let n=await t.getDirectory();L(n);let r=`mavea-video-${Date.now()}-${Math.random().toString(36).slice(2)}.${e}`,i=await n.getFileHandle(r,{create:!0});return{handle:i,name:r,root:n,writable:await i.createWritable()}}catch{return null}}async function ne(e,t=`webm`){let n=await R(t);return n?{target:new e(n.writable,{chunked:!0,chunkSize:4194304}),async finish(){return{blob:await n.handle.getFile(),dispose:()=>n.root.removeEntry(n.name).catch(()=>{})}},async discard(){await n.writable.abort().catch(()=>{}),await n.root.removeEntry(n.name).catch(()=>{})}}:null}async function re(){let e=await R();if(e){let t=!1,n=null,r=Promise.resolve();return{write(i){t||!i.size||(r=r.then(()=>e.writable.write(i)).catch(e=>{n=e instanceof Error?e:Error(`temporary-video-write-failed`)}))},async finish(){if(await r,n)throw n;return await e.writable.close(),{blob:await e.handle.getFile(),dispose:()=>e.root.removeEntry(e.name).catch(()=>{})}},async discard(){t=!0,await r.catch(()=>{}),await e.writable.abort().catch(()=>{}),await e.root.removeEntry(e.name).catch(()=>{})}}}let t=[],n=0,r=null,i=!1;return{write(e){if(!(i||!e.size||r)){if(n+=e.size,n>A){r=Error(`temporary-video-storage-unavailable`),t.length=0;return}t.push(e)}},async finish(){if(r)throw r;return{blob:new Blob(t,{type:`video/webm`})}},async discard(){i=!0,t.length=0}}}e();var z={balanced:{fps:15,bitrate:6e6},high:{fps:24,bitrate:7e6},ultra:{fps:24,bitrate:8e6}};function ie(e,t=i()){let n=z[e],r=t===`lite`?{fps:12,bitrate:6e6}:{fps:24,bitrate:8e6};return{fps:Math.min(n.fps,r.fps),bitrate:Math.min(n.bitrate,r.bitrate)}}function ae(e){let{fps:t,bitrate:n}=ie(e);return`up to ${t} fps · ${Math.round(n/1e6)} Mbps`}async function oe(){try{let{Output:e,Mp4OutputFormat:n,WebMOutputFormat:r,BufferTarget:i,StreamTarget:a,CanvasSource:o,AudioBufferSource:s,canEncodeVideo:c,canEncodeAudio:l}=await t(async()=>{let{Output:e,Mp4OutputFormat:t,WebMOutputFormat:n,BufferTarget:r,StreamTarget:i,CanvasSource:a,AudioBufferSource:o,canEncodeVideo:s,canEncodeAudio:c}=await import(`./src-DG1n-LFe.js`);return{Output:e,Mp4OutputFormat:t,WebMOutputFormat:n,BufferTarget:r,StreamTarget:i,CanvasSource:a,AudioBufferSource:o,canEncodeVideo:s,canEncodeAudio:c}},__vite__mapDeps([0,1,2]));return{Output:e,Mp4OutputFormat:n,WebMOutputFormat:r,BufferTarget:i,StreamTarget:a,CanvasSource:o,AudioBufferSource:s,canEncodeVideo:c,canEncodeAudio:l}}catch{return null}}async function se(){try{return await t(()=>import(`./dist-DRo0JOkC.js`),[])}catch{return null}}var ce={"9:16":{w:1080,h:1920},"1:1":{w:1080,h:1080},"16:9":{w:1920,h:1080}},le=12,B=400,ue=500;function de(e,t){let n=performance.now(),r=0,i=0,a=()=>{n=performance.now(),r++},o=new MutationObserver(e=>{n=performance.now();for(let n of e)t&&(n.target===t||t.contains(n.target))?i++:r++});return o.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),e.addEventListener(`load`,a,!0),e.addEventListener(`scroll`,a,!0),{still(){return performance.now()-n<B||typeof e.getAnimations!=`function`||e.querySelector(`canvas, video`)?!1:e.getAnimations({subtree:!0}).every(e=>e.playState!==`running`)},changes:()=>r,layerChanges:()=>i,hasLiveMedia:()=>!!e.querySelector(`canvas, video`),dispose(){o.disconnect(),e.removeEventListener(`load`,a,!0),e.removeEventListener(`scroll`,a,!0)}}}function V(){if(typeof document>`u`)return!1;let e=T()!==null,t=typeof VideoEncoder<`u`&&globalThis.AudioEncoder!==void 0;return e||t}async function H(e){let t=ie(e.quality??`high`),n=e.fps??t.fps,r=e.bitrate??t.bitrate,i=e.background??`#05070c`,{w:a,h:o}=e.dims??ce[e.aspect],s=e.maxDurationMs??1/0,c=s/1e3,l=await se();if(!l)throw Error(`rasterizer-unavailable`);let u=typeof VideoEncoder<`u`&&globalThis.AudioEncoder!==void 0?await oe():null,d=u?await ee(u,{width:a,height:o,videoBitrate:r,audio:e.audioBuffer}):null,f=!!(d&&u),p=!!e.cues&&Number.isFinite(s)&&f&&typeof e.el.getAnimations==`function`,m=e.el.clientWidth||a,h=Math.min(3,Math.max(1,a/m)),g=p&&e.liveLayer?e.el.querySelector(e.liveLayer.selector):null,_=g instanceof HTMLElement?g:null,y=_?e.liveLayer?.bleed??0:0,b=_?.getBoundingClientRect(),x=b?{w:Math.ceil(b.width+y*2),h:Math.ceil(b.height+y*2)}:null,S=_?document.createElement(`canvas`):null;S&&(S.width=a,S.height=o);let C=S?.getContext(`2d`,{alpha:!1})??null,w=!!(_&&x&&C),O,k=null;try{O=await l.createContext(e.el,{scale:h,backgroundColor:i,filter:w?e=>e!==_:void 0}),w&&_&&x&&(k=await l.createContext(_,{scale:h,backgroundColor:null,width:x.w,height:x.h,style:{padding:`${y}px`}}))}catch{throw Error(`rasterizer-unavailable`)}let A=_&&k&&S&&C?{el:_,context:k,canvas:S,ctx:C}:null,j=0,M=0,N=null,P=()=>{M++,M>=le&&!N&&(N=Error(`rasterizer-failed`))},F=de(e.el,A?.el??null),I=()=>{F.dispose(),l.destroyContext(O),k&&l.destroyContext(k)},L=document.createElement(`canvas`);L.width=a,L.height=o;let R=L.getContext(`2d`,{alpha:!1});R.fillStyle=i,R.fillRect(0,0,a,o);let z=document.createElement(`canvas`);z.width=Math.round(a/2),z.height=Math.round(o/2);let ae=z.getContext(`2d`),B=!1,V=()=>{ae&&(ae.drawImage(L,0,0,z.width,z.height),B=!0)},H=()=>new Blob([],{type:`image/png`}),fe=async()=>(!B&&j>0&&V(),B?await new Promise(e=>z.toBlob(e,`image/png`))??H():H()),U=async e=>{let t;try{t=await l.domToCanvas(e)}catch{return P(),null}return!t.width||!t.height?(P(),null):(M=0,t)},pe=0,me=()=>{if(j++,!e.onFrame)return;let t=performance.now();t-pe<ue||(pe=t,e.onFrame(L))},W={scale:1,offsetX:0,offsetY:0},he=(e,t)=>{let n=Math.max(a/t.width,o/t.height),r=t.width*n,s=t.height*n;W={scale:n,offsetX:(a-r)/2,offsetY:(o-s)/2},e.fillStyle=i,e.fillRect(0,0,a,o),e.drawImage(t,W.offsetX,W.offsetY,r,s)},ge=async()=>{let e=await U(O);return e?(he(R,e),me(),!0):!1},G={x:0,y:0,w:x?.w??0,h:x?.h??0},_e=()=>{if(!A)return;let t=e.el.getBoundingClientRect(),n=A.el.getBoundingClientRect();G={...G,x:n.left-t.left-y,y:n.top-t.top-y}};_e();let ve=async(e,t)=>{if(!A)return ge();let n=e?await U(O):null;if(e&&!n)return!1;let r=t?await U(A.context):null;if(t&&!r)return!1;n&&he(A.ctx,n);let i=W.scale*h,a=Math.round(W.offsetX+G.x*i),o=Math.round(W.offsetY+G.y*i),s=Math.round(G.w*i),c=Math.round(G.h*i);return n?R.drawImage(A.canvas,0,0):R.drawImage(A.canvas,a,o,s,c,a,o,s,c),r&&R.drawImage(r,a,o,s,c),me(),!0},K=0,ye=null,be=()=>ye===null?K:performance.now()-ye,q=!0,J=0,Y=e.cues??[],xe=async e=>{let t=!1;for(;J<Y.length&&Y[J].atMs<=e;)await Y[J].apply(),J++,t=!0;return t},Se=async t=>{let r=te(e.el),i=-1,a=-1,o=-1,s=!1,l=!1;try{for(let u=0;q&&t.accepting()&&!N;u++){let d=u/n;if(d>=c)break;let f=d*1e3;if(e.gate&&await e.gate(),!q)break;let p=await xe(f);p&&_e(),(p||F.changes()+F.layerChanges()!==i)&&(r.refresh(f),i=F.changes()+F.layerChanges()),r.seek(f);let m=F.changes(),h=F.layerChanges(),g=m!==a,_=h!==o,v=r.activeOutside(A?.el??null),y=A?r.activeInside(A.el):!1,b=F.hasLiveMedia(),x=u===0||g||v||s||b,S=!!A&&(x||_||y||l);if(s=v,l=y,x||S){await t.end(d);let e=A?await ve(x,S):await ge();if(!q||!t.accepting()||N)break;e&&(a=m,o=h),t.begin(d)}K=Math.min((u+1)/n,c)*1e3,!B&&d>1.2&&j>2&&M===0&&V(),await new Promise(e=>setTimeout(e,0))}}finally{r.release()}},Ce=async t=>{let r=performance.now();ye=r;let i=!0;for(;q&&t.accepting()&&!N;){let a=performance.now();if(e.gate&&await e.gate(),!q)break;if(await xe(performance.now()-r),i||!F.still()){if(await t.end((performance.now()-r)/1e3),await ge(),!q||!t.accepting()||N)break;t.begin(i?0:(performance.now()-r)/1e3),i=!1}let o=performance.now()-r;if(K=o,o>=s)break;!B&&o>1200&&j>2&&M===0&&V();let c=performance.now()-a;await new Promise(e=>setTimeout(e,Math.max(0,1e3/n-c)))}},we=e=>p&&!e.realtime?Se(e):Ce(e);if(d&&u){let t=await ne(u.StreamTarget,d.container),i=t?null:new u.BufferTarget,a=new u.Output({format:d.container===`mp4`?new u.Mp4OutputFormat:new u.WebMOutputFormat,target:t?.target??i}),o=new u.CanvasSource(L,{codec:d.video,bitrate:r});a.addVideoTrack(o);let s=null;if(e.audioBuffer){let t=new u.AudioBufferSource({codec:d.audio,bitrate:192e3});a.addAudioTrack(t);let n=e.audioBuffer;s=async()=>{try{await t.add(n),t.close()}catch{}}}await a.start(),s?.();let l=E(o,{fps:n,capS:c}),f=we(l);f.catch(()=>{});let p=()=>{q=!1,I(),L.width=L.height=0,z.width=z.height=0,A&&(A.canvas.width=A.canvas.height=0)};return{done:()=>f,async stop(){if(q=!1,N||j===0)throw a.cancel?.(),t?.discard(),p(),N??Error(`rasterizer-failed`);await l.end(be()/1e3);let n=await fe();l.finish(),await a.finalize();let r=t?await t.finish():null;return p(),{blob:r?.blob??new Blob([i?.buffer??new ArrayBuffer(0)],{type:d.mimeType}),type:d.mimeType,poster:n,hasAudio:!!e.audioBuffer,durationMs:Math.round(be()),dispose:r?.dispose}},cancel(){q=!1,a.cancel?.(),t?.discard(),p()}}}let Te=L.captureStream(n),Ee=new MediaStream(Te.getVideoTracks()),De=e.audioBuffer?v(e.audioBuffer):null,Oe=De?.stream.getAudioTracks()[0]??null;Oe&&Ee.addTrack(Oe);let ke=T();if(!ke)throw I(),L.width=L.height=0,z.width=z.height=0,Error(`open-codec-unavailable`);let X=new MediaRecorder(Ee,{mimeType:ke,videoBitsPerSecond:r}),Z=await re();X.ondataavailable=e=>Z.write(e.data);let Ae=new Promise(e=>{X.addEventListener(`stop`,()=>e(),{once:!0})}),Q=()=>{try{X.state!==`inactive`&&X.stop()}catch{}};X.start(1e3),De?.start();let je=we(D()).finally(()=>{(N||K>=s)&&Q()});je.catch(()=>{});let $=()=>{q=!1,I();for(let e of Ee.getTracks())e.stop();De?.stop(),L.width=L.height=0,z.width=z.height=0,A&&(A.canvas.width=A.canvas.height=0)};return{done:()=>je,async stop(){if(q=!1,N||j===0)throw Q(),Z.discard(),$(),N??Error(`rasterizer-failed`);let e=await fe();Q(),await Ae;try{let t=await Z.finish(),n=Math.round(be());return $(),{blob:t.blob,type:ke,poster:e,hasAudio:!!Oe,durationMs:n,dispose:t.dispose}}catch(e){throw await Z.discard(),$(),e}},cancel(){q=!1,Q(),Z.discard(),$()}}}export{T as a,g as c,H as i,c as l,V as n,x as o,ae as r,_ as s,ie as t};
|