@mavea/mavea 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/DISCLAIMER.md +2 -1
  3. package/PRIVACY.md +5 -4
  4. package/README.md +20 -15
  5. package/TERMS.md +3 -1
  6. package/dist/.vite/manifest.json +638 -569
  7. package/dist/assets/AnnotationLayer-qV6CIUZv.js +0 -0
  8. package/dist/assets/{AppCommandPalette-Dm3SedPO.js → AppCommandPalette-BHaYBZ5e.js} +1 -1
  9. package/dist/assets/AreaChart-DZGCSEwt.js +1 -0
  10. package/dist/assets/CadenceCard-P4teI7Se.js +1 -0
  11. package/dist/assets/CanvasSkeleton-CRGWlafo.js +1 -0
  12. package/dist/assets/{CheckLogRail-BU_rmAFH.js → CheckLogRail-DkHIHL0E.js} +1 -1
  13. package/dist/assets/{CommandPalette-E3reEqYR.js → CommandPalette-Bs6tpdZl.js} +1 -1
  14. package/dist/assets/{ConversationVideoStudio-DEZBpJUz.js → ConversationVideoStudio-C1sd4k53.js} +1 -1
  15. package/dist/assets/CourseLessonReader-YCcNKEW7.js +2 -0
  16. package/dist/assets/{CourseRail-C8MJG-zf.js → CourseRail-DXt3bzjU.js} +1 -1
  17. package/dist/assets/{CoursesApp-DFVkhP2f.js → CoursesApp-Dz6xjf4V.js} +2 -2
  18. package/dist/assets/{DashPresent-DwWDtjrU.js → DashPresent-5SRScC2i.js} +1 -1
  19. package/dist/assets/DashboardDetail-8J8TsdQg.css +1 -0
  20. package/dist/assets/DashboardDetail-DOfm8UCQ.js +2 -0
  21. package/dist/assets/DashboardLoopGate-Cf0y_HQ7.js +2 -0
  22. package/dist/assets/DashboardLoopRuntime-CnN5VayH.js +1 -0
  23. package/dist/assets/DashboardSettings-CE0B2y2y.js +1 -0
  24. package/dist/assets/DashboardsApp-_gbfdbX6.js +2 -0
  25. package/dist/assets/{DeepZoomApp-CxdcUeFJ.js → DeepZoomApp-BOLEl-kQ.js} +1 -1
  26. package/dist/assets/{DelegatePanel-B0kIu8Et.js → DelegatePanel-CHEB-OZl.js} +1 -1
  27. package/dist/assets/{DemoGallery-B__X0_H3.js → DemoGallery-DBqnu8TR.js} +1 -1
  28. package/dist/assets/{DropSelect-C3uYlej-.js → DropSelect-DjbdVfIR.js} +1 -1
  29. package/dist/assets/{ExportModal-CDGlhpdH.js → ExportModal-CLobMv1F.js} +1 -1
  30. package/dist/assets/{ExtractionPreview-CloJnrQi.js → ExtractionPreview-QZ2VHmsb.js} +2 -2
  31. package/dist/assets/{FeatureUseNotice-CwHstxBh.js → FeatureUseNotice-Dc8joBGM.js} +1 -1
  32. package/dist/assets/{FlagshipCommandPalette-CHsD5BSH.js → FlagshipCommandPalette-DnWuBjYI.js} +1 -1
  33. package/dist/assets/{FlagshipShowcase-D53Q_4m0.js → FlagshipShowcase-3qQDOK6g.js} +1 -1
  34. package/dist/assets/{FlashcardsApp-CnLfEnDH.js → FlashcardsApp-BQGM-Tr1.js} +1 -1
  35. package/dist/assets/{GalleryApp-2Ffc6CY6.js → GalleryApp-BWQ-J450.js} +1 -1
  36. package/dist/assets/{HonestByDesign-5jIu2ZC8.js → HonestByDesign-57LDf-gm.js} +1 -1
  37. package/dist/assets/{HowItWorks-BiJF84EM.js → HowItWorks-DMfPX3GK.js} +1 -1
  38. package/dist/assets/{LegalApp-zC-rvTww.js → LegalApp-CcO5Qq6R.js} +1 -1
  39. package/dist/assets/{LegalMarkdownDocument-CJ-gRHdX.js → LegalMarkdownDocument-Be_fQbZ_.js} +1 -1
  40. package/dist/assets/{LegalPageShell-Dyd4Uh3r.js → LegalPageShell-B-HY1WG7.js} +1 -1
  41. package/dist/assets/{LibraryOverlay-_xpWdhLN.js → LibraryOverlay-BilW6q_z.js} +1 -1
  42. package/dist/assets/LiveApp-C-OPBybd.css +1 -0
  43. package/dist/assets/LiveApp-DH3OxJFV.js +79 -0
  44. package/dist/assets/{LiveSettings-BceODlOb.js → LiveSettings-CuVMy7rZ.js} +3 -3
  45. package/dist/assets/{MindMapViewerDrawer-BuDodC0s.js → MindMapViewerDrawer-DI_S7fRZ.js} +1 -1
  46. package/dist/assets/{MindShape-CBcCC7hP.js → MindShape-C_Bo9hW9.js} +1 -1
  47. package/dist/assets/{PinToDashboard-DBIXvhlF.js → PinToDashboard-Cz5UJCmq.js} +1 -1
  48. package/dist/assets/PlanReview-CmUxzNqL.js +1 -0
  49. package/dist/assets/{Presence-CKSoyuhE.js → Presence-UqXfH4Y-.js} +1 -1
  50. package/dist/assets/{PresentationDeck-C518t9pP.js → PresentationDeck-B_EI33Pp.js} +1 -1
  51. package/dist/assets/{PrismApp-DRLl8841.js → PrismApp-DtLsPiQF.js} +2 -2
  52. package/dist/assets/{PrismAskController-QRwxRP8D.js → PrismAskController-Bt0k9hAA.js} +1 -1
  53. package/dist/assets/{PrismBriefingPlayer-Kyb8Vs_w.js → PrismBriefingPlayer-DzdtnFj4.js} +2 -2
  54. package/dist/assets/{PrismOverlay-Bj7tCu5Q.js → PrismOverlay-D1cDZamt.js} +3 -3
  55. package/dist/assets/{PrismWorkbench-BCnhkp-S.js → PrismWorkbench-BEIp4MiL.js} +1 -1
  56. package/dist/assets/{PrivacyApp-DHSRr8wq.js → PrivacyApp-B4DT2RUz.js} +6 -5
  57. package/dist/assets/{ReplayCard-CKo5reXy.js → ReplayCard-Dx46HCBT.js} +2 -2
  58. package/dist/assets/{ReplayOverlay-DqAwLshS.js → ReplayOverlay-CnJAxf0u.js} +1 -1
  59. package/dist/assets/{RewindOverlay-CkJIETE0.js → RewindOverlay-CousnxXo.js} +1 -1
  60. package/dist/assets/{RippleApp-C76VTaZK.js → RippleApp-D5j2VCt2.js} +2 -2
  61. package/dist/assets/{RippleAskController-CdlMlRH8.js → RippleAskController-9SxpZnHX.js} +1 -1
  62. package/dist/assets/{RippleOverlay-Mvz3CXhD.js → RippleOverlay-zcXAHPuJ.js} +2 -2
  63. package/dist/assets/{SeeDontRead-BkySmnP3.js → SeeDontRead-Dqfzha0V.js} +1 -1
  64. package/dist/assets/{ShareModal-Cl3ryjgK.js → ShareModal-DWxlrJSz.js} +2 -2
  65. package/dist/assets/{ShipCourse-Cy5ldKLE.js → ShipCourse-BavQppkt.js} +1 -1
  66. package/dist/assets/{SignatureLoop-Cdkifjb8.js → SignatureLoop-L8W2h62w.js} +1 -1
  67. package/dist/assets/{SynthesisApp-C5udWwng.js → SynthesisApp-C2O6pFeM.js} +2 -2
  68. package/dist/assets/{SynthesisOverlay-1o-CJsyX.js → SynthesisOverlay-DLvwiSMv.js} +1 -1
  69. package/dist/assets/{TermsApp-DIAESAZs.js → TermsApp-CxY1yorm.js} +4 -2
  70. package/dist/assets/TopicCanvas-LMI0zC7R.js +2 -0
  71. package/dist/assets/{TourPrism-Bxp--s0i.js → TourPrism-CI-iJZil.js} +1 -1
  72. package/dist/assets/TrackerTile-oz6IoG8m.js +2 -0
  73. package/dist/assets/{TwoSurfaces-C_0XBpwA.js → TwoSurfaces-Rnf-_WgY.js} +1 -1
  74. package/dist/assets/{WhyMachineOverlay-QDSZx5Y7.js → WhyMachineOverlay-ks9-rRiL.js} +1 -1
  75. package/dist/assets/WorldOverlay-BaQNNClA.js +2 -0
  76. package/dist/assets/{WorldOverlay-DRdBQMnb.css → WorldOverlay-D7ay5y4D.css} +1 -1
  77. package/dist/assets/{WowFeatures-DNEeO2pr.js → WowFeatures-C4efSbNV.js} +1 -1
  78. package/dist/assets/{ZoomDeck-qdlPe_yl.js → ZoomDeck-CBrr0yfy.js} +1 -1
  79. package/dist/assets/{annotationAuto-BmKrZ3hU.js → annotationAuto-CDv6Es44.js} +1 -1
  80. package/dist/assets/{backup-PaRBwjJy.js → backup-ZrlVatXc.js} +1 -1
  81. package/dist/assets/canvas-Bsx3eSaS.js +1 -0
  82. package/dist/assets/{capture-CL9ENM-c.js → capture-D8uPIcfj.js} +1 -1
  83. package/dist/assets/confirmAdd-DzMO9jKV.js +1 -0
  84. package/dist/assets/{coreIcons-BzqW7Qiz.js → coreIcons-DDTChE1H.js} +1 -1
  85. package/dist/assets/{dashboardEvents-D-wLCp1A.js → dashboardEvents-DKl5rrTD.js} +1 -1
  86. package/dist/assets/{dashboards-CdzGklae.css → dashboards-C1u2ks-d.css} +1 -1
  87. package/dist/assets/dataPending-DGdCvY5Y.js +1 -0
  88. package/dist/assets/display-CAb_PiGv.js +1 -0
  89. package/dist/assets/{engine-2U7mvPIl.js → engine-BiM6INsW.js} +1 -1
  90. package/dist/assets/{engine-BF8FqSbi.css → engine-CTvOaA86.css} +1 -1
  91. package/dist/assets/{explode-qQ7Fzt6V.js → explode-BgZIWY9m.js} +1 -1
  92. package/dist/assets/format-g3dP8OI3.js +1 -0
  93. package/dist/assets/{generate-C9vOL1C2.js → generate-Dl2EJ_SR.js} +1 -1
  94. package/dist/assets/{generateBeats-DpDpBcgV.js → generateBeats-DZHkvFvh.js} +1 -1
  95. package/dist/assets/{generateCourse-DU281tDE.js → generateCourse-C9qvaJRo.js} +1 -1
  96. package/dist/assets/{generateLive-_x2tWkBH.js → generateLive-B6purd69.js} +13 -13
  97. package/dist/assets/index-Dk0QapqQ.js +22 -0
  98. package/dist/assets/{index-D4FIsool.css → index-DmKgC_TJ.css} +1 -1
  99. package/dist/assets/{kokoro-CdL8Kl48.js → kokoro-P_fkcX-A.js} +1 -1
  100. package/dist/assets/lens-ChFJD9il.js +1 -0
  101. package/dist/assets/loader-DKJEcbPm.js +2 -0
  102. package/dist/assets/{model-DxwoIVpo.js → model-BFRTN9Eh.js} +1 -1
  103. package/dist/assets/{notes-CUeZ1cYu.js → notes-B0-EE0FK.js} +1 -1
  104. package/dist/assets/{number-Bmf7DqLj.js → number-zqlPMliA.js} +1 -1
  105. package/dist/assets/{pen-BAEq0JnM.js → pen-DNMslo3e.js} +1 -1
  106. package/dist/assets/{perfProbe-3Ip5n0yx.js → perfProbe-B9zJpjo9.js} +1 -1
  107. package/dist/assets/{pin-BwWjjqmt.js → pin-CZAIlpXt.js} +1 -1
  108. package/dist/assets/{planTracker-BI9z_0gW.js → planTracker-KKAtTBWs.js} +1 -1
  109. package/dist/assets/{portal-BJzn-Tgn.js → portal-Dogggsub.js} +1 -1
  110. package/dist/assets/{prewarm-CheeUP2L.js → prewarm-B4ELBOxf.js} +1 -1
  111. package/dist/assets/{providers-B2OCzEo1.js → providers-BovElgRL.js} +1 -1
  112. package/dist/assets/{quietHours-DCMczU9R.js → quietHours-CeBje_uU.js} +1 -1
  113. package/dist/assets/{ready-DZY1bETr.js → ready-jtAUOb62.js} +1 -1
  114. package/dist/assets/receipts-D7zveV-I.js +1 -0
  115. package/dist/assets/registry-6DGRAB1m.js +1 -0
  116. package/dist/assets/{registry-BRbEINOV.js → registry-6MOD-I7p.js} +1 -1
  117. package/dist/assets/registry-BFrgx1tE.js +1 -0
  118. package/dist/assets/{registry-BM9FDQxO.js → registry-CD1s3eQ-.js} +1 -1
  119. package/dist/assets/{registry-ChQGee7C.js → registry-CqhpLHM7.js} +1 -1
  120. package/dist/assets/registry-Cse2wF7x.css +1 -0
  121. package/dist/assets/registry-DGNSqTxE.js +1 -0
  122. package/dist/assets/{registry-D_4_HlMg.js → registry-GeAC3ZD7.js} +1 -1
  123. package/dist/assets/{relate-BXcg3Ioz.js → relate-BYdM5eiV.js} +1 -1
  124. package/dist/assets/{replay-rSsGKjEc.js → replay-TYXO0Brm.js} +1 -1
  125. package/dist/assets/{run-ndUTOxjM.js → run-Df10YPyB.js} +1 -1
  126. package/dist/assets/{run-CkaYNX89.js → run-DlvA3l28.js} +1 -1
  127. package/dist/assets/{run-aj7robML.js → run-gmqUaxcL.js} +1 -1
  128. package/dist/assets/seed-D_P5jyog.js +1 -0
  129. package/dist/assets/shapes-Cx5SCKgj.js +39 -0
  130. package/dist/assets/store-CsjDEADX.js +1 -0
  131. package/dist/assets/tiles-D-s6v-mA.js +1 -0
  132. package/dist/assets/types-DuEbJpIA.js +1 -0
  133. package/dist/assets/useDashboardLoop-DDqCFJKY.js +5 -0
  134. package/dist/assets/{useDashboards-GafZIADI.js → useDashboards-SRk8LqHe.js} +1 -1
  135. package/dist/assets/{useLiveConfig-DWz7BRdk.js → useLiveConfig-Cpy0_E_-.js} +1 -1
  136. package/dist/assets/{useStudy-CFIuakaM.js → useStudy-GwNcQWtv.js} +1 -1
  137. package/dist/assets/validate-sGUCmPAs.js +4 -0
  138. package/dist/assets/value-Dx7DZob4.js +1 -0
  139. package/dist/assets/{walkSync-AAocUygp.js → walkSync-CPsd-xu7.js} +1 -1
  140. package/dist/index.html +3 -3
  141. package/dist/legal/DISCLAIMER.md +2 -1
  142. package/dist/legal/PRIVACY.md +5 -4
  143. package/dist/legal/TERMS.md +3 -1
  144. package/docs/media/course-lesson.jpg +0 -0
  145. package/docs/media/living-answer.jpg +0 -0
  146. package/package.json +3 -1
  147. package/dist/assets/AnnotationLayer-IiuYsoSa.js +0 -0
  148. package/dist/assets/CanvasSkeleton-CcHXJqdq.js +0 -2
  149. package/dist/assets/CourseLessonReader-Bpt-DkJo.js +0 -2
  150. package/dist/assets/DashboardDetail-D4wkiTux.js +0 -2
  151. package/dist/assets/DashboardLoopGate-B5UBPsvU.js +0 -2
  152. package/dist/assets/DashboardLoopRuntime-CAnZX234.js +0 -1
  153. package/dist/assets/DashboardSettings-eMhHliVh.js +0 -1
  154. package/dist/assets/DashboardsApp-BwFtTdWa.js +0 -2
  155. package/dist/assets/LiveApp-BNae3fDZ.css +0 -1
  156. package/dist/assets/LiveApp-DjcJQURO.js +0 -78
  157. package/dist/assets/PlanReview-DUQ7OMvV.js +0 -1
  158. package/dist/assets/TopicCanvas-DkzJORfl.js +0 -2
  159. package/dist/assets/TrackerTile-CyPD0A6b.js +0 -2
  160. package/dist/assets/WorldOverlay-DorHCLzw.js +0 -1
  161. package/dist/assets/canvas-BlkTFnVo.js +0 -1
  162. package/dist/assets/confirmAdd-CZPBG1xe.js +0 -1
  163. package/dist/assets/dataPending-lZUzUEo6.js +0 -1
  164. package/dist/assets/display-BrieMea1.js +0 -1
  165. package/dist/assets/format-rPI6ZwwH.js +0 -1
  166. package/dist/assets/index-CfcUMOBf.js +0 -22
  167. package/dist/assets/receipts-ClyzFFGD.js +0 -1
  168. package/dist/assets/registry-9QjeHgKs.js +0 -1
  169. package/dist/assets/registry-D4Xdd7dO.js +0 -1
  170. package/dist/assets/registry-DScSjt8p.css +0 -1
  171. package/dist/assets/registry-DuP_q42N.js +0 -1
  172. package/dist/assets/seed-DN4mRJp-.js +0 -1
  173. package/dist/assets/shapes-C5fjibEc.js +0 -42
  174. package/dist/assets/store-B39HvB_l.js +0 -1
  175. package/dist/assets/tiles-pdNi6MGe.js +0 -1
  176. package/dist/assets/useDashboardLoop-B_YA5jLs.js +0 -5
  177. package/dist/assets/validate-CnG23_8J.js +0 -1
@@ -1 +0,0 @@
1
- var e=`sample timeline`;function t(t,n,r){let i=e=>n===`%`?`${e}%`:`${e} ${n}`;return r.map(([n,r])=>({t:n,value:r,receipt:{quote:`${t} in ${n} measured ${i(r)}.`,host:e}}))}var n={quote:`Rising defaults hollowed out the pools behind the bonds.`,host:e},r={quote:`Each surprise writedown made every rival look suspect.`,host:e},i={title:`Why did the 2008 financial crisis happen?`,outcomeId:`credit-crisis`,provenance:{illustrative:!0,notes:[`Illustrative example — the classic 2008 causal web, not your data.`]},nodes:[{id:`cheap-mortgages`,label:`Cheap credit after 2001`,role:`root`,domain:`policy`,depth:0,tier:`T2`,date:{t:`2001`,until:`2004`},detail:`Policy rates near 1% through 2004 pushed lenders and investors toward yield.`,receipt:{quote:`Policy rates were held near 1 percent into 2004.`,host:e}},{id:`lending-standards`,label:`Lending standards loosened`,role:`root`,domain:`policy`,depth:0,tier:`T2`,date:{t:`2003`,until:`2006`},detail:`Low-doc and no-doc loans normalized as origination fees rewarded volume.`,receipt:{quote:`Documentation requirements fell steadily from 2003.`,host:e}},{id:`housing-boom`,label:`Housing boom`,role:`mechanism`,domain:`economy`,depth:1,tier:`T2`,date:{t:`2003`,until:`2006`},receipt:{quote:`Housing starts ran well above trend through 2005.`,host:e}},{id:`mortgage-volume`,label:`Mortgage volume surged`,role:`mechanism`,domain:`economy`,depth:1,tier:`T2`,unit:`$bn`,receipt:{quote:`Originations peaked near 3,100 billion dollars.`,host:e},series:{tier:`T2`,unit:`$bn`,receipt:{quote:`Annual originations, 2003-2009.`,host:e},points:t(`Originations`,`$bn`,[[`2003`,3800],[`2004`,2900],[`2005`,3100],[`2006`,3e3],[`2007`,2400],[`2008`,1500],[`2009`,1800]])},children:[{id:`mortgage-volume.prime`,label:`Prime`,role:`mechanism`,depth:1,tier:`T2`,value:1900,unit:`$bn`,receipt:{quote:`Prime loans made up about 1,900 of originations.`,host:e}},{id:`mortgage-volume.alt-a`,label:`Alt-A`,role:`mechanism`,depth:1,tier:`T2`,value:400,unit:`$bn`,receipt:{quote:`Alt-A lending reached roughly 400 billion.`,host:e}},{id:`mortgage-volume.subprime`,label:`Subprime`,role:`mechanism`,depth:1,tier:`T2`,value:600,unit:`$bn`,receipt:{quote:`Subprime originations touched 600 billion at the peak.`,host:e}},{id:`mortgage-volume.arm`,label:`Adjustable-rate`,role:`mechanism`,depth:1,tier:`T2`,value:100,unit:`$bn`,receipt:{quote:`Exotic adjustable-rate products added another 100.`,host:e}}]},{id:`home-prices`,label:`Home prices climbed, then fell`,role:`mechanism`,domain:`economy`,depth:2,tier:`T2`,receipt:{quote:`National prices rose two-thirds, then gave most of it back.`,host:e},series:{tier:`T2`,unit:`index`,receipt:{quote:`National house-price index, 2003-2009.`,host:e},points:t(`The national house-price index`,`index`,[[`2003`,100],[`2004`,127],[`2005`,152],[`2006`,168],[`2007`,160],[`2008`,132],[`2009`,115]])}},{id:`mbs-cdo-exposure`,label:`MBS / CDO exposure spread`,role:`mechanism`,domain:`economy`,depth:2,tier:`T2`,date:{t:`2004`,until:`2007`},detail:`Securitization moved mortgage risk onto bank and fund balance sheets worldwide.`,receipt:{quote:`Structured mortgage products spread across balance sheets.`,host:e}},{id:`defaults`,label:`Mortgage defaults rose`,role:`mechanism`,domain:`society`,depth:3,tier:`T2`,value:10.1,unit:`%`,receipt:{quote:`Delinquencies reached 10.1 percent by 2009.`,host:e},series:{tier:`T2`,unit:`%`,receipt:{quote:`Mortgage delinquency rate, 2003-2009.`,host:e},points:t(`The delinquency rate`,`%`,[[`2003`,4.5],[`2004`,4.3],[`2005`,4.6],[`2006`,5],[`2007`,6.3],[`2008`,8.9],[`2009`,10.1]])}},{id:`asset-values`,label:`MBS asset values`,role:`mechanism`,domain:`economy`,depth:4,tier:`T2`,date:{t:`2007`,until:`2008`},receipt:{quote:`Senior tranches once rated AAA traded at deep discounts.`,host:e}},{id:`bank-losses`,label:`Bank losses and writedowns`,role:`mechanism`,domain:`economy`,depth:4,tier:`T2`,receipt:{quote:`Writedowns climbed into the hundreds of billions.`,host:e},series:{tier:`T2`,unit:`$bn`,receipt:{quote:`Annual bank writedowns, 2003-2009.`,host:e},points:t(`Writedowns`,`$bn`,[[`2003`,2],[`2004`,3],[`2005`,4],[`2006`,12],[`2007`,160],[`2008`,490],[`2009`,280]])}},{id:`panic`,label:`Counterparty panic`,role:`mechanism`,domain:`society`,depth:5,tier:`T2`,date:{t:`2008-09`},detail:`Nobody could tell who held the losses, so everyone stopped trusting everyone.`,receipt:{quote:`After Lehman failed, counterparty trust evaporated.`,host:e}},{id:`liquidity`,label:`Interbank liquidity`,role:`mechanism`,domain:`economy`,depth:5,tier:`T2`,receipt:{quote:`Interbank lending spreads spiked to records.`,host:e},series:{tier:`T2`,unit:`bps`,receipt:{quote:`Interbank spread, annual average, 2003-2009.`,host:e},points:t(`The interbank spread`,`bps`,[[`2003`,30],[`2004`,28],[`2005`,35],[`2006`,40],[`2007`,110],[`2008`,160],[`2009`,65]])}},{id:`credit-crisis`,label:`Credit crisis`,role:`outcome`,domain:`economy`,depth:6,tier:`T2`,date:{t:`2008`,until:`2009`},value:4.3,unit:`%`,receipt:{quote:`Output fell 4.3 percent from peak to trough.`,host:e}}],edges:[{from:`cheap-mortgages`,to:`housing-boom`,verb:`fueled`,relation:`causes`,weight:.55,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Cheap financing pulled buyers forward into the boom.`,host:e}},{from:`cheap-mortgages`,to:`mortgage-volume`,verb:`expanded`,relation:`contributes`,weight:.35,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Low rates made ever-larger loans serviceable.`,host:e}},{from:`lending-standards`,to:`mortgage-volume`,verb:`opened`,relation:`enables`,weight:.5,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Looser underwriting admitted borrowers once turned away.`,host:e}},{from:`housing-boom`,to:`home-prices`,verb:`lifted`,relation:`causes`,weight:.7,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Demand outran supply and prices followed.`,host:e}},{from:`mortgage-volume`,to:`mbs-cdo-exposure`,verb:`fed`,relation:`causes`,weight:.8,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Nearly every new loan was pooled and resold.`,host:e}},{from:`home-prices`,to:`defaults`,verb:`suppressed`,relation:`dampens`,weight:.4,sign:-1,tier:`T2`,status:`supported`,receipt:{quote:`Rising prices let stressed borrowers refinance or sell.`,host:e}},{from:`mortgage-volume`,to:`defaults`,verb:`seeded`,relation:`contributes`,weight:.5,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`The marginal loan was the first to sour.`,host:e}},{from:`defaults`,to:`asset-values`,verb:`crushed`,relation:`dampens`,weight:.65,sign:-1,tier:`T2`,status:`supported`,receipt:n,receipts:[n,{quote:`Tranche models had assumed defaults could not cluster.`,host:e}]},{from:`asset-values`,to:`bank-losses`,verb:`cushioned`,relation:`dampens`,weight:.6,sign:-1,tier:`T2`,status:`supported`,receipt:{quote:`While marks held up, balance sheets looked whole.`,host:e}},{from:`mbs-cdo-exposure`,to:`bank-losses`,verb:`transmitted`,relation:`contributes`,weight:.5,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`The bigger the book of structured paper, the bigger the hit.`,host:e}},{from:`bank-losses`,to:`panic`,verb:`ignited`,relation:`causes`,weight:.7,sign:1,tier:`T2`,status:`supported`,receipt:r,receipts:[r,{quote:`Money funds broke the buck and the run went wholesale.`,host:e}]},{from:`panic`,to:`liquidity`,verb:`froze`,relation:`dampens`,weight:.6,sign:-1,tier:`T2`,status:`supported`,receipt:{quote:`Banks hoarded cash rather than lend to each other.`,host:e}},{from:`liquidity`,to:`credit-crisis`,verb:`restrained`,relation:`dampens`,weight:.3,sign:-1,tier:`T2`,status:`supported`,receipt:{quote:`While money still moved, the real economy held on.`,host:e}},{from:`bank-losses`,to:`credit-crisis`,verb:`drove`,relation:`contributes`,weight:.45,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Capital-starved banks pulled credit from firms and households.`,host:e}},{from:`panic`,to:`credit-crisis`,verb:`deepened`,relation:`contributes`,weight:.35,sign:1,tier:`T2`,status:`supported`,receipt:{quote:`Fear finished what the losses started.`,host:e}}]};export{i as WORLD_SEED};
@@ -1,42 +0,0 @@
1
- import{s as e}from"./spokenText-C88IQJ0M.js";import{d as t,h as n,v as r,y as i}from"./attachments-BW-vki-E.js";import{t as a}from"./providers-B2OCzEo1.js";import{n as o}from"./speed-K5_Ebj-8.js";import{i as s,n as c,r as l,t as u}from"./cache-CvbSI-pr.js";import{t as d}from"./number-Bmf7DqLj.js";import{a as f,i as p,o as m,r as h}from"./validate-CnG23_8J.js";import{a as ee,c as g,i as te,l as ne,n as _,o as v,r as y,s as b}from"./officeDoc-GU6Cssjf.js";import{n as re,r as x,t as S}from"./csv-DAqzYXUs.js";import"./search-ZN7v_P5B.js";var C=null,w=!1,T=!1,E=0,D=new Map;function O(){if(!(C||T)){if(typeof Worker>`u`){T=!0;return}try{C=new Worker(new URL(`/assets/worker-D7eK-Ya8.js`,``+import.meta.url),{type:`module`}),C.onmessage=e=>{let t=e.data;if(t.type===`ready`)w=!0;else if(t.type===`error`)T=!0,k();else if(t.type===`result`){let e=D.get(t.id);D.delete(t.id),e?.kind===`fit`&&e.resolve(t.fits)}else if(t.type===`embedded`){let e=D.get(t.id);D.delete(t.id),e?.kind===`embed`&&e.resolve(t.vec.length?t.vec:null)}},C.onerror=()=>{T=!0,k()},C.postMessage({type:`init`,base:se,modelId:oe})}catch{T=!0}}}function k(){for(let e of D.values())e.resolve(null);D.clear();try{C?.terminate()}catch{}C=null,w=!1}function ie(e,t=80){if(O(),!w||!C)return Promise.resolve(null);let n=++E;return new Promise(r=>{let i=setTimeout(()=>{D.delete(n),r(null)},t);D.set(n,{kind:`fit`,resolve:e=>{clearTimeout(i),r(e?new Map(e):null)}}),C.postMessage({type:`fit`,id:n,query:e})})}function ae(e,t=80){if(O(),!w||!C)return Promise.resolve(null);let n=++E;return new Promise(r=>{let i=setTimeout(()=>{D.delete(n),r(null)},t);D.set(n,{kind:`embed`,resolve:e=>{clearTimeout(i),r(e)}}),C.postMessage({type:`embed`,id:n,text:e})})}var oe=`minishlab/potion-base-8M`,se=`/semantic/`,ce=/\b(poems?|haikus?|limericks?|sonnets?|ballads?|rhymes?|riddles?|puns?|jokes?|knock[- ]?knock|tongue[- ]?twisters?|lullab(?:y|ies)|raps?)\b/i,le=/\b(write|compose|make(?:\s+me|\s+up)?|tell(?:\s+me)?\s+(?:a|an)|sing|invent|create|generate|come up with)\b[^.?!]{0,40}\b(story|stories|song|lyrics?|tale|fable|fiction|script|screenplay|verse|jingle)\b/i;function ue(e){let t=e.toLowerCase();return ce.test(t)||le.test(t)}var de=e=>!ue(e),A=`HARD HONESTY RULES:
2
- - A node "value", a series point, or an edge "weight" (a 0..1 share of the outcome it explains) may ONLY be given when you can quote it VERBATIM from SOURCES — put that exact sentence in "quote" and set "tier":"T2" (or "T1" if it came from the user's own attached data). The weights of the edges INTO the outcome should sum to ≤ 1.
3
- - If a cause, link, or figure comes from general knowledge with NO source sentence, set "tier":"T0" and OMIT value/weight/series/quote. Never invent a number, a percentage, or a citation.
4
- - If SOURCES is empty, EVERY node and edge is "T0" with no numbers — a qualitative structure only.
5
- - Every point of a "series" needs its OWN verbatim quote containing that point's digits. A series you cannot quote point-by-point must be omitted entirely, never smoothed or estimated.
6
- - "sign" is 1 (reinforces) or -1 (dampens). "role" is "root" | "mechanism" | "outcome". "depth" grows from roots (0) to the outcome. Edges may only join TOP-LEVEL nodes — "children" are a breakdown of one node, never causal actors.
7
- - Node "id" is a short stable slug of the label (lowercase, hyphens: "cheap-credit"), because a later turn has to be able to name the same node again.
8
- - "date" is WHEN a cause happened, as a plain string: a year ("1986"), an ISO date ("1986-01-28"), or an ISO timestamp. This is NOT a measurement and needs NO source — give one for every node you can place in time, even in an all-T0 world with no numbers anywhere, because it is what lets the reader lay the same causes out on a timeline. Omit it only when you would be guessing at the year.
9
- - "domain" is the sphere a node belongs to, one of: economy | policy | technology | science | environment | society | health | conflict. It is a description, not a claim, so it needs no source — but OMIT it when no single sphere fits, and never stretch one to cover a node.`,j=`Shape: {"title":"the question, verbatim","outcomeId":"<id of the outcome node>","nodes":[{"id":"","label":"","role":"","depth":0,"domain":"","date":"1986-01-28","tier":"T0","value":0,"unit":"","quote":"","detail":"","series":{"tier":"T0","unit":"","points":[{"t":"2008","value":0,"quote":""}]},"children":[{"id":"","label":"","tier":"T0"}]}],"edges":[{"from":"","to":"","verb":"","weight":0,"sign":1,"tier":"T0","quote":"","relation":""}],"provenance":{"illustrative":false}}`,fe=`You are Mavéa's causal world-builder. Given a causal question and SOURCES, build the web that explains it: root causes → mechanisms → the outcome, each node carrying whatever the sources actually prove about it. Return ONLY compact JSON, no prose.
10
-
11
- ${A}
12
- ${j}`,pe=`You are Mavéa's causal world-builder, EXTENDING a world that already exists. The user asked a follow-up about the SAME web. Return ONLY compact JSON, no prose.
13
-
14
- ECHO THE IDS: every node you re-describe MUST reuse its EXISTING id, verbatim, from the roster you are given — that is the only way your answer lands on the world the user is looking at. Only a genuinely new cause gets a new slug id. Re-state "title" exactly as given.
15
- A DELTA, NOT A WORLD: return ONLY the nodes the follow-up actually touches, and only the edges you are adding — every node you leave out keeps exactly what it already has. Re-listing the unchanged web wastes the reader's money and risks overwriting facts that are already proven.
16
- Answer the follow-up by ENRICHING the nodes it is about (add a "series", a "children" breakdown, a "detail" sentence, a missing edge) — do not rebuild the web from scratch and do not rename anything.
17
-
18
- ${A}
19
- ${j}`,M={type:`object`,properties:{quote:{type:`string`},url:{type:`string`},host:{type:`string`},date:{type:`string`}},required:[`quote`]},N={type:`object`,properties:{tier:{type:`string`,enum:[`T0`,`T1`,`T2`,`T3`]},unit:{type:`string`},quote:{type:`string`},points:{type:`array`,items:{type:`object`,properties:{t:{type:`string`},value:{type:`number`},quote:{type:`string`}},required:[`t`,`value`]}}},required:[`tier`,`points`]},P={type:`object`,properties:{id:{type:`string`},label:{type:`string`},domain:{type:`string`,enum:[...m]},tier:{type:`string`,enum:[`T0`,`T1`,`T2`,`T3`]},value:{type:`number`},unit:{type:`string`},quote:{type:`string`}},required:[`id`,`label`]},F={type:`object`,properties:{title:{type:`string`},outcomeId:{type:`string`},nodes:{type:`array`,minItems:2,items:{type:`object`,properties:{id:{type:`string`},label:{type:`string`},role:{type:`string`,enum:[`root`,`mechanism`,`outcome`]},depth:{type:`number`},domain:{type:`string`,enum:[...m]},date:{type:`string`},tier:{type:`string`,enum:[`T0`,`T1`,`T2`,`T3`]},value:{type:`number`},unit:{type:`string`},quote:{type:`string`},detail:{type:`string`},series:N,children:{type:`array`,items:P}},required:[`id`,`label`,`role`]}},edges:{type:`array`,items:{type:`object`,properties:{from:{type:`string`},to:{type:`string`},verb:{type:`string`},weight:{type:`number`},sign:{type:`number`},tier:{type:`string`,enum:[`T0`,`T1`,`T2`,`T3`]},quote:{type:`string`},relation:{type:`string`},receipts:{type:`array`,items:M},counter:M},required:[`from`,`to`,`sign`]}},provenance:{type:`object`,properties:{illustrative:{type:`boolean`}}}},required:[`title`,`nodes`,`edges`]};function I(e){let t={slow:5,standard:8}[o(e)]??12;return{maxTokens:400+t*300,nodeCap:t}}var L=`(none — use only general knowledge; mark EVERY node and edge "T0" with no numbers and no series)`;function R(e){return e.trim()?e.trim().slice(0,6e3):L}function z(e,t,n){return`QUESTION: ${e.trim()}
20
-
21
- SOURCES:
22
- ${R(t)}
23
-
24
- Build the causal world (${n} nodes max). Quote SOURCES verbatim for any number, series point or weight; otherwise T0 with no numbers. Reply as compact JSON on one line.`}function B(e){return e.nodes.map(e=>`${e.id} = ${e.label}`).join(`
25
- `)}function me(e,t,n,r){return`TITLE (re-state verbatim): ${e.title}
26
-
27
- EXISTING NODES — reuse these ids exactly:
28
- ${B(e)}
29
-
30
- FOLLOW-UP: ${t.trim()}
31
-
32
- SOURCES:
33
- ${R(n)}
34
-
35
- Answer the follow-up on THIS world with a DELTA — only the nodes it changes (${r} nodes max, existing ids echoed), never the whole web again. Quote SOURCES verbatim for any number, series point or weight; otherwise T0 with no numbers. Reply as compact JSON on one line.`}async function V(e,t,n,r,i,o){let s;try{s=(await a(n.provider).generate({system:e,history:[],user:t,maxTokens:r,thinkingLevel:`minimal`,format:F,...o?{signal:o}:{}},n)).raw}catch{return null}return o?.aborted?null:h(s,i)}var H=new Map;function he(e,t,n){return s(`world:${e}\0${t}`,n.provider)}function ge(e,t,n,r){let i=he(e,t,n),a=H.get(i);if(a)return a;let o=_e(i,e,t,n,r);for(H.set(i,o);H.size>16;){let e=H.keys().next().value;if(e===void 0||e===i)break;H.delete(e)}return o.then(e=>{e||H.delete(i)},()=>H.delete(i)),o}async function _e(e,t,n,r,i){try{let t=await u(e);if(t)return t}catch{}let{maxTokens:a,nodeCap:o}=I(r.model??r.provider),s=await V(fe,z(t,n,o),r,a,n,i);if(s)try{await c(e,s)}catch{}return s}var ve=.5;async function ye(e,t,n,r,i){let{maxTokens:a,nodeCap:o}=I(r.model??r.provider),s=await V(pe,me(e,t,n,o),r,a,n,i);return!s||f(e,s)<ve?null:p(e,s)}function be(e,t){let n=[],r=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g,i;for(;(i=r.exec(e))!==null;){let e=i[1],r=/\br="([A-Z]+\d+)"/.exec(e)?.[1];if(!r)continue;let a=y(r);if(!a)continue;let o=v(e,i[2]??``,t);o!==``&&n.push({col:a.col,row:a.row,addr:r,text:o})}return n}async function xe(e){let t;try{t=await ne(b(e))}catch{return null}if(!t)return null;let n=t.get(`xl/sharedStrings.xml`),r=n?ee(g(n)):[],i=[...t.keys()].filter(e=>/^xl\/worksheets\/sheet\d+\.xml$/.test(e)).sort((e,t)=>Number(e.match(/(\d+)\.xml$/)[1])-Number(t.match(/(\d+)\.xml$/)[1]));if(i.length===0)return null;let a=t.get(`xl/workbook.xml`),o=a?/<sheet[^>]*name="([^"]+)"/.exec(g(a))?.[1]??`Sheet1`:`Sheet1`,s=be(g(t.get(i[0])),r);if(s.length===0)return null;let c=[...new Set(s.map(e=>e.row))].sort((e,t)=>e-t),l=c[0],u=s.filter(e=>e.row===l).sort((e,t)=>e.col-t.col),d=u.map(e=>e.col),f=u.map((e,t)=>e.text||`col${t+1}`),p=new Map(s.map(e=>[`${e.col}:${e.row}`,e.text])),m=c.filter(e=>e>l),h=m.length,_=m.slice(0,re),v=[],y=[];for(let e of _)v.push(d.map(t=>p.get(`${t}:${e}`)??``)),y.push(d.map(t=>`${te(t)}${e}`));return{headers:f,rows:v,addrs:y,sheet:o,sourceRowCount:h,truncated:h>v.length}}var U=/^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2})?)?$|^\d{1,2}[/-]\d{1,2}[/-]\d{2,4}$/,W=/^(true|false|yes|no)$/i;function G(e){let t=e.trim();if(!t)return null;let n=d(t);if(!n)return null;let r=n.kind===`pct`?`%`:/^[$€£]/.test(t)?t[0]:void 0;return{value:n.value,...r?{unit:r}:{}}}function Se(e){let t=e.trim();return t?G(t)?`number`:U.test(t)?`date`:W.test(t)?`boolean`:`text`:`empty`}function Ce(e,t,n){let r=n.filter(e=>e.trim()!==``);if(r.length===0)return{key:e,label:t,type:`empty`,values:n.map(()=>null),raw:n,parsedFraction:0};let i=r.slice(0,x),a={number:0,date:0,boolean:0,text:0,empty:0};for(let e of i)a[Se(e)]+=1;let o=i.length,s=`text`;a.number/o>=.7?s=`number`:a.date/o>=.7?s=`date`:a.boolean/o>=.7&&(s=`boolean`);let c=0,l,u=n.map(e=>{let t=e.trim();if(!t)return null;if(s===`number`){let e=G(t);return e?(c+=1,e.unit&&!l&&(l=e.unit),e.value):null}return s===`boolean`?W.test(t)?(c+=1,/^(true|yes)$/i.test(t)):null:s===`date`?U.test(t)?(c+=1,t):null:(c+=1,t)});return{key:e,label:t,type:s,values:u,raw:n,parsedFraction:r.length?c/r.length:0,...l?{unit:l}:{}}}function we(e,t,n){let r=e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`col${t+1}`,i=r,a=2;for(;n.has(i);)i=`${r}_${a++}`;return n.add(i),i}function Te(e){let t=new Set;return e.headers.map((n,r)=>{let i=e.rows.map(e=>e[r]??``),a=Ce(we(n,r,t),n,i);return e.addrs&&(a.addrs=e.rows.map((t,n)=>e.addrs[n]?.[r]??``)),a})}async function Ee(e,n){let r,a;if(i(e))a=`xlsx`,r=await xe(e.data);else if(t(e)){a=`csv`;try{r=S(new TextDecoder(`utf-8`).decode(b(e.data)))}catch{r=null}}else return{reason:`Not a CSV or Excel file.`};if(!r||r.headers.length===0)return{reason:`Could not read a table from ${e.name}.`};let o=Te(r);return{dataset:{id:l(`${e.name}:${e.data.slice(0,2e5)}`),file:e.name,...r.sheet?{sheet:r.sheet}:{},columns:o,rowCount:r.rows.length,sourceRowCount:r.sourceRowCount,truncated:r.truncated,origin:a,parsedAt:n}}}var De=200;function Oe(e){let t=[`${e.file}: ${e.columns.map(e=>e.label).join(`, `)}`],n=Math.min(e.rowCount,De);for(let r=0;r<n;r+=1)t.push(e.columns.map(e=>`${e.label} ${e.raw[r]??``}`.trim()).join(` | `));return t.join(`
36
- `)}async function ke(e){let a=[];for(let o of e)try{if(t(o)||i(o)){let{dataset:e}=await Ee(o,0);e&&a.push(Oe(e))}else if(r(o))a.push(new TextDecoder(`utf-8`).decode(b(o.data)));else if(n(o)){let e=await _(o);e&&a.push(e.join(`
37
- `))}}catch{}return a.join(`
38
-
39
- `)}var Ae=8e3,K=new Map;function je(e,t){for(K.delete(e),K.set(e,t);K.size>2;){let e=K.keys().next().value;if(e===void 0)break;K.delete(e)}}async function Me(e){let t=K.get(e);return t?[await ke(t.attachments),t.sources.map(e=>e.url?`${e.title}. ${e.url}`:e.title).filter(e=>e.trim()).join(`
40
- `)].filter(e=>e.trim()).join(`
41
-
42
- `).slice(0,Ae):``}var Ne=/\b(just (?:tell me|give me|the answer)|in one line|one[- ]liner|in a (?:sentence|word|line)|in a few words|brief(?:ly)?|tl;?dr|short (?:version|answer)|keep it (?:short|brief)|quick (?:answer|version|recap|rundown|summary)|in short|the short version|bottom line|in a nutshell|the gist)\b/,Pe=/\b(tell me about|explain|overview|how (?:do|does|to|can|is|are|did|would|should)|why|guide|walk\s?(?:me\s)?through|break\s?down|breakdown|deep\s?dive|everything|compare|comparison|versus|vs\.?|pros and cons|plan|itinerary|roadmap|review|analy[sz]e|dashboard|trends?|history of|all about|summary of)\b/,q=/\b(teach (?:me|us)|help me (?:understand|learn|grasp|wrap my head around)|walk me through|crash course|get (?:me |us )?up to speed|bring me up to speed|from scratch|(?:the )?(?:basics|fundamentals|essentials|core concepts|key concepts) of|study (?:for|guide|plan)|prep(?:are)? (?:me |us )?for (?:my |an? |the |our )?(?:\w+ )?(?:interview|exam|test|quiz|midterm|final|cert\w*)|(?:interview|exam) prep|tutorial|lesson on|learn (?:about |how )?[a-z]+)\b/,Fe=[/^[\s\d().,+\-*/^%×÷=]+\??$/,/\bwhat(?:'s| is| are| was)?\s*[\d().,\s+\-*/^%×÷]+\s*\??$/,/\b(calculate|compute|solve)\b/,/\b\d+(?:\.\d+)?\s*%\s*of\s+\d/,/\bconvert\b/,/\bhow many\s+\w+\s+(?:in|are in|per)\b/,/\b\d+\s*[a-z]+\s+(?:in|to)\s+[a-z]+\b/,/\b(define|definition of)\b/,/\bwhat does\s+.+\s+mean\b/,/\bcapital of\b/];function Ie(e){let t=e.toLowerCase().trim();if(!t)return`rich`;let n=Ne.test(t);return q.test(t)||Pe.test(t)?n?`brief`:`rich`:Fe.some(e=>e.test(t))?`lean`:n?`brief`:`rich`}function Le(e){return q.test(e.toLowerCase())}var Re=/\b(deriv\w*|prove|proof|theorem|integral|derivative|equation|algebra|calculus|optimi[sz]e|trade-?offs?|step[-\s]?by[-\s]?step|reason\w* through|figure out|work out|why (?:does|is|are|do)|analy[sz]e|compare\b.*\bvs\b|root cause|debug|diagnose|strategy|plan\b.*\b(?:budget|trip|itinerary|migration))\b/;function J(e){return Re.test(e.toLowerCase())}function ze(e,t){return e===`lean`?`minimal`:t?`low`:`minimal`}var Y=[`minimal`,`low`,`medium`,`high`];function Be(e,t){let n=Y.indexOf(e);return Y[Math.min(Y.length-1,Math.max(0,n+t))]}function Ve(e,t,n=`fast`){let r=J(t);return e===`lean`&&!r?`minimal`:Be(ze(e,r),n===`thorough`?2:+(n===`balanced`))}var He=.1,Ue=.3,We=.75;function Ge(e,t,n){return t.creative?We:e===`lean`||J(n)||t.troubleshoot?He:Ue}var X=140,Z=320;function Ke(t,n){let r=n===`lean`||n===`brief`?X:Z;return e(t.trim(),r)}function Q(e){return e===`lean`||e===`brief`?X:Z}var qe=`OUTPUT ORDER — emit the "narration" field FIRST in the JSON, before "title", "sub", and "blocks", and write it as complete sentences. It is spoken aloud the moment it streams, so it must lead.`;function Je(e){return e===`lean`||e===`brief`?`SPOKEN LINE ("narration") — keep it to ONE short sentence (≈${Q(e)} characters). Right to the point.`:`SPOKEN LINE ("narration") — at most two or three short sentences (≈${Q(`rich`)} characters), like a person talking. The visuals carry the detail; never narrate the whole canvas.`}var $=[{key:`decision`,test:/\b(should i|should we|worth it|is it worth|which (?:one|should|is better)|do i (?:need|have to)|ought i|better to|or should i)\b/},{key:`comparison`,test:/\b(vs\.?|versus|compare\w*|comparison|pros and cons|trade-?offs?|better than|which is better)\b/},{key:`risk`,test:/\b(risk\w*|danger\w*|downside|what could go wrong|threat\w*|is it safe|safe to|consequenc\w*|backfire|red flags?|pitfalls?)\b/},{key:`planning`,test:/\b(roadmap|schedule|timeline|milestone\w*|strateg\w*|prepare for|get ready|launch|plan (?:to|for|a|my|out)|over the next \d+|in \d+ (?:weeks?|months?|days?))\b/},{key:`troubleshoot`,test:/\b(troubleshoot|debug|not working|isn'?t working|won'?t \w+|broken|\berror\b|\bbug\b|fix\b|stopped working|fail(?:s|ing|ed)?|why (?:is|does|won'?t|isn'?t|can'?t))\b/},{key:`learning`,test:/\b(explain|how does|how do .* work|what is|what are|teach me|help me understand|learn\b|tell me about|why does|the difference between|concept of|crash course|walk me through|for (?:my|an?|the|our) (?:\w+ )?(?:interview|exam|test|midterm|final)|study for)\b/},{key:`creative`,test:/\b(brainstorm|ideas? for|come up with|imagine|invent|design a|creative|name (?:my|a|some|ideas)|suggest (?:some )?\w+ (?:names|ideas))\b/},{key:`whatIf`,test:/\b(what (?:if|happens if|would happen)|if i (?:do|don'?t|take|stay|leave|wait)|either way|both (?:paths|options|ways)|play(?:ed)? out|scenario\w*|down the road|in (?:each|both) cases?|stay or (?:go|leave|take)|futures?\b)\b/},{key:`reflection`,test:/\b(my (?:friend|partner|relationship|boyfriend|girlfriend|marriage|spouse|boss|family|mom|dad|kid)|feel(?:ing)?\b|emotionally|am i (?:wrong|right|overreacting|the problem)|should i feel|drain(?:s|ing|ed)?|toxic|healthy (?:relationship|friendship)|cope\b|burn(?:t|ed)?\s?out|overwhelm\w*|anxious|lonely)\b/},{key:`highStakes`,test:/\b(quit (?:my|the|this) (?:job|career)|get married|getting married|divorce|buy a (?:house|home)|mortgage|life savings|career change|drop out|move (?:abroad|across|countr|to another)|surgery|diagnos\w*|lawsuit|\bsue\b|custody|life-?changing)\b/},{key:`serious`,test:/\b(grief|grieving|death|dying|depress\w*|suicid\w*|self-?harm|abuse|trauma|addiction|crisis|terminal|miscarriage)\b/}],Ye=[{domain:`health`,test:/\b(health\w*|symptom\w*|doctor|medic\w*|diagnos\w*|disease|surgery|mental health|therap\w*|depress\w*|anxiety)\b/},{domain:`legal`,test:/\b(legal|lawyer|attorney|lawsuit|\bsue\b|court|custody|rights\b|contract\b)\b/},{domain:`money`,test:/\b(money|budget|invest\w*|savings|\bdebt\b|loan|mortgage|finance\w*|retire\w*|taxe?s?\b|salary)\b/},{domain:`career`,test:/\b(job\b|career|\bwork\b|boss|promotion|freelanc\w*|resume|interview|fired|laid off|quit)\b/},{domain:`relationship`,test:/\b(relationship|friend\w*|partner|boyfriend|girlfriend|marriage|spouse|dating|breakup|family)\b/},{domain:`travel`,test:/\b(travel|trip|vacation|flight|hotel|itinerary|destination|visit\b)\b/},{domain:`tech`,test:/\b(code|coding|software|\bapp\b|\bapi\b|database|server|deploy|programming|website|algorithm)\b/},{domain:`learning`,test:/\b(study|course|exam|tutorial|homework|\bclass\b|lesson|curriculum)\b/}];function Xe(e){if(!e)return``;for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`)return e[t].content;return``}function Ze(e,t){let n=e.toLowerCase(),r=Xe(t).toLowerCase(),i=r?`${n} ${r}`:n,a={decision:!1,comparison:!1,risk:!1,planning:!1,troubleshoot:!1,learning:!1,creative:!1,whatIf:!1,reflection:!1,highStakes:!1,serious:!1};for(let e of $)e.test.test(i)&&(a[e.key]=!0);(a.highStakes||a.reflection)&&(a.serious=!0);for(let e of Ye)if(e.test.test(i)){a.domain=e.domain;break}return a}function Qe(e){let t=new Set;return e.decision&&t.add(`decide`),e.comparison&&(t.add(`compare`),t.add(`decide`)),e.risk&&t.add(`decide`),e.planning&&(t.add(`plan`),t.add(`howto`)),e.troubleshoot&&(t.add(`howto`),t.add(`explain`)),e.learning&&(t.add(`explain`),t.add(`reference`)),e.creative&&t.add(`draft`),e.whatIf&&t.add(`decide`),e.reflection&&(t.add(`reflect`),t.add(`comfort`)),[...t]}var $e=[{shape:`composition`,weight:1,test:/\b(budget|allocat\w*|split|breakdown|where\s+(?:\w+\s+)?(?:my\s+|the\s+)?(?:money|time|spend\w*|budget)|(?:money|time|spend\w*)\s+goes?|portion|share|mix|composition|makeup|made up of|percent\w*|proportion|divid\w*)\b/},{shape:`series`,weight:1,test:/\b(trend\w*|over time|growth|history|historical|month\w*|week\w*|dai\w*|quarter\w*|year\w*|forecast|projection|trajectory|since|past \d+)\b/},{shape:`comparison`,weight:1,test:/\b(vs\.?|versus|compare\w*|comparison|better|which (?:one|should|is)|either|or should|pros and cons|trade-?offs?|options?|best|top \d+|worth it|should i (?:buy|get|pick|choose|use)|recommend\w*)\b/},{shape:`ranking`,weight:1,test:/\b(rank\w*|leaderboard|top \d+|best|worst|most|least|highest|lowest|fastest|biggest|smallest|standings)\b/},{shape:`status`,weight:1,test:/\b(progress|on track|readiness|ready|status|health\w*|complete\w*|how (?:far|close)|goal|target|score|rating|grade)\b/},{shape:`sequence`,weight:1,test:/\b(steps?|how (?:do|to)|process|guide|walk\s?through|plan|schedule|roadmap|sequence|order|first.*then|itinerary|timeline)\b/},{shape:`flow`,weight:.8,test:/\b(funnel|pipeline|workflow|conversion|stages?|flow|drop-?off|state\s?machine|feedback\s?loops?|decision\s?tree|control\s?flow)\b/},{shape:`geo`,weight:1,test:/\b(map|where is|near\w*|location|route|directions?|cities|country|countries|region|travel|trip|drive)\b/},{shape:`list`,weight:.8,test:/\b(list|tips?|checklist|things to|ways to|ideas|reasons|items|bullet\w*)\b/},{shape:`distribution`,weight:1,test:/\b(distribution|spread|histogram|range|variance|outliers?|percentile|frequency|how (?:often|spread))\b/},{shape:`relationship`,weight:1,test:/\b(correlat\w*|relationship between|scatter|vs.*axis|impact of|affect\w*|driver\w*)\b/},{shape:`structure`,weight:1,test:/\b(molecul\w*|chemical structure|molecular structure|skeletal (?:formula|structure)|lewis structure|smiles|functional group|benzene)\b/},{shape:`tabular`,weight:.9,test:/\b(table|rows?|columns?|spreadsheet|records|dataset|grid of|matrix)\b/},{shape:`media`,weight:1,test:/\b(image\w*|photos?|gallery|pictures?|visual\w*|video|watch|before and after|screenshot)\b/},{shape:`text`,weight:.8,test:/\b(quote\w*|testimonial\w*|said|opinions?|reviews?|feedback|explain|defin\w*|definition|what is|tell me about|meaning of|translate\w*|vocabulary)\b/},{shape:`code`,weight:1.1,test:/\b(code|coding|programming|software|function|algorithm\w*|recursi\w*|data structures?|linked lists?|binary (?:tree|search)|hash\s?(?:map|table)|big-?o|time complexity|syntax|compil\w*|debug\w*|refactor\w*|regex|sql|snippet|pseudo\s?code|api)\b/},{shape:`scalar`,weight:.7,test:/\b(how (?:many|much)|number of|total|count|metric|stat\w*|kpi|figure)\b/},{shape:`keyvalue`,weight:.7,test:/\b(stats|metrics|numbers|key figures|at a glance|summary of|overview)\b/},{shape:`selection`,weight:.9,test:/\b(choose|pick|select|decide|configure|settings|sign\s?up|form|filter|adjust|set up)\b/},{shape:`hierarchy`,weight:.9,test:/\b(hierarch\w*|tree|nested|org\s?chart|structure of|breakdown of .* into|parent|sub-?categor\w*)\b/}],et=[{test:/\b(pdf|white\s?paper|the paper|the document|the report|the contract|the article|the spec|the manual|the filing|the brief|full text|read (?:it|the\b))\b/,types:[`pdfreader`,`docview`]},{test:/\b(images?|photos?|pictures?|gallery|pics?|snapshots?)\b/,types:[`gallery`]},{test:/\b(maps?|where is|located|directions?|on a map|near (?:the|downtown|campus)|walking distance|walkable|nearby|neighborhood|what'?s around|close to (?:downtown|the))\b/,types:[`geomap`]},{test:/\b(code|snippet|implementation|source code|pseudo\s?code)\b/,types:[`codeblock`]},{test:/\b(dialogue\w*|a scene\b|conversation between|exchange between|speakers?|write a (?:script|scene|transcript))\b/,types:[`dialogue`]},{test:/\b(defin\w*|etymology\b|what does .{1,30} mean|look up\b|vocabulary\b|word for\b)\b/,types:[`dictionary`]},{test:/\b(variant\w*|alternativ\w*|\d+ (?:version\w*|option\w*|draft\w*)|rewrit\w*|different (?:tone\w*|style\w*|version\w*))\b/,types:[`variants`]},{test:/\b(?:make|say|write|phrase|word|put) (?:it|this|that|the \w{2,14}) (?:more |a bit |a little |much |way )?(?:firm|soft|warm|blunt|gentl|harsh|kind|stern|polit|casual|formal|direct|punchi|short|long|terse|friendl)\w*\b|\b(?:firmer|softer|warmer|blunter|gentler|harsher|sterner|punchier|shorter|longer|friendlier) (?:version|tone|wording|take|draft|phrasing)\b|\bexplain (?:it|this|that) (?:for|to) (?:an? )?(?:exec|executive|engineer|beginner|expert|layperson)\b|\b(?:at|in) (?:different|two|three|several) (?:levels?|tones?|registers?|reading levels?)\b|\bfor (?:different|two|three|several) audiences\b/,types:[`variantswitch`]},{test:/\b(translat\w+|in (?:french|spanish|japanese|german|chinese|portuguese|italian|korean|arabic|russian|hindi|dutch|swedish|polish|turkish|vietnamese|thai|hebrew|greek|latin)|from (?:english|spanish|french|japanese|german|chinese) (?:to|into))\b/,types:[`translation`]},{test:/\b(rank (?:the )?top \d+|top \d+ (?:ranked|ranking)|leaderboard\b|ranked list\b|best \d+ .{1,30} rank\w*)\b/,types:[`bracketbar`]},{test:/\b(?:as|in|into) (?:a |an )?(?:data )?table\b|\b(?:make|build|draw|create|show|give|put|render|format)\b(?:[\w\s]{0,12})?\btable\b|\btabular\b|\bspreadsheet\b/,types:[`datatable`]},{test:/\b(?:draw|make|show|give|create|build)\b(?:[\w\s]{0,12})?\b(?:flow\s?chart|flow\s?diagram|diagram)\b|\bdiagram (?:this|it|of|the)\b|\bflow\s?chart\b|\bas an? [\w\s]{0,20}?diagram\b|\bstate\s?machine\b/,types:[`diagramflow`]},{test:/\b(?:as|make|draw|show|give|build|on)\b(?:[\w\s]{0,12})?\btime\s?line\b|\btime\s?line of\b/,types:[`timeline`]},{test:/\bcheck\s?list\b/,types:[`checklist`]},{test:/\bstep[-\s]?by[-\s]?step\b|\b(?:numbered|ordered) steps\b|\bwalk me through (?:the )?steps\b/,types:[`howtosteps`,`checklist`]},{test:/\bcompare\b|\bcomparison\b|\b\w+ (?:vs\.?|versus) \w+\b|\bdifference between\b|\bside[-\s]?by[-\s]?side\b/,types:[`compare`]},{test:/\bdifferences? between (?:an? |the )?\w+ and (?:an? |the )?\w+\b|\bhow (?:is|are|does|do) (?:an? |the )?\w+ (?:and (?:an? |the )?\w+ )?differ\w*\b|\bconfus\w+ (?:with|between|for)\b|\b(?:commonly|easily|often) confused\b|\bmix\w* (?:them|these two|those two|the two) up\b|\b(?:them|these two|those two|the two) (?:mixed|confused)\b|\btell\b[^.?!]{0,30}\bapart\b|\bwhich (?:one )?is which\b|\bare\b[^.?!]{1,40}\bthe same thing\b|\bwhen (?:to|do i|should i) use\b[^.?!]{1,30}\b(?:vs\.?|versus|instead of)\b/,types:[`distinctioncard`]},{test:/\bquiz\b|\btest me on\b|\bpractice questions\b/,types:[`quiz`]},{test:/\b(?:quiz|test|grill|drill) me\b|\btest my knowledge\b|\b(?:mock|practice|sample) (?:exam|test)\b|\b\d+[-\s]question\b|\b\d+ (?:practice|review|exam|multiple[-\s]choice|short[-\s]answer) questions?\b|\b(?:ask|give|write|make|generate) me \d+ questions\b|\bexam prep\b/,types:[`quizsession`]},{test:/\bflash\s?cards?\b/,types:[`flashcard`]},{test:/\b(?:100\s?%\s?)?stacked\s+(?:bar|column)s?(?:\s+(?:chart|graph))?\b|\bstacked\s+(?:chart|graph)\b|\b100\s?%\s?stacked\b/,types:[`stackedbars`]},{test:/\b(?:write|draft|compose|give me|make me) (?:me )?(?:an? |the )?(?:\w+[- ]){0,2}(?:essays?|articles?|blog posts?|op-?eds?)\b|\b(?:essays?|blog posts?) (?:about|on|arguing)\b|\b(?:cover letter|personal statement|statement of purpose|college essay)\b|\bin prose\b|\blong[-\s]?form\b|\b(?:wedding|best man'?s?|maid of honou?r|retirement|graduation|farewell) (?:toast|speech)\b|\b(?:few|couple(?: of)?|several|\d+) paragraphs\b|\bwrite (?:it|this) out in full\b/,types:[`longread`]},{test:/\bbrainstorm\w*\b|\b(?:ideas|suggestions) (?:for|on|about)\b|\b(?:some|any|other|more|fresh|a few) (?:ideas|suggestions|names)\b|\b(?:give|list|need|want) (?:me |us )?\d+ (?:ideas|suggestions|names)\b|\bgive me ideas\b|\bideas on how\b|\bwhat (?:should|could) (?:i|we) (?:call|name) (?:it|this|my|our|the)\b|\bname (?:ideas|suggestions)\b|\bwhat could (?:i|we) do about\b|\bpossible (?:approaches|angles|directions)\b|\bcome up with (?:some |a few |\d+ )?(?:ideas|names|concepts|angles|titles)\b/,types:[`ideaboard`]},{test:/\bdo(?:'|’)?s and don(?:'|’)?ts\b|\bwhat not to (?:say|do|wear|bring|ask|write|post)\b|\bwhat (?:should|do) i (?:say|do)\b[^.?!]{0,4}\b(?:when|if|at|during)\b|\bwhat (?:should|do) i avoid\b|\b(?:screw|mess|blow|botch) (?:this|it|that) up\b|\betiquette\b|\b(?:common|rookie|beginner|classic|typical) mistakes?\b|\bthings to avoid\b/,types:[`dosdonts`]},{test:/\banalog(?:y|ies) for\b|\bmetaphors? for\b|\b(?:an?|another|any|the) (?:\w+ ){0,2}analog(?:y|ies)\b|\bby analogy\b|\beli ?5\b|\blike i(?:'|’)?m (?:five|5)\b|\bfor a (?:five|5)[-\s]?year[-\s]?old\b|\b(?:explain|describe)\b[^.?!]{0,40}\blike\s+an?\b/,types:[`analogymap`]},{test:/\b(recipe\b|how to (?:make|cook|bake) |step\w*-?by\w*-?step .{0,20}(?:recipe|cook)|(?:dinner|lunch|breakfast|dessert|cookie|pasta|chicken|beef|vegan|gluten.free) recipe\b)\b/,types:[`recipecard`]},{test:/\b(workout plan|training plan|exercise plan|gym (?:program|plan|routine)|fitness (?:plan|program|routine)|sets? and reps?|push.?pull.?legs?|strength (?:program|plan)|build muscle (?:plan|program)|weekly (?:workout|training|gym) (?:plan|program|schedule))\b/,types:[`workoutplan`]},{test:/\b(macro(?:nutrient)?s?\b|(?:calorie|nutrition(?:al)?) (?:breakdown|facts?|info|content)|grams? of (?:protein|carbs?|fat)|protein.*carb\w*.*fat|caloric breakdown)\b/,types:[`macrobreakdown`]},{test:/\b(medication (?:schedule|reminder|timing)|dosing schedule|pill (?:schedule|reminder)|when (?:to|should i|do i) take .{0,30}(?:pill\w*|drug|medication|meds?|tablet\w*|dose\w*)|what time .{0,20}(?:take|dose) .{0,20}(?:pill\w*|medication|meds?)|drug dosage (?:schedule|timing))\b/,types:[`medicationschedule`]},{test:/\b(chord diagram|guitar chord\b|(?:how to (?:play|finger)|fingering for) .{0,20}chord|barre chord|power chord|open chord|chord shape\w*)\b/,types:[`chorddiagram`]},{test:/\b((?:baby|child|toddler|infant) (?:milestone\w*|developmental? milestone\w*)|developmental? milestone\w*|\d+[- ]month[- ]old milestone\w*|\d+[- ]year[- ]old milestone\w*|when (?:should|do) (?:babies|kids|toddlers|infants)\b)\b/,types:[`developmentmilestone`]},{test:/\b(argument map\b|arguments? (?:for and against\b|supporting and opposing)|philosophical argument\b|claim(?:s?) (?:and|with) (?:evidence|support\w*|objection\w*)|debate the (?:claim|motion|topic)\b|case for and against\b)\b/,types:[`argumentmap`]},{test:/\b((?:soccer|football|basketball|baseball|tennis) (?:formation\b|lineup\b|position\w*|play diagram|tactic\w*)|4-3-3\b|4-4-2\b|3-5-2\b|4-2-3-1\b|3-4-3\b|defensive (?:shift\b|formation\b)|starting (?:eleven\b|xi\b|lineup\b))\b/,types:[`sportspitch`]},{test:/\b(floor\s?plan\b|room layout\b|apartment layout\b|(?:house|home|office) (?:layout\b|floor plan)|room arrangement\b|furniture layout\b)\b/,types:[`floorplan`]},{test:/\b(medical (?:history|timeline|chronolog\w*)|clinical (?:history|course|timeline)|patient (?:history|chronolog\w*)|diagnosis timeline\b|treatment (?:history|timeline)|symptom (?:progression|history|chronolog\w*))\b/,types:[`clinicaltimeline`]},{test:/\b(research (?:finding\w*|result\w*|summary|paper summary)|what (?:does|did) (?:the research|studies|the study|the science) (?:say|show|find|reveal)\b|scientific (?:consensus|evidence|finding\w*)|meta-?analysis\b|randomized (?:controlled )?trial\b|clinical (?:evidence|finding\w*|trial\w*))\b/,types:[`researchsummary`]},{test:/\b(hourly itinerary|hour.?by.?hour|itinerary (?:for|of)\b|trip itinerary|travel itinerary|daily itinerary|day.?by.?day (?:plan|schedule|itinerary)|morning (?:to|through) (?:evening|night)|full day (?:plan|schedule|itinerary)|schedule (?:for|of) (?:my |a |the )?(?:trip|day|visit))\b/,types:[`agenda`]}];function tt(e){let t=e.toLowerCase(),n=[];for(let e of et)e.test.test(t)&&n.push(...e.types);return[...new Set(n)]}var nt={datatable:`a data table`,diagramflow:`a flow diagram`,timeline:`a timeline`,codeblock:`a code block`,geomap:`a map`,gallery:`an image gallery`,pdfreader:`the document`,docview:`the document`,checklist:`a checklist`,howtosteps:`a step-by-step`,compare:`a side-by-side comparison`,quiz:`a quiz`,flashcard:`flashcards`,dictionary:`a definition`,recipecard:`a recipe`,dialogue:`a scripted dialogue`,variants:`variations`,translation:`a translation`,bracketbar:`a ranking`,stackedbars:`a stacked bar chart`,distinctioncard:`a distinction between the terms`,longread:`a long-form written piece`,ideaboard:`a board of ideas`,dosdonts:`a do's-and-don'ts list`,variantswitch:`the same content at several settings`,quizsession:`a graded quiz run`,analogymap:`an analogy`};function rt(e){return nt[e]??`a ${e}`}function it(e){return e.length?`FORMAT REQUEST — the user explicitly asked for their answer in a specific FORM: ${[...new Set(e.map(rt))].join(`, `)}. Make that the LEAD block (position 0 or 1), built fully and completely; the rest of the canvas supports it. Never answer in a different shape than the one they named.`:``}function at(e){if(!e)return``;for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`)return e[t].content;return``}function ot(e,t){let n=e.toLowerCase(),r=at(t).toLowerCase(),i={};for(let e of $e){let t=0;e.test.test(n)&&(t+=e.weight),r&&e.test.test(r)&&(t+=e.weight*.4),t>0&&(i[e.shape]=(i[e.shape]??0)+t)}return i}export{ge as _,Qe as a,ie as b,Q as c,Ve as d,Ie as f,ye as g,Me as h,Ze as i,Je as l,je as m,ot as n,qe as o,Le as p,it as r,Ke as s,tt as t,Ge as u,de as v,O as x,ae as y};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-DkW27tQK.js";import{t}from"./friendlyAsk-BBdRZIar.js";import{n,t as r}from"./contentVault-xfUwSJ3i.js";var i={"15min":15,hourly:60,"6h":360,daily:1440,manual:1/0},a={daily:1440,weekly:10080,"on-change":1/0,manual:1/0};function o(e,t){return Number.isFinite(t)?e+t*6e4:2**53-1}function s(e){return e===`manual`?0:Math.round(43200/i[e])}function c(e,t){let n=e.window;if(n){if(t<n.startAt)return n.startAt;if(t>n.endAt)return 2**53-1}return o(t,i[e.data])}var l=`mavea-dash-opens-v1`,u=2592e6;function d(e){return!!e&&typeof e==`object`}function f(e,t){if(!d(e))return{};let n=t-u,r={};for(let[t,i]of Object.entries(e)){if(!t||!Array.isArray(i))continue;let e=i.filter(e=>typeof e==`number`&&Number.isFinite(e)&&e>=n).slice(-30);e.length&&(r[t]=e)}return r}var p;function ee(e){try{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(l);return t?f(JSON.parse(t),e):{}}catch{return{}}}function m(e=Date.now()){return p??=ee(e),p}function h(e){p=e;try{typeof localStorage<`u`&&localStorage.setItem(l,JSON.stringify(e))}catch{}}function te(e,t=Date.now()){if(!e)return;let n=m(t),r=[...n[e]??[],t].filter(e=>e>=t-u).slice(-30);h({...n,[e]:r})}function ne(e,t,n=Date.now()){return(m(n)[e]??[]).filter(e=>e>=t).length}function g(e){let t=m(),n={};for(let[r,i]of Object.entries(t))e.has(r)&&(n[r]=i);h(n)}var re=e({DASHBOARDS_EVENT:()=>v,DASHBOARDS_QUOTA_EVENT:()=>y,MAX_METRICS:()=>12,MAX_WIDGETS:()=>12,addDashboard:()=>K,addWidget:()=>Ce,appendSource:()=>De,applyRefreshResult:()=>He,blockToWidget:()=>J,clearDashboards:()=>be,clearOneShot:()=>Be,createBlankDashboard:()=>q,ensureFirstCheck:()=>Ie,foldInto:()=>ke,getDashboard:()=>G,getDashboards:()=>W,hasDroppedWrite:()=>C,invalidate:()=>R,markAiRefreshed:()=>Le,markDataRefreshed:()=>Pe,markDataRetry:()=>Fe,markVerdictFailed:()=>Ne,mergeDashboards:()=>ye,newDashboardId:()=>w,removeDashboard:()=>Z,removeWidget:()=>Se,reorderWidgets:()=>xe,setCadenceWindow:()=>Re,setOneShot:()=>ze,setVerdict:()=>Me,setWidgetOrder:()=>Te,setWidgetRefreshQuery:()=>we,setWidgetSpan:()=>Q,updateCadence:()=>X,updateDashboard:()=>Y,updateMetricValue:()=>$,updateTripwireStates:()=>je,whenDashboardsHydrated:()=>I}),_=`mavea-dashboards-v1`,v=_,y=`${_}:quota`,b=24,ie=12,ae=4096,oe=60,x=null,se=0,S=!1;function C(){return S}function w(){try{let e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID()}catch{}return se+=1,`dash-${se.toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}function ce(e){let t=JSON.stringify(e,(e,t)=>typeof t==`string`&&t.length>ae&&t.startsWith(`data:`)?``:t);return JSON.parse(t)}function T(e){return!!e&&typeof e==`object`}function E(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function D(e,t=``){return typeof e==`string`?e:t}function le(e){return e===`5min`?`15min`:D(e,`manual`)}function ue(e){if(!T(e))return null;let t=e.at,n=e.value;return typeof t!=`number`||!Number.isFinite(t)||typeof n!=`number`||!Number.isFinite(n)?null:{at:t,value:n}}function de(e){if(!T(e))return null;let t=(Array.isArray(e.history)?e.history:[]).map(ue).filter(e=>e!==null).slice(-60);return{...e,history:t.length?t:void 0}}function fe(e){if(!T(e))return;let t=e.startAt,n=e.endAt;if(!(typeof t!=`number`||!Number.isFinite(t))&&!(typeof n!=`number`||!Number.isFinite(n)||n<=t))return{label:D(e.label),startAt:t,endAt:n,origin:e.origin===`search`?`search`:`user`}}function pe(e){if(!(!T(e)||typeof e.text!=`string`||!e.text))return{text:e.text,at:E(e.at,0)}}function me(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!T(n)||typeof n.expected!=`string`||!n.expected)continue;let e=n.result;(e===`hit`||e===`miss`||e===`unclear`)&&t.push({at:E(n.at,0),expected:n.expected,result:e,...typeof n.note==`string`&&n.note?{note:n.note}:{}})}return t.slice(-20)}function O(e,t){if(!e.window||t<=e.window.endAt)return e;let{window:n,...r}=e;return r}var k=new Set([`thesis`,`alignmentgauge`,`standingalerts`,`sourceslineage`]);function he(e,t,n){let r=n||t;return r?e.map(e=>{if(e.refreshQuery?.trim()||e.metricId||k.has(e.block.type))return e;let t=e.block.props?.title,n=typeof t==`string`&&t.trim()?`${r} — ${t.trim()}`:r;return{...e,refreshQuery:n}}):e}function ge(e){if(!T(e))return null;let n=D(e.id);if(!n)return null;let r=T(e.thesis)?e.thesis:null,i=Array.isArray(e.widgets)?e.widgets.filter(e=>T(e)&&T(e.block)):[],a=T(e.cadence)?e.cadence:{},o=T(e.alerts)?e.alerts:{},s=_e(e.lastVerdict),c=D(e.title,`Untitled`),l=t(D(e.question)),u=fe(a.window),d=pe(e.prediction),f=me(e.predictionHistory);return{id:n,title:c,question:l,thesis:{text:D(r?.text),saidAt:E(r?.saidAt,0)},tripwires:Array.isArray(e.tripwires)?e.tripwires:[],metrics:Array.isArray(e.metrics)?e.metrics.map(de).filter(e=>e!==null):[],sources:Array.isArray(e.sources)?e.sources:[],widgets:he(i.slice(0,12),c,l),cadence:{data:le(a.data),ai:D(a.ai,`manual`),...u?{window:u}:{}},smartTrigger:typeof e.smartTrigger!=`boolean`||e.smartTrigger,alerts:{inApp:o.inApp!==!1,push:o.push===!0},...typeof e.topic==`string`&&e.topic?{topic:e.topic}:{},createdAt:E(e.createdAt,0),updatedAt:E(e.updatedAt,0),...typeof e.lastTouchedByUserAt==`number`&&Number.isFinite(e.lastTouchedByUserAt)?{lastTouchedByUserAt:e.lastTouchedByUserAt}:{},nextDataAt:E(e.nextDataAt,0),nextAiAt:E(e.nextAiAt,2**53-1),...typeof e.oneShotAt==`number`&&Number.isFinite(e.oneShotAt)?{oneShotAt:e.oneShotAt,oneShotLabel:D(e.oneShotLabel)}:{},...d?{prediction:d}:{},...f.length?{predictionHistory:f}:{},lastRefreshedAt:typeof e.lastRefreshedAt==`number`&&Number.isFinite(e.lastRefreshedAt)?e.lastRefreshedAt:null,...e.lastDataOutcome===`updated`||e.lastDataOutcome===`no-change`||e.lastDataOutcome===`unverified`?{lastDataOutcome:e.lastDataOutcome}:{},...s?{lastVerdict:s}:{},...typeof e.lastVerdictAttemptAt==`number`&&Number.isFinite(e.lastVerdictAttemptAt)?{lastVerdictAttemptAt:e.lastVerdictAttemptAt}:{},...typeof e.lastVerdictError==`string`&&e.lastVerdictError?{lastVerdictError:e.lastVerdictError}:{}}}function _e(e){return!T(e)||typeof e.text!=`string`||!e.text?null:{text:e.text,at:E(e.at,0),grounded:e.grounded===!0,...Array.isArray(e.sources)?{sources:e.sources}:{},...typeof e.tripwireId==`string`?{tripwireId:e.tripwireId}:{}}}var A=!1,j=0;function M(e){return Array.isArray(e)?e.map(ge).filter(e=>e!==null):[]}async function N(e){let t=++j;try{if(typeof localStorage>`u`)return;let r=await n(e);if(t!==j)return;localStorage.setItem(_,r)}catch(e){let t=e;if(t&&(t.name===`QuotaExceededError`||t.name===`NS_ERROR_DOM_QUOTA_REACHED`||t.code===22||t.code===1014)){S=!0;try{typeof window<`u`&&typeof CustomEvent==`function`&&window.dispatchEvent(new CustomEvent(y))}catch{}}}}function ve(){try{if(typeof localStorage>`u`)return[];let e=localStorage.getItem(_);if(!e)return[];let t=M(JSON.parse(e));return t.length&&N(t),t}catch{return[]}}async function P(){try{if(typeof localStorage>`u`)return;let e=localStorage.getItem(_);if(!e)return;try{JSON.parse(e);return}catch{}let t=M(await r(e));if(A)return;x=t,A=!0,typeof window<`u`&&typeof CustomEvent==`function`&&window.dispatchEvent(new CustomEvent(v,{detail:t}))}catch{}}var F=P();function I(){return F}function L(){return x??=ve(),x}function R(){let e=x;x=null,A=!1,F=P();try{if(typeof localStorage>`u`)return;let e=localStorage.getItem(_);if(!e)return;JSON.parse(e)}catch{x=e}}function z(e){return e.length<=b?e:[...e].sort((e,t)=>(t.lastTouchedByUserAt??t.updatedAt)-(e.lastTouchedByUserAt??e.updatedAt)).slice(0,b)}function B(e){let t=M(e);x=t,A=!0,N(t);try{typeof window<`u`&&typeof CustomEvent==`function`&&window.dispatchEvent(new CustomEvent(v,{detail:t}))}catch{}}function V(e,t,n=Date.now(),r={}){let i=!1,a=L().map(a=>a.id===e?(i=!0,{...t(a),updatedAt:n,...r.userTouch?{lastTouchedByUserAt:n}:{}}):a);i&&B(a)}var H=null,U=null;function W(){let e=L();return(U!==e||H===null)&&(H=[...e].sort((e,t)=>(t.lastTouchedByUserAt??t.createdAt)-(e.lastTouchedByUserAt??e.createdAt)),U=e),H}function G(e){return L().find(t=>t.id===e)??null}function K(e){B(z([ce({...e,lastTouchedByUserAt:e.lastTouchedByUserAt??e.updatedAt}),...L().filter(t=>t.id!==e.id)]))}function ye(e){let t=M(e);if(!t.length)return 0;let n=new Map(L().map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||e.updatedAt>=t.updatedAt)&&n.set(e.id,e)}return B(z([...n.values()])),t.length}function q(e){let t=e.now??Date.now();return{id:w(),title:e.title||`Untitled dashboard`,question:e.question??``,thesis:{text:``,saidAt:t},tripwires:[],metrics:[],sources:[{kind:`ORIGIN`,conversationId:`pin`,title:e.title||`Pinned cards`,contributed:`Started by pinning a card.`,at:t}],widgets:[],cadence:{data:`manual`,ai:`manual`},smartTrigger:!1,alerts:{inApp:!0,push:!1},...e.topic?{topic:e.topic}:{},createdAt:t,updatedAt:t,nextDataAt:2**53-1,nextAiAt:2**53-1,lastRefreshedAt:null}}function J(e,t=`pin`,n){let r=new Set([`chart`,`plot`,`dualaxis`,`bars`,`timeline`,`breakdown`,`table`]);return{id:`w-pin-`+Math.random().toString(36).slice(2,9),block:e,span:r.has(e.type)?2:1,fromSource:t,...n?.trim()?{refreshQuery:n.trim()}:{}}}function Y(e,t){V(e,e=>({...e,...t}),void 0,{userTouch:!0})}function X(e,t,n=Date.now()){V(e,e=>{let r={...e.cadence,...t};return{...e,cadence:r,...t.data===void 0?{}:{nextDataAt:c(r,n)},...t.ai===void 0?{}:{nextAiAt:o(n,a[r.ai])}}},n,{userTouch:!0})}function Z(e){let t=L().filter(t=>t.id!==e);t.length!==L().length&&(B(t),g(new Set(t.map(e=>e.id))))}function be(){L().length!==0&&(B([]),g(new Set))}function xe(e,t,n){V(e,e=>{let r=[...e.widgets];if(t<0||t>=r.length||n<0||n>=r.length)return e;let[i]=r.splice(t,1);return r.splice(n,0,i),{...e,widgets:r}},void 0,{userTouch:!0})}function Q(e,t,n){V(e,e=>({...e,widgets:e.widgets.map(e=>e.id===t?{...e,span:n}:e)}),void 0,{userTouch:!0})}function Se(e,t){V(e,e=>({...e,widgets:e.widgets.filter(e=>e.id!==t)}),void 0,{userTouch:!0})}function Ce(e,t,n={}){let r=Array.isArray(t)?t:[t];r.length!==0&&V(e,e=>{let t=Math.max(0,Math.min(n.at??e.widgets.length,e.widgets.length)),i=[...e.widgets.slice(0,t),...r,...e.widgets.slice(t)],a=i;if(i.length>12){let e=i.filter(e=>!k.has(e.block.type)),t=i.length-12;if(e.length>=t){let n=new Set(e.slice(-t).map(e=>e.id));a=i.filter(e=>!n.has(e.id))}else a=i.slice(0,12)}return{...e,widgets:a,...n.source?{sources:[...e.sources,n.source].slice(-Ee)}:{}}},void 0,{userTouch:!0})}function we(e,t,n){let r=n.trim();if(!r||t.length===0)return;let i=new Set(t);V(e,e=>({...e,widgets:e.widgets.map(e=>i.has(e.id)?{...e,refreshQuery:r}:e)}))}function Te(e,t){V(e,e=>{let n=new Map(e.widgets.map(e=>[e.id,e])),r=t.map(e=>n.get(e)).filter(e=>!!e),i=new Set(r.map(e=>e.id)),a=e.widgets.filter(e=>!i.has(e.id));return{...e,widgets:[...r,...a]}},void 0,{userTouch:!0})}var Ee=24;function De(e,t){V(e,e=>({...e,sources:[...e.sources,t].slice(-24)}),void 0,{userTouch:!0})}var Oe=12;function ke(e,t){V(e,e=>({...e,metrics:[...e.metrics,...t.metrics].slice(0,12),tripwires:[...e.tripwires,...t.tripwires].slice(0,12),widgets:[...e.widgets,...t.widgets].slice(0,12),sources:[...e.sources,t.source].slice(-24)}),void 0,{userTouch:!0})}function Ae(e,t,n){if(n===null)return e;let r=[...e??[],{at:t,value:n}];return r.length>oe?r.slice(-60):r}function $(e,t,n,r,i,a=Date.now()){V(e,e=>({...e,metrics:e.metrics.map(e=>e.id===t?{...e,lastValue:n,lastRaw:r,origin:i,asOf:a,history:Ae(e.history,a,n)}:e)}),a,{userTouch:i===`user`})}function je(e,t,n=Date.now()){V(e,e=>({...e,tripwires:t}),n)}function Me(e,t,n=Date.now()){V(e,e=>({...e,lastVerdict:t,lastVerdictAttemptAt:n,lastVerdictError:void 0}),n)}function Ne(e,t,n){V(e,e=>({...e,lastVerdictAttemptAt:t,lastVerdictError:n}),t)}function Pe(e,t=Date.now(),n=`updated`){V(e,e=>{let r=O(e.cadence,t);return{...e,cadence:r,nextDataAt:c(r,t),lastRefreshedAt:t,lastDataOutcome:n}})}function Fe(e,t){V(e,e=>({...e,nextDataAt:t,...e.oneShotAt!==void 0&&e.oneShotAt<t?{oneShotAt:t}:{}}))}function Ie(e,t=Date.now()){V(e,e=>e.oneShotAt===void 0?{...e,oneShotAt:t,oneShotLabel:`first check`}:e)}function Le(e,t=Date.now()){V(e,e=>({...e,nextAiAt:o(t,a[e.cadence.ai])}))}function Re(e,t,n=Date.now()){V(e,e=>{let r=t?{...e.cadence,window:t}:{...e.cadence,window:void 0};return{...e,cadence:r,nextDataAt:c(r,n)}},n,{userTouch:t?.origin===`user`})}function ze(e,t,n,r=Date.now()){V(e,e=>({...e,oneShotAt:t,oneShotLabel:n}),r,{userTouch:!0})}function Be(e,t=Date.now()){V(e,e=>({...e,oneShotAt:void 0,oneShotLabel:void 0}),t)}var Ve=3e5;function He(e,t,n=Date.now()){V(e,e=>{let r=new Map((t.values??[]).map(e=>[e.metricId,e])),i=new Map((t.blocks??[]).map(e=>[e.widgetId,e.block])),a=e.prediction,o=e.predictionHistory;if(t.grade&&a){let e={at:n,expected:a.text,result:t.grade.result,...t.grade.note?{note:t.grade.note}:{}};o=[...o??[],e].slice(-20),a=void 0}t.expects?.trim()&&(a={text:t.expects.trim(),at:n});let s=O(e.cadence,n),l=c(s,n),u=t.outcome===`unverified`&&e.lastDataOutcome!==`unverified`&&l!==2**53-1&&(!s.window||n>=s.window.startAt)?Math.min(l,n+Ve):l;return{...e,cadence:s,metrics:e.metrics.map(e=>{let t=r.get(e.id);return t?{...e,lastValue:t.value,lastRaw:t.raw,origin:t.origin,asOf:n,history:Ae(e.history,n,t.value)}:e}),widgets:e.widgets.map(e=>{let t=i.get(e.id);return t?{...e,block:t}:e}),...t.tripwires?{tripwires:t.tripwires}:{},...t.consumedOneShot?{oneShotAt:void 0,oneShotLabel:void 0}:{},nextDataAt:u,lastRefreshedAt:n,lastDataOutcome:t.outcome,prediction:a,predictionHistory:o}},n)}export{X as A,c as B,Se as C,we as D,Te as E,ne as F,te as I,a as L,$ as M,je as N,Q as O,I as P,i as R,Z as S,Me as T,o as V,Le as _,K as a,ye as b,J as c,Ie as d,ke as f,R as g,C as h,ie as i,Y as j,re as k,Be as l,W as m,y as n,Ce as o,G as p,Oe as r,He as s,v as t,q as u,Fe as v,Re as w,w as x,Ne as y,s as z};
@@ -1 +0,0 @@
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";var r=e(),i=n(),a=200,o=40,s=3;function c({points:e,tone:t=`flat`}){let n=(0,r.useId)();if(e.length<2)return null;let c=e.map(e=>e.value),l=Math.min(...c),u=Math.max(...c)-l||1,d=194/(e.length-1),f=e.map((e,t)=>({x:s+t*d,y:s+(1-(e.value-l)/u)*34})),p=f.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),m=f[0],h=`${p} L${f[f.length-1].x.toFixed(1)},37 L${m.x.toFixed(1)},37 Z`,g=t===`up`?`var(--insight)`:t===`down`?`var(--danger)`:`var(--text-secondary)`;return(0,i.jsxs)(`svg`,{className:`tile-viz-svg`,viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:`none`,role:`presentation`,children:[(0,i.jsx)(`defs`,{children:(0,i.jsxs)(`linearGradient`,{id:n,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:g,stopOpacity:`0.35`}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:g,stopOpacity:`0`})]})}),(0,i.jsx)(`path`,{d:h,fill:`url(#${n})`,stroke:`none`}),(0,i.jsx)(`path`,{d:p,fill:`none`,stroke:g,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})}var l=t();function u(e){if(e<=0)return`due now`;let t=Math.round(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;if(n<24)return r?`${n}h ${r}m`:`${n}h`;let i=Math.floor(n/24),a=n%24;return a?`${i}d ${a}h`:`${i}d`}function d(e){let t=(0,l.c)(9),{targetAt:n,now:r,label:a}=e,o=n-r,s;t[0]===o?s=t[1]:(s=u(o),t[0]=o,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,i.jsx)(`span`,{className:`tile-countdown-value`,children:s}),t[2]=s,t[3]=c);let d;t[4]===a?d=t[5]:(d=a&&(0,i.jsx)(`span`,{className:`tile-countdown-label`,children:a}),t[4]=a,t[5]=d);let f;return t[6]!==c||t[7]!==d?(f=(0,i.jsxs)(`div`,{className:`tile-countdown`,children:[c,d]}),t[6]=c,t[7]=d,t[8]=f):f=t[8],f}export{c as n,d as t};
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/liveSchema-B4bQtO88.js","assets/icons-gLFQTv74.js","assets/jsx-runtime-DeHZSEgm.js","assets/rolldown-runtime-DkW27tQK.js","assets/spokenText-C88IQJ0M.js","assets/safeImageUrl-BINWXOTz.js","assets/catalog-BHjl-1uH.js","assets/sourceHost-BV3t2XDb.js","assets/annotations-CftUUB13.js","assets/catalog-Db9GWM6N.js","assets/preload-helper-CiWYd9n-.js","assets/facts-BUGuVUIc.js","assets/blockTypes-DUDdP3pB.js","assets/streamParse-B-Gjwa9T.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-DkW27tQK.js";import{t}from"./react-BZJXY1be.js";import{t as n}from"./compiler-runtime-qQQXpJgv.js";import{n as r,t as i}from"./preload-helper-CiWYd9n-.js";import{i as a,t as o}from"./http-Lar_UMKb.js";import{F as s,N as c,T as l,_ as u,m as d,p as f,s as p,v as m,y as h}from"./store-B39HvB_l.js";import{t as g}from"./providers-B2OCzEo1.js";import{l as _,n as v}from"./useLiveConfig-DWz7BRdk.js";import{t as y}from"./json-B0N3XRZU.js";import{n as ee}from"./number-Bmf7DqLj.js";import{i as b,n as x,r as S}from"./ledger-Cv0LBflx.js";import{i as C,r as w,t as T}from"./dataPending-lZUzUEo6.js";import{c as te,i as E}from"./format-rPI6ZwwH.js";import{t as D}from"./now-C9-UAzTC.js";import{n as ne,t as re}from"./predictions-CkVKHq-5.js";import{t as O}from"./notify-Bz4wuE4T.js";import{a as k,i as A,r as ie,t as j,u as ae}from"./dashboardEvents-D-wLCp1A.js";var M=t(),oe=n();function se(e){return new Set(e.toLowerCase().replace(/[^a-z0-9 ]/g,` `).replace(/\s+/g,` `).trim().split(` `).filter(e=>e.length>3))}function N(e){return e.replace(/\s+/g,` `).trim().toLowerCase()}r();function ce(e,t,n,r){switch(e){case`gt`:return t>r;case`gte`:return t>=r;case`lt`:return t<r;case`lte`:return t<=r;case`crosses_up`:return n!==null&&n<r&&t>=r;case`crosses_down`:return n!==null&&n>r&&t<=r;case`pct_rise`:return n!==null&&n!==0&&(t-n)/Math.abs(n)*100>=r;case`pct_drop`:return n!==null&&n!==0&&(n-t)/Math.abs(n)*100>=r;default:return!1}}function le(e,t,n){if(n===0)return!0;let r=t/n;switch(e){case`gt`:case`gte`:return r>=.9;case`lt`:case`lte`:return r<=1.1;default:return!0}}function ue(e,t,n){return t===null?`AWAITING`:ce(e.comparator,t,n,e.threshold)?`TRIGGERED`:le(e.comparator,t,e.threshold)?`WATCHING`:`CLEAR`}function P(e,t={}){let n=new Map(e.metrics.map(e=>[e.id,e])),r=[];return{tripwires:e.tripwires.map(e=>{let i=n.get(e.metricId),a=i?i.lastValue:null,o=ue(e,a,e.metricId in t?t[e.metricId]:a),s=o===`TRIGGERED`&&e.state!==`TRIGGERED`?{...e,state:o,brokenValue:a??void 0,brokenAt:i?.asOf}:{...e,state:o};return o===`TRIGGERED`&&e.state!==`TRIGGERED`&&r.push(s),s}),newlyTriggered:r}}function de(e,t){return e.nextDataAt<=t||e.oneShotAt!==void 0&&e.oneShotAt<=t}function F(e){return e.oneShotAt===void 0?e.nextDataAt:Math.min(e.nextDataAt,e.oneShotAt)}function fe(e,t=Date.now(),n=4){return e.filter(e=>de(e,t)).sort((e,t)=>F(e)-F(t)).slice(0,n)}function pe(e,t=Date.now()){return e.filter(e=>e.nextAiAt<=t).sort((e,t)=>e.nextAiAt-t.nextAiAt)[0]??null}function I(e,t,n=Date.now()){return e.smartTrigger&&t.length>0?{fire:!0,trigger:t[0]}:(e.cadence.ai===`daily`||e.cadence.ai===`weekly`)&&n>=e.nextAiAt?{fire:!0,trigger:`scheduled`}:{fire:!1,trigger:null}}function L(e){let t=[];for(let n of o(e.sources)){let e=a(n);typeof e.title==`string`&&typeof e.url==`string`&&t.push({title:e.title,url:e.url})}return t}function me(e,t){return(e.sources?.length??0)>0||L(t).length>0}function he(e){return`- VALUE "${e.label}" — ${e.query}`}function ge(e,t,n){return`- BLOCK #${t} [${e.block.type}] ${e.refreshQuery}\n`+(n?` expected props (use EXACTLY these field names): ${n}\n`:``)+` current content: ${JSON.stringify(e.block.props??{}).slice(0,600)}`}function R(){return{values:{},widgets:{}}}function _e(e){return{metrics:e.metrics.filter(e=>e.query.trim()!==``&&!e.blankKey),targets:e.widgets.filter(e=>!!e.refreshQuery?.trim())}}function z(e){let t=[e.block.type];if(e.block.type===`composite`){let n=e.block.props.regions;for(let e of n??[]){let n=e?.block?.type;typeof n==`string`&&n&&t.push(n)}}return t}function B(e,t,n){return 400+t.length*120+n.length*1200+(e.prediction?150:0)}var ve=12e3;function V(e){let t=[],n=1200;for(let r of e){let{metrics:e,targets:i}=_e(r);if(e.length===0&&i.length===0)continue;let a=B(r,e,i);if(t.length>0&&n+a>ve)break;n+=a,t.push({d:r,metrics:e,targets:i})}return t}function ye(e,t){let n=Math.max(0,Math.round((t-e)/6e4));if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function be(e,t,n){let r=[...e.metrics.map(he),...e.targets.map((e,t)=>ge(e,t,n(e.block.type))),...e.d.prediction?[`- PREVIOUS EXPECTATION (made ${ye(e.d.prediction.at,t)}): "${e.d.prediction.text}" — grade it.`]:[]];return`DASHBOARD ${e.d.id} "${e.d.title}"\n${r.join(`
3
- `)}`}function xe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Se(e,t){let n=e.dashboards;if(n===void 0&&t.length===1)return{[t[0].d.id]:e};let r=new Map,i=[];if(Array.isArray(n))for(let e of n){let t=a(e);i.push(t),typeof t.id==`string`&&t.id&&r.set(t.id,t)}else if(xe(n))for(let[e,t]of Object.entries(n))r.set(e,a(t));let o={};return t.forEach((e,t)=>{o[e.d.id]=r.get(e.d.id)??i[t]??{}}),o}function Ce(e){let t=a(e);if(typeof t.metricLabel!=`string`||!t.metricLabel.trim())return;let n=o(t.readings).filter(e=>typeof e==`string`&&!!e.trim());if(!(n.length<2))return{metricLabel:t.metricLabel.trim(),readings:n,note:typeof t.note==`string`?t.note.trim().slice(0,200):``}}function we(e){let t=a(e),n=typeof t.start==`string`?Date.parse(t.start):NaN,r=typeof t.end==`string`?Date.parse(t.end):NaN;if(!(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)&&!(r-n>6048e5))return{startAt:n,endAt:r,label:typeof t.label==`string`?t.label.trim().slice(0,60):``}}var Te=` YOUR PREVIOUS ATTEMPT DID NOT ACTUALLY SEARCH (no citations came back). Before answering this time, you MUST run a real web search for every DASHBOARD section above and report only what those searches returned, listing the real URLs relied on in "sources" — this is not optional. If search is genuinely unavailable or turns up nothing, return null values and omit "sources" entirely; never invent a value or a source just to satisfy this instruction.`;async function H(e,t,n={}){let r=Date.now(),s={ok:!0,grounded:!1,perDashboard:{},sources:[],attempts:0};if(e.length===0&&!n.briefingContext)return s;try{let s=g(t.provider),c=new Set(e.flatMap(e=>e.targets.flatMap(z))),l=c.size>0,u=l?await i(()=>import(`./liveSchema-B4bQtO88.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])):null,d=e.map(e=>be(e,r,u?u.blockShapeHint:()=>null)).join(`
4
-
5
- `),f={type:`object`,properties:{dashboards:{type:`array`,description:`One object per DASHBOARD section above, in the same order, each echoing its id.`,items:{type:`object`,properties:{id:{type:`string`},values:{type:`object`,description:`Map of VALUE label -> current numeric value, or null.`},blocks:{type:`array`,description:`Exactly one block per BLOCK item for this dashboard, in order.`,items:{type:`object`,properties:{type:{type:`string`},props:{type:`object`}},required:[`type`,`props`]}},expects:{type:`string`,description:`A short "by next check" expectation — omit if nothing here is genuinely predictable.`},grade:{type:`object`,description:`ONLY when this dashboard has a PREVIOUS EXPECTATION line.`,properties:{result:{type:`string`},note:{type:`string`}}},disagreement:{type:`object`,description:`ONLY when two real sources genuinely disagreed on a value.`,properties:{metricLabel:{type:`string`},readings:{type:`array`,items:{type:`string`}},note:{type:`string`}}},liveWindow:{type:`object`,description:`ONLY when search revealed a real, bounded live-event window.`,properties:{start:{type:`string`},end:{type:`string`},label:{type:`string`}}}},required:[`id`]}},...n.briefingContext?{briefing:{type:`string`,description:`2-4 sentences summarizing ALL dashboards (this batch + the given CONTEXT), real values only; use [[shown|said]] pronunciation twins for speech-risky terms.`}}:{},sources:{type:`array`,description:`OMIT unless this call used web search. Real source URLs actually relied on — never invented.`,items:{type:`object`,properties:{title:{type:`string`},url:{type:`string`}},required:[`title`,`url`]}}},required:[`dashboards`]},p=Math.min(14e3,Math.max(3e3,1200+e.reduce((e,t)=>e+B(t.d,t.metrics,t.targets),0)+(n.briefingContext?700:0))),m=D()+` You are checking several standing trackers at once. Return ONLY JSON: {"dashboards": [{"id": string, "values": {...}, "blocks": [...], "expects"?: string, "grade"?: {...}, "disagreement"?: {...}, "liveWindow"?: {...}}, ...], `+(n.briefingContext?`"briefing": string, `:``)+`"sources": [...]}. Use web search for every DASHBOARD section below — never invent a value or detail. ECHO each dashboard's exact "id" so results map back correctly. For a VALUE item, give its CURRENT real number (no units) or null if unverifiable. For a BLOCK item, produce exactly one block whose "type" is the EXACT bracketed type given — never substitute a different one — matching its current content for detail level (real names, numbers, dates). Where a BLOCK lists "expected props", copy that shape EXACTLY: the same field names, and an array shown as string[] takes plain strings, never objects. CRITICAL — a "current content" showing something live, in progress, or upcoming is NOT necessarily still true right now: explicitly check whether it has SINCE concluded and report the concluding outcome if so, reasoning from the date/time above which of upcoming/live/finished applies at this exact moment. If a dashboard has a PREVIOUS EXPECTATION line, grade it honestly ("hit" it came true, "miss" it did not, "unclear" if genuinely unknowable yet) — grade ONLY dashboards that have this line, never invent a grade otherwise. Offer a fresh "expects" only when something is genuinely predictable by the next check; most checks have nothing worth predicting, so omit it far more often than not. If two real sources genuinely disagree on a value, report it in "disagreement" instead of silently picking one. If search reveals a real bounded live-event window (a match's actual start/end time) for a dashboard, report it in "liveWindow" with ISO start/end — never invent a time. `+(n.briefingContext?`Also compose "briefing": 2-4 warm, concrete sentences summarizing ALL dashboards — this batch PLUS the CONTEXT lines below (already-known values — do NOT search for those, use them as given) — real values only, never memory. The briefing is displayed and spoken: preserve normal spelling on the left, but wrap every name, place, brand, or non-English term a voice might mispronounce as [[shown|said]] (for example [[Omakase|oh-mah-kah-seh]]). The said side must be lowercase voice-safe syllables matching a native/source-language pronunciation, never IPA or an Anglicized guess. `:``)+`If search genuinely turns up nothing more specific than what is already shown, say so honestly rather than inventing new specifics or repeating the old ones as if just confirmed. CITE SOURCES — every real URL actually relied on, in "sources"; omit it entirely if you used no search.`,h=`Use web search.\n\n${d}`+(n.briefingContext?`\n\nCONTEXT (already known — do not search these):\n${n.briefingContext}`:``),_=e=>s.generate({system:e?m+Te:m,history:[],user:h,maxTokens:p,temperature:.15,thinkingLevel:e?`high`:`low`,tools:{webSearch:!0},format:f,...l?{blockTypes:[...c],complexity:`brief`}:{}},t).then(e=>({rr:e,grounded:me(e,a(y(e.raw)))})),v=await _(!1),b=1;!v.grounded&&e.length>0&&(v=await _(!0),b=2);let{rr:x}=v,S=a(y(x.raw)),C=me(x,S),w=Se(S,e),T=u?u.validateLiveResponse:null,E={};for(let t of e){let e=w[t.d.id]??{},n=R();if(C&&t.metrics.length>0){let r=a(e.values),i=new Map(Object.entries(r).map(([e,t])=>[N(e),t]));for(let e of t.metrics){let t=ee(r[e.label]??i.get(N(e.label)));t!==null&&(n.values[e.id]={value:t,raw:te(String(t),e.unit)})}}if(t.targets.length>0&&T){let r=o(e.blocks);t.targets.forEach((e,t)=>{let i=r[t];if(!i)return;let a=T({narration:``,title:`x`,sub:``,blocks:[i]},new Set(z(e)),1,C,!0)?.blocks[0];a&&a.type===e.block.type&&(n.widgets[e.id]=a)})}if(C){let r=re(e.expects);if(r&&(n.expects=r),t.d.prediction){let t=ne(e.grade);t&&(n.grade=t)}let i=Ce(e.disagreement);i&&(n.disagreement=i);let a=we(e.liveWindow);a&&(n.liveWindow=a)}E[t.d.id]=n}Object.values(E).every(e=>Object.keys(e.values).length===0&&Object.keys(e.widgets).length===0&&!e.expects)&&console.warn(`[dashboards] refreshDashboards got a response but nothing parsed out of it for any dashboard (${C?`empty/unparseable`:`ungrounded after ${b} attempt${b>1?`s`:``}, discarded`})`,{dashboardIds:e.map(e=>e.d.id),raw:x.raw});let O=n.briefingContext&&C&&typeof S.briefing==`string`&&S.briefing.trim()?S.briefing.trim():void 0;return{ok:!0,grounded:C,perDashboard:E,sources:x.sources&&x.sources.length?x.sources:L(S),attempts:b,...O?{briefing:O}:{}}}catch(t){console.error(`[dashboards] refreshDashboards failed`,t);let n={};for(let t of e)n[t.d.id]=R();return{ok:!1,grounded:!1,perDashboard:n,sources:[],attempts:0}}}function Ee(e){let t=Array.isArray(e?.sources)?e.sources:[],n=[];for(let e of t){let t=e&&typeof e==`object`?e:{};typeof t.title==`string`&&typeof t.url==`string`&&n.push({title:t.title,url:t.url})}return n}function De(e){try{let t=typeof e==`string`?JSON.parse(Oe(e)):e,n=t?.verdict;return{text:typeof n==`string`&&n.trim()?n.trim():null,sources:Ee(t)}}catch{return{text:typeof e==`string`&&e.trim()?e.trim():null,sources:[]}}}function Oe(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`);return t>=0&&n>t?e.slice(t,n+1):e}async function U(e,t,n,r=Date.now()){try{let i=g(n.provider),a=t===`scheduled`?null:t,o=a?e.metrics.find(e=>e.id===a.metricId):void 0,s=e.metrics.map(e=>`${e.label}=${e.lastRaw??`—`}`).join(`, `),c=a?`A line the user set just crossed: "${a.label}" — ${o?.label??a.label} is now ${o?.lastRaw??a.brokenValue??`past the threshold`}. Currently tracked: ${s}. Using web search, say briefly and honestly what the latest numbers show and whether this reads as a real move or just noise.`:`Currently tracked: ${s}. Using web search, give a brief, honest read: what the latest numbers show and what has materially changed since the last check.`,l=await i.generate({system:D()+` You give a brief, honest read on the latest numbers a user is tracking: what they show now, what has materially changed since the last check, and — if a specific line was crossed — whether that looks like a real move or noise. One or two plain sentences. Never invent data. CITE YOUR SOURCES — whenever you used web search, include the exact source URLs you actually relied on as a top-level "sources": [{"title": string, "url": string}] array; only real URLs from the search results — never invent one, and omit "sources" entirely if you didn’t search. Return ONLY JSON: {"verdict":"…","sources":[...]}.`,history:[],user:c,maxTokens:700,temperature:.3,thinkingLevel:`low`,tools:{webSearch:!0}},n),{text:u,sources:d}=De(l.raw);return u?{text:u,at:r,grounded:(l.sources?.length??0)>0||d.length>0,...l.sources&&l.sources.length?{sources:l.sources}:{},...a?{tripwireId:a.id}:{}}:null}catch(e){return console.error(`[dashboards] analyzeMove failed`,e),null}}function W(e){let t=(e??[]).slice(-3);if(t.length<3)return 0;let[n,r,i]=t;return n.value<r.value&&r.value<i.value?1:n.value>r.value&&r.value>i.value?-1:0}function ke(e){let t=e.metrics.filter(e=>(e.history?.length??0)>=3);for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){let i=t[n],a=t[r],o=W(i.history);if(o!==0&&o===W(a.history))return{text:`${i.label} and ${a.label} have moved together over the last three checks.`,dashboardIds:[e.id]}}return null}function Ae(e,t){let n=e.filter(e=>{let n=e.cadence.window;return!!n&&t>=n.startAt&&t<=n.endAt});if(n.length<2)return null;let[r,i]=n;return{text:`${r.title} and ${i.title} overlap right now — their checks are batched into shared searches while both are live.`,dashboardIds:[r.id,i.id]}}var G=5;function je(e){if(e.cadence.data!==`15min`&&e.cadence.data!==`hourly`)return null;let t=e.metrics.find(e=>(e.history?.length??0)>=G);if(!t?.history)return null;let n=t.history.slice(-5);return n.every(e=>e.value===n[0].value)?{text:`${t.label} hasn't moved across ${e.title}'s last ${G} checks.`,dashboardIds:[e.id]}:null}function Me(e,t){let n=t.note?` ${t.note}`:``;return{text:`Sources disagreed on ${t.metricLabel}: ${t.readings.join(` vs `)}.${n}`,dashboardIds:[e.id]}}var Ne=432e5;function Pe(e,t,n){let r=n-Ne;return e.some(e=>e.kind===`insight`&&e.at>=r&&e.text===t.text)}function Fe(e,t,n,r=2){let i=[],a=Ae(e,n);a&&i.push(a);for(let t of e){let e=ke(t);e&&i.push(e);let n=je(t);n&&i.push(n)}return i.filter(e=>!Pe(t,e,n)).slice(0,r)}var Ie=e({checkAllDashboardsNow:()=>qe,readDashboardNow:()=>Je,refreshDashboardNow:()=>Ke,runRefreshBatch:()=>$,selectTickTargets:()=>Ye,useDashboardLoop:()=>Xe,useVerdictPending:()=>X}),Le=15e3,Re=3e5,K=new Set,q=new Set,J=`mavea-dashboard-verdict-pending`;function Y(e,t){t?q.add(e):q.delete(e);try{typeof window<`u`&&typeof CustomEvent==`function`&&window.dispatchEvent(new CustomEvent(J,{detail:e}))}catch{}}function ze(e){return window.addEventListener(J,e),()=>window.removeEventListener(J,e)}function X(e){let t=(0,oe.c)(2),n;return t[0]===e?n=t[1]:(n=()=>q.has(e),t[0]=e,t[1]=n),(0,M.useSyncExternalStore)(ze,n,Be)}function Be(){return!1}function Ve(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function He(e,t){return e.map(e=>{let n=t.perDashboard[e.d.id]??{values:{},widgets:{}},r=e.metrics.find(e=>n.values[e.id]);return r?`${e.d.title} at ${n.values[r.id].raw}`:e.targets.some(e=>n.widgets[e.id])?`${e.d.title} updated`:t.grounded?`${e.d.title} checked`:`${e.d.title} — couldn't verify`}).join(` · `)}var Z=`Daily search budget reached — auto-checks paused until midnight. Manual checks still work.`;function Ue(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function We(e){let t=Ue(e);b().some(e=>e.kind===`savings`&&e.at>=t&&e.text===Z)||x({kind:`savings`,text:Z,dashboardIds:[],searches:0})}async function Q(e,t,n,r,i,a,o=!1){let{d:s}=e,c=Object.keys(t.values).length>0||Object.keys(t.widgets).length>0?`updated`:o?`unverified`:`no-change`,d=s.metrics.map(e=>{let n=t.values[e.id];return n?{...e,lastValue:n.value}:e}),f={...s,metrics:d},{tripwires:m,newlyTriggered:g}=P(f,n),_=s.oneShotAt!==void 0&&s.oneShotAt<=a;p(s.id,{values:Object.entries(t.values).map(([e,t])=>({metricId:e,value:t.value,raw:t.raw,origin:`search`})),blocks:Object.entries(t.widgets).map(([e,t])=>({widgetId:e,block:t})),tripwires:m,outcome:c,...t.expects?{expects:t.expects}:{},...t.grade?{grade:t.grade}:{},..._?{consumedOneShot:!0}:{}},a),g.length&&(O(f,g),x({kind:`alert`,text:`${g.map(e=>e.label).join(`, `)} crossed the line you set.`,dashboardIds:[s.id],searches:0}),f.alerts.inApp&&j({dashboardId:s.id,dashboardTitle:s.title,tripwireLabel:g[0].label})),t.disagreement&&x({kind:`insight`,text:Me(s,t.disagreement).text,dashboardIds:[s.id],searches:0});let v={...s,tripwires:m},y=I(v,g,a);if(y.fire&&y.trigger&&i){Y(s.id,!0);let e=await U(v,y.trigger,r,a);Y(s.id,!1),e?l(s.id,e,a):h(s.id,a,`Mavéa couldn't get a fresh read — will try again.`),u(s.id,a),x({kind:y.trigger===`scheduled`?`check`:`alert`,text:e?e.text.slice(0,200):`Couldn't get a fresh read on ${s.title}.`,dashboardIds:[s.id],searches:1,...e?.sources?.length?{sourceCount:e.sources.length}:{}})}else y.fire&&y.trigger&&u(s.id,a);return c}async function $(e,t,n,r={}){let i=Date.now(),a={},o=V(e),s=e.filter(e=>!o.some(t=>t.d.id===e.id)),c={};for(let t of e)c[t.id]=Object.fromEntries(t.metrics.map(e=>[e.id,e.lastValue]));for(let e of s)a[e.id]=await Q({d:e,metrics:[],targets:[]},{values:{},widgets:{}},c[e.id],t,n,i);if(o.length===0||!n)return a;let l=o.map(e=>e.d.id);T(l,!0);try{let e=await H(o,t,r.briefing?{briefingContext:r.briefing.context}:{});if(!e.ok){for(let e of o)m(e.d.id,i+Re),a[e.d.id]=`failed`;return a}for(let r of o){let o=e.perDashboard[r.d.id]??{values:{},widgets:{}};a[r.d.id]=await Q(r,o,c[r.d.id],t,n,i,!e.grounded)}r.briefing&&e.briefing&&(k(e.briefing,r.briefing.allDashboards,i),x({kind:`briefing`,text:`Morning briefing compiled — folded into this batched search.`,dashboardIds:o.map(e=>e.d.id),searches:0}));let s=[...new Set(e.sources.map(e=>Ve(e.url)))].filter(Boolean);return x({kind:`check`,text:He(o,e),dashboardIds:o.map(e=>e.d.id),...s.length?{domains:s}:{},searches:1,...e.sources.length?{sourceCount:e.sources.length}:{},...r.manual?{manual:!0}:{}}),a}finally{T(l,!1)}}async function Ge(e,t,n,r){let{tripwires:i,newlyTriggered:a}=P(e);c(e.id,i,r),a.length&&(O(e,a),e.alerts.inApp&&j({dashboardId:e.id,dashboardTitle:e.title,tripwireLabel:a[0].label}));let o={...e,tripwires:i},s=I(o,a,r);if(!s.fire||!s.trigger||!n)return;Y(e.id,!0);let d=await U(o,s.trigger,t,r);Y(e.id,!1),d?l(e.id,d,r):h(e.id,r,`Mavéa couldn't get a fresh read — will try again.`),u(e.id,r),x({kind:s.trigger===`scheduled`?`check`:`alert`,text:d?d.text.slice(0,200):`Couldn't get a fresh read on ${e.title}.`,dashboardIds:[e.id],searches:1,...d?.sources?.length?{sourceCount:d.sources.length}:{}})}async function Ke(e){if(K.has(e))return`busy`;let t=f(e);if(!t)return`busy`;let n=_(v());if(!n.apiKey)return`no-model`;K.add(e);try{let r=await $([t],n,!0,{manual:!0});return r[e]===`failed`?`failed`:r[e]===`unverified`?`unverified`:`done`}finally{K.delete(e)}}async function qe(){let e=_(v());if(!e.apiKey)return`no-model`;let t=d().filter(E),n=t.filter(e=>!K.has(e.id));if(n.length===0)return t.length>0?`busy`:`done`;for(;n.length>0;){let t=V(n);if(t.length===0)break;let r=t.map(e=>e.d.id);r.forEach(e=>K.add(e));try{await $(t.map(e=>e.d),e,!0,{manual:!0})}finally{r.forEach(e=>K.delete(e))}n=n.filter(e=>!r.includes(e.id))}return`done`}async function Je(e){if(q.has(e))return`busy`;let t=f(e);if(!t)return`failed`;let n=_(v());if(!n.apiKey)return`no-model`;let r=Date.now(),i=t.tripwires.find(e=>e.state===`TRIGGERED`),a=i??`scheduled`;Y(e,!0);let o;try{o=await U(t,a,n,r)}finally{Y(e,!1)}return o?l(e,o,r):h(e,r,`Mavéa couldn’t get a fresh read — try again in a moment.`),u(e,r),x({kind:i?`alert`:`check`,text:o?o.text.slice(0,200):`Couldn’t get a fresh read on ${t.title}.`,dashboardIds:[e],searches:1,manual:!0,...o?.sources?.length?{sourceCount:o.sources.length}:{}}),o?`done`:`failed`}function Ye(e,t,n,r,i){let a=fe(e,r).filter(e=>!i.has(e.id)),o=pe(e,r);o&&i.has(o.id)&&(o=null);let s=w(t,n,r),c=!1;s.paused&&(c=a.some(E)||!!o,a=a.filter(e=>!E(e)),o=null);let l=V(a);return o&&l.some(e=>e.d.id===o.id)&&(o=null),{dueData:a,dueAi:o,pausedAndBlocked:c}}function Xe(){let e=(0,M.useRef)(!1);(0,M.useEffect)(()=>{let t=!0,n=async()=>{if(e.current||!t||typeof document<`u`&&document.visibilityState!==`visible`)return;let n=_(v()),r=!!n.apiKey,i=Date.now(),a=d(),o=C(),c=b();ae(a,c,e=>S(c,e,i),e=>s(e,i-6048e5,i),i);for(let e of Fe(a,c,i))x({kind:`insight`,text:e.text,dashboardIds:e.dashboardIds,searches:0});let{dueData:l,dueAi:u,pausedAndBlocked:f}=Ye(a,c,o.dailySearchBudget,i,K);f&&We(i);let p=r&&o.briefingEnabled&&ie(i);if(l.length===0&&!u){if(p&&!a.some(E)){let e=A(a,new Set);if(e){let t=await H([],n,{briefingContext:e});t.briefing&&(k(t.briefing,a,i),x({kind:`briefing`,text:`Morning briefing compiled.`,dashboardIds:[],searches:1}))}}return}e.current=!0,l.forEach(e=>K.add(e.id)),u&&K.add(u.id);try{if(l.length>0){let e=p?{context:A(a,new Set(V(l).map(e=>e.d.id))),allDashboards:a}:void 0;await $(l,n,r,e?{briefing:e}:{})}u&&await Ge(u,n,r,i)}finally{l.forEach(e=>K.delete(e.id)),u&&K.delete(u.id),e.current=!1}},r=window.setInterval(()=>void n(),Le),i=()=>{document.visibilityState===`visible`&&n()};return document.addEventListener(`visibilitychange`,i),n(),()=>{t=!1,window.clearInterval(r),document.removeEventListener(`visibilitychange`,i)}},[])}export{X as a,N as c,Ie as i,Ke as n,P as o,Xe as r,se as s,Je as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./types-C42I77wh.js";import{t}from"./json-B0N3XRZU.js";import{r as n}from"./verbatim-DBTj9sPD.js";import{r}from"./number-Bmf7DqLj.js";import{i,n as a,r as o,s,t as c}from"./receipts-ClyzFFGD.js";var l=/^\d{4}$/,u=/^(\d{4})[-/](\d{1,2})$/;function d(e){let t=e.trim();if(l.test(t))return Date.UTC(Number(t),0,1);let n=u.exec(t);if(n){let e=Number(n[2]);return e>=1&&e<=12?Date.UTC(Number(n[1]),e-1,1):null}let r=Date.parse(t);return Number.isFinite(r)?r:null}var f=[`economy`,`policy`,`technology`,`science`,`environment`,`society`,`health`,`conflict`];function p(e){return typeof e==`string`&&f.includes(e)?e:void 0}var m=new Set([`root`,`mechanism`,`outcome`]),h=[`T0`,`T1`,`T2`,`T3`],g=140,_=40,v=120,y=240,b=240,x=24,S=12,C=6,w=16,T=4,E=48,D=40,O=24,k=24;function A(e,t){if(typeof e!=`string`)return null;let n=e.trim();return n?n.length>t?n.slice(0,t):n:null}var j=e=>e<0?0:e>1?1:e;function M(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,k).replace(/-+$/,``)}function N(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.length>O)return null;let n=d(t);return n===null?null:{label:t,at:n}}function P(e){let t=typeof e==`string`?{t:e}:e;if(!t||typeof t!=`object`||Array.isArray(t))return;let n=N(t.t);if(!n)return;let r=N(t.until);return{t:n.label,...r&&r.at>n.at?{until:r.label}:{}}}function F(t,n,a,s){let c=m.has(t.role)?t.role:`mechanism`,l=typeof t.depth==`number`&&Number.isFinite(t.depth)?Math.max(0,Math.round(t.depth)):c===`root`?0:c===`outcome`?2:1,u=h.includes(t.tier)?t.tier:`T0`,d=typeof t.value==`number`&&Number.isFinite(t.value)?t.value:void 0,f=A(t.unit,S)??void 0,g=A(t.detail,b)??void 0,_=P(t.date),v=p(t.domain),y=i(t),x;return e(u)?y&&a(y)?(x=o(t.receipt,y),d!==void 0&&!r(d,y)&&(d=void 0)):(u=`T0`,d=void 0):u===`T3`?(!s||d===void 0)&&(u=`T0`,d=void 0):d=void 0,{label:n,role:c,depth:l,tier:u,...d===void 0?{}:{value:d},...f?{unit:f}:{},...x?{receipt:x}:{},...g?{detail:g}:{},..._?{date:_}:{},...v?{domain:v}:{}}}function I(t,n,a){if(!t||typeof t!=`object`||Array.isArray(t))return;let s=t,c=h.includes(s.tier)?s.tier:`T0`;if(c===`T0`||c===`T3`&&!a)return;let l=A(s.unit,S)??void 0,u=i(s),d=e(c)&&u&&n(u)?o(s.receipt,u):void 0,f=[];for(let t of Array.isArray(s.points)?s.points:[]){if(f.length>=D)break;if(!t||typeof t!=`object`)continue;let a=t,s=A(a.t,O),l=typeof a.value==`number`&&Number.isFinite(a.value)?a.value:void 0;if(!(!s||l===void 0)){if(e(c)){let e=i(a);if(!e||!n(e)||!r(l,e))continue;f.push({t:s,value:l,receipt:o(a.receipt,e)})}else f.push({t:s,value:l})}}if(f.length!==0)return{points:f,tier:c,...l?{unit:l}:{},...d?{receipt:d}:{}}}function L(e,t,n,r){let i=[],a=new Set;for(let o of Array.isArray(e)?e:[]){if(i.length>=T)break;if(!o||typeof o!=`object`)continue;let e=o,s=A(e.id,_)??A(e.label,v);if(!s)continue;let c=M(s.startsWith(`${t}.`)?s.slice(t.length+1):s);if(!c)continue;let l=`${t}.${c}`;if(a.has(l))continue;a.add(l);let u=A(e.label,v)??c,d=I(e.series,n,r);i.push({id:l,...F(e,u,n,r),...d?{series:d}:{}})}return i}function R(e,t){let n=new Map(e.map(e=>[e,0])),r=new Map(e.map(e=>[e,[]]));for(let e of t){let t=r.get(e.from);!t||!n.has(e.to)||(n.set(e.to,n.get(e.to)+1),t.push(e.to))}let i=[...r.keys()].filter(e=>n.get(e)===0),a=0;for(let e=0;e<i.length;e+=1){a+=1;for(let t of r.get(i[e])){let e=n.get(t)-1;n.set(t,e),e===0&&i.push(t)}}return a===r.size}function z(e,t){let n=new Map(e.map(e=>[e,[]]));t.forEach((e,t)=>{let r=n.get(e.from);r&&n.has(e.to)&&r.push(t)});let r=new Map,i=new Set;for(let a of e){if(r.has(a))continue;r.set(a,1);let e=[{id:a,next:0}];for(;e.length>0;){let a=e[e.length-1],o=n.get(a.id);if(a.next>=o.length){r.set(a.id,2),e.pop();continue}let s=o[a.next];a.next+=1;let{to:c}=t[s],l=r.get(c);l===1?i.add(s):l===void 0&&(r.set(c,1),e.push({id:c,next:0}))}}return i}var B=e=>{let t=e.slice(0,3).map(e=>`${e.from} → ${e.to}`);return e.length>t.length?`${t.join(`, `)}, +${e.length-t.length} more`:t.join(`, `)};function V(e,t){if(R(e,t))return{edges:[...t],notes:[]};let n=z(e,t),r=t.filter((e,t)=>n.has(t));return{edges:t.filter((e,t)=>!n.has(t)),notes:[`Dropped ${r.length} link${r.length===1?``:`s`} that closed a causal loop (${B(r)}) — a causal web cannot come back round to its own cause.`]}}var H=e=>e.length===0?[]:[`Dropped ${e.length} self-link${e.length===1?``:`s`} (${B(e)}) — nothing causes itself.`];function U(e,t){let n=Math.max(0,C-t.length),r=[...(e??[]).slice(0,n),...t];return r.length>0?r.slice(0,C):void 0}function W(r,i){let l=typeof r==`string`?t(r):r;if(!l||typeof l!=`object`||Array.isArray(l))return null;let u=l,d=A(u.title,g);if(!d)return null;let f=u.provenance&&typeof u.provenance==`object`?u.provenance:{},p=f.illustrative===!0,m=n(i??``),b=[],S=new Set;for(let e of Array.isArray(u.nodes)?u.nodes:[]){if(b.length>=w)break;if(!e||typeof e!=`object`)continue;let t=e,n=A(t.id,_),r=A(t.label,v);if(!n||!r||S.has(n))continue;S.add(n);let i=I(t.series,m,p),a=L(t.children,n,m,p);b.push({id:n,...F(t,r,m,p),...i?{series:i}:{},...a.length?{children:a}:{}})}if(b.length<2)return null;let C=new Set(b.map(e=>e.id)),T=[],D=[];for(let t of Array.isArray(u.edges)?u.edges:[]){if(T.length>=E)break;if(!t||typeof t!=`object`)continue;let n=t,r=A(n.from,_),i=A(n.to,_);if(!r||!i||!C.has(r)||!C.has(i))continue;if(r===i){D.push({from:r,to:i});continue}let l=n.sign===-1?-1:1,u=A(n.verb,x)??void 0,d=n.relation==null?void 0:s(n.relation),f=h.includes(n.tier)?n.tier:`T0`,p=typeof n.weight==`number`&&Number.isFinite(n.weight)?j(n.weight):void 0,g=c(n,m),v=!1;e(f)&&p!==void 0&&g.length>0||(f=`T0`,p=void 0,v=!0);let b=n.counter&&typeof n.counter==`object`?n.counter:null,S=b?A(b.quote,y):null,w=S&&m(S)?o(b,S):void 0;T.push({from:r,to:i,sign:l,tier:f,...u?{verb:u}:{},...p===void 0?{}:{weight:p},...g.length?{receipt:g[0],receipts:g}:{},...v?{provisional:!0}:{},...d?{relation:d}:{},...w?{counter:w}:{},status:a({tier:f,weight:p,receipt:g[0],receipts:g,counter:w})})}let O=V([...C],T),k=A(u.outcomeId,_);(!k||!C.has(k))&&(k=(b.find(e=>e.role===`outcome`)??b.reduce((e,t)=>t.depth>e.depth?t:e)).id);let M=U(Array.isArray(f.notes)?f.notes.map(e=>String(e)):void 0,[...H(D),...O.notes]);return{title:d,outcomeId:k,nodes:b,edges:O.edges,provenance:{...p?{illustrative:!0}:{},...M?{notes:M}:{}}}}var G=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,``);function K(e,t){let n=new Set(e.nodes.map(e=>e.id)),r=new Map;for(let t of e.nodes){let e=G(t.label),n=r.get(e);n?n.push(t.id):r.set(e,[t.id])}let i=new Map,a=new Set,o=new Set,s=[],c=new Set(n);for(let t of e.nodes)for(let e of t.children??[])c.add(e.id);for(let l of t.nodes){if(i.has(l.id))continue;let t=n.has(l.id)?l.id:null;if(!t){let e=r.get(G(l.label));e&&e.length===1&&(t=e[0])}if(t){if(o.has(t))continue;o.add(t),i.set(l.id,t),a.add(l.id);continue}if(e.nodes.length+s.length>=w)continue;let u=l.id;for(let e=2;c.has(u);e+=1)u=`${l.id}-${e}`;c.add(u),i.set(l.id,u),s.push({node:l,id:u})}return{idMap:i,matched:a,fresh:s}}function q(e,t){return t.nodes.length===0?0:K(e,t).matched.size/t.nodes.length}var J=t=>e(t.tier)&&!!t.receipt;function Y(t,n){return n?t?e(n.tier)||!e(t.tier)?n:t:n:t}function X(e,t){let n=J(t)?t:e,r=Y(e.series,t.series),i=t.detail??e.detail,a=t.date??e.date,o=t.domain??e.domain;return{id:e.id,label:e.label,role:e.role,depth:e.depth,tier:n.tier,...n.value===void 0?{}:{value:n.value},...n.unit?{unit:n.unit}:{},...n.receipt?{receipt:n.receipt}:{},...a?{date:a}:{},...r?{series:r}:{},...i?{detail:i}:{},...o?{domain:o}:{}}}function Z(e,t,n,r){let i=e?[...e]:[],a=new Map(i.map((e,t)=>[e.id,t]));for(let e of t??[]){let t=M(e.id.startsWith(`${n}.`)?e.id.slice(n.length+1):e.id.split(`.`).pop()??``);if(!t)continue;let o=`${r}.${t}`,{children:s,...c}=e,l={...c,id:o},u=a.get(o);u===void 0?i.length<T&&(a.set(o,i.length),i.push(l)):i[u]=X(i[u],l)}return i.length?i:void 0}function Q(e,t){let n=Z(e.children,t.children,t.id,e.id);return{...X(e,t),...n?{children:n}:{}}}var $=e=>e.receipts??(e.receipt?[e.receipt]:[]);function ee(e,t){let n=$(e),r=$(t).length>0&&n.length===0?t:e,i=r===t?e:t,o=[],s=new Set;for(let e of[...$(r),...$(i)])o.length>=3||s.has(e.quote)||(s.add(e.quote),o.push(e));let c=r.relation??i.relation,l=r.counter??i.counter;return{from:e.from,to:e.to,sign:r.sign,tier:r.tier,...r.verb?{verb:r.verb}:{},...r.weight===void 0?{}:{weight:r.weight},...o.length?{receipt:o[0],receipts:o}:{},...r.provisional?{provisional:!0}:{},...c?{relation:c}:{},...l?{counter:l}:{},status:a({tier:r.tier,...r.weight===void 0?{}:{weight:r.weight},...o.length?{receipt:o[0],receipts:o}:{},...l?{counter:l}:{}})}}function te(e,t){let{idMap:n,fresh:r}=K(e,t),i=new Map(t.nodes.map(e=>[e.id,e])),a=[...e.nodes],o=new Map(e.nodes.map((e,t)=>[e.id,t]));for(let[e,t]of n){let n=o.get(t);if(n===void 0)continue;let r=i.get(e);r&&(a[n]=Q(a[n],r))}for(let{node:e,id:t}of r){let{children:n,...r}=e,i=Z(void 0,e.children,e.id,t);a.push({...r,id:t,...i?{children:i}:{}})}let s=[...e.edges],c=new Map(e.edges.map((e,t)=>[`${e.from}\0${e.to}`,t])),l=e=>n.get(e)??(o.has(e)?e:void 0);for(let e of t.edges){let t=l(e.from),n=l(e.to);if(!t||!n||t===n)continue;let r=`${t}\0${n}`,i=c.get(r);i===void 0?s.length<E&&(c.set(r,s.length),s.push({...e,from:t,to:n})):s[i]=ee(s[i],{...e,from:t,to:n})}let u=V(a.map(e=>e.id),s),d=U(e.provenance.notes,u.notes);return{title:e.title,outcomeId:e.outcomeId,nodes:a,edges:u.edges,provenance:{...e.provenance.illustrative?{illustrative:!0}:{},...d?{notes:d}:{}}}}function ne(e,r,i,a){let o=typeof e==`string`?t(e):e;if(!o||typeof o!=`object`)return[];let s=o.children;return L(s,r,n(i),a)}function re(e,t,n){if(n.length===0)return e;let r=e.nodes.find(e=>e.id===t);return!r||(r.children?.length??0)>0?e:{...e,nodes:e.nodes.map(e=>e.id===t?{...e,children:[...n]}:e)}}export{q as a,te as i,ne as n,f as o,W as r,d as s,re as t};