@p4code/cli 0.8.7 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/dist/AcpMcpStdioBridge-BFonJkL3.mjs +4 -0
  2. package/dist/{AcpMcpStdioBridge-DHwGLtep.mjs → AcpMcpStdioBridge-WH45ZIFK.mjs} +78 -11
  3. package/dist/{Effect-BahT0mOQ.mjs → Effect-B-zvTJgX.mjs} +2 -2
  4. package/dist/bin.mjs +2 -2
  5. package/dist/{binCli-D_84b0CF.mjs → binCli-C7u9q31G.mjs} +114320 -113097
  6. package/dist/claude-history-worker.mjs +1 -1
  7. package/dist/{claudeHistoryWorker-v_0uyLGp.mjs → claudeHistoryWorker-C1bTkcUr.mjs} +2 -2
  8. package/dist/client/.vite/manifest.json +2072 -2071
  9. package/dist/client/assets/{AnimatedHeight-DewGDSmN.js → AnimatedHeight-DZPLUjm9.js} +2 -2
  10. package/dist/client/assets/{AuthSurfaceShell-D29U36jB.js → AuthSurfaceShell-CY0yRsGY.js} +2 -2
  11. package/dist/client/assets/{CSPContext-CB4Jj3Uk.js → CSPContext-D9jns38x.js} +2 -2
  12. package/dist/client/assets/ChatGptUsageButton-jceJZ5U0.js +2 -0
  13. package/dist/client/assets/ChatMarkdown-B2cnntMF.js +65 -0
  14. package/dist/client/assets/{CodexSetupSection.logic-DQMTTenV.js → CodexSetupSection.logic-Bfp0M73n.js} +2 -2
  15. package/dist/client/assets/ComboboxClear-B-WUNsj0.js +2 -0
  16. package/dist/client/assets/{CommandBlock-VzUG411k.js → CommandBlock-BI9G-Hs9.js} +2 -2
  17. package/dist/client/assets/{ComposerPromptEditor-lIFv0Iko.js → ComposerPromptEditor-CYQVwHWc.js} +56 -56
  18. package/dist/client/assets/CompositeRoot-CZqNlh6y.js +2 -0
  19. package/dist/client/assets/{ConnectionStatusDot-B0ZKI-zI.js → ConnectionStatusDot-BNGv8ojc.js} +2 -2
  20. package/dist/client/assets/DevicePanel-C5V7qlX0.js +2 -0
  21. package/dist/client/assets/{DeviceSetup-Bg5OpWbo.js → DeviceSetup-lLd1Dxuc.js} +2 -2
  22. package/dist/client/assets/{DialogTitle-BVkBTuS9.js → DialogTitle-Bti0gMwZ.js} +2 -2
  23. package/dist/client/assets/{DiffCommentAnnotation-BsI9yTe1.js → DiffCommentAnnotation-DpZ1jfFT.js} +2 -2
  24. package/dist/client/assets/{DiffFileTree-Bg8GHn2r.js → DiffFileTree-DW_wXLvM.js} +2 -2
  25. package/dist/client/assets/DiffPanel-DvsF1RpU.js +2 -0
  26. package/dist/client/assets/{DiffWorkerPoolProvider-B9BXoLYM.js → DiffWorkerPoolProvider-BGHe4Gu5.js} +3 -3
  27. package/dist/client/assets/{EnvironmentMachineIcon-DX1wHHgS.js → EnvironmentMachineIcon-BzeEbEQS.js} +2 -2
  28. package/dist/client/assets/{ExpandableText-DfTvwfDp.js → ExpandableText-CZAoe3pn.js} +2 -2
  29. package/dist/client/assets/{FieldControl-CrNWnPN_.js → FieldControl-DSYkAElP.js} +2 -2
  30. package/dist/client/assets/{FileDiff-Ds-DSHzC.js → FileDiff-qUCf81Vy.js} +2 -2
  31. package/dist/client/assets/{FilePreviewPanel-CyR5pXUr.js → FilePreviewPanel-DgsQ3_bI.js} +4 -4
  32. package/dist/client/assets/{FoldedSettingsSection-DQesC0Ch.js → FoldedSettingsSection-B8ucLmcM.js} +2 -2
  33. package/dist/client/assets/{FormContext-CUf-dYwe.js → FormContext-TllbMdtd.js} +2 -2
  34. package/dist/client/assets/{Icons-DMu3kCVA.js → Icons-CyDEOiJ2.js} +2 -2
  35. package/dist/client/assets/{KeybindingsSettings.logic-BB1oFV_W.js → KeybindingsSettings.logic-Dx9jAbbW.js} +2 -2
  36. package/dist/client/assets/{NoProjectsHero-D0SwrjYG.js → NoProjectsHero-Lxz19PUh.js} +2 -2
  37. package/dist/client/assets/PanelLayoutControls-jZ_kyR1v.js +216 -0
  38. package/dist/client/assets/{PierreEntryIcon-BUl5qtCE.js → PierreEntryIcon-zwmwEij7.js} +2 -2
  39. package/dist/client/assets/PreviewPanel-Cgu0PLKZ.js +2 -0
  40. package/dist/client/assets/ProjectDefaultsSettings-DaLgF84f.js +2 -0
  41. package/dist/client/assets/ProjectFavicon-Cs-IpJFL.js +3 -0
  42. package/dist/client/assets/{ProjectIconPickerDialog-C-KFxEg0.js → ProjectIconPickerDialog-CWU1aanN.js} +2 -2
  43. package/dist/client/assets/{ProjectMonogram-B2dsNF6-.js → ProjectMonogram-De9Vi6mM.js} +2 -2
  44. package/dist/client/assets/{ProviderAuthTerminal-Cwr8Z1Ly.js → ProviderAuthTerminal-Dod9VT45.js} +2 -2
  45. package/dist/client/assets/ProviderModelPicker-DnPxGK8M.js +2 -0
  46. package/dist/client/assets/{ProviderSettingsForm-DpmAB_Jq.js → ProviderSettingsForm-CK0XB_2n.js} +2 -2
  47. package/dist/client/assets/PullRequestCodeTab-TTmg3elC.js +6 -0
  48. package/dist/client/assets/{ReadOnlySourcePreview-C5y6ELAP.js → ReadOnlySourcePreview-DS49yxPu.js} +2 -2
  49. package/dist/client/assets/{RenderErrorBoundary-CyH8UwmD.js → RenderErrorBoundary-ChsSTLIX.js} +2 -2
  50. package/dist/client/assets/ScheduledTasksSettings-DK0fR_O9.js +4 -0
  51. package/dist/client/assets/{ScopedSwitch-pdvWIJp5.js → ScopedSwitch-zab4bpLE.js} +2 -2
  52. package/dist/client/assets/{SecretInput-C11F3Wuh.js → SecretInput-7_dN8OZO.js} +2 -2
  53. package/dist/client/assets/SettingsPanels-CvD-BKml.js +39 -0
  54. package/dist/client/assets/{SettingsPanels.logic-zUA6f3HT.js → SettingsPanels.logic-BxZ7DzP5.js} +2 -2
  55. package/dist/client/assets/{SettingsScopeNotice-N6bcXfto.js → SettingsScopeNotice-Bq3kVMy1.js} +2 -2
  56. package/dist/client/assets/{T3ConnectAccountPages-uVnu-v4W.js → T3ConnectAccountPages-C37rBXr1.js} +2 -2
  57. package/dist/client/assets/{T3ConnectSidebarSignIn-CZCWzt6C.js → T3ConnectSidebarSignIn-Dcx0wC1Y.js} +2 -2
  58. package/dist/client/assets/{ThemeEditorPanel-CjUB7HmU.js → ThemeEditorPanel-CDg13cbU.js} +3 -3
  59. package/dist/client/assets/{ThreadTerminalDrawer-CAh-h3eK.js → ThreadTerminalDrawer-CJZ5gJIq.js} +4 -4
  60. package/dist/client/assets/{Virtualizer-CB4f0UTD.js → Virtualizer-BzpMB2EV.js} +2 -2
  61. package/dist/client/assets/{WorkspaceBreadcrumb-3VgFkWcC.js → WorkspaceBreadcrumb-BG0QcIel.js} +2 -2
  62. package/dist/client/assets/{WorkspacePageContainer-8jksqZGW.js → WorkspacePageContainer-D4M31vG4.js} +2 -2
  63. package/dist/client/assets/{WorkspacePageHeader-IRvZnA0X.js → WorkspacePageHeader-xG2EcvME.js} +2 -2
  64. package/dist/client/assets/_chat-DWZuy8TH.js +45 -0
  65. package/dist/client/assets/{_chat.index-DnYerwxz.js → _chat.index-CFbhMaCi.js} +2 -2
  66. package/dist/client/assets/{_chat.new-XtBIcyRw.js → _chat.new-B9CmLitW.js} +3 -3
  67. package/dist/client/assets/_chat.pull-requests-BvS3LBJa.js +2 -0
  68. package/dist/client/assets/{abnfDiagram-VCTEODGH-DUPWAarL.js → abnfDiagram-VCTEODGH-DTgtRsRm.js} +2 -2
  69. package/dist/client/assets/{alert-DzxRsWWi.js → alert-BFkMrLRZ.js} +2 -2
  70. package/dist/client/assets/architecture-7GRP2DOG-B_WCZ15Q.js +1 -0
  71. package/dist/client/assets/{architectureDiagram-5GKGNRK7-ipdl5Chl.js → architectureDiagram-5GKGNRK7-DoSCknS9.js} +2 -2
  72. package/dist/client/assets/assets-CH9UWZJ9.js +2 -0
  73. package/dist/client/assets/{blockDiagram-I7D4REHJ-CCqcBoEP.js → blockDiagram-I7D4REHJ-CIO7Vskr.js} +2 -2
  74. package/dist/client/assets/{browserHistoryStore-TLJ0k3I1.js → browserHistoryStore-CUwwaVj8.js} +2 -2
  75. package/dist/client/assets/{browserLinkTarget-Du_qPFvd.js → browserLinkTarget-o1Hmp1Jv.js} +2 -2
  76. package/dist/client/assets/{c4Diagram-7LVT6UL2-D0uMteR1.js → c4Diagram-7LVT6UL2-CmnScM2q.js} +2 -2
  77. package/dist/client/assets/channel-Qn29FVeD.js +2 -0
  78. package/dist/client/assets/checkbox-DSb65NrE.js +2 -0
  79. package/dist/client/assets/{chunk-4HAMMTFA-B3SWgtem.js → chunk-4HAMMTFA-CuQTMYv7.js} +2 -2
  80. package/dist/client/assets/{chunk-75Z2AOVW-CXAakYxI.js → chunk-75Z2AOVW-xNjAbRtQ.js} +2 -2
  81. package/dist/client/assets/{chunk-DU6HZSFF-B4qcstD9.js → chunk-DU6HZSFF-B-vhPkPw.js} +2 -2
  82. package/dist/client/assets/{chunk-F27PBJKO-DimzPDjs.js → chunk-F27PBJKO-HjvfKtnV.js} +2 -2
  83. package/dist/client/assets/{chunk-GMAD6QVW-BHA-Os4E.js → chunk-GMAD6QVW-kPi65s4F.js} +2 -2
  84. package/dist/client/assets/{chunk-GVQU2GXP-P9nMI_GJ.js → chunk-GVQU2GXP-xSVP_0Ga.js} +2 -2
  85. package/dist/client/assets/{chunk-IMKFNOWR-RgWCceFN.js → chunk-IMKFNOWR-Bo44GnXt.js} +2 -2
  86. package/dist/client/assets/{chunk-L3NEJ4N5-9p7zIkHC.js → chunk-L3NEJ4N5-CL_FAp25.js} +2 -2
  87. package/dist/client/assets/{chunk-OSK3NFVY-C9IokqLY.js → chunk-OSK3NFVY-C-UAFrKw.js} +2 -2
  88. package/dist/client/assets/{chunk-P2QGCYS3-Dwk8ORW_.js → chunk-P2QGCYS3-Cu_kTzsg.js} +2 -2
  89. package/dist/client/assets/{chunk-POPQ4Y6H-BwYKYQwt.js → chunk-POPQ4Y6H-DlEI3XVl.js} +2 -2
  90. package/dist/client/assets/{chunk-PWAF6VOD-BMw0rklB.js → chunk-PWAF6VOD-COj3Z6PV.js} +2 -2
  91. package/dist/client/assets/{chunk-SHT3W25Y-D3ovSAoa.js → chunk-SHT3W25Y-DmOdlcB6.js} +2 -2
  92. package/dist/client/assets/{chunk-SVP7TREG-CpaRTznV.js → chunk-SVP7TREG-DZcmFNGC.js} +2 -2
  93. package/dist/client/assets/{chunk-TICWLB2K-CAtIccZJ.js → chunk-TICWLB2K-D2Au2dCv.js} +2 -2
  94. package/dist/client/assets/classDiagram-ZZMXUADV-BNlFiwih.js +2 -0
  95. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BNlFiwih.js +2 -0
  96. package/dist/client/assets/{color-picker-DYoHU1P8.js → color-picker-8XrkJD1z.js} +2 -2
  97. package/dist/client/assets/{combobox-Ddag8Jom.js → combobox-BdHSd-gh.js} +2 -2
  98. package/dist/client/assets/{command-B35zAYVN.js → command-DywgXMPU.js} +2 -2
  99. package/dist/client/assets/{connect-XgeleCz9.js → connect-D6Vr-odX.js} +2 -2
  100. package/dist/client/assets/{connect-agent-BRIcxQbo.js → connect-agent-D6S_10vE.js} +2 -2
  101. package/dist/client/assets/{cynefin-OW5HDTMX-Br0UWz2p.js → cynefin-OW5HDTMX-Cl8Piv1U.js} +1 -1
  102. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Bz8AWXlE.js → cynefinDiagram-5FMLGOSQ-BlrMhOzc.js} +2 -2
  103. package/dist/client/assets/{dagre-GXQ25YYZ-Kk1kLU-A.js → dagre-GXQ25YYZ-zcnnhkbu.js} +2 -2
  104. package/dist/client/assets/{device-CJH4ixRH.js → device-CVYEIUNR.js} +2 -2
  105. package/dist/client/assets/{diagram-S7CK7UJ4-Dogw5edZ.js → diagram-S7CK7UJ4-bDWotpej.js} +2 -2
  106. package/dist/client/assets/{diagram-UQ7AKVKN-kg5DSfbZ.js → diagram-UQ7AKVKN-QfcGX0wU.js} +2 -2
  107. package/dist/client/assets/{diagram-VSXAHHWV-DXdyRkdD.js → diagram-VSXAHHWV-B6rtnGIC.js} +2 -2
  108. package/dist/client/assets/{diagram-VX7I27RA-CNO5Z04I.js → diagram-VX7I27RA-Bh7jDf_z.js} +2 -2
  109. package/dist/client/assets/{diagram-Z3DM3KII-7Pw0HXMg.js → diagram-Z3DM3KII-BF8BOL3s.js} +2 -2
  110. package/dist/client/assets/{dialog-C9_Ef3sx.js → dialog-B5b8j4VI.js} +2 -2
  111. package/dist/client/assets/{diffRendering-CAxImuLd.js → diffRendering-CnRmUrdi.js} +2 -2
  112. package/dist/client/assets/{discovery-list-DXE1P9pq.js → discovery-list-DLWA9rLh.js} +2 -2
  113. package/dist/client/assets/{dist-DOyHkZUI.js → dist-B181ZKao.js} +3 -3
  114. package/dist/client/assets/{draft-input-6dynCiw_.js → draft-input-CidATm_k.js} +2 -2
  115. package/dist/client/assets/{duoViewer-BFeSS1Av.js → duoViewer-gLqnN26Y.js} +2 -2
  116. package/dist/client/assets/{dynamic-BxCDxZLw.js → dynamic-C9YFXILD.js} +2 -2
  117. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DD9UVmrJ.js → ebnfDiagram-PWID7BFC-DbaAPr36.js} +2 -2
  118. package/dist/client/assets/{embeddedScripts-CIC2AYGL.js → embeddedScripts-DZZY2Y12.js} +2 -2
  119. package/dist/client/assets/empty-BQwNj0_P.js +2 -0
  120. package/dist/client/assets/entities-CW57Cs5E.js +2 -0
  121. package/dist/client/assets/{erDiagram-RLTQ6QDP-BJ--ph2e.js → erDiagram-RLTQ6QDP-CkFVQs9q.js} +2 -2
  122. package/dist/client/assets/eventmodeling-NTZA5JFV-Bx5bcL3d.js +1 -0
  123. package/dist/client/assets/{fileLinks-BZV-xG7Q.js → fileLinks-CJJSqeqK.js} +2 -2
  124. package/dist/client/assets/{fileTreeExpansion-SSkII8h0.js → fileTreeExpansion-D1dm7wQj.js} +2 -2
  125. package/dist/client/assets/flowDiagram-HODETNUW-BOrqEpZF.js +1 -0
  126. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CAMkT1YN.js → ganttDiagram-EL5Y4UJY-bgGfFOUy.js} +2 -2
  127. package/dist/client/assets/{getDiffFileInput-BbRHVLd8.js → getDiffFileInput-C3kf5492.js} +2 -2
  128. package/dist/client/assets/{gitGraph-4MIJSDKK-DsGem99u.js → gitGraph-4MIJSDKK-CkcsQXce.js} +1 -1
  129. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BkbTIyDI.js → gitGraphDiagram-WWUBYQGX-D9-3rabr.js} +2 -2
  130. package/dist/client/assets/{guideRunStore-CRgghh5M.js → guideRunStore-C7ZnghV_.js} +2 -2
  131. package/dist/client/assets/{htmlRender-DhaCAG_8.js → htmlRender-Dwrbtk9Z.js} +2 -2
  132. package/dist/client/assets/{index-CyuShNwE.js → index-CG78-Gl5.js} +3 -3
  133. package/dist/client/assets/{info-A6RAGUB7-BBQkQpY8.js → info-A6RAGUB7-D_d0Mq_H.js} +1 -1
  134. package/dist/client/assets/{infoDiagram-27XIBGKW-B-aRfZJ5.js → infoDiagram-27XIBGKW-DYnd3lec.js} +2 -2
  135. package/dist/client/assets/{input-BZEAWLAC.js → input-CNGP9r-b.js} +2 -2
  136. package/dist/client/assets/{input-group-DQ0hiSJt.js → input-group-CIDwGwLV.js} +2 -2
  137. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BuQT0JFA.js → ishikawaDiagram-5VMMS53U-Br3IhV30.js} +2 -2
  138. package/dist/client/assets/{journeyDiagram-3NMN7TZE-DvMkIp6_.js → journeyDiagram-3NMN7TZE-D4gshgtr.js} +2 -2
  139. package/dist/client/assets/{kanban-definition-UXKFOSKX-BH-BleQp.js → kanban-definition-UXKFOSKX-DODm_gbD.js} +2 -2
  140. package/dist/client/assets/{kbd-B5U1dWuw.js → kbd-C3OLELe_.js} +2 -2
  141. package/dist/client/assets/{keybindings-BOV97yVS.js → keybindings-Dw_FB1Sr.js} +2 -2
  142. package/dist/client/assets/{lazyRouteComponent-Cz9CWj20.js → lazyRouteComponent-knQbCz5Y.js} +2 -2
  143. package/dist/client/assets/{line-ldmXyAfR.js → line-B2pKNKWO.js} +2 -2
  144. package/dist/client/assets/{link-GWWfOiYJ.js → link-CBNV8k75.js} +2 -2
  145. package/dist/client/assets/{linkedPrompt-CUOURNo0.js → linkedPrompt-BsxfomUU.js} +2 -2
  146. package/dist/client/assets/main-BEavB8iB.css +2 -0
  147. package/dist/client/assets/main-pmaKofkn.js +30 -0
  148. package/dist/client/assets/{mediaReference-CHMrPLS_.js → mediaReference-BLVT2VlI.js} +2 -2
  149. package/dist/client/assets/{mediaSource-C2DVrhoI.js → mediaSource-1xb6xNr7.js} +2 -2
  150. package/dist/client/assets/{mermaid-parser.core-CLu3jfMo.js → mermaid-parser.core-CT916xNb.js} +4 -4
  151. package/dist/client/assets/{mermaid.core-CcbjUEO9.js → mermaid.core-dZGXThQe.js} +5 -5
  152. package/dist/client/assets/{mindmap-definition-YA3MSWOX-BgA-mHTZ.js → mindmap-definition-YA3MSWOX-DRDe2pwU.js} +2 -2
  153. package/dist/client/assets/number-field-CrV4BtLe.js +2 -0
  154. package/dist/client/assets/{observeResize-DRhwSBbU.js → observeResize-jQzrVN_N.js} +2 -2
  155. package/dist/client/assets/{onboarding-JdAo8zsA.js → onboarding-DnxQtcwh.js} +2 -2
  156. package/dist/client/assets/{openFileInPreview-fPqhkMo9.js → openFileInPreview-Dx_dxN9N.js} +2 -2
  157. package/dist/client/assets/{p4ProjectFile-CvON4UbU.js → p4ProjectFile-BfRZT-Cd.js} +2 -2
  158. package/dist/client/assets/{packet-AYTQ26CC-DApn8qRX.js → packet-AYTQ26CC-BewZkvu0.js} +1 -1
  159. package/dist/client/assets/{pair-BZFzlFlB.js → pair-B5ki01nI.js} +2 -2
  160. package/dist/client/assets/{pegDiagram-XKGWAZYB-CXEiF-e_.js → pegDiagram-XKGWAZYB-C9c_KSl7.js} +2 -2
  161. package/dist/client/assets/{phoneViewer-B2PYzUOK.js → phoneViewer-HVXHif_1.js} +2 -2
  162. package/dist/client/assets/{pie-WAS4IAKB-CYqWZV05.js → pie-WAS4IAKB-CzmLCGka.js} +1 -1
  163. package/dist/client/assets/{pieDiagram-E7YTZNPT-DI-IJXNl.js → pieDiagram-E7YTZNPT-C-Z8w4pJ.js} +2 -2
  164. package/dist/client/assets/{pierre-icons-bBNX7pHG.js → pierre-icons-CnfzBsKG.js} +2 -2
  165. package/dist/client/assets/popover-CCsUmLYF.js +2 -0
  166. package/dist/client/assets/{preview-BVbvXV-T.js → preview-BJJOaGR2.js} +2 -2
  167. package/dist/client/assets/{preview-CBNZZm4k.js → preview-BXxrRVX-.js} +2 -2
  168. package/dist/client/assets/{previewMiniPlayerStore-C_DZeWb5.js → previewMiniPlayerStore-C7poB4-A.js} +2 -2
  169. package/dist/client/assets/primary-DBlVHyxT.js +2 -0
  170. package/dist/client/assets/primaryCloudLinkState-BfCEo8Kn.js +2 -0
  171. package/dist/client/assets/projectFilesQueryState-CgqhXdfj.js +2 -0
  172. package/dist/client/assets/projectScriptEditor-CARl6hYK.js +2 -0
  173. package/dist/client/assets/{providerSkills-JMYzRM2N.js → providerSkills-B2xzNGmJ.js} +2 -2
  174. package/dist/client/assets/{pullRequestDetail.logic-BVBxawC1.js → pullRequestDetail.logic-CYwAUOQC.js} +5 -5
  175. package/dist/client/assets/{pullRequestIcons-CuqlEFYV.js → pullRequestIcons-SCwBWGeD.js} +2 -2
  176. package/dist/client/assets/{pullRequestReviewStore-DmxuV1dp.js → pullRequestReviewStore-C7gfd5m3.js} +2 -2
  177. package/dist/client/assets/pullRequests-DQFba6Nz.js +2 -0
  178. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Os8jPhhw.js → quadrantDiagram-AXDQQJYC-I8UtWMv_.js} +2 -2
  179. package/dist/client/assets/queries-DfOxYbXr.js +2 -0
  180. package/dist/client/assets/query-w0R7LhwJ.js +2 -0
  181. package/dist/client/assets/{radar-RG4KPBEZ-BwFp-k4W.js → radar-RG4KPBEZ-CuVsLyvG.js} +1 -1
  182. package/dist/client/assets/radio-group-DwQ0T1X6.js +2 -0
  183. package/dist/client/assets/{railroad-74A4TZTK-BhaeCUUR.js → railroad-74A4TZTK-CZZIaT2B.js} +1 -1
  184. package/dist/client/assets/railroad-abnf-HS5TGJTU-DieERyRq.js +1 -0
  185. package/dist/client/assets/railroad-ebnf-LZEXJU2U-BVbP0cR7.js +1 -0
  186. package/dist/client/assets/railroad-peg-WCYAUIDC-BDR9vaLF.js +1 -0
  187. package/dist/client/assets/{railroadDiagram-O6MQD6OU-BwEd4kBJ.js → railroadDiagram-O6MQD6OU-CogIhoTG.js} +2 -2
  188. package/dist/client/assets/{renderScheduler-C031Kal5.js → renderScheduler-wjSXDjer.js} +2 -2
  189. package/dist/client/assets/{requirementDiagram-BXWQKSXE-B3cJlOEK.js → requirementDiagram-BXWQKSXE-B9wTphzK.js} +2 -2
  190. package/dist/client/assets/{rightPanelStore-JWjHC9l1.js → rightPanelStore-CRw1DWSH.js} +2 -2
  191. package/dist/client/assets/runtime-ZOY8Qeg_.js +2 -0
  192. package/dist/client/assets/runtime-qAs3Aj0U.js +6 -0
  193. package/dist/client/assets/runtimeModeConfig-VaVDuoFW.js +2 -0
  194. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-C8CBmy9t.js → sankeyDiagram-P5KCCOFB-CeJuchFj.js} +2 -2
  195. package/dist/client/assets/{scheduledTasksSettings.logic-CJBRz5bk.js → scheduledTasksSettings.logic-BBBjz09I.js} +3 -3
  196. package/dist/client/assets/{scroll-area-D4H8QGpd.js → scroll-area-DyzCabMe.js} +2 -2
  197. package/dist/client/assets/select-BX0YSg0P.js +2 -0
  198. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-IbrowOt4.js → sequenceDiagram-WJ2MYXX4-xpNi2v3f.js} +2 -2
  199. package/dist/client/assets/server-BxsIDqAi.js +2 -0
  200. package/dist/client/assets/session-Lp4r-IPM.js +2 -0
  201. package/dist/client/assets/{session-logic-CiMoVF-V.js → session-logic-BFdJF3Bv.js} +5 -5
  202. package/dist/client/assets/{settings-mAdVdtYz.js → settings-D6fi9-XU.js} +2 -2
  203. package/dist/client/assets/settings.appearance-BBT8xGDi.js +2 -0
  204. package/dist/client/assets/settings.archived-Cg-9thGj.js +2 -0
  205. package/dist/client/assets/{settings.computer-use-IGLZXOs8.js → settings.computer-use-Bona3Wg6.js} +2 -2
  206. package/dist/client/assets/settings.connections-BqAUuYT4.js +2 -0
  207. package/dist/client/assets/{settings.data-controls-FiLy_ddv.js → settings.data-controls-OJqN88f4.js} +2 -2
  208. package/dist/client/assets/{settings.decisions-DZO8QWHd.js → settings.decisions-CZWGkeug.js} +2 -2
  209. package/dist/client/assets/settings.diagnostics-DELbs4ob.js +2 -0
  210. package/dist/client/assets/settings.general-B-fstEU-.js +2 -0
  211. package/dist/client/assets/settings.integrations-B9_Yw0oa.js +2 -0
  212. package/dist/client/assets/{settings.keybindings-BYwCM_iI.js → settings.keybindings-tFQjI19L.js} +2 -2
  213. package/dist/client/assets/{settings.open-source-licenses-CZcWXiGu.js → settings.open-source-licenses-J0KhjvdX.js} +2 -2
  214. package/dist/client/assets/{settings.plugins-P_B4taFp.js → settings.plugins-BnMZc7bA.js} +4 -4
  215. package/dist/client/assets/settings.projects-B9iYESeP.js +4 -0
  216. package/dist/client/assets/settings.providers-D_HCdEfA.js +3 -0
  217. package/dist/client/assets/settings.scheduled-tasks-DaNDwLtr.js +2 -0
  218. package/dist/client/assets/{settings.snap-shot-uj9CX5J6.js → settings.snap-shot-ClQxMhzg.js} +2 -2
  219. package/dist/client/assets/{settings.source-control-H60mYM0m.js → settings.source-control-Bs4O94Ae.js} +2 -2
  220. package/dist/client/assets/{settings.storage--Ghi4ySm.js → settings.storage-BYJ2h7qr.js} +2 -2
  221. package/dist/client/assets/settingsLayout-DhPKINaL.js +3 -0
  222. package/dist/client/assets/{sidebar-7a8hvtAS.js → sidebar-ZKIDHqbk.js} +2 -2
  223. package/dist/client/assets/{sidebarProjectGrouping-BGgp_M_h.js → sidebarProjectGrouping-BFqO8E5C.js} +2 -2
  224. package/dist/client/assets/skeleton--v3ra8uu.js +2 -0
  225. package/dist/client/assets/{sortable.esm-CG0AZByT.js → sortable.esm-UojJGtqY.js} +2 -2
  226. package/dist/client/assets/{sourceControl-B8VqenU-.js → sourceControl-ByZv2xxh.js} +2 -2
  227. package/dist/client/assets/{spinner-YUJ6Pwvq.js → spinner-CH-Dn9Fj.js} +2 -2
  228. package/dist/client/assets/{standalone-page-BxErOfZy.js → standalone-page-BwpW1F1h.js} +2 -2
  229. package/dist/client/assets/{stateDiagram-D77RDMKH-C0i1_7JQ.js → stateDiagram-D77RDMKH-BMh5LMip.js} +2 -2
  230. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CK8WckkU.js +2 -0
  231. package/dist/client/assets/{swimlanes-42K2YHIH-DlWorw-a.js → swimlanes-42K2YHIH-CGCv__e7.js} +2 -2
  232. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-D_se7el1.js +9 -0
  233. package/dist/client/assets/{terminal-links-DnuUiEnP.js → terminal-links-DX86FsHj.js} +2 -2
  234. package/dist/client/assets/{terminalSessions-B89lkZlG.js → terminalSessions-CUABDfio.js} +2 -2
  235. package/dist/client/assets/{textarea-Br1ny3dw.js → textarea-B3ib3YW-.js} +2 -2
  236. package/dist/client/assets/{themePalette-B4vIs8Bi.js → themePalette-Bl55tW1x.js} +3 -3
  237. package/dist/client/assets/threadSort-DDAHH_-8.js +2 -0
  238. package/dist/client/assets/{timeline-definition-24CTP7MA-f1puoyJY.js → timeline-definition-24CTP7MA-C_Okwnia.js} +2 -2
  239. package/dist/client/assets/toast-3I2gpMYd.js +2 -0
  240. package/dist/client/assets/{toggle-DNxTFG4o.js → toggle-Ce46mx2g.js} +2 -2
  241. package/dist/client/assets/{toggle-group-CQtXH1ph.js → toggle-group-Dt1Yldxx.js} +2 -2
  242. package/dist/client/assets/tooltip-DdUPPKq4.js +2 -0
  243. package/dist/client/assets/{treeView-Q6P3EWNA-cachkR0K.js → treeView-Q6P3EWNA-23mUAiRP.js} +1 -1
  244. package/dist/client/assets/{treemap-WGGIJYW6-5vI1Z8yq.js → treemap-WGGIJYW6-CFr3RCz-.js} +1 -1
  245. package/dist/client/assets/usage-DXTqHj0T.js +2 -0
  246. package/dist/client/assets/{usageAccess-BRuBlcgN.js → usageAccess-BX6xSC4z.js} +2 -2
  247. package/dist/client/assets/{usageFormat-B0V5dWS3.js → usageFormat-CWi_Qt3l.js} +2 -2
  248. package/dist/client/assets/{usageShortcuts-CK0JjnNA.js → usageShortcuts-CGv3_tEe.js} +2 -2
  249. package/dist/client/assets/{use-atom-command-JNR1Jqwn.js → use-atom-command-CVDCnNHi.js} +2 -2
  250. package/dist/client/assets/{useAriaLabelledBy-BNA1QLXP.js → useAriaLabelledBy-BnxRm9-q.js} +2 -2
  251. package/dist/client/assets/{useHandleNewThread-vYbjmg4i.js → useHandleNewThread-BrxevYhf.js} +2 -2
  252. package/dist/client/assets/{useLocation-D91_HRP0.js → useLocation-BdZaQ50l.js} +2 -2
  253. package/dist/client/assets/useNavigate-Cdy4Jh5i.js +2 -0
  254. package/dist/client/assets/{useNavigateBack-DnwpvjrN.js → useNavigateBack-BLZDxCI_.js} +2 -2
  255. package/dist/client/assets/{useParams-CYkWvywV.js → useParams-3tEZUuVD.js} +2 -2
  256. package/dist/client/assets/{usePermissionStatus-CuzpUXth.js → usePermissionStatus-DCcJZUJC.js} +2 -2
  257. package/dist/client/assets/usePullRequestActions-cqQ4IRFz.js +3 -0
  258. package/dist/client/assets/{useRegisterFieldControl-C127nghN.js → useRegisterFieldControl-Cs54XrA4.js} +2 -2
  259. package/dist/client/assets/{useScopedModelAvailability-BsIJUZbS.js → useScopedModelAvailability-DSe3UBFZ.js} +2 -2
  260. package/dist/client/assets/useSettings-DsvnJBf2.js +3 -0
  261. package/dist/client/assets/{useT3ConnectAuthPrompt-DlW3HUgA.js → useT3ConnectAuthPrompt-CBxfN-Bk.js} +2 -2
  262. package/dist/client/assets/utils-TSzPLNGf.js +37 -0
  263. package/dist/client/assets/vcsRefInvalidation-iz2QneVc.js +2 -0
  264. package/dist/client/assets/{vennDiagram-4TSXK5OY-HkY_FANS.js → vennDiagram-4TSXK5OY-DsePUj7P.js} +2 -2
  265. package/dist/client/assets/{wardley-WFR3VGLG-B9HKXiPi.js → wardley-WFR3VGLG-DADViFrd.js} +1 -1
  266. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CJL7EyS8.js → wardleyDiagram-VM6X3IG4-B7tstBZh.js} +2 -2
  267. package/dist/client/assets/{welcome-BOXDf4R_.js → welcome-CQKf0B5f.js} +2 -2
  268. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Bsll1-pV.js → xychartDiagram-S5SC5T6Z-DRAYLcYA.js} +2 -2
  269. package/dist/client/index.html +1 -1
  270. package/package.json +1 -1
  271. package/dist/AcpMcpStdioBridge-CD9BQr2l.mjs +0 -4
  272. package/dist/client/assets/ChatGptUsageButton-CFN6c9Ue.js +0 -2
  273. package/dist/client/assets/ChatMarkdown-DTSMYNs8.js +0 -65
  274. package/dist/client/assets/ComboboxClear-D8WYxa7i.js +0 -2
  275. package/dist/client/assets/CompositeRoot-CLSWLNTl.js +0 -2
  276. package/dist/client/assets/DevicePanel-BQ6aWeSD.js +0 -2
  277. package/dist/client/assets/DiffPanel-D2TxWIFd.js +0 -2
  278. package/dist/client/assets/PanelLayoutControls-Bfgdx7QX.js +0 -215
  279. package/dist/client/assets/PreviewPanel-CbotCgGz.js +0 -2
  280. package/dist/client/assets/ProjectDefaultsSettings-GpUKCz2U.js +0 -2
  281. package/dist/client/assets/ProjectFavicon-BKEw0TrD.js +0 -3
  282. package/dist/client/assets/ProviderModelPicker-CIxbqWeL.js +0 -2
  283. package/dist/client/assets/PullRequestCodeTab-qEGBl5Kn.js +0 -6
  284. package/dist/client/assets/ScheduledTasksSettings-deUjWQ39.js +0 -4
  285. package/dist/client/assets/SettingsPanels-DExy67bz.js +0 -39
  286. package/dist/client/assets/_chat-BfQTKc_9.js +0 -45
  287. package/dist/client/assets/_chat.pull-requests-Dz-eLkAP.js +0 -2
  288. package/dist/client/assets/architecture-7GRP2DOG-DTyqnvkZ.js +0 -1
  289. package/dist/client/assets/assets-B7aY-rQd.js +0 -2
  290. package/dist/client/assets/channel-BO8pVrSI.js +0 -2
  291. package/dist/client/assets/checkbox-Gd1YCUIl.js +0 -2
  292. package/dist/client/assets/classDiagram-ZZMXUADV-Scmt9e5N.js +0 -2
  293. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Scmt9e5N.js +0 -2
  294. package/dist/client/assets/empty-BvJSXK20.js +0 -2
  295. package/dist/client/assets/entities-Dzl1j2jY.js +0 -2
  296. package/dist/client/assets/eventmodeling-NTZA5JFV-DrPNirV-.js +0 -1
  297. package/dist/client/assets/flowDiagram-HODETNUW-D4bD8hue.js +0 -1
  298. package/dist/client/assets/main-DJbmaTSv.js +0 -30
  299. package/dist/client/assets/main-bt-A8VDR.css +0 -2
  300. package/dist/client/assets/number-field-BuLW4JjE.js +0 -2
  301. package/dist/client/assets/popover-O8JaXWO5.js +0 -2
  302. package/dist/client/assets/primary-fvERVyIG.js +0 -2
  303. package/dist/client/assets/primaryCloudLinkState-CT9FDATw.js +0 -2
  304. package/dist/client/assets/projectFilesQueryState-D-fWLsA3.js +0 -2
  305. package/dist/client/assets/projectScriptEditor-BqddH5Lr.js +0 -2
  306. package/dist/client/assets/pullRequests-CEpTVk5m.js +0 -2
  307. package/dist/client/assets/queries-BBd2XSpN.js +0 -2
  308. package/dist/client/assets/query-fboCqXXy.js +0 -2
  309. package/dist/client/assets/radio-group-B2ziR973.js +0 -2
  310. package/dist/client/assets/railroad-abnf-HS5TGJTU-D_PV710-.js +0 -1
  311. package/dist/client/assets/railroad-ebnf-LZEXJU2U-CmXdS8HA.js +0 -1
  312. package/dist/client/assets/railroad-peg-WCYAUIDC-BpmFZ4-g.js +0 -1
  313. package/dist/client/assets/runtime-B-UcwNuZ.js +0 -2
  314. package/dist/client/assets/runtime-BVzm9sLS.js +0 -6
  315. package/dist/client/assets/runtimeModeConfig-Ce0Dnm2_.js +0 -2
  316. package/dist/client/assets/select-D0wmEFXx.js +0 -2
  317. package/dist/client/assets/server-97u7Iupv.js +0 -2
  318. package/dist/client/assets/session-CPQQ27HG.js +0 -2
  319. package/dist/client/assets/settings.appearance-SUyLnEit.js +0 -2
  320. package/dist/client/assets/settings.archived-C-clMQMK.js +0 -2
  321. package/dist/client/assets/settings.connections-DhpKQ7ay.js +0 -2
  322. package/dist/client/assets/settings.diagnostics-CG2kVUBD.js +0 -2
  323. package/dist/client/assets/settings.general-jsS1Ydzs.js +0 -2
  324. package/dist/client/assets/settings.integrations-DDlR7Et9.js +0 -2
  325. package/dist/client/assets/settings.projects-DqNHL2Mx.js +0 -4
  326. package/dist/client/assets/settings.providers-olNQXPOc.js +0 -3
  327. package/dist/client/assets/settings.scheduled-tasks-Dwr1Iiu5.js +0 -2
  328. package/dist/client/assets/settingsLayout-BdqCokK9.js +0 -3
  329. package/dist/client/assets/skeleton-7wGNlCET.js +0 -2
  330. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-nFt0QPRs.js +0 -2
  331. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Byr1T2AB.js +0 -9
  332. package/dist/client/assets/threadSort-BN7fK5qZ.js +0 -2
  333. package/dist/client/assets/toast-Bkc7xsho.js +0 -2
  334. package/dist/client/assets/tooltip-DH7_Fmka.js +0 -2
  335. package/dist/client/assets/usage-Cuwnw3mn.js +0 -2
  336. package/dist/client/assets/useNavigate-NmIi-1RV.js +0 -2
  337. package/dist/client/assets/usePullRequestActions-DqgBdoH5.js +0 -3
  338. package/dist/client/assets/useSettings-DYKTOdxY.js +0 -3
  339. package/dist/client/assets/utils-vKlT_s3D.js +0 -37
  340. package/dist/client/assets/vcsRefInvalidation-CC_2_Ufo.js +0 -2
@@ -1,2 +1,2 @@
1
- import{Jm as e,Mw as t,kT as n}from"./utils-vKlT_s3D.js";import{F as r,L as i,R as a,z as o}from"./useSettings-DYKTOdxY.js";function s(e){return e!==`separate`}function c(e,t=`repository`){return e?t===`repository_path`?`repository_path`:`repository`:`separate`}var l=`t3code:last-enabled-project-grouping-mode`;function u(){try{return localStorage.getItem(l)===`repository_path`?`repository_path`:`repository`}catch{return`repository`}}function d(e){if(e!==`separate`)try{localStorage.setItem(l,e)}catch{}}function f(t){return!n(t.backgroundActivity,e.backgroundActivity)||t.backgroundActivityProfile!==e.backgroundActivityProfile||!n(t.automaticGitFetchInterval,e.automaticGitFetchInterval)||!n(t.providerHealthRefreshInterval,e.providerHealthRefreshInterval)}function p(t){return[...t.fontFamilySans!==e.fontFamilySans||t.fontSizeInterface!==e.fontSizeInterface?[`Interface font`]:[],...t.fontFamilyComposer!==e.fontFamilyComposer||t.fontSizePrompt!==e.fontSizePrompt?[`Prompt font`]:[],...t.fontFamilyCode!==e.fontFamilyCode||t.fontSizeCode!==e.fontSizeCode?[`Code font`]:[],...t.fontFamilyTerminal!==e.fontFamilyTerminal||t.fontSizeTerminal!==e.fontSizeTerminal?[`Terminal font`]:[]]}function m(e,t){return e._tag===t._tag?e._tag===`fill`||t._tag===`fill`?!0:e.width!==t.width||e.height!==t.height?!1:e._tag===`preset`&&t._tag===`preset`?e.presetId===t.presetId:!0:!1}function h(t){return[...m(t.browserDefaultViewport,e.browserDefaultViewport)?[]:[`Browser viewport`],...t.browserDefaultZoomFactor===e.browserDefaultZoomFactor?[]:[`Browser zoom`],...t.browserDefaultAppearance===e.browserDefaultAppearance?[]:[`Browser appearance`],...t.browserRecordingFrameRate===e.browserRecordingFrameRate?[]:[`Recording frame rate`],...t.browserRecordingShowKeyPresses?[`Recording key presses`]:[],...t.browserRecordingShowMousePresses?[`Recording mouse presses`]:[],...t.browserLinkTarget===e.browserLinkTarget?[]:[`Open links in`],...t.browserAutoShowFloatingPreview===e.browserAutoShowFloatingPreview?[]:[`Floating preview`]]}function g(e){let t=o(e),n=i({schemaVersion:1,profile:`custom`,baseProfile:t.profile,overrides:{automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery}});return n.profile===`custom`?`advanced`:n.profile}function _(e,t){let n=a(e);return{schemaVersion:1,profile:`custom`,baseProfile:t,overrides:n.profile===`custom`?n.overrides:{}}}function v(e){return{providerInstances:{...e.settings.providerInstances,[e.instanceId]:e.instance},...e.textGenerationModelSelection===void 0?{}:{textGenerationModelSelection:e.textGenerationModelSelection}}}function y(e){return Math.round(t(e)/1e3)}function b(e,t=0){return e===null||!Number.isFinite(e)?t:Math.max(t,Math.round(e))}function x(e,t,n){let i={automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery,...n};for(let[e,t]of Object.entries(i))t===void 0&&delete i[e];return{backgroundActivity:{schemaVersion:1,profile:`custom`,baseProfile:r(e),overrides:i}}}export{h as a,s as c,u as d,d as f,y as i,b as l,_ as n,p as o,g as p,v as r,f as s,x as t,c as u};
2
- //# sourceMappingURL=SettingsPanels.logic-zUA6f3HT.js.map
1
+ import{Pw as e,Xm as t,jT as n}from"./utils-TSzPLNGf.js";import{F as r,L as i,R as a,z as o}from"./useSettings-DsvnJBf2.js";function s(e){return e!==`separate`}function c(e,t=`repository`){return e?t===`repository_path`?`repository_path`:`repository`:`separate`}var l=`t3code:last-enabled-project-grouping-mode`;function u(){try{return localStorage.getItem(l)===`repository_path`?`repository_path`:`repository`}catch{return`repository`}}function d(e){if(e!==`separate`)try{localStorage.setItem(l,e)}catch{}}function f(e){return!n(e.backgroundActivity,t.backgroundActivity)||e.backgroundActivityProfile!==t.backgroundActivityProfile||!n(e.automaticGitFetchInterval,t.automaticGitFetchInterval)||!n(e.providerHealthRefreshInterval,t.providerHealthRefreshInterval)}function p(e){return[...e.fontFamilySans!==t.fontFamilySans||e.fontSizeInterface!==t.fontSizeInterface?[`Interface font`]:[],...e.fontFamilyComposer!==t.fontFamilyComposer||e.fontSizePrompt!==t.fontSizePrompt?[`Prompt font`]:[],...e.fontFamilyCode!==t.fontFamilyCode||e.fontSizeCode!==t.fontSizeCode?[`Code font`]:[],...e.fontFamilyTerminal!==t.fontFamilyTerminal||e.fontSizeTerminal!==t.fontSizeTerminal?[`Terminal font`]:[]]}function m(e,t){return e._tag===t._tag?e._tag===`fill`||t._tag===`fill`?!0:e.width!==t.width||e.height!==t.height?!1:e._tag===`preset`&&t._tag===`preset`?e.presetId===t.presetId:!0:!1}function h(e){return[...m(e.browserDefaultViewport,t.browserDefaultViewport)?[]:[`Browser viewport`],...e.browserDefaultZoomFactor===t.browserDefaultZoomFactor?[]:[`Browser zoom`],...e.browserDefaultAppearance===t.browserDefaultAppearance?[]:[`Browser appearance`],...e.browserRecordingFrameRate===t.browserRecordingFrameRate?[]:[`Recording frame rate`],...e.browserRecordingShowKeyPresses?[`Recording key presses`]:[],...e.browserRecordingShowMousePresses?[`Recording mouse presses`]:[],...e.browserLinkTarget===t.browserLinkTarget?[]:[`Open links in`],...e.browserAutoShowFloatingPreview===t.browserAutoShowFloatingPreview?[]:[`Floating preview`]]}function g(e){let t=o(e),n=i({schemaVersion:1,profile:`custom`,baseProfile:t.profile,overrides:{automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery}});return n.profile===`custom`?`advanced`:n.profile}function _(e,t){let n=a(e);return{schemaVersion:1,profile:`custom`,baseProfile:t,overrides:n.profile===`custom`?n.overrides:{}}}function v(e){return{providerInstances:{...e.settings.providerInstances,[e.instanceId]:e.instance},...e.textGenerationModelSelection===void 0?{}:{textGenerationModelSelection:e.textGenerationModelSelection}}}function y(t){return Math.round(e(t)/1e3)}function b(e,t=0){return e===null||!Number.isFinite(e)?t:Math.max(t,Math.round(e))}function x(e,t,n){let i={automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery,...n};for(let[e,t]of Object.entries(i))t===void 0&&delete i[e];return{backgroundActivity:{schemaVersion:1,profile:`custom`,baseProfile:r(e),overrides:i}}}export{h as a,s as c,u as d,d as f,y as i,b as l,_ as n,p as o,g as p,v as r,f as s,x as t,c as u};
2
+ //# sourceMappingURL=SettingsPanels.logic-BxZ7DzP5.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{HT as t,dE as n,sr as r}from"./utils-vKlT_s3D.js";import{t as i}from"./useNavigate-NmIi-1RV.js";import{t as a}from"./useLocation-D91_HRP0.js";import{E as o}from"./useSettings-DYKTOdxY.js";import{n as s,r as c,t as l}from"./alert-DzxRsWWi.js";import{B as u,H as d,i as f}from"./settingsLayout-BdqCokK9.js";var p=n(),m=e(t(),1);function h(e){let t=(0,p.c)(42),{children:n,target:h,targetId:y,eligibleEnvironmentIds:b}=e,{selectScope:x,search:S}=u(),C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C={from:`/settings`},t[0]=C):C=t[0];let w=i(C),T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T={select:v},t[1]=T):T=t[1];let E=a(T),{environments:D}=o(),O=d(),k,A,j,M,N,P,F,I;if(t[2]!==n||t[3]!==b||t[4]!==D||t[5]!==O||t[6]!==w||t[7]!==E||t[8]!==S||t[9]!==x||t[10]!==h||t[11]!==y){let e=h===`checkout`?O.filter(e=>!S.project||e.projectKey===S.project).flatMap(_):h===`project`?O.map(g):h===`environment`?D.filter(e=>b===void 0||b.includes(e.environmentId)).map(e=>({label:D.some(t=>t.environmentId!==e.environmentId&&t.label===e.label)?`${e.label} · ${e.displayUrl||e.environmentId}`:e.label,search:{machine:e.environmentId}})):[{label:`Open all environments`,search:{}}];M=f,j=l,I=`status`,A=c,t[20]===n?F=t[21]:(F=(0,m.jsx)(`p`,{children:n}),t[20]=n,t[21]=F),k=s,N=`flex-wrap`;let i;t[22]!==w||t[23]!==E||t[24]!==x||t[25]!==y?(i=e=>(0,m.jsx)(r,{size:`sm-multiline`,variant:`outline`,className:`max-w-full break-all text-left`,onClick:()=>{y?w({to:E,search:()=>e.search,hash:y}):x(e.search)},children:e.label},JSON.stringify(e.search)),t[22]=w,t[23]=E,t[24]=x,t[25]=y,t[26]=i):i=t[26],P=e.map(i),t[2]=n,t[3]=b,t[4]=D,t[5]=O,t[6]=w,t[7]=E,t[8]=S,t[9]=x,t[10]=h,t[11]=y,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=N,t[17]=P,t[18]=F,t[19]=I}else k=t[12],A=t[13],j=t[14],M=t[15],N=t[16],P=t[17],F=t[18],I=t[19];let L;t[27]!==k||t[28]!==N||t[29]!==P?(L=(0,m.jsx)(k,{className:N,children:P}),t[27]=k,t[28]=N,t[29]=P,t[30]=L):L=t[30];let R;t[31]!==A||t[32]!==F||t[33]!==L?(R=(0,m.jsxs)(A,{children:[F,L]}),t[31]=A,t[32]=F,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==j||t[36]!==I||t[37]!==R?(z=(0,m.jsx)(j,{role:I,children:R}),t[35]=j,t[36]=I,t[37]=R,t[38]=z):z=t[38];let B;return t[39]!==M||t[40]!==z?(B=(0,m.jsx)(M,{children:z}),t[39]=M,t[40]=z,t[41]=B):B=t[41],B}function g(e){return{label:e.displayName,search:{project:e.projectKey}}}function _(e){return e.memberProjects.map(t=>({label:`${e.displayName} · ${t.environmentLabel??`Environment`} · ${t.workspaceRoot}`,search:{project:e.projectKey,machine:t.environmentId,checkout:t.physicalProjectKey}}))}function v(e){return e.pathname}export{h as t};
2
- //# sourceMappingURL=SettingsScopeNotice-N6bcXfto.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{WT as t,mE as n,sr as r}from"./utils-TSzPLNGf.js";import{t as i}from"./useNavigate-Cdy4Jh5i.js";import{t as a}from"./useLocation-BdZaQ50l.js";import{E as o}from"./useSettings-DsvnJBf2.js";import{n as s,r as c,t as l}from"./alert-BFkMrLRZ.js";import{B as u,H as d,i as f}from"./settingsLayout-DhPKINaL.js";var p=n(),m=e(t(),1);function h(e){let t=(0,p.c)(42),{children:n,target:h,targetId:y,eligibleEnvironmentIds:b}=e,{selectScope:x,search:S}=u(),C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C={from:`/settings`},t[0]=C):C=t[0];let w=i(C),T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T={select:v},t[1]=T):T=t[1];let E=a(T),{environments:D}=o(),O=d(),k,A,j,M,N,P,F,I;if(t[2]!==n||t[3]!==b||t[4]!==D||t[5]!==O||t[6]!==w||t[7]!==E||t[8]!==S||t[9]!==x||t[10]!==h||t[11]!==y){let e=h===`checkout`?O.filter(e=>!S.project||e.projectKey===S.project).flatMap(_):h===`project`?O.map(g):h===`environment`?D.filter(e=>b===void 0||b.includes(e.environmentId)).map(e=>({label:D.some(t=>t.environmentId!==e.environmentId&&t.label===e.label)?`${e.label} · ${e.displayUrl||e.environmentId}`:e.label,search:{machine:e.environmentId}})):[{label:`Open all environments`,search:{}}];M=f,j=l,I=`status`,A=c,t[20]===n?F=t[21]:(F=(0,m.jsx)(`p`,{children:n}),t[20]=n,t[21]=F),k=s,N=`flex-wrap`;let i;t[22]!==w||t[23]!==E||t[24]!==x||t[25]!==y?(i=e=>(0,m.jsx)(r,{size:`sm-multiline`,variant:`outline`,className:`max-w-full break-all text-left`,onClick:()=>{y?w({to:E,search:()=>e.search,hash:y}):x(e.search)},children:e.label},JSON.stringify(e.search)),t[22]=w,t[23]=E,t[24]=x,t[25]=y,t[26]=i):i=t[26],P=e.map(i),t[2]=n,t[3]=b,t[4]=D,t[5]=O,t[6]=w,t[7]=E,t[8]=S,t[9]=x,t[10]=h,t[11]=y,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=N,t[17]=P,t[18]=F,t[19]=I}else k=t[12],A=t[13],j=t[14],M=t[15],N=t[16],P=t[17],F=t[18],I=t[19];let L;t[27]!==k||t[28]!==N||t[29]!==P?(L=(0,m.jsx)(k,{className:N,children:P}),t[27]=k,t[28]=N,t[29]=P,t[30]=L):L=t[30];let R;t[31]!==A||t[32]!==F||t[33]!==L?(R=(0,m.jsxs)(A,{children:[F,L]}),t[31]=A,t[32]=F,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==j||t[36]!==I||t[37]!==R?(z=(0,m.jsx)(j,{role:I,children:R}),t[35]=j,t[36]=I,t[37]=R,t[38]=z):z=t[38];let B;return t[39]!==M||t[40]!==z?(B=(0,m.jsx)(M,{children:z}),t[39]=M,t[40]=z,t[41]=B):B=t[41],B}function g(e){return{label:e.displayName,search:{project:e.projectKey}}}function _(e){return e.memberProjects.map(t=>({label:`${e.displayName} · ${t.environmentLabel??`Environment`} · ${t.workspaceRoot}`,search:{project:e.projectKey,machine:t.environmentId,checkout:t.physicalProjectKey}}))}function v(e){return e.pathname}export{h as t};
2
+ //# sourceMappingURL=SettingsScopeNotice-Bq3kVMy1.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,Bp as r,Go as i,HT as a,Jo as o,Lo as s,Np as c,Nx as l,Vo as u,Wn as d,Wo as f,dE as p,ps as m,sC as h,sr as g,t as _,ua as v,zw as y}from"./utils-vKlT_s3D.js";import{D as b,F as x,L as S,O as C,U as w,d as T,f as E,h as D,m as O,pn as k,r as ee}from"./runtime-BVzm9sLS.js";import{i as A}from"./toast-Bkc7xsho.js";import{t as j}from"./use-atom-command-JNR1Jqwn.js";import{t as M}from"./skeleton-7wGNlCET.js";import{i as te,r as ne}from"./dist-DOyHkZUI.js";import{a as N,i as P,o as F,r as I,t as L}from"./empty-BvJSXK20.js";import{Fa as re,Ia as ie,Pa as ae,qa as oe}from"./main-DJbmaTSv.js";var R=e(v(),1),z=p(),B=e(t(),1),V=o(h(k,ee.contextEffect.pipe(l(e=>y(e,k))))),H=T(V),U=C(),W=x(V,{label:`web:managed-relay:deregister-environment`,scheduler:U,concurrency:{mode:`serial`,key:e=>e.accountId},execute:(e,t)=>E(t,e)}),G=i(m([])).pipe(f,n(`managed-relay:web:environments:null`)),K=i(m([])).pipe(f,n(`managed-relay:web:devices:null`));function se(){let e=(0,z.c)(14),t=u(O)?.accountId??null,n;e[0]===t?n=e[1]:(n=t?H.environmentsAtom(t):G,e[0]=t,e[1]=n);let r=u(n),i;e[2]===r?i=e[3]:(i=D(r),e[2]=r,e[3]=i);let a=i,o,c;e[4]!==a.error||e[5]!==a.errorTraceId?(o=()=>{a.error&&console.error(`[t3-cloud] Relay environment listing failed`,{message:a.error,traceId:a.errorTraceId})},c=[a.error,a.errorTraceId],e[4]=a.error,e[5]=a.errorTraceId,e[6]=o,e[7]=c):(o=e[6],c=e[7]),(0,B.useEffect)(o,c);let l;e[8]===t?l=e[9]:(l=()=>{t&&H.refreshEnvironments(s,t)},e[8]=t,e[9]=l);let d=l,f;return e[10]!==t||e[11]!==d||e[12]!==a?(f={...a,accountId:t,refresh:d},e[10]=t,e[11]=d,e[12]=a,e[13]=f):f=e[13],f}function q(){let e=(0,z.c)(14),t=u(O)?.accountId??null,n;e[0]===t?n=e[1]:(n=t?H.devicesAtom(t):K,e[0]=t,e[1]=n);let r=u(n),i;e[2]===r?i=e[3]:(i=D(r),e[2]=r,e[3]=i);let a=i,o,c;e[4]!==a.error||e[5]!==a.errorTraceId?(o=()=>{a.error&&console.error(`[t3-cloud] Relay device listing failed`,{message:a.error,traceId:a.errorTraceId})},c=[a.error,a.errorTraceId],e[4]=a.error,e[5]=a.errorTraceId,e[6]=o,e[7]=c):(o=e[6],c=e[7]),(0,B.useEffect)(o,c);let l;e[8]===t?l=e[9]:(l=()=>{t&&H.refreshDevices(s,t)},e[8]=t,e[9]=l);let d=l,f;return e[10]!==t||e[11]!==d||e[12]!==a?(f={...a,accountId:t,refresh:d},e[10]=t,e[11]=d,e[12]=a,e[13]=f):f=e[13],f}var ce=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),le=[[`notifyOnApproval`,`approvals`],[`notifyOnInput`,`input requests`],[`notifyOnCompletion`,`completions`],[`notifyOnFailure`,`failures`]];function ue(e){return`${e.platform===`android`?`Android`:e.iosMajorVersion===null?`iOS`:`iOS ${e.iosMajorVersion}`}${e.appVersion?` · P4 Code ${e.appVersion}`:``}`}function de(e){if(!e.notifications.enabled)return`Push notifications are disabled on this device.`;let t=le.flatMap(([t,n])=>e.notifications[t]?[n]:[]);return t.length>0?`Alerts enabled for ${t.join(`, `)}.`:`Push notifications are enabled, but no alert types are selected.`}function fe(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Update time unavailable`:`Updated ${ce.format(t)}`}var J=e(a(),1);function Y(e){let t=(0,z.c)(18),{action:n,children:r,className:i,description:a,title:o}=e,s;t[0]===i?s=t[1]:(s=_(`w-full min-w-0 text-foreground`,i),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=(0,J.jsx)(`h2`,{className:`text-base leading-6 font-semibold`,children:o}),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=a?(0,J.jsx)(`p`,{className:`mt-1 max-w-[34rem] text-xs leading-4.5 text-muted-foreground sm:min-h-9`,children:a}):null,t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=n?(0,J.jsx)(`div`,{className:`shrink-0`,children:n}):null,t[9]=n,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,J.jsxs)(`header`,{className:`flex flex-col gap-3 pb-4 sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:pr-8`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==r||t[15]!==s||t[16]!==f?(p=(0,J.jsxs)(`div`,{className:s,children:[f,r]}),t[14]=r,t[15]=s,t[16]=f,t[17]=p):p=t[17],p}function X(e){let t=(0,z.c)(7),{className:n,disabled:r,isPending:i,onClick:a}=e,o=r!==void 0&&r||i,s;t[0]===i?s=t[1]:(s=(0,J.jsx)(oe,{"aria-hidden":`true`,size:`sm`,refreshing:i}),t[0]=i,t[1]=s);let c;return t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==s?(c=(0,J.jsxs)(g,{size:`sm`,variant:`outline`,className:n,disabled:o,onClick:a,children:[s,`Refresh`]}),t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function Z(e){let t=(0,z.c)(12),{children:n,className:r,icon:i}=e,a;t[0]===r?a=t[1]:(a=_(`border-t py-4 first:border-t-0`,r),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted/32 text-muted-foreground`,children:i}),t[2]=i,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),t[4]=n,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,J.jsx)(`li`,{className:a,children:c}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}var pe=[`primary`,`secondary`];function Q(e){let t=(0,z.c)(4),{enabled:n,label:r}=e,i=n?`success`:`outline`,a=n?`On`:`Off`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,J.jsxs)(d,{variant:i,children:[r,`: `,a]}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function me(e){let t=(0,z.c)(32),{device:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(r,{className:`size-4`}),t[0]=i):i=t[0];let a;t[1]===n.label?a=t[2]:(a=(0,J.jsx)(`h3`,{className:`truncate text-sm leading-4.5 font-medium text-foreground`,children:n.label}),t[1]=n.label,t[2]=a);let o;t[3]===n?o=t[4]:(o=ue(n),t[3]=n,t[4]=o);let s;t[5]===o?s=t[6]:(s=(0,J.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:o}),t[5]=o,t[6]=s);let c;t[7]!==a||t[8]!==s?(c=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9];let l;t[10]===n.updatedAt?l=t[11]:(l=fe(n.updatedAt),t[10]=n.updatedAt,t[11]=l);let u;t[12]===l?u=t[13]:(u=(0,J.jsx)(`p`,{className:`shrink-0 text-2xs leading-4 text-muted-foreground/75`,children:l}),t[12]=l,t[13]=u);let d;t[14]!==c||t[15]!==u?(d=(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5 sm:flex-row sm:items-start sm:justify-between sm:gap-3`,children:[c,u]}),t[14]=c,t[15]=u,t[16]=d):d=t[16];let f;t[17]===n.notifications.enabled?f=t[18]:(f=(0,J.jsx)(Q,{enabled:n.notifications.enabled,label:`Push notifications`}),t[17]=n.notifications.enabled,t[18]=f);let p;t[19]===n.liveActivities.enabled?p=t[20]:(p=(0,J.jsx)(Q,{enabled:n.liveActivities.enabled,label:`Live Activities`}),t[19]=n.liveActivities.enabled,t[20]=p);let m;t[21]!==p||t[22]!==f?(m=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[f,p]}),t[21]=p,t[22]=f,t[23]=m):m=t[23];let h;t[24]===n?h=t[25]:(h=de(n),t[24]=n,t[25]=h);let g;t[26]===h?g=t[27]:(g=(0,J.jsx)(`p`,{className:`mt-1.5 text-xs leading-4.5 text-muted-foreground/80`,children:h}),t[26]=h,t[27]=g);let _;return t[28]!==m||t[29]!==g||t[30]!==d?(_=(0,J.jsxs)(Z,{icon:i,children:[d,m,g]}),t[28]=m,t[29]=g,t[30]=d,t[31]=_):_=t[31],_}function he(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsx)(`div`,{"aria-label":`Loading mobile clients`,className:`divide-y border-t`,role:`status`,children:pe.map(ge)}),e[0]=t):t=e[0],t}function ge(e){return(0,J.jsx)(`div`,{className:`py-4`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(M,{shape:`card`,className:`size-8 shrink-0`}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,J.jsx)(M,{className:`h-3.5 w-36`}),(0,J.jsx)(M,{className:`h-3 w-28`}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(M,{className:`h-4.5 w-28`}),(0,J.jsx)(M,{className:`h-4.5 w-24`})]})]})]})},e)}function _e(){let e=(0,z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsx)(N,{variant:`icon`,children:(0,J.jsx)(r,{})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsxs)(L,{size:`compact`,children:[t,(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{children:`No mobile clients`}),(0,J.jsx)(I,{children:`Install P4 Code on your phone and sign in to P4 Connect to get push notifications and Live Activities.`})]})]}),e[1]=n):n=e[1],n}function ve(){let e=(0,z.c)(18),t=q(),n;e[0]===t.data?n=e[1]:(n=t.data??[],e[0]=t.data,e[1]=n);let r=n,i=!t.accountId||t.data===null&&!t.error,a=t.error!==null&&t.data===null,o;e[2]!==t.isPending||e[3]!==t.refresh?(o=(0,J.jsx)(X,{isPending:t.isPending,onClick:t.refresh}),e[2]=t.isPending,e[3]=t.refresh,e[4]=o):o=e[4];let s;e[5]!==t.error||e[6]!==t.refresh?(s=t.error?(0,J.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 border-t border-destructive/35 py-3 text-xs sm:flex-row sm:items-center sm:justify-between`,role:`alert`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive-foreground`,children:`Could not load mobile clients`}),(0,J.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t.error})]}),(0,J.jsx)(g,{size:`xs`,variant:`outline`,onClick:t.refresh,children:`Try again`})]}):null,e[5]=t.error,e[6]=t.refresh,e[7]=s):s=e[7];let c;e[8]!==r||e[9]!==a||e[10]!==i?(c=i?(0,J.jsx)(he,{}):a?null:r.length>0?(0,J.jsx)(`ul`,{className:`border-t`,children:r.map(ye)}):(0,J.jsx)(`div`,{className:`border-t`,children:(0,J.jsx)(_e,{})}),e[8]=r,e[9]=a,e[10]=i,e[11]=c):c=e[11];let l;e[12]!==s||e[13]!==c?(l=(0,J.jsxs)(`div`,{children:[s,c]}),e[12]=s,e[13]=c,e[14]=l):l=e[14];let u;return e[15]!==o||e[16]!==l?(u=(0,J.jsx)(Y,{title:`Mobile clients`,description:`Mobile devices that get notifications from your environments.`,action:o,children:l}),e[15]=o,e[16]=l,e[17]=u):u=e[17],u}function ye(e){return(0,J.jsx)(me,{device:e},e.deviceId)}var be=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`});function xe(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Link date unavailable`:`Linked ${be.format(t)}`}function Se(e){return e.endpoint.providerKind===`cloudflare_tunnel`?`Managed tunnel`:`Activity publishing only`}function Ce(e){let t=(0,z.c)(46),{environment:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(c,{className:`size-4`}),t[0]=r):r=t[0];let i=e.confirmationOpen,a=e.onConfirmationChange,o;t[1]===n.label?o=t[2]:(o=(0,J.jsx)(`h3`,{className:`truncate text-sm leading-4.5 font-medium text-foreground`,children:n.label}),t[1]=n.label,t[2]=o);let s;t[3]===n.linkedAt?s=t[4]:(s=xe(n.linkedAt),t[3]=n.linkedAt,t[4]=s);let l;t[5]===n?l=t[6]:(l=Se(n),t[5]=n,t[6]=l);let u;t[7]!==s||t[8]!==l?(u=(0,J.jsxs)(`p`,{className:`mt-1 text-xs leading-4.5 text-muted-foreground`,children:[s,` · `,l]}),t[7]=s,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==o||t[11]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o,u]}),t[10]=o,t[11]=u,t[12]=d):d=t[12];let f;t[13]===e.mutationPending?f=t[14]:(f=(0,J.jsx)(ie,{render:(0,J.jsx)(g,{size:`sm`,variant:`destructive-outline`,disabled:e.mutationPending,children:`Deregister`})}),t[13]=e.mutationPending,t[14]=f);let p;t[15]!==d||t[16]!==f?(p=(0,J.jsxs)(`div`,{className:`flex items-start gap-4`,children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17];let m=`Confirm deregistration of ${n.label}`,h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,J.jsx)(`h4`,{className:`text-sm leading-4.5 font-semibold text-foreground`,children:`Deregister server`}),t[18]=h):h=t[18];let _;t[19]===n.label?_=t[20]:(_=(0,J.jsxs)(`p`,{className:`mt-1 text-xs leading-4.5 text-muted-foreground`,children:[`“`,n.label,`” will be removed from this account.`]}),t[19]=n.label,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(`p`,{className:`mt-4 max-w-xl text-xs leading-4.5 text-muted-foreground`,children:`P4 Connect access will be revoked, any managed tunnel will be removed, and a host space will become available. Local connections on your devices are not changed.`}),t[21]=v):v=t[21];let y;t[22]===e?y=t[23]:(y=()=>e.onConfirmationChange(!1),t[22]=e,t[23]=y);let b;t[24]!==e.mutationPending||t[25]!==y?(b=(0,J.jsx)(g,{size:`sm`,variant:`ghost`,disabled:e.mutationPending,onClick:y,children:`Cancel`}),t[24]=e.mutationPending,t[25]=y,t[26]=b):b=t[26];let x;t[27]!==n||t[28]!==e?(x=()=>e.onDeregister(n),t[27]=n,t[28]=e,t[29]=x):x=t[29];let S=e.mutationPending?`Deregistering…`:`Deregister`,C;t[30]!==e.mutationPending||t[31]!==x||t[32]!==S?(C=(0,J.jsx)(g,{size:`sm`,variant:`destructive`,disabled:e.mutationPending,onClick:x,children:S}),t[30]=e.mutationPending,t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==b||t[35]!==C?(w=(0,J.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[b,C]}),t[34]=b,t[35]=C,t[36]=w):w=t[36];let T;t[37]!==m||t[38]!==_||t[39]!==w?(T=(0,J.jsx)(re,{children:(0,J.jsx)(`div`,{className:`pt-3`,children:(0,J.jsxs)(`div`,{className:`rounded-lg border border-input bg-muted/32 px-5 py-4 shadow-xs/5`,role:`group`,"aria-label":m,children:[h,_,v,w]})})}),t[37]=m,t[38]=_,t[39]=w,t[40]=T):T=t[40];let E;return t[41]!==e.confirmationOpen||t[42]!==e.onConfirmationChange||t[43]!==T||t[44]!==p?(E=(0,J.jsx)(Z,{icon:r,children:(0,J.jsxs)(ae,{open:i,onOpenChange:a,children:[p,T]})}),t[41]=e.confirmationOpen,t[42]=e.onConfirmationChange,t[43]=T,t[44]=p,t[45]=E):E=t[45],E}function we(){let e=(0,z.c)(41),t=se(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},e[0]=n):n=e[0];let r=j(W,n),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(null),l=(0,B.useRef)(!1),u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={accountId:null,linkedAtById:new Map},e[1]=u):u=e[1];let[d,f]=(0,B.useState)(u),p;e[2]!==r||e[3]!==t?(p=async e=>{let n=t.accountId;if(!n||l.current)return;l.current=!0,a(e.environmentId);let i=await r({accountId:n,environmentId:e.environmentId});if(l.current=!1,a(null),i._tag===`Success`){s(null),f(t=>{let r=new Map(t.accountId===n?t.linkedAtById:[]);return r.set(e.environmentId,e.linkedAt),{accountId:n,linkedAtById:r}}),t.refresh(),A.add({type:`success`,title:`Server deregistered`,description:`P4 Connect access was revoked and a host space is now available.`});return}if(S(i))return;let o=w(i),c=o instanceof Error?o.message:`Could not deregister the server.`,u=b(o);console.error(`[t3-connect] Could not deregister environment`,{environmentId:e.environmentId,message:c,traceId:u,cause:o}),A.add({type:`error`,title:`Could not deregister server`,description:c,data:u?{secondaryActionProps:{children:`Copy trace ID`,onClick:()=>void navigator.clipboard?.writeText(u)}}:void 0})},e[2]=r,e[3]=t,e[4]=p):p=e[4];let m=p,h;e[5]!==t.accountId||e[6]!==d.accountId||e[7]!==d.linkedAtById?(h=d.accountId===t.accountId?d.linkedAtById:new Map,e[5]=t.accountId,e[6]=d.accountId,e[7]=d.linkedAtById,e[8]=h):h=e[8];let g=h,_,v,y,x,C,T;if(e[9]!==o||e[10]!==i||e[11]!==t.accountId||e[12]!==t.data||e[13]!==t.error||e[14]!==t.isPending||e[15]!==t.refresh||e[16]!==m||e[17]!==g){let n;e[24]===g?n=e[25]:(n=e=>g.get(e.environmentId)!==e.linkedAt,e[24]=g,e[25]=n);let r=(t.data??[]).filter(n),a=!t.accountId||t.data===null&&!t.error;_=Y,x=`P4 Connect`,C=`Environments registered to your account. Connections on this device are managed in Settings.`;let l=i!==null;e[26]!==t.isPending||e[27]!==t.refresh||e[28]!==l?(T=(0,J.jsx)(X,{disabled:l,isPending:t.isPending,onClick:t.refresh}),e[26]=t.isPending,e[27]=t.refresh,e[28]=l,e[29]=T):T=e[29],e[30]===t.error?v=e[31]:(v=t.error?(0,J.jsxs)(`div`,{className:`mb-4 border-t border-destructive/35 py-3 text-xs`,role:`alert`,children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive-foreground`,children:`Could not load P4 Connect environments`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.error})]}):null,e[30]=t.error,e[31]=v),y=a?(0,J.jsx)(`p`,{className:`border-t py-4 text-xs text-muted-foreground`,role:`status`,children:`Loading environments…`}):r.length>0?(0,J.jsx)(`ul`,{className:`border-t`,children:r.map(e=>(0,J.jsx)(Ce,{environment:e,confirmationOpen:o===e.environmentId,mutationPending:i!==null,onConfirmationChange:t=>s(t?e.environmentId:null),onDeregister:e=>void m(e)},e.environmentId))}):t.error?null:(0,J.jsx)(`div`,{className:`border-t`,children:(0,J.jsxs)(L,{size:`compact`,children:[(0,J.jsx)(N,{variant:`icon`,children:(0,J.jsx)(c,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{children:`No P4 Connect environments`}),(0,J.jsx)(I,{children:`Link an environment from its local Settings to make it available through P4 Connect.`})]})]})}),e[9]=o,e[10]=i,e[11]=t.accountId,e[12]=t.data,e[13]=t.error,e[14]=t.isPending,e[15]=t.refresh,e[16]=m,e[17]=g,e[18]=_,e[19]=v,e[20]=y,e[21]=x,e[22]=C,e[23]=T}else _=e[18],v=e[19],y=e[20],x=e[21],C=e[22],T=e[23];let E;e[32]!==v||e[33]!==y?(E=(0,J.jsxs)(`div`,{children:[v,y]}),e[32]=v,e[33]=y,e[34]=E):E=e[34];let D;return e[35]!==_||e[36]!==x||e[37]!==C||e[38]!==T||e[39]!==E?(D=(0,J.jsx)(_,{title:x,description:C,action:T,children:E}),e[35]=_,e[36]=x,e[37]=C,e[38]=T,e[39]=E,e[40]=D):D=e[40],D}var $=[{label:`Mobile clients`,url:`mobile-clients`,icon:(0,J.jsx)(r,{className:`size-4`}),content:(0,J.jsx)(ve,{})},{label:`P4 Connect`,url:`t3-connect`,icon:(0,J.jsx)(c,{className:`size-4`}),content:(0,J.jsx)(we,{})}];function Te(){let e=(0,z.c)(8),t=te(),{isSignedIn:n}=ne(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={},e[0]=r):r=e[0];let[i,a]=(0,B.useState)(r),o;e[1]===t?o=e[2]:(o=()=>{let e=(e,t)=>a(n=>({...n,[e]:t}));t.openUserProfile({__experimental_startPath:`/t3-connect`,customPages:$.map(t=>({label:t.label,url:t.url,mount:n=>e(`content:${t.url}`,n),unmount:()=>e(`content:${t.url}`,void 0),mountIcon:n=>e(`icon:${t.url}`,n),unmountIcon:()=>e(`icon:${t.url}`,void 0)}))})},e[1]=t,e[2]=o);let s=o,c;e[3]===i?c=e[4]:(c=$.flatMap(e=>{let t=i[`content:${e.url}`],n=i[`icon:${e.url}`];return[t?(0,R.createPortal)(e.content,t,`content:${e.url}`):null,n?(0,R.createPortal)(e.icon,n,`icon:${e.url}`):null]}),e[3]=i,e[4]=c);let l=c,u=n?s:null,d;return e[5]!==l||e[6]!==u?(d={open:u,portals:l},e[5]=l,e[6]=u,e[7]=d):d=e[7],d}export{Te as n,$ as t};
2
- //# sourceMappingURL=T3ConnectAccountPages-uVnu-v4W.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,Fx as r,Go as i,Jo as a,Lo as o,Pp as s,Vo as c,Vp as l,Vw as u,WT as d,Wn as f,Wo as p,lC as m,mE as h,ps as g,sr as _,t as v,ua as y}from"./utils-TSzPLNGf.js";import{D as b,F as x,L as S,O as C,U as w,d as T,f as E,h as D,m as O,pn as k,r as ee}from"./runtime-qAs3Aj0U.js";import{i as A}from"./toast-3I2gpMYd.js";import{t as j}from"./use-atom-command-CVDCnNHi.js";import{t as M}from"./skeleton--v3ra8uu.js";import{i as te,r as ne}from"./dist-B181ZKao.js";import{a as N,i as P,o as F,r as I,t as L}from"./empty-BQwNj0_P.js";import{Fa as re,Ia as ie,Pa as ae,qa as oe}from"./main-pmaKofkn.js";var R=e(y(),1),z=h(),B=e(t(),1),V=a(m(k,ee.contextEffect.pipe(r(e=>u(e,k))))),H=T(V),U=C(),W=x(V,{label:`web:managed-relay:deregister-environment`,scheduler:U,concurrency:{mode:`serial`,key:e=>e.accountId},execute:(e,t)=>E(t,e)}),G=i(g([])).pipe(p,n(`managed-relay:web:environments:null`)),K=i(g([])).pipe(p,n(`managed-relay:web:devices:null`));function se(){let e=(0,z.c)(14),t=c(O)?.accountId??null,n;e[0]===t?n=e[1]:(n=t?H.environmentsAtom(t):G,e[0]=t,e[1]=n);let r=c(n),i;e[2]===r?i=e[3]:(i=D(r),e[2]=r,e[3]=i);let a=i,s,l;e[4]!==a.error||e[5]!==a.errorTraceId?(s=()=>{a.error&&console.error(`[t3-cloud] Relay environment listing failed`,{message:a.error,traceId:a.errorTraceId})},l=[a.error,a.errorTraceId],e[4]=a.error,e[5]=a.errorTraceId,e[6]=s,e[7]=l):(s=e[6],l=e[7]),(0,B.useEffect)(s,l);let u;e[8]===t?u=e[9]:(u=()=>{t&&H.refreshEnvironments(o,t)},e[8]=t,e[9]=u);let d=u,f;return e[10]!==t||e[11]!==d||e[12]!==a?(f={...a,accountId:t,refresh:d},e[10]=t,e[11]=d,e[12]=a,e[13]=f):f=e[13],f}function q(){let e=(0,z.c)(14),t=c(O)?.accountId??null,n;e[0]===t?n=e[1]:(n=t?H.devicesAtom(t):K,e[0]=t,e[1]=n);let r=c(n),i;e[2]===r?i=e[3]:(i=D(r),e[2]=r,e[3]=i);let a=i,s,l;e[4]!==a.error||e[5]!==a.errorTraceId?(s=()=>{a.error&&console.error(`[t3-cloud] Relay device listing failed`,{message:a.error,traceId:a.errorTraceId})},l=[a.error,a.errorTraceId],e[4]=a.error,e[5]=a.errorTraceId,e[6]=s,e[7]=l):(s=e[6],l=e[7]),(0,B.useEffect)(s,l);let u;e[8]===t?u=e[9]:(u=()=>{t&&H.refreshDevices(o,t)},e[8]=t,e[9]=u);let d=u,f;return e[10]!==t||e[11]!==d||e[12]!==a?(f={...a,accountId:t,refresh:d},e[10]=t,e[11]=d,e[12]=a,e[13]=f):f=e[13],f}var ce=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),le=[[`notifyOnApproval`,`approvals`],[`notifyOnInput`,`input requests`],[`notifyOnCompletion`,`completions`],[`notifyOnFailure`,`failures`]];function ue(e){return`${e.platform===`android`?`Android`:e.iosMajorVersion===null?`iOS`:`iOS ${e.iosMajorVersion}`}${e.appVersion?` · P4 Code ${e.appVersion}`:``}`}function de(e){if(!e.notifications.enabled)return`Push notifications are disabled on this device.`;let t=le.flatMap(([t,n])=>e.notifications[t]?[n]:[]);return t.length>0?`Alerts enabled for ${t.join(`, `)}.`:`Push notifications are enabled, but no alert types are selected.`}function fe(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Update time unavailable`:`Updated ${ce.format(t)}`}var J=e(d(),1);function Y(e){let t=(0,z.c)(18),{action:n,children:r,className:i,description:a,title:o}=e,s;t[0]===i?s=t[1]:(s=v(`w-full min-w-0 text-foreground`,i),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=(0,J.jsx)(`h2`,{className:`text-base leading-6 font-semibold`,children:o}),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=a?(0,J.jsx)(`p`,{className:`mt-1 max-w-[34rem] text-xs leading-4.5 text-muted-foreground sm:min-h-9`,children:a}):null,t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=n?(0,J.jsx)(`div`,{className:`shrink-0`,children:n}):null,t[9]=n,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,J.jsxs)(`header`,{className:`flex flex-col gap-3 pb-4 sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:pr-8`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==r||t[15]!==s||t[16]!==f?(p=(0,J.jsxs)(`div`,{className:s,children:[f,r]}),t[14]=r,t[15]=s,t[16]=f,t[17]=p):p=t[17],p}function X(e){let t=(0,z.c)(7),{className:n,disabled:r,isPending:i,onClick:a}=e,o=r!==void 0&&r||i,s;t[0]===i?s=t[1]:(s=(0,J.jsx)(oe,{"aria-hidden":`true`,size:`sm`,refreshing:i}),t[0]=i,t[1]=s);let c;return t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==s?(c=(0,J.jsxs)(_,{size:`sm`,variant:`outline`,className:n,disabled:o,onClick:a,children:[s,`Refresh`]}),t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function Z(e){let t=(0,z.c)(12),{children:n,className:r,icon:i}=e,a;t[0]===r?a=t[1]:(a=v(`border-t py-4 first:border-t-0`,r),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted/32 text-muted-foreground`,children:i}),t[2]=i,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),t[4]=n,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,J.jsx)(`li`,{className:a,children:c}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}var pe=[`primary`,`secondary`];function Q(e){let t=(0,z.c)(4),{enabled:n,label:r}=e,i=n?`success`:`outline`,a=n?`On`:`Off`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,J.jsxs)(f,{variant:i,children:[r,`: `,a]}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function me(e){let t=(0,z.c)(32),{device:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(l,{className:`size-4`}),t[0]=r):r=t[0];let i;t[1]===n.label?i=t[2]:(i=(0,J.jsx)(`h3`,{className:`truncate text-sm leading-4.5 font-medium text-foreground`,children:n.label}),t[1]=n.label,t[2]=i);let a;t[3]===n?a=t[4]:(a=ue(n),t[3]=n,t[4]=a);let o;t[5]===a?o=t[6]:(o=(0,J.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:a}),t[5]=a,t[6]=o);let s;t[7]!==i||t[8]!==o?(s=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[i,o]}),t[7]=i,t[8]=o,t[9]=s):s=t[9];let c;t[10]===n.updatedAt?c=t[11]:(c=fe(n.updatedAt),t[10]=n.updatedAt,t[11]=c);let u;t[12]===c?u=t[13]:(u=(0,J.jsx)(`p`,{className:`shrink-0 text-2xs leading-4 text-muted-foreground/75`,children:c}),t[12]=c,t[13]=u);let d;t[14]!==s||t[15]!==u?(d=(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5 sm:flex-row sm:items-start sm:justify-between sm:gap-3`,children:[s,u]}),t[14]=s,t[15]=u,t[16]=d):d=t[16];let f;t[17]===n.notifications.enabled?f=t[18]:(f=(0,J.jsx)(Q,{enabled:n.notifications.enabled,label:`Push notifications`}),t[17]=n.notifications.enabled,t[18]=f);let p;t[19]===n.liveActivities.enabled?p=t[20]:(p=(0,J.jsx)(Q,{enabled:n.liveActivities.enabled,label:`Live Activities`}),t[19]=n.liveActivities.enabled,t[20]=p);let m;t[21]!==p||t[22]!==f?(m=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[f,p]}),t[21]=p,t[22]=f,t[23]=m):m=t[23];let h;t[24]===n?h=t[25]:(h=de(n),t[24]=n,t[25]=h);let g;t[26]===h?g=t[27]:(g=(0,J.jsx)(`p`,{className:`mt-1.5 text-xs leading-4.5 text-muted-foreground/80`,children:h}),t[26]=h,t[27]=g);let _;return t[28]!==m||t[29]!==g||t[30]!==d?(_=(0,J.jsxs)(Z,{icon:r,children:[d,m,g]}),t[28]=m,t[29]=g,t[30]=d,t[31]=_):_=t[31],_}function he(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsx)(`div`,{"aria-label":`Loading mobile clients`,className:`divide-y border-t`,role:`status`,children:pe.map(ge)}),e[0]=t):t=e[0],t}function ge(e){return(0,J.jsx)(`div`,{className:`py-4`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(M,{shape:`card`,className:`size-8 shrink-0`}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,J.jsx)(M,{className:`h-3.5 w-36`}),(0,J.jsx)(M,{className:`h-3 w-28`}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(M,{className:`h-4.5 w-28`}),(0,J.jsx)(M,{className:`h-4.5 w-24`})]})]})]})},e)}function _e(){let e=(0,z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsx)(N,{variant:`icon`,children:(0,J.jsx)(l,{})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsxs)(L,{size:`compact`,children:[t,(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{children:`No mobile clients`}),(0,J.jsx)(I,{children:`Install P4 Code on your phone and sign in to P4 Connect to get push notifications and Live Activities.`})]})]}),e[1]=n):n=e[1],n}function ve(){let e=(0,z.c)(18),t=q(),n;e[0]===t.data?n=e[1]:(n=t.data??[],e[0]=t.data,e[1]=n);let r=n,i=!t.accountId||t.data===null&&!t.error,a=t.error!==null&&t.data===null,o;e[2]!==t.isPending||e[3]!==t.refresh?(o=(0,J.jsx)(X,{isPending:t.isPending,onClick:t.refresh}),e[2]=t.isPending,e[3]=t.refresh,e[4]=o):o=e[4];let s;e[5]!==t.error||e[6]!==t.refresh?(s=t.error?(0,J.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 border-t border-destructive/35 py-3 text-xs sm:flex-row sm:items-center sm:justify-between`,role:`alert`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive-foreground`,children:`Could not load mobile clients`}),(0,J.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t.error})]}),(0,J.jsx)(_,{size:`xs`,variant:`outline`,onClick:t.refresh,children:`Try again`})]}):null,e[5]=t.error,e[6]=t.refresh,e[7]=s):s=e[7];let c;e[8]!==r||e[9]!==a||e[10]!==i?(c=i?(0,J.jsx)(he,{}):a?null:r.length>0?(0,J.jsx)(`ul`,{className:`border-t`,children:r.map(ye)}):(0,J.jsx)(`div`,{className:`border-t`,children:(0,J.jsx)(_e,{})}),e[8]=r,e[9]=a,e[10]=i,e[11]=c):c=e[11];let l;e[12]!==s||e[13]!==c?(l=(0,J.jsxs)(`div`,{children:[s,c]}),e[12]=s,e[13]=c,e[14]=l):l=e[14];let u;return e[15]!==o||e[16]!==l?(u=(0,J.jsx)(Y,{title:`Mobile clients`,description:`Mobile devices that get notifications from your environments.`,action:o,children:l}),e[15]=o,e[16]=l,e[17]=u):u=e[17],u}function ye(e){return(0,J.jsx)(me,{device:e},e.deviceId)}var be=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`});function xe(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Link date unavailable`:`Linked ${be.format(t)}`}function Se(e){return e.endpoint.providerKind===`cloudflare_tunnel`?`Managed tunnel`:`Activity publishing only`}function Ce(e){let t=(0,z.c)(46),{environment:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(s,{className:`size-4`}),t[0]=r):r=t[0];let i=e.confirmationOpen,a=e.onConfirmationChange,o;t[1]===n.label?o=t[2]:(o=(0,J.jsx)(`h3`,{className:`truncate text-sm leading-4.5 font-medium text-foreground`,children:n.label}),t[1]=n.label,t[2]=o);let c;t[3]===n.linkedAt?c=t[4]:(c=xe(n.linkedAt),t[3]=n.linkedAt,t[4]=c);let l;t[5]===n?l=t[6]:(l=Se(n),t[5]=n,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,J.jsxs)(`p`,{className:`mt-1 text-xs leading-4.5 text-muted-foreground`,children:[c,` · `,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==o||t[11]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o,u]}),t[10]=o,t[11]=u,t[12]=d):d=t[12];let f;t[13]===e.mutationPending?f=t[14]:(f=(0,J.jsx)(ie,{render:(0,J.jsx)(_,{size:`sm`,variant:`destructive-outline`,disabled:e.mutationPending,children:`Deregister`})}),t[13]=e.mutationPending,t[14]=f);let p;t[15]!==d||t[16]!==f?(p=(0,J.jsxs)(`div`,{className:`flex items-start gap-4`,children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17];let m=`Confirm deregistration of ${n.label}`,h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,J.jsx)(`h4`,{className:`text-sm leading-4.5 font-semibold text-foreground`,children:`Deregister server`}),t[18]=h):h=t[18];let g;t[19]===n.label?g=t[20]:(g=(0,J.jsxs)(`p`,{className:`mt-1 text-xs leading-4.5 text-muted-foreground`,children:[`“`,n.label,`” will be removed from this account.`]}),t[19]=n.label,t[20]=g);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(`p`,{className:`mt-4 max-w-xl text-xs leading-4.5 text-muted-foreground`,children:`P4 Connect access will be revoked, any managed tunnel will be removed, and a host space will become available. Local connections on your devices are not changed.`}),t[21]=v):v=t[21];let y;t[22]===e?y=t[23]:(y=()=>e.onConfirmationChange(!1),t[22]=e,t[23]=y);let b;t[24]!==e.mutationPending||t[25]!==y?(b=(0,J.jsx)(_,{size:`sm`,variant:`ghost`,disabled:e.mutationPending,onClick:y,children:`Cancel`}),t[24]=e.mutationPending,t[25]=y,t[26]=b):b=t[26];let x;t[27]!==n||t[28]!==e?(x=()=>e.onDeregister(n),t[27]=n,t[28]=e,t[29]=x):x=t[29];let S=e.mutationPending?`Deregistering…`:`Deregister`,C;t[30]!==e.mutationPending||t[31]!==x||t[32]!==S?(C=(0,J.jsx)(_,{size:`sm`,variant:`destructive`,disabled:e.mutationPending,onClick:x,children:S}),t[30]=e.mutationPending,t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==b||t[35]!==C?(w=(0,J.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[b,C]}),t[34]=b,t[35]=C,t[36]=w):w=t[36];let T;t[37]!==m||t[38]!==g||t[39]!==w?(T=(0,J.jsx)(re,{children:(0,J.jsx)(`div`,{className:`pt-3`,children:(0,J.jsxs)(`div`,{className:`rounded-lg border border-input bg-muted/32 px-5 py-4 shadow-xs/5`,role:`group`,"aria-label":m,children:[h,g,v,w]})})}),t[37]=m,t[38]=g,t[39]=w,t[40]=T):T=t[40];let E;return t[41]!==e.confirmationOpen||t[42]!==e.onConfirmationChange||t[43]!==T||t[44]!==p?(E=(0,J.jsx)(Z,{icon:r,children:(0,J.jsxs)(ae,{open:i,onOpenChange:a,children:[p,T]})}),t[41]=e.confirmationOpen,t[42]=e.onConfirmationChange,t[43]=T,t[44]=p,t[45]=E):E=t[45],E}function we(){let e=(0,z.c)(41),t=se(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},e[0]=n):n=e[0];let r=j(W,n),[i,a]=(0,B.useState)(null),[o,c]=(0,B.useState)(null),l=(0,B.useRef)(!1),u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={accountId:null,linkedAtById:new Map},e[1]=u):u=e[1];let[d,f]=(0,B.useState)(u),p;e[2]!==r||e[3]!==t?(p=async e=>{let n=t.accountId;if(!n||l.current)return;l.current=!0,a(e.environmentId);let i=await r({accountId:n,environmentId:e.environmentId});if(l.current=!1,a(null),i._tag===`Success`){c(null),f(t=>{let r=new Map(t.accountId===n?t.linkedAtById:[]);return r.set(e.environmentId,e.linkedAt),{accountId:n,linkedAtById:r}}),t.refresh(),A.add({type:`success`,title:`Server deregistered`,description:`P4 Connect access was revoked and a host space is now available.`});return}if(S(i))return;let o=w(i),s=o instanceof Error?o.message:`Could not deregister the server.`,u=b(o);console.error(`[t3-connect] Could not deregister environment`,{environmentId:e.environmentId,message:s,traceId:u,cause:o}),A.add({type:`error`,title:`Could not deregister server`,description:s,data:u?{secondaryActionProps:{children:`Copy trace ID`,onClick:()=>void navigator.clipboard?.writeText(u)}}:void 0})},e[2]=r,e[3]=t,e[4]=p):p=e[4];let m=p,h;e[5]!==t.accountId||e[6]!==d.accountId||e[7]!==d.linkedAtById?(h=d.accountId===t.accountId?d.linkedAtById:new Map,e[5]=t.accountId,e[6]=d.accountId,e[7]=d.linkedAtById,e[8]=h):h=e[8];let g=h,_,v,y,x,C,T;if(e[9]!==o||e[10]!==i||e[11]!==t.accountId||e[12]!==t.data||e[13]!==t.error||e[14]!==t.isPending||e[15]!==t.refresh||e[16]!==m||e[17]!==g){let n;e[24]===g?n=e[25]:(n=e=>g.get(e.environmentId)!==e.linkedAt,e[24]=g,e[25]=n);let r=(t.data??[]).filter(n),a=!t.accountId||t.data===null&&!t.error;_=Y,x=`P4 Connect`,C=`Environments registered to your account. Connections on this device are managed in Settings.`;let l=i!==null;e[26]!==t.isPending||e[27]!==t.refresh||e[28]!==l?(T=(0,J.jsx)(X,{disabled:l,isPending:t.isPending,onClick:t.refresh}),e[26]=t.isPending,e[27]=t.refresh,e[28]=l,e[29]=T):T=e[29],e[30]===t.error?v=e[31]:(v=t.error?(0,J.jsxs)(`div`,{className:`mb-4 border-t border-destructive/35 py-3 text-xs`,role:`alert`,children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive-foreground`,children:`Could not load P4 Connect environments`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.error})]}):null,e[30]=t.error,e[31]=v),y=a?(0,J.jsx)(`p`,{className:`border-t py-4 text-xs text-muted-foreground`,role:`status`,children:`Loading environments…`}):r.length>0?(0,J.jsx)(`ul`,{className:`border-t`,children:r.map(e=>(0,J.jsx)(Ce,{environment:e,confirmationOpen:o===e.environmentId,mutationPending:i!==null,onConfirmationChange:t=>c(t?e.environmentId:null),onDeregister:e=>void m(e)},e.environmentId))}):t.error?null:(0,J.jsx)(`div`,{className:`border-t`,children:(0,J.jsxs)(L,{size:`compact`,children:[(0,J.jsx)(N,{variant:`icon`,children:(0,J.jsx)(s,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(F,{children:`No P4 Connect environments`}),(0,J.jsx)(I,{children:`Link an environment from its local Settings to make it available through P4 Connect.`})]})]})}),e[9]=o,e[10]=i,e[11]=t.accountId,e[12]=t.data,e[13]=t.error,e[14]=t.isPending,e[15]=t.refresh,e[16]=m,e[17]=g,e[18]=_,e[19]=v,e[20]=y,e[21]=x,e[22]=C,e[23]=T}else _=e[18],v=e[19],y=e[20],x=e[21],C=e[22],T=e[23];let E;e[32]!==v||e[33]!==y?(E=(0,J.jsxs)(`div`,{children:[v,y]}),e[32]=v,e[33]=y,e[34]=E):E=e[34];let D;return e[35]!==_||e[36]!==x||e[37]!==C||e[38]!==T||e[39]!==E?(D=(0,J.jsx)(_,{title:x,description:C,action:T,children:E}),e[35]=_,e[36]=x,e[37]=C,e[38]=T,e[39]=E,e[40]=D):D=e[40],D}var $=[{label:`Mobile clients`,url:`mobile-clients`,icon:(0,J.jsx)(l,{className:`size-4`}),content:(0,J.jsx)(ve,{})},{label:`P4 Connect`,url:`t3-connect`,icon:(0,J.jsx)(s,{className:`size-4`}),content:(0,J.jsx)(we,{})}];function Te(){let e=(0,z.c)(8),t=te(),{isSignedIn:n}=ne(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={},e[0]=r):r=e[0];let[i,a]=(0,B.useState)(r),o;e[1]===t?o=e[2]:(o=()=>{let e=(e,t)=>a(n=>({...n,[e]:t}));t.openUserProfile({__experimental_startPath:`/t3-connect`,customPages:$.map(t=>({label:t.label,url:t.url,mount:n=>e(`content:${t.url}`,n),unmount:()=>e(`content:${t.url}`,void 0),mountIcon:n=>e(`icon:${t.url}`,n),unmountIcon:()=>e(`icon:${t.url}`,void 0)}))})},e[1]=t,e[2]=o);let s=o,c;e[3]===i?c=e[4]:(c=$.flatMap(e=>{let t=i[`content:${e.url}`],n=i[`icon:${e.url}`];return[t?(0,R.createPortal)(e.content,t,`content:${e.url}`):null,n?(0,R.createPortal)(e.icon,n,`icon:${e.url}`):null]}),e[3]=i,e[4]=c);let l=c,u=n?s:null,d;return e[5]!==l||e[6]!==u?(d={open:u,portals:l},e[5]=l,e[6]=u,e[7]=d):d=e[7],d}export{Te as n,$ as t};
2
+ //# sourceMappingURL=T3ConnectAccountPages-C37rBXr1.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{Af as t,HT as n,dE as r}from"./utils-vKlT_s3D.js";import{o as i}from"./runtime-BVzm9sLS.js";import{n as a,r as o}from"./dist-DOyHkZUI.js";import{c as s,l as c,s as l}from"./sidebar-7a8hvtAS.js";import{t as u}from"./T3ConnectAccountPages-uVnu-v4W.js";import{t as d}from"./useT3ConnectAuthPrompt-DlW3HUgA.js";var f=r(),p=e(n(),1);function m(){let e=(0,f.c)(1);if(!i())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(v,{}),e[0]=t):t=e[0],t}function h(){let e=(0,f.c)(1);if(!i())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(g,{}),e[0]=t):t=e[0],t}function g(){let e=(0,f.c)(1),{isLoaded:t,isSignedIn:n}=o();if(!t||!n)return null;let r;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(a,{appearance:{elements:{avatarBox:`size-7`,userButtonTrigger:`rounded-lg p-1 hover:bg-sidebar-row-hover`}},children:u.map(_)}),e[0]=r):r=e[0],r}function _(e){return(0,p.jsx)(a.UserProfilePage,{label:e.label,labelIcon:e.icon,url:e.url,children:e.content},e.url)}function v(){let e=(0,f.c)(7),{isLoaded:n,isSignedIn:r}=o(),{authPrompt:i,openAuthPrompt:a}=d();if(!n||r)return null;let u,m;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,p.jsx)(t,{}),m=(0,p.jsx)(`span`,{children:`Sign in to P4 Connect`}),e[0]=u,e[1]=m):(u=e[0],m=e[1]);let h;e[2]===a?h=e[3]:(h=(0,p.jsx)(l,{children:(0,p.jsx)(c,{children:(0,p.jsxs)(s,{onClick:a,children:[u,m]})})}),e[2]=a,e[3]=h);let g;return e[4]!==i||e[5]!==h?(g=(0,p.jsxs)(p.Fragment,{children:[h,i]}),e[4]=i,e[5]=h,e[6]=g):g=e[6],g}export{h as T3ConnectSidebarAvatar,m as T3ConnectSidebarSignIn};
2
- //# sourceMappingURL=T3ConnectSidebarSignIn-CZCWzt6C.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{WT as t,jf as n,mE as r}from"./utils-TSzPLNGf.js";import{o as i}from"./runtime-qAs3Aj0U.js";import{n as a,r as o}from"./dist-B181ZKao.js";import{c as s,l as c,s as l}from"./sidebar-ZKIDHqbk.js";import{t as u}from"./T3ConnectAccountPages-C37rBXr1.js";import{t as d}from"./useT3ConnectAuthPrompt-CBxfN-Bk.js";var f=r(),p=e(t(),1);function m(){let e=(0,f.c)(1);if(!i())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(v,{}),e[0]=t):t=e[0],t}function h(){let e=(0,f.c)(1);if(!i())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(g,{}),e[0]=t):t=e[0],t}function g(){let e=(0,f.c)(1),{isLoaded:t,isSignedIn:n}=o();if(!t||!n)return null;let r;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(a,{appearance:{elements:{avatarBox:`size-7`,userButtonTrigger:`rounded-lg p-1 hover:bg-sidebar-row-hover`}},children:u.map(_)}),e[0]=r):r=e[0],r}function _(e){return(0,p.jsx)(a.UserProfilePage,{label:e.label,labelIcon:e.icon,url:e.url,children:e.content},e.url)}function v(){let e=(0,f.c)(7),{isLoaded:t,isSignedIn:r}=o(),{authPrompt:i,openAuthPrompt:a}=d();if(!t||r)return null;let u,m;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,p.jsx)(n,{}),m=(0,p.jsx)(`span`,{children:`Sign in to P4 Connect`}),e[0]=u,e[1]=m):(u=e[0],m=e[1]);let h;e[2]===a?h=e[3]:(h=(0,p.jsx)(l,{children:(0,p.jsx)(c,{children:(0,p.jsxs)(s,{onClick:a,children:[u,m]})})}),e[2]=a,e[3]=h);let g;return e[4]!==i||e[5]!==h?(g=(0,p.jsxs)(p.Fragment,{children:[h,i]}),e[4]=i,e[5]=h,e[6]=g):g=e[6],g}export{h as T3ConnectSidebarAvatar,m as T3ConnectSidebarSignIn};
2
+ //# sourceMappingURL=T3ConnectSidebarSignIn-Dcx0wC1Y.js.map
@@ -1,5 +1,5 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Em as n,HT as r,Yf as i,_p as a,dE as o,sr as s,t as c,tp as l}from"./utils-vKlT_s3D.js";import{a as u,c as d,d as f,n as p,p as m,t as h}from"./tooltip-DH7_Fmka.js";import{A as g,E as _,G as ee,H as v,O as y,S as b,U as te,W as x,_ as S,d as ne,et as C,g as w,m as T,s as re,u as E,y as D}from"./themePalette-B4vIs8Bi.js";import{n as O,t as k}from"./toggle-group-CQtXH1ph.js";import{t as ie}from"./input-BZEAWLAC.js";import{i as A,o as j,t as M}from"./popover-O8JaXWO5.js";import{i as N,n as P,r as F,t as I}from"./color-picker-DYoHU1P8.js";import{La as L}from"./main-DJbmaTSv.js";var ae=o(),R=e(t(),1),z=e(r(),1);function B(e){return{canvas:`Background`,toolbar:`Toolbar background`,toolbarForeground:`Toolbar text`,toolbarBorder:`Toolbar border`,toolbarControl:`Toolbar control`,toolbarControlForeground:`Toolbar control text`,toolbarControlHover:`Toolbar control hover`,accent:`Accent color`,errorForeground:`Error text`,errorSurface:`Error background`,warningForeground:`Warning text`,warningSurface:`Warning background`,updateForeground:`Update text`,updateSurface:`Update background`}[e]||e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}function V(e){let t=v(e)??``,n=t.length===9?t.slice(7):``;return n===`ff`?``:n}function oe(e){return(v(e)??`#000000`).slice(0,7)}function se(e){let t=Number.parseInt(oe(e).slice(1),16);return[t>>16,t>>8&255,t&255]}function ce(e){let t=e.trim().replace(/^rgb\(\s*/i,``).replace(/\s*\)$/,``).split(/[,\s]+/).filter(Boolean).map(Number);return t.length!==3||t.some(e=>!Number.isInteger(e)||e<0||e>255)?null:`#${t.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function H(e){return se(e).join(`, `)}function U({label:e,value:t,onChange:n}){let r=oe(t),i=V(t),[a,o]=(0,R.useState)(()=>F(r)),[s,c]=(0,R.useState)(r),[l,u]=(0,R.useState)(()=>H(r)),d=(0,R.useRef)(!1),f=N(a.h,a.s,a.v),p=H(f);(0,R.useEffect)(()=>{d.current||(c(r),u(H(r))),o(e=>N(e.h,e.s,e.v)===r?e:F(r))},[r]);let m=(0,R.useRef)(n);m.current=n;let h=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useCallback)(()=>{g.current!==null&&(cancelAnimationFrame(g.current),g.current=null);let e=h.current;h.current=null,e!==null&&m.current(e)},[]);(0,R.useEffect)(()=>()=>_(),[_]);let ee=(0,R.useCallback)(e=>{h.current=e,g.current??=requestAnimationFrame(()=>{g.current=null;let e=h.current;h.current=null,e!==null&&m.current(e)})},[]),v=(0,R.useCallback)(e=>{o(e);let t=N(e.h,e.s,e.v);c(t),u(H(t)),ee(t+i)},[i,ee]),y=e=>{if(c(e),!/^#[0-9a-f]{6}$/i.test(e))return;let t=F(e);o(t),u(H(e)),n(e.toLowerCase())},b=e=>{u(e);let t=ce(e);t&&(o(F(t)),c(t),n(t+i))};return(0,z.jsxs)(`div`,{className:`w-72 bg-popover`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-xs font-semibold text-foreground`,children:e}),(0,z.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:`Choose a color`})]}),(0,z.jsx)(`span`,{className:`size-7 shrink-0 rounded-full shadow-sm`,style:{backgroundColor:f}})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 px-3 pb-3 pt-3`,children:[(0,z.jsx)(P,{label:e,value:a,onChange:v,onInteractionEnd:_}),(0,z.jsx)(I,{label:`${e} hue`,value:a.h,onChange:e=>v({...a,h:e}),onInteractionEnd:_}),(0,z.jsxs)(`div`,{className:`grid grid-cols-[1fr_1.2fr] gap-2`,children:[(0,z.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,z.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`HEX`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:[(0,z.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full`,style:{backgroundColor:f}}),(0,z.jsx)(`input`,{"aria-label":`${e} picker hex value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>y(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:s})]})]}),(0,z.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,z.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`RGB`}),(0,z.jsx)(`span`,{className:`flex min-w-0 items-center rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:(0,z.jsx)(`input`,{"aria-label":`${e} picker RGB value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>b(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:l})})]})]})]})]})}function W(e){let t=(0,ae.c)(13),{label:n,value:r,onChange:i,onInteract:a}=e,o=`Choose ${n} color`,s;t[0]===r?s=t[1]:(s=(0,z.jsx)(`span`,{className:`absolute inset-0 rounded-full shadow-sm`,style:{backgroundColor:r}}),t[0]=r,t[1]=s);let c;t[2]!==a||t[3]!==o||t[4]!==s?(c=(0,z.jsx)(j,{render:(0,z.jsx)(`button`,{"aria-label":o,className:`relative flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-foreground/30 transition-transform hover:scale-105 focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,onFocus:a,onPointerDown:a,type:`button`,children:s})}),t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==i||t[8]!==r?(l=(0,z.jsx)(A,{align:`end`,padding:`none`,"data-theme-editor-panel":``,side:`bottom`,sideOffset:10,children:(0,z.jsx)(U,{label:n,onChange:i,value:r})}),t[6]=n,t[7]=i,t[8]=r,t[9]=l):l=t[9];let u;return t[10]!==c||t[11]!==l?(u=(0,z.jsxs)(M,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}var le=(0,R.memo)(function(e){let t=(0,ae.c)(58),{role:n,value:r,onChange:i,onSelect:a,onToggleSelected:o,selected:s,label:l}=e,d=s!==void 0&&s,f;t[0]!==l||t[1]!==n?(f=l??B(n),t[0]=l,t[1]=n,t[2]=f):f=t[2];let m=f,g;t[3]===r?g=t[4]:(g=_(r),t[3]=r,t[4]=g);let ee=g,y=ee?r:`#000000`,b;t[5]===r?b=t[6]:(b=r.trim().toLowerCase().startsWith(`oklch(`)?v(r)??r:r,t[5]=r,t[6]=b);let te=b,x=d&&`bg-accent/60 inset-ring inset-ring-ring`,S;t[7]===x?S=t[8]:(S=c(`flex min-h-11 min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 transition-[background-color,box-shadow]`,x),t[7]=x,t[8]=S);let ne=`${d?`Hide`:`Show`} ${m} usage`,C;t[9]!==o||t[10]!==n?(C=()=>o?.(n),t[9]=o,t[10]=n,t[11]=C):C=t[11];let w;t[12]===m?w=t[13]:(w=(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),t[12]=m,t[13]=w);let T;t[14]!==d||t[15]!==ne||t[16]!==C||t[17]!==w?(T=(0,z.jsx)(u,{render:(0,z.jsx)(`button`,{"aria-label":ne,"aria-pressed":d,className:`flex min-w-0 flex-1 cursor-pointer items-center rounded-md text-left text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,onClick:C,type:`button`,children:w})}),t[14]=d,t[15]=ne,t[16]=C,t[17]=w,t[18]=T):T=t[18];let re=`${d?`Hide`:`Show`} where ${m} is used`,E;t[19]===re?E=t[20]:(E=(0,z.jsx)(p,{side:`top`,children:re}),t[19]=re,t[20]=E);let D;t[21]!==T||t[22]!==E?(D=(0,z.jsxs)(h,{children:[T,E]}),t[21]=T,t[22]=E,t[23]=D):D=t[23];let O;t[24]!==i||t[25]!==n?(O=e=>i(n,e),t[24]=i,t[25]=n,t[26]=O):O=t[26];let k;t[27]!==a||t[28]!==n?(k=()=>a?.(n),t[27]=a,t[28]=n,t[29]=k):k=t[29];let A;t[30]!==m||t[31]!==y||t[32]!==O||t[33]!==k?(A=(0,z.jsx)(W,{label:m,onChange:O,onInteract:k,value:y}),t[30]=m,t[31]=y,t[32]=O,t[33]=k,t[34]=A):A=t[34];let j=!ee,M=`${m} hex value`,N=`${n}-hex`,P;t[35]!==i||t[36]!==n?(P=e=>i(n,e.currentTarget.value),t[35]=i,t[36]=n,t[37]=P):P=t[37];let F,I;t[38]!==a||t[39]!==n?(F=()=>a?.(n),I=()=>a?.(n),t[38]=a,t[39]=n,t[40]=F,t[41]=I):(F=t[40],I=t[41]);let L;t[42]!==te||t[43]!==j||t[44]!==M||t[45]!==N||t[46]!==P||t[47]!==F||t[48]!==I?(L=(0,z.jsx)(ie,{"aria-invalid":j,"aria-label":M,className:`w-28 shrink-0`,font:`mono`,id:N,nativeInput:!0,onChange:P,onFocus:F,onPointerDown:I,size:`compact`,value:te}),t[42]=te,t[43]=j,t[44]=M,t[45]=N,t[46]=P,t[47]=F,t[48]=I,t[49]=L):L=t[49];let R;t[50]!==A||t[51]!==L?(R=(0,z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[A,L]}),t[50]=A,t[51]=L,t[52]=R):R=t[52];let V;return t[53]!==n||t[54]!==D||t[55]!==R||t[56]!==S?(V=(0,z.jsxs)(`div`,{className:S,"data-theme-color-role":n,children:[D,R]}),t[53]=n,t[54]=D,t[55]=R,t[56]=S,t[57]=V):V=t[57],V}),ue=[`background`,`border`,`foreground`],G=`data-theme-inspector-match`,de=`data-theme-token-probe`,K=`#01fea7`,fe=`#fe01a7`,q=`theme-inspector-spotlight`,J=`theme-inspector-spotlight-mask`,pe=`theme-inspector-spotlight-glow`,Y=`theme-inspector-hover`,X=`http://www.w3.org/2000/svg`,me={background:`canvas`,foreground:`text`,card:`surface`,"card-foreground":`text`,popover:`surfaceOverlay`,"popover-foreground":`text`,"surface-raised":`surfaceRaised`,primary:`messageAction`,"primary-foreground":`messageActionForeground`,secondary:`secondary`,"secondary-foreground":`secondaryForeground`,muted:`muted`,"muted-foreground":`mutedForeground`,placeholder:`placeholder`,"secondary-label":`secondaryLabel`,"icon-muted":`iconMuted`,accent:`accentSurface`,"accent-foreground":`accentSurfaceForeground`,destructive:`error`,"destructive-foreground":`errorForeground`,error:`error`,"error-foreground":`errorForeground`,"error-surface":`errorSurface`,warning:`warning`,"warning-foreground":`warningForeground`,"warning-surface":`warningSurface`,update:`update`,"update-foreground":`updateForeground`,"update-surface":`updateSurface`,message:`messageSurface`,"message-foreground":`messageForeground`,"message-action":`messageAction`,"message-action-foreground":`messageActionForeground`,"message-action-hover":`messageActionHover`,sidebar:`sidebar`,"sidebar-foreground":`sidebarForeground`,"sidebar-muted-foreground":`sidebarMutedForeground`,"sidebar-control-surface":`sidebarControlSurface`,"sidebar-row-hover":`sidebarRowHover`,"sidebar-row-active":`sidebarRowActive`,"sidebar-row-selected":`sidebarRowSelected`,"sidebar-border":`sidebarBorder`,border:`border`,input:`input`,ring:`focus`},he={background:[`bg-`],border:[`border-`,`outline-`,`ring-`],foreground:[`text-`,`caret-`,`fill-`,`stroke-`]};function ge(e){document.querySelectorAll(`[${e}]`).forEach(t=>t.removeAttribute(e))}function _e(){ge(G),document.getElementById(q)?.remove()}function ve(){document.getElementById(Y)?.remove()}function Z(e){return document.createElementNS(X,e)}function ye(e){let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||t.right<0||t.bottom<0||t.left>window.innerWidth||t.top>window.innerHeight)return null;let n=t.left-5,r=t.top-5,i=Number.parseFloat(window.getComputedStyle(e).borderTopLeftRadius)||0;return{x:n,y:r,width:t.width+10,height:t.height+10,radius:Math.min(18,Math.max(7,i+5))}}function be(e,t){let n=ye(e.element);if(!n){ve();return}let r=document.getElementById(Y);if(!r){r=document.createElement(`div`),r.id=Y,r.setAttribute(`aria-hidden`,`true`);let e=document.createElement(`span`);e.dataset.themeInspectorHoverLabel=``,r.append(e),document.body.append(r)}r.style.left=`${n.x}px`,r.style.top=`${n.y}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius=`${n.radius}px`,r.dataset.placement=n.y<32?`below`:`above`;let i=r.querySelector(`[data-theme-inspector-hover-label]`);i&&(i.textContent=t)}function xe(e){let t=new Map;for(let n of e){let e=ye(n);if(!e)continue;let r=[e.x,e.y,e.width,e.height].map(e=>Math.round(e)).join(`:`);t.set(r,e)}if(t.size===0){document.getElementById(q)?.remove();return}let n=document.getElementById(q);n||(n=Z(`svg`),n.id=q,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),document.body.append(n)),n.setAttribute(`viewBox`,`0 0 ${window.innerWidth} ${window.innerHeight}`);let r=Z(`defs`),i=Z(`mask`);i.id=J,i.setAttribute(`maskUnits`,`userSpaceOnUse`);let a=Z(`rect`);a.setAttribute(`width`,String(window.innerWidth)),a.setAttribute(`height`,String(window.innerHeight)),a.setAttribute(`fill`,`white`),i.append(a);let o=Z(`filter`);o.id=pe,o.setAttribute(`x`,`-50%`),o.setAttribute(`y`,`-50%`),o.setAttribute(`width`,`200%`),o.setAttribute(`height`,`200%`);let s=Z(`feGaussianBlur`);s.setAttribute(`stdDeviation`,`5`),s.setAttribute(`result`,`blur`);let c=Z(`feMerge`),l=Z(`feMergeNode`);l.setAttribute(`in`,`blur`);let u=Z(`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.append(l,u),o.append(s,c),r.append(i,o);let d=Z(`g`);for(let e of t.values()){let t=Z(`rect`);t.setAttribute(`x`,String(e.x)),t.setAttribute(`y`,String(e.y)),t.setAttribute(`width`,String(e.width)),t.setAttribute(`height`,String(e.height)),t.setAttribute(`rx`,String(e.radius)),t.setAttribute(`fill`,`black`),i.append(t);let n=t.cloneNode(!1);n.removeAttribute(`fill`),n.setAttribute(`class`,`theme-inspector-spotlight-glow`),n.setAttribute(`filter`,`url(#${pe})`),d.append(n)}let f=Z(`rect`);f.setAttribute(`class`,`theme-inspector-spotlight-dimmer`),f.setAttribute(`width`,String(window.innerWidth)),f.setAttribute(`height`,String(window.innerHeight)),f.setAttribute(`mask`,`url(#${J})`),n.replaceChildren(r,f,d)}function Se(){xe([...document.querySelectorAll(`[${G}]`)])}function Ce(e){return e.matches(`input, textarea, select, option`)?!0:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.textContent?.trim())}function Q(e,{forHitTest:t=!1}={}){let n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||Number(n.opacity)===0)return null;let r=[];for(let[e,t,i]of[[n.borderTopColor,n.borderTopStyle,n.borderTopWidth],[n.borderRightColor,n.borderRightStyle,n.borderRightWidth],[n.borderBottomColor,n.borderBottomStyle,n.borderBottomWidth],[n.borderLeftColor,n.borderLeftStyle,n.borderLeftWidth]])t!==`none`&&Number.parseFloat(i)>0&&r.push(e);n.outlineStyle!==`none`&&Number.parseFloat(n.outlineWidth)>0&&r.push(n.outlineColor),n.borderImageSource!==`none`&&r.push(n.borderImageSource),n.boxShadow!==`none`&&r.push(n.boxShadow);let i=[];return(t||Ce(e))&&i.push(n.color),e instanceof SVGElement&&i.push(n.fill,n.stroke),e.matches(`input, textarea`)&&i.push(n.caretColor),n.textDecorationLine!==`none`&&i.push(n.textDecorationColor),n.textShadow!==`none`&&i.push(n.textShadow),{background:[n.backgroundColor,n.backgroundImage].join(`
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Dm as n,WT as r,Xf as i,mE as a,np as o,sr as s,t as c,vp as l}from"./utils-TSzPLNGf.js";import{a as u,c as d,d as f,n as p,p as m,t as h}from"./tooltip-DdUPPKq4.js";import{A as g,E as _,G as ee,H as v,O as y,S as b,U as te,W as x,_ as S,d as ne,et as C,g as w,m as T,s as re,u as E,y as D}from"./themePalette-Bl55tW1x.js";import{n as O,t as k}from"./toggle-group-Dt1Yldxx.js";import{t as ie}from"./input-CNGP9r-b.js";import{i as A,o as j,t as M}from"./popover-CCsUmLYF.js";import{i as N,n as P,r as F,t as I}from"./color-picker-8XrkJD1z.js";import{La as L}from"./main-pmaKofkn.js";var ae=a(),R=e(t(),1),z=e(r(),1);function B(e){return{canvas:`Background`,toolbar:`Toolbar background`,toolbarForeground:`Toolbar text`,toolbarBorder:`Toolbar border`,toolbarControl:`Toolbar control`,toolbarControlForeground:`Toolbar control text`,toolbarControlHover:`Toolbar control hover`,accent:`Accent color`,errorForeground:`Error text`,errorSurface:`Error background`,warningForeground:`Warning text`,warningSurface:`Warning background`,updateForeground:`Update text`,updateSurface:`Update background`}[e]||e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}function V(e){let t=v(e)??``,n=t.length===9?t.slice(7):``;return n===`ff`?``:n}function oe(e){return(v(e)??`#000000`).slice(0,7)}function se(e){let t=Number.parseInt(oe(e).slice(1),16);return[t>>16,t>>8&255,t&255]}function ce(e){let t=e.trim().replace(/^rgb\(\s*/i,``).replace(/\s*\)$/,``).split(/[,\s]+/).filter(Boolean).map(Number);return t.length!==3||t.some(e=>!Number.isInteger(e)||e<0||e>255)?null:`#${t.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function H(e){return se(e).join(`, `)}function U({label:e,value:t,onChange:n}){let r=oe(t),i=V(t),[a,o]=(0,R.useState)(()=>F(r)),[s,c]=(0,R.useState)(r),[l,u]=(0,R.useState)(()=>H(r)),d=(0,R.useRef)(!1),f=N(a.h,a.s,a.v),p=H(f);(0,R.useEffect)(()=>{d.current||(c(r),u(H(r))),o(e=>N(e.h,e.s,e.v)===r?e:F(r))},[r]);let m=(0,R.useRef)(n);m.current=n;let h=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useCallback)(()=>{g.current!==null&&(cancelAnimationFrame(g.current),g.current=null);let e=h.current;h.current=null,e!==null&&m.current(e)},[]);(0,R.useEffect)(()=>()=>_(),[_]);let ee=(0,R.useCallback)(e=>{h.current=e,g.current??=requestAnimationFrame(()=>{g.current=null;let e=h.current;h.current=null,e!==null&&m.current(e)})},[]),v=(0,R.useCallback)(e=>{o(e);let t=N(e.h,e.s,e.v);c(t),u(H(t)),ee(t+i)},[i,ee]),y=e=>{if(c(e),!/^#[0-9a-f]{6}$/i.test(e))return;let t=F(e);o(t),u(H(e)),n(e.toLowerCase())},b=e=>{u(e);let t=ce(e);t&&(o(F(t)),c(t),n(t+i))};return(0,z.jsxs)(`div`,{className:`w-72 bg-popover`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-xs font-semibold text-foreground`,children:e}),(0,z.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:`Choose a color`})]}),(0,z.jsx)(`span`,{className:`size-7 shrink-0 rounded-full shadow-sm`,style:{backgroundColor:f}})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 px-3 pb-3 pt-3`,children:[(0,z.jsx)(P,{label:e,value:a,onChange:v,onInteractionEnd:_}),(0,z.jsx)(I,{label:`${e} hue`,value:a.h,onChange:e=>v({...a,h:e}),onInteractionEnd:_}),(0,z.jsxs)(`div`,{className:`grid grid-cols-[1fr_1.2fr] gap-2`,children:[(0,z.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,z.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`HEX`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:[(0,z.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full`,style:{backgroundColor:f}}),(0,z.jsx)(`input`,{"aria-label":`${e} picker hex value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>y(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:s})]})]}),(0,z.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,z.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`RGB`}),(0,z.jsx)(`span`,{className:`flex min-w-0 items-center rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:(0,z.jsx)(`input`,{"aria-label":`${e} picker RGB value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>b(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:l})})]})]})]})]})}function W(e){let t=(0,ae.c)(13),{label:n,value:r,onChange:i,onInteract:a}=e,o=`Choose ${n} color`,s;t[0]===r?s=t[1]:(s=(0,z.jsx)(`span`,{className:`absolute inset-0 rounded-full shadow-sm`,style:{backgroundColor:r}}),t[0]=r,t[1]=s);let c;t[2]!==a||t[3]!==o||t[4]!==s?(c=(0,z.jsx)(j,{render:(0,z.jsx)(`button`,{"aria-label":o,className:`relative flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-foreground/30 transition-transform hover:scale-105 focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,onFocus:a,onPointerDown:a,type:`button`,children:s})}),t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==i||t[8]!==r?(l=(0,z.jsx)(A,{align:`end`,padding:`none`,"data-theme-editor-panel":``,side:`bottom`,sideOffset:10,children:(0,z.jsx)(U,{label:n,onChange:i,value:r})}),t[6]=n,t[7]=i,t[8]=r,t[9]=l):l=t[9];let u;return t[10]!==c||t[11]!==l?(u=(0,z.jsxs)(M,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}var le=(0,R.memo)(function(e){let t=(0,ae.c)(58),{role:n,value:r,onChange:i,onSelect:a,onToggleSelected:o,selected:s,label:l}=e,d=s!==void 0&&s,f;t[0]!==l||t[1]!==n?(f=l??B(n),t[0]=l,t[1]=n,t[2]=f):f=t[2];let m=f,g;t[3]===r?g=t[4]:(g=_(r),t[3]=r,t[4]=g);let ee=g,y=ee?r:`#000000`,b;t[5]===r?b=t[6]:(b=r.trim().toLowerCase().startsWith(`oklch(`)?v(r)??r:r,t[5]=r,t[6]=b);let te=b,x=d&&`bg-accent/60 inset-ring inset-ring-ring`,S;t[7]===x?S=t[8]:(S=c(`flex min-h-11 min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 transition-[background-color,box-shadow]`,x),t[7]=x,t[8]=S);let ne=`${d?`Hide`:`Show`} ${m} usage`,C;t[9]!==o||t[10]!==n?(C=()=>o?.(n),t[9]=o,t[10]=n,t[11]=C):C=t[11];let w;t[12]===m?w=t[13]:(w=(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),t[12]=m,t[13]=w);let T;t[14]!==d||t[15]!==ne||t[16]!==C||t[17]!==w?(T=(0,z.jsx)(u,{render:(0,z.jsx)(`button`,{"aria-label":ne,"aria-pressed":d,className:`flex min-w-0 flex-1 cursor-pointer items-center rounded-md text-left text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,onClick:C,type:`button`,children:w})}),t[14]=d,t[15]=ne,t[16]=C,t[17]=w,t[18]=T):T=t[18];let re=`${d?`Hide`:`Show`} where ${m} is used`,E;t[19]===re?E=t[20]:(E=(0,z.jsx)(p,{side:`top`,children:re}),t[19]=re,t[20]=E);let D;t[21]!==T||t[22]!==E?(D=(0,z.jsxs)(h,{children:[T,E]}),t[21]=T,t[22]=E,t[23]=D):D=t[23];let O;t[24]!==i||t[25]!==n?(O=e=>i(n,e),t[24]=i,t[25]=n,t[26]=O):O=t[26];let k;t[27]!==a||t[28]!==n?(k=()=>a?.(n),t[27]=a,t[28]=n,t[29]=k):k=t[29];let A;t[30]!==m||t[31]!==y||t[32]!==O||t[33]!==k?(A=(0,z.jsx)(W,{label:m,onChange:O,onInteract:k,value:y}),t[30]=m,t[31]=y,t[32]=O,t[33]=k,t[34]=A):A=t[34];let j=!ee,M=`${m} hex value`,N=`${n}-hex`,P;t[35]!==i||t[36]!==n?(P=e=>i(n,e.currentTarget.value),t[35]=i,t[36]=n,t[37]=P):P=t[37];let F,I;t[38]!==a||t[39]!==n?(F=()=>a?.(n),I=()=>a?.(n),t[38]=a,t[39]=n,t[40]=F,t[41]=I):(F=t[40],I=t[41]);let L;t[42]!==te||t[43]!==j||t[44]!==M||t[45]!==N||t[46]!==P||t[47]!==F||t[48]!==I?(L=(0,z.jsx)(ie,{"aria-invalid":j,"aria-label":M,className:`w-28 shrink-0`,font:`mono`,id:N,nativeInput:!0,onChange:P,onFocus:F,onPointerDown:I,size:`compact`,value:te}),t[42]=te,t[43]=j,t[44]=M,t[45]=N,t[46]=P,t[47]=F,t[48]=I,t[49]=L):L=t[49];let R;t[50]!==A||t[51]!==L?(R=(0,z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[A,L]}),t[50]=A,t[51]=L,t[52]=R):R=t[52];let V;return t[53]!==n||t[54]!==D||t[55]!==R||t[56]!==S?(V=(0,z.jsxs)(`div`,{className:S,"data-theme-color-role":n,children:[D,R]}),t[53]=n,t[54]=D,t[55]=R,t[56]=S,t[57]=V):V=t[57],V}),ue=[`background`,`border`,`foreground`],G=`data-theme-inspector-match`,de=`data-theme-token-probe`,K=`#01fea7`,fe=`#fe01a7`,q=`theme-inspector-spotlight`,J=`theme-inspector-spotlight-mask`,pe=`theme-inspector-spotlight-glow`,Y=`theme-inspector-hover`,X=`http://www.w3.org/2000/svg`,me={background:`canvas`,foreground:`text`,card:`surface`,"card-foreground":`text`,popover:`surfaceOverlay`,"popover-foreground":`text`,"surface-raised":`surfaceRaised`,primary:`messageAction`,"primary-foreground":`messageActionForeground`,secondary:`secondary`,"secondary-foreground":`secondaryForeground`,muted:`muted`,"muted-foreground":`mutedForeground`,placeholder:`placeholder`,"secondary-label":`secondaryLabel`,"icon-muted":`iconMuted`,accent:`accentSurface`,"accent-foreground":`accentSurfaceForeground`,destructive:`error`,"destructive-foreground":`errorForeground`,error:`error`,"error-foreground":`errorForeground`,"error-surface":`errorSurface`,warning:`warning`,"warning-foreground":`warningForeground`,"warning-surface":`warningSurface`,update:`update`,"update-foreground":`updateForeground`,"update-surface":`updateSurface`,message:`messageSurface`,"message-foreground":`messageForeground`,"message-action":`messageAction`,"message-action-foreground":`messageActionForeground`,"message-action-hover":`messageActionHover`,sidebar:`sidebar`,"sidebar-foreground":`sidebarForeground`,"sidebar-muted-foreground":`sidebarMutedForeground`,"sidebar-control-surface":`sidebarControlSurface`,"sidebar-row-hover":`sidebarRowHover`,"sidebar-row-active":`sidebarRowActive`,"sidebar-row-selected":`sidebarRowSelected`,"sidebar-border":`sidebarBorder`,border:`border`,input:`input`,ring:`focus`},he={background:[`bg-`],border:[`border-`,`outline-`,`ring-`],foreground:[`text-`,`caret-`,`fill-`,`stroke-`]};function ge(e){document.querySelectorAll(`[${e}]`).forEach(t=>t.removeAttribute(e))}function _e(){ge(G),document.getElementById(q)?.remove()}function ve(){document.getElementById(Y)?.remove()}function Z(e){return document.createElementNS(X,e)}function ye(e){let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||t.right<0||t.bottom<0||t.left>window.innerWidth||t.top>window.innerHeight)return null;let n=t.left-5,r=t.top-5,i=Number.parseFloat(window.getComputedStyle(e).borderTopLeftRadius)||0;return{x:n,y:r,width:t.width+10,height:t.height+10,radius:Math.min(18,Math.max(7,i+5))}}function be(e,t){let n=ye(e.element);if(!n){ve();return}let r=document.getElementById(Y);if(!r){r=document.createElement(`div`),r.id=Y,r.setAttribute(`aria-hidden`,`true`);let e=document.createElement(`span`);e.dataset.themeInspectorHoverLabel=``,r.append(e),document.body.append(r)}r.style.left=`${n.x}px`,r.style.top=`${n.y}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius=`${n.radius}px`,r.dataset.placement=n.y<32?`below`:`above`;let i=r.querySelector(`[data-theme-inspector-hover-label]`);i&&(i.textContent=t)}function xe(e){let t=new Map;for(let n of e){let e=ye(n);if(!e)continue;let r=[e.x,e.y,e.width,e.height].map(e=>Math.round(e)).join(`:`);t.set(r,e)}if(t.size===0){document.getElementById(q)?.remove();return}let n=document.getElementById(q);n||(n=Z(`svg`),n.id=q,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),document.body.append(n)),n.setAttribute(`viewBox`,`0 0 ${window.innerWidth} ${window.innerHeight}`);let r=Z(`defs`),i=Z(`mask`);i.id=J,i.setAttribute(`maskUnits`,`userSpaceOnUse`);let a=Z(`rect`);a.setAttribute(`width`,String(window.innerWidth)),a.setAttribute(`height`,String(window.innerHeight)),a.setAttribute(`fill`,`white`),i.append(a);let o=Z(`filter`);o.id=pe,o.setAttribute(`x`,`-50%`),o.setAttribute(`y`,`-50%`),o.setAttribute(`width`,`200%`),o.setAttribute(`height`,`200%`);let s=Z(`feGaussianBlur`);s.setAttribute(`stdDeviation`,`5`),s.setAttribute(`result`,`blur`);let c=Z(`feMerge`),l=Z(`feMergeNode`);l.setAttribute(`in`,`blur`);let u=Z(`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.append(l,u),o.append(s,c),r.append(i,o);let d=Z(`g`);for(let e of t.values()){let t=Z(`rect`);t.setAttribute(`x`,String(e.x)),t.setAttribute(`y`,String(e.y)),t.setAttribute(`width`,String(e.width)),t.setAttribute(`height`,String(e.height)),t.setAttribute(`rx`,String(e.radius)),t.setAttribute(`fill`,`black`),i.append(t);let n=t.cloneNode(!1);n.removeAttribute(`fill`),n.setAttribute(`class`,`theme-inspector-spotlight-glow`),n.setAttribute(`filter`,`url(#${pe})`),d.append(n)}let f=Z(`rect`);f.setAttribute(`class`,`theme-inspector-spotlight-dimmer`),f.setAttribute(`width`,String(window.innerWidth)),f.setAttribute(`height`,String(window.innerHeight)),f.setAttribute(`mask`,`url(#${J})`),n.replaceChildren(r,f,d)}function Se(){xe([...document.querySelectorAll(`[${G}]`)])}function Ce(e){return e.matches(`input, textarea, select, option`)?!0:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.textContent?.trim())}function Q(e,{forHitTest:t=!1}={}){let n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||Number(n.opacity)===0)return null;let r=[];for(let[e,t,i]of[[n.borderTopColor,n.borderTopStyle,n.borderTopWidth],[n.borderRightColor,n.borderRightStyle,n.borderRightWidth],[n.borderBottomColor,n.borderBottomStyle,n.borderBottomWidth],[n.borderLeftColor,n.borderLeftStyle,n.borderLeftWidth]])t!==`none`&&Number.parseFloat(i)>0&&r.push(e);n.outlineStyle!==`none`&&Number.parseFloat(n.outlineWidth)>0&&r.push(n.outlineColor),n.borderImageSource!==`none`&&r.push(n.borderImageSource),n.boxShadow!==`none`&&r.push(n.boxShadow);let i=[];return(t||Ce(e))&&i.push(n.color),e instanceof SVGElement&&i.push(n.fill,n.stroke),e.matches(`input, textarea`)&&i.push(n.caretColor),n.textDecorationLine!==`none`&&i.push(n.textDecorationColor),n.textShadow!==`none`&&i.push(n.textShadow),{background:[n.backgroundColor,n.backgroundImage].join(`
2
2
  `),border:r.join(`
3
3
  `),foreground:i.join(`
4
- `)}}function we(e,t){return ue.filter(n=>e[n]!==t[n])}function Te(e){let t=document.documentElement,n=t.hasAttribute(de);n||t.setAttribute(de,``);try{return e()}finally{window.getComputedStyle(t).color,n||t.removeAttribute(de)}}function Ee(e){let t=document.documentElement,n=w(e),r=t.style.getPropertyValue(n),i=t.style.getPropertyPriority(n),a=r.trim().toLowerCase()===K?fe:K;return t.style.setProperty(n,a,`important`),()=>{r?t.style.setProperty(n,r,i):t.style.removeProperty(n)}}function $(e){let t=e.map(Ee);return()=>{for(let e of t.toReversed())e()}}function De(){return[document.body,...document.body.querySelectorAll(`*`)].filter(e=>!e.closest(`[data-theme-editor-panel]`)&&!e.closest(`#${q}, #${Y}`))}function Oe(e,t){if(e.includes(`:`))return null;for(let n of he[t])if(e.startsWith(n))return me[e.slice(n.length).split(`/`,1)[0]??``]??null;return null}function ke(e){for(let t of ue)for(let n of e.classList){let e=Oe(n,t);if(e)return e}return null}function Ae(e){let t=[],n=e;for(;n&&n!==document.documentElement;)n.closest(`[data-theme-editor-panel]`)||t.push(n),n=n.parentElement;return t}function je(e){if(e.closest(`[data-theme-editor-panel]`))return null;for(let t of Ae(e)){let e=ke(t);if(e)return{element:t,role:e}}return null}function Me(e){performance.now(),ge(G);let t=De(),n=performance.now(),r=Te(()=>{let n=new Map;for(let e of t){let t=Q(e);t&&n.set(e,t)}let r=$(e),i=new Set;try{for(let[e,t]of n){let n=Q(e);n&&we(t,n).length>0&&i.add(e)}}finally{r()}return i});performance.now()-n;let i=new Set;for(let e of r)i.add(e instanceof SVGElement?e.closest(`svg`)??e:e);for(let e of i)e.setAttribute(G,``);return xe([...i]),i.size}function Ne(e){if(e.closest(`[data-theme-editor-panel]`))return null;let t=Ae(e),n=je(e);if(n)return n;let r=Te(()=>{let e=new Map,n=new Map;for(let n of t){let t=Q(n,{forHitTest:!0});t&&e.set(n,t)}for(let t of C){let r=Ee(t);try{for(let[r,i]of e){let e=Q(r,{forHitTest:!0});if(!e)continue;let a=n.get(r)??{};for(let n of we(i,e))a[n]??=t;n.set(r,a)}}finally{r()}}return n});for(let e of t){let t=r.get(e);if(t)for(let n of ue){let r=t[n];if(r)return{element:e,role:r}}}return null}var Pe=[`canvas`,`accent`],Fe=[{id:`foundation`,title:`Foundation`,families:[{id:`background`,label:`Background`,role:`canvas`,roles:[`canvas`,`chrome`,`toolbar`]},{id:`surface`,label:`Surface`,role:`surface`,roles:[`surface`]},{id:`raised-surface`,label:`Raised surface`,role:`surfaceRaised`,roles:[`surfaceRaised`]},{id:`overlay`,label:`Overlay`,role:`surfaceOverlay`,roles:[`surfaceOverlay`]},{id:`text`,label:`Text`,role:`text`,roles:[`text`,`toolbarForeground`,`toolbarControlForeground`]},{id:`muted-text`,label:`Muted text`,role:`mutedForeground`,roles:[`textMuted`,`mutedForeground`,`placeholder`,`secondaryLabel`,`iconMuted`,`sidebarMutedForeground`]},{id:`border`,label:`Border`,role:`border`,roles:[`border`,`toolbarBorder`,`sidebarBorder`]},{id:`input`,label:`Input`,role:`input`,roles:[`input`]}]},{id:`brand-content`,title:`Brand & content`,families:[{id:`subtle-surface`,label:`Subtle surface`,role:`secondary`,roles:[`secondary`,`secondaryForeground`,`muted`,`toolbarControl`]},{id:`highlight-surface`,label:`Highlight surface`,role:`accentSurface`,roles:[`accentSurface`,`accentSurfaceForeground`,`toolbarControlHover`]},{id:`accent`,label:`Accent`,role:`accent`,roles:[`accent`,`accentForeground`,`focus`,`update`,`updateForeground`,`updateSurface`,`terminalCursor`]},{id:`action`,label:`Action`,role:`messageAction`,roles:[`messageAction`,`messageActionForeground`,`messageActionHover`]},{id:`message-surface`,label:`Message surface`,role:`messageSurface`,roles:[`messageSurface`,`messageForeground`]},{id:`code-surface`,label:`Code surface`,role:`codeBackground`,roles:[`codeBackground`,`codeForeground`]}]},{id:`search`,title:`Search`,families:[{id:`search-matches`,label:`Search matches`,role:`searchMatchBackground`,roles:[`searchMatchBackground`,`searchMatchForeground`]},{id:`current-match`,label:`Current match`,role:`searchMatchActiveBackground`,roles:[`searchMatchActiveBackground`,`searchMatchActiveForeground`]}]},{id:`context`,title:`Context`,families:[{id:`sidebar-background`,label:`Sidebar background`,role:`sidebar`,roles:[`sidebar`,`sidebarForeground`]},{id:`sidebar-controls`,label:`Sidebar controls`,role:`sidebarControlSurface`,roles:[`sidebarControlSurface`]},{id:`sidebar-selection`,label:`Sidebar selection`,role:`sidebarRowSelected`,roles:[`sidebarRowHover`,`sidebarRowActive`,`sidebarRowSelected`]},{id:`terminal-background`,label:`Terminal background`,role:`terminalBackground`,roles:[`terminalBackground`,`terminalForeground`,`terminalSelection`,`terminalScrollbar`,`terminalScrollbarHover`]}]},{id:`status`,title:`Status`,families:[{id:`error`,label:`Error`,role:`error`,roles:[`error`,`errorForeground`,`errorSurface`]},{id:`warning`,label:`Warning`,role:`warning`,roles:[`warning`,`warningForeground`,`warningSurface`]}]}],Ie=Fe.flatMap(e=>e.families),Le=new Map(Ie.flatMap(e=>e.roles.map(t=>[t,e])));function Re(e){return Le.get(e)??null}function ze(e){return{...T(e)}}function Be(){return{light:ze(`light`),dark:ze(`dark`)}}function Ve(e){return _(e.trim())}function He(e,t){let n=T(e);return E(e,Ve(t.canvas)?t.canvas:n.canvas,Ve(t.accent)?t.accent:n.accent)}function Ue({open:e,onOpenChange:t,onSaved:r,editingTheme:o,initialAppearance:_,seedTheme:v,seedName:w,restoreTheme:T}){let E=o!==null,[A,j]=(0,R.useState)(``),[M,N]=(0,R.useState)(_),[P,F]=(0,R.useState)(!1),[I,ae]=(0,R.useState)(()=>Be()),[V,oe]=(0,R.useState)({light:!1,dark:!1}),[se,ce]=(0,R.useState)(!1),[H,U]=(0,R.useState)(null),[W,ue]=(0,R.useState)(!1),[G,de]=(0,R.useState)(``),[K,fe]=(0,R.useState)(!1),[q,J]=(0,R.useState)(null),[pe,Y]=(0,R.useState)(null),[X,me]=(0,R.useState)(null),[he,ge]=(0,R.useState)(null),Z=(0,R.useRef)(null),ye=(0,R.useRef)(null),xe=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!e)return;let t=()=>{let e,t;ge(n=>n&&(e=Math.max(280,Math.min(n.width,window.innerWidth-16)),t=Math.max(220,Math.min(n.height,window.innerHeight-16)),{width:e,height:t})),me(n=>{if(!n)return n;let r=et(n.x,n.y,e),i=W?Z.current?.offsetHeight??0:t??Z.current?.offsetHeight??0,a=Math.max(8,window.innerHeight-i-8);return{x:r.x,y:Math.min(r.y,a)}})};return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[W,e]);let[Ce,Q]=(0,R.useState)(!1),we=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(e&&!we.current){let e=o??v??null,t=Be(),n=e?S(e,_)?_:e.appearance:_;if(e){t[e.appearance]={...e.colors};for(let n of[`light`,`dark`]){let r=e.variants?.[n];r&&(t[n]={...r})}}j(o?.label??w??``),N(n),F(e!==null&&e.managed!==!0),oe({light:!1,dark:!1}),ce(e!==null&&e.managed!==!0),ae(t),J(null),Y(null),fe(!1),U(null),Q(!0)}!e&&Ce&&Q(!1),we.current=e},[o,_,Ce,e,w,v]);let Te=te(A),Ee=A.trim().toLowerCase(),$=Ee===``?null:ne().find(e=>e.id!==o?.id&&(e.id===Te||e.label.trim().toLowerCase()===Ee))??null,De=$?D($):[],Oe=o?D(o):null,ke=e=>Oe&&!Oe.includes(e)?`“${o?.label}” has no ${e} palette. Create a theme with the same name to add one.`:!E&&De.includes(e)?`“${$?.label}” already has a ${e} palette.`:null,Ae=$?.id??null,Ie=De.join(`,`);(0,R.useEffect)(()=>{if(E||Ae===null)return;let e=Ie.split(`,`).filter(Boolean);e.length===1&&N(t=>e.includes(t)?e[0]===`light`?`dark`:`light`:t)},[E,Ae,Ie]),(0,R.useEffect)(()=>{e&&Ce&&re(I[M],M)},[M,I,Ce,e]),(0,R.useEffect)(()=>{if(e)return()=>{T()}},[e,T]);let Le=(0,R.useCallback)((e,t)=>{ae(n=>{let r={...n[M],[e]:t},i=!P&&Pe.includes(e)&&Ve(t);return{...n,[M]:P?ee(M,n[M],e,t):i?He(M,r):r}}),!P&&Pe.includes(e)&&Ve(t)&&oe(e=>({...e,[M]:!0})),P&&ce(!0)},[M,P]),ze=(0,R.useCallback)((e,t=!1)=>{let n=Re(e)?.role??e;J(n),Pe.includes(n)||(F(!0),de(``)),t&&requestAnimationFrame(()=>{Z.current?.querySelector(`[data-theme-color-role="${n}"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`})})},[]),Ue=(0,R.useCallback)(e=>{J(t=>t===e?null:e)},[]),We=(0,R.useCallback)(()=>{J(null),Y(null),fe(!1)},[]),Ge=(q?P?Re(q)?.roles??[q]:Pe.includes(q)?C.filter(e=>I[M][e].trim().toLowerCase()===I[M][q].trim().toLowerCase()):[q]:[]).join(`,`);(0,R.useEffect)(()=>{if(_e(),!e||q===null){Y(null);return}if(K)return;let t=Ge.split(`,`),n=()=>Y(Me(t));n();let r=null,i=null,a=performance.now(),o=()=>{if(r!==null||i!==null)return;let e=Math.max(0,500-(performance.now()-a)),t=()=>{r=null,i=null,a=performance.now(),n()};e===0?r=requestAnimationFrame(t):i=setTimeout(t,e)},s=new MutationObserver(e=>{e.every(e=>e.target instanceof Element&&(e.target.closest(`#theme-inspector-spotlight`)||e.target.closest(`[data-theme-editor-panel]`)))||o()});s.observe(document.body,{childList:!0,subtree:!0});let c=null,l=()=>{c??=requestAnimationFrame(()=>{c=null,Se()})};return window.addEventListener(`resize`,l),window.addEventListener(`scroll`,l,!0),()=>{s.disconnect(),r!==null&&cancelAnimationFrame(r),i!==null&&clearTimeout(i),c!==null&&cancelAnimationFrame(c),window.removeEventListener(`resize`,l),window.removeEventListener(`scroll`,l,!0),_e()}},[K,e,Ge,q]),(0,R.useEffect)(()=>{if(!e||!K){ve();return}let t=!1,n=null,r=null,i=null,a=null,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{o(),n=null,r=null,ve()},c=e=>{r=e,be(e,Re(e.role)?.label??B(e.role))},l=e=>{let t=e.target;if(!(t instanceof Element)||t.closest(`[data-theme-editor-panel]`)){s();return}o(),n=t,r=null;let a=je(t);if(a){c(a);return}ve(),i=window.setTimeout(()=>{if(i=null,n!==t||!t.isConnected)return;let e=Ne(t);e&&c(e)},140)},u=e=>{e.relatedTarget===null&&s()},d=e=>{let i=e.target;if(!(i instanceof Element)||i.closest(`[data-theme-editor-panel]`))return;e.preventDefault(),e.stopPropagation(),o();let a=n===i&&r?r:Ne(i);a&&(s(),ze(a.role,!0),t=!0)},f=e=>{let n=e.target;n instanceof Element&&!n.closest(`[data-theme-editor-panel]`)&&(e.preventDefault(),e.stopPropagation(),t&&fe(!1),t=!1)},p=e=>{e.key===`Escape`&&(e.preventDefault(),s(),We())},m=()=>{r&&(a??=requestAnimationFrame(()=>{a=null,r&&be(r,Re(r.role)?.label??B(r.role))}))},h=()=>s();return document.addEventListener(`pointerover`,l,!0),document.addEventListener(`pointerout`,u,!0),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`click`,f,!0),document.addEventListener(`keydown`,p,!0),window.addEventListener(`resize`,m),window.addEventListener(`scroll`,h,!0),()=>{document.removeEventListener(`pointerover`,l,!0),document.removeEventListener(`pointerout`,u,!0),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`click`,f,!0),document.removeEventListener(`keydown`,p,!0),window.removeEventListener(`resize`,m),window.removeEventListener(`scroll`,h,!0),o(),a!==null&&cancelAnimationFrame(a),ve()}},[We,K,e,ze]);let Ke=(0,R.useCallback)(e=>{if(F(e),e||(q&&!Pe.includes(q)&&J(null),!se))return;let t=o&&D(o).length>1?[`light`,`dark`]:[M];oe(e=>{let n={...e};for(let e of t)n[e]=!0;return n}),ae(e=>{let n={...e};for(let r of t)n[r]=He(r,e[r]);return n}),ce(!1)},[M,o,q,se]),qe=()=>{if(!A.trim()){U(`Name your theme first.`);return}try{let e=P?I:{light:V.light?He(`light`,I.light):I.light,dark:V.dark?He(`dark`,I.dark):I.dark},n,i=null,a=null;if(o&&$){let t=D(o),r=t.find(e=>De.includes(e));if(r){U(`“${$.label}” already has a ${r} palette. Pick another name.`);return}i=t[0]??null,n=x({...y({version:1,id:$.id,name:$.label,appearance:$.appearance,colors:$.colors,variants:{...$.variants,...Object.fromEntries(t.map(t=>[t,e[t]]))},...$.managed===!0&&!P?{managed:!0}:{}}),...$.collection?{collection:$.collection}:{}}),a=o;try{g(o.id)}catch(e){try{x($)}catch{}throw e}}else if(o){let t=o.appearance,r=t===`light`?`dark`:`light`;n=x({...y({version:1,id:o.id,name:A,appearance:t,colors:e[t],...D(o).length>1?{variants:{[r]:e[r]}}:{},...P?{}:{managed:!0}}),...o.collection?{collection:o.collection}:{}})}else if($){if(De.includes(M)){U(`“${$.label}” already has light and dark palettes. Pick another name.`);return}i=M,n=x({...y({version:1,id:$.id,name:$.label,appearance:$.appearance,colors:$.colors,variants:{...$.variants,[M]:e[M]},...$.managed===!0&&!P?{managed:!0}:{}}),...$.collection?{collection:$.collection}:{}})}else n=b(y({version:1,name:A,appearance:M,colors:e[M],...P?{}:{managed:!0}}));if(!r(n,{created:o===null&&i===null,...i?{mergedAppearance:i}:{}})){if(!o&&i===null)try{g(n.id)}catch{}else if($&&i!==null)try{x($),a&&b(a)}catch{}U(`Theme saved, but it could not be made active. Try again.`);return}t(!1)}catch(e){U(e instanceof Error?e.message:E?`Could not save the theme.`:`Could not create the theme.`)}},Je=()=>(0,z.jsxs)(`label`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Theme name`}),(0,z.jsx)(ie,{autoFocus:!0,size:`sm`,onChange:e=>{j(e.currentTarget.value),U(null)},placeholder:E?`Theme name`:`e.g. Aurora`,value:A})]}),Ye=e=>{let t=ke(e),n=(0,z.jsx)(k,{"aria-disabled":t!==null,value:e,children:e===`light`?`Light`:`Dark`});return t===null?n:(0,z.jsxs)(h,{children:[(0,z.jsx)(u,{render:n}),(0,z.jsx)(p,{children:t})]})},Xe=()=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Appearance`}),(0,z.jsxs)(O,{"aria-label":`Theme appearance`,variant:`segmented`,value:[M],onValueChange:e=>{let t=e[0];(t===`light`||t===`dark`)&&ke(t)===null&&N(t)},children:[Ye(`light`),Ye(`dark`)]})]}),Ze=()=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-start gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Colors`}),P?null:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Two colors, rest derived`})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[P?(0,z.jsx)(ie,{"aria-label":`Filter colors`,className:`min-w-0 flex-1`,onChange:e=>de(e.currentTarget.value),placeholder:`Filter colors`,size:`sm`,value:G}):null,(0,z.jsxs)(`label`,{className:`ml-auto flex shrink-0 cursor-pointer items-center gap-2 pt-0.5 text-sm font-medium`,children:[(0,z.jsx)(`span`,{children:`Advanced`}),(0,z.jsx)(L,{"aria-label":`Use advanced theme colors`,checked:P,onCheckedChange:e=>Ke(!!e)})]})]})]}),Qe=(e,t=`grid gap-2 sm:grid-cols-2`)=>(0,z.jsx)(`div`,{className:t,children:e.map(e=>(0,z.jsx)(le,{label:e.label,onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e.role,selected:q===e.role,value:I[M][e.role]},e.id))}),$e=()=>{let e=G.trim().toLowerCase(),t=Fe.map(t=>({...t,families:t.families.filter(t=>!e||[t.label,...t.roles.map(e=>B(e))].join(` `).toLowerCase().includes(e))})).filter(e=>e.families.length>0);return P?(0,z.jsxs)(`div`,{className:`space-y-5`,children:[t.map(e=>(0,z.jsxs)(`section`,{className:`space-y-2`,children:[(0,z.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:e.title}),Qe(e.families,`grid gap-1`)]},e.id)),t.length===0?(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No matches.`}):null]}):(0,z.jsx)(`div`,{className:`grid gap-1`,children:Pe.map(e=>(0,z.jsx)(le,{onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e,label:e===`canvas`?`Background`:`Accent`,selected:q===e,value:I[M][e]},e))})},et=(e,t,n)=>{let r=Z.current,i=n??r?.offsetWidth??0;return{x:Math.min(Math.max(e,8),Math.max(8,window.innerWidth-i-8)),y:Math.min(Math.max(t,8),Math.max(8,window.innerHeight-48))}},tt=e=>{if(e.target.closest(`button, input, a`))return;let t=Z.current?.getBoundingClientRect();t&&(ye.current={dx:e.clientX-t.x,dy:e.clientY-t.y},e.currentTarget.setPointerCapture(e.pointerId))},nt=e=>{let t=ye.current;t&&me(et(e.clientX-t.dx,e.clientY-t.dy))},rt=()=>{ye.current=null},it=e=>{let t=Z.current?.getBoundingClientRect();t&&(e.preventDefault(),X===null&&me(et(t.x,t.y)),xe.current={pointerX:e.clientX,pointerY:e.clientY,left:t.x,top:t.y,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},at=e=>{let t=xe.current;if(!t)return;let n=Math.max(280,window.innerWidth-8-t.left),r=Math.max(220,window.innerHeight-8-t.top);ge({width:Math.min(Math.max(t.width+e.clientX-t.pointerX,280),n),height:Math.min(Math.max(t.height+e.clientY-t.pointerY,220),r)})},ot=()=>{xe.current=null};return(0,z.jsxs)(`div`,{"aria-label":E?`Edit theme`:`Create theme`,className:c(`dialog-glass fixed z-[110] flex max-h-[min(42rem,calc(100dvh-6rem))] w-[min(26rem,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border text-popover-foreground`,X===null&&`bottom-4 right-4`,W&&`max-h-none`),"data-theme-editor-panel":!0,ref:Z,role:`dialog`,style:{...X?{left:X.x,top:X.y}:{},...he?{width:he.width}:{},...he&&!W?{height:he.height,maxHeight:`calc(100dvh - 1rem)`}:{}},children:[(0,z.jsxs)(`div`,{className:`flex cursor-grab touch-none select-none items-center gap-1 border-b border-border/70 px-3 py-2 active:cursor-grabbing`,onPointerCancel:rt,onPointerDown:tt,onPointerMove:nt,onPointerUp:rt,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,z.jsx)(`h2`,{className:`shrink-0 truncate text-sm font-medium`,children:E?`Edit theme`:`Create theme`}),W?null:(0,z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:K?`Select an element · Esc to cancel`:q?`${P?Re(q)?.label??B(q):B(q)} · ${pe??0} ${pe===1?`use`:`uses`}`:`Select a color below`})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(u,{render:(0,z.jsxs)(s,{"aria-label":K?`Cancel inspecting app colors`:`Inspect app colors`,"aria-pressed":K,size:`xs`,variant:K?`secondary`:`ghost`,onClick:()=>{if(K){We();return}fe(!0)},children:[(0,z.jsx)(i,{}),K?`Cancel`:`Inspect`]})}),(0,z.jsx)(p,{"data-theme-editor-panel":``,children:K?`Cancel and clear the selection`:`Pick a color from the app`})]}),(0,z.jsx)(s,{"aria-label":W?`Expand the theme editor`:`Minimize the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>ue(!W),children:(0,z.jsx)(d,{icon:W?m:f})}),(0,z.jsx)(s,{"aria-label":`Close the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>t(!1),children:(0,z.jsx)(n,{})})]}),W?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-3 pl-3 pr-1.5`,children:[Je(),H?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:H}):null,Xe(),(0,z.jsxs)(`div`,{className:`space-y-3`,children:[Ze(),$e()]})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,z.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(s,{disabled:!A.trim(),size:`sm`,onClick:qe,children:E?$?`Merge into “${$.label}”`:`Save changes`:$?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{}),`Add ${M} palette`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{}),`Create theme`]})})]}),(0,z.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 right-0 z-10 flex size-5 cursor-se-resize touch-none select-none items-end justify-end p-1 text-muted-foreground/70`,onPointerCancel:ot,onPointerDown:it,onPointerMove:at,onPointerUp:ot,children:(0,z.jsx)(`svg`,{className:`size-2.5`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.2`,viewBox:`0 0 8 8`,children:(0,z.jsx)(`path`,{d:`M7 1 1 7M7 4.5 4.5 7`})})})]})]})}export{Ue as ThemeEditorPanel};
5
- //# sourceMappingURL=ThemeEditorPanel-CjUB7HmU.js.map
4
+ `)}}function we(e,t){return ue.filter(n=>e[n]!==t[n])}function Te(e){let t=document.documentElement,n=t.hasAttribute(de);n||t.setAttribute(de,``);try{return e()}finally{window.getComputedStyle(t).color,n||t.removeAttribute(de)}}function Ee(e){let t=document.documentElement,n=w(e),r=t.style.getPropertyValue(n),i=t.style.getPropertyPriority(n),a=r.trim().toLowerCase()===K?fe:K;return t.style.setProperty(n,a,`important`),()=>{r?t.style.setProperty(n,r,i):t.style.removeProperty(n)}}function $(e){let t=e.map(Ee);return()=>{for(let e of t.toReversed())e()}}function De(){return[document.body,...document.body.querySelectorAll(`*`)].filter(e=>!e.closest(`[data-theme-editor-panel]`)&&!e.closest(`#${q}, #${Y}`))}function Oe(e,t){if(e.includes(`:`))return null;for(let n of he[t])if(e.startsWith(n))return me[e.slice(n.length).split(`/`,1)[0]??``]??null;return null}function ke(e){for(let t of ue)for(let n of e.classList){let e=Oe(n,t);if(e)return e}return null}function Ae(e){let t=[],n=e;for(;n&&n!==document.documentElement;)n.closest(`[data-theme-editor-panel]`)||t.push(n),n=n.parentElement;return t}function je(e){if(e.closest(`[data-theme-editor-panel]`))return null;for(let t of Ae(e)){let e=ke(t);if(e)return{element:t,role:e}}return null}function Me(e){performance.now(),ge(G);let t=De(),n=performance.now(),r=Te(()=>{let n=new Map;for(let e of t){let t=Q(e);t&&n.set(e,t)}let r=$(e),i=new Set;try{for(let[e,t]of n){let n=Q(e);n&&we(t,n).length>0&&i.add(e)}}finally{r()}return i});performance.now()-n;let i=new Set;for(let e of r)i.add(e instanceof SVGElement?e.closest(`svg`)??e:e);for(let e of i)e.setAttribute(G,``);return xe([...i]),i.size}function Ne(e){if(e.closest(`[data-theme-editor-panel]`))return null;let t=Ae(e),n=je(e);if(n)return n;let r=Te(()=>{let e=new Map,n=new Map;for(let n of t){let t=Q(n,{forHitTest:!0});t&&e.set(n,t)}for(let t of C){let r=Ee(t);try{for(let[r,i]of e){let e=Q(r,{forHitTest:!0});if(!e)continue;let a=n.get(r)??{};for(let n of we(i,e))a[n]??=t;n.set(r,a)}}finally{r()}}return n});for(let e of t){let t=r.get(e);if(t)for(let n of ue){let r=t[n];if(r)return{element:e,role:r}}}return null}var Pe=[`canvas`,`accent`],Fe=[{id:`foundation`,title:`Foundation`,families:[{id:`background`,label:`Background`,role:`canvas`,roles:[`canvas`,`chrome`,`toolbar`]},{id:`surface`,label:`Surface`,role:`surface`,roles:[`surface`]},{id:`raised-surface`,label:`Raised surface`,role:`surfaceRaised`,roles:[`surfaceRaised`]},{id:`overlay`,label:`Overlay`,role:`surfaceOverlay`,roles:[`surfaceOverlay`]},{id:`text`,label:`Text`,role:`text`,roles:[`text`,`toolbarForeground`,`toolbarControlForeground`]},{id:`muted-text`,label:`Muted text`,role:`mutedForeground`,roles:[`textMuted`,`mutedForeground`,`placeholder`,`secondaryLabel`,`iconMuted`,`sidebarMutedForeground`]},{id:`border`,label:`Border`,role:`border`,roles:[`border`,`toolbarBorder`,`sidebarBorder`]},{id:`input`,label:`Input`,role:`input`,roles:[`input`]}]},{id:`brand-content`,title:`Brand & content`,families:[{id:`subtle-surface`,label:`Subtle surface`,role:`secondary`,roles:[`secondary`,`secondaryForeground`,`muted`,`toolbarControl`]},{id:`highlight-surface`,label:`Highlight surface`,role:`accentSurface`,roles:[`accentSurface`,`accentSurfaceForeground`,`toolbarControlHover`]},{id:`accent`,label:`Accent`,role:`accent`,roles:[`accent`,`accentForeground`,`focus`,`update`,`updateForeground`,`updateSurface`,`terminalCursor`]},{id:`action`,label:`Action`,role:`messageAction`,roles:[`messageAction`,`messageActionForeground`,`messageActionHover`]},{id:`message-surface`,label:`Message surface`,role:`messageSurface`,roles:[`messageSurface`,`messageForeground`]},{id:`code-surface`,label:`Code surface`,role:`codeBackground`,roles:[`codeBackground`,`codeForeground`]}]},{id:`search`,title:`Search`,families:[{id:`search-matches`,label:`Search matches`,role:`searchMatchBackground`,roles:[`searchMatchBackground`,`searchMatchForeground`]},{id:`current-match`,label:`Current match`,role:`searchMatchActiveBackground`,roles:[`searchMatchActiveBackground`,`searchMatchActiveForeground`]}]},{id:`context`,title:`Context`,families:[{id:`sidebar-background`,label:`Sidebar background`,role:`sidebar`,roles:[`sidebar`,`sidebarForeground`]},{id:`sidebar-controls`,label:`Sidebar controls`,role:`sidebarControlSurface`,roles:[`sidebarControlSurface`]},{id:`sidebar-selection`,label:`Sidebar selection`,role:`sidebarRowSelected`,roles:[`sidebarRowHover`,`sidebarRowActive`,`sidebarRowSelected`]},{id:`terminal-background`,label:`Terminal background`,role:`terminalBackground`,roles:[`terminalBackground`,`terminalForeground`,`terminalSelection`,`terminalScrollbar`,`terminalScrollbarHover`]}]},{id:`status`,title:`Status`,families:[{id:`error`,label:`Error`,role:`error`,roles:[`error`,`errorForeground`,`errorSurface`]},{id:`warning`,label:`Warning`,role:`warning`,roles:[`warning`,`warningForeground`,`warningSurface`]}]}],Ie=Fe.flatMap(e=>e.families),Le=new Map(Ie.flatMap(e=>e.roles.map(t=>[t,e])));function Re(e){return Le.get(e)??null}function ze(e){return{...T(e)}}function Be(){return{light:ze(`light`),dark:ze(`dark`)}}function Ve(e){return _(e.trim())}function He(e,t){let n=T(e);return E(e,Ve(t.canvas)?t.canvas:n.canvas,Ve(t.accent)?t.accent:n.accent)}function Ue({open:e,onOpenChange:t,onSaved:r,editingTheme:a,initialAppearance:_,seedTheme:v,seedName:w,restoreTheme:T}){let E=a!==null,[A,j]=(0,R.useState)(``),[M,N]=(0,R.useState)(_),[P,F]=(0,R.useState)(!1),[I,ae]=(0,R.useState)(()=>Be()),[V,oe]=(0,R.useState)({light:!1,dark:!1}),[se,ce]=(0,R.useState)(!1),[H,U]=(0,R.useState)(null),[W,ue]=(0,R.useState)(!1),[G,de]=(0,R.useState)(``),[K,fe]=(0,R.useState)(!1),[q,J]=(0,R.useState)(null),[pe,Y]=(0,R.useState)(null),[X,me]=(0,R.useState)(null),[he,ge]=(0,R.useState)(null),Z=(0,R.useRef)(null),ye=(0,R.useRef)(null),xe=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!e)return;let t=()=>{let e,t;ge(n=>n&&(e=Math.max(280,Math.min(n.width,window.innerWidth-16)),t=Math.max(220,Math.min(n.height,window.innerHeight-16)),{width:e,height:t})),me(n=>{if(!n)return n;let r=et(n.x,n.y,e),i=W?Z.current?.offsetHeight??0:t??Z.current?.offsetHeight??0,a=Math.max(8,window.innerHeight-i-8);return{x:r.x,y:Math.min(r.y,a)}})};return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[W,e]);let[Ce,Q]=(0,R.useState)(!1),we=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(e&&!we.current){let e=a??v??null,t=Be(),n=e?S(e,_)?_:e.appearance:_;if(e){t[e.appearance]={...e.colors};for(let n of[`light`,`dark`]){let r=e.variants?.[n];r&&(t[n]={...r})}}j(a?.label??w??``),N(n),F(e!==null&&e.managed!==!0),oe({light:!1,dark:!1}),ce(e!==null&&e.managed!==!0),ae(t),J(null),Y(null),fe(!1),U(null),Q(!0)}!e&&Ce&&Q(!1),we.current=e},[a,_,Ce,e,w,v]);let Te=te(A),Ee=A.trim().toLowerCase(),$=Ee===``?null:ne().find(e=>e.id!==a?.id&&(e.id===Te||e.label.trim().toLowerCase()===Ee))??null,De=$?D($):[],Oe=a?D(a):null,ke=e=>Oe&&!Oe.includes(e)?`“${a?.label}” has no ${e} palette. Create a theme with the same name to add one.`:!E&&De.includes(e)?`“${$?.label}” already has a ${e} palette.`:null,Ae=$?.id??null,Ie=De.join(`,`);(0,R.useEffect)(()=>{if(E||Ae===null)return;let e=Ie.split(`,`).filter(Boolean);e.length===1&&N(t=>e.includes(t)?e[0]===`light`?`dark`:`light`:t)},[E,Ae,Ie]),(0,R.useEffect)(()=>{e&&Ce&&re(I[M],M)},[M,I,Ce,e]),(0,R.useEffect)(()=>{if(e)return()=>{T()}},[e,T]);let Le=(0,R.useCallback)((e,t)=>{ae(n=>{let r={...n[M],[e]:t},i=!P&&Pe.includes(e)&&Ve(t);return{...n,[M]:P?ee(M,n[M],e,t):i?He(M,r):r}}),!P&&Pe.includes(e)&&Ve(t)&&oe(e=>({...e,[M]:!0})),P&&ce(!0)},[M,P]),ze=(0,R.useCallback)((e,t=!1)=>{let n=Re(e)?.role??e;J(n),Pe.includes(n)||(F(!0),de(``)),t&&requestAnimationFrame(()=>{Z.current?.querySelector(`[data-theme-color-role="${n}"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`})})},[]),Ue=(0,R.useCallback)(e=>{J(t=>t===e?null:e)},[]),We=(0,R.useCallback)(()=>{J(null),Y(null),fe(!1)},[]),Ge=(q?P?Re(q)?.roles??[q]:Pe.includes(q)?C.filter(e=>I[M][e].trim().toLowerCase()===I[M][q].trim().toLowerCase()):[q]:[]).join(`,`);(0,R.useEffect)(()=>{if(_e(),!e||q===null){Y(null);return}if(K)return;let t=Ge.split(`,`),n=()=>Y(Me(t));n();let r=null,i=null,a=performance.now(),o=()=>{if(r!==null||i!==null)return;let e=Math.max(0,500-(performance.now()-a)),t=()=>{r=null,i=null,a=performance.now(),n()};e===0?r=requestAnimationFrame(t):i=setTimeout(t,e)},s=new MutationObserver(e=>{e.every(e=>e.target instanceof Element&&(e.target.closest(`#theme-inspector-spotlight`)||e.target.closest(`[data-theme-editor-panel]`)))||o()});s.observe(document.body,{childList:!0,subtree:!0});let c=null,l=()=>{c??=requestAnimationFrame(()=>{c=null,Se()})};return window.addEventListener(`resize`,l),window.addEventListener(`scroll`,l,!0),()=>{s.disconnect(),r!==null&&cancelAnimationFrame(r),i!==null&&clearTimeout(i),c!==null&&cancelAnimationFrame(c),window.removeEventListener(`resize`,l),window.removeEventListener(`scroll`,l,!0),_e()}},[K,e,Ge,q]),(0,R.useEffect)(()=>{if(!e||!K){ve();return}let t=!1,n=null,r=null,i=null,a=null,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{o(),n=null,r=null,ve()},c=e=>{r=e,be(e,Re(e.role)?.label??B(e.role))},l=e=>{let t=e.target;if(!(t instanceof Element)||t.closest(`[data-theme-editor-panel]`)){s();return}o(),n=t,r=null;let a=je(t);if(a){c(a);return}ve(),i=window.setTimeout(()=>{if(i=null,n!==t||!t.isConnected)return;let e=Ne(t);e&&c(e)},140)},u=e=>{e.relatedTarget===null&&s()},d=e=>{let i=e.target;if(!(i instanceof Element)||i.closest(`[data-theme-editor-panel]`))return;e.preventDefault(),e.stopPropagation(),o();let a=n===i&&r?r:Ne(i);a&&(s(),ze(a.role,!0),t=!0)},f=e=>{let n=e.target;n instanceof Element&&!n.closest(`[data-theme-editor-panel]`)&&(e.preventDefault(),e.stopPropagation(),t&&fe(!1),t=!1)},p=e=>{e.key===`Escape`&&(e.preventDefault(),s(),We())},m=()=>{r&&(a??=requestAnimationFrame(()=>{a=null,r&&be(r,Re(r.role)?.label??B(r.role))}))},h=()=>s();return document.addEventListener(`pointerover`,l,!0),document.addEventListener(`pointerout`,u,!0),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`click`,f,!0),document.addEventListener(`keydown`,p,!0),window.addEventListener(`resize`,m),window.addEventListener(`scroll`,h,!0),()=>{document.removeEventListener(`pointerover`,l,!0),document.removeEventListener(`pointerout`,u,!0),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`click`,f,!0),document.removeEventListener(`keydown`,p,!0),window.removeEventListener(`resize`,m),window.removeEventListener(`scroll`,h,!0),o(),a!==null&&cancelAnimationFrame(a),ve()}},[We,K,e,ze]);let Ke=(0,R.useCallback)(e=>{if(F(e),e||(q&&!Pe.includes(q)&&J(null),!se))return;let t=a&&D(a).length>1?[`light`,`dark`]:[M];oe(e=>{let n={...e};for(let e of t)n[e]=!0;return n}),ae(e=>{let n={...e};for(let r of t)n[r]=He(r,e[r]);return n}),ce(!1)},[M,a,q,se]),qe=()=>{if(!A.trim()){U(`Name your theme first.`);return}try{let e=P?I:{light:V.light?He(`light`,I.light):I.light,dark:V.dark?He(`dark`,I.dark):I.dark},n,i=null,o=null;if(a&&$){let t=D(a),r=t.find(e=>De.includes(e));if(r){U(`“${$.label}” already has a ${r} palette. Pick another name.`);return}i=t[0]??null,n=x({...y({version:1,id:$.id,name:$.label,appearance:$.appearance,colors:$.colors,variants:{...$.variants,...Object.fromEntries(t.map(t=>[t,e[t]]))},...$.managed===!0&&!P?{managed:!0}:{}}),...$.collection?{collection:$.collection}:{}}),o=a;try{g(a.id)}catch(e){try{x($)}catch{}throw e}}else if(a){let t=a.appearance,r=t===`light`?`dark`:`light`;n=x({...y({version:1,id:a.id,name:A,appearance:t,colors:e[t],...D(a).length>1?{variants:{[r]:e[r]}}:{},...P?{}:{managed:!0}}),...a.collection?{collection:a.collection}:{}})}else if($){if(De.includes(M)){U(`“${$.label}” already has light and dark palettes. Pick another name.`);return}i=M,n=x({...y({version:1,id:$.id,name:$.label,appearance:$.appearance,colors:$.colors,variants:{...$.variants,[M]:e[M]},...$.managed===!0&&!P?{managed:!0}:{}}),...$.collection?{collection:$.collection}:{}})}else n=b(y({version:1,name:A,appearance:M,colors:e[M],...P?{}:{managed:!0}}));if(!r(n,{created:a===null&&i===null,...i?{mergedAppearance:i}:{}})){if(!a&&i===null)try{g(n.id)}catch{}else if($&&i!==null)try{x($),o&&b(o)}catch{}U(`Theme saved, but it could not be made active. Try again.`);return}t(!1)}catch(e){U(e instanceof Error?e.message:E?`Could not save the theme.`:`Could not create the theme.`)}},Je=()=>(0,z.jsxs)(`label`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Theme name`}),(0,z.jsx)(ie,{autoFocus:!0,size:`sm`,onChange:e=>{j(e.currentTarget.value),U(null)},placeholder:E?`Theme name`:`e.g. Aurora`,value:A})]}),Ye=e=>{let t=ke(e),n=(0,z.jsx)(k,{"aria-disabled":t!==null,value:e,children:e===`light`?`Light`:`Dark`});return t===null?n:(0,z.jsxs)(h,{children:[(0,z.jsx)(u,{render:n}),(0,z.jsx)(p,{children:t})]})},Xe=()=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Appearance`}),(0,z.jsxs)(O,{"aria-label":`Theme appearance`,variant:`segmented`,value:[M],onValueChange:e=>{let t=e[0];(t===`light`||t===`dark`)&&ke(t)===null&&N(t)},children:[Ye(`light`),Ye(`dark`)]})]}),Ze=()=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-start gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Colors`}),P?null:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Two colors, rest derived`})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[P?(0,z.jsx)(ie,{"aria-label":`Filter colors`,className:`min-w-0 flex-1`,onChange:e=>de(e.currentTarget.value),placeholder:`Filter colors`,size:`sm`,value:G}):null,(0,z.jsxs)(`label`,{className:`ml-auto flex shrink-0 cursor-pointer items-center gap-2 pt-0.5 text-sm font-medium`,children:[(0,z.jsx)(`span`,{children:`Advanced`}),(0,z.jsx)(L,{"aria-label":`Use advanced theme colors`,checked:P,onCheckedChange:e=>Ke(!!e)})]})]})]}),Qe=(e,t=`grid gap-2 sm:grid-cols-2`)=>(0,z.jsx)(`div`,{className:t,children:e.map(e=>(0,z.jsx)(le,{label:e.label,onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e.role,selected:q===e.role,value:I[M][e.role]},e.id))}),$e=()=>{let e=G.trim().toLowerCase(),t=Fe.map(t=>({...t,families:t.families.filter(t=>!e||[t.label,...t.roles.map(e=>B(e))].join(` `).toLowerCase().includes(e))})).filter(e=>e.families.length>0);return P?(0,z.jsxs)(`div`,{className:`space-y-5`,children:[t.map(e=>(0,z.jsxs)(`section`,{className:`space-y-2`,children:[(0,z.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:e.title}),Qe(e.families,`grid gap-1`)]},e.id)),t.length===0?(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No matches.`}):null]}):(0,z.jsx)(`div`,{className:`grid gap-1`,children:Pe.map(e=>(0,z.jsx)(le,{onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e,label:e===`canvas`?`Background`:`Accent`,selected:q===e,value:I[M][e]},e))})},et=(e,t,n)=>{let r=Z.current,i=n??r?.offsetWidth??0;return{x:Math.min(Math.max(e,8),Math.max(8,window.innerWidth-i-8)),y:Math.min(Math.max(t,8),Math.max(8,window.innerHeight-48))}},tt=e=>{if(e.target.closest(`button, input, a`))return;let t=Z.current?.getBoundingClientRect();t&&(ye.current={dx:e.clientX-t.x,dy:e.clientY-t.y},e.currentTarget.setPointerCapture(e.pointerId))},nt=e=>{let t=ye.current;t&&me(et(e.clientX-t.dx,e.clientY-t.dy))},rt=()=>{ye.current=null},it=e=>{let t=Z.current?.getBoundingClientRect();t&&(e.preventDefault(),X===null&&me(et(t.x,t.y)),xe.current={pointerX:e.clientX,pointerY:e.clientY,left:t.x,top:t.y,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},at=e=>{let t=xe.current;if(!t)return;let n=Math.max(280,window.innerWidth-8-t.left),r=Math.max(220,window.innerHeight-8-t.top);ge({width:Math.min(Math.max(t.width+e.clientX-t.pointerX,280),n),height:Math.min(Math.max(t.height+e.clientY-t.pointerY,220),r)})},ot=()=>{xe.current=null};return(0,z.jsxs)(`div`,{"aria-label":E?`Edit theme`:`Create theme`,className:c(`dialog-glass fixed z-[110] flex max-h-[min(42rem,calc(100dvh-6rem))] w-[min(26rem,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border text-popover-foreground`,X===null&&`bottom-4 right-4`,W&&`max-h-none`),"data-theme-editor-panel":!0,ref:Z,role:`dialog`,style:{...X?{left:X.x,top:X.y}:{},...he?{width:he.width}:{},...he&&!W?{height:he.height,maxHeight:`calc(100dvh - 1rem)`}:{}},children:[(0,z.jsxs)(`div`,{className:`flex cursor-grab touch-none select-none items-center gap-1 border-b border-border/70 px-3 py-2 active:cursor-grabbing`,onPointerCancel:rt,onPointerDown:tt,onPointerMove:nt,onPointerUp:rt,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,z.jsx)(`h2`,{className:`shrink-0 truncate text-sm font-medium`,children:E?`Edit theme`:`Create theme`}),W?null:(0,z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:K?`Select an element · Esc to cancel`:q?`${P?Re(q)?.label??B(q):B(q)} · ${pe??0} ${pe===1?`use`:`uses`}`:`Select a color below`})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(u,{render:(0,z.jsxs)(s,{"aria-label":K?`Cancel inspecting app colors`:`Inspect app colors`,"aria-pressed":K,size:`xs`,variant:K?`secondary`:`ghost`,onClick:()=>{if(K){We();return}fe(!0)},children:[(0,z.jsx)(i,{}),K?`Cancel`:`Inspect`]})}),(0,z.jsx)(p,{"data-theme-editor-panel":``,children:K?`Cancel and clear the selection`:`Pick a color from the app`})]}),(0,z.jsx)(s,{"aria-label":W?`Expand the theme editor`:`Minimize the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>ue(!W),children:(0,z.jsx)(d,{icon:W?m:f})}),(0,z.jsx)(s,{"aria-label":`Close the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>t(!1),children:(0,z.jsx)(n,{})})]}),W?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-3 pl-3 pr-1.5`,children:[Je(),H?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:H}):null,Xe(),(0,z.jsxs)(`div`,{className:`space-y-3`,children:[Ze(),$e()]})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,z.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(s,{disabled:!A.trim(),size:`sm`,onClick:qe,children:E?$?`Merge into “${$.label}”`:`Save changes`:$?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{}),`Add ${M} palette`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(o,{}),`Create theme`]})})]}),(0,z.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 right-0 z-10 flex size-5 cursor-se-resize touch-none select-none items-end justify-end p-1 text-muted-foreground/70`,onPointerCancel:ot,onPointerDown:it,onPointerMove:at,onPointerUp:ot,children:(0,z.jsx)(`svg`,{className:`size-2.5`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.2`,viewBox:`0 0 8 8`,children:(0,z.jsx)(`path`,{d:`M7 1 1 7M7 4.5 4.5 7`})})})]})]})}export{Ue as ThemeEditorPanel};
5
+ //# sourceMappingURL=ThemeEditorPanel-CDg13cbU.js.map