@qredence/fleet 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/web/client/assets/{DialogTitle-DiAm7YNe.js → DialogTitle-BwQ9k-MZ.js} +1 -1
- package/dist/web/client/assets/agent-disclosure-YgLa4c2y.js +1 -0
- package/dist/web/client/assets/{alert-dialog-CYE37KMM.js → alert-dialog-BfK7648p.js} +1 -1
- package/dist/web/client/assets/analytics-stub-BY-GADyA.js +1 -0
- package/dist/web/client/assets/arrow-up-DCwrqIrK.js +1 -0
- package/dist/web/client/assets/artifacts-panel-DDlPULVv.js +1 -0
- package/dist/web/client/assets/bot-DETalD3q.js +1 -0
- package/dist/web/client/assets/{button-Dl0ce3Y5.js → button-BrwYi6QP.js} +1 -1
- package/dist/web/client/assets/{card-DCEnYd2G.js → card-BScRdZNS.js} +1 -1
- package/dist/web/client/assets/chat-command-palette-AjGusIEp.js +1 -0
- package/dist/web/client/assets/chat-helpers-Bj7_hES7.js +1 -0
- package/dist/web/client/assets/check-BTwIaCtI.js +1 -0
- package/dist/web/client/assets/chevron-down-Bse1ggZM.js +1 -0
- package/dist/web/client/assets/chevron-right-BPCB1mOg.js +1 -0
- package/dist/web/client/assets/chunk-YOKDWASO-C8deEx7Z.js +143 -0
- package/dist/web/client/assets/circle-check-DBhaebaM.js +1 -0
- package/dist/web/client/assets/citations-DOkXsdCi.js +1 -0
- package/dist/web/client/assets/clsx-DB0hHKMi.js +1 -0
- package/dist/web/client/assets/{collapsible-CUxOjhDJ.js → collapsible-DsbKpD_Y.js} +1 -1
- package/dist/web/client/assets/{command-Cw4X8Bpk.js → command-DSxdh_1v.js} +1 -1
- package/dist/web/client/assets/composer-intent-C5pz72T6.js +62 -0
- package/dist/web/client/assets/create-project-dialog-zTSeGUup.js +1 -0
- package/dist/web/client/assets/{createBaseUIEventDetails-B58Jldei.js → createBaseUIEventDetails-DklXWq23.js} +1 -1
- package/dist/web/client/assets/createLucideIcon-CQY2ECfR.js +1 -0
- package/dist/web/client/assets/{dialog-BzcIOvFC.js → dialog-B9nXTto4.js} +1 -1
- package/dist/web/client/assets/{dist-DbHxXSgQ.js → dist-BJJVCio8.js} +1 -1
- package/dist/web/client/assets/dist-BogNzeK9.js +1 -0
- package/dist/web/client/assets/{ease-CMumuPlX.js → ease-2UPBQU5v.js} +1 -1
- package/dist/web/client/assets/eye-iNSvs0UA.js +1 -0
- package/dist/web/client/assets/file-text-cqOanUYv.js +1 -0
- package/dist/web/client/assets/folder-COBtkKZa.js +1 -0
- package/dist/web/client/assets/{fork-picker-dialog-BYRr-xTy.js → fork-picker-dialog-DEdHU89A.js} +1 -1
- package/dist/web/client/assets/gauge-0Nn96wfZ.js +1 -0
- package/dist/web/client/assets/git-branch-DZEh2mM2.js +1 -0
- package/dist/web/client/assets/globals-BiAbxPQ2.css +2 -0
- package/dist/web/client/assets/hard-drive-B3opVeEB.js +1 -0
- package/dist/web/client/assets/{highlighted-body-KPVGNVTW-CgT7gqvs.js → highlighted-body-KPVGNVTW-CZcNaoxi.js} +1 -1
- package/dist/web/client/assets/horizontal-resize-5AxYvGLA.js +1 -0
- package/dist/web/client/assets/index-NhnAdIsR.js +12 -0
- package/dist/web/client/assets/{input-CxZp56Im.js → input-BceH49B1.js} +1 -1
- package/dist/web/client/assets/{input-group-D7lAfKHR.js → input-group-DThl_vkS.js} +1 -1
- package/dist/web/client/assets/ipython-tool-CuSGRhXl.js +3 -0
- package/dist/web/client/assets/is-ref-object-CEXqIz6L.js +1 -0
- package/dist/web/client/assets/loader-circle-BmKYM_C4.js +1 -0
- package/dist/web/client/assets/markdown-C-Y9gskI.js +2 -0
- package/dist/web/client/assets/{markdown-code-CDTRq-HZ.js → markdown-code-BqFVdovL.js} +1 -1
- package/dist/web/client/assets/mermaid-HWGCJPDP-CVNXPao6.js +1 -0
- package/dist/web/client/assets/{message-queue-Dl8wbCOu.js → message-queue-BoNn57Po.js} +1 -1
- package/dist/web/client/assets/{model-selector-list-CHD8lMAl.js → model-selector-list-DDsuJCgB.js} +1 -1
- package/dist/web/client/assets/{notify-DjVixft7.js → notify-GSsGEKtR.js} +1 -1
- package/dist/web/client/assets/{openui-renderer-C4e9FOVR.js → openui-renderer-l1qI5JDt.js} +41 -41
- package/dist/web/client/assets/package-BkC-HSi-.js +1 -0
- package/dist/web/client/assets/pencil-Cbgq3ybX.js +1 -0
- package/dist/web/client/assets/plug-wCz-036u.js +1 -0
- package/dist/web/client/assets/prompt-input-BhVQxoyh.js +1 -0
- package/dist/web/client/assets/{prompt-suggestions-BNyTcyWg.js → prompt-suggestions-BRFWFm5y.js} +1 -1
- package/dist/web/client/assets/provider-catalog-L0c-bZv6.js +1 -0
- package/dist/web/client/assets/provider-label-Buq3HZrP.js +1 -0
- package/dist/web/client/assets/react-Cvdyeg_0.js +1 -0
- package/dist/web/client/assets/react-dom-B7th3XGm.js +1 -0
- package/dist/web/client/assets/refresh-cw-CqPE3kNY.js +1 -0
- package/dist/web/client/assets/{repl-panel-L9dmPqio.js → repl-panel-UQN9UFG7.js} +1 -1
- package/dist/web/client/assets/resource-helpers-CKbSmzpw.js +2 -0
- package/dist/web/client/assets/{resources-panel-mT-aMCvV.js → resources-panel-kp_UjnpX.js} +1 -1
- package/dist/web/client/assets/right-panel-context-DHKWoetk.js +1 -0
- package/dist/web/client/assets/right-panel-registry-gwgnEeUz.js +2 -0
- package/dist/web/client/assets/rotate-ccw-DLkfsmG9.js +1 -0
- package/dist/web/client/assets/routes-umGEy_Ak.js +16 -0
- package/dist/web/client/assets/safe-external-url-BnEhm9A0.js +1 -0
- package/dist/web/client/assets/search-Cb6fFWew.js +1 -0
- package/dist/web/client/assets/{session-reasoning-panel-8D2P7iaJ.js → session-reasoning-panel-BAtKTsjn.js} +1 -1
- package/dist/web/client/assets/session-tool-renderer-pGdW2MnV.js +1389 -0
- package/dist/web/client/assets/{session-tree-panel-CM4_wwrM.js → session-tree-panel-DF3kuF0P.js} +1 -1
- package/dist/web/client/assets/settings-dialog-C8YN5D1V.js +2 -0
- package/dist/web/client/assets/{skeleton-C3mo31Qu.js → skeleton-D5Y9nBfp.js} +1 -1
- package/dist/web/client/assets/{skeleton-loaders-BMa_G4yX.js → skeleton-loaders-DOKGa7CW.js} +1 -1
- package/dist/web/client/assets/sparkles-C4VQyMox.js +1 -0
- package/dist/web/client/assets/spinner-C3sPnLdu.js +1 -0
- package/dist/web/client/assets/square-BbTF3gLc.js +1 -0
- package/dist/web/client/assets/square-terminal-BLq2bQVF.js +1 -0
- package/dist/web/client/assets/{subagent-chat-panel-BESrXxAR.js → subagent-chat-panel-BIsmzS45.js} +1 -1
- package/dist/web/client/assets/subagent-transcript-CEUBL9sF.js +1 -0
- package/dist/web/client/assets/{subagents-panel-8aKOwWLs.js → subagents-panel-CFxWpUT0.js} +1 -1
- package/dist/web/client/assets/sun-C7zg8Oas.js +1 -0
- package/dist/web/client/assets/{surfaces-CpfsGAIA.js → surfaces-BULKVm-B.js} +1 -1
- package/dist/web/client/assets/switch-CoSNSJEY.js +1 -0
- package/dist/web/client/assets/terminal-Ceucj7us.js +1 -0
- package/dist/web/client/assets/toast-CS0pnDlS.js +1 -0
- package/dist/web/client/assets/tokens-CtP2s1Y3.js +1 -0
- package/dist/web/client/assets/tool-result-C-vs_tjQ.js +4 -0
- package/dist/web/client/assets/tool-timeline-B4ci1oJg.js +1 -0
- package/dist/web/client/assets/triangle-alert-BuzmrrqI.js +1 -0
- package/dist/web/client/assets/types-D5hZ8IyV.js +1 -0
- package/dist/web/client/assets/{ui-preferences-aG2U2jjW.js → ui-preferences-1YaENqef.js} +1 -1
- package/dist/web/client/assets/{use-presence-7I2qv4qI.js → use-presence-D2YmRKr3.js} +1 -1
- package/dist/web/client/assets/{use-reduced-motion-BOcG709U.js → use-reduced-motion-CaQBb3Qc.js} +2 -2
- package/dist/web/client/assets/{useBaseUiId-D9ZGPZ6f.js → useBaseUiId-BlzQUkVG.js} +1 -1
- package/dist/web/client/assets/{useControlled-CgAAWIy9.js → useControlled-CkQSkSv1.js} +1 -1
- package/dist/web/client/assets/utils-Dpy9ZFOr.js +1 -0
- package/dist/web/client/assets/virtualized-turn-list-DkJIWXFJ.js +6 -0
- package/dist/web/client/assets/workspace-panel-CjKMroC6.js +1 -0
- package/dist/web/client/assets/{workspace-path-nav-DqPbETfJ.js → workspace-path-nav-DmxBrMV6.js} +2 -2
- package/dist/web/client/assets/wrench-BYnD147U.js +1 -0
- package/dist/web/client/assets/x-DEU6H3M-.js +1 -0
- package/dist/web/client/bundle-budget.json +6 -6
- package/dist/web/server/_tanstack-start-manifest_v-B3Gb4p5p-DO2GL5VM.js +95 -0
- package/dist/web/server/{artifacts-panel-CwLVBqyi-CDORJY75.js → artifacts-panel-CGgpyc85-V3KXDVAX.js} +73 -66
- package/dist/web/server/{chat-command-palette-DUha04ia-5OV7WVJZ.js → chat-command-palette-BMR7RsuI-U5S4X44U.js} +52 -45
- package/dist/web/server/{chunk-ADYZWC5L.js → chunk-22XP6PHK.js} +50 -11
- package/dist/web/server/{chunk-XEG4JTND.js → chunk-2HOITUWV.js} +5 -5
- package/dist/web/server/{chunk-NZ6KQT2X.js → chunk-2XQYM4KB.js} +2 -2
- package/dist/web/server/{chunk-K6PTNSCW.js → chunk-36BG6OPK.js} +2 -2
- package/dist/web/server/chunk-3OOZPQZF.js +51 -0
- package/dist/web/server/{chunk-DP26GVWH.js → chunk-3YYNG52U.js} +5772 -4758
- package/dist/web/server/chunk-4IVORBQD.js +39 -0
- package/dist/web/server/{chunk-B2LF64HM.js → chunk-4LBXVBM7.js} +5 -5
- package/dist/web/server/{chunk-DKD32TRM.js → chunk-5FIJPXUA.js} +3343 -14
- package/dist/web/server/{chunk-O2IC376F.js → chunk-5TXDGMCK.js} +117 -1787
- package/dist/web/server/{chunk-YDDDSVNB.js → chunk-5VPNOUVY.js} +7 -5
- package/dist/web/server/chunk-7LUHWO5G.js +28 -0
- package/dist/web/server/chunk-7SZKAHLD.js +25 -0
- package/dist/web/server/{chunk-UE32PAV2.js → chunk-ACZS5EEZ.js} +4 -4
- package/dist/web/server/{chunk-CAPTFJOC.js → chunk-AWVHN432.js} +4 -4
- package/dist/web/server/{chunk-SDV3P3IW.js → chunk-BMXYQRMJ.js} +96 -78
- package/dist/web/server/chunk-BS4D5LRR.js +152 -0
- package/dist/web/server/{chunk-OVJYUWSQ.js → chunk-C2YGLMFE.js} +1 -1
- package/dist/web/server/chunk-CMOAC245.js +28 -0
- package/dist/web/server/{chunk-7FK6YEMA.js → chunk-CRCVWYBA.js} +2 -9
- package/dist/web/server/chunk-DIVIHC5K.js +100 -0
- package/dist/web/server/{chunk-XJ6TGSUB.js → chunk-EKVRPCBJ.js} +1 -1
- package/dist/web/server/{chunk-V5IFFLZQ.js → chunk-ELRLMFHT.js} +192 -142
- package/dist/web/server/{chunk-ZNFXBGLK.js → chunk-ERYPONRF.js} +1 -1
- package/dist/web/server/chunk-F3OV445J.js +25 -0
- package/dist/web/server/{chunk-5727TXOK.js → chunk-F5DJQ3PQ.js} +36 -36
- package/dist/web/server/{chunk-XSOUURPF.js → chunk-FAJILEF2.js} +142 -110
- package/dist/web/server/{chunk-UM3RHJNZ.js → chunk-FF2M3MLP.js} +2 -2
- package/dist/web/server/{chunk-IPV4GLJL.js → chunk-FHZAFF2A.js} +7 -24
- package/dist/web/server/chunk-FOMB2JR7.js +26 -0
- package/dist/web/server/{chunk-5RTGRTPD.js → chunk-FVWPODLT.js} +7 -6
- package/dist/web/server/chunk-G3WQTXJY.js +25 -0
- package/dist/web/server/{chunk-KZ35W5M7.js → chunk-G6NMFFZX.js} +41 -36
- package/dist/web/server/{chunk-YCCF676T.js → chunk-GLNLSEZJ.js} +7 -7
- package/dist/web/server/chunk-GNDXVFJY.js +28 -0
- package/dist/web/server/{chunk-HGVJEUV4.js → chunk-GR765UTQ.js} +4 -4
- package/dist/web/server/{chunk-RXUMFFUV.js → chunk-GSG3K6RA.js} +2 -2
- package/dist/web/server/chunk-HFN4TNR3.js +31 -0
- package/dist/web/server/{chunk-ETCO5KZK.js → chunk-I36LJXNY.js} +5 -5
- package/dist/web/server/{chunk-3Q3QKLHC.js → chunk-IIPUA4LB.js} +248 -212
- package/dist/web/server/{chunk-7PQTPSEE.js → chunk-INWLYZZ6.js} +1 -1
- package/dist/web/server/chunk-JCK6B7ZW.js +1677 -0
- package/dist/web/server/chunk-JEQQEY6O.js +30 -0
- package/dist/web/server/chunk-JVXQQYXB.js +154 -0
- package/dist/web/server/chunk-KABZXD6N.js +152 -0
- package/dist/web/server/{chunk-FTLJ66KU.js → chunk-L2SVMQWB.js} +12 -43
- package/dist/web/server/{chunk-TU2WNRAL.js → chunk-LBUHLBKK.js} +15 -13
- package/dist/web/server/chunk-LOFZS555.js +28 -0
- package/dist/web/server/{chunk-MJXXVQNA.js → chunk-LQRH6BP6.js} +25 -18
- package/dist/web/server/{chunk-WU6X3GPJ.js → chunk-MTVGA2MH.js} +72 -52
- package/dist/web/server/{chunk-T2UTBHJ4.js → chunk-N47UN47Y.js} +51 -39
- package/dist/web/server/chunk-NZ5YXXQ5.js +39 -0
- package/dist/web/server/{chunk-E5HALE4M.js → chunk-OYWUPJ72.js} +2 -2
- package/dist/web/server/{chunk-YVGCPUAW.js → chunk-PISNXFEK.js} +3 -3
- package/dist/web/server/{chunk-7HXCGBUP.js → chunk-PX7B5BTI.js} +5 -5
- package/dist/web/server/{chunk-33QA7BQJ.js → chunk-PYTU4DGR.js} +16 -10
- package/dist/web/server/{chunk-7E76R7MB.js → chunk-QHCQDVCQ.js} +1 -2
- package/dist/web/server/{chunk-FMAYMBRS.js → chunk-QN7KFCUW.js} +4318 -3649
- package/dist/web/server/chunk-QWWG3YC6.js +25 -0
- package/dist/web/server/chunk-RPGWRA2X.js +39 -0
- package/dist/web/server/chunk-RPWKCJHL.js +18 -0
- package/dist/web/server/chunk-RWYAKZCZ.js +39 -0
- package/dist/web/server/chunk-SGMJ5CGW.js +36 -0
- package/dist/web/server/chunk-SOZKLVNI.js +275 -0
- package/dist/web/server/{chunk-BQROC4PL.js → chunk-TNZKPEE6.js} +13 -7
- package/dist/web/server/chunk-TSOBRZPG.js +41 -0
- package/dist/web/server/{chunk-RJNGEU6C.js → chunk-UIUZ4ETR.js} +2 -2
- package/dist/web/server/{chunk-TLNZNR7C.js → chunk-UUDBEYKV.js} +2 -2
- package/dist/web/server/{chunk-HQ5TEXHT.js → chunk-UXS5E6OE.js} +4 -4
- package/dist/web/server/chunk-V7PDLH3T.js +73 -0
- package/dist/web/server/chunk-VCQ65B3G.js +28 -0
- package/dist/web/server/{chunk-TR2GA5OF.js → chunk-VHLBXWEN.js} +55 -40
- package/dist/web/server/{chunk-S2IBIJIG.js → chunk-WU6KNEGU.js} +46 -31
- package/dist/web/server/chunk-X37KO4BO.js +29 -0
- package/dist/web/server/chunk-X5AQ7KHU.js +22 -0
- package/dist/web/server/chunk-XZCIEF54.js +28 -0
- package/dist/web/server/{chunk-7NZ3FJDA.js → chunk-YBCP4V6T.js} +2 -2
- package/dist/web/server/{chunk-7UTDOTOU.js → chunk-YKJJDQAK.js} +28 -100
- package/dist/web/server/chunk-Z4OTKGMN.js +25 -0
- package/dist/web/server/chunk-ZJIELDZL.js +39 -0
- package/dist/web/server/{chunk-UDD5W4CR.js → chunk-ZMF45HAO.js} +58 -45
- package/dist/web/server/chunk-ZNED4KTU.js +105 -0
- package/dist/web/server/chunk-ZNI5AL4B.js +30 -0
- package/dist/web/server/create-project-dialog-xhTWmcx1-UQQU3MAT.js +295 -0
- package/dist/web/server/{fork-picker-dialog-DeMiLZtS-WTRTTP64.js → fork-picker-dialog-B5J-S5Nm-QOMVVHI7.js} +11 -11
- package/dist/web/server/{highlighted-body-KPVGNVTW-Ct6g7FVa-YZHVMLW4.js → highlighted-body-KPVGNVTW-D4Xsgab0-BZNKZ2YE.js} +3 -3
- package/dist/web/server/{markdown-BzNejPoZ-6ITTDAV6.js → markdown-DaTMVcnu-37DWI2JW.js} +4 -4
- package/dist/web/server/{markdown-code-DAwXuW6m-HHVELO6I.js → markdown-code-Cvz3a-x3-WAD4KC4A.js} +5 -5
- package/dist/web/server/{mermaid-HWGCJPDP-Ca26PwPZ-5EWRESLM.js → mermaid-HWGCJPDP-CDDePcVz-4BWFRGWL.js} +2 -2
- package/dist/web/server/{message-queue-Demph1x4-GGXJUUKO.js → message-queue-Dg2okv2L-SJTUUJS7.js} +17 -16
- package/dist/web/server/{model-selector-list-BeGQHwKV-UJYFO4KX.js → model-selector-list-Csw4nOra-IOMN5JMO.js} +23 -23
- package/dist/web/server/openui-renderer-CiWvcD3p-N6I66FOC.js +39 -0
- package/dist/web/server/{prompt-suggestions-yPZqX__K-3VGJC4IF.js → prompt-suggestions-h17Gu7u1-BS5SU2FY.js} +5 -5
- package/dist/web/server/{repl-panel-CgUF1qUw-3DFD2V53.js → repl-panel-CBwh0VGD-USDEOGGJ.js} +8 -9
- package/dist/web/server/{resources-panel-ChUliWV--JITAGS6Q.js → resources-panel-rn64m-sL-7QXEGRNX.js} +9 -10
- package/dist/web/server/{router-DfG45nTQ-3VXEUYG5.js → router-DOPFvRSC-G7G75P7U.js} +2663 -163
- package/dist/web/server/{routes-B9F9UfF1-UN2IVBMJ.js → routes-i2Ai-ZwX-SMSFONDQ.js} +2233 -2486
- package/dist/web/server/server.js +6 -6
- package/dist/web/server/{session-insights-panel-xgrkX1Rp-FDNURBXZ.js → session-insights-panel-DKkakWj6-ITHKDXF4.js} +1 -1
- package/dist/web/server/{session-reasoning-panel-m1RgcIph-NUXGXVKE.js → session-reasoning-panel-CXMCAM8C-HZMR5JCO.js} +9 -10
- package/dist/web/server/session-tool-renderer-jldnNioy-5ATOVAG5.js +46 -0
- package/dist/web/server/{session-tree-panel-rS0t1wbf-HNA6AJBY.js → session-tree-panel-WaHHv775-HRUHFSFO.js} +11 -11
- package/dist/web/server/{settings-dialog-CqkrDSnm-LFEKSS7Y.js → settings-dialog-C-xwPYy8-TFICZWEM.js} +554 -381
- package/dist/web/server/{start-DVUbMfrb-ELVIFRUY.js → start-QK6aG02q-RXFV6K5L.js} +1 -1
- package/dist/web/server/{subagent-chat-panel-Cf7QdDqH-DPPSVLSY.js → subagent-chat-panel-VEVu0QXU-DPWJFCYR.js} +50 -47
- package/dist/web/server/{subagents-panel-_JsUw-6t-MZWM5P45.js → subagents-panel-Cs3cBcsy-HTQBIYAS.js} +47 -45
- package/dist/web/server/tool-timeline-CfuizRid-L3Y3OSCH.js +15 -0
- package/dist/web/server/{workspace-panel-BHEB9nRM-Y6KGIVGP.js → workspace-panel-BU50q4Bu-JHTQPR6R.js} +109 -93
- package/package.json +1 -1
- package/dist/web/client/assets/agent-disclosure-CMrxF7L-.js +0 -1
- package/dist/web/client/assets/analytics-stub-C2vgmGm_.js +0 -1
- package/dist/web/client/assets/artifacts-panel-ClDpGWOU.js +0 -1
- package/dist/web/client/assets/bot-DbB9BKL0.js +0 -1
- package/dist/web/client/assets/bundle-mjs-cJTHqqzI.js +0 -1
- package/dist/web/client/assets/chat-BVMnC5Qh.js +0 -52
- package/dist/web/client/assets/chat-command-palette-YuyaJNbi.js +0 -1
- package/dist/web/client/assets/check-B3LlvM65.js +0 -1
- package/dist/web/client/assets/chevron-down-DUUprRP5.js +0 -1
- package/dist/web/client/assets/chevron-right-NVqQIoiO.js +0 -1
- package/dist/web/client/assets/chunk-YOKDWASO-Bte3iwlH.js +0 -143
- package/dist/web/client/assets/citations-DXqV2NLy.js +0 -1
- package/dist/web/client/assets/createLucideIcon-_dfI7Arx.js +0 -1
- package/dist/web/client/assets/dist-52wg4XPY.js +0 -1
- package/dist/web/client/assets/eye-CDHqtVoE.js +0 -1
- package/dist/web/client/assets/file-text-TmalmYrb.js +0 -1
- package/dist/web/client/assets/folder-vuNT4shY.js +0 -1
- package/dist/web/client/assets/gauge-BsDqNM1A.js +0 -1
- package/dist/web/client/assets/git-branch-CTq9aACS.js +0 -1
- package/dist/web/client/assets/globals-BtCXZXL_.css +0 -2
- package/dist/web/client/assets/hard-drive-BT7UxHQu.js +0 -1
- package/dist/web/client/assets/horizontal-resize-VLjLByUV.js +0 -1
- package/dist/web/client/assets/index-B9aXxpOv.js +0 -12
- package/dist/web/client/assets/ipython-tool-CkHaO3PW.js +0 -3
- package/dist/web/client/assets/is-ref-object-BcRWZ4l7.js +0 -1
- package/dist/web/client/assets/loader-circle-B5GIZGxd.js +0 -1
- package/dist/web/client/assets/markdown-BHkByC9K.js +0 -2
- package/dist/web/client/assets/mermaid-HWGCJPDP-CY3N5ECk.js +0 -1
- package/dist/web/client/assets/package-BKBPgwMP.js +0 -1
- package/dist/web/client/assets/pencil-CdO6qfv3.js +0 -1
- package/dist/web/client/assets/plug-BRROUIw-.js +0 -1
- package/dist/web/client/assets/prompt-input-WaGSKZCU.js +0 -1
- package/dist/web/client/assets/provider-catalog-ClVvphe0.js +0 -1
- package/dist/web/client/assets/provider-label-CwZ-KDxk.js +0 -1
- package/dist/web/client/assets/react-CwJFpaho.js +0 -1
- package/dist/web/client/assets/react-dom-DX3XddaT.js +0 -1
- package/dist/web/client/assets/refresh-cw-l9WPHRkq.js +0 -1
- package/dist/web/client/assets/resource-helpers-BuWybA8l.js +0 -2
- package/dist/web/client/assets/right-panel-context-CS8tJMzE.js +0 -1
- package/dist/web/client/assets/right-panel-registry-BnYCffmM.js +0 -2
- package/dist/web/client/assets/rotate-ccw-CfGhzOv7.js +0 -1
- package/dist/web/client/assets/routes-DUontXSG.js +0 -16
- package/dist/web/client/assets/safe-external-url-BbAom7Bm.js +0 -1
- package/dist/web/client/assets/search-BjcXAUrI.js +0 -1
- package/dist/web/client/assets/session-tool-renderer-Bd3dsE2D.js +0 -1395
- package/dist/web/client/assets/settings-dialog-DMTD9m6z.js +0 -2
- package/dist/web/client/assets/sparkles-BY5MFyk6.js +0 -1
- package/dist/web/client/assets/square-DQaQu9bp.js +0 -1
- package/dist/web/client/assets/square-terminal-BsopiuN7.js +0 -1
- package/dist/web/client/assets/subagent-transcript-CAqFJfMj.js +0 -1
- package/dist/web/client/assets/sun-D0llhiMU.js +0 -1
- package/dist/web/client/assets/switch-D3FhZU-S.js +0 -1
- package/dist/web/client/assets/terminal-BQAKkBY6.js +0 -1
- package/dist/web/client/assets/toast-lnCWGgSE.js +0 -1
- package/dist/web/client/assets/tokens-Ch5WqXC_.js +0 -1
- package/dist/web/client/assets/tool-result-B_yb2JoE.js +0 -4
- package/dist/web/client/assets/tool-timeline-VnMRQoLS.js +0 -1
- package/dist/web/client/assets/triangle-alert-GAYh_5d3.js +0 -1
- package/dist/web/client/assets/utils-Brtgag-m.js +0 -1
- package/dist/web/client/assets/virtualized-turn-list-mL3ONUUA.js +0 -6
- package/dist/web/client/assets/workspace-panel-CKF5JQl2.js +0 -1
- package/dist/web/client/assets/wrench-Myc12BTA.js +0 -1
- package/dist/web/client/assets/x-BGsDD848.js +0 -1
- package/dist/web/server/_tanstack-start-manifest_v-Cm8xE-Rb-TMLYN3GY.js +0 -93
- package/dist/web/server/chunk-2ST2ULW7.js +0 -24
- package/dist/web/server/chunk-3C4CFCIS.js +0 -19
- package/dist/web/server/chunk-3IHTZSBY.js +0 -22
- package/dist/web/server/chunk-4QD4PCVP.js +0 -19
- package/dist/web/server/chunk-4ZIEVI5O.js +0 -63
- package/dist/web/server/chunk-7CNGNFFK.js +0 -23
- package/dist/web/server/chunk-AHTO6GDS.js +0 -33
- package/dist/web/server/chunk-CHEC7TWB.js +0 -22
- package/dist/web/server/chunk-D7ELZVTI.js +0 -33
- package/dist/web/server/chunk-DLA5TLKX.js +0 -164
- package/dist/web/server/chunk-GS2IZGRC.js +0 -19
- package/dist/web/server/chunk-H5D5DX3K.js +0 -75
- package/dist/web/server/chunk-HFQZLPU2.js +0 -29
- package/dist/web/server/chunk-JBLHIEVG.js +0 -22
- package/dist/web/server/chunk-JDCCC7A7.js +0 -3382
- package/dist/web/server/chunk-JIULUYHT.js +0 -24
- package/dist/web/server/chunk-KBWUBWVJ.js +0 -60
- package/dist/web/server/chunk-LJ6Y7DBH.js +0 -128
- package/dist/web/server/chunk-M5RSPNYN.js +0 -22
- package/dist/web/server/chunk-O2DUZJYK.js +0 -19
- package/dist/web/server/chunk-OKL5ZRVB.js +0 -33
- package/dist/web/server/chunk-OMPXUTMX.js +0 -33
- package/dist/web/server/chunk-OOXWPL22.js +0 -22
- package/dist/web/server/chunk-SFTKGQ7H.js +0 -33
- package/dist/web/server/chunk-TNL4YV63.js +0 -29
- package/dist/web/server/chunk-UCA4WN66.js +0 -45
- package/dist/web/server/chunk-WWJF4RO2.js +0 -19
- package/dist/web/server/chunk-X7D6GFQU.js +0 -34
- package/dist/web/server/chunk-XA42CHF2.js +0 -22
- package/dist/web/server/openui-renderer-B4z18Brm-HSMKJ47D.js +0 -39
- package/dist/web/server/session-tool-renderer-CT65wuet-RQBMXHEZ.js +0 -46
- package/dist/web/server/tool-timeline-QL9k5dzA-RLU26HXT.js +0 -16
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isModelPatternEnabled
|
|
3
|
-
} from "./chunk-WTYNN6EV.js";
|
|
4
1
|
import {
|
|
5
2
|
ChatMcpDeleteRequestSchema,
|
|
6
3
|
ChatMcpOAuthLoginRequestSchema,
|
|
@@ -10,44 +7,25 @@ import {
|
|
|
10
7
|
ChatProviderRemoveRequestSchema,
|
|
11
8
|
ChatProviderUpdateRequestSchema,
|
|
12
9
|
ChatSettingsUpdateRequestSchema,
|
|
10
|
+
ComposerCompletionRequestSchema,
|
|
11
|
+
ComposerIntentCredentialSchema,
|
|
12
|
+
ComposerIntentRequestSchema,
|
|
13
|
+
ComposerIntentSettingsUpdateSchema,
|
|
13
14
|
FLEET_ADAPTER_CAPABILITIES,
|
|
14
|
-
HTMLVisualElement,
|
|
15
|
-
MotionConfig,
|
|
16
15
|
NETWORK_DISCONNECTED_MESSAGE,
|
|
17
16
|
QueryClient,
|
|
18
17
|
QueryClientProvider,
|
|
19
|
-
SVGVisualElement,
|
|
20
18
|
SessionTreeNavigateRequestSchema,
|
|
21
19
|
SessionTreeNavigateResponseSchema,
|
|
22
20
|
SessionTreeSnapshotResponseSchema,
|
|
23
|
-
|
|
24
|
-
animateMotionValue,
|
|
25
|
-
animateSingleValue,
|
|
26
|
-
animateTarget,
|
|
27
|
-
applyBoxDelta,
|
|
28
|
-
applyTreeDeltas,
|
|
29
|
-
circOut,
|
|
30
|
-
convertBoundingBoxToBox,
|
|
31
|
-
convertBoxToBoundingBox,
|
|
32
|
-
getOptimisedAppearId,
|
|
33
|
-
getValueTransition,
|
|
34
|
-
has2DTranslate,
|
|
35
|
-
hasScale,
|
|
36
|
-
hasTransform,
|
|
21
|
+
composerCompletionIgnores,
|
|
37
22
|
initAnalytics,
|
|
38
|
-
isKeyframesTarget,
|
|
39
|
-
isSVGElement,
|
|
40
|
-
isSVGSVGElement,
|
|
41
23
|
isServer,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
scalePoint,
|
|
48
|
-
transformBox,
|
|
49
|
-
translateAxis
|
|
50
|
-
} from "./chunk-O2IC376F.js";
|
|
24
|
+
normalizeCompletionDraft
|
|
25
|
+
} from "./chunk-5TXDGMCK.js";
|
|
26
|
+
import {
|
|
27
|
+
isModelPatternEnabled
|
|
28
|
+
} from "./chunk-WTYNN6EV.js";
|
|
51
29
|
import {
|
|
52
30
|
DEFAULT_UI_PREFERENCES,
|
|
53
31
|
applyUiPreferencesToDocument,
|
|
@@ -55,53 +33,102 @@ import {
|
|
|
55
33
|
} from "./chunk-4EBSM4JR.js";
|
|
56
34
|
import {
|
|
57
35
|
Toaster
|
|
58
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-VHLBXWEN.js";
|
|
59
37
|
import {
|
|
60
38
|
fallbackSessionLabel,
|
|
61
39
|
meaningfulSessionLabel,
|
|
62
40
|
redactSessionLabelSecrets
|
|
63
41
|
} from "./chunk-PTCKOR23.js";
|
|
64
42
|
import "./chunk-SZJUXVWG.js";
|
|
65
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-HFN4TNR3.js";
|
|
66
44
|
import {
|
|
67
45
|
isHTMLElement,
|
|
46
|
+
isObject,
|
|
68
47
|
usePresence
|
|
69
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-36BG6OPK.js";
|
|
70
49
|
import {
|
|
50
|
+
KeyframeResolver,
|
|
71
51
|
LayoutGroupContext,
|
|
72
52
|
LazyContext,
|
|
53
|
+
MotionConfigContext,
|
|
54
|
+
MotionGlobalConfig,
|
|
55
|
+
NativeAnimation,
|
|
73
56
|
SubscriptionManager,
|
|
74
57
|
SwitchLayoutGroupContext,
|
|
58
|
+
VisualElement,
|
|
59
|
+
WithPromise,
|
|
60
|
+
acceleratedValues,
|
|
75
61
|
addUniqueItem,
|
|
62
|
+
analyseComplexValue,
|
|
63
|
+
buildHTMLStyles,
|
|
64
|
+
buildSVGAttrs,
|
|
65
|
+
camelToDash,
|
|
76
66
|
cancelFrame,
|
|
77
67
|
clamp,
|
|
68
|
+
color,
|
|
69
|
+
complex,
|
|
70
|
+
containsCSSVariable,
|
|
78
71
|
cornerRadiusProps,
|
|
79
72
|
createBox,
|
|
80
73
|
createDelta,
|
|
74
|
+
cssStyleProperties,
|
|
75
|
+
defaultTransformValue,
|
|
76
|
+
findDimensionValueType,
|
|
77
|
+
flushKeyframeResolvers,
|
|
81
78
|
frame,
|
|
82
79
|
frameData,
|
|
83
80
|
frameSteps,
|
|
81
|
+
generateLinearEasing,
|
|
82
|
+
getAnimatableNone,
|
|
83
|
+
getDefaultValueType,
|
|
84
|
+
getFinalKeyframe,
|
|
85
|
+
hex,
|
|
86
|
+
hsla,
|
|
84
87
|
invariant,
|
|
85
88
|
isAnimationControls,
|
|
89
|
+
isBezierDefinition,
|
|
90
|
+
isCSSVariableName,
|
|
91
|
+
isCSSVariableToken,
|
|
92
|
+
isGenerator,
|
|
93
|
+
isMotionValue,
|
|
94
|
+
isNumOrPxType,
|
|
95
|
+
isNumericalString,
|
|
86
96
|
isRefObject,
|
|
87
97
|
isSVGComponent,
|
|
98
|
+
isSVGTag,
|
|
88
99
|
isVariantLabel,
|
|
100
|
+
isZeroValueString,
|
|
89
101
|
loadFeatures,
|
|
102
|
+
memo$1,
|
|
90
103
|
microtask,
|
|
91
104
|
millisecondsToSeconds,
|
|
92
105
|
mixNumber,
|
|
93
106
|
motionValue,
|
|
94
107
|
noop,
|
|
108
|
+
optimizedAppearDataAttribute,
|
|
95
109
|
percent,
|
|
110
|
+
positionalValues,
|
|
96
111
|
px,
|
|
112
|
+
readTransformValue,
|
|
97
113
|
removeItem,
|
|
98
114
|
resolveMotionValue,
|
|
115
|
+
resolveVariantFromProps,
|
|
116
|
+
rgba,
|
|
99
117
|
scaleCorrectors,
|
|
118
|
+
scrapeMotionValuesFromProps,
|
|
119
|
+
scrapeMotionValuesFromProps$1,
|
|
100
120
|
secondsToMilliseconds,
|
|
121
|
+
setStyle,
|
|
101
122
|
time,
|
|
123
|
+
transformPropOrder,
|
|
124
|
+
transformProps,
|
|
125
|
+
useConstant,
|
|
102
126
|
variantPriorityOrder,
|
|
103
|
-
variantProps
|
|
104
|
-
|
|
127
|
+
variantProps,
|
|
128
|
+
velocityPerSecond,
|
|
129
|
+
warning
|
|
130
|
+
} from "./chunk-QHCQDVCQ.js";
|
|
131
|
+
import "./chunk-FOMB2JR7.js";
|
|
105
132
|
import {
|
|
106
133
|
Card,
|
|
107
134
|
CardContent,
|
|
@@ -109,8 +136,10 @@ import {
|
|
|
109
136
|
CardHeader,
|
|
110
137
|
CardTitle,
|
|
111
138
|
validateAndNormalizeOpenUIHtmlArtifact
|
|
112
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-FF2M3MLP.js";
|
|
113
140
|
import {
|
|
141
|
+
COMPOSER_INTENT_COMMANDS,
|
|
142
|
+
COMPOSER_INTENT_NONE,
|
|
114
143
|
ChatNewRequestSchema,
|
|
115
144
|
ChatOpenUIArtifactUpsertRequestSchema,
|
|
116
145
|
ChatPlanPresentationSchema,
|
|
@@ -128,8 +157,11 @@ import {
|
|
|
128
157
|
SessionIdSchema,
|
|
129
158
|
UploadedAttachmentSchema,
|
|
130
159
|
ZodError,
|
|
131
|
-
|
|
132
|
-
|
|
160
|
+
composerIntentCommand,
|
|
161
|
+
decideComposerIntent,
|
|
162
|
+
external_exports,
|
|
163
|
+
isSingleTokenDraft
|
|
164
|
+
} from "./chunk-3YYNG52U.js";
|
|
133
165
|
import {
|
|
134
166
|
KNOWN_PROVIDERS,
|
|
135
167
|
OPENAI_CHAT_COMPLETIONS_PROVIDER_ID,
|
|
@@ -144,13 +176,13 @@ import {
|
|
|
144
176
|
toInstanceSlug,
|
|
145
177
|
toOccInstanceId
|
|
146
178
|
} from "./chunk-RJOANOT4.js";
|
|
147
|
-
import "./chunk-
|
|
148
|
-
import "./chunk-
|
|
149
|
-
import "./chunk-
|
|
150
|
-
import "./chunk-
|
|
151
|
-
import "./chunk-
|
|
152
|
-
import "./chunk-
|
|
153
|
-
import "./chunk-
|
|
179
|
+
import "./chunk-XZCIEF54.js";
|
|
180
|
+
import "./chunk-UXS5E6OE.js";
|
|
181
|
+
import "./chunk-UUDBEYKV.js";
|
|
182
|
+
import "./chunk-EKVRPCBJ.js";
|
|
183
|
+
import "./chunk-SGMJ5CGW.js";
|
|
184
|
+
import "./chunk-JVXQQYXB.js";
|
|
185
|
+
import "./chunk-JCK6B7ZW.js";
|
|
154
186
|
import {
|
|
155
187
|
HeadContent,
|
|
156
188
|
Outlet,
|
|
@@ -159,13 +191,13 @@ import {
|
|
|
159
191
|
createRootRoute,
|
|
160
192
|
createRouter,
|
|
161
193
|
lazyRouteComponent
|
|
162
|
-
} from "./chunk-
|
|
163
|
-
import "./chunk-
|
|
194
|
+
} from "./chunk-F5DJQ3PQ.js";
|
|
195
|
+
import "./chunk-RPWKCJHL.js";
|
|
164
196
|
import "./chunk-L547YHC4.js";
|
|
165
197
|
import "./chunk-MLKGABMK.js";
|
|
166
198
|
|
|
167
|
-
// web/app/dist/server/assets/router-
|
|
168
|
-
import { Component, Fragment, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
199
|
+
// web/app/dist/server/assets/router-DOPFvRSC.js
|
|
200
|
+
import { Component, Fragment, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
169
201
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
170
202
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
171
203
|
import { fileURLToPath } from "node:url";
|
|
@@ -175,12 +207,1295 @@ import { AuthStorage, DAEMON_PROTOCOL_NAME, DAEMON_PROTOCOL_VERSION, DaemonAgent
|
|
|
175
207
|
import { spawn } from "node:child_process";
|
|
176
208
|
import { homedir } from "node:os";
|
|
177
209
|
import { getProviders, getSupportedThinkingLevels } from "@earendil-works/pi-ai";
|
|
210
|
+
var pipe = (...transformers) => transformers.reduce((a, b) => (v) => b(a(v)));
|
|
211
|
+
var progress = /* @__NO_SIDE_EFFECTS__ */ (from, to, value) => {
|
|
212
|
+
const range = to - from;
|
|
213
|
+
return range ? (value - from) / range : 1;
|
|
214
|
+
};
|
|
215
|
+
var calcBezier = (t, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t + (3 * a2 - 6 * a1)) * t + 3 * a1) * t;
|
|
216
|
+
var subdivisionPrecision = 1e-7;
|
|
217
|
+
var subdivisionMaxIterations = 12;
|
|
218
|
+
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
|
|
219
|
+
let currentX;
|
|
220
|
+
let currentT;
|
|
221
|
+
let i = 0;
|
|
222
|
+
do {
|
|
223
|
+
currentT = lowerBound + (upperBound - lowerBound) / 2;
|
|
224
|
+
currentX = calcBezier(currentT, mX1, mX2) - x;
|
|
225
|
+
if (currentX > 0) upperBound = currentT;
|
|
226
|
+
else lowerBound = currentT;
|
|
227
|
+
} while (Math.abs(currentX) > subdivisionPrecision && ++i < subdivisionMaxIterations);
|
|
228
|
+
return currentT;
|
|
229
|
+
}
|
|
230
|
+
// @__NO_SIDE_EFFECTS__
|
|
231
|
+
function cubicBezier(mX1, mY1, mX2, mY2) {
|
|
232
|
+
if (mX1 === mY1 && mX2 === mY2) return noop;
|
|
233
|
+
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
|
234
|
+
return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
|
|
235
|
+
}
|
|
236
|
+
var mirrorEasing = /* @__NO_SIDE_EFFECTS__ */ (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
|
|
237
|
+
var reverseEasing = /* @__NO_SIDE_EFFECTS__ */ (easing) => (p) => 1 - easing(1 - p);
|
|
238
|
+
var backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
|
239
|
+
var backIn = /* @__PURE__ */ reverseEasing(backOut);
|
|
240
|
+
var backInOut = /* @__PURE__ */ mirrorEasing(backIn);
|
|
241
|
+
var anticipate = (p) => p >= 1 ? 1 : (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
|
|
242
|
+
var circIn = (p) => 1 - Math.sin(Math.acos(p));
|
|
243
|
+
var circOut = /* @__PURE__ */ reverseEasing(circIn);
|
|
244
|
+
var circInOut = /* @__PURE__ */ mirrorEasing(circIn);
|
|
245
|
+
var easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1);
|
|
246
|
+
var easeOut = /* @__PURE__ */ cubicBezier(0, 0, 0.58, 1);
|
|
247
|
+
var easeInOut = /* @__PURE__ */ cubicBezier(0.42, 0, 0.58, 1);
|
|
248
|
+
var isEasingArray = /* @__NO_SIDE_EFFECTS__ */ (ease2) => {
|
|
249
|
+
return Array.isArray(ease2) && typeof ease2[0] !== "number";
|
|
250
|
+
};
|
|
251
|
+
var easingLookup = {
|
|
252
|
+
linear: noop,
|
|
253
|
+
easeIn,
|
|
254
|
+
easeInOut,
|
|
255
|
+
easeOut,
|
|
256
|
+
circIn,
|
|
257
|
+
circInOut,
|
|
258
|
+
circOut,
|
|
259
|
+
backIn,
|
|
260
|
+
backInOut,
|
|
261
|
+
backOut,
|
|
262
|
+
anticipate
|
|
263
|
+
};
|
|
264
|
+
var isValidEasing = (easing) => {
|
|
265
|
+
return typeof easing === "string";
|
|
266
|
+
};
|
|
267
|
+
var easingDefinitionToFunction = (definition) => {
|
|
268
|
+
if (isBezierDefinition(definition)) {
|
|
269
|
+
invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`, "cubic-bezier-length");
|
|
270
|
+
const [x1, y1, x2, y2] = definition;
|
|
271
|
+
return /* @__PURE__ */ cubicBezier(x1, y1, x2, y2);
|
|
272
|
+
} else if (isValidEasing(definition)) {
|
|
273
|
+
invariant(easingLookup[definition] !== void 0, `Invalid easing type '${definition}'`, "invalid-easing-type");
|
|
274
|
+
return easingLookup[definition];
|
|
275
|
+
}
|
|
276
|
+
return definition;
|
|
277
|
+
};
|
|
278
|
+
function hueToRgb(p, q, t) {
|
|
279
|
+
if (t < 0) t += 1;
|
|
280
|
+
if (t > 1) t -= 1;
|
|
281
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
282
|
+
if (t < 1 / 2) return q;
|
|
283
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
284
|
+
return p;
|
|
285
|
+
}
|
|
286
|
+
function hslaToRgba({ hue, saturation, lightness, alpha }) {
|
|
287
|
+
hue /= 360;
|
|
288
|
+
saturation /= 100;
|
|
289
|
+
lightness /= 100;
|
|
290
|
+
let red = 0;
|
|
291
|
+
let green = 0;
|
|
292
|
+
let blue = 0;
|
|
293
|
+
if (!saturation) red = green = blue = lightness;
|
|
294
|
+
else {
|
|
295
|
+
const q = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
|
|
296
|
+
const p = 2 * lightness - q;
|
|
297
|
+
red = hueToRgb(p, q, hue + 1 / 3);
|
|
298
|
+
green = hueToRgb(p, q, hue);
|
|
299
|
+
blue = hueToRgb(p, q, hue - 1 / 3);
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
red: Math.round(red * 255),
|
|
303
|
+
green: Math.round(green * 255),
|
|
304
|
+
blue: Math.round(blue * 255),
|
|
305
|
+
alpha
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function mixImmediate(a, b) {
|
|
309
|
+
return (p) => p > 0 ? b : a;
|
|
310
|
+
}
|
|
311
|
+
var mixLinearColor = (from, to, v) => {
|
|
312
|
+
const fromExpo = from * from;
|
|
313
|
+
const expo = v * (to * to - fromExpo) + fromExpo;
|
|
314
|
+
return expo < 0 ? 0 : Math.sqrt(expo);
|
|
315
|
+
};
|
|
316
|
+
var colorTypes = [
|
|
317
|
+
hex,
|
|
318
|
+
rgba,
|
|
319
|
+
hsla
|
|
320
|
+
];
|
|
321
|
+
var getColorType = (v) => colorTypes.find((type) => type.test(v));
|
|
322
|
+
function asRGBA(color2) {
|
|
323
|
+
const type = getColorType(color2);
|
|
324
|
+
warning(Boolean(type), `'${color2}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable");
|
|
325
|
+
if (!Boolean(type)) return false;
|
|
326
|
+
let model = type.parse(color2);
|
|
327
|
+
if (type === hsla) model = hslaToRgba(model);
|
|
328
|
+
return model;
|
|
329
|
+
}
|
|
330
|
+
var mixColor = (from, to) => {
|
|
331
|
+
const fromRGBA = asRGBA(from);
|
|
332
|
+
const toRGBA = asRGBA(to);
|
|
333
|
+
if (!fromRGBA || !toRGBA) return mixImmediate(from, to);
|
|
334
|
+
const blended = { ...fromRGBA };
|
|
335
|
+
return (v) => {
|
|
336
|
+
blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v);
|
|
337
|
+
blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v);
|
|
338
|
+
blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v);
|
|
339
|
+
blended.alpha = mixNumber(fromRGBA.alpha, toRGBA.alpha, v);
|
|
340
|
+
return rgba.transform(blended);
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
var invisibleValues = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
344
|
+
function mixVisibility(origin, target) {
|
|
345
|
+
if (invisibleValues.has(origin)) return (p) => p <= 0 ? origin : target;
|
|
346
|
+
else return (p) => p >= 1 ? target : origin;
|
|
347
|
+
}
|
|
348
|
+
function mixNumber2(a, b) {
|
|
349
|
+
return (p) => mixNumber(a, b, p);
|
|
350
|
+
}
|
|
351
|
+
function getMixer(a) {
|
|
352
|
+
if (typeof a === "number") return mixNumber2;
|
|
353
|
+
else if (typeof a === "string") return isCSSVariableToken(a) ? mixImmediate : color.test(a) ? mixColor : mixComplex;
|
|
354
|
+
else if (Array.isArray(a)) return mixArray;
|
|
355
|
+
else if (typeof a === "object") return color.test(a) ? mixColor : mixObject;
|
|
356
|
+
return mixImmediate;
|
|
357
|
+
}
|
|
358
|
+
function mixArray(a, b) {
|
|
359
|
+
const output = [...a];
|
|
360
|
+
const numValues = output.length;
|
|
361
|
+
const blendValue = a.map((v, i) => getMixer(v)(v, b[i]));
|
|
362
|
+
return (p) => {
|
|
363
|
+
for (let i = 0; i < numValues; i++) output[i] = blendValue[i](p);
|
|
364
|
+
return output;
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function mixObject(a, b) {
|
|
368
|
+
const output = {
|
|
369
|
+
...a,
|
|
370
|
+
...b
|
|
371
|
+
};
|
|
372
|
+
const blendValue = {};
|
|
373
|
+
for (const key in output) if (a[key] !== void 0 && b[key] !== void 0) blendValue[key] = getMixer(a[key])(a[key], b[key]);
|
|
374
|
+
return (v) => {
|
|
375
|
+
for (const key in blendValue) output[key] = blendValue[key](v);
|
|
376
|
+
return output;
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function matchOrder(origin, target) {
|
|
380
|
+
const orderedOrigin = [];
|
|
381
|
+
const pointers = {
|
|
382
|
+
color: 0,
|
|
383
|
+
var: 0,
|
|
384
|
+
number: 0
|
|
385
|
+
};
|
|
386
|
+
for (let i = 0; i < target.values.length; i++) {
|
|
387
|
+
const type = target.types[i];
|
|
388
|
+
const originIndex = origin.indexes[type][pointers[type]];
|
|
389
|
+
const originValue = origin.values[originIndex] ?? 0;
|
|
390
|
+
orderedOrigin[i] = originValue;
|
|
391
|
+
pointers[type]++;
|
|
392
|
+
}
|
|
393
|
+
return orderedOrigin;
|
|
394
|
+
}
|
|
395
|
+
var mixComplex = (origin, target) => {
|
|
396
|
+
const template = complex.createTransformer(target);
|
|
397
|
+
const originStats = analyseComplexValue(origin);
|
|
398
|
+
const targetStats = analyseComplexValue(target);
|
|
399
|
+
if (originStats.indexes.var.length === targetStats.indexes.var.length && originStats.indexes.color.length === targetStats.indexes.color.length && originStats.indexes.number.length >= targetStats.indexes.number.length) {
|
|
400
|
+
if (invisibleValues.has(origin) && !targetStats.values.length || invisibleValues.has(target) && !originStats.values.length) return mixVisibility(origin, target);
|
|
401
|
+
return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
|
|
402
|
+
} else {
|
|
403
|
+
warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different");
|
|
404
|
+
return mixImmediate(origin, target);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
function mix(from, to, p) {
|
|
408
|
+
if (typeof from === "number" && typeof to === "number" && typeof p === "number") return mixNumber(from, to, p);
|
|
409
|
+
return getMixer(from)(from, to);
|
|
410
|
+
}
|
|
411
|
+
var frameloopDriver = (update) => {
|
|
412
|
+
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
413
|
+
return {
|
|
414
|
+
start: (keepAlive = true) => frame.update(passTimestamp, keepAlive),
|
|
415
|
+
stop: () => cancelFrame(passTimestamp),
|
|
416
|
+
/**
|
|
417
|
+
* If we're processing this frame we can use the
|
|
418
|
+
* framelocked timestamp to keep things in sync.
|
|
419
|
+
*/
|
|
420
|
+
now: () => frameData.isProcessing ? frameData.timestamp : time.now()
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
var maxGeneratorDuration = 2e4;
|
|
424
|
+
function calcGeneratorDuration(generator, timeStep = 50, maxDuration = maxGeneratorDuration, keyframes2) {
|
|
425
|
+
let duration = 0;
|
|
426
|
+
let state = generator.next(duration);
|
|
427
|
+
keyframes2?.push(state.value);
|
|
428
|
+
while (!state.done && duration < maxDuration) {
|
|
429
|
+
duration += timeStep;
|
|
430
|
+
state = generator.next(duration);
|
|
431
|
+
keyframes2?.push(state.value);
|
|
432
|
+
}
|
|
433
|
+
return duration >= maxDuration ? Infinity : duration;
|
|
434
|
+
}
|
|
435
|
+
function createGeneratorEasing(options, scale = 100, createGenerator) {
|
|
436
|
+
const generator = createGenerator({
|
|
437
|
+
...options,
|
|
438
|
+
keyframes: [0, scale]
|
|
439
|
+
});
|
|
440
|
+
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
441
|
+
return {
|
|
442
|
+
type: "keyframes",
|
|
443
|
+
ease: (progress2) => {
|
|
444
|
+
return generator.next(duration * progress2).value / scale;
|
|
445
|
+
},
|
|
446
|
+
duration: millisecondsToSeconds(duration)
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
var springDefaults = {
|
|
450
|
+
stiffness: 100,
|
|
451
|
+
damping: 10,
|
|
452
|
+
mass: 1,
|
|
453
|
+
velocity: 0,
|
|
454
|
+
duration: 800,
|
|
455
|
+
bounce: 0.3,
|
|
456
|
+
visualDuration: 0.3,
|
|
457
|
+
restSpeed: {
|
|
458
|
+
granular: 0.01,
|
|
459
|
+
default: 2
|
|
460
|
+
},
|
|
461
|
+
restDelta: {
|
|
462
|
+
granular: 5e-3,
|
|
463
|
+
default: 0.5
|
|
464
|
+
},
|
|
465
|
+
minDuration: 0.01,
|
|
466
|
+
maxDuration: 10,
|
|
467
|
+
minDamping: 0.05,
|
|
468
|
+
maxDamping: 1
|
|
469
|
+
};
|
|
470
|
+
function calcAngularFreq(undampedFreq, dampingRatio) {
|
|
471
|
+
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
472
|
+
}
|
|
473
|
+
var rootIterations = 12;
|
|
474
|
+
function approximateRoot(envelope, derivative, initialGuess) {
|
|
475
|
+
let result = initialGuess;
|
|
476
|
+
for (let i = 1; i < rootIterations; i++) result = result - envelope(result) / derivative(result);
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
var safeMin = 1e-3;
|
|
480
|
+
function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
|
|
481
|
+
let envelope;
|
|
482
|
+
let derivative;
|
|
483
|
+
warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
484
|
+
let dampingRatio = 1 - bounce;
|
|
485
|
+
dampingRatio = clamp(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
|
|
486
|
+
duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, millisecondsToSeconds(duration));
|
|
487
|
+
if (dampingRatio < 1) {
|
|
488
|
+
envelope = (undampedFreq2) => {
|
|
489
|
+
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
490
|
+
const delta = exponentialDecay * duration;
|
|
491
|
+
const a = exponentialDecay - velocity;
|
|
492
|
+
const b = calcAngularFreq(undampedFreq2, dampingRatio);
|
|
493
|
+
const c = Math.exp(-delta);
|
|
494
|
+
return safeMin - a / b * c;
|
|
495
|
+
};
|
|
496
|
+
derivative = (undampedFreq2) => {
|
|
497
|
+
const delta = undampedFreq2 * dampingRatio * duration;
|
|
498
|
+
const d = delta * velocity + velocity;
|
|
499
|
+
const e = dampingRatio * dampingRatio * undampedFreq2 * undampedFreq2 * duration;
|
|
500
|
+
const f = Math.exp(-delta);
|
|
501
|
+
const g = calcAngularFreq(undampedFreq2 * undampedFreq2, dampingRatio);
|
|
502
|
+
return (-envelope(undampedFreq2) + safeMin > 0 ? -1 : 1) * ((d - e) * f) / g;
|
|
503
|
+
};
|
|
504
|
+
} else {
|
|
505
|
+
envelope = (undampedFreq2) => {
|
|
506
|
+
return -1e-3 + Math.exp(-undampedFreq2 * duration) * ((undampedFreq2 - velocity) * duration + 1);
|
|
507
|
+
};
|
|
508
|
+
derivative = (undampedFreq2) => {
|
|
509
|
+
return Math.exp(-undampedFreq2 * duration) * ((velocity - undampedFreq2) * (duration * duration));
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
const initialGuess = 5 / duration;
|
|
513
|
+
const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
|
|
514
|
+
duration = secondsToMilliseconds(duration);
|
|
515
|
+
if (isNaN(undampedFreq)) return {
|
|
516
|
+
stiffness: springDefaults.stiffness,
|
|
517
|
+
damping: springDefaults.damping,
|
|
518
|
+
duration
|
|
519
|
+
};
|
|
520
|
+
else {
|
|
521
|
+
const stiffness = undampedFreq * undampedFreq * mass;
|
|
522
|
+
return {
|
|
523
|
+
stiffness,
|
|
524
|
+
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
|
|
525
|
+
duration
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
var durationKeys = ["duration", "bounce"];
|
|
530
|
+
var physicsKeys = [
|
|
531
|
+
"stiffness",
|
|
532
|
+
"damping",
|
|
533
|
+
"mass"
|
|
534
|
+
];
|
|
535
|
+
function isSpringType(options, keys) {
|
|
536
|
+
return keys.some((key) => options[key] !== void 0);
|
|
537
|
+
}
|
|
538
|
+
function getSpringOptions(options) {
|
|
539
|
+
let springOptions = {
|
|
540
|
+
velocity: springDefaults.velocity,
|
|
541
|
+
stiffness: springDefaults.stiffness,
|
|
542
|
+
damping: springDefaults.damping,
|
|
543
|
+
mass: springDefaults.mass,
|
|
544
|
+
isResolvedFromDuration: false,
|
|
545
|
+
...options
|
|
546
|
+
};
|
|
547
|
+
if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
|
|
548
|
+
springOptions.velocity = 0;
|
|
549
|
+
if (options.visualDuration) {
|
|
550
|
+
const visualDuration = options.visualDuration;
|
|
551
|
+
const root2 = 2 * Math.PI / (visualDuration * 1.2);
|
|
552
|
+
const stiffness = root2 * root2;
|
|
553
|
+
const damping = 2 * clamp(0.05, 1, 1 - (options.bounce || 0)) * Math.sqrt(stiffness);
|
|
554
|
+
springOptions = {
|
|
555
|
+
...springOptions,
|
|
556
|
+
mass: springDefaults.mass,
|
|
557
|
+
stiffness,
|
|
558
|
+
damping
|
|
559
|
+
};
|
|
560
|
+
} else {
|
|
561
|
+
const derived = findSpring({
|
|
562
|
+
...options,
|
|
563
|
+
velocity: 0
|
|
564
|
+
});
|
|
565
|
+
springOptions = {
|
|
566
|
+
...springOptions,
|
|
567
|
+
...derived,
|
|
568
|
+
mass: springDefaults.mass
|
|
569
|
+
};
|
|
570
|
+
springOptions.isResolvedFromDuration = true;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return springOptions;
|
|
574
|
+
}
|
|
575
|
+
function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {
|
|
576
|
+
const options = typeof optionsOrVisualDuration !== "object" ? {
|
|
577
|
+
visualDuration: optionsOrVisualDuration,
|
|
578
|
+
keyframes: [0, 1],
|
|
579
|
+
bounce
|
|
580
|
+
} : optionsOrVisualDuration;
|
|
581
|
+
let { restSpeed, restDelta } = options;
|
|
582
|
+
const origin = options.keyframes[0];
|
|
583
|
+
const target = options.keyframes[options.keyframes.length - 1];
|
|
584
|
+
const state = {
|
|
585
|
+
done: false,
|
|
586
|
+
value: origin
|
|
587
|
+
};
|
|
588
|
+
const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration } = getSpringOptions({
|
|
589
|
+
...options,
|
|
590
|
+
velocity: -millisecondsToSeconds(options.velocity || 0)
|
|
591
|
+
});
|
|
592
|
+
const initialVelocity = velocity || 0;
|
|
593
|
+
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
|
|
594
|
+
const initialDelta = target - origin;
|
|
595
|
+
const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
|
|
596
|
+
const decay = dampingRatio * undampedAngularFreq;
|
|
597
|
+
const isGranularScale = Math.abs(initialDelta) < 5;
|
|
598
|
+
restSpeed || (restSpeed = isGranularScale ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default);
|
|
599
|
+
restDelta || (restDelta = isGranularScale ? springDefaults.restDelta.granular : springDefaults.restDelta.default);
|
|
600
|
+
let resolveSpring;
|
|
601
|
+
let resolveVelocity;
|
|
602
|
+
if (dampingRatio < 1) {
|
|
603
|
+
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
604
|
+
const A = (initialVelocity + decay * initialDelta) / angularFreq;
|
|
605
|
+
const sinCoeff = decay * A + initialDelta * angularFreq;
|
|
606
|
+
const cosCoeff = decay * initialDelta - A * angularFreq;
|
|
607
|
+
let sampledT = -1;
|
|
608
|
+
let position = 0;
|
|
609
|
+
let velocityAtT = 0;
|
|
610
|
+
const sample = (t) => {
|
|
611
|
+
if (t !== sampledT) {
|
|
612
|
+
sampledT = t;
|
|
613
|
+
const envelope = Math.exp(-decay * t);
|
|
614
|
+
const sin = Math.sin(angularFreq * t);
|
|
615
|
+
const cos = Math.cos(angularFreq * t);
|
|
616
|
+
position = target - envelope * (A * sin + initialDelta * cos);
|
|
617
|
+
velocityAtT = envelope * (sinCoeff * sin + cosCoeff * cos);
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
resolveSpring = (t) => {
|
|
621
|
+
sample(t);
|
|
622
|
+
return position;
|
|
623
|
+
};
|
|
624
|
+
resolveVelocity = (t) => {
|
|
625
|
+
sample(t);
|
|
626
|
+
return velocityAtT;
|
|
627
|
+
};
|
|
628
|
+
} else if (dampingRatio === 1) {
|
|
629
|
+
resolveSpring = (t) => target - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
|
|
630
|
+
const C = initialVelocity + undampedAngularFreq * initialDelta;
|
|
631
|
+
resolveVelocity = (t) => Math.exp(-undampedAngularFreq * t) * (undampedAngularFreq * C * t - initialVelocity);
|
|
632
|
+
} else {
|
|
633
|
+
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
634
|
+
resolveSpring = (t) => {
|
|
635
|
+
const envelope = Math.exp(-decay * t);
|
|
636
|
+
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
637
|
+
return target - envelope * ((initialVelocity + decay * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
638
|
+
};
|
|
639
|
+
const P = (initialVelocity + decay * initialDelta) / dampedAngularFreq;
|
|
640
|
+
const sinhCoeff = decay * P - initialDelta * dampedAngularFreq;
|
|
641
|
+
const coshCoeff = decay * initialDelta - P * dampedAngularFreq;
|
|
642
|
+
resolveVelocity = (t) => {
|
|
643
|
+
const envelope = Math.exp(-decay * t);
|
|
644
|
+
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
645
|
+
return envelope * (sinhCoeff * Math.sinh(freqForT) + coshCoeff * Math.cosh(freqForT));
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
const generator = {
|
|
649
|
+
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
650
|
+
velocity: (t) => secondsToMilliseconds(resolveVelocity(t)),
|
|
651
|
+
next: (t) => {
|
|
652
|
+
const current = resolveSpring(t);
|
|
653
|
+
if (!isResolvedFromDuration) {
|
|
654
|
+
const currentVelocity = secondsToMilliseconds(resolveVelocity(t));
|
|
655
|
+
state.done = Math.abs(currentVelocity) <= restSpeed && Math.abs(target - current) <= restDelta;
|
|
656
|
+
} else state.done = t >= duration;
|
|
657
|
+
state.value = state.done ? target : current;
|
|
658
|
+
return state;
|
|
659
|
+
},
|
|
660
|
+
toString: () => {
|
|
661
|
+
const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
662
|
+
const easing = generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
|
|
663
|
+
return calculatedDuration + "ms " + easing;
|
|
664
|
+
},
|
|
665
|
+
toTransition: () => {
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
return generator;
|
|
669
|
+
}
|
|
670
|
+
spring.applyToOptions = (options) => {
|
|
671
|
+
const generatorOptions = createGeneratorEasing(options, 100, spring);
|
|
672
|
+
options.ease = generatorOptions.ease;
|
|
673
|
+
options.duration = secondsToMilliseconds(generatorOptions.duration);
|
|
674
|
+
options.type = "keyframes";
|
|
675
|
+
return options;
|
|
676
|
+
};
|
|
677
|
+
function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed }) {
|
|
678
|
+
const origin = keyframes2[0];
|
|
679
|
+
const state = {
|
|
680
|
+
done: false,
|
|
681
|
+
value: origin
|
|
682
|
+
};
|
|
683
|
+
const isOutOfBounds = (v) => v < min || v > max;
|
|
684
|
+
const nearestBoundary = (v) => {
|
|
685
|
+
if (min === void 0) return max;
|
|
686
|
+
if (max === void 0) return min;
|
|
687
|
+
return Math.abs(min - v) < Math.abs(max - v) ? min : max;
|
|
688
|
+
};
|
|
689
|
+
let amplitude = power * velocity;
|
|
690
|
+
const ideal = origin + amplitude;
|
|
691
|
+
const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
|
|
692
|
+
if (target !== ideal) amplitude = target - origin;
|
|
693
|
+
const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
|
|
694
|
+
const applyFriction = (t) => {
|
|
695
|
+
const delta = calcDelta(t);
|
|
696
|
+
state.done = Math.abs(delta) <= restDelta;
|
|
697
|
+
state.value = state.done ? target : target + delta;
|
|
698
|
+
};
|
|
699
|
+
let timeReachedBoundary;
|
|
700
|
+
let spring$1;
|
|
701
|
+
const checkCatchBoundary = (t) => {
|
|
702
|
+
if (!isOutOfBounds(state.value)) return;
|
|
703
|
+
timeReachedBoundary = t;
|
|
704
|
+
spring$1 = spring({
|
|
705
|
+
keyframes: [state.value, nearestBoundary(state.value)],
|
|
706
|
+
/**
|
|
707
|
+
* The friction curve is target + calcDelta(t), so its exact
|
|
708
|
+
* derivative is -calcDelta(t) / timeConstant in units/ms,
|
|
709
|
+
* converted here to the units/second expected by spring.
|
|
710
|
+
*/
|
|
711
|
+
velocity: -calcDelta(t) / timeConstant * 1e3,
|
|
712
|
+
damping: bounceDamping,
|
|
713
|
+
stiffness: bounceStiffness,
|
|
714
|
+
restDelta,
|
|
715
|
+
restSpeed
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
checkCatchBoundary(0);
|
|
719
|
+
return {
|
|
720
|
+
calculatedDuration: null,
|
|
721
|
+
next: (t) => {
|
|
722
|
+
let hasUpdatedFrame = false;
|
|
723
|
+
if (!spring$1 && timeReachedBoundary === void 0) {
|
|
724
|
+
hasUpdatedFrame = true;
|
|
725
|
+
applyFriction(t);
|
|
726
|
+
checkCatchBoundary(t);
|
|
727
|
+
}
|
|
728
|
+
if (timeReachedBoundary !== void 0 && t >= timeReachedBoundary) return spring$1.next(t - timeReachedBoundary);
|
|
729
|
+
else {
|
|
730
|
+
!hasUpdatedFrame && applyFriction(t);
|
|
731
|
+
return state;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
function createMixers(output, ease2, customMixer) {
|
|
737
|
+
const mixers = [];
|
|
738
|
+
const mixerFactory = customMixer || MotionGlobalConfig.mix || mix;
|
|
739
|
+
const numMixers = output.length - 1;
|
|
740
|
+
for (let i = 0; i < numMixers; i++) {
|
|
741
|
+
let mixer = mixerFactory(output[i], output[i + 1]);
|
|
742
|
+
if (ease2) mixer = pipe(Array.isArray(ease2) ? ease2[i] || noop : ease2, mixer);
|
|
743
|
+
mixers.push(mixer);
|
|
744
|
+
}
|
|
745
|
+
return mixers;
|
|
746
|
+
}
|
|
747
|
+
function interpolate(input, output, { clamp: isClamp = true, ease: ease2, mixer } = {}) {
|
|
748
|
+
const inputLength = input.length;
|
|
749
|
+
invariant(inputLength === output.length, "Both input and output ranges must be the same length", "range-length");
|
|
750
|
+
if (inputLength === 1) return () => output[0];
|
|
751
|
+
if (inputLength === 2 && output[0] === output[1]) return () => output[1];
|
|
752
|
+
const isZeroDeltaRange = input[0] === input[1];
|
|
753
|
+
if (input[0] > input[inputLength - 1]) {
|
|
754
|
+
input = [...input].reverse();
|
|
755
|
+
output = [...output].reverse();
|
|
756
|
+
}
|
|
757
|
+
const mixers = createMixers(output, ease2, mixer);
|
|
758
|
+
const numMixers = mixers.length;
|
|
759
|
+
const interpolator = (v) => {
|
|
760
|
+
if (isZeroDeltaRange && v < input[0]) return output[0];
|
|
761
|
+
let i = 0;
|
|
762
|
+
if (numMixers > 1) {
|
|
763
|
+
for (; i < input.length - 2; i++) if (v < input[i + 1]) break;
|
|
764
|
+
}
|
|
765
|
+
const progressInRange = /* @__PURE__ */ progress(input[i], input[i + 1], v);
|
|
766
|
+
return mixers[i](progressInRange);
|
|
767
|
+
};
|
|
768
|
+
return isClamp ? (v) => interpolator(clamp(input[0], input[inputLength - 1], v)) : interpolator;
|
|
769
|
+
}
|
|
770
|
+
function fillOffset(offset, remaining) {
|
|
771
|
+
const min = offset[offset.length - 1];
|
|
772
|
+
for (let i = 1; i <= remaining; i++) {
|
|
773
|
+
const offsetProgress = /* @__PURE__ */ progress(0, remaining, i);
|
|
774
|
+
offset.push(mixNumber(min, 1, offsetProgress));
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
function defaultOffset(arr) {
|
|
778
|
+
const offset = [0];
|
|
779
|
+
fillOffset(offset, arr.length - 1);
|
|
780
|
+
return offset;
|
|
781
|
+
}
|
|
782
|
+
function convertOffsetToTimes(offset, duration) {
|
|
783
|
+
return offset.map((o) => o * duration);
|
|
784
|
+
}
|
|
785
|
+
function defaultEasing(values, easing) {
|
|
786
|
+
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
787
|
+
}
|
|
788
|
+
function keyframes({ duration = 300, keyframes: keyframeValues, times, ease: ease2 = "easeInOut" }) {
|
|
789
|
+
const easingFunctions = /* @__PURE__ */ isEasingArray(ease2) ? ease2.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease2);
|
|
790
|
+
const state = {
|
|
791
|
+
done: false,
|
|
792
|
+
value: keyframeValues[0]
|
|
793
|
+
};
|
|
794
|
+
const mapTimeToKeyframe = interpolate(convertOffsetToTimes(times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues), duration), keyframeValues, { ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions) });
|
|
795
|
+
return {
|
|
796
|
+
calculatedDuration: duration,
|
|
797
|
+
next: (t) => {
|
|
798
|
+
state.value = mapTimeToKeyframe(t);
|
|
799
|
+
state.done = t >= duration;
|
|
800
|
+
return state;
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
var velocitySampleDuration = 5;
|
|
805
|
+
function getGeneratorVelocity(resolveValue, t, current) {
|
|
806
|
+
const prevT = Math.max(t - velocitySampleDuration, 0);
|
|
807
|
+
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
808
|
+
}
|
|
809
|
+
var transitionTypeMap = {
|
|
810
|
+
decay: inertia,
|
|
811
|
+
inertia,
|
|
812
|
+
tween: keyframes,
|
|
813
|
+
keyframes,
|
|
814
|
+
spring
|
|
815
|
+
};
|
|
816
|
+
function replaceTransitionType(transition) {
|
|
817
|
+
if (typeof transition.type === "string") transition.type = transitionTypeMap[transition.type];
|
|
818
|
+
}
|
|
819
|
+
var percentToProgress = (percent2) => percent2 / 100;
|
|
820
|
+
var JSAnimation = class extends WithPromise {
|
|
821
|
+
constructor(options) {
|
|
822
|
+
super();
|
|
823
|
+
this.state = "idle";
|
|
824
|
+
this.startTime = null;
|
|
825
|
+
this.isStopped = false;
|
|
826
|
+
this.currentTime = 0;
|
|
827
|
+
this.holdTime = null;
|
|
828
|
+
this.playbackSpeed = 1;
|
|
829
|
+
this.delayState = {
|
|
830
|
+
done: false,
|
|
831
|
+
value: void 0
|
|
832
|
+
};
|
|
833
|
+
this.stop = () => {
|
|
834
|
+
const { motionValue: motionValue2 } = this.options;
|
|
835
|
+
if (motionValue2 && motionValue2.updatedAt !== time.now()) this.tick(time.now());
|
|
836
|
+
this.isStopped = true;
|
|
837
|
+
if (this.state === "idle") return;
|
|
838
|
+
this.teardown();
|
|
839
|
+
this.options.onStop?.();
|
|
840
|
+
};
|
|
841
|
+
this.options = options;
|
|
842
|
+
this.initAnimation();
|
|
843
|
+
this.play();
|
|
844
|
+
if (options.autoplay === false) this.pause();
|
|
845
|
+
}
|
|
846
|
+
initAnimation() {
|
|
847
|
+
const { options } = this;
|
|
848
|
+
replaceTransitionType(options);
|
|
849
|
+
const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = options;
|
|
850
|
+
let { keyframes: keyframes$1 } = options;
|
|
851
|
+
const generatorFactory = type || keyframes;
|
|
852
|
+
if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") {
|
|
853
|
+
this.mixKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
|
|
854
|
+
keyframes$1 = [0, 100];
|
|
855
|
+
}
|
|
856
|
+
const generator = generatorFactory({
|
|
857
|
+
...options,
|
|
858
|
+
keyframes: keyframes$1
|
|
859
|
+
});
|
|
860
|
+
if (repeatType === "mirror") this.mirroredGenerator = generatorFactory({
|
|
861
|
+
...options,
|
|
862
|
+
keyframes: [...keyframes$1].reverse(),
|
|
863
|
+
velocity: -velocity
|
|
864
|
+
});
|
|
865
|
+
if (generator.calculatedDuration === null) generator.calculatedDuration = calcGeneratorDuration(generator);
|
|
866
|
+
const { calculatedDuration } = generator;
|
|
867
|
+
this.calculatedDuration = calculatedDuration;
|
|
868
|
+
this.resolvedDuration = calculatedDuration + repeatDelay;
|
|
869
|
+
this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay;
|
|
870
|
+
this.generator = generator;
|
|
871
|
+
}
|
|
872
|
+
updateTime(timestamp) {
|
|
873
|
+
const animationTime = Math.round(timestamp - this.startTime) * this.playbackSpeed;
|
|
874
|
+
if (this.holdTime !== null) this.currentTime = this.holdTime;
|
|
875
|
+
else this.currentTime = animationTime;
|
|
876
|
+
}
|
|
877
|
+
tick(timestamp, sample = false) {
|
|
878
|
+
const { generator, totalDuration, mixKeyframes, mirroredGenerator, resolvedDuration, calculatedDuration } = this;
|
|
879
|
+
if (this.startTime === null) return generator.next(0);
|
|
880
|
+
const { delay: delay2 = 0, keyframes: keyframes2, repeat, repeatType, repeatDelay, type, onUpdate, finalKeyframe } = this.options;
|
|
881
|
+
if (this.speed > 0) this.startTime = Math.min(this.startTime, timestamp);
|
|
882
|
+
else if (this.speed < 0) this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);
|
|
883
|
+
if (sample) this.currentTime = timestamp;
|
|
884
|
+
else this.updateTime(timestamp);
|
|
885
|
+
const timeWithoutDelay = this.currentTime - delay2 * (this.playbackSpeed >= 0 ? 1 : -1);
|
|
886
|
+
const isInDelayPhase = this.playbackSpeed >= 0 ? timeWithoutDelay < 0 : timeWithoutDelay > totalDuration;
|
|
887
|
+
this.currentTime = Math.max(timeWithoutDelay, 0);
|
|
888
|
+
if (this.state === "finished" && this.holdTime === null) this.currentTime = totalDuration;
|
|
889
|
+
let elapsed = this.currentTime;
|
|
890
|
+
let frameGenerator = generator;
|
|
891
|
+
if (repeat) {
|
|
892
|
+
const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
|
|
893
|
+
let currentIteration = Math.floor(progress2);
|
|
894
|
+
let iterationProgress = progress2 % 1;
|
|
895
|
+
if (!iterationProgress && progress2 >= 1) iterationProgress = 1;
|
|
896
|
+
iterationProgress === 1 && currentIteration--;
|
|
897
|
+
currentIteration = Math.min(currentIteration, repeat + 1);
|
|
898
|
+
if (Boolean(currentIteration % 2)) {
|
|
899
|
+
if (repeatType === "reverse") {
|
|
900
|
+
iterationProgress = 1 - iterationProgress;
|
|
901
|
+
if (repeatDelay) iterationProgress -= repeatDelay / resolvedDuration;
|
|
902
|
+
} else if (repeatType === "mirror") frameGenerator = mirroredGenerator;
|
|
903
|
+
}
|
|
904
|
+
elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
|
|
905
|
+
}
|
|
906
|
+
let state;
|
|
907
|
+
if (isInDelayPhase) {
|
|
908
|
+
this.delayState.value = keyframes2[0];
|
|
909
|
+
state = this.delayState;
|
|
910
|
+
} else state = frameGenerator.next(elapsed);
|
|
911
|
+
if (mixKeyframes && !isInDelayPhase) state.value = mixKeyframes(state.value);
|
|
912
|
+
let { done } = state;
|
|
913
|
+
if (!isInDelayPhase && calculatedDuration !== null) done = this.playbackSpeed >= 0 ? this.currentTime >= totalDuration : this.currentTime <= 0;
|
|
914
|
+
const isAnimationFinished = this.holdTime === null && (this.state === "finished" || this.state === "running" && done);
|
|
915
|
+
if (isAnimationFinished && type !== inertia) state.value = getFinalKeyframe(keyframes2, this.options, finalKeyframe, this.speed);
|
|
916
|
+
if (onUpdate) onUpdate(state.value);
|
|
917
|
+
if (isAnimationFinished) this.finish();
|
|
918
|
+
return state;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
922
|
+
* resolves when the animation finishes at all but in a future update could/should
|
|
923
|
+
* reject if its cancels.
|
|
924
|
+
*/
|
|
925
|
+
then(resolve2, reject) {
|
|
926
|
+
return this.finished.then(resolve2, reject);
|
|
927
|
+
}
|
|
928
|
+
get duration() {
|
|
929
|
+
return millisecondsToSeconds(this.calculatedDuration);
|
|
930
|
+
}
|
|
931
|
+
get iterationDuration() {
|
|
932
|
+
const { delay: delay2 = 0 } = this.options || {};
|
|
933
|
+
return this.duration + millisecondsToSeconds(delay2);
|
|
934
|
+
}
|
|
935
|
+
get time() {
|
|
936
|
+
return millisecondsToSeconds(this.currentTime);
|
|
937
|
+
}
|
|
938
|
+
set time(newTime) {
|
|
939
|
+
newTime = secondsToMilliseconds(newTime);
|
|
940
|
+
this.currentTime = newTime;
|
|
941
|
+
if (this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0) this.holdTime = newTime;
|
|
942
|
+
else if (this.driver) this.startTime = this.driver.now() - newTime / this.playbackSpeed;
|
|
943
|
+
if (this.driver) this.driver.start(false);
|
|
944
|
+
else {
|
|
945
|
+
this.startTime = 0;
|
|
946
|
+
this.state = "paused";
|
|
947
|
+
this.holdTime = newTime;
|
|
948
|
+
this.tick(newTime);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Returns the generator's velocity at the current time in units/second.
|
|
953
|
+
* Uses the analytical derivative when available (springs), avoiding
|
|
954
|
+
* the MotionValue's frame-dependent velocity estimation.
|
|
955
|
+
*/
|
|
956
|
+
getGeneratorVelocity() {
|
|
957
|
+
const t = this.currentTime;
|
|
958
|
+
if (t <= 0) return this.options.velocity || 0;
|
|
959
|
+
if (this.generator.velocity) return this.generator.velocity(t);
|
|
960
|
+
const current = this.generator.next(t).value;
|
|
961
|
+
return getGeneratorVelocity((s) => this.generator.next(s).value, t, current);
|
|
962
|
+
}
|
|
963
|
+
get speed() {
|
|
964
|
+
return this.playbackSpeed;
|
|
965
|
+
}
|
|
966
|
+
set speed(newSpeed) {
|
|
967
|
+
const hasChanged = this.playbackSpeed !== newSpeed;
|
|
968
|
+
if (hasChanged && this.driver) this.updateTime(time.now());
|
|
969
|
+
this.playbackSpeed = newSpeed;
|
|
970
|
+
if (hasChanged && this.driver) this.time = millisecondsToSeconds(this.currentTime);
|
|
971
|
+
}
|
|
972
|
+
play() {
|
|
973
|
+
if (this.isStopped) return;
|
|
974
|
+
const { driver = frameloopDriver, startTime } = this.options;
|
|
975
|
+
if (!this.driver) this.driver = driver((timestamp) => this.tick(timestamp));
|
|
976
|
+
this.options.onPlay?.();
|
|
977
|
+
const now2 = this.driver.now();
|
|
978
|
+
if (this.state === "finished") {
|
|
979
|
+
this.updateFinished();
|
|
980
|
+
this.startTime = now2;
|
|
981
|
+
} else if (this.holdTime !== null) this.startTime = now2 - this.holdTime;
|
|
982
|
+
else if (!this.startTime) this.startTime = startTime ?? now2;
|
|
983
|
+
if (this.state === "finished" && this.speed < 0) this.startTime += this.calculatedDuration;
|
|
984
|
+
this.holdTime = null;
|
|
985
|
+
this.state = "running";
|
|
986
|
+
this.driver.start();
|
|
987
|
+
}
|
|
988
|
+
pause() {
|
|
989
|
+
this.state = "paused";
|
|
990
|
+
this.updateTime(time.now());
|
|
991
|
+
this.holdTime = this.currentTime;
|
|
992
|
+
}
|
|
993
|
+
complete() {
|
|
994
|
+
if (this.state !== "running") this.play();
|
|
995
|
+
this.state = "finished";
|
|
996
|
+
this.holdTime = null;
|
|
997
|
+
}
|
|
998
|
+
finish() {
|
|
999
|
+
this.notifyFinished();
|
|
1000
|
+
this.teardown();
|
|
1001
|
+
this.state = "finished";
|
|
1002
|
+
this.options.onComplete?.();
|
|
1003
|
+
}
|
|
1004
|
+
cancel() {
|
|
1005
|
+
this.holdTime = null;
|
|
1006
|
+
this.startTime = 0;
|
|
1007
|
+
this.tick(0);
|
|
1008
|
+
this.teardown();
|
|
1009
|
+
this.options.onCancel?.();
|
|
1010
|
+
}
|
|
1011
|
+
teardown() {
|
|
1012
|
+
this.state = "idle";
|
|
1013
|
+
this.stopDriver();
|
|
1014
|
+
this.startTime = this.holdTime = null;
|
|
1015
|
+
}
|
|
1016
|
+
stopDriver() {
|
|
1017
|
+
if (!this.driver) return;
|
|
1018
|
+
this.driver.stop();
|
|
1019
|
+
this.driver = void 0;
|
|
1020
|
+
}
|
|
1021
|
+
sample(sampleTime) {
|
|
1022
|
+
this.startTime = 0;
|
|
1023
|
+
return this.tick(sampleTime, true);
|
|
1024
|
+
}
|
|
1025
|
+
attachTimeline(timeline) {
|
|
1026
|
+
if (this.options.allowFlatten) {
|
|
1027
|
+
this.options.type = "keyframes";
|
|
1028
|
+
this.options.ease = "linear";
|
|
1029
|
+
this.initAnimation();
|
|
1030
|
+
}
|
|
1031
|
+
this.driver?.stop();
|
|
1032
|
+
return timeline.observe(this);
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
var unsupportedEasingFunctions = {
|
|
1036
|
+
anticipate,
|
|
1037
|
+
backInOut,
|
|
1038
|
+
circInOut
|
|
1039
|
+
};
|
|
1040
|
+
function isUnsupportedEase(key) {
|
|
1041
|
+
return key in unsupportedEasingFunctions;
|
|
1042
|
+
}
|
|
1043
|
+
function replaceStringEasing(transition) {
|
|
1044
|
+
if (typeof transition.ease === "string" && isUnsupportedEase(transition.ease)) transition.ease = unsupportedEasingFunctions[transition.ease];
|
|
1045
|
+
}
|
|
1046
|
+
var sampleDelta = 10;
|
|
1047
|
+
var NativeAnimationExtended = class extends NativeAnimation {
|
|
1048
|
+
constructor(options) {
|
|
1049
|
+
replaceStringEasing(options);
|
|
1050
|
+
replaceTransitionType(options);
|
|
1051
|
+
super(options);
|
|
1052
|
+
if (options.startTime !== void 0 && options.autoplay !== false) this.startTime = options.startTime;
|
|
1053
|
+
this.options = options;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
1057
|
+
*
|
|
1058
|
+
* Rather than read committed styles back out of the DOM, we can
|
|
1059
|
+
* create a renderless JS animation and sample it twice to calculate
|
|
1060
|
+
* its current value, "previous" value, and therefore allow
|
|
1061
|
+
* Motion to calculate velocity for any subsequent animation.
|
|
1062
|
+
*/
|
|
1063
|
+
updateMotionValue(value) {
|
|
1064
|
+
const { motionValue: motionValue2, onUpdate, onComplete, element, ...options } = this.options;
|
|
1065
|
+
if (!motionValue2) return;
|
|
1066
|
+
if (value !== void 0) {
|
|
1067
|
+
motionValue2.set(value);
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
const sampleAnimation = new JSAnimation({
|
|
1071
|
+
...options,
|
|
1072
|
+
autoplay: false
|
|
1073
|
+
});
|
|
1074
|
+
const sampleTime = Math.max(sampleDelta, time.now() - this.startTime);
|
|
1075
|
+
const delta = clamp(0, sampleDelta, sampleTime - sampleDelta);
|
|
1076
|
+
const current = sampleAnimation.sample(sampleTime).value;
|
|
1077
|
+
const { name } = this.options;
|
|
1078
|
+
if (element && name) setStyle(element, name, current);
|
|
1079
|
+
motionValue2.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, current, delta);
|
|
1080
|
+
sampleAnimation.stop();
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
var isAnimatable = (value, name) => {
|
|
1084
|
+
if (name === "zIndex") return false;
|
|
1085
|
+
if (typeof value === "number" || Array.isArray(value)) return true;
|
|
1086
|
+
if (typeof value === "string" && (complex.test(value) || value === "0") && !value.startsWith("url(")) return true;
|
|
1087
|
+
return false;
|
|
1088
|
+
};
|
|
1089
|
+
function hasKeyframesChanged(keyframes2) {
|
|
1090
|
+
const current = keyframes2[0];
|
|
1091
|
+
if (keyframes2.length === 1) return true;
|
|
1092
|
+
for (let i = 0; i < keyframes2.length; i++) if (keyframes2[i] !== current) return true;
|
|
1093
|
+
}
|
|
1094
|
+
function canAnimate(keyframes2, name, type, velocity) {
|
|
1095
|
+
const originKeyframe = keyframes2[0];
|
|
1096
|
+
if (originKeyframe === null) return false;
|
|
1097
|
+
if (name === "display" || name === "visibility") return true;
|
|
1098
|
+
const targetKeyframe = keyframes2[keyframes2.length - 1];
|
|
1099
|
+
const isOriginAnimatable = isAnimatable(originKeyframe, name);
|
|
1100
|
+
const isTargetAnimatable = isAnimatable(targetKeyframe, name);
|
|
1101
|
+
warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". "${isOriginAnimatable ? targetKeyframe : originKeyframe}" is not an animatable value.`, "value-not-animatable");
|
|
1102
|
+
if (!isOriginAnimatable || !isTargetAnimatable) return false;
|
|
1103
|
+
return hasKeyframesChanged(keyframes2) || (type === "spring" || isGenerator(type)) && velocity;
|
|
1104
|
+
}
|
|
1105
|
+
function makeAnimationInstant(options) {
|
|
1106
|
+
options.duration = 0;
|
|
1107
|
+
options.type = "keyframes";
|
|
1108
|
+
}
|
|
1109
|
+
var browserColorFunctions = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;
|
|
1110
|
+
function hasBrowserOnlyColors(keyframes2) {
|
|
1111
|
+
for (let i = 0; i < keyframes2.length; i++) if (typeof keyframes2[i] === "string" && browserColorFunctions.test(keyframes2[i])) return true;
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
var colorProperties = /* @__PURE__ */ new Set([
|
|
1115
|
+
"color",
|
|
1116
|
+
"backgroundColor",
|
|
1117
|
+
"outlineColor",
|
|
1118
|
+
"fill",
|
|
1119
|
+
"stroke",
|
|
1120
|
+
"borderColor",
|
|
1121
|
+
"borderTopColor",
|
|
1122
|
+
"borderRightColor",
|
|
1123
|
+
"borderBottomColor",
|
|
1124
|
+
"borderLeftColor"
|
|
1125
|
+
]);
|
|
1126
|
+
var supportsWaapi = /* @__PURE__ */ memo$1(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
1127
|
+
function supportsBrowserAnimation(options) {
|
|
1128
|
+
const { motionValue: motionValue2, name, repeatDelay, repeatType, damping, type, keyframes: keyframes2 } = options;
|
|
1129
|
+
const subject = motionValue2?.owner?.current;
|
|
1130
|
+
if (!(subject instanceof HTMLElement) && !(subject instanceof SVGElement)) return false;
|
|
1131
|
+
const { onUpdate, transformTemplate } = motionValue2.owner.getProps();
|
|
1132
|
+
return supportsWaapi() && name && (acceleratedValues.has(name) || colorProperties.has(name) && hasBrowserOnlyColors(keyframes2)) && (name !== "transform" || !transformTemplate) && !onUpdate && !repeatDelay && repeatType !== "mirror" && damping !== 0 && type !== "inertia";
|
|
1133
|
+
}
|
|
1134
|
+
var MAX_RESOLVE_DELAY = 40;
|
|
1135
|
+
var AsyncMotionValueAnimation = class extends WithPromise {
|
|
1136
|
+
constructor({ autoplay = true, delay: delay2 = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", keyframes: keyframes2, name, motionValue: motionValue2, element, ...options }) {
|
|
1137
|
+
super();
|
|
1138
|
+
this.stop = () => {
|
|
1139
|
+
if (this._animation) {
|
|
1140
|
+
this._animation.stop();
|
|
1141
|
+
this.stopTimeline?.();
|
|
1142
|
+
}
|
|
1143
|
+
this.keyframeResolver?.cancel();
|
|
1144
|
+
};
|
|
1145
|
+
this.createdAt = time.now();
|
|
1146
|
+
const optionsWithDefaults = {
|
|
1147
|
+
autoplay,
|
|
1148
|
+
delay: delay2,
|
|
1149
|
+
type,
|
|
1150
|
+
repeat,
|
|
1151
|
+
repeatDelay,
|
|
1152
|
+
repeatType,
|
|
1153
|
+
name,
|
|
1154
|
+
motionValue: motionValue2,
|
|
1155
|
+
element,
|
|
1156
|
+
...options
|
|
1157
|
+
};
|
|
1158
|
+
const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver;
|
|
1159
|
+
this.keyframeResolver = new KeyframeResolver$1(keyframes2, (resolvedKeyframes, finalKeyframe, forced) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe, optionsWithDefaults, !forced), name, motionValue2, element);
|
|
1160
|
+
this.keyframeResolver?.scheduleResolve();
|
|
1161
|
+
}
|
|
1162
|
+
onKeyframesResolved(keyframes2, finalKeyframe, options, sync) {
|
|
1163
|
+
this.keyframeResolver = void 0;
|
|
1164
|
+
const { name, type, velocity, delay: delay2, isHandoff, onUpdate } = options;
|
|
1165
|
+
this.resolvedAt = time.now();
|
|
1166
|
+
let canAnimateValue = true;
|
|
1167
|
+
if (!canAnimate(keyframes2, name, type, velocity)) {
|
|
1168
|
+
canAnimateValue = false;
|
|
1169
|
+
if (MotionGlobalConfig.instantAnimations || !delay2) onUpdate?.(getFinalKeyframe(keyframes2, options, finalKeyframe));
|
|
1170
|
+
keyframes2[0] = keyframes2[keyframes2.length - 1];
|
|
1171
|
+
makeAnimationInstant(options);
|
|
1172
|
+
options.repeat = 0;
|
|
1173
|
+
}
|
|
1174
|
+
const resolvedOptions = {
|
|
1175
|
+
startTime: sync ? !this.resolvedAt ? this.createdAt : this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY ? this.resolvedAt : this.createdAt : void 0,
|
|
1176
|
+
finalKeyframe,
|
|
1177
|
+
...options,
|
|
1178
|
+
keyframes: keyframes2
|
|
1179
|
+
};
|
|
1180
|
+
const useWaapi = canAnimateValue && !isHandoff && supportsBrowserAnimation(resolvedOptions);
|
|
1181
|
+
const element = resolvedOptions.motionValue?.owner?.current;
|
|
1182
|
+
let animation;
|
|
1183
|
+
if (useWaapi) try {
|
|
1184
|
+
animation = new NativeAnimationExtended({
|
|
1185
|
+
...resolvedOptions,
|
|
1186
|
+
element
|
|
1187
|
+
});
|
|
1188
|
+
} catch {
|
|
1189
|
+
animation = new JSAnimation(resolvedOptions);
|
|
1190
|
+
}
|
|
1191
|
+
else animation = new JSAnimation(resolvedOptions);
|
|
1192
|
+
animation.finished.then(() => {
|
|
1193
|
+
this.notifyFinished();
|
|
1194
|
+
}).catch(noop);
|
|
1195
|
+
if (this.pendingTimeline) {
|
|
1196
|
+
this.stopTimeline = animation.attachTimeline(this.pendingTimeline);
|
|
1197
|
+
this.pendingTimeline = void 0;
|
|
1198
|
+
}
|
|
1199
|
+
this._animation = animation;
|
|
1200
|
+
}
|
|
1201
|
+
get finished() {
|
|
1202
|
+
if (!this._animation) return this._finished;
|
|
1203
|
+
else return this.animation.finished;
|
|
1204
|
+
}
|
|
1205
|
+
then(onResolve, _onReject) {
|
|
1206
|
+
return this.finished.finally(onResolve).then(() => {
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
get animation() {
|
|
1210
|
+
if (!this._animation) {
|
|
1211
|
+
this.keyframeResolver?.resume();
|
|
1212
|
+
flushKeyframeResolvers();
|
|
1213
|
+
}
|
|
1214
|
+
return this._animation;
|
|
1215
|
+
}
|
|
1216
|
+
get duration() {
|
|
1217
|
+
return this.animation.duration;
|
|
1218
|
+
}
|
|
1219
|
+
get iterationDuration() {
|
|
1220
|
+
return this.animation.iterationDuration;
|
|
1221
|
+
}
|
|
1222
|
+
get time() {
|
|
1223
|
+
return this.animation.time;
|
|
1224
|
+
}
|
|
1225
|
+
set time(newTime) {
|
|
1226
|
+
this.animation.time = newTime;
|
|
1227
|
+
}
|
|
1228
|
+
get speed() {
|
|
1229
|
+
return this.animation.speed;
|
|
1230
|
+
}
|
|
1231
|
+
get state() {
|
|
1232
|
+
return this.animation.state;
|
|
1233
|
+
}
|
|
1234
|
+
set speed(newSpeed) {
|
|
1235
|
+
this.animation.speed = newSpeed;
|
|
1236
|
+
}
|
|
1237
|
+
get startTime() {
|
|
1238
|
+
return this.animation.startTime;
|
|
1239
|
+
}
|
|
1240
|
+
attachTimeline(timeline) {
|
|
1241
|
+
if (this._animation) this.stopTimeline = this.animation.attachTimeline(timeline);
|
|
1242
|
+
else this.pendingTimeline = timeline;
|
|
1243
|
+
return () => this.stop();
|
|
1244
|
+
}
|
|
1245
|
+
play() {
|
|
1246
|
+
this.animation.play();
|
|
1247
|
+
}
|
|
1248
|
+
pause() {
|
|
1249
|
+
this.animation.pause();
|
|
1250
|
+
}
|
|
1251
|
+
complete() {
|
|
1252
|
+
this.animation.complete();
|
|
1253
|
+
}
|
|
1254
|
+
cancel() {
|
|
1255
|
+
if (this._animation) this.animation.cancel();
|
|
1256
|
+
this.keyframeResolver?.cancel();
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
178
1259
|
function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) {
|
|
179
1260
|
const index = Array.from(children).sort((a, b) => a.sortNodePosition(b)).indexOf(child);
|
|
180
1261
|
const numChildren = children.size;
|
|
181
1262
|
const maxStaggerDuration = (numChildren - 1) * staggerChildren;
|
|
182
1263
|
return typeof delayChildren === "function" ? delayChildren(index, numChildren) : staggerDirection === 1 ? index * staggerChildren : maxStaggerDuration - index * staggerChildren;
|
|
183
1264
|
}
|
|
1265
|
+
function resolveTransition(transition, parentTransition) {
|
|
1266
|
+
if (transition?.inherit && parentTransition) {
|
|
1267
|
+
const { inherit: _, ...rest } = transition;
|
|
1268
|
+
return {
|
|
1269
|
+
...parentTransition,
|
|
1270
|
+
...rest
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
return transition;
|
|
1274
|
+
}
|
|
1275
|
+
function getValueTransition(transition, key) {
|
|
1276
|
+
const valueTransition = transition?.[key] ?? transition?.["default"] ?? transition;
|
|
1277
|
+
if (valueTransition !== transition) return resolveTransition(valueTransition, transition);
|
|
1278
|
+
return valueTransition;
|
|
1279
|
+
}
|
|
1280
|
+
var underDampedSpring = {
|
|
1281
|
+
type: "spring",
|
|
1282
|
+
stiffness: 500,
|
|
1283
|
+
damping: 25,
|
|
1284
|
+
restSpeed: 10
|
|
1285
|
+
};
|
|
1286
|
+
var criticallyDampedSpring = (target) => ({
|
|
1287
|
+
type: "spring",
|
|
1288
|
+
stiffness: 550,
|
|
1289
|
+
damping: target === 0 ? 2 * Math.sqrt(550) : 30,
|
|
1290
|
+
restSpeed: 10
|
|
1291
|
+
});
|
|
1292
|
+
var keyframesTransition = {
|
|
1293
|
+
type: "keyframes",
|
|
1294
|
+
duration: 0.8
|
|
1295
|
+
};
|
|
1296
|
+
var ease = {
|
|
1297
|
+
type: "keyframes",
|
|
1298
|
+
ease: [
|
|
1299
|
+
0.25,
|
|
1300
|
+
0.1,
|
|
1301
|
+
0.35,
|
|
1302
|
+
1
|
|
1303
|
+
],
|
|
1304
|
+
duration: 0.3
|
|
1305
|
+
};
|
|
1306
|
+
var getDefaultTransition = (valueKey, { keyframes: keyframes2 }) => {
|
|
1307
|
+
if (keyframes2.length > 2) return keyframesTransition;
|
|
1308
|
+
else if (transformProps.has(valueKey)) return valueKey.startsWith("scale") ? criticallyDampedSpring(keyframes2[1]) : underDampedSpring;
|
|
1309
|
+
return ease;
|
|
1310
|
+
};
|
|
1311
|
+
var orchestrationKeys = /* @__PURE__ */ new Set([
|
|
1312
|
+
"when",
|
|
1313
|
+
"delay",
|
|
1314
|
+
"delayChildren",
|
|
1315
|
+
"staggerChildren",
|
|
1316
|
+
"staggerDirection",
|
|
1317
|
+
"repeat",
|
|
1318
|
+
"repeatType",
|
|
1319
|
+
"repeatDelay",
|
|
1320
|
+
"from",
|
|
1321
|
+
"elapsed"
|
|
1322
|
+
]);
|
|
1323
|
+
function isTransitionDefined(transition) {
|
|
1324
|
+
for (const key in transition) if (!orchestrationKeys.has(key)) return true;
|
|
1325
|
+
return false;
|
|
1326
|
+
}
|
|
1327
|
+
var animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
1328
|
+
const valueTransition = getValueTransition(transition, name) || {};
|
|
1329
|
+
const delay2 = valueTransition.delay || transition.delay || 0;
|
|
1330
|
+
let { elapsed = 0 } = transition;
|
|
1331
|
+
elapsed = elapsed - secondsToMilliseconds(delay2);
|
|
1332
|
+
const options = {
|
|
1333
|
+
keyframes: Array.isArray(target) ? target : [null, target],
|
|
1334
|
+
ease: "easeOut",
|
|
1335
|
+
velocity: value.getVelocity(),
|
|
1336
|
+
...valueTransition,
|
|
1337
|
+
delay: -elapsed,
|
|
1338
|
+
onUpdate: (v) => {
|
|
1339
|
+
value.set(v);
|
|
1340
|
+
valueTransition.onUpdate && valueTransition.onUpdate(v);
|
|
1341
|
+
},
|
|
1342
|
+
onComplete: () => {
|
|
1343
|
+
onComplete();
|
|
1344
|
+
valueTransition.onComplete && valueTransition.onComplete();
|
|
1345
|
+
},
|
|
1346
|
+
name,
|
|
1347
|
+
motionValue: value,
|
|
1348
|
+
element: isHandoff ? void 0 : element
|
|
1349
|
+
};
|
|
1350
|
+
if (!isTransitionDefined(valueTransition)) Object.assign(options, getDefaultTransition(name, options));
|
|
1351
|
+
options.duration && (options.duration = secondsToMilliseconds(options.duration));
|
|
1352
|
+
options.repeatDelay && (options.repeatDelay = secondsToMilliseconds(options.repeatDelay));
|
|
1353
|
+
if (options.from !== void 0) options.keyframes[0] = options.from;
|
|
1354
|
+
let shouldSkip = false;
|
|
1355
|
+
if (options.type === false || options.duration === 0 && !options.repeatDelay) {
|
|
1356
|
+
makeAnimationInstant(options);
|
|
1357
|
+
if (options.delay === 0) shouldSkip = true;
|
|
1358
|
+
}
|
|
1359
|
+
if (MotionGlobalConfig.instantAnimations || MotionGlobalConfig.skipAnimations || element?.shouldSkipAnimations || valueTransition.skipAnimations) {
|
|
1360
|
+
shouldSkip = true;
|
|
1361
|
+
makeAnimationInstant(options);
|
|
1362
|
+
options.delay = 0;
|
|
1363
|
+
}
|
|
1364
|
+
options.allowFlatten = !valueTransition.type && !valueTransition.ease;
|
|
1365
|
+
if (shouldSkip && !isHandoff && value.get() !== void 0) {
|
|
1366
|
+
const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
|
|
1367
|
+
if (finalKeyframe !== void 0) {
|
|
1368
|
+
frame.update(() => {
|
|
1369
|
+
options.onUpdate(finalKeyframe);
|
|
1370
|
+
options.onComplete();
|
|
1371
|
+
});
|
|
1372
|
+
return;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
return valueTransition.isSync ? new JSAnimation(options) : new AsyncMotionValueAnimation(options);
|
|
1376
|
+
};
|
|
1377
|
+
var splitCSSVariableRegex = /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
|
|
1378
|
+
function parseCSSVariable(current) {
|
|
1379
|
+
const match = splitCSSVariableRegex.exec(current);
|
|
1380
|
+
if (!match) return [,];
|
|
1381
|
+
const [, token1, token2, fallback] = match;
|
|
1382
|
+
return [`--${token1 ?? token2}`, fallback];
|
|
1383
|
+
}
|
|
1384
|
+
var maxDepth = 4;
|
|
1385
|
+
function getVariableValue(current, element, depth = 1) {
|
|
1386
|
+
invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
1387
|
+
const [token, fallback] = parseCSSVariable(current);
|
|
1388
|
+
if (!token) return;
|
|
1389
|
+
const resolved = window.getComputedStyle(element).getPropertyValue(token);
|
|
1390
|
+
if (resolved) {
|
|
1391
|
+
const trimmed = resolved.trim();
|
|
1392
|
+
return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
|
|
1393
|
+
}
|
|
1394
|
+
return isCSSVariableToken(fallback) ? getVariableValue(fallback, element, depth + 1) : fallback;
|
|
1395
|
+
}
|
|
1396
|
+
function resolveVariant(visualElement, definition, custom) {
|
|
1397
|
+
const props = visualElement.getProps();
|
|
1398
|
+
return resolveVariantFromProps(props, definition, custom !== void 0 ? custom : props.custom, visualElement);
|
|
1399
|
+
}
|
|
1400
|
+
var positionalKeys = /* @__PURE__ */ new Set([
|
|
1401
|
+
"width",
|
|
1402
|
+
"height",
|
|
1403
|
+
"top",
|
|
1404
|
+
"left",
|
|
1405
|
+
"right",
|
|
1406
|
+
"bottom",
|
|
1407
|
+
...transformPropOrder
|
|
1408
|
+
]);
|
|
1409
|
+
var isKeyframesTarget = (v) => {
|
|
1410
|
+
return Array.isArray(v);
|
|
1411
|
+
};
|
|
1412
|
+
function setMotionValue(visualElement, key, value) {
|
|
1413
|
+
if (visualElement.hasValue(key)) visualElement.getValue(key).set(value);
|
|
1414
|
+
else visualElement.addValue(key, motionValue(value));
|
|
1415
|
+
}
|
|
1416
|
+
function resolveFinalValueInKeyframes(v) {
|
|
1417
|
+
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
|
|
1418
|
+
}
|
|
1419
|
+
function setTarget(visualElement, definition) {
|
|
1420
|
+
let { transitionEnd = {}, transition = {}, ...target } = resolveVariant(visualElement, definition) || {};
|
|
1421
|
+
target = {
|
|
1422
|
+
...target,
|
|
1423
|
+
...transitionEnd
|
|
1424
|
+
};
|
|
1425
|
+
for (const key in target) setMotionValue(visualElement, key, resolveFinalValueInKeyframes(target[key]));
|
|
1426
|
+
}
|
|
1427
|
+
function isWillChangeMotionValue(value) {
|
|
1428
|
+
return Boolean(isMotionValue(value) && value.add);
|
|
1429
|
+
}
|
|
1430
|
+
function addValueToWillChange(visualElement, key) {
|
|
1431
|
+
const willChange = visualElement.getValue("willChange");
|
|
1432
|
+
if (isWillChangeMotionValue(willChange)) return willChange.add(key);
|
|
1433
|
+
else if (!willChange && MotionGlobalConfig.WillChange) {
|
|
1434
|
+
const newWillChange = new MotionGlobalConfig.WillChange("auto");
|
|
1435
|
+
visualElement.addValue("willChange", newWillChange);
|
|
1436
|
+
newWillChange.add(key);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
function getOptimisedAppearId(visualElement) {
|
|
1440
|
+
return visualElement.props[optimizedAppearDataAttribute];
|
|
1441
|
+
}
|
|
1442
|
+
var isBrowser = typeof window !== "undefined";
|
|
1443
|
+
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
|
|
1444
|
+
const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
|
|
1445
|
+
needsAnimating[key] = false;
|
|
1446
|
+
return shouldBlock;
|
|
1447
|
+
}
|
|
1448
|
+
function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type } = {}) {
|
|
1449
|
+
let { transition, transitionEnd, ...target } = targetAndTransition;
|
|
1450
|
+
const defaultTransition = visualElement.getDefaultTransition();
|
|
1451
|
+
transition = transition ? resolveTransition(transition, defaultTransition) : defaultTransition;
|
|
1452
|
+
const reduceMotion = transition?.reduceMotion;
|
|
1453
|
+
const skipAnimations = transition?.skipAnimations;
|
|
1454
|
+
if (transitionOverride) transition = transitionOverride;
|
|
1455
|
+
const animations2 = [];
|
|
1456
|
+
const animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type];
|
|
1457
|
+
const path = transition?.path;
|
|
1458
|
+
if (path) path.animateVisualElement(visualElement, target, transition, delay2, animations2);
|
|
1459
|
+
for (const key in target) {
|
|
1460
|
+
const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
|
|
1461
|
+
const valueTarget = target[key];
|
|
1462
|
+
if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key)) continue;
|
|
1463
|
+
const valueTransition = {
|
|
1464
|
+
delay: delay2,
|
|
1465
|
+
...getValueTransition(transition || {}, key)
|
|
1466
|
+
};
|
|
1467
|
+
if (skipAnimations) valueTransition.skipAnimations = true;
|
|
1468
|
+
const currentValue = value.get();
|
|
1469
|
+
if (currentValue !== void 0 && !value.isAnimating() && !Array.isArray(valueTarget) && valueTarget === currentValue && !valueTransition.velocity) {
|
|
1470
|
+
frame.update(() => value.set(valueTarget));
|
|
1471
|
+
continue;
|
|
1472
|
+
}
|
|
1473
|
+
let isHandoff = false;
|
|
1474
|
+
if (isBrowser && window.MotionHandoffAnimation) {
|
|
1475
|
+
const appearId = getOptimisedAppearId(visualElement);
|
|
1476
|
+
if (appearId) {
|
|
1477
|
+
const startTime = window.MotionHandoffAnimation(appearId, key, frame);
|
|
1478
|
+
if (startTime !== null) {
|
|
1479
|
+
valueTransition.startTime = startTime;
|
|
1480
|
+
isHandoff = true;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
addValueToWillChange(visualElement, key);
|
|
1485
|
+
const shouldReduceMotion = reduceMotion ?? visualElement.shouldReduceMotion;
|
|
1486
|
+
value.start(animateMotionValue(key, value, valueTarget, shouldReduceMotion && positionalKeys.has(key) ? { type: false } : valueTransition, visualElement, isHandoff));
|
|
1487
|
+
const animation = value.animation;
|
|
1488
|
+
if (animation) animations2.push(animation);
|
|
1489
|
+
}
|
|
1490
|
+
if (transitionEnd) {
|
|
1491
|
+
const applyTransitionEnd = () => frame.update(() => {
|
|
1492
|
+
transitionEnd && setTarget(visualElement, transitionEnd);
|
|
1493
|
+
});
|
|
1494
|
+
if (animations2.length) Promise.all(animations2).then(applyTransitionEnd);
|
|
1495
|
+
else applyTransitionEnd();
|
|
1496
|
+
}
|
|
1497
|
+
return animations2;
|
|
1498
|
+
}
|
|
184
1499
|
function animateVariant(visualElement, variant, options = {}) {
|
|
185
1500
|
const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? visualElement.presenceContext?.custom : void 0);
|
|
186
1501
|
let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
|
|
@@ -222,6 +1537,103 @@ function animateVisualElement(visualElement, definition, options = {}) {
|
|
|
222
1537
|
visualElement.notify("AnimationComplete", definition);
|
|
223
1538
|
});
|
|
224
1539
|
}
|
|
1540
|
+
function isNone(value) {
|
|
1541
|
+
if (typeof value === "number") return value === 0;
|
|
1542
|
+
else if (value !== null) return value === "none" || value === "0" || isZeroValueString(value);
|
|
1543
|
+
else return true;
|
|
1544
|
+
}
|
|
1545
|
+
var invalidTemplates = /* @__PURE__ */ new Set([
|
|
1546
|
+
"auto",
|
|
1547
|
+
"none",
|
|
1548
|
+
"0"
|
|
1549
|
+
]);
|
|
1550
|
+
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
|
|
1551
|
+
let i = 0;
|
|
1552
|
+
let animatableTemplate = void 0;
|
|
1553
|
+
while (i < unresolvedKeyframes.length && !animatableTemplate) {
|
|
1554
|
+
const keyframe = unresolvedKeyframes[i];
|
|
1555
|
+
if (typeof keyframe === "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length) animatableTemplate = unresolvedKeyframes[i];
|
|
1556
|
+
i++;
|
|
1557
|
+
}
|
|
1558
|
+
if (animatableTemplate && name) for (const noneIndex of noneKeyframeIndexes) unresolvedKeyframes[noneIndex] = getAnimatableNone(name, animatableTemplate);
|
|
1559
|
+
}
|
|
1560
|
+
var DOMKeyframesResolver = class extends KeyframeResolver {
|
|
1561
|
+
constructor(unresolvedKeyframes, onComplete, name, motionValue2, element) {
|
|
1562
|
+
super(unresolvedKeyframes, onComplete, name, motionValue2, element, true);
|
|
1563
|
+
}
|
|
1564
|
+
readKeyframes() {
|
|
1565
|
+
const { unresolvedKeyframes, element, name } = this;
|
|
1566
|
+
if (!element || !element.current) return;
|
|
1567
|
+
super.readKeyframes();
|
|
1568
|
+
for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
1569
|
+
let keyframe = unresolvedKeyframes[i];
|
|
1570
|
+
if (typeof keyframe === "string") {
|
|
1571
|
+
keyframe = keyframe.trim();
|
|
1572
|
+
if (isCSSVariableToken(keyframe)) {
|
|
1573
|
+
const resolved = getVariableValue(keyframe, element.current);
|
|
1574
|
+
if (resolved !== void 0) unresolvedKeyframes[i] = resolved;
|
|
1575
|
+
if (i === unresolvedKeyframes.length - 1) this.finalKeyframe = keyframe;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
this.resolveNoneKeyframes();
|
|
1580
|
+
if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) return;
|
|
1581
|
+
const [origin, target] = unresolvedKeyframes;
|
|
1582
|
+
const originType = findDimensionValueType(origin);
|
|
1583
|
+
const targetType = findDimensionValueType(target);
|
|
1584
|
+
if (containsCSSVariable(origin) !== containsCSSVariable(target) && positionalValues[name]) {
|
|
1585
|
+
this.needsMeasurement = true;
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
if (originType === targetType) return;
|
|
1589
|
+
if (isNumOrPxType(originType) && isNumOrPxType(targetType)) for (let i = 0; i < unresolvedKeyframes.length; i++) {
|
|
1590
|
+
const value = unresolvedKeyframes[i];
|
|
1591
|
+
if (typeof value === "string") unresolvedKeyframes[i] = parseFloat(value);
|
|
1592
|
+
}
|
|
1593
|
+
else if (positionalValues[name])
|
|
1594
|
+
this.needsMeasurement = true;
|
|
1595
|
+
}
|
|
1596
|
+
resolveNoneKeyframes() {
|
|
1597
|
+
const { unresolvedKeyframes, name } = this;
|
|
1598
|
+
const noneKeyframeIndexes = [];
|
|
1599
|
+
for (let i = 0; i < unresolvedKeyframes.length; i++) if (unresolvedKeyframes[i] === null || isNone(unresolvedKeyframes[i])) noneKeyframeIndexes.push(i);
|
|
1600
|
+
if (noneKeyframeIndexes.length) makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);
|
|
1601
|
+
}
|
|
1602
|
+
measureInitialState() {
|
|
1603
|
+
const { element, unresolvedKeyframes, name } = this;
|
|
1604
|
+
if (!element || !element.current) return;
|
|
1605
|
+
if (name === "height") this.suspendedScrollY = window.pageYOffset;
|
|
1606
|
+
this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
|
|
1607
|
+
unresolvedKeyframes[0] = this.measuredOrigin;
|
|
1608
|
+
const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
1609
|
+
if (measureKeyframe !== void 0) element.getValue(name, measureKeyframe).jump(measureKeyframe, false);
|
|
1610
|
+
}
|
|
1611
|
+
measureEndState() {
|
|
1612
|
+
const { element, name, unresolvedKeyframes } = this;
|
|
1613
|
+
if (!element || !element.current) return;
|
|
1614
|
+
const value = element.getValue(name);
|
|
1615
|
+
value && value.jump(this.measuredOrigin, false);
|
|
1616
|
+
const finalKeyframeIndex = unresolvedKeyframes.length - 1;
|
|
1617
|
+
const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
|
|
1618
|
+
unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
|
|
1619
|
+
if (finalKeyframe !== null && this.finalKeyframe === void 0) this.finalKeyframe = finalKeyframe;
|
|
1620
|
+
if (this.removedTransforms?.length) this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
|
|
1621
|
+
element.getValue(unsetTransformName).set(unsetTransformValue);
|
|
1622
|
+
});
|
|
1623
|
+
this.resolveNoneKeyframes();
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
1627
|
+
if (elementOrSelector == null) return [];
|
|
1628
|
+
if (elementOrSelector instanceof EventTarget) return [elementOrSelector];
|
|
1629
|
+
else if (typeof elementOrSelector === "string") {
|
|
1630
|
+
let root2 = document;
|
|
1631
|
+
if (scope) root2 = scope.current;
|
|
1632
|
+
const elements = selectorCache?.[elementOrSelector] ?? root2.querySelectorAll(elementOrSelector);
|
|
1633
|
+
return elements ? Array.from(elements) : [];
|
|
1634
|
+
}
|
|
1635
|
+
return Array.from(elementOrSelector).filter((element) => element != null);
|
|
1636
|
+
}
|
|
225
1637
|
var isDragging = {
|
|
226
1638
|
x: false,
|
|
227
1639
|
y: false
|
|
@@ -414,6 +1826,9 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
414
1826
|
});
|
|
415
1827
|
return cancelEvents;
|
|
416
1828
|
}
|
|
1829
|
+
function isSVGElement(element) {
|
|
1830
|
+
return isObject(element) && "ownerSVGElement" in element;
|
|
1831
|
+
}
|
|
417
1832
|
var resizeHandlers = /* @__PURE__ */ new WeakMap();
|
|
418
1833
|
var observer;
|
|
419
1834
|
var getSize = (borderBoxAxis, svgAxis, htmlAxis) => (target, borderBoxSize) => {
|
|
@@ -496,6 +1911,36 @@ var statsBuffer = {
|
|
|
496
1911
|
value: null,
|
|
497
1912
|
addProjectionMetrics: null
|
|
498
1913
|
};
|
|
1914
|
+
function isSVGSVGElement(element) {
|
|
1915
|
+
return isSVGElement(element) && element.tagName === "svg";
|
|
1916
|
+
}
|
|
1917
|
+
var DOMVisualElement = class extends VisualElement {
|
|
1918
|
+
constructor() {
|
|
1919
|
+
super(...arguments);
|
|
1920
|
+
this.KeyframeResolver = DOMKeyframesResolver;
|
|
1921
|
+
}
|
|
1922
|
+
sortInstanceNodePosition(a, b) {
|
|
1923
|
+
return a.compareDocumentPosition(b) & 2 ? 1 : -1;
|
|
1924
|
+
}
|
|
1925
|
+
getBaseTargetFromProps(props, key) {
|
|
1926
|
+
const style = props.style;
|
|
1927
|
+
return style ? style[key] : void 0;
|
|
1928
|
+
}
|
|
1929
|
+
removeValueFromRenderState(key, { vars, style }) {
|
|
1930
|
+
delete vars[key];
|
|
1931
|
+
delete style[key];
|
|
1932
|
+
}
|
|
1933
|
+
handleChildMotionValue() {
|
|
1934
|
+
if (this.childSubscription) {
|
|
1935
|
+
this.childSubscription();
|
|
1936
|
+
delete this.childSubscription;
|
|
1937
|
+
}
|
|
1938
|
+
const { children } = this.props;
|
|
1939
|
+
if (isMotionValue(children)) this.childSubscription = children.on("change", (latest) => {
|
|
1940
|
+
if (this.current) this.current.textContent = `${latest}`;
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
};
|
|
499
1944
|
var Feature = class {
|
|
500
1945
|
constructor(node) {
|
|
501
1946
|
this.isMounted = false;
|
|
@@ -504,6 +1949,231 @@ var Feature = class {
|
|
|
504
1949
|
update() {
|
|
505
1950
|
}
|
|
506
1951
|
};
|
|
1952
|
+
function convertBoundingBoxToBox({ top, left, right, bottom }) {
|
|
1953
|
+
return {
|
|
1954
|
+
x: {
|
|
1955
|
+
min: left,
|
|
1956
|
+
max: right
|
|
1957
|
+
},
|
|
1958
|
+
y: {
|
|
1959
|
+
min: top,
|
|
1960
|
+
max: bottom
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
function convertBoxToBoundingBox({ x, y }) {
|
|
1965
|
+
return {
|
|
1966
|
+
top: y.min,
|
|
1967
|
+
right: x.max,
|
|
1968
|
+
bottom: y.max,
|
|
1969
|
+
left: x.min
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
function transformBoxPoints(point, transformPoint2) {
|
|
1973
|
+
if (!transformPoint2) return point;
|
|
1974
|
+
const topLeft = transformPoint2({
|
|
1975
|
+
x: point.left,
|
|
1976
|
+
y: point.top
|
|
1977
|
+
});
|
|
1978
|
+
const bottomRight = transformPoint2({
|
|
1979
|
+
x: point.right,
|
|
1980
|
+
y: point.bottom
|
|
1981
|
+
});
|
|
1982
|
+
return {
|
|
1983
|
+
top: topLeft.y,
|
|
1984
|
+
left: topLeft.x,
|
|
1985
|
+
bottom: bottomRight.y,
|
|
1986
|
+
right: bottomRight.x
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
function isIdentityScale(scale) {
|
|
1990
|
+
return scale === void 0 || scale === 1;
|
|
1991
|
+
}
|
|
1992
|
+
function hasScale({ scale, scaleX, scaleY }) {
|
|
1993
|
+
return !isIdentityScale(scale) || !isIdentityScale(scaleX) || !isIdentityScale(scaleY);
|
|
1994
|
+
}
|
|
1995
|
+
function hasTransform(values) {
|
|
1996
|
+
return hasScale(values) || has2DTranslate(values) || values.z || values.rotate || values.rotateX || values.rotateY || values.skewX || values.skewY;
|
|
1997
|
+
}
|
|
1998
|
+
function has2DTranslate(values) {
|
|
1999
|
+
return is2DTranslate(values.x) || is2DTranslate(values.y);
|
|
2000
|
+
}
|
|
2001
|
+
function is2DTranslate(value) {
|
|
2002
|
+
return value && value !== "0%";
|
|
2003
|
+
}
|
|
2004
|
+
function scalePoint(point, scale, originPoint) {
|
|
2005
|
+
return originPoint + scale * (point - originPoint);
|
|
2006
|
+
}
|
|
2007
|
+
function applyPointDelta(point, translate, scale, originPoint, boxScale) {
|
|
2008
|
+
if (boxScale !== void 0) point = scalePoint(point, boxScale, originPoint);
|
|
2009
|
+
return scalePoint(point, scale, originPoint) + translate;
|
|
2010
|
+
}
|
|
2011
|
+
function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) {
|
|
2012
|
+
axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
|
|
2013
|
+
axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
|
|
2014
|
+
}
|
|
2015
|
+
function applyBoxDelta(box, { x, y }) {
|
|
2016
|
+
applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
|
|
2017
|
+
applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
|
|
2018
|
+
}
|
|
2019
|
+
var TREE_SCALE_SNAP_MIN = 0.999999999999;
|
|
2020
|
+
var TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
2021
|
+
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
2022
|
+
const treeLength = treePath.length;
|
|
2023
|
+
if (!treeLength) return;
|
|
2024
|
+
treeScale.x = treeScale.y = 1;
|
|
2025
|
+
let node;
|
|
2026
|
+
let delta;
|
|
2027
|
+
for (let i = 0; i < treeLength; i++) {
|
|
2028
|
+
node = treePath[i];
|
|
2029
|
+
delta = node.projectionDelta;
|
|
2030
|
+
const { visualElement } = node.options;
|
|
2031
|
+
if (visualElement && visualElement.props.style && visualElement.props.style.display === "contents") continue;
|
|
2032
|
+
if (isSharedTransition && node.options.layoutScroll && node.scroll && node !== node.root) {
|
|
2033
|
+
translateAxis(box.x, -node.scroll.offset.x);
|
|
2034
|
+
translateAxis(box.y, -node.scroll.offset.y);
|
|
2035
|
+
}
|
|
2036
|
+
if (delta) {
|
|
2037
|
+
treeScale.x *= delta.x.scale;
|
|
2038
|
+
treeScale.y *= delta.y.scale;
|
|
2039
|
+
applyBoxDelta(box, delta);
|
|
2040
|
+
}
|
|
2041
|
+
if (isSharedTransition && hasTransform(node.latestValues)) transformBox(box, node.latestValues, node.layout?.layoutBox);
|
|
2042
|
+
}
|
|
2043
|
+
if (treeScale.x < TREE_SCALE_SNAP_MAX && treeScale.x > TREE_SCALE_SNAP_MIN) treeScale.x = 1;
|
|
2044
|
+
if (treeScale.y < TREE_SCALE_SNAP_MAX && treeScale.y > TREE_SCALE_SNAP_MIN) treeScale.y = 1;
|
|
2045
|
+
}
|
|
2046
|
+
function translateAxis(axis, distance2) {
|
|
2047
|
+
axis.min += distance2;
|
|
2048
|
+
axis.max += distance2;
|
|
2049
|
+
}
|
|
2050
|
+
function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
|
|
2051
|
+
applyAxisDelta(axis, axisTranslate, axisScale, mixNumber(axis.min, axis.max, axisOrigin), boxScale);
|
|
2052
|
+
}
|
|
2053
|
+
function resolveAxisTranslate(value, axis) {
|
|
2054
|
+
if (typeof value === "string") return parseFloat(value) / 100 * (axis.max - axis.min);
|
|
2055
|
+
return value;
|
|
2056
|
+
}
|
|
2057
|
+
function transformBox(box, transform, sourceBox) {
|
|
2058
|
+
const resolveBox = sourceBox ?? box;
|
|
2059
|
+
transformAxis(box.x, resolveAxisTranslate(transform.x, resolveBox.x), transform.scaleX, transform.scale, transform.originX);
|
|
2060
|
+
transformAxis(box.y, resolveAxisTranslate(transform.y, resolveBox.y), transform.scaleY, transform.scale, transform.originY);
|
|
2061
|
+
}
|
|
2062
|
+
function measureViewportBox(instance, transformPoint2) {
|
|
2063
|
+
return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint2));
|
|
2064
|
+
}
|
|
2065
|
+
function measurePageBox(element, rootProjectionNode2, transformPagePoint) {
|
|
2066
|
+
const viewportBox = measureViewportBox(element, transformPagePoint);
|
|
2067
|
+
const { scroll } = rootProjectionNode2;
|
|
2068
|
+
if (scroll) {
|
|
2069
|
+
translateAxis(viewportBox.x, scroll.offset.x);
|
|
2070
|
+
translateAxis(viewportBox.y, scroll.offset.y);
|
|
2071
|
+
}
|
|
2072
|
+
return viewportBox;
|
|
2073
|
+
}
|
|
2074
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
2075
|
+
const elementStyle = element.style;
|
|
2076
|
+
let key;
|
|
2077
|
+
for (key in style) elementStyle[key] = style[key];
|
|
2078
|
+
projection?.applyProjectionStyles(elementStyle, styleProp);
|
|
2079
|
+
for (key in vars) elementStyle.setProperty(key, vars[key]);
|
|
2080
|
+
}
|
|
2081
|
+
function getComputedStyle$1(element) {
|
|
2082
|
+
return window.getComputedStyle(element);
|
|
2083
|
+
}
|
|
2084
|
+
var HTMLVisualElement = class extends DOMVisualElement {
|
|
2085
|
+
constructor() {
|
|
2086
|
+
super(...arguments);
|
|
2087
|
+
this.type = "html";
|
|
2088
|
+
this.renderInstance = renderHTML;
|
|
2089
|
+
}
|
|
2090
|
+
mount(instance) {
|
|
2091
|
+
invariant(Boolean(instance.style), "motion.create() components must forward their ref to a HTML or SVG element", "custom-component-ref");
|
|
2092
|
+
super.mount(instance);
|
|
2093
|
+
}
|
|
2094
|
+
readValueFromInstance(instance, key) {
|
|
2095
|
+
if (transformProps.has(key)) return this.projection?.isProjecting ? defaultTransformValue(key) : readTransformValue(instance, key);
|
|
2096
|
+
else {
|
|
2097
|
+
const computedStyle = getComputedStyle$1(instance);
|
|
2098
|
+
const value = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0;
|
|
2099
|
+
return typeof value === "string" ? value.trim() : value;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
measureInstanceViewportBox(instance, { transformPagePoint }) {
|
|
2103
|
+
return measureViewportBox(instance, transformPagePoint);
|
|
2104
|
+
}
|
|
2105
|
+
build(renderState, latestValues, props) {
|
|
2106
|
+
buildHTMLStyles(renderState, latestValues, props.transformTemplate);
|
|
2107
|
+
}
|
|
2108
|
+
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
2109
|
+
return scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
var camelCaseAttributes = /* @__PURE__ */ new Set([
|
|
2113
|
+
"baseFrequency",
|
|
2114
|
+
"diffuseConstant",
|
|
2115
|
+
"kernelMatrix",
|
|
2116
|
+
"kernelUnitLength",
|
|
2117
|
+
"keySplines",
|
|
2118
|
+
"keyTimes",
|
|
2119
|
+
"limitingConeAngle",
|
|
2120
|
+
"markerHeight",
|
|
2121
|
+
"markerWidth",
|
|
2122
|
+
"numOctaves",
|
|
2123
|
+
"targetX",
|
|
2124
|
+
"targetY",
|
|
2125
|
+
"surfaceScale",
|
|
2126
|
+
"specularConstant",
|
|
2127
|
+
"specularExponent",
|
|
2128
|
+
"stdDeviation",
|
|
2129
|
+
"tableValues",
|
|
2130
|
+
"viewBox",
|
|
2131
|
+
"gradientTransform",
|
|
2132
|
+
"pathLength",
|
|
2133
|
+
"startOffset",
|
|
2134
|
+
"textLength",
|
|
2135
|
+
"lengthAdjust"
|
|
2136
|
+
]);
|
|
2137
|
+
function renderSVG(element, renderState, _styleProp, projection) {
|
|
2138
|
+
renderHTML(element, renderState, void 0, projection);
|
|
2139
|
+
for (const key in renderState.attrs) element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
|
|
2140
|
+
}
|
|
2141
|
+
var SVGVisualElement = class extends DOMVisualElement {
|
|
2142
|
+
constructor() {
|
|
2143
|
+
super(...arguments);
|
|
2144
|
+
this.type = "svg";
|
|
2145
|
+
this.isSVGTag = false;
|
|
2146
|
+
this.measureInstanceViewportBox = createBox;
|
|
2147
|
+
}
|
|
2148
|
+
getBaseTargetFromProps(props, key) {
|
|
2149
|
+
return props[key];
|
|
2150
|
+
}
|
|
2151
|
+
readValueFromInstance(instance, key) {
|
|
2152
|
+
if (transformProps.has(key)) {
|
|
2153
|
+
const defaultType = getDefaultValueType(key);
|
|
2154
|
+
return defaultType ? defaultType.default || 0 : 0;
|
|
2155
|
+
}
|
|
2156
|
+
if (cssStyleProperties.includes(key)) {
|
|
2157
|
+
const value = getComputedStyle(instance)[key];
|
|
2158
|
+
if (typeof value === "string" && value) return value.trim();
|
|
2159
|
+
}
|
|
2160
|
+
key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
|
|
2161
|
+
return instance.getAttribute(key);
|
|
2162
|
+
}
|
|
2163
|
+
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
2164
|
+
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
2165
|
+
}
|
|
2166
|
+
build(renderState, latestValues, props) {
|
|
2167
|
+
buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate, props.style);
|
|
2168
|
+
}
|
|
2169
|
+
renderInstance(instance, renderState, styleProp, projection) {
|
|
2170
|
+
renderSVG(instance, renderState, styleProp, projection);
|
|
2171
|
+
}
|
|
2172
|
+
mount(instance) {
|
|
2173
|
+
this.isSVGTag = isSVGTag(instance.tagName);
|
|
2174
|
+
super.mount(instance);
|
|
2175
|
+
}
|
|
2176
|
+
};
|
|
507
2177
|
var numVariantProps = variantProps.length;
|
|
508
2178
|
function getVariantContext(visualElement) {
|
|
509
2179
|
if (!visualElement) return void 0;
|
|
@@ -869,9 +2539,14 @@ function compress(min, max, easing) {
|
|
|
869
2539
|
return (p) => {
|
|
870
2540
|
if (p < min) return 0;
|
|
871
2541
|
if (p > max) return 1;
|
|
872
|
-
return easing(progress(min, max, p));
|
|
2542
|
+
return easing(/* @__PURE__ */ progress(min, max, p));
|
|
873
2543
|
};
|
|
874
2544
|
}
|
|
2545
|
+
function animateSingleValue(value, keyframes2, options) {
|
|
2546
|
+
const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
|
|
2547
|
+
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options));
|
|
2548
|
+
return motionValue$1.animation;
|
|
2549
|
+
}
|
|
875
2550
|
function addDomEvent(target, eventName, handler, options = { passive: true }) {
|
|
876
2551
|
target.addEventListener(eventName, handler, options);
|
|
877
2552
|
return () => target.removeEventListener(eventName, handler, options);
|
|
@@ -1553,10 +3228,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
1553
3228
|
const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade));
|
|
1554
3229
|
this.animationProgress = 0;
|
|
1555
3230
|
let prevRelativeTarget;
|
|
1556
|
-
const
|
|
3231
|
+
const interpolate2 = pathFn?.interpolateProjection(delta);
|
|
1557
3232
|
this.mixTargetDelta = (latest) => {
|
|
1558
3233
|
const progress2 = latest / 1e3;
|
|
1559
|
-
const point =
|
|
3234
|
+
const point = interpolate2?.(progress2);
|
|
1560
3235
|
if (point) {
|
|
1561
3236
|
targetDelta.x.translate = point.x;
|
|
1562
3237
|
targetDelta.x.scale = mixNumber(delta.x.scale, 1, progress2);
|
|
@@ -1989,6 +3664,26 @@ function LazyMotion({ children, features, strict = false }) {
|
|
|
1989
3664
|
function isLazyBundle(features) {
|
|
1990
3665
|
return typeof features === "function";
|
|
1991
3666
|
}
|
|
3667
|
+
function MotionConfig({ children, ...config }) {
|
|
3668
|
+
const parentConfig = useContext(MotionConfigContext);
|
|
3669
|
+
config = {
|
|
3670
|
+
...parentConfig,
|
|
3671
|
+
...config
|
|
3672
|
+
};
|
|
3673
|
+
config.transition = resolveTransition(config.transition, parentConfig.transition);
|
|
3674
|
+
config.isStatic = useConstant(() => config.isStatic);
|
|
3675
|
+
const context = useMemo(() => config, [
|
|
3676
|
+
JSON.stringify(config.transition),
|
|
3677
|
+
config.transformPagePoint,
|
|
3678
|
+
config.reducedMotion,
|
|
3679
|
+
config.skipAnimations,
|
|
3680
|
+
config.isValidProp
|
|
3681
|
+
]);
|
|
3682
|
+
return jsx(MotionConfigContext.Provider, {
|
|
3683
|
+
value: context,
|
|
3684
|
+
children
|
|
3685
|
+
});
|
|
3686
|
+
}
|
|
1992
3687
|
var createDomVisualElement = (Component2, options) => {
|
|
1993
3688
|
return options.isSVG ?? isSVGComponent(Component2) ? new SVGVisualElement(options) : new HTMLVisualElement(options, { allowProjection: Component2 !== Fragment });
|
|
1994
3689
|
};
|
|
@@ -2322,8 +4017,8 @@ function calcOrigin(source, target) {
|
|
|
2322
4017
|
let origin = 0.5;
|
|
2323
4018
|
const sourceLength = calcLength(source);
|
|
2324
4019
|
const targetLength = calcLength(target);
|
|
2325
|
-
if (targetLength > sourceLength) origin = progress(target.min, target.max - sourceLength, source.min);
|
|
2326
|
-
else if (sourceLength > targetLength) origin = progress(source.min, source.max - targetLength, target.min);
|
|
4020
|
+
if (targetLength > sourceLength) origin = /* @__PURE__ */ progress(target.min, target.max - sourceLength, source.min);
|
|
4021
|
+
else if (sourceLength > targetLength) origin = /* @__PURE__ */ progress(source.min, source.max - targetLength, target.min);
|
|
2327
4022
|
return clamp(0, 1, origin);
|
|
2328
4023
|
}
|
|
2329
4024
|
function rebaseAxisConstraints(layout2, constraints) {
|
|
@@ -2543,7 +4238,7 @@ var VisualElementDragControls = class {
|
|
|
2543
4238
|
};
|
|
2544
4239
|
const bounceStiffness = dragElastic ? 200 : 1e6;
|
|
2545
4240
|
const bounceDamping = dragElastic ? 40 : 1e7;
|
|
2546
|
-
const
|
|
4241
|
+
const inertia2 = {
|
|
2547
4242
|
type: "inertia",
|
|
2548
4243
|
velocity: dragMomentum ? velocity[axis] : 0,
|
|
2549
4244
|
bounceStiffness,
|
|
@@ -2554,7 +4249,7 @@ var VisualElementDragControls = class {
|
|
|
2554
4249
|
...dragTransition,
|
|
2555
4250
|
...transition
|
|
2556
4251
|
};
|
|
2557
|
-
return this.startAxisValueAnimation(axis,
|
|
4252
|
+
return this.startAxisValueAnimation(axis, inertia2);
|
|
2558
4253
|
});
|
|
2559
4254
|
return Promise.all(momentumAnimations).then(onDragTransitionEnd);
|
|
2560
4255
|
}
|
|
@@ -3079,7 +4774,7 @@ function MotionRuntime({ children }) {
|
|
|
3079
4774
|
})
|
|
3080
4775
|
});
|
|
3081
4776
|
}
|
|
3082
|
-
var globals_default = "/assets/globals-
|
|
4777
|
+
var globals_default = "/assets/globals-BiAbxPQ2.css";
|
|
3083
4778
|
function makeQueryClient() {
|
|
3084
4779
|
return new QueryClient({ defaultOptions: { queries: {
|
|
3085
4780
|
staleTime: 6e4,
|
|
@@ -3093,7 +4788,7 @@ function getQueryClient() {
|
|
|
3093
4788
|
if (!browserQueryClient) browserQueryClient = makeQueryClient();
|
|
3094
4789
|
return browserQueryClient;
|
|
3095
4790
|
}
|
|
3096
|
-
var Route$
|
|
4791
|
+
var Route$29 = createRootRoute({
|
|
3097
4792
|
head: () => ({
|
|
3098
4793
|
meta: [
|
|
3099
4794
|
{ charSet: "utf-8" },
|
|
@@ -3161,8 +4856,8 @@ function RootDocument({ children }) {
|
|
|
3161
4856
|
] })]
|
|
3162
4857
|
});
|
|
3163
4858
|
}
|
|
3164
|
-
var $$splitComponentImporter = () => import("./routes-
|
|
3165
|
-
var Route$
|
|
4859
|
+
var $$splitComponentImporter = () => import("./routes-i2Ai-ZwX-SMSFONDQ.js");
|
|
4860
|
+
var Route$28 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter, "component") });
|
|
3166
4861
|
var ManagedAttachmentValidationError = class extends Error {
|
|
3167
4862
|
status;
|
|
3168
4863
|
constructor(message, status) {
|
|
@@ -5859,14 +7554,14 @@ function contentToChatParts(content) {
|
|
|
5859
7554
|
}
|
|
5860
7555
|
return parts;
|
|
5861
7556
|
}
|
|
5862
|
-
function isRecord(value) {
|
|
7557
|
+
function isRecord$1(value) {
|
|
5863
7558
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5864
7559
|
}
|
|
5865
7560
|
var PRIVATE_PAYLOAD_KEY = /(?:api[_-]?key|access[_-]?token|refresh[_-]?token|password|secret|authorization|sessionDir|fullOutputPath|harnessStatePath)/i;
|
|
5866
7561
|
function browserSafePayload(value, key) {
|
|
5867
7562
|
if (key && PRIVATE_PAYLOAD_KEY.test(key)) return "[redacted]";
|
|
5868
7563
|
if (Array.isArray(value)) return value.map((item) => browserSafePayload(item));
|
|
5869
|
-
if (isRecord(value)) return Object.fromEntries(Object.entries(value).map(([entryKey, entryValue]) => [entryKey, browserSafePayload(entryValue, entryKey)]));
|
|
7564
|
+
if (isRecord$1(value)) return Object.fromEntries(Object.entries(value).map(([entryKey, entryValue]) => [entryKey, browserSafePayload(entryValue, entryKey)]));
|
|
5870
7565
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) return value;
|
|
5871
7566
|
}
|
|
5872
7567
|
function stringifyPayload(value) {
|
|
@@ -6550,7 +8245,7 @@ function reasoningFrame(state, phase, streaming) {
|
|
|
6550
8245
|
};
|
|
6551
8246
|
}
|
|
6552
8247
|
function sentAgentMessageId(value) {
|
|
6553
|
-
const record2 = isRecord(value) ? value : void 0;
|
|
8248
|
+
const record2 = isRecord$1(value) ? value : void 0;
|
|
6554
8249
|
return typeof record2?.id === "string" ? record2.id : void 0;
|
|
6555
8250
|
}
|
|
6556
8251
|
function rememberSentAgentMessage(state, toolCallId, message) {
|
|
@@ -6565,8 +8260,8 @@ function withSentAgentMessages(state, toolCallId, value) {
|
|
|
6565
8260
|
if (!toolCallId) return value;
|
|
6566
8261
|
const sentAgentMessages = state.currentToolSentAgentMessages[toolCallId];
|
|
6567
8262
|
if (!sentAgentMessages || sentAgentMessages.length === 0) return value;
|
|
6568
|
-
const base = isRecord(value) ? value : {};
|
|
6569
|
-
const details = isRecord(base.details) ? base.details : {};
|
|
8263
|
+
const base = isRecord$1(value) ? value : {};
|
|
8264
|
+
const details = isRecord$1(base.details) ? base.details : {};
|
|
6570
8265
|
return {
|
|
6571
8266
|
...base,
|
|
6572
8267
|
details: {
|
|
@@ -9060,14 +10755,14 @@ var PrimeBridge = class {
|
|
|
9060
10755
|
return session;
|
|
9061
10756
|
}
|
|
9062
10757
|
};
|
|
9063
|
-
var globalStore = globalThis;
|
|
10758
|
+
var globalStore$2 = globalThis;
|
|
9064
10759
|
function getBridge() {
|
|
9065
|
-
if (!globalStore.__primeBridge) globalStore.__primeBridge = new PrimeBridge({
|
|
10760
|
+
if (!globalStore$2.__primeBridge) globalStore$2.__primeBridge = new PrimeBridge({
|
|
9066
10761
|
kernelTimeoutMs: 3e4,
|
|
9067
10762
|
ringBufferCapacity: 500,
|
|
9068
10763
|
dialogTimeoutMs: 6e4
|
|
9069
10764
|
});
|
|
9070
|
-
return globalStore.__primeBridge;
|
|
10765
|
+
return globalStore$2.__primeBridge;
|
|
9071
10766
|
}
|
|
9072
10767
|
function isLoopbackHostname(hostname) {
|
|
9073
10768
|
const host = hostname.toLowerCase().replace(/\.$/, "");
|
|
@@ -9808,6 +11503,386 @@ function handleChatCommandsGet(request) {
|
|
|
9808
11503
|
});
|
|
9809
11504
|
}, request);
|
|
9810
11505
|
}
|
|
11506
|
+
function normalizeCompletionText(text) {
|
|
11507
|
+
return normalizeCompletionDraft(text);
|
|
11508
|
+
}
|
|
11509
|
+
function longestCommonPrefix(values) {
|
|
11510
|
+
const first = values[0];
|
|
11511
|
+
if (first === void 0) return "";
|
|
11512
|
+
let prefix = first;
|
|
11513
|
+
for (let index = 1; index < values.length; index += 1) {
|
|
11514
|
+
const value = values[index] ?? "";
|
|
11515
|
+
const limit = Math.min(prefix.length, value.length);
|
|
11516
|
+
let shared = 0;
|
|
11517
|
+
while (shared < limit && prefix[shared]?.toLowerCase() === value[shared]?.toLowerCase()) shared += 1;
|
|
11518
|
+
prefix = prefix.slice(0, shared);
|
|
11519
|
+
if (prefix.length === 0) break;
|
|
11520
|
+
}
|
|
11521
|
+
return prefix;
|
|
11522
|
+
}
|
|
11523
|
+
function sessionIdFromFile(sessionFile) {
|
|
11524
|
+
return (sessionFile.split(/[/\\]/).pop() ?? "").replace(/\.jsonl$/i, "");
|
|
11525
|
+
}
|
|
11526
|
+
function isFromSession(candidate, sessionId) {
|
|
11527
|
+
if (!sessionId) return false;
|
|
11528
|
+
if (candidate.sessionId) return candidate.sessionId === sessionId;
|
|
11529
|
+
if (!candidate.sessionFile) return false;
|
|
11530
|
+
return sessionIdFromFile(candidate.sessionFile) === sessionId;
|
|
11531
|
+
}
|
|
11532
|
+
function findCompletion(draft, candidates, options = {}) {
|
|
11533
|
+
const minChars = options.minChars ?? 4;
|
|
11534
|
+
const maxChars = options.maxChars ?? 200;
|
|
11535
|
+
const normalizedDraft = normalizeCompletionText(draft);
|
|
11536
|
+
if (normalizedDraft.length < minChars) return void 0;
|
|
11537
|
+
const needle = normalizedDraft.toLowerCase();
|
|
11538
|
+
const matched = [];
|
|
11539
|
+
for (const candidate of candidates) {
|
|
11540
|
+
const text = normalizeCompletionText(candidate.text);
|
|
11541
|
+
if (text.length <= normalizedDraft.length) continue;
|
|
11542
|
+
if (text.length > maxChars) continue;
|
|
11543
|
+
if (!text.toLowerCase().startsWith(needle)) continue;
|
|
11544
|
+
matched.push({
|
|
11545
|
+
candidate,
|
|
11546
|
+
text
|
|
11547
|
+
});
|
|
11548
|
+
}
|
|
11549
|
+
if (matched.length === 0) return void 0;
|
|
11550
|
+
const sessionMatches = matched.filter((entry) => isFromSession(entry.candidate, options.sessionId));
|
|
11551
|
+
const tier = sessionMatches.length > 0 ? sessionMatches : matched;
|
|
11552
|
+
const source = sessionMatches.length > 0 ? "session" : "corpus";
|
|
11553
|
+
const ranked = [...tier].sort((a, b) => b.candidate.at - a.candidate.at || b.text.length - a.text.length);
|
|
11554
|
+
const best = ranked[0];
|
|
11555
|
+
if (!best) return void 0;
|
|
11556
|
+
const bestRemainder = best.text.slice(normalizedDraft.length);
|
|
11557
|
+
const remainders = [bestRemainder, ...ranked.filter((entry) => entry !== best).map((entry) => entry.text.slice(normalizedDraft.length))];
|
|
11558
|
+
const agreed = longestCommonPrefix(remainders);
|
|
11559
|
+
if (agreed.length === 0) return void 0;
|
|
11560
|
+
const shortestRemainder = Math.min(...remainders.map((remainder) => remainder.length));
|
|
11561
|
+
const agreement = shortestRemainder === 0 ? 0 : agreed.length / shortestRemainder;
|
|
11562
|
+
const confidence = Math.min(1, agreement);
|
|
11563
|
+
if (confidence < (options.floor ?? 0.5)) return void 0;
|
|
11564
|
+
const extendConfidence = options.extendConfidence ?? 0.8;
|
|
11565
|
+
return {
|
|
11566
|
+
completion: normalizedDraft + (source === "corpus" ? agreed : confidence >= extendConfidence ? bestRemainder : agreed),
|
|
11567
|
+
confidence,
|
|
11568
|
+
source,
|
|
11569
|
+
candidateCount: ranked.length
|
|
11570
|
+
};
|
|
11571
|
+
}
|
|
11572
|
+
function harvestPromptCandidates(messages, at, maxChars = 200) {
|
|
11573
|
+
const out = [];
|
|
11574
|
+
for (const message of messages) {
|
|
11575
|
+
if (message.role !== "user") continue;
|
|
11576
|
+
const text = normalizeCompletionText(message.text);
|
|
11577
|
+
if (text.length < 8 || text.length > maxChars) continue;
|
|
11578
|
+
if (text.startsWith("<") || text.startsWith("[harness") || text.includes("<harness_state>")) continue;
|
|
11579
|
+
out.push({
|
|
11580
|
+
text,
|
|
11581
|
+
at
|
|
11582
|
+
});
|
|
11583
|
+
}
|
|
11584
|
+
return out;
|
|
11585
|
+
}
|
|
11586
|
+
var INDEX_READY_TIMEOUT_MS = 250;
|
|
11587
|
+
function createComposerCompletionService(options) {
|
|
11588
|
+
return { async complete(draft, sessionId) {
|
|
11589
|
+
if (composerCompletionIgnores(draft)) return {};
|
|
11590
|
+
await Promise.race([options.index.ready(), new Promise((resolve2) => setTimeout(resolve2, INDEX_READY_TIMEOUT_MS))]);
|
|
11591
|
+
const suggestion = findCompletion(draft, options.index.candidates(), { sessionId });
|
|
11592
|
+
if (!suggestion) return {};
|
|
11593
|
+
return {
|
|
11594
|
+
completion: suggestion.completion,
|
|
11595
|
+
confidence: suggestion.confidence,
|
|
11596
|
+
source: suggestion.source
|
|
11597
|
+
};
|
|
11598
|
+
} };
|
|
11599
|
+
}
|
|
11600
|
+
function stringValue(value) {
|
|
11601
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
11602
|
+
}
|
|
11603
|
+
function timestampValue(value) {
|
|
11604
|
+
if (value instanceof Date) return value.toISOString();
|
|
11605
|
+
return stringValue(value);
|
|
11606
|
+
}
|
|
11607
|
+
function messageCountValue(value) {
|
|
11608
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
|
|
11609
|
+
}
|
|
11610
|
+
function normalizeSessionListRow(source) {
|
|
11611
|
+
const raw = source;
|
|
11612
|
+
const sessionId = stringValue(raw.sessionId) ?? stringValue(raw.id);
|
|
11613
|
+
const cwd = stringValue(raw.cwd);
|
|
11614
|
+
if (!sessionId || !cwd) throw new Error("The Prime Agent session listing returned an invalid session entry");
|
|
11615
|
+
const createdAt = timestampValue(raw.created) ?? timestampValue(raw.modified) ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
11616
|
+
const updatedAt = timestampValue(raw.modified) ?? timestampValue(raw.created) ?? createdAt;
|
|
11617
|
+
const isSubagent2 = typeof raw.runtimeKind === "string" ? raw.runtimeKind === "subagent" : Boolean(raw.rlmChildId ?? raw.rlmParentNodeId ?? raw.parentActiveSessionId ?? raw.parentSessionId ?? raw.parentSessionPath);
|
|
11618
|
+
return {
|
|
11619
|
+
source,
|
|
11620
|
+
sessionId,
|
|
11621
|
+
cwd,
|
|
11622
|
+
title: meaningfulSessionLabel(stringValue(raw.sessionName) ?? stringValue(raw.name)),
|
|
11623
|
+
createdAt,
|
|
11624
|
+
updatedAt,
|
|
11625
|
+
messageCount: messageCountValue(raw.messageCount),
|
|
11626
|
+
firstMessage: meaningfulSessionLabel(typeof raw.firstMessage === "string" ? raw.firstMessage : void 0) ?? "",
|
|
11627
|
+
isSubagent: isSubagent2
|
|
11628
|
+
};
|
|
11629
|
+
}
|
|
11630
|
+
function sessionSourcePath(source) {
|
|
11631
|
+
const raw = source;
|
|
11632
|
+
return stringValue(raw.sessionFile) ?? stringValue(raw.path);
|
|
11633
|
+
}
|
|
11634
|
+
function latestBy(entries, time2) {
|
|
11635
|
+
if (entries.length === 0) return void 0;
|
|
11636
|
+
return entries.reduce((latest, entry) => time2(entry) >= time2(latest) ? entry : latest);
|
|
11637
|
+
}
|
|
11638
|
+
function presentationListActivity(presentation) {
|
|
11639
|
+
if (!presentation) return { activityCount: 0 };
|
|
11640
|
+
const artifacts = presentation.artifactRuns.flatMap((run) => run.artifacts);
|
|
11641
|
+
const latestRefinement = latestBy(presentation.refinements, (entry) => entry.timestamp);
|
|
11642
|
+
const latestArtifact = latestBy(artifacts, (entry) => entry.timestamp);
|
|
11643
|
+
const latestBash = latestBy(presentation.userBash, (entry) => entry.startedAt);
|
|
11644
|
+
return {
|
|
11645
|
+
title: meaningfulSessionLabel(presentation.sessionName) ?? meaningfulSessionLabel(latestRefinement?.summary) ?? meaningfulSessionLabel(latestArtifact?.title) ?? meaningfulSessionLabel(latestBash?.command),
|
|
11646
|
+
activityCount: presentation.refinements.length + artifacts.length + presentation.userBash.length
|
|
11647
|
+
};
|
|
11648
|
+
}
|
|
11649
|
+
function applyPresentationToSessionRow(row, presentation) {
|
|
11650
|
+
const { title: presentationTitle, activityCount } = presentationListActivity(presentation);
|
|
11651
|
+
const firstMessage = row.firstMessage || presentationTitle || "";
|
|
11652
|
+
return {
|
|
11653
|
+
title: row.title ?? meaningfulSessionLabel(firstMessage) ?? presentationTitle ?? fallbackSessionLabel(row.sessionId),
|
|
11654
|
+
firstMessage,
|
|
11655
|
+
messageCount: row.messageCount > 0 ? row.messageCount : activityCount > 0 ? 1 : 0
|
|
11656
|
+
};
|
|
11657
|
+
}
|
|
11658
|
+
function sessionNeedsPresentationJoin(row) {
|
|
11659
|
+
return row.messageCount === 0 || !row.title || !row.firstMessage;
|
|
11660
|
+
}
|
|
11661
|
+
async function loadSessionListPresentation(row, source, livePresentation) {
|
|
11662
|
+
const liveActivity = presentationListActivity(livePresentation);
|
|
11663
|
+
if (liveActivity.activityCount > 0 || liveActivity.title) return livePresentation;
|
|
11664
|
+
if (!sessionNeedsPresentationJoin(row)) return livePresentation;
|
|
11665
|
+
const path = sessionSourcePath(source);
|
|
11666
|
+
if (!path) return livePresentation;
|
|
11667
|
+
return await loadManagedPrimePresentation({ sessionPath: path }) ?? livePresentation;
|
|
11668
|
+
}
|
|
11669
|
+
var PROMPT_INDEX_MAX_SESSION_ENTRIES = 1e4;
|
|
11670
|
+
var PROMPT_INDEX_CANDIDATE_LIMIT = 2e3;
|
|
11671
|
+
var PROMPT_INDEX_RETRY_BACKOFF_MS = 6e4;
|
|
11672
|
+
var PROMPT_INDEX_FILE = "fleet-prompt-index.json";
|
|
11673
|
+
function promptIndexPath(agentDir) {
|
|
11674
|
+
return join(agentDir, PROMPT_INDEX_FILE);
|
|
11675
|
+
}
|
|
11676
|
+
function isSubagent(session) {
|
|
11677
|
+
return session.isSubagent === true;
|
|
11678
|
+
}
|
|
11679
|
+
function sessionRecency(session) {
|
|
11680
|
+
const raw = session.modified;
|
|
11681
|
+
const parsed = raw ? Date.parse(raw) : NaN;
|
|
11682
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
11683
|
+
}
|
|
11684
|
+
async function readPersisted(agentDir) {
|
|
11685
|
+
try {
|
|
11686
|
+
const raw = JSON.parse(await readFile(promptIndexPath(agentDir), "utf8"));
|
|
11687
|
+
if (raw.version !== 1 || !Array.isArray(raw.sessions)) return void 0;
|
|
11688
|
+
const sessions2 = raw.sessions.filter((entry) => typeof entry?.sessionFile === "string" && typeof entry.modified === "string" && Array.isArray(entry.prompts) && entry.prompts.every((prompt) => typeof prompt === "string"));
|
|
11689
|
+
const emptyStreak = typeof raw.emptyStreak === "number" && raw.emptyStreak > 0 ? raw.emptyStreak : 0;
|
|
11690
|
+
return {
|
|
11691
|
+
version: 1,
|
|
11692
|
+
builtAt: typeof raw.builtAt === "string" ? raw.builtAt : "",
|
|
11693
|
+
emptyStreak,
|
|
11694
|
+
sessions: sessions2
|
|
11695
|
+
};
|
|
11696
|
+
} catch {
|
|
11697
|
+
return;
|
|
11698
|
+
}
|
|
11699
|
+
}
|
|
11700
|
+
async function writePersisted(agentDir, index) {
|
|
11701
|
+
const path = promptIndexPath(agentDir);
|
|
11702
|
+
await mkdir(dirname(path), { recursive: true });
|
|
11703
|
+
const temporary = `${path}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
11704
|
+
await writeFile(temporary, `${JSON.stringify(index)}
|
|
11705
|
+
`, "utf8");
|
|
11706
|
+
await rename(temporary, path);
|
|
11707
|
+
}
|
|
11708
|
+
function flattenPromptIndex(index, limit) {
|
|
11709
|
+
const out = [];
|
|
11710
|
+
for (const session of index.sessions) {
|
|
11711
|
+
const base = Date.parse(session.modified);
|
|
11712
|
+
const at = Number.isFinite(base) ? base : 0;
|
|
11713
|
+
const sessionId = sessionIdFromFile(session.sessionFile);
|
|
11714
|
+
session.prompts.forEach((text, offset) => {
|
|
11715
|
+
out.push({
|
|
11716
|
+
text,
|
|
11717
|
+
at: at + Math.min(offset, 999) / 1e3,
|
|
11718
|
+
sessionFile: session.sessionFile,
|
|
11719
|
+
sessionId
|
|
11720
|
+
});
|
|
11721
|
+
});
|
|
11722
|
+
}
|
|
11723
|
+
out.sort((a, b) => b.at - a.at);
|
|
11724
|
+
return out.slice(0, limit);
|
|
11725
|
+
}
|
|
11726
|
+
function createPromptIndex(options) {
|
|
11727
|
+
const limit = options.sessionLimit ?? 2e3;
|
|
11728
|
+
const now2 = options.now ?? Date.now;
|
|
11729
|
+
const log = options.log ?? (() => {
|
|
11730
|
+
});
|
|
11731
|
+
let persisted;
|
|
11732
|
+
let loading;
|
|
11733
|
+
let building;
|
|
11734
|
+
let retryAfter = 0;
|
|
11735
|
+
let flattened;
|
|
11736
|
+
const load = () => {
|
|
11737
|
+
loading ??= (async () => {
|
|
11738
|
+
persisted = await readPersisted(options.agentDir);
|
|
11739
|
+
flattened = void 0;
|
|
11740
|
+
})();
|
|
11741
|
+
return loading;
|
|
11742
|
+
};
|
|
11743
|
+
load();
|
|
11744
|
+
const build = async () => {
|
|
11745
|
+
await load();
|
|
11746
|
+
const previous = new Map((persisted?.sessions ?? []).map((entry) => [entry.sessionFile, entry]));
|
|
11747
|
+
let sessions2;
|
|
11748
|
+
try {
|
|
11749
|
+
sessions2 = await options.listSessions();
|
|
11750
|
+
} catch (error) {
|
|
11751
|
+
log(`prompt index: session listing failed (${error instanceof Error ? error.name : "unknown"})`);
|
|
11752
|
+
return false;
|
|
11753
|
+
}
|
|
11754
|
+
const scoped = sessions2.filter((session) => !isSubagent(session)).filter((session) => typeof session.sessionFile === "string" && session.sessionFile.length > 0).sort((a, b) => sessionRecency(b) - sessionRecency(a)).slice(0, limit);
|
|
11755
|
+
const next = [];
|
|
11756
|
+
for (const session of scoped) {
|
|
11757
|
+
const modified = session.modified ?? "";
|
|
11758
|
+
const cached = previous.get(session.sessionFile);
|
|
11759
|
+
if (cached && cached.modified === modified) {
|
|
11760
|
+
next.push(cached);
|
|
11761
|
+
continue;
|
|
11762
|
+
}
|
|
11763
|
+
try {
|
|
11764
|
+
const messages = await options.openSession(session.sessionFile);
|
|
11765
|
+
if (messages.length > 1e4) {
|
|
11766
|
+
if (cached) next.push(cached);
|
|
11767
|
+
else log(`prompt index: skipped ${session.sessionFile} (${messages.length} entries > ${PROMPT_INDEX_MAX_SESSION_ENTRIES})`);
|
|
11768
|
+
continue;
|
|
11769
|
+
}
|
|
11770
|
+
next.push({
|
|
11771
|
+
sessionFile: session.sessionFile,
|
|
11772
|
+
modified,
|
|
11773
|
+
prompts: harvestPromptCandidates(messages, 0).map((candidate) => candidate.text)
|
|
11774
|
+
});
|
|
11775
|
+
} catch {
|
|
11776
|
+
if (cached) next.push(cached);
|
|
11777
|
+
}
|
|
11778
|
+
}
|
|
11779
|
+
const harvest = next.reduce((total, entry) => total + entry.prompts.length, 0);
|
|
11780
|
+
const hadCorpus = (persisted?.sessions.length ?? 0) > 0;
|
|
11781
|
+
const emptyStreak = (persisted?.emptyStreak ?? 0) + 1;
|
|
11782
|
+
if (harvest === 0 && hadCorpus && emptyStreak < 2) {
|
|
11783
|
+
persisted = {
|
|
11784
|
+
...persisted,
|
|
11785
|
+
emptyStreak
|
|
11786
|
+
};
|
|
11787
|
+
try {
|
|
11788
|
+
await writePersisted(options.agentDir, persisted);
|
|
11789
|
+
} catch {
|
|
11790
|
+
}
|
|
11791
|
+
log("prompt index: rebuild produced no prompts; keeping the previous corpus");
|
|
11792
|
+
return false;
|
|
11793
|
+
}
|
|
11794
|
+
if (harvest === 0 && hadCorpus) log("prompt index: store confirmed empty; clearing the corpus");
|
|
11795
|
+
persisted = {
|
|
11796
|
+
version: 1,
|
|
11797
|
+
builtAt: new Date(now2()).toISOString(),
|
|
11798
|
+
emptyStreak: 0,
|
|
11799
|
+
sessions: next
|
|
11800
|
+
};
|
|
11801
|
+
flattened = void 0;
|
|
11802
|
+
try {
|
|
11803
|
+
await writePersisted(options.agentDir, persisted);
|
|
11804
|
+
} catch (error) {
|
|
11805
|
+
log(`prompt index: persist failed (${error instanceof Error ? error.name : "unknown"})`);
|
|
11806
|
+
}
|
|
11807
|
+
return true;
|
|
11808
|
+
};
|
|
11809
|
+
const ensureFresh = () => {
|
|
11810
|
+
if (building) return;
|
|
11811
|
+
if (now2() < retryAfter) return;
|
|
11812
|
+
building = (async () => {
|
|
11813
|
+
await load();
|
|
11814
|
+
const builtAt = persisted ? Date.parse(persisted.builtAt) : NaN;
|
|
11815
|
+
if (Number.isFinite(builtAt) && now2() - builtAt <= 6e5) return;
|
|
11816
|
+
retryAfter = await build() ? 0 : now2() + PROMPT_INDEX_RETRY_BACKOFF_MS;
|
|
11817
|
+
})().catch(() => {
|
|
11818
|
+
retryAfter = now2() + PROMPT_INDEX_RETRY_BACKOFF_MS;
|
|
11819
|
+
}).finally(() => {
|
|
11820
|
+
building = void 0;
|
|
11821
|
+
});
|
|
11822
|
+
};
|
|
11823
|
+
return {
|
|
11824
|
+
ready: () => load(),
|
|
11825
|
+
candidates() {
|
|
11826
|
+
ensureFresh();
|
|
11827
|
+
if (!persisted) return [];
|
|
11828
|
+
flattened ??= flattenPromptIndex(persisted, PROMPT_INDEX_CANDIDATE_LIMIT);
|
|
11829
|
+
return flattened;
|
|
11830
|
+
},
|
|
11831
|
+
async refresh() {
|
|
11832
|
+
await (building ?? build().then(() => void 0));
|
|
11833
|
+
},
|
|
11834
|
+
stats() {
|
|
11835
|
+
const builtAt = persisted ? Date.parse(persisted.builtAt) : NaN;
|
|
11836
|
+
return {
|
|
11837
|
+
sessions: persisted?.sessions.length ?? 0,
|
|
11838
|
+
prompts: persisted?.sessions.reduce((total, entry) => total + entry.prompts.length, 0) ?? 0,
|
|
11839
|
+
builtAt: Number.isFinite(builtAt) ? builtAt : 0
|
|
11840
|
+
};
|
|
11841
|
+
}
|
|
11842
|
+
};
|
|
11843
|
+
}
|
|
11844
|
+
var globalStore$1 = globalThis;
|
|
11845
|
+
function messageText(message) {
|
|
11846
|
+
if (typeof message !== "object" || message === null) return "";
|
|
11847
|
+
const content = message.content;
|
|
11848
|
+
if (typeof content === "string") return content;
|
|
11849
|
+
if (!Array.isArray(content)) return "";
|
|
11850
|
+
return content.filter((part) => {
|
|
11851
|
+
if (typeof part !== "object" || part === null) return false;
|
|
11852
|
+
const candidate = part;
|
|
11853
|
+
return candidate.type === "text" && typeof candidate.text === "string";
|
|
11854
|
+
}).map((part) => part.text).join(" ");
|
|
11855
|
+
}
|
|
11856
|
+
var openSessionWithRuntime = async (sessionFile) => {
|
|
11857
|
+
return (await SessionManager.openAsync(sessionFile)).getEntries().filter((entry) => entry.type === "message").map((entry) => ({
|
|
11858
|
+
role: entry.message.role,
|
|
11859
|
+
text: messageText(entry.message)
|
|
11860
|
+
}));
|
|
11861
|
+
};
|
|
11862
|
+
function getPromptIndex() {
|
|
11863
|
+
if (!globalStore$1.__fleetPromptIndex) globalStore$1.__fleetPromptIndex = createPromptIndex({
|
|
11864
|
+
agentDir: getPrimeConfig().agentDir,
|
|
11865
|
+
listSessions: async () => (await getBridge().listSessions()).map((summary) => {
|
|
11866
|
+
const row = normalizeSessionListRow(summary);
|
|
11867
|
+
return {
|
|
11868
|
+
sessionFile: sessionSourcePath(row.source),
|
|
11869
|
+
modified: row.updatedAt,
|
|
11870
|
+
isSubagent: row.isSubagent
|
|
11871
|
+
};
|
|
11872
|
+
}),
|
|
11873
|
+
openSession: openSessionWithRuntime,
|
|
11874
|
+
log: (message) => process.stderr.write(`[completion] ${message}
|
|
11875
|
+
`)
|
|
11876
|
+
});
|
|
11877
|
+
return globalStore$1.__fleetPromptIndex;
|
|
11878
|
+
}
|
|
11879
|
+
function handleChatCompletionPost(request) {
|
|
11880
|
+
return wrapApiHandler(async () => {
|
|
11881
|
+
const body = ComposerCompletionRequestSchema.parse(await request.json().catch(() => ({})));
|
|
11882
|
+
const service = createComposerCompletionService({ index: getPromptIndex() });
|
|
11883
|
+
return Response.json(await service.complete(body.text, body.sessionId));
|
|
11884
|
+
}, request);
|
|
11885
|
+
}
|
|
9811
11886
|
function shouldReplaySseEvent(event, pendingQuestionIds) {
|
|
9812
11887
|
if (!pendingQuestionIds) return true;
|
|
9813
11888
|
if (!event || typeof event !== "object") return true;
|
|
@@ -9986,6 +12061,481 @@ function handleChatEventsGet(request) {
|
|
|
9986
12061
|
return createSseResponse(request, getBridge(), { sessionId: sessionId.data }, lastEventIdFor(request, url));
|
|
9987
12062
|
}, request);
|
|
9988
12063
|
}
|
|
12064
|
+
var DEFAULT_FLEET_SETTINGS = {
|
|
12065
|
+
version: 1,
|
|
12066
|
+
composerIntentEnabled: false
|
|
12067
|
+
};
|
|
12068
|
+
var FLEET_SETTINGS_FILE = "fleet-settings.json";
|
|
12069
|
+
function fleetSettingsPath(agentDir) {
|
|
12070
|
+
return join(agentDir, FLEET_SETTINGS_FILE);
|
|
12071
|
+
}
|
|
12072
|
+
async function readFleetSettings(agentDir) {
|
|
12073
|
+
try {
|
|
12074
|
+
return {
|
|
12075
|
+
version: 1,
|
|
12076
|
+
composerIntentEnabled: JSON.parse(await readFile(fleetSettingsPath(agentDir), "utf8")).composerIntentEnabled === true
|
|
12077
|
+
};
|
|
12078
|
+
} catch {
|
|
12079
|
+
return { ...DEFAULT_FLEET_SETTINGS };
|
|
12080
|
+
}
|
|
12081
|
+
}
|
|
12082
|
+
var writeChain = Promise.resolve();
|
|
12083
|
+
async function updateFleetSettings(agentDir, patch) {
|
|
12084
|
+
const update = writeChain.then(() => writeFleetSettings(agentDir, patch));
|
|
12085
|
+
writeChain = update.catch(() => void 0);
|
|
12086
|
+
return update;
|
|
12087
|
+
}
|
|
12088
|
+
async function writeFleetSettings(agentDir, patch) {
|
|
12089
|
+
const current = await readFleetSettings(agentDir);
|
|
12090
|
+
const next = {
|
|
12091
|
+
version: 1,
|
|
12092
|
+
composerIntentEnabled: patch.composerIntentEnabled ?? current.composerIntentEnabled
|
|
12093
|
+
};
|
|
12094
|
+
const path = fleetSettingsPath(agentDir);
|
|
12095
|
+
await mkdir(dirname(path), { recursive: true });
|
|
12096
|
+
const temporary = `${path}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
12097
|
+
await writeFile(temporary, `${JSON.stringify(next, null, " ")}
|
|
12098
|
+
`, "utf8");
|
|
12099
|
+
await rename(temporary, path);
|
|
12100
|
+
return next;
|
|
12101
|
+
}
|
|
12102
|
+
var TYPESAFE_CREDENTIAL_ID = "typesafe";
|
|
12103
|
+
function readCredential() {
|
|
12104
|
+
try {
|
|
12105
|
+
const credential = getPrimeConfig().authStorage.get(TYPESAFE_CREDENTIAL_ID);
|
|
12106
|
+
return credential?.type === "api_key" ? credential : void 0;
|
|
12107
|
+
} catch {
|
|
12108
|
+
return;
|
|
12109
|
+
}
|
|
12110
|
+
}
|
|
12111
|
+
function readStoredTypeSafeKey() {
|
|
12112
|
+
const key = readCredential()?.key?.trim();
|
|
12113
|
+
return key ? key : void 0;
|
|
12114
|
+
}
|
|
12115
|
+
function writeStoredTypeSafeKey(key) {
|
|
12116
|
+
const trimmed = key.trim();
|
|
12117
|
+
if (!trimmed) throw new Error("A TypeSafe API key cannot be empty");
|
|
12118
|
+
const config = getPrimeConfig();
|
|
12119
|
+
config.authStorage.set(TYPESAFE_CREDENTIAL_ID, {
|
|
12120
|
+
type: "api_key",
|
|
12121
|
+
key: trimmed
|
|
12122
|
+
});
|
|
12123
|
+
config.reloadAuth();
|
|
12124
|
+
}
|
|
12125
|
+
function clearStoredTypeSafeKey() {
|
|
12126
|
+
const config = getPrimeConfig();
|
|
12127
|
+
if (config.authStorage.has("typesafe")) config.authStorage.remove(TYPESAFE_CREDENTIAL_ID);
|
|
12128
|
+
config.reloadAuth();
|
|
12129
|
+
}
|
|
12130
|
+
function typeSafeKeySource() {
|
|
12131
|
+
if (readStoredTypeSafeKey()) return "settings";
|
|
12132
|
+
if ((process.env.TYPESAFE_API_KEY ?? "").trim()) return "environment";
|
|
12133
|
+
return "none";
|
|
12134
|
+
}
|
|
12135
|
+
var DEFAULT_TYPESAFE_INTENT_TIMEOUT_MS = 1500;
|
|
12136
|
+
var LOG_LEVELS = [
|
|
12137
|
+
"debug",
|
|
12138
|
+
"info",
|
|
12139
|
+
"warn",
|
|
12140
|
+
"error",
|
|
12141
|
+
"off"
|
|
12142
|
+
];
|
|
12143
|
+
function positiveInt(value, fallback) {
|
|
12144
|
+
const parsed = Number.parseInt(value ?? "", 10);
|
|
12145
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
12146
|
+
}
|
|
12147
|
+
function nonNegativeInt(value, fallback) {
|
|
12148
|
+
const parsed = Number.parseInt(value ?? "", 10);
|
|
12149
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;
|
|
12150
|
+
}
|
|
12151
|
+
function isCredentialSafeBaseUrl(value) {
|
|
12152
|
+
let url;
|
|
12153
|
+
try {
|
|
12154
|
+
url = new URL(value);
|
|
12155
|
+
} catch {
|
|
12156
|
+
return false;
|
|
12157
|
+
}
|
|
12158
|
+
if (url.protocol === "https:") return true;
|
|
12159
|
+
if (url.protocol !== "http:") return false;
|
|
12160
|
+
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
12161
|
+
return host === "localhost" || host === "127.0.0.1" || host === "::1";
|
|
12162
|
+
}
|
|
12163
|
+
function isLogLevel(value) {
|
|
12164
|
+
return value !== void 0 && LOG_LEVELS.includes(value);
|
|
12165
|
+
}
|
|
12166
|
+
function readTypeSafeConfig(env = process.env, storedKey) {
|
|
12167
|
+
const apiKey = (storedKey ?? "").trim() || (env.TYPESAFE_API_KEY ?? "").trim() || void 0;
|
|
12168
|
+
const killed = (env.FLEET_TYPESAFE_ENABLED ?? "").trim() === "0";
|
|
12169
|
+
const requestedBaseUrl = (env.TYPESAFE_BASE_URL ?? "").trim().replace(/\/+$/, "");
|
|
12170
|
+
const baseUrlUsable = requestedBaseUrl === "" || isCredentialSafeBaseUrl(requestedBaseUrl);
|
|
12171
|
+
return {
|
|
12172
|
+
configured: Boolean(apiKey) && !killed && baseUrlUsable,
|
|
12173
|
+
apiKey,
|
|
12174
|
+
baseUrl: requestedBaseUrl || "https://api.typesafe.ai",
|
|
12175
|
+
model: (env.TYPESAFE_MODEL ?? "").trim() || "jev-latest",
|
|
12176
|
+
intentTimeoutMs: positiveInt(env.TYPESAFE_INTENT_TIMEOUT_MS, DEFAULT_TYPESAFE_INTENT_TIMEOUT_MS),
|
|
12177
|
+
intentMaxRetries: nonNegativeInt(env.TYPESAFE_INTENT_MAX_RETRIES, 1),
|
|
12178
|
+
logLevel: isLogLevel(env.TYPESAFE_LOG_LEVEL) ? env.TYPESAFE_LOG_LEVEL : "warn"
|
|
12179
|
+
};
|
|
12180
|
+
}
|
|
12181
|
+
var TypeSafeTransportError = class extends Error {
|
|
12182
|
+
kind;
|
|
12183
|
+
status;
|
|
12184
|
+
constructor(message, kind, status, options) {
|
|
12185
|
+
super(message, options);
|
|
12186
|
+
this.name = "TypeSafeTransportError";
|
|
12187
|
+
this.kind = kind;
|
|
12188
|
+
this.status = status;
|
|
12189
|
+
}
|
|
12190
|
+
};
|
|
12191
|
+
var TYPESAFE_RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
|
|
12192
|
+
408,
|
|
12193
|
+
429,
|
|
12194
|
+
500,
|
|
12195
|
+
502,
|
|
12196
|
+
503,
|
|
12197
|
+
504,
|
|
12198
|
+
529
|
|
12199
|
+
]);
|
|
12200
|
+
var NO_RETRY_STATUSES = /* @__PURE__ */ new Set();
|
|
12201
|
+
var RETRY_MAX_DELAY_MS = 5e3;
|
|
12202
|
+
function retryDelayMs(response, attempt) {
|
|
12203
|
+
const header = response.headers.get("retry-after")?.trim();
|
|
12204
|
+
if (header) {
|
|
12205
|
+
const seconds = Number(header);
|
|
12206
|
+
if (Number.isFinite(seconds) && seconds >= 0) return Math.min(seconds * 1e3, RETRY_MAX_DELAY_MS);
|
|
12207
|
+
const date = Date.parse(header);
|
|
12208
|
+
if (Number.isFinite(date)) return Math.min(Math.max(date - Date.now(), 0), RETRY_MAX_DELAY_MS);
|
|
12209
|
+
}
|
|
12210
|
+
const exponential = Math.min(250 * 2 ** attempt, RETRY_MAX_DELAY_MS);
|
|
12211
|
+
return Math.round(exponential * (0.5 + Math.random() / 2));
|
|
12212
|
+
}
|
|
12213
|
+
function sleep(ms) {
|
|
12214
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
12215
|
+
}
|
|
12216
|
+
function noul(instructions, criteria) {
|
|
12217
|
+
return criteria ? {
|
|
12218
|
+
type: "noul",
|
|
12219
|
+
instructions,
|
|
12220
|
+
criteria
|
|
12221
|
+
} : {
|
|
12222
|
+
type: "noul",
|
|
12223
|
+
instructions
|
|
12224
|
+
};
|
|
12225
|
+
}
|
|
12226
|
+
function choice(instructions, criteria) {
|
|
12227
|
+
return {
|
|
12228
|
+
type: "choice",
|
|
12229
|
+
instructions,
|
|
12230
|
+
criteria
|
|
12231
|
+
};
|
|
12232
|
+
}
|
|
12233
|
+
function choiceAnswer(result, id2) {
|
|
12234
|
+
const answer = result.answers[id2];
|
|
12235
|
+
return answer?.type === "choice" ? answer : void 0;
|
|
12236
|
+
}
|
|
12237
|
+
function noulAnswer(result, id2) {
|
|
12238
|
+
const answer = result.answers[id2];
|
|
12239
|
+
return answer?.type === "noul" ? answer : void 0;
|
|
12240
|
+
}
|
|
12241
|
+
function isRecord(value) {
|
|
12242
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12243
|
+
}
|
|
12244
|
+
async function postSystemOne(config, body, options = {}, fetchImpl = globalThis.fetch) {
|
|
12245
|
+
if (!config.configured || !config.apiKey) throw new TypeSafeTransportError("TypeSafe is not configured", "unconfigured");
|
|
12246
|
+
const apiKey = config.apiKey;
|
|
12247
|
+
const timeoutMs = options.timeoutMs ?? config.intentTimeoutMs;
|
|
12248
|
+
const maxRetries = options.maxRetries ?? 0;
|
|
12249
|
+
const retryStatuses = options.retryStatuses ?? NO_RETRY_STATUSES;
|
|
12250
|
+
let lastError;
|
|
12251
|
+
for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
|
|
12252
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
12253
|
+
const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
|
|
12254
|
+
try {
|
|
12255
|
+
const response = await fetchImpl(`${config.baseUrl}/v1/systemone`, {
|
|
12256
|
+
method: "POST",
|
|
12257
|
+
headers: {
|
|
12258
|
+
Authorization: `Bearer ${apiKey}`,
|
|
12259
|
+
"Content-Type": "application/json"
|
|
12260
|
+
},
|
|
12261
|
+
body: JSON.stringify({
|
|
12262
|
+
state: body.state,
|
|
12263
|
+
model: config.model,
|
|
12264
|
+
questions: body.questions
|
|
12265
|
+
}),
|
|
12266
|
+
signal
|
|
12267
|
+
});
|
|
12268
|
+
if (!response.ok) {
|
|
12269
|
+
await response.text().catch(() => "");
|
|
12270
|
+
const error = new TypeSafeTransportError(`TypeSafe request failed with HTTP ${response.status}`, "http", response.status);
|
|
12271
|
+
if (attempt < maxRetries && retryStatuses.has(response.status)) {
|
|
12272
|
+
lastError = error;
|
|
12273
|
+
await sleep(retryDelayMs(response, attempt));
|
|
12274
|
+
continue;
|
|
12275
|
+
}
|
|
12276
|
+
throw error;
|
|
12277
|
+
}
|
|
12278
|
+
const parsed = await response.json().catch(() => void 0);
|
|
12279
|
+
if (!isRecord(parsed) || !isRecord(parsed.answers)) throw new TypeSafeTransportError("TypeSafe returned an unreadable body", "malformed");
|
|
12280
|
+
const usage = isRecord(parsed.usage) ? parsed.usage : {};
|
|
12281
|
+
return {
|
|
12282
|
+
model: typeof parsed.model === "string" ? parsed.model : config.model,
|
|
12283
|
+
answers: parsed.answers,
|
|
12284
|
+
usage: {
|
|
12285
|
+
input_tokens: typeof usage.input_tokens === "number" ? usage.input_tokens : 0,
|
|
12286
|
+
output_tokens: typeof usage.output_tokens === "number" ? usage.output_tokens : 0
|
|
12287
|
+
}
|
|
12288
|
+
};
|
|
12289
|
+
} catch (error) {
|
|
12290
|
+
if (error instanceof TypeSafeTransportError) throw error;
|
|
12291
|
+
const kind = timeoutSignal.aborted ? "timeout" : options.signal?.aborted ? "aborted" : "http";
|
|
12292
|
+
lastError = new TypeSafeTransportError(kind === "timeout" ? `TypeSafe request exceeded ${timeoutMs}ms` : "TypeSafe request failed", kind, void 0, { cause: error });
|
|
12293
|
+
if (attempt >= maxRetries) throw lastError;
|
|
12294
|
+
}
|
|
12295
|
+
}
|
|
12296
|
+
throw lastError ?? new TypeSafeTransportError("TypeSafe request failed", "http");
|
|
12297
|
+
}
|
|
12298
|
+
async function probeConnection(config, fetchImpl = globalThis.fetch, timeoutMs = 3e3) {
|
|
12299
|
+
if (!config.configured || !config.apiKey) return false;
|
|
12300
|
+
try {
|
|
12301
|
+
const response = await fetchImpl(`${config.baseUrl}/v1/models`, {
|
|
12302
|
+
method: "GET",
|
|
12303
|
+
headers: { Authorization: `Bearer ${config.apiKey}` },
|
|
12304
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
12305
|
+
});
|
|
12306
|
+
await response.text().catch(() => "");
|
|
12307
|
+
return response.ok;
|
|
12308
|
+
} catch {
|
|
12309
|
+
return false;
|
|
12310
|
+
}
|
|
12311
|
+
}
|
|
12312
|
+
var INTENT_ROUTE_QUESTION_ID = "route";
|
|
12313
|
+
var INTENT_CODE_TASK_QUESTION_ID = "is_code_task";
|
|
12314
|
+
var MAX_INTENT_STATE_CHARS = 1e3;
|
|
12315
|
+
var ROUTE_INSTRUCTIONS = [
|
|
12316
|
+
"`utterance` is free text a developer typed into the message composer of a coding-agent chat app.",
|
|
12317
|
+
"`commands` lists the app's built-in commands, each with an `id`, a `what` description, and optional `args`.",
|
|
12318
|
+
"",
|
|
12319
|
+
"Decide whether the developer is asking the app to RUN one of those commands, or whether the text is an ordinary request for the coding agent.",
|
|
12320
|
+
"",
|
|
12321
|
+
"Rules:",
|
|
12322
|
+
"- Every command in `commands` only changes the app's own interface or the conversation session. None of them read, write, edit, run, or inspect code, files, tests, dependencies, or git.",
|
|
12323
|
+
"- If `utterance` asks for any work on code, files, tests, builds, dependencies, git, or the workspace, answer `none` \u2014 even when it also contains a word that appears in a command description.",
|
|
12324
|
+
"- Answer `none` when no command clearly matches what the developer wants, and when you are unsure.",
|
|
12325
|
+
"- Match the developer's intent, not a word the text happens to share with a description."
|
|
12326
|
+
].join("\n");
|
|
12327
|
+
var CODE_TASK_INSTRUCTIONS = [
|
|
12328
|
+
"Does `utterance` ask for real engineering work on code, files, tests, builds, dependencies, git, or the workspace?",
|
|
12329
|
+
"Bug reports, feature requests, questions about the codebase, and refactors all count as yes.",
|
|
12330
|
+
"Requests about the app's own interface, the session, or the conversation do not count, even when they mention code:",
|
|
12331
|
+
"setting a goal, compacting the session, renaming a session, or changing how much reasoning the model uses are all no."
|
|
12332
|
+
].join("\n");
|
|
12333
|
+
var CODE_TASK_CRITERIA = {
|
|
12334
|
+
true: "The developer wants engineering work done on code, files, tests, builds, dependencies, git, or the workspace.",
|
|
12335
|
+
false: "The developer wants the app's own interface or session acted on, or is making conversation."
|
|
12336
|
+
};
|
|
12337
|
+
function buildIntentState(text) {
|
|
12338
|
+
return {
|
|
12339
|
+
utterance: text.slice(0, MAX_INTENT_STATE_CHARS),
|
|
12340
|
+
commands: COMPOSER_INTENT_COMMANDS.map((command) => ({
|
|
12341
|
+
id: command.id,
|
|
12342
|
+
what: command.description,
|
|
12343
|
+
...command.argumentHint ? { args: command.argumentHint } : {}
|
|
12344
|
+
}))
|
|
12345
|
+
};
|
|
12346
|
+
}
|
|
12347
|
+
function buildIntentQuestions() {
|
|
12348
|
+
const criteria = { [COMPOSER_INTENT_NONE]: "The text should be sent to the coding agent as an ordinary message." };
|
|
12349
|
+
for (const command of COMPOSER_INTENT_COMMANDS) criteria[command.id] = command.argumentHint ? `${command.description}. Arguments the developer may name: ${command.argumentHint}.` : command.description;
|
|
12350
|
+
const route = choice(ROUTE_INSTRUCTIONS, criteria);
|
|
12351
|
+
const codeTask = noul(CODE_TASK_INSTRUCTIONS, CODE_TASK_CRITERIA);
|
|
12352
|
+
return {
|
|
12353
|
+
[INTENT_ROUTE_QUESTION_ID]: route,
|
|
12354
|
+
[INTENT_CODE_TASK_QUESTION_ID]: codeTask
|
|
12355
|
+
};
|
|
12356
|
+
}
|
|
12357
|
+
function interpretIntentResult(result, draft) {
|
|
12358
|
+
const route = choiceAnswer(result, INTENT_ROUTE_QUESTION_ID);
|
|
12359
|
+
const codeTask = noulAnswer(result, INTENT_CODE_TASK_QUESTION_ID);
|
|
12360
|
+
if (!route) return {
|
|
12361
|
+
outcome: "none",
|
|
12362
|
+
reason: "no_match"
|
|
12363
|
+
};
|
|
12364
|
+
const confidence = typeof route.confidence === "number" ? route.confidence : 0;
|
|
12365
|
+
const codeTaskProbability = codeTask && typeof codeTask.noul === "number" ? codeTask.noul : 0;
|
|
12366
|
+
const decision = decideComposerIntent({
|
|
12367
|
+
command: route.choice,
|
|
12368
|
+
confidence,
|
|
12369
|
+
codeTaskProbability,
|
|
12370
|
+
requireConfirmation: isSingleTokenDraft(draft) || draft.trim().length > 1e3
|
|
12371
|
+
});
|
|
12372
|
+
if (decision.outcome === "none") return decision;
|
|
12373
|
+
if (!composerIntentCommand(decision.command.id)) return {
|
|
12374
|
+
outcome: "none",
|
|
12375
|
+
reason: "no_match"
|
|
12376
|
+
};
|
|
12377
|
+
return {
|
|
12378
|
+
...decision,
|
|
12379
|
+
confidence,
|
|
12380
|
+
codeTaskProbability
|
|
12381
|
+
};
|
|
12382
|
+
}
|
|
12383
|
+
var CACHE_LIMIT = 48;
|
|
12384
|
+
var CACHE_TTL_MS = 3e5;
|
|
12385
|
+
var MIN_INTENT_CHARS = 4;
|
|
12386
|
+
var PROBE_TTL_MS = 3e5;
|
|
12387
|
+
function normalizeIntentText(text) {
|
|
12388
|
+
return text.trim().replace(/\s+/g, " ").toLowerCase();
|
|
12389
|
+
}
|
|
12390
|
+
function disabledResponse(enabled, reason) {
|
|
12391
|
+
return {
|
|
12392
|
+
enabled,
|
|
12393
|
+
outcome: "none",
|
|
12394
|
+
...reason ? { reason } : {}
|
|
12395
|
+
};
|
|
12396
|
+
}
|
|
12397
|
+
function createTypeSafeService(options = {}) {
|
|
12398
|
+
const config = options.config ?? readTypeSafeConfig();
|
|
12399
|
+
const fetchImpl = options.fetch ?? ((...args) => globalThis.fetch(...args));
|
|
12400
|
+
const now2 = options.now ?? Date.now;
|
|
12401
|
+
const cache = /* @__PURE__ */ new Map();
|
|
12402
|
+
let probe;
|
|
12403
|
+
function readCache(key) {
|
|
12404
|
+
const entry = cache.get(key);
|
|
12405
|
+
if (!entry) return void 0;
|
|
12406
|
+
if (now2() - entry.at > CACHE_TTL_MS) {
|
|
12407
|
+
cache.delete(key);
|
|
12408
|
+
return;
|
|
12409
|
+
}
|
|
12410
|
+
return entry.response;
|
|
12411
|
+
}
|
|
12412
|
+
function writeCache(key, response) {
|
|
12413
|
+
cache.set(key, {
|
|
12414
|
+
response,
|
|
12415
|
+
at: now2()
|
|
12416
|
+
});
|
|
12417
|
+
while (cache.size > CACHE_LIMIT) {
|
|
12418
|
+
const oldest = cache.keys().next();
|
|
12419
|
+
if (oldest.done) break;
|
|
12420
|
+
cache.delete(oldest.value);
|
|
12421
|
+
}
|
|
12422
|
+
}
|
|
12423
|
+
return {
|
|
12424
|
+
configured: config.configured,
|
|
12425
|
+
model: config.model,
|
|
12426
|
+
async status() {
|
|
12427
|
+
if (!config.configured) return "unconfigured";
|
|
12428
|
+
if (probe && now2() - probe.at <= PROBE_TTL_MS) return probe.ok ? "ready" : "error";
|
|
12429
|
+
const ok = await probeConnection(config, fetchImpl);
|
|
12430
|
+
probe = {
|
|
12431
|
+
at: now2(),
|
|
12432
|
+
ok
|
|
12433
|
+
};
|
|
12434
|
+
return ok ? "ready" : "error";
|
|
12435
|
+
},
|
|
12436
|
+
async routeComposerIntent(request, enabled) {
|
|
12437
|
+
if (!enabled) return disabledResponse(false, "disabled");
|
|
12438
|
+
if (!config.configured) return disabledResponse(false, "disabled");
|
|
12439
|
+
const text = request.text.trim();
|
|
12440
|
+
if (text.length < MIN_INTENT_CHARS) return disabledResponse(true, "empty");
|
|
12441
|
+
if (text.startsWith("/")) return disabledResponse(true, "empty");
|
|
12442
|
+
const key = normalizeIntentText(text);
|
|
12443
|
+
const cached = readCache(key);
|
|
12444
|
+
if (cached) return cached;
|
|
12445
|
+
const startedAt = now2();
|
|
12446
|
+
try {
|
|
12447
|
+
const result = await postSystemOne(config, {
|
|
12448
|
+
state: buildIntentState(text),
|
|
12449
|
+
questions: buildIntentQuestions()
|
|
12450
|
+
}, {
|
|
12451
|
+
timeoutMs: config.intentTimeoutMs,
|
|
12452
|
+
maxRetries: config.intentMaxRetries,
|
|
12453
|
+
retryStatuses: TYPESAFE_RETRYABLE_STATUSES
|
|
12454
|
+
}, fetchImpl);
|
|
12455
|
+
const decision = interpretIntentResult(result, text);
|
|
12456
|
+
const response = decision.outcome === "matched" ? {
|
|
12457
|
+
enabled: true,
|
|
12458
|
+
outcome: "matched",
|
|
12459
|
+
command: decision.command.id,
|
|
12460
|
+
confidence: decision.confidence,
|
|
12461
|
+
disposition: decision.disposition,
|
|
12462
|
+
model: result.model,
|
|
12463
|
+
latencyMs: now2() - startedAt
|
|
12464
|
+
} : {
|
|
12465
|
+
enabled: true,
|
|
12466
|
+
outcome: "none",
|
|
12467
|
+
reason: decision.reason,
|
|
12468
|
+
confidence: decision.confidence,
|
|
12469
|
+
model: result.model,
|
|
12470
|
+
latencyMs: now2() - startedAt
|
|
12471
|
+
};
|
|
12472
|
+
writeCache(key, response);
|
|
12473
|
+
return response;
|
|
12474
|
+
} catch (error) {
|
|
12475
|
+
const rateLimited = error instanceof TypeSafeTransportError && error.status === 429;
|
|
12476
|
+
if (config.logLevel !== "off") {
|
|
12477
|
+
const kind = error instanceof TypeSafeTransportError ? error.kind : "unknown";
|
|
12478
|
+
process.stderr.write(`[typesafe] intent routing unavailable (${kind})
|
|
12479
|
+
`);
|
|
12480
|
+
}
|
|
12481
|
+
return disabledResponse(true, rateLimited ? "rate_limited" : "unavailable");
|
|
12482
|
+
}
|
|
12483
|
+
},
|
|
12484
|
+
resetCachesForTests() {
|
|
12485
|
+
cache.clear();
|
|
12486
|
+
probe = void 0;
|
|
12487
|
+
}
|
|
12488
|
+
};
|
|
12489
|
+
}
|
|
12490
|
+
var globalStore = globalThis;
|
|
12491
|
+
function getTypeSafeService() {
|
|
12492
|
+
if (!globalStore.__fleetTypeSafe) globalStore.__fleetTypeSafe = createTypeSafeService({ config: readTypeSafeConfig(process.env, readStoredTypeSafeKey()) });
|
|
12493
|
+
return globalStore.__fleetTypeSafe;
|
|
12494
|
+
}
|
|
12495
|
+
function resetTypeSafeService() {
|
|
12496
|
+
globalStore.__fleetTypeSafe = void 0;
|
|
12497
|
+
}
|
|
12498
|
+
async function composerIntentSettings() {
|
|
12499
|
+
const service = getTypeSafeService();
|
|
12500
|
+
return {
|
|
12501
|
+
enabled: (await readFleetSettings(getPrimeConfig().agentDir)).composerIntentEnabled,
|
|
12502
|
+
status: service.configured ? await service.status() : "unconfigured",
|
|
12503
|
+
keySource: typeSafeKeySource()
|
|
12504
|
+
};
|
|
12505
|
+
}
|
|
12506
|
+
function handleChatIntentGet(request) {
|
|
12507
|
+
return wrapApiHandler(async () => Response.json(await composerIntentSettings()), request);
|
|
12508
|
+
}
|
|
12509
|
+
function handleChatIntentPut(request) {
|
|
12510
|
+
return wrapApiHandler(async () => {
|
|
12511
|
+
const body = ComposerIntentCredentialSchema.parse(await request.json().catch(() => ({})));
|
|
12512
|
+
if (body.apiKey === null) clearStoredTypeSafeKey();
|
|
12513
|
+
else writeStoredTypeSafeKey(body.apiKey);
|
|
12514
|
+
resetTypeSafeService();
|
|
12515
|
+
return Response.json(await composerIntentSettings());
|
|
12516
|
+
}, request);
|
|
12517
|
+
}
|
|
12518
|
+
function handleChatIntentPatch(request) {
|
|
12519
|
+
return wrapApiHandler(async () => {
|
|
12520
|
+
const body = ComposerIntentSettingsUpdateSchema.parse(await request.json().catch(() => ({})));
|
|
12521
|
+
await updateFleetSettings(getPrimeConfig().agentDir, { composerIntentEnabled: body.enabled });
|
|
12522
|
+
return Response.json(await composerIntentSettings());
|
|
12523
|
+
}, request);
|
|
12524
|
+
}
|
|
12525
|
+
function handleChatIntentPost(request) {
|
|
12526
|
+
return wrapApiHandler(async () => {
|
|
12527
|
+
const body = ComposerIntentRequestSchema.parse(await request.json().catch(() => ({})));
|
|
12528
|
+
const service = getTypeSafeService();
|
|
12529
|
+
if (!service.configured) return Response.json({
|
|
12530
|
+
enabled: false,
|
|
12531
|
+
outcome: "none",
|
|
12532
|
+
reason: "disabled"
|
|
12533
|
+
});
|
|
12534
|
+
const settings = await readFleetSettings(getPrimeConfig().agentDir);
|
|
12535
|
+
const response = await service.routeComposerIntent(body, settings.composerIntentEnabled);
|
|
12536
|
+
return Response.json(response);
|
|
12537
|
+
}, request);
|
|
12538
|
+
}
|
|
9989
12539
|
var PRIME_BUTTERFLY_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 178 178" aria-hidden="true"><path fill="currentColor" d="m 123.322,84.092671 c -0.192,0.0065 -0.43,0.0147 -0.74,0.0147 l -0.018,-0.0247 c -0.873,0.1977 -1.958,0.1266 -3.067,0.0537 -3.29,-0.216 -6.799,-0.4465 -5.635,6.2824 0.259,1.4822 -1.538,1.8465 -2.73,1.9082 -3.384,0.1853 -6.78,0.2594 -10.171,0.1915 -0.641,-0.0106 -1.2979,-0.5506 -1.8904,-1.0388 -0.1022,-0.0844 -0.2034,-0.1673 -0.3016,-0.2457 -0.1052,-0.0865 0.2898,-1.2042 0.4942,-1.2166 3.3078,-0.1931 4.5068,-2.4361 5.7028,-4.6724 0.603,-1.1253 1.204,-2.2488 2.072,-3.1088 7.856,-7.7874 15.878,-15.4265 25.054,-21.7008 0.895,-0.6114 1.989,-1.1733 2.73,-0.1111 0.571,0.8205 0.036,1.2854 -0.512,1.7627 -0.24,0.2088 -0.482,0.4199 -0.637,0.6642 -0.554,0.8792 -1.538,1.5273 -2.514,2.1717 -1.92,1.2655 -3.82,2.5172 -2.408,5.4798 1.225,2.5651 0.129,3.0202 -1.555,3.7198 l -0.069,0.0287 c -0.72,0.3021 -1.458,0.5764 -2.194,0.8506 -1.568,0.5835 -3.134,1.1662 -4.537,2.0149 -1.408,0.8522 -2.081,2.5134 0.222,3.4954 5.033,2.1428 18.064,-1.2784 20.608,-5.9965 2.377,-4.4147 5.931,-7.6891 9.481,-10.9611 1.992,-1.836 3.984,-3.6712 5.767,-5.7067 3.844,-4.3849 8.344,-8.1939 12.846,-12.005 2.239,-1.8944 4.478,-3.78938 6.637,-5.75588 1.624,-1.48207 2.297,-3.43353 1.026,-5.56412 -1.267,-2.118215 -3.416,-2.402287 -5.435,-1.926802 -13.309,3.130982 -26.166,7.355122 -37.585,15.241302 -18.23,12.5919 -36.4911,25.1406 -54.9002,37.4669 -6.2743,4.2056 -10.0723,2.1491 -12.1657,-5.1318 -4.6502,-16.1676 -11.4681,-30.2664 -31.0569,-32.4587 -7.1574,-0.8028 -12.4066,3.6807 -11.3692,10.7949 0.5249,3.6065 0.0495,7.003 -1.6858,10.3872 -0.3827,0.7472 -0.7689,1.4947 -1.1556,2.243 -2.672,5.1706 -5.3671,10.3857 -7.0394,15.8885 -0.1399,0.4602 -0.3002,0.9444 -0.4654,1.4437 -1.4909,4.5052 -3.3862,10.2323 5.659,10.5492 0.3705,0.0123 1.0808,0.944799 0.9943,1.290699 -0.1976,0.8213 -0.5991,1.797 -1.2413,2.2725 -8.6705,6.3917 -15.79706,14.1294 -18.860151,24.5971 -1.550066,5.2865 -0.524909,10.7765 3.989391,14.8705 3.22984,2.928 7.35516,4.625 10.97396,2.162 3.3009,-2.247 6.9232,-3.754 10.538,-5.259 3.1819,-1.324 6.358,-2.646 9.3041,-4.468 0.7101,-0.439 1.5727,-0.841 2.4456,-1.248 2.4138,-1.1228 4.9063,-2.2843 4.4709,-4.3841 -0.6854,-3.2908 -4.1623,-6.3418 -7.0586,-8.7384 -2.8716,-2.3769 -10.1897,-18.3411 -9.3189,-22.176099 1.2193,-5.3704 3.9645,-10.0201 6.7125,-14.6744 2.3458,-3.9731 4.6935,-7.9497 6.0956,-12.3806 0.5804,-1.828 2.8037,-2.8284 4.9466,-2.0997 1.4543,0.4928 1.2068,1.8278 0.9762,3.0715 -0.0063,0.0344 -0.0127,0.0685 -0.019,0.1027 -0.8688,4.7802 -1.721,9.566 -2.5733,14.3517 -0.4261,2.3924 -0.8521,4.7847 -1.2803,7.1762 -0.2717,1.5316 0.2038,2.7544 1.7909,3.0631 3.0569,0.599 2.989,1.9762 1.6119,4.341499 -1.4636,2.5072 -1.6674,5.5703 -0.0309,7.8861 1.6427,2.3282 4.3908,2.8161 7.1821,1.4204 1.7415,-0.8646 3.094,-0.0927 3.0755,1.6612 -0.1112,9.3688 3.8103,7.2561 8.584,3.1681 0.439,-0.3763 1.0373,-0.5846 1.6152,-0.7857 0.1048,-0.0366 0.2091,-0.0728 0.3116,-0.1098 0.4529,-0.1616 0.9062,-0.3224 1.3595,-0.4833 8.986,-3.1884 17.9603,-6.3725 23.0334,-15.573099 0.392,-0.7187 1.6783,-1.0669 2.6795,-1.3377 0.057,-0.0154 0.113,-0.0307 0.1681,-0.0456 5.8013,-1.5766 11.7248,-1.6001 17.6438,-1.6237 4.445,-0.0176 8.888,-0.0352 13.277,-0.7107 4.329,-0.667 9.047,-3.1928 9.084,-7.3736 0.035,-3.3707 -2.546,-3.1612 -5.123,-2.9519 -1.115,0.0906 -2.231,0.1811 -3.134,-0.0185 -0.182,-0.0381 -0.375,-0.0316 -0.686,-0.0209 z"/><path fill="currentColor" d="m 55.1325,131.29447 c -1.0745,7.1515 1.6551,13.2715 12.8266,13.1915 h -0.0062 c 9.5413,-0.389 20.3365,-6.164 30.8838,-13.5492 6.9653,-4.8787 12.9873,-10.0236 16.8903,-17.6253 2.872,-5.5889 1.395,-10.0723 -2.933,-13.993799 -1.908,-1.7291 -3.73,-1.9205 -5.867,0.1667 -7.5842,7.423099 -17.0261,11.474299 -26.7218,15.550099 -2.4706,1.0393 -5.2847,1.5582 -8.1187,2.0809 -7.5511,1.3924 -15.2431,2.8103 -16.954,14.1791 z"/></svg>`;
|
|
9990
12540
|
function escapeHtml(value) {
|
|
9991
12541
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
@@ -39438,75 +41988,6 @@ function handleChatSessionDelete(request) {
|
|
|
39438
41988
|
});
|
|
39439
41989
|
}, request);
|
|
39440
41990
|
}
|
|
39441
|
-
function stringValue(value) {
|
|
39442
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
39443
|
-
}
|
|
39444
|
-
function timestampValue(value) {
|
|
39445
|
-
if (value instanceof Date) return value.toISOString();
|
|
39446
|
-
return stringValue(value);
|
|
39447
|
-
}
|
|
39448
|
-
function messageCountValue(value) {
|
|
39449
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
|
|
39450
|
-
}
|
|
39451
|
-
function normalizeSessionListRow(source) {
|
|
39452
|
-
const raw = source;
|
|
39453
|
-
const sessionId = stringValue(raw.sessionId) ?? stringValue(raw.id);
|
|
39454
|
-
const cwd = stringValue(raw.cwd);
|
|
39455
|
-
if (!sessionId || !cwd) throw new Error("The Prime Agent session listing returned an invalid session entry");
|
|
39456
|
-
const createdAt = timestampValue(raw.created) ?? timestampValue(raw.modified) ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
39457
|
-
const updatedAt = timestampValue(raw.modified) ?? timestampValue(raw.created) ?? createdAt;
|
|
39458
|
-
const isSubagent = typeof raw.runtimeKind === "string" ? raw.runtimeKind === "subagent" : Boolean(raw.rlmChildId ?? raw.rlmParentNodeId ?? raw.parentActiveSessionId ?? raw.parentSessionId ?? raw.parentSessionPath);
|
|
39459
|
-
return {
|
|
39460
|
-
source,
|
|
39461
|
-
sessionId,
|
|
39462
|
-
cwd,
|
|
39463
|
-
title: meaningfulSessionLabel(stringValue(raw.sessionName) ?? stringValue(raw.name)),
|
|
39464
|
-
createdAt,
|
|
39465
|
-
updatedAt,
|
|
39466
|
-
messageCount: messageCountValue(raw.messageCount),
|
|
39467
|
-
firstMessage: meaningfulSessionLabel(typeof raw.firstMessage === "string" ? raw.firstMessage : void 0) ?? "",
|
|
39468
|
-
isSubagent
|
|
39469
|
-
};
|
|
39470
|
-
}
|
|
39471
|
-
function sessionSourcePath(source) {
|
|
39472
|
-
const raw = source;
|
|
39473
|
-
return stringValue(raw.sessionFile) ?? stringValue(raw.path);
|
|
39474
|
-
}
|
|
39475
|
-
function latestBy(entries, time2) {
|
|
39476
|
-
if (entries.length === 0) return void 0;
|
|
39477
|
-
return entries.reduce((latest, entry) => time2(entry) >= time2(latest) ? entry : latest);
|
|
39478
|
-
}
|
|
39479
|
-
function presentationListActivity(presentation) {
|
|
39480
|
-
if (!presentation) return { activityCount: 0 };
|
|
39481
|
-
const artifacts = presentation.artifactRuns.flatMap((run) => run.artifacts);
|
|
39482
|
-
const latestRefinement = latestBy(presentation.refinements, (entry) => entry.timestamp);
|
|
39483
|
-
const latestArtifact = latestBy(artifacts, (entry) => entry.timestamp);
|
|
39484
|
-
const latestBash = latestBy(presentation.userBash, (entry) => entry.startedAt);
|
|
39485
|
-
return {
|
|
39486
|
-
title: meaningfulSessionLabel(presentation.sessionName) ?? meaningfulSessionLabel(latestRefinement?.summary) ?? meaningfulSessionLabel(latestArtifact?.title) ?? meaningfulSessionLabel(latestBash?.command),
|
|
39487
|
-
activityCount: presentation.refinements.length + artifacts.length + presentation.userBash.length
|
|
39488
|
-
};
|
|
39489
|
-
}
|
|
39490
|
-
function applyPresentationToSessionRow(row, presentation) {
|
|
39491
|
-
const { title: presentationTitle, activityCount } = presentationListActivity(presentation);
|
|
39492
|
-
const firstMessage = row.firstMessage || presentationTitle || "";
|
|
39493
|
-
return {
|
|
39494
|
-
title: row.title ?? meaningfulSessionLabel(firstMessage) ?? presentationTitle ?? fallbackSessionLabel(row.sessionId),
|
|
39495
|
-
firstMessage,
|
|
39496
|
-
messageCount: row.messageCount > 0 ? row.messageCount : activityCount > 0 ? 1 : 0
|
|
39497
|
-
};
|
|
39498
|
-
}
|
|
39499
|
-
function sessionNeedsPresentationJoin(row) {
|
|
39500
|
-
return row.messageCount === 0 || !row.title || !row.firstMessage;
|
|
39501
|
-
}
|
|
39502
|
-
async function loadSessionListPresentation(row, source, livePresentation) {
|
|
39503
|
-
const liveActivity = presentationListActivity(livePresentation);
|
|
39504
|
-
if (liveActivity.activityCount > 0 || liveActivity.title) return livePresentation;
|
|
39505
|
-
if (!sessionNeedsPresentationJoin(row)) return livePresentation;
|
|
39506
|
-
const path = sessionSourcePath(source);
|
|
39507
|
-
if (!path) return livePresentation;
|
|
39508
|
-
return await loadManagedPrimePresentation({ sessionPath: path }) ?? livePresentation;
|
|
39509
|
-
}
|
|
39510
41991
|
function sessionStatus(info, live) {
|
|
39511
41992
|
if (live?.isStreaming || live?.session?.isStreaming || info.isStreaming) return "running";
|
|
39512
41993
|
if (info.activity === "working" && (info.isSessionActive || info.hasRunningRlmChildren === true)) return "running";
|
|
@@ -39973,19 +42454,26 @@ function handleWorkspaceTreeGet(_request) {
|
|
|
39973
42454
|
});
|
|
39974
42455
|
}, _request);
|
|
39975
42456
|
}
|
|
39976
|
-
var Route$
|
|
39977
|
-
var Route$
|
|
39978
|
-
var Route$
|
|
42457
|
+
var Route$27 = createFileRoute("/api/chat")({ server: { handlers: { POST: ({ request }) => handleChatPost(request) } } });
|
|
42458
|
+
var Route$26 = createFileRoute("/api/health")({ server: { handlers: { GET: ({ request }) => handleHealthGet(request) } } });
|
|
42459
|
+
var Route$25 = createFileRoute("/api/projects")({ server: { handlers: {
|
|
39979
42460
|
DELETE: ({ request }) => handleProjectDelete(request),
|
|
39980
42461
|
GET: ({ request }) => handleProjectsGet(request),
|
|
39981
42462
|
PATCH: ({ request }) => handleProjectPatch(request),
|
|
39982
42463
|
POST: ({ request }) => handleProjectsPost(request)
|
|
39983
42464
|
} } });
|
|
39984
|
-
var Route$
|
|
39985
|
-
var Route$
|
|
39986
|
-
var Route$
|
|
39987
|
-
var Route$
|
|
39988
|
-
var Route$
|
|
42465
|
+
var Route$24 = createFileRoute("/api/chat/abort")({ server: { handlers: { POST: ({ request }) => handleChatAbortPost(request) } } });
|
|
42466
|
+
var Route$23 = createFileRoute("/api/chat/artifacts")({ server: { handlers: { PUT: ({ request }) => handleChatOpenUIArtifactPut(request) } } });
|
|
42467
|
+
var Route$22 = createFileRoute("/api/chat/command")({ server: { handlers: { POST: ({ request }) => handleChatCommandPost(request) } } });
|
|
42468
|
+
var Route$21 = createFileRoute("/api/chat/commands")({ server: { handlers: { GET: ({ request }) => handleChatCommandsGet(request) } } });
|
|
42469
|
+
var Route$20 = createFileRoute("/api/chat/completion")({ server: { handlers: { POST: ({ request }) => handleChatCompletionPost(request) } } });
|
|
42470
|
+
var Route$19 = createFileRoute("/api/chat/events")({ server: { handlers: { GET: ({ request }) => handleChatEventsGet(request) } } });
|
|
42471
|
+
var Route$18 = createFileRoute("/api/chat/intent")({ server: { handlers: {
|
|
42472
|
+
GET: ({ request }) => handleChatIntentGet(request),
|
|
42473
|
+
PATCH: ({ request }) => handleChatIntentPatch(request),
|
|
42474
|
+
POST: ({ request }) => handleChatIntentPost(request),
|
|
42475
|
+
PUT: ({ request }) => handleChatIntentPut(request)
|
|
42476
|
+
} } });
|
|
39989
42477
|
var Route$17 = createFileRoute("/api/chat/mcp")({ server: { handlers: {
|
|
39990
42478
|
GET: ({ request }) => handleChatMcpGet(request),
|
|
39991
42479
|
POST: ({ request }) => handleChatMcpPost(request),
|
|
@@ -40027,51 +42515,61 @@ var Route$3 = createFileRoute("/api/workspace/tree")({ server: { handlers: { GET
|
|
|
40027
42515
|
var Route$2 = createFileRoute("/api/chat/mcp/oauth")({ server: { handlers: { POST: ({ request }) => handleChatMcpOAuthPost(request) } } });
|
|
40028
42516
|
var Route$1 = createFileRoute("/api/chat/models/discover")({ server: { handlers: { POST: ({ request }) => handleChatModelsDiscoverPost(request) } } });
|
|
40029
42517
|
var Route = createFileRoute("/api/chat/providers/oauth")({ server: { handlers: { POST: ({ request }) => handleChatProvidersOAuthPost(request) } } });
|
|
40030
|
-
var IndexRoute = Route$
|
|
42518
|
+
var IndexRoute = Route$28.update({
|
|
40031
42519
|
id: "/",
|
|
40032
42520
|
path: "/",
|
|
40033
|
-
getParentRoute: () => Route$
|
|
42521
|
+
getParentRoute: () => Route$29
|
|
40034
42522
|
});
|
|
40035
|
-
var ApiChatRoute = Route$
|
|
42523
|
+
var ApiChatRoute = Route$27.update({
|
|
40036
42524
|
id: "/api/chat",
|
|
40037
42525
|
path: "/api/chat",
|
|
40038
|
-
getParentRoute: () => Route$
|
|
42526
|
+
getParentRoute: () => Route$29
|
|
40039
42527
|
});
|
|
40040
|
-
var ApiHealthRoute = Route$
|
|
42528
|
+
var ApiHealthRoute = Route$26.update({
|
|
40041
42529
|
id: "/api/health",
|
|
40042
42530
|
path: "/api/health",
|
|
40043
|
-
getParentRoute: () => Route$
|
|
42531
|
+
getParentRoute: () => Route$29
|
|
40044
42532
|
});
|
|
40045
|
-
var ApiProjectsRoute = Route$
|
|
42533
|
+
var ApiProjectsRoute = Route$25.update({
|
|
40046
42534
|
id: "/api/projects",
|
|
40047
42535
|
path: "/api/projects",
|
|
40048
|
-
getParentRoute: () => Route$
|
|
42536
|
+
getParentRoute: () => Route$29
|
|
40049
42537
|
});
|
|
40050
|
-
var ApiChatAbortRoute = Route$
|
|
42538
|
+
var ApiChatAbortRoute = Route$24.update({
|
|
40051
42539
|
id: "/abort",
|
|
40052
42540
|
path: "/abort",
|
|
40053
42541
|
getParentRoute: () => ApiChatRoute
|
|
40054
42542
|
});
|
|
40055
|
-
var ApiChatArtifactsRoute = Route$
|
|
42543
|
+
var ApiChatArtifactsRoute = Route$23.update({
|
|
40056
42544
|
id: "/artifacts",
|
|
40057
42545
|
path: "/artifacts",
|
|
40058
42546
|
getParentRoute: () => ApiChatRoute
|
|
40059
42547
|
});
|
|
40060
|
-
var ApiChatCommandRoute = Route$
|
|
42548
|
+
var ApiChatCommandRoute = Route$22.update({
|
|
40061
42549
|
id: "/command",
|
|
40062
42550
|
path: "/command",
|
|
40063
42551
|
getParentRoute: () => ApiChatRoute
|
|
40064
42552
|
});
|
|
40065
|
-
var ApiChatCommandsRoute = Route$
|
|
42553
|
+
var ApiChatCommandsRoute = Route$21.update({
|
|
40066
42554
|
id: "/commands",
|
|
40067
42555
|
path: "/commands",
|
|
40068
42556
|
getParentRoute: () => ApiChatRoute
|
|
40069
42557
|
});
|
|
40070
|
-
var
|
|
42558
|
+
var ApiChatCompletionRoute = Route$20.update({
|
|
42559
|
+
id: "/completion",
|
|
42560
|
+
path: "/completion",
|
|
42561
|
+
getParentRoute: () => ApiChatRoute
|
|
42562
|
+
});
|
|
42563
|
+
var ApiChatEventsRoute = Route$19.update({
|
|
40071
42564
|
id: "/events",
|
|
40072
42565
|
path: "/events",
|
|
40073
42566
|
getParentRoute: () => ApiChatRoute
|
|
40074
42567
|
});
|
|
42568
|
+
var ApiChatIntentRoute = Route$18.update({
|
|
42569
|
+
id: "/intent",
|
|
42570
|
+
path: "/intent",
|
|
42571
|
+
getParentRoute: () => ApiChatRoute
|
|
42572
|
+
});
|
|
40075
42573
|
var ApiChatMcpRoute = Route$17.update({
|
|
40076
42574
|
id: "/mcp",
|
|
40077
42575
|
path: "/mcp",
|
|
@@ -40140,12 +42638,12 @@ var ApiProjectsForkRoute = Route$5.update({
|
|
|
40140
42638
|
var ApiWorkspaceFileRoute = Route$4.update({
|
|
40141
42639
|
id: "/api/workspace/file",
|
|
40142
42640
|
path: "/api/workspace/file",
|
|
40143
|
-
getParentRoute: () => Route$
|
|
42641
|
+
getParentRoute: () => Route$29
|
|
40144
42642
|
});
|
|
40145
42643
|
var ApiWorkspaceTreeRoute = Route$3.update({
|
|
40146
42644
|
id: "/api/workspace/tree",
|
|
40147
42645
|
path: "/api/workspace/tree",
|
|
40148
|
-
getParentRoute: () => Route$
|
|
42646
|
+
getParentRoute: () => Route$29
|
|
40149
42647
|
});
|
|
40150
42648
|
var ApiChatMcpOauthRoute = Route$2.update({
|
|
40151
42649
|
id: "/oauth",
|
|
@@ -40172,7 +42670,9 @@ var ApiChatRouteChildren = {
|
|
|
40172
42670
|
ApiChatArtifactsRoute,
|
|
40173
42671
|
ApiChatCommandRoute,
|
|
40174
42672
|
ApiChatCommandsRoute,
|
|
42673
|
+
ApiChatCompletionRoute,
|
|
40175
42674
|
ApiChatEventsRoute,
|
|
42675
|
+
ApiChatIntentRoute,
|
|
40176
42676
|
ApiChatMcpRoute: ApiChatMcpRouteWithChildren,
|
|
40177
42677
|
ApiChatModelsRoute: ApiChatModelsRouteWithChildren,
|
|
40178
42678
|
ApiChatNewRoute,
|
|
@@ -40198,7 +42698,7 @@ var rootRouteChildren = {
|
|
|
40198
42698
|
ApiWorkspaceFileRoute,
|
|
40199
42699
|
ApiWorkspaceTreeRoute
|
|
40200
42700
|
};
|
|
40201
|
-
var routeTree = Route$
|
|
42701
|
+
var routeTree = Route$29._addFileChildren(rootRouteChildren)._addFileTypes();
|
|
40202
42702
|
function getRouter() {
|
|
40203
42703
|
return createRouter({
|
|
40204
42704
|
routeTree,
|