termdock 1.4.294 → 1.4.296

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 (335) hide show
  1. package/dist/client/assets/App-BiLjlrk-.js +171 -0
  2. package/dist/client/assets/App-BiLjlrk-.js.br +0 -0
  3. package/dist/client/assets/App-BiLjlrk-.js.gz +0 -0
  4. package/dist/client/assets/{ChangeWalkthroughPanel-D2hm-GX-.js → ChangeWalkthroughPanel-DXprT-7m.js} +1 -1
  5. package/dist/client/assets/ChangeWalkthroughPanel-DXprT-7m.js.br +0 -0
  6. package/dist/client/assets/ChangeWalkthroughPanel-DXprT-7m.js.gz +0 -0
  7. package/dist/client/assets/{DagPlayground-DLmKJylJ.js → DagPlayground-DZcUunT5.js} +1 -1
  8. package/dist/client/assets/DagPlayground-DZcUunT5.js.br +0 -0
  9. package/dist/client/assets/DagPlayground-DZcUunT5.js.gz +0 -0
  10. package/dist/client/assets/{DiffLab-Bje07ujV.js → DiffLab-Brv4DCTb.js} +1 -1
  11. package/dist/client/assets/DiffLab-Brv4DCTb.js.br +0 -0
  12. package/dist/client/assets/DiffLab-Brv4DCTb.js.gz +0 -0
  13. package/dist/client/assets/{DiffReview-CcLHnQu-.js → DiffReview-BuLu1qCi.js} +1 -1
  14. package/dist/client/assets/DiffReview-BuLu1qCi.js.br +0 -0
  15. package/dist/client/assets/DiffReview-BuLu1qCi.js.gz +0 -0
  16. package/dist/client/assets/{DiffReviewLab-CIieaScN.js → DiffReviewLab-DSGamuAD.js} +1 -1
  17. package/dist/client/assets/DiffReviewLab-DSGamuAD.js.br +0 -0
  18. package/dist/client/assets/DiffReviewLab-DSGamuAD.js.gz +0 -0
  19. package/dist/client/assets/{DiffViewer-0nWShFhC.js → DiffViewer-BUCYxg27.js} +1 -1
  20. package/dist/client/assets/DiffViewer-BUCYxg27.js.br +0 -0
  21. package/dist/client/assets/DiffViewer-BUCYxg27.js.gz +0 -0
  22. package/dist/client/assets/{ModelPreview-B2Hrizox.js → ModelPreview-Bnlo-oVE.js} +1 -1
  23. package/dist/client/assets/ModelPreview-Bnlo-oVE.js.br +0 -0
  24. package/dist/client/assets/ModelPreview-Bnlo-oVE.js.gz +0 -0
  25. package/dist/client/assets/{RightSidebar-CiYxOpjs.js → RightSidebar-r_3Lk5Rp.js} +48 -52
  26. package/dist/client/assets/RightSidebar-r_3Lk5Rp.js.br +0 -0
  27. package/dist/client/assets/RightSidebar-r_3Lk5Rp.js.gz +0 -0
  28. package/dist/client/assets/{abnfDiagram-VCTEODGH-BvhG-Int.js → abnfDiagram-VCTEODGH-K6Ppkrbt.js} +1 -1
  29. package/dist/client/assets/abnfDiagram-VCTEODGH-K6Ppkrbt.js.br +0 -0
  30. package/dist/client/assets/abnfDiagram-VCTEODGH-K6Ppkrbt.js.gz +0 -0
  31. package/dist/client/assets/app-CATnTUZF.js +35 -0
  32. package/dist/client/assets/app-CATnTUZF.js.br +0 -0
  33. package/dist/client/assets/app-CATnTUZF.js.gz +0 -0
  34. package/dist/client/assets/{arc-Cfd1r0w4.js → arc-Co2OQqtH.js} +1 -1
  35. package/dist/client/assets/arc-Co2OQqtH.js.br +0 -0
  36. package/dist/client/assets/arc-Co2OQqtH.js.gz +0 -0
  37. package/dist/client/assets/{architectureDiagram-5GKGNRK7-CYcaAY_y.js → architectureDiagram-5GKGNRK7-BQnl7tVF.js} +1 -1
  38. package/dist/client/assets/architectureDiagram-5GKGNRK7-BQnl7tVF.js.br +0 -0
  39. package/dist/client/assets/architectureDiagram-5GKGNRK7-BQnl7tVF.js.gz +0 -0
  40. package/dist/client/assets/{blockDiagram-I7D4REHJ-uGZowYBC.js → blockDiagram-I7D4REHJ-Bm5D5-qq.js} +1 -1
  41. package/dist/client/assets/blockDiagram-I7D4REHJ-Bm5D5-qq.js.br +0 -0
  42. package/dist/client/assets/blockDiagram-I7D4REHJ-Bm5D5-qq.js.gz +0 -0
  43. package/dist/client/assets/{c4Diagram-7LVT6UL2-BuAjHXw2.js → c4Diagram-7LVT6UL2-B9oPpey8.js} +1 -1
  44. package/dist/client/assets/c4Diagram-7LVT6UL2-B9oPpey8.js.br +0 -0
  45. package/dist/client/assets/c4Diagram-7LVT6UL2-B9oPpey8.js.gz +0 -0
  46. package/dist/client/assets/channel-Czv2W4qA.js +1 -0
  47. package/dist/client/assets/{chunk-2Q5K7J3B-DpblcTaf.js → chunk-2Q5K7J3B-TMaWHH0U.js} +1 -1
  48. package/dist/client/assets/{chunk-5VM5RSS4-9DQ9Xhrj.js → chunk-5VM5RSS4-CH7XpknV.js} +1 -1
  49. package/dist/client/assets/{chunk-F27PBJKO-C99DgtYa.js → chunk-F27PBJKO-CJ1rotBe.js} +1 -1
  50. package/dist/client/assets/chunk-F27PBJKO-CJ1rotBe.js.br +0 -0
  51. package/dist/client/assets/chunk-F27PBJKO-CJ1rotBe.js.gz +0 -0
  52. package/dist/client/assets/{chunk-IMKFNOWR-CJs2LWtE.js → chunk-IMKFNOWR-UYKZ5uOG.js} +1 -1
  53. package/dist/client/assets/chunk-IMKFNOWR-UYKZ5uOG.js.br +0 -0
  54. package/dist/client/assets/chunk-IMKFNOWR-UYKZ5uOG.js.gz +0 -0
  55. package/dist/client/assets/{chunk-JWPE2WC7-Bi6NDDYZ.js → chunk-JWPE2WC7-BYL8aXjQ.js} +1 -1
  56. package/dist/client/assets/{chunk-POPQ4Y6H-EDihZ7ei.js → chunk-POPQ4Y6H-C3E8yfU2.js} +1 -1
  57. package/dist/client/assets/{chunk-SVP7TREG-Deb_Pzwv.js → chunk-SVP7TREG-DCTDYa1E.js} +1 -1
  58. package/dist/client/assets/chunk-SVP7TREG-DCTDYa1E.js.br +0 -0
  59. package/dist/client/assets/chunk-SVP7TREG-DCTDYa1E.js.gz +0 -0
  60. package/dist/client/assets/{chunk-TICWLB2K-C6wEoKIF.js → chunk-TICWLB2K-wHiaOsBh.js} +1 -1
  61. package/dist/client/assets/chunk-TICWLB2K-wHiaOsBh.js.br +0 -0
  62. package/dist/client/assets/chunk-TICWLB2K-wHiaOsBh.js.gz +0 -0
  63. package/dist/client/assets/{chunk-XXDRQBXY-DkhA8D3i.js → chunk-XXDRQBXY-D_d479hK.js} +1 -1
  64. package/dist/client/assets/classDiagram-ZZMXUADV-BdvOOL9k.js +1 -0
  65. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BdvOOL9k.js +1 -0
  66. package/dist/client/assets/{cose-bilkent-JH36ORCC-CAImJ8rh.js → cose-bilkent-JH36ORCC-DnhlPBLr.js} +1 -1
  67. package/dist/client/assets/cose-bilkent-JH36ORCC-DnhlPBLr.js.br +0 -0
  68. package/dist/client/assets/cose-bilkent-JH36ORCC-DnhlPBLr.js.gz +0 -0
  69. package/dist/client/assets/{cynefin-OW5HDTMX-D3Egll3y.js → cynefin-OW5HDTMX-BsjzNqJZ.js} +1 -1
  70. package/dist/client/assets/cynefin-OW5HDTMX-BsjzNqJZ.js.br +0 -0
  71. package/dist/client/assets/{cynefin-OW5HDTMX-D3Egll3y.js.gz → cynefin-OW5HDTMX-BsjzNqJZ.js.gz} +0 -0
  72. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-MjvCZkx7.js → cynefinDiagram-5FMLGOSQ-sVUb0zY5.js} +1 -1
  73. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-sVUb0zY5.js.br +0 -0
  74. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-sVUb0zY5.js.gz +0 -0
  75. package/dist/client/assets/{dagre-GXQ25YYZ-CrJn07Be.js → dagre-GXQ25YYZ-YErk8S-c.js} +1 -1
  76. package/dist/client/assets/dagre-GXQ25YYZ-YErk8S-c.js.br +0 -0
  77. package/dist/client/assets/dagre-GXQ25YYZ-YErk8S-c.js.gz +0 -0
  78. package/dist/client/assets/{diagram-S7CK7UJ4-x2YTsmxU.js → diagram-S7CK7UJ4-BaHbV5ho.js} +1 -1
  79. package/dist/client/assets/diagram-S7CK7UJ4-BaHbV5ho.js.br +0 -0
  80. package/dist/client/assets/diagram-S7CK7UJ4-BaHbV5ho.js.gz +0 -0
  81. package/dist/client/assets/{diagram-UQ7AKVKN-D98MzrbS.js → diagram-UQ7AKVKN-BocCYx3V.js} +1 -1
  82. package/dist/client/assets/diagram-UQ7AKVKN-BocCYx3V.js.br +0 -0
  83. package/dist/client/assets/diagram-UQ7AKVKN-BocCYx3V.js.gz +0 -0
  84. package/dist/client/assets/{diagram-VSXAHHWV-DB_ACbg-.js → diagram-VSXAHHWV-ZMTYwWOQ.js} +1 -1
  85. package/dist/client/assets/diagram-VSXAHHWV-ZMTYwWOQ.js.br +0 -0
  86. package/dist/client/assets/diagram-VSXAHHWV-ZMTYwWOQ.js.gz +0 -0
  87. package/dist/client/assets/{diagram-VX7I27RA-Drt4iWsQ.js → diagram-VX7I27RA-xmk_EY1h.js} +1 -1
  88. package/dist/client/assets/diagram-VX7I27RA-xmk_EY1h.js.br +0 -0
  89. package/dist/client/assets/diagram-VX7I27RA-xmk_EY1h.js.gz +0 -0
  90. package/dist/client/assets/{diagram-Z3DM3KII-D8mGxerZ.js → diagram-Z3DM3KII-DKDY_cG6.js} +1 -1
  91. package/dist/client/assets/diagram-Z3DM3KII-DKDY_cG6.js.br +0 -0
  92. package/dist/client/assets/diagram-Z3DM3KII-DKDY_cG6.js.gz +0 -0
  93. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DTYnrl_Q.js → ebnfDiagram-PWID7BFC-C_0z-Jx9.js} +1 -1
  94. package/dist/client/assets/ebnfDiagram-PWID7BFC-C_0z-Jx9.js.br +0 -0
  95. package/dist/client/assets/ebnfDiagram-PWID7BFC-C_0z-Jx9.js.gz +0 -0
  96. package/dist/client/assets/{erDiagram-RLTQ6QDP-ChsNovQf.js → erDiagram-RLTQ6QDP-DHUaG7mt.js} +1 -1
  97. package/dist/client/assets/erDiagram-RLTQ6QDP-DHUaG7mt.js.br +0 -0
  98. package/dist/client/assets/erDiagram-RLTQ6QDP-DHUaG7mt.js.gz +0 -0
  99. package/dist/client/assets/{flowDiagram-HODETNUW-DsFiio6_.js → flowDiagram-HODETNUW-BMNsdMBD.js} +1 -1
  100. package/dist/client/assets/flowDiagram-HODETNUW-BMNsdMBD.js.br +0 -0
  101. package/dist/client/assets/flowDiagram-HODETNUW-BMNsdMBD.js.gz +0 -0
  102. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-BbHyLMqr.js → ganttDiagram-EL5Y4UJY-BH1AiKuF.js} +1 -1
  103. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BH1AiKuF.js.br +0 -0
  104. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BH1AiKuF.js.gz +0 -0
  105. package/dist/client/assets/{gestureArbiter-3rZyzlwR.js → gestureArbiter-DvupkPra.js} +1 -1
  106. package/dist/client/assets/gestureArbiter-DvupkPra.js.br +0 -0
  107. package/dist/client/assets/gestureArbiter-DvupkPra.js.gz +0 -0
  108. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-CTPZoYHy.js → gitGraphDiagram-WWUBYQGX-DAgV0MV-.js} +1 -1
  109. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-DAgV0MV-.js.br +0 -0
  110. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-DAgV0MV-.js.gz +0 -0
  111. package/dist/client/assets/{index-DxhkHH1u.css → index-Bi9A6QUP.css} +1 -1
  112. package/dist/client/assets/index-Bi9A6QUP.css.br +0 -0
  113. package/dist/client/assets/index-Bi9A6QUP.css.gz +0 -0
  114. package/dist/client/assets/{infoDiagram-27XIBGKW-DqG9-3Dv.js → infoDiagram-27XIBGKW-C7iSg0cB.js} +1 -1
  115. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-C7BUr6Q1.js → ishikawaDiagram-5VMMS53U-BpZwsQvw.js} +1 -1
  116. package/dist/client/assets/ishikawaDiagram-5VMMS53U-BpZwsQvw.js.br +0 -0
  117. package/dist/client/assets/ishikawaDiagram-5VMMS53U-BpZwsQvw.js.gz +0 -0
  118. package/dist/client/assets/{journeyDiagram-3NMN7TZE-DeKgSie7.js → journeyDiagram-3NMN7TZE-DXEeFLvw.js} +1 -1
  119. package/dist/client/assets/journeyDiagram-3NMN7TZE-DXEeFLvw.js.br +0 -0
  120. package/dist/client/assets/journeyDiagram-3NMN7TZE-DXEeFLvw.js.gz +0 -0
  121. package/dist/client/assets/{kanban-definition-UXKFOSKX-BXLMRLCs.js → kanban-definition-UXKFOSKX-CV9ivL5u.js} +1 -1
  122. package/dist/client/assets/kanban-definition-UXKFOSKX-CV9ivL5u.js.br +0 -0
  123. package/dist/client/assets/kanban-definition-UXKFOSKX-CV9ivL5u.js.gz +0 -0
  124. package/dist/client/assets/{layout-BIGVsIVB.js → layout-DsKKsJKX.js} +1 -1
  125. package/dist/client/assets/layout-DsKKsJKX.js.br +0 -0
  126. package/dist/client/assets/layout-DsKKsJKX.js.gz +0 -0
  127. package/dist/client/assets/{linear-BhqHS_Ls.js → linear-Dl9MDNV3.js} +1 -1
  128. package/dist/client/assets/linear-Dl9MDNV3.js.br +0 -0
  129. package/dist/client/assets/linear-Dl9MDNV3.js.gz +0 -0
  130. package/dist/client/assets/{mermaid.core-DYTWj2Pu.js → mermaid.core-CxZFe3as.js} +5 -5
  131. package/dist/client/assets/mermaid.core-CxZFe3as.js.br +0 -0
  132. package/dist/client/assets/mermaid.core-CxZFe3as.js.gz +0 -0
  133. package/dist/client/assets/{mindmap-definition-YA3MSWOX-BKVI5pEJ.js → mindmap-definition-YA3MSWOX-C3ormYdL.js} +2 -2
  134. package/dist/client/assets/mindmap-definition-YA3MSWOX-C3ormYdL.js.br +0 -0
  135. package/dist/client/assets/mindmap-definition-YA3MSWOX-C3ormYdL.js.gz +0 -0
  136. package/dist/client/assets/{passwordBootstrap-DyrBaUP8.js → passwordBootstrap-a8z6jJNY.js} +2 -2
  137. package/dist/client/assets/passwordBootstrap-a8z6jJNY.js.br +0 -0
  138. package/dist/client/assets/passwordBootstrap-a8z6jJNY.js.gz +0 -0
  139. package/dist/client/assets/{pegDiagram-XKGWAZYB-DdRPwDgf.js → pegDiagram-XKGWAZYB-CG0wNylH.js} +1 -1
  140. package/dist/client/assets/pegDiagram-XKGWAZYB-CG0wNylH.js.br +0 -0
  141. package/dist/client/assets/pegDiagram-XKGWAZYB-CG0wNylH.js.gz +0 -0
  142. package/dist/client/assets/{pieDiagram-E7YTZNPT-KzblsFOl.js → pieDiagram-E7YTZNPT-D2-ydqyX.js} +1 -1
  143. package/dist/client/assets/pieDiagram-E7YTZNPT-D2-ydqyX.js.br +0 -0
  144. package/dist/client/assets/pieDiagram-E7YTZNPT-D2-ydqyX.js.gz +0 -0
  145. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Co2Mu1vo.js → quadrantDiagram-AXDQQJYC-CK3fRC18.js} +1 -1
  146. package/dist/client/assets/quadrantDiagram-AXDQQJYC-CK3fRC18.js.br +0 -0
  147. package/dist/client/assets/quadrantDiagram-AXDQQJYC-CK3fRC18.js.gz +0 -0
  148. package/dist/client/assets/{railroadDiagram-O6MQD6OU-DjvJ0Ysn.js → railroadDiagram-O6MQD6OU-V4EFlydu.js} +1 -1
  149. package/dist/client/assets/railroadDiagram-O6MQD6OU-V4EFlydu.js.br +0 -0
  150. package/dist/client/assets/railroadDiagram-O6MQD6OU-V4EFlydu.js.gz +0 -0
  151. package/dist/client/assets/{referenceLongPress-VL4F6lii.js → referenceLongPress-BjmYd1vB.js} +1 -1
  152. package/dist/client/assets/referenceLongPress-BjmYd1vB.js.br +0 -0
  153. package/dist/client/assets/referenceLongPress-BjmYd1vB.js.gz +0 -0
  154. package/dist/client/assets/{requirementDiagram-BXWQKSXE-QJ6afxsR.js → requirementDiagram-BXWQKSXE-Di1_tyAX.js} +1 -1
  155. package/dist/client/assets/{requirementDiagram-BXWQKSXE-QJ6afxsR.js.br → requirementDiagram-BXWQKSXE-Di1_tyAX.js.br} +0 -0
  156. package/dist/client/assets/requirementDiagram-BXWQKSXE-Di1_tyAX.js.gz +0 -0
  157. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-CYd9OO8p.js → sankeyDiagram-P5KCCOFB-D-qpWNza.js} +1 -1
  158. package/dist/client/assets/sankeyDiagram-P5KCCOFB-D-qpWNza.js.br +0 -0
  159. package/dist/client/assets/sankeyDiagram-P5KCCOFB-D-qpWNza.js.gz +0 -0
  160. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-Cau471RQ.js → sequenceDiagram-WJ2MYXX4-DmIxafrB.js} +1 -1
  161. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-DmIxafrB.js.br +0 -0
  162. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-DmIxafrB.js.gz +0 -0
  163. package/dist/client/assets/{sizeCapture-INFHLROL-CWBvI9Ex.js → sizeCapture-INFHLROL-4MTh3tTt.js} +1 -1
  164. package/dist/client/assets/sizeCapture-INFHLROL-4MTh3tTt.js.br +0 -0
  165. package/dist/client/assets/sizeCapture-INFHLROL-4MTh3tTt.js.gz +0 -0
  166. package/dist/client/assets/{sparkles-BpYEa9ns.js → sparkles-Dk93lHg0.js} +1 -1
  167. package/dist/client/assets/{stateDiagram-D77RDMKH-ih47Vg8d.js → stateDiagram-D77RDMKH-CgYgneIv.js} +1 -1
  168. package/dist/client/assets/stateDiagram-D77RDMKH-CgYgneIv.js.br +0 -0
  169. package/dist/client/assets/stateDiagram-D77RDMKH-CgYgneIv.js.gz +0 -0
  170. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CvPf0fxf.js +1 -0
  171. package/dist/client/assets/{swimlanes-42K2YHIH-Cks23MF4.js → swimlanes-42K2YHIH-OWA9HFVf.js} +1 -1
  172. package/dist/client/assets/swimlanes-42K2YHIH-OWA9HFVf.js.br +0 -0
  173. package/dist/client/assets/swimlanes-42K2YHIH-OWA9HFVf.js.gz +0 -0
  174. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CZ_OauyW.js +8 -0
  175. package/dist/client/assets/{timeline-definition-24CTP7MA-C3Z6mGRy.js → timeline-definition-24CTP7MA-BAzx5DyO.js} +1 -1
  176. package/dist/client/assets/timeline-definition-24CTP7MA-BAzx5DyO.js.br +0 -0
  177. package/dist/client/assets/timeline-definition-24CTP7MA-BAzx5DyO.js.gz +0 -0
  178. package/dist/client/assets/{triangle-alert-onS3H-d9.js → triangle-alert-CUIBOwqW.js} +1 -1
  179. package/dist/client/assets/{vennDiagram-4TSXK5OY-9GLhPNes.js → vennDiagram-4TSXK5OY-CBZ-PhTQ.js} +1 -1
  180. package/dist/client/assets/{vennDiagram-4TSXK5OY-9GLhPNes.js.br → vennDiagram-4TSXK5OY-CBZ-PhTQ.js.br} +0 -0
  181. package/dist/client/assets/vennDiagram-4TSXK5OY-CBZ-PhTQ.js.gz +0 -0
  182. package/dist/client/assets/{videoCompression-KoXLuxZT.js → videoCompression-BCnqCkRK.js} +1 -1
  183. package/dist/client/assets/videoCompression-BCnqCkRK.js.br +0 -0
  184. package/dist/client/assets/videoCompression-BCnqCkRK.js.gz +0 -0
  185. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-BsZeAlBb.js → wardleyDiagram-VM6X3IG4-DbWzC6l5.js} +1 -1
  186. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DbWzC6l5.js.br +0 -0
  187. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DbWzC6l5.js.gz +0 -0
  188. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-BRT0eEuC.js → xychartDiagram-S5SC5T6Z-BmApnTWE.js} +1 -1
  189. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BmApnTWE.js.br +0 -0
  190. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BmApnTWE.js.gz +0 -0
  191. package/dist/client/index.html +2 -2
  192. package/dist/client/index.html.br +0 -0
  193. package/dist/client/index.html.gz +0 -0
  194. package/dist/client/sw.js +1 -1
  195. package/dist/client/sw.js.br +0 -0
  196. package/dist/client/sw.js.gz +0 -0
  197. package/dist/server/agent/collaborationCli.js +45 -4
  198. package/dist/server/agent/collaborationDeliveryWorker.js +1 -1
  199. package/dist/server/agent/collaborationPeerTransport.js +8 -2
  200. package/dist/server/agent/collaborationRoutes.js +18 -2
  201. package/dist/server/agent/collaborationService.js +43 -1
  202. package/dist/server/agent/collaborationTaskBundles.js +121 -0
  203. package/dist/server/agent/collaborationTaskCli.js +54 -0
  204. package/dist/server/agent/collaborationTaskRoutes.js +58 -0
  205. package/dist/server/agent/collaborationTaskService.js +355 -0
  206. package/dist/server/agent/collaborationTaskStore.js +773 -0
  207. package/dist/server/agent/collaborationTaskTypes.js +1 -0
  208. package/dist/server/agent/collaborationTaskWorkspace.js +100 -0
  209. package/dist/server/entry.js +11 -1
  210. package/dist/server/federation/runtime.js +6 -1
  211. package/dist/server/routes/terminal.js +66 -2
  212. package/package.json +1 -1
  213. package/runtime-manifest.json +3 -3
  214. package/dist/client/assets/App-CDGrOo_r.js +0 -158
  215. package/dist/client/assets/App-CDGrOo_r.js.br +0 -0
  216. package/dist/client/assets/App-CDGrOo_r.js.gz +0 -0
  217. package/dist/client/assets/ChangeWalkthroughPanel-D2hm-GX-.js.br +0 -0
  218. package/dist/client/assets/ChangeWalkthroughPanel-D2hm-GX-.js.gz +0 -0
  219. package/dist/client/assets/DagPlayground-DLmKJylJ.js.br +0 -0
  220. package/dist/client/assets/DagPlayground-DLmKJylJ.js.gz +0 -0
  221. package/dist/client/assets/DiffLab-Bje07ujV.js.br +0 -0
  222. package/dist/client/assets/DiffLab-Bje07ujV.js.gz +0 -0
  223. package/dist/client/assets/DiffReview-CcLHnQu-.js.br +0 -0
  224. package/dist/client/assets/DiffReview-CcLHnQu-.js.gz +0 -0
  225. package/dist/client/assets/DiffReviewLab-CIieaScN.js.br +0 -0
  226. package/dist/client/assets/DiffReviewLab-CIieaScN.js.gz +0 -0
  227. package/dist/client/assets/DiffViewer-0nWShFhC.js.br +0 -0
  228. package/dist/client/assets/DiffViewer-0nWShFhC.js.gz +0 -0
  229. package/dist/client/assets/ModelPreview-B2Hrizox.js.br +0 -0
  230. package/dist/client/assets/ModelPreview-B2Hrizox.js.gz +0 -0
  231. package/dist/client/assets/RightSidebar-CiYxOpjs.js.br +0 -0
  232. package/dist/client/assets/RightSidebar-CiYxOpjs.js.gz +0 -0
  233. package/dist/client/assets/abnfDiagram-VCTEODGH-BvhG-Int.js.br +0 -0
  234. package/dist/client/assets/abnfDiagram-VCTEODGH-BvhG-Int.js.gz +0 -0
  235. package/dist/client/assets/app-CjvwGDVy.js +0 -35
  236. package/dist/client/assets/app-CjvwGDVy.js.br +0 -0
  237. package/dist/client/assets/app-CjvwGDVy.js.gz +0 -0
  238. package/dist/client/assets/arc-Cfd1r0w4.js.br +0 -0
  239. package/dist/client/assets/arc-Cfd1r0w4.js.gz +0 -0
  240. package/dist/client/assets/architectureDiagram-5GKGNRK7-CYcaAY_y.js.br +0 -0
  241. package/dist/client/assets/architectureDiagram-5GKGNRK7-CYcaAY_y.js.gz +0 -0
  242. package/dist/client/assets/blockDiagram-I7D4REHJ-uGZowYBC.js.br +0 -0
  243. package/dist/client/assets/blockDiagram-I7D4REHJ-uGZowYBC.js.gz +0 -0
  244. package/dist/client/assets/c4Diagram-7LVT6UL2-BuAjHXw2.js.br +0 -0
  245. package/dist/client/assets/c4Diagram-7LVT6UL2-BuAjHXw2.js.gz +0 -0
  246. package/dist/client/assets/channel-klM1FsDR.js +0 -1
  247. package/dist/client/assets/chunk-F27PBJKO-C99DgtYa.js.br +0 -0
  248. package/dist/client/assets/chunk-F27PBJKO-C99DgtYa.js.gz +0 -0
  249. package/dist/client/assets/chunk-IMKFNOWR-CJs2LWtE.js.br +0 -0
  250. package/dist/client/assets/chunk-IMKFNOWR-CJs2LWtE.js.gz +0 -0
  251. package/dist/client/assets/chunk-SVP7TREG-Deb_Pzwv.js.br +0 -0
  252. package/dist/client/assets/chunk-SVP7TREG-Deb_Pzwv.js.gz +0 -0
  253. package/dist/client/assets/chunk-TICWLB2K-C6wEoKIF.js.br +0 -0
  254. package/dist/client/assets/chunk-TICWLB2K-C6wEoKIF.js.gz +0 -0
  255. package/dist/client/assets/classDiagram-ZZMXUADV-Ccewxt_X.js +0 -1
  256. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Ccewxt_X.js +0 -1
  257. package/dist/client/assets/cose-bilkent-JH36ORCC-CAImJ8rh.js.br +0 -0
  258. package/dist/client/assets/cose-bilkent-JH36ORCC-CAImJ8rh.js.gz +0 -0
  259. package/dist/client/assets/cynefin-OW5HDTMX-D3Egll3y.js.br +0 -0
  260. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-MjvCZkx7.js.br +0 -0
  261. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-MjvCZkx7.js.gz +0 -0
  262. package/dist/client/assets/dagre-GXQ25YYZ-CrJn07Be.js.br +0 -0
  263. package/dist/client/assets/dagre-GXQ25YYZ-CrJn07Be.js.gz +0 -0
  264. package/dist/client/assets/diagram-S7CK7UJ4-x2YTsmxU.js.br +0 -0
  265. package/dist/client/assets/diagram-S7CK7UJ4-x2YTsmxU.js.gz +0 -0
  266. package/dist/client/assets/diagram-UQ7AKVKN-D98MzrbS.js.br +0 -0
  267. package/dist/client/assets/diagram-UQ7AKVKN-D98MzrbS.js.gz +0 -0
  268. package/dist/client/assets/diagram-VSXAHHWV-DB_ACbg-.js.br +0 -0
  269. package/dist/client/assets/diagram-VSXAHHWV-DB_ACbg-.js.gz +0 -0
  270. package/dist/client/assets/diagram-VX7I27RA-Drt4iWsQ.js.br +0 -0
  271. package/dist/client/assets/diagram-VX7I27RA-Drt4iWsQ.js.gz +0 -0
  272. package/dist/client/assets/diagram-Z3DM3KII-D8mGxerZ.js.br +0 -0
  273. package/dist/client/assets/diagram-Z3DM3KII-D8mGxerZ.js.gz +0 -0
  274. package/dist/client/assets/ebnfDiagram-PWID7BFC-DTYnrl_Q.js.br +0 -0
  275. package/dist/client/assets/ebnfDiagram-PWID7BFC-DTYnrl_Q.js.gz +0 -0
  276. package/dist/client/assets/erDiagram-RLTQ6QDP-ChsNovQf.js.br +0 -0
  277. package/dist/client/assets/erDiagram-RLTQ6QDP-ChsNovQf.js.gz +0 -0
  278. package/dist/client/assets/flowDiagram-HODETNUW-DsFiio6_.js.br +0 -0
  279. package/dist/client/assets/flowDiagram-HODETNUW-DsFiio6_.js.gz +0 -0
  280. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BbHyLMqr.js.br +0 -0
  281. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BbHyLMqr.js.gz +0 -0
  282. package/dist/client/assets/gestureArbiter-3rZyzlwR.js.br +0 -0
  283. package/dist/client/assets/gestureArbiter-3rZyzlwR.js.gz +0 -0
  284. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CTPZoYHy.js.br +0 -0
  285. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CTPZoYHy.js.gz +0 -0
  286. package/dist/client/assets/index-DxhkHH1u.css.br +0 -0
  287. package/dist/client/assets/index-DxhkHH1u.css.gz +0 -0
  288. package/dist/client/assets/ishikawaDiagram-5VMMS53U-C7BUr6Q1.js.br +0 -0
  289. package/dist/client/assets/ishikawaDiagram-5VMMS53U-C7BUr6Q1.js.gz +0 -0
  290. package/dist/client/assets/journeyDiagram-3NMN7TZE-DeKgSie7.js.br +0 -0
  291. package/dist/client/assets/journeyDiagram-3NMN7TZE-DeKgSie7.js.gz +0 -0
  292. package/dist/client/assets/kanban-definition-UXKFOSKX-BXLMRLCs.js.br +0 -0
  293. package/dist/client/assets/kanban-definition-UXKFOSKX-BXLMRLCs.js.gz +0 -0
  294. package/dist/client/assets/layout-BIGVsIVB.js.br +0 -0
  295. package/dist/client/assets/layout-BIGVsIVB.js.gz +0 -0
  296. package/dist/client/assets/linear-BhqHS_Ls.js.br +0 -0
  297. package/dist/client/assets/linear-BhqHS_Ls.js.gz +0 -0
  298. package/dist/client/assets/mermaid.core-DYTWj2Pu.js.br +0 -0
  299. package/dist/client/assets/mermaid.core-DYTWj2Pu.js.gz +0 -0
  300. package/dist/client/assets/mindmap-definition-YA3MSWOX-BKVI5pEJ.js.br +0 -0
  301. package/dist/client/assets/mindmap-definition-YA3MSWOX-BKVI5pEJ.js.gz +0 -0
  302. package/dist/client/assets/passwordBootstrap-DyrBaUP8.js.br +0 -0
  303. package/dist/client/assets/passwordBootstrap-DyrBaUP8.js.gz +0 -0
  304. package/dist/client/assets/pegDiagram-XKGWAZYB-DdRPwDgf.js.br +0 -0
  305. package/dist/client/assets/pegDiagram-XKGWAZYB-DdRPwDgf.js.gz +0 -0
  306. package/dist/client/assets/pieDiagram-E7YTZNPT-KzblsFOl.js.br +0 -0
  307. package/dist/client/assets/pieDiagram-E7YTZNPT-KzblsFOl.js.gz +0 -0
  308. package/dist/client/assets/quadrantDiagram-AXDQQJYC-Co2Mu1vo.js.br +0 -0
  309. package/dist/client/assets/quadrantDiagram-AXDQQJYC-Co2Mu1vo.js.gz +0 -0
  310. package/dist/client/assets/railroadDiagram-O6MQD6OU-DjvJ0Ysn.js.br +0 -0
  311. package/dist/client/assets/railroadDiagram-O6MQD6OU-DjvJ0Ysn.js.gz +0 -0
  312. package/dist/client/assets/referenceLongPress-VL4F6lii.js.br +0 -0
  313. package/dist/client/assets/referenceLongPress-VL4F6lii.js.gz +0 -0
  314. package/dist/client/assets/requirementDiagram-BXWQKSXE-QJ6afxsR.js.gz +0 -0
  315. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CYd9OO8p.js.br +0 -0
  316. package/dist/client/assets/sankeyDiagram-P5KCCOFB-CYd9OO8p.js.gz +0 -0
  317. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Cau471RQ.js.br +0 -0
  318. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Cau471RQ.js.gz +0 -0
  319. package/dist/client/assets/sizeCapture-INFHLROL-CWBvI9Ex.js.br +0 -0
  320. package/dist/client/assets/sizeCapture-INFHLROL-CWBvI9Ex.js.gz +0 -0
  321. package/dist/client/assets/stateDiagram-D77RDMKH-ih47Vg8d.js.br +0 -0
  322. package/dist/client/assets/stateDiagram-D77RDMKH-ih47Vg8d.js.gz +0 -0
  323. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D0ybQxyy.js +0 -1
  324. package/dist/client/assets/swimlanes-42K2YHIH-Cks23MF4.js.br +0 -0
  325. package/dist/client/assets/swimlanes-42K2YHIH-Cks23MF4.js.gz +0 -0
  326. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CTe40kKh.js +0 -8
  327. package/dist/client/assets/timeline-definition-24CTP7MA-C3Z6mGRy.js.br +0 -0
  328. package/dist/client/assets/timeline-definition-24CTP7MA-C3Z6mGRy.js.gz +0 -0
  329. package/dist/client/assets/vennDiagram-4TSXK5OY-9GLhPNes.js.gz +0 -0
  330. package/dist/client/assets/videoCompression-KoXLuxZT.js.br +0 -0
  331. package/dist/client/assets/videoCompression-KoXLuxZT.js.gz +0 -0
  332. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BsZeAlBb.js.br +0 -0
  333. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BsZeAlBb.js.gz +0 -0
  334. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BRT0eEuC.js.br +0 -0
  335. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BRT0eEuC.js.gz +0 -0
@@ -0,0 +1,171 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/videoCompression-BCnqCkRK.js","assets/app-CATnTUZF.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-Bi9A6QUP.css","assets/RightSidebar-r_3Lk5Rp.js","assets/gestureArbiter-DvupkPra.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-BuLu1qCi.js","assets/sparkles-Dk93lHg0.js","assets/DiffViewer-BUCYxg27.js","assets/referenceLongPress-BjmYd1vB.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-CUIBOwqW.js","assets/ChangeWalkthroughPanel-DXprT-7m.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
2
+ import{a9 as Kt,cY as Qr,w as N7,bn as i,a5 as p0,d3 as Vo,cV as ha,cX as Xn,aV as vl,a0 as yd,cA as R7,cW as Zu,cl as Ah,a_ as ko,i as Eu,a8 as n0,cc as If,cI as M7,al as Gc,bm as mu,f as D7,cv as th,N as j7,b3 as Hp,bw as Wp,cr as B7,ar as Q7,c6 as P7,Z as lb,c4 as O7,cp as cb,a3 as F7,aa as $7,L as Nn,C as Mi,X as Kn,e as U7,c as Jo,b8 as z7,aU as Gp,d1 as Kr,bv as Fm,d0 as Zt,aw as H7,d8 as W7,r as G7,bC as V7,bQ as q7,bG as Y7,cn as eg,co as tg,cq as rg,W as ng,bP as Z7,cB as K7,p as Ef,cU as X7,_ as rh,b1 as J7,h as e8,aS as qo,T as Ro,c$ as t8,c7 as r8,ah as n8,ae as Th,aQ as s8,bN as i8,bO as a8,P as ub,V as sg,bD as o8,bp as db,l as Os,aF as Nu,O as nh,cJ as Nf,bu as hb,c_ as l8,b7 as Ko,d5 as c8,B as Wl,d as yc,q as u8,ad as d8,G as Vp,ci as h8,g as wl,bi as f8,bj as p8,aj as fb,au as pb,$ as qp,aC as m8,a as Ch,a7 as g8,cS as x8,bT as s0,cH as mb,bq as b8,bs as gb,k as sh,bU as y8,cs as v8,cd as w8,bS as A8,ap as ig,a1 as Gl,ca as T8,bt as ag,cg as fc,cm as C8,bX as Yp,cF as S8,c8 as _8,bW as L8,cj as k8,bF as I8,bE as xb,cf as E8,ct as N8,cu as R8,aq as M8,br as og,aA as D8,aT as j8,D as B8,az as lg,by as Q8,bY as bb,m as P8,S as O8,bB as F8,bz as $8,bV as U8,ck as z8,n as H8,bR as W8,an as G8,at as V8,av as q8,b2 as M0,bc as Y8,cP as Z8,bd as K8,ai as X8,cR as J8,I as ew,ac as tw,a6 as rw,A as nw,b0 as sw,ak as iw,M as aw,d2 as ow,bH as ec,aZ as lw,aW as cw,aX as uw,aY as dw,aO as Rf,bI as hw,c0 as fw,c9 as pw,a$ as mw,aR as gw,cG as cg,ag as xw,a2 as bw,K as yw,cN as vw,d6 as $n,cD as ww,aN as Aw,b4 as ug,b$ as Tw,cz as vd,cM as D0,cQ as Cw,c1 as Sw,cE as _w,cw as Lw,cL as Mf,cx as kw,cy as Iw,cZ as Ew,af as Nw,ch as j0,x as Rw,bx as Mw,bl as wd,bk as Dw,bZ as dg,c2 as jw,b_ as Nc,c3 as Bw,Y as Qw,a4 as Pw,o as Ow}from"./app-CATnTUZF.js";import{b,R as C,r as Ai,a as Fw}from"./dnd-BCFAPC0L.js";import{b as $w,c as Uw,F as vc,S as zw,e as Hw,h as Ww,r as Gw,y as Vw,d as qw,u as Yw}from"./gestureArbiter-DvupkPra.js";import{L as Zw,l as Kw}from"./terminal-C7X98Amf.js";import{T as yb,L as i0,M as Xw,G as Jw,C as hg}from"./triangle-alert-CUIBOwqW.js";import{r as e9}from"./react-XDCjal2T.js";import{u as $m,G as t9}from"./referenceLongPress-BjmYd1vB.js";const r9=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],n9=Kt("arrow-down-a-z",r9);const s9=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],i9=Kt("arrow-down",s9);const a9=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vb=Kt("arrow-up",a9);const o9=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],wb=Kt("bell",o9);const l9=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Ku=Kt("bot",l9);const c9=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],u9=Kt("box",c9);const d9=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],h9=Kt("cable",d9);const f9=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],p9=Kt("calendar-clock",f9);const m9=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],g9=Kt("camera",m9);const x9=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]],b9=Kt("chart-bar",x9);const y9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],v9=Kt("circle-dot",y9);const w9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Sh=Kt("circle-question-mark",w9);const A9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],T9=Kt("circle",A9);const C9=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],S9=Kt("clipboard-paste",C9);const _9=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Ab=Kt("clipboard",_9);const L9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],Ru=Kt("clock-3",L9);const k9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],I9=Kt("clock",k9);const E9=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],N9=Kt("code",E9);const R9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],xl=Kt("columns-2",R9);const M9=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],D9=Kt("corner-down-left",M9);const j9=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Mu=Kt("download",j9);const B9=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Xu=Kt("external-link",B9);const Q9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],P9=Kt("file-code",Q9);const O9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],F9=Kt("file-up",O9);const $9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Tb=Kt("file",$9);const U9=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Jc=Kt("folder-open",U9);const z9=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],Um=Kt("folder-search",z9);const H9=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],W9=Kt("folder-tree",H9);const G9=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],fg=Kt("grid-2x2",G9);const V9=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Zh=Kt("grip-vertical",V9);const q9=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Y9=Kt("hash",q9);const Z9=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],uc=Kt("history",Z9);const K9=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],X9=Kt("house",K9);const J9=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Cb=Kt("keyboard",J9);const eA=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Sb=Kt("layers",eA);const tA=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],a0=Kt("layout-grid",tA);const rA=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],nA=Kt("maximize",rA);const sA=[["path",{d:"M5 12h14",key:"1ays0h"}]],_b=Kt("minus",sA);const iA=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],aA=Kt("minimize",iA);const oA=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],lA=Kt("monitor-smartphone",oA);const cA=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],uA=Kt("moon",cA);const dA=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],hA=Kt("move",dA);const fA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],pA=Kt("panel-right-close",fA);const mA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],gA=Kt("panel-left",mA);const xA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],bA=Kt("panel-right-open",xA);const yA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Lb=Kt("panel-right",yA);const vA=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],wA=Kt("pause",vA);const AA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],TA=Kt("pen-line",AA);const CA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],SA=Kt("pencil-line",CA);const _A=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Du=Kt("pin",_A);const LA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],ju=Kt("pin-off",LA);const kA=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Zp=Kt("play",kA);const IA=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],EA=Kt("plug",IA);const NA=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],RA=Kt("power",NA);const MA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Jn=Kt("refresh-cw",MA);const DA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],kb=Kt("rotate-ccw",DA);const jA=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],BA=Kt("rotate-cw",jA);const QA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],pg=Kt("rows-2",QA);const PA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o0=Kt("search",PA);const OA=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],FA=Kt("send",OA);const $A=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],UA=Kt("settings",$A);const zA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],HA=Kt("shield-alert",zA);const WA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],GA=Kt("shield-check",WA);const VA=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],qA=Kt("sliders-horizontal",VA);const YA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ib=Kt("square",YA);const ZA=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],KA=Kt("stethoscope",ZA);const XA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],JA=Kt("sun",XA);const eT=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ni=Kt("trash-2",eT);const tT=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],rT=Kt("type",tT);const nT=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],sT=Kt("unlink",nT);const iT=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],Eb=Kt("unplug",iT);const aT=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Nb=Kt("video",aT);const oT=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],lT=Kt("volume-1",oT);const cT=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],uT=Kt("volume-2",cT);const dT=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],hT=Kt("wand-sparkles",dT);const fT=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ad=Kt("workflow",fT);function pT(e,t){return e==="webgl"&&t}function mT(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function gT(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function xT(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function bT(e,t){return!e&&t}function yT({state:e,onCopy:t,copied:r}){const{t:n}=Qr(),[a,l]=b.useState(null),c=e.caAvailable&&e.onboardingUrl?new URL("/ca",e.onboardingUrl).href:null;return b.useEffect(()=>{let h=!1;return l(null),c&&N7.toDataURL(c,{width:180,margin:2,errorCorrectionLevel:"M"}).then(p=>{h||l(p)}).catch(()=>{}),()=>{h=!0}},[c]),i.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-muted-foreground",children:[i.jsx("p",{children:n("settings.mobileSetupIntro")}),e.httpsEnabled&&i.jsxs("section",{className:"space-y-3 rounded-xl bg-surface-2 p-3",children:[i.jsx("h3",{className:"font-medium text-foreground",children:n("settings.mobileSetupDownload")}),c?i.jsxs(i.Fragment,{children:[a&&i.jsx("img",{src:a,alt:n("settings.mobileSetupDownload"),className:"h-44 w-44 rounded-lg"}),i.jsxs("button",{type:"button",onClick:()=>t(c),className:"flex w-full items-center justify-between gap-3 rounded-lg bg-surface p-2 text-left",children:[i.jsx("span",{className:"break-all",children:c}),i.jsx("span",{className:"shrink-0 text-primary",children:n(r?"rightSidebar.copied":"common.copy")})]})]}):i.jsx("p",{children:n("settings.caMissing")}),i.jsx("p",{children:n("settings.mobileSetupIos")}),i.jsx("p",{children:n("settings.mobileSetupAndroid")})]}),i.jsx("h3",{className:"font-medium text-foreground",children:e.httpsEnabled?n("settings.mobileSetupConnect"):n("settings.localAccess")}),i.jsx("p",{children:n("settings.mobileSetupConnectHint")})]})}const Tu=p0(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function mg(){const e=Vo(),t=e.visualViewport,r=document.documentElement.style,n=g=>g===void 0?"?":Math.round(g),a=g=>r.getPropertyValue(g)||"?";let l=document.activeElement?.parentElement,c=null;for(;l&&!c;)c=l.querySelector('[data-mobile-keyboard="true"]'),l=l.parentElement;const h=c?.getBoundingClientRect(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${n(t?.height)} off ${n(t?.offsetTop)} win ${e.innerHeight}`,`base ${a("--app-base-vh")} kb ${a("--kb-height")} move ${a("--kb-translate-y")}`,`bar ${n(h?.top)}…${n(h?.bottom)} h ${n(h?.height)} root ${n(p?.bottom)}`,`safe ${a("--safe-top-inset")}/${a("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
3
+ `)}function vT({onClose:e}){const[t,r]=C.useState(mg);return C.useEffect(()=>{const n=window.setInterval(()=>r(mg()),200);return()=>window.clearInterval(n)},[]),i.jsxs("div",{className:"pointer-events-none fixed inset-x-2 z-toast rounded-lg border border-border/15 bg-surface p-2 text-foreground md:hidden",style:{top:"calc(var(--safe-top-inset, 0px) + 40px)"},children:[i.jsx("button",{type:"button",className:"pointer-events-auto absolute right-1 top-1 px-2 py-1 text-xs",onPointerDown:n=>n.preventDefault(),onClick:e,"aria-label":"关闭布局诊断",children:"×"}),i.jsx("pre",{className:"pr-5 font-mono text-[10px] leading-tight",children:t})]})}const wT={x:0,y:0,width:1,height:1};function pc(e){return"id"in e?[e.id]:[...pc(e.first),...pc(e.second)]}function Kp(e,t=0,r=new Set){if(!e||typeof e!="object"||t>24)return null;const n=e;if(typeof n.id=="string"&&n.id&&!r.has(n.id))return r.add(n.id),{id:n.id};if(!["x","y"].includes(String(n.axis))||!Number.isFinite(n.ratio))return null;const a=Kp(n.first,t+1,r),l=Kp(n.second,t+1,r);return a&&l?{axis:n.axis,ratio:Math.max(.02,Math.min(.98,Number(n.ratio))),first:a,second:l}:a??l}function Bu(e,t){if("id"in e)return t.has(e.id)?e:null;const r=Bu(e.first,t),n=Bu(e.second,t);return r&&n?{...e,first:r,second:n}:r??n}function _h(e,t,r,n){return"id"in e?e.id===t?{axis:n==="left"||n==="right"?"x":"y",ratio:.5,first:n==="left"||n==="top"?{id:r}:e,second:n==="left"||n==="top"?e:{id:r}}:e:{...e,first:_h(e.first,t,r,n),second:_h(e.second,t,r,n)}}function AT(e,t,r,n){if(t===r||!pc(e).includes(t)||!pc(e).includes(r))return e;if(n==="center"){const a=l=>"id"in l?{id:l.id===t?r:l.id===r?t:l.id}:{...l,first:a(l.first),second:a(l.second)};return a(e)}return _h(Bu(e,new Set(pc(e).filter(a=>a!==t))),r,t,n)}function e0(e,t){if(e.length===1)return{id:e[0]};if(t==="grid"&&e.length>2){const r=Math.ceil(e.length/2);return{axis:"y",ratio:.5,first:e0(e.slice(0,r),"horizontal"),second:e0(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:e0(e.slice(1),t)}}function Xp(e,t=wT,r=""){if("id"in e)return{panes:[{id:e.id,rect:t}],dividers:[]};const n={...t},a={...t};e.axis==="x"?(n.width*=e.ratio,a.x+=n.width,a.width-=n.width):(n.height*=e.ratio,a.y+=n.height,a.height-=n.height);const l=Xp(e.first,n,r+"0"),c=Xp(e.second,a,r+"1");return{panes:[...l.panes,...c.panes],dividers:[{path:r,node:e,rect:t},...l.dividers,...c.dividers]}}function Cu(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:Cu(e.first,t.slice(1),r)}:{...e,second:Cu(e.second,t.slice(1),r)}:{...e,ratio:r}}function Rb(e){return"id"in e||"id"in e.first||"id"in e.second||e.first.axis===e.axis||e.second.axis===e.axis||!("id"in e.first.first)||!("id"in e.first.second)||!("id"in e.second.first)||!("id"in e.second.second)?null:e.axis==="y"?{ids:[e.first.first.id,e.first.second.id,e.second.first.id,e.second.second.id],top:e.first.ratio,bottom:e.second.ratio,left:e.ratio,right:e.ratio}:{ids:[e.first.first.id,e.second.first.id,e.first.second.id,e.second.second.id],top:e.ratio,bottom:e.ratio,left:e.first.ratio,right:e.second.ratio}}function Df(e,t,r){const n=Rb(e);if(!n)return e;const[a,l,c,h]=n.ids.map(p=>({id:p}));return t==="top"||t==="bottom"?{axis:"y",ratio:(n.left+n.right)/2,first:{axis:"x",ratio:t==="top"?r:n.top,first:a,second:l},second:{axis:"x",ratio:t==="bottom"?r:n.bottom,first:c,second:h}}:{axis:"x",ratio:(n.top+n.bottom)/2,first:{axis:"y",ratio:t==="left"?r:n.left,first:a,second:c},second:{axis:"y",ratio:t==="right"?r:n.right,first:l,second:h}}}function TT(e,t,r,n,a){const l=(p,g,x)=>{if(p.length===1)return p[0];const y=x?.length===p.length&&x.every(A=>Number.isFinite(A)&&A>0)?x:p.map(()=>1);return{axis:g,ratio:y[0]/y.reduce((A,w)=>A+w,0),first:p[0],second:l(p.slice(1),g,y.slice(1))}};if(t!=="grid")return l(e.map(p=>({id:p})),t==="vertical"?"y":"x",r);const c=Math.ceil(Math.sqrt(e.length)),h=[];for(let p=0;p<e.length;p+=c){const g=e.slice(p,p+c).map(y=>({id:y})),x=n?.length===c?n.slice(0,g.length):void 0;x&&g.length<c&&(x[x.length-1]+=n.slice(g.length).reduce((y,A)=>y+A,0)),h.push(l(g,"x",x))}return l(h,"y",a)}let CT;function Qu(){try{const e="termdock-collaboration-panel-client",t=localStorage.getItem(e);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(e,r),r}catch{return CT??=crypto.randomUUID()}}let gg=Promise.resolve();function Io(e,t){t&&(e={groups:{[t]:e}});const r=Qu(),n=gg.catch(()=>{}).then(()=>ha({collaborationPanel:{clientId:r,state:e}}));return gg=n,n.then(()=>{})}function xg(e,t,r,n,a,l){return{x:a>0?Math.max(0,Math.min(1,(e-r)/a)):.5,y:l>0?Math.max(0,Math.min(1,(t-n)/l)):.5}}function zm(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function Mb(e){const t=Object.entries(e?.groups??{}).filter(([,r])=>r.floatingGroupId).map(([r])=>r);return e?.floatingGroupId&&!e.groups?.[e.floatingGroupId]&&t.push(e.floatingGroupId),t}const ST=e=>e.startsWith("@collaboration:"),bg=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function _T({groupId:e}){const t=Xn(a=>a.setHost),r=b.useRef(null),n=b.useCallback(a=>{(a||Xn.getState().hosts[e]===r.current)&&t(e,a),r.current=a},[e,t]);return i.jsx("div",{ref:n,className:"h-full min-h-0 min-w-0 bg-surface"})}function yg({layoutId:e,panes:t,preset:r="grid",initialTree:n,focusId:a,mobile:l=!1}){const c=Xn(Y=>Y.docks),h=JSON.stringify(t.map(Y=>Y.id)),p=Object.entries(c).filter(([,Y])=>t.some(Ee=>Ee.id===Y.sessionId)),g=JSON.stringify(p),x=b.useRef(null),[y,A]=b.useState(()=>n??e0(t.map(Y=>Y.id),l?"vertical":r)),w=b.useRef(y);w.current=y;const[k,E]=b.useState(!1),I=Xn(Y=>Y.activePaneId),[M,B]=b.useState(null),[F,U]=b.useState(null),[G,Q]=b.useState(null),X=b.useRef(r),ee=b.useRef(t.map(Y=>Y.id)),ze=b.useRef({}),he=b.useRef(!1),de=()=>{he.current&&(he.current=!1,Io({layouts:{[e]:w.current}}).catch(()=>{he.current=!0,B("布局保存失败,调整后重试")}))};b.useEffect(()=>{let Y=!1;return vl().then(Ee=>{if(Y)return;const be=Ee.collaborationPanels?.[Qu()];for(const Ze of Mb(be)){const Se=zm(be,Ze);Se.mode==="docked"&&Se.dock&&t.some(se=>se.id===Se.dock.sessionId)&&!Xn.getState().docks[Ze]&&Xn.getState().setDock(Ze,Se.dock)}let Me=Kp(be?.layouts?.[e]);if(Me&&be?.floatingGroupId){const Ze=Se=>"id"in Se?{id:Se.id==="@collaboration"?yd(be.floatingGroupId):Se.id}:{...Se,first:Ze(Se.first),second:Ze(Se.second)};Me=Ze(Me)}Me&&A(Me),E(!0)}).catch(()=>{Y||B("布局加载失败,请刷新重试")}),()=>{Y=!0}},[e]);const $e=Y=>{he.current=!0,w.current=Y,A(Y)};b.useLayoutEffect(()=>{if(!k)return;const Y=JSON.parse(h),Ee=X.current!==r;X.current=r;let be=Ee?e0(Y,r):w.current;const Me=ee.current;if(!Ee&&Me.length===Y.length&&Me.every(se=>Y.includes(se))&&Me.some((se,Ye)=>se!==Y[Ye])){const se=new Map(Me.map((pt,rt)=>[pt,Y[rt]])),Ye=pt=>"id"in pt?{id:se.get(pt.id)??pt.id}:{...pt,first:Ye(pt.first),second:Ye(pt.second)};be=Ye(be)}ee.current=Y;const Ze=new Set([...Y,...p.map(([se])=>yd(se))]);be=Bu(be,Ze)??e0(Y,r);for(const se of Y)pc(be).includes(se)||(be={axis:"x",ratio:.5,first:be,second:{id:se}});const Se={};for(const[se,Ye]of p){const pt=yd(se),rt=`${Ye.sessionId}:${Ye.side}`;if(Se[se]=rt,(!pc(be).includes(pt)||ze.current[se]&&ze.current[se]!==rt)&&(be=Bu(be,new Set([...Ze].filter(ye=>ye!==pt))),be=_h(be,Ye.sessionId,pt,Ye.side)),Ye.preferredWidth&&(Ye.side==="left"||Ye.side==="right")){const ye=(et,ht)=>{if("id"in et)return et;const te="id"in et.first&&et.first.id===pt,ve="id"in et.second&&et.second.id===pt;if(et.axis==="x"&&(te||ve)&&et.ratio===.5){const me=(x.current?.clientWidth||window.innerWidth)*ht.width,je=Math.max(.1,Math.min(.45,Ye.preferredWidth/Math.max(1,me)));return{...et,ratio:te?je:1-je}}const ct={...ht},re={...ht};return et.axis==="x"?(ct.width*=et.ratio,re.x+=ct.width,re.width-=ct.width):(ct.height*=et.ratio,re.y+=ct.height,re.height-=ct.height),{...et,first:ye(et.first,ct),second:ye(et.second,re)}};be=ye(be,{x:0,y:0,width:1,height:1})}}ze.current=Se,JSON.stringify(be)!==JSON.stringify(w.current)&&($e(be),de())},[k,h,r,g]),b.useEffect(()=>{const Y=()=>de();return window.addEventListener("pagehide",Y),()=>{window.removeEventListener("pagehide",Y),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),Y()}},[e]);const qe=Xp(y),oe=Rb(y),Re=[...t,...p.map(([Y])=>({id:yd(Y),content:i.jsx(_T,{groupId:Y})}))],K=b.useRef(null),we=b.useRef(G);we.current=G;const Z=b.useRef(null);b.useEffect(()=>{const Y=x.current;if(!Y||!k)return;const Ee=Me=>{if(Me.button!==0||!(Me.target instanceof Element))return;const Ze=Me.target.closest("[data-split-pane-title], [data-panel-drag-title]"),Se=Me.target.closest("button, a, input, textarea, select, summary");if(!Ze||Se&&Se!==Ze)return;const se=Ze.closest("[data-layout-pane]");if(!se||!Y.contains(se))return;document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const Ye=se.getBoundingClientRect();K.current={id:se.dataset.layoutPane,x:Me.clientX,y:Me.clientY,moved:!1,originX:Me.clientX-Ye.left,originY:Me.clientY-Ye.top,scale:Math.min(.8,480/Math.max(1,Ye.width),320/Math.max(1,Ye.height))},Y.setPointerCapture?.(Me.pointerId)},be=Me=>{const Ze=Me.target;if(!(Ze instanceof Element))return;const Se=Ze.closest("[data-layout-pane]");if(!(!Se||!Y.contains(Se))){if(Me.type==="pointerdown"&&Xn.getState().activePaneId!==Se.dataset.layoutPane){const se=document.activeElement;se instanceof HTMLElement&&se.closest("[data-layout-pane]")&&!Se.contains(se)&&se.blur();const Ye=window.getSelection();Ye?.anchorNode&&!Se.contains(Ye.anchorNode)&&Ye.removeAllRanges()}Xn.getState().setActivePane(Se.dataset.layoutPane)}};return Y.addEventListener("pointerdown",be,!0),Y.addEventListener("focusin",be,!0),Y.addEventListener("pointerdown",Ee,!0),()=>{Y.removeEventListener("pointerdown",Ee,!0),Y.removeEventListener("pointerdown",be,!0),Y.removeEventListener("focusin",be,!0)}},[k]);const Ue=(Y,Ee)=>{const be=x.current?.getBoundingClientRect(),Me=Z.current;if(!be||!Me)return;const Ze=Me.axis==="x"?be.width*Me.rect.width:be.height*Me.rect.height,Se=Me.axis==="x"?be.left+be.width*Me.rect.x:be.top+be.height*Me.rect.y,se=Math.min(.45,(l?48:120)/Math.max(1,Ze)),Ye=Math.max(se,Math.min(1-se,((Me.axis==="x"?Y:Ee)-Se)/Math.max(1,Ze)));$e(Me.side?Df(w.current,Me.side,Ye):Cu(w.current,Me.path,Ye))},Le=oe?[{key:"top",side:"top",axis:"x",x:oe.top,y:0,length:(oe.left+oe.right)/2},{key:"bottom",side:"bottom",axis:"x",x:oe.bottom,y:(oe.left+oe.right)/2,length:1-(oe.left+oe.right)/2},{key:"left",side:"left",axis:"y",x:0,y:oe.left,length:(oe.top+oe.bottom)/2},{key:"right",side:"right",axis:"y",x:(oe.top+oe.bottom)/2,y:oe.right,length:1-(oe.top+oe.bottom)/2}].map(Y=>({...Y,rect:{x:0,y:0,width:1,height:1},path:void 0})):qe.dividers.map(Y=>({key:Y.path,path:Y.path,side:void 0,axis:Y.node.axis,rect:Y.rect,x:Y.rect.x+(Y.node.axis==="x"?Y.rect.width*Y.node.ratio:0),y:Y.rect.y+(Y.node.axis==="y"?Y.rect.height*Y.node.ratio:0),length:Y.node.axis==="x"?Y.rect.height:Y.rect.width}));return i.jsxs("div",{ref:x,"data-split-container":"true",className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-border [&_[data-split-pane-title]]:touch-none [&_[data-panel-drag-title]]:touch-none",onPointerMove:Y=>{if(Z.current){Y.preventDefault(),Ue(Y.clientX,Y.clientY);return}const Ee=K.current,be=x.current?.getBoundingClientRect();if(!Ee||!be||!Ee.moved&&Math.hypot(Y.clientX-Ee.x,Y.clientY-Ee.y)<6)return;Ee.moved=!0,U({id:Ee.id,dx:Y.clientX-Ee.x,dy:Y.clientY-Ee.y,originX:Ee.originX,originY:Ee.originY,scale:Ee.scale});const Me=(Y.clientX-be.left)/be.width,Ze=(Y.clientY-be.top)/be.height,Se=qe.panes.find(ye=>Me>=ye.rect.x&&Me<=ye.rect.x+ye.rect.width&&Ze>=ye.rect.y&&Ze<=ye.rect.y+ye.rect.height);if(!Se||Se.id===Ee.id){we.current=null,Q(null);return}const se=(Me-Se.rect.x)/Se.rect.width,Ye=(Ze-Se.rect.y)/Se.rect.height,pt=Math.min(se,1-se,Ye,1-Ye)>.25?"center":se<1-se&&se<=Ye&&se<=1-Ye?"left":1-se<=Ye&&1-se<=1-Ye?"right":Ye<1-Ye?"top":"bottom",rt={id:Se.id,side:pt};we.current=rt,Q(rt)},onPointerUp:Y=>{Z.current&&(Z.current=null,de()),K.current?.moved&&we.current&&($e(AT(w.current,K.current.id,we.current.id,we.current.side)),de()),K.current=null,we.current=null,Q(null),U(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),Y.currentTarget.hasPointerCapture?.(Y.pointerId)&&Y.currentTarget.releasePointerCapture(Y.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),Z.current=null,K.current=null,we.current=null,Q(null),U(null),de()},onKeyDownCapture:Y=>{Y.key==="Escape"&&(K.current=null,we.current=null,Q(null),U(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),Z.current=null,K.current=null,we.current=null,Q(null),U(null),de()},children:[F&&i.jsx("div",{"aria-hidden":"true","data-drag-placeholder":"true",className:"pointer-events-none absolute border-2 border-dashed border-primary/30 bg-primary/5",style:bg(qe.panes.find(Y=>Y.id===F.id)?.rect??{x:0,y:0,width:0,height:0})}),Re.map(Y=>{const Ee=qe.panes.find(Me=>Me.id===Y.id)?.rect,be=!Ee||!!a&&Y.id!==a;return i.jsxs("div",{"data-layout-pane":Y.id,"data-pane-active":I===Y.id,className:`${I===Y.id?"[&_[data-pane-titlebar]]:bg-surface":""} absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${F?.id===Y.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 opacity-90 shadow-xl":""}`,style:{...bg(a===Y.id?{x:0,y:0,width:1,height:1}:Ee??{x:0,y:0,width:0,height:0}),padding:Re.length>1?"0.5px":0,transition:"none",visibility:be?"hidden":void 0,...F?.id===Y.id?{transform:`translate(${F.dx}px, ${F.dy}px) scale(${F.scale})`,transformOrigin:`${F.originX}px ${F.originY}px`}:{}},onDragStart:Me=>{Me.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&Me.preventDefault()},children:[Y.content,l&&Re.length>1&&!ST(Y.id)&&i.jsx("button",{type:"button","data-panel-drag-title":"true","aria-label":"拖动面板到其他区域",className:"swiper-no-swiping absolute right-1 top-1 z-20 rounded bg-surface p-1 text-muted-foreground",children:i.jsx(Zh,{size:14})}),G?.id===Y.id&&i.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:G.side==="bottom"?"50%":0,bottom:G.side==="top"?"50%":0,left:G.side==="right"?"50%":0,right:G.side==="left"?"50%":0}})]},Y.id)}),!a&&Le.map(Y=>i.jsx("button",{type:"button",role:"separator","aria-label":Y.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[Y.side]}半段分隔线`:"调整分屏大小","aria-orientation":Y.axis==="x"?"vertical":"horizontal",disabled:!k,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${Y.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${Y.x*100}%`,top:`${Y.y*100}%`,...Y.axis==="x"?{height:`${Y.length*100}%`}:{width:`${Y.length*100}%`}},onPointerDown:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),Z.current=Y,x.current?.setPointerCapture?.(Ee.pointerId)},onDoubleClick:()=>{$e(Y.side?Df(w.current,Y.side,.5):Cu(w.current,Y.path,.5)),de()},onKeyDown:Ee=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Ee.key))return;Ee.preventDefault();const be=Y.side?oe[Y.side]:qe.dividers.find(Ze=>Ze.path===Y.path).node.ratio,Me=Math.max(.05,Math.min(.95,be+(["ArrowRight","ArrowDown"].includes(Ee.key)?.03:-.03)));$e(Y.side?Df(w.current,Y.side,Me):Cu(w.current,Y.path,Me)),de()},children:i.jsx("span",{"aria-hidden":"true",className:`absolute ${Y.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},Y.key)),M&&i.jsx("div",{role:"alert",className:"absolute bottom-1 left-1 z-20 rounded bg-surface px-2 py-1 text-[10px] text-destructive",children:M})]})}let Jp=0,vg=!1,Yc=0;function LT(){if(vg||typeof window>"u")return;vg=!0;const e=()=>{Jp=performance.now()};window.addEventListener("pointerdown",()=>{Yc+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{Yc=Math.max(0,Yc-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{Yc=0,e()})}function Hm(e,t=500){LT();let r=!1,n,a;const l=()=>{if(r)return;if(Yc>0||performance.now()-Jp<400){a=setTimeout(l,100);return}const c=()=>{if(!r){if(Yc>0||performance.now()-Jp<400){a=setTimeout(l,100);return}e()}};"requestIdleCallback"in window?n=window.requestIdleCallback(c):a=setTimeout(c,16)};return a=setTimeout(l,t),()=>{r=!0,clearTimeout(a),n!==void 0&&window.cancelIdleCallback(n)}}function kT(e){const[t,r]=b.useState(e);return b.useEffect(()=>Hm(()=>r(e),0),[e]),t}function IT(e,t,r){b.useEffect(()=>{e&&R7(e,!0)},[e,r])}const bi=[];for(let e=0;e<256;++e)bi.push((e+256).toString(16).slice(1));function ET(e,t=0){return(bi[e[t+0]]+bi[e[t+1]]+bi[e[t+2]]+bi[e[t+3]]+"-"+bi[e[t+4]]+bi[e[t+5]]+"-"+bi[e[t+6]]+bi[e[t+7]]+"-"+bi[e[t+8]]+bi[e[t+9]]+"-"+bi[e[t+10]]+bi[e[t+11]]+bi[e[t+12]]+bi[e[t+13]]+bi[e[t+14]]+bi[e[t+15]]).toLowerCase()}let jf;const NT=new Uint8Array(16);function RT(){if(!jf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jf=crypto.getRandomValues.bind(crypto)}return jf(NT)}const MT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wg={randomUUID:MT};function DT(e,t,r){e=e||{};const n=e.random??e.rng?.()??RT();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,ET(n)}function Db(e,t,r){return wg.randomUUID&&!e?wg.randomUUID():DT(e)}const jb="\x1B[?2026h",jT="\x1B[?2026l",Bb="\x1Bc";function BT(e){return e.replace(/(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)|(?:\x1b[P_X^]|[\x90\x98\x9e\x9f])[\s\S]*?(?:\x1b\\|\x9c|$)|(?:\x1b\[|\x9b)\?([\d;]+)([hl])|(?:\x1b\[|\x9b)[\d;]*!p|\x1bc/g,(t,r,n)=>{if(t===Bb||t.endsWith("!p"))return t+jb;if(r===void 0)return t;const a=r.split(";").filter(l=>Number(l)!==2026);return a.length?`\x1B[?${a.join(";")}${n}`:""})}function QT(e){const t=e.filter(n=>n.length>0).join("");if(!t)return[];const r=BT(t.replace(/^(?:\x1bc)+/,""));return[`${Bb}${jb}${r}${jT}`]}function PT(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}function OT(e){return[["10",e.foreground],["11",e.background]].map(([t,r])=>{const n=/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(r);if(!n)return"";const a=n.slice(1).map(l=>l.repeat(2)).join("/");return`\x1B]${t};rgb:${a}\x1B\\`}).join("")}const FT={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},$T={F1:"P",F2:"Q",F3:"R",F4:"S"},UT={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24};function zT(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:n,altKey:a,ctrlKey:l}=e,c=1+Number(n)+2*Number(a)+4*Number(l),h=c===1?"":`;${c}`,p=FT[r];if(p)return c!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const g=$T[r];if(g)return c!==1?`\x1B[1${h}${g}`:`\x1BO${g}`;if(r==="Insert"&&!a&&(n||l))return null;const x=UT[r];if(x)return`\x1B[${x}${h}~`;if(r==="Tab")return a?`\x1B${n?"\x1B[Z":" "}`:n?"\x1B[Z":" ";if(r==="Escape")return a?"\x1B\x1B":"\x1B";if(r==="Enter")return a?"\x1B\r":null;if(r==="Backspace")return l||a?`${a?"\x1B":""}${l?"\b":""}`:null;if(r.length!==1)return null;if(l){const y=r.toUpperCase();let A;return/^[A-Z]$/.test(y)?A=y.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?A=0:"[\\]^_".includes(r)?A=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?A=Number(r)+24:r==="?"||r==="8"?A=127:r==="/"&&(A=31),A===void 0?null:`${a?"\x1B":""}${String.fromCharCode(A)}`}return a?`\x1B${r}`:null}class ih extends Error{}async function HT(e){if(!e.type.startsWith("image/")||e.size===0)throw new Error("Clipboard image is empty");const t=e.type==="image/jpeg"?"jpg":e.type.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png",r=new File([e],`termdock-clipboard-${Date.now()}-${crypto.randomUUID()}.${t}`,{type:e.type}),{files:n}=await Zu("/tmp",[r]);if(!n[0]?.path)throw new Error("Upload did not return an image path");return n[0].path}async function Ag(e){const t=ko();if(t?.readClipboardImage){const r=await t.readClipboardImage();return r?.byteLength?new File([r],"clipboard.png",{type:"image/png"}):null}if(typeof e?.read!="function")return null;for(const r of await e.read()){const n=r.types.find(c=>c.startsWith("image/"));if(!n)continue;const a=await r.getType(n),l=n==="image/jpeg"?"jpg":n.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([a],`termdock-clipboard-${Date.now()}.${l}`,{type:n})}return null}async function WT(e){if(typeof e?.read!="function")return[];const t=[],r={"video/mp4":"mp4","video/quicktime":"mov","video/x-m4v":"m4v","video/webm":"webm","video/ogg":"ogv","video/mpeg":"mpeg","video/x-msvideo":"avi","video/x-matroska":"mkv","video/3gpp":"3gp","video/3gpp2":"3g2"};for(const n of await e.read()){const a=n.types.find(p=>p.startsWith("video/"));if(!a)continue;const l=await n.getType(a);if(!l.size)throw new Error("Clipboard video is empty");const c=a.split(";")[0].toLowerCase(),h=r[c]||c.slice(6).replace(/[^a-z0-9]/g,"")||"mp4";t.push(new File([l],`termdock-clipboard-${Date.now()}-${crypto.randomUUID()}.${h}`,{type:a}))}return t}async function GT(){const e=Ah()?.targetPeerId;let t;try{t=await ko()?.readClipboardFiles?.({localServiceId:e})}catch(a){const l=a instanceof Error?a.message:String(a),c="TERMDOCK_CLIPBOARD_VIDEO_ERROR:",h=l.indexOf(c);if(h!==-1)throw new ih(l.slice(h+c.length).trim());const p=l.match(/execution error: Error: (复制来源未提供可读取的视频数据[^\r\n]*|无法读取剪贴板视频)(?:\s*\(-\d+\))?\s*$/);throw p?new ih(p[1]):a}if(Ah()?.targetPeerId!==e)throw new Error("目标服务已切换,请重新粘贴");const r=[],n=[];for(const a of t??[])if(a.path&&e)n.push(a.path);else if(a.bytes){if(a.type?.startsWith("video/")&&a.bytes.byteLength===0)throw new ih("复制来源未提供可读取的视频数据,请重新复制视频或选择文件上传");r.push(new File([a.bytes],a.name,{type:a.type||"application/octet-stream"}))}else throw new Error("剪贴板未提供可读取的文件");return{files:r,paths:n}}async function VT(e){if(!e.length)return[];const{files:t}=await Zu("/tmp",e);if(t.length!==e.length||t.some(r=>!r.path))throw new Error("Upload did not return every file path");return t.map(r=>r.path)}function Ps(e){return{dispose:e}}function qT(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function YT(...e){return Ps(()=>qT(e))}var Qb=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},Tc=class{constructor(){this._store=new Qb}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Tc.None=Object.freeze({dispose(){}});var B0=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},Pb=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Ju=Pb?"node":navigator.userAgent,ZT=Pb?"node":navigator.platform,KT=Ju.includes("Firefox");Ju.includes("Chrome");var XT=Ju.includes("Edge"),Ob=/^((?!chrome|android).)*safari/i.test(Ju);function JT(){if(!Ob)return 0;let e=Ju.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}ZT.indexOf("Linux")>=0;var Ks=0,Xs=0,Js=0,vs=0,so={css:"#00000000",rgba:0},Ki;(e=>{function t(a,l,c,h){return h!==void 0?`#${tc(a)}${tc(l)}${tc(c)}${tc(h)}`:`#${tc(a)}${tc(l)}${tc(c)}`}e.toCss=t;function r(a,l,c,h=255){return(a<<24|l<<16|c<<8|h)>>>0}e.toRgba=r;function n(a,l,c,h){return{css:e.toCss(a,l,c,h),rgba:e.toRgba(a,l,c,h)}}e.toColor=n})(Ki||={});var gu;(e=>{function t(p,g){if(vs=(g.rgba&255)/255,vs===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,y=g.rgba>>16&255,A=g.rgba>>8&255,w=p.rgba>>24&255,k=p.rgba>>16&255,E=p.rgba>>8&255;Ks=w+Math.round((x-w)*vs),Xs=k+Math.round((y-k)*vs),Js=E+Math.round((A-E)*vs);let I=Ki.toCss(Ks,Xs,Js),M=Ki.toRgba(Ks,Xs,Js);return{css:I,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let y=mc.ensureContrastRatio(p.rgba,g.rgba,x);if(y)return Ki.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function a(p){let g=(p.rgba|255)>>>0;return[Ks,Xs,Js]=mc.toChannels(g),{css:Ki.toCss(Ks,Xs,Js),rgba:g}}e.opaque=a;function l(p,g){return vs=Math.round(g*255),[Ks,Xs,Js]=mc.toChannels(p.rgba),{css:Ki.toCss(Ks,Xs,Js,vs),rgba:Ki.toRgba(Ks,Xs,Js,vs)}}e.opacity=l;function c(p,g){return vs=p.rgba&255,l(p,vs*g/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(gu||={});var eC;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Ks=parseInt(a.slice(1,2).repeat(2),16),Xs=parseInt(a.slice(2,3).repeat(2),16),Js=parseInt(a.slice(3,4).repeat(2),16),Ki.toColor(Ks,Xs,Js);case 5:return Ks=parseInt(a.slice(1,2).repeat(2),16),Xs=parseInt(a.slice(2,3).repeat(2),16),Js=parseInt(a.slice(3,4).repeat(2),16),vs=parseInt(a.slice(4,5).repeat(2),16),Ki.toColor(Ks,Xs,Js,vs);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Ks=parseInt(l[1],10),Xs=parseInt(l[2],10),Js=parseInt(l[3],10),vs=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ki.toColor(Ks,Xs,Js,vs);if(a==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ks,Xs,Js,vs]=t.getImageData(0,0,1,1).data,vs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ki.toRgba(Ks,Xs,Js,vs),css:a}}e.toColor=n})(eC||={});var Gi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let c=n/255,h=a/255,p=l/255,g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+y*.0722}e.relativeLuminance2=r})(Gi||={});var mc;(e=>{function t(c,h){if(vs=(h&255)/255,vs===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,y=c>>24&255,A=c>>16&255,w=c>>8&255;return Ks=y+Math.round((p-y)*vs),Xs=A+Math.round((g-A)*vs),Js=w+Math.round((x-w)*vs),Ki.toRgba(Ks,Xs,Js)}e.blend=t;function r(c,h,p){let g=Gi.relativeLuminance(c>>8),x=Gi.relativeLuminance(h>>8);if(ol(g,x)<p){if(x<g){let w=n(c,h,p),k=ol(g,Gi.relativeLuminance(w>>8));if(k<p){let E=a(c,h,p),I=ol(g,Gi.relativeLuminance(E>>8));return k>I?w:E}return w}let y=a(c,h,p),A=ol(g,Gi.relativeLuminance(y>>8));if(A<p){let w=n(c,h,p),k=ol(g,Gi.relativeLuminance(w>>8));return A>k?y:w}return y}}e.ensureContrastRatio=r;function n(c,h,p){let g=c>>24&255,x=c>>16&255,y=c>>8&255,A=h>>24&255,w=h>>16&255,k=h>>8&255,E=ol(Gi.relativeLuminance2(A,w,k),Gi.relativeLuminance2(g,x,y));for(;E<p&&(A>0||w>0||k>0);)A-=Math.max(0,Math.ceil(A*.1)),w-=Math.max(0,Math.ceil(w*.1)),k-=Math.max(0,Math.ceil(k*.1)),E=ol(Gi.relativeLuminance2(A,w,k),Gi.relativeLuminance2(g,x,y));return(A<<24|w<<16|k<<8|255)>>>0}e.reduceLuminance=n;function a(c,h,p){let g=c>>24&255,x=c>>16&255,y=c>>8&255,A=h>>24&255,w=h>>16&255,k=h>>8&255,E=ol(Gi.relativeLuminance2(A,w,k),Gi.relativeLuminance2(g,x,y));for(;E<p&&(A<255||w<255||k<255);)A=Math.min(255,A+Math.ceil((255-A)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),E=ol(Gi.relativeLuminance2(A,w,k),Gi.relativeLuminance2(g,x,y));return(A<<24|w<<16|k<<8|255)>>>0}e.increaseLuminance=a;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(mc||={});function tc(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ol(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ms(e){if(!e)throw new Error("value must not be falsy");return e}function Wm(e){return 57508<=e&&e<=57558}function tC(e){return 57520<=e&&e<=57527}function rC(e){return 57344<=e&&e<=63743}function nC(e){return 9472<=e&&e<=9631}function sC(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function iC(e,t,r,n){return t===1&&r>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!sC(e)&&!Wm(e)&&!rC(e)}function Fb(e){return Wm(e)||nC(e)}function aC(){return{css:{canvas:Td(),cell:Td()},device:{canvas:Td(),cell:Td(),char:{width:0,height:0,left:0,top:0}}}}function Td(){return{width:0,height:0}}function oC(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Ie;(e=>(e.LINE_H=Object.freeze({type:2,data:"M0,.5 L1,.5",strokeWidth:1}),e.LINE_V=Object.freeze({type:2,data:"M.5,0 L.5,1",strokeWidth:1}),e.FADE_RIGHT=Object.freeze({type:2,data:"M0,.5 L.28,.5 M.32,.5 L.52,.5 M.60,.5 L.72,.5 M.84,.5 L.90,.5",strokeWidth:1}),e.FADE_LEFT=Object.freeze({type:2,data:"M.10,.5 L.16,.5 M.28,.5 L.40,.5 M.48,.5 L.68,.5 M.72,.5 L1,.5",strokeWidth:1}),e.FADE_DOWN=Object.freeze({type:2,data:"M.5,0 L.5,.28 M.5,.32 L.5,.52 M.5,.60 L.5,.72 M.5,.84 L.5,.90",strokeWidth:1}),e.FADE_UP=Object.freeze({type:2,data:"M.5,.10 L.5,.16 M.5,.28 L.5,.40 M.5,.48 L.5,.68 M.5,.72 L.5,1",strokeWidth:1}),e.CURVE_DOWN_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_DOWN_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.CURVE_UP_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_UP_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.NODE_FILL=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5"}),e.NODE_STROKE=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5",strokeWidth:1}),e.NODE_LINE_RIGHT=Object.freeze({type:3,data:"M1,.5 L.85,.5",strokeWidth:1}),e.NODE_LINE_LEFT=Object.freeze({type:3,data:"M0,.5 L.15,.5",strokeWidth:1}),e.NODE_LINE_DOWN=Object.freeze({type:3,data:"M.5,1 L.5,.7",strokeWidth:1}),e.NODE_LINE_UP=Object.freeze({type:3,data:"M.5,0 L.5,.3",strokeWidth:1})))(Ie||={});var lC={"─":{type:2,data:"M0,.5 L1,.5",strokeWidth:1},"━":{type:2,data:"M0,.5 L1,.5",strokeWidth:3},"│":{type:2,data:"M.5,0 L.5,1",strokeWidth:1},"┃":{type:2,data:"M.5,0 L.5,1",strokeWidth:3},"┄":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:1},"┅":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:3},"┆":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:1},"┇":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:3},"┈":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:1},"┉":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:3},"┊":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:1},"┋":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:3},"┌":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},"┍":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┎":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┏":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3},"┐":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},"┑":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┒":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┓":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3},"└":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},"┕":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┖":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┗":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3},"┘":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},"┙":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┚":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┛":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3},"├":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},"┝":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┞":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┟":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┠":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┡":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┢":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┣":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3},"┤":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},"┥":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┦":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┧":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┨":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┩":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┪":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┫":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3},"┬":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},"┭":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┮":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┯":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┰":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┱":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┲":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┳":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3},"┴":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:1},"┵":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┶":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┷":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┸":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┹":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┺":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┻":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:3},"┼":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:1},"┽":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┾":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┿":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"╀":[{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"╁":[{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╂":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"╃":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"╄":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"╅":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"╆":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"╇":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:3}],"╈":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3}],"╉":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3}],"╊":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3}],"╋":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:3},"╌":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:1},"╍":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:3},"╎":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:1},"╏":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:3},"═":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"║":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╒":{type:2,data:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╓":{type:2,data:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╔":{type:2,data:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╕":{type:2,data:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╖":{type:2,data:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`,strokeWidth:1},"╗":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`,strokeWidth:1},"╘":{type:2,data:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`,strokeWidth:1},"╙":{type:2,data:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╚":{type:2,data:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`,strokeWidth:1},"╛":{type:2,data:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`,strokeWidth:1},"╜":{type:2,data:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`,strokeWidth:1},"╝":{type:2,data:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`,strokeWidth:1},"╞":{type:2,data:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╟":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`,strokeWidth:1},"╠":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╡":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╢":{type:2,data:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╣":{type:2,data:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`,strokeWidth:1},"╤":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`,strokeWidth:1},"╥":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╦":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╧":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╨":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╩":{type:2,data:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╪":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╫":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╬":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╭":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╮":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╯":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╰":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╱":{type:2,data:"M1,0 L0,1",strokeWidth:1},"╲":{type:2,data:"M0,0 L1,1",strokeWidth:1},"╳":{type:2,data:"M1,0 L0,1 M0,0 L1,1",strokeWidth:1},"╴":{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},"╵":{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},"╶":{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},"╷":{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},"╸":{type:2,data:"M.5,.5 L0,.5",strokeWidth:3},"╹":{type:2,data:"M.5,.5 L.5,0",strokeWidth:3},"╺":{type:2,data:"M.5,.5 L1,.5",strokeWidth:3},"╻":{type:2,data:"M.5,.5 L.5,1",strokeWidth:3},"╼":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"╽":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╾":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"╿":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"▀":{type:0,data:[{x:0,y:0,w:8,h:4}]},"▁":{type:0,data:[{x:0,y:7,w:8,h:1}]},"▂":{type:0,data:[{x:0,y:6,w:8,h:2}]},"▃":{type:0,data:[{x:0,y:5,w:8,h:3}]},"▄":{type:0,data:[{x:0,y:4,w:8,h:4}]},"▅":{type:0,data:[{x:0,y:3,w:8,h:5}]},"▆":{type:0,data:[{x:0,y:2,w:8,h:6}]},"▇":{type:0,data:[{x:0,y:1,w:8,h:7}]},"█":{type:0,data:[{x:0,y:0,w:8,h:8}]},"▉":{type:0,data:[{x:0,y:0,w:7,h:8}]},"▊":{type:0,data:[{x:0,y:0,w:6,h:8}]},"▋":{type:0,data:[{x:0,y:0,w:5,h:8}]},"▌":{type:0,data:[{x:0,y:0,w:4,h:8}]},"▍":{type:0,data:[{x:0,y:0,w:3,h:8}]},"▎":{type:0,data:[{x:0,y:0,w:2,h:8}]},"▏":{type:0,data:[{x:0,y:0,w:1,h:8}]},"▐":{type:0,data:[{x:4,y:0,w:4,h:8}]},"░":{type:1,data:[[1,0],[0,0]]},"▒":{type:1,data:[[1,0],[0,1]]},"▓":{type:1,data:[[1,1],[1,0]]},"▔":{type:0,data:[{x:0,y:0,w:8,h:1}]},"▕":{type:0,data:[{x:7,y:0,w:1,h:8}]},"▖":{type:0,data:[{x:0,y:4,w:4,h:4}]},"▗":{type:0,data:[{x:4,y:4,w:4,h:4}]},"▘":{type:0,data:[{x:0,y:0,w:4,h:4}]},"▙":{type:0,data:[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"▚":{type:0,data:[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}]},"▛":{type:0,data:[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}]},"▜":{type:0,data:[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}]},"▝":{type:0,data:[{x:4,y:0,w:4,h:4}]},"▞":{type:0,data:[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}]},"▟":{type:0,data:[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"":{type:5,data:{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.7,.03 L.7,.1 L.355,.1 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2}},"":{type:5,data:{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2}},"":{type:5,data:{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1}},"":{type:5,data:{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1}},"":{type:5,data:{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0.8069,0.6075 Q0.7991,0.612,0.7815,0.6218 T0.7542,0.6369 T0.7282,0.6508 T0.7016,0.6644 T0.6778,0.6758 T0.6551,0.6854 T0.637,0.6911 T0.622,0.6936 Q0.6186,0.6936,0.6128,0.6942 T0.6018,0.6952 T0.5894,0.6956 T0.5757,0.6952 T0.561,0.693 T0.5451,0.6879 Q0.5342,0.6834,0.5193,0.6756 T0.4925,0.6614 T0.4673,0.6485 T0.4436,0.6389 T0.4239,0.6363 T0.4089,0.6422 Q0.4045,0.6467,0.3958,0.6554 T0.3843,0.6669 T0.3748,0.6746 T0.3613,0.683 T0.3442,0.6903 L0.3499,0.6956 Q0.3584,0.7042,0.3679,0.7177 T0.3836,0.7403 T0.4019,0.7583 T0.4295,0.7703 Q0.4688,0.7785,0.5203,0.7605 Q0.4902,0.7817,0.449,0.7911 T0.3696,0.8001 Q0.3567,0.7997,0.341,0.7942 T0.3111,0.7813 T0.2805,0.766 T0.2493,0.753 T0.218,0.7472 T0.187,0.754 Q0.1762,0.7589,0.1653,0.7681 T0.1453,0.7895 T0.1308,0.818 T0.1264,0.8507 L0.1264,0.858 Q0.1453,0.8462,0.1607,0.8433 T0.1899,0.8452 T0.2226,0.8625 Q0.2344,0.8707,0.2485,0.8752 T0.2813,0.8831 T0.3089,0.889 Q0.2981,0.8915,0.2846,0.8956 T0.2603,0.9037 T0.2368,0.9115 T0.2129,0.9174 T0.1894,0.9194 T0.1653,0.9155 Q0.1504,0.9115,0.1328,0.9196 T0.0986,0.9421 T0.0655,0.9708 T0.0317,0.9943 T0,1 Q0.001,0.94,0.0017,0.6508 T0.0024,0.2322 Q0.002,0.2109,0.0007,0.1379 T0,0.0249 Q0.0058,0.0253,0.009,0.0257 T0.0156,0.0288 T0.0203,0.0333 T0.0264,0.0422 T0.0349,0.0539 Q0.044,0.0657,0.0542,0.072 T0.0752,0.0789 T0.096,0.0775 T0.1175,0.0694 T0.1379,0.0573 T0.1579,0.0432 Q0.2141,0,0.2673,0.0318 Q0.2588,0.0318,0.2517,0.033 T0.239,0.0361 T0.2276,0.0424 T0.218,0.0504 T0.2085,0.0612 T0.1997,0.0732 T0.1899,0.0875 T0.1795,0.1028 Q0.1748,0.1093,0.1507,0.1234 T0.1186,0.1448 Q0.0999,0.1612,0.1108,0.1783 Q0.1162,0.1877,0.1238,0.1928 T0.1404,0.1979 T0.158,0.1967 T0.1775,0.1895 T0.1963,0.1791 T0.2151,0.1663 T0.2314,0.1534 T0.2458,0.141 T0.2561,0.1322 Q0.2815,0.1106,0.3017,0.101 T0.344,0.0926 T0.3919,0.1077 Q0.4099,0.1175,0.4265,0.1206 T0.4588,0.1202 T0.488,0.1098 T0.5176,0.0914 Q0.5071,0.1032,0.4963,0.1122 T0.4722,0.1285 T0.4497,0.1401 T0.4223,0.1518 T0.3943,0.1636 Q0.374,0.1726,0.3623,0.1863 T0.3482,0.2162 Q0.3445,0.2403,0.3608,0.2605 T0.4072,0.2876 Q0.4194,0.2909,0.4326,0.2899 T0.457,0.2856 T0.4805,0.2764 T0.5032,0.264 T0.5256,0.2497 T0.5478,0.2352 T0.5698,0.2222 T0.5921,0.2118 Q0.6982,0.173,0.81,0.2436 Q0.833,0.2583,0.8496,0.2674 T0.887,0.2846 T0.925,0.294 T0.9617,0.2911 T1,0.2746 Q0.9817,0.2946,0.96,0.3056 T0.9175,0.3191 T0.8731,0.3209 T0.8277,0.3164 T0.7818,0.3109 T0.7359,0.3101 T0.6907,0.3197 T0.647,0.3448 Q0.6443,0.3472,0.6333,0.3562 T0.6194,0.3674 T0.6076,0.3766 T0.594,0.386 T0.5815,0.3931 T0.5661,0.4007 T0.5501,0.4064 L0.5556,0.4121 Q0.5627,0.4198,0.5722,0.4251 T0.5926,0.4337 T0.6131,0.439 T0.6343,0.4431 T0.6521,0.4468 Q0.6762,0.4529,0.7056,0.4463 Q0.6772,0.4623,0.6543,0.471 T0.604,0.4814 Q0.5962,0.4818,0.5815,0.4825 T0.5591,0.4835 T0.5393,0.4857 T0.519,0.4908 T0.5007,0.4996 T0.4812,0.5141 T0.4627,0.5353 L0.4549,0.5451 L0.4661,0.543 Q0.4759,0.541,0.4909,0.55 T0.5315,0.5796 T0.5684,0.6083 Q0.5799,0.6161,0.5915,0.6212 T0.6181,0.6308 L0.6331,0.6353 Q0.6514,0.6418,0.7004,0.633 T0.8069,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.011,0.0469 Q0.0152,0.0412,0.02,0.0361 T0.0292,0.0281 T0.0365,0.0253 Q0.0426,0.0257,0.0461,0.0263 T0.0534,0.03 T0.0582,0.0345 T0.0645,0.0434 T0.0723,0.0546 Q0.0807,0.0653,0.0897,0.0712 T0.1081,0.0775 T0.1255,0.0765 T0.1438,0.0695 T0.1605,0.0593 T0.1772,0.0473 Q0.2388,0,0.2927,0.0326 L0.2614,0.0767 L0.2581,0.0767 Q0.2494,0.0767,0.2444,0.0773 T0.2359,0.0789 T0.2291,0.0842 T0.2233,0.0922 T0.2146,0.1054 T0.2026,0.1236 Q0.1943,0.1354,0.1843,0.1444 T0.1675,0.1574 T0.1526,0.1654 T0.1429,0.1701 Q0.1436,0.1717,0.1446,0.1733 Q0.1504,0.1823,0.1581,0.1866 T0.1733,0.1915 T0.1909,0.1884 T0.2085,0.1809 T0.2265,0.169 T0.2427,0.1564 T0.2575,0.1436 T0.2688,0.1338 Q0.2969,0.1101,0.3195,0.0995 T0.3643,0.0901 T0.4114,0.1048 Q0.4279,0.1138,0.4426,0.1168 T0.4705,0.117 T0.4945,0.1089 T0.5186,0.0942 L0.5211,0.0926 L0.5289,0.0922 Q0.5411,0.095,0.5189,0.1203 Q0.505,0.1358,0.4913,0.1474 T0.4634,0.167 T0.4389,0.1796 T0.4121,0.1909 T0.3866,0.2011 Q0.3782,0.2047,0.3727,0.2092 Q0.3717,0.2117,0.3714,0.2141 Q0.3695,0.2263,0.3751,0.2388 T0.394,0.2616 T0.4253,0.2761 Q0.4398,0.2785,0.4513,0.2779 T0.4756,0.2724 T0.4987,0.2616 T0.5216,0.2476 T0.5453,0.2321 T0.5703,0.217 T0.5976,0.2043 Q0.7015,0.166,0.8099,0.2345 Q0.8361,0.2512,0.8572,0.2616 T0.9006,0.2779 T0.9432,0.281 T0.9819,0.2663 L0.9887,0.2671 Q1,0.272,0.9768,0.2969 Q0.9558,0.3193,0.9319,0.333 T0.8858,0.3513 T0.8391,0.3569 T0.793,0.3546 T0.7485,0.3497 T0.7065,0.3473 T0.6681,0.3522 T0.6344,0.3699 Q0.5963,0.4005,0.5847,0.4082 Q0.595,0.4139,0.6079,0.4174 T0.6367,0.4237 T0.6586,0.4278 Q0.6793,0.4331,0.7044,0.4278 Q0.7057,0.4278,0.707,0.4274 Q0.7067,0.429,0.7062,0.4313 T0.7036,0.4398 T0.6993,0.4513 T0.6931,0.4619 T0.6851,0.4698 Q0.6573,0.4857,0.6336,0.4947 T0.5831,0.5053 Q0.577,0.5057,0.5615,0.5065 T0.5394,0.508 T0.5221,0.51 T0.5042,0.5139 T0.4905,0.5204 Q0.5008,0.5232,0.515,0.5328 T0.549,0.5585 T0.5799,0.5824 Q0.5905,0.5897,0.6013,0.5946 T0.6262,0.6036 T0.6409,0.6081 Q0.6567,0.6134,0.7035,0.605 T0.8028,0.5816 L0.7974,0.5922 T0.7867,0.6134 L0.7812,0.624 Q0.7799,0.6248,0.7786,0.6252 Q0.7709,0.6297,0.7573,0.6372 T0.7346,0.6499 T0.7123,0.6621 T0.6897,0.6741 T0.6686,0.6847 T0.648,0.6941 T0.6297,0.7013 T0.6129,0.7062 T0.5995,0.7076 Q0.5992,0.7076,0.5831,0.7092 T0.5529,0.7092 T0.525,0.7019 Q0.5105,0.6958,0.4824,0.6811 T0.4356,0.6586 T0.4079,0.6533 Q0.3872,0.6741,0.3827,0.6782 Q0.3872,0.6835,0.3934,0.6929 T0.4037,0.7078 T0.4142,0.7198 T0.4284,0.7304 T0.4466,0.7365 Q0.4824,0.7443,0.5292,0.728 L0.5292,0.7294 T0.529,0.7333 T0.5284,0.7392 T0.5266,0.7463 T0.5236,0.7539 T0.5186,0.7612 T0.5111,0.7679 Q0.5086,0.77,0.5056,0.7716 Q0.4466,0.8104,0.3591,0.8091 Q0.344,0.8091,0.3246,0.802 T0.2893,0.7863 T0.2543,0.77 T0.2206,0.76 T0.1894,0.7643 Q0.1804,0.7684,0.1733,0.7753 Q0.1591,0.7892,0.1601,0.8169 Q0.1784,0.8067,0.1938,0.8053 T0.2212,0.8087 T0.2507,0.825 Q0.2614,0.8324,0.2744,0.8365 T0.3053,0.844 T0.332,0.8499 L0.303,0.894 L0.2998,0.8948 Q0.2904,0.8968,0.278,0.9009 T0.2554,0.9086 T0.233,0.9158 T0.2099,0.9213 T0.1868,0.9229 T0.1633,0.9192 Q0.1517,0.916,0.1367,0.9241 T0.1065,0.9462 T0.0753,0.9737 T0.041,0.9955 T0.0061,1 Q0,0.9984,0.0068,0.9845 Q0.009,0.9804,0.0123,0.9755 Q0.0187,0.9666,0.0261,0.9606 T0.0374,0.9555 Q0.0481,0.958,0.0629,0.949 T0.0931,0.9262 T0.1247,0.8987 T0.1597,0.8777 T0.1949,0.8752 Q0.213,0.8805,0.2343,0.8772 Q0.2249,0.8736,0.2172,0.8683 Q0.1914,0.8511,0.1738,0.8497 T0.1349,0.8617 Q0.1304,0.865,0.1273,0.8646 T0.1242,0.8605 L0.1239,0.8536 Q0.1226,0.8295,0.1354,0.8016 T0.1723,0.7496 Q0.1914,0.7308,0.2104,0.7219 Q0.2259,0.7145,0.2425,0.7141 T0.273,0.7182 T0.3022,0.7296 T0.3301,0.7439 T0.3569,0.7571 T0.3821,0.7643 Q0.373,0.7561,0.3598,0.7367 T0.3382,0.7088 L0.3327,0.7035 Q0.3282,0.699,0.3353,0.6884 T0.3517,0.6692 L0.3611,0.6607 Q0.3711,0.657,0.3751,0.6554 T0.3837,0.6507 T0.3898,0.6458 T0.3979,0.637 T0.4111,0.6236 Q0.4172,0.6175,0.4234,0.6138 Q0.4327,0.6081,0.4439,0.6077 T0.4655,0.6105 T0.4884,0.6201 T0.5113,0.633 T0.5347,0.6468 T0.5573,0.6578 Q0.5705,0.6635,0.5833,0.665 T0.6112,0.665 T0.6286,0.6635 Q0.6421,0.6631,0.6718,0.6501 Q0.626,0.6578,0.6089,0.6517 Q0.6063,0.6509,0.6002,0.6491 T0.5884,0.6454 T0.5757,0.6409 T0.561,0.6344 T0.5466,0.6256 Q0.536,0.6183,0.5108,0.5989 T0.4722,0.5712 T0.4527,0.564 L0.4418,0.5661 Q0.4308,0.5681,0.4366,0.5563 Q0.4401,0.5485,0.4476,0.5392 L0.455,0.5298 Q0.4631,0.5188,0.4714,0.51 T0.4866,0.4947 T0.5021,0.4831 T0.516,0.4749 T0.53,0.4694 T0.5428,0.4657 T0.5558,0.4637 T0.5674,0.4629 T0.5795,0.4625 Q0.5489,0.4543,0.534,0.4384 L0.5286,0.4327 Q0.5244,0.4282,0.5318,0.4174 T0.5486,0.398 L0.5579,0.3899 Q0.567,0.387,0.5749,0.3834 T0.5878,0.3772 T0.6012,0.3687 T0.6126,0.3603 T0.6268,0.3487 T0.6421,0.3361 Q0.6567,0.3242,0.6712,0.3159 T0.7009,0.3034 T0.7277,0.2973 T0.7556,0.2961 T0.7809,0.2977 T0.8074,0.301 Q0.8096,0.3014,0.8109,0.3016 T0.8143,0.302 T0.818,0.3026 Q0.8012,0.2936,0.7767,0.2781 Q0.6718,0.2117,0.5744,0.2476 Q0.5637,0.2516,0.5492,0.2604 T0.5218,0.2779 T0.4923,0.2965 T0.461,0.3124 T0.4282,0.3216 T0.394,0.3206 Q0.3637,0.3136,0.3474,0.2936 T0.3353,0.2459 Q0.3385,0.2247,0.355,0.2023 Q0.3646,0.1892,0.3763,0.179 Q0.3898,0.1672,0.4063,0.1595 Q0.3927,0.1562,0.3785,0.1485 Q0.3604,0.1387,0.3453,0.1354 T0.3161,0.1354 T0.2899,0.1458 T0.2627,0.166 Q0.262,0.1664,0.254,0.1733 T0.2414,0.1841 T0.2267,0.196 T0.2094,0.2086 T0.1915,0.2196 T0.1725,0.2288 T0.1546,0.2337 T0.1373,0.2343 T0.1223,0.228 T0.1097,0.2145 Q0.0962,0.1929,0.1258,0.1582 Q0.131,0.1517,0.1371,0.1464 Q0.1462,0.1387,0.156,0.1321 T0.1752,0.1205 T0.1878,0.1134 Q0.1891,0.1117,0.1947,0.103 T0.2035,0.0899 T0.2125,0.0781 T0.2243,0.064 Q0.1949,0.0616,0.1672,0.0828 Q0.153,0.0934,0.1412,0.1009 T0.1146,0.1146 T0.0873,0.1213 T0.0616,0.116 T0.0374,0.0962 Q0.0339,0.0909,0.0295,0.0846 T0.024,0.0767 T0.0202,0.0728 T0.0148,0.0704 T0.0068,0.0697 Q0.0003,0.0693,0.0058,0.0567 Q0.0077,0.0522,0.011,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.1934,0.6075 Q0.2012,0.612,0.2188,0.6218 T0.2459,0.6369 T0.2718,0.6508 T0.2983,0.6644 T0.322,0.6758 T0.3447,0.6854 T0.363,0.6911 T0.3783,0.6936 Q0.3796,0.6936,0.396,0.6952 T0.4265,0.6952 T0.4548,0.6879 Q0.4656,0.6834,0.4805,0.6756 T0.5073,0.6614 T0.5327,0.6485 T0.5564,0.6389 T0.5759,0.6363 T0.5909,0.6422 Q0.5953,0.6467,0.604,0.6554 T0.6155,0.6669 T0.6251,0.6746 T0.6387,0.683 T0.6556,0.6903 L0.6498,0.6956 Q0.6414,0.7042,0.6319,0.7177 T0.6162,0.7403 T0.5979,0.7583 T0.5703,0.7703 Q0.5313,0.7785,0.4799,0.7605 Q0.5097,0.7817,0.5508,0.7911 T0.6302,0.8001 Q0.6431,0.7997,0.659,0.7942 T0.6888,0.7813 T0.7194,0.766 T0.7506,0.753 T0.7819,0.7472 T0.8131,0.754 Q0.8239,0.7589,0.8346,0.7681 T0.8544,0.7895 T0.8689,0.818 T0.8737,0.8507 L0.8733,0.858 Q0.8591,0.849,0.8474,0.845 T0.8242,0.8421 T0.8021,0.8482 T0.7772,0.8625 Q0.7653,0.8707,0.7513,0.8752 T0.7184,0.8831 T0.6908,0.889 Q0.7017,0.8915,0.7152,0.8956 T0.7396,0.9037 T0.7633,0.9115 T0.7872,0.9174 T0.8107,0.9194 T0.8347,0.9155 Q0.8493,0.9115,0.8671,0.9196 T0.9015,0.9421 T0.9345,0.9708 T0.9682,0.9943 T0.9997,1 Q0.999,0.94,0.9983,0.6508 T0.9976,0.2322 Q0.9976,0.2109,0.9992,0.1379 T1,0.0249 Q0.9949,0.0249,0.9917,0.0257 T0.9863,0.0273 T0.9817,0.0308 T0.9776,0.0357 T0.9721,0.0437 T0.9651,0.0539 Q0.956,0.0657,0.9456,0.072 T0.9247,0.0789 T0.904,0.0775 T0.8823,0.0694 T0.862,0.0573 T0.8422,0.0432 Q0.7856,0,0.7328,0.0318 Q0.7392,0.0318,0.7452,0.0324 T0.756,0.0345 T0.7657,0.0386 T0.7741,0.0437 T0.7821,0.0506 T0.7894,0.0588 T0.7966,0.0683 T0.8039,0.0787 T0.8119,0.0904 T0.8202,0.1028 Q0.8249,0.1093,0.849,0.1234 T0.8811,0.1448 Q0.8998,0.1612,0.8893,0.1783 Q0.8835,0.1877,0.8759,0.1928 T0.8593,0.1979 T0.8417,0.1967 T0.8222,0.1895 T0.8034,0.1791 T0.7848,0.1663 T0.7687,0.1534 T0.7543,0.141 T0.744,0.1322 Q0.7186,0.1106,0.6984,0.101 T0.6559,0.0926 T0.6082,0.1077 Q0.5899,0.1175,0.5733,0.1206 T0.5411,0.1202 T0.5122,0.1098 T0.4822,0.0914 Q0.4927,0.1032,0.5036,0.1122 T0.5276,0.1285 T0.5503,0.1401 T0.5777,0.1518 T0.6055,0.1636 Q0.6258,0.1726,0.6375,0.1863 T0.6519,0.2162 Q0.6556,0.2403,0.6392,0.2605 T0.5926,0.2876 Q0.5804,0.2909,0.5672,0.2899 T0.5428,0.2856 T0.5193,0.2764 T0.4966,0.264 T0.4744,0.2497 T0.4523,0.2352 T0.4301,0.2222 T0.4077,0.2118 Q0.3021,0.173,0.1903,0.2436 Q0.1669,0.2583,0.1504,0.2674 T0.1129,0.2846 T0.075,0.294 T0.0384,0.2911 T0,0.2746 Q0.021,0.297,0.0459,0.3082 T0.0953,0.3207 T0.146,0.3193 T0.1988,0.3131 T0.2508,0.3095 T0.3029,0.3176 T0.3529,0.3448 Q0.3566,0.348,0.3652,0.355 T0.3771,0.3645 T0.3877,0.3731 T0.3993,0.3815 T0.4103,0.3884 T0.4226,0.3953 T0.4352,0.4009 T0.4497,0.4064 L0.4443,0.4121 Q0.4372,0.4198,0.4277,0.4251 T0.4072,0.4337 T0.3867,0.439 T0.3656,0.4431 T0.3481,0.4468 Q0.3241,0.4529,0.2943,0.4463 Q0.3227,0.4623,0.3458,0.471 T0.3959,0.4814 Q0.404,0.4818,0.4187,0.4825 T0.4409,0.4835 T0.4605,0.4857 T0.4809,0.4908 T0.4992,0.4996 T0.5186,0.5141 T0.5371,0.5353 L0.5449,0.5451 L0.5337,0.543 Q0.5242,0.541,0.5091,0.55 T0.4683,0.5796 T0.4314,0.6083 Q0.4203,0.6161,0.4086,0.6212 T0.382,0.6308 T0.3667,0.6353 Q0.3485,0.6418,0.2995,0.633 T0.1934,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.989,0.0469 Q0.9829,0.0379,0.9753,0.0316 T0.9635,0.0253 Q0.9574,0.0257,0.9539,0.0263 T0.9466,0.03 T0.9418,0.0345 T0.9355,0.0434 T0.9277,0.0546 Q0.9193,0.0653,0.9103,0.0712 T0.8919,0.0775 T0.8745,0.0765 T0.8564,0.0695 T0.8396,0.0593 T0.8228,0.0473 Q0.7612,0,0.7073,0.0326 L0.7386,0.0767 L0.7419,0.0767 Q0.7506,0.0767,0.7556,0.0773 T0.7641,0.0789 T0.7709,0.0842 T0.7767,0.0922 T0.7854,0.1054 T0.7974,0.1236 Q0.8057,0.1354,0.8157,0.1444 T0.8325,0.1574 T0.8474,0.1654 T0.8571,0.1701 Q0.8564,0.1717,0.8554,0.1733 Q0.8503,0.1815,0.844,0.186 T0.8301,0.1909 T0.8153,0.1903 T0.7993,0.1845 T0.7836,0.1758 T0.768,0.1648 T0.754,0.1535 T0.741,0.1425 T0.7312,0.1338 Q0.7031,0.1101,0.6805,0.0995 T0.6357,0.0901 T0.5886,0.1048 Q0.5721,0.1138,0.5574,0.1168 T0.5295,0.117 T0.5055,0.1089 T0.4814,0.0942 L0.4789,0.0926 L0.4711,0.0922 Q0.4589,0.095,0.4811,0.1203 Q0.495,0.1358,0.5087,0.1474 T0.5366,0.167 T0.5611,0.1796 T0.5879,0.1909 T0.6134,0.2011 Q0.6218,0.2047,0.6273,0.2092 Q0.6283,0.2117,0.6286,0.2141 Q0.6305,0.2263,0.6249,0.2388 T0.606,0.2616 T0.5747,0.2761 Q0.5602,0.2785,0.5487,0.2779 T0.5245,0.2724 T0.5015,0.2616 T0.4784,0.2476 T0.4547,0.2321 T0.4297,0.217 T0.4024,0.2043 Q0.2985,0.166,0.1901,0.2345 Q0.1694,0.248,0.1523,0.2569 T0.1165,0.2726 T0.0818,0.2812 T0.0494,0.2796 T0.0181,0.2663 L0.0116,0.2671 Q0,0.272,0.0232,0.2969 Q0.0468,0.3222,0.0742,0.3365 T0.1278,0.3542 T0.1807,0.3564 T0.233,0.352 T0.2815,0.3473 T0.3269,0.3509 T0.3656,0.3699 Q0.4037,0.4005,0.4153,0.4082 Q0.405,0.4139,0.3921,0.4174 T0.3633,0.4237 T0.3414,0.4278 Q0.3207,0.4331,0.2956,0.4278 Q0.2943,0.4278,0.293,0.4274 Q0.2933,0.429,0.2938,0.4313 T0.2964,0.4398 T0.3007,0.4513 T0.3069,0.4619 T0.3149,0.4698 Q0.3427,0.4857,0.3664,0.4947 T0.4169,0.5053 Q0.423,0.5057,0.4385,0.5065 T0.4606,0.508 T0.4779,0.51 T0.4958,0.5139 T0.5095,0.5204 Q0.4992,0.5232,0.485,0.5328 T0.451,0.5585 T0.4201,0.5824 Q0.4095,0.5897,0.3987,0.5946 T0.3738,0.6036 T0.3591,0.6081 Q0.3433,0.6134,0.2965,0.605 T0.1972,0.5816 L0.2026,0.5922 T0.2133,0.6134 L0.2188,0.624 Q0.2201,0.6248,0.2214,0.6252 Q0.2291,0.6297,0.2486,0.6405 T0.2786,0.657 T0.3066,0.6721 T0.3353,0.6866 T0.3598,0.6972 T0.383,0.7051 T0.4005,0.7076 Q0.4008,0.7076,0.4169,0.7092 T0.4471,0.7092 T0.475,0.7019 Q0.4895,0.6958,0.5176,0.6811 T0.5644,0.6586 T0.5921,0.6533 Q0.6128,0.6741,0.6173,0.6782 Q0.6131,0.6835,0.6068,0.6929 T0.5963,0.7078 T0.5858,0.7198 T0.5716,0.7304 T0.5534,0.7365 Q0.5179,0.7443,0.4708,0.728 L0.4708,0.7294 T0.471,0.7333 T0.4716,0.7392 T0.4734,0.7463 T0.4764,0.7539 T0.4814,0.7612 T0.4889,0.7679 Q0.4914,0.77,0.4944,0.7716 Q0.5534,0.8104,0.6409,0.8091 Q0.6521,0.8091,0.6654,0.8053 T0.6907,0.7959 T0.7157,0.7838 T0.741,0.772 T0.7652,0.7631 T0.7888,0.7594 T0.8106,0.7643 Q0.8196,0.7684,0.8267,0.7753 Q0.8409,0.7892,0.8399,0.8169 Q0.8216,0.8067,0.8062,0.8053 T0.7788,0.8087 T0.7493,0.825 Q0.7386,0.8324,0.7256,0.8365 T0.6947,0.844 T0.668,0.8499 L0.697,0.894 L0.7002,0.8948 Q0.7099,0.8968,0.7222,0.9009 T0.7446,0.9086 T0.767,0.9158 T0.7901,0.9213 T0.8132,0.9229 T0.8367,0.9192 Q0.8483,0.916,0.8633,0.9241 T0.8937,0.9462 T0.9248,0.9737 T0.959,0.9955 T0.9939,1 Q1,0.9984,0.9932,0.9845 Q0.991,0.9804,0.9877,0.9755 Q0.9813,0.9666,0.9739,0.9606 T0.9626,0.9555 Q0.9519,0.958,0.9372,0.949 T0.9071,0.9262 T0.8753,0.8987 T0.8403,0.8777 T0.8051,0.8752 Q0.787,0.8805,0.7657,0.8772 Q0.7751,0.8736,0.7828,0.8683 Q0.8086,0.8511,0.8262,0.8497 T0.8651,0.8617 Q0.8696,0.865,0.8727,0.8646 T0.8758,0.8605 L0.8761,0.8536 Q0.8774,0.8295,0.8646,0.8016 T0.8277,0.7496 Q0.8086,0.7308,0.7896,0.7219 Q0.7741,0.7145,0.7575,0.7141 T0.727,0.7182 T0.6978,0.7296 T0.6699,0.7439 T0.6433,0.7571 T0.6179,0.7643 Q0.627,0.7561,0.6402,0.7367 T0.6618,0.7088 L0.6673,0.7035 Q0.6718,0.699,0.6647,0.6884 T0.6483,0.6692 L0.6389,0.6607 Q0.6289,0.657,0.6249,0.6554 T0.6163,0.6507 T0.6102,0.6458 T0.6021,0.637 T0.5889,0.6236 Q0.5828,0.6175,0.5766,0.6138 Q0.5673,0.6081,0.5561,0.6077 T0.5345,0.6105 T0.5116,0.6201 T0.4887,0.633 T0.4653,0.6468 T0.4427,0.6578 Q0.4295,0.6635,0.4167,0.665 T0.3888,0.665 T0.3714,0.6635 Q0.3579,0.6631,0.3282,0.6501 Q0.374,0.6578,0.3911,0.6517 Q0.3937,0.6509,0.4024,0.6482 T0.4179,0.6434 T0.4348,0.6364 T0.4534,0.6256 Q0.464,0.6183,0.4892,0.5989 T0.5278,0.5712 T0.5476,0.564 L0.5582,0.5661 Q0.5692,0.5681,0.5634,0.5563 Q0.5599,0.5485,0.5524,0.5392 L0.545,0.5298 Q0.5369,0.5188,0.5286,0.51 T0.5134,0.4947 T0.4979,0.4831 T0.484,0.4749 T0.47,0.4694 T0.4572,0.4657 T0.4442,0.4637 T0.4326,0.4629 T0.4205,0.4625 Q0.4511,0.4543,0.466,0.4384 L0.4714,0.4327 Q0.4795,0.4237,0.4469,0.394 L0.4421,0.3899 Q0.433,0.387,0.4251,0.3834 T0.4122,0.3772 T0.3988,0.3687 T0.3874,0.3603 T0.3732,0.3487 T0.3579,0.3361 Q0.3433,0.3242,0.3288,0.3159 T0.2993,0.3034 T0.2725,0.2973 T0.2446,0.2961 T0.2193,0.2977 T0.1926,0.301 Q0.1855,0.3022,0.182,0.3026 Q0.1991,0.2936,0.2233,0.2781 Q0.3282,0.2117,0.4256,0.2476 Q0.4363,0.2516,0.451,0.2604 T0.4784,0.2779 T0.5077,0.2965 T0.539,0.3124 T0.5718,0.3216 T0.606,0.3206 Q0.6363,0.3136,0.6526,0.2936 T0.6647,0.2459 Q0.6615,0.2247,0.645,0.2023 Q0.6354,0.1892,0.6237,0.179 Q0.6102,0.1672,0.5937,0.1595 Q0.6073,0.1562,0.6215,0.1485 Q0.6396,0.1387,0.6547,0.1354 T0.6839,0.1354 T0.7101,0.1458 T0.7373,0.166 Q0.738,0.1664,0.746,0.1733 T0.7586,0.1841 T0.7733,0.196 T0.7907,0.2086 T0.8086,0.2196 T0.8275,0.2288 T0.8454,0.2337 T0.8627,0.2343 T0.8777,0.228 T0.8903,0.2145 Q0.9038,0.1929,0.8742,0.1582 Q0.869,0.1517,0.8629,0.1464 Q0.8538,0.1387,0.844,0.1321 T0.8248,0.1205 T0.8122,0.1134 Q0.8109,0.1117,0.8053,0.103 T0.7965,0.0899 T0.7875,0.0781 T0.7757,0.064 Q0.8051,0.0616,0.8328,0.0828 Q0.847,0.0934,0.8588,0.1009 T0.8854,0.1146 T0.9127,0.1213 T0.9384,0.116 T0.9626,0.0962 Q0.9664,0.0909,0.9706,0.0846 T0.976,0.0767 T0.9798,0.0728 T0.9852,0.0704 T0.9932,0.0697 Q0.9997,0.0693,0.9942,0.0567 Q0.9923,0.0522,0.989,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0.9099,0.1158 L0.9099,0.1888 L0.9951,0.1888 L0.9951,0.1158 L0.9099,0.1158 Z M0.9075,0.1116 L0.9976,0.1116 Q1,0.1116,1,0.1137 L1,0.1909 Q1,0.193,0.9976,0.193 L0.9075,0.193 Q0.905,0.193,0.905,0.1909 L0.905,0.1137 Q0.905,0.1116,0.9075,0.1116 Z M0.7852,0.6086 L0.7852,0.682 L0.8704,0.682 L0.8704,0.6086 L0.7852,0.6086 Z M0.7828,0.6044 L0.8729,0.6044 Q0.8753,0.6044,0.8753,0.6065 L0.8753,0.6841 Q0.8753,0.6862,0.8729,0.6862 L0.7828,0.6862 Q0.7803,0.6862,0.7803,0.6841 L0.7803,0.6065 Q0.7803,0.6044,0.7828,0.6044 Z M0.66,0.1137 L0.7501,0.1137 L0.7501,0.1909 L0.66,0.1909 L0.66,0.1137 Z M0.6624,0.4102 L0.6624,0.4836 L0.7477,0.4836 L0.7477,0.4102 L0.6624,0.4102 Z M0.66,0.406 L0.7501,0.406 Q0.7526,0.406,0.7526,0.4081 L0.7526,0.4857 Q0.7526,0.4878,0.7501,0.4878 L0.66,0.4878 Q0.6576,0.4878,0.6576,0.4857 L0.6576,0.4081 Q0.6576,0.406,0.66,0.406 Z M0.6624,0.7131 L0.6624,0.7865 L0.7477,0.7865 L0.7477,0.7131 L0.6624,0.7131 Z M0.66,0.7089 L0.7501,0.7089 Q0.7526,0.7089,0.7526,0.711 L0.7526,0.7886 Q0.7526,0.7907,0.7501,0.7907 L0.66,0.7907 Q0.6576,0.7907,0.6576,0.7886 L0.6576,0.711 Q0.6576,0.7089,0.66,0.7089 Z M0.5407,0.2227 L0.5407,0.2836 L0.6113,0.2836 L0.6113,0.2227 L0.5407,0.2227 Z M0.5309,0.206 L0.621,0.206 Q0.623,0.206,0.6249,0.2068 T0.6281,0.2089 T0.6301,0.2116 T0.6308,0.2143 L0.6308,0.2919 Q0.6308,0.2957,0.6276,0.298 T0.621,0.3003 L0.5309,0.3003 Q0.5265,0.3003,0.5239,0.2976 T0.5212,0.2919 L0.5212,0.2143 Q0.5212,0.211,0.5244,0.2085 T0.5309,0.206 Z M0.5407,0.3184 L0.5407,0.3792 L0.6113,0.3792 L0.6113,0.3184 L0.5407,0.3184 Z M0.5309,0.3016 L0.621,0.3016 Q0.6254,0.3016,0.6281,0.3043 T0.6308,0.31 L0.6308,0.3876 Q0.6308,0.3914,0.6276,0.3937 T0.621,0.396 L0.5309,0.396 Q0.5265,0.396,0.5239,0.3932 T0.5212,0.3876 L0.5212,0.31 Q0.5212,0.3062,0.5244,0.3039 T0.5309,0.3016 Z M0.5309,0.4081 L0.621,0.4081 L0.621,0.4857 L0.5309,0.4857 L0.5309,0.4081 Z M0.5309,0.5059 L0.621,0.5059 L0.621,0.5835 L0.5309,0.5835 L0.5309,0.5059 Z M0.5407,0.6149 L0.5407,0.6758 L0.6113,0.6758 L0.6113,0.6149 L0.5407,0.6149 Z M0.5309,0.5982 L0.621,0.5982 Q0.6254,0.5982,0.6281,0.6009 T0.6308,0.6065 L0.6308,0.6841 Q0.6308,0.6879,0.6276,0.6902 T0.621,0.6925 L0.5309,0.6925 Q0.5265,0.6925,0.5239,0.6898 T0.5212,0.6841 L0.5212,0.6065 Q0.5212,0.6028,0.5244,0.6005 T0.5309,0.5982 Z M0.4062,0.1137 L0.4963,0.1137 L0.4963,0.1909 L0.4062,0.1909 L0.4062,0.1137 Z M0.4062,0.2143 L0.4963,0.2143 L0.4963,0.2919 L0.4062,0.2919 L0.4062,0.2143 Z M0.4184,0.4186 L0.4184,0.4753 L0.4842,0.4753 L0.4842,0.4186 L0.4184,0.4186 Z M0.4062,0.3977 L0.4963,0.3977 Q0.5017,0.3977,0.5051,0.401 T0.5085,0.4081 L0.5085,0.4857 Q0.5085,0.4904,0.5046,0.4933 T0.4963,0.4962 L0.4062,0.4962 Q0.4009,0.4962,0.3975,0.4929 T0.3941,0.4857 L0.3941,0.4081 Q0.3941,0.4035,0.398,0.4006 T0.4062,0.3977 Z M0.4062,0.5059 L0.4963,0.5059 L0.4963,0.5835 L0.4062,0.5835 L0.4062,0.5059 Z M0.4087,0.7131 L0.4087,0.7865 L0.4939,0.7865 L0.4939,0.7131 L0.4087,0.7131 Z M0.4062,0.7089 L0.4963,0.7089 Q0.4988,0.7089,0.4988,0.711 L0.4988,0.7886 Q0.4988,0.7907,0.4963,0.7907 L0.4062,0.7907 Q0.4038,0.7907,0.4038,0.7886 L0.4038,0.711 Q0.4038,0.7089,0.4062,0.7089 Z M0.2689,0.1137 L0.359,0.1137 L0.359,0.1909 L0.2689,0.1909 L0.2689,0.1137 Z M0.2689,0.2143 L0.359,0.2143 L0.359,0.2919 L0.2689,0.2919 L0.2689,0.2143 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.31 L0.359,0.31 L0.359,0.3876 L0.2689,0.3876 L0.2689,0.31 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.4081 L0.359,0.4081 L0.359,0.4857 L0.2689,0.4857 L0.2689,0.4081 Z M0.2689,0.5059 L0.359,0.5059 L0.359,0.5835 L0.2689,0.5835 L0.2689,0.5059 Z M0.2689,0.711 L0.359,0.711 L0.359,0.7886 L0.2689,0.7886 L0.2689,0.711 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.1374,0.1137 L0.2275,0.1137 L0.2275,0.1909 L0.1374,0.1909 L0.1374,0.1137 Z M0.1374,0.2143 L0.2275,0.2143 L0.2275,0.2919 L0.1374,0.2919 L0.1374,0.2143 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.31 L0.2275,0.31 L0.2275,0.3876 L0.1374,0.3876 L0.1374,0.31 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.4081 L0.2275,0.4081 L0.2275,0.4857 L0.1374,0.4857 L0.1374,0.4081 Z M0.1374,0.5059 L0.2275,0.5059 L0.2275,0.5835 L0.1374,0.5835 L0.1374,0.5059 Z M0.1374,0.6065 L0.2275,0.6065 L0.2275,0.6841 L0.1374,0.6841 L0.1374,0.6065 Z M0.1374,0.711 L0.2275,0.711 L0.2275,0.7886 L0.1374,0.7886 L0.1374,0.711 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0,0.1137 L0.0901,0.1137 L0.0901,0.1909 L0,0.1909 L0,0.1137 Z M0,0.2143 L0.0901,0.2143 L0.0901,0.2919 L0,0.2919 L0,0.2143 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.31 L0.0901,0.31 L0.0901,0.3876 L0,0.3876 L0,0.31 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.4081 L0.0901,0.4081 L0.0901,0.4857 L0,0.4857 L0,0.4081 Z M0,0.5059 L0.0901,0.5059 L0.0901,0.5835 L0,0.5835 L0,0.5059 Z M0,0.6065 L0.0901,0.6065 L0.0901,0.6841 L0,0.6841 L0,0.6065 Z M0,0.711 L0.0901,0.711 L0.0901,0.7886 L0,0.7886 L0,0.711 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M0.0901,0.1158 L0.0901,0.1888 L0.0049,0.1888 L0.0049,0.1158 L0.0901,0.1158 Z M0.0925,0.1116 L0.0024,0.1116 Q0,0.1116,0,0.1137 L0,0.1909 Q0,0.193,0.0024,0.193 L0.0925,0.193 Q0.095,0.193,0.095,0.1909 L0.095,0.1137 Q0.095,0.1116,0.0925,0.1116 Z M0.2148,0.6086 L0.2148,0.682 L0.1296,0.682 L0.1296,0.6086 L0.2148,0.6086 Z M0.2172,0.6044 L0.1271,0.6044 Q0.1247,0.6044,0.1247,0.6065 L0.1247,0.6841 Q0.1247,0.6862,0.1271,0.6862 L0.2172,0.6862 Q0.2197,0.6862,0.2197,0.6841 L0.2197,0.6065 Q0.2197,0.6044,0.2172,0.6044 Z M0.34,0.1137 L0.2499,0.1137 L0.2499,0.1909 L0.34,0.1909 L0.34,0.1137 Z M0.3376,0.4102 L0.3376,0.4836 L0.2523,0.4836 L0.2523,0.4102 L0.3376,0.4102 Z M0.34,0.406 L0.2499,0.406 Q0.2474,0.406,0.2474,0.4081 L0.2474,0.4857 Q0.2474,0.4878,0.2499,0.4878 L0.34,0.4878 Q0.3424,0.4878,0.3424,0.4857 L0.3424,0.4081 Q0.3424,0.406,0.34,0.406 Z M0.3376,0.7131 L0.3376,0.7865 L0.2523,0.7865 L0.2523,0.7131 L0.3376,0.7131 Z M0.34,0.7089 L0.2499,0.7089 Q0.2474,0.7089,0.2474,0.711 L0.2474,0.7886 Q0.2474,0.7907,0.2499,0.7907 L0.34,0.7907 Q0.3424,0.7907,0.3424,0.7886 L0.3424,0.711 Q0.3424,0.7089,0.34,0.7089 Z M0.4593,0.2227 L0.4593,0.2836 L0.3887,0.2836 L0.3887,0.2227 L0.4593,0.2227 Z M0.4691,0.206 L0.379,0.206 Q0.3746,0.206,0.3719,0.2087 T0.3692,0.2143 L0.3692,0.2919 Q0.3692,0.2957,0.3724,0.298 T0.379,0.3003 L0.4691,0.3003 Q0.4735,0.3003,0.4761,0.2976 T0.4788,0.2919 L0.4788,0.2143 Q0.4788,0.211,0.4756,0.2085 T0.4691,0.206 Z M0.4593,0.3184 L0.4593,0.3792 L0.3887,0.3792 L0.3887,0.3184 L0.4593,0.3184 Z M0.4691,0.3016 L0.379,0.3016 Q0.3746,0.3016,0.3719,0.3043 T0.3692,0.31 L0.3692,0.3876 Q0.3692,0.3914,0.3724,0.3937 T0.379,0.396 L0.4691,0.396 Q0.4735,0.396,0.4761,0.3932 T0.4788,0.3876 L0.4788,0.31 Q0.4788,0.3062,0.4756,0.3039 T0.4691,0.3016 Z M0.4691,0.4081 L0.379,0.4081 L0.379,0.4857 L0.4691,0.4857 L0.4691,0.4081 Z M0.4691,0.5059 L0.379,0.5059 L0.379,0.5835 L0.4691,0.5835 L0.4691,0.5059 Z M0.4593,0.6149 L0.4593,0.6758 L0.3887,0.6758 L0.3887,0.6149 L0.4593,0.6149 Z M0.4691,0.5982 L0.379,0.5982 Q0.3746,0.5982,0.3719,0.6009 T0.3692,0.6065 L0.3692,0.6841 Q0.3692,0.6879,0.3724,0.6902 T0.379,0.6925 L0.4691,0.6925 Q0.4735,0.6925,0.4761,0.6898 T0.4788,0.6841 L0.4788,0.6065 Q0.4788,0.6028,0.4756,0.6005 T0.4691,0.5982 Z M0.5938,0.1137 L0.5037,0.1137 L0.5037,0.1909 L0.5938,0.1909 L0.5938,0.1137 Z M0.5938,0.2143 L0.5037,0.2143 L0.5037,0.2919 L0.5938,0.2919 L0.5938,0.2143 Z M0.5816,0.4186 L0.5816,0.4753 L0.5158,0.4753 L0.5158,0.4186 L0.5816,0.4186 Z M0.5938,0.3977 L0.5037,0.3977 Q0.4983,0.3977,0.4949,0.401 T0.4915,0.4081 L0.4915,0.4857 Q0.4915,0.4904,0.4954,0.4933 T0.5037,0.4962 L0.5938,0.4962 Q0.5991,0.4962,0.6025,0.4929 T0.6059,0.4857 L0.6059,0.4081 Q0.6059,0.4035,0.602,0.4006 T0.5938,0.3977 Z M0.5938,0.5059 L0.5037,0.5059 L0.5037,0.5835 L0.5938,0.5835 L0.5938,0.5059 Z M0.5913,0.7131 L0.5913,0.7865 L0.5061,0.7865 L0.5061,0.7131 L0.5913,0.7131 Z M0.5938,0.7089 L0.5037,0.7089 Q0.5012,0.7089,0.5012,0.711 L0.5012,0.7886 Q0.5012,0.7907,0.5037,0.7907 L0.5938,0.7907 Q0.5962,0.7907,0.5962,0.7886 L0.5962,0.711 Q0.5962,0.7089,0.5938,0.7089 Z M0.7311,0.1137 L0.641,0.1137 L0.641,0.1909 L0.7311,0.1909 L0.7311,0.1137 Z M0.7311,0.2143 L0.641,0.2143 L0.641,0.2919 L0.7311,0.2919 L0.7311,0.2143 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.31 L0.641,0.31 L0.641,0.3876 L0.7311,0.3876 L0.7311,0.31 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.4081 L0.641,0.4081 L0.641,0.4857 L0.7311,0.4857 L0.7311,0.4081 Z M0.7311,0.5059 L0.641,0.5059 L0.641,0.5835 L0.7311,0.5835 L0.7311,0.5059 Z M0.7311,0.711 L0.641,0.711 L0.641,0.7886 L0.7311,0.7886 L0.7311,0.711 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.8626,0.1137 L0.7725,0.1137 L0.7725,0.1909 L0.8626,0.1909 L0.8626,0.1137 Z M0.8626,0.2143 L0.7725,0.2143 L0.7725,0.2919 L0.8626,0.2919 L0.8626,0.2143 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.31 L0.7725,0.31 L0.7725,0.3876 L0.8626,0.3876 L0.8626,0.31 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.4081 L0.7725,0.4081 L0.7725,0.4857 L0.8626,0.4857 L0.8626,0.4081 Z M0.8626,0.5059 L0.7725,0.5059 L0.7725,0.5835 L0.8626,0.5835 L0.8626,0.5059 Z M0.8626,0.6065 L0.7725,0.6065 L0.7725,0.6841 L0.8626,0.6841 L0.8626,0.6065 Z M0.8626,0.711 L0.7725,0.711 L0.7725,0.7886 L0.8626,0.7886 L0.8626,0.711 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M1,0.1137 L0.9099,0.1137 L0.9099,0.1909 L1,0.1909 L1,0.1137 Z M1,0.2143 L0.9099,0.2143 L0.9099,0.2919 L1,0.2919 L1,0.2143 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.31 L0.9099,0.31 L0.9099,0.3876 L1,0.3876 L1,0.31 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.4081 L0.9099,0.4081 L0.9099,0.4857 L1,0.4857 L1,0.4081 Z M1,0.5059 L0.9099,0.5059 L0.9099,0.5835 L1,0.5835 L1,0.5059 Z M1,0.6065 L0.9099,0.6065 L0.9099,0.6841 L1,0.6841 L1,0.6065 Z M1,0.711 L0.9099,0.711 L0.9099,0.7886 L1,0.7886 L1,0.711 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0.8574,0.3217 L0.8574,0.4098 L0.9691,0.4098 L0.9691,0.3217 L0.8574,0.3217 Z M0.8419,0.2978 L0.9846,0.2978 Q0.9892,0.2978,0.9928,0.2997 T0.9982,0.3043 T1,0.31 L1,0.4216 Q1,0.427,0.9951,0.4304 T0.9846,0.4337 L0.8419,0.4337 Q0.8352,0.4337,0.8308,0.4299 T0.8265,0.4216 L0.8265,0.31 Q0.8265,0.3062,0.829,0.3035 T0.835,0.2993 T0.8419,0.2978 Z M0.8574,0.888 L0.8574,0.9757 L0.9691,0.9757 L0.9691,0.888 L0.8574,0.888 Z M0.8419,0.8637 L0.9846,0.8637 Q0.9892,0.8637,0.9928,0.8658 T0.9982,0.8706 T1,0.8758 L1,0.9878 Q1,0.9929,0.9951,0.9964 T0.9846,1 L0.8419,1 Q0.8352,1,0.8308,0.996 T0.8265,0.9878 L0.8265,0.8758 Q0.8265,0.8708,0.8314,0.8672 T0.8419,0.8637 Z M0.6509,0.169 L0.6509,0.2706 L0.7806,0.2706 L0.7806,0.169 L0.6509,0.169 Z M0.6442,0.159 L0.7868,0.159 Q0.7899,0.159,0.7917,0.1604 T0.7935,0.164 L0.7935,0.2756 Q0.7935,0.2781,0.7915,0.2796 T0.7868,0.281 L0.6442,0.281 Q0.6416,0.281,0.6395,0.2794 T0.6375,0.2756 L0.6375,0.164 Q0.6375,0.1619,0.6398,0.1604 T0.6442,0.159 Z M0.6632,0.6044 L0.6632,0.6858 L0.7678,0.6858 L0.7678,0.6044 L0.6632,0.6044 Z M0.6442,0.5742 L0.7868,0.5742 Q0.7951,0.5742,0.8007,0.5791 T0.8064,0.5893 L0.8064,0.7013 Q0.8064,0.7076,0.8002,0.712 T0.7868,0.7164 L0.6442,0.7164 Q0.6359,0.7164,0.6305,0.7114 T0.6251,0.7013 L0.6251,0.5893 Q0.6251,0.5847,0.6282,0.5812 T0.6357,0.5759 T0.6442,0.5742 Z M0.4264,0.164 L0.5695,0.164 L0.5695,0.2756 L0.4264,0.2756 L0.4264,0.164 Z M0.4325,0.315 L0.4325,0.4165 L0.5628,0.4165 L0.5628,0.315 L0.4325,0.315 Z M0.4264,0.3049 L0.5695,0.3049 Q0.5721,0.3049,0.5739,0.3064 T0.5757,0.31 L0.5757,0.4216 Q0.5757,0.4237,0.5736,0.4251 T0.5695,0.4266 L0.4264,0.4266 Q0.4238,0.4266,0.422,0.4251 T0.4202,0.4216 L0.4202,0.31 Q0.4202,0.3087,0.4207,0.3077 T0.4222,0.306 T0.4243,0.3052 T0.4264,0.3049 Z M0.4264,0.4476 L0.5695,0.4476 L0.5695,0.5596 L0.4264,0.5596 L0.4264,0.4476 Z M0.4392,0.7408 L0.4392,0.8326 L0.5561,0.8326 L0.5561,0.7408 L0.4392,0.7408 Z M0.4264,0.7206 L0.5695,0.7206 Q0.5747,0.7206,0.5783,0.724 T0.5819,0.7307 L0.5819,0.8427 Q0.5819,0.8469,0.5778,0.8498 T0.5695,0.8528 L0.4264,0.8528 Q0.4207,0.8528,0.4171,0.8496 T0.4135,0.8427 L0.4135,0.7307 Q0.4135,0.7265,0.4176,0.7236 T0.4264,0.7206 Z M0.2178,0.164 L0.3605,0.164 L0.3605,0.2756 L0.2178,0.2756 L0.2178,0.164 Z M0.2178,0.31 L0.3605,0.31 L0.3605,0.4216 L0.2178,0.4216 L0.2178,0.31 Z M0.2178,0.5893 L0.3605,0.5893 L0.3605,0.7013 L0.2178,0.7013 L0.2178,0.5893 Z M0.2178,0.7307 L0.3605,0.7307 L0.3605,0.8427 L0.2178,0.8427 L0.2178,0.7307 Z M0.2178,0.8758 L0.3605,0.8758 L0.3605,0.9878 L0.2178,0.9878 L0.2178,0.8758 Z M0,0.164 L0.1432,0.164 L0.1432,0.2756 L0,0.2756 L0,0.164 Z M0,0.31 L0.1432,0.31 L0.1432,0.4216 L0,0.4216 L0,0.31 Z M0,0.4476 L0.1432,0.4476 L0.1432,0.5596 L0,0.5596 L0,0.4476 Z M0,0.5893 L0.1432,0.5893 L0.1432,0.7013 L0,0.7013 L0,0.5893 Z M0,0.7307 L0.1432,0.7307 L0.1432,0.8427 L0,0.8427 L0,0.7307 Z M0,0.8758 L0.1432,0.8758 L0.1432,0.9878 L0,0.9878 L0,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M0.1432,0.3217 L0.1432,0.4098 L0.0309,0.4098 L0.0309,0.3217 L0.1432,0.3217 Z M0.1586,0.2978 L0.0154,0.2978 Q0.0088,0.2978,0.0044,0.3016 T0,0.31 L0,0.4216 Q0,0.427,0.0049,0.4304 T0.0154,0.4337 L0.1586,0.4337 Q0.1648,0.4337,0.1694,0.4299 T0.174,0.4216 L0.174,0.31 Q0.174,0.3062,0.1715,0.3035 T0.1653,0.2993 T0.1586,0.2978 Z M0.1432,0.888 L0.1432,0.9757 L0.0309,0.9757 L0.0309,0.888 L0.1432,0.888 Z M0.1586,0.8637 L0.0154,0.8637 Q0.0108,0.8637,0.0072,0.8658 T0.0018,0.8706 T0,0.8758 L0,0.9878 Q0,0.9929,0.0049,0.9964 T0.0154,1 L0.1586,1 Q0.1648,1,0.1694,0.996 T0.174,0.9878 L0.174,0.8758 Q0.174,0.8725,0.1715,0.8695 T0.1653,0.8651 T0.1586,0.8637 Z M0.3496,0.169 L0.3496,0.2706 L0.2194,0.2706 L0.2194,0.169 L0.3496,0.169 Z M0.3563,0.159 L0.2132,0.159 Q0.2106,0.159,0.2088,0.1604 T0.207,0.164 L0.207,0.2756 Q0.207,0.2781,0.2091,0.2796 T0.2132,0.281 L0.3563,0.281 Q0.3589,0.281,0.3607,0.2794 T0.3625,0.2756 L0.3625,0.164 Q0.3625,0.1619,0.3605,0.1604 T0.3563,0.159 Z M0.3368,0.6044 L0.3368,0.6858 L0.2327,0.6858 L0.2327,0.6044 L0.3368,0.6044 Z M0.3563,0.5742 L0.2132,0.5742 Q0.2049,0.5742,0.1993,0.5791 T0.1936,0.5893 L0.1936,0.7013 Q0.1936,0.7076,0.2001,0.712 T0.2132,0.7164 L0.3563,0.7164 Q0.3641,0.7164,0.3697,0.7114 T0.3754,0.7013 L0.3754,0.5893 Q0.3754,0.5847,0.3723,0.5812 T0.3648,0.5759 T0.3563,0.5742 Z M0.5736,0.164 L0.431,0.164 L0.431,0.2756 L0.5736,0.2756 L0.5736,0.164 Z M0.5675,0.315 L0.5675,0.4165 L0.4377,0.4165 L0.4377,0.315 L0.5675,0.315 Z M0.5736,0.3049 L0.431,0.3049 Q0.4284,0.3049,0.4264,0.3064 T0.4243,0.31 L0.4243,0.4216 Q0.4243,0.4237,0.4266,0.4251 T0.431,0.4266 L0.5736,0.4266 Q0.5767,0.4266,0.5785,0.4251 T0.5803,0.4216 L0.5803,0.31 Q0.5803,0.3087,0.5798,0.3077 T0.5783,0.306 T0.5762,0.3052 T0.5736,0.3049 Z M0.5736,0.4476 L0.431,0.4476 L0.431,0.5596 L0.5736,0.5596 L0.5736,0.4476 Z M0.5613,0.7408 L0.5613,0.8326 L0.4439,0.8326 L0.4439,0.7408 L0.5613,0.7408 Z M0.5736,0.7206 L0.431,0.7206 Q0.4253,0.7206,0.4217,0.724 T0.4181,0.7307 L0.4181,0.8427 Q0.4181,0.8469,0.4222,0.8498 T0.431,0.8528 L0.5736,0.8528 Q0.5778,0.8528,0.5808,0.8511 T0.5855,0.8471 T0.587,0.8427 L0.587,0.7307 Q0.587,0.7265,0.5826,0.7236 T0.5736,0.7206 Z M0.7827,0.164 L0.6395,0.164 L0.6395,0.2756 L0.7827,0.2756 L0.7827,0.164 Z M0.7827,0.31 L0.6395,0.31 L0.6395,0.4216 L0.7827,0.4216 L0.7827,0.31 Z M0.7827,0.5893 L0.6395,0.5893 L0.6395,0.7013 L0.7827,0.7013 L0.7827,0.5893 Z M0.7827,0.7307 L0.6395,0.7307 L0.6395,0.8427 L0.7827,0.8427 L0.7827,0.7307 Z M0.7827,0.8758 L0.6395,0.8758 L0.6395,0.9878 L0.7827,0.9878 L0.7827,0.8758 Z M1,0.164 L0.8574,0.164 L0.8574,0.2756 L1,0.2756 L1,0.164 Z M1,0.31 L0.8574,0.31 L0.8574,0.4216 L1,0.4216 L1,0.31 Z M1,0.4476 L0.8574,0.4476 L0.8574,0.5596 L1,0.5596 L1,0.4476 Z M1,0.5893 L0.8574,0.5893 L0.8574,0.7013 L1,0.7013 L1,0.5893 Z M1,0.7307 L0.8574,0.7307 L0.8574,0.8427 L1,0.8427 L1,0.7307 Z M1,0.8758 L0.8574,0.8758 L0.8574,0.9878 L1,0.9878 L1,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.0008,0.9979 Q0.0008,1,0.0032,1 Q0.0482,1,0.0602,0.9975 Q0.0667,0.9963,0.0847,0.9917 T0.1084,0.9859 Q0.1124,0.9851,0.1221,0.9851 L0.1253,0.9851 L0.1285,0.9851 Q0.1518,0.9851,0.1655,0.9809 Q0.1695,0.9801,0.1731,0.9788 T0.1791,0.9766 T0.1839,0.9747 T0.1888,0.9732 L0.1936,0.972 T0.1988,0.9712 T0.2048,0.971 L0.2096,0.971 Q0.2201,0.9714,0.2233,0.9714 T0.2345,0.9693 Q0.2386,0.9685,0.2502,0.9674 T0.2715,0.966 L0.2811,0.9656 Q0.2916,0.9647,0.2916,0.9573 Q0.2916,0.954,0.2892,0.9515 T0.2819,0.9486 Q0.2755,0.9482,0.2683,0.9482 Q0.2643,0.9482,0.2582,0.9484 T0.2498,0.9486 Q0.2426,0.9486,0.2402,0.9473 Q0.2386,0.9469,0.2317,0.943 T0.2161,0.937 Q0.2104,0.9357,0.1992,0.933 T0.1831,0.9291 Q0.1807,0.9287,0.1783,0.9285 T0.1739,0.928 T0.1703,0.9276 T0.1675,0.9272 T0.1655,0.9266 T0.1639,0.9253 Q0.1598,0.9216,0.1462,0.9216 L0.143,0.9216 L0.1398,0.9216 L0.1365,0.9216 Q0.1197,0.9195,0.1197,0.9154 L0.1197,0.9154 Q0.1205,0.9121,0.1373,0.9088 T0.1703,0.9054 Q0.1791,0.9054,0.1863,0.904 T0.1984,0.9011 T0.2064,0.8992 Q0.2402,0.8967,0.2506,0.8934 Q0.2538,0.8926,0.2602,0.8899 T0.2707,0.8872 Q0.2715,0.8872,0.2731,0.8876 Q0.2795,0.8884,0.2884,0.8884 Q0.3068,0.8884,0.3092,0.8826 L0.3092,0.8797 Q0.3092,0.8772,0.3076,0.8747 T0.3044,0.8706 T0.3028,0.8681 Q0.3076,0.8656,0.3237,0.8656 Q0.3317,0.8656,0.3622,0.8623 Q0.3655,0.8623,0.3867,0.8617 T0.4217,0.8602 Q0.4241,0.8598,0.4289,0.8598 L0.4345,0.8598 L0.441,0.8598 Q0.4578,0.8598,0.4667,0.8586 Q0.4739,0.8573,0.4851,0.8567 T0.5004,0.8552 Q0.5012,0.8552,0.5108,0.855 T0.5269,0.853 T0.5333,0.8461 Q0.5333,0.8445,0.5325,0.8432 T0.5309,0.8409 T0.5289,0.8391 T0.5261,0.8378 L0.5229,0.837 T0.5185,0.8362 T0.5133,0.8355 T0.5076,0.8349 T0.502,0.8341 Q0.4932,0.8324,0.4859,0.8324 Q0.4827,0.8324,0.4787,0.8328 T0.4731,0.8333 Q0.4707,0.8333,0.4683,0.8324 Q0.4482,0.825,0.4394,0.825 Q0.4369,0.825,0.4345,0.8254 Q0.4225,0.827,0.4153,0.827 Q0.4088,0.827,0.4064,0.8258 Q0.3976,0.8204,0.3751,0.8204 Q0.3703,0.8204,0.3667,0.8214 T0.3622,0.8225 Q0.3598,0.8225,0.3558,0.82 Q0.351,0.8175,0.3402,0.8167 T0.3177,0.8156 T0.3028,0.8146 L0.2956,0.8121 T0.2871,0.8094 T0.2771,0.8073 T0.2635,0.8063 Q0.261,0.8063,0.2586,0.8067 Q0.2378,0.8071,0.2273,0.8071 Q0.2072,0.8071,0.2024,0.8051 Q0.1976,0.8034,0.1932,0.8026 T0.1867,0.8013 T0.1847,0.8001 L0.1847,0.7993 Q0.1855,0.7984,0.1855,0.7978 T0.1859,0.7966 T0.1867,0.7959 T0.188,0.7955 T0.1896,0.7951 T0.1916,0.7949 T0.1944,0.7945 T0.1984,0.7941 T0.2032,0.7939 Q0.212,0.7926,0.2325,0.7918 T0.2562,0.7905 Q0.2691,0.7893,0.2787,0.7847 Q0.2835,0.7827,0.2968,0.7791 T0.3149,0.7756 Q0.3189,0.7756,0.3305,0.7733 T0.3446,0.771 L0.3454,0.771 Q0.3462,0.771,0.3498,0.7721 T0.3574,0.774 T0.3655,0.7748 Q0.3703,0.7748,0.3743,0.7731 T0.3823,0.7708 T0.3916,0.77 T0.3992,0.7694 Q0.4008,0.7694,0.4076,0.7688 T0.4205,0.7675 L0.4305,0.7665 Q0.4345,0.7657,0.4402,0.7617 T0.4458,0.7545 Q0.4458,0.7503,0.4353,0.7487 Q0.4297,0.7478,0.4209,0.7462 T0.4044,0.7433 T0.3904,0.7416 L0.3847,0.7416 Q0.3807,0.7416,0.3747,0.7422 T0.3663,0.7428 T0.3606,0.7424 Q0.3582,0.742,0.3562,0.7418 T0.3522,0.7412 T0.3482,0.7406 T0.3446,0.7401 T0.341,0.7397 T0.3373,0.7393 T0.3341,0.7391 L0.3293,0.7391 Q0.3277,0.7395,0.3253,0.7395 Q0.3205,0.7395,0.3052,0.7387 T0.2835,0.7379 Q0.2755,0.7379,0.253,0.7325 Q0.2506,0.7316,0.2462,0.731 T0.2382,0.7296 T0.2305,0.7271 T0.2181,0.7234 T0.2048,0.7196 T0.2,0.7155 Q0.2,0.7142,0.2016,0.713 Q0.208,0.7059,0.2285,0.6978 T0.2618,0.6898 Q0.2739,0.6898,0.2831,0.6848 T0.2956,0.6794 Q0.3028,0.6786,0.3289,0.6765 T0.3566,0.674 Q0.3582,0.674,0.3855,0.6723 T0.4406,0.6688 T0.4755,0.6653 Q0.5004,0.6607,0.5124,0.6599 L0.5165,0.6599 Q0.5213,0.6599,0.5277,0.6605 T0.5373,0.6611 Q0.543,0.6611,0.5494,0.6599 Q0.592,0.6524,0.6,0.6524 Q0.6064,0.6524,0.61,0.6499 T0.6161,0.6474 Q0.6177,0.6474,0.6261,0.6495 T0.6418,0.6516 L0.6482,0.6516 Q0.653,0.6512,0.6651,0.6506 T0.6876,0.6493 T0.7084,0.6477 T0.7229,0.645 Q0.7269,0.6437,0.7333,0.6437 Q0.7373,0.6437,0.7458,0.6443 T0.7574,0.645 Q0.7614,0.645,0.7631,0.6445 T0.7655,0.6441 Q0.7671,0.6441,0.7723,0.6448 T0.7823,0.6454 Q0.788,0.6454,0.7952,0.6445 Q0.8233,0.6408,0.8723,0.6367 Q0.9012,0.6342,0.9092,0.6342 L0.9165,0.6342 L0.9205,0.6342 Q0.9277,0.6342,0.9382,0.6323 T0.9526,0.6304 Q0.9534,0.6304,0.9594,0.6307 T0.9695,0.6309 Q0.9976,0.6309,0.9992,0.6234 Q1,0.6201,1,0.618 Q1,0.6089,0.9775,0.608 Q0.9703,0.6076,0.9582,0.6076 Q0.9518,0.6076,0.9394,0.6078 T0.9213,0.608 Q0.9036,0.608,0.8972,0.6072 Q0.894,0.6068,0.8871,0.6058 T0.8751,0.6039 T0.8627,0.6024 T0.8506,0.6018 L0.8474,0.6018 Q0.841,0.6022,0.8281,0.6041 T0.8112,0.606 Q0.8096,0.606,0.808,0.6056 Q0.7783,0.6002,0.7647,0.6002 Q0.7598,0.6002,0.7454,0.6006 T0.7261,0.601 Q0.7221,0.601,0.7145,0.6022 T0.7036,0.6035 Q0.6996,0.6035,0.6964,0.6022 Q0.6723,0.5902,0.6442,0.5902 Q0.6426,0.5902,0.6386,0.5904 T0.6337,0.5906 Q0.6273,0.5906,0.6249,0.5894 L0.6177,0.5856 T0.6116,0.5838 T0.6016,0.5825 T0.5855,0.5823 Q0.5719,0.5823,0.5574,0.5798 T0.5373,0.5774 L0.5341,0.5774 Q0.5293,0.5778,0.5213,0.5786 T0.51,0.5794 Q0.5036,0.5794,0.4988,0.5769 Q0.4932,0.574,0.4771,0.574 Q0.4723,0.574,0.4631,0.5745 T0.4498,0.5749 Q0.4418,0.5749,0.4394,0.5736 Q0.4353,0.5724,0.4305,0.5715 T0.4225,0.5707 T0.4145,0.5705 T0.4056,0.5699 Q0.4008,0.5691,0.398,0.5689 T0.394,0.5689 T0.3908,0.5686 T0.3855,0.5674 Q0.3831,0.567,0.3811,0.5662 T0.3779,0.5645 T0.3743,0.563 T0.3695,0.5624 Q0.3655,0.5624,0.3594,0.5635 T0.3494,0.5645 T0.3406,0.5635 T0.3325,0.5624 Q0.3309,0.5624,0.3301,0.5628 L0.3141,0.5628 Q0.2635,0.5628,0.2506,0.5612 Q0.2474,0.5608,0.2434,0.5608 Q0.2402,0.5608,0.2349,0.561 T0.2273,0.5612 Q0.2209,0.5612,0.2177,0.5595 Q0.2145,0.557,0.2145,0.5558 Q0.2169,0.5537,0.2345,0.5521 Q0.2876,0.5475,0.3028,0.5425 Q0.3068,0.5413,0.3149,0.5396 T0.3309,0.5367 T0.3478,0.5338 T0.3606,0.5309 Q0.3631,0.5305,0.3755,0.5259 T0.3968,0.5214 Q0.3992,0.5214,0.4024,0.5218 T0.4096,0.5222 Q0.4161,0.5222,0.4213,0.5209 T0.4313,0.5185 T0.4402,0.5172 Q0.4418,0.5168,0.447,0.5168 L0.4558,0.5168 T0.4639,0.5162 T0.4707,0.5141 T0.4731,0.5102 Q0.4731,0.5089,0.4723,0.5081 Q0.4699,0.5019,0.4627,0.4994 T0.4369,0.4965 Q0.4273,0.4961,0.4193,0.4946 T0.4048,0.4915 T0.3952,0.4894 Q0.392,0.4886,0.388,0.4886 Q0.3847,0.4886,0.3775,0.4892 T0.3647,0.4898 Q0.3598,0.4898,0.355,0.4894 Q0.3165,0.4861,0.3141,0.4853 Q0.2779,0.4774,0.2715,0.4774 Q0.2699,0.4774,0.2683,0.4776 T0.2627,0.4778 Q0.2498,0.4778,0.2281,0.4762 Q0.2241,0.4749,0.2233,0.4737 Q0.2249,0.472,0.2321,0.4708 Q0.2402,0.4695,0.2554,0.4695 L0.2675,0.4695 L0.2795,0.4695 Q0.294,0.4695,0.2996,0.4679 Q0.3141,0.4629,0.3373,0.4616 Q0.3414,0.4612,0.3466,0.4606 T0.3582,0.4589 T0.3687,0.4562 T0.3727,0.4525 Q0.3727,0.4509,0.3703,0.4492 Q0.3639,0.4455,0.3474,0.4419 T0.3213,0.4384 L0.3157,0.4384 L0.31,0.4384 Q0.294,0.4384,0.2859,0.4363 Q0.2795,0.4347,0.2691,0.4347 L0.2618,0.4347 L0.2546,0.4347 Q0.2458,0.4347,0.2394,0.4338 Q0.2257,0.4318,0.2193,0.4303 T0.2092,0.4266 T0.2052,0.4224 T0.2024,0.4154 T0.196,0.4052 Q0.1912,0.3994,0.1867,0.3949 T0.1807,0.3884 T0.1791,0.3849 Q0.1791,0.3824,0.1839,0.3745 Q0.1871,0.3687,0.1944,0.3637 T0.2072,0.3561 T0.2221,0.3501 T0.2321,0.3463 Q0.2353,0.3455,0.241,0.3445 T0.2522,0.3428 T0.2639,0.3411 T0.2731,0.3384 T0.2956,0.3351 T0.3197,0.3326 Q0.3213,0.3322,0.3237,0.3322 T0.3325,0.3331 T0.3414,0.3339 Q0.3478,0.3339,0.3518,0.3314 Q0.3606,0.3264,0.3703,0.3264 Q0.3775,0.3264,0.3847,0.3293 Q0.3888,0.331,0.396,0.331 Q0.4024,0.331,0.4116,0.3295 T0.4265,0.3266 T0.4414,0.3227 T0.4514,0.3202 Q0.4578,0.3181,0.4839,0.3152 T0.5112,0.3123 T0.5177,0.3119 T0.5285,0.3111 T0.5398,0.3096 T0.549,0.3065 T0.5526,0.3015 Q0.5526,0.2999,0.5518,0.2982 Q0.547,0.2903,0.5386,0.2883 T0.5165,0.2862 Q0.5116,0.2862,0.5056,0.2866 T0.4972,0.287 Q0.4884,0.287,0.4787,0.2833 Q0.4594,0.2758,0.4265,0.2758 Q0.4169,0.2758,0.4129,0.2766 Q0.4112,0.2771,0.4104,0.2771 Q0.4088,0.2771,0.4056,0.2748 T0.3968,0.2721 Q0.3695,0.2696,0.359,0.2659 Q0.355,0.2646,0.351,0.2646 T0.3426,0.2661 T0.3365,0.2675 T0.3333,0.2659 Q0.3277,0.2605,0.3116,0.2553 T0.2859,0.2501 L0.2843,0.2501 L0.2819,0.2501 Q0.2779,0.2501,0.2723,0.2493 T0.2586,0.2472 T0.2474,0.2455 Q0.1799,0.236,0.1719,0.236 Q0.1663,0.236,0.1606,0.235 T0.1502,0.2316 T0.1454,0.2265 Q0.1454,0.2223,0.1558,0.2173 Q0.1679,0.2115,0.1859,0.2092 T0.2185,0.207 T0.2353,0.2057 Q0.2369,0.2049,0.2502,0.2041 T0.2799,0.2022 T0.302,0.2007 Q0.3084,0.1999,0.3245,0.1954 T0.347,0.1908 Q0.3502,0.1908,0.3534,0.1916 Q0.3663,0.197,0.388,0.197 Q0.404,0.197,0.4088,0.1929 Q0.4096,0.192,0.4108,0.192 T0.4177,0.1945 T0.4277,0.197 T0.4369,0.1949 Q0.4442,0.1908,0.4843,0.1875 Q0.4892,0.1871,0.4968,0.1839 T0.5084,0.1808 L0.5108,0.1808 Q0.5213,0.1825,0.5454,0.1825 Q0.5823,0.1825,0.5992,0.1779 Q0.6096,0.1746,0.6217,0.1746 Q0.6249,0.1746,0.6309,0.1748 T0.6394,0.175 Q0.6434,0.175,0.6466,0.1746 Q0.6474,0.1746,0.6594,0.1738 T0.6787,0.1713 T0.6892,0.1659 Q0.6924,0.1634,0.6924,0.1593 Q0.6924,0.1547,0.6888,0.151 T0.6795,0.1472 Q0.6779,0.1472,0.6763,0.1477 Q0.6699,0.1493,0.6667,0.1493 Q0.661,0.1493,0.6506,0.1456 Q0.6329,0.1394,0.6129,0.1394 Q0.6048,0.1394,0.5992,0.1377 T0.5888,0.136 T0.5803,0.1377 T0.5751,0.1394 Q0.5711,0.1394,0.5639,0.1369 Q0.5365,0.1273,0.5116,0.1273 Q0.4876,0.1273,0.4667,0.1253 Q0.4627,0.1248,0.4542,0.1211 T0.4337,0.1174 L0.4305,0.1174 Q0.4217,0.1178,0.4153,0.119 T0.408,0.1203 Q0.4056,0.1203,0.4,0.117 Q0.3976,0.1153,0.396,0.1136 T0.3932,0.1112 T0.39,0.1099 T0.3847,0.1095 Q0.3799,0.1095,0.3687,0.1103 Q0.355,0.1112,0.3434,0.1141 T0.3301,0.117 Q0.3261,0.117,0.3229,0.1145 Q0.3181,0.1116,0.3052,0.1087 T0.2787,0.1043 T0.2546,0.1029 Q0.2506,0.1029,0.2474,0.1033 Q0.2418,0.1037,0.2349,0.1054 T0.2249,0.107 Q0.2225,0.107,0.2193,0.1066 Q0.2024,0.1024,0.1863,0.1024 Q0.1823,0.1024,0.1562,0.0971 T0.1269,0.0917 T0.1161,0.0896 T0.106,0.0854 Q0.1076,0.0846,0.11,0.0842 Q0.1173,0.0821,0.1261,0.0821 Q0.1301,0.0821,0.1369,0.0825 T0.1462,0.083 Q0.1494,0.083,0.151,0.0825 T0.1831,0.0813 T0.2201,0.0784 T0.243,0.074 T0.2667,0.0718 Q0.2707,0.0718,0.2755,0.0724 T0.2843,0.073 T0.2936,0.0724 T0.3024,0.0705 T0.3072,0.068 T0.3092,0.0657 T0.3108,0.0647 Q0.3116,0.0643,0.3133,0.0643 L0.3157,0.0643 L0.3181,0.0643 Q0.3446,0.0643,0.3446,0.0556 T0.3205,0.0469 L0.3189,0.0469 Q0.3157,0.0469,0.3157,0.0465 Q0.3084,0.0427,0.2835,0.0386 Q0.2739,0.0369,0.2675,0.0342 T0.2538,0.0299 Q0.249,0.029,0.245,0.029 T0.2378,0.0303 T0.2321,0.0315 Q0.2305,0.0315,0.2273,0.0307 Q0.2201,0.0286,0.2004,0.0272 T0.1775,0.0245 Q0.1735,0.0228,0.1663,0.0226 T0.1522,0.0197 T0.1345,0.0145 T0.1124,0.0079 Q0.0996,0.0033,0.0671,0.0044 T0.0297,0.0041 Q0.0169,0,0.0024,0.0017 Q0,0.0021,0,0.0037 Z M0.0064,0.9954 L0.0056,0.0058 Q0.0177,0.005,0.0281,0.0083 Q0.0345,0.01,0.0675,0.0089 T0.1108,0.012 Q0.1221,0.0162,0.1329,0.0187 T0.1498,0.0236 T0.1606,0.0268 T0.1691,0.0274 T0.1759,0.0286 Q0.1807,0.0303,0.2,0.0315 T0.2257,0.0348 Q0.2305,0.0361,0.2337,0.0361 Q0.2361,0.0361,0.2398,0.0348 T0.2466,0.0336 Q0.249,0.0336,0.2522,0.034 Q0.2586,0.0353,0.2655,0.0382 T0.2827,0.0427 Q0.3068,0.0469,0.3124,0.0502 Q0.3157,0.0523,0.3237,0.0523 L0.3277,0.0523 L0.3309,0.0523 Q0.3398,0.0523,0.3398,0.0556 Q0.3398,0.0581,0.3341,0.0587 T0.3205,0.0593 T0.3092,0.0603 T0.3036,0.0643 T0.2932,0.068 Q0.2884,0.0684,0.2843,0.0684 Q0.2811,0.0684,0.2763,0.0678 T0.2667,0.0672 Q0.2586,0.0672,0.2422,0.0697 T0.2177,0.0747 Q0.2137,0.0759,0.1831,0.0767 T0.1494,0.0784 L0.1474,0.0784 T0.1398,0.078 T0.1285,0.0776 Q0.1173,0.0776,0.1084,0.08 Q0.1004,0.0817,0.1004,0.0846 Q0.1004,0.0867,0.104,0.0888 T0.1124,0.0923 T0.1213,0.0948 T0.1269,0.0958 T0.155,0.1014 T0.1863,0.107 Q0.2016,0.107,0.2185,0.1107 Q0.2217,0.1116,0.2257,0.1116 Q0.2289,0.1116,0.2365,0.1099 T0.2482,0.1074 L0.2538,0.1074 Q0.2683,0.1074,0.2912,0.1107 T0.3197,0.1182 Q0.3245,0.1215,0.3301,0.1215 Q0.3333,0.1215,0.3454,0.1184 T0.3687,0.1145 Q0.3735,0.1141,0.3779,0.1139 T0.3843,0.1134 T0.3871,0.1132 Q0.3896,0.1132,0.39,0.1136 T0.392,0.1161 T0.3968,0.1203 Q0.404,0.1248,0.408,0.1248 Q0.4096,0.1248,0.4165,0.1234 T0.4305,0.1215 L0.4337,0.1215 Q0.4442,0.1215,0.4518,0.1251 T0.4659,0.1294 Q0.4876,0.1319,0.5116,0.1319 T0.5622,0.141 Q0.5703,0.1439,0.5751,0.1439 Q0.5791,0.1439,0.5831,0.1423 T0.5888,0.1406 Q0.592,0.1406,0.5944,0.1412 T0.6012,0.1427 T0.6129,0.1435 Q0.6313,0.1435,0.649,0.1497 Q0.6602,0.1535,0.6667,0.1535 Q0.6715,0.1535,0.6779,0.1522 Q0.6787,0.1518,0.6795,0.1518 Q0.6827,0.1518,0.6847,0.1541 T0.6867,0.1593 Q0.6867,0.1618,0.6851,0.1634 Q0.6835,0.1655,0.6775,0.1667 T0.6598,0.169 T0.6458,0.1705 T0.6402,0.1709 Q0.6378,0.1709,0.6321,0.1705 T0.6225,0.1701 Q0.6096,0.1701,0.5968,0.1738 Q0.5823,0.1779,0.5446,0.1779 Q0.5205,0.1779,0.5116,0.1767 Q0.51,0.1763,0.5084,0.1763 Q0.5028,0.1763,0.4944,0.1796 T0.4835,0.1829 L0.4771,0.1833 T0.4659,0.1844 L0.4546,0.1858 T0.443,0.1881 T0.4337,0.1912 Q0.4321,0.1916,0.4305,0.1916 Q0.4273,0.1916,0.4209,0.1895 T0.412,0.1875 Q0.408,0.1875,0.4056,0.19 Q0.4024,0.1925,0.388,0.1925 Q0.3663,0.1925,0.3558,0.1879 Q0.3518,0.1862,0.3462,0.1862 Q0.3373,0.1862,0.3213,0.191 T0.3012,0.1962 Q0.2964,0.1966,0.2799,0.1976 T0.2494,0.1997 T0.2313,0.2024 L0.2313,0.2024 L0.2293,0.2024 L0.2261,0.2024 L0.2217,0.2024 Q0.204,0.2024,0.1851,0.2047 T0.1526,0.2136 Q0.1406,0.2198,0.1406,0.226 Q0.1406,0.2319,0.1518,0.2362 T0.1719,0.2406 Q0.1791,0.2406,0.2466,0.2497 Q0.2498,0.2501,0.2574,0.2516 T0.2711,0.2538 T0.2819,0.2547 L0.2851,0.2547 Q0.2851,0.2543,0.2859,0.2543 Q0.294,0.2543,0.3096,0.2592 T0.3285,0.2684 Q0.3317,0.2721,0.3373,0.2721 Q0.3406,0.2721,0.3462,0.2708 T0.3542,0.2696 Q0.3558,0.2696,0.3574,0.27 Q0.3679,0.2737,0.3968,0.2762 Q0.3984,0.2766,0.4004,0.2779 L0.4044,0.2804 T0.4096,0.2816 Q0.412,0.2816,0.4145,0.2808 Q0.4177,0.2804,0.4249,0.2804 Q0.4586,0.2804,0.4763,0.287 Q0.4867,0.2912,0.4972,0.2912 Q0.5004,0.2912,0.5064,0.2908 T0.5165,0.2903 Q0.5293,0.2903,0.5361,0.2922 T0.547,0.3003 L0.547,0.3011 Q0.547,0.3036,0.5414,0.3049 T0.5249,0.3067 T0.51,0.3082 Q0.5092,0.3082,0.4831,0.3111 T0.4498,0.3161 Q0.408,0.3264,0.3952,0.3264 Q0.3896,0.3264,0.3863,0.3252 Q0.3783,0.3223,0.3703,0.3223 Q0.359,0.3223,0.3494,0.3277 Q0.347,0.3293,0.343,0.3293 Q0.3414,0.3293,0.3353,0.3285 T0.3253,0.3277 T0.3181,0.3285 Q0.3149,0.3289,0.2952,0.3306 T0.2699,0.3347 Q0.2675,0.3364,0.2598,0.3372 T0.2434,0.3395 T0.2297,0.3426 L0.2205,0.3461 T0.2048,0.3523 T0.1908,0.3606 T0.1791,0.3725 Q0.1743,0.3803,0.1743,0.3845 Q0.1743,0.3874,0.1763,0.3901 T0.1827,0.3976 T0.1912,0.4073 T0.198,0.4189 T0.2032,0.4276 T0.2137,0.4326 T0.2386,0.438 Q0.2458,0.4392,0.2562,0.4392 L0.2639,0.4392 L0.2699,0.4392 Q0.2795,0.4392,0.2843,0.4405 Q0.2932,0.443,0.3092,0.443 L0.3157,0.443 L0.3213,0.443 Q0.3293,0.443,0.3458,0.4463 T0.3671,0.4525 Q0.3598,0.4558,0.3373,0.4571 Q0.3124,0.4587,0.298,0.4637 Q0.294,0.465,0.2811,0.465 L0.2703,0.465 L0.2586,0.465 Q0.241,0.465,0.2305,0.4666 Q0.2185,0.4687,0.2185,0.4728 Q0.2185,0.4745,0.2205,0.4764 T0.2241,0.4791 L0.2265,0.4803 L0.2273,0.4803 Q0.2506,0.4824,0.261,0.4824 Q0.2675,0.4824,0.2699,0.482 Q0.2699,0.4815,0.2707,0.4815 Q0.2771,0.4815,0.3124,0.4898 Q0.3173,0.4907,0.3229,0.4913 T0.3386,0.4925 T0.3542,0.4936 T0.3663,0.494 Q0.3711,0.494,0.3787,0.4936 T0.3888,0.4932 Q0.392,0.4932,0.3944,0.4936 T0.4032,0.4959 T0.4181,0.499 T0.4369,0.5006 Q0.449,0.501,0.455,0.5021 T0.4639,0.5048 T0.4675,0.5093 L0.4675,0.5097 Q0.4675,0.5106,0.4663,0.511 T0.4622,0.5116 L0.4566,0.512 T0.4486,0.5124 T0.4402,0.5127 Q0.4345,0.5131,0.4257,0.5153 T0.4096,0.5176 Q0.4064,0.5176,0.4024,0.5172 L0.3968,0.5172 Q0.3863,0.5172,0.3731,0.522 T0.359,0.5268 Q0.355,0.528,0.3317,0.5321 T0.3004,0.5388 Q0.2867,0.5433,0.2337,0.5479 Q0.2096,0.55,0.2096,0.5562 Q0.2096,0.5591,0.2145,0.5628 Q0.2193,0.5662,0.2289,0.5662 Q0.2313,0.5662,0.2373,0.5657 T0.2458,0.5653 L0.2498,0.5653 Q0.2635,0.5674,0.3124,0.5674 Q0.3261,0.5674,0.3301,0.567 L0.3317,0.567 Q0.3341,0.567,0.3394,0.568 T0.3486,0.5691 Q0.3542,0.5691,0.3606,0.5678 T0.3699,0.5666 T0.3759,0.5686 T0.3839,0.5718 T0.3908,0.573 T0.3964,0.5734 T0.4048,0.5742 T0.4165,0.5751 T0.4277,0.5757 T0.4369,0.5778 Q0.4426,0.5794,0.4538,0.5794 Q0.4586,0.5794,0.4679,0.5792 T0.4811,0.579 Q0.4924,0.579,0.4956,0.5807 Q0.502,0.584,0.5108,0.584 L0.5137,0.584 T0.5173,0.5838 L0.5205,0.5834 L0.5237,0.583 L0.5269,0.5825 T0.5305,0.5821 T0.5341,0.5819 L0.5365,0.5819 Q0.5414,0.5819,0.5562,0.5842 T0.5855,0.5865 Q0.5912,0.5865,0.5948,0.5867 T0.6012,0.5869 T0.6064,0.5873 T0.61,0.5877 T0.6133,0.5886 T0.6157,0.5896 L0.6185,0.591 T0.6217,0.5931 Q0.6265,0.5952,0.6369,0.5952 L0.6418,0.5952 L0.6466,0.5952 Q0.6723,0.5952,0.6932,0.606 Q0.698,0.608,0.7044,0.608 Q0.7084,0.608,0.7161,0.6068 T0.7261,0.6056 Q0.7309,0.6056,0.7454,0.6051 T0.7647,0.6047 Q0.7775,0.6047,0.8072,0.6101 Q0.8096,0.6105,0.812,0.6105 Q0.8177,0.6105,0.8297,0.6085 T0.8474,0.606 L0.8506,0.606 Q0.8562,0.606,0.8647,0.607 T0.8831,0.6095 T0.8964,0.6118 Q0.9036,0.6122,0.9221,0.6122 L0.9406,0.6122 L0.959,0.6122 L0.9767,0.6122 Q0.9952,0.613,0.9952,0.6172 Q0.9952,0.6176,0.9944,0.6221 Q0.9936,0.6259,0.9574,0.6259 L0.955,0.6259 L0.9526,0.6259 Q0.9478,0.6259,0.9373,0.628 T0.9205,0.63 L0.9173,0.63 Q0.9133,0.6296,0.9084,0.6296 Q0.9004,0.6296,0.8715,0.6321 Q0.8233,0.6367,0.7944,0.64 Q0.7888,0.6408,0.7839,0.6408 T0.7739,0.6402 T0.7671,0.6396 Q0.7639,0.6396,0.7622,0.64 Q0.7614,0.6404,0.759,0.6404 Q0.7574,0.6404,0.749,0.6398 T0.7357,0.6392 Q0.7261,0.6392,0.7213,0.6412 Q0.7173,0.6425,0.7032,0.6437 T0.6711,0.6458 T0.6474,0.647 Q0.645,0.6474,0.6418,0.6474 Q0.6353,0.6474,0.6277,0.6454 T0.6161,0.6433 Q0.6104,0.6433,0.6072,0.6456 T0.6,0.6479 Q0.5912,0.6479,0.5486,0.6557 Q0.5422,0.657,0.5373,0.657 Q0.5349,0.657,0.5289,0.6564 T0.5173,0.6557 L0.5124,0.6557 Q0.4996,0.6562,0.4739,0.6611 Q0.4675,0.6624,0.4398,0.6645 T0.3851,0.668 T0.3558,0.6698 Q0.355,0.6698,0.3285,0.6721 T0.2948,0.6752 Q0.2892,0.6761,0.2843,0.6786 T0.2747,0.6831 T0.2618,0.6852 Q0.253,0.6852,0.2394,0.6893 T0.2141,0.6993 T0.1968,0.7105 Q0.1944,0.713,0.1944,0.7155 Q0.1944,0.7196,0.2012,0.7229 T0.2177,0.7285 T0.2281,0.7308 Q0.2321,0.7329,0.2365,0.7339 T0.245,0.7356 T0.2514,0.7366 Q0.2522,0.737,0.2554,0.7379 T0.2614,0.7393 T0.2679,0.7406 T0.2755,0.7416 T0.2835,0.742 Q0.29,0.742,0.3048,0.7428 T0.3253,0.7437 L0.3301,0.7437 L0.3333,0.7437 Q0.3341,0.7437,0.3598,0.7466 Q0.3639,0.7474,0.3671,0.7474 T0.3759,0.7466 T0.3855,0.7457 Q0.388,0.7457,0.3904,0.7462 Q0.3984,0.7466,0.4137,0.7495 T0.4349,0.7532 T0.441,0.7557 Q0.441,0.7599,0.4289,0.7619 Q0.4257,0.7628,0.4197,0.7634 T0.4072,0.7644 T0.3984,0.7652 Q0.3968,0.7652,0.3912,0.7655 T0.3811,0.7665 T0.3719,0.7694 Q0.3695,0.7702,0.3655,0.7702 T0.3546,0.7686 T0.3462,0.7665 L0.3446,0.7665 Q0.3406,0.7665,0.3293,0.769 T0.3149,0.7715 Q0.3084,0.7715,0.2952,0.7748 T0.2763,0.781 Q0.2675,0.7847,0.2554,0.7864 Q0.253,0.7864,0.2325,0.7874 T0.2024,0.7893 Q0.2008,0.7893,0.1984,0.7897 T0.1948,0.7901 T0.1916,0.7903 T0.1888,0.7908 T0.1867,0.7914 T0.1847,0.7922 L0.1831,0.793 T0.1819,0.7943 L0.1811,0.7959 T0.1799,0.7976 Q0.1791,0.7993,0.1791,0.8001 Q0.1791,0.8034,0.1831,0.8051 T0.1932,0.8078 T0.2,0.8092 Q0.2072,0.8117,0.2257,0.8117 Q0.2337,0.8117,0.2586,0.8109 L0.2635,0.8109 Q0.2707,0.8109,0.2767,0.8117 T0.2859,0.8136 T0.2936,0.8163 T0.3012,0.8187 Q0.3068,0.82,0.3277,0.8206 T0.3526,0.8237 Q0.3582,0.8266,0.3622,0.8266 Q0.3647,0.8266,0.3687,0.8258 T0.3751,0.825 Q0.396,0.825,0.404,0.8291 Q0.408,0.8316,0.4161,0.8316 Q0.4217,0.8316,0.4353,0.8295 L0.4394,0.8295 Q0.4466,0.8295,0.4659,0.8366 Q0.4699,0.8378,0.4747,0.8378 Q0.4763,0.8378,0.4807,0.8374 T0.4884,0.837 Q0.494,0.837,0.5004,0.8382 Q0.5052,0.8391,0.5124,0.8399 Q0.5221,0.8411,0.5249,0.8422 T0.5277,0.8461 Q0.5277,0.8482,0.5233,0.849 T0.5112,0.8501 T0.4996,0.8511 Q0.4964,0.8519,0.4851,0.8523 T0.4659,0.8544 Q0.4578,0.8557,0.4402,0.8557 L0.4349,0.8557 L0.4297,0.8557 L0.4209,0.8557 Q0.408,0.8565,0.3867,0.8571 T0.3614,0.8582 Q0.3317,0.8611,0.3237,0.8611 L0.3225,0.8611 L0.3213,0.8611 Q0.2972,0.8611,0.2972,0.8681 Q0.2972,0.8714,0.3008,0.8747 T0.3044,0.8805 Q0.3044,0.881,0.3036,0.8814 Q0.3012,0.8839,0.2851,0.8839 Q0.2779,0.8839,0.2739,0.883 Q0.2723,0.8826,0.2699,0.8826 T0.2643,0.8835 T0.259,0.8853 T0.2542,0.8876 T0.249,0.8893 Q0.2386,0.8922,0.2056,0.8946 Q0.2016,0.8951,0.1916,0.898 T0.1703,0.9009 Q0.1518,0.9009,0.1337,0.9044 T0.1149,0.9146 L0.1149,0.9158 Q0.1149,0.9175,0.1157,0.9187 T0.1173,0.921 T0.1201,0.9226 T0.1233,0.9237 T0.1269,0.9245 L0.1305,0.9251 T0.1337,0.9255 L0.1357,0.9258 Q0.139,0.9262,0.1446,0.9262 T0.1542,0.9266 T0.1598,0.9282 Q0.1614,0.9303,0.1647,0.9314 T0.1739,0.9328 T0.1815,0.9336 Q0.1863,0.9345,0.1976,0.9372 T0.2145,0.9415 Q0.2225,0.9432,0.2285,0.9467 T0.2378,0.9515 Q0.2426,0.9531,0.2514,0.9531 Q0.2538,0.9531,0.2602,0.9529 T0.2707,0.9527 Q0.2763,0.9527,0.2815,0.9531 T0.2867,0.9569 T0.2811,0.9614 Q0.2434,0.9627,0.2329,0.9652 Q0.2249,0.9672,0.2241,0.9672 L0.2096,0.9668 L0.2056,0.9668 Q0.2,0.9668,0.196,0.9672 T0.1884,0.9687 T0.1815,0.9708 T0.1731,0.9737 T0.1639,0.9772 Q0.1518,0.9805,0.1285,0.9805 L0.1253,0.9805 Q0.1124,0.9805,0.1076,0.9818 Q0.1012,0.983,0.0831,0.9876 T0.0594,0.9934 Q0.049,0.9954,0.0064,0.9954 Z M0.0032,0.9979 L0.0024,0.0037 Q0.0161,0.0021,0.0289,0.0062 Q0.0337,0.0075,0.0671,0.0066 T0.1116,0.01 T0.1337,0.0166 T0.151,0.022 Q0.1582,0.0249,0.1659,0.0251 T0.1767,0.0265 Q0.1807,0.0278,0.2,0.0292 T0.2265,0.0328 Q0.2305,0.034,0.2329,0.034 T0.239,0.0326 T0.2458,0.0311 T0.253,0.0319 Q0.2578,0.0332,0.2614,0.0342 T0.2667,0.0363 T0.2723,0.0384 T0.2827,0.0406 Q0.3084,0.0448,0.3141,0.0485 Q0.3149,0.0494,0.3225,0.0494 T0.3361,0.0504 T0.3422,0.0554 T0.3357,0.0606 T0.3205,0.0618 T0.31,0.0626 Q0.3092,0.0626,0.3056,0.0659 T0.2932,0.0701 Q0.2884,0.0709,0.2843,0.0709 Q0.2811,0.0709,0.2759,0.0701 T0.2667,0.0693 Q0.2586,0.0693,0.2422,0.0718 T0.2193,0.0763 Q0.2137,0.0784,0.1831,0.079 T0.1502,0.0805 Q0.1494,0.0809,0.147,0.0809 Q0.1454,0.0809,0.1386,0.0803 T0.1277,0.0796 Q0.1173,0.0796,0.1092,0.0821 Q0.1036,0.0834,0.1036,0.0854 Q0.1036,0.0879,0.1129,0.0908 T0.1269,0.0937 Q0.1293,0.0937,0.1558,0.0991 T0.1863,0.1045 Q0.2016,0.1045,0.2193,0.1087 Q0.2225,0.1091,0.2249,0.1091 Q0.2289,0.1091,0.2357,0.1076 T0.2482,0.1054 Q0.2506,0.1049,0.2546,0.1049 Q0.2699,0.1049,0.2924,0.1085 T0.3213,0.1165 Q0.3253,0.119,0.3301,0.119 Q0.3325,0.119,0.3446,0.1161 T0.3687,0.1124 Q0.3831,0.1112,0.3863,0.1112 T0.3908,0.1118 T0.3936,0.1145 T0.3984,0.1186 Q0.4048,0.1228,0.408,0.1228 Q0.4096,0.1228,0.4161,0.1213 T0.4305,0.1195 L0.4337,0.1195 Q0.4426,0.1195,0.4474,0.1211 T0.4566,0.1246 T0.4667,0.1273 Q0.4876,0.1298,0.5116,0.1298 Q0.5365,0.1298,0.5631,0.1389 Q0.5703,0.1414,0.5751,0.1414 Q0.5783,0.1414,0.5819,0.1398 T0.5888,0.1381 Q0.5928,0.1381,0.5984,0.1398 T0.6129,0.1414 Q0.6321,0.1414,0.6498,0.1477 Q0.661,0.1514,0.6667,0.1514 Q0.6707,0.1514,0.6771,0.1501 Q0.6787,0.1497,0.6795,0.1497 Q0.6835,0.1497,0.6863,0.1526 T0.6892,0.1593 Q0.6892,0.1626,0.6876,0.1647 Q0.6851,0.1672,0.6799,0.1686 T0.6695,0.1705 T0.6566,0.1715 T0.6458,0.1725 Q0.6434,0.173,0.6402,0.173 Q0.6378,0.173,0.6317,0.1727 T0.6225,0.1725 Q0.6096,0.1725,0.5984,0.1759 Q0.5823,0.1804,0.5454,0.1804 Q0.5205,0.1804,0.5116,0.1788 L0.5084,0.1788 Q0.5036,0.1788,0.4956,0.1819 T0.4843,0.185 Q0.4434,0.1887,0.4353,0.1929 Q0.4321,0.1945,0.4289,0.1945 T0.4197,0.1922 T0.4112,0.19 T0.4072,0.1912 Q0.4032,0.1949,0.388,0.1949 Q0.3663,0.1949,0.3542,0.19 Q0.351,0.1883,0.3462,0.1883 Q0.3406,0.1883,0.3321,0.1906 T0.3153,0.1954 T0.302,0.1983 Q0.2972,0.1991,0.2859,0.1997 T0.2643,0.201 T0.245,0.2024 T0.2337,0.2041 Q0.2321,0.2045,0.2181,0.2045 T0.1851,0.207 T0.1542,0.2157 Q0.143,0.2211,0.143,0.226 Q0.143,0.2314,0.153,0.2348 T0.1719,0.2381 Q0.1791,0.2381,0.2474,0.2476 Q0.2506,0.248,0.2558,0.2489 T0.2651,0.2505 T0.2739,0.252 T0.2819,0.2526 Q0.2835,0.2526,0.2851,0.2522 L0.2859,0.2522 Q0.2948,0.2522,0.3104,0.2574 T0.3309,0.2671 Q0.3333,0.2696,0.3365,0.2696 Q0.339,0.2696,0.3442,0.2684 T0.3526,0.2671 T0.3582,0.2679 Q0.3687,0.2717,0.3968,0.2742 Q0.4,0.2746,0.4036,0.2771 T0.4096,0.2796 Q0.4112,0.2796,0.4137,0.2787 Q0.4169,0.2779,0.4257,0.2779 Q0.4594,0.2779,0.4779,0.2849 Q0.4876,0.2891,0.4972,0.2891 Q0.4996,0.2891,0.506,0.2887 T0.5165,0.2883 Q0.5253,0.2883,0.5305,0.2889 T0.541,0.292 T0.5494,0.299 L0.5494,0.3015 Q0.5494,0.3036,0.5466,0.3051 T0.5386,0.3073 T0.5285,0.3086 T0.5181,0.3094 T0.5108,0.3102 Q0.5068,0.3107,0.494,0.3121 L0.4683,0.315 T0.4506,0.3181 Q0.449,0.3181,0.4426,0.32 T0.4313,0.3229 T0.4197,0.3256 T0.4064,0.3281 T0.3952,0.3289 Q0.3888,0.3289,0.3855,0.3273 Q0.3783,0.3243,0.3703,0.3243 Q0.3598,0.3243,0.351,0.3297 Q0.3478,0.3314,0.3422,0.3314 Q0.3398,0.3314,0.3337,0.3306 T0.3245,0.3297 T0.3189,0.3306 Q0.3149,0.3314,0.2956,0.3328 T0.2715,0.3368 Q0.2691,0.338,0.2635,0.3391 T0.2522,0.3407 T0.2406,0.3424 T0.2313,0.3447 Q0.2305,0.3447,0.2213,0.348 T0.206,0.354 T0.1924,0.3621 T0.1815,0.3733 Q0.1767,0.3816,0.1767,0.3849 Q0.1767,0.387,0.1783,0.3893 T0.1847,0.3961 T0.1936,0.4063 T0.2004,0.4181 T0.2052,0.4264 T0.2145,0.4309 T0.2386,0.4359 Q0.2458,0.4372,0.2554,0.4372 Q0.2578,0.4372,0.2627,0.437 T0.2699,0.4367 Q0.2795,0.4367,0.2851,0.4384 Q0.294,0.4409,0.3092,0.4409 Q0.3116,0.4409,0.3157,0.4407 T0.3213,0.4405 Q0.3301,0.4405,0.3466,0.444 T0.3687,0.4509 Q0.3703,0.4517,0.3703,0.4525 Q0.3703,0.4575,0.3373,0.4596 Q0.3133,0.4608,0.2988,0.4658 Q0.294,0.4674,0.2803,0.4674 Q0.2763,0.4674,0.2687,0.4672 T0.257,0.467 Q0.2402,0.467,0.2313,0.4687 Q0.2209,0.4708,0.2209,0.4737 Q0.2209,0.4741,0.2213,0.4749 T0.2229,0.4764 L0.2249,0.4774 T0.2265,0.4778 L0.2273,0.4782 Q0.2498,0.4803,0.2618,0.4803 Q0.2667,0.4803,0.2691,0.4799 Q0.2699,0.4795,0.2715,0.4795 Q0.2779,0.4795,0.3133,0.4873 Q0.3181,0.4886,0.3233,0.4892 T0.3386,0.4905 T0.3542,0.4915 T0.3655,0.4919 Q0.3703,0.4919,0.3779,0.4915 T0.3888,0.4911 T0.3952,0.4915 Q0.3976,0.4919,0.4008,0.4927 L0.4072,0.4944 T0.4149,0.4961 T0.4249,0.4975 T0.4369,0.4985 Q0.449,0.499,0.4554,0.5 T0.4651,0.5031 T0.4699,0.5085 Q0.4707,0.5093,0.4707,0.5097 Q0.4707,0.5114,0.4687,0.5124 T0.4631,0.5139 T0.4562,0.5145 T0.4478,0.5147 L0.4402,0.5147 Q0.4353,0.5151,0.4265,0.5174 T0.4096,0.5197 L0.4024,0.5197 Q0.4,0.5193,0.3968,0.5193 Q0.3896,0.5193,0.3831,0.5209 T0.3703,0.5253 T0.3598,0.5288 Q0.3558,0.5301,0.3321,0.5342 T0.302,0.5409 Q0.2876,0.5454,0.2337,0.55 Q0.2112,0.5521,0.2112,0.5558 Q0.2112,0.5574,0.2161,0.5612 Q0.2201,0.5637,0.2281,0.5637 Q0.2305,0.5637,0.2361,0.5633 T0.2442,0.5628 Q0.2474,0.5628,0.2498,0.5633 Q0.2635,0.5653,0.3133,0.5653 Q0.3261,0.5653,0.3301,0.5649 L0.3325,0.5649 Q0.3349,0.5649,0.3402,0.5657 T0.3494,0.5666 Q0.3542,0.5666,0.3598,0.5657 Q0.3663,0.5645,0.3695,0.5645 Q0.3735,0.5645,0.3775,0.5666 T0.3847,0.5695 Q0.3888,0.5707,0.3912,0.5709 T0.3968,0.5711 T0.4048,0.572 Q0.4096,0.5724,0.4165,0.5726 T0.4281,0.5734 T0.4378,0.5757 Q0.4418,0.5774,0.4522,0.5774 Q0.4562,0.5774,0.4655,0.5769 T0.4795,0.5765 Q0.4932,0.5765,0.4972,0.579 Q0.5028,0.5819,0.51,0.5819 Q0.5141,0.5819,0.5221,0.5809 T0.5341,0.5798 L0.5373,0.5798 Q0.5422,0.5798,0.557,0.5821 T0.5855,0.5844 L0.5936,0.5844 L0.5992,0.5844 T0.604,0.5848 T0.6076,0.5852 T0.6108,0.5859 T0.6137,0.5865 T0.6161,0.5873 T0.6181,0.5881 T0.6209,0.5896 L0.6233,0.591 Q0.6265,0.5927,0.6353,0.5927 L0.6402,0.5927 L0.645,0.5927 Q0.6723,0.5927,0.6948,0.6039 Q0.6988,0.606,0.7036,0.606 Q0.7076,0.606,0.7153,0.6045 T0.7261,0.6031 Q0.7309,0.6031,0.7454,0.6027 T0.7647,0.6022 Q0.7783,0.6022,0.808,0.608 L0.812,0.608 Q0.8169,0.608,0.8293,0.6062 T0.8474,0.6039 L0.8506,0.6039 Q0.857,0.6039,0.8655,0.6049 T0.8835,0.6074 T0.8972,0.6093 Q0.9036,0.6101,0.9213,0.6101 L0.9398,0.6101 L0.959,0.6101 L0.9767,0.6101 Q0.9976,0.6109,0.9976,0.6176 Q0.9976,0.6188,0.9968,0.6226 Q0.9952,0.6284,0.9671,0.6284 L0.959,0.6284 L0.9526,0.6284 Q0.9486,0.6284,0.9382,0.6302 T0.9205,0.6321 L0.9173,0.6321 Q0.9133,0.6317,0.9092,0.6317 Q0.9012,0.6317,0.8715,0.6346 Q0.8233,0.6387,0.7944,0.6421 Q0.7888,0.6429,0.7831,0.6429 Q0.7783,0.6429,0.7731,0.6425 T0.7663,0.6421 L0.7622,0.6421 Q0.7614,0.6425,0.7586,0.6425 T0.7474,0.6421 T0.7349,0.6416 Q0.7261,0.6416,0.7221,0.6429 Q0.7173,0.645,0.7032,0.646 T0.6711,0.6479 T0.6482,0.6491 Q0.645,0.6495,0.6418,0.6495 Q0.6353,0.6495,0.6273,0.6474 T0.6161,0.6454 Q0.612,0.6454,0.6088,0.6477 T0.6,0.6499 Q0.5912,0.6499,0.5494,0.6578 Q0.5422,0.6591,0.5373,0.6591 Q0.5341,0.6591,0.5281,0.6584 T0.5173,0.6578 L0.5124,0.6578 Q0.5004,0.6582,0.4747,0.6632 Q0.4675,0.6649,0.4398,0.6667 T0.3851,0.6703 T0.3566,0.6719 Q0.3534,0.6723,0.3406,0.6734 T0.3141,0.6757 T0.2948,0.6773 Q0.2908,0.6781,0.2819,0.6829 T0.2618,0.6877 Q0.2482,0.6877,0.2273,0.6958 T0.1992,0.7117 Q0.1976,0.7138,0.1976,0.7155 Q0.1976,0.7188,0.2032,0.7213 T0.2181,0.7258 T0.2289,0.7292 Q0.2337,0.7308,0.2378,0.7316 L0.2458,0.7333 T0.2522,0.7345 Q0.2747,0.7399,0.2835,0.7399 Q0.29,0.7399,0.3048,0.7408 T0.3253,0.7416 Q0.3277,0.7416,0.3297,0.7414 T0.3341,0.7412 L0.3598,0.7445 Q0.3639,0.7449,0.3663,0.7449 Q0.3695,0.7449,0.3751,0.7443 T0.3855,0.7437 L0.3904,0.7437 Q0.3984,0.7441,0.4141,0.7472 T0.4353,0.7507 Q0.4434,0.752,0.4434,0.7553 Q0.4434,0.7578,0.439,0.7605 T0.4297,0.764 Q0.4257,0.7648,0.4201,0.7655 T0.4076,0.7665 T0.3984,0.7673 Q0.3968,0.7673,0.3912,0.7677 T0.3815,0.7688 T0.3735,0.771 T0.3655,0.7727 Q0.3606,0.7727,0.3534,0.7708 T0.3458,0.769 L0.3446,0.769 Q0.3414,0.769,0.3297,0.7713 T0.3149,0.7735 Q0.3092,0.7735,0.296,0.7771 T0.2771,0.7831 Q0.2683,0.7872,0.2554,0.7885 Q0.253,0.7889,0.2325,0.7897 T0.2032,0.7914 Q0.2008,0.7918,0.198,0.792 T0.194,0.7924 T0.1912,0.7928 T0.1888,0.793 T0.1867,0.7934 T0.1851,0.7943 T0.1843,0.7953 T0.1835,0.7968 T0.1823,0.7984 T0.1815,0.8001 Q0.1815,0.8022,0.1847,0.8032 T0.1932,0.8053 T0.2008,0.8071 Q0.2072,0.8092,0.2265,0.8092 Q0.2361,0.8092,0.2586,0.8088 L0.2635,0.8088 Q0.2731,0.8088,0.2795,0.8098 T0.2928,0.8134 T0.302,0.8167 Q0.306,0.8179,0.3277,0.8183 T0.3542,0.8221 Q0.359,0.8246,0.3622,0.8246 Q0.3639,0.8246,0.3675,0.8237 T0.3751,0.8229 Q0.3968,0.8229,0.4048,0.8275 Q0.4088,0.8291,0.4161,0.8291 Q0.4225,0.8291,0.4353,0.8275 Q0.4369,0.827,0.4394,0.827 Q0.4474,0.827,0.4675,0.8345 Q0.4707,0.8358,0.4739,0.8358 Q0.4755,0.8358,0.4799,0.8353 T0.4876,0.8349 Q0.494,0.8349,0.5012,0.8362 L0.5076,0.837 T0.5133,0.8376 T0.5181,0.8382 T0.5221,0.8391 L0.5253,0.8399 T0.5277,0.8409 L0.5293,0.8422 T0.5301,0.8438 L0.5301,0.8461 Q0.5301,0.8499,0.5249,0.8511 T0.5112,0.8526 T0.5004,0.8532 Q0.4964,0.854,0.4851,0.8546 T0.4667,0.8565 Q0.4578,0.8577,0.441,0.8577 L0.4345,0.8577 L0.4289,0.8577 L0.4209,0.8577 Q0.4153,0.8582,0.4088,0.8586 T0.3968,0.8592 T0.3855,0.8594 T0.3755,0.8596 T0.3675,0.86 T0.3622,0.8602 Q0.3317,0.8635,0.3237,0.8635 Q0.2996,0.8635,0.2996,0.8681 Q0.2996,0.8698,0.3032,0.8733 T0.3068,0.8797 L0.3068,0.8822 Q0.3052,0.8859,0.2859,0.8859 Q0.2787,0.8859,0.2739,0.8851 L0.2699,0.8851 Q0.2659,0.8851,0.259,0.888 T0.2498,0.8913 Q0.2394,0.8946,0.2056,0.8971 Q0.2032,0.8971,0.1928,0.9002 T0.1703,0.9034 Q0.1526,0.9034,0.1353,0.9067 T0.1173,0.915 L0.1173,0.9158 Q0.1173,0.9166,0.1177,0.9175 T0.1189,0.9191 T0.1205,0.9204 T0.1229,0.9212 T0.1257,0.922 T0.1285,0.9226 T0.1309,0.9231 T0.1337,0.9235 T0.1365,0.9237 L0.1446,0.9237 T0.1554,0.9243 T0.1614,0.9268 T0.1659,0.9293 T0.1743,0.9303 T0.1823,0.9316 Q0.1863,0.932,0.1912,0.9332 T0.2028,0.9361 T0.2153,0.939 Q0.2233,0.9411,0.2297,0.9448 T0.2386,0.9494 Q0.2426,0.9506,0.2506,0.9506 Q0.253,0.9506,0.2594,0.9504 T0.2699,0.9502 Q0.2763,0.9502,0.2819,0.9511 Q0.2851,0.9511,0.2871,0.9529 T0.2892,0.9573 Q0.2892,0.9627,0.2811,0.9635 Q0.2434,0.9652,0.2337,0.9672 Q0.2257,0.9693,0.2241,0.9693 Q0.2217,0.9693,0.2096,0.9689 L0.2056,0.9689 Q0.1976,0.9689,0.1924,0.9699 T0.1787,0.9741 L0.1647,0.9793 Q0.1518,0.983,0.1285,0.983 L0.1261,0.983 L0.1237,0.983 Q0.1124,0.983,0.1076,0.9838 Q0.102,0.9851,0.0839,0.9896 T0.0602,0.9954 T0.0406,0.9971 T0.0153,0.9979 L0.0032,0.9979 Z",type:0}},"":{type:5,data:{d:"M0.9992,0.998 Q0.9992,1,0.9968,1 Q0.9521,1,0.9392,0.998 Q0.9335,0.997,0.9152,0.9921 T0.8913,0.9862 Q0.8873,0.9852,0.8783,0.9852 L0.8747,0.9852 L0.871,0.9852 Q0.8483,0.9852,0.8345,0.9812 Q0.8289,0.9792,0.8228,0.9773 T0.8135,0.9743 T0.8054,0.9723 T0.7948,0.9713 L0.7908,0.9713 L0.777,0.9713 T0.7656,0.9693 Q0.7616,0.9683,0.7498,0.9674 T0.7283,0.9664 L0.7186,0.9654 Q0.708,0.9644,0.708,0.9575 Q0.708,0.9545,0.7109,0.952 T0.7178,0.9486 L0.7315,0.9486 L0.7417,0.9486 L0.7502,0.9486 Q0.7575,0.9486,0.7599,0.9476 Q0.7616,0.9466,0.7685,0.9426 T0.7843,0.9377 Q0.7899,0.9357,0.8009,0.9332 T0.8175,0.9298 Q0.82,0.9288,0.8228,0.9283 T0.8277,0.9278 T0.8313,0.9273 T0.8341,0.9263 T0.8362,0.9258 Q0.8402,0.9219,0.854,0.9219 L0.8569,0.9219 L0.8597,0.9219 L0.8637,0.9219 Q0.88,0.9199,0.88,0.9159 L0.88,0.9149 Q0.88,0.913,0.8719,0.911 T0.852,0.9075 T0.8297,0.906 Q0.8224,0.906,0.8167,0.905 T0.8074,0.9031 T0.8001,0.9006 T0.794,0.8991 Q0.7599,0.8971,0.7494,0.8942 Q0.7461,0.8932,0.7397,0.8902 T0.7299,0.8872 L0.7267,0.8872 Q0.721,0.8882,0.7121,0.8882 Q0.6926,0.8882,0.691,0.8833 L0.691,0.8803 Q0.691,0.8773,0.6922,0.8749 T0.6955,0.8704 L0.6975,0.8684 Q0.6926,0.8655,0.6764,0.8655 Q0.6683,0.8655,0.6375,0.8625 Q0.6358,0.8625,0.629,0.862 T0.6148,0.8615 T0.5973,0.861 T0.5791,0.8605 L0.5718,0.8605 L0.5661,0.8605 L0.5596,0.8605 Q0.5426,0.8605,0.5337,0.8586 Q0.5264,0.8576,0.515,0.8571 T0.4996,0.8556 Q0.498,0.8556,0.4947,0.8551 T0.4882,0.8546 T0.4809,0.8541 T0.474,0.8531 T0.4692,0.8506 T0.4672,0.8467 Q0.4672,0.8437,0.468,0.8422 T0.4704,0.8398 T0.4736,0.8383 T0.4781,0.8368 T0.4838,0.8358 T0.4911,0.8353 T0.4988,0.8338 Q0.5069,0.8328,0.5142,0.8328 Q0.5174,0.8328,0.5215,0.8333 T0.5264,0.8338 Q0.5296,0.8338,0.532,0.8328 Q0.5523,0.8249,0.5604,0.8249 L0.5653,0.8249 Q0.5775,0.8269,0.5848,0.8269 Q0.5912,0.8269,0.5937,0.8259 Q0.6026,0.821,0.6253,0.821 Q0.6294,0.821,0.6334,0.822 T0.6383,0.8229 Q0.6399,0.8229,0.644,0.82 Q0.6504,0.817,0.6723,0.816 T0.6975,0.814 Q0.6999,0.814,0.7048,0.8121 T0.7129,0.8091 T0.7226,0.8071 T0.7372,0.8061 L0.7421,0.8061 Q0.7624,0.8071,0.7721,0.8071 Q0.7924,0.8071,0.7981,0.8051 Q0.8021,0.8032,0.807,0.8027 T0.8135,0.8017 T0.8151,0.8002 L0.8151,0.7992 Q0.8143,0.7962,0.8127,0.7957 T0.8045,0.7943 Q0.7997,0.7943,0.7964,0.7933 Q0.7883,0.7933,0.7676,0.7923 T0.7437,0.7903 Q0.7307,0.7893,0.7218,0.7844 Q0.7194,0.7834,0.7141,0.7819 L0.7036,0.7789 T0.693,0.7765 T0.6853,0.7755 Q0.6805,0.7755,0.6691,0.773 T0.6553,0.7705 Q0.6545,0.7705,0.6545,0.7715 Q0.6537,0.7715,0.65,0.7725 T0.6423,0.774 T0.635,0.7745 Q0.6294,0.7745,0.6257,0.773 T0.618,0.771 T0.6083,0.77 T0.601,0.7695 Q0.5985,0.7695,0.5921,0.769 T0.5795,0.7676 T0.5702,0.7666 Q0.5653,0.7656,0.5596,0.7616 T0.5539,0.7547 Q0.5539,0.7498,0.5645,0.7488 Q0.5693,0.7478,0.5852,0.7448 T0.6099,0.7418 L0.6148,0.7418 Q0.6196,0.7418,0.6253,0.7423 T0.6338,0.7428 L0.6399,0.7428 Q0.6431,0.7418,0.6488,0.7409 T0.6586,0.7394 T0.6659,0.7389 L0.6707,0.7389 Q0.6723,0.7399,0.6748,0.7399 Q0.6796,0.7399,0.6946,0.7389 T0.7161,0.7379 Q0.7251,0.7379,0.7478,0.7319 Q0.7494,0.7319,0.7539,0.7315 T0.762,0.73 T0.7697,0.727 T0.7818,0.723 T0.7948,0.7196 T0.7997,0.7151 Q0.7997,0.7141,0.7989,0.7132 Q0.7924,0.7062,0.7717,0.6978 T0.738,0.6894 Q0.7267,0.6894,0.717,0.6845 T0.7048,0.6795 Q0.6975,0.6785,0.6711,0.6766 T0.6431,0.6746 Q0.6415,0.6736,0.6144,0.6721 T0.5596,0.6686 T0.5247,0.6657 Q0.4996,0.6607,0.4874,0.6597 L0.4834,0.6597 Q0.4785,0.6597,0.4724,0.6607 T0.4631,0.6617 Q0.4574,0.6617,0.4501,0.6597 Q0.4088,0.6518,0.4006,0.6518 Q0.3933,0.6518,0.3901,0.6499 T0.3844,0.6479 T0.3739,0.6499 T0.3585,0.6518 L0.352,0.6518 Q0.3471,0.6508,0.335,0.6503 T0.3122,0.6494 T0.2912,0.6479 T0.2766,0.6449 Q0.2733,0.6439,0.2668,0.6439 Q0.2628,0.6439,0.2543,0.6444 T0.2425,0.6449 T0.2368,0.6439 L0.2344,0.6439 Q0.2336,0.6439,0.2283,0.6444 T0.2182,0.6449 Q0.2117,0.6449,0.2052,0.6439 Q0.1768,0.6409,0.1281,0.637 Q0.0989,0.634,0.0916,0.634 L0.0835,0.634 L0.0795,0.634 Q0.0722,0.634,0.0616,0.632 T0.0479,0.6301 Q0.0462,0.6301,0.0406,0.6306 T0.0308,0.6311 Q0.0032,0.6311,0.0008,0.6231 Q0,0.6202,0,0.6182 Q0,0.6083,0.0227,0.6083 Q0.03,0.6073,0.0422,0.6073 Q0.0487,0.6073,0.0608,0.6078 T0.0787,0.6083 Q0.0973,0.6083,0.103,0.6073 Q0.1062,0.6063,0.1131,0.6053 T0.1253,0.6039 T0.1375,0.6024 T0.1492,0.6014 L0.1533,0.6014 Q0.1598,0.6024,0.1723,0.6044 T0.189,0.6063 Q0.1906,0.6063,0.1922,0.6053 Q0.2214,0.6004,0.236,0.6004 Q0.2409,0.6004,0.2551,0.6009 T0.2741,0.6014 Q0.2782,0.6014,0.2859,0.6024 T0.2968,0.6034 Q0.3009,0.6034,0.3041,0.6024 Q0.3277,0.5905,0.356,0.5905 L0.3613,0.5905 L0.3666,0.5905 Q0.3731,0.5905,0.3755,0.5895 Q0.382,0.5856,0.3844,0.5846 T0.3938,0.5831 T0.4144,0.5826 T0.4428,0.5801 T0.4631,0.5776 L0.4663,0.5776 Q0.4704,0.5776,0.4785,0.5786 T0.4899,0.5796 Q0.4964,0.5796,0.5012,0.5767 Q0.5069,0.5737,0.5223,0.5737 Q0.5272,0.5737,0.5369,0.5742 T0.5499,0.5747 Q0.558,0.5747,0.5612,0.5737 Q0.5661,0.5717,0.5714,0.5712 T0.5835,0.5702 T0.5945,0.5692 T0.6018,0.5687 L0.6062,0.5687 T0.6095,0.5682 T0.6148,0.5678 Q0.6172,0.5668,0.6196,0.5653 T0.6245,0.5633 T0.631,0.5628 T0.6407,0.5638 T0.6504,0.5648 T0.6594,0.5638 T0.6675,0.5628 L0.6707,0.5628 L0.6861,0.5628 Q0.7364,0.5628,0.7494,0.5608 L0.7567,0.5608 L0.7652,0.5608 L0.7729,0.5608 Q0.7794,0.5608,0.7818,0.5589 Q0.7851,0.5569,0.7859,0.5559 Q0.7835,0.5539,0.7656,0.5519 Q0.7121,0.547,0.6975,0.543 Q0.6934,0.541,0.6853,0.5396 L0.6691,0.5366 T0.6525,0.5336 T0.6391,0.5312 Q0.6367,0.5302,0.6245,0.5257 T0.6034,0.5213 L0.5977,0.5213 Q0.5945,0.5223,0.5904,0.5223 Q0.5839,0.5223,0.5787,0.5208 T0.5685,0.5183 T0.5596,0.5173 Q0.558,0.5173,0.5552,0.5168 T0.5495,0.5163 L0.5434,0.5163 T0.5373,0.5158 T0.532,0.5148 T0.5284,0.5129 T0.5272,0.5104 L0.5272,0.5074 Q0.5304,0.5015,0.5377,0.499 T0.5629,0.4965 Q0.5734,0.4955,0.5811,0.4946 T0.5953,0.4916 T0.605,0.4896 Q0.6083,0.4886,0.6123,0.4886 Q0.6148,0.4886,0.6225,0.4891 T0.635,0.4896 L0.6456,0.4896 Q0.6837,0.4857,0.6861,0.4857 Q0.7226,0.4768,0.7283,0.4768 Q0.7307,0.4768,0.732,0.4773 T0.7372,0.4777 Q0.7502,0.4777,0.7721,0.4758 Q0.7753,0.4748,0.777,0.4738 Q0.7745,0.4718,0.768,0.4708 Q0.7599,0.4688,0.7445,0.4688 Q0.7405,0.4688,0.7324,0.4693 T0.721,0.4698 Q0.7056,0.4698,0.6999,0.4679 Q0.6861,0.4629,0.6626,0.4619 Q0.6586,0.4609,0.6533,0.4604 T0.6419,0.459 T0.6314,0.456 T0.6269,0.452 Q0.6269,0.451,0.6302,0.4491 Q0.6358,0.4451,0.6525,0.4416 T0.6788,0.4382 L0.6845,0.4382 L0.6902,0.4382 Q0.7064,0.4382,0.7145,0.4362 Q0.7202,0.4342,0.7307,0.4342 L0.7356,0.4342 L0.7409,0.4342 L0.7453,0.4342 Q0.7543,0.4342,0.7607,0.4332 Q0.7778,0.4313,0.7847,0.4288 T0.7932,0.4248 T0.7972,0.4169 T0.8045,0.4045 L0.8094,0.3986 T0.8135,0.3942 L0.8167,0.3912 T0.8191,0.3887 T0.8204,0.3867 T0.8208,0.3848 Q0.8208,0.3818,0.8167,0.3739 Q0.8127,0.3689,0.8054,0.3635 T0.7924,0.3556 T0.7778,0.3497 T0.768,0.3462 Q0.764,0.3442,0.7478,0.3427 T0.7267,0.3383 Q0.7234,0.3363,0.7044,0.3348 T0.6805,0.3323 L0.6764,0.3323 T0.6679,0.3328 T0.6586,0.3333 Q0.6521,0.3333,0.648,0.3314 Q0.6391,0.3264,0.6294,0.3264 Q0.6229,0.3264,0.6156,0.3294 Q0.6115,0.3304,0.6042,0.3304 Q0.5977,0.3304,0.5888,0.3289 T0.5738,0.3264 T0.5584,0.3225 L0.5491,0.3195 Q0.5418,0.3185,0.5162,0.3155 T0.4895,0.3121 T0.4826,0.3116 T0.4716,0.3111 T0.4607,0.3096 T0.4513,0.3066 T0.4477,0.3017 Q0.4477,0.2997,0.4485,0.2977 Q0.4526,0.2898,0.4611,0.2878 T0.4842,0.2859 Q0.4882,0.2859,0.4943,0.2864 T0.5028,0.2868 Q0.5118,0.2868,0.5215,0.2829 Q0.5401,0.276,0.5734,0.276 Q0.5831,0.276,0.5872,0.277 L0.5904,0.277 T0.5949,0.2745 T0.6034,0.272 Q0.631,0.269,0.6407,0.2661 Q0.6448,0.2641,0.6488,0.2641 T0.6573,0.2656 T0.6634,0.2671 Q0.6659,0.2671,0.6675,0.2651 Q0.6723,0.2601,0.6886,0.2552 T0.7137,0.2502 L0.7153,0.2502 L0.7178,0.2502 Q0.7218,0.2502,0.7279,0.2493 T0.7417,0.2468 T0.7526,0.2453 Q0.8208,0.2354,0.8281,0.2354 Q0.8337,0.2354,0.8394,0.2344 T0.8496,0.2315 T0.854,0.2265 Q0.854,0.2216,0.8443,0.2176 Q0.8354,0.2127,0.8216,0.2102 T0.7972,0.2072 T0.777,0.2067 T0.7648,0.2057 Q0.7632,0.2047,0.7498,0.2038 T0.7202,0.2018 T0.6983,0.1998 Q0.6918,0.1998,0.676,0.1949 T0.6537,0.1899 Q0.6496,0.1899,0.6472,0.1919 Q0.6342,0.1968,0.6123,0.1968 Q0.5961,0.1968,0.5912,0.1929 Q0.5904,0.1919,0.5892,0.1919 T0.5823,0.1944 T0.5722,0.1968 T0.5637,0.1949 Q0.5556,0.1909,0.5158,0.1869 Q0.5109,0.1869,0.5032,0.1835 T0.4915,0.18 Q0.4907,0.18,0.4891,0.181 Q0.4793,0.182,0.455,0.182 Q0.4177,0.182,0.4015,0.1771 Q0.3901,0.1741,0.3779,0.1741 Q0.3747,0.1741,0.369,0.1746 T0.3609,0.1751 Q0.3569,0.1751,0.3536,0.1741 Q0.3512,0.1741,0.3459,0.1736 T0.3358,0.1726 T0.3256,0.1716 T0.3167,0.1696 T0.3106,0.1662 Q0.3082,0.1632,0.3082,0.1592 Q0.3082,0.1543,0.3114,0.1508 T0.3204,0.1474 L0.3236,0.1474 Q0.3301,0.1494,0.3333,0.1494 Q0.339,0.1494,0.3496,0.1454 Q0.3674,0.1385,0.3869,0.1385 Q0.395,0.1385,0.4011,0.137 T0.4116,0.1355 T0.4197,0.1375 T0.425,0.1395 Q0.429,0.1395,0.4355,0.1365 Q0.4631,0.1266,0.4882,0.1266 Q0.5126,0.1266,0.5337,0.1246 Q0.5369,0.1246,0.5458,0.1207 T0.5661,0.1167 L0.5693,0.1167 Q0.5791,0.1177,0.5852,0.1187 T0.5921,0.1197 Q0.5945,0.1197,0.6002,0.1167 Q0.6026,0.1147,0.605,0.1123 T0.6091,0.1093 T0.6156,0.1088 T0.6318,0.1098 Q0.6456,0.1108,0.6569,0.1137 T0.6707,0.1167 Q0.674,0.1167,0.6772,0.1147 Q0.6821,0.1108,0.6946,0.1083 T0.721,0.1044 T0.7453,0.1029 L0.7526,0.1029 Q0.7583,0.1039,0.7652,0.1053 T0.7753,0.1068 Q0.7778,0.1068,0.7802,0.1058 Q0.7981,0.1019,0.8143,0.1019 Q0.8175,0.1019,0.8439,0.0964 T0.8735,0.091 Q0.8759,0.091,0.8836,0.089 T0.8938,0.0851 Q0.8929,0.0841,0.8905,0.0841 Q0.8832,0.0821,0.8735,0.0821 Q0.8694,0.0821,0.8629,0.0826 T0.854,0.0831 Q0.8508,0.0831,0.8491,0.0821 Q0.8475,0.0821,0.8171,0.0811 T0.7802,0.0781 T0.7571,0.0737 T0.7332,0.0712 Q0.7299,0.0712,0.7247,0.0717 T0.7161,0.0722 L0.7064,0.0722 Q0.7032,0.0712,0.7003,0.0707 T0.6959,0.0692 T0.693,0.0678 T0.6914,0.0663 T0.6902,0.0648 T0.689,0.0643 L0.6869,0.0643 L0.6845,0.0643 L0.6821,0.0643 Q0.6553,0.0643,0.6553,0.0554 T0.6796,0.0465 L0.6813,0.0465 L0.6845,0.0465 Q0.6918,0.0425,0.717,0.0376 Q0.7226,0.0366,0.7267,0.0356 T0.7324,0.0336 T0.7376,0.0317 T0.747,0.0297 Q0.7518,0.0287,0.7551,0.0287 T0.762,0.0297 T0.768,0.0307 L0.7729,0.0307 Q0.7802,0.0277,0.7997,0.0267 T0.8224,0.0237 Q0.8273,0.0227,0.8341,0.0223 T0.8475,0.0193 T0.8654,0.0143 T0.8873,0.0079 Q0.9002,0.003,0.9331,0.004 T0.97,0.004 Q0.9838,0,0.9976,0.001 Q1,0.001,1,0.003 Z M0.9935,0.996 L0.9951,0.0049 Q0.9822,0.0049,0.9716,0.0079 Q0.9659,0.0099,0.9327,0.0089 T0.8897,0.0119 Q0.8775,0.0158,0.8666,0.0183 T0.85,0.0237 Q0.8418,0.0267,0.8341,0.0272 T0.8248,0.0277 Q0.82,0.0297,0.8001,0.0312 T0.7745,0.0346 Q0.7697,0.0356,0.7664,0.0356 Q0.764,0.0356,0.7603,0.0341 T0.7534,0.0326 Q0.751,0.0326,0.7478,0.0336 Q0.7429,0.0346,0.7397,0.0356 T0.7344,0.0376 T0.7283,0.0401 T0.7178,0.0425 Q0.6926,0.0465,0.6878,0.0495 Q0.6845,0.0514,0.6764,0.0514 L0.6723,0.0514 L0.6691,0.0514 Q0.6602,0.0514,0.6602,0.0554 Q0.6602,0.0574,0.6659,0.0579 T0.6796,0.0589 T0.691,0.0603 T0.6967,0.0643 T0.7072,0.0673 Q0.7121,0.0682,0.7153,0.0682 T0.7238,0.0678 T0.7332,0.0673 Q0.7413,0.0673,0.7579,0.0692 T0.7818,0.0742 Q0.7867,0.0752,0.8171,0.0762 T0.8508,0.0781 L0.852,0.0781 T0.8601,0.0776 T0.8719,0.0772 Q0.8832,0.0772,0.8921,0.0791 Q0.8994,0.0811,0.8994,0.0841 T0.8933,0.0895 T0.8812,0.094 T0.8735,0.0959 T0.8451,0.1014 T0.8143,0.1068 Q0.7989,0.1068,0.7818,0.1098 Q0.7778,0.1108,0.7745,0.1108 T0.768,0.1103 T0.7603,0.1088 T0.7518,0.1068 L0.7461,0.1068 Q0.7315,0.1068,0.7088,0.1103 T0.6805,0.1177 Q0.6756,0.1207,0.6699,0.1207 Q0.6667,0.1207,0.6545,0.1177 T0.631,0.1147 Q0.6269,0.1137,0.6225,0.1133 T0.616,0.1128 L0.6123,0.1128 T0.6103,0.1133 L0.6083,0.1157 T0.6034,0.1197 Q0.5961,0.1246,0.5921,0.1246 Q0.5904,0.1246,0.5835,0.1231 T0.5693,0.1217 L0.5661,0.1217 Q0.558,0.1217,0.5535,0.1231 T0.5446,0.1266 T0.5345,0.1296 Q0.5126,0.1316,0.4882,0.1316 T0.438,0.1405 Q0.4298,0.1434,0.425,0.1434 Q0.4209,0.1434,0.4173,0.1419 T0.4112,0.1405 T0.4027,0.1419 T0.3869,0.1434 Q0.3682,0.1434,0.3512,0.1494 Q0.3398,0.1533,0.3333,0.1533 Q0.3285,0.1533,0.3228,0.1513 L0.3212,0.1513 Q0.3179,0.1513,0.3155,0.1538 T0.3131,0.1592 Q0.3131,0.1612,0.3147,0.1632 Q0.3171,0.1652,0.3232,0.1667 T0.3406,0.1691 T0.3544,0.1701 L0.3601,0.1701 L0.3678,0.1701 L0.3771,0.1701 Q0.3909,0.1701,0.4031,0.1731 Q0.4177,0.178,0.4558,0.178 Q0.4793,0.178,0.4882,0.1761 L0.4915,0.1761 Q0.498,0.1761,0.5061,0.179 T0.5158,0.183 Q0.5166,0.183,0.5231,0.1835 T0.5341,0.1845 T0.545,0.1855 T0.5572,0.1874 T0.5661,0.1909 Q0.5677,0.1919,0.5702,0.1919 T0.5791,0.1894 T0.588,0.1869 Q0.5921,0.1869,0.5945,0.1899 Q0.5977,0.1919,0.6123,0.1919 Q0.6334,0.1919,0.6448,0.1879 Q0.6488,0.186,0.6537,0.186 Q0.6626,0.186,0.6784,0.1909 T0.6983,0.1958 Q0.704,0.1968,0.7206,0.1973 T0.7506,0.1993 T0.7689,0.2018 L0.7705,0.2018 L0.7741,0.2018 L0.7786,0.2018 Q0.8248,0.2018,0.8475,0.2136 Q0.8597,0.2196,0.8597,0.2255 T0.8483,0.2359 T0.8281,0.2404 Q0.8208,0.2404,0.7534,0.2493 Q0.7502,0.2502,0.7425,0.2512 T0.7287,0.2532 T0.7178,0.2542 L0.7153,0.2542 L0.7137,0.2542 Q0.7064,0.2542,0.6906,0.2591 T0.6715,0.2681 T0.6626,0.272 Q0.6594,0.272,0.6541,0.2705 T0.6464,0.269 T0.6431,0.27 Q0.6318,0.273,0.6034,0.276 Q0.6018,0.276,0.5998,0.2774 T0.5957,0.2799 T0.5904,0.2809 L0.5856,0.2809 Q0.5823,0.2799,0.575,0.2799 Q0.541,0.2799,0.5239,0.2868 Q0.5134,0.2908,0.5028,0.2908 Q0.4996,0.2908,0.4935,0.2903 T0.4842,0.2898 Q0.4704,0.2898,0.4635,0.2918 T0.4534,0.2997 L0.4534,0.3007 Q0.4534,0.3037,0.459,0.3046 T0.4753,0.3066 T0.4899,0.3076 Q0.4907,0.3076,0.5166,0.3106 T0.5507,0.3155 Q0.5921,0.3264,0.605,0.3264 Q0.6107,0.3264,0.6131,0.3254 Q0.6212,0.3225,0.6294,0.3225 Q0.6407,0.3225,0.6513,0.3274 Q0.6529,0.3294,0.6569,0.3294 Q0.6594,0.3294,0.665,0.3284 T0.6748,0.3274 T0.6821,0.3284 Q0.6861,0.3294,0.6967,0.3299 T0.7165,0.3314 T0.7299,0.3343 Q0.7324,0.3363,0.7486,0.3383 T0.7697,0.3422 Q0.7713,0.3432,0.7774,0.3452 T0.7887,0.3492 T0.8005,0.3546 T0.8127,0.3625 T0.8208,0.3719 Q0.8256,0.3798,0.8256,0.3848 Q0.8256,0.3877,0.8236,0.3902 T0.8171,0.3976 T0.809,0.4075 T0.8021,0.4189 T0.7968,0.4273 T0.7867,0.4322 T0.7616,0.4382 Q0.7543,0.4392,0.7437,0.4392 L0.7364,0.4392 L0.7299,0.4392 Q0.7202,0.4392,0.7161,0.4402 Q0.7072,0.4431,0.691,0.4431 L0.6845,0.4431 L0.6788,0.4431 Q0.6707,0.4431,0.6545,0.4461 T0.6334,0.452 Q0.6399,0.456,0.6626,0.457 Q0.6878,0.458,0.7024,0.4639 Q0.7064,0.4649,0.7186,0.4649 L0.7295,0.4649 L0.7413,0.4649 Q0.7591,0.4649,0.7697,0.4669 Q0.7818,0.4688,0.7818,0.4728 Q0.7818,0.4748,0.7798,0.4763 T0.7753,0.4787 L0.7737,0.4797 L0.7729,0.4797 Q0.7494,0.4827,0.7388,0.4827 Q0.7332,0.4827,0.7307,0.4817 L0.7291,0.4817 Q0.7226,0.4817,0.6878,0.4896 Q0.6829,0.4906,0.6772,0.4911 T0.6618,0.4921 T0.646,0.4931 T0.6342,0.4936 T0.6212,0.4931 T0.6115,0.4926 Q0.6083,0.4926,0.6058,0.4931 T0.5969,0.4955 T0.5819,0.499 T0.5629,0.5005 Q0.5572,0.5005,0.5527,0.501 T0.545,0.502 T0.5397,0.503 T0.5361,0.5045 T0.5337,0.5064 T0.5328,0.5094 L0.532,0.5094 Q0.532,0.5104,0.5337,0.5109 T0.5381,0.5114 T0.5438,0.5119 T0.5515,0.5124 L0.5604,0.5124 Q0.5661,0.5134,0.5746,0.5153 T0.5912,0.5173 L0.5977,0.5173 L0.6026,0.5173 Q0.6139,0.5173,0.6273,0.5218 T0.6407,0.5272 Q0.6448,0.5282,0.6683,0.5321 T0.6991,0.5381 Q0.7137,0.543,0.7664,0.548 Q0.7908,0.55,0.7908,0.5559 Q0.7908,0.5589,0.7859,0.5628 Q0.781,0.5658,0.7713,0.5658 Q0.7689,0.5658,0.7628,0.5653 T0.7543,0.5648 T0.7502,0.5658 Q0.7364,0.5678,0.6878,0.5678 Q0.674,0.5678,0.6699,0.5668 L0.6683,0.5668 Q0.6659,0.5668,0.6606,0.5678 T0.6513,0.5687 Q0.6464,0.5687,0.6391,0.5678 Q0.6334,0.5668,0.6302,0.5668 T0.6241,0.5687 T0.6164,0.5717 Q0.6123,0.5727,0.6099,0.5727 L0.6062,0.5727 T0.6022,0.5732 T0.5953,0.5737 Q0.5904,0.5747,0.5839,0.5747 T0.5726,0.5752 T0.5629,0.5776 T0.5458,0.5796 Q0.5418,0.5796,0.5324,0.5791 T0.5191,0.5786 Q0.5077,0.5786,0.5045,0.5806 Q0.498,0.5836,0.4899,0.5836 Q0.4858,0.5836,0.4777,0.5826 T0.4655,0.5816 L0.4631,0.5816 Q0.4582,0.5816,0.4436,0.5841 T0.4144,0.5865 L0.4051,0.5865 L0.3986,0.5865 T0.3933,0.587 T0.3897,0.5875 T0.3869,0.5885 T0.3844,0.5895 T0.3812,0.591 T0.3779,0.5925 Q0.3739,0.5955,0.3633,0.5955 L0.3585,0.5955 L0.3536,0.5955 Q0.3277,0.5955,0.3066,0.6053 Q0.3017,0.6083,0.296,0.6083 Q0.2912,0.6083,0.2839,0.6068 T0.2741,0.6053 Q0.2693,0.6053,0.2547,0.6048 T0.236,0.6044 Q0.2222,0.6044,0.193,0.6103 L0.1882,0.6103 Q0.1825,0.6103,0.1703,0.6083 T0.1525,0.6063 L0.15,0.6063 Q0.1436,0.6063,0.135,0.6073 T0.1168,0.6098 T0.1038,0.6113 Q0.0973,0.6123,0.0787,0.6123 L0.06,0.6123 L0.0414,0.6123 L0.0235,0.6123 Q0.0049,0.6133,0.0049,0.6172 L0.0057,0.6222 Q0.0073,0.6261,0.043,0.6261 L0.0454,0.6261 L0.0479,0.6261 Q0.0527,0.6261,0.0633,0.6281 T0.0803,0.6301 L0.0835,0.6301 L0.0916,0.6301 Q0.0998,0.6301,0.129,0.632 Q0.1768,0.636,0.206,0.64 Q0.2117,0.6409,0.2165,0.6409 Q0.2206,0.6409,0.2263,0.6405 T0.2336,0.64 L0.2384,0.64 L0.2409,0.64 T0.251,0.6395 T0.2644,0.639 Q0.2741,0.639,0.279,0.6409 Q0.283,0.6429,0.2972,0.6439 T0.3293,0.6459 T0.3528,0.6469 L0.3577,0.6469 Q0.3642,0.6469,0.3723,0.6449 T0.3844,0.6429 Q0.3901,0.6429,0.3933,0.6454 T0.4006,0.6479 Q0.4088,0.6479,0.4517,0.6558 Q0.4582,0.6568,0.4623,0.6568 Q0.4655,0.6568,0.4716,0.6563 T0.4826,0.6558 L0.4882,0.6558 Q0.5004,0.6558,0.5255,0.6607 Q0.5328,0.6627,0.5604,0.6647 T0.6152,0.6682 T0.644,0.6696 T0.6719,0.6721 T0.7056,0.6756 Q0.7113,0.6756,0.7198,0.6805 T0.738,0.6855 Q0.7453,0.6855,0.7551,0.6879 T0.7741,0.6939 T0.7912,0.7018 T0.8029,0.7102 Q0.8054,0.7132,0.8054,0.7151 Q0.8054,0.7191,0.8009,0.7216 T0.7908,0.7255 T0.779,0.7285 T0.7721,0.731 Q0.7672,0.7329,0.7632,0.7339 T0.7551,0.7354 T0.7486,0.7369 Q0.7478,0.7369,0.7445,0.7379 T0.7388,0.7394 T0.7324,0.7404 L0.7242,0.7413 T0.7161,0.7418 Q0.7105,0.7418,0.6955,0.7428 T0.6748,0.7438 L0.6699,0.7438 L0.6667,0.7438 Q0.6659,0.7438,0.6407,0.7468 Q0.6367,0.7478,0.6334,0.7478 T0.6245,0.7468 T0.6148,0.7458 L0.6099,0.7458 Q0.6018,0.7468,0.5864,0.7498 T0.5653,0.7532 T0.5596,0.7557 Q0.5596,0.7596,0.571,0.7616 Q0.5742,0.7626,0.5803,0.7631 T0.5929,0.7641 T0.6018,0.7656 L0.6087,0.7656 T0.6192,0.7666 T0.6277,0.7695 Q0.631,0.7705,0.6342,0.7705 Q0.6383,0.7705,0.6452,0.7685 T0.6537,0.7666 L0.6553,0.7666 Q0.6602,0.7666,0.6711,0.769 T0.6853,0.7715 Q0.691,0.7715,0.7048,0.775 T0.7242,0.7814 Q0.7324,0.7854,0.7445,0.7864 Q0.7478,0.7864,0.768,0.7873 T0.7972,0.7893 Q0.7989,0.7893,0.8017,0.7898 T0.8054,0.7903 L0.8082,0.7903 T0.811,0.7908 T0.8131,0.7913 T0.8151,0.7918 L0.8167,0.7928 T0.8179,0.7943 T0.8191,0.7957 T0.8204,0.7977 T0.8208,0.8002 Q0.8208,0.8032,0.8171,0.8051 T0.8074,0.8081 T0.7997,0.8091 Q0.7932,0.8121,0.7737,0.8121 Q0.7664,0.8121,0.7413,0.8111 L0.7364,0.8111 Q0.7275,0.8111,0.7214,0.8121 T0.7084,0.8155 T0.6991,0.819 Q0.6934,0.82,0.6723,0.8205 T0.6472,0.8239 Q0.6423,0.8269,0.6375,0.8269 Q0.6358,0.8269,0.6338,0.8264 T0.6294,0.8254 T0.6253,0.8249 Q0.6042,0.8249,0.5961,0.8289 Q0.5921,0.8318,0.5839,0.8318 Q0.5783,0.8318,0.5645,0.8299 L0.5604,0.8299 Q0.5531,0.8299,0.5337,0.8368 Q0.5296,0.8378,0.5255,0.8378 Q0.5239,0.8378,0.5195,0.8373 T0.5118,0.8368 Q0.5061,0.8368,0.4996,0.8388 Q0.4947,0.8388,0.4882,0.8398 Q0.4777,0.8417,0.4753,0.8427 T0.4728,0.8467 Q0.4728,0.8487,0.4769,0.8492 T0.4886,0.8501 T0.5004,0.8516 Q0.5036,0.8516,0.515,0.8521 T0.5345,0.8546 Q0.5426,0.8556,0.5596,0.8556 L0.5649,0.8556 L0.5702,0.8556 L0.5791,0.8556 Q0.5921,0.8566,0.6135,0.8571 T0.6383,0.8586 Q0.6683,0.8615,0.6764,0.8615 L0.6776,0.8615 L0.6788,0.8615 Q0.7032,0.8615,0.7032,0.8684 Q0.7032,0.8714,0.6995,0.8749 T0.6959,0.8803 L0.6959,0.8813 Q0.6991,0.8843,0.7153,0.8843 Q0.7218,0.8843,0.7259,0.8833 L0.7299,0.8833 Q0.7324,0.8833,0.7348,0.8838 T0.7393,0.8848 T0.7433,0.8863 L0.7474,0.8882 T0.751,0.8892 Q0.7616,0.8922,0.7948,0.8952 Q0.7981,0.8952,0.8082,0.8981 T0.8297,0.9011 T0.8528,0.9026 T0.8747,0.907 T0.8856,0.9149 L0.8856,0.9159 Q0.8856,0.9179,0.8848,0.9189 T0.8828,0.9209 T0.88,0.9228 T0.8767,0.9243 T0.8731,0.9248 T0.8698,0.9253 T0.8666,0.9258 L0.8646,0.9258 Q0.8621,0.9258,0.8577,0.9263 T0.85,0.9268 T0.8439,0.9273 T0.8402,0.9278 Q0.8386,0.9298,0.8358,0.9308 T0.8305,0.9322 T0.8244,0.9332 T0.8183,0.9337 Q0.8135,0.9347,0.8025,0.9372 T0.7859,0.9416 Q0.7778,0.9436,0.7717,0.9471 T0.7624,0.9515 Q0.7575,0.9535,0.7486,0.9535 Q0.7461,0.9535,0.7397,0.953 T0.7291,0.9525 Q0.7234,0.9525,0.7186,0.953 T0.7137,0.957 T0.7194,0.9614 Q0.7567,0.9634,0.7664,0.9654 Q0.7745,0.9674,0.7762,0.9674 L0.7908,0.9674 Q0.7924,0.9664,0.7948,0.9664 Q0.8029,0.9664,0.8082,0.9679 T0.8224,0.9723 T0.8362,0.9773 Q0.8483,0.9812,0.871,0.9812 L0.8751,0.9812 Q0.8873,0.9812,0.8929,0.9822 T0.9165,0.9876 T0.9408,0.9931 Q0.9513,0.996,0.9935,0.996 Z M0.9968,0.998 L0.9976,0.003 Q0.9838,0.002,0.9708,0.0059 Q0.9659,0.0069,0.9327,0.0059 T0.8881,0.0099 Q0.8767,0.0138,0.8658,0.0163 T0.8491,0.0218 Q0.8418,0.0247,0.8341,0.0247 T0.8232,0.0257 Q0.8191,0.0277,0.7997,0.0292 T0.7737,0.0326 Q0.7697,0.0336,0.7672,0.0336 T0.7612,0.0321 T0.7543,0.0307 T0.747,0.0317 Q0.7397,0.0326,0.7336,0.0356 T0.717,0.0406 Q0.6918,0.0445,0.6861,0.0475 Q0.6845,0.0485,0.6772,0.0485 T0.6638,0.05 T0.6577,0.0549 T0.6642,0.0598 T0.6796,0.0613 T0.6902,0.0623 Q0.691,0.0623,0.6946,0.0658 T0.7064,0.0702 L0.7161,0.0702 Q0.7194,0.0702,0.7242,0.0697 T0.7332,0.0692 Q0.7413,0.0692,0.7579,0.0717 T0.781,0.0762 Q0.7867,0.0781,0.8171,0.0786 T0.85,0.0801 L0.8532,0.0801 Q0.8548,0.0801,0.8613,0.0796 T0.8727,0.0791 Q0.8832,0.0791,0.8913,0.0811 Q0.897,0.0831,0.897,0.0851 Q0.897,0.088,0.8873,0.0905 T0.8735,0.093 Q0.871,0.093,0.8447,0.0984 T0.8143,0.1039 Q0.7981,0.1039,0.781,0.1078 Q0.7778,0.1088,0.7745,0.1088 T0.7644,0.1073 T0.7518,0.1048 L0.7453,0.1048 Q0.7299,0.1048,0.7076,0.1083 T0.6788,0.1157 Q0.6748,0.1187,0.6699,0.1187 Q0.6675,0.1187,0.6557,0.1157 T0.6318,0.1118 Q0.6164,0.1108,0.6135,0.1108 T0.6095,0.1113 T0.6067,0.1142 T0.6018,0.1187 Q0.5953,0.1227,0.5921,0.1227 Q0.5904,0.1227,0.5839,0.1212 T0.5693,0.1187 L0.5661,0.1187 Q0.558,0.1187,0.5527,0.1207 T0.5434,0.1246 T0.5337,0.1266 Q0.5126,0.1296,0.4882,0.1296 T0.4371,0.1385 Q0.4298,0.1414,0.425,0.1414 Q0.4225,0.1414,0.4189,0.1395 T0.4112,0.1375 Q0.4079,0.1375,0.4019,0.1395 T0.3869,0.1414 Q0.3682,0.1414,0.3504,0.1474 Q0.3398,0.1513,0.3333,0.1513 Q0.3293,0.1513,0.3228,0.1494 L0.3204,0.1494 Q0.3179,0.1494,0.3155,0.1508 T0.3118,0.1543 T0.3106,0.1592 T0.3127,0.1642 T0.32,0.1677 T0.3305,0.1701 T0.3435,0.1716 T0.3544,0.1721 Q0.3569,0.1731,0.3601,0.1731 Q0.3625,0.1731,0.3686,0.1726 T0.3779,0.1721 Q0.3901,0.1721,0.4023,0.1751 Q0.4177,0.18,0.455,0.18 Q0.4793,0.18,0.4882,0.178 L0.4915,0.178 Q0.4964,0.178,0.5045,0.1815 T0.5158,0.185 Q0.5564,0.1889,0.5645,0.1929 Q0.5677,0.1939,0.571,0.1939 Q0.575,0.1939,0.5807,0.1919 T0.5888,0.1899 T0.5929,0.1909 Q0.5969,0.1949,0.6123,0.1949 Q0.6334,0.1949,0.6456,0.1899 Q0.6488,0.1879,0.6537,0.1879 Q0.661,0.1879,0.6772,0.1929 T0.6983,0.1978 Q0.704,0.1988,0.7206,0.1998 T0.7502,0.2018 T0.7664,0.2038 Q0.7672,0.2038,0.7818,0.2043 T0.8151,0.2067 T0.8459,0.2156 Q0.8573,0.2206,0.8573,0.2255 Q0.8573,0.2295,0.8516,0.2324 T0.8394,0.2369 T0.8281,0.2384 Q0.8208,0.2384,0.7526,0.2473 Q0.7494,0.2483,0.7421,0.2493 T0.7287,0.2512 T0.7178,0.2522 L0.7153,0.2522 L0.7137,0.2522 Q0.7056,0.2522,0.6898,0.2572 T0.6691,0.2671 Q0.6667,0.269,0.6634,0.269 Q0.661,0.269,0.6557,0.2681 T0.6472,0.2671 Q0.6448,0.2671,0.6415,0.2681 Q0.631,0.271,0.6034,0.274 Q0.5994,0.274,0.5961,0.2765 T0.5904,0.2789 L0.5864,0.2789 Q0.5831,0.2779,0.5742,0.2779 Q0.541,0.2779,0.5223,0.2849 Q0.5126,0.2888,0.5028,0.2888 Q0.5004,0.2888,0.4943,0.2883 T0.4842,0.2878 Q0.4704,0.2878,0.4627,0.2898 T0.4509,0.2987 Q0.4501,0.2997,0.4501,0.3007 Q0.4501,0.3046,0.4574,0.3066 T0.4765,0.3091 T0.4899,0.3096 Q0.4931,0.3106,0.5061,0.3121 T0.5316,0.315 T0.5499,0.3175 Q0.5507,0.3175,0.5572,0.3195 T0.5685,0.3225 T0.5803,0.3254 T0.5933,0.3279 T0.605,0.3284 T0.6148,0.3274 Q0.6221,0.3244,0.6294,0.3244 Q0.6399,0.3244,0.6496,0.3294 Q0.6529,0.3314,0.6577,0.3314 Q0.6602,0.3314,0.6663,0.3304 T0.6756,0.3294 T0.6813,0.3304 Q0.6837,0.3304,0.6873,0.3309 L0.6946,0.3318 T0.7024,0.3323 T0.7105,0.3328 T0.7178,0.3338 T0.7238,0.3348 T0.7283,0.3363 Q0.7324,0.3383,0.7482,0.3403 T0.7689,0.3442 Q0.7697,0.3442,0.779,0.3477 T0.794,0.3536 T0.8074,0.3615 T0.8183,0.3729 Q0.8232,0.3808,0.8232,0.3848 Q0.8232,0.3867,0.8216,0.3892 T0.8151,0.3961 T0.8062,0.406 T0.7997,0.4179 T0.7952,0.4263 T0.7855,0.4308 T0.7616,0.4362 Q0.7543,0.4372,0.7445,0.4372 L0.7372,0.4372 L0.7307,0.4372 Q0.7202,0.4372,0.7153,0.4382 Q0.7064,0.4402,0.691,0.4402 L0.6845,0.4402 L0.6788,0.4402 Q0.6699,0.4402,0.6533,0.4436 T0.6318,0.451 Q0.6302,0.451,0.6302,0.452 Q0.6302,0.457,0.6626,0.459 Q0.6869,0.4609,0.7015,0.4659 Q0.7064,0.4669,0.7202,0.4669 L0.7311,0.4669 L0.7429,0.4669 Q0.7599,0.4669,0.7689,0.4688 Q0.7794,0.4708,0.7794,0.4738 L0.7786,0.4748 T0.777,0.4763 T0.7749,0.4773 L0.7737,0.4777 L0.7729,0.4777 Q0.7502,0.4797,0.738,0.4797 L0.7315,0.4797 L0.7291,0.4797 Q0.7226,0.4797,0.6869,0.4876 Q0.6821,0.4886,0.6768,0.4891 T0.6614,0.4901 T0.6456,0.4916 L0.6342,0.4916 Q0.6294,0.4916,0.6217,0.4911 T0.6115,0.4906 Q0.6083,0.4906,0.6054,0.4911 T0.5961,0.4936 T0.5815,0.4965 T0.5629,0.4985 Q0.5507,0.4985,0.5442,0.4995 T0.5345,0.5025 T0.5304,0.5084 L0.5296,0.5094 Q0.5296,0.5114,0.5316,0.5124 T0.5373,0.5138 T0.5442,0.5143 L0.5523,0.5143 L0.5604,0.5143 Q0.5637,0.5153,0.5677,0.5158 T0.5742,0.5173 T0.5811,0.5188 T0.5904,0.5193 L0.5977,0.5193 L0.6026,0.5193 Q0.6107,0.5193,0.6168,0.5208 T0.6294,0.5252 T0.6399,0.5292 Q0.6448,0.5302,0.6679,0.5341 T0.6983,0.541 Q0.7129,0.545,0.7664,0.55 Q0.7883,0.5519,0.7883,0.5559 Q0.7883,0.5579,0.7843,0.5608 T0.7721,0.5638 Q0.7697,0.5638,0.764,0.5633 T0.7559,0.5628 L0.7502,0.5628 Q0.7364,0.5648,0.6869,0.5648 L0.6699,0.5648 L0.6675,0.5648 Q0.665,0.5648,0.6602,0.5658 T0.6513,0.5668 Q0.6464,0.5668,0.6399,0.5658 Q0.6342,0.5648,0.6302,0.5648 T0.6225,0.5668 T0.6156,0.5697 Q0.6107,0.5707,0.6087,0.5707 T0.6034,0.5712 T0.5953,0.5717 Q0.5904,0.5727,0.5835,0.5727 T0.5718,0.5732 T0.562,0.5757 Q0.558,0.5767,0.5483,0.5767 L0.5349,0.5767 L0.5207,0.5767 Q0.5069,0.5767,0.5028,0.5786 Q0.4972,0.5816,0.4899,0.5816 Q0.4858,0.5816,0.4781,0.5806 T0.4663,0.5796 L0.4631,0.5796 Q0.4582,0.5796,0.4432,0.5821 T0.4144,0.5846 L0.4071,0.5846 L0.4011,0.5846 T0.3958,0.5851 T0.3921,0.5856 T0.3889,0.5861 T0.3865,0.5865 T0.384,0.5875 L0.382,0.5885 L0.3796,0.5895 L0.3771,0.5905 Q0.3731,0.5925,0.365,0.5925 L0.3601,0.5925 L0.3552,0.5925 Q0.3277,0.5925,0.3049,0.6044 Q0.3017,0.6053,0.296,0.6053 Q0.292,0.6053,0.2847,0.6044 T0.2741,0.6034 Q0.2693,0.6034,0.2547,0.6029 T0.236,0.6024 Q0.2222,0.6024,0.1922,0.6073 Q0.1906,0.6083,0.1882,0.6083 Q0.1833,0.6083,0.1711,0.6063 T0.1533,0.6044 Q0.1517,0.6034,0.1492,0.6034 Q0.1436,0.6034,0.135,0.6048 T0.1168,0.6078 T0.103,0.6093 Q0.0973,0.6103,0.0787,0.6103 L0.0604,0.6103 L0.0414,0.6103 L0.0235,0.6103 Q0.0024,0.6113,0.0024,0.6172 Q0.0024,0.6192,0.0032,0.6231 Q0.0049,0.6281,0.0333,0.6281 L0.0414,0.6281 L0.0479,0.6281 Q0.0519,0.6281,0.0624,0.6301 T0.0803,0.632 L0.0835,0.632 L0.0916,0.632 Q0.0989,0.632,0.1281,0.634 L0.206,0.6419 Q0.2117,0.6429,0.2174,0.6429 Q0.2214,0.6429,0.2271,0.6424 T0.2344,0.6419 L0.2376,0.6419 Q0.2393,0.6429,0.2417,0.6429 T0.2526,0.6419 T0.2652,0.6409 Q0.2741,0.6409,0.2782,0.6429 T0.2968,0.6459 T0.3293,0.6479 T0.352,0.6489 Q0.3552,0.6499,0.3585,0.6499 Q0.365,0.6499,0.3731,0.6474 T0.3844,0.6449 Q0.3885,0.6449,0.3917,0.6474 T0.4006,0.6499 Q0.4088,0.6499,0.4509,0.6578 Q0.4574,0.6588,0.4631,0.6588 Q0.4655,0.6588,0.4716,0.6583 T0.4834,0.6578 L0.4874,0.6578 Q0.5004,0.6588,0.5255,0.6637 Q0.532,0.6647,0.56,0.6667 T0.6148,0.6701 T0.644,0.6716 Q0.6464,0.6726,0.6594,0.6736 T0.6861,0.6756 T0.7048,0.6775 Q0.7097,0.6775,0.7186,0.6825 T0.738,0.6874 Q0.7518,0.6874,0.7729,0.6958 T0.8005,0.7122 Q0.8029,0.7141,0.8029,0.7151 Q0.8029,0.7191,0.7968,0.7216 T0.7818,0.726 T0.7705,0.729 L0.764,0.731 T0.7583,0.7324 T0.753,0.7334 T0.7486,0.7349 Q0.7251,0.7399,0.7161,0.7399 Q0.7097,0.7399,0.6951,0.7409 T0.6748,0.7418 L0.6703,0.7418 L0.6667,0.7418 Q0.6659,0.7418,0.6399,0.7448 L0.6334,0.7448 Q0.631,0.7448,0.6249,0.7443 T0.6148,0.7438 L0.6099,0.7438 Q0.601,0.7448,0.5856,0.7473 T0.5645,0.7507 Q0.5572,0.7517,0.5572,0.7547 T0.5616,0.7606 T0.5702,0.7646 Q0.5734,0.7646,0.5779,0.7651 T0.5864,0.7661 T0.5949,0.7671 T0.6018,0.7676 L0.6071,0.7676 T0.6135,0.7681 T0.62,0.769 T0.6269,0.771 T0.6342,0.7725 Q0.6391,0.7725,0.6464,0.7705 T0.6541,0.7685 L0.6553,0.7685 Q0.6586,0.7685,0.6699,0.771 T0.6853,0.7735 Q0.6902,0.7735,0.704,0.777 T0.7226,0.7834 Q0.7315,0.7873,0.7445,0.7883 Q0.747,0.7883,0.7676,0.7893 T0.7972,0.7913 Q0.7989,0.7913,0.8017,0.7918 T0.8058,0.7923 T0.809,0.7928 T0.8114,0.7933 T0.8131,0.7938 T0.8147,0.7943 T0.8159,0.7953 L0.8171,0.7967 T0.8175,0.7982 Q0.8183,0.7992,0.8183,0.8002 Q0.8183,0.8022,0.8155,0.8032 T0.807,0.8051 T0.7989,0.8071 Q0.7932,0.8091,0.7737,0.8091 L0.7413,0.8091 L0.7372,0.8091 Q0.7275,0.8091,0.721,0.8101 T0.7072,0.8136 T0.6983,0.817 Q0.6942,0.818,0.6825,0.818 T0.6602,0.819 T0.6456,0.822 Q0.6415,0.8249,0.6375,0.8249 Q0.6367,0.8249,0.6326,0.8239 T0.6253,0.8229 Q0.6034,0.8229,0.5953,0.8279 Q0.5912,0.8289,0.5848,0.8289 Q0.5775,0.8289,0.5645,0.8279 Q0.5629,0.8269,0.5604,0.8269 Q0.5523,0.8269,0.5328,0.8348 Q0.5296,0.8358,0.5264,0.8358 Q0.5247,0.8358,0.5203,0.8353 T0.5126,0.8348 Q0.5061,0.8348,0.4988,0.8358 Q0.4947,0.8368,0.4882,0.8378 Q0.4826,0.8388,0.4797,0.8388 T0.474,0.8398 T0.4704,0.8422 T0.4696,0.8462 T0.472,0.8501 T0.4781,0.8521 T0.4854,0.8526 L0.4935,0.8526 T0.4996,0.8536 Q0.5036,0.8536,0.515,0.8546 T0.5337,0.8566 Q0.5426,0.8576,0.5596,0.8576 L0.5657,0.8576 L0.571,0.8576 L0.5791,0.8576 Q0.5921,0.8586,0.6135,0.8591 T0.6383,0.8605 Q0.6683,0.8635,0.6764,0.8635 Q0.6999,0.8635,0.6999,0.8684 Q0.6999,0.8694,0.6967,0.8734 T0.6934,0.8803 L0.6934,0.8823 Q0.6951,0.8863,0.7137,0.8863 Q0.7218,0.8863,0.7267,0.8853 L0.7299,0.8853 Q0.734,0.8853,0.7409,0.8882 T0.7502,0.8912 Q0.7607,0.8942,0.794,0.8971 Q0.7972,0.8971,0.8078,0.9001 T0.8297,0.9031 Q0.8475,0.9031,0.8646,0.9065 T0.8824,0.9149 L0.8824,0.9159 Q0.8824,0.9169,0.882,0.9179 T0.8808,0.9194 L0.8792,0.9204 T0.8767,0.9214 T0.8743,0.9224 T0.8715,0.9228 L0.8686,0.9228 T0.8662,0.9233 T0.8637,0.9238 L0.8556,0.9238 T0.8447,0.9243 T0.8386,0.9268 Q0.837,0.9278,0.835,0.9288 T0.8305,0.9303 T0.8244,0.9308 T0.8175,0.9318 Q0.8127,0.9327,0.8017,0.9352 T0.7851,0.9397 Q0.777,0.9416,0.7705,0.9451 T0.7616,0.9496 Q0.7575,0.9505,0.7494,0.9505 L0.7405,0.9505 L0.7307,0.9505 Q0.7234,0.9505,0.7178,0.9515 Q0.7145,0.9515,0.7125,0.9535 T0.7105,0.9575 Q0.7105,0.9624,0.7194,0.9634 Q0.7567,0.9654,0.7664,0.9674 Q0.7745,0.9693,0.7762,0.9693 L0.7908,0.9693 L0.7948,0.9693 Q0.8005,0.9693,0.8058,0.9698 T0.8143,0.9718 T0.824,0.9753 T0.8354,0.9792 Q0.8483,0.9832,0.871,0.9832 L0.8739,0.9832 L0.8767,0.9832 Q0.8873,0.9832,0.8921,0.9842 Q0.8978,0.9852,0.9157,0.9896 T0.94,0.996 Q0.9424,0.996,0.9469,0.9965 T0.9566,0.997 T0.9676,0.9975 T0.9781,0.998 L0.9874,0.998 L0.9943,0.998 L0.9968,0.998 Z",type:0}},"":{type:5,data:{d:"M1,0.5071 L0.8623,0.7102 L0.5865,0.7102 L0.4489,0.5071 L0.5865,0.3045 L0.8623,0.3045 Z M0.4135,0.7974 L0.2758,1 L0,1 L0,0.5944 L0.2758,0.5944 Z M0.4135,0.2026 L0.2758,0.4056 L0,0.4056 L0,0 L0.2758,0 Z",type:0}},"":{type:5,data:{d:"M0.9726,0.5071 L0.8451,0.3184 L0.59,0.3184 L0.4624,0.5071 L0.59,0.6955 L0.8451,0.6955 Z M1,0.5071 L0.8588,0.716 L0.5768,0.716 L0.4355,0.5071 L0.5768,0.2982 L0.8588,0.2982 Z M0.401,0.7911 L0.2735,0.6028 L0.0236,0.6028 L0.0236,0.9799 L0.2735,0.9799 Z M0.4284,0.7911 L0.2872,1 L0,1 L0,0.5826 L0.2872,0.5826 Z M0.401,0.2089 L0.2735,0.0201 L0.0236,0.0201 L0.0236,0.3972 L0.2735,0.3972 Z M0.4284,0.2089 L0.2872,0.4174 L0,0.4174 L0,0 L0.2872,0 Z",type:0}},"":{type:5,data:{d:"M1,0.4996 Q1,0.5365,0.9924,0.568 T0.9718,0.6177 T0.9433,0.6363 L0.9425,0.6367 Q0.9355,0.6367,0.9285,0.6326 L0.9308,0.6326 Q0.9129,0.6195,0.9013,0.587 T0.8871,0.5164 T0.8943,0.4373 T0.9254,0.3687 L0.9254,0.3691 Q0.9339,0.3628,0.9425,0.3628 Q0.9584,0.3628,0.9716,0.3811 T0.9924,0.431 T1,0.4996 Z M0.9234,0.6321 L0.8776,0.7169 Q0.8791,0.732,0.8791,0.7441 Q0.8791,0.781,0.8716,0.8123 T0.8508,0.862 T0.8224,0.8809 L0.8216,0.8809 Q0.8154,0.8809,0.8092,0.8775 L0.8088,0.8775 Q0.7905,0.8633,0.7792,0.8297 T0.766,0.7571 T0.775,0.6768 T0.8088,0.6086 L0.7431,0.6065 Q0.719,0.6313,0.7072,0.6705 T0.6965,0.7487 T0.7097,0.823 T0.7423,0.8763 L0.7913,0.8775 L0.7314,0.9895 L0.4648,0.5038 L0.7299,0.0176 L0.7882,0.1229 L0.7404,0.1212 Q0.7244,0.138,0.7136,0.1617 T0.6982,0.2108 T0.6943,0.2632 T0.7003,0.3144 T0.7159,0.3586 T0.7396,0.3909 L0.8072,0.3926 Q0.7894,0.3796,0.7777,0.3479 T0.7635,0.2789 T0.7697,0.2011 T0.7987,0.1326 Q0.8092,0.1225,0.8204,0.1225 Q0.8321,0.1225,0.8426,0.1332 T0.8609,0.1623 T0.8731,0.2062 T0.8776,0.2592 Q0.8776,0.268,0.8768,0.2815 L0.9219,0.3628 L0.8644,0.3612 Q0.8403,0.3855,0.8284,0.4247 T0.8177,0.5029 T0.8309,0.5772 T0.8632,0.6305 Z M0.6759,0.6384 Q0.6576,0.625,0.6457,0.5914 T0.6319,0.5185 T0.6407,0.4375 T0.6751,0.3691 L0.609,0.367 Q0.5849,0.3918,0.5731,0.431 T0.5626,0.509 T0.5758,0.5833 T0.6082,0.6367 Z M0.6459,0.0025 L0.391,0.4551 L0.0035,0.4551 L0.246,0 Z M0.6553,1 L0.2421,1 L0,0.5449 L0.3875,0.5449 Z",type:0}},"":{type:5,data:{d:"M0.4996,0 Q0.5562,0,0.5961,0.0166 T0.6364,0.0566 L0.6368,0.0575 Q0.6368,0.0646,0.6324,0.0713 L0.6324,0.0692 Q0.6196,0.0868,0.5872,0.0986 T0.5166,0.1128 T0.4373,0.1057 T0.3689,0.0747 L0.3694,0.0747 Q0.3627,0.0663,0.3627,0.0575 Q0.3627,0.0336,0.4028,0.0168 T0.4996,0 Z M0.6324,0.0768 L0.717,0.1225 Q0.7321,0.1212,0.744,0.1212 Q0.8007,0.1212,0.8406,0.1378 T0.8809,0.1779 L0.8813,0.1783 Q0.8813,0.1846,0.8778,0.1909 Q0.8636,0.2093,0.8299,0.2208 T0.7573,0.2343 T0.6769,0.2253 T0.6089,0.1913 L0.6067,0.2567 Q0.6315,0.281,0.6707,0.2928 T0.7489,0.3035 T0.8231,0.2903 T0.8764,0.258 L0.8778,0.2085 L0.9898,0.2685 L0.504,0.5352 L0.0177,0.2701 L0.1227,0.2118 L0.1213,0.2596 Q0.1457,0.2836,0.1851,0.2955 T0.2635,0.3062 T0.3377,0.293 T0.3911,0.2605 L0.3928,0.193 Q0.38,0.2106,0.3483,0.2221 T0.2792,0.2364 T0.2013,0.2303 T0.1324,0.2013 Q0.1222,0.1909,0.1222,0.1795 Q0.1222,0.156,0.1623,0.1393 T0.2591,0.1225 Q0.2679,0.1225,0.2817,0.1233 L0.3627,0.078 L0.3609,0.1359 Q0.3857,0.1598,0.4249,0.1718 T0.5031,0.1825 T0.5773,0.1693 T0.6306,0.1367 Z M0.6386,0.3242 Q0.6253,0.3427,0.5917,0.3544 T0.5186,0.3683 T0.4376,0.3595 T0.3689,0.3251 L0.3671,0.3909 Q0.3915,0.4148,0.4309,0.4268 T0.5093,0.4375 T0.5835,0.4243 T0.6368,0.3918 Z M0.0027,0.354 L0.4553,0.6091 L0.4553,0.9962 L0,0.7542 Z M1,0.3448 L1,0.7576 L0.5447,1 L0.5447,0.6128 Z",type:0}},"":{type:5,data:{d:"M0,0.7699 Q0,0.7172,0.0277,0.6731 T0.103,0.6032 T0.2066,0.5774 Q0.2487,0.5774,0.2865,0.5922 T0.3526,0.6339 L0.3935,0.6715 Q0.4218,0.6984,0.438,0.7336 T0.4541,0.8075 Q0.4541,0.8602,0.4264,0.9046 T0.3511,0.9745 T0.2475,1 Q0.2054,1,0.1676,0.9852 T0.1016,0.9435 L0.0606,0.9059 Q0.0317,0.879,0.0159,0.8438 T0,0.7699 Z M0.5459,0.7699 Q0.5459,0.7172,0.5736,0.6731 T0.6489,0.6032 T0.7525,0.5774 Q0.7946,0.5774,0.8324,0.5922 T0.8984,0.6339 L0.9394,0.6715 Q0.9579,0.6892,0.9714,0.7105 T0.9925,0.7567 T1,0.8075 Q1,0.8602,0.9723,0.9046 T0.897,0.9745 T0.7934,1 Q0.7513,1,0.7135,0.9852 T0.6474,0.9435 L0.6065,0.9059 Q0.5776,0.879,0.5617,0.8438 T0.5459,0.7699 Z M0,0.1925 Q0,0.1398,0.0277,0.0957 T0.103,0.0258 T0.2066,0 Q0.2487,0,0.2865,0.0148 T0.3526,0.0565 L0.3935,0.0941 Q0.4218,0.121,0.438,0.1562 T0.4541,0.2301 Q0.4541,0.2828,0.4264,0.3269 T0.3511,0.3968 T0.2475,0.4226 Q0.2054,0.4226,0.1676,0.4078 T0.1016,0.3661 L0.0606,0.3285 Q0.0317,0.3016,0.0159,0.2664 T0,0.1925 Z M0.5459,0.1925 Q0.5459,0.1398,0.5736,0.0957 T0.6489,0.0258 T0.7525,0 Q0.7946,0,0.8324,0.0148 T0.8984,0.0565 L0.9394,0.0941 Q0.9677,0.121,0.9838,0.1562 T1,0.2301 Q1,0.2828,0.9723,0.3269 T0.897,0.3968 T0.7934,0.4226 Q0.7513,0.4226,0.7135,0.4078 T0.6474,0.3661 L0.6065,0.3285 Q0.5874,0.3108,0.5741,0.2895 T0.5534,0.2433 T0.5459,0.1925 Z M0.3301,0.6403 Q0.3306,0.6403,0.3312,0.6409 L0.3272,0.6371 L0.3272,0.6371 Z M0.8759,0.6403 Q0.8765,0.6403,0.8771,0.6409 Q0.8748,0.6387,0.8725,0.6371 L0.8731,0.6371 Z M0.3301,0.0629 Q0.3306,0.0629,0.3312,0.0634 L0.3272,0.0597 L0.3272,0.0602 Z M0.8759,0.0629 Q0.8765,0.0629,0.8771,0.0634 Q0.8748,0.0613,0.8725,0.0597 Q0.8731,0.0597,0.8731,0.0602 Z M0.779,0.4113 L0.7501,0.3849 Q0.7046,0.3844,0.6636,0.3661 Q0.7132,0.407,0.779,0.4113 Z M0.7957,0.4118 Q0.8477,0.4113,0.8918,0.3874 T0.9619,0.3223 T0.9885,0.2323 L0.9585,0.2048 Q0.9538,0.2769,0.8987,0.3282 T0.7657,0.3844 Z M0.9879,0.2167 Q0.9827,0.1554,0.9388,0.1097 Q0.9585,0.1478,0.959,0.1898 Z M0.2331,0.4113 L0.2043,0.3849 Q0.1587,0.3844,0.1177,0.3661 Q0.1673,0.407,0.2331,0.4113 Z M0.2499,0.4118 Q0.2885,0.4118,0.324,0.3973 T0.3852,0.3589 T0.4264,0.3019 T0.4426,0.2323 L0.4126,0.2048 Q0.408,0.2769,0.3529,0.3282 T0.2198,0.3844 Z M0.442,0.2167 Q0.4368,0.1554,0.393,0.1097 Q0.4126,0.1478,0.4132,0.1903 Z M0.779,0.9887 L0.7501,0.9624 Q0.7046,0.9618,0.6636,0.9435 Q0.7132,0.9844,0.779,0.9887 Z M0.7957,0.9892 Q0.8477,0.9887,0.8918,0.9648 T0.9619,0.8997 T0.9885,0.8097 L0.9585,0.7823 Q0.9538,0.8543,0.8987,0.9056 T0.7657,0.9618 Z M0.9879,0.7941 Q0.9827,0.7328,0.9388,0.6871 Q0.9585,0.7253,0.959,0.7672 Z M0.2331,0.9887 L0.2043,0.9624 Q0.1587,0.9618,0.1177,0.9435 Q0.1673,0.9844,0.2331,0.9887 Z M0.2499,0.9892 Q0.3018,0.9887,0.3459,0.9648 T0.416,0.8997 T0.4426,0.8102 L0.4126,0.7823 Q0.408,0.8543,0.3529,0.9056 T0.2198,0.9618 Z M0.442,0.7941 Q0.4368,0.7328,0.393,0.6871 Q0.4126,0.7253,0.4132,0.7672 Z M0.3191,0.6452 Q0.2943,0.622,0.2643,0.6091 T0.2066,0.5962 Q0.1795,0.5962,0.1497,0.6091 T0.0949,0.6441 T0.0537,0.6995 T0.0375,0.7699 Q0.0375,0.8419,0.0941,0.8941 Q0.1189,0.9172,0.1489,0.9304 T0.2066,0.9435 Q0.2337,0.9435,0.2634,0.9304 T0.3182,0.8952 T0.3595,0.8398 T0.3756,0.7699 Q0.3756,0.6978,0.3191,0.6452 Z M0.026,0.7731 L0.026,0.7699 Q0.026,0.6935,0.0854,0.6376 Q0.0658,0.6538,0.0514,0.6739 T0.0289,0.718 T0.0202,0.7677 Z M0.0271,0.7892 L0.0208,0.7833 Q0.0254,0.8419,0.0681,0.886 Q0.0664,0.8828,0.0646,0.879 Q0.0329,0.8382,0.0271,0.7892 Z M0.3866,0.7823 Q0.382,0.8511,0.3278,0.9016 Q0.3843,0.8565,0.3918,0.7871 Z M0.3872,0.7677 L0.393,0.7726 L0.393,0.7699 Q0.393,0.7349,0.3791,0.7038 Q0.3739,0.6973,0.3681,0.6914 Q0.3866,0.7274,0.3872,0.7677 Z M0.865,0.6452 Q0.8402,0.622,0.8102,0.6091 T0.7525,0.5962 Q0.7305,0.5962,0.7072,0.6043 T0.6619,0.628 T0.6223,0.6642 T0.5941,0.7124 T0.5834,0.7699 Q0.5834,0.8419,0.6399,0.8941 Q0.6561,0.9097,0.6757,0.9207 T0.7149,0.9376 T0.7525,0.9435 Q0.7796,0.9435,0.8093,0.9304 T0.8641,0.8952 T0.9054,0.8398 T0.9215,0.7699 Q0.9215,0.6978,0.865,0.6452 Z M0.5718,0.7731 L0.5718,0.7699 Q0.5718,0.6935,0.6313,0.6376 Q0.6013,0.6618,0.584,0.6954 T0.5661,0.7677 Z M0.573,0.7892 L0.5666,0.7833 Q0.5713,0.8419,0.614,0.886 Q0.6122,0.8828,0.6105,0.879 Q0.5788,0.8382,0.573,0.7892 Z M0.9325,0.7823 Q0.9279,0.8511,0.8736,0.9016 Q0.9308,0.8565,0.9377,0.7871 Z M0.9331,0.7672 L0.9388,0.7726 L0.9388,0.7699 Q0.9388,0.7349,0.925,0.7038 Q0.9198,0.6973,0.914,0.6914 Q0.9325,0.7274,0.9331,0.7672 Z M0.3191,0.0677 Q0.2943,0.0446,0.2643,0.0317 T0.2066,0.0188 Q0.1795,0.0188,0.1497,0.0317 T0.0949,0.0667 T0.0537,0.122 T0.0375,0.1925 Q0.0375,0.2645,0.0941,0.3167 Q0.1189,0.3398,0.1489,0.353 T0.2066,0.3661 Q0.2337,0.3661,0.2634,0.353 T0.3182,0.3177 T0.3595,0.2624 T0.3756,0.1925 Q0.3756,0.1204,0.3191,0.0677 Z M0.026,0.1957 L0.026,0.1925 Q0.026,0.1161,0.0854,0.0602 Q0.0554,0.0844,0.0381,0.118 T0.0202,0.1903 Z M0.0271,0.2118 L0.0208,0.2059 Q0.0254,0.2645,0.0681,0.3086 Q0.0664,0.3054,0.0646,0.3016 Q0.0329,0.2608,0.0271,0.2118 Z M0.3866,0.2048 Q0.382,0.2737,0.3278,0.3242 Q0.3849,0.279,0.3918,0.2097 Z M0.3872,0.1903 L0.393,0.1952 L0.393,0.1925 Q0.393,0.1581,0.3791,0.1263 Q0.3739,0.1199,0.3681,0.114 Q0.3866,0.15,0.3872,0.1903 Z M0.865,0.0677 Q0.8402,0.0446,0.8102,0.0317 T0.7525,0.0188 Q0.7253,0.0188,0.6956,0.0317 T0.6408,0.0667 T0.5995,0.122 T0.5834,0.1925 Q0.5834,0.2645,0.6399,0.3167 Q0.6647,0.3398,0.6947,0.353 T0.7525,0.3661 Q0.7796,0.3661,0.8093,0.353 T0.8641,0.3177 T0.9054,0.2624 T0.9215,0.1925 Q0.9215,0.1204,0.865,0.0677 Z M0.5718,0.1957 L0.5718,0.1925 Q0.5718,0.1161,0.6313,0.0602 Q0.6013,0.0844,0.584,0.118 T0.5661,0.1903 Z M0.573,0.2118 L0.5666,0.2059 Q0.5713,0.2645,0.614,0.3086 Q0.6122,0.3054,0.6105,0.3016 Q0.5788,0.2608,0.573,0.2118 Z M0.9325,0.2048 Q0.9279,0.2737,0.8736,0.3242 Q0.9308,0.279,0.9377,0.2097 Z M0.9331,0.1898 L0.9388,0.1952 L0.9388,0.1925 Q0.9388,0.1575,0.925,0.1263 Q0.9198,0.1199,0.914,0.114 Q0.9325,0.15,0.9331,0.1898 Z",type:0}},"":{type:5,data:{d:"M0.7639,0.1974 L0.9593,0.1974 L0.9593,0.1443 L0.7639,0.1443 L0.7639,0.1974 Z M0.7586,0.109 L0.9727,0.109 Q0.9839,0.109,0.992,0.1153 T1,0.1291 L1,0.382 Q1,0.3906,0.9912,0.3964 T0.9727,0.4021 L0.7586,0.4021 Q0.7468,0.4021,0.739,0.3956 T0.7313,0.382 L0.7313,0.1291 Q0.7313,0.1246,0.7339,0.1207 T0.7406,0.1143 T0.7495,0.1104 T0.7586,0.109 Z M0.7639,0.6575 L0.9593,0.6575 L0.9593,0.6044 L0.7639,0.6044 L0.7639,0.6575 Z M0.7313,0.8347 L0.7313,0.5843 Q0.7313,0.5757,0.7401,0.5699 T0.7586,0.5641 L0.9706,0.5641 Q0.9818,0.5641,0.9898,0.5705 T0.9979,0.5843 L0.9979,0.8347 Q0.9979,0.8433,0.989,0.8491 T0.9706,0.8549 L0.7586,0.8549 Q0.7468,0.8549,0.739,0.8483 T0.7313,0.8347 Z M0,1 L0,0 L0.7607,0 L0.7607,1 L0,1 Z",type:0}},"":{type:5,data:{d:"M0.9764,0.0029 L0.3179,0.4552 L0,0.4552 L0,0 Z M1,1 L0,1 L0,0.5448 L0.3091,0.5448 Z",type:0}},"":{type:5,data:{d:"M0.0236,0.0029 L0.6824,0.4552 L1,0.4552 L1,0 Z M0,1 L1,1 L1,0.5448 L0.6912,0.5448 Z",type:0}},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z M.25,.15 L1,.15 L1,.85 L.25,.85 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z M0,.15 L1,.15 L1,.85 L0,.85 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z M0,.15 L.75,.15 L.75,.85 L0,.85 Z"},"":{type:5,data:{d:"M0.6574,0.303 Q0.623,0.291,0.5852,0.285 T0.5082,0.279 T0.4311,0.285 T0.359,0.303 L0.3082,0.248 Q0.3525,0.232,0.4041,0.2235 T0.5082,0.215 T0.6123,0.2235 T0.7082,0.248 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.8557,0.582 L0.7656,0.551 Q0.7852,0.53,0.7951,0.507 T0.8049,0.46 Q0.8049,0.424,0.782,0.3905 T0.718,0.332 T0.6221,0.293 T0.5082,0.279 L0.5082,0.215 Q0.5607,0.215,0.6123,0.2235 T0.709,0.248 T0.7918,0.287 T0.8557,0.3375 T0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.582 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.482,0.705,0.4557,0.703 T0.4049,0.697 L0.4311,0.635 Q0.4508,0.638,0.4697,0.6395 T0.5082,0.641 Q0.5672,0.641,0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 Q0.8049,0.436,0.7951,0.413 T0.7656,0.369 L0.8557,0.338 Q0.882,0.365,0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 L0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 T0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 L0.9098,0.46 Q0.9098,0.492,0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.338 L0.2508,0.369 Q0.2311,0.39,0.2213,0.413 T0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 Q0.5279,0.641,0.5467,0.6395 T0.5852,0.635 L0.6115,0.697 Q0.5869,0.701,0.5607,0.703 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.1607,0.582 Q0.1344,0.555,0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.3375 T0.2246,0.287 T0.3074,0.248 T0.4041,0.2235 T0.5082,0.215 L0.5082,0.279 Q0.4492,0.279,0.3943,0.293 T0.2984,0.332 T0.2344,0.3905 T0.2115,0.46 Q0.2115,0.484,0.2213,0.507 T0.2508,0.551 Z",type:0},scaleType:1},"":Ie.LINE_H,"":Ie.LINE_V,"":Ie.FADE_RIGHT,"":Ie.FADE_LEFT,"":Ie.FADE_DOWN,"":Ie.FADE_UP,"":Ie.CURVE_DOWN_RIGHT,"":Ie.CURVE_DOWN_LEFT,"":Ie.CURVE_UP_RIGHT,"":Ie.CURVE_UP_LEFT,"":[Ie.LINE_V,Ie.CURVE_UP_RIGHT],"":[Ie.LINE_V,Ie.CURVE_DOWN_RIGHT],"":[Ie.CURVE_DOWN_RIGHT,Ie.CURVE_UP_RIGHT],"":[Ie.LINE_V,Ie.CURVE_UP_LEFT],"":[Ie.LINE_V,Ie.CURVE_DOWN_LEFT],"":[Ie.CURVE_DOWN_LEFT,Ie.CURVE_UP_LEFT],"":[Ie.LINE_H,Ie.CURVE_DOWN_LEFT],"":[Ie.LINE_H,Ie.CURVE_DOWN_RIGHT],"":[Ie.CURVE_DOWN_LEFT,Ie.CURVE_DOWN_RIGHT],"":[Ie.LINE_H,Ie.CURVE_UP_LEFT],"":[Ie.LINE_H,Ie.CURVE_UP_RIGHT],"":[Ie.CURVE_UP_LEFT,Ie.CURVE_UP_RIGHT],"":[Ie.LINE_V,Ie.CURVE_UP_LEFT,Ie.CURVE_UP_RIGHT],"":[Ie.LINE_V,Ie.CURVE_DOWN_LEFT,Ie.CURVE_DOWN_RIGHT],"":[Ie.LINE_H,Ie.CURVE_DOWN_LEFT,Ie.CURVE_UP_LEFT],"":[Ie.LINE_H,Ie.CURVE_DOWN_RIGHT,Ie.CURVE_UP_RIGHT],"":[Ie.LINE_V,Ie.CURVE_DOWN_RIGHT,Ie.CURVE_UP_LEFT],"":[Ie.LINE_V,Ie.CURVE_DOWN_LEFT,Ie.CURVE_UP_RIGHT],"":[Ie.LINE_H,Ie.CURVE_DOWN_RIGHT,Ie.CURVE_UP_LEFT],"":[Ie.LINE_H,Ie.CURVE_DOWN_LEFT,Ie.CURVE_UP_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE],"":Ie.NODE_STROKE,"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_LEFT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_LEFT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_DOWN],"":[Ie.NODE_STROKE,Ie.NODE_LINE_DOWN],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_UP],"":[Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_UP],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_LEFT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_LEFT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_FILL,Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"":[Ie.NODE_STROKE,Ie.NODE_LINE_UP,Ie.NODE_LINE_DOWN,Ie.NODE_LINE_LEFT,Ie.NODE_LINE_RIGHT],"🬀":gr(1),"🬁":gr(2),"🬂":gr(3),"🬃":gr(4),"🬄":gr(5),"🬅":gr(6),"🬆":gr(7),"🬇":gr(8),"🬈":gr(9),"🬉":gr(10),"🬊":gr(11),"🬋":gr(12),"🬌":gr(13),"🬍":gr(14),"🬎":gr(15),"🬏":gr(16),"🬐":gr(17),"🬑":gr(18),"🬒":gr(19),"🬓":gr(20),"🬔":gr(22),"🬕":gr(23),"🬖":gr(24),"🬗":gr(25),"🬘":gr(26),"🬙":gr(27),"🬚":gr(28),"🬛":gr(29),"🬜":gr(30),"🬝":gr(31),"🬞":gr(32),"🬟":gr(33),"🬠":gr(34),"🬡":gr(35),"🬢":gr(36),"🬣":gr(37),"🬤":gr(38),"🬥":gr(39),"🬦":gr(40),"🬧":gr(41),"🬨":gr(43),"🬩":gr(44),"🬪":gr(45),"🬫":gr(46),"🬬":gr(47),"🬭":gr(48),"🬮":gr(49),"🬯":gr(50),"🬰":gr(51),"🬱":gr(52),"🬲":gr(53),"🬳":gr(54),"🬴":gr(55),"🬵":gr(56),"🬶":gr(57),"🬷":gr(58),"🬸":gr(59),"🬹":gr(60),"🬺":gr(61),"🬻":gr(62),"🬼":{type:3,data:"M0,0.6667 L0,1 L0.5,1 Z"},"🬽":{type:3,data:"M0,0.6667 L0,1 L1,1 Z"},"🬾":{type:3,data:"M0,0.3333 L0,1 L0.5,1 Z"},"🬿":{type:3,data:"M0,0.3333 L0,1 L1,1 Z"},"🭀":{type:3,data:"M0,0 L0,1 L0.5,1 Z"},"🭁":{type:3,data:"M0,0.3333 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭂":{type:3,data:"M0,0.3333 L1,0 L1,1 L0,1 Z"},"🭃":{type:3,data:"M0,0.6667 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭄":{type:3,data:"M0,0.6667 L1,0 L1,1 L0,1 Z"},"🭅":{type:3,data:"M0,1 L0.5,0 L1,0 L1,1 Z"},"🭆":{type:3,data:"M0,0.6667 L1,0.3333 L1,1 L0,1 Z"},"🭇":{type:3,data:"M0.5,1 L1,0.6667 L1,1 Z"},"🭈":{type:3,data:"M0,1 L1,0.6667 L1,1 Z"},"🭉":{type:3,data:"M0.5,1 L1,0.3333 L1,1 Z"},"🭊":{type:3,data:"M0,1 L1,0.3333 L1,1 Z"},"🭋":{type:3,data:"M0.5,1 L1,0 L1,1 Z"},"🭌":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.3333 Z"},"🭍":{type:3,data:"M0,0 L0,1 L1,1 L1,0.3333 Z"},"🭎":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.6667 Z"},"🭏":{type:3,data:"M0,0 L0,1 L1,1 L1,0.6667 Z"},"🭐":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 Z"},"🭑":{type:3,data:"M0,0.3333 L0,1 L1,1 L1,0.6667 Z"},"🭒":{type:3,data:"M0,0.6667 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭓":{type:3,data:"M0,0.6667 L1,1 L1,0 L0,0 Z"},"🭔":{type:3,data:"M0,0.3333 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭕":{type:3,data:"M0,0.3333 L1,1 L1,0 L0,0 Z"},"🭖":{type:3,data:"M0,0 L0.5,1 L1,1 L1,0 Z"},"🭗":{type:3,data:"M0,0.3333 L0,0 L0.5,0 Z"},"🭘":{type:3,data:"M0,0.3333 L0,0 L1,0 Z"},"🭙":{type:3,data:"M0,0.6667 L0,0 L0.5,0 Z"},"🭚":{type:3,data:"M0,0.6667 L0,0 L1,0 Z"},"🭛":{type:3,data:"M0,1 L0,0 L0.5,0 Z"},"🭜":{type:3,data:"M0,0.6667 L0,0 L1,0 L1,0.3333 Z"},"🭝":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.6667 Z"},"🭞":{type:3,data:"M0,1 L0,0 L1,0 L1,0.6667 Z"},"🭟":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.3333 Z"},"🭠":{type:3,data:"M0,1 L0,0 L1,0 L1,0.3333 Z"},"🭡":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 Z"},"🭢":{type:3,data:"M0.5,0 L1,0 L1,0.3333 Z"},"🭣":{type:3,data:"M0,0 L1,0 L1,0.3333 Z"},"🭤":{type:3,data:"M0.5,0 L1,0 L1,0.6667 Z"},"🭥":{type:3,data:"M0,0 L1,0 L1,0.6667 Z"},"🭦":{type:3,data:"M0.5,0 L1,0 L1,1 Z"},"🭧":{type:3,data:"M0,0.3333 L1,0.6667 L1,0 L0,0 Z"},"🭨":{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0.5,0.5 Z"},"🭩":{type:3,data:"M0,0 L0.5,0.5 L1,0 L1,1 L0,1 Z"},"🭪":{type:3,data:"M0,0 L1,0 L0.5,0.5 L1,1 L0,1 Z"},"🭫":{type:3,data:"M0,0 L1,0 L1,1 L0.5,0.5 L0,1 Z"},"🭬":{type:3,data:"M0,0 L0.5,0.5 L0,1 Z"},"🭭":{type:3,data:"M0,0 L1,0 L0.5,0.5 Z"},"🭮":{type:3,data:"M1,0 L1,1 L0.5,0.5 Z"},"🭯":{type:3,data:"M0,1 L1,1 L0.5,0.5 Z"},"🭰":{type:0,data:[{x:1,y:0,w:1,h:8}]},"🭱":{type:0,data:[{x:2,y:0,w:1,h:8}]},"🭲":{type:0,data:[{x:3,y:0,w:1,h:8}]},"🭳":{type:0,data:[{x:4,y:0,w:1,h:8}]},"🭴":{type:0,data:[{x:5,y:0,w:1,h:8}]},"🭵":{type:0,data:[{x:6,y:0,w:1,h:8}]},"🭶":{type:0,data:[{x:0,y:1,w:8,h:1}]},"🭷":{type:0,data:[{x:0,y:2,w:8,h:1}]},"🭸":{type:0,data:[{x:0,y:3,w:8,h:1}]},"🭹":{type:0,data:[{x:0,y:4,w:8,h:1}]},"🭺":{type:0,data:[{x:0,y:5,w:8,h:1}]},"🭻":{type:0,data:[{x:0,y:6,w:8,h:1}]},"🭼":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🭽":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭾":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭿":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🮀":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮁":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮂":{type:0,data:[{x:0,y:0,w:8,h:2}]},"🮃":{type:0,data:[{x:0,y:0,w:8,h:3}]},"🮄":{type:0,data:[{x:0,y:0,w:8,h:5}]},"🮅":{type:0,data:[{x:0,y:0,w:8,h:6}]},"🮆":{type:0,data:[{x:0,y:0,w:8,h:7}]},"🮇":{type:0,data:[{x:6,y:0,w:2,h:8}]},"🮈":{type:0,data:[{x:5,y:0,w:3,h:8}]},"🮉":{type:0,data:[{x:3,y:0,w:5,h:8}]},"🮊":{type:0,data:[{x:2,y:0,w:6,h:8}]},"🮋":{type:0,data:[{x:1,y:0,w:7,h:8}]},"🮌":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},"🮍":{type:1,data:[[1,0],[0,1]],clipPath:"M0.5,0 L1,0 L1,1 L0.5,1 Z"},"🮎":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},"🮏":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},"🮐":{type:1,data:[[0,1],[1,0]]},"🮑":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},{type:0,data:[{x:0,y:0,w:8,h:4}]}],"🮒":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},{type:0,data:[{x:0,y:4,w:8,h:4}]}],"🮔":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},{type:0,data:[{x:4,y:0,w:4,h:8}]}],"🮕":{type:0,data:[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}]},"🮖":{type:0,data:[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}]},"🮗":{type:0,data:[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},"🮘":{type:2,data:"M-0.25,-0.25 L1.25,1.25 M-0.25,0 L1,1.25 M-0.25,0.25 L0.75,1.25 M-0.25,0.5 L0.5,1.25 M0,-0.25 L1.25,1 M0.25,-0.25 L1.25,0.75 M0.5,-0.25 L1.25,0.5 M-0.25,0.75 L0.25,1.25 M0.75,-0.25 L1.25,0.25",strokeWidth:1},"🮙":{type:2,data:"M-0.25,0.5 L0.5,-0.25 M-0.25,0.75 L0.75,-0.25 M-0.25,1 L1,-0.25 M-0.25,1.25 L1.25,-0.25 M0,1.25 L1.25,0 M0.25,1.25 L1.25,0.25 M0.5,1.25 L1.25,0.5 M-0.25,0.25 L0.25,-0.25 M0.75,1.25 L1.25,0.75",strokeWidth:1},"🮚":{type:5,data:{d:"M0,0 L.5,.5 L0,1 L1,1 L.5,.5 L1,0",type:0}},"🮛":{type:5,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1",type:0}},"🮜":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L0,1 Z"},"🮝":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,1 Z"},"🮞":{type:1,data:[[1,0],[0,1]],clipPath:"M1,0 L1,1 L0,1 Z"},"🮟":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,1 L0,1 Z"},"🮠":{type:2,data:"M.5,0 L0,.5",strokeWidth:1},"🮡":{type:2,data:"M.5,0 L1,.5",strokeWidth:1},"🮢":{type:2,data:"M0,.5 L.5,1",strokeWidth:1},"🮣":{type:2,data:"M1,.5 L.5,1",strokeWidth:1},"🮤":{type:2,data:"M.5,0 L0,.5 L.5,1",strokeWidth:1},"🮥":{type:2,data:"M.5,0 L1,.5 L.5,1",strokeWidth:1},"🮦":{type:2,data:"M0,.5 L.5,1 L1,.5",strokeWidth:1},"🮧":{type:2,data:"M0,.5 L.5,0 L1,.5",strokeWidth:1},"🮨":{type:2,data:"M.5,0 L0,.5 M1,.5 L.5,1",strokeWidth:1},"🮩":{type:2,data:"M.5,0 L1,.5 M0,.5 L.5,1",strokeWidth:1},"🮪":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5",strokeWidth:1},"🮫":{type:2,data:"M.5,0 L0,.5 L.5,1 L1,.5",strokeWidth:1},"🮬":{type:2,data:"M0,.5 L.5,0 L1,.5 L.5,1",strokeWidth:1},"🮭":{type:2,data:"M1,.5 L.5,0 L0,.5 L.5,1",strokeWidth:1},"🮮":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5 Z",strokeWidth:1},"🮯":{type:2,data:"M0,.5 L1,.5 M.5,.35 L.5,.65",strokeWidth:1},"🮰":{type:3,data:"M0.1,0.2 L0.1,.8 L.4,.6 L.9,0.6 Z",scaleType:1},"🮱":{type:4,data:{d:"M.1,.525 L.35,.675 L.9,.35",type:1},scaleType:1},"🮲":{type:3,data:"M.29,.27 L0.13,.56 L.22,.59 L.35,0.35 L.67,.35 L.57,.57 L.71,.76 L.22,.76 L.42,1 L.53,.98 L.43,.86 L.9,.86 L.71,.6 L1,.6 L1,.52 L.83,.52 L.92,.36 L1,.36 L1,.27Z M.99,.13 A.12,.12,0,1,1,.75,.13 A.12,.12,0,1,1,.99,.13"},"🮳":{type:3,data:"M0,.27 L.3,.27 L.55,.12 L.63,.18 L.33,.36 L0,.36 M0,.52 L.33,.52 L.59,.89 L.73,.89 L.73,.98 L.53,.98 L.28,.6 L0,.6"},"🮴":{type:4,data:{d:"M.15,.55 L.5,.4 L.5,.45 L.65,.45 L.65,.35 L.85,.35 L.85,.625 L.5,.625 L.5,.7 Z",type:0},scaleType:1},"🮵":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.15,.5 L.5,.35 L.5,.425 L.85,.425 L.85,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮶":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.85,.5 L.5,.35 L.5,.425 L.15,.425 L.15,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮷":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.675 L.2,.5 L.35,.5 L.35,.325 L.65,.325 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮸":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.325 L.2,.5 L.35,.5 L.35,.675 L.65,.675 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮹":{type:5,data:{d:"M1,.89 L.11,.89 L.11,.37 L.36,.12 L.74,.12 L.96,.34 L1,.34 L1,.405 L.92,.405 L.69,.185 L.41,.185 L.21,.42 L.21,.825 L1,.825 Z",type:0}},"🮺":{type:5,data:{d:"M0,.89 L0,.825 L.78,.825 L.78,.53 L.7,.415 L0,.415 L0,.35 L.75,.35 L.88,.48 L.88,.89 Z",type:0}},"🮻":{type:5,data:{d:"M.31,.275 L.44,.275 L.44,.47 L.05,.47 L.05,.405 L.31,.405 Z M.56,.275 L.69,.275 L.69,.405 L.95,.405 L.95,.47 L.56,.47 Z M.05,.53 L.44,.53 L.44,.725 L.31,.725 L.31,.595 L.05,.595 Z M.56,.53 L.95,.53 L.95,.595 L.69,.595 L.69,.725 L.56,.725 Z",type:0},scaleType:1},"🮼":[{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0,.935 L.885,.935 L.885,.065 L0,.065 Z"},{type:3,data:"M.67,.5 A.17,.085,0,1,1,.33,.5 A.17,.085,0,1,1,.67,.5",scaleType:1}],"🮽":{type:4,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1 Z",type:1}},"🮾":{type:4,data:{d:"M1,.5 L.5,1",type:1}},"🮿":{type:4,data:{d:"M.5,0 L1,.5 L.5,1 L0,.5 Z",type:1}},"🯀":{type:3,data:"M.16,.445 A.02,.01,0,0,1,.39,.33 L.5,.375 L.61,.33 A.02,.01,0,0,1,.84,.445 L.75,.5 L.84,.555 A.02,.01,0,0,1,.61,.67 L.5,.625 L.39,.67 A.02,.01,0,0,1,.16,.555 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",scaleType:1},"🯁":{type:3,data:"M0.142308,0.924 Q0.130770,0.924,0.120193,0.922 T0.101924,0.916 T0.089424,0.9065 T0.084616,0.895 V0.025 Q0.084616,0.019,0.089424,0.0135 T0.101924,0.004 T0.120193,-0.002 T0.142308,-0.004 Q0.150000,-0.004,0.157693,-0.003 T0.173078,0.000 L0.430770,0.085 Q0.451924,0.059,0.494232,0.041 T0.587501,0.013 T0.692309,-0.0005 T0.800001,-0.004 H1 V0.055 H0.800001 Q0.771155,0.055,0.742309,0.056 T0.685578,0.060 T0.630770,0.0685 T0.580770,0.0825 T0.543270,0.1045 T0.528847,0.133 V0.647 H0.530770 Q0.596155,0.645,0.659616,0.638 T0.782693,0.6165 T0.893270,0.5805 T1,0.531 V0.623 Q0.934616,0.644,0.880770,0.6595 T0.769232,0.685 T0.650963,0.700 T0.528847,0.707 V0.787 Q0.528847,0.802,0.543270,0.8155 T0.580770,0.8375 T0.630770,0.8515 T0.685578,0.860 T0.742309,0.864 T0.800001,0.865 H1 V0.924 H0.800001 Q0.746155,0.924,0.692309,0.9205 T0.587501,0.907 T0.494232,0.879 T0.430770,0.835 L0.173078,0.920 Q0.165386,0.922,0.157693,0.923 T0.142308,0.924 Z M0.2,0.841 L0.415385,0.770 V0.150 L0.2,0.079 V0.841 Z M1,0.698 Q0.973077,0.694,0.969231,0.6885 T0.965385,0.677 Q0.965385,0.672,0.969231,0.6665 T1,0.657 V0.698 Z"},"🯂":{type:3,data:"M0,0.623 V0.531 Q0.044231,0.512,0.0625,0.4905 T0.092308,0.4465 T0.108654,0.4005 T0.113462,0.354 V0.351 Q0.113462,0.345,0.117308,0.3395 T0.129808,0.3305 T0.148846,0.3245 T0.171154,0.323 H0.501923 Q0.532692,0.323,0.563462,0.3185 T0.617308,0.303 T0.651923,0.2765 T0.663462,0.2435 V0.241 Q0.663462,0.219,0.657692,0.197 T0.639423,0.1545 T0.604808,0.115 T0.549615,0.082 T0.475577,0.0615 T0.392308,0.055 H0 V-0.004 H1 V0.055 H0.667308 Q0.694231,0.071,0.713462,0.09 T0.746154,0.129 T0.766346,0.1705 T0.775,0.213 H1 V0.316 Q0.971154,0.305,0.955769,0.2965 T0.920192,0.2825 T0.876923,0.2745 T0.830769,0.272 H0.773077 Q0.767308,0.297,0.743269,0.319 T0.680769,0.355 T0.595192,0.375 T0.501923,0.381 H0.227308 Q0.223462,0.415,0.211,0.4485 T0.172692,0.5135 T0.108269,0.573 T0,0.623 Z M0.611538,0.924 H0 V0.865 H0.611538 Q0.642308,0.865,0.673077,0.8605 T0.727885,0.845 T0.762308,0.8185 T0.773077,0.787 V0.785 Q0.773077,0.769,0.762308,0.7535 T0.727885,0.727 T0.673077,0.7115 T0.611538,0.707 H0.059615 Q0.048077,0.707,0.037115,0.7045 T0,0.694 V0.653 Q0.026923,0.648,0.037115,0.646 T0.059615,0.644 H0.722692 Q0.753462,0.644,0.784231,0.6395 T0.839038,0.624 T0.873846,0.5975 T0.884615,0.566 V0.564 Q0.884615,0.548,0.873846,0.532 T0.839038,0.5055 T0.784231,0.49 T0.722692,0.4855 H0.392308 Q0.380769,0.4855,0.370192,0.483 T0.351923,0.4765 T0.339423,0.467 T0.334615,0.4555 T0.339423,0.444 T0.351923,0.4345 T0.370192,0.428 T0.392308,0.4255 H0.832692 Q0.855769,0.4255,0.878846,0.4235 T0.922115,0.416 T0.957692,0.4015 T1,0.3815 V0.4685 Q0.975,0.4705,0.966346,0.4725 T0.95,0.4765 Q0.961538,0.4835,0.969231,0.4915 T1,0.5075 V0.6205 Q0.965385,0.6455,0.926923,0.665 T0.84,0.6935 Q0.866923,0.7115,0.877596,0.7345 T0.894231,0.7855 V0.787 Q0.894231,0.815,0.876923,0.8425 T0.820192,0.8895 T0.726923,0.916 T0.611538,0.924 Z"},"🯃":{type:3,data:"M0,0.473 V0.386 Q0.025490,0.378,0.028431,0.3695 T0.031373,0.352 V0.35 Q0.031373,0.342,0.028431,0.333 T0,0.316 V0.213 H0.652941 Q0.684314,0.213,0.715686,0.2085 T0.770588,0.193 T0.804902,0.1665 T0.815686,0.135 V0.133 Q0.815686,0.117,0.804902,0.101 T0.770588,0.0745 T0.715686,0.0595 T0.652941,0.055 H0 V-0.004 H0.652941 Q0.707843,-0.004,0.761765,0.004 T0.856863,0.031 T0.915686,0.0775 T0.933333,0.133 V0.135 Q0.933333,0.163,0.915686,0.1905 T0.856863,0.237 T0.761765,0.264 T0.652941,0.272 H0.109804 Q0.131373,0.29,0.140196,0.31 T0.149020,0.35 V0.352 Q0.149020,0.37,0.142157,0.388 T0.118627,0.4225 T0.076471,0.452 T0,0.473 Z M0,0.625 V0.513 Q0.029412,0.526,0.032353,0.54 T0.035294,0.568 V0.57 Q0.035294,0.584,0.032353,0.598 T0,0.625 Z"},"🯄":{type:3,data:"M0.019231,1.085 V-0.165 H0.980769 V1.085 H0.019231 Z M0.446154,0.527 H0.553846 Q0.553846,0.511,0.5625,0.495 T0.591346,0.466 T0.631731,0.4405 T0.666346,0.4135 T0.688462,0.3825 T0.696154,0.35 Q0.696154,0.33,0.682692,0.311 T0.641346,0.2785 T0.575,0.259 T0.498077,0.253 T0.421154,0.259 T0.356731,0.279 T0.315385,0.3125 T0.301923,0.352 V0.357 H0.409615 V0.354 Q0.409615,0.345,0.414423,0.335 T0.431731,0.318 T0.4625,0.3075 T0.498077,0.304 Q0.517308,0.304,0.534615,0.307 T0.564423,0.3165 T0.582692,0.332 T0.588462,0.35 Q0.588462,0.366,0.572115,0.3805 T0.535577,0.4075 T0.496154,0.4335 T0.465385,0.4625 T0.45,0.4945 T0.446154,0.527 Z M0.5,0.667 Q0.519231,0.667,0.5375,0.664 T0.569231,0.654 T0.588462,0.637 T0.594231,0.617 T0.588462,0.5975 T0.569231,0.581 T0.5375,0.571 T0.5,0.568 T0.4625,0.571 T0.430769,0.581 T0.411538,0.5975 T0.405769,0.617 T0.411538,0.637 T0.430769,0.654 T0.4625,0.664 T0.5,0.667 Z",scaleType:1},"🯅":{type:5,data:{d:"M.44,.425 L.44,.51 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.51 L.56,.425 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯆":{type:5,data:{d:"M.44,.425 L.44,.46 L.23,.385 L.19,.43 L.44,.51 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.61,.735 L.7,.71 L.56,.56 L.56,.51 L.81,.43 L.77,.385 L.56,.46 L.56,.425 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯇":{type:5,data:{d:"M.44,.425 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.425 Z M.18,.53 L.23,.575 L.81,.43 L.77,.385 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯈":{type:5,data:{d:"M.44,.425 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.62,.735 L.71,.71 L.56,.56 L.56,.425 Z M.23,.385 L.18,.43 L.77,.575 L.81,.53 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯉":{type:5,data:{d:"M.44,.425 L.45,.495 L.15,.645 L.34,.645 L.34,.7 L.44,.7 L.44,.645 L.56,.645 L.56,.7 L.66,.7 L.66,.645 L.84,.645 L.54,.495 L.56,.425 Z M.39,.6 L.5,.55 L.60,.6 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯊":{type:5,data:{d:"M.26,.375 L.5,.255 L.74,.375 L.74,.665 L.5,.55 L.26,.665 Z M.37,.395 L.37,.54 L.5,.475 L.63,.54 L.63,.395 L.5,.33 Z",type:0},scaleType:1},"🯋":{type:5,data:{d:"M.09,.41 L.32,.295 L.5,.375 L.68,.295 L.91,.41 L.75,.5 L.91,.59 L.68,.705 L.5,.625 L.32,.705 L.09,.59 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",type:0},scaleType:1},"🯌":{type:5,data:{d:"M.55,.305 L.88,.305 L.88,.355 L.65,.355 L.65,.47 L.88,.47 L.88,.52 L.55,.52 Z",type:0},scaleType:1},"🯍":{type:5,data:{d:"M.38,.39 L.5,.33 L.62,.39 L.62,.53 L.5,.47 L.38,.53 Z",type:0},scaleType:1},"🯎":{type:3,data:"M0,0 L0.6667,0 L0.6667,1 L0,1 Z"},"🯏":{type:3,data:"M0,0 L0.3333,0 L0.3333,1 L0,1 Z"},"🯐":{type:2,data:"M1,.5 L0,1",strokeWidth:1},"🯑":{type:2,data:"M1,0 L0,.5",strokeWidth:1},"🯒":{type:2,data:"M0,0 L1,.5",strokeWidth:1},"🯓":{type:2,data:"M0,.5 L1,1",strokeWidth:1},"🯔":{type:2,data:"M0,0 L.5,1",strokeWidth:1},"🯕":{type:2,data:"M.5,0 L1,1",strokeWidth:1},"🯖":{type:2,data:"M1,0 L.5,1",strokeWidth:1},"🯗":{type:2,data:"M.5,0 L0,1",strokeWidth:1},"🯘":{type:2,data:"M0,0 L.5,.5 L1,0",strokeWidth:1},"🯙":{type:2,data:"M1,0 L.5,.5 L1,1",strokeWidth:1},"🯚":{type:2,data:"M0,1 L.5,.5 L1,1",strokeWidth:1},"🯛":{type:2,data:"M0,0 L.5,.5 L0,1",strokeWidth:1},"🯜":{type:2,data:"M0,0 L.5,1 L1,0",strokeWidth:1},"🯝":{type:2,data:"M1,0 L0,.5 L1,1",strokeWidth:1},"🯞":{type:2,data:"M0,1 L.5,0 L1,1",strokeWidth:1},"🯟":{type:2,data:"M0,0 L1,.5 L0,1",strokeWidth:1},"🯠":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0",type:1}},"🯡":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1",type:1}},"🯢":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1",type:1}},"🯣":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1",type:1}},"🯤":{type:0,data:[{x:2,y:0,w:4,h:4}]},"🯥":{type:0,data:[{x:2,y:4,w:4,h:4}]},"🯦":{type:0,data:[{x:0,y:2,w:4,h:4}]},"🯧":{type:0,data:[{x:4,y:2,w:4,h:4}]},"🯨":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0 Z",type:0}},"🯩":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1 Z",type:0}},"🯪":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1 Z",type:0}},"🯫":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1 Z",type:0}},"🯬":{type:5,data:{d:"M1,0 L.5,0 C.5,.276,.724,.5,1,.5 Z",type:0}},"🯭":{type:5,data:{d:"M0,1 L.5,1 C.5,.724,.276,.5,0,.5 Z",type:0}},"🯮":{type:5,data:{d:"M1,1 L1,.5 C.724,.5,.5,.724,.5,1 Z",type:0}},"🯯":{type:5,data:{d:"M0,0 L0,.5 C.276,.5,.5,.276,.5,0 Z",type:0}},"🯰":{type:5,data:{d:Po(126),type:0},scaleType:1},"🯱":{type:5,data:{d:Po(48),type:0},scaleType:1},"🯲":{type:5,data:{d:Po(109),type:0},scaleType:1},"🯳":{type:5,data:{d:Po(121),type:0},scaleType:1},"🯴":{type:5,data:{d:Po(51),type:0},scaleType:1},"🯵":{type:5,data:{d:Po(91),type:0},scaleType:1},"🯶":{type:5,data:{d:Po(95),type:0},scaleType:1},"🯷":{type:5,data:{d:Po(114),type:0},scaleType:1},"🯸":{type:5,data:{d:Po(127),type:0},scaleType:1},"🯹":{type:5,data:{d:Po(123),type:0},scaleType:1},"🯺":{type:5,data:{d:"M.5,.175 C.2,.175,.15,.305,.15,.435 L.05,.63 L.35,.63 C.35,.682,.42,.76,.5,.76 C.58,.76,.65,.682,.65,.63 L.95,.63 L.85,.435 C.85,.305,.8,.175,.5,.175 Z",type:0},scaleType:1},...Object.fromEntries(Array.from({length:256},(e,t)=>[String.fromCodePoint(10240+t),{type:6,data:t}]))},cC=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function gr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],n=[0,3/8,5/8];for(let a=0;a<3;a++){let l=e>>a*2&1,c=e>>a*2+1&1;l&&c?t.push(`M0,${n[a]} L1,${n[a]} L1,${n[a]+r[a]} L0,${n[a]+r[a]} Z`):l?t.push(`M0,${n[a]} L${.5},${n[a]} L${.5},${n[a]+r[a]} L0,${n[a]+r[a]} Z`):c&&t.push(`M${.5},${n[a]} L1,${n[a]} L1,${n[a]+r[a]} L${.5},${n[a]+r[a]} Z`)}return t.join(" ")}}}function Po(e){let t=[];if(e&64){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${n-.075},${.175} L${n},${.2125} L${n-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,n=.95-.15/2,a=.95,l=.175+.075+.015,c=.5-.015;t.push(`M${n},${l} L${a},${l+.0375} L${a},${c-.0375} L${n},${c} L${r},${c-.0375} L${r},${l+.0375} Z`)}if(e&16){let r=.7999999999999999,n=.95-.15/2,a=.95,l=.5+.015,c=.825-.075-.015;t.push(`M${n},${l} L${a},${l+.0375} L${a},${c-.0375} L${n},${c} L${r},${c-.0375} L${r},${l+.0375} Z`)}if(e&8){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.7875} L${r+.075},${.75} L${n-.075},${.75} L${n},${.7875} L${n-.075},${.825} L${r+.075},${.825} Z`)}if(e&4&&t.push(`M${.125},${.515} L${.2},${.515+.0375} L${.2},${.735-.0375} L${.125},${.735} L${.05},${.735-.0375} L${.05},${.515+.0375} Z`),e&2&&t.push(`M${.125},${.265} L${.2},${.265+.0375} L${.2},${.485-.0375} L${.125},${.485} L${.05},${.485-.0375} L${.05},${.265+.0375} Z`),e&1){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.5} L${r+.075},${.4625} L${n-.075},${.4625} L${n},${.5} L${n-.075},${.5375} L${r+.075},${.5375} Z`)}return t.join(" ")}var mi=0,Ys=0,Oo=!1,ll=!1,Cd=!1,aa,Q0=0,uC=class{constructor(e,t,r,n,a,l){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=n,this._coreBrowserService=a,this._themeService=l,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,n,a){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ys=0,mi=0,ll=!1,Oo=!1,Cd=!1,aa=this._themeService.colors,Q0=0;let l=e.getCode();if(l!==0&&e.extended.underlineStyle===4){let c=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Q0=t*n%(Math.round(c)*2)}if(Q0===0&&cC.has(l)&&(Q0=t*n%2*2+r*a%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",c=>{c.backgroundColorRGB&&(Ys=c.backgroundColorRGB.rgba>>8&16777215,ll=!0),c.foregroundColorRGB&&(mi=c.foregroundColorRGB.rgba>>8&16777215,Oo=!0)}),Cd=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Cd){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ys=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ys=(this.result.fg&16777215)<<8|255;break;default:Ys=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ys=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ys=(this.result.bg&16777215)<<8|255;break}Ys=mc.blend(Ys,(this._coreBrowserService.isFocused?aa.selectionBackgroundOpaque:aa.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ys=(this._coreBrowserService.isFocused?aa.selectionBackgroundOpaque:aa.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(ll=!0,aa.selectionForeground&&(mi=aa.selectionForeground.rgba>>8&16777215,Oo=!0),Fb(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)mi=(this._coreBrowserService.isFocused?aa.selectionBackgroundOpaque:aa.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:mi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:mi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:mi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:mi=(this.result.fg&16777215)<<8|255;break;default:mi=this._themeService.colors.foreground.rgba}mi=mc.blend(mi,(this._coreBrowserService.isFocused?aa.selectionBackgroundOpaque:aa.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Oo=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",c=>{c.backgroundColorRGB&&(Ys=c.backgroundColorRGB.rgba>>8&16777215,ll=!0),c.foregroundColorRGB&&(mi=c.foregroundColorRGB.rgba>>8&16777215,Oo=!0)}),ll&&(Cd?Ys=e.bg&-16777216&-134217729|Ys|50331648:Ys=e.bg&-16777216|Ys|50331648),Oo&&(mi=e.fg&-16777216&-67108865|mi|50331648),this.result.fg&67108864&&(ll&&!Oo&&((this.result.bg&50331648)===0?mi=this.result.fg&-134217728|aa.background.rgba>>8&16777215&16777215|50331648:mi=this.result.fg&-134217728|this.result.bg&67108863,Oo=!0),!ll&&Oo&&((this.result.fg&50331648)===0?Ys=this.result.bg&-67108864|aa.foreground.rgba>>8&16777215&16777215|50331648:Ys=this.result.bg&-67108864|this.result.fg&67108863,ll=!0)),aa=void 0,this.result.bg=ll?Ys:this.result.bg,this.result.fg=Oo?mi:this.result.fg,this.result.ext&=536870911,this.result.ext|=Q0<<29&3758096384}},dC=.5,$b=KT||XT?"bottom":"ideographic";function hC(e,t,r,n,a,l,c,h,p,g,x,y,A=0){let w=lC[t];if(w){let k=Array.isArray(w)?w:[w];for(let E of k)fC(e,E,r,n,a,l,c,h,p,g,x,y,A);return!0}return!1}function fC(e,t,r,n,a,l,c,h,p,g,x,y,A=0){let w=a,k=l,E=r,I=n;switch(t.scaleType===1&&(w=c,k=h,E=r+(a-c)/2,I=n+(l-h)/2),t.clipPath&&(e.save(),wC(e,t.clipPath,E,I,w,k)),t.type){case 0:pC(e,t.data,E,I,w,k);break;case 1:yC(e,t.data,E,I,w,k,A);break;case 2:vC(e,t.data,E,I,w,k,g,x,t.strokeWidth);break;case 3:gC(e,t.data,E,I,w,k,g,t.strokeWidth);break;case 4:bC(e,t.data,E,I,w,k,g,y);break;case 5:AC(e,t.data,E,I,w,k,p,g,x);break;case 6:mC(e,t.data,E,I,w,k);break}t.clipPath&&e.restore()}function pC(e,t,r,n,a,l){for(let c=0;c<t.length;c++){let h=t[c],p=a/8,g=l/8;e.fillRect(r+h.x*p,n+h.y*g,h.w*p,h.h*g)}}var Tg=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function mC(e,t,r,n,a,l){let c=a/8,h=l*.1,p=l*.8/8,g=Math.min(c,p);for(let x=0;x<8;x++)if(t&1<<x){let y=Tg[x*2],A=Tg[x*2+1],w=r+(y+1)*c,k=n+h+(A+1)*p;e.beginPath(),e.arc(w,k,g,0,Math.PI*2),e.fill()}}function gC(e,t,r,n,a,l,c,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,x=0,y=0,A=0,w="";for(let k of p.split(" ")){let E=k[0],I=k.substring(1).split(",");if(E==="Z"){e.closePath(),w=E;continue}if(E==="V"){let B=n+parseFloat(I[0])*l;e.lineTo(g,B),x=B,y=g,A=x,w=E;continue}if(E==="H"){let B=r+parseFloat(I[0])*a;e.lineTo(B,x),g=B,y=g,A=x,w=E;continue}if(!I[0]||!I[1])continue;if(E==="A"){let B=parseFloat(I[0])*a,F=parseFloat(I[1])*l,U=parseFloat(I[2])*Math.PI/180,G=parseInt(I[3],10),Q=parseInt(I[4],10),X=r+parseFloat(I[5])*a,ee=n+parseFloat(I[6])*l;xC(e,g,x,B,F,U,G,Q,X,ee),g=X,x=ee;continue}let M=I.map((B,F)=>{let U=parseFloat(B);return F%2===0?r+U*a:n+U*l});if(E==="M")e.moveTo(M[0],M[1]),g=M[0],x=M[1],y=g,A=x;else if(E==="L")e.lineTo(M[0],M[1]),g=M[0],x=M[1],y=g,A=x;else if(E==="Q")e.quadraticCurveTo(M[0],M[1],M[2],M[3]),y=M[0],A=M[1],g=M[2],x=M[3];else if(E==="T"){let B,F;w==="Q"||w==="T"?(B=2*g-y,F=2*x-A):(B=g,F=x),e.quadraticCurveTo(B,F,M[0],M[1]),y=B,A=F,g=M[0],x=M[1]}else E==="C"&&(e.bezierCurveTo(M[0],M[1],M[2],M[3],M[4],M[5]),y=M[2],A=M[3],g=M[4],x=M[5]);w=E}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*h,e.stroke()):e.fill()}function xC(e,t,r,n,a,l,c,h,p,g){if(n===0||a===0){e.lineTo(p,g);return}n=Math.abs(n),a=Math.abs(a);let x=Math.cos(l),y=Math.sin(l),A=(t-p)/2,w=(r-g)/2,k=x*A+y*w,E=-y*A+x*w,I=n*n,M=a*a,B=k*k,F=E*E,U=B/I+F/M;if(U>1){let Z=Math.sqrt(U);n*=Z,a*=Z,I=n*n,M=a*a}let G=(I*M-I*F-M*B)/(I*F+M*B);G<0&&(G=0);let Q=(c===h?-1:1)*Math.sqrt(G),X=Q*(n*E/a),ee=Q*-(a*k/n),ze=x*X-y*ee+(t+p)/2,he=y*X+x*ee+(r+g)/2,de=(k-X)/n,$e=(E-ee)/a,qe=(-k-X)/n,oe=(-E-ee)/a,Re=Math.atan2($e,de),K=Math.atan2(oe,qe)-Re;h===0&&K>0?K-=2*Math.PI:h===1&&K<0&&(K+=2*Math.PI);let we=Re+K;e.ellipse(ze,he,n,a,l,Re,we,h===0)}function bC(e,t,r,n,a,l,c,h){e.save(),e.fillRect(r,n,a,l),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=c,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let g=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){g==="Z"&&e.closePath();continue}let y=x.map((A,w)=>{let k=parseFloat(A);return w%2===0?r+k*a:n+k*l});g==="M"?e.moveTo(y[0],y[1]):g==="L"&&e.lineTo(y[0],y[1])}t.type===1?e.stroke():e.fill(),e.restore()}var Cg=new Map;function yC(e,t,r,n,a,l,c=0){let h=Cg.get(t);h||(h=new Map,Cg.set(t,h));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let g=h.get(p);if(!g){let A=t[0].length,w=t.length,k=e.canvas.ownerDocument.createElement("canvas");k.width=A,k.height=w;let E=Ms(k.getContext("2d")),I=new ImageData(A,w),M,B,F,U;if(p.startsWith("#"))M=parseInt(p.slice(1,3),16),B=parseInt(p.slice(3,5),16),F=parseInt(p.slice(5,7),16),U=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[M,B,F,U]=p.substring(5,p.length-1).split(",").map(G=>parseFloat(G));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let G=0;G<w;G++)for(let Q=0;Q<A;Q++)I.data[(G*A+Q)*4]=M,I.data[(G*A+Q)*4+1]=B,I.data[(G*A+Q)*4+2]=F,I.data[(G*A+Q)*4+3]=t[G][Q]*(U*255);E.putImageData(I,0,0),g=Ms(e.createPattern(k,null)),h.set(p,g)}let x=c>>1&1,y=c&1;x!==0||y!==0?g.setTransform(new DOMMatrix().translateSelf(-x,-y)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,n,a,l)}function vC(e,t,r,n,a,l,c,h,p){e.save(),e.beginPath(),e.rect(r,n,a,l),e.clip(),e.beginPath();let g;if(typeof t=="function"){let y=.15/l*a;g=t(.15,y)}else g=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let y of g.split(" ")){let A=y[0];if(A==="Z"){e.closePath(),x.lastCommand=A;continue}let w=Ub[A];if(!w){h.error(`Could not find drawing instructions for "${A}"`);continue}let k=y.substring(1).split(",");!k[0]||!k[1]||(w(e,zb(k,a,l,r,n,!0,c,0,0,!1),x),x.lastCommand=A)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function wC(e,t,r,n,a,l){e.beginPath();for(let c of t.split(" ")){let h=c[0];if(h==="Z"){e.closePath();continue}let p=c.substring(1).split(",");if(!p[0]||!p[1])continue;let g=r+parseFloat(p[0])*a,x=n+parseFloat(p[1])*l;h==="M"?e.moveTo(g,x):h==="L"&&e.lineTo(g,x)}e.clip()}function AC(e,t,r,n,a,l,c,h,p){let g=new Path2D;g.rect(r,n,a,l),e.clip(g),e.beginPath();let x=c/12;e.lineWidth=h*x;let y={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let A of t.d.split(" ")){let w=A[0];if(w==="Z"){e.closePath(),y.lastCommand=w;continue}let k=Ub[w];if(!k){p.error(`Could not find drawing instructions for "${w}"`);continue}let E=A.substring(1).split(",");!E[0]||!E[1]||(k(e,zb(E,a,l,r,n,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),y),y.lastCommand=w)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Sg(e,t,r=0){return Math.max(Math.min(e,t),r)}var Ub={C:(e,t,r)=>{e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),r.lastControlX=t[2],r.lastControlY=t[3],r.currentX=t[4],r.currentY=t[5]},L:(e,t,r)=>{e.lineTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},M:(e,t,r)=>{e.moveTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},Q:(e,t,r)=>{e.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.lastControlX=t[0],r.lastControlY=t[1],r.currentX=t[2],r.currentY=t[3]},T:(e,t,r)=>{let n,a;r.lastCommand==="Q"||r.lastCommand==="T"?(n=2*r.currentX-r.lastControlX,a=2*r.currentY-r.lastControlY):(n=r.currentX,a=r.currentY),e.quadraticCurveTo(n,a,t[0],t[1]),r.lastControlX=n,r.lastControlY=a,r.currentX=t[0],r.currentY=t[1]}};function zb(e,t,r,n,a,l,c,h=0,p=0,g=!0){let x=e.map(y=>parseFloat(y)||parseInt(y));if(x.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<x.length;y+=2){if(x[y]*=t-h*c-p*c,l&&x[y]!==0){let A=Math.round(x[y]+.5)-.5;x[y]=g?Sg(A,t,0):A}x[y]+=n+h*c}for(let y=1;y<x.length;y+=2){if(x[y]*=r,l&&x[y]!==0){let A=Math.round(x[y]+.5)-.5;x[y]=g?Sg(A,r,0):A}x[y]+=a}return x}var _g=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Lg=class{constructor(){this._data=new _g}set(e,t,r,n,a){this._data.get(e,t)||this._data.set(e,t,new _g),this._data.get(e,t).set(r,n,a)}get(e,t,r,n){return this._data.get(e,t)?.get(r,n)}clear(){this._data.clear()}},Hb=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t,r=0,n=e.timeRemaining(),a;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),a=e.timeRemaining(),r*1.5>a){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=a}this.clear()}},TC=class extends Hb{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},CC=class extends Hb{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},SC="requestIdleCallback"in globalThis?CC:TC,Zc=class Wb{constructor(){this.fg=0,this.bg=0,this.extended=new Gb}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Wb;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Gb=class Vb{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Vb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Eo=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Ps(()=>{});let a={fn:t,thisArgs:r};this._listeners.push(a);let l=Ps(()=>{let c=this._listeners.indexOf(a);c!==-1&&this._listeners.splice(c,1)});return n&&(Array.isArray(n)?n.push(l):n.add(l)),l},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:a}of r)n.call(a,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},dc;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new Qb;for(let x of l)g.add(x(y=>c.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(dc||={});var kg={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},P0=2,O0,Pl=class Vc{constructor(t,r,n,a){this._document=t,this._config=r,this._unicodeService=n,this._logService=a,this._didWarmUp=!1,this._cacheMap=new Lg,this._cacheMapCombined=new Lg,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Zc,this._textureSize=512,this._onAddTextureAtlasCanvas=new Eo,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Eo,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Yb(t,this._config.deviceCellWidth*4+P0*2,this._config.deviceCellHeight+P0*2),this._tmpCtx=Ms(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose(),this._onRemoveTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new SC(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let n=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,n)}})}beginFrame(){let t=this._requestClearModel;return this._requestClearModel=!1,t}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Vc.maxAtlasPages&&this._pages.length>=Math.max(4,Vc.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(Vc.maxTextureSize||4096)).sort((g,x)=>x.canvas.width!==g.canvas.width?x.canvas.width-g.canvas.width:x.percentageUsed-g.percentageUsed),n=-1,a=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==a)n=g,a=r[g].canvas.width;else if(g-n===3)break;let l=r.slice(n,n+4);if(l.length<4||l.some(g=>g.canvas.width!==l[0].canvas.width)){let g=new rc(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let c=l.map(g=>g.glyphs[0].texturePage).sort((g,x)=>g-x),h=this.pages.length-l.length,p=this._mergePages(l,h);p.version=++rc.nextVersion;for(let g=c.length-1;g>=0;g--)this._deletePage(c[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new rc(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let n=t[0].canvas.width*2,a=new rc(this._document,n,t);for(let[l,c]of t.entries()){let h=l*c.canvas.width%n,p=Math.floor(l/2)*c.canvas.height;a.ctx.drawImage(c.canvas,h,p);for(let x of c.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/n,x.sizeClipSpace.y=x.size.y/n,x.texturePosition.x+=h,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/n,x.texturePositionClipSpace.y=x.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let g=this._activePages.indexOf(c);g!==-1&&this._activePages.splice(g,1)}return a}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let n=this._pages[r];for(let a of n.glyphs)a.texturePage--;n.version=++rc.nextVersion}}getRasterizedGlyphCombinedChar(t,r,n,a,l,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,n,a,l,c)}getRasterizedGlyph(t,r,n,a,l,c){return this._getFromCacheMap(this._cacheMap,t,r,n,a,l,c)}_getFromCacheMap(t,r,n,a,l,c,h){return O0=t.get(r,n,a,l),O0||(O0=this._drawToCache(r,n,a,l,c,h),t.set(r,n,a,l,O0)),O0}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,n,a){if(this._config.allowTransparency)return so;let l;switch(t){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(r);break;case 50331648:let c=Zc.toColorRGB(r);l=Ki.toColor(c[0],c[1],c[2]);break;default:n?l=gu.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=gu.opaque(l)),l}_getForegroundColor(t,r,n,a,l,c,h,p,g,x){let y=this._getMinimumContrastColor(t,r,n,a,l,c,h,g,p,x);if(y)return y;let A;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&c<8&&(c+=8),A=this._getColorFromAnsiIndex(c);break;case 50331648:let w=Zc.toColorRGB(c);A=Ki.toColor(w[0],w[1],w[2]);break;default:h?A=this._config.colors.background:A=this._config.colors.foreground}return this._config.allowTransparency&&(A=gu.opaque(A)),p&&(A=gu.multiplyOpacity(A,dC)),A}_resolveBackgroundRgba(t,r,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,n,a){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&a&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,n,a,l,c,h,p,g,x){if(this._config.minimumContrastRatio===1||x)return;let y=this._getContrastCache(g),A=y.getColor(t,a);if(A!==void 0)return A??void 0;let w=this._resolveBackgroundRgba(r,n,h),k=this._resolveForegroundRgba(l,c,h,p),E=mc.ensureContrastRatio(w,k,this._config.minimumContrastRatio/(g?2:1));if(!E){y.setColor(t,a,null);return}let I=Ki.toColor(E>>24&255,E>>16&255,E>>8&255);return y.setColor(t,a,I),I}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,n,a,l,c){let h=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+P0*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+P0*4,this._textureSize);if(this._tmpCanvas.height<g&&(this._tmpCanvas.height=g),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=a,!!this._workAttributeData.isInvisible())return kg;let x=!!this._workAttributeData.isBold(),y=!!this._workAttributeData.isInverse(),A=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),E=!!this._workAttributeData.isStrikethrough(),I=!!this._workAttributeData.isOverline(),M=this._workAttributeData.getFgColor(),B=this._workAttributeData.getFgColorMode(),F=this._workAttributeData.getBgColor(),U=this._workAttributeData.getBgColorMode();if(y){let Le=M;M=F,F=Le;let Y=B;B=U,U=Y}let G=this._getBackgroundColor(U,F,y,A);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=G.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let Q=x?this._config.fontWeightBold:this._config.fontWeight,X=w?"italic":"";this._tmpCtx.font=`${X} ${Q} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=$b;let ee=h.length===1&&Wm(h.charCodeAt(0)),ze=h.length===1&&tC(h.charCodeAt(0)),he=this._getForegroundColor(r,U,F,n,B,M,y,A,x,Fb(h.charCodeAt(0)));this._tmpCtx.fillStyle=he.css;let de=ze?0:P0*2,$e=!1;if(this._config.customGlyphs!==!1){let Le=this._workAttributeData.getUnderlineVariantOffset();$e=hC(this._tmpCtx,h,de,de,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,G.css,Le)}let qe=!ee,oe;if(typeof t=="number"?oe=this._unicodeService.wcwidth(t):oe=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Y=Le%2===1?.5:0;if(this._tmpCtx.lineWidth=Le,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())qe=!1,this._tmpCtx.strokeStyle=`rgb(${Zc.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{qe=!1;let Ye=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Ye<8&&(Ye+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Ye).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let Ee=de,be=Math.ceil(de+this._config.deviceCharHeight)-Y-(l?Le*2:0),Me=be+Le*2,Ze=this._workAttributeData.getUnderlineVariantOffset(),Se=0,se=0;for(let Ye=0;Ye<oe;Ye++){let pt=!1;this._tmpCtx.save(),Se=be,se=Me;let rt=Ee+Ye*this._config.deviceCellWidth,ye=Ee+(Ye+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(rt,be),this._tmpCtx.lineTo(ye,be),this._tmpCtx.moveTo(rt,Me),this._tmpCtx.lineTo(ye,Me);break;case 3:Se=this._config.deviceCharHeight+1,se=Se+3*this._config.devicePixelRatio;let et=new Path2D;et.rect(rt,Se,this._config.deviceCellWidth,se-Se),this._tmpCtx.clip(et);let ht=this._config.deviceCellWidth,te=se-Se,ve=ht/6,ct=te/3,re=[[0,2,1,3,2.4,3,0,.6],[5.5,0,2.5,3,1.1,3,4.1,0],[4,0,6,2,6,.6,5.4,0]];for(let kt of re){this._tmpCtx.beginPath();for(let Dt=0;Dt<kt.length;Dt+=2){let Yt=rt+kt[Dt]*ve,xr=se-kt[Dt+1]*ct;Dt===0?this._tmpCtx.moveTo(Yt,xr):this._tmpCtx.lineTo(Yt,xr)}this._tmpCtx.closePath(),this._tmpCtx.fill()}pt=!0;break;case 4:let me=Ze===0?0:Ze>=Le?Le*2-Ze:Le-Ze;Ze>=Le||me===0?(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(rt+me,be),this._tmpCtx.lineTo(ye,be)):(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(rt,be),this._tmpCtx.lineTo(rt+me,be),this._tmpCtx.moveTo(rt+me+Le,be),this._tmpCtx.lineTo(ye,be)),Ze=oC(ye-rt,Le,Ze);break;case 5:let je=.6,mt=.3,ae=ye-rt,De=Math.floor(je*ae),gt=Math.floor(mt*ae),ft=ae-De-gt;this._tmpCtx.setLineDash([De,gt,ft]),this._tmpCtx.moveTo(rt,be),this._tmpCtx.lineTo(ye,be);break;default:this._tmpCtx.moveTo(rt,be),this._tmpCtx.lineTo(ye,be);break}pt||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!$e&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Ye=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ye&&Ye.actualBoundingBoxDescent>0){this._tmpCtx.save();let pt=new Path2D;pt.rect(Ee,Se-Math.ceil(Le/2),this._config.deviceCellWidth*oe,se-Se+Math.ceil(Le/2)),this._tmpCtx.clip(pt),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=G.css,this._tmpCtx.strokeText(h,de,de+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(I){let Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Y=Le%2===1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(de,de+Y),this._tmpCtx.lineTo(de+this._config.deviceCharWidth*oe,de+Y),this._tmpCtx.stroke()}if($e||this._tmpCtx.fillText(h,de,de+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let Le=Bf(this._tmpCtx.getImageData(de,de,this._config.deviceCellWidth,this._config.deviceCellHeight),G,he,qe);if(Le)for(let Y=1;Y<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=G.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,de,de+this._config.deviceCharHeight-Y),Le=Bf(this._tmpCtx.getImageData(de,de,this._config.deviceCellWidth,this._config.deviceCellHeight),G,he,qe),!!Le);Y++);}if(E){let Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Y=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(de,de+Math.floor(this._config.deviceCharHeight/2)-Y),this._tmpCtx.lineTo(de+this._config.deviceCharWidth*oe,de+Math.floor(this._config.deviceCharHeight/2)-Y),this._tmpCtx.stroke()}this._tmpCtx.restore();let Re=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),K;if(this._config.allowTransparency?K=_C(Re):K=Bf(Re,G,he,qe),K)return kg;let we=this._findGlyphBoundingBox(Re,this._workBoundingBox,p,ze,$e,de),Z,Ue;for(;;){if(this._activePages.length===0){let Le=this._createNewPage();Z=Le,Ue=Le.currentRow,Ue.height=we.size.y;break}Z=this._activePages[this._activePages.length-1],Ue=Z.currentRow;for(let Le of this._activePages)we.size.y<=Le.currentRow.height&&(Z=Le,Ue=Le.currentRow);for(let Le=this._activePages.length-1;Le>=0;Le--)for(let Y of this._activePages[Le].fixedRows)Y.height<=Ue.height&&we.size.y<=Y.height&&(Z=this._activePages[Le],Ue=Y);if(we.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new rc(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),Z=this._overflowSizePage,Ue=this._overflowSizePage.currentRow,Ue.x+we.size.x>=Z.canvas.width&&(Ue.x=0,Ue.y+=Ue.height,Ue.height=0);break}if(Ue.y+we.size.y>=Z.canvas.height||Ue.height>we.size.y+2){let Le=!1;if(Z.currentRow.y+Z.currentRow.height+we.size.y>=Z.canvas.height){let Y;for(let Ee of this._activePages)if(Ee.currentRow.y+Ee.currentRow.height+we.size.y<Ee.canvas.height){Y=Ee;break}if(Y)Z=Y;else if(Vc.maxAtlasPages&&this._pages.length>=Vc.maxAtlasPages&&Ue.y+we.size.y<=Z.canvas.height&&Ue.height>=we.size.y&&Ue.x+we.size.x<=Z.canvas.width)Le=!0;else{let Ee=this._createNewPage();Z=Ee,Ue=Ee.currentRow,Ue.height=we.size.y,Le=!0}}Le||(Z.currentRow.height>0&&Z.fixedRows.push(Z.currentRow),Ue={x:0,y:Z.currentRow.y+Z.currentRow.height,height:we.size.y},Z.fixedRows.push(Ue),Z.currentRow={x:0,y:Ue.y+Ue.height,height:0})}if(Ue.x+we.size.x<=Z.canvas.width)break;Ue===Z.currentRow?(Ue.x=0,Ue.y+=Ue.height,Ue.height=0):Z.fixedRows.splice(Z.fixedRows.indexOf(Ue),1)}return we.texturePage=this._pages.indexOf(Z),we.texturePosition.x=Ue.x,we.texturePosition.y=Ue.y,we.texturePositionClipSpace.x=Ue.x/Z.canvas.width,we.texturePositionClipSpace.y=Ue.y/Z.canvas.height,we.sizeClipSpace.x/=Z.canvas.width,we.sizeClipSpace.y/=Z.canvas.height,Ue.height=Math.max(Ue.height,we.size.y),Ue.x+=we.size.x,Z.ctx.putImageData(Re,we.texturePosition.x-this._workBoundingBox.left,we.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,we.size.x,we.size.y),Z.addGlyph(we),Z.version=++rc.nextVersion,we}_findGlyphBoundingBox(t,r,n,a,l,c){r.top=0;let h=a?this._config.deviceCellHeight:this._tmpCanvas.height,p=a?this._config.deviceCellWidth:n,g=!1;for(let x=0;x<h;x++){for(let y=0;y<p;y++){let A=x*this._tmpCanvas.width*4+y*4+3;if(t.data[A]!==0){r.top=x,g=!0;break}}if(g)break}r.left=0,g=!1;for(let x=0;x<c+p;x++){for(let y=0;y<h;y++){let A=y*this._tmpCanvas.width*4+x*4+3;if(t.data[A]!==0){r.left=x,g=!0;break}}if(g)break}r.right=p,g=!1;for(let x=c+p-1;x>=c;x--){for(let y=0;y<h;y++){let A=y*this._tmpCanvas.width*4+x*4+3;if(t.data[A]!==0){r.right=x,g=!0;break}}if(g)break}r.bottom=h,g=!1;for(let x=h-1;x>=0;x--){for(let y=0;y<p;y++){let A=x*this._tmpCanvas.width*4+y*4+3;if(t.data[A]!==0){r.bottom=x,g=!0;break}}if(g)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+c+(a||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(a||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},qb=class em{constructor(t,r,n){if(this._usedPixels=0,this._glyphs=[],this.version=++em.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=Yb(t,r,r),this.ctx=Ms(this.canvas.getContext("2d",{alpha:!0})),n)if(n.length===4)this._glyphs=this._glyphs.concat(n[0].glyphs,n[1].glyphs,n[2].glyphs,n[3].glyphs),this._usedPixels=n[0]._usedPixels+n[1]._usedPixels+n[2]._usedPixels+n[3]._usedPixels;else for(let a=0;a<n.length;++a)this._glyphs=this._glyphs.concat(n[a].glyphs),this._usedPixels+=n[a]._usedPixels}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version=++em.nextVersion}};qb.nextVersion=0;var rc=qb;function Bf(e,t,r,n){let a=t.rgba>>>24,l=t.rgba>>>16&255,c=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,g=r.rgba>>>8&255,x=Math.floor((Math.abs(a-h)+Math.abs(l-p)+Math.abs(c-g))/12),y=!0;for(let A=0;A<e.data.length;A+=4)e.data[A]===a&&e.data[A+1]===l&&e.data[A+2]===c||n&&Math.abs(e.data[A]-a)+Math.abs(e.data[A+1]-l)+Math.abs(e.data[A+2]-c)<x?e.data[A+3]=0:y=!1;return y}function _C(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function Yb(e,t,r){let n=e.createElement("canvas");return n.width=t,n.height=r,n}function LC(e,t,r,n,a,l,c,h,p=!0){let g={foreground:l.foreground,background:l.background,cursor:so,cursorAccent:so,selectionForeground:so,selectionBackgroundTransparent:so,selectionBackgroundOpaque:so,selectionInactiveBackgroundTransparent:so,selectionInactiveBackgroundOpaque:so,overviewRulerBorder:so,scrollbarSliderBackground:so,scrollbarSliderHoverBackground:so,scrollbarSliderActiveBackground:so,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:p,devicePixelRatio:c,deviceMaxTextureSize:h,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:n,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:g}}function Ig(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.deviceMaxTextureSize===t.deviceMaxTextureSize&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCellWidth===t.deviceCellWidth&&e.deviceCellHeight===t.deviceCellHeight&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function kC(e){return(e&50331648)===16777216||(e&50331648)===33554432}var oo=[];function Zb(e,t,r,n,a,l,c,h,p,g=!0){let x=LC(n,a,l,c,t,r,h,p,g);for(let k=0;k<oo.length;k++){let E=oo[k],I=E.ownedBy.indexOf(e);if(I>=0){if(Ig(E.config,x))return E.atlas;E.ownedBy.length===1?(E.atlas.dispose(),oo.splice(k,1)):E.ownedBy.splice(I,1);break}}for(let k=0;k<oo.length;k++){let E=oo[k];if(Ig(E.config,x))return E.ownedBy.push(e),E.atlas}let y=e._core,A=y._logService,w={atlas:new Pl(document,x,y.unicodeService,A),config:x,ownedBy:[e]};return oo.push(w),w.atlas}function Eg(e){for(let t=0;t<oo.length;t++){let r=oo[t].ownedBy.indexOf(e);if(r!==-1){oo[t].ownedBy.length===1?(oo[t].atlas.dispose(),oo.splice(t,1)):oo[t].ownedBy.splice(r,1);break}}}var IC=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._isIdlePaused=!1,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&(this._restartInterval(),this._resetIdleTimer())}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}restartBlinkAnimation(){this._isIdlePaused&&this._resetIdleTimer(),!this.isPaused&&(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},e)}pause(){this.isCursorVisible=!0,this._isIdlePaused=!1,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this._resetIdleTimer(),this.restartBlinkAnimation()}_resetIdleTimer(){this._isIdlePaused=!1,this._idleTimeout&&this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_stopBlinkingDueToIdle(){this.isCursorVisible=!0,this._isIdlePaused=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0,this._renderCallback()}};function Ng(e,t,r){let n=new t.ResizeObserver(a=>{let l=a.find(p=>p.target===e);if(!l)return;if(!("devicePixelContentBoxSize"in l)){n?.disconnect(),n=void 0;return}let c=l.devicePixelContentBoxSize[0].inlineSize,h=l.devicePixelContentBoxSize[0].blockSize;c>0&&h>0&&r(c,h)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Ps(()=>n?.disconnect())}function EC(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var NC=class Kb extends Zc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gb,this.combinedData=""}static fromCharData(t){let r=new Kb;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?EC(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(t){if(this.getFgColorMode()!==t.getFgColorMode()||this.getFgColor()!==t.getFgColor()||this.getBgColorMode()!==t.getBgColorMode()||this.getBgColor()!==t.getBgColor()||this.isInverse()!==t.isInverse()||this.isBold()!==t.isBold()||this.isUnderline()!==t.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=this.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();if(!(r&&n)&&(r!==n||this.getUnderlineColor()!==t.getUnderlineColor()||this.getUnderlineColorMode()!==t.getUnderlineColorMode()))return!1}return!(this.isOverline()!==t.isOverline()||this.isBlink()!==t.isBlink()||this.isInvisible()!==t.isInvisible()||this.isItalic()!==t.isItalic()||this.isDim()!==t.isDim()||this.isStrikethrough()!==t.isStrikethrough())}},RC=class extends Tc{constructor(e,t,r){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=r,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",n=>{this.setIntervalDuration(n)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Ps(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(this._interval!==void 0)return;let e=this._blinkOn;this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),e||this._renderCallback();return}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){this._interval!==void 0&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},Xb=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Jb(e,t,r,n){let a=Ms(e.createProgram());if(e.attachShader(a,Ms(Rg(e,e.VERTEX_SHADER,t,n))),e.attachShader(a,Ms(Rg(e,e.FRAGMENT_SHADER,r,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;n.error(e.getProgramInfoLog(a)),e.deleteProgram(a)}function Rg(e,t,r,n){let a=Ms(e.createShader(t));if(e.shaderSource(a,r),e.compileShader(a),e.getShaderParameter(a,e.COMPILE_STATUS))return a;n.error(e.getShaderInfoLog(a)),e.deleteShader(a)}function MC(e,t){let r=Math.min(e.length*2,t),n=new Float32Array(r);for(let a=0;a<e.length;a++)n[a]=e[a];return n}var DC=class{constructor(t){this.texture=t,this.version=-1}},jC=`#version 300 es
4
+ layout (location = 0) in vec2 a_unitquad;
5
+ layout (location = 1) in vec2 a_cellpos;
6
+ layout (location = 2) in vec2 a_offset;
7
+ layout (location = 3) in vec2 a_size;
8
+ layout (location = 4) in float a_texpage;
9
+ layout (location = 5) in vec2 a_texcoord;
10
+ layout (location = 6) in vec2 a_texsize;
11
+
12
+ uniform mat4 u_projection;
13
+ uniform vec2 u_resolution;
14
+
15
+ out vec2 v_texcoord;
16
+ flat out int v_texpage;
17
+
18
+ void main() {
19
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
20
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
21
+ v_texpage = int(a_texpage);
22
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
23
+ }`;function BC(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
24
+ precision lowp float;
25
+
26
+ in vec2 v_texcoord;
27
+ flat in int v_texpage;
28
+
29
+ uniform sampler2D u_texture[${e}];
30
+
31
+ out vec4 outColor;
32
+
33
+ void main() {
34
+ if (v_texpage == 0) {
35
+ outColor = texture(u_texture[0], v_texcoord);
36
+ } ${t}
37
+ }`}var ys=0,os,Qf=0,F0=0,QC=class extends Tc{constructor(t,r,n,a,l){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._optionsService=a,this._logService=l,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let c=this._gl;Pl.maxAtlasPages===void 0&&(Pl.maxAtlasPages=Math.min(32,Ms(c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS))),Pl.maxTextureSize=Ms(c.getParameter(c.MAX_TEXTURE_SIZE))),this._program=Ms(Jb(c,jC,BC(Pl.maxAtlasPages),this._logService)),this._register(Ps(()=>c.deleteProgram(this._program))),this._projectionLocation=Ms(c.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ms(c.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ms(c.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=c.createVertexArray();this._register(Ps(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(g))),c.bindBuffer(c.ARRAY_BUFFER,g),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),y=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(y))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ms(c.createBuffer()),this._register(Ps(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,2,c.FLOAT,!1,44,0),c.vertexAttribDivisor(2,1),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,c.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(3,1),c.enableVertexAttribArray(4),c.vertexAttribPointer(4,1,c.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(4,1),c.enableVertexAttribArray(5),c.vertexAttribPointer(5,2,c.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(5,1),c.enableVertexAttribArray(6),c.vertexAttribPointer(6,2,c.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(6,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.useProgram(this._program);let A=new Int32Array(Pl.maxAtlasPages);for(let w=0;w<Pl.maxAtlasPages;w++)A[w]=w;c.uniform1iv(this._textureLocation,A),c.uniformMatrix4fv(this._projectionLocation,!1,Xb),this._atlasTextures=[];for(let w=0;w<Pl.maxAtlasPages;w++){let k=new DC(Ms(c.createTexture()));this._register(Ps(()=>c.deleteTexture(k.texture))),c.activeTexture(c.TEXTURE0+w),c.bindTexture(c.TEXTURE_2D,k.texture),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[w]=k}c.enable(c.BLEND),c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,n,a,l,c,h,p,g){this._updateCell(this._vertices.attributes,t,r,n,a,l,c,h,p,g)}_updateCell(t,r,n,a,l,c,h,p,g,x){if(ys=(n*this._terminal.cols+r)*11,a===0||a===void 0){t.fill(0,ys,ys+11-1-2);return}this._atlas&&(p&&p.length>1?os=this._atlas.getRasterizedGlyphCombinedChar(p,l,c,h,!1,this._terminal.element):os=this._atlas.getRasterizedGlyph(a,l,c,h,!1,this._terminal.element),Qf=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==x&&os.offset.x>Qf?(F0=os.offset.x-Qf,t[ys]=-(os.offset.x-F0)+this._dimensions.device.char.left,t[ys+1]=-os.offset.y+this._dimensions.device.char.top,t[ys+2]=(os.size.x-F0)/this._dimensions.device.canvas.width,t[ys+3]=os.size.y/this._dimensions.device.canvas.height,t[ys+4]=os.texturePage,t[ys+5]=os.texturePositionClipSpace.x+F0/this._atlas.pages[os.texturePage].canvas.width,t[ys+6]=os.texturePositionClipSpace.y,t[ys+7]=os.sizeClipSpace.x-F0/this._atlas.pages[os.texturePage].canvas.width,t[ys+8]=os.sizeClipSpace.y):(t[ys]=-os.offset.x+this._dimensions.device.char.left,t[ys+1]=-os.offset.y+this._dimensions.device.char.top,t[ys+2]=os.size.x/this._dimensions.device.canvas.width,t[ys+3]=os.size.y/this._dimensions.device.canvas.height,t[ys+4]=os.texturePage,t[ys+5]=os.texturePositionClipSpace.x,t[ys+6]=os.texturePositionClipSpace.y,t[ys+7]=os.sizeClipSpace.x,t[ys+8]=os.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&iC(a,g,os.size.x,this._dimensions.device.cell.width)&&(t[ys+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*11;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count!==r?this._vertices.attributesBuffers[n]=new Float32Array(r):this._vertices.attributesBuffers[n].fill(0);this._vertices.count=r,n=0;for(let a=0;a<t.rows;a++)for(let l=0;l<t.cols;l++)this._vertices.attributes[n+9]=l/t.cols,this._vertices.attributes[n+10]=a/t.rows,n+=11}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),t.uniform2f(this._resolutionLocation,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],a=0;for(let l=0;l<t.lineLengths.length;l++){let c=l*this._terminal.cols*11,h=this._vertices.attributes.subarray(c,c+t.lineLengths[l]*11);n.set(h,a),a+=h.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,n.subarray(0,a),r.STREAM_DRAW);for(let l=0;l<this._atlas.pages.length;l++)this._atlas.pages[l].version!==this._atlasTextures[l].version&&this._bindAtlasPageTexture(r,this._atlas,l);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,a/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,n){t.activeTexture(t.TEXTURE0+n),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[n].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[n].canvas),this._atlasTextures[n].version=r.pages[n].version}setDimensions(t){this._dimensions=t}},PC=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,n,a=!1){if(this.selectionStart=r,this.selectionEnd=n,!r||!n||r[0]===n[0]&&r[1]===n[1]){this.clear();return}let l=t.buffers.active.ydisp,c=r[1]-l,h=n[1]-l,p=Math.max(c,0),g=Math.min(h,t.rows-1);if(p>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,this.startCol=r[0],this.endCol=n[0]}isCellSelected(t,r,n){return this.hasSelection?(n-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&n>=this.viewportCappedStartRow&&r<this.endCol&&n<=this.viewportCappedEndRow:r<this.startCol&&n>=this.viewportCappedStartRow&&r>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol):!1}};function OC(){return new PC}var FC=2147483648,$C=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=OC()}resize(t,r){let n=t*r*4;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},UC=`#version 300 es
38
+ layout (location = 0) in vec2 a_position;
39
+ layout (location = 1) in vec2 a_size;
40
+ layout (location = 2) in vec4 a_color;
41
+ layout (location = 3) in vec2 a_unitquad;
42
+
43
+ uniform mat4 u_projection;
44
+
45
+ out vec4 v_color;
46
+
47
+ void main() {
48
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
49
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
50
+ v_color = a_color;
51
+ }`,zC=`#version 300 es
52
+ precision lowp float;
53
+
54
+ in vec4 v_color;
55
+
56
+ out vec4 outColor;
57
+
58
+ void main() {
59
+ outColor = v_color;
60
+ }`,Yo=8,Pf=Yo*Float32Array.BYTES_PER_ELEMENT,HC=20*Yo,Mg=class{constructor(){this.attributes=new Float32Array(HC),this.count=0}},cl=0,Dg=0,jg=0,Bg=0,Qg=0,Pg=0,Og=0,WC=class extends Tc{constructor(t,r,n,a,l){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._themeService=a,this._logService=l,this._vertices=new Mg,this._verticesCursor=new Mg;let c=this._gl;this._program=Ms(Jb(c,UC,zC,this._logService)),this._register(Ps(()=>c.deleteProgram(this._program))),this._projectionLocation=Ms(c.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=c.createVertexArray();this._register(Ps(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(g))),c.bindBuffer(c.ARRAY_BUFFER,g),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),y=c.createBuffer();this._register(Ps(()=>c.deleteBuffer(y))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ms(c.createBuffer()),this._register(Ps(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,Pf,0),c.vertexAttribDivisor(0,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Pf,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,Pf,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this._register(this._themeService.onChangeColors(A=>{this._updateCachedColors(A),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,Xb),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let r=this._terminal,n=this._vertices,a=1,l,c,h,p,g,x,y,A,w,k,E;for(l=0;l<r.rows;l++){for(h=-1,p=0,g=0,x=!1,c=0;c<r.cols;c++)y=(l*r.cols+c)*4,A=t.cells[y+1],w=t.cells[y+2],k=!!(w&67108864),(A!==p||w!==g&&(x||k))&&((p!==0||x&&g!==0)&&(E=a++*Yo,this._updateRectangle(n,E,g,p,h,c,l)),h=c,p=A,g=w,x=k);(p!==0||x&&g!==0)&&(E=a++*Yo,this._updateRectangle(n,E,g,p,h,r.cols,l))}n.count=a}updateCursor(t){let r=this._verticesCursor,n=t.cursor;if(!n||n.style==="block"){r.count=0;return}let a,l=0;(n.style==="bar"||n.style==="outline")&&(a=l++*Yo,this._addRectangleFloat(r.attributes,a,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(a=l++*Yo,this._addRectangleFloat(r.attributes,a,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(a=l++*Yo,this._addRectangleFloat(r.attributes,a,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),a=l++*Yo,this._addRectangleFloat(r.attributes,a,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=l}_updateRectangle(t,r,n,a,l,c,h){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:cl=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:cl=(n&16777215)<<8;break;default:cl=this._themeService.colors.foreground.rgba}else switch(a&50331648){case 16777216:case 33554432:cl=this._themeService.colors.ansi[a&255].rgba;break;case 50331648:cl=(a&16777215)<<8;break;default:cl=this._themeService.colors.background.rgba}t.attributes.length<r+Yo&&(t.attributes=MC(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Yo)),Dg=l*this._dimensions.device.cell.width,jg=h*this._dimensions.device.cell.height,Bg=(cl>>24&255)/255,Qg=(cl>>16&255)/255,Pg=(cl>>8&255)/255,Og=1,this._addRectangle(t.attributes,r,Dg,jg,(c-l)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Bg,Qg,Pg,Og)}_addRectangle(t,r,n,a,l,c,h,p,g,x){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=a/this._dimensions.device.canvas.height,t[r+2]=l/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h,t[r+5]=p,t[r+6]=g,t[r+7]=x}_addRectangleFloat(t,r,n,a,l,c,h){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=a/this._dimensions.device.canvas.height,t[r+2]=l/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h[0],t[r+5]=h[1],t[r+6]=h[2],t[r+7]=h[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},GC=class extends Tc{constructor(e,t,r,n,a,l,c,h){super(),this._container=t,this._alpha=a,this._coreBrowserService=l,this._optionsService=c,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(Ps(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ms(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,n=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Zb(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,n){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,n){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=$b,this._clipCell(r,n,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let n=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${n} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},VC=class extends GC{constructor(t,r,n,a,l,c,h){super(n,t,"link",r,!0,l,c,h),this._register(a.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(a.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&kC(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},qC=class{constructor(t,r,n,a){this._node=t,this._type=r,this._handler=n,this._options=a,t.addEventListener(r,n,a)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Of(e,t,r,n){return new qC(e,t,r,n)}var YC=class extends Tc{constructor(e,t,r,n,a,l,c,h,p,g=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._logService=c,this._optionsService=h,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new B0),this._charAtlasDisposable=this._register(new B0),this._observerDisposable=this._register(new B0),this._model=new $C,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new NC,this._rectangleRenderer=this._register(new B0),this._glyphRenderer=this._register(new B0),this._onChangeTextureAtlas=this._register(new Eo),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Eo),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Eo),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Eo),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Eo),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let y={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",y),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new uC(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new VC(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=aC(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new RC(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Of(this._canvas,"webglcontextlost",A=>{this._logService.debug("webglcontextlost event received"),A.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(A)},3e3)})),this._register(Of(this._canvas,"webglcontextrestored",A=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Eg(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Ng(this._canvas,this._coreBrowserService.window,(A,w)=>this._setCanvasDevicePixelDimensions(A,w)),this._register(this._coreBrowserService.onWindowChange(A=>{this._observerDisposable.value=Ng(this._canvas,A,(w,k)=>this._setCanvasDevicePixelDimensions(w,k))})),this._register(Of(this._coreBrowserService.mainDocument,"mousedown",()=>this._cursorBlinkStateManager.value?.restartBlinkAnimation())),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ps(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let A of this._renderLayers)A.dispose();this._canvas.parentElement?.removeChild(this._canvas),Eg(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._resetBlinkingRowState();for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1),this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0})}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,r){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new WC(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new QC(this._terminal,this._gl,this.dimensions,this._optionsService,this._logService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Zb(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize,this._customGlyphs);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=YT(dc.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),dc.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._resetBlinkingRowState(),this._textBlinkStateManager.setNeedsBlinkInViewport(!1),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let a of this._renderLayers)a.handleGridChanged(this._terminal,e,t);if(!this._glyphRenderer.value||!this._rectangleRenderer.value)return;this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t);let r=!1,n=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&n++<32;)r=!0,this._clearModel(!0),this._updateModel(0,this._terminal.rows-1);r&&this._glyphRenderer.value.invalidateAtlasTextures(),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor()}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new IC(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,n=this._workCell,a,l,c,h,p,g,x,y,A,w,k,E,I,M,B,F,U;e=Fg(e,r.rows-1,0),t=Fg(t,r.rows-1,0);let G=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",Q=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,X=Q-r.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),ze=-1,he=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let de=!1;for(l=e;l<=t;l++){c=l+r.buffer.ydisp;let $e=r.buffer.lines.get(c);if(!$e){for(this._model.lineLengths[l]=0,F=0;F<r.cols;F++)U=(l*r.cols+F)*4,de=!0,this._nullModelCell(F,l,U,0,0,0);this._setRowBlinkState(l,!1);continue}h=$e;let qe=!1;for(this._model.lineLengths[l]=0,k=Q===c,x=0,p=this._characterJoinerService.getJoinedCharacters(c),F=0;F<r.cols;F++){if(a=this._cellColorResolver.result.bg,h.loadCell(F,n),F===0&&(a=this._cellColorResolver.result.bg),g=!1,y=F>=x,A=F,p.length>0&&F===p[0][0]&&y){w=p.shift();let oe=this._model.selection.isCellSelected(this._terminal,w[0],c);for(B=w[0]+1;B<w[1];B++)y&&=oe===this._model.selection.isCellSelected(this._terminal,B,c);y&&=!k||ee<w[0]||ee>=w[1],y?(g=!0,n=new ZC(n,h.translateToString(!0,w[0],w[1]),w[1]-w[0]),A=w[1]-1):x=w[1]}if(E=n.getChars(),I=n.getCode(),B=(l*r.cols+F)*4,!qe&&n.isBlink()&&(qe=!0),this._cellColorResolver.resolve(n,F,c,this.dimensions.device.cell.width,this.dimensions.device.cell.height),he&&c===Q&&(F===ee&&(this._model.cursor={x:ee,y:X,width:n.getWidth(),style:this._coreBrowserService.isFocused?G:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},ze=ee+n.getWidth()-1),F>=ee&&F<=ze&&(this._coreBrowserService.isFocused&&G==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),this._textBlinkStateManager.isEnabled&&!this._textBlinkStateManager.isBlinkOn&&n.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),I!==0&&(this._model.lineLengths[l]=F+1),!(this._model.cells[B]===I&&this._model.cells[B+1]===this._cellColorResolver.result.bg&&this._model.cells[B+2]===this._cellColorResolver.result.fg&&this._model.cells[B+3]===this._cellColorResolver.result.ext)&&(de=!0,E.length>1&&(I|=FC),this._model.cells[B]=I,this._model.cells[B+1]=this._cellColorResolver.result.bg,this._model.cells[B+2]=this._cellColorResolver.result.fg,this._model.cells[B+3]=this._cellColorResolver.result.ext,M=n.getWidth(),this._glyphRenderer.value.updateCell(F,l,I,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,M,a),g)){for(n=this._workCell,F++;F<=A;F++)U=(l*r.cols+F)*4,this._nullModelCell(F,l,U,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);F--}}this._setRowBlinkState(l,qe)}de&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,n,a,l){this._glyphRenderer.value.updateCell(e,t,0,n,a,l,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=n,this._model.cells[r+2]=a,this._model.cells[r+3]=l}_resetBlinkingRowState(){this._rowHasBlinkingCells=new Array(this._terminal.rows).fill(!1),this._rowHasBlinkingCellsCount=0}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0}))}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},ZC=class extends Zc{constructor(t,r,n){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Fg(e,t,r=0){return Math.max(Math.min(e,t),r)}var KC=class extends Tc{constructor(e){if(Ob&&JT()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("WebGL2 is only supported on Safari 16 and above")}super(),this._onChangeTextureAtlas=this._register(new Eo),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Eo),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Eo),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Eo),this.onContextLoss=this._onContextLoss.event,this._customGlyphs=e?.customGlyphs??!0,this._preserveDrawingBuffer=e?.preserveDrawingBuffer}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,n=t.optionsService,a=t,l=a._renderService,c=a._characterJoinerService,h=a._charSizeService,p=a._coreBrowserService,g=a._decorationService,x=a._logService,y=a._themeService;this._renderer=this._register(new YC(e,c,h,p,r,g,x,n,y,this._customGlyphs,this._preserveDrawingBuffer)),this._register(dc.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(dc.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(dc.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(dc.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(Ps(()=>{if(this._terminal._core._store._isDisposed)return;let A=this._terminal._core._renderService;A.setRenderer(this._terminal._core._createRenderer()),A.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var XC=class{constructor(t,r,n,a={}){this._terminal=t,this._regex=r,this._handler=n,this._options=a}provideLinks(t,r){let n=eS.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(n))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(n,a)=>{if(this._options.hover){let{range:l}=r;this._options.hover(n,a,l)}},r))}};function JC(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var eS=class ah{static computeLink(t,r,n,a){let l=r.flags.includes("g")?r.flags:`${r.flags}g`,c=new RegExp(r.source,l),[h,p]=ah._getWindowedLineStrings(t-1,n),g=h.join(""),x,y=[];for(;x=c.exec(g);){let A=x[0];if(!JC(A))continue;let[w,k]=ah._mapStrIdx(n,p,0,x.index),[E,I]=ah._mapStrIdx(n,w,k,A.length);if(w===-1||k===-1||E===-1||I===-1)continue;let M={start:{x:k+1,y:w+1},end:{x:I,y:E+1}};y.push({range:M,text:A,activate:a})}return y}static _getWindowedLineStrings(t,r){let n,a=t,l=t,c,h,p=[];if(n=r.buffer.active.getLine(t)){let g=n.translateToString(!0);if(n.isWrapped&&g[0]!==" "){for(c=0;(n=r.buffer.active.getLine(--a))&&c<2048&&(h=n.translateToString(!0),c+=h.length,p.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),c=0;(n=r.buffer.active.getLine(++l))&&n.isWrapped&&c<2048&&(h=n.translateToString(!0),c+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,a]}static _mapStrIdx(t,r,n,a){let l=t.buffer.active,c=l.getNullCell(),h=n;for(;a;){let p=l.getLine(r);if(!p)return[-1,-1];for(let g=h;g<p.length;++g){p.getCell(g,c);let x=c.getChars();if(c.getWidth()&&(a-=x.length||1,g===p.length-1&&x==="")){let y=l.getLine(r+1);y&&y.isWrapped&&(y.getCell(0,c),c.getWidth()===2&&(a+=1))}if(a<0)return[r,g]}r++,h=0}return[r,h]}},tS=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function rS(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var nS=class{constructor(t=rS,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,n=r.urlRegex??tS;this._linkProvider=this._terminal.registerLinkProvider(new XC(this._terminal,n,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function $g(e){return{dispose:e}}var sS=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},iS=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return $g(()=>{});let a={fn:t,thisArgs:r};this._listeners.push(a);let l=$g(()=>{let c=this._listeners.indexOf(a);c!==-1&&this._listeners.splice(c,1)});return n&&(Array.isArray(n)?n.push(l):n.add(l)),l},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:a}of r)n.call(a,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},aS;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new sS;for(let x of l)g.add(x(y=>c.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(aS||={});var Ug=class oh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new iS,this.onChange=this._onChange.event}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t,this._active||(this.activeVersion=t.version)}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,a=t.length;for(let l=0;l<a;++l){let c=t.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=a)return r+this.wcwidth(c);let g=t.charCodeAt(l);56320<=g&&g<=57343?c=(c-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let h=this.charProperties(c,n),p=oh.extractWidth(h);oh.extractShouldJoin(h)&&(p-=oh.extractWidth(n)),r+=p,n=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Ff=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],oS=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],$f=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],lS=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],ul;function zg(e,t){let r=0,n=t.length-1,a;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(a=r+n>>1,e>t[a][1])r=a+1;else if(e<t[a][0])n=a-1;else return!0;return!1}var cS=class{constructor(){if(this.version="11",!ul){ul=new Uint8Array(65536),ul.fill(1),ul[0]=0,ul.fill(0,1,32),ul.fill(0,127,160);for(let e=0;e<Ff.length;++e)ul.fill(0,Ff[e][0],Ff[e][1]+1);for(let e=0;e<$f.length;++e)ul.fill(2,$f[e][0],$f[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ul[e]:zg(e,oS)?0:zg(e,lS)?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let a=Ug.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return Ug.createPropertyValue(0,r,n)}},uS=class{activate(e){e.unicode.register(new cS)}dispose(){}};function wc(e){return{dispose:e}}function lh(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function dS(...e){return wc(()=>lh(e))}var e3=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(t){return this._isDisposed?t.dispose():this._disposables.add(t),t}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let t of this._disposables)t.dispose();this._disposables.clear()}}clear(){for(let t of this._disposables)t.dispose();this._disposables.clear()}},ed=class{constructor(){this._store=new e3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};ed.None=Object.freeze({dispose(){}});var Lh=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},tm=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return wc(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let a=wc(()=>{let l=this._listeners.indexOf(n);l!==-1&&this._listeners.splice(l,1)});return r&&(Array.isArray(r)?r.push(a):r.add(a)),a},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},hS;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new e3;for(let x of l)g.add(x(y=>c.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(hS||={});function t3(e,t=0,r){let n=setTimeout(()=>{e()},t);return wc(()=>{clearTimeout(n)})}var fS=class extends ed{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Lh),this._linesCacheDisposables=this._register(new Lh),this._lastAccessTimestamp=0,this._register(wc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=dS(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._lastAccessTimestamp=Date.now(),this._linesCacheTimeout.value||this._scheduleLinesCacheTimeout(15e3)}_destroyLinesCache(){this._linesCache=void 0,this._lastAccessTimestamp=0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}_scheduleLinesCacheTimeout(e){this._linesCacheTimeout.value=t3(()=>{if(!this._linesCache)return;let t=Date.now()-this._lastAccessTimestamp;if(t>=15e3){this._destroyLinesCache();return}this._scheduleLinesCacheTimeout(15e3-t)},e)}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],n=[0],a=this._terminal.buffer.active.getLine(e);for(;a;){let l=this._terminal.buffer.active.getLine(e+1),c=l?l.isWrapped:!1,h=a.translateToString(!c&&t);if(c&&l){let p=a.getCell(a.length-1);p&&p.getCode()===0&&p.getWidth()===1&&l.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),c)n.push(n[n.length-1]+h.length);else break;e++,a=l}return[r.join(""),n]}},pS=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(t){this._cachedSearchTerm=t}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(t){this._lastSearchOptions=t}isValidSearchTerm(t){return!!(t&&t.length>0)}didOptionsChange(t){return this._lastSearchOptions?t?this._lastSearchOptions.caseSensitive!==t.caseSensitive||this._lastSearchOptions.regex!==t.regex||this._lastSearchOptions.wholeWord!==t.wholeWord:!1:!0}shouldUpdateHighlighting(t,r){return r?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(r):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},mS=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,n,a){if(!t||t.length===0){this._terminal.clearSelection();return}if(n>=this._terminal.cols)throw new Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let l={startRow:r,startCol:n},c=this._findInLine(t,l,a);if(!c)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=h,l.startCol=0,c=this._findInLine(t,l,a),!c);h++);return c}findNextWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,c=0;a&&(n===t?(l=a.end.x,c=a.end.y):(l=a.start.x,c=a.start.y)),this._lineCache.initLinesCache();let h={startRow:c,startCol:l},p=this._findInLine(t,h,r);if(!p)for(let g=c+1;g<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);if(!p&&c!==0)for(let g=0;g<c&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);return!p&&a&&(h.startRow=a.start.y,h.startCol=0,p=this._findInLine(t,h,r)),p}findPreviousWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=this._terminal.buffer.active.baseY+this._terminal.rows-1,c=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:l,startCol:c},g;if(a&&(p.startRow=l=a.start.y,p.startCol=a.start.x,n!==t&&(g=this._findInLine(t,p,r,!1),g||(p.startRow=l=a.end.y,p.startCol=a.end.x))),g??=this._findInLine(t,p,r,h),!g){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=l-1;x>=0&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);}if(!g&&l!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=l&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);return g}_isWholeWord(t,r,n){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+n.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+n.length]))}_findInLine(t,r,n={},a=!1){let l=r.startRow,c=r.startCol;if(this._terminal.buffer.active.getLine(l)?.isWrapped){if(a){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,n)}let h=this._lineCache.getLineFromCache(l);h||(h=this._lineCache.translateBufferLineToStringWithWrap(l,!0),this._lineCache.setLineInCache(l,h));let[p,g]=h,x=this._bufferColsToStringOffset(l,c),y=t,A=p;n.regex||(y=n.caseSensitive?t:t.toLowerCase(),A=n.caseSensitive?p:p.toLowerCase());let w=-1;if(n.regex){let k=RegExp(y,n.caseSensitive?"g":"gi"),E;if(a)for(;E=k.exec(A.slice(0,x));)w=k.lastIndex-E[0].length,t=E[0],k.lastIndex-=t.length-1;else E=k.exec(A.slice(x)),E&&E[0].length>0&&(w=x+(k.lastIndex-E[0].length),t=E[0])}else a?x-y.length>=0&&(w=A.lastIndexOf(y,x-y.length)):w=A.indexOf(y,x);if(w>=0){if(n.wholeWord&&!this._isWholeWord(w,A,t))return;let k=0;for(;k<g.length-1&&w>=g[k+1];)k++;let E=k;for(;E<g.length-1&&w+t.length>=g[E+1];)E++;let I=w-g[k],M=w+t.length-g[E],B=this._stringLengthToBufferSize(l+k,I),F=this._stringLengthToBufferSize(l+E,M)-B+this._terminal.cols*(E-k);return{term:t,col:B,row:l+k,size:F}}}_stringLengthToBufferSize(t,r){let n=this._terminal.buffer.active.getLine(t);if(!n)return 0;for(let a=0;a<r;a++){let l=n.getCell(a);if(!l)break;let c=l.getChars();c.length>1&&(r-=c.length-1);let h=n.getCell(a+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let n=t,a=0,l=this._terminal.buffer.active.getLine(n);for(;r>0&&l;){for(let c=0;c<r&&c<this._terminal.cols;c++){let h=l.getCell(c);if(!h)break;h.getWidth()&&(a+=h.getCode()===0?1:h.getChars().length)}if(n++,l=this._terminal.buffer.active.getLine(n),l&&!l.isWrapped)break;r-=this._terminal.cols}return a}},gS=class extends ed{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(wc(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let n of t){let a=this._createResultDecorations(n,r,!1);if(a)for(let l of a)this._storeDecoration(l,n)}}createActiveDecoration(t,r){let n=this._createResultDecorations(t,r,!0);if(n)return{decorations:n,match:t,dispose(){lh(n)}}}clearHighlightDecorations(){lh(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,r){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:r,dispose(){t.dispose()}})}_applyStyles(t,r,n){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),n&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,n){let a=[],l=t.col,c=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;c>0;){let g=Math.min(this._terminal.cols-l,c);a.push([h,l,g]),l=0,c-=g,h++}let p=[];for(let g of a){let x=this._terminal.registerMarker(g[0]),y=this._terminal.registerDecoration({marker:x,x:g[1],width:g[2],layer:n?"top":"bottom",backgroundColor:n?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:n?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(y){let A=[];A.push(x),A.push(y.onRender(w=>this._applyStyles(w,n?r.activeMatchBorder:r.matchBorder,!1))),A.push(y.onDispose(()=>lh(A))),p.push(y)}}return p.length===0?void 0:p}},xS=class extends ed{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new tm)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,r){this._searchResults=t.slice(0,r)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let r=0;r<this._searchResults.length;r++){let n=this._searchResults[r];if(n.row===t.row&&n.col===t.col&&n.size===t.size)return r}return-1}fireResultsChanged(t){if(!t)return;let r=-1;this._selectedDecoration&&(r=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:r,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},bS=class extends ed{constructor(t){super(),this._highlightTimeout=this._register(new Lh),this._lineCache=this._register(new Lh),this._state=new pS,this._resultTracker=this._register(new xS),this._onAfterSearch=this._register(new tm),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new tm),this.onBeforeSearch=this._onBeforeSearch.event,this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new fS(t),this._engine=new mS(t,this._lineCache.value),this._decorationManager=new gS(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(wc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=t3(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let a=this._findNextAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),a}_highlightAllMatches(t,r){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],a,l=this._engine.find(t,0,0,r);for(;l&&(a?.row!==l.row||a?.col!==l.col)&&!(n.length>=this._highlightLimit);){a=l,n.push(a);let c=this._terminal.cols,h=a.col+a.size,p=a.row;h>=c&&(p+=Math.floor(h/c),h=h%c),l=this._engine.find(t,p,h,r)}this._resultTracker.updateResults(n,this._highlightLimit),r.decorations&&this._decorationManager.createHighlightDecorations(n,r.decorations)}_findNextAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let a=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(a,r?.decorations,n?.noScroll)}findPrevious(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let a=this._findPreviousAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),a}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let a=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(a,r?.decorations,n?.noScroll)}_selectResult(t,r,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),r){let a=this._decorationManager.createActiveDecoration(t,r);a&&(this._resultTracker.selectedDecoration=a)}if(!n&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let a=t.row-this._terminal.buffer.active.viewportY;a-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(a)}return!0}};var ei=0,ti=0,ri=0,ws=0,Ri;(e=>{function t(a,l,c,h){return h!==void 0?`#${nc(a)}${nc(l)}${nc(c)}${nc(h)}`:`#${nc(a)}${nc(l)}${nc(c)}`}e.toCss=t;function r(a,l,c,h=255){return(a<<24|l<<16|c<<8|h)>>>0}e.toRgba=r;function n(a,l,c,h){return{css:e.toCss(a,l,c,h),rgba:e.toRgba(a,l,c,h)}}e.toColor=n})(Ri||={});var yS;(e=>{function t(p,g){if(ws=(g.rgba&255)/255,ws===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,y=g.rgba>>16&255,A=g.rgba>>8&255,w=p.rgba>>24&255,k=p.rgba>>16&255,E=p.rgba>>8&255;ei=w+Math.round((x-w)*ws),ti=k+Math.round((y-k)*ws),ri=E+Math.round((A-E)*ws);let I=Ri.toCss(ei,ti,ri),M=Ri.toRgba(ei,ti,ri);return{css:I,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let y=ch.ensureContrastRatio(p.rgba,g.rgba,x);if(y)return Ri.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function a(p){let g=(p.rgba|255)>>>0;return[ei,ti,ri]=ch.toChannels(g),{css:Ri.toCss(ei,ti,ri),rgba:g}}e.opaque=a;function l(p,g){return ws=Math.round(g*255),[ei,ti,ri]=ch.toChannels(p.rgba),{css:Ri.toCss(ei,ti,ri,ws),rgba:Ri.toRgba(ei,ti,ri,ws)}}e.opacity=l;function c(p,g){return ws=p.rgba&255,l(p,ws*g/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(yS||={});var yi;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return ei=parseInt(a.slice(1,2).repeat(2),16),ti=parseInt(a.slice(2,3).repeat(2),16),ri=parseInt(a.slice(3,4).repeat(2),16),Ri.toColor(ei,ti,ri);case 5:return ei=parseInt(a.slice(1,2).repeat(2),16),ti=parseInt(a.slice(2,3).repeat(2),16),ri=parseInt(a.slice(3,4).repeat(2),16),ws=parseInt(a.slice(4,5).repeat(2),16),Ri.toColor(ei,ti,ri,ws);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return ei=parseInt(l[1],10),ti=parseInt(l[2],10),ri=parseInt(l[3],10),ws=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ri.toColor(ei,ti,ri,ws);if(a==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ei,ti,ri,ws]=t.getImageData(0,0,1,1).data,ws!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ri.toRgba(ei,ti,ri,ws),css:a}}e.toColor=n})(yi||={});var Vi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let c=n/255,h=a/255,p=l/255,g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+y*.0722}e.relativeLuminance2=r})(Vi||={});var ch;(e=>{function t(c,h){if(ws=(h&255)/255,ws===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,y=c>>24&255,A=c>>16&255,w=c>>8&255;return ei=y+Math.round((p-y)*ws),ti=A+Math.round((g-A)*ws),ri=w+Math.round((x-w)*ws),Ri.toRgba(ei,ti,ri)}e.blend=t;function r(c,h,p){let g=Vi.relativeLuminance(c>>8),x=Vi.relativeLuminance(h>>8);if(dl(g,x)<p){if(x<g){let w=n(c,h,p),k=dl(g,Vi.relativeLuminance(w>>8));if(k<p){let E=a(c,h,p),I=dl(g,Vi.relativeLuminance(E>>8));return k>I?w:E}return w}let y=a(c,h,p),A=dl(g,Vi.relativeLuminance(y>>8));if(A<p){let w=n(c,h,p),k=dl(g,Vi.relativeLuminance(w>>8));return A>k?y:w}return y}}e.ensureContrastRatio=r;function n(c,h,p){let g=c>>24&255,x=c>>16&255,y=c>>8&255,A=h>>24&255,w=h>>16&255,k=h>>8&255,E=dl(Vi.relativeLuminance2(A,w,k),Vi.relativeLuminance2(g,x,y));for(;E<p&&(A>0||w>0||k>0);)A-=Math.max(0,Math.ceil(A*.1)),w-=Math.max(0,Math.ceil(w*.1)),k-=Math.max(0,Math.ceil(k*.1)),E=dl(Vi.relativeLuminance2(A,w,k),Vi.relativeLuminance2(g,x,y));return(A<<24|w<<16|k<<8|255)>>>0}e.reduceLuminance=n;function a(c,h,p){let g=c>>24&255,x=c>>16&255,y=c>>8&255,A=h>>24&255,w=h>>16&255,k=h>>8&255,E=dl(Vi.relativeLuminance2(A,w,k),Vi.relativeLuminance2(g,x,y));for(;E<p&&(A<255||w<255||k<255);)A=Math.min(255,A+Math.ceil((255-A)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),E=dl(Vi.relativeLuminance2(A,w,k),Vi.relativeLuminance2(g,x,y));return(A<<24|w<<16|k<<8|255)>>>0}e.increaseLuminance=a;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(ch||={});function nc(e){let t=e.toString(16);return t.length<2?"0"+t:t}function dl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var vS=Object.freeze((()=>{let e=[yi.toColor("#2e3436"),yi.toColor("#cc0000"),yi.toColor("#4e9a06"),yi.toColor("#c4a000"),yi.toColor("#3465a4"),yi.toColor("#75507b"),yi.toColor("#06989a"),yi.toColor("#d3d7cf"),yi.toColor("#555753"),yi.toColor("#ef2929"),yi.toColor("#8ae234"),yi.toColor("#fce94f"),yi.toColor("#729fcf"),yi.toColor("#ad7fa8"),yi.toColor("#34e2e2"),yi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],a=t[r/6%6|0],l=t[r%6];e.push({css:Ri.toCss(n,a,l),rgba:Ri.toRgba(n,a,l)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Ri.toCss(n,n,n),rgba:Ri.toRgba(n,n,n)})}return e})());function Hg(e,t,r){return Math.max(t,Math.min(e,r))}function wS(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var r3=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),a=r,l=e.start.y,c=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(c-l,l,c);for(let g=l;g<=c;g++){let x=this._buffer.getLine(g);if(x){let y=g===e.start.y?h:0,A=g===e.end.y?p:x.length;for(let w=y;w<A;w++){let k=x.getCell(w,a===r?n:r);if(!k){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(k,a,g,w),a=k}}this._rowEnd(g,g===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,n){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function Gm(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Zo(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function n3(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=e.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();return r&&n?!0:r!==n?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function Vm(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&n3(e,t)&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}function s3(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):Gm(e,t)&&Zo(e,t)&&Vm(e,t)}var AS=class extends r3{constructor(t,r){super(t),this._terminal=r,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,r,n){this._allRows=new Array(t),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){this._nullCellCount>0&&!Zo(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let a=this._buffer.getLine(t),l=this._buffer.getLine(t+1);if(!l.isWrapped)n=`\r
61
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{n="";let c=a.getCell(a.length-1,this._thisRowLastChar),h=a.getCell(a.length-2,this._thisRowLastSecondChar),p=l.getCell(0,this._nextRowFirstChar),g=p.getWidth()>1,x=!1;(p.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Zo(c,p)&&(x=!0),g&&(h.getChars()||h.getWidth()===0)&&Zo(c,p)&&Zo(h,p)&&(x=!0)),x||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let n=[];if(s3(t,r))return n;let a=!Gm(t,r),l=!Zo(t,r),c=!Vm(t,r);if(a||l||c)if(t.isAttributeDefault())r.isAttributeDefault()||n.push(0);else{if(a){let h=t.getFgColor();t.isFgRGB()?n.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?n.push(38,5,h):n.push(h&8?90+(h&7):30+(h&7)):n.push(39)}if(l){let h=t.getBgColor();t.isBgRGB()?n.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?n.push(48,5,h):n.push(h&8?100+(h&7):40+(h&7)):n.push(49)}if(c){if(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),n3(t,r))t.isUnderline()!==r.isUnderline()&&n.push(t.isUnderline()?4:24);else{let h=t.getUnderlineStyle();if(h===0)n.push(24);else if(h===1&&t.isUnderlineColorDefault())n.push(4);else if(n.push("4:"+h),!t.isUnderlineColorDefault()){let p=t.getUnderlineColor();t.isUnderlineColorRGB()?n.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):n.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&n.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&n.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&n.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&n.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&n.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&n.push(t.isStrikethrough()?9:29)}}return n}_nextCell(t,r,n,a){if(t.getWidth()===0)return;let l=t.getChars()==="",c=this._diffStyle(t,this._cursorStyle);if(l?!Zo(this._cursorStyle,t):c.length>0){this._nullCellCount>0&&(Zo(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=a,this._currentRow+=`\x1B[${c.join(";")}m`;let h=this._buffer.getLine(n);h!==void 0&&(h.getCell(a,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=a)}l?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Zo(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=a+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let c=0;c<r;c++)n+=this._allRows[c],c+1<r&&(n+=this._allRowSeparators[c]);if(!t){let c=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=c!==this._lastCursorRow||h!==this._lastCursorCol,g=x=>{x>0?n+=`\x1B[${x}C`:x<0&&(n+=`\x1B[${-x}D`)};p&&((x=>{x>0?n+=`\x1B[${x}B`:x<0&&(n+=`\x1B[${-x}A`)})(c-this._lastCursorRow),g(h-this._lastCursorCol))}let a=this._terminal._core._inputHandler._curAttrData,l=this._diffStyle(a,this._cursorStyle);return l.length>0&&(n+=`\x1B[${l.join(";")}m`),n}},TS=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let a=r.length,l=n===void 0?a:Hg(n+t.rows,0,a);return this._serializeBufferByRange(t,r,{start:a-l,end:a-1},!1)}_serializeBufferByRange(t,r,n,a){return new AS(r,t).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:t.cols,y:typeof n.end=="number"?n.end:n.end.line}},a)}_serializeBufferAsHTML(t,r){let n=t.buffer.active,a=new CS(n,t,r),l=r.onlySelection??!1,c=r.range;if(c)return a.serialize({start:{x:c.startCol,y:(c.startLine,c.startLine)},end:{x:t.cols,y:(c.endLine,c.endLine)}});if(!l){let p=n.length,g=r.scrollback,x=g===void 0?p:Hg(g+t.rows,0,p);return a.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?a.serialize({start:{x:h.start.x,y:h.start.y},end:{x:h.end.x,y:h.end.y}}):""}_serializeScrollRegion(t){let r=t._core.buffer,n=r.scrollTop,a=r.scrollBottom;return n!==0||a!==t.rows-1?`\x1B[${n+1};${a+1}r`:""}_serializeModes(t){let r="",n=t.modes;if(n.applicationCursorKeysMode&&(r+="\x1B[?1h"),n.applicationKeypadMode&&(r+="\x1B[?66h"),n.bracketedPasteMode&&(r+="\x1B[?2004h"),n.insertMode&&(r+="\x1B[4h"),n.originMode&&(r+="\x1B[?6h"),n.reverseWraparoundMode&&(r+="\x1B[?45h"),n.sendFocusMode&&(r+="\x1B[?1004h"),n.wraparoundMode===!1&&(r+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return n.showCursor||(r+="\x1B[?25l"),r}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let r=t?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t?.scrollback);if(!t?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${n}`}return t?.excludeModes||(r+=this._serializeModes(this._terminal),r+=this._serializeScrollRegion(this._terminal)),r}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t??{})}dispose(){}},CS=class extends r3{constructor(t,r,n){super(t),this._terminal=r,this._options=n,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=vS}_beforeSerialize(t,r,n){this._htmlContent+="<html><body><!--StartFragment--><pre>";let a="#000000",l="#ffffff";(this._options.includeGlobalBackground??!1)&&(a=this._terminal.options.theme?.foreground??"#ffffff",l=this._terminal.options.theme?.background??"#000000");let c=[];c.push("color: "+a+";"),c.push("background-color: "+l+";"),c.push("font-family: "+this._terminal.options.fontFamily+";"),c.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+c.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,r){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,r){let n=r?t.getFgColor():t.getBgColor();if(r?t.isFgRGB():t.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(a=>a.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[n].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(n=>n.toString(16).padStart(2,"0")).join(""):this._ansiColors[r].css}_getUnderlineStyle(t){switch(t.getUnderlineStyle()){case 1:return"underline";case 2:return"underline double";case 3:return"underline wavy";case 4:return"underline dotted";case 5:return"underline dashed";default:return"underline"}}_diffStyle(t,r){let n=[];if(s3(t,r))return;let a=!Gm(t,r),l=!Zo(t,r),c=!Vm(t,r);if(a||l||c){let h=this._getHexColor(t,!0);h&&n.push("color: "+h+";");let p=this._getHexColor(t,!1);p&&n.push("background-color: "+p+";"),t.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&n.push("font-weight: bold;");let g=[];if(t.isUnderline()&&g.push(this._getUnderlineStyle(t)),t.isOverline()&&g.push("overline"),t.isStrikethrough()&&g.push("line-through"),t.isBlink()&&g.push("blink"),g.length>0&&n.push("text-decoration: "+g.join(" ")+";"),t.isUnderline()){let x=this._getUnderlineColor(t);x&&n.push("text-decoration-color: "+x+";")}return t.isInvisible()&&n.push("visibility: hidden;"),t.isItalic()&&n.push("font-style: italic;"),t.isDim()&&n.push("opacity: 0.5;"),n}}_nextCell(t,r,n,a){if(t.getWidth()===0)return;let l=t.getChars()==="",c=this._diffStyle(t,r);c&&(this._currentRow+=c.length===0?"</span><span>":"</span><span style='"+c.join(" ")+"'>"),l?this._currentRow+=" ":this._currentRow+=wS(t.getChars())}_serializeString(){return this._htmlContent}};var SS=class{constructor(e=new _S,t=new i3){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,t=>this._setOrReportClipboard(t))}dispose(){return this._disposable?.dispose()}_readText(e,t){let r=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${r}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(";");if(t.length<2)return!0;let r=t[0],n=t[1];if(n==="?"){let c=this._provider.readText(r);return c instanceof Promise?c.then(h=>(this._readText(r,h),!0)):(this._readText(r,c),!0)}let a="";try{a=this._base64.decodeText(n)}catch{}let l=this._provider.writeText(r,a);return l instanceof Promise?l.then(()=>!0):!0}},i3=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},_S=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let n="";for(let a=0;a<r.length;a++)n+=String.fromCharCode(r[a]);return btoa(n)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let r=atob(t),n=new Uint8Array(r.length);for(let a=0;a<r.length;++a)n[a]=r.charCodeAt(a);return new TextDecoder().decode(n)}catch{}return""}};var LS=Object.create,a3=Object.defineProperty,kS=Object.getOwnPropertyDescriptor,IS=Object.getOwnPropertyNames,ES=Object.getPrototypeOf,NS=Object.prototype.hasOwnProperty,m0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},RS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of IS(t))!NS.call(e,a)&&a!==r&&a3(e,a,{get:()=>t[a],enumerable:!(n=kS(t,a))||n.enumerable});return e},g0=(e,t,r)=>(r=e!=null?LS(ES(e)):{},RS(!e||!e.__esModule?a3(r,"default",{value:e,enumerable:!0}):r,e)),qm=m0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly.");function t(w){return w&255}e.red=t;function r(w){return w>>>8&255}e.green=r;function n(w){return w>>>16&255}e.blue=n;function a(w){return w>>>24&255}e.alpha=a;function l(w,k,E,I=255){return((I&255)<<24|(E&255)<<16|(k&255)<<8|w&255)>>>0}e.toRGBA8888=l;function c(w){return[w&255,w>>8&255,w>>16&255,w>>>24]}e.fromRGBA8888=c;function h(w,k){let E=t(w),I=r(w),M=n(w),B=Number.MAX_SAFE_INTEGER,F=-1;for(let U=0;U<k.length;++U){let G=E-k[U][0],Q=I-k[U][1],X=M-k[U][2],ee=G*G+Q*Q+X*X;if(!ee)return U;ee<B&&(B=ee,F=U)}return F}e.nearestColorIndex=h;function p(w,k,E){return Math.max(w,Math.min(E,k))}function g(w,k,E){return E<0&&(E+=1),E>1&&(E-=1),E*6<1?k+(w-k)*6*E:E*2<1?w:E*3<2?k+(w-k)*(4-E*6):k}function x(w,k,E){if(!E){let B=Math.round(k*255);return l(B,B,B)}let I=k<.5?k*(1+E):k+E-k*E,M=2*k-I;return l(p(0,255,Math.round(g(I,M,w+1/3)*255)),p(0,255,Math.round(g(I,M,w)*255)),p(0,255,Math.round(g(I,M,w-1/3)*255)))}function y(w,k,E){return(4278190080|Math.round(E/100*255)<<16|Math.round(k/100*255)<<8|Math.round(w/100*255))>>>0}e.normalizeRGB=y;function A(w,k,E){return x((w+240%360)/360,k/100,E/100)}e.normalizeHLS=A,e.PALETTE_VT340_COLOR=new Uint32Array([y(0,0,0),y(20,20,80),y(80,13,13),y(20,80,20),y(80,20,80),y(20,80,80),y(80,80,20),y(53,53,53),y(26,26,26),y(33,33,60),y(60,26,26),y(33,60,33),y(60,33,60),y(33,60,60),y(60,60,33),y(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([y(0,0,0),y(13,13,13),y(26,26,26),y(40,40,40),y(6,6,6),y(20,20,20),y(33,33,33),y(46,46,46),y(0,0,0),y(13,13,13),y(26,26,26),y(40,40,40),y(6,6,6),y(20,20,20),y(33,33,33),y(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let w=[l(0,0,0),l(205,0,0),l(0,205,0),l(205,205,0),l(0,0,238),l(205,0,205),l(0,250,205),l(229,229,229),l(127,127,127),l(255,0,0),l(0,255,0),l(255,255,0),l(92,92,255),l(255,0,255),l(0,255,255),l(255,255,255)],k=[0,95,135,175,215,255];for(let E=0;E<6;++E)for(let I=0;I<6;++I)for(let M=0;M<6;++M)w.push(l(k[E],k[I],k[M]));for(let E=8;E<=238;E+=10)w.push(l(E,E,E));return new Uint32Array(w)})(),e.DEFAULT_BACKGROUND=l(0,0,0,255),e.DEFAULT_FOREGROUND=l(255,255,255,255)}),o3=m0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=n=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(n);if(typeof Buffer<"u")return Buffer.from(n,"base64");let a=atob(n),l=new Uint8Array(a.length);for(let c=0;c<l.length;++c)l[c]=a.charCodeAt(c);return l};function r(n){if(n.d){let{t:a,s:l,d:c}=n,h,p,g=WebAssembly;return a===0?l?x=>new g.Instance(p||(p=new g.Module(h||(h=t(c)))),x):x=>p?g.instantiate(p,x):g.instantiate(h||(h=t(c)),x).then(y=>(p=y.module)&&y.instance):a===1?l?()=>p||(p=new g.Module(h||(h=t(c)))):()=>p?Promise.resolve(p):g.compile(h||(h=t(c))).then(x=>p=x):l?()=>h||(h=t(c)):()=>Promise.resolve(h||(h=t(c)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(n)}}),l3=m0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=o3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),n=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(h=>h.charCodeAt(0))),a=new Uint32Array(1024);a.fill(4278190080);for(let h=0;h<n.length;++h)a[n[h]]=h<<2;for(let h=0;h<n.length;++h)a[256+n[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<n.length;++h)a[512+n[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<n.length;++h)a[768+n[h]]=h<<16;var l=new Uint8Array(0),c=class{constructor(h,p,g){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=h??1048576,this.maxBytes=p??4294901760,this._bytes=g??32768,this._bytes>this.maxBytes||this.maxBytes>4294901760)throw new Error("invalid byte settings")}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):l}release(){this._inst&&(this._bytes>this.keepSize?this._inst=this._m32=this._d=this._mem=null:(this._m32[1280]=0,this._m32[1281]=0,this._m32[1282]=0))}init(h,p){if(this.maxBytes=h??this.maxBytes,this._bytes=p??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let g=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),g=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(x/65536)}),this._inst=r({env:{memory:this._mem}}),g=new Uint32Array(this._mem.buffer,0),g.set(a,256),this._d=new Uint8Array(this._mem.buffer,5152)),g[1280]=0,g[1281]=0,g[1282]=0,this._m32=g,this._ended=!1}_realloc(h){let p=this._m32[1280]+h;if(this._bytes<p){if(p>this.maxBytes)return-3;let g=this._bytes;for(;(g*=2)<p;);if(g=Math.min(g,this.maxBytes),g<p)return-3;if(g+5152>this._mem.buffer.byteLength){let x=Math.ceil((g+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(x),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=g}return 0}put(h){if(!this._inst||this._ended)return-2;if(this._realloc(h.length))return-3;let p=this._m32;return this._d.set(h,p[1280]),p[1280]+=h.length,p[1280]-p[1281]>=131072?this._inst.exports.dec():0}end(){return this._ended=!0,this._inst?this._inst.exports.end():-2}get loadedBytes(){return this._inst?this._m32[1280]:0}get freeBytes(){return this._inst?this.maxBytes-this._m32[1280]:0}};e.default=c}),MS=m0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=o3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),n=class{constructor(a){this.keepSize=a,this.width=0,this.height=0}decode(a){this.width=a[4]<<24|a[5]<<16|a[6]<<8|a[7],this.height=a[8]<<24|a[9]<<16|a[10]<<8|a[11];let l=this.width*this.height,c=l*4,h=a.length,p=Math.max(c,h)+(Math.min(c,h)>>1)+4096;this._inst?this._mem.buffer.byteLength<p&&(this._mem.grow(Math.ceil((p-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(p/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let g=this._mem.buffer.byteLength-h&-256;return this._d.set(a,g),this._inst.exports.dec(g,h,l),this._d.subarray(1024,1024+c)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=n}),DS=m0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:"AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF"}}),jS=m0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=qm(),r=DS();function n(w){if(typeof Buffer<"u")return Buffer.from(w,"base64");let k=atob(w),E=new Uint8Array(k.length);for(let I=0;I<E.length;++I)E[I]=k.charCodeAt(I);return E}var a=n(r.LIMITS.BYTES),l,c=new Uint32Array,h=class{constructor(){this.bandHandler=w=>1,this.modeHandler=w=>1}handle_band(w){return this.bandHandler(w)}mode_parsed(w){return this.modeHandler(w)}},p={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function g(w){let k=new h,E={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(l||a,E).then(I=>(l=l||I.module,new x(w,I.instance||I,k)))}e.DecoderAsync=g;var x=class{constructor(w,k,E){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=c,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},p,w),this._opts.paletteLimit>r.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${r.LIMITS.PALETTE_SIZE}`);if(k)E.bandHandler=this._handle_band.bind(this),E.modeHandler=this._initCanvas.bind(this);else{let I=l||(l=new WebAssembly.Module(a));k=new WebAssembly.Instance(I,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=k,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),r.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),r.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(w){if(w===2){let k=this.width*this.height;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}this._maxWidth=this._width}else if(w===1)if(this._level===2){let k=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(w,k){let E=w+k;if(E>this._canvas.length){if(this._opts.memoryLimit&&E*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let I=new Uint32Array(Math.ceil(E/65536)*65536);I.set(this._canvas),this._canvas=I}}_handle_band(w){let k=this._PIXEL_OFFSET,E=this._lastOffset;if(this._mode===2){let I=this.height-this._currentHeight,M=0;for(;M<6&&I>0;)this._canvas.set(this._pSrc.subarray(k*M,k*M+w),E+w*M),M++,I--;this._lastOffset+=w*M,this._currentHeight+=M}else if(this._mode===1){this._realloc(E,w*6),this._maxWidth=Math.max(this._maxWidth,w),this._minWidth=Math.min(this._minWidth,w);for(let I=0;I<6;++I)this._canvas.set(this._pSrc.subarray(k*I,k*I+w),E+w*I);this._bandWidths.push(w),this._lastOffset+=w*6,this._currentHeight+=6}return 0}get width(){return this._mode!==1?this._width:Math.max(this._maxWidth,this._wasm.current_width())}get height(){return this._mode!==1?this._height:this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(w=this._opts.fillColor,k=this._opts.palette,E=this._opts.paletteLimit,I=this._opts.truncate){this._wasm.init(this._opts.sixelColor,w,E,I?1:0),k&&this._palette.set(k.subarray(0,r.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(w,k=0,E=w.length){let I=k;for(;I<E;){let M=Math.min(E-I,r.LIMITS.CHUNK_SIZE);this._chunk.set(w.subarray(I,I+=M)),this._wasm.decode(0,M)}}decodeString(w,k=0,E=w.length){let I=k;for(;I<E;){let M=Math.min(E-I,r.LIMITS.CHUNK_SIZE);for(let B=0,F=I;B<M;++B,++F)this._chunk[B]=w.charCodeAt(F);I+=M,this._wasm.decode(0,M)}}get data32(){if(this._mode===0||!this.width||!this.height)return c;let w=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let E=this._PIXEL_OFFSET,I=this._lastOffset,M=0;for(;M<6&&k>0;)this._canvas.set(this._pSrc.subarray(E*M,E*M+w),I+w*M),M++,k--;k&&this._canvas.fill(this._fillColor,I+w*M)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let M=!1;if(w)if(w!==this._minWidth)M=!0;else{let B=this._PIXEL_OFFSET,F=this._lastOffset;this._realloc(F,w*6);for(let U=0;U<6;++U)this._canvas.set(this._pSrc.subarray(B*U,B*U+w),F+w*U)}if(!M)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let E=0,I=0;for(let M=0;M<this._bandWidths.length;++M){let B=this._bandWidths[M];for(let F=0;F<6;++F)k.set(this._canvas.subarray(I,I+=B),E),E+=this.width}if(w){let M=this._PIXEL_OFFSET,B=this._wasm.current_height();for(let F=0;F<B;++F)k.set(this._pSrc.subarray(M*F,M*F+w),E+this.width*F)}return k}return c}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=c,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=x;function y(w,k){let E=new x(k);return E.init(),typeof w=="string"?E.decodeString(w):E.decode(w),{width:E.width,height:E.height,data32:E.data32,data8:E.data8}}e.decode=y;async function A(w,k){let E=await g(k);return E.init(),typeof w=="string"?E.decodeString(w):E.decode(w),{width:E.width,height:E.height,data32:E.data32,data8:E.data8}}e.decodeAsync=A});function rm(e){return{dispose:e}}var c3=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},u3=class{constructor(){this._store=new c3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};u3.None=Object.freeze({dispose(){}});var BS=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},QS=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return rm(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let a=rm(()=>{let l=this._listeners.indexOf(n);l!==-1&&this._listeners.splice(l,1)});return r&&(Array.isArray(r)?r.push(a):r.add(a)),a},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},PS;(e=>{function t(l,c){return l(h=>c.fire(h))}e.forward=t;function r(l,c){return(h,p,g)=>l(x=>h.call(p,c(x)),void 0,g)}e.map=r;function n(...l){return(c,h,p)=>{let g=new c3;for(let x of l)g.add(x(y=>c.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(l,c,h){return c(h),l(p=>c(p))}e.runAndSubscribe=a})(PS||={});var Wg=g0(qm()),l0=class Ol extends u3{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new BS),this._oldOpen=this._terminal._core.open,this._terminal._core.open=r=>{this._oldOpen?.call(this._terminal._core,r),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange(r=>{r==="fontSize"&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))}),this._register(rm(()=>{this.removeLayerFromDom(),this.removeLayerFromDom("bottom"),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this._layers.clear(),this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0}))}get canvas(){return this._layers.get("top")?.canvas}static createCanvas(t,r,n){let a=(t??document).createElement("canvas");return a.width=r|0,a.height=n|0,a}static createImageData(t,r,n,a){if(typeof ImageData!="function"){let l=t.createImageData(r,n);return a&&l.data.set(new Uint8ClampedArray(a,0,r*n*4)),l}return a?new ImageData(new Uint8ClampedArray(a,0,r*n*4),r,n):new ImageData(r,n)}static createImageBitmap(t){return typeof createImageBitmap!="function"?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&this.cellSize.height!==-1&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._terminal.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,r,n){let a=t*(this.dimensions?.css.cell.height||0),l=this.dimensions?.css.canvas.width||0,c=(r+1-t)*(this.dimensions?.css.cell.height||0);(!n||n==="top")&&this._layers.get("top")?.clearRect(0,a,l,c),(!n||n==="bottom")&&this._layers.get("bottom")?.clearRect(0,a,l,c)}clearAll(t){if(!t||t==="top"){let r=this._layers.get("top");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}if(!t||t==="bottom"){let r=this._layers.get("bottom");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}}draw(t,r,n,a,l=1){let c=this._layers.get(t.layer);if(!c)return;let{width:h,height:p}=this.cellSize;if(h===-1||p===-1)return;this._rescaleImage(t,h,p);let g=t.actual,x=Math.ceil(g.width/h),y=r%x*h,A=Math.floor(r/x)*p,w=n*h,k=a*p,E=l*h+y>g.width?g.width-y:l*h,I=A+p>g.height?g.height-A:p;c.drawImage(g,Math.floor(y),Math.floor(A),Math.ceil(E),Math.ceil(I),Math.floor(w),Math.floor(k),Math.ceil(E),Math.ceil(I))}extractTile(t,r){let{width:n,height:a}=this.cellSize;if(n===-1||a===-1)return;this._rescaleImage(t,n,a);let l=t.actual,c=Math.ceil(l.width/n),h=r%c*n,p=Math.floor(r/c)*a,g=n+h>l.width?l.width-h:n,x=p+a>l.height?l.height-p:a,y=Ol.createCanvas(this.document,g,x),A=y.getContext("2d");if(A)return A.drawImage(l,Math.floor(h),Math.floor(p),Math.floor(g),Math.floor(x),0,0,Math.floor(g),Math.floor(x)),y}drawPlaceholder(t,r,n=1){let a=this._layers.get("top");if(a){let{width:l,height:c}=this.cellSize;if(l===-1||c===-1||(this._placeholder?c>=this._placeholder.height&&this._createPlaceHolder(c+1):this._createPlaceHolder(Math.max(c+1,24)),!this._placeholder))return;a.drawImage(this._placeholderBitmap??this._placeholder,t*l,r*c%2?0:1,l*n,c,t*l,r*c,l*n,c)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,r=this.dimensions?.css.canvas.height||0;for(let n of this._layers.values())(n.canvas.width!==t||n.canvas.height!==r)&&(n.canvas.width=t,n.canvas.height=r)}_rescaleImage(t,r,n){if(r===t.actualCellSize.width&&n===t.actualCellSize.height)return;let{width:a,height:l}=t.origCellSize;if(r===a&&n===l){t.actual=t.orig,t.actualCellSize.width=a,t.actualCellSize.height=l;return}let c=Ol.createCanvas(this.document,Math.ceil(t.orig.width*r/a),Math.ceil(t.orig.height*n/l)),h=c.getContext("2d");h&&(h.drawImage(t.orig,0,0,c.width,c.height),t.actual=c,t.actualCellSize.width=r,t.actualCellSize.height=n)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{for(let r of[...this._layers.keys()])this.removeLayerFromDom(r);this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(t="top"){if(!this.document||!this._terminal._core.screenElement){console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement");return}if(this._layers.has(t))return;let r=Ol.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let n=this._terminal._core.screenElement;n.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",n.insertBefore(r,n.firstChild)):(r.style.zIndex="0",n.appendChild(r));let a=r.getContext("2d",{alpha:!0});if(!a){r.remove();return}this._layers.set(t,a),this.clearAll(t)}removeLayerFromDom(t="top"){let r=this._layers.get(t);r&&(r.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let r=32,n=Ol.createCanvas(this.document,r,t),a=n.getContext("2d",{alpha:!1});if(!a)return;let l=Ol.createImageData(a,r,t),c=new Uint32Array(l.data.buffer),h=(0,Wg.toRGBA8888)(0,0,0),p=(0,Wg.toRGBA8888)(255,255,255);c.fill(h);for(let y=0;y<t;++y){let A=y%2,w=y*r;for(let k=0;k<r;k+=2)c[w+k+A]=p}a.putImageData(l,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=Ol.createCanvas(this.document,g,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let y=0;y<g;y+=r)x.drawImage(n,y,0);Ol.createImageBitmap(this._placeholder).then(y=>this._placeholderBitmap=y)}get document(){return this._terminal._core._coreBrowserService?.window.document}},bl={width:7,height:14},nm=class d3{constructor(t=0,r=0,n=-1,a=-1){this.imageId=n,this.tileId=a,this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new d3(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},Sd=new nm,OS=class{constructor(e,t,r){this._terminal=e,this._renderer=t,this._opts=r,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(n){n instanceof Error&&console.error(n.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let e of this._images.values())e.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return this._pixelLimit*4/1e6}setLimit(e){if(e<.5||e>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=e/4*1e6>>>0,this._evictOldest(0)}getUsage(){return this._getStoredPixels()*4/1e6}_getStoredPixels(){let e=0;for(let t of this._images.values())t.orig&&(e+=t.orig.width*t.orig.height,t.actual&&t.actual!==t.orig&&(e+=t.actual.width*t.actual.height));return e}_delImg(e){let t=this._images.get(e);t&&(this._images.delete(e),window.ImageBitmap&&t.orig instanceof ImageBitmap&&t.orig.close(),this.onImageDeleted?.(e))}wipeAlternate(){let e=[];for(let[t,r]of this._images.entries())r.bufferType==="alternate"&&(r.marker?.dispose(),e.push(t));for(let t of e)this._delImg(t);this._needsFullClear=!0,this._fullyCleared=!1}deleteImage(e){let t=this._images.get(e);t&&(t.marker?.dispose(),this._delImg(e))}addImage(e,t){this._evictOldest(e.width*e.height);let r=this._renderer.cellSize;(r.width===-1||r.height===-1)&&(r=bl);let n=Math.ceil(e.width/r.width),a=Math.ceil(e.height/r.height),l=++this._lastId,c=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,g=c.x,x=c.y,y=g,A=0;t.scrolling||(c.x=0,c.y=0,y=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y);for(let I=0;I<a;++I){let M=c.lines.get(c.y+c.ybase);for(let B=0;B<n&&!(y+B>=h);++B)this._writeToCell(M,y+B,l,I*n+B),A++;if(t.scrolling)I<a-1&&this._terminal._core._inputHandler.lineFeed();else if(++c.y>=p)break;c.x=y}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y),t.scrolling?t.cursorPos==="iip"?c.x=Math.min(y+n,h):c.x=y:(c.x=g,c.y=x);let w=[];for(let[I,M]of this._images.entries())M.tileCount<1&&(M.marker?.dispose(),w.push(I));for(let I of w)this._delImg(I);let k=this._terminal.registerMarker(0);k?.onDispose(()=>{this._images.get(l)&&this._delImg(l)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let E={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:k||void 0,tileCount:A,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(l,E),this.onImageAdded?.(),l}render(e){let t=!1,r=!1;for(let g of this._images.values())if(g.layer==="bottom"?r=!0:t=!0,t&&r)break;if(t&&!this._renderer.hasLayer("top")&&(this._renderer.insertLayerToDom("top"),!this._renderer.hasLayer("top")))return;if(r&&!this._renderer.hasLayer("bottom")&&this._renderer.insertLayerToDom("bottom"),this._renderer.rescaleCanvas(),!this._images.size){this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),this._renderer.hasLayer("top")&&this._renderer.removeLayerFromDom("top"),this._renderer.hasLayer("bottom")&&this._renderer.removeLayerFromDom("bottom");return}!t&&this._renderer.hasLayer("top")&&(this._renderer.clearAll("top"),this._renderer.removeLayerFromDom("top")),!r&&this._renderer.hasLayer("bottom")&&(this._renderer.clearAll("bottom"),this._renderer.removeLayerFromDom("bottom")),this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:n,end:a}=e,l=this._terminal._core.buffer,c=this._terminal._core.cols;this._renderer.clearLines(n,a);let h=[],p=[];for(let g=n;g<=a;++g){let x=l.lines.get(g+l.ydisp);if(!x)return;for(let y=0;y<c;++y){let A;if(x.getBg(y)&268435456)A=x._extendedAttrs[y]??Sd;else{let E=x._extendedAttrs[y];if(!E||E.imageId===void 0||E.imageId===-1)continue;A=E}let w=A.imageId;if(w===void 0||w===-1)continue;let k=this._images.get(w);if(A.tileId!==-1){let E=A.tileId,I=y,M=1;for(;++y<c;){let B=x._extendedAttrs[y];if(!B||B.imageId!==w||B.tileId!==E+M)break;M++}y--,k?k.actual&&h.push({imgSpec:k,tileId:E,col:I,row:g,count:M}):this._opts.showPlaceholder&&p.push({col:I,row:g,count:M}),this._fullyCleared=!1}}}h.sort((g,x)=>g.imgSpec.zIndex-x.imgSpec.zIndex);for(let g of p)this._renderer.drawPlaceholder(g.col,g.row,g.count);for(let g of h)this._renderer.draw(g.imgSpec,g.tileId,g.col,g.row,g.count)}viewportResize(e){if(!this._images.size){this._viewportMetrics=e;return}if(this._viewportMetrics.cols>=e.cols){this._viewportMetrics=e;return}let t=this._terminal._core.buffer,r=t.lines.length,n=this._viewportMetrics.cols-1;for(let a=0;a<r;++a){let l=t.lines.get(a);if(l.getBg(n)&268435456){let c=l._extendedAttrs[n]??Sd,h=c.imageId;if(h===void 0||h===-1)continue;let p=this._images.get(h);if(!p)continue;let g=Math.ceil((p.actual?.width||0)/p.actualCellSize.width);if(c.tileId%g+1>=g)continue;let x=!1;for(let w=n+1;w>e.cols;++w)if(l._data[w*3+0]&4194303){x=!0;break}if(x)continue;let y=Math.min(e.cols,g-c.tileId%g+n),A=c.tileId;for(let w=n+1;w<y;++w)this._writeToCell(l,w,h,++A),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??Sd;if(n.imageId&&n.imageId!==-1){let a=this._images.get(n.imageId)?.orig;if(window.ImageBitmap&&a instanceof ImageBitmap){let l=l0.createCanvas(window.document,a.width,a.height);return l.getContext("2d")?.drawImage(a,0,0,a.width,a.height),l}return a}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??Sd;if(n.imageId&&n.imageId!==-1&&n.tileId!==-1){let a=this._images.get(n.imageId);if(a)return this._renderer.extractTile(a,n.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let n=this._images.get(++this._lowestId);n&&n.orig&&(r-=n.orig.width*n.orig.height,n.actual&&n.orig!==n.actual&&(r-=n.actual.width*n.actual.height),n.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,n){if(e._data[t*3+2]&268435456){let a=e._extendedAttrs[t];if(a){if(a.imageId!==void 0){let l=this._images.get(a.imageId);l&&l.tileCount--,a.imageId=r,a.tileId=n;return}e._extendedAttrs[t]=new nm(a.ext,a.urlId,r,n);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new nm(0,0,r,n)}_evictOnAlternate(){for(let r of this._images.values())r.bufferType==="alternate"&&(r.tileCount=0);let e=this._terminal._core.buffer;for(let r=0;r<this._terminal.rows;++r){let n=e.lines.get(r);if(n){for(let a=0;a<this._terminal.cols;++a)if(n._data[a*3+2]&268435456){let l=n._extendedAttrs[a]?.imageId;if(l){let c=this._images.get(l);c&&c.tileCount++}}}}let t=[];for(let[r,n]of this._images.entries())n.bufferType==="alternate"&&!n.tileCount&&(n.marker?.dispose(),t.push(r));for(let r of t)this._delImg(r)}},FS=g0(l3()),$S=g0(MS());function kh(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Uf(e){let t=0;for(let r=0;r<e.length;++r){if(e[r]<48||e[r]>57)throw new Error("illegal char");t=t*10+e[r]-48}return t}function Gg(e){let t=kh(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function US(e){if(typeof Buffer<"u")return Buffer.from(kh(e),"base64").toString();let t=atob(kh(e)),r=new Uint8Array(t.length);for(let n=0;n<r.length;++n)r[n]=t.charCodeAt(n);return new TextDecoder().decode(r)}var Vg={inline:Uf,size:Uf,name:US,width:Gg,height:Gg,preserveAspectRatio:Uf},qg=[70,105,108,101],Yg=[77,117,108,116,105,112,97,114,116,70,105,108,101],zf=[70,105,108,101,80,97,114,116],Hf=[70,105,108,101,69,110,100],Wf=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],Gf=1024,zS=class{constructor(){this.state=0,this._buffer=new Uint32Array(Gf),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}end(){if(this.state===0){if(this._position===Hf.length){for(let t=0;t<Hf.length;++t)if(this._buffer[t]!==Hf[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===Wf.length){for(let t=0;t<Wf.length;++t)if(this._buffer[t]!==Wf[t])return this._a();return this.fields.type=5,this.state=4,0}return this._a()}return this.state===4?0:this.state===3&&this.fields.type===2?this._storeValue(this._position)?(this.state=4,0):this._a():this._a()}parse(t,r,n){let a=this.state,l=this._position,c=this._buffer;if(a===1||a===4||a===0&&l>14)return-1;for(let h=r;h<n;++h){let p=t[h];switch(p){case 59:if(!this._storeValue(l))return this._a();a=2,l=0;break;case 61:if(a===0){if(c[0]===70){let g=0;for(;g<qg.length;++g)if(c[g]!==qg[g])return this._a();if(this.fields.type=1,l===zf.length){for(;g<zf.length;++g)if(c[g]!==zf[g])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(c[0]===77){for(let g=0;g<Yg.length;++g)if(c[g]!==Yg[g])return this._a();this.fields.type=2}else return this._a();a=2,l=0}else if(a===2){if(!this._storeKey(l))return this._a();a=3,l=0}else if(a===3){if(l>=Gf)return this._a();c[l++]=p}break;case 58:return a===3&&!this._storeValue(l)?this._a():(this.state=4,h+1);default:if(l>=Gf)return this._a();c[l++]=p}}return this.state=a,this._position=l,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=kh(this._buffer.subarray(0,t));return r?(this._key=r,this.fields[r]=null,!0):!1}_storeValue(t){if(this._key){try{let r=this._buffer.slice(0,t);this.fields[this._key]=Vg[this._key]?Vg[this._key](r):r}catch{return!1}return!0}return!1}},Ih={mime:"unsupported",width:0,height:0};function HS(e){if(e.length<24)return Ih;let t=new Uint32Array(e.buffer,e.byteOffset,6);if(t[0]===1196314761&&t[1]===169478669&&t[3]===1380206665)return{mime:"image/png",width:e[16]<<24|e[17]<<16|e[18]<<8|e[19],height:e[20]<<24|e[21]<<16|e[22]<<8|e[23]};if(e[0]===255&&e[1]===216&&e[2]===255){let[r,n]=WS(e);return{mime:"image/jpeg",width:r,height:n}}return t[0]===944130375&&(e[4]===55||e[4]===57)&&e[5]===97?{mime:"image/gif",width:e[7]<<8|e[6],height:e[9]<<8|e[8]}:t[0]===1718185841?{mime:"image/qoi",width:e[4]<<24|e[5]<<16|e[6]<<8|e[7],height:e[8]<<24|e[9]<<16|e[10]<<8|e[11]}:Ih}function WS(e){let t=e.length,r=4,n=e[r]<<8|e[r+1];for(;;){if(r+=n,r>=t)return[0,0];if(e[r]!==255)return[0,0];if(e[r+1]===192||e[r+1]===194)return r+8<t?[e[r+7]<<8|e[r+8],e[r+5]<<8|e[r+6]]:[0,0];r+=2,n=e[r]<<8|e[r+1]}}var Vf={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},GS=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=n,this._aborted=!1,this._hp=new zS,this._header=Vf,this._metrics=Ih,this._isMultipart=!1,this._abortMulti=!1;let a=Math.ceil(this._opts.iipSizeLimit*4/3),l=Math.min(1048576,a);this._dec=new FS.default(4194304,a,l),this._qoiDec=new $S.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=Ih,this._hp.reset()}put(e,t,r){if(!this._aborted)if(this._hp.state===4)this._dec.put(e.subarray(t,r))!==0&&(this._dec.release(),this._aborted=!0);else{let n=this._hp.parse(e,t,r);if(n===-1){this._aborted=!0;return}if(n>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},Vf,this._hp.fields),!this._header.inline){this._aborted=!0;return}this._dec.init()}else if(this._abortMulti){this._aborted=!0;return}this._dec.put(e.subarray(n,r))!==0&&(this._dec.release(),this._aborted=!0,this._isMultipart&&(this._abortMulti=!0))}}}end(e){if(this._aborted||this._hp.state!==4&&this._hp.end())return!0;let t=this._hp.fields.type;if(t===3)return!0;if(t===5){let c=bl.width,h=bl.height;this._renderer.dimensions&&(c=this._renderer.dimensions.css.canvas.width/this._coreTerminal.cols,h=this._renderer.dimensions.css.canvas.height/this._coreTerminal.rows);let p=this._coreTerminal._core._coreBrowserService?.dpr??1,g=`\x1B]1337;ReportCellSize=${h.toFixed(3)};${c.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},Vf,this._hp.fields),this._isMultipart=!0,this._abortMulti=!1,this._dec.release(),this._dec.init(),!0;if(t===4&&(!this._isMultipart||(this._isMultipart=!1,this._abortMulti||this._header.type!==2)))return!0;let r=0,n=0,a;if((a=e)&&(a=!this._dec.end())&&(this._metrics=HS(this._dec.data8),(a=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,n=this._metrics.height,(a=r&&n&&r*n<this._opts.pixelLimit)&&([r,n]=this._resize(r,n).map(Math.floor),a=r&&n&&r*n<this._opts.pixelLimit))),!a)return this._dec.release(),!0;let l;if(this._metrics.mime==="image/qoi"){let c=this._qoiDec.decode(this._dec.data8);if(l=new ImageData(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&n===this._qoiDec.height){this._dec.release();let h=l0.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return h.getContext("2d")?.putImageData(l,0,0),this._storage.addImage(h),!0}}else l=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(l,{resizeWidth:r,resizeHeight:n}).then(c=>(this._storage.addImage(c),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||bl.width,n=this._renderer.dimensions?.css.cell.height||bl.height,a=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,l=this._renderer.dimensions?.css.canvas.height||n*this._coreTerminal.rows,c=this._dim(this._header.width,a,r),h=this._dim(this._header.height,l,n);if(!c&&!h){let p=a/e,g=(l-n)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[e,t]}return c?this._header.preserveAspectRatio||!c||!h?[c,t*c/e]:[c,h]:[e*h/t,h]}_dim(e,t,r){return e==="auto"?0:e.endsWith("%")?parseInt(e.slice(0,-1),10)*t/100:e.endsWith("px")?parseInt(e.slice(0,-2),10):parseInt(e,10)*r}},VS=g0(l3());function Zg(e){let t={},r=e.split(",");for(let n of r){let a=n.indexOf("=");if(a===-1)continue;let l=n.substring(0,a),c=n.substring(a+1);if(l==="a"){t.action=c;continue}if(l==="o"){t.compression=c;continue}if(l==="t"){t.transmission=c;continue}if(l==="d"){t.deleteSelector=c;continue}let h=parseInt(c,10);switch(l){case"f":t.format=h;break;case"i":t.id=h;break;case"I":t.imageNumber=h;break;case"s":t.width=h;break;case"v":t.height=h;break;case"x":t.x=h;break;case"y":t.y=h;break;case"w":t.sourceWidth=h;break;case"h":t.sourceHeight=h;break;case"X":t.xOffset=h;break;case"Y":t.yOffset=h;break;case"c":t.columns=h;break;case"r":t.rows=h;break;case"m":t.more=h;break;case"q":t.quiet=h;break;case"C":t.cursorMovement=h;break;case"z":t.zIndex=h;break;case"p":t.placementId=h;break}}return t}var Kg=0,qS=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._kittyStorage=r,this._coreTerminal=n,this._aborted=!1,this._decodeError=!1,this._activeDecoder=null,this._inControlData=!0,this._controlData=new Uint32Array(512),this._controlLength=0,this._encodedSizeLimit=0,this._totalEncodedSize=0,this._parsedCommand=null,this._pendingTransmissions=new Map,this._maxEncodedBytes=Math.ceil(this._opts.kittySizeLimit*4/3),this._initialEncodedBytes=Math.min(4194304,this._maxEncodedBytes)}reset(){this._cleanupAllPending(),this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),this._kittyStorage.reset()}dispose(){this.reset()}_removePendingEntry(e){this._pendingTransmissions.delete(e),this._lastPendingKey===e&&(this._lastPendingKey=void 0)}_cleanupAllPending(){for(let e of this._pendingTransmissions.values())e.decoder.release();this._pendingTransmissions.clear(),this._lastPendingKey=void 0}start(){this._aborted=!1,this._decodeError=!1,this._inControlData=!0,this._controlLength=0,this._parsedCommand=null,this._encodedSizeLimit=this._maxEncodedBytes,this._totalEncodedSize=0,this._activeDecoder=null}put(e,t,r){if(!this._aborted)if(!this._inControlData)this._streamPayload(e,t,r);else{let n=r;for(let l=t;l<r;l++)if(e[l]===59){this._inControlData=!1,n=l;break}let a=n-t;if(this._controlLength+a>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,n),this._controlLength),this._controlLength+=a,!this._inControlData){if(this._parsedCommand=Zg(this._parseControlDataString()),this._parsedCommand.id!==void 0&&this._parsedCommand.imageNumber!==void 0){this._sendResponse(this._parsedCommand.id,"EINVAL:cannot specify both i and I keys",this._parsedCommand.quiet??0),this._aborted=!0;return}if(this._parsedCommand.action==="d")return;let l=n+1;l<r&&this._streamPayload(e,l,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let n=this._parsedCommand?.id??this._lastPendingKey??0,a=this._pendingTransmissions.get(n),l=a?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,l+this._totalEncodedSize>this._encodedSizeLimit){let c=this._activeDecoder??a?.decoder;c&&c.release(),this._activeDecoder=null,a&&this._removePendingEntry(n),this._aborted=!0;return}this._decodeError||(a?.decoder&&!this._activeDecoder&&(this._activeDecoder=a.decoder),this._activeDecoder||(this._activeDecoder=new VS.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==Kg&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,a&&this._removePendingEntry(n)))}end(e){if(this._aborted||!e)return this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),!0;if(this._inControlData)return this._handleNoPayloadCommand();let t=this._parsedCommand;if(t.action==="d")return this._handleDelete(t);let r=t.id??this._lastPendingKey??0,n=t.more===1,a=this._pendingTransmissions.get(r);if(n)return this._activeDecoder&&(a?(a.totalEncodedSize+=this._totalEncodedSize,a.decodeError=a.decodeError||this._decodeError):this._pendingTransmissions.set(r,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=r,this._activeDecoder=null),!0;a&&(this._lastPendingKey=void 0);let l=this._decodeError,c=t,h=this._activeDecoder;a&&(c=a.cmd,h=a.decoder,l=l||a.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==Kg&&(l=!0),p=h.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(c,p,l);return h&&h.release(),g}_parseControlDataString(){let e="";for(let t=0;t<this._controlLength;t++)e+=String.fromCodePoint(this._controlData[t]);return e}_handleNoPayloadCommand(){let e=Zg(this._parseControlDataString());if(e.id!==void 0&&e.imageNumber!==void 0)return this._sendResponse(e.id,"EINVAL:cannot specify both i and I keys",e.quiet??0),!0;switch(e.action??"t"){case"d":return this._handleDelete(e);case"q":return this._sendResponse(e.id??0,"OK",e.quiet??0),!0;case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handleCommandWithBytesAndCmd(e,t,r){switch(e.action??"t"){case"t":{let n=this._handleTransmit(e,t,r);return(e.transmission??"d")==="d"&&e.id!==void 0&&(r?this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0):t.length>0&&this._sendResponse(e.id,"OK",e.quiet??0)),n}case"T":return this._handleTransmitDisplay(e,t,r);case"q":return this._handleQuery(e,t,r);case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handlePlacement(e){if(e.id===void 0)return!0;let t=e.id,r=this._kittyStorage.getImage(t);return r?this._displayImage(r,e).then(n=>(this._sendResponse(t,n?"OK":"EINVAL:image rendering failed",e.quiet??0,e.placementId),!0)):(this._sendResponse(t,"ENOENT:image not found",e.quiet??0,e.placementId),!0)}_handleTransmit(e,t,r){return(e.transmission??"d")!=="d"?(e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported transmission medium",e.quiet??0),!0):(r||t.length===0||this._kittyStorage.storeImage(e.id,{data:new Blob([t]),width:e.width??0,height:e.height??0,format:e.format??32,compression:e.compression??""}),!0)}_handleTransmitDisplay(e,t,r){if(r)return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0),!0;this._handleTransmit(e,t,r);let n=e.id??this._kittyStorage.lastImageId,a=this._kittyStorage.getImage(n);if(a){let l=this._displayImage(a,e);return e.id!==void 0?l.then(c=>(this._sendResponse(n,c?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):l.then(()=>!0)}return!0}_handleQuery(e,t,r){let n=e.id??0,a=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(n,"EINVAL:unsupported transmission medium",a),!0;if(r)return this._sendResponse(n,"EINVAL:invalid base64 data",a),!0;if(t.length===0)return this._sendResponse(n,"OK",a),!0;let l=e.format??32;if(l===100)this._sendResponse(n,"OK",a);else{let c=e.width??0,h=e.height??0;if(!c||!h)return this._sendResponse(n,"EINVAL:width and height required for raw pixel data",a),!0;let p=l===32?4:3,g=c*h*p;if(t.length<g)return this._sendResponse(n,"EINVAL:insufficient pixel data",a),!0;this._sendResponse(n,"OK",a)}return!0}_handleDelete(e){switch(e.deleteSelector??"a"){case"a":case"A":this._cleanupAllPending(),this._kittyStorage.deleteAll();break;case"i":case"I":if(e.id!==void 0){let t=this._pendingTransmissions.get(e.id);t&&t.decoder.release(),this._removePendingEntry(e.id),this._kittyStorage.deleteById(e.id)}break}return!0}_sendResponse(e,t,r,n){let a=t==="OK";if(a&&r>=1||!a&&r>=2)return;let l=n?`,p=${n}`:"",c=`\x1B_Gi=${e}${l};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(c)}_displayImage(e,t){return this._decodeAndDisplay(e,t).then(()=>!0).catch(()=>!1)}async _decodeAndDisplay(e,t){let r=await this._createBitmap(e);try{let n=Math.max(0,t.x??0),a=Math.max(0,t.y??0),l=t.sourceWidth||r.width-n,c=t.sourceHeight||r.height-a,h=Math.max(0,r.width-n),p=Math.max(0,r.height-a),g=Math.max(0,Math.min(l,h)),x=Math.max(0,Math.min(c,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(n!==0||a!==0||g!==r.width||x!==r.height){let ze=await createImageBitmap(r,n,a,g,x);r.close(),r=ze}let y=this._renderer.dimensions?.css.cell.width||bl.width,A=this._renderer.dimensions?.css.cell.height||bl.height,w,k;t.columns!==void 0&&t.rows!==void 0?(w=t.columns,k=t.rows):t.columns!==void 0?(w=t.columns,k=Math.max(1,Math.ceil(r.height/r.width*(w*y)/A))):t.rows!==void 0?(k=t.rows,w=Math.max(1,Math.ceil(r.width/r.height*(k*A)/y))):(w=Math.ceil(r.width/y),k=Math.ceil(r.height/A));let E=r.width,I=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(E=Math.round(w*y),I=Math.round(k*A)),E*I>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let M=this._coreTerminal._core.buffer,B=M.x,F=M.y,U=M.ybase,G=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(E!==r.width||I!==r.height){let ze=await createImageBitmap(r,{resizeWidth:E,resizeHeight:I});r.close(),r=ze}let Q=Math.min(Math.max(0,t.xOffset??0),y-1),X=Math.min(Math.max(0,t.yOffset??0),A-1);if(Q!==0||X!==0){let ze=t.columns!==void 0?Math.round(w*y):r.width+Q,he=t.rows!==void 0?Math.round(k*A):r.height+X,de=l0.createCanvas(window.document,ze,he),$e=de.getContext("2d");if(!$e)throw new Error("Failed to create offset canvas context");$e.drawImage(r,Q,X);let qe=await createImageBitmap(de);if(de.width=de.height=0,r.close(),r=qe,E=r.width,I=r.height,E*I>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(w=Math.ceil(r.width/y)),t.rows===void 0&&(k=Math.ceil(r.height/A))}let ee=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,G,ee),r=void 0,t.cursorMovement===1){let ze=M.ybase-U;M.x=B,M.y=Math.max(F-ze,0)}else M.x=Math.min(B+w,this._coreTerminal.cols)}catch(n){throw r?.close(),n}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let E=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let I=URL.createObjectURL(E),M=new Image;return new Promise((B,F)=>{M.addEventListener("load",()=>{URL.revokeObjectURL(I);let U=l0.createCanvas(window.document,M.width,M.height);U.getContext("2d")?.drawImage(M,0,0),createImageBitmap(U).then(B).catch(F)}),M.addEventListener("error",()=>{URL.revokeObjectURL(I),F(new Error("Failed to load image"))}),M.src=I})}return createImageBitmap(E)}let r=e.width,n=e.height;if(!r||!n)throw new Error("Width and height required for raw pixel data");let a=e.format===32?4:3,l=r*n*a;if(t.length<l)throw new Error("Insufficient pixel data");let c=r*n;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,c*4),r,n));let h=new Uint8ClampedArray(c*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(h.buffer),x=c&-4,y=0,A=0;for(let E=0;E<x;E+=4){let I=p[y++],M=p[y++],B=p[y++];g[A++]=4278190080|I,g[A++]=4278190080|I>>>24|M<<8,g[A++]=4278190080|M>>>16|B<<16,g[A++]=4278190080|B>>>8}let w=x*3,k=x*4;for(let E=x;E<c;E++)h[k]=t[w],h[k+1]=t[w+1],h[k+2]=t[w+2],h[k+3]=255,w+=3,k+=4;return createImageBitmap(new ImageData(h,r,n))}async _decompressZlib(e){try{return await this._decompress(e,"deflate")}catch{return await this._decompress(e,"deflate-raw")}}async _decompress(e,t){let r=new DecompressionStream(t),n=r.writable.getWriter();n.write(e),n.close();let a=[],l=r.readable.getReader();for(;;){let{done:g,value:x}=await l.read();if(g)break;a.push(x)}let c=a.reduce((g,x)=>g+x.length,0),h=new Uint8Array(c),p=0;for(let g of a)h.set(g,p),p+=g.length;return h}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},h3=class sm{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let n=this._storageIdToKittyId.get(r);n!==void 0&&(this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(r),this._images.delete(n))},this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"},this._previousOnImageDeleted=this._storage.onImageDeleted,this._wrappedOnImageDeleted=r=>{this._previousOnImageDeleted?.(r),this._handleStorageImageDeleted(r)},this._storage.onImageDeleted=this._wrappedOnImageDeleted}reset(){this._nextImageId=1,this._images.clear(),this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}dispose(){this.reset(),this._storage.onImageDeleted===this._wrappedOnImageDeleted&&(this._storage.onImageDeleted=this._previousOnImageDeleted)}storeImage(t,r){let n=t??this._nextImageId++,a=this._kittyIdToStorageId.get(n);return a!==void 0&&(this._storage.deleteImage(a),this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(a)),!this._images.has(n)&&this._images.size>=sm._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(n,{...r,id:n}),n}addImage(t,r,n,a,l){let c=this._kittyIdToStorageId.get(t);c!==void 0&&this._storageIdToKittyId.delete(c),this._addImageOpts.scrolling=n,this._addImageOpts.layer=a,this._addImageOpts.zIndex=l;let h=this._storage.addImage(r,this._addImageOpts);this._kittyIdToStorageId.set(t,h),this._storageIdToKittyId.set(h,t)}getImage(t){return this._images.get(t)}deleteById(t){this._images.delete(t);let r=this._kittyIdToStorageId.get(t);r!==void 0&&(this._storage.deleteImage(r),this._kittyIdToStorageId.delete(t),this._storageIdToKittyId.delete(r))}deleteAll(){this._images.clear();for(let t of this._kittyIdToStorageId.values())this._storage.deleteImage(t);this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}get images(){return this._images}get kittyIdToStorageId(){return this._kittyIdToStorageId}get lastImageId(){return this._nextImageId-1}_evictUndisplayedImages(){for(let[t]of this._images){if(this._images.size<=sm._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};h3._maxStoredImages=256;var YS=h3,Pu=g0(qm()),ZS=g0(jS()),KS=4194304,im=Pu.PALETTE_ANSI_256;im.set(Pu.PALETTE_VT340_COLOR);var XS=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,ZS.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:im,paletteLimit:this._opts.sixelPaletteLimit}).then(n=>this._dec=n)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,im,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:JS(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(t,null,this._opts.sixelPaletteLimit)}}put(e,t,r){if(!(this._aborted||!this._dec)){if(this._size+=r-t,this._size>this._opts.sixelSizeLimit){console.warn("SIXEL: too much data, aborting"),this._aborted=!0,this._dec.release();return}try{this._dec.decode(e,t,r)}catch(n){console.warn(`SIXEL: error while decoding image - ${n}`),this._aborted=!0,this._dec.release()}}}unhook(e){if(this._aborted||!e||!this._dec)return!0;let t=this._dec.width,r=this._dec.height;if(!t||!r)return r&&this._storage.advanceCursor(r),!0;let n=l0.createCanvas(void 0,t,r);return n.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>KS&&this._dec.release(),this._storage.addImage(n),!0}};function JS(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=_d(t.foreground.rgba);else if(e.isFgRGB()){let n=e.constructor.toColorRGB(e.getFgColor());r=(0,Pu.toRGBA8888)(...n)}else r=_d(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=_d(t.background.rgba);else if(e.isBgRGB()){let n=e.constructor.toColorRGB(e.getBgColor());r=(0,Pu.toRGBA8888)(...n)}else r=_d(t.ansi[e.getBgColor()].rgba);return r}function _d(e){return Pu.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var e_=class{constructor(e,t,r,n){this._storage=e,this._opts=t,this._renderer=r,this._terminal=n,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"vt340"}}addImage(e){this._addImageOpts.scrolling=this._opts.sixelScrolling,this._storage.addImage(e,this._addImageOpts)}advanceCursor(e){if(this._opts.sixelScrolling){let t=this._renderer.cellSize;(t.width===-1||t.height===-1)&&(t=bl);let r=Math.ceil(e/t.height);for(let n=1;n<r;++n)this._terminal._core._inputHandler.lineFeed()}}},t_=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},Xg={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Jg=4096,r_=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new QS,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},Xg,t),this._defaultOpts=Object.assign({},Xg,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear(),this._onImageAdded.dispose()}_disposeLater(...t){for(let r of t)this._disposables.push(r)}activate(t){if(this._terminal=t,this._renderer=new l0(t),this._storage=new OS(t,this._renderer,this._opts),this._storage.onImageAdded=()=>this._onImageAdded.fire(),this._opts.enableSizeReports){let r=t.options.windowOptions??{};r.getWinSizePixels=!0,r.getCellSizePixels=!0,r.getWinSizeChars=!0,t.options.windowOptions=r}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},r=>this._decset(r)),t.parser.registerCsiHandler({prefix:"?",final:"l"},r=>this._decrst(r)),t.parser.registerCsiHandler({final:"c"},r=>this._da1(r)),t.parser.registerCsiHandler({prefix:"?",final:"S"},r=>this._xtermGraphicsAttributes(r)),t.onRender(r=>this._storage?.render(r)),t.parser.registerCsiHandler({intermediates:"!",final:"p"},()=>this.reset()),t.parser.registerEscHandler({final:"c"},()=>this.reset()),t._core._inputHandler.onRequestReset(()=>this.reset()),t.buffer.onBufferChange(()=>this._storage?.wipeAlternate()),t.onResize(r=>this._storage?.viewportResize(r))),this._opts.sixelSupport){let r=new e_(this._storage,this._opts,this._renderer,t),n=new XS(this._opts,r,t);this._handlers.set("sixel",n),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},n))}if(this._opts.iipSupport){let r=new t_(this._storage),n=new GS(this._opts,this._renderer,r,t);this._handlers.set("iip",n),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,n))}if(this._opts.kittySupport){let r=new YS(this._storage),n=new qS(this._opts,this._renderer,r,t);this._handlers.set("kitty",n),this._disposeLater(r,n,t._core._inputHandler._parser.registerApcHandler({final:"G"},n))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,r){return this._storage?.getImageAtBufferCell(t,r)}extractTileAtBufferCell(t,r){return this._storage?.extractTileAtBufferCell(t,r)}_report(t){this._terminal?._core.input(t,!1)}_decset(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return t[0]?!0:this._opts.sixelSupport?(this._report("\x1B[?62;4;9;22c"),!0):!1}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(t[0]===1)switch(t[1]){case 1:return this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let r of this._handlers.values())r.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=Jg?(this._opts.sixelPaletteLimit=t[2],this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`\x1B[?${t[0]};2S`),!0;case 4:return this._report(`\x1B[?${t[0]};0;${Jg}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}if(t[0]===2)switch(t[1]){case 1:let r=this._renderer?.dimensions?.css.canvas.width,n=this._renderer?.dimensions?.css.canvas.height;if(!r||!n){let l=bl;r=(this._terminal?.cols||80)*l.width,n=(this._terminal?.rows||24)*l.height}if(r*n<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${n.toFixed(0)}S`);else{let l=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${l};${l}S`)}return!0;case 4:let a=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${a};${a}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const Rc=new Map;function qc(e){return{name:e,get hasSubscribers(){return(Rc.get(e)?.size??0)>0},publish(t){const r=Rc.get(e);if(r)for(const n of r)n(t,e)},subscribe(t){const r=Rc.get(e)??new Set;r.add(t),Rc.set(e,r)},unsubscribe(t){const r=Rc.get(e);if(!r)return!1;const n=r.delete(t);return r.size===0&&Rc.delete(e),n}}}function n_(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:qc(t.start),end:qc(t.end),asyncStart:qc(t.asyncStart),asyncEnd:qc(t.asyncEnd),error:qc(t.error),traceSync(n,a,l,...c){r.start.publish(a);try{const h=n.apply(l,c);return r.end.publish(a),h}catch(h){throw r.error.publish(h),h}},async tracePromise(n,a,l,...c){r.asyncStart.publish(a);try{const h=await n.apply(l,c);return r.asyncEnd.publish(a),h}catch(h){throw r.error.publish(h),h}},traceCallback(n,a,l,c,...h){r.start.publish(l);try{const p=n.apply(c,h);return r.end.publish(l),p}catch(p){throw r.error.publish(p),p}}};return r}var s_=Object.create,Ym=Object.defineProperty,i_=Object.getOwnPropertyDescriptor,a_=Object.getOwnPropertyNames,o_=Object.getPrototypeOf,l_=Object.prototype.hasOwnProperty,f3=e=>{throw TypeError(e)},c_=(e,t,r)=>t in e?Ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u_=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},d_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of a_(t))!l_.call(e,a)&&a!==r&&Ym(e,a,{get:()=>t[a],enumerable:!(n=i_(t,a))||n.enumerable});return e},h_=(e,t,r)=>(r=e!=null?s_(o_(e)):{},d_(!e||!e.__esModule?Ym(r,"default",{value:e,enumerable:!0}):r,e)),Qs=(e,t,r)=>c_(e,typeof t!="symbol"?t+"":t,r),Zm=(e,t,r)=>t.has(e)||f3("Cannot "+r),J=(e,t,r)=>(Zm(e,t,"read from private field"),r?r.call(e):t.get(e)),xn=(e,t,r)=>t.has(e)?f3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Cr=(e,t,r,n)=>(Zm(e,t,"write to private field"),t.set(e,r),r),Gt=(e,t,r)=>(Zm(e,t,"access private method"),r),qf=(e,t,r,n)=>({set _(a){Cr(e,t,a)},get _(){return J(e,t,n)}}),f_=u_((e,t)=>{var r=(()=>{var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,h=(s,o)=>{for(var u in o)n(s,u,{get:o[u],enumerable:!0})},p=(s,o,u,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of l(o))!c.call(s,f)&&f!==u&&n(s,f,{get:()=>o[f],enumerable:!(d=a(o,f))||d.enumerable});return s},g=s=>p(n({},"__esModule",{value:!0}),s),x={};h(x,{BoundingBox:()=>Y,Font:()=>Y1,Glyph:()=>Ur,Path:()=>Ye,_parse:()=>fe,load:()=>k7,loadSync:()=>I7,parse:()=>L7});var y=0,A=-3;function w(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function k(s,o){this.source=s,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new w,this.dtree=new w}var E=new w,I=new w,M=new Uint8Array(30),B=new Uint16Array(30),F=new Uint8Array(30),U=new Uint16Array(30),G=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Q=new w,X=new Uint8Array(320);function ee(s,o,u,d){var f,m;for(f=0;f<u;++f)s[f]=0;for(f=0;f<30-u;++f)s[f+u]=f/u|0;for(m=d,f=0;f<30;++f)o[f]=m,m+=1<<s[f]}function ze(s,o){var u;for(u=0;u<7;++u)s.table[u]=0;for(s.table[7]=24,s.table[8]=152,s.table[9]=112,u=0;u<24;++u)s.trans[u]=256+u;for(u=0;u<144;++u)s.trans[24+u]=u;for(u=0;u<8;++u)s.trans[168+u]=280+u;for(u=0;u<112;++u)s.trans[176+u]=144+u;for(u=0;u<5;++u)o.table[u]=0;for(o.table[5]=32,u=0;u<32;++u)o.trans[u]=u}var he=new Uint16Array(16);function de(s,o,u,d){var f,m;for(f=0;f<16;++f)s.table[f]=0;for(f=0;f<d;++f)s.table[o[u+f]]++;for(s.table[0]=0,m=0,f=0;f<16;++f)he[f]=m,m+=s.table[f];for(f=0;f<d;++f)o[u+f]&&(s.trans[he[o[u+f]]++]=f)}function $e(s){s.bitcount--||(s.tag=s.source[s.sourceIndex++],s.bitcount=7);var o=s.tag&1;return s.tag>>>=1,o}function qe(s,o,u){if(!o)return u;for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var d=s.tag&65535>>>16-o;return s.tag>>>=o,s.bitcount-=o,d+u}function oe(s,o){for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var u=0,d=0,f=0,m=s.tag;do d=2*d+(m&1),m>>>=1,++f,u+=o.table[f],d-=o.table[f];while(d>=0);return s.tag=m,s.bitcount-=f,o.trans[u+d]}function Re(s,o,u){var d,f,m,v,T,_;for(d=qe(s,5,257),f=qe(s,5,1),m=qe(s,4,4),v=0;v<19;++v)X[v]=0;for(v=0;v<m;++v){var R=qe(s,3,0);X[G[v]]=R}for(de(Q,X,0,19),T=0;T<d+f;){var N=oe(s,Q);switch(N){case 16:var q=X[T-1];for(_=qe(s,2,3);_;--_)X[T++]=q;break;case 17:for(_=qe(s,3,3);_;--_)X[T++]=0;break;case 18:for(_=qe(s,7,11);_;--_)X[T++]=0;break;default:X[T++]=N;break}}de(o,X,0,d),de(u,X,d,f)}function K(s,o,u){for(;;){var d=oe(s,o);if(d===256)return y;if(d<256)s.dest[s.destLen++]=d;else{var f,m,v,T;for(d-=257,f=qe(s,M[d],B[d]),m=oe(s,u),v=s.destLen-qe(s,F[m],U[m]),T=v;T<v+f;++T)s.dest[s.destLen++]=s.dest[T]}}}function we(s){for(var o,u,d;s.bitcount>8;)s.sourceIndex--,s.bitcount-=8;if(o=s.source[s.sourceIndex+1],o=256*o+s.source[s.sourceIndex],u=s.source[s.sourceIndex+3],u=256*u+s.source[s.sourceIndex+2],o!==(~u&65535))return A;for(s.sourceIndex+=4,d=o;d;--d)s.dest[s.destLen++]=s.source[s.sourceIndex++];return s.bitcount=0,y}function Z(s,o){var u=new k(s,o),d,f,m;do{switch(d=$e(u),f=qe(u,2,0),f){case 0:m=we(u);break;case 1:m=K(u,E,I);break;case 2:Re(u,u.ltree,u.dtree),m=K(u,u.ltree,u.dtree);break;default:m=A}if(m!==y)throw new Error("Data error")}while(!d);return u.destLen<u.dest.length?typeof u.dest.slice=="function"?u.dest.slice(0,u.destLen):u.dest.subarray(0,u.destLen):u.dest}ze(E,I),ee(M,B,4,3),ee(F,U,2,1),M[28]=0,B[28]=258;function Ue(s,o,u,d,f){return Math.pow(1-f,3)*s+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*u+Math.pow(f,3)*d}function Le(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Le.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Le.prototype.addPoint=function(s,o){typeof s=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=s,this.x2=s),s<this.x1&&(this.x1=s),s>this.x2&&(this.x2=s)),typeof o=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=o,this.y2=o),o<this.y1&&(this.y1=o),o>this.y2&&(this.y2=o))},Le.prototype.addX=function(s){this.addPoint(s,null)},Le.prototype.addY=function(s){this.addPoint(null,s)},Le.prototype.addBezier=function(s,o,u,d,f,m,v,T){let _=[s,o],R=[u,d],N=[f,m],q=[v,T];this.addPoint(s,o),this.addPoint(v,T);for(let V=0;V<=1;V++){let ge=6*_[V]-12*R[V]+6*N[V],ce=-3*_[V]+9*R[V]-9*N[V]+3*q[V],Ce=3*R[V]-3*_[V];if(ce===0){if(ge===0)continue;let _r=-Ce/ge;0<_r&&_r<1&&(V===0&&this.addX(Ue(_[V],R[V],N[V],q[V],_r)),V===1&&this.addY(Ue(_[V],R[V],N[V],q[V],_r)));continue}let it=Math.pow(ge,2)-4*Ce*ce;if(it<0)continue;let pr=(-ge+Math.sqrt(it))/(2*ce);0<pr&&pr<1&&(V===0&&this.addX(Ue(_[V],R[V],N[V],q[V],pr)),V===1&&this.addY(Ue(_[V],R[V],N[V],q[V],pr)));let or=(-ge-Math.sqrt(it))/(2*ce);0<or&&or<1&&(V===0&&this.addX(Ue(_[V],R[V],N[V],q[V],or)),V===1&&this.addY(Ue(_[V],R[V],N[V],q[V],or)))}},Le.prototype.addQuad=function(s,o,u,d,f,m){let v=s+.6666666666666666*(u-s),T=o+2/3*(d-o),_=v+1/3*(f-s),R=T+1/3*(m-o);this.addBezier(s,o,v,T,_,R,f,m)};var Y=Le;function Ee(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var be={};function Me(s,o){let u=Math.floor(s),d=s-u;if(be[o]||(be[o]={}),be[o][d]!==void 0){let m=be[o][d];return u+m}let f=+(Math.round(d+"e+"+o)+"e-"+o);return be[o][d]=f,u+f}function Ze(s){let o=[[]],u=0,d=0;for(let f=0;f<s.length;f+=1){let m=o[o.length-1],v=s[f],T=m[0],_=m[1],R=m[m.length-1],N=s[f+1];m.push(v),v.type==="M"?(u=v.x,d=v.y):v.type==="L"&&(!N||N.type==="Z")?Math.abs(v.x-u)>1||Math.abs(v.y-d)>1||m.pop():v.type==="L"&&R&&R.x===v.x&&R.y===v.y?m.pop():v.type==="Z"&&(T&&_&&R&&T.type==="M"&&_.type==="L"&&R.type==="L"&&R.x===T.x&&R.y===T.y&&(m.shift(),m[0].type="M"),f+1<s.length&&o.push([]))}return s=[].concat.apply([],o),s}function Se(s){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},s)}function se(s){return parseInt(s)===s&&(s={decimalPlaces:s,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},s)}Ee.prototype.fromSVG=function(s,o={}){typeof SVGPathElement<"u"&&s instanceof SVGPathElement&&(s=s.getAttribute("d")),o=Se(o),this.commands=[];let u="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",m="-+",v={},T=[""],_=!1;function R(ce){return ce.filter(Ce=>Ce.length).map(Ce=>{let it=parseFloat(Ce);return(o.decimalPlaces||o.decimalPlaces===0)&&(it=Me(it,o.decimalPlaces)),it})}function N(ce){if(!this.commands.length)return ce;let Ce=this.commands[this.commands.length-1];for(let it=0;it<ce.length;it++)ce[it]+=Ce[it&1?"y":"x"];return ce}function q(){if(v.type===void 0)return;let ce=v.type.toUpperCase(),Ce=ce!=="Z"&&v.type.toUpperCase()!==v.type,it=R(T);if(T=[""],!it.length&&ce!=="Z")return;Ce&&ce!=="H"&&ce!=="V"&&(it=N.apply(this,[it]));let pr=this.commands.length&&this.commands[this.commands.length-1].x||0,or=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(ce){case"M":this.moveTo(...it);break;case"L":this.lineTo(...it);break;case"V":for(let _r=0;_r<it.length;_r++){let en=0;Ce&&(en=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(pr,it[_r]+en)}break;case"H":for(let _r=0;_r<it.length;_r++){let en=0;Ce&&(en=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(it[_r]+en,or)}break;case"C":this.bezierCurveTo(...it);break;case"Q":this.quadraticCurveTo(...it);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let _r in this.commands[this.commands.length-1])this.commands[this.commands.length-1][_r]===void 0&&(this.commands[this.commands.length-1][_r]=0)}for(let ce=0;ce<s.length;ce++){let Ce=s.charAt(ce),it=T[T.length-1];if(u.indexOf(Ce)>-1)T[T.length-1]+=Ce;else if(m.indexOf(Ce)>-1)if(!v.type&&!this.commands.length&&(v.type="L"),Ce==="-")!v.type||it.indexOf("-")>0?_=!0:it.length?T.push("-"):T[T.length-1]=Ce;else if(!v.type||it.length>0)_=!0;else continue;else if(d.indexOf(Ce)>-1)v.type?(q.apply(this),v={type:Ce}):v.type=Ce;else{if(f.indexOf(Ce)>-1)throw new Error("Unsupported path command: "+Ce+". Currently supported commands are "+d.split("").join(", ")+".");` ,
62
+ \r\f\v`.indexOf(Ce)>-1?T.push(""):Ce==="."?!v.type||it.indexOf(Ce)>-1?_=!0:T[T.length-1]+=Ce:_=!0}if(_)throw new Error("Unexpected character: "+Ce+" at offset "+ce)}q.apply(this),o.optimize&&(this.commands=Ze(this.commands));let V=o.flipY,ge=o.flipYBase;if(V===!0&&o.flipYBase===void 0){let ce=this.getBoundingBox();ge=ce.y1+ce.y2}for(let ce in this.commands){let Ce=this.commands[ce];for(let it in Ce)["x","x1","x2"].includes(it)?this.commands[ce][it]=o.x+Ce[it]*o.scale:["y","y1","y2"].includes(it)&&(this.commands[ce][it]=o.y+(V?ge-Ce[it]:Ce[it])*o.scale)}return this},Ee.fromSVG=function(s,o){return new Ee().fromSVG(s,o)},Ee.prototype.moveTo=function(s,o){this.commands.push({type:"M",x:s,y:o})},Ee.prototype.lineTo=function(s,o){this.commands.push({type:"L",x:s,y:o})},Ee.prototype.curveTo=Ee.prototype.bezierCurveTo=function(s,o,u,d,f,m){this.commands.push({type:"C",x1:s,y1:o,x2:u,y2:d,x:f,y:m})},Ee.prototype.quadTo=Ee.prototype.quadraticCurveTo=function(s,o,u,d){this.commands.push({type:"Q",x1:s,y1:o,x:u,y:d})},Ee.prototype.close=Ee.prototype.closePath=function(){this.commands.push({type:"Z"})},Ee.prototype.extend=function(s){if(s.commands)s=s.commands;else if(s instanceof Y){let o=s;this.moveTo(o.x1,o.y1),this.lineTo(o.x2,o.y1),this.lineTo(o.x2,o.y2),this.lineTo(o.x1,o.y2),this.close();return}Array.prototype.push.apply(this.commands,s)},Ee.prototype.getBoundingBox=function(){let s=new Y,o=0,u=0,d=0,f=0;for(let m=0;m<this.commands.length;m++){let v=this.commands[m];switch(v.type){case"M":s.addPoint(v.x,v.y),o=d=v.x,u=f=v.y;break;case"L":s.addPoint(v.x,v.y),d=v.x,f=v.y;break;case"Q":s.addQuad(d,f,v.x1,v.y1,v.x,v.y),d=v.x,f=v.y;break;case"C":s.addBezier(d,f,v.x1,v.y1,v.x2,v.y2,v.x,v.y),d=v.x,f=v.y;break;case"Z":d=o,f=u;break;default:throw new Error("Unexpected path command "+v.type)}}return s.isEmpty()&&s.addPoint(0,0),s},Ee.prototype.draw=function(s){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],s);return}let u=this._image;if(u){s.drawImage(u.image,u.x,u.y,u.width,u.height);return}s.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?s.moveTo(f.x,f.y):f.type==="L"?s.lineTo(f.x,f.y):f.type==="C"?s.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?s.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&s.closePath()}this.fill&&(s.fillStyle=this.fill,s.fill()),this.stroke&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeWidth,s.stroke())},Ee.prototype.toPathData=function(s){s=se(s);function o(T){let _=Me(T,s.decimalPlaces);return Math.round(T)===_?""+_:_.toFixed(s.decimalPlaces)}function u(){let T="";for(let _=0;_<arguments.length;_+=1){let R=arguments[_];R>=0&&_>0&&(T+=" "),T+=o(R)}return T}let d=this.commands;s.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=Ze(d));let f=s.flipY,m=s.flipYBase;if(f===!0&&m===void 0){let T=new Ee;T.extend(d);let _=T.getBoundingBox();m=_.y1+_.y2}let v="";for(let T=0;T<d.length;T+=1){let _=d[T];_.type==="M"?v+="M"+u(_.x,f?m-_.y:_.y):_.type==="L"?v+="L"+u(_.x,f?m-_.y:_.y):_.type==="C"?v+="C"+u(_.x1,f?m-_.y1:_.y1,_.x2,f?m-_.y2:_.y2,_.x,f?m-_.y:_.y):_.type==="Q"?v+="Q"+u(_.x1,f?m-_.y1:_.y1,_.x,f?m-_.y:_.y):_.type==="Z"&&(v+="Z")}return v},Ee.prototype.toSVG=function(s,o){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),o||(o=this.toPathData(s));let u='<path d="';return u+=o,u+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u+=' fill="none"':u+=' fill="'+this.fill+'"'),this.stroke&&(u+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),u+="/>",u},Ee.prototype.toDOMElement=function(s,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(s));let u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u.setAttribute("fill","none"):u.setAttribute("fill",this.fill)),this.stroke&&(u.setAttribute("stroke",this.stroke),u.setAttribute("stroke-width",this.strokeWidth)),u};var Ye=Ee;function pt(s){throw new Error(s)}function rt(s,o){s||pt(o)}var ye={fail:pt,argument:rt,assert:rt},et=32768,ht=2147483648,te=-32768,ve=32767+1/65536,ct={},re={},me={};function je(s){return function(){return s}}re.BYTE=function(s){return ye.argument(s>=0&&s<=255,"Byte value should be between 0 and 255."),[s]},me.BYTE=je(1),re.CHAR=function(s){return[s.charCodeAt(0)]},me.CHAR=je(1),re.CHARARRAY=function(s){(s===null||typeof s>"u")&&(s="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));let o=[];for(let u=0;u<s.length;u+=1)o[u]=s.charCodeAt(u);return o},me.CHARARRAY=function(s){return typeof s>"u"?0:s.length},re.USHORT=function(s){return[s>>8&255,s&255]},me.USHORT=je(2),re.SHORT=function(s){return s>=et&&(s=-(2*et-s)),[s>>8&255,s&255]},me.SHORT=je(2),re.UINT24=function(s){return[s>>16&255,s>>8&255,s&255]},me.UINT24=je(3),re.ULONG=function(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]},me.ULONG=je(4),re.LONG=function(s){return s>=ht&&(s=-(2*ht-s)),[s>>24&255,s>>16&255,s>>8&255,s&255]},me.LONG=je(4),re.FLOAT=function(s){if(s>ve||s<te)throw new Error(`Value ${s} is outside the range of representable values in 16.16 format`);let o=Math.round(s*65536)<<0;return re.ULONG(o)},me.FLOAT=me.ULONG,re.FIXED=re.ULONG,me.FIXED=me.ULONG,re.FWORD=re.SHORT,me.FWORD=me.SHORT,re.UFWORD=re.USHORT,me.UFWORD=me.USHORT,re.F2DOT14=function(s){return re.USHORT(s*16384)},me.F2DOT14=me.USHORT,re.LONGDATETIME=function(s){return[0,0,0,0,s>>24&255,s>>16&255,s>>8&255,s&255]},me.LONGDATETIME=je(8),re.TAG=function(s){return ye.argument(s.length===4,"Tag should be exactly 4 ASCII characters."),[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]},me.TAG=je(4),re.Card8=re.BYTE,me.Card8=me.BYTE,re.Card16=re.USHORT,me.Card16=me.USHORT,re.OffSize=re.BYTE,me.OffSize=me.BYTE,re.SID=re.USHORT,me.SID=me.USHORT,re.NUMBER=function(s){return s>=-107&&s<=107?[s+139]:s>=108&&s<=1131?(s=s-108,[(s>>8)+247,s&255]):s>=-1131&&s<=-108?(s=-s-108,[(s>>8)+251,s&255]):s>=-32768&&s<=32767?re.NUMBER16(s):re.NUMBER32(s)},me.NUMBER=function(s){return re.NUMBER(s).length},re.NUMBER16=function(s){return[28,s>>8&255,s&255]},me.NUMBER16=je(3),re.NUMBER32=function(s){return[29,s>>24&255,s>>16&255,s>>8&255,s&255]},me.NUMBER32=je(5),re.REAL=function(s){let o=s.toString(),u=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(u){let m=parseFloat("1e"+((u[2]?+u[2]:0)+u[1].length));o=(Math.round(s*m)/m).toString()}let d="";for(let m=0,v=o.length;m<v;m+=1){let T=o[m];T==="e"?d+=o[++m]==="-"?"c":"b":T==="."?d+="a":T==="-"?d+="e":d+=T}d+=d.length&1?"f":"ff";let f=[30];for(let m=0,v=d.length;m<v;m+=2)f.push(parseInt(d.substr(m,2),16));return f},me.REAL=function(s){return re.REAL(s).length},re.NAME=re.CHARARRAY,me.NAME=me.CHARARRAY,re.STRING=re.CHARARRAY,me.STRING=me.CHARARRAY,ct.UTF8=function(s,o,u){let d=[],f=u;for(let m=0;m<f;m++,o+=1)d[m]=s.getUint8(o);return String.fromCharCode.apply(null,d)},ct.UTF16=function(s,o,u){let d=[],f=u/2;for(let m=0;m<f;m++,o+=2)d[m]=s.getUint16(o);return String.fromCharCode.apply(null,d)},re.UTF16=function(s){let o=[];for(let u=0;u<s.length;u+=1){let d=s.charCodeAt(u);o[o.length]=d>>8&255,o[o.length]=d&255}return o},me.UTF16=function(s){return s.length*2};var mt={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};ct.MACSTRING=function(s,o,u,d){let f=mt[d];if(f===void 0)return;let m="";for(let v=0;v<u;v++){let T=s.getUint8(o+v);T<=127?m+=String.fromCharCode(T):m+=f[T&127]}return m};var ae=typeof WeakMap=="function"&&new WeakMap,De,gt=function(s){if(!De){De={};for(let f in mt)De[f]=new String(f)}let o=De[s];if(o===void 0)return;if(ae){let f=ae.get(o);if(f!==void 0)return f}let u=mt[s];if(u===void 0)return;let d={};for(let f=0;f<u.length;f++)d[u.charCodeAt(f)]=f+128;return ae&&ae.set(o,d),d};re.MACSTRING=function(s,o){let u=gt(o);if(u===void 0)return;let d=[];for(let f=0;f<s.length;f++){let m=s.charCodeAt(f);if(m>=128&&(m=u[m],m===void 0))return;d[f]=m}return d},me.MACSTRING=function(s,o){let u=re.MACSTRING(s,o);return u!==void 0?u.length:0};function ft(s){return s>=-128&&s<=127}function kt(s,o,u){let d=0,f=s.length;for(;o<f&&d<64&&s[o]===0;)++o,++d;return u.push(128|d-1),o}function Dt(s,o,u){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let v=s[m];if(!ft(v)||v===0&&m+1<f&&s[m+1]===0)break;++m,++d}u.push(d-1);for(let v=o;v<m;++v)u.push(s[v]+256&255);return m}function Yt(s,o,u){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let v=s[m];if(v===0||ft(v)&&m+1<f&&ft(s[m+1]))break;++m,++d}u.push(64|d-1);for(let v=o;v<m;++v){let T=s[v];u.push(T+65536>>8&255,T+256&255)}return m}re.VARDELTAS=function(s){let o=0,u=[];for(;o<s.length;){let d=s[o];d===0?o=kt(s,o,u):d>=-128&&d<=127?o=Dt(s,o,u):o=Yt(s,o,u)}return u},re.INDEX=function(s){let o=1,u=[o],d=[];for(let T=0;T<s.length;T+=1){let _=re.OBJECT(s[T]);Array.prototype.push.apply(d,_),o+=_.length,u.push(o)}if(d.length===0)return[0,0];let f=[],m=1+Math.floor(Math.log(o)/Math.log(2))/8|0,v=[void 0,re.BYTE,re.USHORT,re.UINT24,re.ULONG][m];for(let T=0;T<u.length;T+=1){let _=v(u[T]);Array.prototype.push.apply(f,_)}return Array.prototype.concat(re.Card16(s.length),re.OffSize(m),f,d)},me.INDEX=function(s){return re.INDEX(s).length},re.DICT=function(s){let o=[],u=Object.keys(s),d=u.length;for(let f=0;f<d;f+=1){let m=parseInt(u[f],0),v=s[m],T=re.OPERAND(v.value,v.type),_=re.OPERATOR(m);for(let R=0;R<T.length;R++)o.push(T[R]);for(let R=0;R<_.length;R++)o.push(_[R])}return o},me.DICT=function(s){return re.DICT(s).length},re.OPERATOR=function(s){return s<1200?[s]:[12,s-1200]},re.OPERAND=function(s,o){let u=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){ye.argument(s.length===o.length,"Not enough arguments given for type"+o);let f=re.OPERAND(s[d],o[d]);for(let m=0;m<f.length;m++)u.push(f[m])}else if(o==="SID"){let d=re.NUMBER(s);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="offset"){let d=re.NUMBER32(s);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="number"){let d=re.NUMBER(s);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="real"){let d=re.REAL(s);for(let f=0;f<d.length;f++)u.push(d[f])}else throw new Error("Unknown operand type "+o);return u},re.OP=re.BYTE,me.OP=me.BYTE;var xr=typeof WeakMap=="function"&&new WeakMap;re.CHARSTRING=function(s){if(xr){let d=xr.get(s);if(d!==void 0)return d}let o=[],u=s.length;for(let d=0;d<u;d+=1){let f=s[d],m=re[f.type](f.value);for(let v=0;v<m.length;v++)o.push(m[v])}return xr&&xr.set(s,o),o},me.CHARSTRING=function(s){return re.CHARSTRING(s).length},re.OBJECT=function(s){let o=re[s.type];return ye.argument(o!==void 0,"No encoding function for type "+s.type),o(s.value)},me.OBJECT=function(s){let o=me[s.type];return ye.argument(o!==void 0,"No sizeOf function for type "+s.type),o(s.value)},re.TABLE=function(s){let o=[],u=(s.fields||[]).length,d=[],f=[];for(let m=0;m<u;m+=1){let v=s.fields[m],T=re[v.type];ye.argument(T!==void 0,"No encoding function for field type "+v.type+" ("+v.name+")");let _=s[v.name];_===void 0&&(_=v.value);let R=T(_);if(v.type==="TABLE")_.fields!==null&&(f.push(o.length),d.push(R)),o.push(0,0);else for(let N=0;N<R.length;N++)o.push(R[N])}for(let m=0;m<d.length;m+=1){let v=f[m],T=o.length;ye.argument(T<65536,"Table "+s.tableName+" too big."),o[v]=T>>8,o[v+1]=T&255;for(let _=0;_<d[m].length;_++)o.push(d[m][_])}return o},me.TABLE=function(s){let o=0,u=(s.fields||[]).length;for(let d=0;d<u;d+=1){let f=s.fields[d],m=me[f.type];ye.argument(m!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let v=s[f.name];v===void 0&&(v=f.value),o+=m(v),f.type==="TABLE"&&(o+=2)}return o},re.RECORD=re.TABLE,me.RECORD=me.TABLE,re.LITERAL=function(s){return s},me.LITERAL=function(s){return s.length};function rr(s,o,u){if(o&&o.length)for(let d=0;d<o.length;d+=1){let f=o[d];this[f.name]=f.value}if(this.tableName=s,this.fields=o,u){let d=Object.keys(u);for(let f=0;f<d.length;f+=1){let m=d[f],v=u[m];this[m]!==void 0&&(this[m]=v)}}}rr.prototype.encode=function(){return re.TABLE(this)},rr.prototype.sizeOf=function(){return me.TABLE(this)};function Ir(s,o,u){u===void 0&&(u=o.length);let d=new Array(o.length+1);d[0]={name:s+"Count",type:"USHORT",value:u};for(let f=0;f<o.length;f++)d[f+1]={name:s+f,type:"USHORT",value:o[f]};return d}function ne(s,o,u){let d=o.length,f=new Array(d+1);f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f[m+1]={name:s+m,type:"TABLE",value:u(o[m],m)};return f}function Ne(s,o,u){let d=o.length,f=[];f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f=f.concat(u(o[m],m));return f}function tt(s){s.format===1?rr.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Ir("glyph",s.glyphs))):s.format===2?rr.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Ne("rangeRecord",s.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"startCoverageIndex"+u,type:"USHORT",value:o.index}]}))):ye.assert(!1,"Coverage format must be 1 or 2.")}tt.prototype=Object.create(rr.prototype),tt.prototype.constructor=tt;function jt(s){rr.call(this,"scriptListTable",Ne("scriptRecord",s,function(o,u){let d=o.script,f=d.defaultLangSys;return ye.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+u,type:"TAG",value:o.tag},{name:"script"+u,type:"TABLE",value:new rr("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new rr("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(Ir("featureIndex",f.featureIndexes)))}].concat(Ne("langSys",d.langSysRecords,function(m,v){let T=m.langSys;return[{name:"langSysTag"+v,type:"TAG",value:m.tag},{name:"langSys"+v,type:"TABLE",value:new rr("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:T.reqFeatureIndex}].concat(Ir("featureIndex",T.featureIndexes)))}]})))}]}))}jt.prototype=Object.create(rr.prototype),jt.prototype.constructor=jt;function Et(s){rr.call(this,"featureListTable",Ne("featureRecord",s,function(o,u){let d=o.feature;return[{name:"featureTag"+u,type:"TAG",value:o.tag},{name:"feature"+u,type:"TABLE",value:new rr("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Ir("lookupListIndex",d.lookupListIndexes)))}]}))}Et.prototype=Object.create(rr.prototype),Et.prototype.constructor=Et;function dr(s,o){rr.call(this,"lookupListTable",ne("lookup",s,function(u){let d=o[u.lookupType];return ye.assert(!!d,"Unable to write GSUB lookup type "+u.lookupType+" tables."),new rr("lookupTable",[{name:"lookupType",type:"USHORT",value:u.lookupType},{name:"lookupFlag",type:"USHORT",value:u.lookupFlag}].concat(ne("subtable",u.subtables,d)))}))}dr.prototype=Object.create(rr.prototype),dr.prototype.constructor=dr;function Jt(s){s.format===1?rr.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:s.startGlyph}].concat(Ir("glyph",s.classes))):s.format===2?rr.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Ne("rangeRecord",s.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"class"+u,type:"USHORT",value:o.classId}]}))):ye.assert(!1,"Class format must be 1 or 2.")}Jt.prototype=Object.create(rr.prototype),Jt.prototype.constructor=Jt;var We={Table:rr,Record:rr,Coverage:tt,ClassDef:Jt,ScriptList:jt,FeatureList:Et,LookupList:dr,ushortList:Ir,tableList:ne,recordList:Ne};function Lr(s,o){return s.getUint8(o)}function Xe(s,o){return s.getUint16(o,!1)}function Pt(s,o){return s.getInt16(o,!1)}function Ge(s,o){return(s.getUint16(o)<<8)+s.getUint8(o+2)}function It(s,o){return s.getUint32(o,!1)}function cn(s,o){return s.getInt32(o,!1)}function Lt(s,o){let u=s.getInt16(o,!1),d=s.getUint16(o+2,!1);return u+d/65535}function Vr(s,o){let u="";for(let d=o;d<o+4;d+=1)u+=String.fromCharCode(s.getInt8(d));return u}function ut(s,o,u){let d=0;for(let f=0;f<u;f+=1)d<<=8,d+=s.getUint8(o+f);return d}function fn(s,o,u){let d=[];for(let f=o;f<u;f+=1)d.push(s.getUint8(f));return d}function Sr(s){let o="";for(let u=0;u<s.length;u+=1)o+=String.fromCharCode(s[u]);return o}var Pr={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},br={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767,SHARED_POINT_NUMBERS:32768,COUNT_MASK:4095,EMBEDDED_PEAK_TUPLE:32768,INTERMEDIATE_REGION:16384,PRIVATE_POINT_NUMBERS:8192,TUPLE_INDEX_MASK:4095,POINTS_ARE_WORDS:128,POINT_RUN_COUNT_MASK:127,DELTAS_ARE_ZERO:128,DELTAS_ARE_WORDS:64,DELTA_RUN_COUNT_MASK:63,INNER_INDEX_BIT_COUNT_MASK:15,MAP_ENTRY_SIZE_MASK:48};function pe(s,o){this.data=s,this.offset=o,this.relativeOffset=0}pe.prototype.parseByte=function(){let s=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},pe.prototype.parseChar=function(){let s=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},pe.prototype.parseCard8=pe.prototype.parseByte,pe.prototype.parseUShort=function(){let s=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},pe.prototype.parseCard16=pe.prototype.parseUShort,pe.prototype.parseSID=pe.prototype.parseUShort,pe.prototype.parseOffset16=pe.prototype.parseUShort,pe.prototype.parseShort=function(){let s=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},pe.prototype.parseF2Dot14=function(){let s=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,s},pe.prototype.parseUInt24=function(){let s=Ge(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,s},pe.prototype.parseULong=function(){let s=It(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},pe.prototype.parseLong=function(){let s=cn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},pe.prototype.parseOffset32=pe.prototype.parseULong,pe.prototype.parseFixed=function(){let s=Lt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},pe.prototype.parseString=function(s){let o=this.data,u=this.offset+this.relativeOffset,d="";this.relativeOffset+=s;for(let f=0;f<s;f++)d+=String.fromCharCode(o.getUint8(u+f));return d},pe.prototype.parseTag=function(){return this.parseString(4)},pe.prototype.parseLongDateTime=function(){let s=It(this.data,this.offset+this.relativeOffset+4);return s-=2082844800,this.relativeOffset+=8,s},pe.prototype.parseVersion=function(s){let o=Xe(this.data,this.offset+this.relativeOffset),u=Xe(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,s===void 0&&(s=4096),o+u/s/10},pe.prototype.skip=function(s,o){o===void 0&&(o=1),this.relativeOffset+=Pr[s]*o},pe.prototype.parseULongList=function(s){s===void 0&&(s=this.parseULong());let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getUint32(d),d+=4;return this.relativeOffset+=s*4,o},pe.prototype.parseOffset16List=pe.prototype.parseUShortList=function(s){s===void 0&&(s=this.parseUShort());let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getUint16(d),d+=2;return this.relativeOffset+=s*2,o},pe.prototype.parseShortList=function(s){let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getInt16(d),d+=2;return this.relativeOffset+=s*2,o},pe.prototype.parseByteList=function(s){let o=new Array(s),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=u.getUint8(d++);return this.relativeOffset+=s,o},pe.prototype.parseList=function(s,o){o||(o=s,s=this.parseUShort());let u=new Array(s);for(let d=0;d<s;d++)u[d]=o.call(this);return u},pe.prototype.parseList32=function(s,o){o||(o=s,s=this.parseULong());let u=new Array(s);for(let d=0;d<s;d++)u[d]=o.call(this);return u},pe.prototype.parseRecordList=function(s,o){o||(o=s,s=this.parseUShort());let u=new Array(s),d=Object.keys(o);for(let f=0;f<s;f++){let m={};for(let v=0;v<d.length;v++){let T=d[v],_=o[T];m[T]=_.call(this)}u[f]=m}return u},pe.prototype.parseRecordList32=function(s,o){o||(o=s,s=this.parseULong());let u=new Array(s),d=Object.keys(o);for(let f=0;f<s;f++){let m={};for(let v=0;v<d.length;v++){let T=d[v],_=o[T];m[T]=_.call(this)}u[f]=m}return u},pe.prototype.parseTupleRecords=function(s,o){let u=[];for(let d=0;d<s;d++){let f=[];for(let m=0;m<o;m++)f.push(this.parseF2Dot14());u.push(f)}return u},pe.prototype.parseStruct=function(s){if(typeof s=="function")return s.call(this);{let o=Object.keys(s),u={};for(let d=0;d<o.length;d++){let f=o[d],m=s[f];u[f]=m.call(this)}return u}},pe.prototype.parseValueRecord=function(s){if(s===void 0&&(s=this.parseUShort()),s===0)return;let o={};return s&1&&(o.xPlacement=this.parseShort()),s&2&&(o.yPlacement=this.parseShort()),s&4&&(o.xAdvance=this.parseShort()),s&8&&(o.yAdvance=this.parseShort()),s&16&&(o.xPlaDevice=void 0,this.parseShort()),s&32&&(o.yPlaDevice=void 0,this.parseShort()),s&64&&(o.xAdvDevice=void 0,this.parseShort()),s&128&&(o.yAdvDevice=void 0,this.parseShort()),o},pe.prototype.parseValueRecordList=function(){let s=this.parseUShort(),o=this.parseUShort(),u=new Array(o);for(let d=0;d<o;d++)u[d]=this.parseValueRecord(s);return u},pe.prototype.parsePointer=function(s){let o=this.parseOffset16();if(o>0)return new pe(this.data,this.offset+o).parseStruct(s)},pe.prototype.parsePointer32=function(s){let o=this.parseOffset32();if(o>0)return new pe(this.data,this.offset+o).parseStruct(s)},pe.prototype.parseListOfLists=function(s){let o=this.parseOffset16List(),u=o.length,d=this.relativeOffset,f=new Array(u);for(let m=0;m<u;m++){let v=o[m];if(v===0){f[m]=void 0;continue}if(this.relativeOffset=v,s){let T=this.parseOffset16List(),_=new Array(T.length);for(let R=0;R<T.length;R++)this.relativeOffset=v+T[R],_[R]=s.call(this);f[m]=_}else f[m]=this.parseUShortList()}return this.relativeOffset=d,f},pe.prototype.parseCoverage=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort(),u=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(u)};if(o===2){let d=new Array(u);for(let f=0;f<u;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+s.toString(16)+": Coverage format must be 1 or 2.")},pe.prototype.parseClassDef=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();return o===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:o===2?{format:2,ranges:this.parseRecordList({start:pe.uShort,end:pe.uShort,classId:pe.uShort})}:(console.warn(`0x${s.toString(16)}: This font file uses an invalid ClassDef format of ${o}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:o})},pe.list=function(s,o){return function(){return this.parseList(s,o)}},pe.list32=function(s,o){return function(){return this.parseList32(s,o)}},pe.recordList=function(s,o){return function(){return this.parseRecordList(s,o)}},pe.recordList32=function(s,o){return function(){return this.parseRecordList32(s,o)}},pe.pointer=function(s){return function(){return this.parsePointer(s)}},pe.pointer32=function(s){return function(){return this.parsePointer32(s)}},pe.tag=pe.prototype.parseTag,pe.byte=pe.prototype.parseByte,pe.uShort=pe.offset16=pe.prototype.parseUShort,pe.uShortList=pe.prototype.parseUShortList,pe.uInt24=pe.prototype.parseUInt24,pe.uLong=pe.offset32=pe.prototype.parseULong,pe.uLongList=pe.prototype.parseULongList,pe.fixed=pe.prototype.parseFixed,pe.f2Dot14=pe.prototype.parseF2Dot14,pe.struct=pe.prototype.parseStruct,pe.coverage=pe.prototype.parseCoverage,pe.classDef=pe.prototype.parseClassDef;var Er={reserved:pe.uShort,reqFeatureIndex:pe.uShort,featureIndexes:pe.uShortList};pe.prototype.parseScriptList=function(){return this.parsePointer(pe.recordList({tag:pe.tag,script:pe.pointer({defaultLangSys:pe.pointer(Er),langSysRecords:pe.recordList({tag:pe.tag,langSys:pe.pointer(Er)})})}))||[]},pe.prototype.parseFeatureList=function(){return this.parsePointer(pe.recordList({tag:pe.tag,feature:pe.pointer({featureParams:pe.offset16,lookupListIndexes:pe.uShortList})}))||[]},pe.prototype.parseLookupList=function(s){return this.parsePointer(pe.list(pe.pointer(function(){let o=this.parseUShort();ye.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let u=this.parseUShort(),d=u&16;return{lookupType:o,lookupFlag:u,subtables:this.parseList(pe.pointer(s[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},pe.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let s=this.parseUShort(),o=this.parseUShort();return ye.argument(s===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:pe.offset32,featureTableSubstitutionOffset:pe.offset32})})||[]},pe.prototype.parseVariationStore=function(){let s=this.relativeOffset,o=this.parseUShort(),u={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=s+o+2,u},pe.prototype.parseItemVariationStore=function(){let s=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},u=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=s+u,o.variationRegions=this.parseVariationRegionList();for(let m=0;m<d;m++){let v=f[m];this.relativeOffset=s+v,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},pe.prototype.parseVariationRegionList=function(){let s=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:pe.recordList(s,{startCoord:pe.f2Dot14,peakCoord:pe.f2Dot14,endCoord:pe.f2Dot14})})},pe.prototype.parseItemVariationSubtable=function(){let s=this.parseUShort(),o=this.parseUShort(),u=this.parseUShortList(),d=u.length;return{regionIndexes:u,deltaSets:s&&d?this.parseDeltaSets(s,o,d):[]}},pe.prototype.parseDeltaSetIndexMap=function(){let s=this.parseByte(),o=this.parseByte(),u=[],d=0;switch(s){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${s}`)}if(!d)return{format:s,entryFormat:o};let f=(o&br.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&br.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let v=0;v<d;v++){let T;if(m===1)T=this.parseByte();else if(m===2)T=this.parseUShort();else if(m===3)T=this.parseUInt24();else if(m===4)T=this.parseULong();else throw new Error(`Invalid entry size of ${m}`);let _=T>>f,R=T&(1<<f)-1;u.push({outerIndex:_,innerIndex:R})}return{format:s,entryFormat:o,map:u}},pe.prototype.parseDeltaSets=function(s,o,u){let d=Array.from({length:s},()=>[]),f=o&br.LONG_WORDS,m=o&br.WORD_DELTA_COUNT_MASK;if(m>u)throw Error("wordCount must be less than or equal to regionIndexCount");let v=(f?this.parseLong:this.parseShort).bind(this),T=(f?this.parseShort:this.parseChar).bind(this);for(let _=0;_<s;_++)for(let R=0;R<u;R++)R<m?d[_].push(v()):d[_].push(T());return d},pe.prototype.parseTupleVariationStoreList=function(s,o,u){let d=this.parseUShort(),f=this.parseUShort()&1,m=this.parseOffset32(),v=(f?this.parseULong:this.parseUShort).bind(this),T={},_=v();f||(_*=2);let R;for(let N=0;N<d;N++){R=v(),f||(R*=2);let q=R-_;T[N]=q?this.parseTupleVariationStore(m+_,s,o,u,N):void 0,_=R}return T},pe.prototype.parseTupleVariationStore=function(s,o,u,d,f){let m=this.relativeOffset;this.relativeOffset=s,u==="cvar"&&(this.relativeOffset+=4);let v=this.parseUShort(),T=!!(v&br.SHARED_POINT_NUMBERS),_=v&br.COUNT_MASK,R=this.parseOffset16(),N=[],q=[];for(let ce=0;ce<_;ce++){let Ce=this.parseTupleVariationHeader(o,u);N.push(Ce)}this.relativeOffset!==s+R&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${s+R}, actually ${this.relativeOffset}`),this.relativeOffset=s+R),T&&(q=this.parsePackedPointNumbers());let V=this.relativeOffset;for(let ce=0;ce<_;ce++){let Ce=N[ce];Ce.privatePoints=[],this.relativeOffset=V,u==="cvar"&&!Ce.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),Ce.flags.privatePointNumbers&&(Ce.privatePoints=this.parsePackedPointNumbers()),delete Ce.flags;let it=this.offset,pr=this.relativeOffset,or=_r=>{let en,Fn,Vn=()=>{let qn=0;if(u==="gvar"){if(qn=Ce.privatePoints.length||q.length,!qn){let Ns=d.get(f);Ns.path,qn=Ns.points.length,qn+=4}}else u==="cvar"&&(qn=d.length);this.offset=it,this.relativeOffset=pr,en=this.parsePackedDeltas(qn),u==="gvar"&&(Fn=this.parsePackedDeltas(qn))};return{configurable:!0,get:function(){return en===void 0&&Vn(),_r==="deltasY"?Fn:en},set:function(qn){en===void 0&&Vn(),_r==="deltasY"?Fn=qn:en=qn}}};Object.defineProperty(Ce,"deltas",or.call(this,"deltas")),u==="gvar"&&Object.defineProperty(Ce,"deltasY",or.call(this,"deltasY")),V+=Ce.variationDataSize,delete Ce.variationDataSize}this.relativeOffset=m;let ge={headers:N};return ge.sharedPoints=q,ge},pe.prototype.parseTupleVariationHeader=function(s,o){let u=this.parseUShort(),d=this.parseUShort(),f=!!(d&br.EMBEDDED_PEAK_TUPLE),m=!!(d&br.INTERMEDIATE_REGION),v=!!(d&br.PRIVATE_POINT_NUMBERS),T=f?void 0:d&br.TUPLE_INDEX_MASK,_=f?this.parseTupleRecords(1,s)[0]:void 0,R=m?this.parseTupleRecords(1,s)[0]:void 0,N=m?this.parseTupleRecords(1,s)[0]:void 0,q={variationDataSize:u,peakTuple:_,intermediateStartTuple:R,intermediateEndTuple:N,flags:{embeddedPeakTuple:f,intermediateRegion:m,privatePointNumbers:v}};return o==="gvar"&&(q.sharedTupleRecordsIndex=T),q},pe.prototype.parsePackedPointNumbers=function(){let s=this.parseByte(),o=[],u=s;if(s>=128){let f=this.parseByte();u=(s&br.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<u;){let f=this.parseByte(),m=!!(f&br.POINTS_ARE_WORDS),v=(f&br.POINT_RUN_COUNT_MASK)+1;for(let T=0;T<v&&o.length<u;T++){let _;m?_=this.parseUShort():_=this.parseByte(),d=d+_,o.push(d)}}return o},pe.prototype.parsePackedDeltas=function(s){let o=[];for(;o.length<s;){let u=this.parseByte(),d=!!(u&br.DELTAS_ARE_ZERO),f=!!(u&br.DELTAS_ARE_WORDS),m=(u&br.DELTA_RUN_COUNT_MASK)+1;for(let v=0;v<m&&o.length<s;v++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var fe={getByte:Lr,getCard8:Lr,getUShort:Xe,getCard16:Xe,getShort:Pt,getUInt24:Ge,getULong:It,getFixed:Lt,getTag:Vr,getOffset:ut,getBytes:fn,bytesToString:Sr,Parser:pe},Ve=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],nr={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},an={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Nr={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Ar(s,o,u){switch(s){case 0:if(o===65535)return"und";if(u)return u[o];break;case 1:return nr[o];case 3:return Nr[o]}}var Bt="utf-16",Rr={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},fs={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Xr(s,o,u){switch(s){case 0:return Bt;case 1:return fs[u]||Rr[o];case 3:if(o===1||o===10)return Bt;break}}var pn={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function mn(s){return pn[s]}function An(s,o,u){let d={},f=new fe.Parser(s,o),m=f.parseUShort(),v=f.parseUShort(),T=f.offset+f.parseUShort();for(let _=0;_<v;_++){let R=f.parseUShort(),N=f.parseUShort(),q=f.parseUShort(),V=f.parseUShort(),ge=Ve[V]||V,ce=f.parseUShort(),Ce=f.parseUShort(),it=Ar(R,q,u),pr=Xr(R,N,q),or=mn(R);if(pr!==void 0&&it!==void 0&&or!==void 0){let _r;if(pr===Bt?_r=ct.UTF16(s,T+Ce,ce):_r=ct.MACSTRING(s,T+Ce,ce,pr),_r){let en=d[or];en===void 0&&(en=d[or]={});let Fn=en[ge];Fn===void 0&&(Fn=en[ge]={}),Fn[it]=_r}}}return m===1&&f.parseUShort(),d}function Rn(s){let o={};for(let u in s)o[s[u]]=parseInt(u);return o}function dn(s,o,u,d,f,m){return new We.Record("NameRecord",[{name:"platformID",type:"USHORT",value:s},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:u},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:m}])}function Mn(s,o){let u=s.length,d=o.length-u+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let m=0;m<u;m++)if(o[f+m]!==s[m])continue e;return f}return-1}function bn(s,o){let u=Mn(s,o);if(u<0){u=o.length;let d=0,f=s.length;for(;d<f;++d)o.push(s[d])}return u}function _n(s,o){let u=Rn(pn),d=Rn(nr),f=Rn(Nr),m=[],v=[];for(let _ in s){let R,N=[],q={},V=Rn(Ve),ge=u[_];for(let ce in s[_]){let Ce=V[ce];if(Ce===void 0&&(Ce=ce),R=parseInt(Ce),isNaN(R))throw new Error('Name table entry "'+ce+'" does not exist, see nameTableNames for complete list.');q[R]=s[_][ce],N.push(R)}for(let ce=0;ce<N.length;ce++){R=N[ce];let Ce=q[R];for(let it in Ce){let pr=Ce[it];if(ge===1||ge===0){let or=d[it],_r=an[or],en=Xr(ge,_r,or),Fn=re.MACSTRING(pr,en);if(ge===0&&(or=o.indexOf(it),or<0&&(or=o.length,o.push(it)),_r=4,Fn=re.UTF16(pr)),Fn!==void 0){let Vn=bn(Fn,v);m.push(dn(ge,_r,or,R,Fn.length,Vn))}}if(ge===3){let or=f[it];if(or!==void 0){let _r=re.UTF16(pr),en=bn(_r,v);m.push(dn(3,1,or,R,_r.length,en))}}}}}m.sort(function(_,R){return _.platformID-R.platformID||_.encodingID-R.encodingID||_.languageID-R.languageID||_.nameID-R.nameID});let T=new We.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:m.length},{name:"stringOffset",type:"USHORT",value:6+m.length*12}]);for(let _=0;_<m.length;_++)T.fields.push({name:"record_"+_,type:"RECORD",value:m[_]});return T.fields.push({name:"strings",type:"LITERAL",value:v}),T}function Dn(s,o,u=[]){if(o<256&&o in Ve){if(u.length&&!u.includes(parseInt(o)))return;o=Ve[o]}for(let d in s)for(let f in s[d])if(f===o||parseInt(f)===o)return s[d][f]}var kn={parse:An,make:_n,getNameByID:Dn};function $r(s,o,u,d){s.length=o.parseUShort(),s.language=o.parseUShort()-1;let f=o.parseByteList(s.length),m=Object.assign({},f),v=Xr(u,d,s.language),T=mt[v];for(let _=0;_<T.length;_++)m[T.charCodeAt(_)]=f[128+_];s.glyphIndexMap=m}function Ts(s,o,u){o.parseUShort(),s.length=o.parseULong(),s.language=o.parseULong();let d;s.groupCount=d=o.parseULong(),s.glyphIndexMap={};for(let f=0;f<d;f+=1){let m=o.parseULong(),v=o.parseULong(),T=o.parseULong();for(let _=m;_<=v;_+=1)s.glyphIndexMap[_]=T,u===12&&T++}}function er(s,o,u,d,f){s.length=o.parseUShort(),s.language=o.parseUShort();let m;s.segCount=m=o.parseUShort()>>1,o.skip("uShort",3),s.glyphIndexMap={};let v=new fe.Parser(u,d+f+14),T=new fe.Parser(u,d+f+16+m*2),_=new fe.Parser(u,d+f+16+m*4),R=new fe.Parser(u,d+f+16+m*6),N=d+f+16+m*8;for(let q=0;q<m-1;q+=1){let V,ge=v.parseUShort(),ce=T.parseUShort(),Ce=_.parseShort(),it=R.parseUShort();for(let pr=ce;pr<=ge;pr+=1)it!==0?(N=R.offset+R.relativeOffset-2,N+=it,N+=(pr-ce)*2,V=fe.getUShort(u,N),V!==0&&(V=V+Ce&65535)):V=pr+Ce&65535,s.glyphIndexMap[pr]=V}}function qr(s,o){let u={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let m=o.parseUInt24(),v={varSelector:m},T=o.parseOffset32(),_=o.parseOffset32(),R=o.relativeOffset;T&&(o.relativeOffset=T,v.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),_&&(o.relativeOffset=_,v.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let N={},q=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let V=0;V<q.length;V+=1)N[q[V].unicodeValue]=q[V];return N}})),u[m]=v,o.relativeOffset=R}s.varSelectorList=u}function Qn(s,o){let u={};u.version=fe.getUShort(s,o),ye.argument(u.version===0,"cmap table version should be 0."),u.numTables=fe.getUShort(s,o+2);let d=null,f=-1,m=-1,v=null,T=null,_=[0,1,2,3,4,6],R=[0,1,10];for(let q=u.numTables-1;q>=0;q-=1)if(v=fe.getUShort(s,o+4+q*8),T=fe.getUShort(s,o+4+q*8+2),v===3&&R.includes(T)||v===0&&_.includes(T)||v===1&&T===0){if(m>0)continue;if(m=fe.getULong(s,o+4+q*8+4),d)break}else if(v===0&&T===5){if(f=fe.getULong(s,o+4+q*8+4),d=new fe.Parser(s,o+f),d.parseUShort()!==14)f=-1,d=null;else if(m>0)break}if(m===-1)throw new Error("No valid cmap sub-tables found.");let N=new fe.Parser(s,o+m);if(u.format=N.parseUShort(),u.format===0)$r(u,N,v,T);else if(u.format===12||u.format===13)Ts(u,N,u.format);else if(u.format===4)er(u,N,s,o,m);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+u.format+", platformId "+v+", encodingId "+T+").");return d&&qr(u,d),u}function Tn(s,o,u){s.segments.push({end:o,start:o,delta:-(o-u),offset:0,glyphIndex:u})}function Yr(s){s.segments.push({end:65535,start:65535,delta:1,offset:0})}function jr(s){if(s.length===0)return s;let o=[s[0]];for(let u=1;u<s.length;u++){let d=o[o.length-1],f=s[u];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function rn(s){let o=!0,u;for(u=s.length-1;u>0;u-=1)if(s.get(u).unicode>65535){o=!1;break}let d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:o?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:o?12:20}];o||d.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),d.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});let f=new We.Table("cmap",d);for(f.segments=[],u=0;u<s.length;u+=1){let ge=s.get(u);for(let ce=0;ce<ge.unicodes.length;ce+=1)Tn(f,ge.unicodes[ce],u)}f.segments.sort(function(ge,ce){return ge.start-ce.start}),f.segments=jr(f.segments),Yr(f);let m=f.segments.length,v=0,T=[],_=[],R=[],N=[],q=[],V=[];for(u=0;u<m;u+=1){let ge=f.segments[u];ge.end<=65535&&ge.start<=65535?(T.push({name:"end_"+u,type:"USHORT",value:ge.end}),_.push({name:"start_"+u,type:"USHORT",value:ge.start}),R.push({name:"idDelta_"+u,type:"SHORT",value:ge.delta}),N.push({name:"idRangeOffset_"+u,type:"USHORT",value:ge.offset}),ge.glyphId!==void 0&&q.push({name:"glyph_"+u,type:"USHORT",value:ge.glyphId})):v+=1,!o&&ge.glyphIndex!==void 0&&(V.push({name:"cmap12Start_"+u,type:"ULONG",value:ge.start}),V.push({name:"cmap12End_"+u,type:"ULONG",value:ge.end}),V.push({name:"cmap12Glyph_"+u,type:"ULONG",value:ge.glyphIndex}))}f.segCountX2=(m-v)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(m-v)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let ge=0;ge<T.length;ge++)f.fields.push(T[ge]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let ge=0;ge<_.length;ge++)f.fields.push(_[ge]);for(let ge=0;ge<R.length;ge++)f.fields.push(R[ge]);for(let ge=0;ge<N.length;ge++)f.fields.push(N[ge]);for(let ge=0;ge<q.length;ge++)f.fields.push(q[ge]);if(f.cmap4Length=14+T.length*2+2+_.length*2+R.length*2+N.length*2+q.length*2,!o){let ge=16+V.length*4;f.cmap12Offset=20+f.cmap4Length,f.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:ge},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:V.length/3});for(let ce=0;ce<V.length;ce++)f.fields.push(V[ce])}return f}var Br={parse:Qn,make:rn},W=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Be=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],wt=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],yr=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Rt=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Mr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Dr=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Zr(s){this.font=s}Zr.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),u=this.font.glyphs;if(u)for(let d=0;d<u.length;d+=1){let f=u.get(d);for(let m=0;m<f.unicodes.length;m+=1)if(f.unicodes[m]===o)return d}return null};function nn(s){this.cmap=s}nn.prototype.charToGlyphIndex=function(s){return this.cmap.glyphIndexMap[s.codePointAt(0)]||0};function zn(s,o){this.encoding=s,this.charset=o}zn.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),u=this.encoding[o];return this.charset.indexOf(u)};function jn(s){switch(s.version){case 1:this.names=Dr.slice();break;case 2:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)s.glyphNameIndex[o]<Dr.length?this.names[o]=Dr[s.glyphNameIndex[o]]:this.names[o]=s.names[s.glyphNameIndex[o]-Dr.length];break;case 2.5:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)this.names[o]=Dr[o+s.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}jn.prototype.nameToGlyphIndex=function(s){return this.names.indexOf(s)},jn.prototype.glyphIndexToName=function(s){return this.names[s]};function ss(s){let o,u=s.tables.cmap.glyphIndexMap,d=Object.keys(u);for(let f=0;f<d.length;f+=1){let m=d[f],v=u[m];o=s.glyphs.get(v),o.addUnicode(parseInt(m))}for(let f=0;f<s.glyphs.length;f+=1)o=s.glyphs.get(f),s.cffEncoding?o.name=s.cffEncoding.charset[f]:s.glyphNames.names&&(o.name=s.glyphNames.glyphIndexToName(f))}function $(s){s._IndexToUnicodeMap={};let o=s.tables.cmap.glyphIndexMap,u=Object.keys(o);for(let d=0;d<u.length;d+=1){let f=u[d],m=o[f];s._IndexToUnicodeMap[m]===void 0?s._IndexToUnicodeMap[m]={unicodes:[parseInt(f)]}:s._IndexToUnicodeMap[m].unicodes.push(parseInt(f))}}function Te(s,o){o.lowMemory?$(s):ss(s)}function He(s,o,u,d,f){s.beginPath(),s.moveTo(o,u),s.lineTo(d,f),s.stroke()}var Ke={line:He};function Je(s,o){let u=new pe(s,o),d=u.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=u.parseShort(),m=u.parseShort(),v=u.parseShort(),T=u.parseOffset32(),_=u.parseUShortList(m);u.relativeOffset=T;let R=u.parseULongList(v);return u.relativeOffset=T,{version:d,numPaletteEntries:f,colorRecords:R,colorRecordIndices:_}}function xt({version:s=0,numPaletteEntries:o=0,colorRecords:u=[],colorRecordIndices:d=[0]}){return ye.argument(s===0,"Only CPALv0 are supported."),ye.argument(u.length,"No colorRecords given."),ye.argument(d.length,"No colorRecordIndices given."),d.length>1&&ye.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new We.Table("CPAL",[{name:"version",type:"USHORT",value:s},{name:"numPaletteEntries",type:"USHORT",value:o||u.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:u.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:f})),...u.map((f,m)=>({name:"colorRecords_"+m,type:"ULONG",value:f}))])}function Qt(s){var o=(s&4278190080)>>24,u=(s&16711680)>>16,d=(s&65280)>>8,f=s&255;return o=o+256&255,u=u+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:u,r:d,a:f}}function vt(s,o,u=0,d="hexa"){if(o==65535)return"currentColor";let f=s&&s.tables&&s.tables.cpal;if(!f)return"currentColor";if(u>f.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${f.colorRecordIndices.length}, index: ${o})`);if(o>f.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${f.numPaletteEntries}, index: ${o})`);let m=f.colorRecordIndices[u]+o;if(m>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${m})`);let v=Qt(f.colorRecords[m]);return d==="bgra"?v:Ct(v,d)}function lt(s){return("0"+parseInt(s).toString(16)).slice(-2)}function At(s){let o=s.r/255,u=s.g/255,d=s.b/255,f=Math.max(o,u,d),m=Math.min(o,u,d),v,T,_=(f+m)/2;if(f===m)v=T=0;else{let R=f-m;switch(T=_>.5?R/(2-f-m):R/(f+m),f){case o:v=(u-d)/R+(u<d?6:0);break;case u:v=(d-o)/R+2;break;case d:v=(o-u)/R+4;break}v/=6}return{h:v*360,s:T*100,l:_*100}}function Mt(s){let{h:o,s:u,l:d,a:f}=s;o=o%360,u/=100,d/=100;let m=(1-Math.abs(2*d-1))*u,v=m*(1-Math.abs(o/60%2-1)),T=d-m/2,_=0,R=0,N=0;return 0<=o&&o<60?(_=m,R=v,N=0):60<=o&&o<120?(_=v,R=m,N=0):120<=o&&o<180?(_=0,R=m,N=v):180<=o&&o<240?(_=0,R=v,N=m):240<=o&&o<300?(_=v,R=0,N=m):300<=o&&o<=360&&(_=m,R=0,N=v),{r:Math.round((_+T)*255),g:Math.round((R+T)*255),b:Math.round((N+T)*255),a:f}}function Ot(s){return parseInt(`0x${lt(s.b)}${lt(s.g)}${lt(s.r)}${lt(s.a*255)}`,16)}function dt(s,o="hexa"){let u=o=="raw"||o=="cpal",d=Number.isInteger(s),f=!0;if(d&&u||s==="currentColor")return s;if(typeof s=="object"){if(o=="bgra")return s;if(u)return Ot(s)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(s.trim())){switch(s=s.trim().substring(1),s.length){case 3:s={r:parseInt(s[0].repeat(2),16),g:parseInt(s[1].repeat(2),16),b:parseInt(s[2].repeat(2),16),a:1};break;case 4:s={r:parseInt(s[0].repeat(2),16),g:parseInt(s[1].repeat(2),16),b:parseInt(s[2].repeat(2),16),a:parseInt(s[3].repeat(2),16)/255};break;case 6:s={r:parseInt(s[0]+s[1],16),g:parseInt(s[2]+s[3],16),b:parseInt(s[4]+s[5],16),a:1};break;case 8:s={r:parseInt(s[0]+s[1],16),g:parseInt(s[2]+s[3],16),b:parseInt(s[4]+s[5],16),a:parseInt(s[6]+s[7],16)/255};break}if(o=="bgra")return s}else if(typeof document<"u"&&/^[a-z]+$/i.test(s)){let m=document.createElement("canvas").getContext("2d");m.fillStyle=s;let v=Ct(m.fillStyle,"hexa");v==="#000000ff"&&s.toLowerCase()!=="black"?f=!1:s=v}else{s=s.trim();let m=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(m.test(s)){let v=s.match(m).filter(T=>typeof T<"u");s={r:Math.round(parseFloat(v[1])/(v[2]?.39215686274509803:1)),g:Math.round(parseFloat(v[3])/(v[4]?.39215686274509803:1)),b:Math.round(parseFloat(v[5])/(v[6]?.39215686274509803:1)),a:v[7]?parseFloat(v[7])/(v[8]?100:1):1}}else{let v=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(v.test(s)){let T=s.match(v).filter(_=>typeof _<"u");s=Mt({h:parseFloat(T[1])*(T[2]==="turn"?360:1),s:parseFloat(T[3]),l:parseFloat(T[4]),a:T[5]?parseFloat(T[5])/(T[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${s}`);return Ct(s,o)}function Ct(s,o="hexa"){if(s==="currentColor")return s;if(Number.isInteger(s)){if(o=="raw"||o=="cpal")return s;s=Qt(s)}else typeof s!="object"&&(s=dt(s,"bgra"));let u=["hsl","hsla"].includes(o)?At(s):null;switch(o){case"rgba":return`rgba(${s.r}, ${s.g}, ${s.b}, ${parseFloat(s.a.toFixed(3))})`;case"rgb":return`rgb(${s.r}, ${s.g}, ${s.b})`;case"hex":case"hex6":case"hex-6":return`#${lt(s.r)}${lt(s.g)}${lt(s.b)}`;case"hexa":case"hex8":case"hex-8":return`#${lt(s.r)}${lt(s.g)}${lt(s.b)}${lt(s.a*255)}`;case"hsl":return`hsl(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%)`;case"hsla":return`hsla(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%, ${parseFloat(s.a.toFixed(3))})`;case"bgra":return s;case"raw":case"cpal":return Ot(s);default:throw new Error("Unknown color format: "+o)}}var ar={parse:Je,make:xt,getPaletteColor:vt,parseColor:dt,formatColor:Ct};function cr(s,o){let u=o||new Ye;return{configurable:!0,get:function(){return typeof u=="function"&&(u=u()),u},set:function(d){u=d}}}function $t(s){this.bindConstructorValues(s)}$t.prototype.bindConstructorValues=function(s){if(this.index=s.index||0,s.name===".notdef"?s.unicode=void 0:s.name===".null"&&(s.unicode=0),s.unicode===0&&s.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=s.name||null,this.unicode=s.unicode,this.unicodes=s.unicodes||(s.unicode!==void 0?[s.unicode]:[]),"xMin"in s&&(this.xMin=s.xMin),"yMin"in s&&(this.yMin=s.yMin),"xMax"in s&&(this.xMax=s.xMax),"yMax"in s&&(this.yMax=s.yMax),"advanceWidth"in s&&(this.advanceWidth=s.advanceWidth),"leftSideBearing"in s&&(this.leftSideBearing=s.leftSideBearing),"points"in s&&(this.points=s.points),Object.defineProperty(this,"path",cr(this,s.path))},$t.prototype.addUnicode=function(s){this.unicodes.length===0&&(this.unicode=s),this.unicodes.push(s)},$t.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},$t.prototype.getPath=function(s,o,u,d,f){s=s!==void 0?s:0,o=o!==void 0?o:0,u=u!==void 0?u:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let m,v,T=d.xScale,_=d.yScale,R=1/(this.path.unitsPerEm||1e3)*u,N=this;f&&f.variation&&(N=f.variation.getTransform(this,d.variation),m=N.path.commands),d.hinting&&f&&f.hinting&&(v=N.path&&f.hinting.exec(N,u,d)),v?(m=f.hinting.getCommands(v),s=Math.round(s),o=Math.round(o),T=_=1):(m=N.path.commands,T===void 0&&(T=R),_===void 0&&(_=R));let q=new Ye;if(d.drawSVG){let V=this.getSvgImage(f);if(V){let ge=new Ye;return ge._image={image:V.image,x:s+V.leftSideBearing*R,y:o-V.baseline*R,width:V.image.width*R,height:V.image.height*R},q._layers=[ge],q}}if(d.drawLayers){let V=this.getLayers(f);if(V&&V.length){q._layers=[];for(let ge=0;ge<V.length;ge+=1){let ce=V[ge],Ce=vt(f,ce.paletteIndex,d.usePalette);Ce==="currentColor"?Ce=d.fill||"black":Ce=Ct(Ce,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:Ce}),q._layers.push(this.getPath.call(ce.glyph,s,o,u,d,f))}return q}}q.fill=d.fill||this.path.fill,q.stroke=this.path.stroke,q.strokeWidth=this.path.strokeWidth*R;for(let V=0;V<m.length;V+=1){let ge=m[V];ge.type==="M"?q.moveTo(s+ge.x*T,o+-ge.y*_):ge.type==="L"?q.lineTo(s+ge.x*T,o+-ge.y*_):ge.type==="Q"?q.quadraticCurveTo(s+ge.x1*T,o+-ge.y1*_,s+ge.x*T,o+-ge.y*_):ge.type==="C"?q.curveTo(s+ge.x1*T,o+-ge.y1*_,s+ge.x2*T,o+-ge.y2*_,s+ge.x*T,o+-ge.y*_):ge.type==="Z"&&q.stroke&&q.strokeWidth&&q.closePath()}return q},$t.prototype.getLayers=function(s){if(!s)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return s.layers.get(this.index)},$t.prototype.getSvgImage=function(s){if(!s)throw new Error("The font object is required to read the svg table in order to get the image.");return s.svgImages.get(this.index)},$t.prototype.getContours=function(s=null){if(this.points===void 0&&!s)return[];let o=[],u=[],d=s||this.points;for(let f=0;f<d.length;f+=1){let m=d[f];u.push(m),m.lastPointOfContour&&(o.push(u),u=[])}return ye.argument(u.length===0,"There are still points left in the current contour."),o},$t.prototype.getMetrics=function(){let s=this.path.commands,o=[],u=[];for(let f=0;f<s.length;f+=1){let m=s[f];m.type!=="Z"&&(o.push(m.x),u.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),u.push(m.y1)),m.type==="C"&&(o.push(m.x2),u.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,u),leftSideBearing:this.leftSideBearing};return isFinite(d.xMin)||(d.xMin=0),isFinite(d.xMax)||(d.xMax=this.advanceWidth),isFinite(d.yMin)||(d.yMin=0),isFinite(d.yMax)||(d.yMax=0),d.rightSideBearing=this.advanceWidth-d.leftSideBearing-(d.xMax-d.xMin),d},$t.prototype.draw=function(s,o,u,d,f,m){f=Object.assign({},m&&m.defaultRenderOptions,f),this.getPath(o,u,d,f,m).draw(s)},$t.prototype.drawPoints=function(s,o,u,d,f,m){if(f=Object.assign({},m&&m.defaultRenderOptions,f),f.drawLayers){let q=this.getLayers(m);if(q&&q.length){for(let V=0;V<q.length;V+=1)q[V].glyph.index!==this.index&&this.drawPoints.call(q[V].glyph,s,o,u,d);return}}function v(q,V,ge,ce){s.beginPath();for(let Ce=0;Ce<q.length;Ce+=1)s.moveTo(V+q[Ce].x*ce,ge+q[Ce].y*ce),s.arc(V+q[Ce].x*ce,ge+q[Ce].y*ce,2,0,Math.PI*2,!1);s.fill()}o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24;let T=1/this.path.unitsPerEm*d,_=[],R=[],N=this.path.commands;m&&m.variation&&(N=m.variation.getTransform(this,f.variation).path.commands);for(let q=0;q<N.length;q+=1){let V=N[q];V.x!==void 0&&_.push({x:V.x,y:-V.y}),V.x1!==void 0&&R.push({x:V.x1,y:-V.y1}),V.x2!==void 0&&R.push({x:V.x2,y:-V.y2})}s.fillStyle="blue",v(_,o,u,T),s.fillStyle="red",v(R,o,u,T)},$t.prototype.drawMetrics=function(s,o,u,d){let f;o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,s.lineWidth=1,s.strokeStyle="black",Ke.line(s,o,-1e4,o,1e4),Ke.line(s,-1e4,u,1e4,u);let m=this.xMin||0,v=this.yMin||0,T=this.xMax||0,_=this.yMax||0,R=this.advanceWidth||0;s.strokeStyle="blue",Ke.line(s,o+m*f,-1e4,o+m*f,1e4),Ke.line(s,o+T*f,-1e4,o+T*f,1e4),Ke.line(s,-1e4,u+-v*f,1e4,u+-v*f),Ke.line(s,-1e4,u+-_*f,1e4,u+-_*f),s.strokeStyle="green",Ke.line(s,o+R*f,-1e4,o+R*f,1e4)},$t.prototype.toPathData=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let u=this;o&&o.variation&&(u=o.variation.getTransform(this,s.variation));let d=u.points&&s.pointsTransform?s.pointsTransform(u.points):u.path;return s.pathTransform&&(d=s.pathTransform(d)),d.toPathData(s)},$t.prototype.fromSVG=function(s,o={}){return this.path.fromSVG(s,o)},$t.prototype.toSVG=function(s,o){let u=this.toPathData.apply(this,[s,o]);return this.path.toSVG(s,u)},$t.prototype.toDOMElement=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let u=this.path;return o&&o.variation&&(u=o.variation.getTransform(this,s.variation).path),u.toDOMElement(s)};var Ur=$t;function Or(s,o,u){Object.defineProperty(s,o,{get:function(){return typeof s[u]>"u"&&s.path,s[u]},set:function(d){s[u]=d},enumerable:!0,configurable:!0})}function es(s,o){if(this.font=s,this.glyphs={},Array.isArray(o))for(let u=0;u<o.length;u++){let d=o[u];d.path.unitsPerEm=s.unitsPerEm,this.glyphs[u]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(es.prototype[Symbol.iterator]=function(){let s=-1;return{next:(function(){s++;let o=s>=this.length-1;return{value:this.get(s),done:o}}).bind(this)}}),es.prototype.get=function(s){if(this.font._push&&this.glyphs[s]===void 0){this.font._push(s),typeof this.glyphs[s]=="function"&&(this.glyphs[s]=this.glyphs[s]());let o=this.glyphs[s],u=this.font._IndexToUnicodeMap[s];if(u)for(let d=0;d<u.unicodes.length;d++)o.addUnicode(u.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[s]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(s)),this.glyphs[s].advanceWidth=this.font._hmtxTableData[s].advanceWidth,this.glyphs[s].leftSideBearing=this.font._hmtxTableData[s].leftSideBearing}else typeof this.glyphs[s]=="function"&&(this.glyphs[s]=this.glyphs[s]());return this.glyphs[s]},es.prototype.push=function(s,o){this.glyphs[s]=o,this.length++};function js(s,o){return new Ur({index:o,font:s})}function ai(s,o,u,d,f,m){return function(){let v=new Ur({index:o,font:s});return v.path=function(){u(v,d,f);let T=m(s.glyphs,v);return T.unitsPerEm=s.unitsPerEm,T},Or(v,"numberOfContours","_numberOfContours"),Or(v,"xMin","_xMin"),Or(v,"xMax","_xMax"),Or(v,"yMin","_yMin"),Or(v,"yMax","_yMax"),Or(v,"points","_points"),v}}function Fs(s,o,u,d,f){return function(){let m=new Ur({index:o,font:s});return m.path=function(){let v=u(s,m,d,f);return v.unitsPerEm=s.unitsPerEm,v},m}}var zr={GlyphSet:es,glyphLoader:js,ttfGlyphLoader:ai,cffGlyphLoader:Fs};function on(s,o){if(s===o)return!0;if(Array.isArray(s)&&Array.isArray(o)){if(s.length!==o.length)return!1;for(let u=0;u<s.length;u+=1)if(!on(s[u],o[u]))return!1;return!0}else return!1}var Wn=10;function z(s){let o;return s.length<1240?o=107:s.length<33900?o=1131:o=32768,o}function le(s,o,u,d){let f=[],m=[],v=d>1?fe.getULong(s,o):fe.getCard16(s,o),T=d>1?4:2,_,R;if(v!==0){let N=fe.getByte(s,o+T);_=o+(v+1)*N+T;let q=o+T+1;for(let V=0;V<v+1;V+=1)f.push(fe.getOffset(s,q,N)),q+=N;R=_+f[v]}else R=o+T;for(let N=0;N<f.length-1;N+=1){let q=fe.getBytes(s,_+f[N],_+f[N+1]);u&&(q=u(q,s,o,d)),m.push(q)}return{objects:m,startOffset:o,endOffset:R}}function xe(s,o,u){let d=[],f=u>1?fe.getULong(s,o):fe.getCard16(s,o),m=u>1?4:2,v,T;if(f!==0){let _=fe.getByte(s,o+m);v=o+(f+1)*_+m;let R=o+m+1;for(let N=0;N<f+1;N+=1)d.push(fe.getOffset(s,R,_)),R+=_;T=v+d[f]}else T=o+m;return{offsets:d,startOffset:o,endOffset:T}}function Pe(s,o,u,d,f,m){let v=m>1?fe.getULong(u,d):fe.getCard16(u,d),T=m>1?4:2,_=0;if(v!==0){let N=fe.getByte(u,d+T);_=d+(v+1)*N+T}let R=fe.getBytes(u,_+o[s],_+o[s+1]);return f&&(R=f(R)),R}function Ht(s){let o="",u=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=s.parseByte(),f=d>>4,m=d&15;if(f===15||(o+=u[f],m===15))break;o+=u[m]}return parseFloat(o)}function Ft(s,o){let u,d,f,m;if(o===28)return u=s.parseByte(),d=s.parseByte(),u<<8|d;if(o===29)return u=s.parseByte(),d=s.parseByte(),f=s.parseByte(),m=s.parseByte(),u<<24|d<<16|f<<8|m;if(o===30)return Ht(s);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return u=s.parseByte(),(o-247)*256+u+108;if(o>=251&&o<=254)return u=s.parseByte(),-(o-251)*256-u-108;throw new Error("Invalid b0 "+o)}function tr(s){let o={};for(let u=0;u<s.length;u+=1){let d=s[u][0],f=s[u][1],m;if(f.length===1?m=f[0]:m=f,Object.prototype.hasOwnProperty.call(o,d)&&!isNaN(o[d]))throw new Error("Object "+o+" already has key "+d);o[d]=m}return o}function Xt(s,o,u,d){o=o!==void 0?o:0;let f=new fe.Parser(s,o),m=[],v=[];u=u!==void 0?u:s.byteLength;let T=d<2?22:28;for(;f.relativeOffset<u;){let _=f.parseByte();if(_<T){if(_===12&&(_=1200+f.parseByte()),d>1&&_===23){oi(v);continue}m.push([_,v]),v=[]}else v.push(Ft(f,_,d))}return tr(m)}function Hr(s,o){return o<=390?o=W[o]:s?o=s[o-391]:o=void 0,o}function yn(s,o,u){let d={},f;for(let m=0;m<o.length;m+=1){let v=o[m];if(Array.isArray(v.type)){let T=[];T.length=v.type.length;for(let _=0;_<v.type.length;_++)f=s[v.op]!==void 0?s[v.op][_]:void 0,f===void 0&&(f=v.value!==void 0&&v.value[_]!==void 0?v.value[_]:null),v.type[_]==="SID"&&(f=Hr(u,f)),T[_]=f;d[v.name]=T}else f=s[v.op],f===void 0&&(f=v.value!==void 0?v.value:null),v.type==="SID"&&(f=Hr(u,f)),d[v.name]=f}return d}function P(s,o){let u={};if(u.formatMajor=fe.getCard8(s,o),u.formatMinor=fe.getCard8(s,o+1),u.formatMajor>2)throw new Error(`Unsupported CFF table version ${u.formatMajor}.${u.formatMinor}`);return u.size=fe.getCard8(s,o+2),u.formatMajor<2?(u.offsetSize=fe.getCard8(s,o+3),u.startOffset=o,u.endOffset=o+4):(u.topDictLength=fe.getCard16(s,o+3),u.endOffset=o+8),u}var Ae=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],_e=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],at=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],bt=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],ur=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function Vt(s,o,u,d){let f=Xt(s,o,s.byteLength,d);return yn(f,d>1?_e:Ae,u)}function Nt(s,o,u,d,f){let m=Xt(s,o,u,f);return yn(m,f>1?bt:at,d)}function Wr(s,o,u){let d=Xt(s,o,void 0,u);return yn(d,ur)}function Pn(s,o,u){let d=[];for(let f=0;f<u.length;f++){let m=new DataView(new Uint8Array(u[f]).buffer),v=Wr(m,0,2),T=v.private[0],_=v.private[1];if(T!==0&&_!==0){let R=Nt(s,_+o,T,[],2);if(R.subrs){let N=_+R.subrs,q=le(s,N+o,void 0,2);v._subrs=q.objects,v._subrsBias=z(v._subrs)}v._privateDict=R}d.push(v)}return d}function xs(s,o,u,d,f){let m=[];for(let v=0;v<u.length;v+=1){let T=new DataView(new Uint8Array(u[v]).buffer),_=Vt(T,0,d,f);_._subrs=[],_._subrsBias=0,_._defaultWidthX=0,_._nominalWidthX=0;let R=f<2?_.private[0]:0,N=f<2?_.private[1]:0;if(R!==0&&N!==0){let q=Nt(s,N+o,R,d,f);if(_._defaultWidthX=q.defaultWidthX,_._nominalWidthX=q.nominalWidthX,q.subrs!==0){let V=N+q.subrs,ge=le(s,V+o,void 0,f);_._subrs=ge.objects,_._subrsBias=z(_._subrs)}_._privateDict=q}m.push(_)}return m}function Di(s,o,u,d,f){let m,v,T=new fe.Parser(s,o);u-=1;let _=[".notdef"],R=T.parseCard8();if(R===0)for(let N=0;N<u;N+=1)m=T.parseSID(),f?_.push(m):_.push(Hr(d,m)||m);else if(R===1)for(;_.length<=u;){m=T.parseSID(),v=T.parseCard8();for(let N=0;N<=v;N+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(Hr(d,m)||m),m+=1}else if(R===2)for(;_.length<=u;){m=T.parseSID(),v=T.parseCard16();for(let N=0;N<=v;N+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(Hr(d,m)||m),m+=1}else throw new Error("Unknown charset format "+R);return _}function is(s,o){let u,d={},f=new fe.Parser(s,o),m=f.parseCard8();if(m===0){let v=f.parseCard8();for(let T=0;T<v;T+=1)u=f.parseCard8(),d[u]=T}else if(m===1){let v=f.parseCard8();u=1;for(let T=0;T<v;T+=1){let _=f.parseCard8(),R=f.parseCard8();for(let N=_;N<=_+R;N+=1)d[N]=u,u+=1}}else throw new Error("Unknown encoding format "+m);return d}function oi(s){let o=s.pop();for(;s.length>o;)s.pop()}function li(s,o){let u=s.tables.cff&&s.tables.cff.topDict&&s.tables.cff.topDict.paintType||0;return u===2&&(o.fill=null,o.stroke="black",o.strokeWidth=s.tables.cff.topDict.strokeWidth||0),u}function fa(s,o,u,d,f){let m,v,T,_,R=new Ye,N=[],q=0,V=!1,ge=!1,ce=0,Ce=0,it,pr,or,_r,en=0,Fn=[],Vn,qn=0,Ns=s.tables.cff2||s.tables.cff;if(or=Ns.topDict._defaultWidthX,_r=Ns.topDict._nominalWidthX,f=f||s.variation&&s.variation.get(),o.getBlendPath||(o.getBlendPath=function(sr){return fa(s,o,u,d,sr)}),s.isCIDFont||d>1){let sr=Ns.topDict._fdSelect?Ns.topDict._fdSelect[o.index]:0,ir=Ns.topDict._fdArray[sr];it=ir._subrs,pr=ir._subrsBias,d>1?(Fn=Ns.topDict._vstore.itemVariationStore,en=ir._privateDict.vsindex):(or=ir._defaultWidthX,_r=ir._nominalWidthX)}else it=Ns.topDict._subrs,pr=Ns.topDict._subrsBias;let Ao=li(s,R),tn=or;function Na(sr,ir){ge&&Ao!==2&&R.closePath(),R.moveTo(sr,ir),ge=!0}function Fi(){let sr;sr=(N.length&1)!==0,sr&&!V&&(tn=N.shift()+_r),q+=N.length>>1,N.length=0,V=!0}function mr(sr){let ir,Ei,Ml,gd,Xl,To,$i,qa,Ni,Ra,Ui,zi,Ls=0;for(;Ls<sr.length;){let Za=sr[Ls];switch(Ls+=1,Za){case 1:Fi();break;case 3:Fi();break;case 4:N.length>1&&!V&&(tn=N.shift()+_r,V=!0),Ce+=N.pop(),Na(ce,Ce);break;case 5:for(;N.length>0;)ce+=N.shift(),Ce+=N.shift(),R.lineTo(ce,Ce);break;case 6:for(;N.length>0&&(ce+=N.shift(),R.lineTo(ce,Ce),N.length!==0);)Ce+=N.shift(),R.lineTo(ce,Ce);break;case 7:for(;N.length>0&&(Ce+=N.shift(),R.lineTo(ce,Ce),N.length!==0);)ce+=N.shift(),R.lineTo(ce,Ce);break;case 8:for(;N.length>0;)m=ce+N.shift(),v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),ce=T+N.shift(),Ce=_+N.shift(),R.curveTo(m,v,T,_,ce,Ce);break;case 10:if(Xl=N.pop()+pr,To=it[Xl],To){if(qn>=Wn){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}qn++,mr(To),qn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Za=sr[Ls],Ls+=1,Za){case 35:m=ce+N.shift(),v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),$i=T+N.shift(),qa=_+N.shift(),Ni=$i+N.shift(),Ra=qa+N.shift(),Ui=Ni+N.shift(),zi=Ra+N.shift(),ce=Ui+N.shift(),Ce=zi+N.shift(),N.shift(),R.curveTo(m,v,T,_,$i,qa),R.curveTo(Ni,Ra,Ui,zi,ce,Ce);break;case 34:m=ce+N.shift(),v=Ce,T=m+N.shift(),_=v+N.shift(),$i=T+N.shift(),qa=_,Ni=$i+N.shift(),Ra=_,Ui=Ni+N.shift(),zi=Ce,ce=Ui+N.shift(),R.curveTo(m,v,T,_,$i,qa),R.curveTo(Ni,Ra,Ui,zi,ce,Ce);break;case 36:m=ce+N.shift(),v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),$i=T+N.shift(),qa=_,Ni=$i+N.shift(),Ra=_,Ui=Ni+N.shift(),zi=Ra+N.shift(),ce=Ui+N.shift(),R.curveTo(m,v,T,_,$i,qa),R.curveTo(Ni,Ra,Ui,zi,ce,Ce);break;case 37:m=ce+N.shift(),v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),$i=T+N.shift(),qa=_+N.shift(),Ni=$i+N.shift(),Ra=qa+N.shift(),Ui=Ni+N.shift(),zi=Ra+N.shift(),Math.abs(Ui-ce)>Math.abs(zi-Ce)?ce=Ui+N.shift():Ce=zi+N.shift(),R.curveTo(m,v,T,_,$i,qa),R.curveTo(Ni,Ra,Ui,zi,ce,Ce);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+Za),N.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(N.length>=4){let Jl=Rt[N.pop()],Ec=Rt[N.pop()],xd=N.pop(),bd=N.pop();if(Jl&&Ec){o.isComposite=!0,o.components=[];let X1=s.cffEncoding.charset.indexOf(Jl),J1=s.cffEncoding.charset.indexOf(Ec);o.components.push({glyphIndex:J1,dx:0,dy:0}),o.components.push({glyphIndex:X1,dx:bd,dy:xd}),R.extend(s.glyphs.get(J1).path);let E7=s.glyphs.get(X1),Lf=JSON.parse(JSON.stringify(E7.path.commands));for(let kf=0;kf<Lf.length;kf+=1){let Qo=Lf[kf];Qo.type!=="Z"&&(Qo.x+=bd,Qo.y+=xd),(Qo.type==="Q"||Qo.type==="C")&&(Qo.x1+=bd,Qo.y1+=xd),Qo.type==="C"&&(Qo.x2+=bd,Qo.y2+=xd)}R.extend(Lf)}}else N.length>0&&!V&&(tn=N.shift()+_r,V=!0);ge&&Ao!==2&&(R.closePath(),ge=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}en=N.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}Vn||(Vn=s.variation&&f&&s.variation.process.getBlendVector(Fn,en,f));var Zn=N.pop(),ia=Vn?Vn.length:Fn.itemVariationSubtables[en].regionIndexes.length,Ya=Zn*ia,Co=N.length-Ya,al=Co-Zn;if(Vn)for(let Jl=0;Jl<Zn;Jl++){var K1=N[al+Jl];for(let Ec=0;Ec<ia;Ec++)K1+=Vn[Ec]*N[Co++];N[al+Jl]=K1}for(;Ya--;)N.pop();break;case 18:Fi();break;case 19:case 20:Fi(),Ls+=q+7>>3;break;case 21:N.length>2&&!V&&(tn=N.shift()+_r,V=!0),Ce+=N.pop(),ce+=N.pop(),Na(ce,Ce);break;case 22:N.length>1&&!V&&(tn=N.shift()+_r,V=!0),ce+=N.pop(),Na(ce,Ce);break;case 23:Fi();break;case 24:for(;N.length>2;)m=ce+N.shift(),v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),ce=T+N.shift(),Ce=_+N.shift(),R.curveTo(m,v,T,_,ce,Ce);ce+=N.shift(),Ce+=N.shift(),R.lineTo(ce,Ce);break;case 25:for(;N.length>6;)ce+=N.shift(),Ce+=N.shift(),R.lineTo(ce,Ce);m=ce+N.shift(),v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),ce=T+N.shift(),Ce=_+N.shift(),R.curveTo(m,v,T,_,ce,Ce);break;case 26:for(N.length&1&&(ce+=N.shift());N.length>0;)m=ce,v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),ce=T,Ce=_+N.shift(),R.curveTo(m,v,T,_,ce,Ce);break;case 27:for(N.length&1&&(Ce+=N.shift());N.length>0;)m=ce+N.shift(),v=Ce,T=m+N.shift(),_=v+N.shift(),ce=T+N.shift(),Ce=_,R.curveTo(m,v,T,_,ce,Ce);break;case 28:ir=sr[Ls],Ei=sr[Ls+1],N.push((ir<<24|Ei<<16)>>16),Ls+=2;break;case 29:if(Xl=N.pop()+s.gsubrsBias,To=s.gsubrs[Xl],To){if(qn>=Wn){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}qn++,mr(To),qn--}break;case 30:for(;N.length>0&&(m=ce,v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),ce=T+N.shift(),Ce=_+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ce,Ce),N.length!==0);)m=ce+N.shift(),v=Ce,T=m+N.shift(),_=v+N.shift(),Ce=_+N.shift(),ce=T+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ce,Ce);break;case 31:for(;N.length>0&&(m=ce+N.shift(),v=Ce,T=m+N.shift(),_=v+N.shift(),Ce=_+N.shift(),ce=T+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ce,Ce),N.length!==0);)m=ce,v=Ce+N.shift(),T=m+N.shift(),_=v+N.shift(),ce=T+N.shift(),Ce=_+(N.length===1?N.shift():0),R.curveTo(m,v,T,_,ce,Ce);break;default:Za<32?console.log("Glyph "+o.index+": unknown operator "+Za):Za<247?N.push(Za-139):Za<251?(ir=sr[Ls],Ls+=1,N.push((Za-247)*256+ir+108)):Za<255?(ir=sr[Ls],Ls+=1,N.push(-(Za-251)*256-ir-108)):(ir=sr[Ls],Ei=sr[Ls+1],Ml=sr[Ls+2],gd=sr[Ls+3],Ls+=4,N.push((ir<<24|Ei<<16|Ml<<8|gd)/65536))}}}return mr(u),s.variation&&f&&(R.commands=R.commands.map(sr=>{let ir=Object.keys(sr);for(let Ei=0;Ei<ir.length;Ei++){let Ml=ir[Ei];Ml!=="type"&&(sr[Ml]=Math.round(sr[Ml]))}return sr})),V&&(o.advanceWidth=tn),R}function vn(s,o,u,d,f){let m=[],v,T=new fe.Parser(s,o),_=T.parseCard8();if(_===0)for(let R=0;R<u;R++){if(v=T.parseCard8(),v>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+v+" (FD count "+d+")");m.push(v)}else if(_===3||f>1&&_===4){let R=_===4?T.parseULong():T.parseCard16(),N=_===4?T.parseULong():T.parseCard16();if(N!==0)throw new Error(`CFF Table CID Font FDSelect format ${_} range has bad initial GID ${N}`);let q;for(let V=0;V<R;V++){if(v=_===4?T.parseUShort():T.parseCard8(),q=_===4?T.parseULong():T.parseCard16(),v>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+v+" (FD count "+d+")");if(q>u)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${q}`);for(;N<q;N++)m.push(v);N=q}if(q!==u)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+q)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+_);return m}function cs(s,o,u,d){let f,m=P(s,o);m.formatMajor===2?f=u.tables.cff2={}:f=u.tables.cff={};let v=m.formatMajor>1?null:le(s,m.endOffset,fe.bytesToString),T=m.formatMajor>1?null:le(s,v.endOffset),_=m.formatMajor>1?null:le(s,T.endOffset,fe.bytesToString),R=le(s,m.formatMajor>1?o+m.size+m.topDictLength:_.endOffset,void 0,m.formatMajor);u.gsubrs=R.objects,u.gsubrsBias=z(u.gsubrs);let N;if(m.formatMajor>1){let V=o+m.size,ge=fe.getBytes(s,V,V+m.topDictLength);N=xs(s,0,[ge],void 0,m.formatMajor)[0]}else{let V=xs(s,o,T.objects,_.objects,m.formatMajor);if(V.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+V.length);N=V[0]}if(f.topDict=N,N._privateDict&&(u.defaultWidthX=N._privateDict.defaultWidthX,u.nominalWidthX=N._privateDict.nominalWidthX),m.formatMajor<2&&N.ros[0]!==void 0&&N.ros[1]!==void 0&&(u.isCIDFont=!0),m.formatMajor>1){let V=N.fdArray,ge=N.fdSelect;if(!V)throw new Error("This is a CFF2 font, but FDArray information is missing");let ce=le(s,o+V,null,m.formatMajor),Ce=Pn(s,o,ce.objects);N._fdArray=Ce,ge&&(N._fdSelect=vn(s,o+ge,u.numGlyphs,Ce.length,m.formatMajor))}else if(u.isCIDFont){let V=N.fdArray,ge=N.fdSelect;if(V===0||ge===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");V+=o;let ce=le(s,V),Ce=xs(s,o,ce.objects,_.objects,m.formatMajor);N._fdArray=Ce,ge+=o,N._fdSelect=vn(s,ge,u.numGlyphs,Ce.length,m.formatMajor)}if(m.formatMajor<2){let V=o+N.private[1],ge=Nt(s,V,N.private[0],_.objects,m.formatMajor);if(u.defaultWidthX=ge.defaultWidthX,u.nominalWidthX=ge.nominalWidthX,ge.subrs!==0){let ce=V+ge.subrs,Ce=le(s,ce);u.subrs=Ce.objects,u.subrsBias=z(u.subrs)}else u.subrs=[],u.subrsBias=0}let q;if(d.lowMemory?(q=xe(s,o+N.charStrings,m.formatMajor),u.nGlyphs=q.offsets.length-(m.formatMajor>1?1:0)):(q=le(s,o+N.charStrings,null,m.formatMajor),u.nGlyphs=q.objects.length),m.formatMajor>1&&u.tables.maxp&&u.nGlyphs!==u.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${u.nGlyphs}) must correspond to the glyph count in the maxp table (${u.tables.maxp.numGlyphs})`),m.formatMajor<2){let V=[],ge=[];N.charset===0?V=Be:N.charset===1?V=wt:N.charset===2?V=yr:V=Di(s,o+N.charset,u.nGlyphs,_.objects,u.isCIDFont),N.encoding===0?ge=Rt:N.encoding===1?ge=Mr:ge=is(s,o+N.encoding),u.cffEncoding=new zn(ge,V),u.encoding=u.encoding||u.cffEncoding}if(u.glyphs=new zr.GlyphSet(u),d.lowMemory)u._push=function(V){let ge=Pe(V,q.offsets,s,o+N.charStrings,void 0,m.formatMajor);u.glyphs.push(V,zr.cffGlyphLoader(u,V,fa,ge,m.formatMajor))};else for(let V=0;V<u.nGlyphs;V+=1){let ge=q.objects[V];u.glyphs.push(V,zr.cffGlyphLoader(u,V,fa,ge,m.formatMajor))}if(N.vstore){let V=new fe.Parser(s,o+N.vstore);N._vstore=V.parseVariationStore()}}function ks(s,o){let u,d=W.indexOf(s);return d>=0&&(u=d),d=o.indexOf(s),d>=0?u=d+W.length:(u=W.length+o.length,o.push(s)),u}function Qa(){return new We.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ci(s){let o=new We.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let u=0;u<s.length;u+=1)o.names.push({name:"name_"+u,type:"NAME",value:s[u]});return o}function ho(s,o,u){let d={};for(let f=0;f<s.length;f+=1){let m=s[f],v=o[m.name];v!==void 0&&!on(v,m.value)&&(m.type==="SID"&&(v=ks(v,u)),d[m.op]={name:m.name,type:m.type,value:v})}return d}function pa(s,o,u){let d=new We.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=ho(u>1?_e:Ae,s,o),d}function gn(s){let o=new We.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:s}],o}function ma(s){let o=new We.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let u=0;u<s.length;u+=1)o.strings.push({name:"string_"+u,type:"STRING",value:s[u]});return o}function Is(){return new We.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function el(s,o){let u=new We.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<s.length;d+=1){let f=s[d],m=ks(f,o);u.fields.push({name:"glyph_"+d,type:"SID",value:m})}return u}function Si(s,o){let u=[],d=s.path;o<2&&u.push({name:"width",type:"NUMBER",value:s.advanceWidth});let f=0,m=0;for(let v=0;v<d.commands.length;v+=1){let T,_,R=d.commands[v];if(R.type==="Q"){let N=.3333333333333333,q=2/3;R={type:"C",x:R.x,y:R.y,x1:Math.round(N*f+q*R.x1),y1:Math.round(N*m+q*R.y1),x2:Math.round(N*R.x+q*R.x1),y2:Math.round(N*R.y+q*R.y1)}}if(R.type==="M")T=Math.round(R.x-f),_=Math.round(R.y-m),u.push({name:"dx",type:"NUMBER",value:T}),u.push({name:"dy",type:"NUMBER",value:_}),u.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(R.x),m=Math.round(R.y);else if(R.type==="L")T=Math.round(R.x-f),_=Math.round(R.y-m),u.push({name:"dx",type:"NUMBER",value:T}),u.push({name:"dy",type:"NUMBER",value:_}),u.push({name:"rlineto",type:"OP",value:5}),f=Math.round(R.x),m=Math.round(R.y);else if(R.type==="C"){let N=Math.round(R.x1-f),q=Math.round(R.y1-m),V=Math.round(R.x2-R.x1),ge=Math.round(R.y2-R.y1);T=Math.round(R.x-R.x2),_=Math.round(R.y-R.y2),u.push({name:"dx1",type:"NUMBER",value:N}),u.push({name:"dy1",type:"NUMBER",value:q}),u.push({name:"dx2",type:"NUMBER",value:V}),u.push({name:"dy2",type:"NUMBER",value:ge}),u.push({name:"dx",type:"NUMBER",value:T}),u.push({name:"dy",type:"NUMBER",value:_}),u.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(R.x),m=Math.round(R.y)}}return o<2&&u.push({name:"endchar",type:"OP",value:14}),u}function fo(s,o){let u=new We.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<s.length;d+=1){let f=s.get(d),m=Si(f,o);u.charStrings.push({name:f.name,type:"CHARSTRING",value:m})}return u}function Pa(s,o,u){let d=new We.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=ho(u>1?bt:at,s,o),d}function ga(s,o){let u=new We.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),d=1/o.unitsPerEm,f={version:o.version,fullName:o.fullName,familyName:o.familyName,weight:o.weightName,fontBBox:o.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},m=o&&o.topDict||{};m.paintType&&(f.paintType=m.paintType,f.strokeWidth=m.strokeWidth||0);let v={},T=[],_;for(let V=1;V<s.length;V+=1)_=s.get(V),T.push(_.name);let R=[];u.header=Qa(),u.nameIndex=Ci([o.postScriptName]);let N=pa(f,R);u.topDictIndex=gn(N),u.globalSubrIndex=Is(),u.charsets=el(T,R),u.charStringsIndex=fo(s,1),u.privateDict=Pa(v,R),u.stringIndex=ma(R);let q=u.header.sizeOf()+u.nameIndex.sizeOf()+u.topDictIndex.sizeOf()+u.stringIndex.sizeOf()+u.globalSubrIndex.sizeOf();return f.charset=q,f.encoding=0,f.charStrings=f.charset+u.charsets.sizeOf(),f.private[1]=f.charStrings+u.charStringsIndex.sizeOf(),N=pa(f,R),u.topDictIndex=gn(N),u}var Xi={parse:cs,make:ga};function Oa(s,o){let u={},d=new fe.Parser(s,o);return u.version=d.parseVersion(),u.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,u.checkSumAdjustment=d.parseULong(),u.magicNumber=d.parseULong(),ye.argument(u.magicNumber===1594834165,"Font header has wrong magic number."),u.flags=d.parseUShort(),u.unitsPerEm=d.parseUShort(),u.created=d.parseLongDateTime(),u.modified=d.parseLongDateTime(),u.xMin=d.parseShort(),u.yMin=d.parseShort(),u.xMax=d.parseShort(),u.yMax=d.parseShort(),u.macStyle=d.parseUShort(),u.lowestRecPPEM=d.parseUShort(),u.fontDirectionHint=d.parseShort(),u.indexToLocFormat=d.parseShort(),u.glyphDataFormat=d.parseShort(),u}function ci(s){let o=Math.round(new Date().getTime()/1e3)+2082844800,u=o,d=s.macStyle||0;return s.createdTimestamp&&(u=s.createdTimestamp+2082844800),new We.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:u},{name:"modified",type:"LONGDATETIME",value:o},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:d},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],s)}var us={parse:Oa,make:ci};function In(s,o){let u={},d=new fe.Parser(s,o);return u.version=d.parseVersion(),u.ascender=d.parseShort(),u.descender=d.parseShort(),u.lineGap=d.parseShort(),u.advanceWidthMax=d.parseUShort(),u.minLeftSideBearing=d.parseShort(),u.minRightSideBearing=d.parseShort(),u.xMaxExtent=d.parseShort(),u.caretSlopeRise=d.parseShort(),u.caretSlopeRun=d.parseShort(),u.caretOffset=d.parseShort(),d.relativeOffset+=8,u.metricDataFormat=d.parseShort(),u.numberOfHMetrics=d.parseUShort(),u}function xa(s){return new We.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],s)}var ts={parse:In,make:xa};function ui(s,o,u,d,f){let m,v,T=new fe.Parser(s,o);for(let _=0;_<d;_+=1){_<u&&(m=T.parseUShort(),v=T.parseShort());let R=f.get(_);R.advanceWidth=m,R.leftSideBearing=v}}function _i(s,o,u,d,f){s._hmtxTableData={};let m,v,T=new fe.Parser(o,u);for(let _=0;_<f;_+=1)_<d&&(m=T.parseUShort(),v=T.parseShort()),s._hmtxTableData[_]={advanceWidth:m,leftSideBearing:v}}function Ji(s,o,u,d,f,m,v){v.lowMemory?_i(s,o,u,d,f):ui(o,u,d,f,m)}function Fa(s){let o=new We.Table("hmtx",[]);for(let u=0;u<s.length;u+=1){let d=s.get(u),f=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+u,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+u,type:"SHORT",value:m})}return o}var $a={parse:Ji,make:Fa};function po(s){let o=new We.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:s.length}]),u="",d=12+s.length*4;for(let f=0;f<s.length;++f){let m=u.indexOf(s[f]);m<0&&(m=u.length,u+=s[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+m}),o.fields.push({name:"length "+f,type:"USHORT",value:s[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),o}function Al(s,o){let u=new fe.Parser(s,o),d=u.parseULong();ye.argument(d===1,"Unsupported ltag table version."),u.skip("uLong",1);let f=u.parseULong(),m=[];for(let v=0;v<f;v++){let T="",_=o+u.parseUShort(),R=u.parseUShort();for(let N=_;N<_+R;++N)T+=String.fromCharCode(s.getInt8(N));m.push(T)}return m}var tl={make:po,parse:Al};function Mo(s,o){let u={},d=new fe.Parser(s,o);return u.version=d.parseVersion(),u.numGlyphs=d.parseUShort(),u.version===1&&(u.maxPoints=d.parseUShort(),u.maxContours=d.parseUShort(),u.maxCompositePoints=d.parseUShort(),u.maxCompositeContours=d.parseUShort(),u.maxZones=d.parseUShort(),u.maxTwilightPoints=d.parseUShort(),u.maxStorage=d.parseUShort(),u.maxFunctionDefs=d.parseUShort(),u.maxInstructionDefs=d.parseUShort(),u.maxStackElements=d.parseUShort(),u.maxSizeOfInstructions=d.parseUShort(),u.maxComponentElements=d.parseUShort(),u.maxComponentDepth=d.parseUShort()),u}function $s(s){return new We.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:s}])}var Do={parse:Mo,make:$s},ba=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function ya(s){for(let o=0;o<ba.length;o+=1){let u=ba[o];if(s>=u.begin&&s<u.end)return o}return-1}function va(s,o){let u={},d=new fe.Parser(s,o);u.version=d.parseUShort(),u.xAvgCharWidth=d.parseShort(),u.usWeightClass=d.parseUShort(),u.usWidthClass=d.parseUShort(),u.fsType=d.parseUShort(),u.ySubscriptXSize=d.parseShort(),u.ySubscriptYSize=d.parseShort(),u.ySubscriptXOffset=d.parseShort(),u.ySubscriptYOffset=d.parseShort(),u.ySuperscriptXSize=d.parseShort(),u.ySuperscriptYSize=d.parseShort(),u.ySuperscriptXOffset=d.parseShort(),u.ySuperscriptYOffset=d.parseShort(),u.yStrikeoutSize=d.parseShort(),u.yStrikeoutPosition=d.parseShort(),u.sFamilyClass=d.parseShort(),u.panose=[];for(let f=0;f<10;f++)u.panose[f]=d.parseByte();return u.ulUnicodeRange1=d.parseULong(),u.ulUnicodeRange2=d.parseULong(),u.ulUnicodeRange3=d.parseULong(),u.ulUnicodeRange4=d.parseULong(),u.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),u.fsSelection=d.parseUShort(),u.usFirstCharIndex=d.parseUShort(),u.usLastCharIndex=d.parseUShort(),u.sTypoAscender=d.parseShort(),u.sTypoDescender=d.parseShort(),u.sTypoLineGap=d.parseShort(),u.usWinAscent=d.parseUShort(),u.usWinDescent=d.parseUShort(),u.version>=1&&(u.ulCodePageRange1=d.parseULong(),u.ulCodePageRange2=d.parseULong()),u.version>=2&&(u.sxHeight=d.parseShort(),u.sCapHeight=d.parseShort(),u.usDefaultChar=d.parseUShort(),u.usBreakChar=d.parseUShort(),u.usMaxContent=d.parseUShort()),u}function ps(s){return new We.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],s)}var Li={parse:va,make:ps,unicodeRanges:ba,getUnicodeRange:ya};function mo(s,o){let u={},d=new fe.Parser(s,o);switch(u.version=d.parseVersion(),u.italicAngle=d.parseFixed(),u.underlinePosition=d.parseShort(),u.underlineThickness=d.parseShort(),u.isFixedPitch=d.parseULong(),u.minMemType42=d.parseULong(),u.maxMemType42=d.parseULong(),u.minMemType1=d.parseULong(),u.maxMemType1=d.parseULong(),u.version){case 1:u.names=Dr.slice();break;case 2:u.numberOfGlyphs=d.parseUShort(),u.glyphNameIndex=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.glyphNameIndex[f]=d.parseUShort();u.names=[];for(let f=0;f<u.numberOfGlyphs;f++)if(u.glyphNameIndex[f]>=Dr.length){let m=d.parseChar();u.names.push(d.parseString(m))}break;case 2.5:u.numberOfGlyphs=d.parseUShort(),u.offset=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.offset[f]=d.parseChar();break}return u}function go(s){let{italicAngle:o=Math.round((s.italicAngle||0)*65536),underlinePosition:u=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:m=0,maxMemType42:v=0,minMemType1:T=0,maxMemType1:_=0}=s.tables.post||{};return new We.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:u},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:m},{name:"maxMemType42",type:"ULONG",value:v},{name:"minMemType1",type:"ULONG",value:T},{name:"maxMemType1",type:"ULONG",value:_}])}var xo={parse:mo,make:go},Us=new Array(9);Us[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(pe.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(pe.coverage),substitute:this.parseOffset16List()};ye.assert(!1,"0x"+s.toString(16)+": lookup type 1 format must be 1 or 2.")},Us[2]=function(){let s=this.parseUShort();return ye.argument(s===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(pe.coverage),sequences:this.parseListOfLists()}},Us[3]=function(){let s=this.parseUShort();return ye.argument(s===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(pe.coverage),alternateSets:this.parseListOfLists()}},Us[4]=function(){let s=this.parseUShort();return ye.argument(s===1,"GSUB ligature table identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(pe.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var zs={sequenceIndex:pe.uShort,lookupListIndex:pe.uShort};Us[5]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(pe.coverage),ruleSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,zs)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(pe.coverage),classDef:this.parsePointer(pe.classDef),classSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,zs)}})};if(o===3){let u=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(u,pe.pointer(pe.coverage)),lookupRecords:this.parseRecordList(d,zs)}}ye.assert(!1,"0x"+s.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Us[6]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(pe.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(zs)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(pe.coverage),backtrackClassDef:this.parsePointer(pe.classDef),inputClassDef:this.parsePointer(pe.classDef),lookaheadClassDef:this.parsePointer(pe.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(zs)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(pe.pointer(pe.coverage)),inputCoverage:this.parseList(pe.pointer(pe.coverage)),lookaheadCoverage:this.parseList(pe.pointer(pe.coverage)),lookupRecords:this.parseRecordList(zs)};ye.assert(!1,"0x"+s.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Us[7]=function(){let s=this.parseUShort();ye.argument(s===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),u=new pe(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:Us[o].call(u)}},Us[8]=function(){let s=this.parseUShort();return ye.argument(s===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(pe.coverage),backtrackCoverage:this.parseList(pe.pointer(pe.coverage)),lookaheadCoverage:this.parseList(pe.pointer(pe.coverage)),substitutes:this.parseUShortList()}};function jo(s,o){o=o||0;let u=new pe(s,o),d=u.parseVersion(1);return ye.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(Us)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(Us),variations:u.parseFeatureVariationsList()}}var Yn=new Array(9);Yn[1]=function(s){if(s.substFormat===1)return new We.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)},{name:"deltaGlyphID",type:"SHORT",value:s.deltaGlyphId}]);if(s.substFormat===2)return new We.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)}].concat(We.ushortList("substitute",s.substitute)));ye.fail("Lookup type 1 substFormat must be 1 or 2.")},Yn[2]=function(s){return ye.assert(s.substFormat===1,"Lookup type 2 substFormat must be 1."),new We.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)}].concat(We.tableList("seqSet",s.sequences,function(o){return new We.Table("sequenceSetTable",We.ushortList("sequence",o))})))},Yn[3]=function(s){return ye.assert(s.substFormat===1,"Lookup type 3 substFormat must be 1."),new We.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)}].concat(We.tableList("altSet",s.alternateSets,function(o){return new We.Table("alternateSetTable",We.ushortList("alternate",o))})))},Yn[4]=function(s){return ye.assert(s.substFormat===1,"Lookup type 4 substFormat must be 1."),new We.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)}].concat(We.tableList("ligSet",s.ligatureSets,function(o){return new We.Table("ligatureSetTable",We.tableList("ligature",o,function(u){return new We.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:u.ligGlyph}].concat(We.ushortList("component",u.components,u.components.length+1)))}))})))},Yn[5]=function(s){if(s.substFormat===1)return new We.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)}].concat(We.tableList("sequenceRuleSet",s.ruleSets,function(o){return o?new We.Table("sequenceRuleSetTable",We.tableList("sequenceRule",o,function(u){let d=We.ushortList("seqLookup",[],u.lookupRecords.length).concat(We.ushortList("inputSequence",u.input,u.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new We.Table("sequenceRuleTable",d)})):new We.Table("NULL",null)})));if(s.substFormat===2)return new We.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)},{name:"classDef",type:"TABLE",value:new We.ClassDef(s.classDef)}].concat(We.tableList("classSeqRuleSet",s.classSets,function(o){return o?new We.Table("classSeqRuleSetTable",We.tableList("classSeqRule",o,function(u){let d=We.ushortList("classes",u.classes,u.classes.length+1).concat(We.ushortList("seqLookupCount",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new We.Table("classSeqRuleTable",d)})):new We.Table("NULL",null)})));if(s.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:s.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:s.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let u=0;u<s.coverages.length;u++){let d=s.coverages[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new We.Coverage(d)})}for(let u=0;u<s.lookupRecords.length;u++){let d=s.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new We.Table("contextualSubstitutionTable",o)}ye.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Yn[6]=function(s){if(s.substFormat===1)return new We.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new We.Coverage(s.coverage)}].concat(We.tableList("chainRuleSet",s.chainRuleSets,function(o){return new We.Table("chainRuleSetTable",We.tableList("chainRule",o,function(u){let d=We.ushortList("backtrackGlyph",u.backtrack,u.backtrack.length).concat(We.ushortList("inputGlyph",u.input,u.input.length+1)).concat(We.ushortList("lookaheadGlyph",u.lookahead,u.lookahead.length)).concat(We.ushortList("substitution",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new We.Table("chainRuleTable",d)}))})));if(s.substFormat===2)ye.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(s.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:s.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:s.backtrackCoverage.length});for(let u=0;u<s.backtrackCoverage.length;u++){let d=s.backtrackCoverage[u];o.push({name:"backtrackCoverage"+u,type:"TABLE",value:new We.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:s.inputCoverage.length});for(let u=0;u<s.inputCoverage.length;u++){let d=s.inputCoverage[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new We.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:s.lookaheadCoverage.length});for(let u=0;u<s.lookaheadCoverage.length;u++){let d=s.lookaheadCoverage[u];o.push({name:"lookaheadCoverage"+u,type:"TABLE",value:new We.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let u=0;u<s.lookupRecords.length;u++){let d=s.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new We.Table("chainContextTable",o)}ye.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function as(s){return new We.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new We.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new We.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new We.LookupList(s.lookups,Yn)}])}var di={parse:jo,make:as};function ji(s,o){let u=new fe.Parser(s,o),d=u.parseULong();ye.argument(d===1,"Unsupported META table version."),u.parseULong(),u.parseULong();let f=u.parseULong(),m={};for(let v=0;v<f;v++){let T=u.parseTag(),_=u.parseULong(),R=u.parseULong();if(T==="appl"||T==="bild")continue;let N=ct.UTF8(s,o+_,R);m[T]=N}return m}function Bi(s){let o=Object.keys(s).length,u="",d=16+o*12,f=new We.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:d},{name:"numTags",type:"ULONG",value:o}]);for(let m in s){let v=u.length;u+=s[m],f.fields.push({name:"tag "+m,type:"TAG",value:m}),f.fields.push({name:"offset "+m,type:"ULONG",value:d+v}),f.fields.push({name:"length "+m,type:"ULONG",value:s[m].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),f}var Hs={parse:ji,make:Bi};function bo(s,o){let u=new pe(s,o),d=u.parseUShort();d!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");let f=u.parseUShort(),m=u.parseOffset32(),v=u.parseOffset32(),T=u.parseUShort();u.relativeOffset=m;let _=u.parseRecordList(f,{glyphID:pe.uShort,firstLayerIndex:pe.uShort,numLayers:pe.uShort});u.relativeOffset=v;let R=u.parseRecordList(T,{glyphID:pe.uShort,paletteIndex:pe.uShort});return{version:d,baseGlyphRecords:_,layerRecords:R}}function Ws({version:s=0,baseGlyphRecords:o=[],layerRecords:u=[]}){ye.argument(s===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new We.Table("COLR",[{name:"version",type:"USHORT",value:s},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:u.length},...o.map((m,v)=>[{name:"glyphID_"+v,type:"USHORT",value:m.glyphID},{name:"firstLayerIndex_"+v,type:"USHORT",value:m.firstLayerIndex},{name:"numLayers_"+v,type:"USHORT",value:m.numLayers}]).flat(),...u.map((m,v)=>[{name:"LayerGlyphID_"+v,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+v,type:"USHORT",value:m.paletteIndex}]).flat()])}var hi={parse:bo,make:Ws};function sn(s,o){return[{name:"tag_"+s,type:"TAG",value:o.tag},{name:"minValue_"+s,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+s,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+s,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+s,type:"USHORT",value:0},{name:"nameID_"+s,type:"USHORT",value:o.axisNameID}]}function wa(s,o,u){let d={},f=new fe.Parser(s,o);d.tag=f.parseTag(),d.minValue=f.parseFixed(),d.defaultValue=f.parseFixed(),d.maxValue=f.parseFixed(),f.skip("uShort",1);let m=f.parseUShort();return d.axisNameID=m,d.name=Dn(u,m),d}function Gs(s,o,u,d={}){let f=[{name:"nameID_"+s,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+s,type:"USHORT",value:0}];for(let m=0;m<u.length;++m){let v=u[m].tag;f.push({name:"axis_"+s+" "+v,type:"FIXED",value:o.coordinates[v]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function ea(s,o,u,d,f){let m={},v=new fe.Parser(s,o),T=v.parseUShort();m.subfamilyNameID=T,m.name=Dn(d,T,[2,17]),v.skip("uShort",1),m.coordinates={};for(let R=0;R<u.length;++R)m.coordinates[u[R].tag]=v.parseFixed();if(v.relativeOffset===f)return m.postScriptNameID=void 0,m.postScriptName=void 0,m;let _=v.parseUShort();return m.postScriptNameID=_==65535?void 0:_,m.postScriptName=m.postScriptNameID!==void 0?Dn(d,_,[6]):"",m}function Aa(s,o){let u=new We.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:s.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:s.instances.length},{name:"instanceSize",type:"USHORT",value:4+s.axes.length*4}]);u.offsetToData=u.sizeOf();for(let f=0;f<s.axes.length;f++)u.fields=u.fields.concat(sn(f,s.axes[f],o));let d={};for(let f=0;f<s.instances.length;f++)if(s.instances[f].postScriptNameID!==void 0){u.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<s.instances.length;f++)u.fields=u.fields.concat(Gs(f,s.instances[f],s.axes,d));return u}function Ta(s,o,u){let d=new fe.Parser(s,o),f=d.parseULong();ye.argument(f===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let v=d.parseUShort(),T=d.parseUShort(),_=d.parseUShort(),R=d.parseUShort(),N=[];for(let ge=0;ge<v;ge++)N.push(wa(s,o+m+ge*T,u));let q=[],V=o+m+v*T;for(let ge=0;ge<_;ge++)q.push(ea(s,V+ge*R,N,u,R));return{axes:N,instances:q}}var fi={make:Aa,parse:Ta},ta={tag:pe.tag,nameID:pe.uShort,ordering:pe.uShort},Cs=new Array(5);Cs[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Cs[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Cs[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Cs[4]=function(){let s=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(s,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function Ca(){let s=this.parseUShort(),o=Cs[s],u={format:s};return o===void 0?(console.warn(`Unknown axis value table format ${s}`),u):Object.assign(u,this.parseStruct(o.bind(this)))}function Ua(s,o,u){o||(o=0);let d=new fe.Parser(s,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${m}`);let v=[f,m],T=d.parseUShort(),_=d.parseUShort(),R=d.parseOffset32(),N=d.parseUShort(),q=d.parseOffset32(),V=f>1||m>0?d.parseUShort():void 0;u!==void 0&&ye.argument(_>=u.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),N>0&&ye.argument(_>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let ge=[];for(let it=0;it<_;it++)d.offset=o+R,d.relativeOffset=it*T,ge.push(d.parseStruct(ta));d.offset=o,d.relativeOffset=q;let ce=d.parseUShortList(N),Ce=[];for(let it=0;it<N;it++)d.offset=o+q,d.relativeOffset=ce[it],Ce.push(Ca.apply(d));return{version:v,axes:ge,values:Ce,elidedFallbackNameID:V}}var rs=new Array(5);rs[1]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:1},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`value${s}`,type:"FLOAT",value:o.value}]},rs[2]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:2},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${s}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${s}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${s}`,type:"FLOAT",value:o.rangeMaxValue}]},rs[3]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:3},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`value${s}`,type:"FLOAT",value:o.value},{name:`linkedValue${s}`,type:"FLOAT",value:o.linkedValue}]},rs[4]=function(s,o){let u=[{name:`format${s}`,type:"USHORT",value:4},{name:`axisCount${s}`,type:"USHORT",value:o.axisValues.length},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)u=u.concat([{name:`format${s}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${s}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return u};function ms(s,o){return new We.Record("axisRecord_"+s,[{name:"axisTag_"+s,type:"TAG",value:o.tag},{name:"axisNameID_"+s,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+s,type:"USHORT",value:o.ordering}])}function Sa(s,o){let u=o.format,d=rs[u];ye.argument(d!==void 0,`Unknown axis value table format ${u}`);let f=d(s,o);return new We.Table("axisValueTable_"+s,f)}function rl(s){let o=new We.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:s.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:s.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:s.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let m=0;m<s.axes.length;m++){let v=ms(m,s.axes[m]);o.offsetToAxisValueOffsets+=v.sizeOf(),o.fields=o.fields.concat(v.fields)}let u=[],d=[],f=s.values.length*2;for(let m=0;m<s.values.length;m++){let v=Sa(m,s.values[m]);u.push({name:"offset_"+m,type:"USHORT",value:f}),f+=v.sizeOf(),d=d.concat(v.fields)}return o.fields=o.fields.concat(u),o.fields=o.fields.concat(d),o}var Qi={make:rl,parse:Ua};function yo(s,o){return new We.Record("axisValueMap_"+s,[{name:"fromCoordinate_"+s,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+s,type:"F2DOT14",value:o.toCoordinate}])}function za(s,o){let u=new We.Record("segmentMap_"+s,[{name:"positionMapCount_"+s,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let m=yo(`${s}_${f}`,o.axisValueMaps[f]);d=d.concat(m.fields)}return u.fields=u.fields.concat(d),u}function nl(s,o){ye.argument(s.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let u=new We.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:s.axisSegmentMaps.length}]);for(let d=0;d<s.axisSegmentMaps.length;d++){let f=za(d,s.axisSegmentMaps[d]);u.fields=u.fields.concat(f.fields)}return u}function Ha(s,o,u){o||(o=0);let d=new pe(s,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${m}`),d.skip("uShort",1);let v=d.parseUShort();ye.argument(v===u.axes.length,"avar axis count must correspond to fvar axis count");let T=[];for(let _=0;_<v;_++){let R=[],N=d.parseUShort();for(let q=0;q<N;q++){let V=d.parseF2Dot14(),ge=d.parseF2Dot14();R.push({fromCoordinate:V,toCoordinate:ge})}T.push({axisValueMaps:R})}return{version:[f,m],axisSegmentMaps:T}}var _a={make:nl,parse:Ha};function ie(s,o,u,d){let f=new fe.Parser(s,o),m=f.parseTupleVariationStore(f.relativeOffset,u.axes.length,"cvar",d),v=f.parseUShort(),T=f.parseUShort();return v!==1&&console.warn(`Unsupported cvar table version ${v}.${T}`),{version:[v,T],...m}}function Fe(){console.warn("Writing of cvar tables is not yet supported.")}var yt={make:Fe,parse:ie};function Tt(s,o,u,d){let f=new fe.Parser(s,o),m=f.parseUShort(),v=f.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${v}`);let T=f.parseUShort();T!==u.axes.length&&console.warn(`axisCount ${T} in gvar table does not match the number of axes ${u.axes.length} in the fvar table!`);let _=f.parseUShort(),R=f.parsePointer32(function(){return this.parseTupleRecords(_,T)}),N=f.parseTupleVariationStoreList(T,"gvar",d);return{version:[m,v],sharedTuples:R,glyphVariations:N}}function Oe(){console.warn("Writing of gvar tables is not yet supported.")}var _t={make:Oe,parse:Tt};function hr(s,o){let u={},d=new fe.Parser(s,o);u.version=d.parseUShort(),ye.argument(u.version<=1,"Unsupported gasp table version."),u.numRanges=d.parseUShort(),u.gaspRanges=[];for(let f=0;f<u.numRanges;f++)u.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return u}function Fr(s){let o=new We.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:s.numRanges}]);for(let u in s.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:s.gaspRanges[u].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:s.gaspRanges[u].rangeGaspBehavior});return o}var L={parse:hr,make:Fr};function j(s,o){let u=new Map,d=s.buffer,f=new pe(s,o);if(f.parseUShort()!==0)return u;f.relativeOffset=f.parseOffset32();let m=s.byteOffset+o+f.relativeOffset,v=f.parseUShort(),T=new Map;for(let _=0;_<v;_++){let R=f.parseUShort(),N=f.parseUShort(),q=m+f.parseOffset32(),V=f.parseULong(),ge=T.get(q);ge===void 0&&(ge=new Uint8Array(d,q,V),T.set(q,ge));for(let ce=R;ce<=N;ce++)u.set(ce,ge)}return u}function O(s){let o=Array.from(s.keys()).sort(),u=[],d=[],f=new Map,m=0,v={endGlyphID:null};for(let V=0,ge=o.length;V<ge;V++){let ce=o[V],Ce=s.get(ce),it=f.get(Ce);it===void 0&&(it=m,d.push(Ce),f.set(Ce,it),m+=Ce.byteLength),ce-1===v.endGlyphID&&it===v.svgDocOffset?v.endGlyphID=ce:(v={startGlyphID:ce,endGlyphID:ce,svgDocOffset:it,svgDocLength:Ce.byteLength},u.push(v))}let T=u.length,_=d.length,R=2+T*12,N=new Array(4+T*4+_),q=0;N[q++]={name:"version",type:"USHORT",value:0},N[q++]={name:"svgDocumentListOffset",type:"ULONG",value:10},N[q++]={name:"reserved",type:"ULONG",value:0},N[q++]={name:"numEntries",type:"USHORT",value:T};for(let V=0;V<T;V++){let ge="documentRecord_"+V,{startGlyphID:ce,endGlyphID:Ce,svgDocOffset:it,svgDocLength:pr}=u[V];N[q++]={name:ge+"_startGlyphID",type:"USHORT",value:ce},N[q++]={name:ge+"_endGlyphID",type:"USHORT",value:Ce},N[q++]={name:ge+"_svgDocOffset",type:"ULONG",value:R+it},N[q++]={name:ge+"_svgDocLength",type:"ULONG",value:pr}}for(let V=0;V<_;V++)N[q++]={name:"svgDoc_"+V,type:"LITERAL",value:d[V]};return new We.Table("SVG ",N)}var H={make:O,parse:j};function Qe(s){return Math.log(s)/Math.log(2)|0}function ke(s){for(;s.length%4!==0;)s.push(0);let o=0;for(let u=0;u<s.length;u+=4)o+=(s[u]<<24)+(s[u+1]<<16)+(s[u+2]<<8)+s[u+3];return o%=Math.pow(2,32),o}function st(s,o,u,d){return new We.Record("Table Record",[{name:"tag",type:"TAG",value:s!==void 0?s:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:u!==void 0?u:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function ot(s){let o=new We.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);o.tables=s,o.numTables=s.length;let u=Math.pow(2,Qe(o.numTables));o.searchRange=16*u,o.entrySelector=Qe(u),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],m=o.sizeOf()+st().sizeOf()*o.numTables;for(;m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0});for(let v=0;v<s.length;v+=1){let T=s[v];ye.argument(T.tableName.length===4,"Table name"+T.tableName+" is invalid.");let _=T.sizeOf(),R=st(T.tableName,ke(T.encode()),m,_);for(d.push({name:R.tag+" Table Record",type:"RECORD",value:R}),f.push({name:T.tableName+" table",type:"RECORD",value:T}),m+=_,ye.argument(!isNaN(m),"Something went wrong calculating the offset.");m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(v,T){return v.value.tag>T.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function zt(s,o,u){for(let d=0;d<o.length;d+=1){let f=s.charToGlyphIndex(o[d]);if(f>0)return s.glyphs.get(f).getMetrics()}return u}function fr(s){let o=0;for(let u=0;u<s.length;u+=1)o+=s[u];return o/s.length}function ln(s){let o=[],u=[],d=[],f=[],m=[],v=[],T=[],_,R=0,N=0,q=0,V=0,ge=0;for(let Zn=0;Zn<s.glyphs.length;Zn+=1){let ia=s.glyphs.get(Zn),Ya=ia.unicode|0;if(isNaN(ia.advanceWidth))throw new Error("Glyph "+ia.name+" ("+Zn+"): advanceWidth is not a number.");(_>Ya||_===void 0)&&Ya>0&&(_=Ya),R<Ya&&(R=Ya);let Co=Li.getUnicodeRange(Ya);if(Co<32)N|=1<<Co;else if(Co<64)q|=1<<Co-32;else if(Co<96)V|=1<<Co-64;else if(Co<123)ge|=1<<Co-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(ia.name===".notdef")continue;let al=ia.getMetrics();o.push(al.xMin),u.push(al.yMin),d.push(al.xMax),f.push(al.yMax),v.push(al.leftSideBearing),T.push(al.rightSideBearing),m.push(ia.advanceWidth)}let ce={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:fr(m),minLeftSideBearing:Math.min.apply(null,v),maxLeftSideBearing:Math.max.apply(null,v),minRightSideBearing:Math.min.apply(null,T)};ce.ascender=s.ascender,ce.descender=s.descender;let Ce=0;s.weightClass>=600&&(Ce|=s.macStyleValues.BOLD),s.italicAngle<0&&(Ce|=s.macStyleValues.ITALIC);let it=us.make({flags:3,unitsPerEm:s.unitsPerEm,xMin:ce.xMin,yMin:ce.yMin,xMax:ce.xMax,yMax:ce.yMax,lowestRecPPEM:3,macStyle:Ce,createdTimestamp:s.createdTimestamp}),pr=ts.make({ascender:ce.ascender,descender:ce.descender,advanceWidthMax:ce.advanceWidthMax,minLeftSideBearing:ce.minLeftSideBearing,minRightSideBearing:ce.minRightSideBearing,xMaxExtent:ce.maxLeftSideBearing+(ce.xMax-ce.xMin),numberOfHMetrics:s.glyphs.length}),or=Do.make(s.glyphs.length),_r=Li.make(Object.assign({xAvgCharWidth:Math.round(ce.advanceWidthAvg),usFirstCharIndex:_,usLastCharIndex:R,ulUnicodeRange1:N,ulUnicodeRange2:q,ulUnicodeRange3:V,ulUnicodeRange4:ge,sTypoAscender:ce.ascender,sTypoDescender:ce.descender,sTypoLineGap:0,usWinAscent:ce.yMax,usWinDescent:Math.abs(ce.yMin),ulCodePageRange1:1,sxHeight:zt(s,"xyvw",{yMax:Math.round(ce.ascender/2)}).yMax,sCapHeight:zt(s,"HIKLEFJMNTZBDPRAGOQSUVWXY",ce).yMax,usDefaultChar:s.hasChar(" ")?32:0,usBreakChar:s.hasChar(" ")?32:0},s.tables.os2)),en=$a.make(s.glyphs),Fn=Br.make(s.glyphs),Vn=s.getEnglishName("fontFamily"),qn=s.getEnglishName("fontSubfamily"),Ns=Vn+" "+qn,Ao=s.getEnglishName("postScriptName");Ao||(Ao=Vn.replace(/\s/g,"")+"-"+qn);let tn={};for(let Zn in s.names)tn[Zn]=s.names[Zn];tn.unicode=tn.unicode||{},tn.macintosh=tn.macintosh||{},tn.windows=tn.windows||{};let Na=s.names.unicode||{},Fi=s.names.macintosh||{},mr=s.names.windows||{};for(let Zn in tn){if(tn[Zn]=tn[Zn]||{},!tn[Zn].uniqueID){let ia=s.getEnglishName("manufacturer")||"";tn[Zn].uniqueID={en:`${ia}: ${Ns}`}}tn[Zn].postScriptName||(tn[Zn].postScriptName={en:Ao})}tn.unicode.preferredFamily||(tn.unicode.preferredFamily=Na.fontFamily||Fi.fontFamily||mr.fontFamily),tn.macintosh.preferredFamily||(tn.macintosh.preferredFamily=Fi.fontFamily||Na.fontFamily||mr.fontFamily),tn.windows.preferredFamily||(tn.windows.preferredFamily=mr.fontFamily||Na.fontFamily||Fi.fontFamily),tn.unicode.preferredSubfamily||(tn.unicode.preferredSubfamily=Na.fontSubfamily||Fi.fontSubfamily||mr.fontSubfamily),tn.macintosh.preferredSubfamily||(tn.macintosh.preferredSubfamily=Fi.fontSubfamily||Na.fontSubfamily||mr.fontSubfamily),tn.windows.preferredSubfamily||(tn.windows.preferredSubfamily=mr.fontSubfamily||Na.fontSubfamily||Fi.fontSubfamily);let sr=[],ir=kn.make(tn,sr),Ei=sr.length>0?tl.make(sr):void 0,Ml=xo.make(s),gd=Xi.make(s.glyphs,{version:s.getEnglishName("version"),fullName:Ns,familyName:Vn,weightName:qn,postScriptName:Ao,unitsPerEm:s.unitsPerEm,fontBBox:[0,ce.yMin,ce.ascender,ce.advanceWidthMax],topDict:s.tables.cff&&s.tables.cff.topDict||{}}),Xl=s.metas&&Object.keys(s.metas).length>0?Hs.make(s.metas):void 0,To=[it,pr,or,_r,ir,Fn,Ml,gd,en];Ei&&To.push(Ei);let $i={gsub:di,cpal:ar,colr:hi,stat:Qi,avar:_a,cvar:yt,fvar:fi,gvar:_t,gasp:L,svg:H},qa={avar:[s.tables.fvar],fvar:[s.names]};for(let Zn in $i){let ia=s.tables[Zn];if(ia){let Ya=$i[Zn].make.call(s,ia,...qa[Zn]||[]);Ya&&To.push(Ya)}}Xl&&To.push(Xl);let Ni=ot(To),Ra=Ni.encode(),Ui=ke(Ra),zi=Ni.fields,Ls=!1;for(let Zn=0;Zn<zi.length;Zn+=1)if(zi[Zn].name==="head table"){zi[Zn].value.checkSumAdjustment=2981146554-Ui,Ls=!0;break}if(!Ls)throw new Error("Could not find head table with checkSum to adjust.");return Ni}var On={make:ot,fontToTable:ln,computeCheckSum:ke};function En(s,o){let u=0,d=s.length-1;for(;u<=d;){let f=u+d>>>1,m=s[f].tag;if(m===o)return f;m<o?u=f+1:d=f-1}return-u-1}function Gn(s,o){let u=0,d=s.length-1;for(;u<=d;){let f=u+d>>>1,m=s[f];if(m===o)return f;m<o?u=f+1:d=f-1}return-u-1}function kr(s,o){let u,d=0,f=s.length-1;for(;d<=f;){let m=d+f>>>1;u=s[m];let v=u.start;if(v===o)return u;v<o?d=m+1:f=m-1}if(d>0)return u=s[d-1],o>u.end?0:u}function Cn(s,o){this.font=s,this.tableName=o}Cn.prototype={searchTag:En,binSearch:Gn,getTable:function(s){let o=this.font.tables[this.tableName];return!o&&s&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let s=this.getTable();return s?s.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let s=this.getTable();if(!s)return;let o=!1;for(let u=0;u<s.scripts.length;u++){let d=s.scripts[u].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(s,o){let u=this.getTable(o);if(u){s=s||"DFLT";let d=u.scripts,f=En(u.scripts,s);if(f>=0)return d[f].script;if(o){let m={tag:s,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,m),m.script}}},getLangSysTable:function(s,o,u){let d=this.getScriptTable(s,u);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=En(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(u){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,m),m.langSys}}},getFeatureTable:function(s,o,u,d){let f=this.getLangSysTable(s,o,d);if(f){let m,v=f.featureIndexes,T=this.font.tables[this.tableName].features;for(let _=0;_<v.length;_++)if(m=T[v[_]],m.tag===u)return m.feature;if(d){let _=T.length;return ye.assert(_===0||u>=T[_-1].tag,"Features must be added in alphabetical order."),m={tag:u,feature:{params:0,lookupListIndexes:[]}},T.push(m),v.push(_),m.feature}}},getLookupTables:function(s,o,u,d,f){let m=this.getFeatureTable(s,o,u,f),v=[];if(m){let T,_=m.lookupListIndexes,R=this.font.tables[this.tableName].lookups;for(let N=0;N<_.length;N++)T=R[_[N]],T.lookupType===d&&v.push(T);if(v.length===0&&f){T={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let N=R.length;return R.push(T),_.push(N),[T]}}return v},getGlyphClass:function(s,o){switch(s.format){case 1:return s.startGlyph<=o&&o<s.startGlyph+s.classes.length?s.classes[o-s.startGlyph]:0;case 2:{let u=kr(s.ranges,o);return u?u.classId:0}}},getCoverageIndex:function(s,o){switch(s.format){case 1:{let u=Gn(s.glyphs,o);return u>=0?u:-1}case 2:{let u=kr(s.ranges,o);return u?u.index+o-u.start:-1}}},expandCoverage:function(s){if(s.format===1)return s.glyphs;{let o=[],u=s.ranges;for(let d=0;d<u.length;d++){let f=u[d],m=f.start,v=f.end;for(let T=m;T<=v;T++)o.push(T)}return o}}};var Ln=Cn;function Vs(s){Ln.call(this,s,"gpos")}Vs.prototype=Ln.prototype,Vs.prototype.init=function(){let s=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(s)},Vs.prototype.getKerningValue=function(s,o,u){for(let d=0;d<s.length;d++){let f=s[d].subtables;for(let m=0;m<f.length;m++){let v=f[m],T=this.getCoverageIndex(v.coverage,o);if(!(T<0))switch(v.posFormat){case 1:{let _=v.pairSets[T];for(let R=0;R<_.length;R++){let N=_[R];if(N.secondGlyph===u)return N.value1&&N.value1.xAdvance||0}break}case 2:{let _=this.getGlyphClass(v.classDef1,o),R=this.getGlyphClass(v.classDef2,u),N=v.classRecords[_][R];return N.value1&&N.value1.xAdvance||0}}}}return 0},Vs.prototype.getKerningTables=function(s,o){if(this.font.tables.gpos)return this.getLookupTables(s,o,"kern",2)};var La=Vs;function ds(s,o){let u=s.length;if(u!==o.length)return!1;for(let d=0;d<u;d++)if(s[d]!==o[d])return!1;return!0}function ql(s,o,u){let d=0,f=s.length-1,m=null;for(;d<=f;){let v=Math.floor((d+f)/2),T=s[v],_=T[o];if(_<u)d=v+1;else if(_>u)f=v-1;else{m=T;break}}return m}function Ss(s,o,u){let d=0,f=s.length-1;for(;d<=f;){let m=Math.floor((d+f)/2),v=s[m];if(v[o]<u)d=m+1;else if(v[o]>u)f=m-1;else return m}return-1}function Bo(s,o,u){let d=0,f=s.length,m=(v,T)=>v[o]-T[o];for(;d<f;){let v=d+f>>>1;m(s[v],u)<0?d=v+1:f=v}return s.splice(d,0,u),d}function Tl(s){return s[0]===31&&s[1]===139&&s[2]===8}function _c(s){let o=new DataView(s.buffer,s.byteOffset,s.byteLength),u=10,d=s.byteLength-8,f=o.getInt8(3);if(f&4&&(u+=2+o.getUint16(u,!0)),f&8)for(;u<d&&s[u++]!==0;);if(f&16)for(;u<d&&s[u++]!==0;);if(f&2&&(u+=2),u>=d)throw new Error("Can't find compressed blocks");let m=o.getUint32(o.byteLength-4,!0);return Z(s.subarray(u,d),new Uint8Array(m))}function ki(s){return{x:s.x,y:s.y,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour}}function ka(s){return{glyphIndex:s.glyphIndex,xScale:s.xScale,scale01:s.scale01,scale10:s.scale10,yScale:s.yScale,dx:s.dx,dy:s.dy}}function Es(s){Ln.call(this,s,"gsub")}function Cl(s,o,u){let d=s.subtables;for(let f=0;f<d.length;f++){let m=d[f];if(m.substFormat===o)return m}if(u)return d.push(u),u}Es.prototype=Ln.prototype,Es.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Es.prototype.getSingle=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,1);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N;if(_.substFormat===1){let q=_.deltaGlyphId;for(N=0;N<R.length;N++){let V=R[N];d.push({sub:V,by:V+q})}}else{let q=_.substitute;for(N=0;N<R.length;N++)d.push({sub:R[N],by:q[N]})}}}return d},Es.prototype.getMultiple=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,2);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N;for(N=0;N<R.length;N++){let q=R[N],V=_.sequences[N];d.push({sub:q,by:V})}}}return d},Es.prototype.getAlternates=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,3);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N=_.alternateSets;for(let q=0;q<R.length;q++)d.push({sub:R[q],by:N[q]})}}return d},Es.prototype.getLigatures=function(s,o,u){let d=[],f=this.getLookupTables(o,u,s,4);for(let m=0;m<f.length;m++){let v=f[m].subtables;for(let T=0;T<v.length;T++){let _=v[T],R=this.expandCoverage(_.coverage),N=_.ligatureSets;for(let q=0;q<R.length;q++){let V=R[q],ge=N[q];for(let ce=0;ce<ge.length;ce++){let Ce=ge[ce];d.push({sub:[V].concat(Ce.components),by:Ce.ligGlyph})}}}}return d},Es.prototype.addSingle=function(s,o,u,d){let f=this.getLookupTables(u,d,s,1,!0)[0],m=Cl(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ye.assert(m.coverage.format===1,"Single: unable to modify coverage table format "+m.coverage.format);let v=o.sub,T=this.binSearch(m.coverage.glyphs,v);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,v),m.substitute.splice(T,0,0)),m.substitute[T]=o.by},Es.prototype.addMultiple=function(s,o,u,d){ye.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(u,d,s,2,!0)[0],m=Cl(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});ye.assert(m.coverage.format===1,"Multiple: unable to modify coverage table format "+m.coverage.format);let v=o.sub,T=this.binSearch(m.coverage.glyphs,v);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,v),m.sequences.splice(T,0,0)),m.sequences[T]=o.by},Es.prototype.addAlternate=function(s,o,u,d){let f=this.getLookupTables(u,d,s,3,!0)[0],m=Cl(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ye.assert(m.coverage.format===1,"Alternate: unable to modify coverage table format "+m.coverage.format);let v=o.sub,T=this.binSearch(m.coverage.glyphs,v);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,v),m.alternateSets.splice(T,0,0)),m.alternateSets[T]=o.by},Es.prototype.addLigature=function(s,o,u,d){let f=this.getLookupTables(u,d,s,4,!0)[0],m=f.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=m),ye.assert(m.coverage.format===1,"Ligature: unable to modify coverage table format "+m.coverage.format);let v=o.sub[0],T=o.sub.slice(1),_={ligGlyph:o.by,components:T},R=this.binSearch(m.coverage.glyphs,v);if(R>=0){let N=m.ligatureSets[R];for(let q=0;q<N.length;q++)if(ds(N[q].components,T))return;N.push(_)}else R=-1-R,m.coverage.glyphs.splice(R,0,v),m.ligatureSets.splice(R,0,[_])},Es.prototype.getFeature=function(s,o,u){if(/ss\d\d/.test(s))return this.getSingle(s,o,u);switch(s){case"aalt":case"salt":return this.getSingle(s,o,u).concat(this.getAlternates(s,o,u));case"dlig":case"liga":case"rlig":return this.getLigatures(s,o,u);case"ccmp":return this.getMultiple(s,o,u).concat(this.getLigatures(s,o,u));case"stch":return this.getMultiple(s,o,u)}},Es.prototype.add=function(s,o,u,d){if(/ss\d\d/.test(s))return this.addSingle(s,o,u,d);switch(s){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(s,o,u,d):this.addAlternate(s,o,u,d);case"dlig":case"liga":case"rlig":return this.addLigature(s,o,u,d);case"ccmp":return o.by instanceof Array?this.addMultiple(s,o,u,d):this.addLigature(s,o,u,d)}};var ff=Es,id=class{constructor(s){this.defaultValue=255,this.font=s}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(s){let o=[],u=this.cpal();if(!u)return o;for(let d=0;d<u.colorRecordIndices.length;d++){let f=u.colorRecordIndices[d],m=[];for(let v=f;v<f+u.numPaletteEntries;v++)m.push(Ct(u.colorRecords[v],s||"hexa"));o.push(m)}return o}toCPALcolor(s){return Array.isArray(s)?s.map(o=>dt(o,"raw")):dt(s,"raw")}fillPalette(s,o=[],u=this.cpal().numPaletteEntries){return s=Number.isInteger(s)?this.get(s,"raw"):s,Object.assign(Array(u).fill(this.defaultValue),this.toCPALcolor(s).concat(this.toCPALcolor(o)))}extend(s){if(this.ensureCPAL(Array(s).fill(this.defaultValue)))return;let o=this.cpal(),u=o.numPaletteEntries+s,d=this.getAll().map(f=>this.fillPalette(f,[],u));o.numPaletteEntries=u,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(s,o="hexa"){return this.getAll(o)[s]||null}getColor(s,o=0,u="hexa"){return vt(this.font,s,o,u)}setColor(s,o,u=0){s=parseInt(s),u=parseInt(u);let d=this.getAll("raw"),f=d[u];if(!f)throw Error(`paletteIndex ${u} out of range`);let m=this.cpal(),v=m.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+s>v&&(this.extend(o.length+s-v),d=this.getAll("raw"),f=d[u]);for(let T=0;T<o.length;T++)f[T+s]=this.toCPALcolor(o[T]);m.colorRecords=d.flat(),this.updateIndices()}add(s){if(this.ensureCPAL(s))return;let o=this.cpal(),u=o.numPaletteEntries;s&&s.length?(s=this.toCPALcolor(s),s.length>u?this.extend(s.length-u):s.length<u&&(s=this.fillPalette(s)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...s)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(u).fill(this.defaultValue)))}delete(s){let o=this.getAll("raw");delete o[s];let u=this.cpal();u.colorRecordIndices.pop(),u.colorRecords=o.flat()}deleteColor(s,o){if(s===o)throw Error("replacementIndex cannot be the same as colorIndex");let u=this.cpal(),d=this.getAll("raw"),f=[];if(o>u.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${u.numPaletteEntries-1}, replacementIndex: ${o})`);for(let T=0;T<d.length;T++){let _=d[T].filter((R,N)=>N!==s);f.push(_)}let m=this.font.tables.colr;if(m){let T=m.layerRecords;for(let _=0;_<T.length;_++){let R=T[_].paletteIndex;if(R>s)T[_].paletteIndex-=1;else if(R===s){let N=0;for(let q=0;q<d.length;q++)if(o>s&&o<=s+d[q].length){N++;break}T[_].paletteIndex=o-N}}this.font.tables.colr={...m,layerRecords:T}}let v=f.flat();for(let T=0;T<d.length;T++)u.colorRecordIndices[T]-=T;u.numPaletteEntries=Math.max(0,u.numPaletteEntries-1),u.colorRecords=this.toCPALcolor(v)}ensureCPAL(s){return this.cpal()?!1:(!s||!s.length?s=[this.defaultValue]:s=this.toCPALcolor(s),this.font.tables.cpal={version:0,numPaletteEntries:s.length,colorRecords:s,colorRecordIndices:[0]},!0)}updateIndices(){let s=this.cpal(),o=Math.ceil(s.colorRecords.length/s.numPaletteEntries);s.colorRecordIndices=[];for(let u=0;u<o;u++)s.colorRecordIndices.push(u*s.numPaletteEntries)}},pf=class{constructor(s){this.font=s}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(s){let o=this.font,u=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return u;let m=ql(d.baseGlyphRecords,"glyphID",s);if(!m)return u;let v=m.firstLayerIndex,T=m.numLayers;for(let _=0;_<T;_++){let R=d.layerRecords[v+_];u.push({glyph:o.glyphs.get(R.glyphID),paletteIndex:R.paletteIndex})}return u}add(s,o,u){let d=this.get(s);o=Array.isArray(o)?o:[o],u===void 0||u===1/0||u>d.length?u=d.length:u<0&&(u=d.length+1+u%(d.length+1),u>=d.length+1&&(u-=d.length+1));let f=[];for(let m=0;m<u;m++){let v=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:v,paletteIndex:d[m].paletteIndex})}for(let m of o){let v=Number.isInteger(m.glyph)?m.glyph:m.glyph.index;f.push({glyphID:v,paletteIndex:m.paletteIndex})}for(let m=u;m<d.length;m++){let v=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:v,paletteIndex:d[m].paletteIndex})}this.updateColrTable(s,f)}setPaletteIndex(s,o,u){let d=this.get(s);d[o]?(d=d.map((f,m)=>({glyphID:f.glyph.index,paletteIndex:m===o?u:f.paletteIndex})),this.updateColrTable(s,d)):console.error("Invalid layer index")}remove(s,o,u=o){let d=this.get(s);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,u-o+1),this.updateColrTable(s,d)}updateColrTable(s,o){this.ensureCOLR();let u=this.font.tables.colr,d=Ss(u.baseGlyphRecords,"glyphID",s);if(d===-1){let _={glyphID:s,firstLayerIndex:u.layerRecords.length,numLayers:0};d=Bo(u.baseGlyphRecords,"glyphID",_)}let f=u.baseGlyphRecords[d],m=f.numLayers,v=o.length,T=v-m;if(T>0){let _=o.slice(m).map(R=>({glyphID:R.glyphID,paletteIndex:R.paletteIndex}));u.layerRecords.splice(f.firstLayerIndex+m,0,..._)}else T<0&&u.layerRecords.splice(f.firstLayerIndex+v,-T);for(let _=0;_<Math.min(m,v);_++)u.layerRecords[f.firstLayerIndex+_]={glyphID:o[_].glyphID,paletteIndex:o[_].paletteIndex};if(f.numLayers=v,T!==0)for(let _=0;_<u.baseGlyphRecords.length;_++){let R=u.baseGlyphRecords[_];_===d||R.firstLayerIndex<f.firstLayerIndex||(u.baseGlyphRecords[_].firstLayerIndex+=T)}}},mf=class{constructor(s){this.font=s,this.cache=new WeakMap}get(s){let o=this.getOrCreateSvgImageCacheEntry(s);return o&&o.image}getAsync(s){let o=this.getOrCreateSvgImageCacheEntry(s);return o&&o.promise}getOrCreateSvgImageCacheEntry(s){let o=this.font.tables.svg;if(o===void 0)return;let u=o.get(s);if(u===void 0)return;let d=this.cache.get(u);d===void 0&&(d=vo(u),this.cache.set(u,d));let f=d.images.get(s);return f===void 0&&(f=sl(this.font,d.template,s),f.promise.then(m=>{if(f.image=m,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(s)}catch(v){console.error("font.onGlyphUpdated",s,v)}}),d.images.set(s,f)),f}};function vo(s){return{template:gf(s).then(od),images:new Map}}function sl(s,o,u){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=u,f=d.join(""));let m=ld(f,s.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var gf=typeof DecompressionStream=="function"?ad:Yl;function Yl(s){try{return Promise.resolve(new TextDecoder().decode(Tl(s)?_c(s):s))}catch(o){return Promise.reject(o)}}function ad(s){if(Tl(s))return new Response(new Response(s).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(s))}catch(o){return Promise.reject(o)}}function od(s){let o=s.indexOf("<svg"),u=s.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(s.substring(o,u)))return s;let d=s.lastIndexOf("</svg>");return[s.substring(0,u),"<defs>",s.substring(u,d),'</defs><use href="#glyph',"",'"/>',s.substring(d)]}function ld(s,o){let u=new DOMParser().parseFromString(s,"image/svg+xml").documentElement,d=u.viewBox.baseVal,f=u.width.baseVal,m=u.height.baseVal,v=1,T=1;d.width>0&&d.height>0&&(f.unitType===1?(v=f.valueInSpecifiedUnits/d.width,T=m.unitType===1?m.valueInSpecifiedUnits/d.height:v):m.unitType===1?(T=m.valueInSpecifiedUnits/d.height,v=T):o&&(v=o/d.width,T=o/d.height));let _=document.createElement("div");_.style.position="fixed",_.style.visibility="hidden",_.appendChild(u),document.body.appendChild(_);let R=u.getBBox();document.body.removeChild(_);let N=(R.x-d.x)*v,q=(d.y-R.y)*T,V=R.width*v,ge=R.height*T;u.setAttribute("viewBox",[R.x,R.y,R.width,R.height].join(" ")),v!==1&&u.setAttribute("width",V),T!==1&&u.setAttribute("height",ge);let ce=new Image(V,ge);return ce.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u.outerHTML),{leftSideBearing:N,baseline:q,image:ce}}var Lc=new WeakMap;function v0(s,o,u,d,f){let m;return(o&d)>0?(m=s.parseByte(),(o&f)===0&&(m=-m),m=u+m):(o&f)>0?m=u:m=u+s.parseShort(),m}function Sl(s,o,u){let d=new fe.Parser(o,u);s._numberOfContours=d.parseShort(),s._xMin=d.parseShort(),s._yMin=d.parseShort(),s._xMax=d.parseShort(),s._yMax=d.parseShort();let f,m;if(s._numberOfContours>0){let v=s.endPointIndices=[];for(let _=0;_<s._numberOfContours;_+=1)v.push(d.parseUShort());s.instructionLength=d.parseUShort(),s.instructions=[];for(let _=0;_<s.instructionLength;_+=1)s.instructions.push(d.parseByte());let T=v[v.length-1]+1;f=[];for(let _=0;_<T;_+=1)if(m=d.parseByte(),f.push(m),(m&8)>0){let R=d.parseByte();for(let N=0;N<R;N+=1)f.push(m),_+=1}if(ye.argument(f.length===T,"Bad flags."),v.length>0){let _=[],R;if(T>0){for(let V=0;V<T;V+=1)m=f[V],R={},R.onCurve=!!(m&1),R.lastPointOfContour=v.indexOf(V)>=0,_.push(R);let N=0;for(let V=0;V<T;V+=1)m=f[V],R=_[V],R.x=v0(d,m,N,2,16),N=R.x;let q=0;for(let V=0;V<T;V+=1)m=f[V],R=_[V],R.y=v0(d,m,q,4,32),q=R.y}s.points=_}else s.points=[]}else if(s._numberOfContours===0)s.points=[];else{s.isComposite=!0,s.points=[],s.components=[];let v=!0;for(;v;){f=d.parseUShort();let T={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(T.dx=d.parseShort(),T.dy=d.parseShort()):T.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(T.dx=d.parseChar(),T.dy=d.parseChar()):T.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?T.xScale=T.yScale=d.parseF2Dot14():(f&64)>0?(T.xScale=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()):(f&128)>0&&(T.xScale=d.parseF2Dot14(),T.scale01=d.parseF2Dot14(),T.scale10=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()),s.components.push(T),v=!!(f&32)}if(f&256){s.instructionLength=d.parseUShort(),s.instructions=[];for(let T=0;T<s.instructionLength;T+=1)s.instructions.push(d.parseByte())}}}function Pi(s,o){let u=[];for(let d=0;d<s.length;d+=1){let f=s[d],m={x:o.xScale*f.x+o.scale10*f.y+o.dx,y:o.scale01*f.x+o.yScale*f.y+o.dy,onCurve:f.onCurve,lastPointOfContour:f.lastPointOfContour};u.push(m)}return u}function w0(s){let o=[],u=[];for(let d=0;d<s.length;d+=1){let f=s[d];u.push(f),f.lastPointOfContour&&(o.push(u),u=[])}return ye.argument(u.length===0,"There are still points left in the current contour."),o}function A0(s){let o=new Ye;if(!s)return o;let u=w0(s);for(let d=0;d<u.length;++d){let f=u[d],m=f[f.length-1],v=f[0];if(m.onCurve)o.moveTo(m.x,m.y);else if(v.onCurve)o.moveTo(v.x,v.y);else{let T={x:(m.x+v.x)*.5,y:(m.y+v.y)*.5};o.moveTo(T.x,T.y)}for(let T=0;T<f.length;++T)if(m=v,v=f[(T+1)%f.length],m.onCurve)o.lineTo(m.x,m.y);else{let _=v;v.onCurve||(_={x:(m.x+v.x)*.5,y:(m.y+v.y)*.5}),o.quadraticCurveTo(m.x,m.y,_.x,_.y)}o.closePath()}return o}function T0(s,o){if(o.isComposite){Lc.has(s)||Lc.set(s,new Set);let u=Lc.get(s);u.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(u.has(f.glyphIndex))continue;let m=s.get(f.glyphIndex);if(m.getPath(),m.points){let v;if(f.matchedPoints===void 0)v=Pi(m.points,f);else{if(f.matchedPoints[0]>o.points.length-1||f.matchedPoints[1]>m.points.length-1)throw Error("Matched points out of range in "+o.name);let T=o.points[f.matchedPoints[0]],_=m.points[f.matchedPoints[1]],R={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};_=Pi([_],R)[0],R.dx=T.x-_.x,R.dy=T.y-_.y,v=Pi(m.points,R)}o.points=o.points.concat(v)}}}finally{u.delete(o.index)}}return A0(o.points)}function C0(s,o,u,d){let f=new zr.GlyphSet(d);for(let m=0;m<u.length-1;m+=1){let v=u[m],T=u[m+1];v!==T?f.push(m,zr.ttfGlyphLoader(d,m,Sl,s,o+v,T0)):f.push(m,zr.glyphLoader(d,m))}return f}function S0(s,o,u,d){let f=new zr.GlyphSet(d);return d._push=function(m){let v=u[m],T=u[m+1];v!==T?f.push(m,zr.ttfGlyphLoader(d,m,Sl,s,o+v,T0)):f.push(m,zr.glyphLoader(d,m))},f}function xf(s,o,u,d,f){return f.lowMemory?S0(s,o,u,d):C0(s,o,u,d)}var _0={getPath:A0,parse:xf},L0=class{constructor(s){this.font=s}normalizeCoordTags(s){for(let o in s)if(o.length<4){let u=o.padEnd(4," ");s[u]===void 0&&(s[u]=s[o]),delete s[o]}}getNormalizedCoords(s){s||(s=this.font.variation.get());let o=[];this.normalizeCoordTags(s);for(let u=0;u<this.fvar().axes.length;u++){let d=this.fvar().axes[u],f=s[d.tag];f===void 0&&(f=d.defaultValue),f<d.defaultValue?o.push((f-d.defaultValue+Number.EPSILON)/(d.defaultValue-d.minValue+Number.EPSILON)):o.push((f-d.defaultValue+Number.EPSILON)/(d.maxValue-d.defaultValue+Number.EPSILON))}if(this.avar())for(let u=0;u<this.avar().axisSegmentMaps.length;u++){let d=this.avar().axisSegmentMaps[u];for(let f=0;f<d.axisValueMaps.length;f++){let m=d.axisValueMaps[f];if(f>=1&&o[u]<m.fromCoordinate){let v=d.axisValueMaps[f-1];o[u]=((o[u]-v.fromCoordinate)*(m.toCoordinate-v.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-v.fromCoordinate+Number.EPSILON)+v.toCoordinate;break}}}return o}interpolatePoints(s,o,u){if(s.length===0)return;let d=0;for(;d<s.length;){let f=d,m=d,v=s[m];for(;!v.lastPointOfContour;)v=s[++m];for(;d<=m&&!u[d];)d++;if(d>m)continue;let T=d,_=d;for(d++;d<=m;)u[d]&&(this.deltaInterpolate(_+1,d-1,_,d,o,s),_=d),d++;_===T?this.deltaShift(f,m,_,o,s):(this.deltaInterpolate(_+1,m,_,T,o,s),T>0&&this.deltaInterpolate(f,T-1,_,T,o,s)),d=m+1}}deltaInterpolate(s,o,u,d,f,m){if(s>o)return;let v=["x","y"];for(let _=0;_<v.length;_++){let R=v[_];if(f[u][R]>f[d][R]){var T=u;u=d,d=T}let N=f[u][R],q=f[d][R],V=m[u][R],ge=m[d][R];if(N!==q||V===ge){let ce=N===q?0:(ge-V)/(q-N);for(let Ce=s;Ce<=o;Ce++){let it=f[Ce][R];it<=N?it+=V-N:it>=q?it+=ge-q:it=V+(it-N)*ce,m[Ce][R]=it}}}}deltaShift(s,o,u,d,f){let m=f[u].x-d[u].x,v=f[u].y-d[u].y;if(!(m===0&&v===0))for(let T=s;T<=o;T++)T!==u&&(f[T].x+=m,f[T].y+=v)}transformComponents(s,o,u,d,f,m){let v=0;for(let T=0;T<s.components.length;T++){let _=s.components[T],R=this.font.glyphs.get(_.glyphIndex),N=ka(_),q=d.indexOf(T);q>-1&&(N.dx+=Math.round(f.deltas[q]*m),N.dy+=Math.round(f.deltasY[q]*m));let V=Pi(this.getTransform(R,u).points,N);o.splice(v,V.length,...V),v+=R.points.length}}applyTupleVariationStore(s,o,u,d="gvar",f={}){u||(u=this.font.variation.get());let m=this.getNormalizedCoords(u),{headers:v,sharedPoints:T}=s,_=this.fvar().axes.length,R;d==="gvar"?R=o.map(ki):d==="cvar"&&(R=[...o]);for(let N=0;N<v.length;N++){let q=v[N],V=1;for(let ce=0;ce<_;ce++){let Ce=[0];switch(d){case"gvar":Ce=q.peakTuple?q.peakTuple:this.gvar().sharedTuples[q.sharedTupleRecordsIndex];break;case"cvar":Ce=q.peakTuple;break}if(Ce[ce]!==0){if(m[ce]===0){V=0;break}if(q.intermediateStartTuple)if(m[ce]<q.intermediateStartTuple[ce]||m[ce]>q.intermediateEndTuple[ce]){V=0;break}else m[ce]<Ce[ce]?V=V*(m[ce]-q.intermediateStartTuple[ce]+Number.EPSILON)/(Ce[ce]-q.intermediateStartTuple[ce]+Number.EPSILON):V=V*(q.intermediateEndTuple[ce]-m[ce]+Number.EPSILON)/(q.intermediateEndTuple[ce]-Ce[ce]+Number.EPSILON);else{if(m[ce]<Math.min(0,Ce[ce])||m[ce]>Math.max(0,Ce[ce])){V=0;break}V=(V*m[ce]+Number.EPSILON)/(Ce[ce]+Number.EPSILON)}}}if(V===0)continue;let ge=q.privatePoints.length?q.privatePoints:T;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,R,u,ge,q,V);else if(ge.length===0)for(let ce=0;ce<R.length;ce++){let Ce=R[ce];d==="gvar"?R[ce]={x:Math.round(Ce.x+q.deltas[ce]*V),y:Math.round(Ce.y+q.deltasY[ce]*V),onCurve:Ce.onCurve,lastPointOfContour:Ce.lastPointOfContour}:d==="cvar"&&(R[ce]=Math.round(Ce+q.deltas[ce]*V))}else{let ce;d==="gvar"?ce=R.map(ki):d==="cvar"&&(ce=R);let Ce=Array(o.length).fill(!1);for(let it=0;it<ge.length;it++){let pr=ge[it];if(pr<o.length){let or=ce[pr];d==="gvar"?(Ce[pr]=!0,or.x+=q.deltas[it]*V,or.y+=q.deltasY[it]*V):d==="cvar"&&(R[pr]=Math.round(or+q.deltas[it]*V))}}if(d==="gvar"){this.interpolatePoints(ce,R,Ce);for(let it=0;it<o.length;it++){let pr=ce[it].x-R[it].x,or=ce[it].y-R[it].y;R[it].x=Math.round(R[it].x+pr),R[it].y=Math.round(R[it].y+or)}}}}return R}getTransform(s,o){Number.isInteger(s)&&(s=this.font.glyphs.get(s));let u=s.getBlendPath,d=!!(s.points&&s.points.length),f=s;if(u||d){if(o||(o=this.font.variation.get()),d){let m=this.gvar()&&this.gvar().glyphVariations[s.index];if(m){let v=s.points,T=this.applyTupleVariationStore(m,v,o,"gvar",{glyph:s});f=new Ur(Object.assign({},s,{points:T,path:A0(T)}))}}else if(u){let m=s.getBlendPath(o);f=new Ur(Object.assign({},s,{path:m}))}}return this.font.tables.hvar&&(s._advanceWidth=typeof s._advanceWidth<"u"?s._advanceWidth:s.advanceWidth,s.advanceWidth=f.advanceWidth=Math.round(s._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),s._leftSideBearing=typeof s._leftSideBearing<"u"?s._leftSideBearing:s.leftSideBearing,s.leftSideBearing=f.leftSideBearing=Math.round(s._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(s){let o=this.font.tables.cvt,u=this.cvar();return!o||!o.length||!u||!u.headers.length?o:this.applyTupleVariationStore(u,o,s,"cvar")}getVariableAdjustment(s,o,u,d){d=d||this.font.variation.get();let f,m,v=this.font.tables[o];if(!v)throw Error(`trying to get variation adjustment from non-existent table "${v}"`);if(!v.itemVariationStore)throw Error(`trying to get variation adjustment from table "${v}" which does not have an itemVariationStore`);let T=v[u]&&v[u].map.length;if(T){let _=s;_>=T&&(_=T-1),{outerIndex:f,innerIndex:m}=v[u].map[_]}else f=0,m=s;return this.getDelta(v.itemVariationStore,f,m,d)}getDelta(s,o,u,d){if(o>=s.itemVariationSubtables.length)return 0;let f=s.itemVariationSubtables[o];if(u>=f.deltaSets.length)return 0;let m=f.deltaSets[u],v=this.getBlendVector(s,o,d),T=0;for(let _=0;_<f.regionIndexes.length;_++)T+=m[_]*v[_];return T}getBlendVector(s,o,u){u||(u=this.font.variation.get());let d=s.itemVariationSubtables[o],f=this.getNormalizedCoords(u),m=[];for(let v=0;v<d.regionIndexes.length;v++){let T=1,_=d.regionIndexes[v],R=s.variationRegions[_].regionAxes;for(let N=0;N<R.length;N++){let q=R[N],V;q.startCoord>q.peakCoord||q.peakCoord>q.endCoord||q.startCoord<0&&q.endCoord>0&&q.peakCoord!==0||q.peakCoord===0?V=1:f[N]<q.startCoord||f[N]>q.endCoord?V=0:f[N]===q.peakCoord?V=1:f[N]<q.peakCoord?V=(f[N]-q.startCoord+Number.EPSILON)/(q.peakCoord-q.startCoord+Number.EPSILON):V=(q.endCoord-f[N]+Number.EPSILON)/(q.endCoord-q.peakCoord+Number.EPSILON),T*=V}m[v]=T}return m}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},cd=class{constructor(s){this.font=s,this.process=new L0(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let s=this.getDefaultInstanceIndex();s>-1?this.set(s):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((s,o)=>(s[o.tag]=o.defaultValue,s),{})}getDefaultInstanceIndex(){let s=this.getDefaultCoordinates(),o=this.getInstanceIndex(s);return o<0&&(o=this.fvar().instances.findIndex(u=>u.name&&u.name.en==="Regular")),o}getInstanceIndex(s){return this.fvar().instances.findIndex(o=>Object.keys(s).every(u=>o.coordinates[u]===s[u]))}getInstance(s){return this.fvar().instances&&this.fvar().instances[s]}set(s){let o;if(Number.isInteger(s)){let u=this.getInstance(s);if(!u)throw Error(`Invalid instance index ${s}`);o={...u.coordinates}}else o=s,this.process.normalizeCoordTags(o);o=Object.assign({},this.font.defaultRenderOptions.variation,o),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:o})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},ra=1e6,il=64,_l=1e4,Zl,na,_s,k0;function I0(s){this.font=s,this.getCommands=function(o){return _0.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function bf(s){return s}function E0(s){return Math.sign(s)*Math.round(Math.abs(s))}function ud(s){return Math.sign(s)*Math.round(Math.abs(s*2))/2}function S(s){return Math.sign(s)*(Math.round(Math.abs(s)+.5)-.5)}function D(s){return Math.sign(s)*Math.ceil(Math.abs(s))}function ue(s){return Math.sign(s)*Math.floor(Math.abs(s))}var nt=function(s){let o=this.srPeriod,u=this.srPhase,d=this.srThreshold,f=1;return s<0&&(s=-s,f=-1),s+=d-u,s=Math.trunc(s/o)*o,s+=u,s<0?u*f:s*f},St={x:1,y:0,axis:"x",distance:function(s,o,u,d){return(u?s.xo:s.x)-(d?o.xo:o.x)},interpolate:function(s,o,u,d){let f,m,v,T,_,R,N;if(!d||d===this){if(f=s.xo-o.xo,m=s.xo-u.xo,_=o.x-o.xo,R=u.x-u.xo,v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){s.x=s.xo+(_+R)/2;return}s.x=s.xo+(_*T+R*v)/N;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,u,!0,!0),_=d.distance(o,o,!1,!0),R=d.distance(u,u,!1,!0),v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){St.setRelative(s,s,(_+R)/2,d,!0);return}St.setRelative(s,s,(_*T+R*v)/N,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(s,o,u,d,f){if(!d||d===this){s.x=(f?o.xo:o.x)+u;return}let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+u*d.x,_=v+u*d.y;s.x=T+(s.y-_)/d.normalSlope},slope:0,touch:function(s){s.xTouched=!0},touched:function(s){return s.xTouched},untouch:function(s){s.xTouched=!1}},qt={x:0,y:1,axis:"y",distance:function(s,o,u,d){return(u?s.yo:s.y)-(d?o.yo:o.y)},interpolate:function(s,o,u,d){let f,m,v,T,_,R,N;if(!d||d===this){if(f=s.yo-o.yo,m=s.yo-u.yo,_=o.y-o.yo,R=u.y-u.yo,v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){s.y=s.yo+(_+R)/2;return}s.y=s.yo+(_*T+R*v)/N;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,u,!0,!0),_=d.distance(o,o,!1,!0),R=d.distance(u,u,!1,!0),v=Math.abs(f),T=Math.abs(m),N=v+T,N===0){qt.setRelative(s,s,(_+R)/2,d,!0);return}qt.setRelative(s,s,(_*T+R*v)/N,d,!0)},normalSlope:0,setRelative:function(s,o,u,d,f){if(!d||d===this){s.y=(f?o.yo:o.y)+u;return}let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+u*d.x,_=v+u*d.y;s.y=_+d.normalSlope*(s.x-T)},slope:Number.POSITIVE_INFINITY,touch:function(s){s.yTouched=!0},touched:function(s){return s.yTouched},untouch:function(s){s.yTouched=!1}};Object.freeze(St),Object.freeze(qt);function wr(s,o){this.x=s,this.y=o,this.axis=void 0,this.slope=o/s,this.normalSlope=-s/o,Object.freeze(this)}wr.prototype.distance=function(s,o,u,d){return this.x*St.distance(s,o,u,d)+this.y*qt.distance(s,o,u,d)},wr.prototype.interpolate=function(s,o,u,d){let f,m,v,T,_,R,N;if(v=d.distance(s,o,!0,!0),T=d.distance(s,u,!0,!0),f=d.distance(o,o,!1,!0),m=d.distance(u,u,!1,!0),_=Math.abs(v),R=Math.abs(T),N=_+R,N===0){this.setRelative(s,s,(f+m)/2,d,!0);return}this.setRelative(s,s,(f*R+m*_)/N,d,!0)},wr.prototype.setRelative=function(s,o,u,d,f){d=d||this;let m=f?o.xo:o.x,v=f?o.yo:o.y,T=m+u*d.x,_=v+u*d.y,R=d.normalSlope,N=this.slope,q=s.x,V=s.y;s.x=(N*q-R*T+_-V)/(N-R),s.y=N*(s.x-q)+V},wr.prototype.touch=function(s){s.xTouched=!0,s.yTouched=!0};function hn(s,o){let u=Math.sqrt(s*s+o*o);return s/=u,o/=u,s===1&&o===0?St:s===0&&o===1?qt:new wr(s,o)}function un(s,o,u,d){this.x=this.xo=Math.round(s*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=u,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}un.prototype.nextTouched=function(s){let o=this.nextPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},un.prototype.prevTouched=function(s){let o=this.prevPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var wn=Object.freeze(new un(0,0)),Ii={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Jr(s,o){switch(this.env=s,this.stack=[],this.prog=o,s){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=St,this.round=E0}}I0.prototype.exec=function(s,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let u=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){Jr.prototype=Ii,f=this._fpgmState=new Jr("fpgm",u.tables.fpgm),f.funcs=[],f.font=u,f.instructionCount=0,f.callDepth=0;try{na(f)}catch(v){console.log("Hinting error in FPGM:"+v),this._errorState=3;return}}Jr.prototype=f,d=this._prepState=new Jr("prep",u.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=u.variation&&u.variation.process.getCvarTransform()||u.tables.cvt;if(m){let v=d.cvt=new Array(m.length),T=o/u.unitsPerEm;for(let _=0;_<m.length;_++)v[_]=m[_]*T}else d.cvt=[];try{na(d)}catch(v){this._errorState<2&&console.log("Hinting error in PREP:"+v),this._errorState=2}}if(!(this._errorState>1))try{return _s(s,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},_s=function(s,o){let u=o.ppem/o.font.unitsPerEm,d=u,f=s.components,m,v,T;if(Jr.prototype=o,!f)T=new Jr("glyf",s.instructions),T.instructionCount=0,T.callDepth=0,k0(s,T,u,d),v=T.gZone;else{let _=o.font;v=[],m=[];for(let R=0;R<f.length;R++){let N=f[R],q=_.glyphs.get(N.glyphIndex);T=new Jr("glyf",q.instructions),T.instructionCount=0,T.callDepth=0,k0(q,T,u,d);let V=Math.round(N.dx*u),ge=Math.round(N.dy*d),ce=T.gZone,Ce=T.contours;for(let pr=0;pr<ce.length;pr++){let or=ce[pr];or.xTouched=or.yTouched=!1,or.xo=or.x=or.x+V,or.yo=or.y=or.y+ge}let it=v.length;v.push.apply(v,ce);for(let pr=0;pr<Ce.length;pr++)m.push(Ce[pr]+it)}s.instructions&&!T.inhibitGridFit&&(T=new Jr("glyf",s.instructions),T.gZone=T.z0=T.z1=T.z2=v,T.contours=m,v.push(new un(0,0),new un(Math.round(s.advanceWidth*u),0)),na(T),v.length-=2)}return v},k0=function(s,o,u,d){let f=s.points||[],m=f.length,v=o.gZone=o.z0=o.z1=o.z2=[],T=o.contours=[],_;for(let q=0;q<m;q++)_=f[q],v[q]=new un(_.x*u,_.y*d,_.lastPointOfContour,_.onCurve);let R,N;for(let q=0;q<m;q++)_=v[q],R||(R=_,T.push(q)),_.lastPointOfContour?(_.nextPointOnContour=R,R.prevPointOnContour=_,R=void 0):(N=v[q+1],_.nextPointOnContour=N,N.prevPointOnContour=_);o.inhibitGridFit||(v.push(new un(0,0),new un(Math.round(s.advanceWidth*u),0)),na(o),v.length-=2)},na=function(s){let o=s.prog;if(!o)return;let u=o.length,d;for(s.ip=0;s.ip<u;s.ip++){if(++s.instructionCount>ra)throw new Error("Hinting instructions exceeded maximum of "+ra);if(d=Zl[o[s.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[s.ip]).toString(16));d(s)}};function qs(s){let o=s.tZone=new Array(s.gZone.length);for(let u=0;u<o.length;u++)o[u]=new un(0,0)}function Wa(s,o){let u=s.prog,d=s.ip,f=1,m;do if(m=u[++d],m===88)f++;else if(m===89)f--;else if(m===64)d+=u[d+1]+1;else if(m===65)d+=2*u[d+1]+1;else if(m>=176&&m<=183)d+=m-176+1;else if(m>=184&&m<=191)d+=(m-184+1)*2;else if(o&&f===1&&m===27)break;while(f>0);s.ip=d}function Ga(s,o){o.fv=o.pv=o.dpv=s}function sa(s,o){o.pv=o.dpv=s}function pi(s,o){o.fv=s}function Ia(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],v=o.z1[f],T,_;s?(T=m.y-v.y,_=v.x-m.x):(T=v.x-m.x,_=v.y-m.y),o.pv=o.dpv=hn(T,_)}function dd(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],v=o.z1[f],T,_;s?(T=m.y-v.y,_=v.x-m.x):(T=v.x-m.x,_=v.y-m.y),o.fv=hn(T,_)}function N0(s){let o=s.stack,u=o.pop(),d=o.pop();s.pv=s.dpv=hn(d,u)}function E6(s){let o=s.stack,u=o.pop(),d=o.pop();s.fv=hn(d,u)}function N6(s){let o=s.stack,u=s.pv;o.push(u.x*16384),o.push(u.y*16384)}function R6(s){let o=s.stack,u=s.fv;o.push(u.x*16384),o.push(u.y*16384)}function M6(s){s.fv=s.pv}function D6(s){let o=s.stack,u=o.pop(),d=o.pop(),f=o.pop(),m=o.pop(),v=o.pop(),T=s.z0,_=s.z1,R=T[u],N=T[d],q=_[f],V=_[m],ge=s.z2[v],ce=R.x,Ce=R.y,it=N.x,pr=N.y,or=q.x,_r=q.y,en=V.x,Fn=V.y,Vn=(ce-it)*(_r-Fn)-(Ce-pr)*(or-en),qn=ce*pr-Ce*it,Ns=or*Fn-_r*en;ge.x=(qn*(or-en)-Ns*(ce-it))/Vn,ge.y=(qn*(_r-Fn)-Ns*(Ce-pr))/Vn}function j6(s){s.rp0=s.stack.pop()}function B6(s){s.rp1=s.stack.pop()}function Q6(s){s.rp2=s.stack.pop()}function P6(s){let o=s.stack.pop();switch(s.zp0=o,o){case 0:s.tZone||qs(s),s.z0=s.tZone;break;case 1:s.z0=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function O6(s){let o=s.stack.pop();switch(s.zp1=o,o){case 0:s.tZone||qs(s),s.z1=s.tZone;break;case 1:s.z1=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function F6(s){let o=s.stack.pop();switch(s.zp2=o,o){case 0:s.tZone||qs(s),s.z2=s.tZone;break;case 1:s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function $6(s){let o=s.stack.pop();switch(s.zp0=s.zp1=s.zp2=o,o){case 0:s.tZone||qs(s),s.z0=s.z1=s.z2=s.tZone;break;case 1:s.z0=s.z1=s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function U6(s){s.loop=s.stack.pop(),s.loop>_l&&(s.loop=_l)}function z6(s){s.round=E0}function H6(s){s.round=S}function W6(s){let o=s.stack.pop();s.minDis=o/64}function G6(s){Wa(s,!1)}function V6(s){let o=s.stack.pop();s.ip+=o-1}function q6(s){let o=s.stack.pop();s.cvCutIn=o/64}function Y6(s){let o=s.stack;o.push(o[o.length-1])}function yf(s){s.stack.pop()}function Z6(s){s.stack.length=0}function K6(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u),o.push(d)}function X6(s){let o=s.stack;o.push(o.length)}function J6(s){let o=s.stack,u=o.pop(),d=o.pop();if(d>_l&&(d=_l),++s.callDepth>il)throw new Error("Hinting call depth exceeded maximum of "+il);let f=s.ip,m=s.prog;s.prog=s.funcs[u];for(let v=0;v<d;v++)na(s);s.ip=f,s.prog=m,s.callDepth--}function ev(s){let o=s.stack.pop();if(++s.callDepth>il)throw new Error("Hinting call depth exceeded maximum of "+il);let u=s.ip,d=s.prog;s.prog=s.funcs[o],na(s),s.ip=u,s.prog=d,s.callDepth--}function tv(s){let o=s.stack,u=o.pop();o.push(o[o.length-u])}function rv(s){let o=s.stack,u=o.pop();o.push(o.splice(o.length-u,1)[0])}function nv(s){if(s.env!=="fpgm")throw new Error("FDEF not allowed here");let o=s.stack,u=s.prog,d=s.ip,f=o.pop(),m=d;for(;u[++d]!==45;);s.ip=d,s.funcs[f]=u.slice(m+1,d)}function N1(s,o){let u=o.stack.pop(),d=o.z0[u],f=o.fv,m=o.pv,v=m.distance(d,wn);s&&(v=o.round(v)),f.setRelative(d,wn,v,m),f.touch(d),o.rp0=o.rp1=u}function R1(s,o){let u=o.z2,d=u.length-2,f,m,v;for(let T=0;T<d;T++)f=u[T],!s.touched(f)&&(m=f.prevTouched(s),m!==f&&(v=f.nextTouched(s),m===v&&s.setRelative(f,f,s.distance(m,m,!1,!0),s,!0),s.interpolate(f,m,v,s)))}function M1(s,o){let u=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=o.loop,_=o.z2;for(;T--;){let R=u.pop(),N=_[R],q=v.distance(f,f,!1,!0);m.setRelative(N,N,q,v),m.touch(N)}o.loop=1}function D1(s,o){let u=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=u.pop(),_=o.z2[o.contours[T]],R=_,N=v.distance(f,f,!1,!0);do R!==f&&m.setRelative(R,R,N,v),R=R.nextPointOnContour;while(R!==_)}function j1(s,o){let u=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,v=o.pv,T=u.pop(),_;switch(T){case 0:_=o.tZone;break;case 1:_=o.gZone;break;default:throw new Error("Invalid zone")}let R,N=v.distance(f,f,!1,!0),q=_.length-2;for(let V=0;V<q;V++)R=_[V],m.setRelative(R,R,N,v)}function sv(s){let o=s.stack,u=s.loop,d=s.fv,f=o.pop()/64,m=s.z2;for(;u--;){let v=o.pop(),T=m[v];d.setRelative(T,T,f),d.touch(T)}s.loop=1}function iv(s){let o=s.stack,u=s.rp1,d=s.rp2,f=s.loop,m=s.z0[u],v=s.z1[d],T=s.fv,_=s.dpv,R=s.z2;for(;f--;){let N=o.pop(),q=R[N];T.interpolate(q,m,v,_),T.touch(q)}s.loop=1}function B1(s,o){let u=o.stack,d=u.pop()/64,f=u.pop(),m=o.z1[f],v=o.z0[o.rp0],T=o.fv,_=o.pv;T.setRelative(m,v,d,_),T.touch(m),o.rp1=o.rp0,o.rp2=f,s&&(o.rp0=f)}function av(s){let o=s.stack,u=s.rp0,d=s.z0[u],f=s.loop,m=s.fv,v=s.pv,T=s.z1;for(;f--;){let _=o.pop(),R=T[_];m.setRelative(R,d,0,v),m.touch(R)}s.loop=1}function ov(s){s.round=ud}function Q1(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z0[f],v=o.fv,T=o.pv,_=o.cvt[d],R=T.distance(m,wn);s&&(Math.abs(R-_)<o.cvCutIn&&(R=_),R=o.round(R)),v.setRelative(m,wn,R,T),o.zp0===0&&(m.xo=m.x,m.yo=m.y),v.touch(m),o.rp0=o.rp1=f}function lv(s){let o=s.prog,u=s.ip,d=s.stack,f=o[++u];for(let m=0;m<f;m++)d.push(o[++u]);s.ip=u}function cv(s){let o=s.ip,u=s.prog,d=s.stack,f=u[++o];for(let m=0;m<f;m++){let v=u[++o]<<8|u[++o];v&32768&&(v=-((v^65535)+1)),d.push(v)}s.ip=o}function uv(s){let o=s.stack,u=s.store;u||(u=s.store=[]);let d=o.pop(),f=o.pop();u[f]=d}function dv(s){let o=s.stack,u=s.store,d=o.pop(),f=u&&u[d]||0;o.push(f)}function hv(s){let o=s.stack,u=o.pop(),d=o.pop();s.cvt[d]=u/64}function fv(s){let o=s.stack,u=o.pop();o.push(s.cvt[u]*64)}function P1(s,o){let u=o.stack,d=u.pop(),f=o.z2[d];u.push(o.dpv.distance(f,wn,s,!1)*64)}function O1(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z1[d],v=o.z0[f],T=o.dpv.distance(v,m,s,s);o.stack.push(Math.round(T*64))}function pv(s){s.stack.push(s.ppem)}function mv(s){s.autoFlip=!0}function gv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d<u?1:0)}function xv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d<=u?1:0)}function bv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d>u?1:0)}function yv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d>=u?1:0)}function vv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u===d?1:0)}function wv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u!==d?1:0)}function Av(s){let o=s.stack,u=o.pop();o.push(Math.trunc(u)&1?1:0)}function Tv(s){let o=s.stack,u=o.pop();o.push(Math.trunc(u)&1?0:1)}function Cv(s){let o=s.stack.pop(),u;o||Wa(s,!0)}function Sv(s){}function _v(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u&&d?1:0)}function Lv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(u||d?1:0)}function kv(s){let o=s.stack,u=o.pop();o.push(u?0:1)}function vf(s,o){let u=o.stack,d=u.pop(),f=o.fv,m=o.pv,v=o.ppem,T=o.deltaBase+(s-1)*16,_=o.deltaShift,R=o.z0;for(let N=0;N<d;N++){let q=u.pop(),V=u.pop();if(T+((V&240)>>4)!==v)continue;let ge=(V&15)-8;ge>=0&&ge++;let ce=R[q];f.setRelative(ce,ce,ge*_,m)}}function Iv(s){let o=s.stack.pop();s.deltaBase=o}function Ev(s){let o=s.stack.pop();s.deltaShift=Math.pow(.5,o)}function Nv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d+u)}function Rv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d-u)}function Mv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d*64/u)}function Dv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(d*u/64)}function jv(s){let o=s.stack,u=o.pop();o.push(Math.abs(u))}function Bv(s){let o=s.stack,u=o.pop();o.push(-u)}function Qv(s){let o=s.stack,u=o.pop();o.push(Math.floor(u/64)*64)}function Pv(s){let o=s.stack,u=o.pop();o.push(Math.ceil(u/64)*64)}function hd(s,o){let u=o.stack,d=u.pop();u.push(o.round(d/64)*64)}function Ov(s){let o=s.stack,u=o.pop(),d=o.pop();s.cvt[d]=u*s.ppem/s.font.unitsPerEm}function wf(s,o){let u=o.stack,d=u.pop(),f=o.ppem,m=o.deltaBase+(s-1)*16,v=o.deltaShift;for(let T=0;T<d;T++){let _=u.pop(),R=u.pop();if(m+((R&240)>>4)!==f)continue;let N=(R&15)-8;N>=0&&N++;let q=N*v;o.cvt[_]+=q}}function Fv(s){let o=s.stack.pop();s.round=nt;let u;switch(o&192){case 0:u=.5;break;case 64:u=1;break;case 128:u=2;break;default:throw new Error("invalid SROUND value")}switch(s.srPeriod=u,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*u;break;case 32:s.srPhase=.5*u;break;case 48:s.srPhase=.75*u;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*u}function $v(s){let o=s.stack.pop();s.round=nt;let u;switch(o&192){case 0:u=Math.sqrt(2)/2;break;case 64:u=Math.sqrt(2);break;case 128:u=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(s.srPeriod=u,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*u;break;case 32:s.srPhase=.5*u;break;case 48:s.srPhase=.75*u;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*u}function Uv(s){s.round=bf}function zv(s){s.round=D}function Hv(s){s.round=ue}function Wv(s){let o=s.stack.pop()}function F1(s,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],v=o.z1[f],T,_;s?(T=m.y-v.y,_=v.x-m.x):(T=v.x-m.x,_=v.y-m.y),o.dpv=hn(T,_)}function Gv(s){let o=s.stack,u=o.pop(),d=0;u&1&&(d=35),u&32&&(d|=4096),o.push(d)}function Vv(s){let o=s.stack,u=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(u),o.push(f)}function qv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(Math.max(d,u))}function Yv(s){let o=s.stack,u=o.pop(),d=o.pop();o.push(Math.min(d,u))}function Zv(s){let o=s.stack.pop()}function Kv(s){let o=s.stack.pop(),u=s.stack.pop();switch(o){case 1:s.inhibitGridFit=!!u;return;case 2:s.ignoreCvt=!!u;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Ll(s,o){let u=o.stack,d=o.prog,f=o.ip;for(let m=0;m<s;m++)u.push(d[++f]);o.ip=f}function kl(s,o){let u=o.ip,d=o.prog,f=o.stack;for(let m=0;m<s;m++){let v=d[++u]<<8|d[++u];v&32768&&(v=-((v^65535)+1)),f.push(v)}o.ip=u}function lr(s,o,u,d,f,m){let v=m.stack,T=s&&v.pop(),_=v.pop(),R=m.rp0,N=m.z0[R],q=m.z1[_],V=m.minDis,ge=m.fv,ce=m.dpv,Ce,it,pr,or;it=Ce=ce.distance(q,N,!0,!0),pr=it>=0?1:-1,it=Math.abs(it),s&&(or=m.cvt[T],d&&Math.abs(it-or)<m.cvCutIn&&(it=or)),u&&it<V&&(it=V),d&&(it=m.round(it)),ge.setRelative(q,N,pr*it,ce),ge.touch(q),m.rp1=m.rp0,m.rp2=_,o&&(m.rp0=_)}Zl=[Ga.bind(void 0,qt),Ga.bind(void 0,St),sa.bind(void 0,qt),sa.bind(void 0,St),pi.bind(void 0,qt),pi.bind(void 0,St),Ia.bind(void 0,0),Ia.bind(void 0,1),dd.bind(void 0,0),dd.bind(void 0,1),N0,E6,N6,R6,M6,D6,j6,B6,Q6,P6,O6,F6,$6,U6,z6,H6,W6,G6,V6,q6,void 0,void 0,Y6,yf,Z6,K6,X6,tv,rv,void 0,void 0,void 0,J6,ev,nv,void 0,N1.bind(void 0,0),N1.bind(void 0,1),R1.bind(void 0,qt),R1.bind(void 0,St),M1.bind(void 0,0),M1.bind(void 0,1),D1.bind(void 0,0),D1.bind(void 0,1),j1.bind(void 0,0),j1.bind(void 0,1),sv,iv,B1.bind(void 0,0),B1.bind(void 0,1),av,ov,Q1.bind(void 0,0),Q1.bind(void 0,1),lv,cv,uv,dv,hv,fv,P1.bind(void 0,0),P1.bind(void 0,1),void 0,O1.bind(void 0,0),O1.bind(void 0,1),pv,void 0,mv,void 0,void 0,gv,xv,bv,yv,vv,wv,Av,Tv,Cv,Sv,_v,Lv,kv,vf.bind(void 0,1),Iv,Ev,Nv,Rv,Mv,Dv,jv,Bv,Qv,Pv,hd.bind(void 0,0),hd.bind(void 0,1),hd.bind(void 0,2),hd.bind(void 0,3),void 0,void 0,void 0,void 0,Ov,vf.bind(void 0,2),vf.bind(void 0,3),wf.bind(void 0,1),wf.bind(void 0,2),wf.bind(void 0,3),Fv,$v,void 0,void 0,Uv,void 0,zv,Hv,yf,yf,void 0,void 0,void 0,void 0,void 0,Wv,F1.bind(void 0,0),F1.bind(void 0,1),Gv,void 0,Vv,qv,Yv,Zv,Kv,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Ll.bind(void 0,1),Ll.bind(void 0,2),Ll.bind(void 0,3),Ll.bind(void 0,4),Ll.bind(void 0,5),Ll.bind(void 0,6),Ll.bind(void 0,7),Ll.bind(void 0,8),kl.bind(void 0,1),kl.bind(void 0,2),kl.bind(void 0,3),kl.bind(void 0,4),kl.bind(void 0,5),kl.bind(void 0,6),kl.bind(void 0,7),kl.bind(void 0,8),lr.bind(void 0,0,0,0,0,0),lr.bind(void 0,0,0,0,0,1),lr.bind(void 0,0,0,0,0,2),lr.bind(void 0,0,0,0,0,3),lr.bind(void 0,0,0,0,1,0),lr.bind(void 0,0,0,0,1,1),lr.bind(void 0,0,0,0,1,2),lr.bind(void 0,0,0,0,1,3),lr.bind(void 0,0,0,1,0,0),lr.bind(void 0,0,0,1,0,1),lr.bind(void 0,0,0,1,0,2),lr.bind(void 0,0,0,1,0,3),lr.bind(void 0,0,0,1,1,0),lr.bind(void 0,0,0,1,1,1),lr.bind(void 0,0,0,1,1,2),lr.bind(void 0,0,0,1,1,3),lr.bind(void 0,0,1,0,0,0),lr.bind(void 0,0,1,0,0,1),lr.bind(void 0,0,1,0,0,2),lr.bind(void 0,0,1,0,0,3),lr.bind(void 0,0,1,0,1,0),lr.bind(void 0,0,1,0,1,1),lr.bind(void 0,0,1,0,1,2),lr.bind(void 0,0,1,0,1,3),lr.bind(void 0,0,1,1,0,0),lr.bind(void 0,0,1,1,0,1),lr.bind(void 0,0,1,1,0,2),lr.bind(void 0,0,1,1,0,3),lr.bind(void 0,0,1,1,1,0),lr.bind(void 0,0,1,1,1,1),lr.bind(void 0,0,1,1,1,2),lr.bind(void 0,0,1,1,1,3),lr.bind(void 0,1,0,0,0,0),lr.bind(void 0,1,0,0,0,1),lr.bind(void 0,1,0,0,0,2),lr.bind(void 0,1,0,0,0,3),lr.bind(void 0,1,0,0,1,0),lr.bind(void 0,1,0,0,1,1),lr.bind(void 0,1,0,0,1,2),lr.bind(void 0,1,0,0,1,3),lr.bind(void 0,1,0,1,0,0),lr.bind(void 0,1,0,1,0,1),lr.bind(void 0,1,0,1,0,2),lr.bind(void 0,1,0,1,0,3),lr.bind(void 0,1,0,1,1,0),lr.bind(void 0,1,0,1,1,1),lr.bind(void 0,1,0,1,1,2),lr.bind(void 0,1,0,1,1,3),lr.bind(void 0,1,1,0,0,0),lr.bind(void 0,1,1,0,0,1),lr.bind(void 0,1,1,0,0,2),lr.bind(void 0,1,1,0,0,3),lr.bind(void 0,1,1,0,1,0),lr.bind(void 0,1,1,0,1,1),lr.bind(void 0,1,1,0,1,2),lr.bind(void 0,1,1,0,1,3),lr.bind(void 0,1,1,1,0,0),lr.bind(void 0,1,1,1,0,1),lr.bind(void 0,1,1,1,0,2),lr.bind(void 0,1,1,1,0,3),lr.bind(void 0,1,1,1,1,0),lr.bind(void 0,1,1,1,1,1),lr.bind(void 0,1,1,1,1,2),lr.bind(void 0,1,1,1,1,3)];var Xv=I0;function kc(s){this.char=s,this.state={},this.activeState=null}function Af(s,o,u){this.contextName=u,this.startIndex=s,this.endOffset=o}function Jv(s,o,u){this.contextName=s,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=u}function Oi(s,o){this.context=s,this.index=o,this.length=s.length,this.current=s[o],this.backtrack=s.slice(0,o),this.lookahead=s.slice(o+1)}function fd(s){this.eventId=s,this.subscribers=[]}function e4(s){let o=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let d=0;d<o.length;d++){let f=o[d];Object.defineProperty(this.events,f,{value:new fd(f)})}if(s)for(let d=0;d<o.length;d++){let f=o[d],m=s[f];typeof m=="function"&&this.events[f].subscribe(m)}let u=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<u.length;d++){let f=u[d];this.events[f].subscribe(this.updateContextsRanges)}}function bs(s){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],e4.call(this,s)}kc.prototype.setState=function(s,o){return this.state[s]=o,this.activeState={key:s,value:this.state[s]},this.activeState},kc.prototype.getState=function(s){return this.state[s]||null},bs.prototype.inboundIndex=function(s){return s>=0&&s<this.tokens.length},bs.prototype.composeRUD=function(s){let o=s.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),u=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(u))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(u)};this.dispatch("composeRUD",[o.filter(d=>!u(d))])},bs.prototype.replaceRange=function(s,o,u,d){o=o!==null?o:this.tokens.length;let f=u.every(m=>m instanceof kc);if(!isNaN(s)&&this.inboundIndex(s)&&f){let m=this.tokens.splice.apply(this.tokens,[s,o].concat(u));return d||this.dispatch("replaceToken",[s,o,u]),[m,u]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},bs.prototype.replaceToken=function(s,o,u){if(!isNaN(s)&&this.inboundIndex(s)&&o instanceof kc){let d=this.tokens.splice(s,1,o);return u||this.dispatch("replaceToken",[s,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},bs.prototype.removeRange=function(s,o,u){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(s,o);return u||this.dispatch("removeRange",[d,s,o]),d},bs.prototype.removeToken=function(s,o){if(!isNaN(s)&&this.inboundIndex(s)){let u=this.tokens.splice(s,1);return o||this.dispatch("removeToken",[u,s]),u}else return{FAIL:"removeToken: invalid token index."}},bs.prototype.insertToken=function(s,o,u){return s.every(d=>d instanceof kc)?(this.tokens.splice.apply(this.tokens,[o,0].concat(s)),u||this.dispatch("insertToken",[s,o]),s):{FAIL:"insertToken: invalid token(s)."}},bs.prototype.registerModifier=function(s,o,u){this.events.newToken.subscribe(function(d,f){let m=[d,f],v=o===null||o.apply(this,m)===!0,T=[d,f];if(v){let _=u.apply(this,T);d.setState(s,_)}}),this.registeredModifiers.push(s)},fd.prototype.subscribe=function(s){return typeof s=="function"?this.subscribers.push(s)-1:{FAIL:`invalid '${this.eventId}' event handler`}},fd.prototype.unsubscribe=function(s){this.subscribers.splice(s,1)},Oi.prototype.setCurrentIndex=function(s){this.index=s,this.current=this.context[s],this.backtrack=this.context.slice(0,s),this.lookahead=this.context.slice(s+1)},Oi.prototype.get=function(s){switch(!0){case s===0:return this.current;case(s<0&&Math.abs(s)<=this.backtrack.length):return this.backtrack.slice(s)[0];case(s>0&&s<=this.lookahead.length):return this.lookahead[s-1];default:return null}},bs.prototype.rangeToText=function(s){if(s instanceof Af)return this.getRangeTokens(s).map(o=>o.char).join("")},bs.prototype.getText=function(){return this.tokens.map(s=>s.char).join("")},bs.prototype.getContext=function(s){return this.registeredContexts[s]||null},bs.prototype.on=function(s,o){let u=this.events[s];return u?u.subscribe(o):null},bs.prototype.dispatch=function(s,o){let u=this.events[s];if(u instanceof fd)for(let d=0;d<u.subscribers.length;d++)u.subscribers[d].apply(this,o||[])},bs.prototype.registerContextChecker=function(s,o,u){if(this.getContext(s))return{FAIL:`context name '${s}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof u!="function")return{FAIL:"missing context end check."};let d=new Jv(s,o,u);return this.registeredContexts[s]=d,this.contextCheckers.push(d),d},bs.prototype.getRangeTokens=function(s){let o=s.startIndex+s.endOffset;return[].concat(this.tokens.slice(s.startIndex,o))},bs.prototype.getContextRanges=function(s){let o=this.getContext(s);return o?o.ranges:{FAIL:`context checker '${s}' is not registered.`}},bs.prototype.resetContextsRanges=function(){let s=this.registeredContexts;for(let o in s)if(Object.prototype.hasOwnProperty.call(s,o)){let u=s[o];u.ranges=[]}},bs.prototype.updateContextsRanges=function(){this.resetContextsRanges();let s=this.tokens.map(o=>o.char);for(let o=0;o<s.length;o++){let u=new Oi(s,o);this.runContextCheck(u)}this.dispatch("updateContextsRanges",[this.registeredContexts])},bs.prototype.setEndOffset=function(s,o){let u=this.getContext(o).openRange.startIndex,d=new Af(u,s,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},bs.prototype.runContextCheck=function(s){let o=s.index;for(let u=0;u<this.contextCheckers.length;u++){let d=this.contextCheckers[u],f=d.contextName,m=this.getContext(f).openRange;if(!m&&d.checkStart(s)&&(m=new Af(o,null,f),this.getContext(f).openRange=m,this.dispatch("contextStart",[f,o])),m&&d.checkEnd(s)){let v=o-m.startIndex+1,T=this.setEndOffset(v,f);this.dispatch("contextEnd",[f,T])}}},bs.prototype.tokenize=function(s){this.tokens=[],this.resetContextsRanges();let o=Array.from(s);this.dispatch("start");for(let u=0;u<o.length;u++){let d=o[u],f=new Oi(o,u);this.dispatch("next",[f]),this.runContextCheck(f);let m=new kc(d);this.tokens.push(m),this.dispatch("newToken",[m,f])}return this.dispatch("end",[this.tokens]),this.tokens};var t4=bs;function Il(s){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(s)}function $1(s){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(s)}function El(s){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(s)}function pd(s){return/[\u0E00-\u0E7F]/.test(s)}function md(s){return/[A-z]/.test(s)}function r4(s){return/\s/.test(s)}function Ea(s){this.font=s,this.features={}}function Nl(s){this.id=s.id,this.tag=s.tag,this.substitution=s.substitution}function Rl(s,o){if(!s)return-1;switch(o.format){case 1:return o.glyphs.indexOf(s);case 2:{let u=o.ranges;for(let d=0;d<u.length;d++){let f=u[d];if(s>=f.start&&s<=f.end){let m=s-f.start;return f.index+m}}break}default:return-1}return-1}function n4(s,o){return Rl(s,o.coverage)===-1?null:s+o.deltaGlyphId}function s4(s,o){let u=Rl(s,o.coverage);return u===-1?null:o.substitute[u]}function Tf(s,o){let u=[];for(let d=0;d<s.length;d++){let f=s[d],m=o.current;m=Array.isArray(m)?m[0]:m;let v=Rl(m,f);v!==-1&&u.push(v)}return u.length!==s.length?-1:u}function i4(s,o){let u=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(s.context.length<u)return[];let d=Tf(o.inputCoverage,s);if(d===-1)return[];let f=o.inputCoverage.length-1;if(s.lookahead.length<o.lookaheadCoverage.length)return[];let m=s.lookahead.slice(f);for(;m.length&&El(m[0].char);)m.shift();let v=new Oi(m,0),T=Tf(o.lookaheadCoverage,v),_=[].concat(s.backtrack);for(_.reverse();_.length&&El(_[0].char);)_.shift();if(_.length<o.backtrackCoverage.length)return[];let R=new Oi(_,0),N=Tf(o.backtrackCoverage,R),q=d.length===o.inputCoverage.length&&T.length===o.lookaheadCoverage.length&&N.length===o.backtrackCoverage.length,V=[];if(q)for(let ge=0;ge<o.lookupRecords.length;ge++){let ce=o.lookupRecords[ge],Ce=ce.lookupListIndex,it=this.getLookupByIndex(Ce);for(let pr=0;pr<it.subtables.length;pr++){let or=it.subtables[pr],_r,en=this.getSubstitutionType(it,or);if(en==="71"?(en=this.getSubstitutionType(or,or.extension),_r=this.getLookupMethod(or,or.extension),or=or.extension):_r=this.getLookupMethod(it,or),en==="12"){let Fn=s.get(ce.sequenceIndex),Vn=_r(Fn);Vn&&V.push(Vn)}else if(en==="21"){let Fn=s.get(ce.sequenceIndex),Vn=_r(Fn);Vn&&V.push(Vn)}else throw new Error(`Substitution type ${en} is not supported in chaining substitution`)}}return V}function a4(s,o){let u=s.current,d=Rl(u,o.coverage);if(d===-1)return null;let f,m=o.ligatureSets[d];for(let v=0;v<m.length;v++){f=m[v];for(let T=0;T<f.components.length;T++){let _=s.lookahead[T],R=f.components[T];if(_!==R)break;if(T===f.components.length-1)return f}}return null}function o4(s,o){let u=s.current;if(Rl(u,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let m=!0;for(let v=0;v<f.input.length;v++)if(s.lookahead[v]!==f.input[v]){m=!1;break}if(m){let v=[];v.push(u);for(let _=0;_<f.input.length;_++)v.push(f.input[_]);let T=(_,R)=>{let{lookupListIndex:N,sequenceIndex:q}=R,{subtables:V}=this.getLookupByIndex(N);for(let ge of V)Rl(_[q],ge.coverage)!==-1&&(_[q]=ge.deltaGlyphId)};for(let _=0;_<f.lookupRecords.length;_++){let R=f.lookupRecords[_];T(v,R)}return v}}return null}function l4(s,o){if(s.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=s.get(d);if(f=Array.isArray(f)?f[0]:f,Rl(f,o.coverages[d])===-1)return[]}let u=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],m=f.lookupListIndex,v=this.getLookupByIndex(m);for(let T=0;T<v.subtables.length;T++){let _=v.subtables[T],R,N=this.getSubstitutionType(v,_);if(N==="71"?(N=this.getSubstitutionType(_,_.extension),R=this.getLookupMethod(_,_.extension),_=_.extension):R=this.getLookupMethod(v,_),N==="12"){let q=s.get(f.sequenceIndex),V=R(q);V&&u.push(V)}else if(N==="21"){let q=s.get(f.sequenceIndex),V=R(q);V&&u.push(V)}}}return u}function c4(s,o){let u=Rl(s,o.coverage);return u===-1?null:o.sequences[u]}Ea.prototype.getDefaultScriptFeaturesIndexes=function(){let s=this.font.tables.gsub.scripts;for(let o=0;o<s.length;o++){let u=s[o];if(u.tag==="DFLT")return u.script.defaultLangSys.featureIndexes}return[]},Ea.prototype.getScriptFeaturesIndexes=function(s){if(!this.font.tables.gsub)return[];if(!s)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let u=0;u<o.length;u++){let d=o[u];if(d.tag===s&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let m=0;m<f.length;m++){let v=f[m];if(v.tag===s)return v.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},Ea.prototype.mapTagsToFeatures=function(s,o){let u={};for(let d=0;d<s.length;d++){let f=s[d].tag,m=s[d].feature;u[f]=m}this.features[o].tags=u},Ea.prototype.getScriptFeatures=function(s){let o=this.features[s];if(Object.prototype.hasOwnProperty.call(this.features,s))return o;let u=this.getScriptFeaturesIndexes(s);if(!u)return null;let d=this.font.tables.gsub;return o=u.map(f=>d.features[f]),this.features[s]=o,this.mapTagsToFeatures(o,s),o},Ea.prototype.getSubstitutionType=function(s,o){let u=s.lookupType.toString(),d=o.substFormat.toString();return u+d},Ea.prototype.getLookupMethod=function(s,o){let u=this.getSubstitutionType(s,o);switch(u){case"11":return d=>n4.apply(this,[d,o]);case"12":return d=>s4.apply(this,[d,o]);case"63":return d=>i4.apply(this,[d,o]);case"41":return d=>a4.apply(this,[d,o]);case"21":return d=>c4.apply(this,[d,o]);case"51":return d=>o4.apply(this,[d,o]);case"53":return d=>l4.apply(this,[d,o]);default:throw new Error(`substitutionType : ${u} lookupType: ${s.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},Ea.prototype.lookupFeature=function(s){let o=s.contextParams,u=o.index,d=this.getFeature({tag:s.tag,script:s.script});if(!d)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${s.tag}' for script '${s.script}'.`);let f=this.getFeatureLookups(d),m=[].concat(o.context);for(let v=0;v<f.length;v++){let T=f[v],_=this.getLookupSubtables(T);for(let R=0;R<_.length;R++){let N=_[R],q=this.getSubstitutionType(T,N),V;q==="71"?(q=this.getSubstitutionType(N,N.extension),V=this.getLookupMethod(N,N.extension),N=N.extension):V=this.getLookupMethod(T,N);let ge;switch(q){case"11":ge=V(o.current),ge&&m.splice(u,1,new Nl({id:11,tag:s.tag,substitution:ge}));break;case"12":ge=V(o.current),ge&&m.splice(u,1,new Nl({id:12,tag:s.tag,substitution:ge}));break;case"63":ge=V(o),Array.isArray(ge)&&ge.length&&m.splice(u,1,new Nl({id:63,tag:s.tag,substitution:ge}));break;case"41":ge=V(o),ge&&m.splice(u,1,new Nl({id:41,tag:s.tag,substitution:ge}));break;case"21":ge=V(o.current),ge&&m.splice(u,1,new Nl({id:21,tag:s.tag,substitution:ge}));break;case"51":case"53":ge=V(o),Array.isArray(ge)&&ge.length&&m.splice(u,1,new Nl({id:parseInt(q),tag:s.tag,substitution:ge}));break}o=new Oi(m,u),!(Array.isArray(ge)&&!ge.length)&&(ge=null)}}return m.length?m:null},Ea.prototype.supports=function(s){if(!s.script)return!1;this.getScriptFeatures(s.script);let o=Object.prototype.hasOwnProperty.call(this.features,s.script);if(!s.tag)return o;let u=this.features[s.script].some(d=>d.tag===s.tag);return o&&u},Ea.prototype.getLookupSubtables=function(s){return s.subtables||null},Ea.prototype.getLookupByIndex=function(s){return this.font.tables.gsub.lookups[s]||null},Ea.prototype.getFeatureLookups=function(s){return s.lookupListIndexes.map(this.getLookupByIndex.bind(this))},Ea.prototype.getFeature=function(s){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,s.script)||this.getScriptFeatures(s.script);let o=this.features[s.script];return o?o.tags[s.tag]?this.features[s.script].tags[s.tag]:null:{FAIL:`No feature for script ${s.script}`}};var u4=Ea;function d4(s){let o=s.current,u=s.get(-1);return u===null&&Il(o)||!Il(u)&&Il(o)}function h4(s){let o=s.get(1);return o===null||!Il(o)}var f4={startCheck:d4,endCheck:h4};function p4(s){let o=s.current,u=s.get(-1);return(Il(o)||El(o))&&!Il(u)}function m4(s){let o=s.get(1);switch(!0){case o===null:return!0;case(!Il(o)&&!El(o)):{let u=r4(o);if(!u)return!0;if(u){let d=!1;if(d=s.lookahead.some(f=>Il(f)||El(f)),!d)return!0}break}default:return!1}}var g4={startCheck:p4,endCheck:m4};function x4(s,o,u){o[u].setState(s.tag,s.substitution)}function b4(s,o,u){o[u].setState(s.tag,s.substitution)}function Cf(s,o,u){for(let d=0;d<s.substitution.length;d++){let f=s.substitution[d],m=o[u+d];if(Array.isArray(f)){f.length?m.setState(s.tag,f[0]):m.setState("deleted",!0);continue}m.setState(s.tag,f)}}function y4(s,o,u){let d=o[u];d.setState(s.tag,s.substitution.ligGlyph);let f=s.substitution.components.length;for(let m=0;m<f;m++)d=o[u+m+1],d.setState("deleted",!0)}var U1={11:x4,12:b4,63:Cf,41:y4,51:Cf,53:Cf};function v4(s,o,u){s instanceof Nl&&U1[s.id]&&U1[s.id](s,o,u)}var Kl=v4;function w4(s){let o=[].concat(s.backtrack);for(let u=o.length-1;u>=0;u--){let d=o[u],f=$1(d),m=El(d);if(!f&&!m)return!0;if(f)return!1}return!1}function A4(s){if($1(s.current))return!1;for(let o=0;o<s.lookahead.length;o++){let u=s.lookahead[o];if(!El(u))return!0}return!1}function T4(s){let o="arab",u=this.featuresTags[o],d=this.tokenizer.getRangeTokens(s);if(d.length===1)return;let f=new Oi(d.map(v=>v.getState("glyphIndex")),0),m=new Oi(d.map(v=>v.char),0);for(let v=0;v<d.length;v++){let T=d[v];if(El(T.char))continue;f.setCurrentIndex(v),m.setCurrentIndex(v);let _=0;w4(m)&&(_|=1),A4(m)&&(_|=2);let R;switch(_){case 1:R="fina";break;case 2:R="init";break;case 3:R="medi";break}if(u.indexOf(R)===-1)continue;let N=this.query.lookupFeature({tag:R,script:o,contextParams:f});if(N instanceof Error){console.info(N.message);continue}for(let q=0;q<N.length;q++){let V=N[q];V instanceof Nl&&(Kl(V,d,q),f.context[q]=V.substitution)}}}var C4=T4;function z1(s,o){let u=s.map(d=>d.activeState.value);return new Oi(u,o||0)}function S4(s){let o="arab",u=this.tokenizer.getRangeTokens(s),d=z1(u);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Kl(T,u,f)}d=z1(u)}}}var _4=S4;function L4(s){return s.index===0&&s.context.length>1}function k4(s){return s.index===s.context.length-1}var I4={startCheck:L4,endCheck:k4};function H1(s,o){let u=s.map(d=>d.activeState.value);return new Oi(u,o||0)}function E4(s){let o="delf",u="ccmp",d=this.tokenizer.getRangeTokens(s),f=H1(d);for(let m=0;m<f.context.length;m++){if(!this.query.getFeature({tag:u,script:o,contextParams:f}))continue;f.setCurrentIndex(m);let v=this.query.lookupFeature({tag:u,script:o,contextParams:f});if(v.length){for(let T=0;T<v.length;T++){let _=v[T];Kl(_,d,m)}f=H1(d)}}}var N4=E4;function R4(s){let o=s.current,u=s.get(-1);return u===null&&md(o)||!md(u)&&md(o)}function M4(s){let o=s.get(1);return o===null||!md(o)}var D4={startCheck:R4,endCheck:M4};function W1(s,o){let u=s.map(d=>d.activeState.value);return new Oi(u,o||0)}function j4(s){let o="latn",u=this.tokenizer.getRangeTokens(s),d=W1(u);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Kl(T,u,f)}d=W1(u)}}}var B4=j4;function Q4(s){let o=s.current,u=s.get(-1);return u===null&&pd(o)||!pd(u)&&pd(o)}function P4(s){let o=s.get(1);return o===null||!pd(o)}var O4={startCheck:Q4,endCheck:P4};function G1(s,o){let u=s.map(d=>d.activeState.value);return new Oi(u,o||0)}function F4(s){let o="thai",u=this.tokenizer.getRangeTokens(s),d=G1(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Kl(T,u,f)}d=G1(u,f)}}}var $4=F4;function V1(s,o){let u=s.map(d=>d.activeState.value);return new Oi(u,o||0)}function U4(s){let o="thai",u=this.tokenizer.getRangeTokens(s),d=V1(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Kl(T,u,f)}d=V1(u,f)}}}var z4=U4;function q1(s,o){let u=s.map(d=>d.activeState.value);return new Oi(u,o||0)}function H4(s){let o="thai",u=this.tokenizer.getRangeTokens(s),d=q1(u,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let v=0;v<m.length;v++){let T=m[v];Kl(T,u,f)}d=q1(u,f)}}}var W4=H4;function Sf(s){if(s===null)return!1;let o=s.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function G4(s){let o=s.current,u=s.get(1);return u===null&&Sf(o)||Sf(u)}function V4(s){let o=s.get(1);return o===null||!Sf(o)}var q4={startCheck:G4,endCheck:V4};function Y4(s){let o=this.query.font,u=this.tokenizer.getRangeTokens(s);if(u[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=u[0].char.codePointAt(0),f=u[1].char.codePointAt(0),m=o.tables.cmap.varSelectorList[f];if(m!==void 0&&m.nonDefaultUVS){let v=m.nonDefaultUVS.uvsMappings;if(v[d]){let T=v[d].glyphID;o.glyphs.glyphs[T]!==void 0&&u[0].setState("glyphIndex",T)}}}}var Z4=Y4;function Va(s){this.baseDir=s||"ltr",this.tokenizer=new t4,this.featuresTags={}}Va.prototype.setText=function(s){this.text=s},Va.prototype.contextChecks={ccmpReplacementCheck:I4,latinWordCheck:D4,arabicWordCheck:f4,arabicSentenceCheck:g4,thaiWordCheck:O4,unicodeVariationSequenceCheck:q4};function Ic(s){let o=this.contextChecks[`${s}Check`];return this.tokenizer.registerContextChecker(s,o.startCheck,o.endCheck)}function K4(){return Ic.call(this,"ccmpReplacement"),Ic.call(this,"latinWord"),Ic.call(this,"arabicWord"),Ic.call(this,"arabicSentence"),Ic.call(this,"thaiWord"),Ic.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function X4(){let s=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<s.length;o++){let u=s[o],d=this.tokenizer.getRangeTokens(u);this.tokenizer.replaceRange(u.startIndex,u.endOffset,d.reverse())}}Va.prototype.registerFeatures=function(s,o){let u=o.filter(d=>this.query.supports({script:s,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,s)?this.featuresTags[s]=this.featuresTags[s].concat(u):this.featuresTags[s]=u},Va.prototype.applyFeatures=function(s,o){if(!s)throw new Error("No valid font was provided to apply features");this.query||(this.query=new u4(s));for(let u=0;u<o.length;u++){let d=o[u];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Va.prototype.registerModifier=function(s,o,u){this.tokenizer.registerModifier(s,o,u)};function R0(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function J4(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;R0.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let u=s[o];C4.call(this,u)}}function e7(){R0.call(this);let s=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<s.length;o++){let u=s[o];N4.call(this,u)}}function t7(){if(!this.hasFeatureEnabled("arab","rlig"))return;R0.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let u=s[o];_4.call(this,u)}}function r7(){if(!this.hasFeatureEnabled("latn","liga"))return;R0.call(this);let s=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<s.length;o++){let u=s[o];B4.call(this,u)}}function n7(){let s=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<s.length;o++){let u=s[o];Z4.call(this,u)}}function s7(){R0.call(this);let s=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<s.length;o++){let u=s[o];this.hasFeatureEnabled("thai","liga")&&z4.call(this,u),this.hasFeatureEnabled("thai","rlig")&&W4.call(this,u),this.hasFeatureEnabled("thai","ccmp")&&$4.call(this,u)}}Va.prototype.checkContextReady=function(s){return!!this.tokenizer.getContext(s)},Va.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&e7.call(this),this.checkContextReady("arabicWord")&&(J4.call(this),t7.call(this)),this.checkContextReady("latinWord")&&r7.call(this),this.checkContextReady("arabicSentence")&&X4.call(this),this.checkContextReady("thaiWord")&&s7.call(this),this.checkContextReady("unicodeVariationSequence")&&n7.call(this)},Va.prototype.hasFeatureEnabled=function(s,o){return(this.featuresTags[s]||[]).indexOf(o)!==-1},Va.prototype.processText=function(s){(!this.text||this.text!==s)&&(this.setText(s),K4.call(this),this.applyFeaturesToContexts())},Va.prototype.getBidiText=function(s){return this.processText(s),this.tokenizer.getText()},Va.prototype.getTextGlyphs=function(s){this.processText(s);let o=[];for(let u=0;u<this.tokenizer.tokens.length;u++){let d=this.tokenizer.tokens[u];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var i7=Va;function _f(s){return{fontFamily:{en:s.familyName||" "},fontSubfamily:{en:s.styleName||" "},fullName:{en:s.fullName||s.familyName+" "+s.styleName},postScriptName:{en:s.postScriptName||(s.familyName+s.styleName).replace(/\s/g,"")},designer:{en:s.designer||" "},designerURL:{en:s.designerURL||" "},manufacturer:{en:s.manufacturer||" "},manufacturerURL:{en:s.manufacturerURL||" "},license:{en:s.license||" "},licenseURL:{en:s.licenseURL||" "},version:{en:s.version||"Version 0.1"},description:{en:s.description||" "},copyright:{en:s.copyright||" "},trademark:{en:s.trademark||" "}}}function Hn(s){if(s=s||{},s.tables=s.tables||{},!s.empty){if(!s.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!s.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!s.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!s.ascender)throw new Error("When creating a new Font object, ascender is required.");if(s.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=_f(s),this.names.macintosh=_f(s),this.names.windows=_f(s),this.unitsPerEm=s.unitsPerEm||1e3,this.ascender=s.ascender,this.descender=s.descender,this.createdTimestamp=s.createdTimestamp,this.italicAngle=s.italicAngle||0,this.weightClass=s.weightClass||0;let o=0;s.fsSelection?o=s.fsSelection:(this.italicAngle<0?o|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(o|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(o|=this.fsSelectionValues.BOLD),o===0&&(o=this.fsSelectionValues.REGULAR)),(!s.panose||!Array.isArray(s.panose))&&(s.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(s.tables,{os2:Object.assign({usWeightClass:s.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:s.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:s.panose[0]||0,bSerifStyle:s.panose[1]||0,bWeight:s.panose[2]||0,bProportion:s.panose[3]||0,bContrast:s.panose[4]||0,bStrokeVariation:s.panose[5]||0,bArmStyle:s.panose[6]||0,bLetterform:s.panose[7]||0,bMidline:s.panose[8]||0,bXHeight:s.panose[9]||0,fsSelection:o},s.tables.os2)})}this.supported=!0,this.glyphs=new zr.GlyphSet(this,s.glyphs||[]),this.encoding=new Zr(this),this.position=new La(this),this.substitution=new ff(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,u,d)=>(o[u]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new cd(this)),!0)}),this.palettes=new id(this),this.layers=new pf(this),this.svgImages=new mf(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new Xv(this):null}})}Hn.prototype.hasChar=function(s){return this.encoding.charToGlyphIndex(s)>0},Hn.prototype.charToGlyphIndex=function(s){return this.encoding.charToGlyphIndex(s)},Hn.prototype.charToGlyph=function(s){let o=this.charToGlyphIndex(s),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Hn.prototype.updateFeatures=function(s){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(u=>s[u])}:o)},Hn.prototype.stringToGlyphIndexes=function(s,o){let u=new i7,d=m=>this.charToGlyphIndex(m.char);u.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return u.applyFeatures(this,f),u.getTextGlyphs(s)},Hn.prototype.stringToGlyphs=function(s,o){let u=this.stringToGlyphIndexes(s,o),d=u.length,f=new Array(d),m=this.glyphs.get(0);for(let v=0;v<d;v+=1)f[v]=this.glyphs.get(u[v])||m;return f},Hn.prototype.nameToGlyphIndex=function(s){return this.glyphNames.nameToGlyphIndex(s)},Hn.prototype.nameToGlyph=function(s){let o=this.nameToGlyphIndex(s),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Hn.prototype.glyphIndexToName=function(s){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(s):""},Hn.prototype.getKerningValue=function(s,o){s=s.index||s,o=o.index||o;let u=this.position.defaultKerningTables;return u?this.position.getKerningValue(u,s,o):this.kerningPairs[s+","+o]||0},Hn.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}],hinting:!1,usePalette:0,drawLayers:!0,drawSVG:!0},Hn.prototype.forEachGlyph=function(s,o,u,d,f,m){o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let v=1/this.unitsPerEm*d,T=this.stringToGlyphs(s,f),_;if(f.kerning){let R=f.script||this.position.getDefaultScriptName();_=this.position.getKerningTables(R,f.language)}for(let R=0;R<T.length;R+=1){let N=T[R];if(m.call(this,N,o,u,d,f),N.advanceWidth&&(o+=N.advanceWidth*v),f.kerning&&R<T.length-1){let q=_?this.position.getKerningValue(_,N.index,T[R+1].index):this.getKerningValue(N,T[R+1]);o+=q*v}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Hn.prototype.getPath=function(s,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=new Ye;if(m._layers=[],li(this,m,d),m.stroke){let v=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=v}return this.forEachGlyph(s,o,u,d,f,(v,T,_,R)=>{let N=v.getPath(T,_,R,f,this);if(f.drawSVG||f.drawLayers){let q=N._layers;if(q&&q.length){for(let V=0;V<q.length;V++){let ge=q[V];m._layers.push(ge)}return}}m.extend(N)}),m},Hn.prototype.getPaths=function(s,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=[];return this.forEachGlyph(s,o,u,d,f,function(v,T,_,R){let N=v.getPath(T,_,R,f,this);m.push(N)}),m},Hn.prototype.getAdvanceWidth=function(s,o,u){return u=Object.assign({},this.defaultRenderOptions,u),this.forEachGlyph(s,0,0,o,u,function(){})},Hn.prototype.draw=function(s,o,u,d,f,m){this.getPath(o,u,d,f,m).draw(s)},Hn.prototype.drawPoints=function(s,o,u,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,u,d,f,m,function(v,T,_,R){v.drawPoints(s,T,_,R,m,this)})},Hn.prototype.drawMetrics=function(s,o,u,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,u,d,f,m,function(v,T,_,R){v.drawMetrics(s,T,_,R)})},Hn.prototype.getEnglishName=function(s){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[s];if(o)return o.en},Hn.prototype.validate=function(){let s=[],o=this;function u(f,m){f||(console.warn(`[opentype.js] ${m}`),s.push(m))}function d(f){let m=o.getEnglishName(f);u(m&&m.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),u(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,m=-1;for(let v=0;v<f.length;v++){let T=f[v].glyphID;if(u(m<f[v].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${T} comes after ${m}`),m>f[v].glyphID)break;m=T}}return s},Hn.prototype.toTables=function(){return On.fontToTable(this)},Hn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Hn.prototype.toArrayBuffer=function(){let s=this.toTables().encode(),o=new ArrayBuffer(s.length),u=new Uint8Array(o);for(let d=0;d<s.length;d++)u[d]=s[d];return o},Hn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Hn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Hn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Hn.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Hn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var Y1=Hn;function a7(s,o){let u=new fe.Parser(s,o),d=u.parseUShort(),f=u.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let m=[d,f],v=u.parsePointer32(function(){return this.parseItemVariationStore()}),T=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),_=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),R=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:v,advanceWidth:T,lsb:_,rsb:R}}function o7(){console.warn("Writing of hvar tables is not yet supported.")}var l7={make:o7,parse:a7},c7=function(){return{coverage:this.parsePointer(pe.coverage),attachPoints:this.parseList(pe.pointer(pe.uShortList))}},u7=function(){var s=this.parseUShort();if(ye.argument(s===1||s===2||s===3,"Unsupported CaretValue table version."),s===1)return{coordinate:this.parseShort()};if(s===2)return{pointindex:this.parseShort()};if(s===3)return{coordinate:this.parseShort()}},d7=function(){return this.parseList(pe.pointer(u7))},h7=function(){return{coverage:this.parsePointer(pe.coverage),ligGlyphs:this.parseList(pe.pointer(d7))}},f7=function(){return this.parseUShort(),this.parseList(pe.pointer(pe.coverage))};function p7(s,o){o=o||0;let u=new pe(s,o),d=u.parseVersion(1);ye.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:u.parsePointer(pe.classDef),attachList:u.parsePointer(c7),ligCaretList:u.parsePointer(h7),markAttachClassDef:u.parsePointer(pe.classDef)};return d>=1.2&&(f.markGlyphSets=u.parsePointer(f7)),f}var m7={parse:p7},wo=new Array(10);wo[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(pe.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(pe.coverage),values:this.parseValueRecordList()};ye.assert(!1,"0x"+s.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},wo[2]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();ye.assert(o===1||o===2,"0x"+s.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let u=this.parsePointer(pe.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(pe.pointer(pe.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let m=this.parsePointer(pe.classDef),v=this.parsePointer(pe.classDef),T=this.parseUShort(),_=this.parseUShort();return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,classDef1:m,classDef2:v,class1Count:T,class2Count:_,classRecords:this.parseList(T,pe.list(_,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},wo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},wo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},wo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},wo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},wo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},wo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},wo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function g7(s,o){o=o||0;let u=new pe(s,o),d=u.parseVersion(1);return ye.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(wo)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(wo),variations:u.parseFeatureVariationsList()}}var x7=new Array(10);function b7(s){return new We.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new We.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new We.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new We.LookupList(s.lookups,x7)}])}var y7={parse:g7,make:b7};function v7(s){let o={};s.skip("uShort");let u=s.parseUShort();ye.argument(u===0,"Unsupported kern sub-table version."),s.skip("uShort",2);let d=s.parseUShort();s.skip("uShort",3);for(let f=0;f<d;f+=1){let m=s.parseUShort(),v=s.parseUShort(),T=s.parseShort();o[m+","+v]=T}return o}function w7(s){let o={};s.skip("uShort"),s.parseULong()>1&&console.warn("Only the first kern subtable is supported."),s.skip("uLong");let u=s.parseUShort()&255;if(s.skip("uShort"),u===0){let d=s.parseUShort();s.skip("uShort",3);for(let f=0;f<d;f+=1){let m=s.parseUShort(),v=s.parseUShort(),T=s.parseShort();o[m+","+v]=T}}return o}function A7(s,o){let u=new fe.Parser(s,o),d=u.parseUShort();if(d===0)return v7(u);if(d===1)return w7(u);throw new Error("Unsupported kern table version ("+d+").")}var T7={parse:A7};function C7(s,o,u,d){let f=new fe.Parser(s,o),m=d?f.parseUShort:f.parseULong,v=[];for(let T=0;T<u+1;T+=1){let _=m.call(f);d&&(_*=2),v.push(_)}return v}var S7={parse:C7};function Z1(s,o){let u=[],d=12;for(let f=0;f<o;f+=1){let m=fe.getTag(s,d),v=fe.getULong(s,d+4),T=fe.getULong(s,d+8),_=fe.getULong(s,d+12);u.push({tag:m,checksum:v,offset:T,length:_,compression:!1}),d+=16}return u}function _7(s,o){let u=[],d=44;for(let f=0;f<o;f+=1){let m=fe.getTag(s,d),v=fe.getULong(s,d+4),T=fe.getULong(s,d+8),_=fe.getULong(s,d+12),R;T<_?R="WOFF":R=!1,u.push({tag:m,offset:v,compression:R,compressedLength:T,length:_}),d+=20}return u}function Bn(s,o){if(o.compression==="WOFF"){let u=new Uint8Array(s.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(Z(u,d),d.byteLength!==o.length)throw new Error("Decompression error: "+o.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}else return{data:s,offset:o.offset}}function L7(s,o={}){let u,d,f=new Y1({empty:!0});s.constructor!==ArrayBuffer&&(s=new Uint8Array(s).buffer);let m=new DataView(s,0),v,T=[],_=fe.getTag(m,0);if(_==="\0\0\0"||_==="true"||_==="typ1")f.outlinesFormat="truetype",v=fe.getUShort(m,4),T=Z1(m,v);else if(_==="OTTO")f.outlinesFormat="cff",v=fe.getUShort(m,4),T=Z1(m,v);else if(_==="wOFF"){let mr=fe.getTag(m,4);if(mr==="\0\0\0")f.outlinesFormat="truetype";else if(mr==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+_);v=fe.getUShort(m,12),T=_7(m,v)}else if(_==="wOF2"){let mr="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+mr)}else throw new Error("Unsupported OpenType signature "+_);let R,N,q,V,ge,ce,Ce,it,pr,or,_r,en,Fn,Vn,qn,Ns,Ao,tn;for(let mr=0;mr<v;mr+=1){let sr=T[mr],ir;switch(sr.tag){case"avar":Ce=sr;break;case"cmap":ir=Bn(m,sr),f.tables.cmap=Br.parse(ir.data,ir.offset),f.encoding=new nn(f.tables.cmap);break;case"cvt ":ir=Bn(m,sr),tn=new fe.Parser(ir.data,ir.offset),f.tables.cvt=tn.parseShortList(sr.length/2);break;case"fvar":q=sr;break;case"STAT":V=sr;break;case"gvar":ge=sr;break;case"cvar":ce=sr;break;case"fpgm":ir=Bn(m,sr),tn=new fe.Parser(ir.data,ir.offset),f.tables.fpgm=tn.parseByteList(sr.length);break;case"head":ir=Bn(m,sr),f.tables.head=us.parse(ir.data,ir.offset),f.unitsPerEm=f.tables.head.unitsPerEm,u=f.tables.head.indexToLocFormat;break;case"hhea":ir=Bn(m,sr),f.tables.hhea=ts.parse(ir.data,ir.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":Fn=sr;break;case"hmtx":en=sr;break;case"ltag":ir=Bn(m,sr),d=tl.parse(ir.data,ir.offset);break;case"COLR":ir=Bn(m,sr),f.tables.colr=hi.parse(ir.data,ir.offset);break;case"CPAL":ir=Bn(m,sr),f.tables.cpal=ar.parse(ir.data,ir.offset);break;case"maxp":ir=Bn(m,sr),f.tables.maxp=Do.parse(ir.data,ir.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Ns=sr;break;case"OS/2":ir=Bn(m,sr),f.tables.os2=Li.parse(ir.data,ir.offset);break;case"post":ir=Bn(m,sr),f.tables.post=xo.parse(ir.data,ir.offset),f.glyphNames=new jn(f.tables.post);break;case"prep":ir=Bn(m,sr),tn=new fe.Parser(ir.data,ir.offset),f.tables.prep=tn.parseByteList(sr.length);break;case"glyf":it=sr;break;case"loca":qn=sr;break;case"CFF ":R=sr;break;case"CFF2":N=sr;break;case"kern":Vn=sr;break;case"GDEF":pr=sr;break;case"GPOS":or=sr;break;case"GSUB":_r=sr;break;case"meta":Ao=sr;break;case"gasp":try{ir=Bn(m,sr),f.tables.gasp=L.parse(ir.data,ir.offset)}catch(Ei){console.warn("Failed to parse gasp table, skipping."),console.warn(Ei)}break;case"SVG ":ir=Bn(m,sr),f.tables.svg=H.parse(ir.data,ir.offset);break;default:break}}let Na=Bn(m,Ns);if(f.tables.name=kn.parse(Na.data,Na.offset,d),f.names=f.tables.name,it&&qn){let mr=u===0,sr=Bn(m,qn),ir=S7.parse(sr.data,sr.offset,f.numGlyphs,mr),Ei=Bn(m,it);f.glyphs=_0.parse(Ei.data,Ei.offset,ir,f,o)}else if(R){let mr=Bn(m,R);Xi.parse(mr.data,mr.offset,f,o)}else if(N){let mr=Bn(m,N);Xi.parse(mr.data,mr.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Fi=Bn(m,en);if($a.parse(f,Fi.data,Fi.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),Te(f,o),Vn){let mr=Bn(m,Vn);f.kerningPairs=T7.parse(mr.data,mr.offset)}else f.kerningPairs={};if(pr){let mr=Bn(m,pr);f.tables.gdef=m7.parse(mr.data,mr.offset)}if(or){let mr=Bn(m,or);f.tables.gpos=y7.parse(mr.data,mr.offset),f.position.init()}if(_r){let mr=Bn(m,_r);f.tables.gsub=di.parse(mr.data,mr.offset)}if(q){let mr=Bn(m,q);f.tables.fvar=fi.parse(mr.data,mr.offset,f.names)}if(V){let mr=Bn(m,V);f.tables.stat=Qi.parse(mr.data,mr.offset,f.tables.fvar)}if(ge){q||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),it||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let mr=Bn(m,ge);f.tables.gvar=_t.parse(mr.data,mr.offset,f.tables.fvar,f.glyphs)}if(ce){q||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),f.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),it||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let mr=Bn(m,ce);f.tables.cvar=yt.parse(mr.data,mr.offset,f.tables.fvar,f.tables.cvt||[])}if(Ce){q||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let mr=Bn(m,Ce);f.tables.avar=_a.parse(mr.data,mr.offset,f.tables.fvar)}if(Fn){q||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),en||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let mr=Bn(m,Fn);f.tables.hvar=l7.parse(mr.data,mr.offset,f.tables.fvar)}if(Ao){let mr=Bn(m,Ao);f.tables.meta=Hs.parse(mr.data,mr.offset),f.metas=f.tables.meta}return f.palettes=new id(f),f}function k7(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function I7(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(x)})();(function(n,a){typeof define=="function"&&define.amd?define(a):typeof t=="object"&&t.exports?t.exports=a():n.opentype=a()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),p_=h_(f_()),vi=qc("lru-cache:metrics"),xu=n_("lru-cache"),m_=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Yf=()=>vi.hasSubscribers||xu.hasSubscribers,p3=new Set,e2=typeof process=="object"&&process?process:{},g_=(e,t,r,n)=>{typeof e2.emitWarning=="function"?e2.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},x_=e=>!p3.has(e),Fl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),m3=e=>Fl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?uh:null:null,uh=class extends Array{constructor(e){super(e),this.fill(0)}},sc,$0,b_=(sc=class{constructor(e,t){if(Qs(this,"heap"),Qs(this,"length"),!J(sc,$0))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=m3(e);if(!t)return[];Cr(sc,$0,!0);let r=new sc(e,t);return Cr(sc,$0,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},$0=new WeakMap,xn(sc,$0,!1),sc),t2,r2,So,Ka,Fo,Mc,$o,U0,z0,Uo,Zs,Xa,Bs,hs,Gr,oa,Ja,Hi,gi,zo,xi,Ho,Wo,eo,to,Go,H0,la,Dc,Wt,Zf,jc,Dl,Ld,ro,n2,Bc,W0,kd,jl,Bl,Kf,Qc,Id,s2,i2,Ed,ns,Xf,a2,o2,G0,Jf,V0,Ql,ep,tp,y_=(tp=class{constructor(e){xn(this,Wt),xn(this,So),xn(this,Ka),xn(this,Fo),xn(this,Mc),xn(this,$o),xn(this,U0),xn(this,z0),xn(this,Uo),Qs(this,"ttl"),Qs(this,"ttlResolution"),Qs(this,"ttlAutopurge"),Qs(this,"updateAgeOnGet"),Qs(this,"updateAgeOnHas"),Qs(this,"allowStale"),Qs(this,"noDisposeOnSet"),Qs(this,"noUpdateTTL"),Qs(this,"maxEntrySize"),Qs(this,"sizeCalculation"),Qs(this,"noDeleteOnFetchRejection"),Qs(this,"noDeleteOnStaleGet"),Qs(this,"allowStaleOnFetchAbort"),Qs(this,"allowStaleOnFetchRejection"),Qs(this,"ignoreFetchAbort"),Qs(this,"backgroundFetchSize"),xn(this,Zs),xn(this,Xa),xn(this,Bs),xn(this,hs),xn(this,Gr),xn(this,oa),xn(this,Ja),xn(this,Hi),xn(this,gi),xn(this,zo),xn(this,xi),xn(this,Ho),xn(this,Wo),xn(this,eo),xn(this,to),xn(this,Go),xn(this,H0),xn(this,la),xn(this,Dc),xn(this,jc,()=>{}),xn(this,Dl,()=>{}),xn(this,Ld,()=>{}),xn(this,ro,()=>!1),xn(this,Bc,he=>{}),xn(this,W0,(he,de,$e)=>{}),xn(this,kd,(he,de,$e,qe)=>{if($e||qe)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Qs(this,t2,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:l,updateAgeOnHas:c,allowStale:h,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:y,noUpdateTTL:A,maxSize:w=0,maxEntrySize:k=0,sizeCalculation:E,fetchMethod:I,memoMethod:M,noDeleteOnFetchRejection:B,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:U,allowStaleOnFetchAbort:G,ignoreFetchAbort:Q,backgroundFetchSize:X=1,perf:ee}=e;if(this.backgroundFetchSize=X,ee!==void 0&&typeof ee?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(Cr(this,Uo,ee??m_),t!==0&&!Fl(t))throw new TypeError("max option must be a nonnegative integer");let ze=t?m3(t):Array;if(!ze)throw new Error("invalid max value: "+t);if(Cr(this,So,t),Cr(this,Ka,w),this.maxEntrySize=k||J(this,Ka),this.sizeCalculation=E,this.sizeCalculation){if(!J(this,Ka)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(Cr(this,z0,M),I!==void 0&&typeof I!="function")throw new TypeError("fetchMethod must be a function if specified");if(Cr(this,U0,I),Cr(this,H0,!!I),Cr(this,Bs,new Map),Cr(this,hs,Array.from({length:t}).fill(void 0)),Cr(this,Gr,Array.from({length:t}).fill(void 0)),Cr(this,oa,new ze(t)),Cr(this,Ja,new ze(t)),Cr(this,Hi,0),Cr(this,gi,0),Cr(this,zo,b_.create(t)),Cr(this,Zs,0),Cr(this,Xa,0),typeof p=="function"&&Cr(this,Fo,p),typeof g=="function"&&Cr(this,Mc,g),typeof x=="function"?(Cr(this,$o,x),Cr(this,xi,[])):(Cr(this,$o,void 0),Cr(this,xi,void 0)),Cr(this,Go,!!J(this,Fo)),Cr(this,Dc,!!J(this,Mc)),Cr(this,la,!!J(this,$o)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!B,this.allowStaleOnFetchRejection=!!U,this.allowStaleOnFetchAbort=!!G,this.ignoreFetchAbort=!!Q,this.maxEntrySize!==0){if(J(this,Ka)!==0&&!Fl(J(this,Ka)))throw new TypeError("maxSize must be a positive integer if specified");if(!Fl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Gt(this,Wt,n2).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!c,this.ttlResolution=Fl(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Fl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Gt(this,Wt,Zf).call(this)}if(J(this,So)===0&&this.ttl===0&&J(this,Ka)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!J(this,So)&&!J(this,Ka)){let he="LRU_CACHE_UNBOUNDED";x_(he)&&(p3.add(he),g_("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",he,tp))}}get perf(){return J(this,Uo)}static unsafeExposeInternals(e){return{starts:J(e,Wo),ttls:J(e,eo),autopurgeTimers:J(e,to),sizes:J(e,Ho),keyMap:J(e,Bs),keyList:J(e,hs),valList:J(e,Gr),next:J(e,oa),prev:J(e,Ja),get head(){return J(e,Hi)},get tail(){return J(e,gi)},free:J(e,zo),isBackgroundFetch:t=>{var r;return Gt(r=e,Wt,ns).call(r,t)},backgroundFetch:(t,r,n,a)=>{var l;return Gt(l=e,Wt,Ed).call(l,t,r,n,a)},moveToTail:t=>{var r;return Gt(r=e,Wt,V0).call(r,t)},indexes:t=>{var r;return Gt(r=e,Wt,jl).call(r,t)},rindexes:t=>{var r;return Gt(r=e,Wt,Bl).call(r,t)},isStale:t=>{var r;return J(r=e,ro).call(r,t)}}}get max(){return J(this,So)}get maxSize(){return J(this,Ka)}get calculatedSize(){return J(this,Xa)}get size(){return J(this,Zs)}get fetchMethod(){return J(this,U0)}get memoMethod(){return J(this,z0)}get dispose(){return J(this,Fo)}get onInsert(){return J(this,Mc)}get disposeAfter(){return J(this,$o)}getRemainingTTL(e){return J(this,Bs).has(e)?1/0:0}*entries(){for(let e of Gt(this,Wt,jl).call(this))J(this,Gr)[e]!==void 0&&J(this,hs)[e]!==void 0&&!Gt(this,Wt,ns).call(this,J(this,Gr)[e])&&(yield[J(this,hs)[e],J(this,Gr)[e]])}*rentries(){for(let e of Gt(this,Wt,Bl).call(this))J(this,Gr)[e]!==void 0&&J(this,hs)[e]!==void 0&&!Gt(this,Wt,ns).call(this,J(this,Gr)[e])&&(yield[J(this,hs)[e],J(this,Gr)[e]])}*keys(){for(let e of Gt(this,Wt,jl).call(this)){let t=J(this,hs)[e];t!==void 0&&!Gt(this,Wt,ns).call(this,J(this,Gr)[e])&&(yield t)}}*rkeys(){for(let e of Gt(this,Wt,Bl).call(this)){let t=J(this,hs)[e];t!==void 0&&!Gt(this,Wt,ns).call(this,J(this,Gr)[e])&&(yield t)}}*values(){for(let e of Gt(this,Wt,jl).call(this))J(this,Gr)[e]!==void 0&&!Gt(this,Wt,ns).call(this,J(this,Gr)[e])&&(yield J(this,Gr)[e])}*rvalues(){for(let e of Gt(this,Wt,Bl).call(this))J(this,Gr)[e]!==void 0&&!Gt(this,Wt,ns).call(this,J(this,Gr)[e])&&(yield J(this,Gr)[e])}[(r2=Symbol.iterator,t2=Symbol.toStringTag,r2)](){return this.entries()}find(e,t={}){for(let r of Gt(this,Wt,jl).call(this)){let n=J(this,Gr)[r],a=Gt(this,Wt,ns).call(this,n)?n.__staleWhileFetching:n;if(a!==void 0&&e(a,J(this,hs)[r],this))return Gt(this,Wt,G0).call(this,J(this,hs)[r],t)}}forEach(e,t=this){for(let r of Gt(this,Wt,jl).call(this)){let n=J(this,Gr)[r],a=Gt(this,Wt,ns).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&e.call(t,a,J(this,hs)[r],this)}}rforEach(e,t=this){for(let r of Gt(this,Wt,Bl).call(this)){let n=J(this,Gr)[r],a=Gt(this,Wt,ns).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&e.call(t,a,J(this,hs)[r],this)}}purgeStale(){let e=!1;for(let t of Gt(this,Wt,Bl).call(this,{allowStale:!0}))J(this,ro).call(this,t)&&(Gt(this,Wt,Ql).call(this,J(this,hs)[t],"expire"),e=!0);return e}info(e){let t=J(this,Bs).get(e);if(t===void 0)return;let r=J(this,Gr)[t],n=Gt(this,Wt,ns).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let a={value:n};if(J(this,eo)&&J(this,Wo)){let l=J(this,eo)[t],c=J(this,Wo)[t];if(l&&c){let h=l-(J(this,Uo).now()-c);a.ttl=h,a.start=Date.now()}}return J(this,Ho)&&(a.size=J(this,Ho)[t]),a}dump(){let e=[];for(let t of Gt(this,Wt,jl).call(this,{allowStale:!0})){let r=J(this,hs)[t],n=J(this,Gr)[t],a=Gt(this,Wt,ns).call(this,n)?n.__staleWhileFetching:n;if(a===void 0||r===void 0)continue;let l={value:a};if(J(this,eo)&&J(this,Wo)){l.ttl=J(this,eo)[t];let c=J(this,Uo).now()-J(this,Wo)[t];l.start=Math.floor(Date.now()-c)}J(this,Ho)&&(l.size=J(this,Ho)[t]),e.unshift([r,l])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=J(this,Uo).now()-n}Gt(this,Wt,Qc).call(this,t,r.value,r)}}set(e,t,r={}){let{status:n=vi.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="set",n.key=e,t!==void 0&&(n.value=t),n.cache=this);let a=Gt(this,Wt,Qc).call(this,e,t,r);return n&&vi.hasSubscribers&&vi.publish(n),a}pop(){var e;try{for(;J(this,Zs);){let t=J(this,Gr)[J(this,Hi)];if(Gt(this,Wt,Id).call(this,!0),Gt(this,Wt,ns).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(J(this,la)&&J(this,xi)){let t=J(this,xi),r;for(;r=t?.shift();)(e=J(this,$o))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=vi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let n=Gt(this,Wt,s2).call(this,e,t);return vi.hasSubscribers&&vi.publish(r),n}peek(e,t={}){let{status:r=Yf()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let n=Gt(this,Wt,i2).call(this,e,t);return vi.hasSubscribers&&vi.publish(r),n}fetch(e,t={}){let r=xu.hasSubscribers,{status:n=Yf()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let a=Gt(this,Wt,Xf).call(this,e,t);return n&&r&&(n.trace=!0,xu.tracePromise(()=>a,n).catch(()=>{})),a}forceFetch(e,t={}){let r=xu.hasSubscribers,{status:n=Yf()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let a=Gt(this,Wt,a2).call(this,e,t);return n&&r&&(n.trace=!0,xu.tracePromise(()=>a,n).catch(()=>{})),a}memo(e,t={}){let{status:r=vi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let n=Gt(this,Wt,o2).call(this,e,t);return r&&(r.value=n),vi.hasSubscribers&&vi.publish(r),n}get(e,t={}){let{status:r=vi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let n=Gt(this,Wt,G0).call(this,e,t);return r&&(n!==void 0&&(r.value=n),vi.hasSubscribers&&vi.publish(r)),n}delete(e){return Gt(this,Wt,Ql).call(this,e,"delete")}clear(){return Gt(this,Wt,ep).call(this,"delete")}},So=new WeakMap,Ka=new WeakMap,Fo=new WeakMap,Mc=new WeakMap,$o=new WeakMap,U0=new WeakMap,z0=new WeakMap,Uo=new WeakMap,Zs=new WeakMap,Xa=new WeakMap,Bs=new WeakMap,hs=new WeakMap,Gr=new WeakMap,oa=new WeakMap,Ja=new WeakMap,Hi=new WeakMap,gi=new WeakMap,zo=new WeakMap,xi=new WeakMap,Ho=new WeakMap,Wo=new WeakMap,eo=new WeakMap,to=new WeakMap,Go=new WeakMap,H0=new WeakMap,la=new WeakMap,Dc=new WeakMap,Wt=new WeakSet,Zf=function(){let e=new uh(J(this,So)),t=new uh(J(this,So));Cr(this,eo,e),Cr(this,Wo,t);let r=this.ttlAutopurge?Array.from({length:J(this,So)}):void 0;Cr(this,to,r),Cr(this,Ld,(c,h,p=J(this,Uo).now())=>{t[c]=h!==0?p:0,e[c]=h,n(c,h)}),Cr(this,jc,c=>{t[c]=e[c]!==0?J(this,Uo).now():0,n(c,e[c])});let n=this.ttlAutopurge?(c,h)=>{if(r?.[c]&&(clearTimeout(r[c]),r[c]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{J(this,ro).call(this,c)&&Gt(this,Wt,Ql).call(this,J(this,hs)[c],"expire")},h+1);p.unref&&p.unref(),r[c]=p}}:()=>{};Cr(this,Dl,(c,h)=>{if(e[h]){let p=e[h],g=t[h];if(!p||!g)return;c.ttl=p,c.start=g,c.now=a||l();let x=c.now-g;c.remainingTTL=p-x}});let a=0,l=()=>{let c=J(this,Uo).now();if(this.ttlResolution>0){a=c;let h=setTimeout(()=>a=0,this.ttlResolution);h.unref&&h.unref()}return c};this.getRemainingTTL=c=>{let h=J(this,Bs).get(c);if(h===void 0)return 0;let p=e[h],g=t[h];if(!p||!g)return 1/0;let x=(a||l())-g;return p-x},Cr(this,ro,c=>{let h=t[c],p=e[c];return!!p&&!!h&&(a||l())-h>p})},jc=new WeakMap,Dl=new WeakMap,Ld=new WeakMap,ro=new WeakMap,n2=function(){let e=new uh(J(this,So));Cr(this,Xa,0),Cr(this,Ho,e),Cr(this,Bc,t=>{Cr(this,Xa,J(this,Xa)-e[t]),e[t]=0}),Cr(this,kd,(t,r,n,a)=>{if(!Fl(n)){if(Gt(this,Wt,ns).call(this,r))return this.backgroundFetchSize;if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(r,t),!Fl(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return n}),Cr(this,W0,(t,r,n)=>{if(e[t]=r,J(this,Ka)){let a=J(this,Ka)-e[t];for(;J(this,Xa)>a;)Gt(this,Wt,Id).call(this,!0)}Cr(this,Xa,J(this,Xa)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=J(this,Xa))})},Bc=new WeakMap,W0=new WeakMap,kd=new WeakMap,jl=function*({allowStale:e=this.allowStale}={}){if(J(this,Zs))for(let t=J(this,gi);Gt(this,Wt,Kf).call(this,t)&&((e||!J(this,ro).call(this,t))&&(yield t),t!==J(this,Hi));)t=J(this,Ja)[t]},Bl=function*({allowStale:e=this.allowStale}={}){if(J(this,Zs))for(let t=J(this,Hi);Gt(this,Wt,Kf).call(this,t)&&((e||!J(this,ro).call(this,t))&&(yield t),t!==J(this,gi));)t=J(this,oa)[t]},Kf=function(e){return e!==void 0&&J(this,Bs).get(J(this,hs)[e])===e},Qc=function(e,t,r,n){var a,l,c,h;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:y=this.sizeCalculation,status:A}=r,w=Gt(this,Wt,ns).call(this,t);if(t===void 0)return A&&(A.set="deleted"),this.delete(e),this;let{noUpdateTTL:k=this.noUpdateTTL}=r;A&&!w&&(A.value=t);let E=J(this,kd).call(this,e,t,r.size||0,y,A);if(this.maxEntrySize&&E>this.maxEntrySize)return Gt(this,Wt,Ql).call(this,e,"set"),A&&(A.set="miss",A.maxEntrySizeExceeded=!0),this;let I=J(this,Zs)===0?void 0:J(this,Bs).get(e);if(I===void 0)I=J(this,Zs)===0?J(this,gi):J(this,zo).length!==0?J(this,zo).pop():J(this,Zs)===J(this,So)?Gt(this,Wt,Id).call(this,!1):J(this,Zs),J(this,hs)[I]=e,J(this,Gr)[I]=t,J(this,Bs).set(e,I),J(this,oa)[J(this,gi)]=I,J(this,Ja)[I]=J(this,gi),Cr(this,gi,I),qf(this,Zs)._++,J(this,W0).call(this,I,E,A),A&&(A.set="add"),k=!1,J(this,Dc)&&!w&&((a=J(this,Mc))==null||a.call(this,t,e,"add"));else{Gt(this,Wt,V0).call(this,I);let M=J(this,Gr)[I];if(t!==M){if(!x)if(Gt(this,Wt,ns).call(this,M)){M!==n&&M.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:B}=M;B!==void 0&&B!==t&&(J(this,Go)&&((l=J(this,Fo))==null||l.call(this,B,e,"set")),J(this,la)&&J(this,xi)?.push([B,e,"set"]))}else J(this,Go)&&((c=J(this,Fo))==null||c.call(this,M,e,"set")),J(this,la)&&J(this,xi)?.push([M,e,"set"]);if(J(this,Bc).call(this,I),J(this,W0).call(this,I,E,A),J(this,Gr)[I]=t,!w){let B=M&&Gt(this,Wt,ns).call(this,M)?M.__staleWhileFetching:M,F=B===void 0?"add":t!==B?"replace":"update";A&&(A.set=F,B!==void 0&&(A.oldValue=B)),J(this,Dc)&&this.onInsert?.(t,e,F)}}else w||(A&&(A.set="update"),J(this,Dc)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!J(this,eo)&&Gt(this,Wt,Zf).call(this),J(this,eo)&&(k||J(this,Ld).call(this,I,p,g),A&&J(this,Dl).call(this,A,I)),!x&&J(this,la)&&J(this,xi)){let M=J(this,xi),B;for(;B=M?.shift();)(h=J(this,$o))==null||h.call(this,...B)}return this},Id=function(e){var t;let r=J(this,Hi),n=J(this,hs)[r],a=J(this,Gr)[r],l=Gt(this,Wt,ns).call(this,a);l&&a.__abortController.abort(new Error("evicted"));let c=l?a.__staleWhileFetching:a;return(J(this,Go)||J(this,la))&&c!==void 0&&(J(this,Go)&&((t=J(this,Fo))==null||t.call(this,c,n,"evict")),J(this,la)&&J(this,xi)?.push([c,n,"evict"])),J(this,Bc).call(this,r),J(this,to)?.[r]&&(clearTimeout(J(this,to)[r]),J(this,to)[r]=void 0),e&&(J(this,hs)[r]=void 0,J(this,Gr)[r]=void 0,J(this,zo).push(r)),J(this,Zs)===1?(Cr(this,Hi,Cr(this,gi,0)),J(this,zo).length=0):Cr(this,Hi,J(this,oa)[r]),J(this,Bs).delete(n),qf(this,Zs)._--,r},s2=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,a=J(this,Bs).get(e);if(a!==void 0){let l=J(this,Gr)[a];if(Gt(this,Wt,ns).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(J(this,ro).call(this,a))n&&(n.has="stale",J(this,Dl).call(this,n,a));else return r&&J(this,jc).call(this,a),n&&(n.has="hit",J(this,Dl).call(this,n,a)),!0}else n&&(n.has="miss");return!1},i2=function(e,t){let{status:r,allowStale:n=this.allowStale}=t,a=J(this,Bs).get(e);if(a===void 0||!n&&J(this,ro).call(this,a)){r&&(r.peek=a===void 0?"miss":"stale");return}let l=J(this,Gr)[a],c=Gt(this,Wt,ns).call(this,l)?l.__staleWhileFetching:l;return r&&(c!==void 0?(r.peek="hit",r.value=c):r.peek="miss"),c},Ed=function(e,t,r,n){let a=t===void 0?void 0:J(this,Gr)[t];if(Gt(this,Wt,ns).call(this,a))return a;let l=new AbortController,{signal:c}=r;c?.addEventListener("abort",()=>l.abort(c.reason),{signal:l.signal});let h={signal:l.signal,options:r,context:n},p=(k,E=!1)=>{let{aborted:I}=l.signal,M=r.ignoreFetchAbort&&k!==void 0,B=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(I&&!E?(r.status.fetchAborted=!0,r.status.fetchError=l.signal.reason,M&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),I&&!M&&!E)return x(l.signal.reason,B);let F=A,U=J(this,Gr)[t];return(U===A||U===void 0&&M&&E)&&(k===void 0?F.__staleWhileFetching!==void 0?J(this,Gr)[t]=F.__staleWhileFetching:Gt(this,Wt,Ql).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Gt(this,Wt,Qc).call(this,e,k,h.options,F))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,E)=>{let{aborted:I}=l.signal,M=I&&r.allowStaleOnFetchAbort,B=M||r.allowStaleOnFetchRejection,F=B||r.noDeleteOnFetchRejection,U=A;if(J(this,Gr)[t]===A&&(!F||!E&&U.__staleWhileFetching===void 0?Gt(this,Wt,Ql).call(this,e,"fetch"):M||(J(this,Gr)[t]=U.__staleWhileFetching)),B)return r.status&&U.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),U.__staleWhileFetching;if(U.__returned===U)throw k},y=(k,E)=>{var I;let M=(I=J(this,U0))==null?void 0:I.call(this,e,a,h);l.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=B=>p(B,!0)))}),M&&M instanceof Promise?M.then(B=>k(B===void 0?void 0:B),E):M!==void 0&&k(M)};r.status&&(r.status.fetchDispatched=!0);let A=new Promise(y).then(p,g),w=Object.assign(A,{__abortController:l,__staleWhileFetching:a,__returned:void 0});return t===void 0?(Gt(this,Wt,Qc).call(this,e,w,{...h.options,status:void 0}),t=J(this,Bs).get(e)):J(this,Gr)[t]=w,w},ns=function(e){if(!J(this,H0))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Xf=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:k,forceRefresh:E=!1,status:I,signal:M}=t;if(I&&(I.op="fetch",I.key=e,E&&(I.forceRefresh=!0),I.cache=this),!J(this,H0))return I&&(I.fetch="get"),Gt(this,Wt,G0).call(this,e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:I});let B={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:l,noDisposeOnSet:c,size:h,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:w,ignoreFetchAbort:A,status:I,signal:M},F=J(this,Bs).get(e);if(F===void 0){I&&(I.fetch="miss");let U=Gt(this,Wt,Ed).call(this,e,F,B,k);return U.__returned=U}else{let U=J(this,Gr)[F];if(Gt(this,Wt,ns).call(this,U)){let ee=r&&U.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",ee&&(I.returnedStale=!0)),ee?U.__staleWhileFetching:U.__returned=U}let G=J(this,ro).call(this,F);if(!E&&!G)return I&&(I.fetch="hit"),Gt(this,Wt,V0).call(this,F),n&&J(this,jc).call(this,F),I&&J(this,Dl).call(this,I,F),U;let Q=Gt(this,Wt,Ed).call(this,e,F,B,k),X=Q.__staleWhileFetching!==void 0&&r;return I&&(I.fetch=G?"stale":"refresh",X&&G&&(I.returnedStale=!0)),X?Q.__staleWhileFetching:Q.__returned=Q}},a2=async function(e,t={}){let r=await Gt(this,Wt,Xf).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},o2=function(e,t={}){let r=J(this,z0);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,status:a,forceRefresh:l,...c}=t;a&&l&&(a.forceRefresh=!0);let h=Gt(this,Wt,G0).call(this,e,c),p=l||h===void 0;if(a&&(a.memo=p?"miss":"hit",p||(a.value=h)),!p)return h;let g=r(e,h,{options:c,context:n});return a&&(a.value=g),Gt(this,Wt,Qc).call(this,e,g,c),g},G0=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:l}=t,c=J(this,Bs).get(e);if(c===void 0){l&&(l.get="miss");return}let h=J(this,Gr)[c],p=Gt(this,Wt,ns).call(this,h);return l&&J(this,Dl).call(this,l,c),J(this,ro).call(this,c)?p?(l&&(l.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(l&&(l.returnedStale=!0),h.__staleWhileFetching):void 0):(a||Gt(this,Wt,Ql).call(this,e,"expire"),l&&(l.get="stale"),r?(l&&(l.returnedStale=!0),h):void 0):(l&&(l.get=p?"fetching":"hit"),Gt(this,Wt,V0).call(this,c),n&&J(this,jc).call(this,c),p?h.__staleWhileFetching:h)},Jf=function(e,t){J(this,Ja)[t]=e,J(this,oa)[e]=t},V0=function(e){e!==J(this,gi)&&(e===J(this,Hi)?Cr(this,Hi,J(this,oa)[e]):Gt(this,Wt,Jf).call(this,J(this,Ja)[e],J(this,oa)[e]),Gt(this,Wt,Jf).call(this,J(this,gi),e),Cr(this,gi,e))},Ql=function(e,t){var r,n;vi.hasSubscribers&&vi.publish({op:"delete",delete:t,key:e,cache:this});let a=!1;if(J(this,Zs)!==0){let l=J(this,Bs).get(e);if(l!==void 0)if(J(this,to)?.[l]&&(clearTimeout(J(this,to)?.[l]),J(this,to)[l]=void 0),a=!0,J(this,Zs)===1)Gt(this,Wt,ep).call(this,t);else{J(this,Bc).call(this,l);let c=J(this,Gr)[l];if(Gt(this,Wt,ns).call(this,c)?c.__abortController.abort(new Error("deleted")):(J(this,Go)||J(this,la))&&(J(this,Go)&&((r=J(this,Fo))==null||r.call(this,c,e,t)),J(this,la)&&J(this,xi)?.push([c,e,t])),J(this,Bs).delete(e),J(this,hs)[l]=void 0,J(this,Gr)[l]=void 0,l===J(this,gi))Cr(this,gi,J(this,Ja)[l]);else if(l===J(this,Hi))Cr(this,Hi,J(this,oa)[l]);else{let h=J(this,Ja)[l];J(this,oa)[h]=J(this,oa)[l];let p=J(this,oa)[l];J(this,Ja)[p]=J(this,Ja)[l]}qf(this,Zs)._--,J(this,zo).push(l)}}if(J(this,la)&&J(this,xi)?.length){let l=J(this,xi),c;for(;c=l?.shift();)(n=J(this,$o))==null||n.call(this,...c)}return a},ep=function(e){var t,r;for(let n of Gt(this,Wt,Bl).call(this,{allowStale:!0})){let a=J(this,Gr)[n];if(Gt(this,Wt,ns).call(this,a))a.__abortController.abort(new Error("deleted"));else{let l=J(this,hs)[n];J(this,Go)&&((t=J(this,Fo))==null||t.call(this,a,l,e)),J(this,la)&&J(this,xi)?.push([a,l,e])}}if(J(this,Bs).clear(),J(this,Gr).fill(void 0),J(this,hs).fill(void 0),J(this,eo)&&J(this,Wo)){J(this,eo).fill(0),J(this,Wo).fill(0);for(let n of J(this,to)??[])n!==void 0&&clearTimeout(n);J(this,to)?.fill(void 0)}if(J(this,Ho)&&J(this,Ho).fill(0),Cr(this,Hi,0),Cr(this,gi,0),J(this,zo).length=0,Cr(this,Xa,0),Cr(this,Zs,0),J(this,la)&&J(this,xi)){let n=J(this,xi),a;for(;a=n?.shift();)(r=J(this,$o))==null||r.call(this,...a)}},tp);function g3(e){let t={individual:{},range:[]},r=new WeakMap;for(let n of e)am(t,n,r);return t}function am(e,t,r){for(let[n,a]of Object.entries(t.individual))if(e.individual[n])Pc(e.individual[n],a,r);else{let l=!1;for(let[c,{range:h,entry:p}]of e.range.entries()){let g=rp(Number(n),h);if(g.both!==null){l=!0,e.individual[n]=a,Pc(e.individual[n],wi(p),r),e.range.splice(c,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:wi(p)}):e.individual[x]=wi(p)}}l||(e.individual[n]=a)}for(let{range:n,entry:a}of t.range){let l=[n];for(let c=0;c<e.range.length;c++){let{range:h,entry:p}=e.range[c];for(let[g,x]of l.entries())if(Array.isArray(x)){let y=v_(x,h);if(y.both===null)continue;e.range.splice(c,1),c--;let A=wi(p);Array.isArray(y.both)?e.range.push({range:y.both,entry:A}):e.individual[y.both]=A,Pc(A,wi(a),r);for(let w of y.second)Array.isArray(w)?e.range.push({range:w,entry:wi(p)}):e.individual[w]=wi(p);l=y.first}else{let y=rp(x,h);if(y.both===null)continue;e.individual[x]=wi(a),Pc(e.individual[x],wi(p),r),e.range.splice(c,1),c--;for(let A of y.second)Array.isArray(A)?e.range.push({range:A,entry:wi(p)}):e.individual[A]=wi(p);l.splice(g,1,...y.first);break}}for(let c of Object.keys(e.individual))for(let[h,p]of l.entries())if(Array.isArray(p)){let g=rp(Number(c),p);if(g.both===null)continue;Pc(e.individual[c],wi(a),r),l.splice(h,1,...g.second);break}else if(Number(c)===p){Pc(e.individual[c],wi(a),r);break}for(let c of l)Array.isArray(c)?e.range.push({range:c,entry:wi(a)}):e.individual[c]=wi(a)}}function Pc(e,t,r){let n=r.get(e);n?.has(t)||(n||(n=new Set,r.set(e,n)),n.add(t),t.lookup&&(!e.lookup||e.lookup.index>t.lookup.index||e.lookup.index===t.lookup.index&&e.lookup.subIndex>t.lookup.subIndex)&&(e.lookup=t.lookup),t.forward&&(e.forward?am(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?am(e.reverse,t.reverse,r):e.reverse=t.reverse))}function v_(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let n=Math.max(e[0],t[0]),a=Math.min(e[1],t[1]);r.both=cc(n,a)}if(e[0]<t[0]){let n=e[0],a=Math.min(t[0],e[1]);r.first.push(cc(n,a))}else if(t[0]<e[0]){let n=t[0],a=Math.min(t[1],e[0]);r.second.push(cc(n,a))}if(e[1]>t[1]){let n=Math.max(e[0],t[1]),a=e[1];r.first.push(cc(n,a))}else if(t[1]>e[1]){let n=Math.max(e[1],t[0]),a=t[1];r.second.push(cc(n,a))}return r}function rp(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let r={first:[],second:[],both:e};return t[0]<e&&r.second.push(cc(t[0],e)),t[1]>e&&r.second.push(cc(e+1,t[1])),r}function cc(e,t){return t-e===1?e:[e,t]}function wi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=l2(e.forward,t)),e.reverse&&(r.reverse=l2(e.reverse,t)),e.lookup&&(r.lookup={contextRange:e.lookup.contextRange.slice(),index:e.lookup.index,length:e.lookup.length,subIndex:e.lookup.subIndex,substitutions:e.lookup.substitutions.slice()}),r}function l2(e,t=new Map){let r={};for(let[n,a]of Object.entries(e.individual))r[n]=wi(a,t);return{individual:r,range:e.range.map(({range:n,entry:a})=>({range:n.slice(),entry:wi(a,t)}))}}function om(e,t,r,n){let a=t[n],l=e[a];if(!l)return;let c=l.lookup;if(l.reverse){let p=w_(l.reverse,t,r);(!c&&p||p&&c&&(c.index>p.index||c.index===p.index&&c.subIndex>p.subIndex))&&(c=p)}if(++n>=t.length||!l.forward)return c;let h=om(l.forward,t,r,n);return(!c&&h||h&&c&&(c.index>h.index||c.index===h.index&&c.subIndex>h.subIndex))&&(c=h),c}function w_(e,t,r){let n=e[t[--r]],a=n&&n.lookup;for(;n&&((!a&&n.lookup||n.lookup&&a&&a.index>n.lookup.index)&&(a=n.lookup),!(--r<0||!n.reverse));)n=n.reverse[t[r]];return a}function c2(e,t,r){let n=!1;for(let a=0;a<e.length;a++){let l=e[a];if(n){if(r<=l[0])return e[a-1][1]=r,e;if(r<=l[1])return e[a-1][1]=Math.max(r,l[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(r<=l[0])return e.splice(a,0,[t,r]),e;if(r<=l[1])return l[0]=Math.min(t,l[0]),e;if(t<l[1])l[0]=Math.min(t,l[0]),n=!0;else continue}}return n?e[e.length-1][1]=r:e.push([t,r]),e}function A_(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let n=e.ranges.find(a=>a.start<=t&&a.end>=t);return n?n.index:null}}function yl(e){switch(e.format){case 1:return e.glyphs.map((r,n)=>({glyphId:r,index:n}));case 2:let t=[];for(let[r,n]of e.ranges.entries())n.end===n.start?t.push({glyphId:n.start,index:r}):t.push({glyphId:[n.start,n.end+1],index:r});return t}}function T_(e,t){let r=t[0],n=lm(e,r),a=t[0]+1,l=new Map;for(;a<t[1];)lm(e,a)!==n&&(a-r<=1?l.set(r,n):l.set([r,a],n)),a++;return a-r<=1?l.set(r,n):l.set([r,a],n),l}function lm(e,t){let r=A_(e.coverage,t);if(r===null)return null;switch(e.substFormat){case 1:return(t+e.deltaGlyphId)%2**16;case 2:return e.substitute[r]??null}}function Km(e,t,r,n,a){let l=[];for(let c of r){c.entry.forward={individual:{},range:[]};for(let h of e)l.push(...Jh(c.entry.forward,n,a,t,h).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...c.substitutions,g]})))}return l}function Kh(e,t){let r=[],n=new Set;for(let a of t){if(n.has(a.entry))continue;n.add(a.entry),a.entry.forward??={individual:{},range:[]};let l={};for(let c of e)Array.isArray(c)?a.entry.forward.range.push({entry:l,range:c}):a.entry.forward.individual[c]=l;r.push({entry:l,substitutions:a.substitutions})}return r}function Xh(e,t){let r=[],n=new Set;for(let a of t){if(n.has(a.entry))continue;n.add(a.entry),a.entry.reverse??={individual:{},range:[]};let l={};for(let c of e)Array.isArray(c)?a.entry.reverse.range.push({entry:l,range:c}):a.entry.reverse.individual[c]=l;r.push({entry:l,substitutions:a.substitutions})}return r}function Jh(e,t,r,n,a){let l=[];if(!Array.isArray(a))e.individual[a]={},l.push({entry:e.individual[a],substitution:S_(t,r,n,a)});else{let c=C_(t,r,n,a);for(let[h,p]of c){let g={};Array.isArray(h)?e.range.push({range:h,entry:g}):e.individual[h]={},l.push({entry:g,substitution:p})}}return l}function C_(e,t,r,n){for(let a of e.filter(l=>l.sequenceIndex===r))for(let l of t[a.lookupListIndex].subtables){let c=T_(l,n);if(!Array.from(c.values()).every(h=>h!==null))return c}return new Map([[n,null]])}function S_(e,t,r,n){for(let a of e.filter(l=>l.sequenceIndex===r))for(let l of t[a.lookupListIndex].subtables){let c=lm(l,n);if(c!==null)return c}return null}function __(e,t,r){let n={individual:{},range:[]},a=yl(e.coverage);for(let{glyphId:l,index:c}of a){let h=e.chainRuleSets[c];if(h)for(let[p,g]of h.entries()){let x=Jh(n,g.lookupRecords,t,0,l).map(({entry:y,substitution:A})=>({entry:y,substitutions:[A]}));for(let[y,A]of g.input.entries())x=Km([A],y+1,x,g.lookupRecords,t);for(let y of g.lookahead)x=Kh([y],x);for(let y of g.backtrack)x=Xh([y],x);for(let{entry:y,substitutions:A}of x)y.lookup={substitutions:A,length:g.input.length+1,index:r,subIndex:p,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return n}function L_(e,t){return e.format===2?Array.isArray(t)?k_(e,t):new Map([[t,cm(e,t)]]):new Map([[t,null]])}function k_(e,t){let r=t[0],n=cm(e,r),a=t[0]+1,l=new Map;for(;a<t[1];)cm(e,a)!==n&&(a-r<=1?l.set(r,n):l.set([r,a],n)),a++;return a-r<=1?l.set(r,n):l.set([r,a],n),l}function cm(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function np(e,t){switch(e.format){case 2:let r=[];for(let n of e.ranges)n.classId===t&&(n.end===n.start?r.push(n.start):r.push([n.start,n.end+1]));return r;default:return[]}}function I_(e,t,r){let n=[],a=yl(e.coverage);for(let{glyphId:l}of a){let c=L_(e.inputClassDef,l);for(let[h,p]of c.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,y]of g.entries()){let A={individual:{},range:[]},w=Jh(A,y.lookupRecords,t,0,h).map(({entry:k,substitution:E})=>({entry:k,substitutions:[E]}));for(let[k,E]of y.input.entries())w=Km(np(e.inputClassDef,E),k+1,w,y.lookupRecords,t);for(let k of y.lookahead)w=Kh(np(e.lookaheadClassDef,k),w);for(let k of y.backtrack)w=Xh(np(e.backtrackClassDef,k),w);for(let{entry:k,substitutions:E}of w)k.lookup={substitutions:E,index:r,subIndex:x,length:y.input.length+1,contextRange:[-1*y.backtrack.length,1+y.input.length+y.lookahead.length]};n.push(A)}}}return g3(n)}function E_(e,t,r){let n={individual:{},range:[]},a=yl(e.inputCoverage[0]);for(let{glyphId:l}of a){let c=Jh(n,e.lookupRecords,t,0,l).map(({entry:h,substitution:p})=>({entry:h,substitutions:[p]}));for(let[h,p]of e.inputCoverage.slice(1).entries())c=Km(yl(p).map(g=>g.glyphId),h+1,c,e.lookupRecords,t);for(let h of e.lookaheadCoverage)c=Kh(yl(h).map(p=>p.glyphId),c);for(let h of e.backtrackCoverage)c=Xh(yl(h).map(p=>p.glyphId),c);for(let{entry:h,substitutions:p}of c)h.lookup={substitutions:p,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return n}function N_(e,t){let r={individual:{},range:[]},n=yl(e.coverage);for(let{glyphId:a,index:l}of n){let c={};Array.isArray(a)?r.range.push({entry:c,range:a}):r.individual[a]=c;let h=[{entry:c,substitutions:[e.substitutes[l]]}];for(let p of e.lookaheadCoverage)h=Kh(yl(p).map(g=>g.glyphId),h);for(let p of e.backtrackCoverage)h=Xh(yl(p).map(g=>g.glyphId),h);for(let{entry:p,substitutions:g}of h)p.lookup={substitutions:g,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function um(e,t=new Map){let r={};for(let[n,a]of Object.entries(e.individual))r[n]=u2(a,t);for(let{range:n,entry:a}of e.range){let l=u2(a,t);for(let c=n[0];c<n[1];c++)r[c]=l}return r}function u2(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=um(e.forward,t)),e.reverse&&(r.reverse=um(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var R_=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new y_({maxSize:t.cacheSize,sizeCalculation:((l,c)=>c.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(l=>l.tag==="calt")||[]).reduce((l,c)=>[...l,...c.feature.lookupListIndexes],[]),n=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],a=n.filter((l,c)=>r.some(h=>h===c));for(let[l,c]of a.entries()){let h=[];switch(c.lookupType){case 6:for(let[g,x]of c.subtables.entries())switch(x.substFormat){case 1:h.push(__(x,n,g));break;case 2:h.push(I_(x,n,g));break;case 3:h.push(E_(x,n,g));break}break;case 8:for(let[g,x]of c.subtables.entries())h.push(N_(x,g));break}let p=um(g3(h));this._lookupTrees.push({tree:p,processForward:c.lookupType!==8});for(let g of Object.keys(p))this._glyphLookups[g]||(this._glyphLookups[g]=[]),this._glyphLookups[g].push(l)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let l of e)r.push(this._font.charToGlyphIndex(l));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let n=this._findInternal(r.slice()),a={inputGlyphs:r,outputGlyphs:n.sequence,contextRanges:n.ranges};return this._cache&&this._cache.set(e,a),a}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let r=[];for(let a of e)r.push(this._font.charToGlyphIndex(a));let n=this._findInternal(r);return this._cache&&this._cache.set(e,n.ranges),n.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let n=this._lookupTrees[r.index];if(n.processForward){let a=r.last;for(let l=r.first;l<a;l++){let c=om(n.tree,e,l,l);if(c){for(let h=0;h<c.substitutions.length;h++){let p=c.substitutions[h];p!==null&&(e[l+h]=p)}c2(t,c.contextRange[0]+l,c.contextRange[1]+l),l+c.length>=a&&(a=l+c.length+1),l+=c.length-1}}}else for(let a=r.last-1;a>=r.first;a--){let l=om(n.tree,e,a,a);if(l){for(let c=0;c<l.substitutions.length;c++){let h=l.substitutions[c];h!==null&&(e[a+c]=h)}c2(t,l.contextRange[0]+a,l.contextRange[1]+a),a-=l.length-1}}r=this._getNextLookup(e,r.index+1)}return{sequence:e,ranges:t}}_getNextLookup(e,t){let r={index:null,first:1/0,last:-1};for(let n=0;n<e.length;n++){let a=this._glyphLookups[e[n]];if(a)for(let l=0;l<a.length;l++){let c=a[l];if(c>=t){(r.index===null||c<=r.index)&&(r.index=c,r.first>n&&(r.first=n),r.last=n+1);break}}}return r}};function M_(e,t){let r=p_.parse(e);return new R_(r,{cacheSize:0,...t})}function D_(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],n="";for(;t.offset<t.input.length;){let a=t.input[t.offset++];switch(a){case"'":case'"':n+=j_(t,a);break;case",":r.push(n),n="";break;default:/\s/.test(a)||(t.offset--,n+=B_(t),r.push(n),n="")}}return r}function j_(e,t){let r="",n=!1;for(;e.offset<e.input.length;){let a=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(a)?(e.offset--,r+=x3(e)):a!==`
63
+ `&&(r+=a),n=!1;else switch(a){case t:return r;case"\\":n=!0;break;default:r+=a}}throw new Error("Unterminated string")}function B_(e){let t="",r=!1;for(;e.offset<e.input.length;){let n=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(n)?(e.offset--,t+=x3(e)):t+=n,r=!1;else switch(n){case"\\":r=!0;break;case",":return t;default:/\s/.test(n)?t.endsWith(" ")||(t+=" "):t+=n}}return t}function x3(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return sp(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,sp(t);t+=r}return sp(t)}function sp(e){return String.fromCodePoint(parseInt(e,16))}var q0;async function Q_(e,t){if(!q0){if(typeof navigator<"u"&&"fonts"in navigator){try{let a=await navigator.permissions.request?.({name:"local-fonts"});if(a&&a.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(a){if(a instanceof Error&&a.name!=="TypeError")throw a}let n={};try{let a=await navigator.fonts.query();for(let l of a)n.hasOwnProperty(l.family)||(n[l.family]=[]),n[l.family].push(l);q0=Promise.resolve(n)}catch(a){a instanceof Error&&console.error(a.name,a.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let n={};try{let a=await window.queryLocalFonts();for(let l of a)n.hasOwnProperty(l.family)||(n[l.family]=[]),n[l.family].push(l);q0=Promise.resolve(n)}catch(a){a instanceof Error&&console.error(a.name,a.message)}}q0??=Promise.resolve({})}let r=await q0;for(let n of D_(e)){if(P_.includes(n))return;if(r.hasOwnProperty(n)&&r[n].length>0){let a=r[n][0];if("blob"in a){let l=await(await a.blob()).arrayBuffer();return M_(l,{cacheSize:t})}return}}}var P_=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],O_=1e5;function F_(e,t=[]){let r,n,a=0,l;return e.registerCharacterJoiner(c=>{let h=e.options.fontFamily;if(h&&(a===0||r!==h)){n=void 0,a=1,r=h;let p=r;Q_(p,O_).then(g=>{p===e.options.fontFamily&&(a=2,n=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{p===e.options.fontFamily&&(a=3,e.options.logLevel==="debug"&&console.debug(l,new Error("Failure while loading font")),n=void 0,l=g)})}return n&&a===2?n.findLigatureRanges(c).map(p=>[p[0],p[1]]):$_(c,t)})}function $_(e,t){let r=[];for(let n=0;n<e.length;n++)for(let a=0;a<t.length;a++)if(e.startsWith(t[a],n)){r.push([n,n+t[a].length]),n+=t[a].length-1;break}return r}var U_=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures??["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]).sort((t,r)=>r.length-t.length),this._fontFeatureSettings=e?.fontFeatureSettings}activate(e){if(!e.element)throw new Error("Cannot activate LigaturesAddon before open is called");this._terminal=e,this._characterJoinerId=F_(e,this._fallbackLigatures),e.element.style.fontFeatureSettings=this._fontFeatureSettings??'"calt" on'}dispose(){this._characterJoinerId!==void 0&&(this._terminal?.deregisterCharacterJoiner(this._characterJoinerId),this._characterJoinerId=void 0),this._terminal?.element&&(this._terminal.element.style.fontFeatureSettings="")}};function d2(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var z_=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=d2(r[1]),a=d2(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(a<0)return!0;this.progress={state:n,value:a};break;case 2:case 4:if(a<0)return!0;this.progress={state:n,value:a||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function b3(e,t){const r=Math.max(e.left,t.left),n=Math.max(e.top,t.top),a=Math.min(e.right,t.right),l=Math.min(e.bottom,t.bottom);return a>r&&l>n?{left:r,top:n,right:a,bottom:l}:null}function h2(e,t){const r=b3(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function gc(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const n=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!n.width||!n.height)return null;const a=e.dimensions?.css?.cell?.height,l=n.width/e.cols,c=a&&a>0?a:n.height/e.rows;return{originLeft:n.left,originTop:n.top,cellW:l,cellH:c}}function dh(e,t){const r=gc(e);if(!r)return null;const n=t.row-e.buffer.active.viewportY;if(n<0||n>=e.rows)return null;const a=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(a+.5)*r.cellW,y:r.originTop+n*r.cellH}}function H_(e,t){const r=Math.max(0,e.buffer.active.baseY+e.rows-1);return{col:Math.max(0,Math.min(e.cols-1,t.col)),row:Math.max(0,Math.min(r,t.row))}}function Eh(e,t,r){const n=e.row*r+e.col,a=t.row*r+t.col;return n<=a?{start:e,end:t}:{start:t,end:e}}function W_(e,t,r){const n=gc(e);if(!n)return null;const{start:a,end:l}=Eh(t,r,e.cols),c=e.buffer.active.viewportY,h=c+e.rows-1;if(l.row<c||a.row>h)return null;const p=Math.max(a.row,c),g=Math.min(l.row,h),x=n.originTop+(p-c)*n.cellH,y=n.originTop+(g-c+1)*n.cellH;return a.row===l.row?{left:n.originLeft+a.col*n.cellW,top:x,right:n.originLeft+(l.col+1)*n.cellW,bottom:y}:{left:n.originLeft,top:x,right:n.originLeft+e.cols*n.cellW,bottom:y}}function G_(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),n=Math.min(e.viewport.right,e.terminal.right),a=Math.min(e.viewport.bottom,e.terminal.bottom),l=t+e.margin,c=r+e.margin,h=Math.max(l,n-e.width-e.margin),p=Math.max(c,a-e.height-e.margin),g=ee=>Math.max(l,Math.min(ee,h)),x=ee=>Math.max(c,Math.min(ee,p)),y=e.selection?b3(e.selection,{left:t,top:r,right:n,bottom:a}):null;if(!y){const ee=g(e.clientX-e.width/2),ze=e.clientY-e.height-e.fingerGap,he=e.clientY+e.fingerGap,de=x(ze>=c?ze:he);return{left:Math.round(ee),top:Math.round(de)}}const A=(y.left+y.right)/2,w=(y.top+y.bottom)/2,k=e.preference?.alignX??A,E=e.selectionGap??e.fingerGap,I=y.top-e.height-E,M=y.bottom+E,B=e.preference?.vertical==="below"?M:I,F=e.preference?.vertical==="below"?I:M,U=[{left:l,top:c},{left:h,top:c},{left:l,top:p},{left:h,top:p}];e.preference&&U.sort((ee,ze)=>{const he=de=>{const $e=de.left+e.width/2,qe=de.top+e.height/2;return Math.hypot($e-e.preference.focusX,qe-e.preference.focusY)};return he(ze)-he(ee)});const G=[{left:k-e.width/2,top:B},{left:A-e.width/2,top:B},{left:k-e.width/2,top:F},{left:A-e.width/2,top:F},{left:y.left-e.width-e.fingerGap,top:w-e.height/2},{left:y.right+e.fingerGap,top:w-e.height/2},...U].map(ee=>({left:g(ee.left),top:x(ee.top)}));let Q=G[0],X=Number.POSITIVE_INFINITY;return G.forEach((ee,ze)=>{const he={left:ee.left,top:ee.top,right:ee.left+e.width,bottom:ee.top+e.height},de=(e.avoid??[]).reduce((qe,oe)=>qe+h2(he,oe),0),$e=(de>0?1e6:0)+de*100+h2(he,y)*10+ze*.01;$e<X&&(Q=ee,X=$e)}),{left:Math.round(Q.left),top:Math.round(Q.top)}}function V_(e){const t=e.willChange.split(",").map(n=>n.trim()),r=(n,a)=>!!(n&&n!==a);return r(e.transform,"none")||r(e.perspective,"none")||r(e.filter,"none")||r(e.backdropFilter,"none")||r(e.containerType,"normal")||e.contain.includes("layout")||e.contain.includes("paint")||e.contain.includes("strict")||e.contain.includes("content")||t.includes("transform")||t.includes("perspective")||t.includes("filter")}function q_(e){let t=e.parentElement;for(;t;){if(V_(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function Y_(e,t,r,n){const a=e.getBoundingClientRect();let l=0,c=0;if(t){const h=t.getBoundingClientRect();l=h.left+t.clientLeft,c=h.top+t.clientTop}return{x:a.left-l+r,y:a.top-c+n}}function Z_(e,t){const r=e.replace(/\r?\n/g,"\r");return`\x1B[200~${(t&&r.endsWith("\r")?r.slice(0,-1):r).replace(/\x1b/g,"␛")}\x1B[201~${t?"\r":""}`}function K_(e,t,r){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let a=0;const l=e.length-n,c=t.length-n;for(;a<l&&a<c&&e[e.length-1-a]===t[t.length-1-a];)a+=1;const h=t.slice(n,t.length-a);return h&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(h))?h:null}const f2=2,X_=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function J_(e){const t=e.reason.replace(/^refresh:/,""),r=X_.has(t),n=Math.abs(e.proposedCols-e.currentCols),a=Math.abs(e.proposedRows-e.currentRows);return{accept:r?n>0||a>0:n>=f2||a>=f2,isRealResize:r,colsDelta:n,rowsDelta:a}}function eL(e){return e.before.cols!==e.after.cols||e.before.rows!==e.after.rows||e.lastServerSize===null||e.reconcileServerSize===!0&&(e.lastServerSize.cols!==e.after.cols||e.lastServerSize.rows!==e.after.rows)}function tL(e,t){return!e||t}function rL(e,t,r){return e!=="alternate"&&r>=t}function nL(e,t){return e?"none":t?"single":"settled"}function sL(e,t,r){return!r&&(e||t)}function iL(e){let t,r,n=!1,a=0;const l=e.parser.registerCsiHandler({prefix:"?",final:"l"},h=>(t&&h.some(p=>p===2026)&&(n=!0),!1)),c=h=>{const p=t;if(!p)return;const g=r;if(t=void 0,r=void 0,n=!1,p(),h){const x=e._core?._renderService?._renderer?.value;g&&x?.handleResize(...g),x?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(a++,n=!1,t)return;const h=e._core?._renderService?._renderer?.value;if(!h||typeof h.handleResize!="function"||typeof h.renderRows!="function"||typeof h.clear!="function")return;const p=h.handleResize,g=h.renderRows,x=h.clear;h.handleResize=(y,A)=>{r=[y,A]},h.renderRows=()=>{},h.clear=()=>{},t=()=>{h.handleResize=p,h.renderRows=g,h.clear=x}},get generation(){return a},written(h){h===a&&n&&!e.modes.synchronizedOutputMode&&c(!0)},cancel(){c(!0)},dispose(){c(!1),l.dispose()}}}function ip(){return{confirmed:null,pending:null,nextSeq:1}}function p2(e,t){return e?.cols===t.cols&&e.rows===t.rows}function Xm(e,t,r){const n={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:n,nextSeq:e.nextSeq+1},request:n}}function aL(e,t){return p2(e.pending,t)||!e.pending&&p2(e.confirmed,t)?{state:e,request:null}:Xm(e,t,0)}function oL(e,t){return Xm(e,t,0)}function lL(e,t){const r=e.pending;if(!r||t.seq!==r.seq)return{state:e,accepted:!1};const n=t.ok&&Number.isFinite(t.cols)&&Number.isFinite(t.rows)&&(t.cols??0)>0&&(t.rows??0)>0?{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}:null;return{state:{...e,confirmed:n,pending:null},accepted:!0}}function m2(e,t,r=1){const n=e.pending;return!n||n.seq!==t?{state:e,request:null,exhausted:!1}:n.attempt>=r?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...Xm(e,n,n.attempt+1),exhausted:!1}}function cL(e,t){return!Number.isFinite(t.cols)||!Number.isFinite(t.rows)||t.cols<=0||t.rows<=0?e:{...e,confirmed:{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}}}function uL(e){return{...e,pending:null}}const dL=150;function g2(e=0){return{lastPushAt:e}}function hL(e,t,r=dL){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function fL(e){return{lastPushAt:e}}const dm="termdock-settings",pL=6,mL=100,gL='"calt" on',xL=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function bL(){if(typeof window>"u")return 13;const e=window.matchMedia("(max-width: 767px)").matches,t=window.matchMedia("(pointer: coarse)").matches;return e||t?10:13}function Jm(){return{fontFamily:"var(--font-mono)",fontSize:bL(),rendererMode:"auto",fontWeight:"normal",fontWeightBold:"bold",letterSpacing:1,lineHeight:1.05,minimumContrastRatio:4.5,drawBoldTextInBrightColors:!0,unicodeVersion:"11",customGlyphs:!0,rescaleOverlappingGlyphs:!1,fontLigatures:!0,enableImages:!0,smoothScrolling:!0}}function Nd(e,t,r,n){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):n}function x2(e,t){return e==="normal"||e==="bold"?e:typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(1e3,Math.round(e))):t}function t0(e){const t=Jm(),r=e&&typeof e=="object"?e:{},n=r.rendererMode??r.renderer;return{fontFamily:typeof r.fontFamily=="string"&&r.fontFamily.trim()?r.fontFamily.trim():t.fontFamily,fontSize:Nd(r.fontSize,pL,mL,t.fontSize),rendererMode:n==="auto"||n==="webgl"||n==="canvas"?n:t.rendererMode,fontWeight:x2(r.fontWeight,t.fontWeight),fontWeightBold:x2(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Nd(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Nd(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Nd(r.minimumContrastRatio,1,21,t.minimumContrastRatio),drawBoldTextInBrightColors:t.drawBoldTextInBrightColors,unicodeVersion:t.unicodeVersion,customGlyphs:t.customGlyphs,rescaleOverlappingGlyphs:t.rescaleOverlappingGlyphs,fontLigatures:t.fontLigatures,enableImages:t.enableImages,smoothScrolling:t.smoothScrolling}}function Rd(e){return e.pointerType==="touch"||e.pointerType==="pen"}class yL{handlers=new Map;active=new Map;pointerStates=new Map;sorted=[];sortedDirty=!1;listenersRegistered=!1;changeListeners=new Set;constructor(){this.ensureListeners()}register(t){return this.handlers.has(t.name)&&this.log("replace",t.name),this.handlers.set(t.name,t),this.sortedDirty=!0,this.log("register",t.name,`prio=${t.priority}`),()=>{this.unregister(t.name)}}unregister(t){this.handlers.delete(t),this.sortedDirty=!0;for(const[r,n]of this.active)n===t&&(this.active.delete(r),this.pointerStates.delete(r));this.log("unregister",t)}getHandlers(){return this.sortedHandlers().map(t=>({name:t.name,priority:t.priority,hasContainer:t.container!=null}))}getClaimedHandler(t){return this.active.get(t)??null}isClaimedBy(t,r){return this.active.get(t)===r}isAnyPointerClaimed(){return this.active.size>0}onChange(t){return this.changeListeners.add(t),()=>{this.changeListeners.delete(t)}}emitChange(t,r,n){this.changeListeners.size!==0&&this.changeListeners.forEach(a=>{try{a({type:t,pointerId:r,handler:n})}catch{}})}log(t,r,n=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const a=performance.now().toFixed(0);console.debug(`[GestureManager ${a}] ${t} ${r} ${n}`)}}sortedHandlers(){return this.sortedDirty&&(this.sorted=[...this.handlers.values()].sort((t,r)=>r.priority-t.priority),this.sortedDirty=!1),this.sorted}ensureListeners(){this.listenersRegistered||(this.listenersRegistered=!0,document.addEventListener("pointerdown",this.handlePointerDown,{capture:!0,passive:!1}),document.addEventListener("pointermove",this.handlePointerMove,{capture:!0,passive:!1}),document.addEventListener("pointerup",this.handlePointerUp,{capture:!0,passive:!1}),document.addEventListener("pointercancel",this.handlePointerCancel,{capture:!0,passive:!1}))}handlePointerDown=t=>{if(!Rd(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let n=!1;for(const a of this.sortedHandlers()){if(!this.handlerMatchesContainer(a,t)){this.log("skip-container",a.name);continue}a.onPointerDown(t,r)&&!n&&(this.active.set(t.pointerId,a.name),n=!0,this.log("claim",a.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,a.name))}n&&t.preventDefault()};handlePointerMove=t=>{if(!Rd(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const n of this.sortedHandlers()){if(!this.handlerMatchesContainer(n,t))continue;const a=this.active.get(t.pointerId)===n.name,l=n.onPointerMove(t,a);if(l==="claim"&&!r){const c=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,n.name),r=!0,t.preventDefault(),c&&c!==n.name&&this.log("handoff",`${c}->${n.name}`,`pid=${t.pointerId}`),this.log("claim",n.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,n.name)}if(l==="release"&&a&&!r){const c=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",n.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,c??null)}}};handlePointerUp=t=>{if(!Rd(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerUp(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlePointerCancel=t=>{if(!Rd(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerCancel(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlerMatchesContainer(t,r){return t.container?t.container.contains(r.target):!0}}const y3=new yL,vL=90,wL=80,AL=70,TL=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:n=.8,boostDenominator:a=50,velocityAlpha:l=.15,maxVelocity:c=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:y,onScroll:A,onScrollWithCoords:w,onTap:k,onClickWithCoords:E,onClaimChange:I,tapThreshold:M=10,gestureName:B="normal-scroll"}=t,F=1.06,U=C.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),G=C.useRef(0),Q=C.useRef(0),X=C.useRef(0),ee=C.useRef(null),ze=C.useRef(0),he=C.useRef(!1),de=C.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),$e=C.useCallback(()=>{ee.current=null,G.current!==0&&(w&&Q.current>0&&X.current>0?w(G.current,Q.current,X.current):A&&A(G.current),G.current=0,Q.current=0,X.current=0)},[A,w]),qe=C.useCallback(()=>{ee.current===null&&typeof window<"u"&&(ee.current=window.requestAnimationFrame($e))},[$e]),oe=C.useCallback((Se,se,Ye)=>{G.current+=Se,se!==void 0&&Ye!==void 0&&(Q.current=se,X.current=Ye),qe()},[qe]),Re=C.useCallback(Se=>{if(!Se||!A)return!1;const se=A(Se);return se?ze.current=0:ze.current++,se},[A]),K=C.useCallback(Se=>{he.current!==Se&&(he.current=Se,I?.(Se))},[I]),we=C.useCallback(()=>{const Se=U.current;Se.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(Se.rafId),Se.rafId=null,ee.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(ee.current),ee.current=null,G.current=0},[]),Z=C.useRef(k);Z.current=k;const Ue=C.useRef(E);Ue.current=E;const Le=C.useRef(x);Le.current=x;const Y=C.useCallback(()=>{const Se=e.current;if(!Se||!("PointerEvent"in window))return()=>{};const se=U.current,Ye={name:B,priority:AL,get container(){return e.current??void 0},onPointerDown:(ye,et)=>(ye.pointerType!=="touch"||(se.pointerId=ye.pointerId,se.startX=et.startX,se.startY=et.startY,se.didMove=!1,se.gestureAxis=null,se.lastY=ye.clientY,se.lastTime=de(),se.velocity=0,we()),!1),onPointerMove:(ye,et)=>{if(ye.pointerType!=="touch"||se.pointerId!==ye.pointerId||!se.lastY||!se.lastTime)return"neutral";const ht=ye.clientX,te=ye.clientY,ve=de(),ct=ve-se.lastTime,re=te-se.lastY;if(se.startX!==null&&se.startY!==null){const je=ht-se.startX,mt=te-se.startY;if(!se.didMove&&Math.hypot(je,mt)>=M&&(se.didMove=!0),se.gestureAxis===null&&se.didMove){const ae=Math.abs(je),De=Math.abs(mt);ae>De*F?se.gestureAxis="x":De>ae*F&&(se.gestureAxis="y")}if(se.gestureAxis==="x")return se.isCurrentlyScrolling=!1,K(!1),se.lastY=te,se.lastTime=ve,et?"release":"neutral";if(se.gestureAxis===null)return se.lastY=te,se.lastTime=ve,"neutral"}if(se.gestureAxis==="y"&&!et&&!(y?.()??!0))return se.lastY=te,se.lastTime=ve,K(!1),"neutral";const me=re/Math.max(ct,1);if(se.velocity=se.velocity*(1-l)+me*l,se.velocity=Math.max(-c,Math.min(c,se.velocity)),Math.abs(re)>1){if(!et)return K(!0),se.lastY=te,se.lastTime=ve,"claim";se.isCurrentlyScrolling=!0;const je=r+Math.min(n,Math.abs(re)/a),mt=-re*je;oe(mt,ht,te),K(!0)}return se.lastY=te,se.lastTime=ve,et?"claim":"neutral"},onPointerUp:ye=>{if(ye.pointerType!=="touch"||se.pointerId!==ye.pointerId)return;const et=se.isCurrentlyScrolling;se.isCurrentlyScrolling=!1,K(!1);const ht=se.rafId!==null||ee.current!==null;!se.didMove&&!ht&&se.startX!==null&&se.startY!==null&&Z.current?.(se.startX,se.startY),!se.didMove&&!ht&&se.startX!==null&&se.startY!==null&&Ue.current?.(se.startX,se.startY),se.pointerId=null,se.startX=null,se.startY=null;const te=se.gestureAxis==="x";if(se.gestureAxis=null,g&&et&&!te&&Math.abs(se.velocity)>h&&se.didMove){const ve=()=>{const ct=de(),re=ct-(se.lastTime||ct);if(se.lastTime=ct,se.velocity*=Math.pow(p,re),Math.abs(se.velocity)<h){se.velocity=0,we();return}if(!Re(-se.velocity*re)&&ze.current>2){se.velocity=0,we();return}se.rafId=requestAnimationFrame(ve)};se.rafId=requestAnimationFrame(ve)}},onPointerCancel:ye=>{ye.pointerType!=="touch"||se.pointerId!==ye.pointerId||(se.isCurrentlyScrolling=!1,K(!1),se.pointerId=null,se.startX=null,se.startY=null,se.gestureAxis=null,we())}},pt=y3.register(Ye),rt=Se.style.touchAction;return Se.style.touchAction="none",()=>{K(!1),pt(),Se.style.touchAction=rt,we()}},[e,B,r,n,a,l,c,h,p,de,we,Re,oe,M,g,K,y]),Ee=C.useCallback(()=>{const Se=e.current;if(!Se)return()=>{};const se=U.current,Ye=et=>{et.touches.length===1&&((x?.()??!0)&&et.cancelable&&et.preventDefault(),se.isCurrentlyScrolling=!1,se.gestureAxis=null,se.lastY=et.touches[0].clientY,se.startX=et.touches[0].clientX,se.startY=et.touches[0].clientY,se.didMove=!1,se.velocity=0,we())},pt=et=>{if(et.touches.length!==1)return;const ht=et.touches[0].clientX,te=et.touches[0].clientY;if(se.startX!==null&&se.startY!==null){const ct=ht-se.startX,re=te-se.startY;if(!se.didMove&&Math.hypot(ct,re)>=M&&(se.didMove=!0),se.gestureAxis===null&&se.didMove){const me=Math.abs(ct),je=Math.abs(re);me>je*F?se.gestureAxis="x":je>me*F&&(se.gestureAxis="y")}if(se.gestureAxis==="x"){se.isCurrentlyScrolling=!1,se.lastY=te;return}if(se.gestureAxis===null){(x?.()??!1)&&et.cancelable&&et.preventDefault(),se.lastY=te;return}}if(et.preventDefault(),!se.lastY){se.lastY=te;return}const ve=te-se.lastY;if(Math.abs(ve)>1){se.isCurrentlyScrolling=!0;const ct=r+Math.min(n,Math.abs(ve)/a),re=-ve*ct;oe(re,ht,te)}se.lastY=te},rt=et=>{if(!et.changedTouches?.[0])return;const te=se.isCurrentlyScrolling;se.isCurrentlyScrolling=!1;const ve=se.rafId!==null||ee.current!==null;!se.didMove&&!ve&&k&&se.startX!==null&&se.startY!==null&&k(se.startX,se.startY),!se.didMove&&!ve&&E&&se.startX!==null&&se.startY!==null&&E(se.startX,se.startY),se.startX=null,se.startY=null;const ct=se.gestureAxis==="x";if(se.gestureAxis=null,g&&te&&!ct&&se.didMove&&Math.abs(se.velocity)>h){const re=()=>{if(se.velocity*=Math.pow(p,16),Math.abs(se.velocity)<h){se.velocity=0,we();return}if(!Re(-se.velocity*16)&&ze.current>2){se.velocity=0,we();return}se.rafId=requestAnimationFrame(re)};se.rafId=requestAnimationFrame(re)}};Se.addEventListener("touchstart",Ye,{passive:!1}),Se.addEventListener("touchmove",pt,{passive:!1}),Se.addEventListener("touchend",rt,{passive:!1}),Se.addEventListener("touchcancel",rt,{passive:!1});const ye=Se.style.touchAction;return Se.style.touchAction="none",()=>{Se.removeEventListener("touchstart",Ye),Se.removeEventListener("touchmove",pt),Se.removeEventListener("touchend",rt),Se.removeEventListener("touchcancel",rt),Se.style.touchAction=ye,we()}},[e,r,n,a,h,p,we,Re,oe,k,E,M,x,g]),be=C.useCallback(()=>{we();const Se=typeof window<"u"&&"PointerEvent"in window,se=Se?Y():()=>{},Ye=Se?()=>{}:Ee();return()=>{se(),Ye(),we()}},[Y,Ee,we]),Me=C.useCallback(()=>U.current.isCurrentlyScrolling||U.current.rafId!==null||ee.current!==null,[]),Ze=C.useCallback(()=>{we();const Se=U.current;Se.isCurrentlyScrolling=!1,Se.velocity=0,Se.lastY=null,Se.lastTime=null,Se.startX=null,Se.startY=null,Se.pointerId=null,Se.didMove=!1,Se.gestureAxis=null},[we]);return{setupTouchScroll:be,isScrolling:Me,stopAllScroll:Ze}};function b2(e){const{name:t,priority:r}=e,n=b.useRef(e.onPointerDown),a=b.useRef(e.onPointerMove),l=b.useRef(e.onPointerUp),c=b.useRef(e.onPointerCancel),h=b.useRef(e.container);n.current=e.onPointerDown,a.current=e.onPointerMove,l.current=e.onPointerUp,c.current=e.onPointerCancel,h.current=e.container,b.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,y){return n.current?.(x,y)??!1},onPointerMove(x,y){return a.current?.(x,y)??"neutral"},onPointerUp(x){l.current?.(x)},onPointerCancel(x){c.current?.(x)}};return y3.register(p)},[t,r])}var Ds;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Ds||(Ds={}));Ds.Light,Ds.Medium,Ds.Heavy,Ds.Success,Ds.Warning,Ds.Error;Ds.Light,Ds.Medium,Ds.Heavy,Ds.Success,Ds.Warning,Ds.Error;Ds.Light,Ds.Medium,Ds.Heavy,Ds.Success,Ds.Warning,Ds.Error;const CL=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",SL=()=>typeof document<"u"&&!!document.body,_L=()=>{if(SL())try{const e=document.createElement("label");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),e.appendChild(t),document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}},y2=e=>Array.isArray(e)?[...e]:[e],LL=e=>{if(CL()){try{const a=y2(e),l=a.length===1?a[0]:a;navigator.vibrate(l)}catch{}return}const t=y2(e),r=Array.from({length:Math.ceil(t.length/2)},(a,l)=>[t[l*2]??0,t[l*2+1]??0]);let n=0;for(const[a,l]of r)a>0&&setTimeout(_L,n),n+=a+l},ao=e=>LL(e);function v3({message:e}){const{t}=Qr();return i.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-4",children:i.jsx(Eu,{dots:!0,label:e??t("terminal.loading"),className:"max-w-full rounded-full bg-surface-2 px-4 py-2 text-center shadow-sm"})})}function kL(){const{t:e}=Qr();return i.jsx(v3,{message:e("terminal.initializing")})}const IL=({message:e,onRetry:t})=>{const{t:r}=Qr();return i.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[i.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:i.jsxs("svg",{className:"w-6 h-6 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img","aria-label":r("terminal.error"),children:[i.jsx("title",{children:r("terminal.error")}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})]})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&i.jsx("button",{type:"button",onClick:t,className:"mt-2 px-5 py-2.5 bg-primary text-primary-foreground text-sm font-medium rounded-full hover:bg-primary/90 active:scale-[0.97] transition-all shadow-sm",children:r("common.retry")})]})})};function hh(e){return Array.from(e)}function v2(e,t,r){return Math.max(t,Math.min(r,e))}function EL(e,t,r,n){const a=hh(e),l=hh(t);let c=v2(r,0,a.length);const h=v2(n,0,l.length);let p=0;for(;p<a.length&&p<l.length&&a[p]===l[p];)p++;let g=0;for(;g<a.length-p&&g<l.length-p&&a[a.length-1-g]===l[l.length-1-g];)g++;const x=a.length-p-g,y=l.slice(p,l.length-g).join(""),A=[];if(x>0||y){const w=p+x;c>w?A.push({left:c-w}):c<w&&A.push({right:w-c}),c=w,x>0&&(A.push({backspace:x}),c=p),y&&(A.push({insert:y}),c+=hh(y).length)}return c>h?A.push({left:c-h}):c<h&&A.push({right:h-c}),c=h,{ops:A,cursor:c}}function w2(e){const t=e.value,r=e.selectionStart??t.length;return hh(t.slice(0,r)).length}const Nh=16,NL=10,A2=1.5,RL=1.8,T2=240,ML=125,DL=92;function jL(e,t,r){const n=Math.hypot(e,t),a=Math.abs(e),l=Math.abs(t),c=()=>a>=l*A2?e>0?"right":"left":l>=a*A2?t>0?"down":"up":"";if(r==="")return n>Nh?c():"";if(n<NL)return"";if(n<=Nh)return r;const h=c();if(h===""||h===r)return r;if(r==="left"&&h==="right"||r==="right"&&h==="left"||r==="up"&&h==="down"||r==="down"&&h==="up")return h;const g=r==="left"||r==="right";return(g?l:a)>=(g?a:l)*RL?h:r}function BL(e){const t=DL-Nh,r=Math.min(Math.max((e-Nh)/t,0),1);return T2-r*(T2-ML)}const QL="termdock-open-terminal-directory",hm=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,PL=new RegExp(`^( *)(${hm.source})`,"u"),OL=/[,;:!?]+$/u,FL=/^[a-z][a-z\d+.-]*:\/\//iu;function $L(e){return!e||e==="/"||FL.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function w3(e){const t=[];hm.lastIndex=0;let r;for(;(r=hm.exec(e))!==null;){const a=r[0].replace(OL,"");if(!$L(a))continue;const l=e.slice(r.index+a.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),c=l?Number(l[1]):void 0,h=c!==void 0&&Number.isSafeInteger(c)&&c>0;t.push({text:a,...h?{line:c}:{},startIndex:r.index,endIndex:r.index+a.length+(h?l[0].length:0)})}return t}function ap(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function UL(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function zL(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return ap(r);if(r==="~"||r.startsWith("~/")){const n=t?UL(t):null;return n?ap(`${n}/${r.slice(2)}`):null}return t?.startsWith("/")?ap(`${t}/${r}`):null}function Md(e,t){const r=e.buffer.active.getLine(t-1),n=e.buffer.active.getLine(t);if(!r||!n||n.isWrapped)return null;const a=r.translateToString(!0).trimEnd(),l=n.translateToString(!0),c=w3(a).at(-1),h=l.match(PL);if(!c||c.endIndex!==a.length||!c.text.endsWith("/")||!h||/^[~./]/u.test(h[2]))return null;const p=h[2];if(!p.includes("/")&&!/^[^/:]+\.[\p{L}\p{N}_-]+$/u.test(p))return null;let g=r.length-1;for(;g>=0&&!(r.getCell(g)?.getChars()||"").trim();)g-=1;const x=h[1].length;let y=0;for(let E=x;E<n.length;E+=1){const I=n.getCell(E);if(I?.getWidth()!==0){if(!I||/[\s/:]/u.test(I.getChars()||" "))break;y+=I.getWidth()}}if(r.length-g-1>=Math.max(8,x+2,y))return null;const w=r.getCell(g),k=n.getCell(x);return!w||!k||w.isFgDefault()||k.isFgDefault()||w.getFgColorMode()!==k.getFgColorMode()||w.getFgColor()!==k.getFgColor()?null:x}function HL(e,t){const r=e.buffer.active;let n=t-1;if(!r.getLine(n))return null;for(;n>0&&(r.getLine(n)?.isWrapped||Md(e,n)!==null);)n-=1;let a=t-1;for(;a+1<r.length&&(r.getLine(a+1)?.isWrapped||Md(e,a+1)!==null);)a+=1;let l="";const c=[],h=[];for(let g=n;g<=a&&l.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;const y=g>n?Md(e,g)??0:0;let A=x.length;if(g<a&&Md(e,g+1)!==null)for(;A>0&&!(x.getCell(A-1)?.getChars()||"").trim();)A-=1;for(let w=y;w<A;w+=1){const k=x.getCell(w);if(!k||k.getWidth()===0)continue;const E=k.getChars()||" ";l+=E;for(let I=0;I<E.length;I+=1)c.push({x:w+1,y:g+1}),h.push({x:w+Math.max(1,k.getWidth()),y:g+1})}}const p=l.trimEnd().length;return{text:l.slice(0,p),startPositions:c.slice(0,p),endPositions:h.slice(0,p)}}function WL(e,t){return{provideLinks(r,n){const a=HL(e,r);if(!a){n(void 0);return}const l=w3(a.text).map(c=>({text:c.text,range:{start:a.startPositions[c.startIndex]??{x:c.startIndex+1,y:r},end:a.endPositions[c.endIndex-1]??{x:c.endIndex,y:r}},activate:()=>c.line===void 0?t(c.text):t(c.text,c.line)}));n(l.length>0?l:void 0)}}}function C2(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const r=Math.floor(t),n=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let a=0;if(n!==null){const p=Math.max(0,n-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),a++)}let l=Math.max(0,Math.floor(e.ybase)+r),c=n===null?l:Math.min(l,n),h=Math.max(0,c-e.lines.length);if(h>r){const p=Math.max(0,e.lines.length-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),a++),l=Math.max(0,Math.floor(e.ybase)+r),c=n===null?l:Math.min(l,n),h=Math.max(0,c-e.lines.length)}for(let p=0;p<h;p++){const g=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=g)break;a++}return a}function S2(e,t=e.rows){const n=e._core?._bufferService?.buffers;return n?C2(n.normal,t)+C2(n.alt,t):0}function Dd(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function GL(e,t,r){const n=Dd(e.fontBoundingBoxAscent)+Dd(e.fontBoundingBoxDescent),a=Dd(e.actualBoundingBoxAscent)+Dd(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(n||a||t)*r))}const ic=8,jd=36,_2=10,VL=1.08,qL=1.16,Bd=6,YL=.94,ZL=.08,KL=.12,XL=88,JL=36,ek=10,tk=14,rk=52;function Y0(e){return e?e.replace(/\r\n|\r|\n/g,"\r").replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g," ").replace(/[\u200B-\u200D\uFEFF]/g,""):""}const nk=80,sk=8;function Qd(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function ik(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function ak(e){try{const t=atob(e),r=Uint8Array.from(t,n=>n.charCodeAt(0));return new TextDecoder("utf-8").decode(r)}catch{return null}}function ok(e){const t="\x1B]52;";let r=0,n="";for(;r<e.length;){const a=e.indexOf(t,r);if(a===-1)return n+=e.slice(r),{cleaned:n,remainder:""};n+=e.slice(r,a);let l=-1,c=1;for(let g=a+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){l=g,c=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){l=g,c=2;break}}if(l===-1)return{cleaned:n,remainder:e.slice(a)};const h=e.slice(a+t.length,l),p=h.indexOf(";");if(p>=0){const g=h.slice(p+1);if(g&&g!=="?"){const x=ak(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=l+c}return{cleaned:n,remainder:""}}function lk(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const n of t){const l=window.getComputedStyle(n).overflowY;if(!(l!=="auto"&&l!=="scroll")){if(n.scrollHeight-n.clientHeight>2)return n;r||(r=n)}}return r}const ck=new Set(["visibility","bfcache","online"]),uk=5e5,dk=1e5,Z0=260,K0=140,L2=80;function hk(e){return!e}let Oc=null;const fk=[{font:'400 13px "Termdock Mono"',text:"Termdock 0123456789 ~!@#$%^&*()[]{}"},{font:'700 13px "Termdock Mono"',text:"Termdock 0123456789 ~!@#$%^&*()[]{}"},{font:'400 13px "Noto Sans Mono CJK SC"',text:"终端中文路径"},{font:'700 13px "Noto Sans Mono CJK SC"',text:"终端中文路径"},{font:'400 13px "Termdock Star Symbol"',text:"✦✧"},{font:'400 13px "Noto Sans Symbols 2"',text:"⏺⏸⏹✓✗"}],pk=()=>{if(Oc)return Oc;if(typeof document>"u"||!("fonts"in document))return Oc=Promise.resolve(),Oc;const e=document.fonts;return Oc=Promise.allSettled(fk.map(({font:r,text:n})=>e.load(r,n))).then(()=>e.ready).then(()=>{}).catch(()=>{}),Oc},k2=e=>{if((!e||e.includes("var("))&&typeof window<"u"){const t=getComputedStyle(document.documentElement).getPropertyValue("--font-mono").trim();if(t)return t}return e};function I2(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function ac(e,t,r){const n=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(n||t*r))}function mk(e){return{background:e.background,foreground:e.foreground,cursor:e.cursor||e.foreground,cursorAccent:e.cursorAccent||e.background,selectionBackground:e.selectionBackground||"rgba(0, 0, 0, 0.3)",selectionForeground:e.selectionForeground||e.foreground,black:e.black||"#6F6E69",red:e.red||"#AF3029",green:e.green||"#66800B",yellow:e.yellow||"#AD8301",blue:e.blue||"#205EA6",magenta:e.magenta||"#A02F6F",cyan:e.cyan||"#24837B",white:e.white||"#CECDC3",brightBlack:e.brightBlack||"#6F6E69",brightRed:e.brightRed||"#D14D41",brightGreen:e.brightGreen||"#879A39",brightYellow:e.brightYellow||"#D0A215",brightBlue:e.brightBlue||"#4385BE",brightMagenta:e.brightMagenta||"#CE5D97",brightCyan:e.brightCyan||"#3AA99F",brightWhite:e.brightWhite||"#FFFCF0"}}const E2=new Map;function gk(e,t,r,n,a){if(typeof window>"u"||typeof document>"u")return null;const l=e.getBoundingClientRect();if(l.width<24||l.height<24)return null;const c=window.devicePixelRatio||1,h=`${r}::${n}::${a}::${c}::${t}`;let p=E2.get(h);if(!p)try{const A=document.createElement("canvas").getContext("2d");if(!A)return null;A.font=`${r}px ${t}`;const w=A.measureText("M"),E=(Math.floor(w.width*c)+Math.round(n))/c,I=GL(w,r,a);E>=1&&I>=1&&(p={cellWidth:E,cellHeight:I},E2.set(h,p))}catch{return null}if(!p)return null;const g=Math.max(2,Math.floor(l.width/p.cellWidth)),x=Math.max(2,Math.floor(l.height/p.cellHeight));return!Number.isFinite(g)||!Number.isFinite(x)?null:{cols:g,rows:x}}async function N2(e){if(!e)return!1;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.select();const r=document.execCommand("copy");return t.remove(),r}catch{return!1}}}function xk(e){const t=e.buffer.active,r=t.viewportY,n=Math.min(t.length,r+e.rows),a=[];for(let l=r;l<n;l+=1){const c=t.getLine(l);c&&a.push(c.translateToString(!0))}return a.join(`
64
+ `).replace(/\s+$/g,"")}function X0(e,t,r){const n=gc(e);if(!n)return null;const a=Math.max(0,Math.min(e.cols-1,Math.floor((t-n.originLeft)/n.cellW))),l=Math.max(0,Math.min(e.rows-1,Math.floor((r-n.originTop)/n.cellH)));return{col:a,row:e.buffer.active.viewportY+l}}function op(e,t,r){const n=t.row*e.cols+t.col,a=r.row*e.cols+r.col;if(n===a)return e.clearSelection(),!1;const l=Math.min(n,a),c=Math.max(n,a)+1,h=l%e.cols,p=Math.floor(l/e.cols);return e.select(h,p,c-l),!0}function R2(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function bk(e,t,r,n,a=!0){if(typeof window>"u")return{left:0,top:0};const l=window.visualViewport,c=l?.offsetLeft??0,h=l?.offsetTop??0,p=l?.width??window.innerWidth,g=l?.height??window.innerHeight,x=R2("--safe-top-inset"),y=R2("--safe-bottom-inset"),A=n?W_(n.terminal,n.anchor,n.focus):null,w=[];let k;if(a&&w.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),n){const I=gc(n.terminal),{start:M,end:B}=Eh(n.anchor,n.focus,n.terminal.cols),F=dh(n.terminal,M),U=dh(n.terminal,B);if(F&&w.push({left:F.x-24,top:F.y-48,right:F.x+24,bottom:F.y+4}),U&&I){const G=U.y+I.cellH;w.push({left:U.x-24,top:G-4,right:U.x+24,bottom:G+48})}if(A){const G=n.anchor.row*n.terminal.cols+n.anchor.col,Q=n.focus.row*n.terminal.cols+n.focus.col,X=G<=Q,ee=A.right-A.left,he=n.anchor.row===n.focus.row?X?A.left+ee*.25:A.right-ee*.25:(A.left+A.right)/2,de=dh(n.terminal,n.focus),$e=de&&I?de.y+I.cellH/2:t;k={vertical:n.focus.row<n.anchor.row?"below":"above",alignX:he,focusX:de?.x??e,focusY:$e}}}const E=G_({clientX:e,clientY:t,viewport:{left:c,top:h+x,right:c+p,bottom:h+g-y},terminal:r,width:XL,height:JL,margin:ek,fingerGap:tk,selection:A,avoid:w,preference:k,selectionGap:rk});return{left:E.left-r.left,top:E.top-r.top}}const A3=C.forwardRef(({sessionKey:e,sessionId:t,isLayoutVisible:r=!0,chunks:n,onInput:a,onResize:l,onFlowControl:c,onTmuxScroll:h,tmuxScrollSensitivity:p=.55,onDoubleTap:g,onInputFocusChange:x,onMobileLongPressCopyResult:y,onMobilePasteResult:A,onReadyChange:w,onSizeSynchronizedChange:k,onWritesSettled:E,onWriteProgress:I,onCursorPositionChange:M,onDirectoryLinkActivate:B,terminalSettings:F,theme:U,className:G,enableTouchScroll:Q,mobileLongPressMode:X="arrows",autoFocus:ee=!0,cursorVisible:ze=!0,suppressSmoothScroll:he=!1},de)=>{const{t:$e}=Qr(),qe=C.useRef(null),oe=C.useRef(null),Re=C.useRef(null),K=C.useRef(null),we=C.useRef(null),Z=C.useRef(he);Z.current=he;const Ue=C.useRef(null),Le=C.useRef(a),Y=C.useRef(l),Ee=C.useRef(x),be=C.useRef(c),Me=C.useRef(w);Me.current=w;const Ze=C.useRef(k);Ze.current=k;const Se=C.useRef(E);Se.current=E;const se=C.useRef(I);se.current=I;const Ye=C.useRef(M);Ye.current=M;const pt=C.useRef(B);pt.current=B;const rt=C.useRef(F.rendererMode),ye=C.useRef(""),et=C.useRef(0),ht=C.useRef(!1),te=C.useRef(null),ve=C.useRef(0),ct=C.useRef(0),re=C.useRef(!1),me=C.useRef(null),je=C.useRef(null),mt=C.useRef(null),ae=C.useRef(!1),De=C.useRef(null),gt=C.useRef(()=>{}),ft=C.useRef(null),kt=C.useRef(null),Dt=C.useRef(void 0),Yt=C.useRef(null),xr=C.useRef(!1),rr=C.useRef(0),Ir=C.useRef(""),ne=C.useRef(null),Ne=C.useRef(null),tt=C.useRef(!1),jt=C.useRef(typeof window<"u"?window.devicePixelRatio:1),Et=C.useRef(!1),dr=C.useRef(!1),Jt=C.useRef(null),We=C.useRef(""),Lr=C.useRef(0),Xe=C.useRef(null),Pt=C.useRef(null),Ge=C.useRef(null),It=C.useRef(0),cn=C.useRef(0),Lt=C.useRef(0),Vr=C.useRef(null),ut=C.useRef(0),fn=C.useRef(0),Sr=C.useRef(!1),Pr=C.useRef(0),[,br]=C.useReducer(L=>L+1,0),[pe,Er]=C.useReducer(L=>L+1,0),[fe,Ve]=C.useState("loading"),[nr,an]=C.useState(null),[Nr,Ar]=C.useState(null);C.useEffect(()=>{const L=j=>{(j.target instanceof Element?j.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&Ar(String(j.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const Bt=C.useMemo(()=>n0("terminal"),[]),[Rr,fs]=C.useState(!0),[Xr,pn]=C.useState(!1);C.useEffect(()=>{if(!Rr&&fe!=="loading"){pn(!1);return}const L=window.setTimeout(()=>pn(!0),160);return()=>window.clearTimeout(L)},[Rr,fe]);const[mn,An]=C.useState(!1),[Rn,dn]=C.useState({visible:!1,activeDir:""}),[Mn,bn]=C.useState(null),_n=C.useRef(null),Dn=C.useRef(!1),kn=C.useRef({active:!1,anchor:null,focus:null,dragging:null}),[$r,Ts]=C.useState(null),[er,qr]=C.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),Qn=C.useRef(er);Qn.current=er;const Tn=C.useRef(null),[Yr,jr]=C.useState({active:!1,text:""}),rn=C.useRef(null),Br=C.useRef(null);Le.current=a,Y.current=l,Ee.current=x,be.current=c,rt.current=F.rendererMode;const W=C.useRef(ee);W.current=ee;const Be=C.useRef(ze);Be.current=ze;const wt=C.useRef(Q);wt.current=Q;const yr=C.useRef(r);yr.current=r;const Mr=hk(!!h),{rendererMode:Dr,fontFamily:Zr,fontSize:nn,fontWeight:zn,fontWeightBold:jn,letterSpacing:ss,lineHeight:$,minimumContrastRatio:Te,drawBoldTextInBrightColors:He,unicodeVersion:Ke,customGlyphs:Je,rescaleOverlappingGlyphs:xt,fontLigatures:Qt,enableImages:vt,smoothScrolling:lt}=F,At=Dr==="webgl",Mt=C.useCallback(()=>{_n.current!==null&&(clearTimeout(_n.current),_n.current=null),bn(null)},[]),Ot=C.useCallback((L,j)=>{_n.current!==null&&(clearTimeout(_n.current),_n.current=null),Dn.current=!1,bn(L),!j?.persistent&&(_n.current=setTimeout(()=>{_n.current=null,bn(null)},3e3))},[]);C.useEffect(()=>{if(!Mn)return;const L=()=>{kn.current.active||Mt()},j=()=>Mt();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",j),document.addEventListener("visibilitychange",j),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",j),document.removeEventListener("visibilitychange",j)}},[Mt,Mn]),C.useEffect(()=>()=>{_n.current!==null&&(clearTimeout(_n.current),_n.current=null)},[]);const dt=C.useCallback(()=>{const L=Re.current,j=qe.current,O=kn.current;if(!L||!j||!O.active||!O.anchor||!O.focus){Ts(null);return}const H=j.getBoundingClientRect(),Qe=gc(L)?.cellH??16,{start:ke,end:st}=Eh(O.anchor,O.focus,L.cols),ot=O.dragging==="start"?O.focus:O.dragging==="end"?O.anchor:ke,zt=O.dragging==="end"?O.focus:O.dragging==="start"?O.anchor:st,fr=(ln,On)=>{const En=dh(L,ln);return En?{left:En.x-H.left,top:On?En.y-H.top:En.y+Qe-H.top}:null};Ts({start:fr(ot,!0),end:fr(zt,!1)})},[]),Ct=C.useCallback(L=>{const j=Re.current,O=qe.current,H=kn.current;if(!j||!O||!H.active||!H.anchor||!H.focus)return;if(H.dragging){Mt();return}const Qe=O.getBoundingClientRect(),ke={x:(Qe.left+Qe.right)/2,y:(Qe.top+Qe.bottom)/2};Ot(bk(L?.x??ke.x,L?.y??ke.y,Qe,{terminal:j,anchor:H.anchor,focus:H.focus},L!==void 0),{persistent:!0})},[Mt,Ot]),ar=C.useCallback(()=>{const L=kn.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,Ts(null),Mt()},[Mt]);C.useEffect(()=>{if(!$r)return;const L=Re.current;if(!L)return;const j=L.onScroll(()=>{dt(),Ct()}),O=L.onResize(()=>ar());return()=>{j.dispose(),O.dispose()}},[$r,dt,Ct,ar]),C.useEffect(()=>{Q||Ee.current?.(!1)},[Q]);const cr=C.useCallback((L,j,O)=>{const H=(O.element?.offsetWidth||0)/O.cols||8,Qe=(O.element?.offsetHeight||0)/O.rows||16,ke=Math.max(1,Math.min(O.cols,Math.floor(L/H)+1)),st=Math.max(1,Math.min(O.rows,Math.floor(j/Qe)+1));return{x:ke,y:st}},[]),$t=C.useCallback((L,j,O)=>{const H=Re.current;if(!H)return!1;const Qe=L>0?-1:1;if(H.modes?.mouseTrackingMode!=="none"){let ke,st;if(j!==void 0&&O!==void 0){const fr=cr(j,O,H);ke=fr.x,st=fr.y}else ke=H.buffer.active.cursorX+1,st=H.buffer.active.cursorY+1;const zt=`\x1B[<${Qe>0?64:65};${ke};${st}M`;return Le.current(zt),!0}if(H.buffer.active.type==="alternate"){const ke=Qe>0?"\x1B[A":"\x1B[B";return Le.current(ke),!0}return null},[cr]),Ur=C.useCallback(L=>{const j=Re.current;if(!j)return!1;const O=ac(Re.current,nn,$),H=rr.current+L,Qe=Math.trunc(H/O);return rr.current=H-Qe*O,Qe!==0?(j.scrollLines(Qe),!0):!1},[nn,$]),Or=C.useCallback(L=>{if(!Re.current)return!1;const H=ac(Re.current,nn,$)/Math.max(.1,p),Qe=rr.current+L;let ke=Math.trunc(Qe/H);if(rr.current=Qe-ke*H,ke===0&&Math.abs(Qe)>=H/3&&(ke=Qe>0?1:-1,rr.current=0),ke===0)return!1;const st=ke>0?"down":"up",ot=Math.max(1,Math.min(Math.abs(ke),10));return h(st,ot),!0},[nn,$,h,p]),es=C.useRef($t);es.current=$t;const js=C.useRef(Ur);js.current=Ur;const ai=C.useRef(Or);ai.current=Or;const Fs=C.useRef(h);Fs.current=h;const zr=C.useRef({pointerId:null,tmuxActiveAtDown:!1});C.useEffect(()=>{if(!Q)return;const L=qe.current;if(!L)return;const j=H=>{H.pointerType==="touch"&&(zr.current.pointerId=H.pointerId,zr.current.tmuxActiveAtDown=!!Fs.current)},O=H=>{H.pointerType==="touch"&&zr.current.pointerId===H.pointerId&&(zr.current.pointerId=null,zr.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",j,{capture:!0,passive:!0}),L.addEventListener("pointerup",O,{capture:!0,passive:!0}),L.addEventListener("pointercancel",O,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",j,!0),L.removeEventListener("pointerup",O,!0),L.removeEventListener("pointercancel",O,!0)}},[Q]);const on=C.useCallback(()=>{if(Sr.current)return!1;const L=zr.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!Fs.current},[]),Wn=C.useCallback((L,j,O)=>{const H=es.current(L,j,O);return H!==null?H:Fs.current?ai.current(L):js.current(L)},[]),z=C.useCallback((L,j)=>{if(performance.now()<=fn.current){fn.current=0;return}const O=Re.current;if(O&&O.modes?.mouseTrackingMode!=="none"){const H=cr(L,j,O),Qe=H.x,ke=H.y,st=`\x1B[<0;${Qe};${ke}M`,ot=`\x1B[<0;${Qe};${ke}m`;Le.current(st),Le.current(ot)}},[cr]),le=C.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),xe=C.useCallback((L=700)=>{Vr.current=null,ut.current=le()+L},[le]),Pe=C.useCallback(()=>wt.current&&le()<=ut.current,[le]),Ht=C.useCallback(()=>{const L=kt.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),Ft=C.useCallback(()=>{if(typeof window>"u")return!1;const L=ot=>{if(typeof document>"u")return 0;const zt=Number.parseFloat(document.documentElement.style.getPropertyValue(ot)||"0");return Number.isFinite(zt)?zt:0},j=L("--kb-height");if(j>0)return j>=L2;const O=window.visualViewport;if(!O)return!1;const H=L("--app-base-vh")||window.innerHeight,Qe=L("--safe-bottom-inset"),ke=O.height+O.offsetTop;return Math.max(0,Math.round(H-ke-Qe))>=L2},[]),tr=C.useCallback(()=>{Xe.current!==null&&(clearTimeout(Xe.current),Xe.current=null),Pt.current=null},[]),Xt=C.useCallback(L=>{const j=Re.current;let O="";for(const H of L)H.left&&(O+=(j?Qd(j,"D"):"\x1B[D").repeat(H.left)),H.right&&(O+=(j?Qd(j,"C"):"\x1B[C").repeat(H.right)),H.backspace&&(O+="".repeat(H.backspace)),H.insert&&(O+=H.insert);return O},[]),Hr=C.useCallback(L=>{const j=L.value,O=Y0(j),H=We.current;if(!(wt.current&&!O.includes("\r")&&!H.includes("\r"))){if(O===H)return;let fr=0;for(;fr<H.length&&fr<O.length&&H[fr]===O[fr];)fr++;const ln=H.length-fr;ln>0&&Le.current("".repeat(ln));const On=O.slice(fr);if(On){try{Re.current?.clearSelection()}catch{}Le.current(On)}We.current=O,Lr.current=Array.from(O).length;return}const ke=w2(L),{ops:st,cursor:ot}=EL(H,O,Lr.current,ke),zt=Xt(st);if(zt){if(st.some(fr=>fr.insert))try{Re.current?.clearSelection()}catch{}Le.current(zt)}We.current=O,Lr.current=ot},[Xt]),yn=C.useCallback((L,j)=>{const O=L.value,H=Y0(O),Qe=We.current;if(H===Qe){tr();return}let ke=0;for(;ke<Qe.length&&ke<H.length&&Qe[ke]===H[ke];)ke++;const st=Qe.length-ke;if(Q&&!j?.immediate&&st>=sk){Pt.current=L,Xe.current!==null&&clearTimeout(Xe.current),Xe.current=setTimeout(()=>{Xe.current=null;const zt=Pt.current;Pt.current=null,zt&&Hr(zt)},nk);return}tr(),Hr(L)},[tr,Q,Hr]),P=C.useCallback(L=>{yn(L,{immediate:!0}),Le.current("\r"),L.value="",We.current="",Lr.current=0},[yn]),Ae=C.useCallback((L,j,O)=>{if(!L)return;tr();const H=j??kt.current;H&&(H.value=""),We.current="",Lr.current=0;try{Re.current?.clearSelection()}catch{}if(ar(),O?.paste&&/[\r\n]/.test(L)){const Qe=O.submitAfterPaste??L.endsWith("\r"),ke=Z_(L,Qe);return Le.current(ke,{skipModifierTransform:!0,consumeModifier:O?.consumeModifier,targeted:O?.targeted})}return Le.current(L,{skipModifierTransform:!0,consumeModifier:O?.consumeModifier,targeted:O?.targeted})},[tr]),_e=C.useCallback((L,j)=>{const O=Y0(L);return O?(Ar(null),If(O)||(Ae(O,j,{paste:!0,submitAfterPaste:!1}),Mt()),!0):!1},[Mt,Ae]);C.useEffect(()=>M7(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const j=L.paths.map(Gc).join(" ");Ae(`${j} `);try{kt.current?.focus({preventScroll:!0})}catch{}}),[Ae,e]);const at=C.useCallback(async(L,j)=>{Ar(null);try{const O=await HT(L);return If(`${Gc(O)} `)||(Ae(`${Gc(O)} `,j),Mt()),!0}catch(O){return Ar(O instanceof Error?O.message:"Image upload failed"),!1}},[Mt,Ae]),bt=C.useCallback(async(L,j)=>{Ar(null);try{const O=await VT(L);if(!O.length)return!1;const H=`${O.map(Gc).join(" ")} `;return If(H)||(Ae(H,j),Mt()),!0}catch(O){return Ar(O instanceof Error?O.message:"File upload failed"),!1}},[Mt,Ae]),ur=C.useCallback(async(L,j)=>{Ar(null);try{const O=Ah()?.targetPeerId;let H;if(ko()?.readClipboardFiles){try{const{files:st,paths:ot}=await GT();if(ot.length)return _e(`${ot.map(Gc).join(" ")} `,L);if(st.length)return bt(st,L)}catch(st){if(st instanceof ih)throw st;H=st}if(Ah()?.targetPeerId!==O)throw new Error("目标服务已切换,请重新粘贴")}if(j?.files.length){const st=j.files[0];return j.files.length===1&&st.type.startsWith("image/")?at(st,L):bt(j.files,L)}if(j?.text)return _e(j.text,L);if(!ko()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const st=await navigator.clipboard.read(),ot=await WT({read:async()=>st});if(ot.length)return bt(ot,L);const zt=await Ag({read:async()=>st});if(zt)return at(zt,L);for(const fr of st){if(!fr.types.includes("text/plain"))continue;const ln=await(await fr.getType("text/plain")).text();return _e(ln,L)}return Ar("剪贴板未提供可读取的文字、图片或视频;视频可通过文件按钮选择上传。"),!1}return navigator.clipboard?.readText?_e(await navigator.clipboard.readText(),L):!1}const Qe=await Ag(navigator.clipboard);if(Qe)return at(Qe,L);if(!navigator.clipboard?.readText){if(H)throw H;return!1}const ke=await navigator.clipboard.readText();if(!ke&&H)throw H;return _e(ke,L)}catch(O){return Ar(O instanceof Error?O.message:"Clipboard read failed"),!1}},[bt,at,_e]),Vt=C.useCallback(L=>{if(Tn.current&&!L?.repositionFrozen)return null;const j=Re.current;if(!j||!j.element)return null;const O=gc(j),Qe=j.element.querySelector(".xterm-screen")??j.element,ke=Qe.getBoundingClientRect(),st=O?.cellW??(ke.width>0&&j.cols>0?ke.width/j.cols:8),ot=O?.cellH??(ke.height>0&&j.rows>0?ke.height/j.rows:17),zt=kt.current;let fr=Dt.current;zt&&(fr===void 0||fr!==null&&(!fr.isConnected||!fr.contains(zt)))&&(fr=q_(zt),Dt.current=fr);const ln=j.buffer.active,On=ln.cursorX*st,En=ln.cursorY*ot,Gn=Y_(Qe,fr??null,On,En),kr=Math.round(Gn.x),Cn=Math.round(Gn.y),Ln={x:kr,y:Cn,cellW:st,cellH:ot,cursorX:ln.cursorX};return Qn.current=Ln,Tn.current&&L?.repositionFrozen&&(Tn.current={...Ln}),qr(Vs=>Math.abs(Vs.x-kr)<.5&&Math.abs(Vs.y-Cn)<.5&&Math.abs(Vs.cellW-st)<.5&&Math.abs(Vs.cellH-ot)<.5&&Vs.cursorX===ln.cursorX?Vs:Ln),Ln},[]),Nt=C.useRef(Vt);Nt.current=Vt,C.useEffect(()=>{if(!Q)return;let L=null,j=null;const O=()=>{L!==null&&window.cancelAnimationFrame(L),j!==null&&window.cancelAnimationFrame(j),L=window.requestAnimationFrame(()=>{L=null,j=window.requestAnimationFrame(()=>{j=null,Nt.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",O),window.visualViewport?.addEventListener("scroll",O),document.addEventListener("termdock:viewport-keyboard-change",O),()=>{L!==null&&window.cancelAnimationFrame(L),j!==null&&window.cancelAnimationFrame(j),window.visualViewport?.removeEventListener("resize",O),window.visualViewport?.removeEventListener("scroll",O),document.removeEventListener("termdock:viewport-keyboard-change",O)}},[Q]);const Wr=C.useCallback(L=>{let j=0;for(const O of L){const H=O.codePointAt(0)??0,Qe=H>=4352&&H<=4447||H>=11904&&H<=12350||H>=12353&&H<=13311||H>=13312&&H<=19903||H>=19968&&H<=40959||H>=40960&&H<=42191||H>=44032&&H<=55203||H>=63744&&H<=64255||H>=65072&&H<=65103||H>=65280&&H<=65376||H>=65504&&H<=65510||H>=127744&&H<=129791;j+=Qe?2:1}return j},[]),Pn=C.useCallback(L=>{const j=Re.current,{cellW:O,cellH:H}=er;if(!j||!L)return{width:Math.max(1,Math.round(O)),height:Math.max(1,Math.round(H)),whiteSpace:"pre"};const ke=Tn.current?.cursorX??j.buffer.active.cursorX,st=Math.max(1,j.cols),ot=Math.max(1,Wr(L)),zt=Math.max(1,st-ke);if(ot<=zt)return{width:Math.max(1,Math.round(ot*O)),height:Math.max(1,Math.round(H)),whiteSpace:"pre"};const fr=ot-zt,On=1+Math.ceil(fr/st);return{width:Math.max(1,Math.round(zt*O)),height:Math.max(1,Math.round(On*H)),whiteSpace:"pre-wrap"}},[er,Wr]),xs=C.useCallback(()=>{Dt.current=void 0;const L=Nt.current();Tn.current={...L??Qn.current}},[]),Di=C.useCallback(()=>{Tn.current=null},[]),is=C.useCallback(L=>{if(!Et.current&&Tn.current===null)return!1;if(Et.current=!1,Tn.current=null,tr(),Jt.current!==null&&(clearTimeout(Jt.current),Jt.current=null),dr.current=!1,L){L.value=We.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return jr(j=>j.active||j.text?{active:!1,text:""}:j),!0},[tr]),oi=C.useCallback((L,j)=>{const O=kt.current;if(O)try{O.removeAttribute("readonly");const Qe=typeof document<"u"&&document.activeElement===O&&!Ft(),ke=le(),st=ke-Pr.current;Pr.current=ke,Qe&&st>600?(O.blur(),O.removeAttribute("readonly"),O.focus(),Pr.current=le()):O.focus()}catch{}},[Ft,le]),li=C.useCallback(L=>{cn.current=le()+L},[le]),fa=C.useCallback(()=>Q?le()<=cn.current:!1,[Q,le]),vn=C.useCallback(L=>{li(L),Lt.current=le()},[li,le]),cs=C.useCallback(()=>{Q&&kt.current?.removeAttribute("readonly")},[Q]),ks=C.useCallback(L=>L instanceof HTMLElement&&(L.closest('[data-terminal-copy-popover="true"]')!==null||L.closest('[data-mobile-copy-button="true"]')!==null||L.closest("[data-selection-handle]")!==null),[]),Qa=C.useCallback(L=>{if(cs(),vn(Z0),!Q||L.pointerType!=="touch"){Vr.current=null;return}const j=L.target;if(ks(j)){xe();return}Mn&&!(j instanceof HTMLElement&&j.closest('[data-terminal-copy-popover="true"]'))&&Mt(),Vr.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[Mt,Q,vn,ks,Mn,cs,xe]),Ci=C.useCallback(L=>{vn(Z0);const j=Vr.current;!j||j.pointerId!==L.pointerId||Math.hypot(L.clientX-j.startX,L.clientY-j.startY)>12&&(j.moved=!0)},[vn]),ho=C.useCallback(L=>{vn(K0);const j=Vr.current;Vr.current=null,!(!Q||L.pointerType!=="touch")&&(!j||j.pointerId!==L.pointerId||j.moved||Pe()||oi(L.clientX,L.clientY))},[Q,vn,oi,Pe]),pa=C.useCallback(()=>{Vr.current=null,vn(K0)},[vn]),gn=C.useMemo(()=>({enableKinetic:!0}),[]),ma=C.useRef(()=>!1),Is=C.useRef(oi);Is.current=oi;const el=C.useCallback((L,j)=>{Pe()||Is.current(L,j)},[Pe]),Si=C.useRef(g);Si.current=g;const fo=C.useRef(y);fo.current=y;const Pa=C.useRef(A);Pa.current=A;const ga=C.useCallback(()=>{if(Dn.current)return;Dn.current=!0,xe();const L=Re.current,j=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}Ai.flushSync(()=>{ar()}),(async()=>{const O=await N2(j);fo.current?.(O)})()},[ar,xe]),Xi=C.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:Oa,stopAllScroll:ci}=TL(qe,{...gn,shouldCaptureTouch:ma.current,canStartScrollGesture:on,onScroll:Wn,onScrollWithCoords:Wn,onClickWithCoords:z,onTap:el,onClaimChange:Xi,tapThreshold:12,gestureName:`normal-scroll:${e}`});C.useEffect(()=>{if(!Q)return;kt.current?.setAttribute("readonly","");const L=Oa();return()=>{L()}},[Q,Oa]),C.useEffect(()=>{if(!Q)return;let L=Ft();const j=()=>{const O=Ft();if(L&&!O){const H=kt.current;H&&typeof document<"u"&&document.activeElement===H&&(H.setAttribute("readonly",""),H.blur())}L=O};return window.visualViewport?.addEventListener("resize",j),window.visualViewport?.addEventListener("scroll",j),document.addEventListener("termdock:viewport-keyboard-change",j),()=>{window.visualViewport?.removeEventListener("resize",j),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("termdock:viewport-keyboard-change",j)}},[Q,Ft]),C.useEffect(()=>{if(!Q)return;const L=qe.current;if(!L)return;const j=H=>{const ke=H.sourceCapabilities?.firesTouchEvents===!0,st=le()-Lt.current<=1200;return!ke&&!st?!1:L.contains(H.target)},O=H=>{j(H)&&(H.cancelable&&H.preventDefault(),H.stopImmediatePropagation(),H.stopPropagation())};return L.addEventListener("mousedown",O,{capture:!0,passive:!1}),L.addEventListener("mouseup",O,{capture:!0,passive:!1}),L.addEventListener("click",O,{capture:!0,passive:!1}),document.addEventListener("mouseup",O,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",O,!0),L.removeEventListener("mouseup",O,!0),L.removeEventListener("click",O,!0),document.removeEventListener("mouseup",O,!0)}},[Q,le]);const us=C.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),In=C.useCallback(()=>{const L=us.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),xa=C.useCallback((L,j,O)=>{const H=Re.current;if(!H||!H.element||!H.cols||!H.rows)return null;const Qe=us.current,ke=H.element.getBoundingClientRect(),st=j??Qe.lastX??ke.left+ke.width/2,ot=O??Qe.lastY??ke.top+ke.height/2,zt=st-ke.left,fr=ot-ke.top,ln=H.element.offsetWidth/H.cols||8,On=H.element.offsetHeight/H.rows||16,En=Math.max(1,Math.min(H.cols,Math.floor(zt/ln)+1)),Gn=Math.max(1,Math.min(H.rows,Math.floor(fr/On)+1));return`\x1B[<${L==="up"?64:65};${En};${Gn}M`},[]),ts=C.useCallback((L,j,O,H)=>{if(j<=0)return;const Qe=xa(L,O,H);Qe&&Le.current(j===1?Qe:Qe.repeat(j))},[xa]),ui=C.useRef(ts);ui.current=ts;const _i=C.useRef(()=>{}),Ji=C.useCallback(()=>{const j=ac(Re.current,nn,$)/Math.max(.1,p),O=1+us.current.instantSpeed*.1;return j/Math.min(6,O)},[nn,$,p]),Fa=C.useCallback(()=>{const L=us.current;L.rafId=null;const j=Ji();let O=0,H=0;for(;O+H<Bd&&L.remainder>=j;)L.remainder-=j,H++;for(;O+H<Bd&&L.remainder<=-j;)L.remainder+=j,O++;if(H>0&&ts("down",H),O>0&&ts("up",O),O+H>0)L.rafId=requestAnimationFrame(Fa);else if(L.pointerId!==null&&Math.abs(L.remainder)>=j/3){const ke=L.remainder>0?"down":"up";L.remainder=0,ts(ke,1),L.rafId=requestAnimationFrame(Fa)}},[Ji,ts]),$a=C.useCallback(()=>{const L=us.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(Fa))},[Fa]),po=C.useCallback(L=>{if(L.pointerType!=="touch")return!1;In();const j=us.current;return j.pointerId=L.pointerId,j.lastX=L.clientX,j.lastY=L.clientY,j.startX=L.clientX,j.startY=L.clientY,j.gestureAxis=null,j.remainder=0,j.velocity=0,j.instantSpeed=0,j.didScroll=!1,!1},[In]),Al=C.useCallback((L,j)=>{if(Sr.current)return j?"release":"neutral";if(performance.now()<=fn.current)return"neutral";const O=us.current;if(L.pointerType!=="touch"||L.pointerId!==O.pointerId||O.lastY==null)return"neutral";if(O.gestureAxis===null&&O.startX!==null&&O.startY!==null){const ke=Math.abs(L.clientX-O.startX),st=Math.abs(L.clientY-O.startY);if(ke>_2||st>_2){if(ke>st*VL)return O.gestureAxis="x","release";st>ke*qL&&(O.gestureAxis="y")}}if(O.gestureAxis==="x")return O.lastX=L.clientX,O.lastY=L.clientY,"release";if(O.gestureAxis===null)return O.lastX=L.clientX,O.lastY=L.clientY,"neutral";const H=L.clientY-O.lastY;O.lastX=L.clientX,O.lastY=L.clientY;const Qe=-H;if(O.remainder+=Qe,O.instantSpeed=Math.abs(Qe),O.velocity=O.velocity*.45+Qe*.55,j){const st=ac(Re.current,nn,$)/Math.max(.1,p);Math.abs(O.remainder)>=st/3&&(O.didScroll=!0,$a())}return"claim"},[nn,$,p,$a]),tl=C.useCallback(L=>{const j=us.current;if(L.pointerType!=="touch"||L.pointerId!==j.pointerId)return;if(In(),j.pointerId=null,j.lastX=null,j.lastY=null,j.startX=null,j.startY=null,j.instantSpeed=0,j.gestureAxis==="x"){j.gestureAxis=null;return}j.gestureAxis=null;const H=ac(Re.current,nn,$)/Math.max(.1,p);if(j.didScroll&&Math.abs(j.velocity)>H*ZL){const Qe=()=>{j.velocity*=YL,j.remainder+=j.velocity;const ke=1+Math.abs(j.velocity)*.1,st=H/Math.min(6,ke);if(Math.abs(j.velocity)<H*KL){if(Math.abs(j.remainder)>=st/3){const fr=j.remainder>0?"down":"up";ts(fr,1),j.remainder=0}j.velocity=0,j.rafId=null;return}let ot=0,zt=0;for(;ot+zt<Bd&&j.remainder>=st;)j.remainder-=st,zt++;for(;ot+zt<Bd&&j.remainder<=-st;)j.remainder+=st,ot++;zt>0&&ts("down",zt),ot>0&&ts("up",ot),j.rafId=requestAnimationFrame(Qe)};j.rafId=requestAnimationFrame(Qe)}else Math.abs(j.remainder)>=H/3&&$a();j.didScroll&&L.stopImmediatePropagation()},[In,ts,$a,p,nn,$]),Mo=C.useCallback(L=>{const j=us.current;L.pointerType!=="touch"||L.pointerId!==j.pointerId||(In(),j.pointerId=null,j.lastX=null,j.lastY=null,j.startX=null,j.startY=null,j.gestureAxis=null,j.remainder=0,j.velocity=0,j.didScroll=!1)},[In]);b2({name:`tmux-scroll:${e}`,priority:wL,container:()=>qe.current,onPointerDown:Q&&h?po:void 0,onPointerMove:Q&&h?Al:void 0,onPointerUp:Q&&h?tl:void 0,onPointerCancel:Q&&h?Mo:void 0});const $s=C.useRef({pointerId:null,originX:0,originY:0,holdTimer:null,mode:"idle",longPressMode:"arrows",copyStart:null,copyDidSelect:!1,edgeScrollTimer:null,edgeScrollDir:0,edgeScrollLines:0,edgeClientX:0,edgeClientY:0,gestureLocked:!1,joystickDir:"",joystickRepeatTimer:null,repeatIntervalMs:260,lastHapticTime:0,lastTapTime:0,lastTapX:0,lastTapY:0,tapStartX:0,tapStartY:0,tapDidMove:!1}),Do=C.useRef(null);Do.current=qe.current;const ba=Do,ya=Le,va=C.useRef(X);va.current=X;const ps=C.useCallback(L=>{const j=$s.current;j.gestureLocked!==L&&(j.gestureLocked=L,Xi(L))},[Xi]),Li=C.useCallback(()=>{const L=$s.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),mo=C.useCallback(L=>{const j=Re.current,O=$s.current;if(j){if(O.mode==="copy"&&O.copyStart){O.copyDidSelect=op(j,O.copyStart,L)||O.copyDidSelect;return}if(O.mode==="adjust"){const H=kn.current;if(!H.active||!H.anchor)return;H.focus=H_(j,L),op(j,H.anchor,H.focus),dt()}}},[dt]),go=C.useCallback((L,j)=>{const O=Re.current,H=$s.current;if(!O)return;const Qe=gc(O);if(!Qe)return;const ke=Qe.originTop,st=Qe.originTop+O.rows*Qe.cellH,ot=Math.max(28,Qe.cellH*1.5),zt=j-ke,fr=st-j;let ln=0,On=0;if(zt<ot?(ln=-1,On=Math.min(1,(ot-zt)/ot)):fr<ot&&(ln=1,On=Math.min(1,(ot-fr)/ot)),H.edgeClientX=L,H.edgeClientY=j,ln===0){Li();return}H.edgeScrollDir=ln,H.edgeScrollLines=1+Math.round(On*5),H.edgeScrollTimer===null&&(H.edgeScrollTimer=setInterval(()=>{const En=Re.current,Gn=$s.current;if(!En||Gn.edgeScrollDir===0)return;if(Gn.mode!=="copy"&&Gn.mode!=="adjust"){Li();return}En.scrollLines(Gn.edgeScrollDir*Gn.edgeScrollLines);const kr=X0(En,Gn.edgeClientX,Gn.edgeClientY-jd);kr&&mo(kr)},60))},[mo,Li]),xo=C.useCallback(L=>{if(L.pointerType!=="touch")return!1;const j=ba.current;if(!j)return!1;const O=L.target;if(!(O instanceof HTMLElement)||!j.contains(O)||O.closest('[data-mobile-keyboard="true"]'))return!1;const H=$s.current;H.longPressMode=va.current;const Qe=kn.current;if(Qe.active&&H.pointerId===null){const ke=O.closest("[data-selection-handle]");if(ke instanceof HTMLElement){const st=Re.current,ot=ke.dataset.selectionHandle==="start"?"start":"end";if(st&&Qe.anchor&&Qe.focus){const zt=Eh(Qe.anchor,Qe.focus,st.cols);return Qe.anchor=ot==="start"?zt.end:zt.start,Qe.focus=ot==="start"?zt.start:zt.end,Qe.dragging=ot,Mt(),H.pointerId=L.pointerId,H.tapStartX=L.clientX,H.tapStartY=L.clientY,H.tapDidMove=!1,H.mode="adjust",Sr.current=!0,xe(1800),kt.current?.setAttribute("readonly",""),ci(),In(),ao(ic),ps(!0),!0}}if(!O.closest("[data-terminal-copy-popover]")){ar();try{Re.current?.clearSelection()}catch{}}}if(H.pointerId!==null)return!0;if(Sr.current=!1,Si.current){const ke=performance.now(),st=L.clientX,ot=L.clientY;if(H.lastTapTime!==0&&ke-H.lastTapTime<=300&&Math.hypot(st-H.lastTapX,ot-H.lastTapY)<=25)return ao(ic),fn.current=performance.now()+500,Si.current?.(),An(!0),Br.current&&clearTimeout(Br.current),Br.current=setTimeout(()=>An(!1),400),H.lastTapTime=0,!0}return H.holdTimer!==null&&(clearTimeout(H.holdTimer),H.holdTimer=null),H.joystickRepeatTimer!==null&&(clearTimeout(H.joystickRepeatTimer),H.joystickRepeatTimer=null),H.joystickDir="",H.copyStart=null,H.copyDidSelect=!1,H.pointerId=L.pointerId,H.originX=L.clientX,H.originY=L.clientY,H.tapStartX=L.clientX,H.tapStartY=L.clientY,H.tapDidMove=!1,H.mode="holding",H.longPressMode==="copy"&&ps(!0),H.holdTimer=setTimeout(()=>{if(H.holdTimer=null,H.mode==="holding"){if(H.longPressMode==="copy"){const ke=Re.current,st=ke?X0(ke,H.tapStartX,H.tapStartY):null;if(!ke||!st){H.mode="idle";return}H.mode="copy",Sr.current=!0,xe(1800),kt.current?.setAttribute("readonly",""),H.copyStart=st,H.copyDidSelect=!1,ci(),In(),ke.clearSelection(),ao(ic),ps(!0);return}H.mode="arrow",Sr.current=!0,xe(1e3),ci(),In(),ao(ic),ps(!0),requestAnimationFrame(()=>{dn({visible:!0,activeDir:""})})}},350),!0},[ps,Mt,ar]),Us=C.useCallback((L,j)=>{if(L.pointerType!=="touch")return"neutral";const O=$s.current;if(O.mode==="arrow"&&L.pointerId!==O.pointerId||O.mode==="copy"&&L.pointerId!==O.pointerId||O.mode!=="arrow"&&O.mode!=="copy"&&L.pointerId!==O.pointerId)return"neutral";const H=L.clientX-O.tapStartX,Qe=L.clientY-O.tapStartY;if(Math.hypot(H,Qe)>10&&(O.tapDidMove=!0),O.mode==="holding"){if(!j)return O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),ps(!1),Sr.current=!1,O.mode="idle","neutral";const ke=L.clientX-O.originX,st=L.clientY-O.originY;return O.longPressMode==="copy"&&Math.hypot(ke,st)>20?(O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),ps(!1),Sr.current=!1,O.mode="idle","release"):Math.hypot(ke,st)>20?(O.holdTimer!==null&&(clearTimeout(O.holdTimer),O.holdTimer=null),ps(!1),O.mode="idle","release"):"claim"}if(O.mode==="adjust"){if(!j)return"claim";ci();const ke=Re.current,st=kn.current;if(!ke||!st.active||!st.anchor||!st.focus)return"claim";const ot=X0(ke,L.clientX,L.clientY-jd);return ot&&(mo(ot),go(L.clientX,L.clientY)),"claim"}if(O.mode==="copy"){if(!j)return"claim";ci();const ke=Re.current;if(!ke||!O.copyStart)return"claim";const st=X0(ke,L.clientX,L.clientY-jd);return st&&(mo(st),go(L.clientX,L.clientY)),"claim"}if(O.mode==="arrow"){if(!j)return"claim";const ke={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},st=L.clientX-O.tapStartX,ot=L.clientY-O.tapStartY,zt=jL(st,ot,O.joystickDir);if(zt&&zt!==O.joystickDir&&(O.originX=L.clientX,O.originY=L.clientY),zt){const fr=L.clientX-O.originX,ln=L.clientY-O.originY,On=Math.hypot(fr,ln);if(O.repeatIntervalMs=BL(On),zt!==O.joystickDir){O.joystickRepeatTimer!==null&&clearTimeout(O.joystickRepeatTimer);const En=O.joystickDir==="";O.joystickDir=zt,ya.current(ke[zt]);const Gn=performance.now();Gn-O.lastHapticTime>120&&(ao(ic),O.lastHapticTime=Gn);const kr=En?400:300;O.joystickRepeatTimer=setTimeout(function Cn(){if(O.joystickDir!==zt)return;ya.current(ke[zt]);const Ln=performance.now();Ln-O.lastHapticTime>120&&(ao(ic),O.lastHapticTime=Ln),O.joystickRepeatTimer=setTimeout(Cn,O.repeatIntervalMs)},kr)}dn({visible:!0,activeDir:zt})}else O.joystickRepeatTimer!==null&&(clearTimeout(O.joystickRepeatTimer),O.joystickRepeatTimer=null),O.joystickDir="",dn({visible:!0,activeDir:""});return"claim"}return"neutral"},[ps,mo,go]),zs=C.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==$s.current.pointerId)return;const j=$s.current;if(j.mode==="copy"){ci(),In(),Li(),ps(!1);const H=Re.current;let Qe=null;if(H&&j.copyStart&&(Qe=X0(H,L.clientX,L.clientY-jd),Qe&&(j.copyDidSelect=op(H,j.copyStart,Qe)||j.copyDidSelect)),H&&j.copyDidSelect&&H.hasSelection()&&j.copyStart){const ke=kn.current;ke.active=!0,ke.anchor=j.copyStart,ke.focus=Qe??j.copyStart,ke.dragging=null,dt(),Ct({x:L.clientX,y:L.clientY}),xe(1800),ao(ic)}else fo.current?.(!1);j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),j.copyStart=null,j.copyDidSelect=!1,j.pointerId=null,j.mode="idle",Sr.current=!1;return}if(j.mode==="adjust"){ci(),In(),Li(),ps(!1),kn.current.dragging=null,dt(),Ct({x:L.clientX,y:L.clientY}),xe(1800),j.pointerId=null,j.mode="idle",Sr.current=!1;return}if(j.mode==="arrow"){ci(),In(),ps(!1),dn({visible:!1,activeDir:""}),j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",j.pointerId=null,j.mode="idle",Sr.current=!1;return}const O=ba.current;if(O&&!j.tapDidMove){const H=L.target;H instanceof HTMLElement&&O.contains(H)&&!H.closest('[data-mobile-keyboard="true"]')&&(j.lastTapTime=performance.now(),j.lastTapX=L.clientX,j.lastTapY=L.clientY)}else j.tapDidMove&&(j.lastTapTime=0);j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",ps(!1),Sr.current=!1,j.copyStart=null,j.copyDidSelect=!1,j.pointerId=null,j.mode="idle"},[ps,ci,xe,Li,dt,Ct]),jo=C.useCallback(()=>{const L=$s.current;ps(!1),Li(),L.mode==="arrow"&&dn({visible:!1,activeDir:""}),L.mode==="adjust"&&(kn.current.dragging=null,dt(),Ct()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",Sr.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[ps,Li,dt,Ct]);b2({name:`long-press:${e}`,priority:vL,container:()=>qe.current,onPointerDown:Q?xo:void 0,onPointerMove:Q?Us:void 0,onPointerUp:Q?zs:void 0,onPointerCancel:Q?jo:void 0});const Yn=C.useCallback((L={})=>{ct.current+=1,ye.current="",je.current=null,et.current=0,ae.current=!1,De.current=null,ht.current&&(ht.current=!1,L.notifyFlowResume===!0&&be.current?.(!1)),te.current=null,re.current=!1,me.current=null,Ir.current=""},[]),as=C.useCallback((L="unknown")=>{const j=Ue.current,O=Re.current,H=qe.current;if(!j||!O||!H||!O.element||!O.cols||!O.rows)return;const Qe=H.getBoundingClientRect();if(Qe.width<24||Qe.height<24){Bt("skip fit: container too small",{reason:L,width:Math.round(Qe.width),height:Math.round(Qe.height)});return}try{const ke={cols:O.cols,rows:O.rows},st=O.buffer.active,ot=rL(st.type,st.baseY,st.viewportY),zt=j.proposeDimensions();if(!zt||zt.cols<=0||zt.rows<=0)return;const fr=S2(O,ke.rows),ln=J_({reason:L,currentCols:ke.cols,currentRows:ke.rows,proposedCols:zt.cols,proposedRows:zt.rows});let On=0;if(ln.accept){fi.current&&Fs.current&&(ke.cols!==zt.cols||ke.rows!==zt.rows)&&we.current?.begin();const Gn=O.options.smoothScrollDuration;try{O.options.smoothScrollDuration=0,O.resize(zt.cols,zt.rows),On=S2(O,zt.rows),ot&&O.scrollToBottom()}finally{O.options.smoothScrollDuration=Gn}rr.current=0}(fr>0||On>0)&&(O.refresh(0,Math.max(0,O.rows-1)),Bt("xterm buffer invariant repaired",{reason:L,before:fr,after:On,cols:O.cols,rows:O.rows}));const En={cols:O.cols,rows:O.rows};Bt("fit",{reason:L,backend:"xterm",width:Math.round(Qe.width),height:Math.round(Qe.height),before:ke,proposed:zt,next:En,hysteresis:ln,changed:ke.cols!==En.cols||ke.rows!==En.rows})}catch{we.current?.cancel()}},[Bt]),di=C.useCallback(L=>{const j=Re.current;if(j)try{j.refresh(0,Math.max(0,j.rows-1)),Bt("terminal refreshed (sync)",{reason:L,cols:j.cols,rows:j.rows,hasWebgl:!!ne.current})}catch(O){Bt("terminal refresh (sync) failed",{reason:L,error:O})}},[Bt]),ji=C.useCallback(L=>{const j=Ne.current;if(j){try{j.dispose()}catch{}Ne.current=null}const O=ne.current;if(!O)return!1;we.current?.cancel();try{O.dispose()}catch{}return ne.current=null,Bt("renderer disposed",{type:"webgl",reason:L}),!0},[Bt]),Bi=C.useCallback((L,j)=>{if(ne.current)return!0;try{const O=new KC({customGlyphs:Je});return Ne.current=O.onContextLoss(()=>{Bt("webgl context loss",{reason:"onContextLoss"}),tt.current=!0,typeof window<"u"&&window.setTimeout(()=>{Tt("webgl-context-loss",{forceRendererRecreate:!0})},0)}),we.current?.cancel(),L.loadAddon(O),ne.current=O,tt.current=!1,Bt("renderer",{type:"webgl",reason:j,mobile:Q,mode:rt.current}),di(`webgl-enabled:${j}`),as(`webgl-enabled:${j}`),Ta.current=!0,!0}catch(O){return Bt("webgl load failed, fallback to dom renderer",{reason:j,error:O,mobile:Q,mode:rt.current}),!1}},[Bt,Je,Q,as,di]),Hs=200,bo=C.useRef(0),Ws=C.useRef(new Map),hi=C.useRef(new Map),sn=C.useRef(ip()),wa=C.useRef(null),Gs=C.useRef(null),ea=C.useRef(-1),Aa=C.useRef(new Map),Ta=C.useRef(!1),fi=C.useRef(!1),ta=C.useRef(g2()),Cs=C.useRef(null),Ca=C.useRef(null),Ua=C.useCallback(()=>{Cs.current!==null&&(clearTimeout(Cs.current),Cs.current=null),Ca.current=null},[]),rs=C.useCallback(()=>{const L=Ws.current;L.forEach(j=>cancelAnimationFrame(j)),L.clear(),hi.current.clear()},[]),ms=C.useCallback(()=>{wa.current!==null&&(window.clearTimeout(wa.current),wa.current=null)},[]),Sa=C.useRef(()=>{}),rl=C.useCallback(L=>{ms(),Ze.current?.(!1),Y.current(L.cols,L.rows,L.seq),wa.current=window.setTimeout(()=>{wa.current=null;const j=m2(sn.current,L.seq);sn.current=j.state,j.request&&fi.current?(Bt("resize ack timeout; retrying",{seq:L.seq,retrySeq:j.request.seq,cols:j.request.cols,rows:j.request.rows}),Sa.current(j.request)):j.exhausted&&(we.current?.cancel(),Bt("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[ms,Bt]);Sa.current=rl;const Qi=C.useCallback((L,j)=>{if(!fi.current)return;const O=aL(sn.current,{cols:L,rows:j});sn.current=O.state,O.request&&rl(O.request)},[rl]),yo=C.useCallback((L,j)=>{const O=hL(ta.current,Date.now());if(O.action==="send"){Ca.current=null,Qi(L,j);return}Ca.current={cols:L,rows:j},Cs.current===null&&(Cs.current=setTimeout(()=>{Cs.current=null;const H=Ca.current;Ca.current=null,H&&(ta.current=fL(Date.now()),Qi(H.cols,H.rows))},Math.max(0,O.readyAt-Date.now())))},[Qi]),za=1500,nl=400,Ha=C.useRef(0),_a=C.useRef(0),ie=C.useCallback((L,j,O)=>{if(!Number.isFinite(L)||!Number.isFinite(j)||L<=0||j<=0)return;const H=Math.floor(L),Qe=Math.floor(j);sn.current=cL(sn.current,{cols:H,rows:Qe}),Ha.current=Date.now(),Bt("pty-size broadcast received",{cols:H,rows:Qe,source:O??"unknown"})},[Bt]),Fe=C.useCallback(L=>{const j=Re.current;if(!j||!j.cols||!j.rows||!fi.current||typeof document<"u"&&(document.visibilityState!=="visible"||!mu()))return;const O=Date.now();if(O-Ha.current<za||O-_a.current<nl)return;const H=j.cols,Qe=j.rows,ke=sn.current.confirmed;ke&&ke.cols===H&&ke.rows===Qe||(_a.current=O,Bt("ensureSizeMatches push",{reason:L,cols:H,rows:Qe,lastServerSize:ke}),Qi(H,Qe))},[Bt,Qi]),yt=C.useCallback((L,j)=>{const O=Re.current,H=Ue.current;if(!O||!H)return;if(!Ta.current){Bt("refresh skipped: renderer not ready",{reason:L});return}if(j.dedupeKey!==void 0){if(Aa.current.get(L)===j.dedupeKey){Bt("refresh deduped",{reason:L,dedupeKey:j.dedupeKey});return}Aa.current.set(L,j.dedupeKey)}Bt("refresh",{reason:L,options:j});const Qe=j.forceRendererRecreate===!0||tt.current||At&&!!ne.current&&ck.has(L)&&/Android/i.test(navigator.userAgent);let ke=!1;Qe&&(tt.current=!1,At?(ji(`refresh:${L}`),Bi(O,`refresh:${L}`)||di(`refresh:${L}:webgl-fallback`),ke=!0):(di(`refresh:${L}`),ke=!0)),sL(j.forceRedraw===!0,L==="dpr-change",ke)?di(`refresh:${L}`):ke||Bt("terminal redraw skipped: fit/write already repaints",{reason:L});const st={cols:O.cols,rows:O.rows};as(`refresh:${L}`);const ot={cols:O.cols,rows:O.rows};if(j.skipResizePush||eL({before:st,after:ot,lastServerSize:sn.current.confirmed,reconcileServerSize:j.reconcileServerSize})&&yo(ot.cols,ot.rows),!j.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const fr=requestAnimationFrame(()=>{const En=Re.current;if(En&&En.buffer.active.type!=="alternate")try{En.scrollToBottom()}catch{}}),ln=Ws.current,On=ln.get(L);On!==void 0&&cancelAnimationFrame(On),ln.set(L,fr)}},[Bt,At,ji,Bi,di,as,yo]),Tt=C.useCallback((L,j={})=>{if(Re.current,L==="session-key-change"&&(sn.current=ip(),ms(),Ua(),ta.current=g2(),Aa.current.clear(),rs()),!j.force&&(L==="visibility"||L==="bfcache"||L==="online")){const H=Date.now();if(H-bo.current<Hs){Bt("refresh throttled",{reason:L});return}bo.current=H}if(hi.current.set(L,j),Ws.current.has(L))return;const O=requestAnimationFrame(()=>{const H=hi.current.get(L)??{};Ws.current.delete(L),hi.current.delete(L),yt(L,H)});Ws.current.set(L,O)},[Bt,rs,ms,Ua,yt]),Oe=C.useCallback(L=>{const j=Ws.current.get(L);if(j===void 0)return;const O=hi.current.get(L)??{};cancelAnimationFrame(j),Ws.current.delete(L),hi.current.delete(L),yt(L,O)},[yt]);_i.current=()=>Oe("resize"),C.useEffect(()=>()=>{rs(),Yt.current!==null&&(window.clearTimeout(Yt.current),Yt.current=null)},[e,rs]),C.useEffect(()=>{sn.current=ip(),ms(),Aa.current.clear()},[e,ms]);const _t=C.useCallback(()=>{if(re.current)return;const L=Re.current;if(!L){Yn();return}if(!ye.current)return;const j=ye.current,O=j.length,H=je.current,Qe=ae.current;ye.current="",je.current=null,ae.current=!1,re.current=!0;let ke=null;Qe&&(ke=De.current??{depth:0},De.current=ke,ke.depth+=1);const st=we.current,ot=st?.generation;L.write(j,()=>{if(ke&&(ke.depth-=1),ot!==void 0&&st?.written(ot),re.current=!1,et.current-=O,et.current<0&&(et.current=0),H!==null&&se.current?.(H),ht.current&&et.current<dk&&(ht.current=!1,be.current?.(!1)),ye.current){_t();return}const zt=++ct.current,fr=()=>{if(zt!==ct.current||re.current||ye.current)return;const ln=L.buffer.active;Se.current?.({x:ln.cursorX,y:ln.cursorY,rows:L.rows,lastProcessedChunkId:me.current})};typeof window>"u"?fr():window.requestAnimationFrame(()=>{window.requestAnimationFrame(fr)})})},[Yn]);gt.current=_t;const hr=C.useCallback(()=>{if(te.current!==null)return;const L=++ve.current;te.current=L,queueMicrotask(()=>{te.current===L&&(te.current=null,_t())})},[_t]),Fr=C.useCallback((L,j,O=!1)=>{if(!L)return;ct.current+=1,ye.current+=L,je.current=j,ae.current=ae.current||O,et.current+=L.length;const H=mt.current;(H===null||j>H)&&(mt.current=j),!ht.current&&et.current>=uk&&(ht.current=!0,be.current?.(!0)),hr()},[hr]);return C.useEffect(()=>{let L=!1,j=null,O=null,H=[];const Qe=qe.current;return Qe?(Qe.tabIndex=Q?-1:0,(async()=>{if(Me.current?.(!1),Ve("loading"),an(null),fs(!0),await pk(),!L)try{const st=gk(Qe,k2(Zr),nn,ss,$),ot=new Zw({...st?{cols:st.cols,rows:st.rows}:{},allowProposedApi:!0,fontFamily:k2(Zr),fontSize:nn,fontWeight:I2(zn),fontWeightBold:I2(jn),theme:mk(U),logLevel:"off",cursorBlink:!At,cursorStyle:"block",cursorInactiveStyle:Be.current?"bar":"none",scrollback:h?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:pT(Dr,vt),convertEol:Mr,drawBoldTextInBrightColors:He,rescaleOverlappingGlyphs:xt,minimumContrastRatio:Te,letterSpacing:ss,lineHeight:$,smoothScrollDuration:lt&&!Z.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),zt=new Kw;ot.loadAddon(zt),ot.loadAddon(new nS),ot.registerLinkProvider(WL(ot,(kr,Cn)=>{pt.current?.(kr,Cn)}));const fr=new uS;ot.loadAddon(fr),ot.unicode.activeVersion=Ke,ot.loadAddon(new bS({highlightLimit:1e3}));const ln=new TS;ot.loadAddon(ln),K.current=ln,ot.loadAddon(new z_);try{ot.loadAddon(new SS(void 0,new i3))}catch(kr){Bt("clipboard addon skipped",{error:kr})}j=ot,Re.current=ot,Ue.current=zt,jt.current=typeof window<"u"?window.devicePixelRatio:1,ot.open(Qe),we.current=iL(ot),Qt&&ot.loadAddon(new U_({fontFeatureSettings:gL,fallbackLigatures:xL}));try{const kr=ot._core;kr?.coreService&&(kr.coreService.isCursorInitialized=!0),ot.refresh(0,ot.rows-1)}catch{}At?(Bi(ot,"init"),Ta.current=!0):(Bt("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:Q,mode:Dr}),Ta.current=!0),fs(!1),Er();const On=kr=>{if(kr.ctrlKey||kr.metaKey){kr.preventDefault();const Cn=kr.deltaY>0?-1:1;th(t,nn+Cn)}};if(Ge.current=On,Qe.addEventListener("wheel",On,{passive:!1}),!Q){let kr=0,Cn=null,Ln=null,Vs=null;const La=()=>{Vs=null,_i.current();const ds=ac(Re.current,nn,$),ql=It.current+kr;kr=0;const Ss=Math.trunc(ql/ds);if(It.current=ql-Ss*ds,Ss!==0){const Bo=Ss>0?"down":"up",Tl=Re.current,_c=Math.max(3,Math.floor((Tl?.rows??24)/2)),ki=Math.abs(Ss);ki>_c&&(It.current=0),ui.current(Bo,Math.min(ki,_c),Cn??void 0,Ln??void 0)}};ot.attachCustomWheelEventHandler(ds=>{if(ds.ctrlKey||ds.metaKey||ds.shiftKey)return!0;if(ds.deltaY===0)return!1;if(!Re.current||!Fs.current)return!0;const Ss=ac(Re.current,nn,$);let Bo=ds.deltaY;return ds.deltaMode===1?Bo=ds.deltaY*Ss:ds.deltaMode===2&&(Bo=ds.deltaY*(Qe.clientHeight||Ss*20)),kr+=Bo,Cn=ds.clientX,Ln=ds.clientY,Vs===null&&(Vs=requestAnimationFrame(La)),ds.preventDefault(),!1})}const En=lk(Qe);if(En?(En.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),oe.current=En,br()):oe.current=null,Tt("mount",{skipResizePush:!0,skipScrollToBottom:!0}),W.current&&(Q?ot.focus():kt.current?.focus({preventScroll:!0})),Q||Nt.current(),H.push(ot.onRender(()=>{const kr=ot.buffer.active;Ye.current?.({x:kr.cursorX,y:kr.cursorY,rows:ot.rows}),Q||Nt.current()})),!Q){try{const kr=ot.textarea;if(kr){kr.tabIndex=-1,kr.setAttribute("aria-hidden","true"),kr.setAttribute("readonly",""),kr.value="";const Cn=()=>{kt.current?.focus({preventScroll:!0})};kr.addEventListener("focus",Cn),H.push({dispose:()=>kr.removeEventListener("focus",Cn)})}}catch{}try{H.push(ot.onCursorMove(()=>Nt.current())),H.push(ot.onResize(()=>Nt.current()))}catch{}}H.push(ot.onData(kr=>{const Cn=De.current;Cn!==null&&Cn.depth>0||Le.current(kr)}));const Gn=kr=>{const Cn=typeof window<"u"?window.devicePixelRatio:1,Ln=Math.abs(Cn-jt.current)>.001;return Ln&&(jt.current=Cn,Bt("device pixel ratio changed",{value:Cn,source:kr})),Ln};if(O=new ResizeObserver(kr=>{if(!tL(!!wt.current,yr.current)){Bt("resize observer skipped: hidden mobile session");return}Dt.current=void 0;const Cn=kr[0];Cn&&Bt("resize observer",{width:Math.round(Cn.contentRect.width),height:Math.round(Cn.contentRect.height)});const Ln=Gn("resize-observer");Tt(Ln?"dpr-change":"resize")}),O.observe(Qe),typeof window<"u"){const kr=()=>{Gn("window-resize")&&Tt("dpr-change")};window.addEventListener("resize",kr),H.push({dispose:()=>window.removeEventListener("resize",kr)});const Cn=window.visualViewport;if(Cn){const Ln=()=>{Gn("visual-viewport-resize")&&Tt("dpr-change")};Cn.addEventListener("resize",Ln),H.push({dispose:()=>Cn.removeEventListener("resize",Ln)})}}as("init-fit"),Ve("ready"),Me.current?.(!0)}catch(st){console.error("Failed to initialize terminal:",st),fs(!1),Ve("error"),an(st instanceof Error?st.message:"Failed to load terminal")}})(),()=>{Me.current?.(!1),L=!0,Ee.current?.(!1),ft.current?.(),ft.current=null,Et.current=!1,Jt.current!==null&&(clearTimeout(Jt.current),Jt.current=null),dr.current=!1,Tn.current=null,tr(),jr({active:!1,text:""});for(const st of H)st.dispose();O?.disconnect(),Ge.current&&(Qe.removeEventListener("wheel",Ge.current),Ge.current=null),we.current?.dispose(),we.current=null,ji("component-unmount"),j?.dispose(),Re.current=null,Ue.current=null,oe.current=null,Yn({notifyFlowResume:!0}),ms(),Ua()}):void 0},[as,Zr,nn,zn,jn,ss,$,Te,He,Ke,Je,xt,Qt,vt,lt,U,Yn,tr,Q,Bi,ji,Bt,ms,Ua]),C.useEffect(()=>{const L=Re.current;L&&(L.options.smoothScrollDuration=lt&&!he?125:0)},[lt,he,pe]),C.useEffect(()=>{const L=Re.current;L&&(L.options.cursorInactiveStyle=ze?"bar":"none",ze||L.blur())},[ze,pe]),C.useEffect(()=>{const L=Re.current;if(L){if(At){if(L.options.cursorBlink=!1,Bi(L,"renderer-mode-change")&&vt&&!xr.current)try{L.loadAddon(new r_({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),xr.current=!0}catch(O){Bt("image addon skipped",{error:O})}return}L.options.cursorBlink=!0,ji("renderer-mode-change")&&(di("renderer-mode-change:webgl-disabled"),as("renderer-mode-change:webgl-disabled"))}},[At,vt,Bi,ji,di,as,Bt]),C.useEffect(()=>{const L=Re.current;L&&(me.current!==null&&L.reset(),Yn(),We.current="",Lr.current=0,kt.current&&(kt.current.value=""),Tt("session-reset",{skipScrollToBottom:!0}),W.current&&(wt.current?L.focus():kt.current?.focus({preventScroll:!0})))},[e,pe,Tt,Yn]),C.useEffect(()=>{if(!Q||typeof document>"u")return;let L=null;const j=()=>{L=null;const H=kt.current;if(!H||document.activeElement!==H||Et.current)return;const Qe=We.current,ke=Y0(H.value);if(ke!==Qe||ke.includes("\r")||!Ft())return;const st=Math.min(w2(H),Array.from(ke).length),ot=st-Lr.current;if(ot===0)return;const zt=Re.current,fr=ot<0?(zt?Qd(zt,"D"):"\x1B[D").repeat(-ot):(zt?Qd(zt,"C"):"\x1B[C").repeat(ot);Le.current(fr),Lr.current=st},O=()=>{L===null&&(L=requestAnimationFrame(j))};return document.addEventListener("selectionchange",O),()=>{document.removeEventListener("selectionchange",O),L!==null&&cancelAnimationFrame(L)}},[Q,Ft]),C.useEffect(()=>{if(!Q)return;const L=Oa();return ft.current=L,()=>{L(),ft.current=null}},[Q,Oa]),C.useEffect(()=>{const L=Re.current;if(L)try{L.options.scrollback=h?0:1e3}catch{}},[h,pe]),C.useEffect(()=>{const L=Re.current;if(!L)return;if(n.length===0){me.current!==null&&(L.reset(),Yn(),Tt("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const j=me.current;let O,H=!1;if(j===null)O=n;else{const Qe=n.findIndex(ke=>ke.id===j);Qe>=0?O=n.slice(Qe+1):(O=n,H=!0)}if(O.length>0){const Qe=O.map(ln=>ln.data).join(""),ke=Ir.current+Qe,{cleaned:st,remainder:ot}=ok(ke);Ir.current=ot;const zt=mt.current,fr=zt!==null&&(O[0].id<=zt||H);st?Fr(st,O[O.length-1].id,fr):se.current?.(O[O.length-1].id)}me.current=n[n.length-1].id},[n,pe,Fr,Tt,Yn]),C.useImperativeHandle(de,()=>({serializeSnapshot:()=>Re.current?K.current?.serialize({scrollback:100})??null:null,focus:()=>{if(wt.current){oi();return}kt.current?.focus({preventScroll:!0})},blur:()=>{const L=kt.current;is(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),wt.current&&L?.setAttribute("readonly",""),Ee.current?.(!1)},clear:()=>{const L=Re.current;L&&(L.reset(),Yn(),Tt("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Yn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=Re.current;if(!L)return!1;const j=L.hasSelection()?L.getSelection():xk(L),O=await N2(j);return O&&L.hasSelection()&&Mt(),O},pasteClipboardText:async()=>{xe();const L=await ur(kt.current);return Pa.current?.(L),L},sendSequence:(L,j)=>Ae(L,null,j),getDimensions:()=>{const L=Re.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:Tt,setSessionReady:L=>{fi.current=L,L||(we.current?.cancel(),ms(),sn.current=uL(sn.current),Gs.current=null,ea.current=-1,Ze.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const ke=m2(sn.current,L.seq);if(!ke.request&&!ke.exhausted)return;ms(),sn.current=ke.state,ke.request&&fi.current?Sa.current(ke.request):ke.exhausted&&we.current?.cancel();return}const j=lL(sn.current,L);if(!j.accepted)return;ms(),sn.current=j.state,Bt("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const O=Re.current,H=j.state.confirmed;if(!!!(O&&H&&O.cols===H.cols&&O.rows===H.rows)){Ze.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){Gs.current=L.screenSyncGeneration;const ke=ea.current>=L.screenSyncGeneration;Ze.current?.(ke),ke&&(Gs.current=null);return}Gs.current=null,Ze.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;ea.current=Math.max(ea.current,L);const j=Gs.current;if(j===null||L<j)return;Gs.current=null;const O=Re.current,H=sn.current.confirmed;Ze.current?.(!!(O&&H&&O.cols===H.cols&&O.rows===H.rows))},notifyServerSize:ie,ensureSizeMatches:Fe,requestPtyRedraw:()=>{const L=Re.current;if(!L||!fi.current||sn.current.pending||Gs.current!==null)return;const j=oL(sn.current,{cols:L.cols,rows:L.rows});sn.current=j.state,Sa.current(j.request)}}),[Q,is,oi,Yn,ur,Ae,Tt,ms,Bt,Qi,ie,Fe]),i.jsxs("div",{ref:qe,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${G||""}`,style:{backgroundColor:U.background,touchAction:Rn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Qa,onPointerMoveCapture:Ci,onPointerUpCapture:ho,onPointerCancelCapture:pa,onTouchStartCapture:L=>{if(ks(L.target)){xe(),vn(Z0);return}cs(),vn(Z0)},onTouchMoveCapture:()=>vn(Z0),onTouchEndCapture:()=>vn(K0),onTouchCancelCapture:()=>vn(K0),onMouseDown:L=>{Q||L.button===0&&(Yt.current!==null&&(window.clearTimeout(Yt.current),Yt.current=null),requestAnimationFrame(()=>{try{kt.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{Q||L.button===0&&(Yt.current!==null&&window.clearTimeout(Yt.current),Yt.current=window.setTimeout(()=>{Yt.current=null;try{kt.current?.focus({preventScroll:!0})}catch{}},0))},children:[Nr&&i.jsx("button",{type:"button",role:"alert",onClick:()=>Ar(null),className:"absolute bottom-2 left-2 right-2 z-20 rounded-md border border-border bg-surface-2 px-3 py-2 text-left text-sm text-foreground",children:Nr}),Mn&&i.jsxs("button",{type:"button","data-terminal-copy-popover":"true",className:"absolute z-30 inline-flex h-9 w-[88px] select-none items-center justify-center gap-1.5 rounded-full border border-white/15 bg-[rgb(28_28_30_/_0.92)] px-3 text-[13px] font-semibold text-white shadow-[0_10px_28px_rgb(0_0_0_/_0.32),0_2px_8px_rgb(0_0_0_/_0.18)] backdrop-blur-xl transition-transform duration-100 ease-out active:scale-[0.96]",style:{left:Mn.left,top:Mn.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{xe(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),ga()},onTouchStart:L=>{xe(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),ga()},onClick:L=>{L.preventDefault(),L.stopPropagation(),ga()},children:[i.jsx(D7,{size:14,strokeWidth:2.4}),i.jsx("span",{children:$e("common.copy")})]}),$r?.start&&i.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:$r.start.left,top:$r.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:i.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[i.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),i.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),$r?.end&&i.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:$r.end.left,top:$r.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:i.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[i.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),i.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),Xr&&Rr&&i.jsx(kL,{}),Xr&&fe==="loading"&&!Rr&&i.jsx(v3,{}),fe==="error"&&i.jsx(IL,{message:nr||void 0,onRetry:()=>{window.location.reload()}}),fe==="ready"&&i.jsxs(i.Fragment,{children:[i.jsx("textarea",{ref:kt,"aria-label":$e("terminal.input"),"data-terminal-input-anchor":"true",inputMode:"text",enterKeyHint:"enter",autoCapitalize:"off",autoComplete:"nope",autoCorrect:"off",spellCheck:!1,tabIndex:-1,style:{position:"absolute",opacity:0,zIndex:20,background:"transparent",color:"transparent",caretColor:"transparent",resize:"none",overflow:"hidden",border:"none",padding:0,margin:0,outline:"none",...Q?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=er.x,j=er.y,O={position:"fixed",left:L,top:j,pointerEvents:"none",touchAction:"auto",fontSize:`${nn}px`,fontFamily:Zr,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(er.cellW)),height:Math.max(1,Math.round(er.cellH))};if(!Yr.active)return O;const H=Pn(Yr.text);return{...O,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:H.width,height:H.height,whiteSpace:H.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{Bt("input anchor focus"),Dt.current=void 0,Nt.current(),Tt("focus",{skipResizePush:!0,skipScrollToBottom:!0}),Ee.current?.(!0)},onBlur:L=>{Q||is(L.currentTarget);const j=fa(),O=typeof document<"u"?document.activeElement:null;if(Bt("input anchor blur",{guarded:j,activeTag:O?.tagName??null,activeClass:O?.className??null}),!j){Q&&kt.current?.setAttribute("readonly",""),Ee.current?.(!1);return}if(typeof window>"u"){Ee.current?.(!1);return}window.setTimeout(()=>{Ht()||Ft()||(Q&&kt.current?.setAttribute("readonly",""),Ee.current?.(!1))},K0)},onBeforeInput:L=>{if(Et.current)return;const j=L.nativeEvent;if(j instanceof InputEvent){if(j.inputType==="insertFromPaste"||j.inputType==="insertFromPasteAsQuotation"){const O=j.dataTransfer?.getData("text/plain")||j.data;if(O){L.preventDefault();const H=_e(O,L.currentTarget);Q&&Pa.current?.(H)}return}if(j.inputType==="insertLineBreak"){if(dr.current){dr.current=!1,Jt.current!==null&&(clearTimeout(Jt.current),Jt.current=null),L.preventDefault();return}L.preventDefault(),P(L.currentTarget);return}if(j.inputType==="deleteContentBackward"||j.inputType==="deleteContentForward"||j.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),Le.current("");return}if(j.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Le.current("");return}return}}},onInput:L=>{if(Et.current)return;const j=L.nativeEvent,O=K_(We.current,Y0(L.currentTarget.value),j.inputType);if(O){const H=_e(O,L.currentTarget);Q&&Pa.current?.(H);return}yn(L.currentTarget)},onPaste:L=>{const j=L.clipboardData.files.length?Array.from(L.clipboardData.files):Array.from(L.clipboardData.items).filter(ke=>ke.kind==="file").map(ke=>ke.getAsFile()).filter(ke=>ke!==null),O=L.clipboardData.getData("text/plain");if(window.termdockDesktop?.readClipboardFiles){L.preventDefault(),ur(L.currentTarget,{files:j,text:O});return}if(j.length&&(j.length>1||!j[0].type.startsWith("image/"))){L.preventDefault(),bt(j,L.currentTarget);return}const H=j[0];if(H){L.preventDefault(),at(H,L.currentTarget);return}if(!O){(window.termdockDesktop||typeof navigator.clipboard?.read=="function")&&(L.preventDefault(),ur(L.currentTarget));return}L.preventDefault();const Qe=_e(O,L.currentTarget);Q&&Pa.current?.(Qe)},onKeyDown:L=>{const j=ik(L);if(!j&&!Et.current){if(L.getModifierState("AltGraph"))return;const O=Re.current,H=L.metaKey,Qe=L.ctrlKey,ke=L.altKey,st=L.shiftKey,ot=L.key;if(H&&!Qe&&!ke&&!st&&ot==="Enter"){L.preventDefault(),P(L.currentTarget);return}if((H||Qe)&&!ke&&!st&&(ot==="v"||ot==="V"))return;if(H&&!Qe&&!ke&&!st&&(ot==="c"||ot==="C")){L.preventDefault();const fr=O?.hasSelection()?O.getSelection():"";fr&&navigator.clipboard?.writeText(fr).catch(()=>{});return}if((H||Qe)&&!ke&&!st&&(ot==="k"||ot==="K")){L.preventDefault(),O&&(O.reset(),Yn(),Tt("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",We.current="",Lr.current=0;return}if(H&&!Qe&&!ke&&!st&&ot==="Backspace"){L.preventDefault(),Ae("",L.currentTarget);return}if(H&&!Qe&&!ke&&!st&&ot==="Delete"){L.preventDefault(),Ae("\v",L.currentTarget);return}if(H&&!Qe&&!ke&&!st&&ot==="ArrowLeft"){L.preventDefault(),Ae("",L.currentTarget);return}if(H&&!Qe&&!ke&&!st&&ot==="ArrowRight"){L.preventDefault(),Ae("",L.currentTarget);return}if(H)return;if(ke&&!Qe&&!H&&!st&&ot==="Backspace"){L.preventDefault(),Ae("\x1B",L.currentTarget);return}if(ke&&!Qe&&!H&&!st&&ot==="Delete"){L.preventDefault(),Ae("\x1Bd",L.currentTarget);return}if(ke&&!Qe&&!H&&!st&&ot==="ArrowLeft"){L.preventDefault(),Ae("\x1Bb",L.currentTarget);return}if(ke&&!Qe&&!H&&!st&&ot==="ArrowRight"){L.preventDefault(),Ae("\x1Bf",L.currentTarget);return}const zt=zT(L,O?.modes?.applicationCursorKeysMode===!0);if(zt!==null){L.preventDefault(),Ae(zt,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(j||Et.current){L.preventDefault();return}if(dr.current){dr.current=!1,Jt.current!==null&&(clearTimeout(Jt.current),Jt.current=null),L.preventDefault();return}L.preventDefault(),P(L.currentTarget);return}if(L.key==="Backspace"){if(j||Et.current)return;if(!L.currentTarget.value){L.preventDefault(),Le.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Le.current("");return}}},onCompositionStart:()=>{Et.current=!0,xs(),jr({active:!0,text:""})},onCompositionUpdate:L=>{Et.current=!0;const j=L.data??L.currentTarget.value;jr(O=>O.active&&O.text===j?O:{active:!0,text:j})},onCompositionEnd:L=>{Et.current=!1,dr.current=!0,Jt.current!==null&&clearTimeout(Jt.current),Jt.current=setTimeout(()=>{dr.current=!1,Jt.current=null},50),jr({active:!1,text:""}),yn(L.currentTarget),Di()}}),Yr.active&&(()=>{const L=Pn(Yr.text);return i.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:er.x,top:er.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:U.foreground,background:U.background,boxShadow:`-1px 0 0 1px ${U.background}`,fontSize:`${nn}px`,fontFamily:Zr,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:U.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:Yr.text})})(),i.jsx("div",{"aria-hidden":!0,className:`absolute left-1/2 -translate-x-1/2 top-6 z-30 pointer-events-none
65
+ rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
66
+ shadow-lg transition-all duration-150 ease-out`,style:{opacity:mn?1:0,transform:mn?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),i.jsx("div",{ref:rn,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:Rn.visible?1:0,transform:Rn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:Rn.visible&&(()=>{const{activeDir:L}=Rn,j=O=>L===O;return i.jsxs("div",{className:"flex flex-col items-center gap-0.5 rounded-xl bg-[var(--overlay-background)] backdrop-blur-sm shadow-lg px-1.5 py-1.5",children:[i.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),i.jsxs("div",{className:"flex items-center gap-0.5",children:[i.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),i.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),i.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),i.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${j("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});A3.displayName="TerminalViewport";const yk=A3,vk=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},wk=()=>({async createSession(e){return $7(e)},connect(e,t,r){const n=F7(e,t.onEvent,t.onError,{...vk(r),getDimensions:r?.getDimensions});return{close:()=>n()}},async sendInput(e,t){await cb(e,t)},async resize(e){await O7(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await lb(e)},async restartSession(e,t){return P7(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await Q7(e)},async tmuxAction(e,t){return B7(e,t)},async listTmuxSessions(){return Wp()},async getTmuxStatus(){return Hp()},async checkHealth(e){return j7(e)}}),Ak="\x1B",Tk=/\x1b\[[IO]/g,Ck=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,Sk=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function M2(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function _k(e){const t=e.replace(Tk,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let n=M2(Ck,t,r);if(n<0&&(n=M2(Sk,t,r)),n<0&&t.startsWith("\x1B[M",r)&&t.length>=r+6&&(n=r+6),n<0)return!1;r=n}return!0}function Lk(e){return e===Ak}function fm(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const bu=15;function kk(){return T3.map(e=>e.id)}const T3=[{id:"default",label:"Base",programs:[],includeAlt:!0,rowLayout:[3,3,3],actions:[],showOnDesktop:!1},{id:"opencode",label:"Code",programs:["opencode"],includeAlt:!1,rowLayout:[6],actions:[{id:"opencode-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo||\r"},{id:"opencode-new",label:"/new",sequence:"/new",doubleTapSequence:"/new||\r"},{id:"opencode-models",label:"/models",sequence:"/models",doubleTapSequence:"/models||\r"},{id:"opencode-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact||\r"}],showOnDesktop:!0},{id:"claude",label:"Claude",programs:["claude","claude-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"claude-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"claude-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"claude-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"}],showOnDesktop:!0},{id:"kimi",label:"Kimi",programs:["kimi","kimi-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"kimi-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"kimi-new",label:"/new",sequence:"/new",doubleTapSequence:"/new\r"},{id:"kimi-sessions",label:"/sessions",sequence:"/sessions",doubleTapSequence:"/sessions\r"},{id:"kimi-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"kimi-goal",label:"/goal",sequence:"/goal",doubleTapSequence:"/goal\r"}],showOnDesktop:!0},{id:"codex",label:"Codex",programs:["codex"],includeAlt:!1,rowLayout:[6],actions:[{id:"codex-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"codex-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"codex-model",label:"/model",sequence:"/model",doubleTapSequence:"/model\r"},{id:"codex-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"codex-resume",label:"/resume",sequence:"/resume",doubleTapSequence:"/resume\r"}],showOnDesktop:!0},{id:"coco",label:"Coco",programs:["coco"],includeAlt:!1,rowLayout:[6],actions:[{id:"coco-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"coco-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"coco-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"coco-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0},{id:"traex",label:"TraeX",programs:["traex","traecli"],includeAlt:!1,rowLayout:[6],actions:[{id:"traex-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"traex-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"traex-compact",label:"/compact",sequence:"/||compact ",doubleTapSequence:"/||compact ||\r"},{id:"traex-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"traex-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0}];function Ou(){return T3.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function e1(e){const t=Array.isArray(e)?e.map(r=>Math.min(20,Math.max(2,Math.floor(r)))).filter(r=>Number.isFinite(r)):[];return t.length>0?t:[3,3]}function C3(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const t1=/^\/(.+)\/([gimsuy]*)$/;function D2(e){return t1.test(e.trim())}function Rh(e){const t=e.trim().match(t1);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function S3(e){if(typeof e!="string")return null;const t=e.trim();return t?t1.test(t)?Rh(t)?t:null:t.toLowerCase():null}function j2(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\r/g,"\r").replace(/\\n/g,`
67
+ `).replace(/\\t/g," ")}const B2="||",Ik=120;function Ek(e){return e.includes(B2)?e.split(B2).filter(t=>t.length>0):[e]}function Kc(e){const t=new Set,r=e.map((a,l)=>{const c=typeof a.id=="string"&&a.id.trim().length>0?a.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${l+1}`,h=t.has(c)?`${c}-${l+1}`:c;return t.add(h),{id:h,label:typeof a.label=="string"&&a.label.trim().length>0?a.label.trim():"Preset",programs:Array.isArray(a.programs)?a.programs.map(p=>S3(p)).filter(p=>!!p):[],includeAlt:typeof a.includeAlt=="boolean"?!!a.includeAlt:!1,rowLayout:e1(a.rowLayout),showOnDesktop:typeof a.showOnDesktop=="boolean"?!!a.showOnDesktop:!1,actions:Array.isArray(a.actions)?a.actions.map((p,g)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${h}-action-${g+1}`,label:typeof p.label=="string"?p.label:`Key ${g+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(a=>a.id!=="auto"),n=Ou()[0];return n&&!r.some(a=>a.id==="default")&&r.unshift(n),r}function Nk(e,t){const r=C3(e);if(!r)return"default";for(const n of t)if(n.id!=="default")for(const a of n.programs){const l=Rh(a);if(l){if(l.test(r))return n.id}else if(r.includes(a))return n.id}return"default"}function Q2(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??Ou()[0]}function Rk(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function Mk(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.id==="default"||t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function _3(e,t){const r=e1(t),n=[];let a=0,l=0;for(;a<e.length;){const c=r[Math.min(l,r.length-1)]??3;n.push({columns:c,items:e.slice(a,a+c)}),a+=c,l+=1}return n}const L3=28,k3=({mode:e,presetLabel:t,title:r,ariaLabel:n,disabled:a,onPointerDown:l,buttonRef:c})=>i.jsx("button",{ref:c,type:"button",onPointerDown:l,tabIndex:-1,disabled:a,className:"h-7 w-7 rounded-full bg-surface-2 shadow-sm text-[11px] font-medium active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",title:r,"aria-label":n??r,children:e==="auto"?i.jsx(hT,{size:14}):(t.charAt(0)||"?").toUpperCase()}),Dk={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},J0=8;function jk(e,t){return Dk[e]??null}const Bk=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:n,lockedModifier:a,disabled:l,defaultShowExtended:c=!1,presetLabel:h,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:y,presetRowLayout:A,extraActions:w,onKeyPress:k,onTextPress:E,onPastePress:I,onFilePress:M,onFileLongPress:B,fileUploadState:F="idle",fileUploadProgress:U=0,longPressMode:G="arrows",copyFeedback:Q="idle",onLongPressModeToggle:X,onModifierToggle:ee,onPresetSelect:ze,onExpandedChange:he})=>{const{t:de}=Qr(),[$e,qe]=C.useState(c),[oe,Re]=C.useState(!1),K=C.useRef(null),we=r==="desktop-actions",Z=we||$e,[Ue,Le]=C.useState(!1),[Y,Ee]=C.useState(null),be=l||!e||!t,Me=l||!e,Ze=C.useRef(null),Se=C.useRef(null),se=C.useRef(null),Ye=C.useRef(null),pt=C.useRef(null),rt=C.useRef(Q),ye=C.useRef(null),et=C.useRef(0),ht=C.useRef(null),te=C.useRef(!1),ve=C.useCallback(Xe=>{if(be)return;const Pt=Xe.target;if(!(Pt instanceof Element))return;const Ge=Pt.closest("button"),It=Ge?.hasAttribute("data-mobile-native-action")===!0;Ge&&!It?(Xe.preventDefault(),ao(J0)):Ge&&ao(J0)},[be]),ct=C.useCallback(Xe=>{Xe.preventDefault()},[]),re=C.useCallback(Xe=>{const Pt=Xe.target;be||Pt instanceof HTMLElement&&Pt.closest("button")&&Pt.blur()},[be]);C.useEffect(()=>{qe(c)},[c]),C.useEffect(()=>{we||he?.($e)},[we,he,$e]),C.useEffect(()=>{be&&(ye.current!==null&&(window.clearTimeout(ye.current.timer),ye.current=null),Le(!1),Ee(null))},[be]),C.useEffect(()=>{e||(Le(!1),Ee(null))},[e]),C.useEffect(()=>{if(!Ue)return;const Xe=()=>{const Pt=Ze.current?.getBoundingClientRect();Pt&&Ee({left:Math.max(8,Pt.left),top:Math.max(8,Pt.top-8)})};return Xe(),window.addEventListener("resize",Xe),window.addEventListener("scroll",Xe,!0),()=>{window.removeEventListener("resize",Xe),window.removeEventListener("scroll",Xe,!0)}},[Ue]),C.useEffect(()=>{const Xe=rt.current;if(rt.current=Q,Q==="idle"||Q===Xe)return;if(pt.current!==null&&window.clearTimeout(pt.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(Q==="copied"){Se.current?.animate?.([{transform:"scale(1)"},{transform:"scale(1.16)",offset:.28},{transform:"scale(0.96)",offset:.62},{transform:"scale(1)"}],{duration:720,easing:"cubic-bezier(0.16, 1, 0.3, 1)"});const Ge=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];se.current?.animate?.(Ge,{duration:760,easing:"ease-out"}),Ye.current?.animate?.(Ge,{duration:760,delay:130,easing:"ease-out"})}else Se.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});ao(J0),Q==="copied"&&(pt.current=window.setTimeout(()=>{ao(J0),pt.current=null},90),G==="copy"&&X?.())},[Q,G,X]),C.useEffect(()=>()=>{pt.current!==null&&window.clearTimeout(pt.current)},[]);const me=C.useCallback((Xe,Pt)=>{be||(Xe.preventDefault(),k(Pt))},[k,be]),je=C.useCallback((Xe,Pt)=>{be||(Xe.preventDefault(),ee(Pt))},[ee,be]),mt=C.useCallback(Xe=>{be||(Xe.preventDefault(),qe(Pt=>{const Ge=!Pt;return Ge&&(Re(!0),K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{Re(!1),K.current=null},350)),Ge}))},[be]),ae=C.useCallback(()=>{const Xe=typeof performance<"u"?performance.now():Date.now();Xe-et.current<350||(et.current=Xe,I?.())},[I]),De=C.useCallback(Xe=>{be||(Xe.stopPropagation(),Xe.pointerType!=="touch"&&(Xe.preventDefault(),ae()))},[be,ae]),gt=C.useCallback(Xe=>{be||(Xe.preventDefault(),Xe.stopPropagation(),ae())},[be,ae]),ft=C.useCallback(Xe=>{be||F==="uploading"||!M||(Xe.preventDefault(),Xe.stopPropagation(),te.current||M(),te.current=!1)},[F,M,be]),kt=C.useCallback(()=>{ht.current!==null&&window.clearTimeout(ht.current),ht.current=null},[]),Dt=C.useCallback(Xe=>{Xe.stopPropagation(),!(be||F==="uploading"||!B)&&(te.current=!1,ht.current=window.setTimeout(()=>{ht.current=null,te.current=!0,ao(J0),B()},500))},[F,B,be]);C.useEffect(()=>()=>kt(),[kt]);const Yt=C.useCallback(Xe=>{be||Xe.stopPropagation()},[be]),xr=250,rr=C.useCallback(()=>{ye.current!==null&&(window.clearTimeout(ye.current.timer),ye.current=null)},[]);C.useEffect(()=>()=>{rr(),K.current!==null&&(window.clearTimeout(K.current),K.current=null)},[rr]);const Ir=C.useCallback((Xe,Pt)=>{if(be)return;if(Xe.preventDefault(),!Pt.doubleTapSequence){E(Pt.sequence);return}const Ge=ye.current;if(Ge!==null&&Ge.actionId===Pt.id){window.clearTimeout(Ge.timer),ye.current=null,E(Pt.doubleTapSequence);return}rr();const It=window.setTimeout(()=>{ye.current=null,E(Pt.sequence)},xr);ye.current={actionId:Pt.id,timer:It}},[rr,E,be]),ne=C.useCallback(Xe=>{be||(Xe.preventDefault(),Xe.stopPropagation(),X?.())},[X,be]),Ne=C.useCallback(Xe=>{be||Xe.stopPropagation()},[be]),tt=C.useCallback(Xe=>{if(be)return;Xe.preventDefault();const Pt=Xe.currentTarget.getBoundingClientRect();Ee({left:Math.max(8,Pt.left),top:Math.max(8,Pt.top-8)}),Le(Ge=>!Ge)},[be]),jt=C.useCallback((Xe,Pt)=>{be||(Xe.preventDefault(),Le(!1),Ee(null),ze(Pt))},[ze,be]),Et=w.length>0,dr=C.useMemo(()=>{const Xe=[{id:"preset",kind:"preset"}];if(!we&&y&&Xe.push({id:"alt",kind:"alt"}),Et){const Pt=w.map(Ge=>({id:Ge.id,kind:"text",action:Ge}));return Xe.concat(Pt)}return we?Xe.concat([{id:"esc",kind:"key",keyName:"esc"},{id:"ctrl-c",kind:"key",keyName:"ctrl-c"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"},{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"}]):Xe.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[w,Et,y,we]),Jt=C.useMemo(()=>_3(dr,we&&!Et?[6]:A),[dr,Et,we,A]),We=`${we?"space-y-1":"mt-1 space-y-1"}${oe?" pointer-events-none":""}`,Lr=Ue&&Y?Ai.createPortal(i.jsx("div",{className:"fixed z-popover min-w-28 -translate-y-full rounded-2xl bg-surface-elevated p-1.5 shadow-xl border border-border/15",style:{left:Y.left,top:Y.top},children:i.jsx("div",{className:"grid gap-1",children:x.map(Xe=>i.jsx("button",{type:"button",onPointerDown:Pt=>jt(Pt,Xe.id),tabIndex:-1,disabled:Me,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${Xe.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:Xe.label},Xe.id))})}),document.body):null;return i.jsxs(i.Fragment,{children:[Lr,i.jsx("div",{"data-mobile-keyboard":"true",className:`z-chrome select-none overflow-hidden app-chrome-bg transition-all duration-150 ease-out px-1 py-0 ${e?we?"max-h-24":"max-h-40":"max-h-0"} ${e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"} ${t?"":"[&_button]:pointer-events-none"}`,onMouseDownCapture:ve,onPointerDownCapture:ve,onContextMenuCapture:ct,onFocusCapture:re,children:i.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!we&&i.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[i.jsx("button",{type:"button",onPointerDown:Xe=>me(Xe,"esc"),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"Esc"}),i.jsx("button",{type:"button",onPointerDown:Xe=>je(Xe,"ctrl"),tabIndex:-1,disabled:Me,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${a==="ctrl"?"ring-2 ring-accent":""}`,children:i.jsx("span",{className:"font-medium",children:a==="ctrl"?"Ctrl*":"Ctrl"})}),i.jsx("button",{type:"button",onPointerDown:Xe=>me(Xe,"ctrl-c"),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-C"}),i.jsx("button",{type:"button",onPointerDown:Xe=>me(Xe,"ctrl-u"),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-U"}),i.jsxs("button",{type:"button",onPointerDown:Dt,onPointerUp:kt,onPointerCancel:kt,onClick:ft,tabIndex:-1,disabled:Me||!M||F==="uploading",title:F==="uploading"?`${de("rightSidebar.uploading")} ${Math.round(U)}%`:de(F==="inserted"?"rightSidebar.inserted":F==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":de("rightSidebar.insertLocalFile"),className:`relative h-7 w-full overflow-hidden rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center ${F==="inserted"?"bg-primary/15 text-primary":F==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[F==="uploading"&&i.jsx("span",{"aria-hidden":"true","data-file-upload-progress":"true",className:"absolute inset-y-0 left-0 bg-primary/25 transition-[width] duration-150 ease-out",style:{width:`${Math.max(0,Math.min(100,U))}%`}}),i.jsx("span",{className:"relative z-10 flex items-center justify-center",children:F==="uploading"?i.jsx(Nn,{size:15,className:"animate-spin"}):F==="inserted"?i.jsx(Mi,{size:15}):F==="failed"?i.jsx(Kn,{size:15}):i.jsx(F9,{size:15})}),F!=="idle"&&i.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:F==="uploading"?`${de("rightSidebar.uploading")} ${Math.round(U)}%`:de(F==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),i.jsx("button",{type:"button",onPointerDown:()=>E("/"),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"/"}),i.jsx("button",{type:"button",onPointerDown:Xe=>me(Xe,"enter"),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:i.jsx(D9,{size:16})}),i.jsxs("button",{ref:Se,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Ne,onTouchStart:Ne,onClick:ne,tabIndex:-1,disabled:Me,title:de(Q==="copied"?"terminal.copied":Q==="failed"?"terminal.copyFailed":G==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":de(G==="copy"?"terminal.switchLongPressToArrows":"terminal.switchLongPressToCopy"),className:`relative isolate h-7 w-full overflow-visible rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-colors keyboard-button-active disabled:opacity-50 flex items-center justify-center ${Q==="copied"?"bg-primary/15 text-primary":Q==="failed"?"bg-destructive/15 text-destructive":G==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[i.jsx("span",{ref:se,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),i.jsx("span",{ref:Ye,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),i.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[i.jsx(Mi,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${Q==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),i.jsx(Kn,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${Q==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),i.jsx(Ab,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${Q==="idle"&&G==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),i.jsx(hA,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${Q==="idle"&&G==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),Q!=="idle"&&i.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:Q==="copied"?`${de("terminal.copied")} · ${de("terminal.longPressSendsArrows")}`:`${de("terminal.copyFailed")} · ${de("terminal.longPressSelectsText")}`})]}),i.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:De,onPointerUp:Yt,onTouchStart:Yt,onTouchEnd:Yt,onClick:gt,tabIndex:-1,disabled:Me,title:de("terminal.paste"),"aria-label":de("terminal.paste"),className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:i.jsx(S9,{size:15})}),i.jsx("button",{type:"button",onPointerDown:mt,tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:$e?i.jsx(U7,{size:16}):i.jsx(Jo,{size:16})})]}),Z&&i.jsx("div",{className:We,children:Jt.map((Xe,Pt)=>{const Ge=Xe.items[0]?.kind==="preset",It=Math.max(2,Xe.columns),cn=Ge?`${L3}px repeat(${Math.max(1,It-1)}, minmax(0, 1fr))`:`repeat(${It}, minmax(0, 1fr))`;return i.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:cn},children:Xe.items.map(Lt=>Lt.kind==="preset"?i.jsx(k3,{buttonRef:Lt.id==="preset"?Ze:void 0,mode:g,presetLabel:h,title:p,disabled:Me,onPointerDown:tt},Lt.id):Lt.kind==="alt"?i.jsx("button",{type:"button",onPointerDown:Vr=>je(Vr,"alt"),tabIndex:-1,disabled:Me,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${a==="alt"?"ring-2 ring-accent":""}`,children:i.jsx("span",{className:"font-medium",children:a==="alt"?"Alt*":"Alt"})},Lt.id):Lt.kind==="text"?i.jsxs("button",{type:"button",onPointerDown:Vr=>Ir(Vr,Lt.action),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm px-1 text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 relative",children:[Lt.action.label,Lt.action.doubleTapSequence&&i.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},Lt.id):i.jsx("button",{type:"button",onPointerDown:Vr=>me(Vr,Lt.keyName),tabIndex:-1,disabled:Me,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:Lt.keyName==="esc"?"Esc":Lt.keyName==="ctrl-c"?"Ctrl-C":Lt.keyName==="ctrl-d"?"Ctrl-D":Lt.keyName==="home"?"Home":"End"},Lt.id))},`row-${Pt}`)})})]})})]})},Qk=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:n,connectionError:a,terminalSessionId:l})=>{if(typeof window>"u")return null;const c=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return i.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[i.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),i.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[i.jsxs("div",{children:["isMobile: ",i.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),i.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),i.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),i.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),i.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),i.jsxs("div",{children:["inputFocused: ",String(t)]}),i.jsxs("div",{children:["keyboard~: ",c,"px"]}),i.jsxs("div",{children:["connecting:"," ",i.jsx("span",{className:n?"text-muted-foreground":"text-accent",children:String(n)})]}),i.jsxs("div",{children:["sessionId:"," ",i.jsx("span",{className:l?"text-accent":"text-destructive",children:l?"✓":"✗"})]}),i.jsxs("div",{children:["error:"," ",i.jsx("span",{className:a?"text-destructive":"text-accent",children:a?"Yes":"No"})]}),i.jsxs("div",{children:["isIOS:"," ",i.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),i.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:i.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},Pk=/^Reconnecting/i,Ok=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:n,onHardRestart:a})=>{const{t:l}=Qr(),c=!!e&&Pk.test(e),h=!!(n&&!e||c),[p,g]=C.useState(!1);return C.useEffect(()=>{if(!h){g(!1);return}const x=setTimeout(()=>g(!0),1500);return()=>clearTimeout(x)},[h]),h?p?i.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:i.jsx(Eu,{dots:!0,label:l("connection.reconnecting"),className:"rounded-full bg-surface-2 px-3 py-1 text-[11px]"})}):null:e?i.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:i.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[i.jsx("span",{children:e}),t&&i.jsx("button",{type:"button",onClick:a,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:l("common.retry")})]})}):null};let yu=[],lp=!1;function da(e,t,r={}){typeof window>"u"||(yu.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),Fk())}async function Fk(){if(!lp){lp=!0;try{for(;yu.length>0;){const e=yu[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),yu.shift()}catch{yu=[];break}}}finally{lp=!1}}}const $k=120,Uk=80,zk=400;function P2(){if(typeof window>"u"||document.visibilityState!=="visible"||!z7())return 0;const e=Number.parseFloat(document.documentElement.style.getPropertyValue("--kb-height")||"0");if(Number.isFinite(e)&&e>0)return Math.round(e);const t=Vo().visualViewport;if(!t)return 0;const r=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,n=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,a=t.height+t.offsetTop;return Math.max(0,Math.round(r-a-n))}function I3(e){const{enabled:t,openThresholdPx:r=$k,closeThresholdPx:n=Uk,settleDelayMs:a=zk}=e,l=C.useMemo(()=>n0("keyboard"),[]),c=C.useRef(!1),h=C.useRef(null),p=C.useRef(0),[g,x]=C.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return C.useEffect(()=>{if(typeof window>"u"||!t){c.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x(Q=>!Q.isOpen&&!Q.isSettled&&Q.keyboardHeight===0?Q:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let y=null;const A=()=>{y=null;const Q=P2();let X=c.current;if(Q>=r?X=!0:Q<=n&&(X=!1),c.current=X,X){const ee=Math.abs(Q-p.current);p.current=Q,ee>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(ze=>ze.isSettled?ze:{...ze,isSettled:!0})},a))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(ee=>{const ze=X?ee.isSettled:!1;return ee.isOpen===X&&ee.keyboardHeight===Q&&ee.isSettled===ze?ee:(l("sync",{keyboardHeight:Q,isOpen:X,isSettled:ze,visualViewport:Vo().visualViewport?{width:Math.round(Vo().visualViewport.width),height:Math.round(Vo().visualViewport.height),offsetTop:Math.round(Vo().visualViewport.offsetTop)}:null}),{isOpen:X,isSettled:ze,keyboardHeight:Q})})},w=(Q="event")=>{(Q.includes("visibilitychange")||Q.includes("pageshow"))&&l("schedule",{source:Q}),y===null&&(y=window.requestAnimationFrame(A))};w("mount");const k=()=>w("resize"),E=()=>w("orientationchange"),I=()=>w("visualViewport.resize"),M=()=>w("visualViewport.scroll"),B=()=>w("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",E),Vo().visualViewport?.addEventListener("resize",I),Vo().visualViewport?.addEventListener("scroll",M),document.addEventListener("termdock:viewport-keyboard-change",B);const F=Q=>{l("resume",{source:Q,keyboardHeight:P2(),hidden:document.hidden}),w(`${Q}:now`),window.setTimeout(()=>w(`${Q}:50ms`),50),window.setTimeout(()=>w(`${Q}:200ms`),200)},U=()=>{document.hidden||F("visibilitychange")},G=()=>F("pageshow");return document.addEventListener("visibilitychange",U),window.addEventListener("pageshow",G),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",E),Vo().visualViewport?.removeEventListener("resize",I),Vo().visualViewport?.removeEventListener("scroll",M),document.removeEventListener("termdock:viewport-keyboard-change",B),document.removeEventListener("visibilitychange",U),window.removeEventListener("pageshow",G),y!==null&&window.cancelAnimationFrame(y),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[l,t,r,n,a]),g}const fh=300,Hk=120,Wk=2e3,Gk=250,Vk=6e4;function qk(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(c=>t.has(c)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const n=e.slides.findIndex(c=>c.some(h=>r.has(h)));if(n<0)return r;const a=e.slides[n-1]??[],l=e.slides[n+1]??[];for(let c=0;c<Math.max(a.length,l.length)&&r.size<3;c+=1)for(const h of[a[c],l[c]])h&&r.size<3&&r.add(h);return r}function cp(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function Pd(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function Yk(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function Zk(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function Kk(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function Xk(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function Jk(e){return!e.initialConnectionPending}function eI(e){return!e}function tI(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function rI(e,t){return[...e].every(r=>t.has(r))}function nI(e,t){return e===null||t-e>=Gk}function sI(e){return!1}function iI(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,Vk-(e.now-e.reconnectStartedAt))}function aI(e,t){const r=new Map;let n=0;for(const a of e)if(!r.has(a)){if(t.has(a)){r.set(a,0);continue}r.set(a,fh+n*Hk),n+=1}return r}const oI="Session not found on server",ph="Terminal session not found",lI="STALE_SESSION_RESTORE_REJECTED";function O2(e){return pm(e)?!1:e?.message===oI||e?.status===404&&e.message===ph}function pm(e){return e?.code===lI}function cI(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function E3(e,t){return cI(e,t).replace(/ /g,"\\ ")}function N3(e,t){return`${E3(e,t)} `}function F2(e,t){return E3(e,t)}function wF(e,t,r){if(!r)return F2(e,t);const n=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${F2(e,t)}:${n}`}const uI="/tmp";async function R3(e,t,r){const a=(await t(uI,[e])).files[0];if(!a?.path)throw new Error("Upload did not return a file path");return r(a.path),a}const AF=R3,M3=[640,960,1280,1600,2048,2560,3072,4096],D3=[240,360,480,540,720,1080,1440,2160],Su={min:.1,max:1,step:.01},_u={min:25e4,max:2e7,step:25e4},r1="termdock:mobile-media-compression-v1",Fc={imageEnabled:!1,imageMaxDimension:2048,imageQuality:.8,videoEnabled:!1,videoMaxHeight:720,videoBitrate:25e5};function j3(){try{const e=JSON.parse(localStorage.getItem(r1)||"null");return!e||typeof e!="object"?Fc:{imageEnabled:e.imageEnabled===!0,imageMaxDimension:M3.includes(e.imageMaxDimension)?e.imageMaxDimension:Fc.imageMaxDimension,imageQuality:typeof e.imageQuality=="number"&&e.imageQuality>=Su.min&&e.imageQuality<=Su.max?e.imageQuality:Fc.imageQuality,videoEnabled:e.videoEnabled===!0,videoMaxHeight:D3.includes(e.videoMaxHeight)?e.videoMaxHeight:Fc.videoMaxHeight,videoBitrate:typeof e.videoBitrate=="number"&&e.videoBitrate>=_u.min&&e.videoBitrate<=_u.max?e.videoBitrate:Fc.videoBitrate}}catch{return Fc}}const B3=p0((e,t)=>({preferences:j3(),saveFailed:!1,update:r=>{const n={...t().preferences,...r};let a=!1;try{localStorage.setItem(r1,JSON.stringify(n))}catch{a=!0}e({preferences:n,saveFailed:a})}}));typeof window<"u"&&window.addEventListener("storage",e=>{(e.key===r1||e.key===null)&&B3.setState({preferences:j3(),saveFailed:!1})});function Od(e){if(e<1024)return`${e} B`;const t=["B","KB","MB","GB","TB"],r=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024)));return`${Number((e/1024**r).toFixed(1))} ${t[r]}`}function dI({result:e,message:t,onClose:r}){const{locale:n}=Qr(),a=n==="zh",l=b.useRef(null),[c,h]=b.useState(null),[p,g]=b.useState(!1);return b.useEffect(()=>{const x=URL.createObjectURL(e.file);return h(x),g(!1),()=>URL.revokeObjectURL(x)},[e.file]),b.useEffect(()=>{const x=l.current;return x?.showModal(),()=>x?.close()},[]),i.jsx("dialog",{ref:l,"aria-label":a?"上传结果预览":"Uploaded media preview",onCancel:x=>{x.preventDefault(),r()},onClick:x=>{x.target===x.currentTarget&&r()},onKeyDown:x=>x.stopPropagation(),onKeyUp:x=>x.stopPropagation(),className:"fixed inset-0 z-modal-panel m-0 h-[100dvh] max-h-none w-screen max-w-none bg-transparent p-3 text-foreground backdrop:bg-[var(--app-backdrop)] open:flex open:items-center open:justify-center",children:i.jsxs("section",{className:"flex max-h-[calc(100dvh-env(safe-area-inset-top,0px)-env(safe-area-inset-bottom,0px)-1.5rem)] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-xl",children:[i.jsxs("header",{className:"flex shrink-0 items-start gap-3 border-b border-border/15 p-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{className:"text-sm font-semibold",children:a?"上传结果预览":"Uploaded media preview"}),i.jsx("p",{className:"mt-1 break-words text-xs text-muted-foreground",children:t}),i.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",children:e.file.name})]}),i.jsx("button",{type:"button",autoFocus:!0,onClick:r,"aria-label":a?"关闭预览":"Close preview",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:i.jsx(Kn,{size:18})})]}),i.jsx("div",{className:"min-h-0 overflow-auto p-2",children:p?i.jsx("p",{role:"alert",className:"p-4 text-sm text-muted-foreground",children:a?"文件已上传,但当前浏览器无法预览此格式。":"File uploaded, but this browser cannot preview this format."}):c&&(e.kind==="image"?i.jsx("img",{src:c,alt:e.file.name,onError:()=>g(!0),className:"mx-auto block max-h-[65dvh] max-w-full object-contain"}):i.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onError:()=>g(!0),className:"mx-auto block max-h-[65dvh] w-full"}))})]})})}function hI({result:e,onDismiss:t}){const{locale:r}=Qr(),n=r==="zh",[a,l]=b.useState(null);b.useEffect(()=>{if(!e)return;const k=window.setTimeout(t,2e3);return()=>window.clearTimeout(k)},[e,t]);const c=e??a?.result;if(!c)return null;const h=c.originalSize-c.uploadedSize,p=c.originalSize>0?Math.abs(h)/c.originalSize*100:0,g=p<1?"<1%":`${Math.floor(p)}%`,x=c.kind==="image"?n?"图片":"Image":n?"视频":"Video",y=h>0?n?"已压缩上传":"Compressed upload":n?"已处理上传":"Processed upload",A=h>0?n?`省 ${g}`:`${g} saved`:h<0?`+${g}`:n?"体积未变":"Size unchanged",w=c.originalRetained?n?`已尝试压缩 · 保留原图 ${Od(c.uploadedSize)},已上传`:`Compression tried · original ${Od(c.uploadedSize)} uploaded`:`${y} · ${Od(c.originalSize)} → ${Od(c.uploadedSize)} · ${A}`;return i.jsxs(i.Fragment,{children:[e&&i.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none absolute left-1/2 top-1/2 z-30 w-max max-w-[calc(100%-1.5rem)] -translate-x-1/2 -translate-y-1/2 motion-safe:animate-[fade-in_0.15s_ease-out]",children:i.jsxs("button",{type:"button","aria-label":`${x}:${w} · ${n?"点击预览":"Preview"}`,onClick:()=>{l({result:e,message:w}),t()},className:"pointer-events-auto flex max-w-full select-none items-center gap-1.5 rounded-full border border-border/15 bg-surface-elevated px-3 py-2 text-[11px] leading-4 text-foreground shadow-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[i.jsx(Mi,{size:13,strokeWidth:2.5,className:"shrink-0 text-primary","aria-hidden":"true"}),i.jsx("span",{className:"truncate tabular-nums",children:w}),i.jsx("span",{className:"shrink-0 text-muted-foreground",children:n?"预览 ›":"Preview ›"})]})}),a&&Ai.createPortal(i.jsx(dI,{result:a.result,message:a.message,onClose:()=>l(null)}),document.body)]})}const fI=320,$2="termdock:mobile-keyboard-expanded",U2="termdock:mobile-keyboard-preset-mode",z2="termdock:mobile-long-press-mode",pI=80;function mI(e){return/\.(?:jpe?g|png|heic|heif)$/i.test(e.name)||/^(?:image\/jpeg|image\/png|image\/heic|image\/heif)$/i.test(e.type)}function H2(e){const t=(e instanceof Error?e.message:String(e)).slice(0,3e3);return/importing a module script failed|dynamically imported module|loading chunk/i.test(t)?`压缩模块加载失败,可能是页面版本过旧或网络中断。请更新页面后重试,无需清除转码器缓存。
68
+ ${t}`:t}function gI(e){switch(e?.phase){case"loading":return`正在加载转码器… ${e.progress??0}%(优先使用浏览器缓存)`;case"saving":return"加载完成,正在保存到本机…";case"initializing":return e.source==="local"?"已找到本机缓存,正在初始化转码器…":"正在初始化本地转码器…";case"ready":return e.source==="local"?"已从本机缓存加载,转码器已就绪。":e.saved?"转码器已就绪,已保存到本机供下次使用。":"转码器已就绪。";default:return"正在检查本机转码器缓存…"}}function up(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const xI={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},bI=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:n=Jm(),colorTheme:a="dark",toolbarPresets:l=[],isActive:c=!0,focusSuspended:h=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:g=!0,focusRequestToken:x=0,resumeRequestToken:y=0,resumeRequestReason:A="visibility",resumeRequestDelayMs:w=0,forceResumeReconnect:k=!1,initialConnectDelayMs:E=0,initialConnectEnabled:I=!0,resumeRequestEnabled:M=!0,onStreamReadyChange:B,onStreamConnected:F,onViewportReadyChange:U,onContentReadyChange:G,onKeyboardVisibilityChange:Q,suppressKeyboard:X=!1,keyboardPortalTarget:ee=null,sharedMobileKeyboardLayout:ze=!1,suppressPageFlipRefresh:he=!1,showDebug:de,onStatusChange:$e})=>{const{t:qe}=Qr(),[oe]=C.useState(e||Db()),[Re,K]=C.useState(()=>(e?Gp(e):null)??n.fontSize),we=C.useMemo(()=>wk(),[]),Z=C.useMemo(()=>n0("session"),[]),Ue=C.useMemo(()=>n0("keyboard"),[]),Le=C.useRef(null),Y=C.useRef(null);C.useEffect(()=>{Gp(oe)===null&&K(n.fontSize)},[n.fontSize,oe]);const Ee=C.useMemo(()=>({...n,fontSize:Re}),[n,Re]),[be,Me]=C.useState(up),[Ze,Se]=C.useState(!1),[se,Ye]=C.useState(!1),[pt,rt]=C.useState(!1),[ye,et]=C.useState(()=>typeof document>"u"?!0:!document.hidden&&mu()),[ht,te]=C.useState(()=>typeof document>"u"?!0:document.hasFocus()),[ve,ct]=C.useState(!1),[re,me]=C.useState(!1),[je,mt]=C.useState(!1),[ae,De]=C.useState(!1),[gt,ft]=C.useState(!0),{isOpen:kt,keyboardHeight:Dt}=I3({enabled:be&&c}),[Yt,xr]=C.useState(null),[rr,Ir]=C.useState(null),[ne,Ne]=C.useState(()=>typeof window>"u"?!1:window.localStorage.getItem($2)==="true"),[tt,jt]=C.useState(()=>{if(typeof window>"u")return"auto";const ie=window.localStorage.getItem(U2);return ie&&ie.length>0?ie:"auto"}),[Et,dr]=C.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(z2)==="copy"?"copy":"arrows"),[Jt,We]=C.useState("idle"),[Lr,Xe]=C.useState("idle"),[Pt,Ge]=C.useState(0),[It,cn]=C.useState(null),[Lt,Vr]=C.useState(null),ut=C.useCallback(()=>Vr(null),[]),{preferences:fn,update:Sr,saveFailed:Pr}=B3(),{videoEnabled:br,videoMaxHeight:pe,videoBitrate:Er,imageEnabled:fe,imageMaxDimension:Ve,imageQuality:nr}=fn,[an,Nr]=C.useState(!1),[Ar,Bt]=C.useState(null),[Rr,fs]=C.useState(null),Xr=Kr(ie=>ie.sessions.get(oe)),{setTerminalSession:pn,setConnecting:mn,appendToBuffer:An,replaceBuffer:Rn,clearTerminalSession:dn,removeTerminalSession:Mn,clearBuffer:bn,setSessionActiveProgram:_n,setSessionCwd:Dn,setSessionCopyMode:kn,setSessionAgentStatus:$r,setSessionShellTitle:Ts,setSessionPromptState:er,clearAgentNeedsReview:qr}=Kr.getState(),Qn=C.useMemo(()=>`wt-${oe.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[oe]),Tn=Xr?.terminalSessionId??null,Yr=Xr?.mode??"shell",jr=Xr?.activeProgram??null,rn=C.useMemo(()=>Kc(l),[l]),Br=Yr==="tmux",W=Xr?.bufferChunks??[],Be=Xr?.isConnecting??!1,wt=Tn,yr=C.useCallback(async(ie,Fe)=>{const yt=zL(ie,Xr?.cwd||Xr?.directory);if(!yt)return;let Tt=yt,Oe="directory";try{Tt=(await Fm(yt)).path}catch(_t){if(!(_t instanceof Error)||_t.message!=="Path is not a directory")return;Oe="file"}try{const _t=Zt.getState();_t.setRightTab("files"),_t.openRight(),window.dispatchEvent(new CustomEvent(QL,{detail:{path:Tt,kind:Oe,line:Fe}}))}catch{}},[Xr?.cwd,Xr?.directory]),Rt=t??Xr?.mode??"shell",Mr=Rt==="tmux"?r??Xr?.tmuxSessionName??null:null,[Dr,Zr]=C.useState(null),nn=C.useRef(!1),[zn,jn]=C.useState(!1),[ss,$]=C.useState(!1),[Te,He]=C.useState(null),[Ke,Je]=C.useState(0),[xt,Qt]=C.useState(null),vt=de!==void 0?de:!1,lt=C.useRef(null),At=C.useRef(null),Mt=C.useRef(null),Ot=C.useRef(null),dt=C.useRef(null),Ct=C.useRef(!1),ar=C.useRef(null),cr=C.useRef([]),$t=C.useRef(0),Ur=C.useRef(!1),Or=C.useRef(null),es=C.useRef(null),js=C.useRef(-1),ai=C.useRef(null),Fs=C.useRef(0),zr=C.useRef(null),on=C.useRef(null),Wn=C.useRef(0),z=C.useRef(0),le=C.useRef(!1),xe=C.useRef(null),Pe=C.useRef(null),Ht=C.useRef(!1),Ft=C.useRef(0),tr=C.useRef(!1),Xt=C.useRef(!1),Hr=C.useRef(!1),yn=C.useRef(null),P=C.useRef(null),Ae=C.useRef(null),_e=C.useRef(c);_e.current=c;const at=C.useRef(h);at.current=h;const bt=C.useRef(be),ur=C.useRef(null),Vt=C.useRef(null),Nt=C.useRef(null),Wr=C.useRef(null),Pn=C.useRef(null),xs=C.useRef(null),Di=C.useRef(null),is=C.useCallback(()=>{const ie=++Ft.current,Fe=()=>{ie===Ft.current&&me(!0)};if(typeof window>"u"){Fe();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Fe))},[]),oi=C.useCallback(ie=>{if(tr.current){if(P.current!==null&&(window.clearTimeout(P.current),P.current=null),ie.x===0&&ie.y>=ie.rows-1){ft(!1);return}P.current=window.setTimeout(()=>{P.current=null,ft(!0)},pI)}},[]),li=C.useRef(null);C.useEffect(()=>()=>{li.current?.()},[]);const fa=C.useCallback(()=>{li.current||(li.current=Hm(()=>{li.current=null;const ie=Kr.getState(),Fe=Mt.current,yt=ie.getTerminalSession(oe);if(!Fe||yt?.mode!=="shell"||ie.hasPendingBufferWrites(oe))return;const Tt=H7(Fe),Oe=dt.current?.getDimensions();if(!Tt||!Oe)return;const _t=dt.current?.serializeSnapshot();_t&&W7({id:Fe,version:1,...Tt,...Oe,data:_t,savedAt:Date.now()})},2e3))},[oe]),vn=C.useCallback(ie=>{const Fe=Kr.getState(),yt=Fe.getTerminalSession(oe)?.bufferChunks.at(-1)?.id;if(Mt.current&&yt!==void 0&&yt<=ie&&!Fe.hasPendingBufferWrites(oe)&&(G7(Mt.current),fa()),!le.current||!Xk({writtenChunkId:ie,initialTargetChunkId:xe.current}))return;const Tt=Pe.current;Pe.current=null,Tt!==null&&dt.current?.notifyScreenSynchronized(Tt),le.current=!1,xe.current=null,is()},[is,fa,oe]),cs=C.useCallback(ie=>{if(!tr.current)return;const Fe=yn.current;Fe&&Fe.x===ie.x&&Fe.y===ie.y&&Fe.rows===ie.rows||(yn.current=ie,P.current!==null&&(window.clearTimeout(P.current),P.current=null),ie.x===0&&ie.y>=ie.rows-1&&ft(!1))},[]);C.useEffect(()=>{if(!p){Xt.current=!1;return}Xt.current||(Xt.current=!0,Hr.current=!1,tr.current=!0,yn.current=null,ft(!1),P.current!==null&&(window.clearTimeout(P.current),P.current=null),Ae.current!==null&&window.clearTimeout(Ae.current),Ae.current=window.setTimeout(()=>{Ae.current=null,P.current!==null&&typeof window<"u"&&window.clearTimeout(P.current),P.current=null,tr.current=!1,ft(!0)},15e3))},[p]);const ks=C.useCallback(()=>{Wr.current=null;const ie=Nt.current;Nt.current=null,ie&&Ts(ie.sessionId,ie.title)},[Ts]),Qa=C.useCallback((ie,Fe)=>{if(Nt.current={sessionId:ie,title:Fe},Wr.current===null){if(typeof window>"u"){ks();return}Wr.current=window.requestAnimationFrame(ks)}},[ks]),Ci=C.useCallback(()=>{Wr.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Wr.current),Wr.current=null,Nt.current=null},[]),ho=C.useCallback(async()=>{const ie=Rt;return(await V7({preferredFrontendSessionId:oe,mode:ie,tmuxSessionName:ie==="tmux"?Mr||Qn:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Rt,Mr,Qn,oe]),pa=C.useRef(c);C.useEffect(()=>{if(!c){dt.current?.blur(),pa.current=!1;return}if(pa.current)return;pa.current=!0;const ie=nL(be,he);if(ie==="single"){dt.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}ie!=="none"&&dt.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[c,be,he,wt]),C.useEffect(()=>{bt.current=be},[be]);const gn=C.useCallback(()=>{!_e.current||at.current||dt.current?.focus()},[]);C.useLayoutEffect(()=>{h&&dt.current?.blur()},[h]),C.useEffect(()=>{if(!c||h||gt||Hr.current)return;Hr.current=!0;const ie=window.requestAnimationFrame(()=>{dt.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(ie)},[h,c,gt]);const ma=C.useCallback(ie=>{typeof window>"u"||typeof document>"u"||!_e.current||at.current||bt.current||document.hidden||!mu()||(ur.current!==null&&window.clearTimeout(ur.current),ur.current=window.setTimeout(()=>{if(ur.current=null,!_e.current||at.current||bt.current||document.hidden||!mu())return;const Fe=document.activeElement,yt=Fe?.getAttribute("data-terminal-input-anchor")==="true";if((Fe instanceof HTMLInputElement||Fe instanceof HTMLTextAreaElement||Fe instanceof HTMLSelectElement||Fe?.isContentEditable===!0)&&!yt){Ue("desktop resume focus skipped: editable active",{reason:ie});return}Ue("desktop resume focus",{reason:ie}),dt.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),dt.current?.focus()},50))},[Ue]);C.useEffect(()=>()=>{ur.current!==null&&typeof window<"u"&&window.clearTimeout(ur.current),ur.current=null,Vt.current!==null&&typeof window<"u"&&window.clearTimeout(Vt.current),Vt.current=null,Pn.current!==null&&typeof window<"u"&&window.clearTimeout(Pn.current),Pn.current=null,xs.current!==null&&typeof window<"u"&&window.clearTimeout(xs.current),xs.current=null,Ae.current!==null&&typeof window<"u"&&window.clearTimeout(Ae.current),Ae.current=null,P.current!==null&&typeof window<"u"&&window.clearTimeout(P.current),P.current=null},[]),C.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const ie=()=>{Vt.current!==null&&window.clearTimeout(Vt.current),Vt.current=window.setTimeout(()=>{Vt.current=null;const Fe=document.activeElement,Tt=!(Fe?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Fe&&(Fe instanceof HTMLInputElement||Fe instanceof HTMLTextAreaElement||Fe instanceof HTMLSelectElement||Fe.isContentEditable));xT({isActive:_e.current&&!at.current,isMobile:bt.current,documentVisible:!document.hidden,activeElementIsEditable:Tt})&&gn()},0)};return document.addEventListener("pointerup",ie),()=>{document.removeEventListener("pointerup",ie),Vt.current!==null&&(window.clearTimeout(Vt.current),Vt.current=null)}},[gn]);const Is=C.useCallback(()=>{ts.current=!1,Je(ie=>ie+1)},[]),el=C.useCallback((ie,Fe,yt)=>{const Tt=Mt.current,Oe=Date.now();if(Tt&&Fe&&q7(Tt)){Y.current={startedAt:Oe,strategy:"reconnect",reason:ie},da("info","PWA_RESUME terminal-start",{frontendSessionId:oe,backendSessionId:Tt,strategy:"reconnect",reason:ie,active:_e.current});return}if(Tt&&Y7(Tt,()=>{const _t=Y.current;da("info","PWA_RESUME terminal-responsive",{frontendSessionId:oe,backendSessionId:Tt,durationMs:_t?Date.now()-_t.startedAt:null,strategy:_t?.strategy??"probe",reason:_t?.reason??ie}),Y.current=null,F?.(oe)},{visible:yt})){Y.current={startedAt:Oe,strategy:"probe",reason:ie},da("info","PWA_RESUME terminal-start",{frontendSessionId:oe,backendSessionId:Tt,strategy:"probe",reason:ie,active:_e.current}),Z("[Terminal] resume probe sent",{reason:ie,backendSessionId:Tt,active:_e.current});return}if(Z("[Terminal] resume probe missing connection, restarting ensureSession",{reason:ie,backendSessionId:Tt,active:_e.current}),!Jk({initialConnectionPending:Ht.current})){Z("[Terminal] resume probe deferred during initial websocket handshake",{reason:ie,backendSessionId:Tt});return}Is()},[Z,F,Is,oe]),Si=C.useCallback((ie,Fe)=>{const yt=Mt.current;yt&&ar.current!==ie&&(ar.current=ie,eg(yt,ie,Fe),Z("[Terminal] flow-control state sent",{backendSessionId:yt,paused:ie,reason:Fe}))},[Z]),fo=C.useCallback((ie,Fe)=>{const yt=Mt.current;yt&&zr.current!==ie&&(zr.current=ie,tg(yt,ie,Fe),Z("[Terminal] focus state sent",{backendSessionId:yt,focused:ie,reason:Fe}))},[Z]),Pa=C.useCallback((ie,Fe)=>{const yt=Mt.current;yt&&on.current!==ie&&(on.current=ie,rg(yt,ie,Fe),Z("[Terminal] viewing state sent",{backendSessionId:yt,viewing:ie,reason:Fe}))},[Z]),ga=mT({isActive:c&&!h,viewportFocused:pt,documentVisible:ye,windowFocused:ht,streamReady:ve}),Xi=gT({isActive:c,documentVisible:ye,windowFocused:ht,streamReady:ve,isDesktop:ko()!==null}),Oa=C.useRef(ga),ci=C.useRef(Xi);C.useEffect(()=>{Oa.current=ga,fo(ga,"logical-focus-change")},[ga,fo,wt]),C.useEffect(()=>{ci.current=Xi,Pa(Xi,"logical-viewing-change")},[Xi,Pa,wt]),IT(wt,ye,ve),C.useEffect(()=>{const ie=Fe=>{const yt=Fe.detail;!yt||yt.sessionId!==oe||K(yt.fontSize??n.fontSize)};return window.addEventListener("termfontchange",ie),()=>window.removeEventListener("termfontchange",ie)},[oe,n.fontSize]),C.useEffect(()=>{const ie=()=>{const Oe=!document.hidden&&mu();et(Oe),Oe&&c&&ma("visibility")},Fe=Oe=>{c&&ma(Oe.persisted?"bfcache":"pageshow")},yt=()=>{te(!0),ma("window-focus")},Tt=()=>te(!1);return document.addEventListener("visibilitychange",ie),window.addEventListener(ng,ie),window.addEventListener("pageshow",Fe),window.addEventListener("focus",yt),window.addEventListener("blur",Tt),()=>{document.removeEventListener("visibilitychange",ie),window.removeEventListener(ng,ie),window.removeEventListener("pageshow",Fe),window.removeEventListener("focus",yt),window.removeEventListener("blur",Tt)}},[c,ma]),C.useEffect(()=>{if(!y||!M||!ui.current)return;const ie=w,Fe=ie<=0,yt=Le.current;if(yt?.token===y&&(yt.visible||!Fe))return;const Tt=()=>{Le.current={token:y,visible:Fe},dt.current?.requestRefresh(A,{skipScrollToBottom:!0}),el(ie>0?"global-resume-background":"global-resume-visible",ie<=0&&k,Fe)};if(ie<=0){Tt();return}const Oe=window.setTimeout(Tt,ie);return()=>window.clearTimeout(Oe)},[y,A,M,w,k,el]);const us=C.useRef(0);C.useEffect(()=>{if(ve){us.current=0;return}if(!zn||Dr==="Authentication required"||Dr===ph)return;const ie=us.current,Fe=Math.min(2e3*Math.pow(2,Math.min(ie,4)),3e4),yt=setTimeout(()=>{us.current+=1,Z("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:us.current,backendSessionId:Mt.current}),Zr("Reconnecting..."),jn(!1),Is()},Fe);return()=>clearTimeout(yt)},[Dr,zn,ve,Ke,Z,Is]),C.useEffect(()=>{if(typeof window>"u"){Se(!1);return}const ie=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;Se(ie)},[]),C.useEffect(()=>{(!c||!be)&&Ye(!1),c||rt(!1)},[c,be]),C.useEffect(()=>{Mt.current=wt,js.current=-1,Pe.current=null,zr.current=null,on.current=null,ar.current=null},[wt]),C.useEffect(()=>{B?.(oe,ve)},[ve,B,oe]),C.useEffect(()=>{G?.(oe,ve&&re&&je)},[re,je,ve,G,oe]),C.useEffect(()=>{Br||(Ur.current=!1,Or.current=null,es.current&&(clearTimeout(es.current),es.current=null))},[Br]),C.useEffect(()=>{wt&&dt.current?.requestRefresh("session-key-change",{force:!0})},[wt]),C.useEffect(()=>{const ie=c&&be&&kt;Ue("visibility signal",{sessionId:oe,isActive:c,isMobile:be,isInputFocused:se,isViewportKeyboardOpen:kt,viewportKeyboardHeight:Dt,visible:ie}),Q?.(oe,ie)},[Q,oe,c,be,kt,Dt,Ue]),C.useEffect(()=>{c&&x&&x!==Fs.current&&(Fs.current=x,gn())},[x,gn,c]),C.useEffect(()=>{Ot.current=oe},[oe]),C.useEffect(()=>{!be&&(Yt!==null||rr!==null)&&(xr(null),Ir(null),ai.current=null)},[be,Yt,rr]),C.useEffect(()=>{!wt&&(Yt!==null||rr!==null)&&(xr(null),Ir(null),ai.current=null)},[wt,Yt,rr]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem($2,ne?"true":"false")},[ne]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(U2,tt)},[tt]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(z2,Et)},[Et]),C.useEffect(()=>{Me(up());const ie=()=>{Me(up())};return window.addEventListener("resize",ie),()=>window.removeEventListener("resize",ie)},[]);const In=C.useCallback(()=>{Wn.current+=1,z.current+=1,ks(),Ci();const ie=lt.current;lt.current=null,At.current=null,Ht.current=!1,ct(!1),dt.current?.setSessionReady(!1);const Fe=Mt.current;Fe&&eg(Fe,!1,"stream-disconnect"),Ct.current=!1,ar.current=null,cr.current=[],ie?.()},[Ci,ks]),xa=C.useCallback(async ie=>{if(At.current===ie){Z(`[startStream] Skipping - already connected to ${ie}`);return}Z(`[startStream] Starting stream for frontendSessionId=${oe} backendSessionId=${ie}`),He(null),Ft.current+=1,le.current=!1,xe.current=null,me(!1),mt(!1),In();const Fe=Wn.current+1;Wn.current=Fe,Ht.current=!0;const yt=Kr.getState().getTerminalSession(oe);if(yt?.mode==="shell"&&!yt.bufferChunks.length){const Oe=await Promise.race([Z7(ie),new Promise(_t=>window.setTimeout(()=>_t(null),75))]);if(Wn.current!==Fe||Ot.current!==oe)return;if(Oe&&!Kr.getState().getTerminalSession(oe)?.bufferChunks.length){Kr.getState().replaceBuffer(oe,[Oe.data]);const _t=dt.current?.getDimensions();_t?.cols===Oe.cols&&_t.rows===Oe.rows&&K7(ie,Oe.seq,Oe.epoch)}}const Tt=we.connect(ie,{onEvent:Oe=>{if(Wn.current!==Fe)return;const _t=oe;if(_t)switch(Oe.type){case"connected":{z.current+=1,Ht.current=!1;const hr=Y.current;hr&&(da("info","PWA_RESUME terminal-connected",{frontendSessionId:_t,backendSessionId:Mt.current,durationMs:Date.now()-hr.startedAt,strategy:hr.strategy,reason:hr.reason}),Y.current=null),F?.(_t),(Oe.runtime||Oe.ptyBackend)&&Z(`[Terminal] connected frontendSessionId=${_t} backendSessionId=${Mt.current} runtime=${Oe.runtime??"unknown"} pty=${Oe.ptyBackend??"unknown"} cwd=${Oe.cwd??"unknown"}`),mn(_t,!1),Zr(null),jn(!1),He(null),ct(!0),Mt.current&&(tg(Mt.current,Oa.current,"stream-connected"),rg(Mt.current,ci.current,"stream-connected")),dt.current?.setSessionReady(!0),ar.current=null,Si(Ct.current,"stream-connected"),Oe.tuiProgress!==void 0&&Kr.getState().setSessionTuiProgress(_t,Oe.tuiProgress??null),Oe.shellTitle!==void 0&&Kr.getState().setSessionShellTitle(_t,Oe.shellTitle??null),Oe.promptState!==void 0&&Oe.promptState!==null&&Kr.getState().setSessionPromptState(_t,Oe.promptState);const Fr=Kr.getState().getTerminalSession(_t);if(Fr?.terminalSessionId&&Oe.mode&&Kr.getState().setTerminalSession(_t,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Oe.mode,tmuxSessionName:Oe.tmuxSessionName??null,cwd:Oe.cwd??null}),Oe.activeProgram!==void 0&&_n(_t,Oe.activeProgram??null,Oe.activeProgramSource??null,Oe.activeProgramRaw??null),dt.current?.requestRefresh("connected",{force:!0,reconcileServerSize:_e.current}),Oe.mode!=="tmux"&&(Qt(null),kn(_t,!1)),Z("[Terminal] Connected event received:",{frontendSessionId:_t,backendSessionId:Mt.current,storeHasState:!!Fr,storeTerminalId:Fr?.terminalSessionId,hasHistoryInStore:!!Fr?.history?.length,historyLength:Fr?.history?.length??0}),Fr?.history&&Fr.history.length>0){Z(`[Terminal] Restoring ${Fr.history.length} history chunks to frontend session ${_t}`);const O=Fr.history.reduce((Qe,ke)=>Qe+ke.length,0),H=Math.max(300,Math.min(2e3,Math.ceil(O/200)));$t.current=Date.now()+H,Fr.history.forEach(Qe=>{An(_t,Qe,{markActivity:!1})}),Kr.getState().setSessionHistory(_t,[]),Z(`[Terminal] History restoration complete for ${_t}`)}else Z(`[Terminal] No history to restore for ${_t}`);const L=Oe.replayChunks,j=!!Fr?.history?.length||!!L?.length;if(j?le.current=!0:is(),L&&L.length>0){let O=null;if(Oe.replayOutOfWindow)Z(`[Terminal] Replay out-of-window, atomically replacing buffer (${L.length} chunks)`),O=Rn(_t,QT(L));else{Z(`[Terminal] Replay incremental: ${L.length} chunks`);for(const ke of L)An(_t,ke)}const H=L.reduce((ke,st)=>ke+st.length,0),Qe=Math.max(200,Math.min(1500,Math.ceil(H/200)));$t.current=Math.max($t.current,Date.now()+Qe),xe.current=O}j&&xe.current===null&&(xe.current=Kr.getState().flushPendingBufferWrites(_t),xe.current===null&&(le.current=!1,is()));break}case"reconnecting":{He(hr=>hr??Date.now()),Zr("Reconnecting..."),jn(!1);break}case"data":{Oe.data&&(Ct.current?cr.current.push(Oe.data):An(_t,Oe.data));break}case"tmux-layout":{Qt(Oe.layout??null),Oe.layout&&kn(_t,Oe.layout.inCopyMode);break}case"tmux-screen-sync":{const hr=Oe.generation??0;if(hr<js.current)break;js.current=hr,Ft.current+=1,le.current=!0,me(!1),cr.current=[],dt.current?.prepareScreenReplacement(),Pe.current=hr,xe.current=Rn(_t,PT(Oe.chunks??[])),xe.current===null&&(Pe.current=null,dt.current?.notifyScreenSynchronized(hr),le.current=!1,is()),typeof Oe.cols=="number"&&typeof Oe.rows=="number"&&dt.current?.notifyServerSize(Oe.cols,Oe.rows,"tmux-screen-sync");break}case"active-program":{_n(_t,Oe.activeProgram??null,Oe.activeProgramSource??null,Oe.activeProgramRaw??null);break}case"cwd":{Dn(_t,Oe.cwd??null);break}case"agent-status":{$r(_t,{agentStatus:Oe.agentStatus??null,agentIndicator:Oe.agentIndicator??null,agentStatusDetail:Oe.agentStatusDetail??null,agent:Oe.agent??null,agentMessage:Oe.agentMessage??null,agentNativeSessionId:Oe.agentNativeSessionId??null,agentResumeRecovered:Oe.agentResumeRecovered===!0,agentRich:Oe.agentRich===!0,agentActivity:Oe.agentActivity??0,agentCwd:Oe.agentCwd??null,reviewed:Oe.reviewed??null});break}case"git-status":{Kr.getState().setSessionGitStatus(_t,Oe.gitStatus??null);break}case"focus-mode":{Z("[Terminal] focus tracking mode",{backendSessionId:Mt.current,requested:Oe.focusTrackingRequested===!0});break}case"resize-ack":{dt.current?.acknowledgeResize({seq:Oe.seq,ok:Oe.ok!==!1,cols:Oe.cols,rows:Oe.rows,screenSyncPending:Oe.screenSyncPending,screenSyncGeneration:Oe.screenSyncGeneration});break}case"pty-size":{typeof Oe.cols=="number"&&typeof Oe.rows=="number"&&dt.current?.notifyServerSize(Oe.cols,Oe.rows,Oe.source);break}case"shell-title":{Qa(_t,Oe.title??null);break}case"prompt-state":{er(_t,Oe.state??"idle",Oe.exitCode??null);break}case"tui-progress":{Kr.getState().setSessionTuiProgress(_t,Oe.tuiProgress??null);break}case"exit":{const hr=typeof Oe.exitCode=="number"?Oe.exitCode:null,Fr=typeof Oe.signal=="number"?Oe.signal:null;An(_t,`\r
69
+ [Process exited${hr!==null?` with code ${hr}`:""}${Fr!==null?` (signal ${Fr})`:""}]\r
70
+ `),dn(_t),mn(_t,!1),Zr("Terminal session ended"),ct(!1),jn(!1),He(null),Qt(null),kn(_t,!1),In();break}}},onError:(Oe,_t)=>{if(Wn.current!==Fe)return;const hr=oe;if(!hr)return;Ht.current=!1;const Fr=_t&&Oe.message==="Authentication required",L=O2(Oe),j=Fr?Oe.message:L||_t?"Reconnecting...":Oe.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${_t}):`,j),L&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:Mt.current,frontendSessionId:hr,isActive:c,isMobile:be,fatal:_t,stack:new Error().stack}),Zr(j),jn(!!_t),_t&&(He(null),mn(hr,!1),In(),L&&(Z("[onError] Session lost, auto-recreating"),Zr("Reconnecting..."),jn(!1),dn(hr),bn(hr),Mt.current=null,ts.current=!1,Is()))}},{...xI,getDimensions:()=>dt.current?.getDimensions()??null});lt.current=()=>{Tt.close(),Wn.current===Fe&&(At.current=null)},At.current=ie},[An,bn,dn,Z,In,is,F,Si,Is,Qa,mn,_n,$r,kn,Dn,er,we,oe]);C.useEffect(()=>{const ie=iI({isActive:c,isStreamReady:ve,reconnectStartedAt:Te,now:Date.now()});if(ie===null)return;const Fe=window.setTimeout(()=>{Z("[Terminal] visible reconnect watchdog expired",{backendSessionId:Mt.current,reconnectStartedAt:Te}),In(),mn(oe,!1),Zr("Reconnecting..."),jn(!1),He(Date.now()),Is()},ie);return()=>window.clearTimeout(Fe)},[Z,In,c,ve,Te,Is,oe,mn]);const ts=C.useRef(!1),ui=C.useRef(!1),_i=C.useRef(0);C.useEffect(()=>()=>{_i.current+=1,ts.current=!1,In()},[In]);const Ji=C.useRef(Rt),Fa=C.useRef(Mr);C.useEffect(()=>{const ie=Ji.current,Fe=Fa.current;Ji.current=Rt,Fa.current=Mr,Ot.current===oe&&(ie===Rt&&Fe===Mr||(ts.current=!1,In(),Je(yt=>yt+1)))},[Rt,Mr,In,oe]),C.useEffect(()=>{if(Ot.current!==oe&&(Z(`[useEffect] sessionId changed from ${Ot.current} to ${oe}, allowing reinitialization`),ts.current=!1,ui.current=!1),ts.current&&Ot.current===oe){Z(`[useEffect] Already initialized for sessionId=${oe}, skipping`);return}if(!ae)return;const ie=async _t=>{if(Z(`[ensureSession] Starting for sessionId=${oe}, runId=${_t}`),!Ot.current||Ot.current!==oe){Z(`[ensureSession] SessionId mismatch or stale run (current=${Ot.current}, target=${oe}), skipping`);return}if(_t!==_i.current){Z(`[ensureSession] Stale run detected (runId=${_t}, currentRunId=${_i.current}), skipping`);return}const hr=Kr.getState(),Fr=hr.getTerminalSession(oe),L=Fr?.mode??Rt;Z("[ensureSession] Current state from store:",{terminalSessionId:Fr?.terminalSessionId,mode:Fr?.mode,tmuxSessionName:Fr?.tmuxSessionName,isConnecting:Fr?.isConnecting});let j=Fr?.terminalSessionId??null,O=!j;if(j&&L!==Rt?(Z(`[ensureSession] Store mode mismatch for ${j}: current=${L} desired=${Rt}, will create new session`),O=!0,hr.clearTerminalSession(oe),j=null):j&&Rt==="tmux"&&Mr&&Fr?.tmuxSessionName!==Mr&&(Z(`[ensureSession] Store tmux name mismatch for ${j}: current=${Fr?.tmuxSessionName} desired=${Mr}, will create new session`),O=!0,hr.clearTerminalSession(oe),j=null),j&&we.checkHealth&&!_e.current){Z(`[ensureSession] Checking health of existing session ${j}`);try{const H=await we.checkHealth(j);if(Z("[ensureSession] Health check result:",H),!H.healthy)Z(`[ensureSession] Session ${j} is NOT healthy (healthy=${H.healthy}), will create new session`),Z("[ensureSession] Health check details:",H),O=!0,H.mode&&Fr?.terminalSessionId&&hr.setTerminalSession(oe,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:H.mode,tmuxSessionName:H.tmuxSessionName??null}),hr.clearTerminalSession(oe),Z("[ensureSession] Cleared unhealthy session from store");else{Z(`[ensureSession] Session ${j} is healthy, reusing it, cwd=${H.cwd}, clients=${H.clients}, lastActivity=${Date.now()-(H.lastActivity||0)}ms ago`),H.mode&&Fr?.terminalSessionId&&hr.setTerminalSession(oe,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:H.mode,tmuxSessionName:H.tmuxSessionName??null}),Z(`[ensureSession] Setting terminalIdRef to ${j} and starting stream`),Mt.current=j,xa(j),Z(`[ensureSession] Successfully reused healthy session ${j}, returning early`);return}}catch(H){Z(`[ensureSession] Failed to check health of session ${j}:`,H),Z("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(Z(`[ensureSession] Decision: shouldCreateNewSession=${O}, terminalId=${j}`),O){Z(`[ensureSession] Creating new session, shouldCreateNewSession=${O}, runId=${_t}`),Zr(null),jn(!1),hr.setConnecting(oe,!0);const Qe=Kr.getState().getTerminalSession(oe),st=(Qe?.mode??Rt)===Rt&&(Rt!=="tmux"||!Mr||Qe?.tmuxSessionName===Mr);if(Qe?.terminalSessionId&&st)Z(`[ensureSession] Race condition avoided: another instance already created session ${Qe.terminalSessionId}`),hr.setConnecting(oe,!1),j=Qe.terminalSessionId,O=!1;else try{const ot=await ho();if(Z(`[ensureSession] Opened managed backend session ${ot.sessionId}`),_t!==_i.current){Z(`[ensureSession] Stale run after session creation (runId=${_t}, currentRunId=${_i.current}), leaving ${ot.sessionId} for sibling`);return}hr.setTerminalSession(oe,ot),Z(`[ensureSession] Updated store with new session ${ot.sessionId}`),j=ot.sessionId}catch(ot){if(_t!==_i.current){Z("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(ot instanceof Ef&&pm(ot)){Z("[ensureSession] Confirmed missing persisted session:",{sessionId:oe,error:ot.message}),hr.clearTerminalSession(oe),Zr(ph),jn(!0),hr.setConnecting(oe,!1);return}Zr("Reconnecting..."),jn(!0),hr.setConnecting(oe,!1);return}}if(_t!==_i.current){Z(`[ensureSession] Stale run before starting stream (runId=${_t}, currentRunId=${_i.current}), skipping`);return}if(!j){Z(`[ensureSession] No terminalId, terminalId=${j}`);return}Z(`[ensureSession] Starting stream for session ${j}`),Mt.current=j,xa(j),Z(`[ensureSession] ensureSession completed for sessionId=${oe}, terminalId=${j}`)};let Fe=null,yt=null;const Tt=()=>{yt=null,!(ts.current&&Ot.current===oe)&&(Z(`[useEffect] Running ensureSession for sessionId=${oe}, hasInitialized=${ts.current}`),ts.current=!0,ui.current=!0,Fe=++_i.current,ie(Fe))};if(!I&&!ui.current){Z(`[useEffect] Holding background connection until the selected session is ready: ${oe}`);return}const Oe=ui.current?0:Math.max(0,E);return Oe>0?(Z(`[useEffect] Delaying initial connection for sessionId=${oe} by ${Oe}ms`),yt=window.setTimeout(Tt,Oe)):Tt(),()=>{yt!==null&&window.clearTimeout(yt),Z(`[useEffect] Cleanup for sessionId=${oe}, runId=${Fe??"pending"}`)}},[oe,Ke,xa,In,we,Z,Rt,Mr,Qn,E,I,ae]);const $a=C.useCallback(async()=>{if(oe&&!ss){$(!0),Zr(null),jn(!1),He(null),In();try{we.forceKill&&await we.forceKill({sessionId:oe})}catch{}Mn(oe),bn(oe),dt.current?.clear(),await new Promise(ie=>setTimeout(ie,100));try{mn(oe,!0);const ie=await ho();pn(oe,ie),Mt.current=ie.sessionId,xa(ie.sessionId)}catch(ie){Zr(ie instanceof Ef&&pm(ie)?ph:"Reconnecting..."),jn(!0),mn(oe,!1)}finally{$(!1)}}},[oe,ss,In,we,Mn,bn,mn,pn,xa,ho]),po=C.useCallback((ie,Fe,yt,Tt)=>{if(!(Mt.current!==Fe||z.current!==yt)){if(ie instanceof Ef&&O2(ie)){Z("[Terminal] operation backend missing, recovering",{terminalId:Fe,sessionId:oe}),Zr("Reconnecting..."),jn(!1),In(),dn(oe),Mt.current=null,mn(oe,!0),Is();return}Zr(ie instanceof Error?ie.message:Tt)}},[dn,Z,In,Is,oe,mn]),Al=C.useCallback((ie,Fe)=>{if(!_e.current&&!Fe?.targeted||!ie)return;const yt=_k(ie),Tt=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(ie);if(Br&&Tt&&(Ur.current=!0),Date.now()<$t.current)return;let Oe=ie,_t=Fe?.consumeModifier??!1;if(!Fe?.skipModifierTransform&&Yt&&ie.length>0){const O=ie[0];if(O.length===1&&/[a-zA-Z]/.test(O)){const H=O.toUpperCase();Yt==="ctrl"?(Oe=String.fromCharCode(H.charCodeAt(0)&31),_t=!0):Yt==="alt"&&(Oe=`\x1B${ie}`,_t=!0)}_t||(Yt==="alt"&&(Oe=`\x1B${ie}`),_t=!0)}const hr=Mt.current;if(!hr)return;const Fr=z.current,j=(async()=>{try{if(Br&&!yt&&Ur.current&&we.tmuxAction){Ur.current=!1;try{await we.tmuxAction(hr,{action:"copy-mode",enabled:!1})}catch{}if(Mt.current!==hr||z.current!==Fr)return!1;if(Lk(Oe))return!0}return await we.sendInput(hr,Oe),qr(oe),!0}catch(O){return po(O,hr,Fr,"Failed to send input"),!1}})();return _t&&(rr||xr(null),gn()),j},[Yt,qr,gn,po,Br,rr,oe,we]);C.useEffect(()=>{const ie=Fe=>{const yt=Fe,Tt=yt.detail?.sessionId;if(Tt?Tt!==oe:!_e.current)return;const Oe=yt.detail?.text;if(!Oe)return;const _t=yt.detail?.nonce;if(nn.current||!dt.current){_t&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:_t,ok:!1}}));return}const hr=dt.current?.sendSequence(Oe,{paste:yt.detail?.paste,targeted:!!Tt});_t&&Promise.resolve(hr).then(Fr=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:_t,ok:Fr===!0}}))},()=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:_t,ok:!1}}))}),bT(bt.current,yt.detail?.focus!==!1)&&gn()};return window.addEventListener("termdock-insert-reference",ie),()=>window.removeEventListener("termdock-insert-reference",ie)},[gn,oe]);const tl=C.useCallback((ie,Fe,yt)=>{const Tt=Mt.current;if(!Tt){Ue("xterm resize push skipped: no terminalId",{cols:ie,rows:Fe});return}Ue("xterm resize push",{cols:ie,rows:Fe}),we.resize({sessionId:Tt,cols:ie,rows:Fe,seq:yt}).catch(Oe=>{dt.current?.acknowledgeResize({seq:yt,ok:!1}),Oe&&/session not found/i.test(String(Oe.message||Oe))&&console.warn("[Terminal] resize 404 session not found",{sessionId:Tt,cols:ie,rows:Fe,stack:new Error().stack})})},[we,Ue]),Mo=C.useCallback(async ie=>{const Fe=Mt.current;if(!Fe||!we.tmuxAction)return;const yt=z.current;try{const Tt=await we.tmuxAction(Fe,ie);if(Mt.current!==Fe||z.current!==yt)return;Tt.layout&&(Qt(Tt.layout),ie.action==="switch-session"&&(pn(oe,{sessionId:Fe,cols:80,rows:24,mode:"tmux",tmuxSessionName:Tt.layout.sessionName}),X7(oe,{tmuxSessionName:Tt.layout.sessionName}).catch(Oe=>{console.warn("[Terminal] failed to update inventory after tmux switch",Oe)})))}catch(Tt){po(Tt,Fe,yt,"Failed to execute tmux action")}},[po,oe,pn,we]);C.useEffect(()=>{if(!xt||!wt)return;const Fe=xt.windows.find(yt=>yt.id===xt.activeWindowId)?.panes.find(yt=>yt.id===xt.activePaneId);Fe&&dt.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${wt}:${xt.sessionId}:${Fe.id}:${Fe.width}x${Fe.height}`})},[xt,wt]);const $s=C.useCallback((ie,Fe=5)=>{const yt=Math.max(1,Math.min(Math.floor(Fe)||1,40));Ur.current=!0;const Tt=Or.current;if(Tt&&Tt.direction===ie){Tt.lines+=yt;return}Tt&&Mo({action:"scroll",direction:Tt.direction,lines:Tt.lines}).finally(()=>{gn()}),Or.current={direction:ie,lines:yt},es.current&&clearTimeout(es.current),es.current=setTimeout(()=>{const Oe=Or.current;Oe&&(Or.current=null,Mo({action:"scroll",direction:Oe.direction,lines:Oe.lines}).finally(()=>{gn()}))},0)},[gn,Mo]),Do=C.useCallback(ie=>{const Fe=Date.now(),yt=ai.current,Tt=yt!==null&&yt.modifier===ie&&Fe-yt.timestamp<=fI;if(ai.current={modifier:ie,timestamp:Fe},rr===ie){Ir(null),xr(null);return}if(Tt){Ir(ie),xr(ie);return}rr!==null&&rr!==ie&&Ir(null),xr(Oe=>Oe===ie?null:ie)},[rr]),ba=C.useCallback(ie=>{if(rt(ie&&_e.current),Ue("input focus changed",{focused:ie,isActive:_e.current,isMobile:bt.current}),!bt.current||!_e.current){Ye(!1);return}Ye(Fe=>Fe===ie?Fe:ie)},[Ue]),ya=C.useCallback(ie=>{if(Ct.current=ie,Si(ie,"viewport-watermark"),!ie&&cr.current.length>0){const Fe=oe;if(Fe){const yt=cr.current;cr.current=[];for(const Tt of yt)An(Fe,Tt)}}},[An,Si,oe]),va=C.useCallback(ie=>{_e.current&&dt.current?.ensureSizeMatches(ie)},[]),ps=C.useRef(null);C.useEffect(()=>{if(!c)return;const ie=ps.current;if(!ie)return;const Fe=()=>va("pointerdown"),yt=()=>va("keydown"),Tt=()=>va("touchstart"),Oe=()=>va("wheel");return ie.addEventListener("pointerdown",Fe),ie.addEventListener("keydown",yt),ie.addEventListener("touchstart",Tt,{passive:!0}),ie.addEventListener("wheel",Oe,{passive:!0}),()=>{ie.removeEventListener("pointerdown",Fe),ie.removeEventListener("keydown",yt),ie.removeEventListener("touchstart",Tt),ie.removeEventListener("wheel",Oe)}},[c,va]);const Li=C.useCallback(ie=>{dt.current=ie},[]),mo=C.useCallback(ie=>{De(ie),U?.(oe,ie)},[U,oe]),go=C.useCallback(ie=>{const Fe=jk(ie);if(!Fe)return;const yt=Yt!==null;dt.current?.sendSequence(Fe,{consumeModifier:yt})},[Yt]),xo=C.useCallback(ie=>{const Fe=Ek(ie);if(Fe.length===0)return;const yt=Yt!==null;dt.current?.sendSequence(j2(Fe[0]),{consumeModifier:yt});for(let Tt=1;Tt<Fe.length;Tt+=1){const Oe=Fe[Tt];window.setTimeout(()=>{dt.current?.sendSequence(j2(Oe))},Ik*Tt)}},[Yt]),Us=C.useCallback(()=>{dt.current?.pasteClipboardText()},[]),zs=C.useCallback(ie=>{xs.current!==null&&(window.clearTimeout(xs.current),xs.current=null),Xe(ie),(ie==="inserted"||ie==="failed")&&(xs.current=window.setTimeout(()=>{xs.current=null,Xe("idle")},1400))},[]),jo=C.useCallback(()=>{zs("idle"),Ge(0),Di.current?.click()},[zs]),Yn=C.useCallback(()=>{Nr(!0)},[]),as=C.useCallback(ie=>{const Fe=ie.currentTarget.files?.[0];if(ie.currentTarget.value="",!Fe)return;cn(null),Vr(null),Ge(0),zs("uploading");const yt=br&&Fe.type.startsWith("video/")?{maxHeight:pe,videoBitrate:Er,onProgress:Ge}:null,Tt=fe&&mI(Fe)?{maxDimension:Ve,quality:nr}:null;let Oe=yt?"视频压缩":Tt?"图片压缩":"文件上传";(async()=>{const _t=yt?await(await rh(async()=>{const{compressVideoLocally:hr}=await import("./videoCompression-BCnqCkRK.js");return{compressVideoLocally:hr}},__vite__mapDeps([0,1,2,3,4,5]))).compressVideoLocally(Fe,yt):Tt?await(await rh(async()=>{const{compressImageLocally:hr}=await import("./imageCompression-DaUBNTq-.js");return{compressImageLocally:hr}},[])).compressImageLocally(Fe,Tt):Fe;Oe="文件上传",await R3(_t,(hr,Fr)=>Zu(hr,Fr,void 0,Ge),hr=>{if(Oe="插入终端",!_e.current||nn.current)throw new Error(`终端暂不可用,文件已上传至 ${hr}`);window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:N3(hr,null),focus:!0}}))}),(yt||Tt)&&Vr({file:_t,kind:yt?"video":"image",originalSize:Fe.size,uploadedSize:_t.size,originalRetained:_t===Fe})})().then(()=>zs("inserted"),_t=>{const hr=H2(_t);cn({stage:Oe,detail:hr}),Nr(!0),zs("failed"),da("warn","MOBILE_MEDIA_UPLOAD failed",{stage:Oe,detail:hr})})},[Er,br,pe,fe,Ve,nr,zs]);C.useEffect(()=>{if(!an||!br)return;let ie=!0;return fs(null),Bt({phase:"checking-cache"}),rh(async()=>{const{prepareLocalVideoCompression:Fe}=await import("./videoCompression-BCnqCkRK.js");return{prepareLocalVideoCompression:Fe}},__vite__mapDeps([0,1,2,3,4,5])).then(({prepareLocalVideoCompression:Fe})=>{if(ie)return Fe(yt=>{ie&&Bt(yt)})}).catch(Fe=>{ie&&fs(H2(Fe))}),()=>{ie=!1}},[an,br]);const di=Be||Dr!==null;nn.current=di;const ji=C.useRef(jr);di||(ji.current=jr);const Bi=di?ji.current:jr,Hs=C.useMemo(()=>Nk(Bi,rn),[Bi,rn]),bo=C.useMemo(()=>Q2(rn,tt),[tt,rn]),Ws=!be&&tt!=="auto"&&bo.id!=="default"&&bo.showOnDesktop!==!0?"auto":tt,hi=Ws==="auto"?Hs:Ws,sn=C.useMemo(()=>Q2(rn,hi),[hi,rn]),wa=C.useMemo(()=>sn.actions.filter(ie=>ie.sequence.trim().length>0).map((ie,Fe)=>({...ie,label:fm(ie,Fe)})),[sn.actions]),Gs=C.useMemo(()=>C3(jr),[jr]),ea=sn.label,Aa=C.useMemo(()=>Ws!=="auto"?`Manual preset: ${sn.label}`:Gs?`Auto preset · ${sn.label} (${Gs})`:"Auto preset",[Gs,Ws,sn.label]),Ta=C.useCallback(ie=>{jt(ie)},[]),fi=C.useCallback(()=>{dr(ie=>ie==="copy"?"arrows":"copy"),We("idle")},[]),ta=C.useCallback(()=>{typeof window>"u"||(Pn.current!==null&&window.clearTimeout(Pn.current),Pn.current=window.setTimeout(()=>{Pn.current=null,We("idle")},1200))},[]),Cs=C.useCallback(ie=>{Pn.current!==null&&typeof window<"u"&&(window.clearTimeout(Pn.current),Pn.current=null),We(ie?"copied":"failed"),ta()},[ta]),Ca=C.useCallback(ie=>{Ne(ie)},[]),Ua=C.useMemo(()=>be?Rk(rn):Mk(rn),[be,rn]),rs=C.useMemo(()=>J7(a),[a]);C.useEffect(()=>{if(!Br||!ve||!ae||!wt)return;const ie=OT(rs);ie&&we.sendInput(wt,ie).catch(Fe=>{console.warn("[Terminal] Failed to synchronize tmux default colors:",Fe)})},[Br,ve,ae,wt,we,rs]);const ms=C.useMemo(()=>`terminal::${oe}`,[oe]);C.useEffect(()=>{$e?.({isConnecting:Be,isRestarting:ss,hasError:!!Dr,sessionId:wt})},[Be,ss,Dr,wt,$e]);const Sa=!wt||Be||ss,rl=C.useCallback((ie,Fe)=>{if(Sa)return;const yt=Math.max(1,Math.min(Math.floor(Fe)||1,40));$s(ie,yt)},[$s,Sa]);C.useEffect(()=>{if(!c||!be)return;dt.current?.requestRefresh("resize",{skipScrollToBottom:!kt,force:!0})},[c,be,kt,Dt,oe]),C.useEffect(()=>{if(!c||!be)return;const ie=Fe=>{const yt=Fe.detail;dt.current?.requestRefresh("resize",{skipScrollToBottom:yt?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",ie),()=>{document.removeEventListener("termdock:viewport-keyboard-change",ie)}},[c,be,oe]);const Qi=!X&&(be||sn.id==="default"||sn.showOnDesktop===!0),yo=c,za=be&&!ze?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,nl=be&&!ze?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,Ha=i.jsx(Bk,{visible:Qi,interactive:yo,presentation:be?"mobile":"desktop-actions",activeModifier:Yt,lockedModifier:rr,disabled:Sa,defaultShowExtended:ne,presetLabel:ea,presetModeLabel:Aa,presetMode:Ws,presetOptions:Ua,includeAlt:sn.includeAlt,presetRowLayout:sn.rowLayout,extraActions:wa,onKeyPress:go,onTextPress:xo,onPastePress:be?Us:void 0,onFilePress:be?jo:void 0,onFileLongPress:be?Yn:void 0,fileUploadState:Lr,fileUploadProgress:Pt,longPressMode:Et,copyFeedback:Jt,onLongPressModeToggle:fi,onModifierToggle:Do,onPresetSelect:Ta,onExpandedChange:Ca}),_a=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return i.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:za,children:[i.jsx("input",{ref:Di,type:"file",className:"hidden",onChange:as}),an&&Ai.createPortal(i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>Nr(!1),"aria-label":qe("common.close")}),i.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"mobile-video-compression-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] z-modal-panel max-h-[calc(100dvh-1.5rem)] overflow-y-auto rounded-2xl border border-border/15 bg-surface p-4 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:left-1/2 sm:right-auto sm:w-[min(28rem,calc(100vw-2rem))] sm:-translate-x-1/2",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h2",{id:"mobile-video-compression-title",className:"text-sm font-semibold text-foreground",children:"本地媒体压缩"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"按文件类型选择压缩方式,处理完成后才上传。"})]}),i.jsx("button",{type:"button",className:"min-h-10 rounded-lg bg-surface-2 px-3 text-xs",onClick:()=>Nr(!1),children:qe("common.close")})]}),It&&i.jsxs("div",{role:"alert",className:"mt-3 rounded-lg bg-destructive/10 p-3 text-xs text-destructive",children:[i.jsxs("p",{children:[It.stage,"失败。",It.stage.endsWith("压缩")?"原文件未上传。":It.stage==="插入终端"?"文件已上传,路径见详情。":""]}),i.jsxs("details",{className:"mt-2",children:[i.jsx("summary",{className:"cursor-pointer",children:"错误详情"}),i.jsx("p",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:It.detail})]})]}),Pr&&i.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:"本机未能保存设置,重新打开后可能恢复默认值。"}),i.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[i.jsx("span",{children:"压缩图片后上传"}),i.jsx("input",{type:"checkbox",checked:fe,onChange:ie=>Sr({imageEnabled:ie.target.checked}),className:"h-4 w-4 accent-primary"})]}),fe&&i.jsxs("div",{className:"mt-3 space-y-3",children:[i.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片最长边",i.jsx("select",{value:Ve,onChange:ie=>Sr({imageMaxDimension:Number(ie.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:M3.map(ie=>i.jsxs("option",{value:ie,children:[ie," px",ie===640?" · 最省流量":ie===2048?" · 推荐":ie===4096?" · 保留更多细节":""]},ie))})]}),i.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片画质:",Math.round(nr*100),"%",i.jsx("input",{type:"range",min:Su.min,max:Su.max,step:Su.step,value:nr,onChange:ie=>Sr({imageQuality:Number(ie.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"支持 JPEG、PNG、HEIC 照片;GIF、SVG 等保持原文件。压缩后未变小也会保留原图。"})]}),i.jsx("div",{className:"mt-4 border-t border-border/15 pt-1"}),i.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[i.jsx("span",{children:"压缩视频后上传"}),i.jsx("input",{type:"checkbox",checked:br,onChange:ie=>Sr({videoEnabled:ie.target.checked}),className:"h-4 w-4 accent-primary"})]}),br&&i.jsxs("div",{className:"mt-4 space-y-4",children:[i.jsxs("label",{className:"block text-xs text-muted-foreground",children:["视频最长边(像素)",i.jsx("select",{value:pe,onChange:ie=>Sr({videoMaxHeight:Number(ie.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:D3.map(ie=>i.jsxs("option",{value:ie,children:[ie," px",ie===240?" · 最省流量":ie===720?" · 推荐":ie>=1440?" · 手机处理较慢":""]},ie))})]}),i.jsxs("label",{className:"block text-xs text-muted-foreground",children:["目标视频码率:",Er/1e6," Mbps",i.jsx("input",{type:"range",min:_u.min,max:_u.max,step:_u.step,value:Er,onChange:ie=>Sr({videoBitrate:Number(ie.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"保持比例,不放大原视频。尺寸越小通常处理越快;码率越低体积通常越小,过高可能比原片更大。"}),i.jsx("p",{className:"text-[11px] text-muted-foreground",role:"status","aria-live":"polite",children:Rr?"本地转码器准备失败,请关闭开关后重试。":gI(Ar)}),Ar?.saved===!1&&i.jsx("p",{className:"text-[11px] text-destructive",children:"本机未能保存转码器,重新打开后可能需要重新下载。"}),Rr&&i.jsx("p",{className:"text-[11px] text-destructive",children:Rr})]})]})]}),document.body),vt&&i.jsx(Qk,{isMobile:be,isInputFocused:se,isIOS:Ze,isConnecting:Be,connectionError:Dr,terminalSessionId:wt}),i.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:rs.background,...nl},children:[i.jsx("div",{ref:ps,className:"h-full w-full box-border",children:i.jsx(e8,{fallback:i.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:i.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),i.jsx("span",{className:"text-sm text-muted-foreground",children:qe("terminal.componentFailed")})]})}),children:i.jsx(yk,{ref:Li,sessionKey:ms,sessionId:oe,isLayoutVisible:g,chunks:W,onInput:Al,onResize:tl,onFlowControl:ya,onTmuxScroll:Br?rl:void 0,tmuxScrollSensitivity:.38,onDoubleTap:be?()=>{dt.current?.sendSequence(" ")}:void 0,onInputFocusChange:ba,onMobileLongPressCopyResult:Cs,onReadyChange:mo,onSizeSynchronizedChange:mt,onWritesSettled:oi,onWriteProgress:vn,onCursorPositionChange:cs,onDirectoryLinkActivate:yr,terminalSettings:Ee,theme:rs,enableTouchScroll:be,mobileLongPressMode:Et,autoFocus:!h&&!be&&!_a,cursorVisible:!h&&gt,suppressSmoothScroll:!re||!je,className:h||!gt?"terminal-focus-suspended":void 0},ms)})}),i.jsx(hI,{result:Lt,onDismiss:ut}),i.jsx(Ok,{connectionError:Dr,isFatalError:zn,isRestarting:ss,isConnecting:Be,onHardRestart:$a})]}),ee?X?null:Ai.createPortal(Ha,ee):Ha]})};function yI({session:e,active:t,onActivate:r,onToggleRightSidebar:n}){const{t:a}=Qr(),l=Kr(c=>{const h=c.sessions.get(e.id);return qo(e,h?.activeProgram??null,h?.cwd??null,void 0,h?.shellTitle??null,h?.promptState??null).primary});return i.jsxs("div",{"data-pane-titlebar":"true",className:"swiper-no-swiping flex h-6 min-h-6 shrink-0 items-center border-b border-border app-chrome-bg",children:[i.jsxs("button",{type:"button","data-split-pane-title":e.id,draggable:!1,onDragStart:c=>c.preventDefault(),"aria-pressed":t,title:`${l} · 拖动标题移动,边缘拆分,中央交换`,onClick:r,className:"split-pane-drag-handle flex h-full min-w-0 cursor-grab active:cursor-grabbing flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-[12px] font-medium leading-none text-foreground hover:bg-surface focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:[i.jsx(Ro,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:l}),i.jsx(Zh,{size:12,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),t&&i.jsx("span",{"aria-hidden":"true",className:"h-1 w-1 shrink-0 rounded-full bg-primary"})]}),n&&i.jsx("button",{type:"button",onClick:n,"aria-label":a("tab.explorerTitle"),title:a("tab.explorerTitle"),className:"inline-flex h-full w-7 shrink-0 items-center justify-center text-muted-foreground hover:bg-surface hover:text-foreground focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:i.jsx(Lb,{size:14})})]})}const vI="termdock:startup:";function Xc(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${vI}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function W2(e,t){e||Ai.flushSync(t)}const mm="horizontal";function r0(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function mh(e,t){if(!Array.isArray(e)||e.length!==t)return r0(t);const r=e.map(Number);if(r.some(a=>!Number.isFinite(a)||a<=0))return r0(t);const n=r.reduce((a,l)=>a+l,0);return n<=0?r0(t):r.map(a=>a/n)}function wI(e){const t=Math.max(1,Math.ceil(Math.sqrt(Math.max(1,e))));return{columns:t,rows:Math.max(1,Math.ceil(Math.max(1,e)/t))}}function AI(e){return e==="horizontal"||e==="vertical"||e==="grid"}function TI(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,n=[];for(const a of e){if(!a||typeof a!="object")continue;const l=a;if(typeof l.id!="string"||!l.id||r.has(l.id))continue;const c=Array.isArray(l.sessionIds)?l.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],h=[...new Set(c)];if(h.length<2)continue;const p=wI(h.length);h.forEach(g=>t.add(g)),r.add(l.id),n.push({id:l.id,...typeof l.name=="string"&&l.name.trim()?{name:l.name.trim().slice(0,80)}:{},sessionIds:h,layout:AI(l.layout)?l.layout:mm,ratios:mh(l.ratios,h.length),...l.gridColumnRatios!==void 0?{gridColumnRatios:mh(l.gridColumnRatios,p.columns)}:{},...l.gridRowRatios!==void 0?{gridRowRatios:mh(l.gridRowRatios,p.rows)}:{}})}return n}function CI(e,t){const r=new Set(t);return e.flatMap(n=>{const a=n.sessionIds.filter(l=>r.has(l));return a.length<2?[]:[{...n,sessionIds:a,ratios:a.length===n.sessionIds.length?mh(n.ratios,a.length):r0(a.length)}]})}function Fu(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function dp(e,t,r){if(!t||!r||t===r)return e;const n=Fu(e,t),a=Fu(e,r);if(n&&n.id===a?.id)return e;const l=[...n?.sessionIds??[t],...a?.sessionIds??[r]],c=[...new Set(l)],h={id:n?.id??`split:${t}`,...n?.name?{name:n.name}:{},sessionIds:c,layout:c.length>2&&(!n||n.layout===mm)?"grid":n?.layout??mm,ratios:r0(c.length)},p=new Set([n?.id,a?.id].filter(Boolean)),g=e.filter(y=>!p.has(y.id)),x=n?Math.max(0,e.findIndex(y=>y.id===n.id)):g.length;return g.splice(Math.min(x,g.length),0,h),g}function SI(e,t){const r=Fu(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(a=>a.id!==r.id);const n=r.sessionIds.filter(a=>a!==t);return e.map(a=>a.id===r.id?{...a,sessionIds:n,ratios:r0(n.length)}:a)}function _I(e,t){const r=Fu(e,t);return r?e.filter(n=>n.id!==r.id):e}function LI(e,t,r){return e.map(n=>{if(n.id!==t)return n;const a=[...new Set(r)],l=new Set(n.sessionIds);return a.length===n.sessionIds.length&&a.every(h=>l.has(h))?{...n,sessionIds:a}:n})}function kI(e,t,r){const n=r.trim().slice(0,80);return e.map(a=>a.id===t?{...a,...n?{name:n}:{name:void 0}}:a)}const gm=320,Q3=1,II=gm+120,xm="termdock:split-workspaces:v2",P3="termdock:split-workspace:v1",EI=.1,NI=.9;function hp(){if(typeof window>"u")return{mobile:!1,landscape:!1};const t=(navigator.maxTouchPoints>0||"ontouchstart"in window)&&Math.min(window.innerWidth,window.innerHeight)<768;return{mobile:t,landscape:t&&window.innerWidth>window.innerHeight}}function RI(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(xm);if(e)return TI(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(P3)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(NI,Math.max(EI,typeof t.ratio=="number"?t.ratio:.5));return[{id:`split:${t.primaryId}`,sessionIds:[t.primaryId,t.secondaryId],layout:t.direction==="vertical"?"vertical":"horizontal",ratios:[r,1-r]}]}}catch{}return[]}function MI(e,t){const r=new Map(e.map(c=>[c.id,c])),n=new Map;t.forEach(c=>c.sessionIds.forEach(h=>n.set(h,c)));const a=new Set,l=[];for(const c of e){const h=n.get(c.id);if(!h){l.push({key:c.id,sessions:[c]});continue}if(a.has(h.id))continue;a.add(h.id);const p=h.sessionIds.flatMap(g=>{const x=r.get(g);return x?[x]:[]});p.length>=2&&l.push({key:h.id,sessions:p,workspace:h})}return l}function G2(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function Fd(e,t){const r=Mh(e,t);if(r===null)return;const n=e.wrapperEl;G2(e),n&&(n.style.transitionDuration="0ms");try{const a=e;a.setTransition?.(0),a.setTranslate?.(r),G2(e),n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}catch{n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}}function bm(e){try{const t=typeof e.getTranslate=="function"?e.getTranslate():e.translate;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return typeof e.translate=="number"&&Number.isFinite(e.translate)?e.translate:null}}function Mh(e,t){const r=e.snapGrid,n=Array.isArray(r)?r[t]:void 0;return typeof n!="number"||!Number.isFinite(n)?null:-n}function DI(e,t){const r=bm(e),n=Mh(e,t);return r!==null&&n!==null&&Math.abs(r-n)<=Q3}function jI(e){const t=[],r=new Map,n=new Map,a=new Map;for(const l of e){const c=r.get(l.id)??[];if(c.push(l.id),r.set(l.id,c),l.sessionId){const h=n.get(l.sessionId)??[];h.push(l.id),n.set(l.sessionId,h)}if(l.mode==="tmux"&&l.tmuxSessionName){const h=a.get(l.tmuxSessionName)??[];h.push(l.id),a.set(l.tmuxSessionName,h)}}for(const[l,c]of r)c.length>1&&t.push({kind:"frontend",key:l,sessionIds:c});for(const[l,c]of n)c.length>1&&t.push({kind:"backend",key:l,sessionIds:c});for(const[l,c]of a)c.length>1&&t.push({kind:"tmux",key:l,sessionIds:c});return t}function O3(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function F3(e){return{id:e.sessionId,name:e.name,customName:e.customName===!0,sessionId:e.backendSessionId,mode:e.mode==="tmux"||e.mode==="shell"?e.mode:"shell",tmuxSessionName:e.tmuxSessionName??null}}function BI(e,t){const r=O3(e),n=r.findIndex(a=>a.id===t.id);if(n>=0){const a=[...r];return a[n]=t,a}return[...r,t]}function V2(e,t){const r=new Map(e.map(n=>[n.id,n]));return t.map(n=>{const a=r.get(n.sessionId);return{...F3(n),history:a?.history}})}function q2(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function Y2(e){if(!e||typeof e!="object")return"unknown";const t=e;if(typeof t.pointerType=="string"&&t.pointerType)return t.pointerType;if(typeof t.type=="string"){if(t.type.startsWith("touch"))return"touch";if(t.type.startsWith("mouse"))return"mouse";if(t.type.startsWith("pointer"))return"pointer"}return"unknown"}function Z2(e){const t=new Map;for(const[r,n]of e)t.set(r,n.cwd??null);return t}function QI(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t)if(e.get(r)!==n)return!1;return!0}function PI(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const r=Date.now().toString(36),n=Math.random().toString(36).slice(2,8);return`wt-${r}${n}`}const OI=({terminalSettings:e=Jm(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:n,terminalFocusAvailable:a=!0,defaultSessionMode:l="shell",defaultTmuxSessionName:c="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:x,desktopFloatingTitle:y=!1,desktopPinnedLeftSidebarWidth:A=0,desktopViewportWidth:w=0,onStatusChange:k,onSessionDataUpdate:E,onInitialViewportReady:I,onInitialRecoveryRequired:M})=>{const{t:B}=Qr(),F=b.useMemo(()=>n0("session"),[]),U=b.useMemo(()=>n0("terminal"),[]),[G,Q]=b.useState([]),[X,ee]=b.useState(null),ze=Xn(z=>z.activePaneId);b.useEffect(()=>{Xn.getState().setActivePane(X)},[X]);const[he,de]=b.useState(null),[$e,qe]=b.useState(!0),[oe,Re]=b.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[K,we]=b.useState(()=>new Set),[Z,Ue]=b.useState(()=>({token:0,completed:new Set})),[Le,Y]=b.useState(0),[Ee,be]=b.useState(()=>new Set),[Me,Ze]=b.useState(()=>new Set),Se=b.useRef(new Map),[se,Ye]=b.useState(()=>new Set),pt=b.useRef(!1),rt=b.useRef(null),ye=b.useRef({}),[et,ht]=b.useState(null),[te,ve]=b.useState(()=>RI()),[ct,re]=b.useState(!1),[me,je]=b.useState(null),[mt,ae]=b.useState(null),[De,gt]=b.useState(null),[ft,kt]=b.useState(!1),[Dt,Yt]=b.useState(()=>hp().mobile),[xr,rr]=b.useState(()=>hp().landscape),[Ir,ne]=b.useState(null),[Ne,tt]=b.useState(null),jt=b.useRef(a),Et=b.useRef(!1),dr=b.useRef(!1),Jt=b.useRef(null),We=b.useRef(null),Lr=b.useRef(Dt),Xe=b.useRef(null),Pt=b.useRef(0),Ge=b.useRef([]),It=b.useRef(0),cn=b.useRef(null),Lt=b.useRef(!1),Vr=b.useRef(!0),ut=b.useRef(null),fn=b.useRef(""),Sr=b.useRef(0);b.useEffect(()=>{if(typeof window>"u")return;const z=()=>{const le=hp();Lr.current=le.mobile,Yt(le.mobile),rr(le.landscape)};return z(),window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)},[]);const{sessions:Pr,inventory:br,activeSessionId:pe,isLoading:Er,openSession:fe,setActiveSession:Ve,removeSession:nr,renameSession:an,resetSessionCustomName:Nr,reorderSessions:Ar,restoreSessions:Bt}=t8(),Rr=br?.tmuxRecovery??null;b.useEffect(()=>{Rr&&M?.()},[Rr,M]),b.useEffect(()=>{gt(null),ae(null)},[Rr?.id]);const fs=b.useCallback(async()=>{ae("restore"),gt(null);try{const z=await r8();await Bt(),z.failed>0&&gt(B("tab.tmuxRecoveryPartial",{restored:z.restored,failed:z.failed}))}catch{gt(B("tab.tmuxRecoveryFailed"))}finally{ae(null)}},[Bt,B]),Xr=b.useCallback(async()=>{ae("dismiss"),gt(null);try{await n8(),await Bt()}catch{gt(B("tab.tmuxRecoveryDismissFailed"))}finally{ae(null)}},[Bt,B]),pn=Zt(z=>z.groupByFolder),mn=Tu(z=>z.collaborationGroups),An=Zt(z=>z.leftOpen||z.rightOpen),Rn=Zt(z=>z.rightSidebarWidthContextKey),dn=Zt(z=>z.rightSidebarWidth),Mn=Zt(z=>z.rightPinned),[bn,_n]=b.useState(()=>Z2(Kr.getState().sessions));b.useEffect(()=>Kr.subscribe(z=>{const le=Z2(z.sessions);_n(xe=>QI(xe,le)?xe:le)}),[]);const{arranged:Dn}=b.useMemo(()=>Th(G,z=>bn.get(z.id)??null,pn,"",te,mn),[G,bn,pn,te,mn]),kn=b.useRef(Dn);kn.current=Dn;const $r=b.useMemo(()=>MI(Dn,te),[Dn,te]),Ts=b.useRef($r);Ts.current=$r;const er=b.useMemo(()=>Fu(te,X),[X,te]),qr=b.useMemo(()=>{const z=$r.find(le=>le.sessions.some(xe=>xe.id===X));return new Set(z?.sessions.map(le=>le.id)??[])},[X,$r]),Qn=b.useMemo(()=>{const z=new Map;if(!g||w<=0)return z;for(const le of $r){const xe=le.sessions[0];if(!xe)continue;const Pe=s8(xe.id,bn.get(xe.id)??null,le.workspace?.id??null);if(!(Pe===Rn?Mn:i8(xe.id,bn.get(xe.id)??null,le.workspace?.id??null)))continue;const Ft=Pe===Rn?dn:a8(xe.id,bn.get(xe.id)??null,le.workspace?.id??null),tr=nh(Ft,w,A);z.set(le.key,tr+ub)}return z},[bn,A,g,Mn,Rn,dn,w,$r]),Tn=b.useMemo(()=>cp(G.map(z=>({id:z.id,backendSessionId:z.sessionId})),h),[h,G]),Yr=b.useMemo(()=>q2(Pr,pe),[pe,Pr]),jr=Pd({prioritySessionId:Tn,activeSessionId:he??X,persistedActiveSessionId:Yr,firstSessionId:G[0]?.id??null}),rn=b.useMemo(()=>aI($r.flatMap(z=>z.sessions.map(le=>le.id)),qr),[qr,$r]),Br=jr!==null&&K.has(jr),W=b.useMemo(()=>{const z=new Set(qr);return he&&z.add(he),!z.size&&jr&&z.add(jr),z},[qr,he,jr]),Be=Z.token===oe.token&&rI(W,Z.completed),wt=Be||Le===oe.token?oe.token:-1;b.useEffect(()=>{if(!oe.token||Be)return;const z=window.setTimeout(()=>Y(oe.token),Wk);return()=>window.clearTimeout(z)},[oe.token,Be]);const yr=b.useCallback((z,le)=>{we(xe=>{if(xe.has(z)===le)return xe;const Ht=new Set(xe);return le?Ht.add(z):Ht.delete(z),Ht})},[]),Rt=b.useCallback(z=>{const le=Pt.current;Ue(Pe=>{if(Pe.token===le&&Pe.completed.has(z))return Pe;const Ht=new Set(Pe.token===le?Pe.completed:[]);return Ht.add(z),{token:le,completed:Ht}});const xe=Tn??he??Xe.current;z===xe&&Xc("foreground-stream-connected")},[he,Tn]),Mr=b.useCallback((z,le)=>{be(xe=>{if(xe.has(z)===le)return xe;const Pe=new Set(xe);return le?Pe.add(z):Pe.delete(z),Pe})},[]),Dr=b.useCallback((z,le)=>{Ze(xe=>{if(xe.has(z)===le)return xe;const Pe=new Set(xe);return le?Pe.add(z):Pe.delete(z),Pe})},[]);b.useEffect(()=>{for(const[z,le]of Se.current){const xe=G.find(Pe=>Pe.id===z);if(!xe||xe.sessionId!==le.backendSessionId){Se.current.delete(z);continue}!K.has(z)||!Ee.has(z)||!Me.has(z)||(Se.current.delete(z),cb(le.backendSessionId,`${le.command}\r`).catch(Pe=>{console.error("[Session] Failed to send startup command:",Pe)}))}},[G,K,Ee,Me]);const Zr=jr!==null&&Ee.has(jr),nn=jr!==null&&Me.has(jr);b.useEffect(()=>{Zr&&Xc("foreground-viewport-ready")},[Zr]),b.useEffect(()=>{nn&&Xc("foreground-content-ready")},[nn]),b.useEffect(()=>{if(!I)return;if(!$e&&G.length===0){I();return}if(!Zr||!Br||!nn)return;const z=[...qr].every(Ft=>Ee.has(Ft)&&K.has(Ft)&&Me.has(Ft));let le=0,xe=0;const Pe=()=>{le=requestAnimationFrame(()=>{xe=requestAnimationFrame(()=>{Xc("initial-viewport-presented"),I()})})};z&&Pe();const Ht=z?void 0:window.setTimeout(Pe,8e3);return()=>{cancelAnimationFrame(le),cancelAnimationFrame(xe),clearTimeout(Ht)}},[Br,nn,Zr,$e,I,G.length,qr,Ee,K,Me]);const zn=b.useMemo(()=>Dt?qk({slides:$r.map(z=>z.sessions.map(le=>le.id)),visibleSessionIds:qr,foregroundSessionId:jr}):se,[Dt,$r,qr,jr,se]);b.useEffect(()=>{if(Dt||qr.size===0)return;const z=new Set(qr),le=$r.findIndex(xe=>xe.sessions.some(Pe=>qr.has(Pe.id)));for(let xe=-2;xe<=2;xe+=1)xe!==0&&$r[le+xe]?.sessions.forEach(Pe=>z.add(Pe.id));Ye(xe=>{let Pe=!1;const Ht=new Set(xe);for(const Ft of z)Ht.has(Ft)||(Ht.add(Ft),Pe=!0);return Pe?Ht:xe})},[Dt,qr,$r]);const jn=kT(zn);b.useEffect(()=>{if(!he)return;if(!G.some(le=>le.id===he)){de(null);return}if(!Ee.has(he)||!K.has(he)||!Me.has(he))return;const z=window.setTimeout(()=>{de(le=>le===he?null:le),jt.current&&!Lr.current&&ht({sessionId:he,token:Date.now()})},80);return()=>window.clearTimeout(z)},[Me,he,K,G,Ee]),b.useEffect(()=>{typeof window>"u"||(te.length>0?(window.localStorage.setItem(xm,JSON.stringify(te)),window.localStorage.removeItem(P3)):window.localStorage.removeItem(xm))},[te]),b.useEffect(()=>{Er||$e||te.length===0||ve(z=>CI(z,G.map(le=>le.id)))},[Er,$e,G,te.length]),b.useEffect(()=>{if(!me)return;const z=window.setTimeout(()=>je(null),3200);return()=>window.clearTimeout(z)},[me]),Xe.current=X,Pt.current=oe.token,Ge.current=G,cn.current=pe,Lt.current=Er,Vr.current=$e,jt.current=a;const ss=b.useCallback((z=rt.current)=>{const le=It.current,xe=typeof window<"u"?window.visualViewport:null,Pe=z?bm(z):null,Ht=z?Mh(z,le):null;return{sessionsLength:Ge.current.length,workspaceSlidesLength:Ts.current.length,sessionIds:Ge.current.map(Ft=>Ft.id),activeSessionId:Xe.current,activeSessionIndex:le,persistedActiveId:cn.current,isLoading:Lt.current,isRestoring:Vr.current,activeIndex:z?.activeIndex??null,previousIndex:z?.previousIndex??null,animating:z?.animating??null,allowTouchMove:z?.allowTouchMove??null,width:z?.width??null,translate:Pe,targetTranslate:Ht,translateDelta:Pe!==null&&Ht!==null?Pe-Ht:null,snapGridLength:z?.snapGrid?.length??null,targetSnap:z?.snapGrid?.[le]??null,visualViewport:xe?{width:Math.round(xe.width),height:Math.round(xe.height),offsetTop:Math.round(xe.offsetTop)}:null}},[]),$=b.useCallback((z,le)=>{F(z,{...ss(),...le})},[F,ss]);b.useEffect(()=>{Er||$e||X!==pe&&Ve(X)},[X,Er,$e,pe,Ve]);const Te=b.useMemo(()=>{if(Dn.length===0||!X)return 0;const z=$r.findIndex(le=>le.sessions.some(xe=>xe.id===X));return z>=0?z:0},[$r,X]);It.current=Te;const He=b.useCallback(()=>{Jt.current&&(clearTimeout(Jt.current),Jt.current=null)},[]),Ke=b.useCallback(z=>{He(),Jt.current=setTimeout(()=>{Jt.current=null,Et.current=!1,$("[swiper:touch-guard-clear]",{reason:z})},II)},[He,$]),Je=b.useCallback((z,le={})=>{const xe=rt.current,Pe=It.current,Ht=Ts.current;if(!xe||Ht.length===0||Pe<0||Pe>=Ht.length)return;if(Et.current){$("[swiper:sync-skip-touch]",{reason:z});return}if(xe.animating){$("[swiper:sync-skip-animating]",{reason:z});return}const Ft=bm(xe),tr=Mh(xe,Pe),Xt=Ft!==null&&tr!==null&&Math.abs(Ft-tr)<=Q3,Hr=xe.activeIndex===Pe;if($("[swiper:sync-check]",{reason:z,activeIndexAligned:Hr,translateAligned:Xt,immediate:le.immediate===!0}),!(Hr&&Xt)){if(Hr){Fd(xe,Pe),$("[swiper:sync-forced-active]",{reason:z,translateAligned:Xt,immediate:le.immediate===!0});return}le.immediate?(Fd(xe,Pe),xe.slideTo(Pe,0,!1),Fd(xe,Pe)):xe.slideTo(Pe,gm,!1),$("[swiper:sync-applied]",{reason:z,activeIndexAligned:Hr,translateAligned:Xt,immediate:le.immediate===!0})}},[$]);b.useEffect(()=>{const z=le=>{const xe=le;rt.current&&(rt.current.allowTouchMove=!xe.detail.locked),$("[swiper:gesture-lock]",{locked:xe.detail.locked})};return document.addEventListener("termdock:gesture-lock",z),()=>document.removeEventListener("termdock:gesture-lock",z)},[$]),b.useEffect(()=>{if(G.length===0){X!==null&&ee(null);return}if(!X){if(!p)return;ee(Pd({prioritySessionId:Tn,activeSessionId:null,persistedActiveSessionId:Yr,firstSessionId:G[0]?.id??null}));return}G.some(le=>le.id===X)||ee(G[0].id)},[G,X,p,Tn,Yr]);const xt=b.useCallback((z,le)=>{if(le&&Date.now()<Sr.current){ye.current[z]=!1;return}ye.current[z]=le,tt(xe=>le?z:xe===z?null:xe)},[]),Qt=b.useCallback(z=>{if(!Et.current&&z.activeIndex!==It.current){$("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:z.activeIndex,expectedActiveIndex:It.current}),requestAnimationFrame(()=>Je("ignored-layout-slide-change",{immediate:!0}));return}const le=Ts.current[z.activeIndex],xe=le?.sessions.some(Ft=>Ft.id===X)?X:le?.sessions[0]?.id;if($("[swiper:slide-change]",{nextSessionId:xe??null,instanceActiveIndex:z.activeIndex}),!xe||xe===X)return;const Pe=!!X&&ye.current[X]===!0,Ht=jt.current&&(!Lr.current||Pe);if(We.current=xe,ee(xe),Ht){ht({sessionId:xe,token:Date.now()});return}ht(null)},[G,X,$,Je]);b.useLayoutEffect(()=>{if(We.current===X){$("[swiper:sync-skip-swiper-driven]",{activeSessionId:X}),We.current=null;return}Je("active-session-index",{immediate:!0})},[X,Te,G.length,Je,$]),b.useEffect(()=>{const z=rt.current;if(!z)return;const le=$r.length>1&&!An&&!ct;z.allowTouchMove!==le&&(z.allowTouchMove=le,$("[swiper:allow-touch-sync]",{nextAllow:le,sidebarOverlayOpen:An}))},[$r.length,$,An,ct]);const vt=b.useCallback(z=>{const le=rt.current;if(!le)return;const xe=le.el;if($("[swiper:layout-before]",{reason:z,scrollLeft:xe?.scrollLeft??null}),xe&&(xe.scrollLeft=0),le.updateSize(),le.updateSlides(),le.updateProgress(),le.updateSlidesClasses(),xe&&(xe.scrollLeft=0),$("[swiper:layout-after]",{reason:z,scrollLeft:xe?.scrollLeft??null}),Et.current||le.animating){$("[swiper:layout-skip-sync-motion]",{reason:z});return}Je(`layout:${z}`,{immediate:!0}),requestAnimationFrame(()=>{const Pe=rt.current;Pe&&(Et.current||Pe.animating||Fd(Pe,It.current))})},[$,Je]);b.useEffect(()=>()=>He(),[He]);const lt=$r.map(z=>z.key).join("\0");b.useEffect(()=>{requestAnimationFrame(()=>vt("group-change"))},[pn,lt,vt]),b.useEffect(()=>{let z=null,le="mount";const xe=Xt=>{le=Xt,z===null&&(z=requestAnimationFrame(()=>{z=null,vt(`viewport-change:${le}`)}))},Pe=()=>xe("window-resize"),Ht=()=>xe("visual-viewport-resize"),Ft=()=>xe("visual-viewport-scroll"),tr=Xt=>{xe(`measured:${Xt.detail?.source??"unknown"}`)};return window.addEventListener("resize",Pe),window.visualViewport?.addEventListener("resize",Ht),window.visualViewport?.addEventListener("scroll",Ft),document.addEventListener(sg,tr),xe("mount"),()=>{window.removeEventListener("resize",Pe),window.visualViewport?.removeEventListener("resize",Ht),window.visualViewport?.removeEventListener("scroll",Ft),document.removeEventListener(sg,tr),z!==null&&cancelAnimationFrame(z)}},[vt]),b.useEffect(()=>{if(typeof document>"u")return;let z=null,le=null;const xe=Hr=>{if(Hr!=="online"&&document.hidden)return;const yn=performance.now();if(!nI(le,yn))return;le=yn;const P=Hr==="bfcache"||Hr==="online"?Hr:"visibility",Ae=sI();Nf(),da("info","PWA_RESUME scheduled",{source:Hr,forceForegroundReconnect:Ae,activeSessionId:Xe.current}),Re(_e=>({token:_e.token+1,reason:P,forceForegroundReconnect:Ae})),requestAnimationFrame(()=>vt(`resume:${Hr}:raf`)),z&&clearTimeout(z),z=setTimeout(()=>{z=null,vt(`resume:${Hr}:settled`)},320)},Pe=()=>{if(document.hidden){Nf();return}xe("visibility")},Ht=()=>{Nf()},Ft=Hr=>{xe(Hr.persisted?"bfcache":"pageshow")},tr=()=>xe("online"),Xt=()=>xe("focus");return document.addEventListener("visibilitychange",Pe),window.addEventListener("pagehide",Ht),window.addEventListener("pageshow",Ft),window.addEventListener("online",tr),window.addEventListener("focus",Xt),()=>{document.removeEventListener("visibilitychange",Pe),window.removeEventListener("pagehide",Ht),window.removeEventListener("pageshow",Ft),window.removeEventListener("online",tr),window.removeEventListener("focus",Xt),z&&clearTimeout(z)}},[vt]),b.useLayoutEffect(()=>{if(!eI($e))return;const z=jI(G),le=JSON.stringify(z);z.length>0&&le!==fn.current?(fn.current=le,console.warn("[session-invariant] duplicate mapping detected",z)):z.length===0&&fn.current&&(fn.current=""),E?.({sessions:G.map(xe=>({id:xe.id,name:xe.name,customName:xe.customName,mode:xe.mode,tmuxSessionName:xe.tmuxSessionName})),activeSessionId:X,splitWorkspaces:te.map(({id:xe,name:Pe,sessionIds:Ht,layout:Ft})=>({id:xe,...Pe?{name:Pe}:{},sessionIds:Ht,layout:Ft}))})},[G,X,te,E,$e]),b.useEffect(()=>{if(Er||pt.current)return;pt.current=!0;const z=cp(Pr.map(Ft=>({id:Ft.sessionId,backendSessionId:Ft.backendSessionId??null})),h),le=q2(Pr,pe),xe=Pd({prioritySessionId:p?z:null,activeSessionId:null,persistedActiveSessionId:le,firstSessionId:Pr[0]?.sessionId??null}),Pe=O3(Pr.map(F3));if(F("[Session] Restoring",Pe.length,"persisted sessions (one-shot)"),$("[swiper:restore-start]",{persistedSessionIds:Pr.map(Ft=>Ft.sessionId),nextActiveSessionId:xe}),Pe.length>0){const Ft=Kr.getState();Pe.forEach(Xt=>{Xt.sessionId&&Ft.setTerminalSession(Xt.id,{sessionId:Xt.sessionId,cols:80,rows:24,mode:Xt.mode,tmuxSessionName:Xt.tmuxSessionName,history:Xt.history})}),Pr.forEach(Xt=>{Xt.agent!==void 0&&Ft.setSessionAgentIdentity(Xt.sessionId,Xt.agent),Xt.activeProgram!=null&&Ft.setSessionActiveProgram(Xt.sessionId,Xt.activeProgram),Xt.cwd!=null&&Ft.setSessionCwd(Xt.sessionId,Xt.cwd),Xt.shellTitle!=null&&Ft.setSessionShellTitle(Xt.sessionId,Xt.shellTitle)}),Q(Pe);const tr=xe||Pe[0]?.id||null;ee(tr),$("[swiper:restore-complete]",{restoredSessionIds:Pe.map(Xt=>Xt.id),nextActiveSessionId:tr})}(async()=>(Pe.length===0&&await ut.current?.({createIfEmpty:!0}),qe(!1),requestAnimationFrame(()=>Je("restore-finished",{immediate:!0}))))()},[Er,Pr,pe,F,$,Je,p,h]),b.useEffect(()=>{if(!p||$e||G.length===0)return;const z=cp(G.map(xe=>({id:xe.id,backendSessionId:xe.sessionId})),h),le=Pd({prioritySessionId:z,activeSessionId:Xe.current,persistedActiveSessionId:Yr,firstSessionId:G[0]?.id??null});le&&le!==Xe.current&&ee(le)},[p,h,$e,Yr,G]);const At=b.useRef([]),Mt=b.useRef(!1);Xe.current=X,b.useEffect(()=>{if($e)return;const z=At.current,le=Pr,xe=new Map(z.map(P=>[P.sessionId,P])),Pe=Kr.getState();for(const P of le){const Ae=xe.get(P.sessionId),_e=Kr.getState().sessions.get(P.sessionId);P.agent!==void 0&&JSON.stringify(P.agent)!==JSON.stringify(_e?.agent)&&(_e?.agent==null||JSON.stringify(P.agent)!==JSON.stringify(Ae?.agent))&&Pe.setSessionAgentIdentity(P.sessionId,P.agent),P.activeProgram!=null&&P.activeProgram!==_e?.activeProgram&&(_e?.activeProgram==null||P.activeProgram!==Ae?.activeProgram)&&Pe.setSessionActiveProgram(P.sessionId,P.activeProgram),P.cwd!=null&&P.cwd!==_e?.cwd&&(_e?.cwd==null||P.cwd!==Ae?.cwd)&&Pe.setSessionCwd(P.sessionId,P.cwd),P.shellTitle!=null&&P.shellTitle!==_e?.shellTitle&&(_e?.shellTitle==null||P.shellTitle!==Ae?.shellTitle)&&Pe.setSessionShellTitle(P.sessionId,P.shellTitle)}if(!Mt.current){Q(P=>V2(P,le)),At.current=le,Mt.current=!0;return}const Ht=new Set(z.map(P=>P.sessionId)),Ft=new Set(le.map(P=>P.sessionId)),tr=new Map(z.map(P=>[P.sessionId,P.name]));At.current=le,Q(P=>{const Ae=V2(P,le);return(!Xe.current||!Ae.some(_e=>_e.id===Xe.current))&&ee(Ae[0]?.id??null),Ae});const Xt=le.filter(P=>!Ht.has(P.sessionId)),Hr=[...Ht].filter(P=>!Ft.has(P)),yn=le.filter(P=>Ht.has(P.sessionId)&&tr.get(P.sessionId)!==P.name);(Xt.length>0||Hr.length>0||yn.length>0)&&F("[Session] Synced persisted sessions:",{newSessionIds:Xt.map(P=>P.sessionId),removedSessionIds:Hr,renamedSessionIds:yn.map(P=>P.sessionId),currentSessionIds:le.map(P=>P.sessionId)});for(const P of le){if(!P.backendSessionId)continue;Kr.getState().setTerminalSession(P.sessionId,{sessionId:P.backendSessionId,cols:80,rows:24,mode:P.mode,tmuxSessionName:P.tmuxSessionName})}},[Pr,$e,F]);const Ot=b.useCallback(async z=>{try{const le=Zt.getState(),xe=X?{rightOpen:le.rightOpen,rightPinned:le.rightPinned,rightSidebarWidth:le.rightSidebarWidth,rightTab:le.rightTab}:null,Pe=z?.mode==="tmux"||z?.mode==="shell"?z.mode:l,Ht=(z?.tmuxSessionName||"").trim(),Ft=c.trim(),tr=Pe==="tmux"?Ht||Ft||PI():null,Xt=typeof z?.cwd=="string"?z.cwd:null,Hr=X?Kr.getState().sessions.get(X)?.cwd??null:null,yn=typeof Xt=="string"&&Xt.trim().length>0?Xt:typeof Hr=="string"&&Hr.trim().length>0?Hr:void 0,P=await fe({mode:Pe,tmuxSessionName:tr,cwd:yn,termType:"xterm-256color",createIfEmpty:z?.createIfEmpty===!0}),Ae=P.session,_e=P.terminalSession;!P.reused&&xe&&Zt.getState().initializeRightSidebarForSession(Ae.sessionId,_e.cwd??yn??null,xe);const at={id:Ae.sessionId,name:Ae.name,customName:Ae.customName===!0,sessionId:_e.sessionId,mode:_e.mode??Ae.mode,tmuxSessionName:_e.tmuxSessionName??Ae.tmuxSessionName},bt=z?.command?.trim();return bt&&Se.current.set(at.id,{backendSessionId:_e.sessionId,command:bt}),Q(Vt=>BI(Vt,at)),ee(at.id),Kr.getState().setTerminalSession(at.id,{sessionId:_e.sessionId,cols:80,rows:24,mode:at.mode,tmuxSessionName:at.tmuxSessionName,activeProgram:_e.activeProgram,activeProgramRaw:_e.activeProgramRaw,activeProgramSource:_e.activeProgramSource,cwd:_e.cwd}),F("[Session] Inventory opened session:",{frontendSessionId:at.id,backendSessionId:_e.sessionId,reused:P.reused,mode:at.mode,tmuxSessionName:at.tmuxSessionName}),at.id}catch(le){return console.error("[Session] Failed to create new session:",le),null}},[l,c,X,fe,F]);ut.current=Ot;const dt=b.useCallback((z,le={})=>{Xn.getState().setActivePane(z);const xe=Xe.current,Pe=!!xe&&ye.current[xe]===!0;if(ee(z),Lr.current&&le.preserveMobileKeyboard===!1){Sr.current=Date.now()+600,xe&&(ye.current[xe]=!1),tt(null),ht(null);const Ht=document.activeElement;Ht instanceof HTMLTextAreaElement&&Ht.closest(".terminal-viewport-container")&&Ht.blur();return}Pe&&Lr.current&&tt(z),jt.current&&(!Lr.current||Pe)&&ht({sessionId:z,token:Date.now()})},[]),Ct=b.useCallback(z=>{ee(z),re(!0),je(null)},[]),ar=b.useCallback(z=>{const le=Xe.current;!le||le===z||(ve(xe=>dp(xe,le,z)),re(!1),dt(le,{preserveMobileKeyboard:!1}))},[dt]),cr=b.useCallback(async()=>{const z=Xe.current;if(!z||ft)return;kt(!0);const le=Kr.getState().sessions.get(z)?.cwd??void 0,xe=await Ot({cwd:le||void 0,mode:l});if(kt(!1),!xe){je(B("common.error"));return}ve(Pe=>dp(Pe,z,xe)),re(!1),dt(z,{preserveMobileKeyboard:!1})},[dt,l,Ot,ft,B]),$t=b.useCallback(z=>{ve(le=>_I(le,z)),z&&dt(z,{preserveMobileKeyboard:!1})},[dt]),Ur=b.useCallback(z=>{ve(le=>SI(le,z)),dt(z,{preserveMobileKeyboard:!1})},[dt]),Or=b.useCallback(z=>{if(G.find(xe=>xe.id===z)){if(Xn.getState().setActivePane(z),z===Xe.current)return;if(ee(z),!Kk({isMobile:Lr.current,viewportReady:Ee.has(z),streamReady:K.has(z),contentReady:Me.has(z)})){de(null),jt.current&&ht({sessionId:z,token:Date.now()}),F("[Session] Switched to session:",z);return}Ye(Pe=>{if(Pe.has(z))return Pe;const Ht=new Set(Pe);return Ht.add(z),Ht}),de(z),F("[Session] Switched to session:",z)}},[Me,F,K,G,Ee]),es=b.useCallback((z,le)=>{le.trim()&&(Q(xe=>xe.map(Pe=>Pe.id===z?{...Pe,name:le.trim(),customName:!0}:Pe)),an(z,le.trim()))},[an]),js=b.useCallback(z=>{Q(le=>le.map(xe=>xe.id===z?{...xe,customName:!1}:xe)),Nr(z)},[Nr]),ai=b.useCallback(z=>{Q(le=>{const xe=new Map(le.map(tr=>[tr.id,tr])),Pe=z.map(tr=>xe.get(tr)).filter(tr=>tr!==void 0),Ht=new Set(z),Ft=le.filter(tr=>!Ht.has(tr.id));return[...Pe,...Ft]}),Ar(z),F("[Session] Reordered sessions:",z),requestAnimationFrame(()=>{rt.current?.update()})},[Ar,F]),Fs=b.useCallback(async z=>{const le=typeof z=="string"?z:z.sessionId,xe=typeof z=="string"?"auto":z.closeMode??"auto",Pe=G.find(Ft=>Ft.id===le);if(!Pe)return;const Ht=o8(Dn,le,Ft=>Ft.id);try{xe==="destroy"&&Pe.mode==="tmux"&&Pe.tmuxSessionName?(await db(Pe.tmuxSessionName),F("[Session] Destroyed tmux session:",{frontendSessionId:Pe.id,tmuxSessionName:Pe.tmuxSessionName})):Pe.sessionId&&(await lb(Pe.sessionId),F("[Session] Closed backend terminal:",Pe.sessionId))}catch(Ft){console.error("[Session] Failed to close backend terminal:",Ft);return}Q(Ft=>{const tr=Ft.filter(Xt=>Xt.id!==le);return ee(Ht),tr}),nr(le,Ht),delete ye.current[le],F("[Session] Closed session:",{sessionId:le,closeMode:xe})},[G,Dn,nr,F]),zr=b.useCallback(z=>{if(!z)return;const le=G.filter(xe=>xe.sessionId===z);if(le.length!==0){le.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:z,frontendSessionIds:le.map(xe=>xe.id)}),Q(xe=>{const Pe=xe.filter(Ht=>Ht.sessionId!==z);return Pe.length!==xe.length&&!Pe.some(Ft=>Ft.id===X)&&ee(Pe.length>0?Pe[0].id:null),Pe});for(const xe of le)nr(xe.id),delete ye.current[xe.id];F("[Session] Backend gone, dropped local session(s):",le.map(xe=>xe.id))}},[G,X,nr,F]);b.useEffect(()=>{const z=Vt=>{Ot(Vt.detail)},le=Vt=>{Or(Vt.detail)},xe=()=>{const Vt=Xe.current;!Vt||Lr.current||ht({sessionId:Vt,token:Date.now()})},Pe=Vt=>{const Nt=Vt;Nt.detail&&Ct(Nt.detail)},Ht=Vt=>{const Nt=Vt.detail;$t(Nt??Xe.current??void 0)},Ft=Vt=>{const Nt=Vt.detail;Nt&&Ur(Nt)},tr=Vt=>{const Nt=Vt.detail,Wr=typeof Nt=="string"?Nt:Nt?.layout,Pn=typeof Nt=="string"?Xe.current:Nt?.sessionId;Wr!=="horizontal"&&Wr!=="vertical"&&Wr!=="grid"||ve(xs=>xs.map(Di=>Di.sessionIds.includes(Pn??"")?{...Di,layout:Wr}:Di))},Xt=Vt=>{const Wr=Vt.detail?.direction;if(Wr!=="prev"&&Wr!=="next")return;const Pn=kn.current;if(Pn.length<=1)return;const xs=Xe.current,Di=xs?Pn.findIndex(vn=>vn.id===xs):-1,li=((Di>=0?Di:0)+(Wr==="next"?1:-1)+Pn.length)%Pn.length,fa=Pn[li]?.id;fa&&fa!==xs&&Or(fa)},Hr=Vt=>{Fs(Vt.detail)},yn=Vt=>{zr(Vt.detail)},P=Vt=>{const Nt=Vt;!Nt.detail?.sessionId||!Nt.detail?.name||es(Nt.detail.sessionId,Nt.detail.name)},Ae=Vt=>{const Nt=Vt;Nt.detail?.sessionId&&js(Nt.detail.sessionId)},_e=Vt=>{const Nt=Vt;Nt.detail?.sessionIds&&ai(Nt.detail.sessionIds)},at=Vt=>{const Nt=Vt.detail;!Nt?.workspaceId||!Array.isArray(Nt.sessionIds)||ve(Wr=>LI(Wr,Nt.workspaceId,Nt.sessionIds))},bt=Vt=>{const Nt=Vt.detail;!Nt?.workspaceId||typeof Nt.name!="string"||ve(Wr=>kI(Wr,Nt.workspaceId,Nt.name))},ur=Vt=>{const Nt=Vt.detail;!Nt?.primaryId||!Nt.secondaryId||Nt.primaryId===Nt.secondaryId||(ve(Wr=>dp(Wr,Nt.primaryId,Nt.secondaryId)),dt(Nt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",z),window.addEventListener("switch-terminal-session",le),window.addEventListener("focus-active-terminal-session",xe),window.addEventListener("open-terminal-split-chooser",Pe),window.addEventListener("close-terminal-split",Ht),window.addEventListener("remove-terminal-split-pane",Ft),window.addEventListener("set-terminal-split-direction",tr),window.addEventListener("cycle-terminal-session",Xt),window.addEventListener("close-terminal-session",Hr),window.addEventListener("close-terminal-session-by-backend",yn),window.addEventListener("rename-terminal-session",P),window.addEventListener("reset-terminal-session-name",Ae),window.addEventListener("reorder-terminal-session",_e),window.addEventListener("reorder-terminal-split-workspace",at),window.addEventListener("rename-terminal-split-workspace",bt),window.addEventListener("combine-terminal-split-sessions",ur),()=>{window.removeEventListener("new-terminal-session",z),window.removeEventListener("switch-terminal-session",le),window.removeEventListener("focus-active-terminal-session",xe),window.removeEventListener("open-terminal-split-chooser",Pe),window.removeEventListener("close-terminal-split",Ht),window.removeEventListener("remove-terminal-split-pane",Ft),window.removeEventListener("set-terminal-split-direction",tr),window.removeEventListener("cycle-terminal-session",Xt),window.removeEventListener("close-terminal-session",Hr),window.removeEventListener("close-terminal-session-by-backend",yn),window.removeEventListener("rename-terminal-session",P),window.removeEventListener("reset-terminal-session-name",Ae),window.removeEventListener("reorder-terminal-session",_e),window.removeEventListener("reorder-terminal-split-workspace",at),window.removeEventListener("rename-terminal-split-workspace",bt),window.removeEventListener("combine-terminal-split-sessions",ur)}},[dt,Ot,Or,Ct,$t,Ur,Fs,zr,es,js,ai]),b.useEffect(()=>{if(!er||Dt)return;const z=le=>{if(!(le.ctrlKey||le.metaKey)||!le.shiftKey)return;if(er.layout==="horizontal"?le.key==="ArrowLeft"||le.key==="ArrowRight":er.layout==="vertical"?le.key==="ArrowUp"||le.key==="ArrowDown":le.key.startsWith("Arrow")){le.preventDefault(),le.stopPropagation();const Pe=er.sessionIds.indexOf(Xe.current??""),Ht=le.key==="ArrowLeft"||le.key==="ArrowUp"?-1:1,Ft=(Math.max(0,Pe)+Ht+er.sessionIds.length)%er.sessionIds.length,tr=er.sessionIds[Ft];if(!tr)return;dt(tr);return}le.key==="Backspace"&&(le.preventDefault(),le.stopPropagation(),$t(Xe.current??void 0))};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[dt,er,$t,Dt]);const on=z=>{const le=Kr.getState().sessions.get(z.id);return qo(z,le?.activeProgram??null,le?.cwd??null,void 0,le?.shellTitle??null,le?.promptState??null)},Wn=(z,le={})=>{const xe=z.id===X&&!ze?.startsWith("@collaboration:"),Pe=qr.has(z.id)&&!le.hidden,Ht=p&&Zk({sessionId:z.id,foregroundSessionId:jr,visibleSessionIds:qr,deferredViewportSessionIds:Dt?jn:zn}),Ft=Yk({sessionId:z.id,foregroundSessionId:jr,foregroundReady:Br,isVisible:Pe})&&p,tr=tI({sessionId:z.id,foregroundSessionId:jr,requestToken:oe.token,foregroundCompletedToken:wt,isVisible:W.has(z.id)})&&p,Xt=Pe||z.id===jr||zn.has(z.id)?0:rn.get(z.id)??fh;return i.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${le.hidden?"invisible pointer-events-none":""}`,style:le.containerStyle,"aria-hidden":le.hidden||void 0,onPointerDownCapture:()=>{Pe&&W2(xe,()=>dt(z.id))},onWheelCapture:()=>{W2(xe,()=>dt(z.id))},children:[le.showPaneTitle&&i.jsx(yI,{session:z,active:xe,onActivate:()=>dt(z.id),onToggleRightSidebar:xe?x:void 0}),i.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Ht&&i.jsx(bI,{sessionId:z.id,mode:z.mode,tmuxSessionName:z.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:xe,focusSuspended:he!==null,deferCursorUntilPositioned:he===z.id||z.mode==="tmux"&&!Me.has(z.id),isLayoutVisible:Pe,initialConnectEnabled:Ft&&tr,resumeRequestEnabled:tr,suppressKeyboard:le.suppressKeyboard,keyboardPortalTarget:le.keyboardPortalTarget,sharedMobileKeyboardLayout:le.sharedMobileKeyboardLayout,suppressPageFlipRefresh:le.suppressPageFlipRefresh,focusRequestToken:et?.sessionId===z.id?et.token:0,resumeRequestToken:oe.token,resumeRequestReason:oe.reason,forceResumeReconnect:oe.forceForegroundReconnect&&W.has(z.id),resumeRequestDelayMs:W.has(z.id)?0:le.hidden?fh:rn.get(z.id)??fh,initialConnectDelayMs:Xt,onStreamReadyChange:yr,onStreamConnected:Rt,onViewportReadyChange:Mr,onContentReadyChange:Dr,onKeyboardVisibilityChange:xt,showDebug:n,onStatusChange:xe?k:void 0})})]},z.id)};return i.jsxs("div",{className:"relative h-full flex flex-col",children:[Rr&&i.jsx("section",{className:"fixed inset-x-3 top-[calc(var(--safe-top-inset)+0.75rem)] z-toast mx-auto max-w-lg rounded-2xl border border-warning/30 bg-surface-elevated px-4 py-3.5 shadow-[0_20px_60px_var(--app-shadow-strong)]",role:"alert","aria-live":"assertive",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-warning/15 text-warning",children:i.jsx(yb,{size:18})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:B("tab.tmuxRecoveryTitle",{count:Rr.sessions.length})}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:B("tab.tmuxRecoveryHint")}),i.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Rr.sessions.map(z=>z.name).join(" · ")}),De&&i.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:De}),i.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[i.jsxs("button",{type:"button",disabled:mt!==null,onClick:()=>{fs()},className:"inline-flex min-h-9 items-center gap-1.5 rounded-lg bg-primary px-3 text-[11px] font-medium text-primary-foreground transition active:opacity-80 disabled:opacity-50",children:[i.jsx(kb,{size:13,className:mt==="restore"?"animate-spin":""}),B(mt==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),i.jsx("button",{type:"button",disabled:mt!==null,onClick:()=>{Xr()},className:"inline-flex min-h-9 items-center rounded-lg px-3 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-50",children:B("tab.tmuxRecoveryDismiss")})]})]})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx($w,{onSwiper:z=>{rt.current=z,z.allowTouchMove=$r.length>1&&!An&&!ct,$("[swiper:on-swiper]",{allowTouchMove:z.allowTouchMove}),requestAnimationFrame(()=>vt("on-swiper"))},onSlideChange:Qt,onTouchStart:(z,le)=>{const xe=Y2(le),Pe=xe==="touch"||xe==="pen"||xe==="unknown";U("[swipe:touch-start]",{pointerType:xe,allowed:Pe}),$("[swiper:touch-start]",{pointerType:xe,allowed:Pe}),Pe&&(He(),dr.current=!0,Et.current=!0)},onTouchEnd:(z,le)=>{const xe=Y2(le),Pe=xe==="touch"||xe==="pen"||xe==="unknown";U("[swipe:touch-end]",{pointerType:xe,allowed:Pe}),$("[swiper:touch-end]",{pointerType:xe,allowed:Pe}),Pe&&(dr.current=!1,Ke("touch-end"))},onTransitionEnd:()=>{const z=rt.current;if(dr.current){$("[swiper:transition-end-during-touch]");return}if(Et.current&&z&&!DI(z,It.current)){$("[swiper:transition-end-deferred]");return}He(),Et.current=!1,$("[swiper:transition-end]")},initialSlide:Math.max(0,Te),speed:gm,slidesPerView:1,resistanceRatio:.82,threshold:8,longSwipesRatio:.2,touchAngle:45,touchStartPreventDefault:!1,simulateTouch:!1,noSwiping:!0,noSwipingSelector:"[data-mobile-keyboard='true']",className:"terminal-session-swiper h-full",children:$r.map(z=>{const le=z.workspace,xe=!!le&&z.sessions.length>=2,Pe=Dt?xr?"horizontal":"vertical":le?.layout??"horizontal",Ht=Dt&&Ne?z.sessions.some(tr=>tr.id===Ne):!1,Ft=z.sessions.some(tr=>tr.id===X)?X:z.sessions[0]?.id;return i.jsx(Uw,{className:"h-full",children:i.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":Qn.get(z.key)??0,style:{paddingRight:Qn.get(z.key)??0,paddingTop:y&&!xe?"2.5rem":void 0},children:xe?i.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:Dt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[i.jsx(yg,{layoutId:z.key,preset:le?.layout??"horizontal",initialTree:TT(z.sessions.map(tr=>tr.id),Pe,le?.ratios,le?.gridColumnRatios,le?.gridRowRatios),mobile:Dt,focusId:Ht?Ne:null,panes:z.sessions.map(tr=>({id:tr.id,content:Wn(tr,{showPaneTitle:!Dt,suppressKeyboard:Dt&&tr.id!==Ft,keyboardPortalTarget:Dt?Ir:null,sharedMobileKeyboardLayout:Dt,suppressPageFlipRefresh:!0})}))}),Dt&&i.jsx("div",{ref:ne,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):i.jsx(yg,{layoutId:z.key,preset:le?.layout??"horizontal",mobile:Dt,panes:[{id:z.sessions[0].id,content:Wn(z.sessions[0])}]})})},z.key)})})}),ct&&X&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>re(!1),"aria-label":B("common.close")}),i.jsxs("section",{className:"fixed inset-x-3 bottom-3 z-modal-panel mx-auto max-h-[min(78svh,620px)] max-w-md overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-[0_24px_70px_var(--app-shadow-strong)] sm:bottom-auto sm:top-1/2 sm:-translate-y-1/2",style:{paddingBottom:"var(--safe-bottom-inset)"},role:"dialog","aria-modal":"true","aria-label":B("tab.splitTitle"),children:[i.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[i.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:i.jsx(xl,{size:17})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:B("tab.splitTitle")}),i.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:B("tab.splitExistingHint")})]}),i.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",onClick:()=>re(!1),"aria-label":B("common.close"),children:i.jsx(Kn,{size:16})})]}),i.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[i.jsxs("button",{type:"button",disabled:ft,onClick:()=>{cr()},className:"flex w-full items-center gap-3 rounded-xl px-3 py-3 text-left transition hover:bg-surface-2 active:bg-surface-elevated disabled:opacity-60",children:[i.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:i.jsx(Os,{size:17})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:B("tab.splitNew")}),i.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:B("tab.splitNewHint")})]})]}),te.filter(z=>z.id!==er?.id).length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:B("tab.splitExistingGroups")}),te.filter(z=>z.id!==er?.id).map((z,le)=>{const xe=z.sessionIds.flatMap(Ft=>{const tr=G.find(Xt=>Xt.id===Ft);return tr?[tr]:[]});if(xe.length<2)return null;const Pe=z.name||`${B("tab.splitWorkspace")} ${le+1}`,Ht=xe.map(Ft=>on(Ft).primary).join(" · ");return i.jsxs("button",{type:"button",onClick:()=>ar(xe[0].id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[i.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:i.jsx(xl,{size:15})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:Pe}),i.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:B("tab.splitOccupied")})]}),i.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[B("tab.sessionCount",{count:xe.length})," · ",Ht]})]}),i.jsx(Mi,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},z.id)})]}),i.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:B("tab.splitAvailableSessions")}),G.filter(z=>!te.some(le=>le.sessionIds.includes(z.id))&&z.id!==X).length===0&&te.filter(z=>z.id!==er?.id).length===0?i.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:B("tab.splitNoOtherSessions")}):G.filter(z=>!te.some(le=>le.sessionIds.includes(z.id))&&z.id!==X).map(z=>{const le=bn.get(z.id)??null,xe=on(z);return i.jsxs("button",{type:"button",onClick:()=>ar(z.id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[i.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:le?i.jsx(vc,{size:15}):i.jsx(xl,{size:15})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:xe.primary}),i.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:le?Nu(le)??le:z.name})]}),i.jsx(Mi,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},z.id)})]})]})]}),me&&i.jsx("div",{className:"fixed inset-x-3 bottom-4 z-toast mx-auto max-w-md rounded-xl border border-border/20 bg-surface-elevated px-4 py-3 text-center text-[12px] text-foreground shadow-lg",children:me})]})},FI={sm:"h-4 w-7",md:"h-6 w-10"},$I={sm:"h-3 w-3",md:"h-5 w-5"},UI={sm:"translate-x-3",md:"translate-x-4"};function Xo({checked:e,disabled:t=!1,size:r="md",className:n=""}){return i.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${FI[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${n}`,children:i.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${$I[r]} ${e?UI[r]:""}`})})}function qi(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var zI=typeof Symbol=="function"&&Symbol.observable||"@@observable",K2=zI,X2=()=>Math.random().toString(36).substring(7).split("").join("."),HI={INIT:`@@redux/INIT${X2()}`,REPLACE:`@@redux/REPLACE${X2()}`},J2=HI;function WI(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function $3(e,t,r){if(typeof e!="function")throw new Error(qi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(qi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(qi(1));return r($3)(e,t)}let n=e,a=t,l=new Map,c=l,h=0,p=!1;function g(){c===l&&(c=new Map,l.forEach((I,M)=>{c.set(M,I)}))}function x(){if(p)throw new Error(qi(3));return a}function y(I){if(typeof I!="function")throw new Error(qi(4));if(p)throw new Error(qi(5));let M=!0;g();const B=h++;return c.set(B,I),function(){if(M){if(p)throw new Error(qi(6));M=!1,g(),c.delete(B),l=null}}}function A(I){if(!WI(I))throw new Error(qi(7));if(typeof I.type>"u")throw new Error(qi(8));if(typeof I.type!="string")throw new Error(qi(17));if(p)throw new Error(qi(9));try{p=!0,a=n(a,I)}finally{p=!1}return(l=c).forEach(B=>{B()}),I}function w(I){if(typeof I!="function")throw new Error(qi(10));n=I,A({type:J2.REPLACE})}function k(){const I=y;return{subscribe(M){if(typeof M!="object"||M===null)throw new Error(qi(11));function B(){const U=M;U.next&&U.next(x())}return B(),{unsubscribe:I(B)}},[K2](){return this}}}return A({type:J2.INIT}),{dispatch:A,subscribe:y,getState:x,replaceReducer:w,[K2]:k}}function ex(e,t){return function(...r){return t(e.apply(this,r))}}function tx(e,t){if(typeof e=="function")return ex(e,t);if(typeof e!="object"||e===null)throw new Error(qi(16));const r={};for(const n in e){const a=e[n];typeof a=="function"&&(r[n]=ex(a,t))}return r}function U3(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function GI(...e){return t=>(r,n)=>{const a=t(r,n);let l=()=>{throw new Error(qi(15))};const c={getState:a.getState,dispatch:(p,...g)=>l(p,...g)},h=e.map(p=>p(c));return l=U3(...h)(a.dispatch),{...a,dispatch:l}}}var fp={exports:{}},pp={};var rx;function VI(){if(rx)return pp;rx=1;var e=e9();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,a=e.useRef,l=e.useEffect,c=e.useMemo,h=e.useDebugValue;return pp.useSyncExternalStoreWithSelector=function(p,g,x,y,A){var w=a(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=c(function(){function I(G){if(!M){if(M=!0,B=G,G=y(G),A!==void 0&&k.hasValue){var Q=k.value;if(A(Q,G))return F=Q}return F=G}if(Q=F,r(B,G))return Q;var X=y(G);return A!==void 0&&A(Q,X)?(B=G,Q):(B=G,F=X)}var M=!1,B,F,U=x===void 0?null:x;return[function(){return I(g())},U===null?void 0:function(){return I(U())}]},[g,x,y,A]);var E=n(p,w[0],w[1]);return l(function(){k.hasValue=!0,k.value=E},[E]),h(E),E},pp}var nx;function qI(){return nx||(nx=1,fp.exports=VI()),fp.exports}qI();var YI=b.version.startsWith("19"),ZI=Symbol.for(YI?"react.transitional.element":"react.element"),KI=Symbol.for("react.portal"),XI=Symbol.for("react.fragment"),JI=Symbol.for("react.strict_mode"),eE=Symbol.for("react.profiler"),tE=Symbol.for("react.consumer"),rE=Symbol.for("react.context"),z3=Symbol.for("react.forward_ref"),nE=Symbol.for("react.suspense"),sE=Symbol.for("react.suspense_list"),n1=Symbol.for("react.memo"),iE=Symbol.for("react.lazy"),aE=z3,oE=n1;function lE(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case ZI:switch(e=e.type,e){case XI:case eE:case JI:case nE:case sE:return e;default:switch(e=e&&e.$$typeof,e){case rE:case z3:case iE:case n1:return e;case tE:return e;default:return t}}case KI:return t}}}function cE(e){return lE(e)===n1}function uE(e,t,r,n,{areStatesEqual:a,areOwnPropsEqual:l,areStatePropsEqual:c}){let h=!1,p,g,x,y,A;function w(B,F){return p=B,g=F,x=e(p,g),y=t(n,g),A=r(x,y,g),h=!0,A}function k(){return x=e(p,g),t.dependsOnOwnProps&&(y=t(n,g)),A=r(x,y,g),A}function E(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(y=t(n,g)),A=r(x,y,g),A}function I(){const B=e(p,g),F=!c(B,x);return x=B,F&&(A=r(x,y,g)),A}function M(B,F){const U=!l(F,g),G=!a(B,p,F,g);return p=B,g=F,U&&G?k():U?E():G?I():A}return function(F,U){return h?M(F,U):w(F,U)}}function dE(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...a}){const l=t(e,a),c=r(e,a),h=n(e,a);return uE(l,c,h,e,a)}function hE(e,t){const r={};for(const n in e){const a=e[n];typeof a=="function"&&(r[n]=(...l)=>t(a(...l)))}return r}function ym(e){return function(r){const n=e(r);function a(){return n}return a.dependsOnOwnProps=!1,a}}function sx(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function H3(e,t){return function(n,{displayName:a}){const l=function(h,p){return l.dependsOnOwnProps?l.mapToProps(h,p):l.mapToProps(h,void 0)};return l.dependsOnOwnProps=!0,l.mapToProps=function(h,p){l.mapToProps=e,l.dependsOnOwnProps=sx(e);let g=l(h,p);return typeof g=="function"&&(l.mapToProps=g,l.dependsOnOwnProps=sx(g),g=l(h,p)),g},l}}function s1(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function fE(e){return e&&typeof e=="object"?ym(t=>hE(e,t)):e?typeof e=="function"?H3(e):s1(e,"mapDispatchToProps"):ym(t=>({dispatch:t}))}function pE(e){return e?typeof e=="function"?H3(e):s1(e,"mapStateToProps"):ym(()=>({}))}function mE(e,t,r){return{...r,...e,...t}}function gE(e){return function(r,{displayName:n,areMergedPropsEqual:a}){let l=!1,c;return function(p,g,x){const y=e(p,g,x);return l?a(y,c)||(c=y):(l=!0,c=y),c}}}function xE(e){return e?typeof e=="function"?gE(e):s1(e,"mergeProps"):()=>mE}function bE(e){e()}function yE(){let e=null,t=null;return{clear(){e=null,t=null},notify(){bE(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const a=t={callback:r,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!n||e===null||(n=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var ix={notify(){},get:()=>[]};function W3(e,t){let r,n=ix,a=0,l=!1;function c(E){x();const I=n.subscribe(E);let M=!1;return()=>{M||(M=!0,I(),y())}}function h(){n.notify()}function p(){k.onStateChange&&k.onStateChange()}function g(){return l}function x(){a++,r||(r=t?t.addNestedSub(p):e.subscribe(p),n=yE())}function y(){a--,r&&a===0&&(r(),r=void 0,n.clear(),n=ix)}function A(){l||(l=!0,x())}function w(){l&&(l=!1,y())}const k={addNestedSub:c,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:g,trySubscribe:A,tryUnsubscribe:w,getListeners:()=>n};return k}var vE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wE=vE(),AE=()=>typeof navigator<"u"&&navigator.product==="ReactNative",TE=AE(),CE=()=>wE||TE?b.useLayoutEffect:b.useEffect,Dh=CE();function ax(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function mp(e,t){if(ax(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++)if(!Object.prototype.hasOwnProperty.call(t,r[a])||!ax(e[r[a]],t[r[a]]))return!1;return!0}var SE={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},_E={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},LE={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},G3={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},kE={[aE]:LE,[oE]:G3};function ox(e){return cE(e)?G3:kE[e.$$typeof]||SE}var IE=Object.defineProperty,EE=Object.getOwnPropertyNames,lx=Object.getOwnPropertySymbols,NE=Object.getOwnPropertyDescriptor,RE=Object.getPrototypeOf,cx=Object.prototype;function vm(e,t){if(typeof t!="string"){if(cx){const l=RE(t);l&&l!==cx&&vm(e,l)}let r=EE(t);lx&&(r=r.concat(lx(t)));const n=ox(e),a=ox(t);for(let l=0;l<r.length;++l){const c=r[l];if(!_E[c]&&!(a&&a[c])&&!(n&&n[c])){const h=NE(t,c);try{IE(e,c,h)}catch{}}}}return e}var ME=Symbol.for("react-redux-context"),DE=typeof globalThis<"u"?globalThis:{};function jE(){if(!b.createContext)return{};const e=DE[ME]??=new Map;let t=e.get(b.createContext);return t||(t=b.createContext(null),e.set(b.createContext,t)),t}var V3=jE(),BE=[null,null];function QE(e,t,r){Dh(()=>e(...t),r)}function PE(e,t,r,n,a,l){e.current=n,r.current=!1,a.current&&(a.current=null,l())}function OE(e,t,r,n,a,l,c,h,p,g,x){if(!e)return()=>{};let y=!1,A=null;const w=()=>{if(y||!h.current)return;const E=t.getState();let I,M;try{I=n(E,a.current)}catch(B){M=B,A=B}M||(A=null),I===l.current?c.current||g():(l.current=I,p.current=I,c.current=!0,x())};return r.onStateChange=w,r.trySubscribe(),w(),()=>{if(y=!0,r.tryUnsubscribe(),r.onStateChange=null,A)throw A}}function FE(e,t){return e===t}function $E(e,t,r,{pure:n,areStatesEqual:a=FE,areOwnPropsEqual:l=mp,areStatePropsEqual:c=mp,areMergedPropsEqual:h=mp,forwardRef:p=!1,context:g=V3}={}){const x=g,y=pE(e),A=fE(t),w=xE(r),k=!!e;return I=>{const M=I.displayName||I.name||"Component",B=`Connect(${M})`,F={shouldHandleStateChanges:k,displayName:B,wrappedComponentName:M,WrappedComponent:I,initMapStateToProps:y,initMapDispatchToProps:A,initMergeProps:w,areStatesEqual:a,areStatePropsEqual:c,areOwnPropsEqual:l,areMergedPropsEqual:h};function U(X){const[ee,ze,he]=b.useMemo(()=>{const{reactReduxForwardedRef:et,...ht}=X;return[X.context,et,ht]},[X]),de=b.useMemo(()=>{let et=x;return ee?.Consumer,et},[ee,x]),$e=b.useContext(de),qe=!!X.store&&!!X.store.getState&&!!X.store.dispatch,oe=!!$e&&!!$e.store,Re=qe?X.store:$e.store,K=oe?$e.getServerState:Re.getState,we=b.useMemo(()=>dE(Re.dispatch,F),[Re]),[Z,Ue]=b.useMemo(()=>{if(!k)return BE;const et=W3(Re,qe?void 0:$e.subscription),ht=et.notifyNestedSubs.bind(et);return[et,ht]},[Re,qe,$e]),Le=b.useMemo(()=>qe?$e:{...$e,subscription:Z},[qe,$e,Z]),Y=b.useRef(void 0),Ee=b.useRef(he),be=b.useRef(void 0),Me=b.useRef(!1),Ze=b.useRef(!1),Se=b.useRef(void 0);Dh(()=>(Ze.current=!0,()=>{Ze.current=!1}),[]);const se=b.useMemo(()=>()=>be.current&&he===Ee.current?be.current:we(Re.getState(),he),[Re,he]),Ye=b.useMemo(()=>ht=>Z?OE(k,Re,Z,we,Ee,Y,Me,Ze,be,Ue,ht):()=>{},[Z]);QE(PE,[Ee,Y,Me,he,be,Ue]);let pt;try{pt=b.useSyncExternalStore(Ye,se,K?()=>we(K(),he):se)}catch(et){throw Se.current&&(et.message+=`
71
+ The error may be correlated with this previous error:
72
+ ${Se.current.stack}
73
+
74
+ `),et}Dh(()=>{Se.current=void 0,be.current=void 0,Y.current=pt});const rt=b.useMemo(()=>b.createElement(I,{...pt,ref:ze}),[ze,I,pt]);return b.useMemo(()=>k?b.createElement(de.Provider,{value:Le},rt):rt,[de,rt,Le])}const Q=b.memo(U);if(Q.WrappedComponent=I,Q.displayName=U.displayName=B,p){const ee=b.forwardRef(function(he,de){return b.createElement(Q,{...he,reactReduxForwardedRef:de})});return ee.displayName=B,ee.WrappedComponent=I,vm(ee,I)}return vm(Q,I)}}var q3=$E;function UE(e){const{children:t,context:r,serverState:n,store:a}=e,l=b.useMemo(()=>{const p=W3(a);return{store:a,subscription:p,getServerState:n?()=>n:void 0}},[a,n]),c=b.useMemo(()=>a.getState(),[a]);Dh(()=>{const{subscription:p}=l;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),c!==a.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[l,c]);const h=r||V3;return b.createElement(h.Provider,{value:l},t)}var zE=UE,HE="Invariant failed";function WE(e,t){throw new Error(HE)}var No=function(t){var r=t.top,n=t.right,a=t.bottom,l=t.left,c=n-l,h=a-r,p={top:r,right:n,bottom:a,left:l,width:c,height:h,x:l,y:r,center:{x:(n+l)/2,y:(a+r)/2}};return p},i1=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},ux=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},GE=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},gp={top:0,right:0,bottom:0,left:0},a1=function(t){var r=t.borderBox,n=t.margin,a=n===void 0?gp:n,l=t.border,c=l===void 0?gp:l,h=t.padding,p=h===void 0?gp:h,g=No(i1(r,a)),x=No(ux(r,c)),y=No(ux(x,p));return{marginBox:g,borderBox:No(r),paddingBox:x,contentBox:y,margin:a,border:c,padding:p}},no=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var a=Number(r);return isNaN(a)&&WE(),a},VE=function(){return{x:window.pageXOffset,y:window.pageYOffset}},jh=function(t,r){var n=t.borderBox,a=t.border,l=t.margin,c=t.padding,h=GE(n,r);return a1({borderBox:h,border:a,margin:l,padding:c})},Bh=function(t,r){return r===void 0&&(r=VE()),jh(t,r)},Y3=function(t,r){var n={top:no(r.marginTop),right:no(r.marginRight),bottom:no(r.marginBottom),left:no(r.marginLeft)},a={top:no(r.paddingTop),right:no(r.paddingRight),bottom:no(r.paddingBottom),left:no(r.paddingLeft)},l={top:no(r.borderTopWidth),right:no(r.borderRightWidth),bottom:no(r.borderBottomWidth),left:no(r.borderLeftWidth)};return a1({borderBox:t,margin:n,padding:a,border:l})},Z3=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return Y3(r,n)},$u=function(t){var r=[],n=null,a=function(){for(var c=arguments.length,h=new Array(c),p=0;p<c;p++)h[p]=arguments[p];r=h,!n&&(n=requestAnimationFrame(function(){n=null,t.apply(void 0,r)}))};return a.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},a};function Qh(){return Qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qh.apply(null,arguments)}function K3(e,t){}K3.bind(null,"warn");K3.bind(null,"error");function zl(){}function qE(e,t){return{...e,...t}}function co(e,t,r){const n=t.map(a=>{const l=qE(r,a.options);return e.addEventListener(a.eventName,a.fn,l),function(){e.removeEventListener(a.eventName,a.fn,l)}});return function(){n.forEach(l=>{l()})}}const YE="Invariant failed";class Ph extends Error{}Ph.prototype.toString=function(){return this.message};function Ut(e,t){throw new Ph(YE)}class ZE extends C.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=zl,this.onWindowError=r=>{const n=this.getCallbacks();n.isDragging()&&n.tryAbort(),r.error instanceof Ph&&r.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=r=>{this.callbacks=r}}componentDidMount(){this.unbind=co(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Ph){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const KE=`
75
+ Press space bar to start a drag.
76
+ When dragging you can use the arrow keys to move the item around and escape to cancel.
77
+ Some screen readers may require you to be in focus mode or to use your pass through key
78
+ `,Oh=e=>e+1,XE=e=>`
79
+ You have lifted an item in position ${Oh(e.source.index)}
80
+ `,X3=(e,t)=>{const r=e.droppableId===t.droppableId,n=Oh(e.index),a=Oh(t.index);return r?`
81
+ You have moved the item from position ${n}
82
+ to position ${a}
83
+ `:`
84
+ You have moved the item from position ${n}
85
+ in list ${e.droppableId}
86
+ to list ${t.droppableId}
87
+ in position ${a}
88
+ `},J3=(e,t,r)=>t.droppableId===r.droppableId?`
89
+ The item ${e}
90
+ has been combined with ${r.draggableId}`:`
91
+ The item ${e}
92
+ in list ${t.droppableId}
93
+ has been combined with ${r.draggableId}
94
+ in list ${r.droppableId}
95
+ `,JE=e=>{const t=e.destination;if(t)return X3(e.source,t);const r=e.combine;return r?J3(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},dx=e=>`
96
+ The item has returned to its starting position
97
+ of ${Oh(e.index)}
98
+ `,eN=e=>{if(e.reason==="CANCEL")return`
99
+ Movement cancelled.
100
+ ${dx(e.source)}
101
+ `;const t=e.destination,r=e.combine;return t?`
102
+ You have dropped the item.
103
+ ${X3(e.source,t)}
104
+ `:r?`
105
+ You have dropped the item.
106
+ ${J3(e.draggableId,e.source,r)}
107
+ `:`
108
+ The item has been dropped while not over a drop area.
109
+ ${dx(e.source)}
110
+ `},gh={dragHandleUsageInstructions:KE,onDragStart:XE,onDragUpdate:JE,onDragEnd:eN};function tN(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function ey(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!tN(e[r],t[r]))return!1;return!0}function Sn(e,t){const r=b.useState(()=>({inputs:t,result:e()}))[0],n=b.useRef(!0),a=b.useRef(r),c=n.current||!!(t&&a.current.inputs&&ey(t,a.current.inputs))?a.current:{inputs:t,result:e()};return b.useEffect(()=>{n.current=!1,a.current=c},[c]),c.result}function vr(e,t){return Sn(()=>e,t)}const ii={x:0,y:0},Ti=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Ma=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Hl=(e,t)=>e.x===t.x&&e.y===t.y,x0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Ac=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},Uu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),hx=(e,t)=>Math.min(...t.map(r=>Uu(e,r))),ty=e=>t=>({x:e(t.x),y:e(t.y)});var rN=(e,t)=>{const r=No({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r};const td=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),fx=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],nN={top:0,right:0,bottom:0,left:0},sN=(e,t)=>t?td(e,t.scroll.diff.displacement):e,iN=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,aN=(e,t)=>t&&t.shouldClipSubject?rN(t.pageMarginBox,e):No(e);var c0=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const a=sN(e.marginBox,n),l=iN(a,r,t),c=aN(l,n);return{page:e,withPlaceholder:t,active:c}},o1=(e,t)=>{e.frame||Ut();const r=e.frame,n=Ma(t,r.scroll.initial),a=x0(n),l={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:a},max:r.scroll.max}},c=c0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:l});return{...e,frame:l,subject:c}};function si(e,t=ey){let r=null;function n(...a){if(r&&r.lastThis===this&&t(a,r.lastArgs))return r.lastResult;const l=e.apply(this,a);return r={lastResult:l,lastArgs:a,lastThis:this},l}return n.clear=function(){r=null},n}const ry=si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),ny=si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),ef=si(e=>Object.values(e)),oN=si(e=>Object.values(e));var b0=si((e,t)=>oN(t).filter(n=>e===n.descriptor.droppableId).sort((n,a)=>n.descriptor.index-a.descriptor.index));function l1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function tf(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var rf=si((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),lN=({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:a})=>{if(!r.isCombineEnabled||!l1(a))return null;function c(w){const k={type:"COMBINE",combine:{draggableId:w,droppableId:r.descriptor.id}};return{...a,at:k}}const h=a.displaced.all,p=h.length?h[0]:null;if(e)return p?c(p):null;const g=rf(t,n);if(!p){if(!g.length)return null;const w=g[g.length-1];return c(w.descriptor.id)}const x=g.findIndex(w=>w.descriptor.id===p);x===-1&&Ut();const y=x-1;if(y<0)return null;const A=g[y];return c(A.descriptor.id)},y0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const sy={point:ii,value:0},zu={invisible:{},visible:{},all:[]},cN={displaced:zu,displacedBy:sy,at:null};var uo=(e,t)=>r=>e<=r&&r<=t,iy=e=>{const t=uo(e.top,e.bottom),r=uo(e.left,e.right);return n=>{if(t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right))return!0;const l=t(n.top)||t(n.bottom),c=r(n.left)||r(n.right);if(l&&c)return!0;const p=n.top<e.top&&n.bottom>e.bottom,g=n.left<e.left&&n.right>e.right;return p&&g?!0:p&&c||g&&l}},uN=e=>{const t=uo(e.top,e.bottom),r=uo(e.left,e.right);return n=>t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right)};const c1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},ay={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var dN=e=>t=>{const r=uo(t.top,t.bottom),n=uo(t.left,t.right);return a=>e===c1?r(a.top)&&r(a.bottom):n(a.left)&&n(a.right)};const hN=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:ii;return td(e,r)},fN=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,pN=(e,t,r)=>r(t)(e),u1=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:a})=>{const l=n?hN(e,t):e;return fN(l,t,a)&&pN(l,r,a)},mN=e=>u1({...e,isVisibleThroughFrameFn:iy}),oy=e=>u1({...e,isVisibleThroughFrameFn:uN}),gN=e=>u1({...e,isVisibleThroughFrameFn:dN(e.destination.axis)}),xN=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:n,visible:a}=t;if(n[e])return!1;const l=a[e];return l?l.shouldAnimate:!0};function bN(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return No(i1(r,n))}function Hu({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:a,last:l}){return e.reduce(function(h,p){const g=bN(p,r),x=p.descriptor.id;if(h.all.push(x),!mN({target:g,destination:t,viewport:n,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const A=xN(x,l,a),w={draggableId:x,shouldAnimate:A};return h.visible[x]=w,h},{all:[],visible:{},invisible:{}})}function yN(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function px({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const a=yN(e,{inHomeList:t});return{displaced:zu,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function Fh({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:a,last:l,index:c,forceShouldAnimate:h}){const p=y0(e,r);if(c==null)return px({insideDestination:t,inHomeList:p,displacedBy:a,destination:r});const g=t.find(k=>k.descriptor.index===c);if(!g)return px({insideDestination:t,inHomeList:p,displacedBy:a,destination:r});const x=rf(e,t),y=t.indexOf(g),A=x.slice(y);return{displaced:Hu({afterDragging:A,destination:r,displacedBy:a,last:l,viewport:n.frame,forceShouldAnimate:h}),displacedBy:a,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:c}}}}function Vl(e,t){return!!t.effected[e]}var vN=({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:a})=>{if(!t.isCombineEnabled)return null;const l=n.draggableId,h=r[l].descriptor.index;return Vl(l,a)?e?h:h-1:e?h+1:h},wN=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const a=n.index,l=e?a+1:a-1,c=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return l<c||l>p?null:l},AN=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:a,insideDestination:l,previousImpact:c,viewport:h,afterCritical:p})=>{const g=c.at;if(g||Ut(),g.type==="REORDER"){const y=wN({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:l});return y==null?null:Fh({draggable:r,insideDestination:l,destination:a,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:y})}const x=vN({isMovingForward:e,destination:a,displaced:c.displaced,draggables:n,combine:g.combine,afterCritical:p});return x==null?null:Fh({draggable:r,insideDestination:l,destination:a,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:x})},TN=({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const a=!!(e.visible[r]||e.invisible[r]);return Vl(r,t)?a?ii:x0(n.point):a?n.point:ii},CN=({afterCritical:e,impact:t,draggables:r})=>{const n=tf(t);n||Ut();const a=n.draggableId,l=r[a].page.borderBox.center,c=TN({displaced:t.displaced,afterCritical:e,combineWith:a,displacedBy:t.displacedBy});return Ti(l,c)};const ly=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,SN=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,d1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,mx=({axis:e,moveRelativeTo:t,isMoving:r})=>Ac(e.line,t.marginBox[e.end]+ly(e,r),d1(e,t.marginBox,r)),gx=({axis:e,moveRelativeTo:t,isMoving:r})=>Ac(e.line,t.marginBox[e.start]-SN(e,r),d1(e,t.marginBox,r)),_N=({axis:e,moveInto:t,isMoving:r})=>Ac(e.line,t.contentBox[e.start]+ly(e,r),d1(e,t.contentBox,r));var LN=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:a})=>{const l=b0(n.descriptor.id,r),c=t.page,h=n.axis;if(!l.length)return _N({axis:h,moveInto:n.page,isMoving:c});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const A=r[x];if(Vl(x,a))return gx({axis:h,moveRelativeTo:A.page,isMoving:c});const w=jh(A.page,g.point);return gx({axis:h,moveRelativeTo:w,isMoving:c})}const y=l[l.length-1];if(y.descriptor.id===t.descriptor.id)return c.borderBox.center;if(Vl(y.descriptor.id,a)){const A=jh(y.page,x0(a.displacedBy.point));return mx({axis:h,moveRelativeTo:A,isMoving:c})}return mx({axis:h,moveRelativeTo:y.page,isMoving:c})},wm=(e,t)=>{const r=e.frame;return r?Ti(t,r.scroll.diff.displacement):t};const kN=({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:a})=>{const l=t.page.borderBox.center,c=e.at;return!r||!c?l:c.type==="REORDER"?LN({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:a}):CN({impact:e,draggables:n,afterCritical:a})};var nf=e=>{const t=kN(e),r=e.droppable;return r?wm(r,t):t},cy=(e,t)=>{const r=Ma(t,e.scroll.initial),n=x0(r);return{frame:No({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}}};function xx(e,t){return e.map(r=>t[r])}function IN(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}var EN=({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:a})=>{const l=cy(t,Ti(t.scroll.current,a)),c=r.frame?o1(r,Ti(r.frame.scroll.current,a)):r,h=e.displaced,p=Hu({afterDragging:xx(h.all,n),destination:r,displacedBy:e.displacedBy,viewport:l.frame,last:h,forceShouldAnimate:!1}),g=Hu({afterDragging:xx(h.all,n),destination:c,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},y={},A=[h,p,g];return h.all.forEach(k=>{const E=IN(k,A);if(E){y[k]=E;return}x[k]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:y}}},NN=(e,t)=>Ti(e.scroll.diff.displacement,t),h1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=NN(r,e),a=Ma(n,t.page.borderBox.center);return Ti(t.client.borderBox.center,a)},uy=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:a,onlyOnMainAxis:l=!1})=>{const c=Ma(r,e.page.borderBox.center),p={target:td(e.page.borderBox,c),destination:t,withDroppableDisplacement:a,viewport:n};return l?gN(p):oy(p)},RN=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:a,viewport:l,previousPageBorderBoxCenter:c,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const g=b0(r.descriptor.id,n),x=y0(t,r),y=lN({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:a})||AN({isMovingForward:e,isInHomeList:x,draggable:t,draggables:n,destination:r,insideDestination:g,previousImpact:a,viewport:l,afterCritical:p});if(!y)return null;const A=nf({impact:y,draggable:t,droppable:r,draggables:n,afterCritical:p});if(uy({draggable:t,destination:r,newPageBorderBoxCenter:A,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:h1({pageBorderBoxCenter:A,draggable:t,viewport:l}),impact:y,scrollJumpRequest:null};const k=Ma(A,c),E=EN({impact:y,viewport:l,destination:r,draggables:n,maxScrollChange:k});return{clientSelection:h,impact:E,scrollJumpRequest:k}};const Wi=e=>{const t=e.subject.active;return t||Ut(),t};var MN=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:a})=>{const l=r.subject.active;if(!l)return null;const c=r.axis,h=uo(l[c.start],l[c.end]),p=ef(n).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>iy(a.frame)(Wi(x))).filter(x=>{const y=Wi(x);return e?l[c.crossAxisEnd]<y[c.crossAxisEnd]:y[c.crossAxisStart]<l[c.crossAxisStart]}).filter(x=>{const y=Wi(x),A=uo(y[c.start],y[c.end]);return h(y[c.start])||h(y[c.end])||A(l[c.start])||A(l[c.end])}).sort((x,y)=>{const A=Wi(x)[c.crossAxisStart],w=Wi(y)[c.crossAxisStart];return e?A-w:w-A}).filter((x,y,A)=>Wi(x)[c.crossAxisStart]===Wi(A[0])[c.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>uo(Wi(x)[c.start],Wi(x)[c.end])(t[c.line]));return g.length===1?g[0]:g.length>1?g.sort((x,y)=>Wi(x)[c.start]-Wi(y)[c.start])[0]:p.sort((x,y)=>{const A=hx(t,fx(Wi(x))),w=hx(t,fx(Wi(y)));return A!==w?A-w:Wi(x)[c.start]-Wi(y)[c.start]})[0]};const bx=(e,t)=>{const r=e.page.borderBox.center;return Vl(e.descriptor.id,t)?Ma(r,t.displacedBy.point):r},DN=(e,t)=>{const r=e.page.borderBox;return Vl(e.descriptor.id,t)?td(r,x0(t.displacedBy.point)):r};var jN=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:a})=>n.filter(c=>oy({target:DN(c,a),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((c,h)=>{const p=Uu(e,wm(r,bx(c,a))),g=Uu(e,wm(r,bx(h,a)));return p<g?-1:g<p?1:c.descriptor.index-h.descriptor.index})[0]||null,rd=si(function(t,r){const n=r[t.line];return{value:n,point:Ac(t.line,n)}});const BN=(e,t,r)=>{const n=e.axis;if(e.descriptor.mode==="virtual")return Ac(n.line,t[n.line]);const a=e.subject.page.contentBox[n.size],p=b0(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[n.size],0)+t[n.line]-a;return p<=0?null:Ac(n.line,p)},dy=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),hy=(e,t,r)=>{const n=e.frame;y0(t,e)&&Ut(),e.subject.withPlaceholder&&Ut();const a=rd(e.axis,t.displaceBy).point,l=BN(e,a,r),c={placeholderSize:a,increasedBy:l,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const x=c0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=l?Ti(n.scroll.max,l):n.scroll.max,p=dy(n,h),g=c0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},QN=e=>{const t=e.subject.withPlaceholder;t||Ut();const r=e.frame;if(!r){const c=c0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:c}}const n=t.oldFrameMaxScroll;n||Ut();const a=dy(r,n),l=c0({page:e.subject.page,axis:e.axis,frame:a,withPlaceholder:null});return{...e,subject:l,frame:a}};var PN=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:a,destination:l,viewport:c,afterCritical:h})=>{if(!t){if(r.length)return null;const y={displaced:zu,displacedBy:sy,at:{type:"REORDER",destination:{droppableId:l.descriptor.id,index:0}}},A=nf({impact:y,draggable:n,droppable:l,draggables:a,afterCritical:h}),w=y0(n,l)?l:hy(l,n,a);return uy({draggable:n,destination:w,newPageBorderBoxCenter:A,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?y:null}const p=e[l.axis.line]<=t.page.borderBox.center[l.axis.line],g=(()=>{const y=t.descriptor.index;return t.descriptor.id===n.descriptor.id||p?y:y+1})(),x=rd(l.axis,n.displaceBy);return Fh({draggable:n,insideDestination:r,destination:l,viewport:c,displacedBy:x,last:zu,index:g})},ON=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:a,droppables:l,viewport:c,afterCritical:h})=>{const p=MN({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:l,viewport:c});if(!p)return null;const g=b0(p.descriptor.id,a),x=jN({pageBorderBoxCenter:t,viewport:c,destination:p,insideDestination:g,afterCritical:h}),y=PN({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:a,moveRelativeTo:x,insideDestination:g,viewport:c,afterCritical:h});if(!y)return null;const A=nf({impact:y,draggable:r,droppable:p,draggables:a,afterCritical:h});return{clientSelection:h1({pageBorderBoxCenter:A,draggable:r,viewport:c}),impact:y,scrollJumpRequest:null}},ja=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const FN=(e,t)=>{const r=ja(e);return r?t[r]:null};var $N=({state:e,type:t})=>{const r=FN(e.impact,e.dimensions.droppables),n=!!r,a=e.dimensions.droppables[e.critical.droppable.id],l=r||a,c=l.axis.direction,h=c==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||c==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(h&&!n)return null;const p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",g=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:y,droppables:A}=e.dimensions;return h?RN({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:l,draggables:y,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):ON({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:l,draggables:y,droppables:A,viewport:e.viewport,afterCritical:e.afterCritical})};function lc(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function fy(e){const t=uo(e.top,e.bottom),r=uo(e.left,e.right);return function(a){return t(a.y)&&r(a.x)}}function UN(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function zN({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,a=r.map(l=>{const c=l.axis,h=Ac(l.axis.line,e.center[c.line],l.page.borderBox.center[c.crossAxisLine]);return{id:l.descriptor.id,distance:Uu(n,h)}}).sort((l,c)=>c.distance-l.distance);return a[0]?a[0].id:null}function HN({pageBorderBox:e,draggable:t,droppables:r}){const n=ef(r).filter(a=>{if(!a.isEnabled)return!1;const l=a.subject.active;if(!l||!UN(e,l))return!1;if(fy(l)(e.center))return!0;const c=a.axis,h=l.center[c.crossAxisLine],p=e[c.crossAxisStart],g=e[c.crossAxisEnd],x=uo(l[c.crossAxisStart],l[c.crossAxisEnd]),y=x(p),A=x(g);return!y&&!A?!0:y?p<h:g>h});return n.length?n.length===1?n[0].descriptor.id:zN({pageBorderBox:e,draggable:t,candidates:n}):null}const py=(e,t)=>No(td(e,t));var WN=(e,t)=>{const r=e.frame;return r?py(t,r.scroll.diff.value):t};function my({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function GN({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var VN=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:a,viewport:l,afterCritical:c})=>{const h=r.axis,p=rd(r.axis,t.displaceBy),g=p.value,x=e[h.start],y=e[h.end],w=rf(t,n).find(E=>{const I=E.descriptor.id,M=E.page.borderBox.center[h.line],B=Vl(I,c),F=my({displaced:a,id:I});return B?F?y<=M:x<M-g:F?y<=M+g:x<M})||null,k=GN({draggable:t,closest:w,inHomeList:y0(t,r)});return Fh({draggable:t,insideDestination:n,destination:r,viewport:l,last:a,displacedBy:p,index:k})};const qN=4;var YN=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:a,afterCritical:l})=>{if(!n.isCombineEnabled)return null;const c=n.axis,h=rd(n.axis,e.displaceBy),p=h.value,g=t[c.start],x=t[c.end],A=rf(e,a).find(k=>{const E=k.descriptor.id,I=k.page.borderBox,B=I[c.size]/qN,F=Vl(E,l),U=my({displaced:r.displaced,id:E});return F?U?x>I[c.start]+B&&x<I[c.end]-B:g>I[c.start]-p+B&&g<I[c.end]-p-B:U?x>I[c.start]+p+B&&x<I[c.end]+p-B:g>I[c.start]+B&&g<I[c.end]-B});return A?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:A.descriptor.id,droppableId:n.descriptor.id}}}:null},gy=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:a,viewport:l,afterCritical:c})=>{const h=py(t.page.borderBox,e),p=HN({pageBorderBox:h,draggable:t,droppables:n});if(!p)return cN;const g=n[p],x=b0(g.descriptor.id,r),y=WN(g,h);return YN({pageBorderBoxWithDroppableScroll:y,draggable:t,previousImpact:a,destination:g,insideDestination:x,afterCritical:c})||VN({pageBorderBoxWithDroppableScroll:y,draggable:t,destination:g,insideDestination:x,last:a.displaced,viewport:l,afterCritical:c})},f1=(e,t)=>({...e,[t.descriptor.id]:t});const ZN=({previousImpact:e,impact:t,droppables:r})=>{const n=ja(e),a=ja(t);if(!n||n===a)return r;const l=r[n];if(!l.subject.withPlaceholder)return r;const c=QN(l);return f1(r,c)};var KN=({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:a})=>{const l=ZN({previousImpact:n,impact:a,droppables:r}),c=ja(a);if(!c)return l;const h=r[c];if(y0(e,h)||h.subject.withPlaceholder)return l;const p=hy(h,e,t);return f1(l,p)},Lu=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:a,scrollJumpRequest:l})=>{const c=n||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,g=Ma(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:Ti(e.initial.client.borderBoxCenter,g)},y={selection:Ti(x.selection,c.scroll.current),borderBoxCenter:Ti(x.borderBoxCenter,c.scroll.current),offset:Ti(x.offset,c.scroll.diff.value)},A={client:x,page:y};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:c,current:A};const w=h.draggables[e.critical.draggable.id],k=a||gy({pageOffset:y.offset,draggable:w,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:c,afterCritical:e.afterCritical}),E=KN({draggable:w,impact:k,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:A,dimensions:{draggables:h.draggables,droppables:E},impact:k,viewport:c,scrollJumpRequest:l||null,forceShouldAnimate:l?!1:null}};function XN(e,t){return e.map(r=>t[r])}var xy=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:a})=>{const l=e.displaced,c=XN(l.all,r),h=Hu({afterDragging:c,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:a,last:l});return{...e,displaced:h}},by=({impact:e,draggable:t,droppable:r,draggables:n,viewport:a,afterCritical:l})=>{const c=nf({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:l});return h1({pageBorderBoxCenter:c,draggable:t,viewport:a})},yy=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&Ut();const n=e.impact,a=r||e.viewport,l=t||e.dimensions,{draggables:c,droppables:h}=l,p=c[e.critical.draggable.id],g=ja(n);g||Ut();const x=h[g],y=xy({impact:n,viewport:a,destination:x,draggables:c}),A=by({impact:y,draggable:p,droppable:x,draggables:c,viewport:a,afterCritical:e.afterCritical});return Lu({impact:y,clientSelection:A,state:e,dimensions:l,viewport:a})},JN=e=>({index:e.index,droppableId:e.droppableId}),vy=({draggable:e,home:t,draggables:r,viewport:n})=>{const a=rd(t.axis,e.displaceBy),l=b0(t.descriptor.id,r),c=l.indexOf(e);c===-1&&Ut();const h=l.slice(c+1),p=h.reduce((A,w)=>(A[w.descriptor.id]=!0,A),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:a,effected:p};return{impact:{displaced:Hu({afterDragging:h,destination:t,displacedBy:a,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:a,at:{type:"REORDER",destination:JN(e.descriptor)}},afterCritical:g}},eR=(e,t)=>({draggables:e.draggables,droppables:f1(e.droppables,t)}),tR=({draggable:e,offset:t,initialWindowScroll:r})=>{const n=jh(e.client,t),a=Bh(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:a}},rR=e=>{const t=e.frame;return t||Ut(),t},nR=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map(a=>{const l=a.descriptor.droppableId,c=t[l],p=rR(c).scroll.diff.value,g=Ti(n,p);return tR({draggable:a,offset:g,initialWindowScroll:r.scroll.initial})})},sR=({state:e,published:t})=>{const r=t.modified.map(M=>{const B=e.dimensions.droppables[M.droppableId];return o1(B,M.scroll)}),n={...e.dimensions.droppables,...ry(r)},a=ny(nR({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),l={...e.dimensions.draggables,...a};t.removals.forEach(M=>{delete l[M]});const c={droppables:n,draggables:l},h=ja(e.impact),p=h?c.droppables[h]:null,g=c.draggables[e.critical.draggable.id],x=c.droppables[e.critical.droppable.id],{impact:y,afterCritical:A}=vy({draggable:g,home:x,draggables:l,viewport:e.viewport}),w=p&&p.isCombineEnabled?e.impact:y,k=gy({pageOffset:e.current.page.offset,draggable:c.draggables[e.critical.draggable.id],draggables:c.draggables,droppables:c.droppables,previousImpact:w,viewport:e.viewport,afterCritical:A}),E={...e,phase:"DRAGGING",impact:k,onLiftImpact:y,dimensions:c,afterCritical:A,forceShouldAnimate:!1};return e.phase==="COLLECTING"?E:{...E,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Am=e=>e.movementMode==="SNAP",xp=(e,t,r)=>{const n=eR(e.dimensions,t);return!Am(e)||r?Lu({state:e,dimensions:n}):yy({state:e,dimensions:n})};function bp(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const yx={phase:"IDLE",completed:null,shouldFlush:!1};var iR=(e=yx,t)=>{if(t.type==="FLUSH")return{...yx,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&Ut();const{critical:r,clientSelection:n,viewport:a,dimensions:l,movementMode:c}=t.payload,h=l.draggables[r.draggable.id],p=l.droppables[r.droppable.id],g={selection:n,borderBoxCenter:h.client.borderBox.center,offset:ii},x={client:g,page:{selection:Ti(g.selection,a.scroll.initial),borderBoxCenter:Ti(g.selection,a.scroll.initial),offset:Ti(g.selection,a.scroll.diff.value)}},y=ef(l.droppables).every(E=>!E.isFixedOnPage),{impact:A,afterCritical:w}=vy({draggable:h,home:p,draggables:l.draggables,viewport:a});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:c,dimensions:l,initial:x,current:x,isWindowScrollAllowed:y,impact:A,afterCritical:w,onLiftImpact:A,viewport:a,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&Ut(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||Ut(),sR({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;lc(e)||Ut();const{client:r}=t.payload;return Hl(r,e.current.client.selection)?e:Lu({state:e,clientSelection:r,impact:Am(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return bp(e);lc(e)||Ut();const{id:r,newScroll:n}=t.payload,a=e.dimensions.droppables[r];if(!a)return e;const l=o1(a,n);return xp(e,l,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;lc(e)||Ut();const{id:r,isEnabled:n}=t.payload,a=e.dimensions.droppables[r];a||Ut(),a.isEnabled===n&&Ut();const l={...a,isEnabled:n};return xp(e,l,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;lc(e)||Ut();const{id:r,isCombineEnabled:n}=t.payload,a=e.dimensions.droppables[r];a||Ut(),a.isCombineEnabled===n&&Ut();const l={...a,isCombineEnabled:n};return xp(e,l,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;lc(e)||Ut(),e.isWindowScrollAllowed||Ut();const r=t.payload.newScroll;if(Hl(e.viewport.scroll.current,r))return bp(e);const n=cy(e.viewport,r);return Am(e)?yy({state:e,viewport:n}):Lu({state:e,viewport:n})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!lc(e))return e;const r=t.payload.maxScroll;if(Hl(r,e.viewport.scroll.max))return e;const n={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:n}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&Ut();const r=$N({state:e,type:t.type});return r?Lu({state:e,impact:r.impact,clientSelection:r.clientSelection,scrollJumpRequest:r.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const r=t.payload.reason;return e.phase!=="COLLECTING"&&Ut(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:n,newHomeClientOffset:a}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||Ut(),{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:a,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function Un(e,t){return e instanceof Object&&"type"in e&&e.type===t}const aR=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),oR=e=>({type:"LIFT",payload:e}),lR=e=>({type:"INITIAL_PUBLISH",payload:e}),cR=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),uR=()=>({type:"COLLECTION_STARTING",payload:null}),dR=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),hR=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),fR=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),wy=e=>({type:"MOVE",payload:e}),pR=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),mR=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),gR=()=>({type:"MOVE_UP",payload:null}),xR=()=>({type:"MOVE_DOWN",payload:null}),bR=()=>({type:"MOVE_RIGHT",payload:null}),yR=()=>({type:"MOVE_LEFT",payload:null}),p1=()=>({type:"FLUSH",payload:null}),vR=e=>({type:"DROP_ANIMATE",payload:e}),m1=e=>({type:"DROP_COMPLETE",payload:e}),Ay=e=>({type:"DROP",payload:e}),wR=e=>({type:"DROP_PENDING",payload:e}),Ty=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var AR=e=>({getState:t,dispatch:r})=>n=>a=>{if(!Un(a,"LIFT")){n(a);return}const{id:l,clientSelection:c,movementMode:h}=a.payload,p=t();p.phase==="DROP_ANIMATING"&&r(m1({completed:p.completed})),t().phase!=="IDLE"&&Ut(),r(p1()),r(aR({draggableId:l,movementMode:h}));const x={draggableId:l,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:y,dimensions:A,viewport:w}=e.startPublishing(x);r(lR({critical:y,dimensions:A,clientSelection:c,movementMode:h,viewport:w}))},TR=e=>()=>t=>r=>{Un(r,"INITIAL_PUBLISH")&&e.dragging(),Un(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(Un(r,"FLUSH")||Un(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const g1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Wu={opacity:{drop:0,combining:.7},scale:{drop:.75}},Cy={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},oc=`${Cy.outOfTheWay}s ${g1.outOfTheWay}`,ku={fluid:`opacity ${oc}`,snap:`transform ${oc}, opacity ${oc}`,drop:e=>{const t=`${e}s ${g1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${oc}`,placeholder:`height ${oc}, width ${oc}, margin ${oc}`},vx=e=>Hl(e,ii)?void 0:`translate(${e.x}px, ${e.y}px)`,Tm={moveTo:vx,drop:(e,t)=>{const r=vx(e);if(r)return t?`${r} scale(${Wu.scale.drop})`:r}},{minDropTime:Cm,maxDropTime:Sy}=Cy,CR=Sy-Cm,wx=1500,SR=.6;var _R=({current:e,destination:t,reason:r})=>{const n=Uu(e,t);if(n<=0)return Cm;if(n>=wx)return Sy;const a=n/wx,l=Cm+CR*a,c=r==="CANCEL"?l*SR:l;return Number(c.toFixed(2))},LR=({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:a})=>{const{draggables:l,droppables:c}=r,h=ja(e),p=h?c[h]:null,g=c[t.descriptor.droppableId],x=by({impact:e,draggable:t,draggables:l,afterCritical:a,droppable:p||g,viewport:n});return Ma(x,t.client.borderBox.center)},kR=({draggables:e,reason:t,lastImpact:r,home:n,viewport:a,onLiftImpact:l})=>!r.at||t!=="DROP"?{impact:xy({draggables:e,impact:l,destination:n,viewport:a,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:zu},didDropInsideDroppable:!0};const IR=({getState:e,dispatch:t})=>r=>n=>{if(!Un(n,"DROP")){r(n);return}const a=e(),l=n.payload.reason;if(a.phase==="COLLECTING"){t(wR({reason:l}));return}if(a.phase==="IDLE")return;a.phase==="DROP_PENDING"&&a.isWaiting&&Ut(),a.phase==="DRAGGING"||a.phase==="DROP_PENDING"||Ut();const h=a.critical,p=a.dimensions,g=p.draggables[a.critical.draggable.id],{impact:x,didDropInsideDroppable:y}=kR({reason:l,lastImpact:a.impact,afterCritical:a.afterCritical,onLiftImpact:a.onLiftImpact,home:a.dimensions.droppables[a.critical.droppable.id],viewport:a.viewport,draggables:a.dimensions.draggables}),A=y?l1(x):null,w=y?tf(x):null,k={index:h.draggable.index,droppableId:h.droppable.id},E={draggableId:g.descriptor.id,type:g.descriptor.type,source:k,reason:l,mode:a.movementMode,destination:A,combine:w},I=LR({impact:x,draggable:g,dimensions:p,viewport:a.viewport,afterCritical:a.afterCritical}),M={critical:a.critical,afterCritical:a.afterCritical,result:E,impact:x};if(!(!Hl(a.current.client.offset,I)||!!E.combine)){t(m1({completed:M}));return}const F=_R({current:a.current.client.offset,destination:I,reason:l});t(vR({newHomeClientOffset:I,dropDuration:F,completed:M}))};var _y=()=>({x:window.pageXOffset,y:window.pageYOffset});function ER(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function NR({onWindowScroll:e}){function t(){e(_y())}const r=$u(t),n=ER(r);let a=zl;function l(){return a!==zl}function c(){l()&&Ut(),a=co(window,[n])}function h(){l()||Ut(),r.cancel(),a(),a=zl}return{start:c,stop:h,isActive:l}}const RR=e=>Un(e,"DROP_COMPLETE")||Un(e,"DROP_ANIMATE")||Un(e,"FLUSH"),MR=e=>{const t=NR({onWindowScroll:r=>{e.dispatch(pR({newScroll:r}))}});return r=>n=>{!t.isActive()&&Un(n,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&RR(n)&&t.stop(),r(n)}};var DR=e=>{let t=!1,r=!1;const n=setTimeout(()=>{r=!0}),a=l=>{t||r||(t=!0,e(l),clearTimeout(n))};return a.wasCalled=()=>t,a},jR=()=>{const e=[],t=a=>{const l=e.findIndex(h=>h.timerId===a);l===-1&&Ut();const[c]=e.splice(l,1);c.callback()};return{add:a=>{const l=setTimeout(()=>t(l)),c={timerId:l,callback:a};e.push(c)},flush:()=>{if(!e.length)return;const a=[...e];e.length=0,a.forEach(l=>{clearTimeout(l.timerId),l.callback()})}}};const BR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,QR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,PR=(e,t)=>{if(e===t)return!0;const r=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&n},eu=(e,t)=>{t()},$d=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function yp(e,t,r,n){if(!e){r(n(t));return}const a=DR(r);e(t,{announce:a}),a.wasCalled()||r(n(t))}var OR=(e,t)=>{const r=jR();let n=null;const a=(y,A)=>{n&&Ut(),eu("onBeforeCapture",()=>{const w=e().onBeforeCapture;w&&w({draggableId:y,mode:A})})},l=(y,A)=>{n&&Ut(),eu("onBeforeDragStart",()=>{const w=e().onBeforeDragStart;w&&w($d(y,A))})},c=(y,A)=>{n&&Ut();const w=$d(y,A);n={mode:A,lastCritical:y,lastLocation:w.source,lastCombine:null},r.add(()=>{eu("onDragStart",()=>yp(e().onDragStart,w,t,gh.onDragStart))})},h=(y,A)=>{const w=l1(A),k=tf(A);n||Ut();const E=!PR(y,n.lastCritical);E&&(n.lastCritical=y);const I=!BR(n.lastLocation,w);I&&(n.lastLocation=w);const M=!QR(n.lastCombine,k);if(M&&(n.lastCombine=k),!E&&!I&&!M)return;const B={...$d(y,n.mode),combine:k,destination:w};r.add(()=>{eu("onDragUpdate",()=>yp(e().onDragUpdate,B,t,gh.onDragUpdate))})},p=()=>{n||Ut(),r.flush()},g=y=>{n||Ut(),n=null,eu("onDragEnd",()=>yp(e().onDragEnd,y,t,gh.onDragEnd))};return{beforeCapture:a,beforeStart:l,start:c,update:h,flush:p,drop:g,abort:()=>{if(!n)return;const y={...$d(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};g(y)}}},FR=(e,t)=>{const r=OR(e,t);return n=>a=>l=>{if(Un(l,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(l.payload.draggableId,l.payload.movementMode);return}if(Un(l,"INITIAL_PUBLISH")){const h=l.payload.critical;r.beforeStart(h,l.payload.movementMode),a(l),r.start(h,l.payload.movementMode);return}if(Un(l,"DROP_COMPLETE")){const h=l.payload.completed.result;r.flush(),a(l),r.drop(h);return}if(a(l),Un(l,"FLUSH")){r.abort();return}const c=n.getState();c.phase==="DRAGGING"&&r.update(c.critical,c.impact)}};const $R=e=>t=>r=>{if(!Un(r,"DROP_ANIMATION_FINISHED")){t(r);return}const n=e.getState();n.phase!=="DROP_ANIMATING"&&Ut(),e.dispatch(m1({completed:n.completed}))},UR=e=>{let t=null,r=null;function n(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return a=>l=>{if((Un(l,"FLUSH")||Un(l,"DROP_COMPLETE")||Un(l,"DROP_ANIMATION_FINISHED"))&&n(),a(l),!Un(l,"DROP_ANIMATE"))return;const c={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Ty())}};r=requestAnimationFrame(()=>{r=null,t=co(window,[c])})}};var zR=e=>()=>t=>r=>{(Un(r,"DROP_COMPLETE")||Un(r,"FLUSH")||Un(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},HR=e=>{let t=!1;return()=>r=>n=>{if(Un(n,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),e.tryRestoreFocusRecorded();return}if(r(n),!!t){if(Un(n,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Un(n,"DROP_COMPLETE")){t=!1;const a=n.payload.completed.result;a.combine&&e.tryShiftRecord(a.draggableId,a.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const WR=e=>Un(e,"DROP_COMPLETE")||Un(e,"DROP_ANIMATE")||Un(e,"FLUSH");var GR=e=>t=>r=>n=>{if(WR(n)){e.stop(),r(n);return}if(Un(n,"INITIAL_PUBLISH")){r(n);const a=t.getState();a.phase!=="DRAGGING"&&Ut(),e.start(a);return}r(n),e.scroll(t.getState())};const VR=e=>t=>r=>{if(t(r),!Un(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(Ay({reason:n.reason})))},qR=U3;var YR=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:a,autoScroller:l})=>$3(iR,qR(GI(TR(r),zR(e),AR(e),IR,$R,UR,VR,GR(l),MR,HR(t),FR(n,a))));const vp=()=>({additions:{},removals:{},modified:{}});function ZR({registry:e,callbacks:t}){let r=vp(),n=null;const a=()=>{n||(t.collectionStarting(),n=requestAnimationFrame(()=>{n=null;const{additions:p,removals:g,modified:x}=r,y=Object.keys(p).map(k=>e.draggable.getById(k).getDimension(ii)).sort((k,E)=>k.descriptor.index-E.descriptor.index),A=Object.keys(x).map(k=>{const I=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:I}}),w={additions:y,removals:Object.keys(g),modified:A};r=vp(),t.publish(w)}))};return{add:p=>{const g=p.descriptor.id;r.additions[g]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[g]&&delete r.removals[g],a()},remove:p=>{const g=p.descriptor;r.removals[g.id]=!0,r.modified[g.droppableId]=!0,r.additions[g.id]&&delete r.additions[g.id],a()},stop:()=>{n&&(cancelAnimationFrame(n),n=null,r=vp())}}}var Ly=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const a=Ma({x:t,y:e},{x:n,y:r});return{x:Math.max(0,a.x),y:Math.max(0,a.y)}},ky=()=>{const e=document.documentElement;return e||Ut(),e},Iy=()=>{const e=ky();return Ly({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},KR=()=>{const e=_y(),t=Iy(),r=e.y,n=e.x,a=ky(),l=a.clientWidth,c=a.clientHeight,h=n+l,p=r+c;return{frame:No({top:r,left:n,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:ii,displacement:ii}}}},XR=({critical:e,scrollOptions:t,registry:r})=>{const n=KR(),a=n.scroll.current,l=e.droppable,c=r.droppable.getAllByType(l.type).map(x=>x.callbacks.getDimensionAndWatchScroll(a,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(a));return{dimensions:{draggables:ny(h),droppables:ry(c)},critical:e,viewport:n}};function Ax(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var JR=(e,t)=>{let r=null;const n=ZR({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),a=(A,w)=>{e.droppable.exists(A)||Ut(),r&&t.updateDroppableIsEnabled({id:A,isEnabled:w})},l=(A,w)=>{r&&(e.droppable.exists(A)||Ut(),t.updateDroppableIsCombineEnabled({id:A,isCombineEnabled:w}))},c=(A,w)=>{r&&(e.droppable.exists(A)||Ut(),t.updateDroppableScroll({id:A,newScroll:w}))},h=(A,w)=>{r&&e.droppable.getById(A).callbacks.scroll(w)},p=()=>{if(!r)return;n.stop();const A=r.critical.droppable;e.droppable.getAllByType(A.type).forEach(w=>w.callbacks.dragStopped()),r.unsubscribe(),r=null},g=A=>{r||Ut();const w=r.critical.draggable;A.type==="ADDITION"&&Ax(e,w,A.value)&&n.add(A.value),A.type==="REMOVAL"&&Ax(e,w,A.value)&&n.remove(A.value)};return{updateDroppableIsEnabled:a,updateDroppableIsCombineEnabled:l,scrollDroppable:h,updateDroppableScroll:c,startPublishing:A=>{r&&Ut();const w=e.draggable.getById(A.draggableId),k=e.droppable.getById(w.descriptor.droppableId),E={draggable:w.descriptor,droppable:k.descriptor},I=e.subscribe(g);return r={critical:E,unsubscribe:I},XR({critical:E,registry:e,scrollOptions:A.scrollOptions})},stopPublishing:p}},Ey=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",eM=e=>{window.scrollBy(e.x,e.y)};const tM=si(e=>ef(e).filter(t=>!(!t.isEnabled||!t.frame))),rM=(e,t)=>tM(t).find(n=>(n.frame||Ut(),fy(n.frame.pageMarginBox)(e)))||null;var nM=({center:e,destination:t,droppables:r})=>{if(t){const a=r[t];return a.frame?a:null}return rM(e,r)};const Gu={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var sM=(e,t,r=()=>Gu)=>{const n=r(),a=e[t.size]*n.startFromPercentage,l=e[t.size]*n.maxScrollAtPercentage;return{startScrollingFrom:a,maxScrollValueAt:l}},Ny=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;return n===0?0:(r-e)/n},x1=1,iM=(e,t,r=()=>Gu)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return x1;const l=1-Ny({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),c=n.maxPixelScroll*n.ease(l);return Math.ceil(c)},aM=(e,t,r)=>{const n=r(),a=n.durationDampening.accelerateAt,l=n.durationDampening.stopDampeningAt,c=t,h=l,g=Date.now()-c;if(g>=l)return e;if(g<a)return x1;const x=Ny({startOfRange:a,endOfRange:h,current:g}),y=e*n.ease(x);return Math.ceil(y)},Tx=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:a})=>{const l=iM(e,t,a);return l===0?0:n?Math.max(aM(l,r,a),x1):l},Cx=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c=sM(e,n,l);return t[n.end]<t[n.start]?Tx({distanceToEdge:t[n.end],thresholds:c,dragStartTime:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l}):-1*Tx({distanceToEdge:t[n.start],thresholds:c,dragStartTime:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l})},oM=({container:e,subject:t,proposedScroll:r})=>{const n=t.height>e.height,a=t.width>e.width;return!a&&!n?r:a&&n?null:{x:a?0:r.x,y:n?0:r.y}};const lM=ty(e=>e===0?0:e);var Ry=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},h=Cx({container:t,distanceToEdges:c,dragStartTime:e,axis:c1,shouldUseTimeDampening:a,getAutoScrollerOptions:l}),p=Cx({container:t,distanceToEdges:c,dragStartTime:e,axis:ay,shouldUseTimeDampening:a,getAutoScrollerOptions:l}),g=lM({x:p,y:h});if(Hl(g,ii))return null;const x=oM({container:t,subject:r,proposedScroll:g});return x?Hl(x,ii)?null:x:null};const cM=ty(e=>e===0?0:e>0?1:-1),b1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:n})=>{const a=Ti(t,n),l={x:e(a.x,r.x),y:e(a.y,r.y)};return Hl(l,ii)?null:l}})(),My=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},a=cM(r),l=b1({max:n,current:t,change:a});return!l||a.x!==0&&l.x===0||a.y!==0&&l.y===0},y1=(e,t)=>My({current:e.scroll.current,max:e.scroll.max,change:t}),uM=(e,t)=>{if(!y1(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return b1({current:n,max:r,change:t})},v1=(e,t)=>{const r=e.frame;return r?My({current:r.scroll.current,max:r.scroll.max,change:t}):!1},dM=(e,t)=>{const r=e.frame;return!r||!v1(e,t)?null:b1({current:r.scroll.current,max:r.scroll.max,change:t})};var hM=({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c=Ry({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l});return c&&y1(e,c)?c:null},fM=({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:l})=>{const c=e.frame;if(!c)return null;const h=Ry({dragStartTime:n,container:c.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:a,getAutoScrollerOptions:l});return h&&v1(e,h)?h:null},Sx=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:a,getAutoScrollerOptions:l})=>{const c=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const y=e.viewport,A=hM({dragStartTime:t,viewport:y,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:l});if(A){n(A);return}}const g=nM({center:c,destination:ja(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=fM({dragStartTime:t,droppable:g,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:l});x&&a(g.descriptor.id,x)},pM=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>Gu})=>{const n=$u(e),a=$u(t);let l=null;const c=g=>{l||Ut();const{shouldUseTimeDampening:x,dragStartTime:y}=l;Sx({state:g,scrollWindow:n,scrollDroppable:a,dragStartTime:y,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{l&&Ut();const x=Date.now();let y=!1;const A=()=>{y=!0};Sx({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:A,scrollDroppable:A,getAutoScrollerOptions:r}),l={dragStartTime:x,shouldUseTimeDampening:y},y&&c(g)},stop:()=>{l&&(n.cancel(),a.cancel(),l=null)},scroll:c}},mM=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(h,p)=>{const g=Ti(h.current.client.selection,p);e({client:g})},a=(h,p)=>{if(!v1(h,p))return p;const g=dM(h,p);if(!g)return t(h.descriptor.id,p),null;const x=Ma(p,g);return t(h.descriptor.id,x),Ma(p,x)},l=(h,p,g)=>{if(!h||!y1(p,g))return g;const x=uM(p,g);if(!x)return r(g),null;const y=Ma(g,x);return r(y),Ma(g,y)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const g=ja(h.impact);g||Ut();const x=a(h.dimensions.droppables[g],p);if(!x)return;const y=h.viewport,A=l(h.isWindowScrollAllowed,y,x);A&&n(h,A)}},gM=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const a=pM({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),l=mM({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(n().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){a.scroll(p);return}p.scrollJumpRequest&&l(p)}},start:a.start,stop:a.stop}};const u0="data-rfd",d0=(()=>{const e=`${u0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Sm=(()=>{const e=`${u0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),xM=(()=>{const e=`${u0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),_x={contextId:`${u0}-scroll-container-context-id`},bM=e=>t=>`[${t}="${e}"]`,tu=(e,t)=>e.map(r=>{const n=r.styles[t];return n?`${r.selector} { ${n} }`:""}).join(" "),yM="pointer-events: none;";var vM=e=>{const t=bM(e),r=(()=>{const h=`
111
+ cursor: -webkit-grab;
112
+ cursor: grab;
113
+ `;return{selector:t(d0.contextId),styles:{always:`
114
+ -webkit-touch-callout: none;
115
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
116
+ touch-action: manipulation;
117
+ `,resting:h,dragging:yM,dropAnimating:h}}})(),n=(()=>{const h=`
118
+ transition: ${ku.outOfTheWay};
119
+ `;return{selector:t(Sm.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),a={selector:t(xM.contextId),styles:{always:"overflow-anchor: none;"}},c=[n,r,a,{selector:"body",styles:{dragging:`
120
+ cursor: grabbing;
121
+ cursor: -webkit-grabbing;
122
+ user-select: none;
123
+ -webkit-user-select: none;
124
+ -moz-user-select: none;
125
+ -ms-user-select: none;
126
+ overflow-anchor: none;
127
+ `}}];return{always:tu(c,"always"),resting:tu(c,"resting"),dragging:tu(c,"dragging"),dropAnimating:tu(c,"dropAnimating"),userCancel:tu(c,"userCancel")}};const Ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,wp=()=>{const e=document.querySelector("head");return e||Ut(),e},Lx=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function wM(e,t){const r=Sn(()=>vM(e),[e]),n=b.useRef(null),a=b.useRef(null),l=vr(si(y=>{const A=a.current;A||Ut(),A.textContent=y}),[]),c=vr(y=>{const A=n.current;A||Ut(),A.textContent=y},[]);Ba(()=>{!n.current&&!a.current||Ut();const y=Lx(t),A=Lx(t);return n.current=y,a.current=A,y.setAttribute(`${u0}-always`,e),A.setAttribute(`${u0}-dynamic`,e),wp().appendChild(y),wp().appendChild(A),c(r.always),l(r.resting),()=>{const w=k=>{const E=k.current;E||Ut(),wp().removeChild(E),k.current=null};w(n),w(a)}},[t,c,l,r.always,r.resting,e]);const h=vr(()=>l(r.dragging),[l,r.dragging]),p=vr(y=>{if(y==="DROP"){l(r.dropAnimating);return}l(r.userCancel)},[l,r.dropAnimating,r.userCancel]),g=vr(()=>{a.current&&l(r.resting)},[l,r.resting]);return Sn(()=>({dragging:h,dropping:p,resting:g}),[h,p,g])}function Dy(e,t){return Array.from(e.querySelectorAll(t))}var jy=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function sf(e){return e instanceof jy(e).HTMLElement}function AM(e,t){const r=`[${d0.contextId}="${e}"]`,n=Dy(document,r);if(!n.length)return null;const a=n.find(l=>l.getAttribute(d0.draggableId)===t);return!a||!sf(a)?null:a}function TM(e){const t=b.useRef({}),r=b.useRef(null),n=b.useRef(null),a=b.useRef(!1),l=vr(function(A,w){const k={id:A,focus:w};return t.current[A]=k,function(){const I=t.current;I[A]!==k&&delete I[A]}},[]),c=vr(function(A){const w=AM(e,A);w&&w!==document.activeElement&&w.focus()},[e]),h=vr(function(A,w){r.current===A&&(r.current=w)},[]),p=vr(function(){n.current||a.current&&(n.current=requestAnimationFrame(()=>{n.current=null;const A=r.current;A&&c(A)}))},[c]),g=vr(function(A){r.current=null;const w=document.activeElement;w&&w.getAttribute(d0.draggableId)===A&&(r.current=A)},[]);return Ba(()=>(a.current=!0,function(){a.current=!1;const A=n.current;A&&cancelAnimationFrame(A)}),[]),Sn(()=>({register:l,tryRecordFocus:g,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[l,g,p,h])}function CM(){const e={draggables:{},droppables:{}},t=[];function r(y){return t.push(y),function(){const w=t.indexOf(y);w!==-1&&t.splice(w,1)}}function n(y){t.length&&t.forEach(A=>A(y))}function a(y){return e.draggables[y]||null}function l(y){const A=a(y);return A||Ut(),A}const c={register:y=>{e.draggables[y.descriptor.id]=y,n({type:"ADDITION",value:y})},update:(y,A)=>{const w=e.draggables[A.descriptor.id];w&&w.uniqueId===y.uniqueId&&(delete e.draggables[A.descriptor.id],e.draggables[y.descriptor.id]=y)},unregister:y=>{const A=y.descriptor.id,w=a(A);w&&y.uniqueId===w.uniqueId&&(delete e.draggables[A],e.droppables[y.descriptor.droppableId]&&n({type:"REMOVAL",value:y}))},getById:l,findById:a,exists:y=>!!a(y),getAllByType:y=>Object.values(e.draggables).filter(A=>A.descriptor.type===y)};function h(y){return e.droppables[y]||null}function p(y){const A=h(y);return A||Ut(),A}const g={register:y=>{e.droppables[y.descriptor.id]=y},unregister:y=>{const A=h(y.descriptor.id);A&&y.uniqueId===A.uniqueId&&delete e.droppables[y.descriptor.id]},getById:p,findById:h,exists:y=>!!h(y),getAllByType:y=>Object.values(e.droppables).filter(A=>A.descriptor.type===y)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:c,droppable:g,subscribe:r,clean:x}}function SM(){const e=Sn(CM,[]);return b.useEffect(()=>function(){e.clean()},[e]),e}var w1=C.createContext(null),$h=()=>{const e=document.body;return e||Ut(),e};const _M={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},LM=e=>`rfd-announcement-${e}`;function kM(e){const t=Sn(()=>LM(e),[e]),r=b.useRef(null);return b.useEffect(function(){const l=document.createElement("div");return r.current=l,l.id=t,l.setAttribute("aria-live","assertive"),l.setAttribute("aria-atomic","true"),Qh(l.style,_M),$h().appendChild(l),function(){setTimeout(function(){const p=$h();p.contains(l)&&p.removeChild(l),l===r.current&&(r.current=null)})}},[t]),vr(a=>{const l=r.current;if(l){l.textContent=a;return}},[])}const IM={separator:"::"};function A1(e,t=IM){const r=C.useId();return Sn(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function EM({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function NM({contextId:e,text:t}){const r=A1("hidden-text",{separator:"-"}),n=Sn(()=>EM({contextId:e,uniqueId:r}),[r,e]);return b.useEffect(function(){const l=document.createElement("div");return l.id=n,l.textContent=t,l.style.display="none",$h().appendChild(l),function(){const h=$h();h.contains(l)&&h.removeChild(l)}},[n,t]),n}var af=C.createContext(null);function By(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),t}function RM(){let e=null;function t(){return!!e}function r(c){return c===e}function n(c){e&&Ut();const h={abandon:c};return e=h,h}function a(){e||Ut(),e=null}function l(){e&&(e.abandon(),a())}return{isClaimed:t,isActive:r,claim:n,release:a,tryAbandon:l}}function Vu(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const MM=9,DM=13,T1=27,Qy=32,jM=33,BM=34,QM=35,PM=36,OM=37,FM=38,$M=39,UM=40,zM={[DM]:!0,[MM]:!0};var Py=e=>{zM[e.keyCode]&&e.preventDefault()};const of=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(n=>`on${n}`in document)||e})(),Oy=0,kx=5;function HM(e,t){return Math.abs(t.x-e.x)>=kx||Math.abs(t.y-e.y)>=kx}const Ix={type:"IDLE"};function WM({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:a=>{const{button:l,clientX:c,clientY:h}=a;if(l!==Oy)return;const p={x:c,y:h},g=r();if(g.type==="DRAGGING"){a.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&Ut();const x=g.point;if(!HM(x,p))return;a.preventDefault();const y=g.actions.fluidLift(p);n({type:"DRAGGING",actions:y})}},{eventName:"mouseup",fn:a=>{const l=r();if(l.type!=="DRAGGING"){e();return}a.preventDefault(),l.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:a=>{r().type==="DRAGGING"&&a.preventDefault(),e()}},{eventName:"keydown",fn:a=>{if(r().type==="PENDING"){e();return}if(a.keyCode===T1){a.preventDefault(),e();return}Py(a)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:a=>{const l=r();if(l.type==="IDLE"&&Ut(),l.actions.shouldRespectForcePress()){e();return}a.preventDefault()}},{eventName:of,fn:e}]}function GM(e){const t=b.useRef(Ix),r=b.useRef(zl),n=Sn(()=>({eventName:"mousedown",fn:function(y){if(y.defaultPrevented||y.button!==Oy||y.ctrlKey||y.metaKey||y.shiftKey||y.altKey)return;const A=e.findClosestDraggableId(y);if(!A)return;const w=e.tryGetLock(A,c,{sourceEvent:y});if(!w)return;y.preventDefault();const k={x:y.clientX,y:y.clientY};r.current(),g(w,k)}}),[e]),a=Sn(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const y=e.findClosestDraggableId(x);if(!y)return;const A=e.findOptionsForDraggable(y);A&&(A.shouldRespectForcePress||e.canGetLock(y)&&x.preventDefault())}}),[e]),l=vr(function(){const y={passive:!1,capture:!0};r.current=co(window,[a,n],y)},[a,n]),c=vr(()=>{t.current.type!=="IDLE"&&(t.current=Ix,r.current(),l())},[l]),h=vr(()=>{const x=t.current;c(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[c]),p=vr(function(){const y={capture:!0,passive:!1},A=WM({cancel:h,completed:c,getPhase:()=>t.current,setPhase:w=>{t.current=w}});r.current=co(window,A,y)},[h,c]),g=vr(function(y,A){t.current.type!=="IDLE"&&Ut(),t.current={type:"PENDING",point:A,actions:y},p()},[p]);Ba(function(){return l(),function(){r.current()}},[l])}function VM(){}const qM={[BM]:!0,[jM]:!0,[PM]:!0,[QM]:!0};function YM(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:a=>{if(a.keyCode===T1){a.preventDefault(),r();return}if(a.keyCode===Qy){a.preventDefault(),n();return}if(a.keyCode===UM){a.preventDefault(),e.moveDown();return}if(a.keyCode===FM){a.preventDefault(),e.moveUp();return}if(a.keyCode===$M){a.preventDefault(),e.moveRight();return}if(a.keyCode===OM){a.preventDefault(),e.moveLeft();return}if(qM[a.keyCode]){a.preventDefault();return}Py(a)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:of,fn:r}]}function ZM(e){const t=b.useRef(VM),r=Sn(()=>({eventName:"keydown",fn:function(l){if(l.defaultPrevented||l.keyCode!==Qy)return;const c=e.findClosestDraggableId(l);if(!c)return;const h=e.tryGetLock(c,x,{sourceEvent:l});if(!h)return;l.preventDefault();let p=!0;const g=h.snapLift();t.current();function x(){p||Ut(),p=!1,t.current(),n()}t.current=co(window,YM(g,x),{capture:!0,passive:!1})}}),[e]),n=vr(function(){const l={passive:!1,capture:!0};t.current=co(window,[r],l)},[r]);Ba(function(){return n(),function(){t.current()}},[n])}const Ap={type:"IDLE"},KM=120,XM=.15;function JM({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:r=>{r.preventDefault()}},{eventName:"keydown",fn:r=>{if(t().type!=="DRAGGING"){e();return}r.keyCode===T1&&r.preventDefault(),e()}},{eventName:of,fn:e}]}function eD({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:n=>{const a=r();if(a.type!=="DRAGGING"){e();return}a.hasMoved=!0;const{clientX:l,clientY:c}=n.touches[0],h={x:l,y:c};n.preventDefault(),a.actions.move(h)}},{eventName:"touchend",fn:n=>{const a=r();if(a.type!=="DRAGGING"){e();return}n.preventDefault(),a.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:n=>{if(r().type!=="DRAGGING"){e();return}n.preventDefault(),e()}},{eventName:"touchforcechange",fn:n=>{const a=r();a.type==="IDLE"&&Ut();const l=n.touches[0];if(!l||!(l.force>=XM))return;const h=a.actions.shouldRespectForcePress();if(a.type==="PENDING"){h&&e();return}if(h){if(a.hasMoved){n.preventDefault();return}e();return}n.preventDefault()}},{eventName:of,fn:e}]}function tD(e){const t=b.useRef(Ap),r=b.useRef(zl),n=vr(function(){return t.current},[]),a=vr(function(w){t.current=w},[]),l=Sn(()=>({eventName:"touchstart",fn:function(w){if(w.defaultPrevented)return;const k=e.findClosestDraggableId(w);if(!k)return;const E=e.tryGetLock(k,h,{sourceEvent:w});if(!E)return;const I=w.touches[0],{clientX:M,clientY:B}=I,F={x:M,y:B};r.current(),y(E,F)}}),[e]),c=vr(function(){const w={capture:!0,passive:!1};r.current=co(window,[l],w)},[l]),h=vr(()=>{const A=t.current;A.type!=="IDLE"&&(A.type==="PENDING"&&clearTimeout(A.longPressTimerId),a(Ap),r.current(),c())},[c,a]),p=vr(()=>{const A=t.current;h(),A.type==="DRAGGING"&&A.actions.cancel({shouldBlockNextClick:!0}),A.type==="PENDING"&&A.actions.abort()},[h]),g=vr(function(){const w={capture:!0,passive:!1},k={cancel:p,completed:h,getPhase:n},E=co(window,eD(k),w),I=co(window,JM(k),w);r.current=function(){E(),I()}},[p,n,h]),x=vr(function(){const w=n();w.type!=="PENDING"&&Ut();const k=w.actions.fluidLift(w.point);a({type:"DRAGGING",actions:k,hasMoved:!1})},[n,a]),y=vr(function(w,k){n().type!=="IDLE"&&Ut();const E=setTimeout(x,KM);a({type:"PENDING",point:k,actions:w,longPressTimerId:E}),g()},[g,n,a,x]);Ba(function(){return c(),function(){r.current();const k=n();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),a(Ap))}},[n,c,a]),Ba(function(){return co(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const rD=["input","button","textarea","select","option","optgroup","video","audio"];function Fy(e,t){if(t==null)return!1;if(rD.includes(t.tagName.toLowerCase()))return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:Fy(e,t.parentElement)}function nD(e,t){const r=t.target;return sf(r)?Fy(e,r):!1}var sD=e=>No(e.getBoundingClientRect()).center;function iD(e){return e instanceof jy(e).Element}const aD=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(n=>n in Element.prototype)||e})();function $y(e,t){return e==null?null:e[aD](t)?e:$y(e.parentElement,t)}function oD(e,t){return e.closest?e.closest(t):$y(e,t)}function lD(e){return`[${d0.contextId}="${e}"]`}function cD(e,t){const r=t.target;if(!iD(r))return null;const n=lD(e),a=oD(r,n);return!a||!sf(a)?null:a}function uD(e,t){const r=cD(e,t);return r?r.getAttribute(d0.draggableId):null}function dD(e,t){const r=`[${Sm.contextId}="${e}"]`,a=Dy(document,r).find(l=>l.getAttribute(Sm.id)===t);return!a||!sf(a)?null:a}function hD(e){e.preventDefault()}function Ud({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!(!r()||e!==t)}function Uy({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const a=r.draggable.findById(n);return!(!a||!a.options.isEnabled||!Ey(t.getState(),n))}function fD({lockAPI:e,contextId:t,store:r,registry:n,draggableId:a,forceSensorStop:l,sourceEvent:c}){if(!Uy({lockAPI:e,store:r,registry:n,draggableId:a}))return null;const p=n.draggable.getById(a),g=dD(t,p.descriptor.id);if(!g||c&&!p.options.canDragInteractiveElements&&nD(g,c))return null;const x=e.claim(l||zl);let y="PRE_DRAG";function A(){return p.options.shouldRespectForcePress}function w(){return e.isActive(x)}function k(G,Q){Ud({expected:G,phase:y,isLockActive:w,shouldWarn:!0})&&r.dispatch(Q())}const E=k.bind(null,"DRAGGING");function I(G){function Q(){e.release(),y="COMPLETED"}y!=="PRE_DRAG"&&(Q(),Ut()),r.dispatch(oR(G.liftActionArgs)),y="DRAGGING";function X(ee,ze={shouldBlockNextClick:!1}){if(G.cleanup(),ze.shouldBlockNextClick){const he=co(window,[{eventName:"click",fn:hD,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(he)}Q(),r.dispatch(Ay({reason:ee}))}return{isActive:()=>Ud({expected:"DRAGGING",phase:y,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:A,drop:ee=>X("DROP",ee),cancel:ee=>X("CANCEL",ee),...G.actions}}function M(G){const Q=$u(ee=>{E(()=>wy({client:ee}))});return{...I({liftActionArgs:{id:a,clientSelection:G,movementMode:"FLUID"},cleanup:()=>Q.cancel(),actions:{move:Q}}),move:Q}}function B(){const G={moveUp:()=>E(gR),moveRight:()=>E(bR),moveDown:()=>E(xR),moveLeft:()=>E(yR)};return I({liftActionArgs:{id:a,clientSelection:sD(g),movementMode:"SNAP"},cleanup:zl,actions:G})}function F(){Ud({expected:"PRE_DRAG",phase:y,isLockActive:w,shouldWarn:!0})&&e.release()}return{isActive:()=>Ud({expected:"PRE_DRAG",phase:y,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:A,fluidLift:M,snapLift:B,abort:F}}const pD=[GM,ZM,tD];function mD({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:a}){const l=[...a?pD:[],...n||[]],c=b.useState(()=>RM())[0],h=vr(function(I,M){Vu(I)&&!Vu(M)&&c.tryAbandon()},[c]);Ba(function(){let I=t.getState();return t.subscribe(()=>{const B=t.getState();h(I,B),I=B})},[c,t,h]),Ba(()=>c.tryAbandon,[c.tryAbandon]);const p=vr(E=>Uy({lockAPI:c,registry:r,store:t,draggableId:E}),[c,r,t]),g=vr((E,I,M)=>fD({lockAPI:c,registry:r,contextId:e,store:t,draggableId:E,forceSensorStop:I||null,sourceEvent:M&&M.sourceEvent?M.sourceEvent:null}),[e,c,r,t]),x=vr(E=>uD(e,E),[e]),y=vr(E=>{const I=r.draggable.findById(E);return I?I.options:null},[r.draggable]),A=vr(function(){c.isClaimed()&&(c.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(p1()))},[c,t]),w=vr(()=>c.isClaimed(),[c]),k=Sn(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:y,tryReleaseLock:A,isLockClaimed:w}),[p,g,x,y,A,w]);for(let E=0;E<l.length;E++)l[E](k)}const gD=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Ai.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),xD=e=>({...Gu,...e.autoScrollerOptions,durationDampening:{...Gu.durationDampening,...e.autoScrollerOptions}});function ru(e){return e.current||Ut(),e.current}function bD(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:a,dragHandleUsageInstructions:l}=e,c=b.useRef(null),h=By(e),p=vr(()=>gD(h.current),[h]),g=vr(()=>xD(h.current),[h]),x=kM(t),y=NM({contextId:t,text:l}),A=wM(t,a),w=vr(he=>{ru(c).dispatch(he)},[]),k=Sn(()=>tx({publishWhileDragging:cR,updateDroppableScroll:dR,updateDroppableIsEnabled:hR,updateDroppableIsCombineEnabled:fR,collectionStarting:uR},w),[w]),E=SM(),I=Sn(()=>JR(E,k),[E,k]),M=Sn(()=>gM({scrollWindow:eM,scrollDroppable:I.scrollDroppable,getAutoScrollerOptions:g,...tx({move:wy},w)}),[I.scrollDroppable,w,g]),B=TM(t),F=Sn(()=>YR({announce:x,autoScroller:M,dimensionMarshal:I,focusMarshal:B,getResponders:p,styleMarshal:A}),[x,M,I,B,p,A]);c.current=F;const U=vr(()=>{const he=ru(c);he.getState().phase!=="IDLE"&&he.dispatch(p1())},[]),G=vr(()=>{const he=ru(c).getState();return he.phase==="DROP_ANIMATING"?!0:he.phase==="IDLE"?!1:he.isDragging},[]),Q=Sn(()=>({isDragging:G,tryAbort:U}),[G,U]);r(Q);const X=vr(he=>Ey(ru(c).getState(),he),[]),ee=vr(()=>lc(ru(c).getState()),[]),ze=Sn(()=>({marshal:I,focus:B,contextId:t,canLift:X,isMovementAllowed:ee,dragHandleUsageInstructionsId:y,registry:E}),[t,I,y,B,X,ee,E]);return mD({contextId:t,store:F,registry:E,customSensors:n||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),b.useEffect(()=>U,[U]),C.createElement(af.Provider,{value:ze},C.createElement(zE,{context:w1,store:F},e.children))}function yD(){return C.useId()}function Uh(e){const t=yD(),r=e.dragHandleUsageInstructions||gh.dragHandleUsageInstructions;return C.createElement(ZE,null,n=>C.createElement(bD,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:r,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const Ex={dragging:5e3,dropAnimating:4500},vD=(e,t)=>t?ku.drop(t.duration):e?ku.snap:ku.fluid,wD=(e,t)=>{if(e)return t?Wu.opacity.drop:Wu.opacity.combining},AD=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function TD(e){const r=e.dimension.client,{offset:n,combineWith:a,dropping:l}=e,c=!!a,h=AD(e),p=!!l,g=p?Tm.drop(n,c):Tm.moveTo(n);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:vD(h,l),transform:g,opacity:wD(c,p),zIndex:p?Ex.dropAnimating:Ex.dragging,pointerEvents:"none"}}function CD(e){return{transform:Tm.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function SD(e){return e.type==="DRAGGING"?TD(e):CD(e)}function _D(e,t,r=ii){const n=window.getComputedStyle(t),a=t.getBoundingClientRect(),l=Y3(a,n),c=Bh(l,r),h={client:l,tagName:t.tagName.toLowerCase(),display:n.display},p={x:l.marginBox.width,y:l.marginBox.height};return{descriptor:e,placeholder:h,displaceBy:p,client:l,page:c}}function LD(e){const t=A1("draggable"),{descriptor:r,registry:n,getDraggableRef:a,canDragInteractiveElements:l,shouldRespectForcePress:c,isEnabled:h}=e,p=Sn(()=>({canDragInteractiveElements:l,shouldRespectForcePress:c,isEnabled:h}),[l,h,c]),g=vr(w=>{const k=a();return k||Ut(),_D(r,k,w)},[r,a]),x=Sn(()=>({uniqueId:t,descriptor:r,options:p,getDimension:g}),[r,g,p,t]),y=b.useRef(x),A=b.useRef(!0);Ba(()=>(n.draggable.register(y.current),()=>n.draggable.unregister(y.current)),[n.draggable]),Ba(()=>{if(A.current){A.current=!1;return}const w=y.current;y.current=x,n.draggable.update(x,w)},[x,n.draggable])}var C1=C.createContext(null);function zh(e){const t=b.useContext(e);return t||Ut(),t}function kD(e){e.preventDefault()}const ID=e=>{const t=b.useRef(null),r=vr((Q=null)=>{t.current=Q},[]),n=vr(()=>t.current,[]),{contextId:a,dragHandleUsageInstructionsId:l,registry:c}=zh(af),{type:h,droppableId:p}=zh(C1),g=Sn(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:y,isEnabled:A,shouldRespectForcePress:w,canDragInteractiveElements:k,isClone:E,mapped:I,dropAnimationFinished:M}=e;if(!E){const Q=Sn(()=>({descriptor:g,registry:c,getDraggableRef:n,canDragInteractiveElements:k,shouldRespectForcePress:w,isEnabled:A}),[g,c,n,k,w,A]);LD(Q)}const B=Sn(()=>A?{tabIndex:0,role:"button","aria-describedby":l,"data-rfd-drag-handle-draggable-id":y,"data-rfd-drag-handle-context-id":a,draggable:!1,onDragStart:kD}:null,[a,l,y,A]),F=vr(Q=>{I.type==="DRAGGING"&&I.dropping&&Q.propertyName==="transform"&&Ai.flushSync(M)},[M,I]),U=Sn(()=>{const Q=SD(I),X=I.type==="DRAGGING"&&I.dropping?F:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":a,"data-rfd-draggable-id":y,style:Q,onTransitionEnd:X},dragHandleProps:B}},[a,B,y,I,F,r]),G=Sn(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return C.createElement(C.Fragment,null,x(U,I.snapshot,G))};var zy=(e,t)=>e===t,Hy=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const ED=e=>e.combine?e.combine.draggableId:null,ND=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function RD(){const e=si((a,l)=>({x:a,y:l})),t=si((a,l,c=null,h=null,p=null)=>({isDragging:!0,isClone:l,isDropAnimating:!!p,dropAnimation:p,mode:a,draggingOver:c,combineWith:h,combineTargetFor:null})),r=si((a,l,c,h,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:l,offset:a,dimension:c,forceShouldAnimate:x,snapshot:t(l,h,p,g,null)}}));return(a,l)=>{if(Vu(a)){if(a.critical.draggable.id!==l.draggableId)return null;const c=a.current.client.offset,h=a.dimensions.draggables[l.draggableId],p=ja(a.impact),g=ND(a.impact),x=a.forceShouldAnimate;return r(e(c.x,c.y),a.movementMode,h,l.isClone,p,g,x)}if(a.phase==="DROP_ANIMATING"){const c=a.completed;if(c.result.draggableId!==l.draggableId)return null;const h=l.isClone,p=a.dimensions.draggables[l.draggableId],g=c.result,x=g.mode,y=Hy(g),A=ED(g),k={duration:a.dropDuration,curve:g1.drop,moveTo:a.newHomeClientOffset,opacity:A?Wu.opacity.drop:null,scale:A?Wu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:a.newHomeClientOffset,dimension:p,dropping:k,draggingOver:y,combineWith:A,mode:x,forceShouldAnimate:null,snapshot:t(x,h,y,A,k)}}}return null}}function Wy(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const MD={mapped:{type:"SECONDARY",offset:ii,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Wy(null)}};function DD(){const e=si((c,h)=>({x:c,y:h})),t=si(Wy),r=si((c,h=null,p)=>({mapped:{type:"SECONDARY",offset:c,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),n=c=>c?r(ii,c,!0):null,a=(c,h,p,g)=>{const x=p.displaced.visible[c],y=!!(g.inVirtualList&&g.effected[c]),A=tf(p),w=A&&A.draggableId===c?h:null;if(!x){if(!y)return n(w);if(p.displaced.invisible[c])return null;const I=x0(g.displacedBy.point),M=e(I.x,I.y);return r(M,w,!0)}if(y)return n(w);const k=p.displacedBy.point,E=e(k.x,k.y);return r(E,w,x.shouldAnimate)};return(c,h)=>{if(Vu(c))return c.critical.draggable.id===h.draggableId?null:a(h.draggableId,c.critical.draggable.id,c.impact,c.afterCritical);if(c.phase==="DROP_ANIMATING"){const p=c.completed;return p.result.draggableId===h.draggableId?null:a(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const jD=()=>{const e=RD(),t=DD();return(n,a)=>e(n,a)||t(n,a)||MD},BD={dropAnimationFinished:Ty},QD=q3(jD,BD,null,{context:w1,areStatePropsEqual:zy})(ID);function Gy(e){return zh(C1).isUsingCloneFor===e.draggableId&&!e.isClone?null:C.createElement(QD,e)}function ml(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return C.createElement(Gy,Qh({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const Vy=e=>t=>e===t,PD=Vy("scroll"),OD=Vy("auto"),Nx=(e,t)=>t(e.overflowX)||t(e.overflowY),FD=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return Nx(r,PD)||Nx(r,OD)},$D=()=>!1,qy=e=>e==null?null:e===document.body?$D()?e:null:e===document.documentElement?null:FD(e)?e:qy(e.parentElement);var _m=e=>({x:e.scrollLeft,y:e.scrollTop});const Yy=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Yy(e.parentElement):!1;var UD=e=>{const t=qy(e),r=Yy(e);return{closestScrollable:t,isFixedOnPage:r}},zD=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:a,client:l,page:c,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:A,client:w}=h,k=Ly({scrollHeight:A.scrollHeight,scrollWidth:A.scrollWidth,height:w.paddingBox.height,width:w.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:w,scrollSize:A,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:k,diff:{value:ii,displacement:ii}}}})(),g=a==="vertical"?c1:ay,x=c0({page:c,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:g,isEnabled:t,client:l,page:c,frame:p,subject:x}};const HD=(e,t)=>{const r=Z3(e);if(!t||e!==t)return r;const n=r.paddingBox.top-t.scrollTop,a=r.paddingBox.left-t.scrollLeft,l=n+t.scrollHeight,c=a+t.scrollWidth,p=i1({top:n,right:c,bottom:l,left:a},r.border);return a1({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var WD=({ref:e,descriptor:t,env:r,windowScroll:n,direction:a,isDropDisabled:l,isCombineEnabled:c,shouldClipSubject:h})=>{const p=r.closestScrollable,g=HD(e,p),x=Bh(g,n),y=(()=>{if(!p)return null;const w=Z3(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:w,page:Bh(w,n),scroll:_m(p),scrollSize:k,shouldClipSubject:h}})();return zD({descriptor:t,isEnabled:!l,isCombineEnabled:c,isFixedOnPage:r.isFixedOnPage,direction:a,client:g,page:x,closest:y})};const GD={passive:!1},VD={passive:!0};var Rx=e=>e.shouldPublishImmediately?GD:VD;const zd=e=>e&&e.env.closestScrollable||null;function qD(e){const t=b.useRef(null),r=zh(af),n=A1("droppable"),{registry:a,marshal:l}=r,c=By(e),h=Sn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=b.useRef(h),g=Sn(()=>si((U,G)=>{t.current||Ut();const Q={x:U,y:G};l.updateDroppableScroll(h.id,Q)}),[h.id,l]),x=vr(()=>{const U=t.current;return!U||!U.env.closestScrollable?ii:_m(U.env.closestScrollable)},[]),y=vr(()=>{const U=x();g(U.x,U.y)},[x,g]),A=Sn(()=>$u(y),[y]),w=vr(()=>{const U=t.current,G=zd(U);if(U&&G||Ut(),U.scrollOptions.shouldPublishImmediately){y();return}A()},[A,y]),k=vr((U,G)=>{t.current&&Ut();const Q=c.current,X=Q.getDroppableRef();X||Ut();const ee=UD(X),ze={ref:X,descriptor:h,env:ee,scrollOptions:G};t.current=ze;const he=WD({ref:X,descriptor:h,env:ee,windowScroll:U,direction:Q.direction,isDropDisabled:Q.isDropDisabled,isCombineEnabled:Q.isCombineEnabled,shouldClipSubject:!Q.ignoreContainerClipping}),de=ee.closestScrollable;return de&&(de.setAttribute(_x.contextId,r.contextId),de.addEventListener("scroll",w,Rx(ze.scrollOptions))),he},[r.contextId,h,w,c]),E=vr(()=>{const U=t.current,G=zd(U);return U&&G||Ut(),_m(G)},[]),I=vr(()=>{const U=t.current;U||Ut();const G=zd(U);t.current=null,G&&(A.cancel(),G.removeAttribute(_x.contextId),G.removeEventListener("scroll",w,Rx(U.scrollOptions)))},[w,A]),M=vr(U=>{const G=t.current;G||Ut();const Q=zd(G);Q||Ut(),Q.scrollTop+=U.y,Q.scrollLeft+=U.x},[]),B=Sn(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:E,dragStopped:I,scroll:M}),[I,k,E,M]),F=Sn(()=>({uniqueId:n,descriptor:h,callbacks:B}),[B,h,n]);Ba(()=>(p.current=F.descriptor,a.droppable.register(F),()=>{t.current&&I(),a.droppable.unregister(F)}),[B,h,I,F,l,a.droppable]),Ba(()=>{t.current&&l.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,l]),Ba(()=>{t.current&&l.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,l])}function Tp(){}const Mx={width:0,height:0,margin:nN},YD=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?Mx:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},ZD=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=YD({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:n.width,height:n.height,marginTop:n.margin.top,marginRight:n.margin.right,marginBottom:n.margin.bottom,marginLeft:n.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?ku.placeholder:null}},KD=e=>{const t=b.useRef(null),r=vr(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:n,onTransitionEnd:a,onClose:l,contextId:c}=e,[h,p]=b.useState(e.animate==="open");b.useEffect(()=>h?n!=="open"?(r(),p(!1),Tp):t.current?Tp:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):Tp,[n,h,r]);const g=vr(y=>{y.propertyName==="height"&&(a(),n==="close"&&l())},[n,l,a]),x=ZD({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return C.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":c,onTransitionEnd:g,ref:e.innerRef})};var XD=C.memo(KD);class JD extends C.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,r){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:r.isVisible?{isVisible:!0,data:r.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const ej=e=>{const t=b.useContext(af);t||Ut();const{contextId:r,isMovementAllowed:n}=t,a=b.useRef(null),l=b.useRef(null),{children:c,droppableId:h,type:p,mode:g,direction:x,ignoreContainerClipping:y,isDropDisabled:A,isCombineEnabled:w,snapshot:k,useClone:E,updateViewportMaxScroll:I,getContainerForClone:M}=e,B=vr(()=>a.current,[]),F=vr((de=null)=>{a.current=de},[]);vr(()=>l.current,[]);const U=vr((de=null)=>{l.current=de},[]),G=vr(()=>{n()&&I({maxScroll:Iy()})},[n,I]);qD({droppableId:h,type:p,mode:g,direction:x,isDropDisabled:A,isCombineEnabled:w,ignoreContainerClipping:y,getDroppableRef:B});const Q=Sn(()=>C.createElement(JD,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:de,data:$e,animate:qe})=>C.createElement(XD,{placeholder:$e,onClose:de,innerRef:U,animate:qe,contextId:r,onTransitionEnd:G})),[r,G,e.placeholder,e.shouldAnimatePlaceholder,U]),X=Sn(()=>({innerRef:F,placeholder:Q,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,Q,F]),ee=E?E.dragging.draggableId:null,ze=Sn(()=>({droppableId:h,type:p,isUsingCloneFor:ee}),[h,ee,p]);function he(){if(!E)return null;const{dragging:de,render:$e}=E,qe=C.createElement(Gy,{draggableId:de.draggableId,index:de.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(oe,Re)=>$e(oe,Re,de));return Fw.createPortal(qe,M())}return C.createElement(C1.Provider,{value:ze},c(X,k),he())};function tj(){return document.body||Ut(),document.body}const Dx={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:tj},Zy=e=>{let t={...e},r;for(r in Dx)e[r]===void 0&&(t={...t,[r]:Dx[r]});return t},Cp=(e,t)=>e===t.droppable.type,jx=(e,t)=>t.draggables[e.draggable.id],rj=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=si(l=>({draggableId:l.id,type:l.type,source:{index:l.index,droppableId:l.droppableId}})),n=si((l,c,h,p,g,x)=>{const y=g.descriptor.id;if(g.descriptor.droppableId===l){const k=x?{render:x,dragging:r(g.descriptor)}:null,E={isDraggingOver:h,draggingOverWith:h?y:null,draggingFromThisWith:y,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:E,useClone:k}}if(!c)return t;if(!p)return e;const w={isDraggingOver:h,draggingOverWith:y,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:w,useClone:null}});return(l,c)=>{const h=Zy(c),p=h.droppableId,g=h.type,x=!h.isDropDisabled,y=h.renderClone;if(Vu(l)){const A=l.critical;if(!Cp(g,A))return t;const w=jx(A,l.dimensions),k=ja(l.impact)===p;return n(p,x,k,k,w,y)}if(l.phase==="DROP_ANIMATING"){const A=l.completed;if(!Cp(g,A.critical))return t;const w=jx(A.critical,l.dimensions);return n(p,x,Hy(A.result)===p,ja(A.impact)===p,w,y)}if(l.phase==="IDLE"&&l.completed&&!l.shouldFlush){const A=l.completed;if(!Cp(g,A.critical))return t;const w=ja(A.impact)===p,k=!!(A.impact.at&&A.impact.at.type==="COMBINE"),E=A.critical.droppable.id===p;return w?k?e:t:E?e:t}return t}},nj={updateViewportMaxScroll:mR},gl=q3(rj,nj,(e,t,r)=>({...Zy(r),...e,...t}),{context:w1,areStatePropsEqual:zy})(ej);function sj(){if(typeof window>"u")return t0(void 0);try{const e=window.localStorage.getItem(dm);return t0(e?JSON.parse(e):void 0)}catch{return t0(void 0)}}function Sp(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(dm),r=t?JSON.parse(t):{},n=t0({...r,...e});window.localStorage.setItem(dm,JSON.stringify(n))}catch{}}function ij(){const[e,t]=C.useState(sj);C.useEffect(()=>{Sp(e)},[e]);const r=C.useCallback(a=>{t(l=>{const c=t0({...l,...a});return Sp(c),c})},[]),n=C.useCallback(()=>{const a=t0(void 0);t(a),Sp(a)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:n}}const Lm="termdock-settings";function aj(e){return e==="shell"||e==="tmux"}function oj(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(Lm);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&aj(t.newSessionMode)?t.newSessionMode:null,n=r??"shell",a=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:n,tmuxName:a,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function Bx(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Lm),n={...t?JSON.parse(t):{},...e};window.localStorage.setItem(Lm,JSON.stringify(n))}catch{}}function lj(){const[e,t]=C.useState(oj),r=C.useCallback((a,l)=>{const c=l?.userInitiated!==!1;t(h=>({...h,mode:a,userSelectedMode:c?a:h.userSelectedMode})),c&&Bx({newSessionMode:a,newSessionModeUserSelected:!0})},[]),n=C.useCallback(a=>{t(l=>({...l,tmuxName:a})),Bx({newSessionTmuxName:a})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:n}}const cj=550,uj=10;function Ky(){const e=b.useRef(null),t=b.useRef(null),r=b.useRef(!1),n=b.useRef(!1),a=b.useRef(null),l=b.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),c=b.useCallback(()=>{l(),t.current=null},[l]);return b.useCallback(p=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(c(),r.current=!1,t.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(r.current=!0,p())},cj))},onPointerMove:g=>{const x=t.current;if(!x||x.pointerId!==g.pointerId||r.current)return;const y=g.clientX-x.startX,A=g.clientY-x.startY;Math.hypot(y,A)>uj&&c()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,n.current=!0,a.current!=null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{n.current=!1,a.current=null},600)),c()},onPointerCancel:c,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&c()},onClickCapture:g=>{n.current&&(n.current=!1,a.current!=null&&(window.clearTimeout(a.current),a.current=null),g.preventDefault(),g.stopPropagation())}}),[c])}function Qx({mode:e,activeProgram:t,promptState:r,shellNames:n}){return e!=="tmux"?!1:r==="running"?!0:r==="idle"?!1:t===null||!n.has(t.toLowerCase())}function dj(e,t,r){return!!(e&&t===e&&!r)}const km={ack:"成员确认接手",working:"成员报告进行中",blocked:"成员报告受阻",complete:"成员提交结果",failed:"成员报告失败"};function qu(e){if(e.status==="accepted")return e.completionMode==="reviewed"?"独立评审通过":"已验收";if(e.status==="closed")return"已关闭";if(e.decisions.some(l=>l.status==="pending"))return"需要你回答";if(e.automationIssue)return"需要处理异常";if(e.workflow?.paused)return"自动安排已暂停";const t=e.attempts.find(l=>l.id===e.activeAttemptId),r=e.artifacts.filter(l=>l.kind==="plan"&&l.attemptId===e.activeAttemptId).at(-1);if(r&&r.id!==e.approvedPlanArtifactId)return"需要你确认方案";const n=e.artifacts.filter(l=>l.kind==="result"&&l.attemptId===e.activeAttemptId).at(-1),a=n&&e.events.some(l=>l.kind==="revise"&&l.attemptId===e.activeAttemptId&&l.createdAt>=n.createdAt);if(n&&!a){const l=e.artifacts.filter(c=>c.kind==="review"&&c.reviewsArtifactId===n.id).at(-1);return e.workflow&&l?.verdict!=="pass"?l?.verdict==="changes"?"评审要求修改":"等待独立评审":e.workflow?.kind==="step"?"评审通过 · 等待接续":"等待你验收"}return a?"已要求修改 · 等待新结果":t?t.report?km[t.report.status]:["failed","expired"].includes(t.deliveryStatus??"")?"投递未成功":e.deliveries.some(l=>l.attemptId===e.activeAttemptId&&l.error)?"投递需要关注":t.deliveryStatus==="delivered"?"已写入终端 · 等待回复":"等待投递":e.scheduledAssignee?e.dependsOn.length?"依赖完成后自动分派":"准备独立执行目录":e.dependsOn.length?"等待依赖与分派":"待分派"}function xh(e){return e.status==="open"&&["需要你回答","需要你确认方案","等待你验收","需要处理异常","成员报告受阻","成员报告失败","投递未成功","投递需要关注"].includes(qu(e))}const vu=p0(e=>{let t=!1;return{tasks:[],error:null,refresh:async()=>{if(!t){t=!0;try{const{tasks:r}=await hb();e({tasks:r.filter(xh),error:null})}catch(r){e({error:r instanceof Error?r.message:"协作待处理事项加载失败"})}finally{t=!1}}}}});function Px(e,t){try{localStorage.setItem(`termdock:tasks:${location.origin}:${e}:open-task`,JSON.stringify(t))}catch{}window.dispatchEvent(new CustomEvent("open-collaboration-task",{detail:{groupId:e,taskId:t}}))}function Ox({sessionIds:e}){const t=l8(a=>e.reduce((l,c)=>l+(a.unread[c]?.length??0),0)),{locale:r}=Qr();if(!t)return null;const n=r==="zh"?`${t} 条未读进展`:`${t} unread progress updates`;return i.jsx("span",{title:n,"aria-label":n,className:"inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1 text-[10px] font-medium text-primary",children:t>99?"99+":t})}function hj(e){if(!e.startsWith("remote:"))return null;const t=e.slice(7).split(":");if(t.length!==2)return null;try{const r=decodeURIComponent(t[0]),n=decodeURIComponent(t[1]),a=new URL(r);return!["https:","http:"].includes(a.protocol)||a.origin!==r||!n?null:{origin:r,sessionId:n}}catch{return null}}async function Xy(e){const t=hj(e);if(!t)throw new Error("远端会话标识无效");if(window.termdockDesktop?.collaborationFocus)try{if(await window.termdockDesktop.collaborationFocus(e))return}catch{}window.dispatchEvent(new CustomEvent("termdock:open-remote-session",{detail:t}))}function fj(e,t,r){return Math.max(t,Math.min(e,r))}const ls={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function Fx(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function $x(e,t,r,n=.15){return n===0?fj(e,t,r):e<t?-Fx(t-e,r-t,n)+t:e>r?+Fx(e-r,r-t,n)+r:e}function pj(e,[t,r],[n,a]){const[[l,c],[h,p]]=e;return[$x(t,l,c,n),$x(r,h,p,a)]}function mj(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gj(e){var t=mj(e,"string");return typeof t=="symbol"?t:String(t)}function Rs(e,t,r){return t=gj(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ux(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function gs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ux(Object(r),!0).forEach(function(n){Rs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ux(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const Jy={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function zx(e){return e?e[0].toUpperCase()+e.slice(1):""}const xj=["enter","leave"];function bj(e=!1,t){return e&&!xj.includes(t)}function yj(e,t="",r=!1){const n=Jy[e],a=n&&n[t]||t;return"on"+zx(e)+zx(a)+(bj(r,a)?"Capture":"")}const vj=["gotpointercapture","lostpointercapture"];function wj(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=vj.includes(t)?"capturecapture":"capture",a=!!~t.indexOf(n);return a&&(t=t.replace("capture","")),{device:t,capture:a,passive:r}}function Aj(e,t=""){const r=Jy[e],n=r&&r[t]||t;return e+n}function lf(e){return"touches"in e}function e6(e){return lf(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function Tj(e){return Array.from(e.touches).filter(t=>{var r,n;return t.target===e.currentTarget||((r=e.currentTarget)===null||r===void 0||(n=r.contains)===null||n===void 0?void 0:n.call(r,t.target))})}function Cj(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function t6(e){return lf(e)?Cj(e)[0]:e}function Im(e,t){try{const r=t.clientX-e.clientX,n=t.clientY-e.clientY,a=(t.clientX+e.clientX)/2,l=(t.clientY+e.clientY)/2,c=Math.hypot(r,n);return{angle:-(Math.atan2(r,n)*180)/Math.PI,distance:c,origin:[a,l]}}catch{}return null}function Sj(e){return Tj(e).map(t=>t.identifier)}function Hx(e,t){const[r,n]=Array.from(e.touches).filter(a=>t.includes(a.identifier));return Im(r,n)}function _p(e){const t=t6(e);return lf(e)?t.identifier:t.pointerId}function h0(e){const t=t6(e);return[t.clientX,t.clientY]}const Wx=40,Gx=800;function r6(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return n===1?(t*=Wx,r*=Wx):n===2&&(t*=Gx,r*=Gx),[t,r]}function _j(e){var t,r;const{scrollX:n,scrollY:a,scrollLeft:l,scrollTop:c}=e.currentTarget;return[(t=n??l)!==null&&t!==void 0?t:0,(r=a??c)!==null&&r!==void 0?r:0]}function Lj(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:n,metaKey:a,ctrlKey:l}=e;Object.assign(t,{shiftKey:r,altKey:n,metaKey:a,ctrlKey:l})}return t}function Hh(e,...t){return typeof e=="function"?e(...t):e}function kj(){}function Ij(...e){return e.length===0?kj:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function Vx(e,t){return Object.assign({},t,e||{})}const Ej=32;class n6{constructor(t,r,n){this.ctrl=t,this.args=r,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:r,ingKey:n,args:a}=this;r[n]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=a,t.axis=void 0,t.memo=void 0,t.elapsedTime=t.timeDelta=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const r=this.state,n=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=t.target,r.currentTarget=t.currentTarget,r.lastOffset=n.from?Hh(n.from,r):r.offset,r.offset=r.lastOffset,r.startTime=r.timeStamp=t.timeStamp)}computeValues(t){const r=this.state;r._values=t,r.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:r,config:n,shared:a}=this;r.args=this.args;let l=0;if(t&&(r.event=t,n.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,a.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,a.locked=!!document.pointerLockElement,Object.assign(a,Lj(t)),a.down=a.pressed=a.buttons%2===1||a.touches>0,l=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const Q=r._delta.map(Math.abs);ls.addTo(r._distance,Q)}this.axisIntent&&this.axisIntent(t);const[c,h]=r._movement,[p,g]=n.threshold,{_step:x,values:y}=r;if(n.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(c)>=p&&y[0]),x[1]===!1&&(x[1]=Math.abs(h)>=g&&y[1])):(x[0]===!1&&(x[0]=Math.abs(c)>=p&&Math.sign(c)*p),x[1]===!1&&(x[1]=Math.abs(h)>=g&&Math.sign(h)*g)),r.intentional=x[0]!==!1||x[1]!==!1,!r.intentional)return;const A=[0,0];if(n.hasCustomTransform){const[Q,X]=y;A[0]=x[0]!==!1?Q-x[0]:0,A[1]=x[1]!==!1?X-x[1]:0}else A[0]=x[0]!==!1?c-x[0]:0,A[1]=x[1]!==!1?h-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(A);const w=r.offset,k=r._active&&!r._blocked||r.active;k&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=a[this.ingKey]=r._active,t&&(r.first&&("bounds"in n&&(r._bounds=Hh(n.bounds,r)),this.setup&&this.setup()),r.movement=A,this.computeOffset()));const[E,I]=r.offset,[[M,B],[F,U]]=r._bounds;r.overflow=[E<M?-1:E>B?1:0,I<F?-1:I>U?1:0],r._movementBound[0]=r.overflow[0]?r._movementBound[0]===!1?r._movement[0]:r._movementBound[0]:!1,r._movementBound[1]=r.overflow[1]?r._movementBound[1]===!1?r._movement[1]:r._movementBound[1]:!1;const G=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=pj(r._bounds,r.offset,G),r.delta=ls.sub(r.offset,w),this.computeMovement(),k&&(!r.last||l>Ej)){r.delta=ls.sub(r.offset,w);const Q=r.delta.map(Math.abs);ls.addTo(r.distance,Q),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&l>0&&(r.velocity=[Q[0]/l,Q[1]/l],r.timeDelta=l)}}emit(){const t=this.state,r=this.shared,n=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!n.triggerAllEvents)return;const a=this.handler(gs(gs(gs({},r),t),{},{[this.aliasKey]:t.values}));a!==void 0&&(t.memo=a)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Nj([e,t],r){const n=Math.abs(e),a=Math.abs(t);if(n>a&&n>r)return"x";if(a>n&&a>r)return"y"}class nd extends n6{constructor(...t){super(...t),Rs(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=ls.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ls.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,n=this.config;if(!r.axis&&t){const a=typeof n.axisThreshold=="object"?n.axisThreshold[e6(t)]:n.axisThreshold;r.axis=Nj(r._movement,a)}r._blocked=(n.lockDirection||!!n.axis)&&!r.axis||!!n.axis&&n.axis!==r.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0;break}}}const Rj=e=>e,qx=.15,s6={enabled(e=!0){return e},eventOptions(e,t,r){return gs(gs({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[qx,qx];case!1:return[0,0];default:return ls.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return ls.toVector(e)},transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||Rj},threshold(e){return ls.toVector(e,0)}},Mj=0,Cc=gs(gs({},s6),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=Mj){return e},bounds(e={}){if(typeof e=="function")return l=>Cc.bounds(e(l));if("current"in e)return()=>e.current;if(typeof HTMLElement=="function"&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:r=1/0,top:n=-1/0,bottom:a=1/0}=e;return[[t,r],[n,a]]}}),Yx={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};class Dj extends nd{constructor(...t){super(...t),Rs(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const r=t._bounds.getBoundingClientRect(),n=t.currentTarget.getBoundingClientRect(),a={left:r.left-n.left+t.offset[0],right:r.right-n.right+t.offset[0],top:r.top-n.top+t.offset[1],bottom:r.bottom-n.bottom+t.offset[1]};t._bounds=Cc.bounds(a)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const r=this.config,n=this.state;if(t.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(t.buttons):r.pointerButtons!==-1&&r.pointerButtons!==t.buttons))return;const a=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(a&&a.size>1&&n._pointerActive)&&(this.start(t),this.setupPointer(t),n._pointerId=_p(t),n._pointerActive=!0,this.computeValues(h0(t)),this.computeInitial(),r.preventScrollAxis&&e6(t)!=="mouse"?(n._active=!1,this.setupScrollPrevention(t)):r.delay>0?(this.setupDelayTrigger(t),r.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const r=this.state;r._active=!0,r._preventScroll=!0,r._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const r=this.state,n=this.config;if(!r._pointerActive)return;const a=_p(t);if(r._pointerId!==void 0&&a!==r._pointerId)return;const l=h0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=ls.sub(l,r._values),this.computeValues(l)),ls.addTo(r._movement,r._delta),this.compute(t),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(t);return}if(n.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){r._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(t);return}else return;this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch{}const r=this.state,n=this.config;if(!r._active||!r._pointerActive)return;const a=_p(t);if(r._pointerId!==void 0&&a!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[l,c]=r._distance;if(r.tap=l<=n.tapsThreshold&&c<=n.tapsThreshold,r.tap&&n.filterTaps)r._force=!0;else{const[h,p]=r._delta,[g,x]=r._movement,[y,A]=n.swipe.velocity,[w,k]=n.swipe.distance,E=n.swipe.duration;if(r.elapsedTime<E){const I=Math.abs(h/r.timeDelta),M=Math.abs(p/r.timeDelta);I>y&&Math.abs(g)>w&&(r.swipe[0]=Math.sign(h)),M>A&&Math.abs(x)>k&&(r.swipe[1]=Math.sign(p))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const r=this.config,n=r.device;r.pointerLock&&t.currentTarget.requestPointerLock(),r.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,jj(t);const r=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",r),this.eventStore.add(this.sharedConfig.window,"touch","cancel",r),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(t)},this.config.delay)}keyDown(t){const r=Yx[t.key];if(r){const n=this.state,a=t.shiftKey?10:t.altKey?.1:1;this.start(t),n._delta=r(this.config.keyboardDisplacement,a),n._keyboardActive=!0,ls.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in Yx&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const r=this.config.device;t(r,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(r,"change",this.pointerMove.bind(this)),t(r,"end",this.pointerUp.bind(this)),t(r,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function jj(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const sd=typeof window<"u"&&window.document&&window.document.createElement;function i6(){return sd&&"ontouchstart"in window}function Bj(){return i6()||sd&&window.navigator.maxTouchPoints>1}function Qj(){return sd&&"onpointerdown"in window}function Pj(){return sd&&"exitPointerLock"in window.document}function Oj(){try{return"constructor"in GestureEvent}catch{return!1}}const lo={isBrowser:sd,gesture:Oj(),touch:i6(),touchscreen:Bj(),pointer:Qj(),pointerLock:Pj()},Fj=250,$j=180,Uj=.5,zj=50,Hj=250,Wj=10,Zx={mouse:0,touch:0,pen:8},Gj=gs(gs({},Cc),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:a=!1}={}}){return this.pointerLock=n&&lo.pointerLock,lo.touch&&r?"touch":this.pointerLock?"mouse":lo.pointer&&!a?"pointer":lo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?Fj:void 0,!(!lo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:n=1,keys:a=!0}={}}){return this.pointerButtons=n,this.keys=a,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:n=3,axis:a=void 0}){const l=ls.toVector(e,r?n:a?1:0);return this.filterTaps=r,this.tapsThreshold=n,l},swipe({velocity:e=Uj,distance:t=zj,duration:r=Hj}={}){return{velocity:this.transform(ls.toVector(e)),distance:this.transform(ls.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return $j;case!1:return 0;default:return e}},axisThreshold(e){return e?gs(gs({},Zx),e):Zx},keyboardDisplacement(e=Wj){return e}});function a6(e){const[t,r]=e.overflow,[n,a]=e._delta,[l,c]=e._direction;(t<0&&n>0&&l<0||t>0&&n<0&&l>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&a>0&&c<0||r>0&&a<0&&c>0)&&(e._movement[1]=e._movementBound[1])}const Vj=30,qj=100;class Yj extends n6{constructor(...t){super(...t),Rs(this,"ingKey","pinching"),Rs(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const t=this.state;t._touchIds=[],t.canceled=!1,t.cancel=this.cancel.bind(this),t.turns=0}computeOffset(){const{type:t,movement:r,lastOffset:n}=this.state;t==="wheel"?this.state.offset=ls.add(r,n):this.state.offset=[(1+r[0])*n[0],r[1]+n[1]]}computeMovement(){const{offset:t,lastOffset:r}=this.state;this.state.movement=[t[0]/r[0],t[1]-r[1]]}axisIntent(){const t=this.state,[r,n]=t._movement;if(!t.axis){const a=Math.abs(r)*Vj-Math.abs(n);a<0?t.axis="angle":a>0&&(t.axis="scale")}}restrictToAxis(t){this.config.lockDirection&&(this.state.axis==="scale"?t[1]=0:this.state.axis==="angle"&&(t[0]=0))}cancel(){const t=this.state;t.canceled||setTimeout(()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()},0)}touchStart(t){this.ctrl.setEventIds(t);const r=this.state,n=this.ctrl.touchIds;if(r._active&&r._touchIds.every(l=>n.has(l))||n.size<2)return;this.start(t),r._touchIds=Array.from(n).slice(0,2);const a=Hx(t,r._touchIds);a&&this.pinchStart(t,a)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const r=this.state,n=r._pointerEvents,a=this.ctrl.pointerIds;if(r._active&&Array.from(n.keys()).every(c=>a.has(c))||(n.size<2&&n.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const l=Im(...Array.from(n.values()));l&&this.pinchStart(t,l)}pinchStart(t,r){const n=this.state;n.origin=r.origin,this.computeValues([r.distance,r.angle]),this.computeInitial(),this.compute(t),this.emit()}touchMove(t){if(!this.state._active)return;const r=Hx(t,this.state._touchIds);r&&this.pinchMove(t,r)}pointerMove(t){const r=this.state._pointerEvents;if(r.has(t.pointerId)&&r.set(t.pointerId,t),!this.state._active)return;const n=Im(...Array.from(r.values()));n&&this.pinchMove(t,n)}pinchMove(t,r){const n=this.state,a=n._values[1],l=r.angle-a;let c=0;Math.abs(l)>270&&(c+=Math.sign(l)),this.computeValues([r.distance,r.angle-360*c]),n.origin=r.origin,n.turns=c,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(t),this.emit()}touchEnd(t){this.ctrl.setEventIds(t),this.state._active&&this.state._touchIds.some(r=>!this.ctrl.touchIds.has(r))&&(this.state._active=!1,this.compute(t),this.emit())}pointerEnd(t){const r=this.state;this.ctrl.setEventIds(t);try{t.target.releasePointerCapture(t.pointerId)}catch{}r._pointerEvents.has(t.pointerId)&&r._pointerEvents.delete(t.pointerId),r._active&&r._pointerEvents.size<2&&(r._active=!1,this.compute(t),this.emit())}gestureStart(t){t.cancelable&&t.preventDefault();const r=this.state;r._active||(this.start(t),this.computeValues([t.scale,t.rotation]),r.origin=[t.clientX,t.clientY],this.compute(t),this.emit())}gestureMove(t){if(t.cancelable&&t.preventDefault(),!this.state._active)return;const r=this.state;this.computeValues([t.scale,t.rotation]),r.origin=[t.clientX,t.clientY];const n=r._movement;r._movement=[t.scale-1,t.rotation],r._delta=ls.sub(r._movement,n),this.compute(t),this.emit()}gestureEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}wheel(t){const r=this.config.modifierKey;r&&(Array.isArray(r)?!r.find(n=>t[n]):!t[r])||(this.state._active?this.wheelChange(t):this.wheelStart(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(t){this.start(t),this.wheelChange(t)}wheelChange(t){"uv"in t||t.cancelable&&t.preventDefault();const n=this.state;n._delta=[-r6(t)[1]/qj*n.offset[0],0],ls.addTo(n._movement,n._delta),a6(n),this.state.origin=[t.clientX,t.clientY],this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){const r=this.config.device;r&&(t(r,"start",this[r+"Start"].bind(this)),t(r,"change",this[r+"Move"].bind(this)),t(r,"end",this[r+"End"].bind(this)),t(r,"cancel",this[r+"End"].bind(this)),t("lostPointerCapture","",this[r+"End"].bind(this))),this.config.pinchOnWheel&&t("wheel","",this.wheel.bind(this),{passive:!1})}}const Zj=gs(gs({},s6),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!lo.touch&&lo.gesture)return"gesture";if(lo.touch&&n)return"touch";if(lo.touchscreen){if(lo.pointer)return"pointer";if(lo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const a=c=>{const h=Vx(Hh(r,c),{min:-1/0,max:1/0});return[h.min,h.max]},l=c=>{const h=Vx(Hh(n,c),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof n!="function"?[a(),l()]:c=>[a(c),l(c)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",ls.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class Kj extends nd{constructor(...t){super(...t),Rs(this,"ingKey","moving")}move(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.state._active?this.moveChange(t):this.moveStart(t),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(t){this.start(t),this.computeValues(h0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=h0(t),n=this.state;n._delta=ls.sub(r,n._values),ls.addTo(n._movement,n._delta),this.computeValues(r),this.compute(t),this.emit()}moveEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}bind(t){t("pointer","change",this.move.bind(this)),t("pointer","leave",this.moveEnd.bind(this))}}const Xj=gs(gs({},Cc),{},{mouseOnly:(e=!0)=>e});class Jj extends nd{constructor(...t){super(...t),Rs(this,"ingKey","scrolling")}scroll(t){this.state._active||this.start(t),this.scrollChange(t),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(t){t.cancelable&&t.preventDefault();const r=this.state,n=_j(t);r._delta=ls.sub(n,r._values),ls.addTo(r._movement,r._delta),this.computeValues(n),this.compute(t),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("scroll","",this.scroll.bind(this))}}const eB=Cc;class tB extends nd{constructor(...t){super(...t),Rs(this,"ingKey","wheeling")}wheel(t){this.state._active||this.start(t),this.wheelChange(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(t){const r=this.state;r._delta=r6(t),ls.addTo(r._movement,r._delta),a6(r),this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("wheel","",this.wheel.bind(this))}}const rB=Cc;class nB extends nd{constructor(...t){super(...t),Rs(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(h0(t)),this.compute(t),this.emit())}leave(t){if(this.config.mouseOnly&&t.pointerType!=="mouse")return;const r=this.state;if(!r._active)return;r._active=!1;const n=h0(t);r._movement=r._delta=ls.sub(n,r._values),this.computeValues(n),this.compute(t),r.delta=r.movement,this.emit()}bind(t){t("pointer","enter",this.enter.bind(this)),t("pointer","leave",this.leave.bind(this))}}const sB=gs(gs({},Cc),{},{mouseOnly:(e=!0)=>e}),S1=new Map,Em=new Map;function o6(e){S1.set(e.key,e.engine),Em.set(e.key,e.resolver)}const l6={key:"drag",engine:Dj,resolver:Gj},iB={key:"hover",engine:nB,resolver:sB},aB={key:"move",engine:Kj,resolver:Xj},oB={key:"pinch",engine:Yj,resolver:Zj},lB={key:"scroll",engine:Jj,resolver:eB},cB={key:"wheel",engine:tB,resolver:rB};function uB(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,l;for(l=0;l<n.length;l++)a=n[l],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function dB(e,t){if(e==null)return{};var r=uB(e,t),n,a;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const hB={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=lo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},fB=["target","eventOptions","window","enabled","transform"];function bh(e={},t){const r={};for(const[n,a]of Object.entries(t))switch(typeof a){case"function":r[n]=a.call(r,e[n],n,e);break;case"object":r[n]=bh(e[n],a);break;case"boolean":a&&(r[n]=e[n]);break}return r}function pB(e,t,r={}){const n=e,{target:a,eventOptions:l,window:c,enabled:h,transform:p}=n,g=dB(n,fB);if(r.shared=bh({target:a,eventOptions:l,window:c,enabled:h,transform:p},hB),t){const x=Em.get(t);r[t]=bh(gs({shared:r.shared},g),x)}else for(const x in g){const y=Em.get(x);y&&(r[x]=bh(gs({shared:r.shared},g[x]),y))}return r}class c6{constructor(t,r){Rs(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,n,a,l){const c=this._listeners,h=Aj(r,n),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=gs(gs({},p),l);t.addEventListener(h,a,g);const x=()=>{t.removeEventListener(h,a,g),c.delete(x)};return c.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class mB{constructor(){Rs(this,"_timeouts",new Map)}add(t,r,n=140,...a){this.remove(t),this._timeouts.set(t,window.setTimeout(r,n,...a))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class gB{constructor(t){Rs(this,"gestures",new Set),Rs(this,"_targetEventStore",new c6(this)),Rs(this,"gestureEventStores",{}),Rs(this,"gestureTimeoutStores",{}),Rs(this,"handlers",{}),Rs(this,"config",{}),Rs(this,"pointerIds",new Set),Rs(this,"touchIds",new Set),Rs(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),xB(this,t)}setEventIds(t){if(lf(t))return this.touchIds=new Set(Sj(t)),this.touchIds;if("pointerId"in t)return t.type==="pointerup"||t.type==="pointercancel"?this.pointerIds.delete(t.pointerId):t.type==="pointerdown"&&this.pointerIds.add(t.pointerId),this.pointerIds}applyHandlers(t,r){this.handlers=t,this.nativeHandlers=r}applyConfig(t,r){this.config=pB(t,r,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const r=this.config.shared,n={};let a;if(!(r.target&&(a=r.target(),!a))){if(r.enabled){for(const c of this.gestures){const h=this.config[c],p=Kx(n,h.eventOptions,!!a);if(h.enabled){const g=S1.get(c);new g(this,t,c).bind(p)}}const l=Kx(n,r.eventOptions,!!a);for(const c in this.nativeHandlers)l(c,"",h=>this.nativeHandlers[c](gs(gs({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const l in n)n[l]=Ij(...n[l]);if(!a)return n;for(const l in n){const{device:c,capture:h,passive:p}=wj(l);this._targetEventStore.add(a,c,"",n[l],{capture:h,passive:p})}}}}function $c(e,t){e.gestures.add(t),e.gestureEventStores[t]=new c6(e,t),e.gestureTimeoutStores[t]=new mB}function xB(e,t){t.drag&&$c(e,"drag"),t.wheel&&$c(e,"wheel"),t.scroll&&$c(e,"scroll"),t.move&&$c(e,"move"),t.pinch&&$c(e,"pinch"),t.hover&&$c(e,"hover")}const Kx=(e,t,r)=>(n,a,l,c={},h=!1)=>{var p,g;const x=(p=c.capture)!==null&&p!==void 0?p:t.capture,y=(g=c.passive)!==null&&g!==void 0?g:t.passive;let A=h?n:yj(n,a,x);r&&y&&(A+="Passive"),e[A]=e[A]||[],e[A].push(l)},bB=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function yB(e){const t={},r={},n=new Set;for(let a in e)bB.test(a)?(n.add(RegExp.lastMatch),r[a]=e[a]):t[a]=e[a];return[r,t,n]}function Uc(e,t,r,n,a,l){if(!e.has(r)||!S1.has(n))return;const c=r+"Start",h=r+"End",p=g=>{let x;return g.first&&c in t&&t[c](g),r in t&&(x=t[r](g)),g.last&&h in t&&t[h](g),x};a[n]=p,l[n]=l[n]||{}}function vB(e,t){const[r,n,a]=yB(e),l={};return Uc(a,r,"onDrag","drag",l,t),Uc(a,r,"onWheel","wheel",l,t),Uc(a,r,"onScroll","scroll",l,t),Uc(a,r,"onPinch","pinch",l,t),Uc(a,r,"onMove","move",l,t),Uc(a,r,"onHover","hover",l,t),{handlers:l,config:t,nativeHandlers:n}}function u6(e,t={},r,n){const a=C.useMemo(()=>new gB(e),[]);if(a.applyHandlers(e,n),a.applyConfig(t,r),C.useEffect(a.effect.bind(a)),C.useEffect(()=>a.clean.bind(a),[]),t.target===void 0)return a.bind.bind(a)}function Xx(e,t){return o6(l6),u6({drag:e},t||{},"drag")}function wB(e){return e.forEach(o6),function(r,n){const{handlers:a,nativeHandlers:l,config:c}=vB(r,n||{});return u6(a,c,void 0,l)}}function TF(e,t){return wB([l6,oB,lB,cB,aB,iB])(e,t||{})}const Jx={dampingRatio:.8,response:.3},AB=.998;function TB(e,t,r,n){const a=2*Math.PI/Math.max(e.response,.001),l=t-n,c=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const w=l,k=c+a*l;return{value:E=>n+(w+k*E)*Math.exp(-a*E),velocity:E=>(k-a*(w+k*E))*Math.exp(-a*E)}}if(h<1){const w=a*Math.sqrt(1-h*h),k=l,E=(c+h*a*l)/w;return{value:I=>n+Math.exp(-h*a*I)*(k*Math.cos(w*I)+E*Math.sin(w*I)),velocity:I=>Math.exp(-h*a*I)*((E*w-h*a*k)*Math.cos(w*I)-(k*w+h*a*E)*Math.sin(w*I))}}const p=a*Math.sqrt(h*h-1),g=-h*a+p,x=-h*a-p,y=(c-x*l)/(g-x),A=l-y;return{value:w=>n+y*Math.exp(g*w)+A*Math.exp(x*w),velocity:w=>y*g*Math.exp(g*w)+A*x*Math.exp(x*w)}}function CB(e,t=AB){return e/1e3*(t/(1-t))}function e5(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function SB(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const _B=.1,LB=5;function kB(e,t,r,n,a){const l=TB(e,t,r,n),c=1e3/60,h=240,p=[];for(let g=0;g<h;g++){const x=g*c/1e3,y=l.value(x),A=l.velocity(x);if(p.push(a?a(y):y),g>0&&Math.abs(y-n)<_B&&Math.abs(A)<LB)break}return p.push(a?a(n):n),{frames:p,durationMs:(p.length-1)*c,solver:l}}const IB='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function EB(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(IB)&&e.blur()}const NB=18,t5=8,r5={touch:t5,pen:t5},RB=500,Lp=200,n5=50,MB=`[${zw}]`;function kp(e,t,r){return Math.min(r,Math.max(t,e))}function s5(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.pointerType=="string"?t.pointerType==="touch"||t.pointerType==="pen":typeof t.type=="string"&&t.type.startsWith("touch")}function i5(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(MB)}function nu(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const d6=C.forwardRef(function({side:t,isOpen:r,drawerWidthPx:n,onClose:a,onOpen:l,children:c,pinned:h=!1},p){const{t:g}=Qr(),x=t==="left",y=x?-n:n,A=b.useRef(null),w=b.useRef(null),k=b.useRef(r?0:y),E=b.useRef(null),I=b.useRef(null),M=b.useRef(0),B=b.useRef(null),F=b.useRef(null),U=b.useRef(!1),G=b.useRef(null),Q=b.useRef(!1),X=b.useRef([]),ee=b.useRef(null),ze=b.useRef(k.current),he=b.useRef(r?1:0),de=b.useRef(r);de.current=r;const $e=b.useRef(y);$e.current=y;const qe=b.useRef(n);qe.current=n;const oe=b.useRef(x);oe.current=x;const Re=b.useRef(a);Re.current=a;const K=b.useRef(l);K.current=l;const we=b.useCallback(me=>{A.current=me,typeof p=="function"?p(me):p&&(p.current=me)},[p]),Z=b.useCallback(()=>{I.current!==null&&(window.cancelAnimationFrame(I.current),I.current=null),E.current=null},[]),Ue=b.useCallback(me=>{const je=qe.current;return oe.current?(me+je)/je:(je-me)/je},[]),Le=b.useCallback(me=>{const je=w.current;je&&(je.style.opacity=String(kp(Ue(me),0,1)))},[Ue]),Y=b.useCallback(me=>{k.current=me;const je=A.current;je&&(je.style.transform=`translateX(${me}px)`,Le(me))},[Le]),Ee=b.useCallback(me=>{E.current=me,I.current===null&&(I.current=window.requestAnimationFrame(()=>{I.current=null;const je=E.current;E.current=null,je!==null&&Y(je)}))},[Y]),be=b.useCallback(()=>{I.current!==null&&(window.cancelAnimationFrame(I.current),I.current=null);const me=E.current;E.current=null,me!==null&&Y(me)},[Y]),Me=b.useCallback(me=>{const je=$e.current;return kp(me,Math.min(0,je),Math.max(0,je))},[]),Ze=b.useCallback(()=>{const me=B.current;if(!me)return null;B.current=null;const je=(performance.now()-me.startTime)/1e3,mt={value:me.solver.value(je),velocity:me.solver.velocity(je)};return me.animations.forEach(ae=>ae.cancel()),mt},[]),Se=b.useCallback(()=>{F.current!==null&&(window.clearTimeout(F.current),F.current=null)},[]),se=b.useCallback(()=>{ee.current?.(),ee.current=null},[]),Ye=b.useCallback(()=>{be(),Se();const me=Ze();me&&Y(Me(me.value));const je=A.current,mt=w.current;je?.getAnimations().forEach(ae=>ae.cancel()),je&&(je.style.transition="none",je.style.opacity="1"),mt?.getAnimations().forEach(ae=>ae.cancel()),mt&&(mt.style.transition="none")},[Y,Se,Me,be,Ze]),pt=b.useCallback((me,je)=>{be(),Se();const mt=A.current,ae=w.current,De=me?0:$e.current;ae&&(ae.style.pointerEvents=me?"auto":"none");const gt=Ze(),ft=gt?Me(gt.value):k.current,kt=je?.velocity??gt?.velocity??0;if(SB())return k.current=De,mt&&(mt.style.transition=`opacity ${Lp}ms ease`,mt.style.opacity=me?"1":"0",mt.style.transform=`translateX(${De}px)`),ae&&(ae.style.transition=`opacity ${Lp}ms ease`,ae.style.opacity=me?"1":"0"),Lp;mt&&(mt.style.transition="none",mt.style.opacity="1"),ae&&(ae.style.transition="none");const Dt=Math.abs(je?.velocity??0)>RB,{frames:Yt,durationMs:xr,solver:rr}=kB({dampingRatio:Dt?Jx.dampingRatio:1,response:Jx.response},ft,kt,De,Me);if(!mt||Math.abs(ft-De)<.5&&Math.abs(kt)<5)return Y(De),0;const Ir=mt.animate(Yt.map(Ne=>({transform:`translateX(${Ne}px)`})),{duration:xr,easing:"linear",fill:"forwards"}),ne=[Ir];return ae&&ne.push(ae.animate(Yt.map(Ne=>({opacity:String(kp(Ue(Ne),0,1))})),{duration:xr,easing:"linear",fill:"forwards"})),B.current={solver:rr,startTime:performance.now(),target:De,animations:ne},nu("spring start",{startX:ft,startVelocity:kt,targetX:De,frames:Yt.length,durationMs:xr}),Ir.onfinish=()=>{const Ne=B.current;!Ne||!Ne.animations.includes(Ir)||(B.current=null,Y(De),Ne.animations.forEach(tt=>tt.cancel()),nu("spring finish",{targetX:De}))},xr},[Y,Se,Me,be,Ue,Ze]),rt=b.useCallback(me=>{be();const je=me,mt=0,ae=$e.current,De=k.current+CB(je),gt=Math.abs(De-mt)<=Math.abs(De-ae);nu("decideSnap",{velocity:je,currentX:k.current,projected:De,shouldOpen:gt});const ft=pt(gt,{velocity:je});return gt&&!de.current?F.current=window.setTimeout(()=>{F.current=null,K.current?.()},ft+n5):!gt&&de.current&&(F.current=window.setTimeout(()=>{F.current=null,Re.current()},ft+n5)),gt},[pt,be]),ye=b.useCallback(me=>{const je=$e.current,mt=Math.min(0,je),ae=Math.max(0,je),De=qe.current;return me<mt?mt-e5(mt-me,De):me>ae?ae+e5(me-ae,De):me},[]),et=b.useCallback(me=>{const je=X.current,mt=performance.now();je.push({t:mt,x:me});const ae=mt-120;for(;je.length>0&&je[0].t<ae;)je.shift()},[]),ht=b.useCallback(()=>{const me=X.current;if(me.length<2)return 0;const je=me[me.length-1];if(performance.now()-je.t>60)return 0;const mt=me[0],ae=(je.t-mt.t)/1e3;return ae<.016?0:(je.x-mt.x)/ae},[]);b.useEffect(()=>{Se();const me=B.current,je=r?0:$e.current;me&&me.target===je||pt(r)},[r,pt,Se]),b.useEffect(()=>{Ye(),Ee(de.current?0:y)},[y,Ye,Ee]),b.useEffect(()=>()=>{Z(),Se(),Ze(),se()},[Se,Z,se,Ze]);const te=Xx(({active:me,cancel:je,first:mt,last:ae,movement:[De],event:gt})=>{if(nu("bindPanel",{active:me,first:mt,last:ae,mx:De}),!s5(gt)){je();return}if(mt){if(se(),U.current=!1,G.current=null,X.current=[],i5(gt)){je();return}const ft=A.current,kt=ft?Hw(gt.target,ft):null;if(!kt||Ww()){je();return}const Dt=Gw(kt,De,oe.current?-1:1);if(nu("arbitrate",{owner:Dt.kind,mx:De}),Dt.kind==="swiper"){ee.current=Vw(Dt.instance),je();return}if(Dt.kind==="scroller"){const Yt=qw(Dt.element);if(Yt)G.current=Yt;else{je();return}}G.current||(U.current=!0,Ye(),M.current=k.current)}if(!me){G.current=null,U.current&&(U.current=!1,rt(ht()));return}if(G.current){Yw(G.current,De);return}if(U.current){const ft=ye(M.current+De);et(ft),Ee(ft)}},{axis:"x",axisThreshold:r5,filterTaps:!0,pointer:{touch:!0}}),ve=Xx(({active:me,cancel:je,first:mt,movement:[ae],event:De})=>{if(!s5(De)){je();return}if(de.current){je();return}if(mt&&(Q.current=!0,X.current=[],Ye(),M.current=k.current),!me){Q.current&&(Q.current=!1,rt(ht())&&EB());return}if(Q.current){const gt=ye(M.current+ae);et(gt),Ee(gt)}},{axis:"x",axisThreshold:r5,filterTaps:!0,pointer:{touch:!0}}),ct=b.useCallback(me=>{me.preventDefault(),me.stopPropagation(),de.current||K.current?.()},[]);if(h)return i.jsx("aside",{ref:we,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:c});const re=te();return i.jsxs(i.Fragment,{children:[i.jsx("div",{...ve(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:NB,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:ct,"aria-label":g(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),i.jsx("div",{ref:w,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:he.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:a,"aria-label":g("sidebar.closeSidebar")}),i.jsx("aside",{...re,onClickCapture:me=>{i5(me)||re.onClickCapture?.(me)},ref:we,"data-sidebar":t,className:`fixed inset-y-0 z-sidebar-panel flex flex-col chrome-glow-panel will-change-transform ${x?"border-r border-border":"border-l border-border/15"}`,style:{...x?{left:0}:{right:0},width:n,maxWidth:x?"94vw":"95vw",transform:`translateX(${ze.current}px)`,transition:"none",touchAction:"pan-y",pointerEvents:r?"auto":"none",paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))",...x?{paddingLeft:"var(--safe-left-inset, env(safe-area-inset-left, 0px))"}:{paddingRight:"var(--safe-right-inset, env(safe-area-inset-right, 0px))"}},children:c})]})}),DB={activeKey:"root",items:[]},jB=()=>()=>{},BB=()=>DB;function QB(e){const t=Ko(),r=b.useSyncExternalStore(t?.subscribe??jB,t?.snapshot??BB),n=c8(),a=r.items.map(l=>l.key===n?{...l,reviewCount:e}:l).filter(l=>l.reviewCount>0);return{host:t,groups:a,currentKey:n,active:!t||r.activeKey===n,total:t?e+a.reduce((l,c)=>l+(c.key===n?0:c.reviewCount),0):e,hasOtherAttention:a.some(l=>l.key!==n)}}function PB({groups:e,currentKey:t,onClose:r}){const{t:n}=Qr(),a=b.useId(),l=b.useRef(null),c=b.useRef(null),h=b.useRef(r);h.current=r;const p=b.useRef(!0),[g,x]=b.useState(""),y=e.reduce((k,E)=>k+E.reviewCount,0);b.useEffect(()=>{const k=document.activeElement;c.current?.focus({preventScroll:!0});const E=I=>{if(I.key==="Escape"&&(I.preventDefault(),I.stopImmediatePropagation(),h.current()),I.key!=="Tab")return;const M=Array.from(l.current?.querySelectorAll("button:not(:disabled)")??[]),B=M[0],F=M[M.length-1],U=!l.current?.contains(document.activeElement);I.shiftKey&&(document.activeElement===B||U)?(I.preventDefault(),F?.focus()):!I.shiftKey&&(document.activeElement===F||U)&&(I.preventDefault(),B?.focus())};return document.addEventListener("keydown",E,!0),()=>{document.removeEventListener("keydown",E,!0),p.current&&k?.isConnected&&!k.closest("[inert]")&&k.focus({preventScroll:!0})}},[]);const A=(k,E)=>{const I=Ko(),M=I?.snapshot().items.find(F=>F.key===k.key);if(!M?.reviewCount||E&&!M.attentionSessions?.some(F=>F.id===E)){x(n("serviceAttention.changed"));return}p.current=!1;let B=!1;E&&k.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:E})),B=!0):E&&M.service?.targetPeerId?B=I?.focusSession(M.service.targetPeerId,E)??!1:M.service&&(B=I?.activate(M.service,!0)??!1),B?r():(p.current=!0,x(n("serviceAttention.unavailable")))},w=k=>k.phase==="offline"?n("serviceAttention.offline"):k.phase==="login"?n("serviceAttention.login"):k.phase==="connecting"||k.phase==="reconnecting"?n("connection.reconnecting"):null;return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button","aria-label":n("common.close"),tabIndex:-1,className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)]",onClick:r}),i.jsx("div",{className:"pointer-events-none fixed inset-0 z-modal-panel flex items-end justify-center p-3 sm:items-center sm:p-6",style:{paddingTop:"max(12px, var(--safe-top-inset, env(safe-area-inset-top, 0px)))",paddingBottom:"max(12px, var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px)))"},children:i.jsxs("section",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":a,"data-sidebar-gesture-ignore":!0,onKeyDown:k=>k.stopPropagation(),className:"pointer-events-auto flex max-h-full w-full max-w-md flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-xl",children:[i.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[i.jsx(Wl,{size:20,className:"shrink-0 text-[color:var(--warning)]","aria-hidden":"true"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{id:a,className:"text-sm font-semibold",children:n("serviceAttention.title")}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:n("serviceAttention.summary",{services:e.length,count:y})})]}),i.jsx("button",{ref:c,type:"button","aria-label":n("common.close"),onClick:r,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl text-muted-foreground hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:i.jsx(Kn,{size:18})})]}),i.jsxs("div",{className:"min-h-0 overflow-y-auto overscroll-contain p-2",children:[e.length===0&&i.jsx("p",{role:"status",className:"px-4 py-8 text-center text-sm text-muted-foreground",children:n("serviceAttention.empty")}),e.map(k=>i.jsxs("section",{className:"mb-2 last:mb-0",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-1 pt-2 text-xs",children:[i.jsx("h3",{className:"min-w-0 flex-1 truncate font-medium",title:k.service?.label,children:k.service?.label||n("serviceAttention.currentService")}),k.key===t&&i.jsx("span",{className:"shrink-0 text-muted-foreground",children:n("agent.currentSession")}),i.jsx("span",{className:"shrink-0 tabular-nums text-[color:var(--warning)]",children:k.reviewCount})]}),w(k)&&i.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:w(k)}),k.attentionSessions?.length?k.attentionSessions.map(E=>i.jsxs("button",{type:"button",onClick:()=>A(k,E.id),className:"flex min-h-14 w-full items-center gap-3 rounded-xl px-3 py-2 text-left hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"line-clamp-2 break-words text-sm",title:E.label,children:E.label}),i.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:E.waiting?n("serviceAttention.waiting"):n("agent.needsReview")})]}),i.jsx(yc,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},E.id)):i.jsx("button",{type:"button",onClick:()=>A(k),className:"min-h-11 w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:n("serviceAttention.viewService")})]},k.key))]}),i.jsxs("footer",{className:"shrink-0 border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[g&&i.jsx("p",{role:"alert",className:"mb-1 text-[color:var(--warning)]",children:g}),n("serviceAttention.scope")]})]})})]})}function OB(e){const t=e.icon&&e.isPlugin?`/api/terminal/agent-plugin-icon/${encodeURIComponent(e.slug)}${e.iconVersion?`?v=${Math.floor(e.iconVersion)}`:""}`:void 0,[r,n]=b.useState();if(b.useEffect(()=>{if(n(void 0),!t)return;const a=new AbortController;let l;return fetch(t,{signal:a.signal}).then(async c=>{if(!c.ok)throw new Error(`Icon request failed: ${c.status}`);const h=await c.blob();a.signal.aborted||(l=URL.createObjectURL(h),n({endpoint:t,src:l}))}).catch(()=>{}),()=>{a.abort(),l&&URL.revokeObjectURL(l)}},[t]),!!e.icon)return e.isPlugin?r?.endpoint===t?r?.src:void 0:`/icons/agents/${e.icon}.svg`}function FB(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function $B(e,t,r,n="next"){if(e.length===0)return null;const a=t?e.findIndex(l=>l.sessionId===t):-1;for(let l=1;l<=e.length;l+=1){const c=n==="next"?l:-l,h=(a+c+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function UB(e,t,r="next"){return $B(e,t,FB,r)}const Da=42,Wh=20,zB=10;function Nm(e,t,r){return Math.min(r,Math.max(t,e))}function cf(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),n=Math.max(0,e.safeBottom??0),a=Math.max(0,e.safeLeft??0),l=Math.max(0,e.bottomClearance??72),c=a+Wh,h=Math.max(c,e.width-r-Wh-Da),p=Math.max(t+12,52),g=Math.max(p,e.height-n-l-Da);return{minX:c,maxX:h,minY:p,maxY:g}}function a5(e,t){const r=cf(e),n=Nm(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*n}}function xc(e,t){const r=cf(e);return{x:Nm(t.x,r.minX,r.maxX),y:Nm(t.y,r.minY,r.maxY)}}function o5(e,t){const r=cf(e),n=xc(e,t),a=(r.minX+r.maxX+Da)/2,l=n.x+Da/2<a?"left":"right",c=r.maxY-r.minY;return{position:{x:l==="left"?r.minX:r.maxX,y:n.y},preference:{side:l,yRatio:c>0?(n.y-r.minY)/c:0}}}function l5(e,t,r){const n=xc(e,t),a=Da+zB,l=g=>Math.abs(g.x-r.x)<a&&Math.abs(g.y-r.y)<a;if(!l(n))return n;const c=[{...n,y:r.y-a},{...n,y:r.y+a}].map(g=>xc(e,g)).filter(g=>!l(g)).sort((g,x)=>Math.abs(g.y-n.y)-Math.abs(x.y-n.y));if(c[0])return c[0];const h=cf(e);return[{...n,x:h.minX},{...n,x:h.maxX}].map(g=>xc(e,g)).filter(g=>!l(g)).sort((g,x)=>Math.abs(g.x-n.x)-Math.abs(x.x-n.x))[0]??n}const Ip="var(--warning)",HB="var(--success)",c5="var(--tmux)",u5="termdock:mobile-attention-position:v1",d5="termdock:running-session-position:v1",WB={side:"right",yRatio:.68},GB={side:"right",yRatio:.54};function h5(e,t){if(typeof window>"u")return t;try{const r=JSON.parse(window.localStorage.getItem(e)??"null");if(r&&(r.side==="left"||r.side==="right")&&typeof r.yRatio=="number"&&Number.isFinite(r.yRatio))return{side:r.side,yRatio:Math.min(1,Math.max(0,r.yRatio))}}catch{}return t}function VB(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Hd(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e));return Number.isFinite(t)?Math.max(0,t):0}function qB(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const n=window.visualViewport,a=n?.width??window.innerWidth,l=n?.height??window.innerHeight,c=t?.getBoundingClientRect(),h=!!(c&&c.width>0&&c.height>0);return{width:a,height:l,safeTop:Math.max(Hd("--safe-top-inset"),(h?Math.max(0,c.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(Hd("--safe-right-inset"),(h?Math.max(0,a-c.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(Hd("--safe-bottom-inset"),(h?Math.max(0,l-c.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(Hd("--safe-left-inset"),(h?Math.max(0,c.left):0)+Math.max(0,r.left??0)),bottomClearance:e?Wh:72}}function h6(){const e=Kr.getState(),t=Array.from(e.sessions.values()),r=UB(t,e.activeSessionId);if(!r)return;const n=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;n?.agentNeedsReview&&e.clearAgentNeedsReview(n.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:r}))}function f5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function f6(e){switch(e){case"success":return"var(--success)";case"warning":return"var(--warning)";case"danger":return"var(--destructive)";case"info":case"accent":return"var(--accent)";default:return"var(--muted-foreground)"}}function YB({indicator:e,tone:t,size:r}){const n=f6(t);switch(e){case"spinner":return i.jsx(Nn,{size:r,className:"shrink-0 animate-spin",style:{color:n}});case"question":return i.jsx(Sh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:n}});case"badge":return i.jsx(Wl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:n}});case"terminal":return i.jsx(Ro,{size:r,className:"shrink-0",style:{color:n}});case"pulse":return i.jsx(v9,{size:r,className:"shrink-0 animate-pulse",style:{color:n}});case"ring":return i.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:n}});case"dot":return i.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:n}})}}function bc({agent:e,size:t=12}){const r=t-4,n=OB(e);return n?e.iconMode==="native"?i.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:i.jsx("img",{src:n,alt:e.displayName,style:{width:r,height:r}})}):i.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:i.jsx("span",{className:"block bg-white",style:{width:r,height:r,WebkitMask:`url(${n}) center / contain no-repeat`,mask:`url(${n}) center / contain no-repeat`}})}):i.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:i.jsx(Ku,{size:r,className:"text-white"})})}function ZB({sessionMode:e,state:t,size:r=11}){const n=t?.agent?i.jsx(bc,{agent:t.agent,size:r+1}):e==="tmux"?i.jsx(a0,{size:r,className:"shrink-0"}):i.jsx(Ro,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?i.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:i.jsx(YB,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?i.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:i.jsx(Nn,{size:r,className:"shrink-0 animate-spin",style:{color:HB}})}):t?.agentStatus==="waiting"?i.jsx("span",{title:t.agentMessage??void 0,children:i.jsx(Sh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:Ip}})}):t?.agentStatus==="done"&&t.agentNeedsReview?i.jsx("span",{title:t.agentMessage??void 0,children:i.jsx(Wl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Ip}})}):t?.agentNeedsReview?i.jsx("span",{title:t.agentMessage??void 0,children:i.jsx(Wl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Ip}})}):t?.inCopyMode?e==="tmux"?i.jsx(a0,{size:r,className:"shrink-0 animate-pulse",style:{color:c5}}):i.jsx(Ro,{size:r,className:"shrink-0 animate-pulse",style:{color:c5}}):n}function KB({status:e,detail:t,needsReview:r,inCopyMode:n}){const{t:a}=Qr();return t&&!r?i.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface animate-pulse",style:{backgroundColor:f6(t.tone)},title:t.label}):e==="working"?i.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--success)] ring-2 ring-surface shadow-[0_0_6px_rgb(var(--success-rgb)_/_0.50)] animate-pulse",title:a("agent.aiRunning")}):e==="waiting"||r?i.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:a(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?i.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:a("agent.finishedReview")}):n?i.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-[2px] bg-[var(--tmux)] ring-2 ring-surface",title:a("agent.copyMode")}):null}function p6({count:e,tone:t,title:r}){const{t:n}=Qr();if(e<=0)return null;const a=t==="running"?"inline-flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.12)] px-1.5 py-0.5 text-[10px] font-medium text-[color:var(--success)]":"inline-flex min-h-6 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-0.5 text-[10px] font-semibold text-[color:var(--warning)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.24)] transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)] active:scale-[0.97]",l=t==="running"?"h-1.5 w-1.5 rounded-full bg-[var(--success)] animate-pulse":"h-1.5 w-1.5 rounded-full bg-[var(--warning)] animate-pulse";if(t==="review"){const c=r??n("agent.jumpToNext");return i.jsxs("button",{type:"button",className:a,title:`${c} · ${n("agent.jumpToNext")}`,"aria-label":`${c}: ${e}. ${n("agent.jumpToNext")}`,onClick:h6,children:[i.jsx(Wl,{size:11,className:"shrink-0"}),i.jsx("span",{children:n("agent.needsReview")}),i.jsx("span",{className:"tabular-nums",children:e})]})}return i.jsxs("span",{className:a,title:r,children:[i.jsx("span",{className:l}),e]})}function XB({runningCount:e,reviewCount:t,className:r=""}){const n=[];return e>0&&n.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&n.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),n.length===0?null:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${n.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:n.map(a=>i.jsx("span",{className:`flex h-3 min-w-3 items-center justify-center rounded-full px-0.5 text-[7px] font-bold leading-3 shadow-sm ring-1 ring-background ${a.className}`,children:a.count>9?"9+":a.count},a.key))})}const JB=380,p5=10,Wd=10,Ep=52,eQ=104;function tQ(e,t,r){const n=Math.max(0,t.safeLeft??0),a=t.width-Math.max(0,t.safeRight??0),l=Math.max(0,t.safeTop??0),c=t.height-Math.max(0,t.safeBottom??0),h=Wh,p=e.x+Da/2>=n+(a-n)/2,g=p?e.x-Wd-n-h:a-h-e.x-Da-Wd,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*eQ))),y=p?e.x-Wd-x:e.x+Da+Wd,A=Math.min(Math.max(y,n+h),Math.max(n+h,a-h-x)),w=e.y+Da/2-Ep/2,k=Math.min(Math.max(w,l+h),Math.max(l+h,c-h-Ep));return{left:A,top:k,width:x,height:Ep,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function m5(e,t,r,n){return t<e.left||t>e.left+e.width||r<e.top-14||r>e.top+e.height+14?null:Math.min(n-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function rQ(e,t){if(e.length===0)return null;const r=t?e.findIndex(n=>n.id===t):-1;return e[(r+1)%e.length]?.id??null}function nQ({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:n,attentionButtonEnabled:a=!0,isDesktopLayout:l,containerElement:c,occlusionInsets:h}){const{t:p}=Qr(),g=Zt(te=>te.leftOpen),x=Zt(te=>te.rightOpen),{isOpen:y}=I3({enabled:!l}),A=l||!g&&!x&&!y,w=QB(e),[k,E]=C.useState(!1);C.useEffect(()=>{(!w.active||!A)&&E(!1)},[w.active,A]);const I=a&&w.total>0&&A,M=t.length>1||t.length===1&&t[0]?.id!==r,B=n&&t.length>0&&M&&A,F=Math.max(0,h?.top??0),U=Math.max(0,h?.right??0),G=Math.max(0,h?.bottom??0),Q=Math.max(0,h?.left??0),X=C.useCallback(()=>qB(l,c,{top:F,right:U,bottom:G,left:Q}),[c,l,G,Q,U,F]),ee=C.useRef({attention:h5(u5,WB),running:h5(d5,GB)}),ze=C.useCallback(()=>{const te=X(),ve=a5(te,ee.current.attention),ct=a5(te,ee.current.running);return{attention:ve,running:I&&B?l5(te,ct,ve):ct}},[I,X,B]),[he,de]=C.useState(()=>ze()),$e=C.useRef(he);$e.current=he;const[qe,oe]=C.useState(null),Re=C.useRef(null),[K,we]=C.useState("idle"),[Z,Ue]=C.useState(null),Le=C.useRef(null),Y=C.useRef({attention:!1,running:!1});C.useEffect(()=>()=>{const te=Le.current?.longPressTimer;te!=null&&window.clearTimeout(te)},[]),C.useEffect(()=>{if(B)return;const te=Le.current?.longPressTimer;te!=null&&window.clearTimeout(te),Le.current=null,we("idle"),Ue(null)},[B]),C.useLayoutEffect(()=>{const te=()=>{const ct=ze();$e.current=ct,de(ct)};te(),window.addEventListener("resize",te),window.addEventListener("orientationchange",te),window.visualViewport?.addEventListener("resize",te);const ve=typeof ResizeObserver>"u"?null:new ResizeObserver(te);return c&&ve?.observe(c),()=>{window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),window.visualViewport?.removeEventListener("resize",te),ve?.disconnect()}},[c,ze]);const Ee=C.useCallback(te=>te==="attention"?B:I,[I,B]),be=C.useCallback((te,ve)=>{if(!Ee(te))return ve;const ct=te==="attention"?"running":"attention";return l5(X(),ve,$e.current[ct])},[X,Ee]),Me=C.useCallback((te,ve,ct,re)=>{const me=X(),je=ve.moved?xc(me,{x:ve.startX+(ct-ve.originX),y:ve.startY+(re-ve.originY)}):$e.current[te],mt=o5(me,je),ae=be(te,mt.position),De=o5(me,ae);ee.current[te]=De.preference,VB(te==="attention"?u5:d5,De.preference);const gt={...$e.current,[te]:De.position};$e.current=gt,de(gt)},[be,X]),Ze=C.useCallback(te=>{Y.current[te]=!0,window.setTimeout(()=>{Y.current[te]=!1},0)},[]),Se=C.useCallback(te=>{const ve=Re.current;!ve||ve.kind!=="attention"||ve.pointerId!==te.pointerId||(Re.current=null,oe(null),Me("attention",ve,te.clientX,te.clientY),ve.moved&&Ze("attention"))},[Me,Ze]),se={onPointerDown:te=>{te.stopPropagation(),te.currentTarget.setPointerCapture(te.pointerId),Re.current={kind:"attention",pointerId:te.pointerId,originX:te.clientX,originY:te.clientY,startX:he.attention.x,startY:he.attention.y,moved:!1}},onPointerMove:te=>{const ve=Re.current;if(!ve||ve.kind!=="attention"||ve.pointerId!==te.pointerId)return;const ct=te.clientX-ve.originX,re=te.clientY-ve.originY;if(!ve.moved&&Math.hypot(ct,re)<5)return;ve.moved=!0,oe("attention");const me=X(),je=be("attention",xc(me,{x:ve.startX+ct,y:ve.startY+re})),mt={...$e.current,attention:je};$e.current=mt,de(mt)},onPointerUp:Se,onPointerCancel:Se},Ye=c?tQ(he.running,X(),t.length):null,pt=te=>{te.longPressTimer!==null&&(window.clearTimeout(te.longPressTimer),te.longPressTimer=null)},rt={onPointerDown:te=>{te.stopPropagation(),te.currentTarget.setPointerCapture(te.pointerId);const ve=te.pointerId,ct={pointerId:ve,originX:te.clientX,originY:te.clientY,startX:he.running.x,startY:he.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};ct.longPressTimer=window.setTimeout(()=>{const re=Le.current;!re||re.pointerId!==ve||re.mode!=="pressing"||(re.longPressTimer=null,re.mode="dragging",Y.current.running=!0,we("dragging"))},JB),Le.current=ct,we("pressing"),Ue(null)},onPointerMove:te=>{const ve=Le.current;if(!ve||ve.pointerId!==te.pointerId)return;const ct=te.clientX-ve.originX,re=te.clientY-ve.originY;if(ve.mode==="pressing")if(Math.abs(ct)>=p5&&Math.abs(ct)>=Math.abs(re))pt(ve),ve.mode="selecting",Y.current.running=!0,we("selecting");else if(Math.hypot(ct,re)>=p5){pt(ve),ve.mode="cancelled",Y.current.running=!0,we("idle");return}else return;if(ve.mode==="selecting"){const ae=Ye?m5(Ye,te.clientX,te.clientY,t.length):null;ve.selectedIndex=ae,Ue(ae);return}if(ve.mode!=="dragging"||!ve.moved&&Math.hypot(ct,re)<5)return;ve.moved=!0;const me=X(),je=be("running",xc(me,{x:ve.startX+ct,y:ve.startY+re})),mt={...$e.current,running:je};$e.current=mt,de(mt)},onPointerUp:te=>{const ve=Le.current;if(!ve||ve.pointerId!==te.pointerId)return;pt(ve);const ct=ve.mode;if(ct==="selecting"){const re=Ye?m5(Ye,te.clientX,te.clientY,t.length):ve.selectedIndex,me=re===null?null:t[re]?.id;me&&f5(me)}else ct==="dragging"&&Me("running",ve,te.clientX,te.clientY);Le.current=null,we("idle"),Ue(null),ct!=="pressing"&&Ze("running")},onPointerCancel:te=>{const ve=Le.current;!ve||ve.pointerId!==te.pointerId||(pt(ve),Le.current=null,we("idle"),Ue(null),Ze("running"))}},ye=(te,ve)=>i.jsx("span",{className:`pointer-events-none absolute -right-1 -top-1 z-10 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-surface px-1 text-[9px] font-bold tabular-nums ring-2 ring-[var(--chrome-bg)] ${ve==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:te>9?"9+":te}),et=()=>{const te=w.hasOtherAttention?p("serviceAttention.title"):p("agent.jumpToNext"),ve=he.attention,ct=qe==="attention";return i.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...se,onClick:re=>{re.stopPropagation(),!Y.current.attention&&(w.hasOtherAttention?E(!0):h6())},className:`fixed z-chrome-hint inline-flex items-center justify-center rounded-full bg-[var(--warning)] text-[color:var(--warning-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.35)] animate-fade-in ${ct?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{display:k?"none":void 0,left:ve.x,top:ve.y,width:Da,height:Da,touchAction:"none"},"aria-label":`${te}: ${w.total}`,"aria-haspopup":w.hasOtherAttention?"dialog":void 0,title:te,children:[i.jsx(Wl,{size:17,className:"shrink-0"}),ye(w.total,"attention")]},"attention")},ht=()=>{const te=t.length,ve=he.running,ct=K==="selecting",re=K==="dragging";return i.jsxs(C.Fragment,{children:[i.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":K,...rt,onClick:me=>{if(me.stopPropagation(),Y.current.running)return;const je=rQ(t,r);je&&f5(je)},className:`fixed z-chrome-hint inline-flex select-none items-center justify-center rounded-full bg-[var(--success)] text-[color:var(--success-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--success-rgb)_/_0.35)] animate-fade-in ${re?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":ct?"cursor-ew-resize scale-[1.04] ring-2 ring-[rgb(var(--success-rgb)_/_0.55)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{left:ve.x,top:ve.y,width:Da,height:Da,touchAction:"none"},"aria-label":`${p("agent.jumpToNextRunning")}: ${te}`,title:p("agent.runningSessionGestureHint"),children:[i.jsx(Nn,{size:18,className:"shrink-0 animate-spin"}),ye(te,"running")]}),ct&&Ye&&i.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Ye.side,"aria-label":p("agent.selectRunningSession"),className:"pointer-events-none fixed z-popover flex overflow-hidden rounded-full border border-border/15 bg-surface/95 p-1 shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",style:{left:Ye.left,top:Ye.top,width:Ye.width,height:Ye.height},children:t.map((me,je)=>{const mt=je===Z,ae=me.id===r,De=`${me.label}${me.detail?` · ${me.detail}`:""}${ae?` · ${p("agent.currentSession")}`:""}`;return i.jsxs("div",{role:"option","aria-selected":mt,"data-running-session-option":me.id,"data-selected":mt?"true":"false",title:De,className:`relative flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-full px-2 transition-[background-color,color,transform] duration-100 ${mt?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":ae?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[i.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${mt?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:je+1}),i.jsx("span",{className:"truncate text-[10px] font-medium",children:me.label})]},me.id)})})]},"running")};return!I&&!B&&!k||c===null||typeof document>"u"?null:i.jsxs(u8,{children:[I&&et(),B&&!k&&ht(),k&&w.active&&A&&i.jsx(PB,{groups:w.groups,currentKey:w.currentKey,onClose:()=>E(!1)})]})}function sQ(){const{t:e}=Qr();return i.jsxs("div",{role:"status",className:"td-loading-skeleton overflow-hidden px-3 py-2",children:[i.jsx("span",{className:"sr-only",children:e("common.loading")}),i.jsx("div",{"aria-hidden":"true",children:["w-2/5","w-3/5","w-1/3","w-1/2","w-2/5","w-1/3"].map((t,r)=>i.jsxs("div",{className:"flex h-8 items-center gap-2",style:{paddingLeft:r>1&&r<5?20:0},children:[i.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),i.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},r))})]})}const iQ=new Set([".ts",".tsx",".js",".jsx",".py",".rs",".go",".java",".c",".cpp",".h",".rb",".php",".swift",".kt",".sh",".css",".scss",".html",".json",".yaml",".yml",".toml",".md"]),g5=120,x5=120,aQ=new Set,oQ=[],lQ={added:{label:"A",className:"text-[color:var(--diff-insert-strong)]",title:"Added"},modified:{label:"M",className:"text-[color:var(--diff-hunk-accent)]",title:"Modified"},deleted:{label:"D",className:"text-[color:var(--diff-delete-strong)]",title:"Deleted"},renamed:{label:"R",className:"text-muted-foreground",title:"Renamed"},copied:{label:"C",className:"text-[color:var(--diff-insert-strong)]",title:"Copied"},untracked:{label:"U",className:"text-[color:var(--diff-insert-strong)]",title:"Untracked (new file)"},conflicted:{label:"!",className:"text-destructive",title:"Conflicted"},unknown:{label:"?",className:"text-muted-foreground",title:"Unknown"}};function _1(e,t){if(t==="directory")return null;if(f8(e))return i.jsx(u9,{size:14});if(p8(e))return i.jsx(Nb,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return iQ.has(r)?i.jsx(P9,{size:14}):i.jsx(Tb,{size:14})}function m6({path:e}){const r=Zt(a=>a.changedFiles.get(e))?.status;if(!r)return null;const n=lQ[r]??{label:"?",className:"text-muted-foreground",title:r};return i.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${n.className}`,title:n.title,children:n.label})}function f0(e){return e?"ml-1 w-6 opacity-100":"ml-1 w-6 opacity-100 sm:ml-0 sm:w-0 sm:overflow-hidden sm:opacity-0 sm:group-hover:ml-1 sm:group-hover:w-6 sm:group-hover:opacity-100"}function L1(e){return f0(e)}const cQ=b.memo(function({path:t}){const{t:r}=Qr(),[n,a]=b.useState("idle"),[l,c]=b.useState(null),h=b.useCallback(async p=>{if(p.stopPropagation(),n!=="pending"){a("pending"),c(null);try{await fb(t),a("idle")}catch(g){a("error"),c(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,n,r]);return i.jsx("span",{role:"button",tabIndex:-1,onClick:p=>{h(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${f0(n==="pending")} ${n==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:n==="error"?l??r("rightSidebar.downloadFailed"):r("rightSidebar.downloadFile"),children:n==="pending"?i.jsx(Nn,{size:12,className:"animate-spin"}):i.jsx(Mu,{size:12})})});function g6(){const{t:e}=Qr(),[t,r]=b.useState({status:"idle"}),n=b.useCallback(async a=>{r({status:"pending"});try{await fb(a),r({status:"idle"})}catch(l){r({status:"error",message:l instanceof Error?l.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:n}}function Rm(e){return e instanceof DOMException&&e.name==="AbortError"}function Gh(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function x6(e){return e.button===2||e.ctrlKey}const uQ=176,dQ=160,su=8;function b5(e,t,r,n){const a=window.visualViewport,l=a?.offsetLeft??0,c=a?.offsetTop??0,h=l+(a?.width??window.innerWidth),p=c+(a?.height??window.innerHeight),g=l+su,x=c+su,y=Math.max(g,h-r-su),A=Math.max(x,p-n-su),w=t+n<=p-su?t:t-n;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),y),top:Math.min(Math.max(w,x),A)}}function b6(e){const[t,r]=b.useState(null),n=b.useRef(null),a=b.useCallback((l,c)=>{r(b5(l,c,uQ,dQ))},[]);return b.useLayoutEffect(()=>{if(!e||!t||!n.current)return;const l=n.current.getBoundingClientRect();if(l.width<=0||l.height<=0)return;const c=b5(t.anchorX,t.anchorY,l.width,l.height);c.left===t.left&&c.top===t.top||r(c)},[e,t]),{position:t,menuRef:n,openAt:a,clearPosition:()=>r(null)}}function y6(e,t){return t&&typeof document<"u"?Ai.createPortal(e,document.body):e}function hQ(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function k1(e,t,r){if(!t||hQ(e,t))return!0;const n=r.get(e.path);return n?n.some(a=>k1(a,t,r)):!1}function Mm(e){return e.map(t=>({name:t.name,path:t.path,type:t.type,isSymlink:t.isSymlink,modified:t.modified,expanded:!1,loaded:!1,children:t.type==="directory"?[]:void 0}))}function Dm(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const fQ=b.memo(function e({node:t,depth:r,onFileSelect:n,directoriesOnly:a=!1,onPathReference:l,getReferenceText:c,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:y,onDirectoryPinToggle:A,onFilePinToggle:w,onOpenInFileBrowser:k,canOpenInFileBrowser:E,pinnedPaths:I,selectedFilePath:M,queryLower:B,onDirectoryDropFiles:F,onFileDeleteRequest:U,deletingFilePath:G,revealedDirectoryPath:Q,gitIgnoreRoot:X}){const{t:ee}=Qr(),ze=Zt(Ge=>Ge.expandedPaths.has(t.path)),he=Zt(Ge=>Ge.directoryCache.get(t.path)),de=Zt(Ge=>Ge.showHiddenFiles),$e=Zt(Ge=>Ge.toggleExpanded),qe=Zt(Ge=>Ge.setDirectoryCache),oe=Zt(Ge=>Ge.fileSortModes[t.path]??"name"),Re=Zt(Ge=>Ge.setDirectorySortMode),[K,we]=b.useState(!1),[Z,Ue]=b.useState(!1),{position:Le,menuRef:Y,openAt:Ee,clearPosition:be}=b6(Z),[Me,Ze]=b.useState(!1),Se=b.useRef(0),se=b.useRef(null),Ye=b.useRef(null),pt=t.path===M||t.path===Q,rt=t.type==="directory"&&(ze||!!B),ye=t.type==="directory",et=I.has(t.path),ht=!ye&&!!w,te=!!(E&&k),ve=`path:${t.path}`,ct=p===ve,re=g===ve,me=c?.(t.path)??t.path,je=$m(h),{state:mt,run:ae}=g6(),De=G===t.path,gt=ye&&!a&&!!(x||y||A||te),ft=b.useMemo(()=>{if(!he)return;if(!B)return he;const Ge=Zt.getState().directoryCache;return he.filter(It=>(!a||It.type==="directory")&&k1(It,B,Ge))},[he,a,B]),kt=b.useCallback(async()=>{if(!Zt.getState().directoryCache.has(t.path)&&!K){const It=`file-tree:${t.path}`;se.current?.abort(),Vp(It);const cn=new AbortController;se.current=cn,we(!0);try{const Lt=await Fm(t.path,cn.signal,de,"expand_directory",It,oe,X);if(cn.signal.aborted)return;const Vr=Mm(Lt.entries);qe(t.path,Vr)}catch(Lt){Rm(Lt)}finally{se.current===cn&&(se.current=null),we(!1)}}},[t.path,K,qe,de,oe,X]),Dt=b.useCallback(async()=>{if(t.type!=="directory"){n(t.path);return}if(a&&x){x(t.path);return}const Ge=!Zt.getState().expandedPaths.has(t.path);$e(t.path),Ge&&await kt()},[a,t.path,t.type,kt,x,$e,n]);b.useEffect(()=>{t.type==="directory"&&ze&&!he&&!K&&kt()},[he,ze,kt,K,t.type]);const Yt=b.useCallback(Ge=>{Ge.stopPropagation(),l?.(t.path,ve)},[l,t.path,ve]),xr=b.useCallback(Ge=>{Ge.stopPropagation(),x?.(t.path),Ue(!1)},[t.path,x]),rr=b.useCallback(Ge=>{Ge.stopPropagation(),y?.(t.path),Ue(!1)},[t.path,y]),Ir=b.useCallback(Ge=>{Ge.stopPropagation(),A?.(t.path),Ue(!1)},[t.path,A]),ne=b.useCallback(Ge=>{Ge.stopPropagation(),Re(t.path,oe==="modified"?"name":"modified"),Ue(!1)},[t.path,Re,oe]),Ne=b.useCallback(Ge=>{Ge.stopPropagation(),w?.(t.path),Ue(!1)},[t.path,w]),tt=b.useCallback(Ge=>{Ge.stopPropagation(),Ue(!1),ae(t.path)},[t.path,ae]),jt=b.useCallback(Ge=>{Ge.stopPropagation(),Ue(!1),U(t)},[t,U]),Et=b.useCallback(Ge=>{Ge.stopPropagation(),k?.(t.path),Ue(!1)},[t.path,k]),dr=b.useCallback(Ge=>{!ye||!F||!Ge.dataTransfer.types.includes("Files")||(Ge.preventDefault(),Ge.stopPropagation(),Se.current+=1,Ze(!0))},[ye,F]),Jt=b.useCallback(Ge=>{!ye||!F||!Ge.dataTransfer.types.includes("Files")||(Ge.preventDefault(),Ge.stopPropagation(),Ge.dataTransfer.dropEffect="copy",Ze(!0))},[ye,F]),We=b.useCallback(Ge=>{!ye||!F||(Ge.preventDefault(),Ge.stopPropagation(),Se.current-=1,Se.current<=0&&(Se.current=0,Ze(!1)))},[ye,F]),Lr=b.useCallback(Ge=>{if(!ye||!F)return;Ge.preventDefault(),Ge.stopPropagation(),Se.current=0,Ze(!1);const It=Array.from(Ge.dataTransfer.files);It.length>0&&F(t.path,It)},[ye,t.path,F]),Xe=b.useCallback(Ge=>{Ge.stopPropagation(),be(),Ue(It=>!It)},[be]),Pt=b.useCallback(Ge=>{!gt||!x6(Ge)||(Ge.preventDefault(),Ge.stopPropagation(),Ee(Ge.clientX,Ge.clientY),Ue(!0))},[gt,Ee]);return b.useEffect(()=>{if(!Z)return;const Ge=cn=>{const Lt=cn.target;Lt instanceof Node&&(Ye.current?.contains(Lt)||Y.current?.contains(Lt))||Ue(!1)},It=cn=>{cn.key==="Escape"&&Ue(!1)};return document.addEventListener("pointerdown",Ge),document.addEventListener("keydown",It),()=>{document.removeEventListener("pointerdown",Ge),document.removeEventListener("keydown",It)}},[Z,Y]),b.useEffect(()=>()=>{se.current?.abort()},[]),i.jsxs("div",{style:!rt&&!Z?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[i.jsxs("div",{ref:Ye,className:"relative",children:[je.popoverNode,i.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":oe,role:"button",tabIndex:0,onClick:()=>{Gh()||Dt()},onContextMenu:Pt,onKeyDown:Ge=>{Ge.key!=="Enter"&&Ge.key!==" "||(Ge.preventDefault(),Dt())},onDragEnter:dr,onDragOver:Jt,onDragLeave:We,onDrop:Lr,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${Me?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":pt?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[r>0&&i.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:`${r*14-4}px`}}),Me&&i.jsx("span",{className:"pointer-events-none absolute right-2 top-1/2 z-10 -translate-y-1/2 rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold text-primary-foreground shadow-md",children:ee("fileTree.dropToUploadHere")}),t.type==="directory"?i.jsxs(i.Fragment,{children:[rt?i.jsx(Jo,{size:14,className:"shrink-0 text-muted-foreground/80"}):i.jsx(yc,{size:14,className:"shrink-0 text-muted-foreground/80"}),rt?i.jsx(Jc,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):i.jsx(vc,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-[14px] shrink-0"}),i.jsx("span",{className:pt?"text-primary":"text-muted-foreground/80",children:_1(t.name,t.type)})]}),i.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${pt?"font-medium":""}`,children:[t.name,oe==="modified"&&i.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:ee("fileTree.sortedByModified"),"aria-label":ee("fileTree.sortedByModified"),children:i.jsx(Ru,{size:11})}),t.isSymlink&&i.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:ee("fileTree.symbolicLink"),children:i.jsx(i0,{size:11})})]}),i.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${pt?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:Ge=>Ge.stopPropagation(),onKeyDown:Ge=>Ge.stopPropagation(),children:[K&&i.jsx(Nn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),i.jsx(m6,{path:t.path}),gt&&i.jsx("span",{onClick:Xe,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${f0(Z)} ${Z?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:ee("fileTree.moreDirActions"),children:i.jsx(wl,{size:13})}),!ye&&i.jsx("span",{onClick:Xe,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${f0(Z||mt.status==="pending"||De||et)} ${Z?"bg-surface-elevated text-foreground":et?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:mt.status==="error"?mt.message??ee("rightSidebar.downloadFailed"):ee("fileTree.moreFileActions"),children:mt.status==="pending"||De?i.jsx(Nn,{size:13,className:"animate-spin"}):i.jsx(wl,{size:13})}),l&&i.jsx("span",{onClick:Yt,...je(me,ve),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${L1(ct||re)} ${ct||re?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":ee(re?"rightSidebar.copied":ct?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:ee(re?"rightSidebar.copied":ct?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:re||ct?i.jsx(Mi,{size:12}):i.jsx(i0,{size:12})}),gt&&Z&&y6(i.jsxs("div",{ref:Y,className:`${Le?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:Le?{left:Le.left,top:Le.top}:void 0,children:[te&&i.jsxs("button",{type:"button",onClick:Et,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:ee("fileTree.openInFileBrowserTitle"),children:[i.jsx(Jc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee("fileTree.openInFileBrowser")})]}),x&&i.jsxs("button",{type:"button",onClick:xr,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:ee("fileTree.openDirRootTitle"),children:[i.jsx(Jc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee("fileTree.openDirRoot")})]}),y&&i.jsxs("button",{type:"button",onClick:rr,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:ee("fileTree.searchFromDirTitle"),children:[i.jsx(Um,{size:13,className:"shrink-0 text-primary"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee("fileTree.searchFromDir")})]}),A&&i.jsxs("button",{type:"button",onClick:Ir,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${et?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:ee(et?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[et?i.jsx(ju,{size:13,className:"shrink-0"}):i.jsx(Du,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee(et?"fileTree.unpinDir":"fileTree.pinDir")})]}),i.jsxs("button",{type:"button",onClick:ne,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[oe==="modified"?i.jsx(n9,{size:13,className:"shrink-0"}):i.jsx(Ru,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee(oe==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!Le),!ye&&Z&&i.jsxs("div",{className:"absolute right-2 top-[calc(100%+2px)] z-30 w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[te&&i.jsxs("button",{type:"button",onClick:Et,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:ee("fileTree.openInFileBrowserTitle"),children:[i.jsx(Tb,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee("fileTree.openInFileBrowser")})]}),i.jsxs("button",{type:"button",onClick:tt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:ee("rightSidebar.downloadFile"),children:[i.jsx(Mu,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee("rightSidebar.downloadFile")})]}),ht&&i.jsxs("button",{type:"button",onClick:Ne,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${et?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:ee(et?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[et?i.jsx(ju,{size:13,className:"shrink-0"}):i.jsx(Du,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee(et?"fileTree.unpinFile":"fileTree.pinFile")})]}),i.jsxs("button",{type:"button",onClick:jt,disabled:De,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:ee("fileTree.deleteFile"),children:[De?i.jsx(Nn,{size:13,className:"shrink-0 animate-spin"}):i.jsx(ni,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee("fileTree.deleteFile")})]})]})]})]})]}),rt&&ft&&ft.length>0&&i.jsx("div",{className:r===0?"mt-0.5":"",children:ft.map(Ge=>i.jsx(e,{node:Ge,depth:r+1,onFileSelect:n,directoriesOnly:a,onPathReference:l,getReferenceText:c,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:y,onDirectoryPinToggle:A,onFilePinToggle:w,onOpenInFileBrowser:k,canOpenInFileBrowser:E,pinnedPaths:I,selectedFilePath:M,queryLower:B,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:F,onFileDeleteRequest:U,deletingFilePath:G,gitIgnoreRoot:X,revealedDirectoryPath:Q},Ge.path))})]})}),pQ=b.memo(function({node:t,rootPath:r,onFileSelect:n,onPathReference:a,getReferenceText:l,onReferenceCopied:c,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:y,onFilePinToggle:A,pinnedPaths:w,selectedFilePath:k,onFileDeleteRequest:E,deletingFilePath:I}){const{t:M}=Qr(),B=t.path===k,F=t.type==="directory",U=w.has(t.path),G=!F&&!!A,Q=`path:${t.path}`,X=h===Q,ee=p===Q,ze=l?.(t.path)??t.path,he=$m(c),{state:de,run:$e}=g6(),[qe,oe]=b.useState(!1),{position:Re,menuRef:K,openAt:we,clearPosition:Z}=b6(qe),Ue=b.useRef(null),Le=I===t.path,Y=F&&!!(g||x||y),Ee=b.useCallback(()=>{Gh()||(t.type==="directory"?g?.(t.path):n(t.path))},[t.path,t.type,g,n]),be=b.useCallback(rt=>{rt.stopPropagation(),a?.(t.path,Q)},[a,t.path,Q]),Me=b.useCallback(rt=>{rt.stopPropagation(),y?.(t.path),oe(!1)},[t.path,y]),Ze=b.useCallback(rt=>{rt.stopPropagation(),A?.(t.path),oe(!1)},[t.path,A]),Se=b.useCallback(rt=>{rt.stopPropagation(),oe(!1),$e(t.path)},[t.path,$e]),se=b.useCallback(rt=>{rt.stopPropagation(),oe(!1),E(t)},[t,E]),Ye=b.useCallback(rt=>{rt.stopPropagation(),Z(),oe(ye=>!ye)},[Z]),pt=b.useCallback(rt=>{!Y||!x6(rt)||(rt.preventDefault(),rt.stopPropagation(),we(rt.clientX,rt.clientY),oe(!0))},[Y,we]);return b.useEffect(()=>{if(!qe)return;const rt=et=>{const ht=et.target;ht instanceof Node&&(Ue.current?.contains(ht)||K.current?.contains(ht))||oe(!1)},ye=et=>{et.key==="Escape"&&oe(!1)};return document.addEventListener("pointerdown",rt),document.addEventListener("keydown",ye),()=>{document.removeEventListener("pointerdown",rt),document.removeEventListener("keydown",ye)}},[qe,K]),i.jsxs("div",{ref:Ue,className:"relative border-b border-border/10 last:border-b-0",children:[he.popoverNode,i.jsxs("div",{role:"button",tabIndex:0,onClick:Ee,onContextMenu:pt,onKeyDown:rt=>{rt.key!=="Enter"&&rt.key!==" "||(rt.preventDefault(),Ee())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${B?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-[14px] shrink-0"}),i.jsx(vc,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-[14px] shrink-0"}),i.jsx("span",{className:B?"text-primary":"text-muted-foreground/80",children:_1(t.name,t.type)})]}),i.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[i.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${B?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&i.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:M("fileTree.symbolicLink"),children:i.jsx(i0,{size:11})})]}),i.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:Dm(r,t.path)})]}),i.jsx(m6,{path:t.path}),t.type==="directory"&&(y||x)&&i.jsx("span",{onClick:Ye,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${f0(qe)} ${qe?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:M("fileTree.moreDirActions"),children:i.jsx(wl,{size:13})}),!F&&i.jsx("span",{onClick:Ye,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${f0(qe||de.status==="pending"||Le||U)} ${qe?"bg-surface-elevated text-foreground":U?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:de.status==="error"?de.message??M("rightSidebar.downloadFailed"):M("fileTree.moreFileActions"),children:de.status==="pending"||Le?i.jsx(Nn,{size:13,className:"animate-spin"}):i.jsx(wl,{size:13})}),a&&i.jsx("span",{onClick:be,...he(ze,Q),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${L1(X||ee)} ${X||ee?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":M(ee?"rightSidebar.copied":X?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:M(ee?"rightSidebar.copied":X?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:ee||X?i.jsx(Mi,{size:12}):i.jsx(i0,{size:12})})]}),Y&&qe&&y6(i.jsxs("div",{ref:K,className:`${Re?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:Re?{left:Re.left,top:Re.top}:void 0,children:[g&&i.jsxs("button",{type:"button",onClick:rt=>{rt.stopPropagation(),g(t.path),oe(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("fileTree.openDirRootTitle"),children:[i.jsx(Jc,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.openDirRoot")})]}),x&&i.jsxs("button",{type:"button",onClick:rt=>{rt.stopPropagation(),x(t.path),oe(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[i.jsx(Um,{size:13,className:"shrink-0 text-primary"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.searchFromDir")})]}),y&&i.jsxs("button",{type:"button",onClick:Me,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${U?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(U?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[U?i.jsx(ju,{size:13,className:"shrink-0"}):i.jsx(Du,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(U?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!Re),!F&&qe&&i.jsxs("div",{className:"absolute right-2 top-[calc(100%+2px)] z-30 w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[i.jsxs("button",{type:"button",onClick:Se,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("rightSidebar.downloadFile"),children:[i.jsx(Mu,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("rightSidebar.downloadFile")})]}),G&&i.jsxs("button",{type:"button",onClick:Ze,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${U?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(U?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[U?i.jsx(ju,{size:13,className:"shrink-0"}):i.jsx(Du,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(U?"fileTree.unpinFile":"fileTree.pinFile")})]}),i.jsxs("button",{type:"button",onClick:se,disabled:Le,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:M("fileTree.deleteFile"),children:[Le?i.jsx(Nn,{size:13,className:"shrink-0 animate-spin"}):i.jsx(ni,{size:13,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.deleteFile")})]})]})]})}),mQ=60,y5=60,gQ=20;function v5({count:e,loading:t,engine:r,limited:n,scope:a,content:l}){const{t:c}=Qr();return i.jsxs("div",{className:"sticky top-0 z-10 -mx-2 -mt-2 mb-2 border-b border-border/15 bg-surface/95 px-3 py-2.5 backdrop-blur",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[i.jsx(Um,{size:14,className:"shrink-0 text-primary"}),i.jsx("span",{children:l?c("fileTree.contentMatchesCount",{count:e}):c("fileTree.searchResults",{count:e})})]}),r&&i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[9px] uppercase tracking-[0.12em] text-muted-foreground",children:[t&&i.jsx(Nn,{size:9,className:"animate-spin"}),r,n?" · limited":""]})]}),i.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"shrink-0",children:c("fileTree.searchScope")}),i.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:a,children:a}),t&&i.jsx("span",{className:"ml-auto shrink-0",children:c("fileTree.searching")})]})]})}function xQ(e,t){if(!t)return e;const r=e.toLowerCase(),n=t.toLowerCase(),a=[];let l=0,c=r.indexOf(n,l),h=0;for(;c>=0&&n;)c>l&&a.push(e.slice(l,c)),a.push(i.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(c,c+n.length)},`m-${h++}`)),l=c+n.length,c=r.indexOf(n,l);return l<e.length&&a.push(e.slice(l)),a.length>0?a:e}const bQ=b.memo(function({entry:t,rootPath:r,selectedFilePath:n,query:a,onContentMatchSelect:l,onPathReference:c,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:y}=Qr(),[A,w]=b.useState(!0),k=t.path===n,E=A?t.matches.slice(0,gQ):[],I=t.matches.length-E.length,M=`path:${t.path}`,B=g===M,F=x===M,U=h?.(t.path)??t.path,G=$m(p);return i.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[G.popoverNode,i.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Gh()||w(Q=>!Q)},onKeyDown:Q=>{Q.key!=="Enter"&&Q.key!==" "||(Q.preventDefault(),w(X=>!X))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${k?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[A?i.jsx(Jo,{size:14,className:"shrink-0 text-muted-foreground/80"}):i.jsx(yc,{size:14,className:"shrink-0 text-muted-foreground/80"}),i.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:_1(t.name,"file")}),i.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[i.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),i.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:Dm(r,t.path)})]}),i.jsx("span",{className:"shrink-0 select-none rounded-full bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:t.matches.length}),i.jsx(cQ,{path:t.path}),c&&i.jsx("span",{onClick:Q=>{Q.stopPropagation(),c(t.path,M)},...G(U,M),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${L1(B||F)} ${B||F?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":y(F?"rightSidebar.copied":B?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:y(F?"rightSidebar.copied":B?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:F||B?i.jsx(Mi,{size:12}):i.jsx(i0,{size:12})})]}),A&&i.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[E.map((Q,X)=>i.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Gh()||l?.(t.path,Q.line)},onKeyDown:ee=>{ee.key!=="Enter"&&ee.key!==" "||(ee.preventDefault(),l?.(t.path,Q.line))},className:"flex w-full cursor-pointer items-start gap-2 rounded px-2 py-1 text-left font-mono text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",title:`${Dm(r,t.path)}:${Q.line}`,children:[i.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:Q.line}),i.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:xQ(Q.text,a)})]},`${Q.line}-${X}`)),I>0&&i.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:y("fileTree.moreMatches",{count:I})})]})]})});function yQ({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:n,getReferenceText:a,onReferenceCopied:l,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:y,onOpenInFileBrowser:A,canOpenInFileBrowser:w=!1,pinnedPaths:k=aQ,selectedFilePath:E,query:I="",searchRootPath:M,searchOptions:B={},searchMode:F="name",onContentMatchSelect:U,onDirectoryDropFiles:G,revealDirectory:Q}){const{t:X}=Qr(),ee=Zt(ne=>e?ne.directoryCache.get(e):void 0),ze=Zt(ne=>ne.setDirectoryCache),he=Zt(ne=>ne.showHiddenFiles),de=Zt(ne=>ne.fileSortModesHydrated),$e=Zt(ne=>ne.fileSortModes[e]??"name"),qe=Zt(ne=>ne.hydrateFileSortModes),oe=Zt(ne=>ne.hydrateHideGitIgnoredRoots),Re=Zt(ne=>!!ne.hideGitIgnoredRoots[e]),K=Zt(ne=>ne.hideGitIgnoredRootsHydrated),we=Zt(ne=>JSON.stringify(ne.gitIgnoreExceptions[e]??[])),Z=Zt(ne=>ne.invalidateDirectoryCache);b.useLayoutEffect(()=>{e&&Z(e,!0)},[e,Re,we,Z]);const[Ue,Le]=b.useState(!1),[Y,Ee]=b.useState(null),[be,Me]=b.useState(!1),[Ze,Se]=b.useState(!1),[se,Ye]=b.useState(null),[pt,rt]=b.useState(de&&K),ye=de&&K||pt;b.useEffect(()=>{let ne=!1;return Promise.all([qe(),oe()]).catch(()=>{}).finally(()=>{ne||rt(!0)}),()=>{ne=!0}},[qe,oe]);const[et,ht]=b.useState([]),[te,ve]=b.useState(null),[ct,re]=b.useState(g5),[me,je]=b.useState([]),[mt,ae]=b.useState(null),De=b.useRef(null),gt=b.useRef(0),ft=I.trim().toLowerCase(),kt=F==="content",Dt=M||e,Yt=B.excludePatterns??oQ,xr=Yt.join(`
128
+ `);b.useEffect(()=>{const ne=Q?.path;if(!ne||!ne.startsWith(`${e}/`)&&ne!==e)return;const Ne=ne.slice(e.length).replace(/^\/+/,""),tt=Ne?Ne.split("/"):[],jt=tt.map((Pt,Ge)=>`${e}/${tt.slice(0,Ge+1).join("/")}`),Et=Zt.getState(),dr=jt.filter(Pt=>!Et.expandedPaths.has(Pt));dr.length>0&&Zt.setState(Pt=>({expandedPaths:new Set([...Pt.expandedPaths,...dr])}));let Jt=!1,We=0;const Lr=()=>{if(Jt)return;const Pt=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(Ge=>Ge.dataset.fileTreePath===ne);if(Pt){Pt.scrollIntoView({block:"center",behavior:"smooth"});return}We+=1,We<80&&window.setTimeout(Lr,50)},Xe=window.requestAnimationFrame(Lr);return()=>{Jt=!0,window.cancelAnimationFrame(Xe)}},[Q?.nonce,Q?.path,e]);const rr=b.useCallback(async ne=>{if(!(mt||ne.type==="directory")&&window.confirm(X("fileTree.deleteFileConfirm",{name:ne.name}))){ae(ne.path);try{await d8(ne.path),Zt.getState().applyFileWatchEvents([{type:"deleted",path:ne.path}]),ht(Ne=>Ne.filter(tt=>tt.path!==ne.path)),je(Ne=>Ne.filter(tt=>tt.path!==ne.path)),k.has(ne.path)&&y?.(ne.path)}catch(Ne){const tt=Ne instanceof Error?Ne.message:String(Ne);window.alert(X("fileTree.deleteFileFailed",{message:tt}))}finally{ae(null)}}},[mt,y,k,X]);b.useEffect(()=>{if(!e||!ye)return;if(ft){Le(!1);return}if(Zt.getState().directoryCache.has(e)){Le(!1);return}let ne=!1;const Ne=new AbortController;return Le(!0),Ee(null),Fm(e,Ne.signal,he,"load_file_tree_root",`file-tree-root:${e}`,$e,e).then(tt=>{if(ne)return;const jt=Mm(tt.entries);Me(!!tt.truncated),ze(e,jt)}).catch(tt=>{ne||Rm(tt)||Ee(tt instanceof Error?tt.message:"Failed to load directory")}).finally(()=>{ne||Le(!1)}),()=>{ne=!0,Ne.abort(),Vp(`file-tree-root:${e}`)}},[ft,ee,e,$e,ze,he,ye,Re,we]),b.useEffect(()=>{if(!Dt||!ft){Se(!1),Ye(null),ht([]),je([]),ve(null);return}let ne=!1;const Ne=new AbortController,tt=new Set;Se(!0),Ye(null),ht([]),je([]),re(kt?mQ:g5),ve({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const jt=`file-search:${Dt}:${++gt.current}`;return h8(Dt,I.trim(),Et=>{if(!ne){if(Et.engine&&ve(dr=>({truncated:dr?.truncated??!1,total:dr?.total??0,engine:Et.engine,limited:Et.limited??dr?.limited??!1,done:dr?.done??!1})),Et.entries?.length){const dr=Et.entries.filter(Jt=>tt.has(Jt.path)?!1:(tt.add(Jt.path),!0));dr.length>0&&(ht(Jt=>[...Jt,...Mm(dr)]),ve(Jt=>Jt?{...Jt,total:tt.size}:{truncated:!1,total:tt.size,engine:"rg",limited:!1,done:!1}))}if(Et.contentEntries?.length){const dr=Et.contentEntries.filter(Jt=>tt.has(Jt.path)?!1:(tt.add(Jt.path),!0));dr.length>0&&(je(Jt=>[...Jt,...dr]),ve(Jt=>Jt?{...Jt,total:tt.size}:{truncated:!1,total:tt.size,engine:"rg",limited:!1,done:!1}))}Et.done&&ve(dr=>({truncated:!!Et.truncated,total:typeof Et.total=="number"?Et.total:tt.size,engine:Et.engine??dr?.engine??"rg",limited:!!Et.limited,done:!0}))}},Ne.signal,he,F,jt,{excludePatterns:Yt,caseSensitive:B.caseSensitive,wholeWord:B.wholeWord,regex:B.regex}).catch(Et=>{ne||Rm(Et)||(Ye(Et instanceof Error?Et.message:"Failed to search files"),ht([]),je([]),ve(null))}).finally(()=>{ne||Se(!1)}),()=>{ne=!0,Ne.abort(),Vp(jt)}},[Dt,xr,kt,I,ft,F,B.caseSensitive,B.regex,B.wholeWord,he]),b.useEffect(()=>{if(!ft)return;const ne=De.current;if(!ne)return;const Ne=kt?me.length:et.length,tt=kt?y5:x5,jt=new IntersectionObserver(Et=>{Et.some(dr=>dr.isIntersecting)&&re(dr=>Math.min(dr+tt,Ne))},{rootMargin:"160px 0px"});return jt.observe(ne),()=>jt.disconnect()},[ft,et.length,me.length,kt]);const Ir=b.useMemo(()=>{if(!ee)return;if(!ft)return r?ee.filter(Ne=>Ne.type==="directory"):ee;const ne=Zt.getState().directoryCache;return ee.filter(Ne=>(!r||Ne.type==="directory")&&k1(Ne,ft,ne))},[r,ft,ee]);if(!e)return i.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:X("fileTree.noWorkingDir")});if(Ue||!ye)return i.jsx(sQ,{});if(ft&&kt){const ne=te?.total??me.length,Ne=me.slice(0,ct),tt=ct<me.length;return i.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[i.jsx(v5,{count:ne,loading:Ze,engine:te?.engine,limited:te?.limited,scope:Dt,content:!0}),se?i.jsxs("div",{className:"mx-1 mt-3 rounded-xl border border-border/15 bg-surface-2 px-4 py-5 text-center text-sm text-muted-foreground",children:[X("fileTree.contentSearchNeedsRipgrep"),i.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:se})]}):Ze&&me.length===0?i.jsx(Eu,{label:X("fileTree.searching"),className:"py-8"}):me.length===0?i.jsx("div",{className:"mx-1 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:X("fileTree.noContentMatches")}):i.jsxs(i.Fragment,{children:[te?.limited&&i.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:X("fileTree.searchTruncatedHint",{count:te.total})}),Ne.map(jt=>i.jsx(bQ,{entry:jt,rootPath:Dt,selectedFilePath:E,query:I.trim(),onContentMatchSelect:U,onPathReference:n,getReferenceText:a,onReferenceCopied:l,insertedReferenceKey:c,copiedReferenceKey:h},jt.path)),i.jsx("div",{ref:De,className:"py-2 text-center text-[11px] text-muted-foreground",children:tt?i.jsx("button",{type:"button",onClick:()=>re(jt=>Math.min(jt+y5,me.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:X("fileTree.loadMoreSearchResults",{shown:Ne.length,total:me.length})}):Ze?i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Nn,{size:10,className:"animate-spin"}),X("fileTree.searchStillRunning")]}):Ne.length>0?i.jsx("span",{children:X("fileTree.showingSearchResults",{shown:Ne.length,total:ne})}):null})]})]})}if(ft){const ne=te?.total??et.length,Ne=et.slice(0,ct),tt=ct<et.length;return i.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[i.jsx(v5,{count:ne,loading:Ze,engine:te?.engine,limited:te?.limited,scope:Dt,content:!1}),Ze&&et.length===0?i.jsx(Eu,{label:X("fileTree.searching"),className:"py-8"}):se?i.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:se}):et.length===0?i.jsx("div",{className:"mx-1 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:X("fileTree.noMatchingFiles")}):i.jsxs(i.Fragment,{children:[te?.limited&&i.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:X("fileTree.searchTruncatedHint",{count:te.total})}),Ne.map(jt=>i.jsx(pQ,{node:jt,rootPath:Dt,onFileSelect:t,onPathReference:n,getReferenceText:a,onReferenceCopied:l,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:y,pinnedPaths:k,selectedFilePath:E,insertedReferenceKey:c,copiedReferenceKey:h,onFileDeleteRequest:rr,deletingFilePath:mt},jt.path)),i.jsx("div",{ref:De,className:"py-2 text-center text-[11px] text-muted-foreground",children:tt?i.jsx("button",{type:"button",onClick:()=>re(jt=>Math.min(jt+x5,et.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:X("fileTree.loadMoreSearchResults",{shown:Ne.length,total:et.length})}):Ze?i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Nn,{size:10,className:"animate-spin"}),X("fileTree.searchStillRunning")]}):Ne.length>0?i.jsx("span",{children:X("fileTree.showingSearchResults",{shown:Ne.length,total:ne})}):null})]})]})}return Y?i.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:Y}):!ee||ee.length===0?i.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:X("fileTree.emptyDir")}):!Ir||Ir.length===0?i.jsx("div",{className:"mx-3 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:X("fileTree.noMatchingFiles")}):i.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[be&&i.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:X("fileTree.truncatedHint")}),Ir.map(ne=>i.jsx(fQ,{node:ne,gitIgnoreRoot:e,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:n,getReferenceText:a,onReferenceCopied:l,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:y,onOpenInFileBrowser:A,canOpenInFileBrowser:w,pinnedPaths:k,selectedFilePath:E,queryLower:ft,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryDropFiles:G,onFileDeleteRequest:rr,deletingFilePath:mt,revealedDirectoryPath:Q?.path},ne.path))]})}function jm(e){return e.trim().replace(/\/+$/,"")||"/"}function vQ(e){const t=jm(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function I1({open:e,initialPath:t,title:r,labels:n,onCancel:a,onConfirm:l}){const{t:c}=Qr(),h={hint:n?.hint??c("sidebar.directoryPickerHint"),cancel:n?.cancel??c("common.cancel"),confirm:n?.confirm??c("sidebar.useThisFolder"),close:n?.close??c("common.close"),parent:n?.parent??c("rightSidebar.parentFolder")},[p,g]=b.useState(()=>jm(t));return b.useEffect(()=>{e&&g(jm(t))},[t,e]),b.useEffect(()=>{if(!e)return;const x=document.body.style.overflow,y=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),a())};return document.body.style.overflow="hidden",document.addEventListener("keydown",y,!0),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",y,!0)}},[a,e]),e?Ai.createPortal(i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:a,"aria-label":h.cancel}),i.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(0.75rem,env(safe-area-inset-top,0px))] z-modal-panel flex flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:h-[min(72svh,36rem)] sm:w-[min(36rem,calc(100vw-2rem))] sm:-translate-x-1/2 sm:-translate-y-1/2",children:[i.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[i.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:i.jsx(W9,{size:15})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:r}),i.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:h.hint})]}),i.jsx("button",{type:"button",autoFocus:!0,onClick:a,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":h.close,children:i.jsx(Kn,{size:15})})]}),i.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[i.jsx("button",{type:"button",disabled:p==="/",onClick:()=>g(vQ(p)),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-30","aria-label":h.parent,children:i.jsx(vb,{size:14})}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:p,children:p})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:i.jsx(yQ,{rootPath:p,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:g,selectedFilePath:t||null})}),i.jsxs("footer",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border/15 bg-surface-elevated px-3 py-3",children:[i.jsx("button",{type:"button",onClick:a,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:h.cancel}),i.jsxs("button",{type:"button",onClick:()=>l(p),className:"inline-flex min-h-10 items-center gap-1.5 rounded-lg bg-primary px-4 text-[11px] font-semibold text-primary-foreground transition hover:bg-primary/90",children:[i.jsx(Mi,{size:13}),h.confirm]})]})]})]}),document.body):null}const Bm="termdock:new-session-commands:v1",$l="__saved_command__:";function Gd(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith($l)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function iu(){try{const e=JSON.parse(localStorage.getItem(Bm)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function wQ({directories:e,tmuxAvailable:t,options:r,agents:n,selectedAgent:a,detecting:l,resumeHistory:c,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:y,onLaunchAgent:A,onResumeHistory:w,onRemoveResumeHistory:k,onClose:E,onOptionsChange:I,additionalContent:M,footerActions:B}){const{t:F,locale:U}=Qr(),G=b.useRef(null),[Q,X]=b.useState(a),[ee,ze]=b.useState(!1),[he,de]=b.useState(!1),[$e,qe]=b.useState(iu),[oe,Re]=b.useState(()=>Gd(iu())),[K,we]=b.useState(null),[Z,Ue]=b.useState("idle"),Le=he?"__custom__":Q?.slug??"__terminal__",Y=Q?.command??"",Ee=he?$e.__custom__??$e.__terminal__??"":Q?$e[Le]??Y:"",be=()=>{const te=Ee.trim()||Y;if(!(he&&!te))try{const ve={...iu(),[Le]:te};if(he){for(const ct of Gd(iu()))ve[$l+ct]=ct;ve[$l+te]=te}localStorage.setItem(Bm,JSON.stringify(ve)),Re(Gd(ve)),he&&we(te),Ue("saved")}catch{Ue("error")}},Me=()=>{if(K)try{const te=iu();for(const[ve,ct]of Object.entries(te))(ve.startsWith($l)||ve==="__custom__"||ve==="__terminal__")&&ct.trim()===K&&delete te[ve];localStorage.setItem(Bm,JSON.stringify(te)),Re(Gd(te)),qe(ve=>({...ve,__custom__:""})),we(null),Ue("idle")}catch{Ue("error")}},Ze=()=>{const te=Ee.trim()||Y;he&&!te||(be(),A(Q,te))},Se=b.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),se=he?K?$l+K:"__custom__":Q?.slug??"__terminal__",Ye=te=>{Ue("idle");const ve=te.startsWith($l)?te.slice($l.length):null;we(ve),de(te==="__custom__"||ve!==null),(ve!==null||te==="__custom__")&&qe(ct=>({...ct,__custom__:ve??""})),X(n.find(ct=>ct.slug===te)??null)},pt=he?K??F("sidebar.customStartupCommand"):Q?.displayName??"Terminal",rt=a?.displayName??"Terminal",ye=!he&&(Q===null?a===null:a?.slug===Q.slug);b.useEffect(()=>{const te=ve=>{ve.key!=="Escape"||ve.defaultPrevented||ee||E()};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[ee,E]),b.useEffect(()=>{if(ee)return;const te=ve=>{ve.target instanceof Node&&(G.current?.contains(ve.target)||ve.target instanceof Element&&ve.target.closest("[data-sidebar-composer-popover]")?.getAttribute("data-sidebar-composer-popover")===G.current?.id||ve.target instanceof Element&&ve.target.closest('[aria-controls="sidebar-launch-options"]')||E())};return document.addEventListener("pointerdown",te,!0),()=>document.removeEventListener("pointerdown",te,!0)},[ee,E]);const et=te=>{I({...r,cwd:te}),ze(!1)},ht=te=>new Intl.DateTimeFormat(U==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(te));return i.jsxs("section",{ref:G,id:"sidebar-launch-options",className:`absolute inset-x-3 bottom-3 z-30 flex flex-col overflow-hidden rounded-2xl border border-border bg-surface shadow-[0_18px_50px_var(--app-shadow-strong),0_4px_14px_var(--app-shadow-soft)] animate-slide-down ${B?"max-h-[min(70svh,42rem,calc(100%_-_4.5rem))]":"max-h-[min(56svh,36rem,calc(100%_-_4.5rem))]"}`,"aria-label":F("sidebar.newSessionComposerTitle"),children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[i.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:i.jsx(Ro,{size:14})}),i.jsx("div",{className:"min-w-0",children:i.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:F("sidebar.newSessionComposerTitle")})})]}),i.jsx("button",{type:"button",onClick:E,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":F("common.close"),children:i.jsx(Kn,{size:14})})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-1",children:[i.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[i.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:F("sidebar.sessionMode")}),i.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(te=>i.jsx("button",{type:"button",disabled:te==="tmux"&&!t,onClick:()=>I({...r,mode:te}),"aria-pressed":r.mode===te,title:te==="tmux"?F(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===te?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:F(te==="shell"?"sidebar.newShell":"sidebar.newTmux")},te))})]}),i.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[i.jsx("span",{className:"text-[11px] text-muted-foreground",children:F("sidebar.startupCommand")}),i.jsx("button",{type:"button",onClick:x,disabled:l,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground disabled:opacity-50",title:F("sidebar.detectAgents"),"aria-label":F("sidebar.detectAgents"),children:i.jsx(Jn,{size:12,className:l?"animate-spin":""})})]}),i.jsxs("div",{role:"radiogroup","aria-label":F("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[n.map(te=>{const ve=!he&&Q?.slug===te.slug;return i.jsxs("button",{type:"button",role:"radio","aria-checked":ve,onClick:()=>Ye(te.slug),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${ve?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[i.jsx(bc,{agent:te,size:12}),i.jsx("span",{className:"max-w-[9rem] truncate",children:te.displayName}),a?.slug===te.slug&&i.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:F("sidebar.defaultAgent")})]},te.slug)}),oe.map(te=>{const ve=he&&K===te;return i.jsxs("button",{type:"button",role:"radio","aria-checked":ve,onClick:()=>Ye($l+te),title:te,className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 transition ${ve?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[i.jsx(uc,{size:10,className:"shrink-0"}),i.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:te})]},te)}),i.jsxs("button",{type:"button",role:"radio","aria-checked":se==="__terminal__",onClick:()=>Ye("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${se==="__terminal__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[i.jsx(Ro,{size:11,className:"shrink-0"}),i.jsx("span",{children:"Terminal"}),a===null&&i.jsx("span",{className:"ml-0.5 text-[9px] font-normal text-muted-foreground",children:F("sidebar.defaultAgent")})]}),i.jsxs("button",{type:"button",role:"radio","aria-checked":se==="__custom__",onClick:()=>Ye("__custom__"),className:`inline-flex min-h-7 items-center gap-0.5 rounded-md px-2 text-[10.5px] font-medium transition ${se==="__custom__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[i.jsx(Os,{size:10,className:"shrink-0"}),i.jsx("span",{children:F("sidebar.addStartupCommand")})]})]}),!ye&&!he&&i.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[i.jsx("span",{className:"truncate text-muted-foreground",children:F("sidebar.currentDefaultAgent",{name:rt})}),i.jsx("button",{type:"button",onClick:()=>y(Q),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:F("sidebar.makeDefault")})]}),Z==="error"&&i.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:F("sidebar.saveStartupCommandFailed")}),(Q||he)&&i.jsxs("details",{open:he&&!K||void 0,className:"group/command mt-0.5",children:[i.jsxs("summary",{className:"ml-auto flex min-h-8 w-fit cursor-pointer list-none items-center gap-1 rounded-md px-1 text-[10px] text-muted-foreground transition hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/50 [&::-webkit-details-marker]:hidden",children:[F(he&&!K?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),i.jsx(Jo,{size:11,className:"transition-transform group-open/command:rotate-180"})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("label",{htmlFor:"new-session-command",className:"sr-only",children:F("sidebar.startupCommand")}),Q&&Ee!==Y&&i.jsx("button",{type:"button",onClick:()=>{qe(te=>({...te,[Le]:Y})),Ue("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:F("sidebar.resetStartupCommand")})]}),i.jsx("input",{id:"new-session-command",value:Ee,onChange:te=>{qe(ve=>({...ve,[Le]:te.target.value})),Ue("idle")},placeholder:Y||F("sidebar.startupCommandPlaceholder"),autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoComplete:"off",className:"min-h-10 w-full rounded-lg border-0 bg-surface px-3 font-mono text-[16px] text-foreground outline-none ring-1 ring-inset ring-border transition focus:ring-primary/50 sm:text-[11px]"}),i.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2","aria-live":"polite",children:[he&&K&&i.jsxs("button",{type:"button",onClick:Me,className:"mr-auto inline-flex min-h-9 items-center gap-1 rounded-md px-2 text-[10px] text-muted-foreground transition hover:text-destructive","aria-label":F("sidebar.deleteStartupCommand"),children:[i.jsx(ni,{size:11}),F("sidebar.deleteStartupCommand")]}),i.jsx("button",{type:"button",onClick:be,disabled:Z==="saved"||he&&!Ee.trim(),className:"min-h-8 rounded-md px-2 text-[10px] font-medium text-primary transition hover:bg-primary/10 disabled:cursor-default disabled:opacity-50",children:F(Z==="saved"?"sidebar.startupCommandSaved":"sidebar.saveStartupCommand")})]}),i.jsx("p",{className:"mb-2 mt-1.5 px-0.5 text-[10px] leading-relaxed text-muted-foreground",children:F(Q?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},K??Le),i.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:F("sidebar.workingDirectory")}),i.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>ze(!0),className:"mt-1 flex min-h-11 w-full items-center gap-2 rounded-lg border border-transparent bg-surface px-2.5 font-mono text-[11px] text-foreground outline-none transition hover:bg-surface-2 focus-visible:border-primary",children:[i.jsx(vc,{size:12,className:"shrink-0 text-muted-foreground"}),i.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||F("sidebar.directoryPlaceholder")})]}),Se.length>0&&i.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":F("sidebar.recentDirectories"),children:Se.map(te=>i.jsx("button",{type:"button",onClick:()=>et(te),title:te,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:Nu(te)||te},te))}),(c.length>0||g)&&i.jsxs("details",{className:"mt-1",children:[i.jsxs("summary",{className:"flex min-h-9 cursor-pointer list-none items-center gap-2 rounded-md px-1 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground transition hover:text-foreground",children:[i.jsx(uc,{size:11}),i.jsx("span",{className:"flex-1",children:F("sidebar.resumeHistory")}),h&&i.jsx(Nn,{size:10,className:"animate-spin"}),c.length>0&&i.jsx("span",{className:"normal-case tracking-normal",children:F("sidebar.resumeHistoryCount",{n:c.length})}),i.jsx(Jo,{size:11})]}),c.length>0&&i.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:c.slice(0,6).map(te=>{const ve=p===te.id;return i.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[i.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>w(te),className:"flex min-h-11 min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2 text-left disabled:cursor-wait disabled:opacity-60","aria-label":F("sidebar.resumeHistoryAction",{title:te.title}),children:[i.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:ve?i.jsx(Nn,{size:13,className:"animate-spin"}):i.jsx(bc,{agent:te.agent,size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:te.title}),i.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[te.agent.displayName," · ",ht(te.closedAt)]})]}),i.jsx(kb,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),i.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(te.id),className:"relative inline-flex w-11 shrink-0 items-center justify-center text-muted-foreground transition hover:text-destructive disabled:opacity-40","aria-label":F("sidebar.resumeHistoryRemove",{title:te.title}),children:[i.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),i.jsx(ni,{size:12})]})]},te.id)})}),g&&i.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]}),M]}),i.jsxs("div",{className:"shrink-0 bg-surface px-3 pb-3 pt-2",children:[i.jsxs("button",{type:"button",onClick:Ze,disabled:he&&!Ee.trim(),className:"flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-primary px-3 text-[12px] font-semibold text-primary-foreground transition hover:brightness-110 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-40","aria-label":F("sidebar.launchSessionWith",{name:pt}),children:[Q?i.jsx(bc,{agent:Q,size:15}):i.jsx(Ro,{size:14}),i.jsx("span",{className:"truncate",children:F("sidebar.launchSessionWith",{name:pt})})]}),B]}),i.jsx(I1,{open:ee,initialPath:r.cwd?.trim()||Se[0]||"/",title:F("sidebar.chooseDirectory"),onCancel:()=>ze(!1),onConfirm:et})]})}const v6="termdock:new-session-agent:v1";function AQ(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(v6)||"null");return!e||typeof e.slug!="string"||typeof e.command!="string"?null:{slug:e.slug,command:e.command,displayName:typeof e.displayName=="string"?e.displayName:e.slug,capabilities:Array.isArray(e.capabilities)?e.capabilities.filter(t=>typeof t=="string"):void 0,accentColor:typeof e.accentColor=="string"?e.accentColor:"var(--muted-foreground)",icon:typeof e.icon=="string"?e.icon:null,isPlugin:e.isPlugin===!0,iconMode:e.iconMode==="native"?"native":e.iconMode==="mask"?"mask":void 0,iconVersion:typeof e.iconVersion=="number"?e.iconVersion:void 0}}catch{return null}}function Np(e){if(!(typeof window>"u"))try{window.localStorage.setItem(v6,JSON.stringify(e))}catch{}}function TQ(e,t){return e?t.find(r=>r.slug===e)??null:null}function CQ(){const[e,t]=b.useState(AQ),[r,n]=b.useState([]),[a,l]=b.useState(!0),c=b.useCallback(async()=>{l(!0);try{const[p,g]=await Promise.all([vl(),pb()]),x=TQ(p.newSessionAgentSlug,g);n(g),t(x),Np(x)}finally{l(!1)}},[]);b.useEffect(()=>{const p=()=>{c().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){p();return}return window.addEventListener("termdock:initial-viewport-presented",p,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",p)},[c]);const h=b.useCallback(async p=>{const g=e;t(p),Np(p);try{await ha({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),Np(g),x}},[e]);return{preference:e,agents:r,detecting:a,refresh:c,selectAgent:h}}const Zi="inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-xs transition disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",Yi="w-full min-h-11 rounded-lg border border-border/30 bg-surface-2 px-3 py-2 text-xs text-foreground outline-none focus:border-primary",Ul=`${Zi} bg-primary text-primary-foreground`,zc=`${Zi} bg-surface-2 text-foreground hover:bg-surface-2/80`,SQ={created:"创建任务",assigned:"分派",report:"成员报告",question:"提出问题",answer:"用户回答","submit-plan":"提交方案",review:"提交评审","request-review":"请求独立评审","approve-plan":"用户确认方案",accepted:"用户验收",revise:"要求修改",comment:"补充说明",coordinator:"协调者变更",close:"关闭",reopen:"重新打开",scheduled:"等待自动分派",coordinate:"协调说明","child-update":"子任务更新","review-passed":"独立评审通过","review-blocked":"评审受阻","automation-blocked":"自动安排受阻",pause:"暂停安排",resume:"继续安排",retry:"继续协调"},Iu=e=>`${e.serviceId}:${e.sessionId}`,hl=e=>new Date(e).toLocaleString([],{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function hc(e,t){try{const r=JSON.parse(localStorage.getItem(e)??"null");return r===null||t!==null&&(typeof r!=typeof t||Array.isArray(r)!==Array.isArray(t))?t:r}catch{return t}}function pl(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const wu={mode:"goal",isolated:!0,title:"",spec:"",constraints:"",acceptance:"",assignee:"",coordinator:"",parent:"",dependencies:[]};function _Q(e){const t={...wu,...hc(e,wu)};return!t||!Array.isArray(t.dependencies)||t.dependencies.some(r=>typeof r!="string")||Object.keys(wu).some(r=>!["dependencies","isolated"].includes(r)&&typeof t[r]!="string")?wu:{...t,mode:t.mode==="task"?"task":"goal",isolated:t.isolated!==!1}}function LQ({group:e,sessions:t,active:r,onOpenSession:n,onAttentionChange:a}){const l=`termdock:tasks:${location.origin}:${e.id}`,[c,h]=b.useState([]),[p,g]=b.useState(null),[x,y]=b.useState(()=>hc(`${l}:selected`,null)),[A,w]=b.useState(!1),[k,E]=b.useState(!1),[I,M]=b.useState(!1),B=b.useRef(null),F=b.useRef(null);b.useEffect(()=>{const ae=B.current;if(!ae)return;const De=new ResizeObserver(gt=>E(gt[0].contentRect.width>=760));return De.observe(ae),()=>De.disconnect()},[]);const[U,G]=b.useState(!1),[Q,X]=b.useState(null),[ee,ze]=b.useState(!1),[he,de]=b.useState(""),[$e,qe]=b.useState(!1);b.useEffect(()=>{if(!he)return;const ae=setTimeout(()=>de(""),5e3);return()=>clearTimeout(ae)},[he]);const[oe,Re]=b.useState("open"),[K,we]=b.useState(""),[Z,Ue]=b.useState(()=>_Q(`${l}:draft`)),Le=b.useRef(!0),Y=b.useRef(new Map),Ee=b.useRef(!1),be=e.sessionIds.flatMap(ae=>{const De=t.find(gt=>gt.sessionId===ae);return De?[De]:[]}),Me=be.map(ae=>({...ae,name:qp(ae,be)})),Ze=Z.coordinator||hc(`${l}:lead`,""),Se=Me.find(ae=>ae.sessionId===Ze)?.sessionId||Me.find(ae=>ae.agent)?.sessionId||Me[0]?.sessionId||"",se=Me.filter(ae=>ae.sessionId!==Se&&ae.agent).map(ae=>ae.sessionId),Ye=!!Z.spec.trim()&&!!Me.find(ae=>ae.sessionId===Se)?.agent&&se.length>0,pt=c.find(ae=>ae.id===x)??null,rt=p?.id===x?p:null;b.useEffect(()=>(Le.current=!0,()=>{Le.current=!1}),[]),b.useEffect(()=>{pl(`${l}:draft`,Z)},[l,Z]),b.useEffect(()=>{pl(`${l}:selected`,x)},[l,x]),b.useEffect(()=>{const ae=gt=>{const ft=gt.detail;ft?.groupId===e.id&&(pl(`${l}:open-task`,null),y(ft.taskId),w(!0),qe(!1),Re("all"),ye())};window.addEventListener("open-collaboration-task",ae);const De=hc(`${l}:open-task`,null);return De&&(y(De),w(!0),Re("all"),pl(`${l}:open-task`,null)),()=>window.removeEventListener("open-collaboration-task",ae)},[e.id]),b.useEffect(()=>{if(!r||!pt||p?.id===pt.id&&p.revision===pt.revision)return;let ae=!1;return m8(pt.id).then(De=>{ae||g(De.task)}).catch(De=>{ae||X(De instanceof Error?De.message:"任务详情加载失败")}),()=>{ae=!0}},[r,pt?.id,pt?.revision,p?.id,p?.revision]);const ye=async()=>{if(!Ee.current){Ee.current=!0;try{const ae=await hb(e.id);Le.current&&(h(ae.tasks),G(!0),X(null))}catch(ae){Le.current&&X(ae instanceof Error?ae.message:"任务加载失败")}finally{Ee.current=!1}}};b.useEffect(()=>{if(!r)return;ye();const ae=()=>{document.hidden||ye()},De=setInterval(ae,2500);return document.addEventListener("visibilitychange",ae),()=>{clearInterval(De),document.removeEventListener("visibilitychange",ae)}},[r,e.id]);const et=ae=>{const De=JSON.stringify(ae),gt=hc(`${l}:request`,null);let ft=Y.current.get(De)??(gt?.fingerprint===De?gt.key:void 0);return ft||(ft=crypto.randomUUID(),Y.current.set(De,ft)),pl(`${l}:request`,{fingerprint:De,key:ft}),ft},ht=ae=>{Y.current.delete(JSON.stringify(ae)),pl(`${l}:request`,null)},te=async(ae,De)=>{if(ee)return;ze(!0),X(null),de("");const gt={...De,expectedRevision:ae.revision};try{const ft=await x8(ae.id,{...gt,idempotencyKey:et([ae.id,gt])});ht([ae.id,gt]),vu.getState().refresh(),Le.current&&(h(kt=>kt.map(Dt=>Dt.id===ft.task.id?ft.task:Dt)),g(ft.task),de(De.kind==="answer"?"回答已保存,服务端继续投递。":De.kind==="accept"?"已验收此版本结果。":"记录已保存。"))}catch(ft){Le.current&&(X(ft instanceof Error?ft.message:"操作失败"),ye())}finally{Le.current&&ze(!1)}},ve=async ae=>{if(ae.preventDefault(),ee)return;ze(!0),X(null);const De=Z.mode==="goal",gt={groupId:e.id,title:Z.title.trim()||Z.spec.trim().split(`
129
+ `)[0].slice(0,100),spec:Z.spec,constraints:Z.constraints,acceptance:Z.acceptance,assigneeSessionId:De?void 0:Z.assignee||void 0,coordinatorSessionId:De?Se:Z.coordinator||void 0,parentTaskId:De?void 0:Z.parent||void 0,dependsOn:De?[]:Z.dependencies,managed:De,isolated:Z.isolated,reviewerSessionIds:De?se:void 0};try{const{task:ft}=await g8({...gt,idempotencyKey:et(gt)});ht(gt),Le.current&&(h(kt=>[ft,...kt.filter(Dt=>Dt.id!==ft.id)]),y(ft.id),w(!0),g(ft),De&&pl(`${l}:lead`,Se),Ue(wu),qe(!1),Re("open"),we(""),de(De?"目标已提交,协调者收到后开始拆分与分派。后续评审和依赖由服务接续。":"任务已保存。分派后由服务端持续投递。"))}catch(ft){Le.current&&X(ft instanceof Error?ft.message:"创建失败")}finally{Le.current&&ze(!1)}},ct=(ae,De)=>{if(!De)return"用户";const gt=ae.memberSessions[Iu(De)];return Me.find(ft=>ft.sessionId===gt)?.name??t.find(ft=>ft.sessionId===gt)?.name??De.sessionId},re=c.filter(ae=>(oe==="all"?!0:oe==="archive"?ae.status!=="open":ae.status==="open")&&(oe==="all"||oe==="attention"||ae.workflow?.kind!=="step")&&(oe!=="attention"||xh(ae))&&(!K.trim()||`${ae.title} ${ae.spec} ${ae.attempts.map(De=>ct(ae,De.assignee)).join(" ")}`.toLowerCase().includes(K.trim().toLowerCase()))),me=c.filter(xh).length;b.useEffect(()=>{a?.(me)},[me,a]);const je=!!pt&&(k||A),mt=()=>{qe(!1),requestAnimationFrame(()=>F.current?.focus())};return i.jsxs("section",{ref:B,"aria-label":"协作任务",className:"space-y-3",children:[Q&&i.jsxs("div",{role:"alert",className:"flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[i.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[Q,U?" · 显示最近保存的记录":""]}),i.jsxs("button",{type:"button",className:Zi,onClick:()=>{ye()},children:[i.jsx(Jn,{size:14}),"刷新"]})]}),he&&i.jsx("p",{role:"status",className:"text-xs text-primary",children:he}),$e?i.jsxs("form",{onSubmit:ae=>{ve(ae)},className:"space-y-3",onKeyDown:ae=>{ae.key==="Escape"&&(ae.preventDefault(),ae.stopPropagation(),ee||mt())},children:[i.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-2 bg-surface py-1",children:[i.jsxs("button",{type:"button",className:`${Zi} text-muted-foreground hover:bg-surface-2`,disabled:ee,onClick:mt,children:[i.jsx(Ch,{size:14}),"返回"]}),i.jsx("h4",{className:"min-w-0 flex-1 text-sm font-medium text-foreground",children:Z.mode==="goal"?"交给协作组":"手动任务"}),i.jsx("button",{className:Ul,disabled:ee||(Z.mode==="goal"?!Ye:!Z.title.trim()||!Z.spec.trim()),children:ee?"提交中…":Z.mode==="goal"?"开始协作":Z.assignee?"创建并分派":"保存任务"})]}),i.jsx("div",{className:"flex gap-1",children:["goal","task"].map(ae=>i.jsx("button",{type:"button",className:`${Zi} ${Z.mode===ae?"bg-primary/15 text-primary":"text-muted-foreground"}`,"aria-pressed":Z.mode===ae,onClick:()=>Ue(De=>({...De,mode:ae})),children:ae==="goal"?"自动协作":"手动分派"},ae))}),Z.mode==="task"&&i.jsx(io,{label:"任务标题",children:i.jsx("input",{className:Yi,required:!0,maxLength:200,value:Z.title,onChange:ae=>Ue(De=>({...De,title:ae.target.value})),placeholder:"要完成什么?"})}),i.jsx(io,{label:Z.mode==="goal"?"希望协作组完成什么?":"目标与交付要求",children:i.jsx("textarea",{className:`${Yi} min-h-24 resize-y`,autoFocus:!0,required:!0,value:Z.spec,onChange:ae=>Ue(De=>({...De,spec:ae.target.value})),placeholder:"说明当前问题、预期结果和需要交付的内容。"})}),Z.mode==="goal"?i.jsxs(i.Fragment,{children:[i.jsx(io,{label:"协调者",children:i.jsx("select",{className:Yi,value:Se,onChange:ae=>Ue(De=>({...De,coordinator:ae.target.value})),children:Me.map(ae=>i.jsxs("option",{value:ae.sessionId,disabled:!ae.agent,children:[ae.name,ae.agent?"":"(需要启动 Agent)"]},ae.sessionId))})}),i.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"协调者拆分和汇总,执行成员完成子任务,服务自动安排评审与返工。你回答必要问题并验收最终结果。"}),!se.length&&i.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"请先在“消息与成员”加入至少一位执行 Agent。"})]}):i.jsx(io,{label:"分派给",children:i.jsxs("select",{className:Yi,value:Z.assignee,onChange:ae=>Ue(De=>({...De,assignee:ae.target.value})),children:[i.jsx("option",{value:"",children:"先保存,稍后分派"}),Me.map(ae=>i.jsx("option",{value:ae.sessionId,children:ae.name},ae.sessionId))]})}),i.jsx(io,{label:"验收标准(选填)",children:i.jsx("textarea",{className:`${Yi} min-h-16 resize-y`,value:Z.acceptance,onChange:ae=>Ue(De=>({...De,acceptance:ae.target.value})),placeholder:"什么结果满足要求?"})}),i.jsxs("details",{children:[i.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:Z.mode==="goal"?"约束与执行目录":"约束、协调者与任务依赖"}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(io,{label:"约束",children:i.jsx("textarea",{className:Yi,value:Z.constraints,onChange:ae=>Ue(De=>({...De,constraints:ae.target.value})),placeholder:"必须保留什么?哪些操作需要先问用户?"})}),Z.mode==="goal"?i.jsxs("label",{className:"flex min-h-11 items-start gap-2 text-xs text-muted-foreground",children:[i.jsx("input",{type:"checkbox",className:"mt-0.5",checked:Z.isolated,onChange:ae=>Ue(De=>({...De,isolated:ae.target.checked}))}),i.jsx("span",{children:"为代码子任务创建独立目录与 Agent 会话。以已提交代码为基线,不包含原目录未提交改动;依赖的已评审提交会自动集成。非代码任务可关闭。"})]}):i.jsx(io,{label:"协调者",children:i.jsxs("select",{className:Yi,value:Z.coordinator,onChange:ae=>Ue(De=>({...De,coordinator:ae.target.value})),children:[i.jsx("option",{value:"",children:"由用户协调"}),Me.map(ae=>i.jsx("option",{value:ae.sessionId,children:ae.name},ae.sessionId))]})}),Z.mode==="task"&&i.jsxs(i.Fragment,{children:[i.jsx(io,{label:"父任务",children:i.jsxs("select",{className:Yi,value:Z.parent,onChange:ae=>Ue(De=>({...De,parent:ae.target.value})),children:[i.jsx("option",{value:"",children:"独立任务"}),c.filter(ae=>!ae.workflow).map(ae=>i.jsx("option",{value:ae.id,children:ae.title},ae.id))]})}),i.jsxs("fieldset",{className:"space-y-1",children:[i.jsx("legend",{className:"text-xs text-muted-foreground",children:"需先验收的依赖任务"}),c.length?c.filter(ae=>ae.status!=="closed").map(ae=>i.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-foreground",children:[i.jsx("input",{type:"checkbox",checked:Z.dependencies.includes(ae.id),onChange:De=>Ue(gt=>({...gt,dependencies:De.target.checked?[...gt.dependencies,ae.id]:gt.dependencies.filter(ft=>ft!==ae.id)}))}),ae.title]},ae.id)):i.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"还没有其他任务"})]})]})]})]}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"草稿自动保存在当前设备。返回后可继续编辑。"})]}):!U&&!c.length?i.jsx("p",{role:"status",className:"py-8 text-center text-xs text-muted-foreground",children:Q?"任务暂时无法加载,请重试。":"正在加载任务…"}):c.length?i.jsxs(i.Fragment,{children:[(!je||k)&&i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.filter(ae=>ae.status==="open"&&ae.workflow?.kind!=="step").length," 个进行中",me>0?` · ${me} 个待处理`:""]}),i.jsxs("button",{ref:F,type:"button",className:Ul,disabled:ee,onClick:()=>qe(!0),children:[i.jsx(Os,{size:14}),"新目标"]})]}),i.jsxs("div",{className:k&&je?"grid items-start gap-4 grid-cols-[260px_minmax(0,1fr)]":"",children:[(!je||k)&&i.jsxs("div",{className:"min-w-0 space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("div",{className:"flex min-w-0 flex-1 gap-0.5 overflow-x-auto","aria-label":"任务筛选",children:[["open","进行中"],["attention",`待处理${me?` ${me}`:""}`],["archive","归档"],["all","全部"]].map(([ae,De])=>i.jsx("button",{type:"button","aria-pressed":oe===ae,className:`${Zi} shrink-0 px-2 ${oe===ae?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2"}`,onClick:()=>Re(ae),children:De},ae))}),i.jsx("button",{type:"button","aria-label":"搜索任务","aria-expanded":I,className:`${Zi} shrink-0 px-2 text-muted-foreground hover:bg-surface-2`,onClick:()=>{M(ae=>!ae),we("")},children:i.jsx(o0,{size:14})})]}),I&&i.jsxs("label",{className:"relative block",children:[i.jsx("span",{className:"sr-only",children:"搜索任务或负责人"}),i.jsx(o0,{size:14,className:"pointer-events-none absolute left-3 top-3.5 text-muted-foreground"}),i.jsx("input",{autoFocus:!0,className:`${Yi} pl-9`,value:K,onChange:ae=>we(ae.target.value),placeholder:"搜索任务或负责人"})]}),!re.length&&i.jsxs("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:[K.trim()?"没有匹配的任务。":oe==="attention"?"目前没有需要你处理的任务。":oe==="archive"?"还没有归档任务。":"当前没有进行中的任务。",(oe!=="all"||K)&&i.jsx("button",{type:"button",className:`${Zi} mt-2 text-primary`,onClick:()=>{Re("all"),we("")},children:"查看全部任务"})]}),re.map(ae=>{const De=ae.attempts.find(gt=>gt.id===ae.activeAttemptId);return i.jsxs("button",{type:"button","aria-pressed":x===ae.id,className:`w-full rounded-lg border p-3 text-left transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${x===ae.id?"border-primary/50 bg-primary/5":"border-border/20 hover:bg-surface-2"}`,onClick:()=>{y(ae.id),w(!0),de("")},children:[i.jsx("span",{className:"block break-words text-sm font-medium text-foreground",children:ae.title}),i.jsx("span",{className:`mt-1.5 block text-xs ${xh(ae)?"text-primary":"text-muted-foreground"}`,children:qu(ae)}),i.jsxs("span",{className:"mt-2 block truncate text-[11px] text-muted-foreground",children:[De?ct(ae,De.assignee):"尚未分派"," · ",hl(ae.updatedAt)]})]},ae.id)})]}),je&&i.jsxs("div",{className:"min-w-0",children:[!k&&i.jsxs("button",{type:"button",className:`${Zi} mb-2 text-primary`,onClick:()=>w(!1),children:[i.jsx(Ch,{size:14}),"返回任务"]}),rt?i.jsx(kQ,{task:rt,tasks:c,members:Me,busy:ee,name:ae=>ct(rt,ae),act:ae=>te(rt,ae),storage:l,onSelectTask:ae=>{y(ae),w(!0)},onOpenSession:async ae=>{const De=t.find(gt=>gt.sessionId===rt.memberSessions[Iu(ae)]);if(!De){X("成员会话暂不可用,任务历史已保留。");return}try{await n(De)}catch(gt){X(gt instanceof Error?gt.message:"无法打开终端")}}},rt.id):i.jsx("p",{role:"status",className:"py-8 text-center text-xs text-muted-foreground",children:"正在加载任务详情…"})]})]})]}):i.jsxs("div",{className:"space-y-3 rounded-lg border border-border/20 p-3",children:[i.jsx("h4",{className:"text-sm font-medium text-foreground",children:"给协作组一个目标"}),i.jsx("p",{className:"max-w-xs text-xs leading-relaxed text-muted-foreground",children:"协调者组织执行,服务接续评审和返工,最后把结果交给你验收。"}),i.jsxs("button",{ref:F,type:"button",className:Ul,disabled:ee,onClick:()=>qe(!0),children:[i.jsx(Os,{size:14}),"开始协作"]})]})]})}function io({label:e,children:t}){return i.jsxs("label",{className:"block space-y-1.5",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:e}),t]})}function kQ({task:e,tasks:t,members:r,name:n,busy:a,act:l,storage:c,onOpenSession:h,onSelectTask:p}){const[g,x]=b.useState(""),[y,A]=b.useState(""),[w,k]=b.useState(""),E=b.useRef(null);b.useEffect(()=>{E.current?.focus()},[]);const[I,M]=b.useState(()=>hc(`${c}:${e.id}:feedback`,"")),[B,F]=b.useState(()=>hc(`${c}:${e.id}:answers`,{}));b.useEffect(()=>pl(`${c}:${e.id}:answers`,B),[c,e.id,B]),b.useEffect(()=>pl(`${c}:${e.id}:feedback`,I),[c,e.id,I]);const U=e.attempts.find(K=>K.id===e.activeAttemptId),G=e.status==="open",Q=e.artifacts.filter(K=>K.kind==="result"&&K.attemptId===e.activeAttemptId).at(-1),X=e.artifacts.filter(K=>K.kind==="plan"&&K.attemptId===e.activeAttemptId).at(-1),ee=Q&&e.events.some(K=>K.kind==="revise"&&K.attemptId===e.activeAttemptId&&K.createdAt>=Q.createdAt),ze=e.decisions.filter(K=>K.status==="pending"&&K.attemptId===e.activeAttemptId),he=e.dependsOn.some(K=>t.find(we=>we.id===K)?.status!=="accepted"),de=!e.workflow||e.artifacts.filter(K=>K.kind==="review"&&K.reviewsArtifactId===Q?.id).at(-1)?.verdict==="pass",$e=e.children??[],qe=e.workflow?.kind==="goal"&&$e.some(K=>!["accepted","closed"].includes(K.status)),oe=`任务:${e.title}
130
+ 任务 ID:${e.id}
131
+ ${e.spec}
132
+ 约束:${e.constraints||"未补充"}
133
+ 验收标准:${e.acceptance||"由用户决定"}
134
+ ${U?`当前尝试:${U.id}
135
+ 负责人:${n(U.assignee)}
136
+ `:""}${e.artifacts.filter(K=>K.attemptId===e.activeAttemptId).map(K=>`${K.kind} · 版本 ${K.id} · ${hl(K.createdAt)}
137
+ ${K.content}`).join(`
138
+
139
+ `)}
140
+ ${ze.map(K=>`待回答:${K.question}`).join(`
141
+ `)}`,Re=()=>{const K=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:"application/json"})),we=document.createElement("a");we.href=K,we.download=`termdock-task-${e.id}.json`,we.click(),setTimeout(()=>URL.revokeObjectURL(K),1e3)};return i.jsxs("article",{className:"space-y-4",children:[e.replica&&i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"这是来源服务同步的任务记录;回答与决定会送回来源服务保存。"}),i.jsxs("header",{children:[i.jsxs("div",{className:"flex flex-wrap items-start gap-2",children:[i.jsx("h3",{ref:E,tabIndex:-1,className:"min-w-0 flex-1 break-words text-base font-medium text-foreground outline-none",children:e.title}),i.jsx("span",{className:"shrink-0 rounded-md bg-surface-2 px-2 py-1 text-[11px] text-primary",children:qu(e)})]}),i.jsxs("details",{className:"mt-2",children:[i.jsx("summary",{className:"cursor-pointer py-2 text-xs text-muted-foreground",children:"目标与验收标准"})," ",i.jsx("p",{className:"mt-2 whitespace-pre-wrap break-words text-xs leading-relaxed text-foreground",children:e.spec}),(e.constraints||e.acceptance)&&i.jsxs("dl",{className:"mt-3 space-y-2 text-xs",children:[e.constraints&&i.jsxs("div",{children:[i.jsx("dt",{className:"text-muted-foreground",children:"约束"}),i.jsx("dd",{className:"mt-1 whitespace-pre-wrap break-words text-foreground",children:e.constraints})]}),e.acceptance&&i.jsxs("div",{children:[i.jsx("dt",{className:"text-muted-foreground",children:"验收标准"}),i.jsx("dd",{className:"mt-1 whitespace-pre-wrap break-words text-foreground",children:e.acceptance})]})]})]}),i.jsxs("p",{className:"mt-3 text-[11px] text-muted-foreground",children:[U?`负责人:${n(U.assignee)}`:"尚未分派"," · ",e.coordinator?`协调者:${n(e.coordinator)}`:"由你协调",U&&i.jsxs("button",{type:"button",className:`${Zi} ml-1 text-primary`,onClick:()=>{h(U.assignee)},children:[i.jsx(Xu,{size:13}),"终端"]})]}),!!e.dependsOn.length&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:["依赖:",e.dependsOn.map(K=>`${t.find(we=>we.id===K)?.title??K}(${t.find(we=>we.id===K)?.status==="accepted"?"已验收":"待验收"})`).join("、")]}),e.parentTaskId&&i.jsxs("button",{type:"button",className:`${Zi} mt-1 text-primary`,onClick:()=>p(e.parentTaskId),children:[i.jsx(Ch,{size:12}),t.find(K=>K.id===e.parentTaskId)?.title??"返回目标"]})]}),e.workflow&&G&&i.jsxs("section",{className:"space-y-2 rounded-lg border border-border/20 p-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-medium text-foreground",children:e.workflow.kind==="goal"?"协调与自动接续":"自动执行与评审"}),i.jsx("button",{type:"button",className:zc,disabled:a,onClick:()=>{l({kind:e.workflow.paused?"resume":"pause"})},children:e.workflow.paused?"继续安排":"暂停安排"})]}),i.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:e.workflow.paused?"后续自动安排已暂停,已入队的终端工作继续保留。":"明确交付后自动评审,修改要求自动交回,依赖通过后接续。最终结果由你验收。"}),e.automationIssue&&i.jsxs("div",{role:"alert",className:"space-y-2",children:[i.jsx("p",{className:"whitespace-pre-wrap break-words text-xs text-destructive",children:e.automationIssue}),i.jsx("button",{type:"button",className:zc,disabled:a,onClick:()=>{l({kind:"retry"})},children:"继续协调 / 重试投递"})]}),e.workflow.kind==="goal"&&e.events.filter(K=>K.kind==="coordinate").at(-1)&&i.jsx("p",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-foreground",children:e.events.filter(K=>K.kind==="coordinate").at(-1).content}),e.workspace&&i.jsxs("details",{children:[i.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"交付目录与分支"}),i.jsxs("p",{className:"select-text break-all text-xs text-foreground",children:[e.workspace.cwd,i.jsx("br",{}),e.workspace.branch]}),i.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"基于已提交代码创建,原目录未提交改动保持原样。合并到原分支或发布需另行操作。"})]})]}),!!$e.length&&i.jsxs("section",{className:"space-y-1",children:[i.jsxs("h4",{className:"text-xs font-medium text-foreground",children:["子任务 · ",$e.filter(K=>K.status==="accepted").length,"/",$e.length," 已通过评审"]}),$e.map(K=>{const we=t.find(Z=>Z.id===K.id);return i.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-lg bg-surface-2 px-3 py-2 text-left",onClick:()=>p(K.id),children:[i.jsx("span",{className:"min-w-0 flex-1 break-words text-xs text-foreground",children:K.title}),i.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:we?qu(we):K.status==="accepted"?"评审通过":"等待报告"})]},K.id)})]}),G&&!U&&!e.scheduledAssignee&&i.jsxs("section",{className:"space-y-2 rounded-lg border border-border/20 p-3",children:[i.jsx(io,{label:"分派给",children:i.jsxs("select",{className:Yi,value:g,onChange:K=>x(K.target.value),children:[i.jsx("option",{value:"",children:"选择负责人"}),r.map(K=>i.jsx("option",{value:K.sessionId,children:K.name},K.sessionId))]})}),i.jsx("button",{type:"button",className:Ul,disabled:a||!g||he,onClick:()=>{l({kind:"assign",assigneeSessionId:g})},children:"分派任务"}),he&&i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"依赖任务验收后可分派。"})]}),ze.map(K=>i.jsxs("form",{className:"space-y-2 rounded-xl border border-primary/30 bg-primary/5 p-3",onSubmit:we=>{we.preventDefault(),l({kind:"answer",decisionId:K.id,content:B[K.id]}).then(()=>E.current?.focus())},children:[i.jsxs("p",{className:"text-xs font-medium text-primary",children:["需要你的回答 · ",hl(K.createdAt)]}),i.jsx("p",{className:"whitespace-pre-wrap break-words text-sm text-foreground",children:K.question}),!!K.options.length&&i.jsx("div",{className:"flex flex-wrap gap-2",children:K.options.map((we,Z)=>i.jsx("button",{type:"button","aria-pressed":B[K.id]===we,disabled:a,className:`${Zi} ${B[K.id]===we?"bg-primary/15 text-primary":"bg-surface-2 text-foreground"}`,onClick:()=>F(Ue=>({...Ue,[K.id]:we})),children:we},Z))}),i.jsx(io,{label:"你的回答",children:i.jsx("textarea",{className:`${Yi} min-h-20 resize-y`,required:!0,value:B[K.id]??"",onChange:we=>F(Z=>({...Z,[K.id]:we.target.value})),placeholder:"可选择上面的建议,也可补充自己的答案"})}),i.jsx("div",{className:"flex justify-end",children:i.jsx("button",{className:Ul,disabled:a||!B[K.id]?.trim(),children:"保存并回复"})})]},K.id)),(U||e.outbox.length>0)&&i.jsxs("details",{className:"rounded-lg bg-surface-2 px-3",children:[i.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["投递凭证与执行尝试 · ",e.attempts.length," 轮"]}),i.jsxs("div",{className:"space-y-3 pb-3",children:[e.outbox.map(K=>i.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:[K.lastError?`等待重试:${K.lastError}`:"已保存 · 等待投递",K.messageId?` · 消息 ${K.messageId}`:""]},K.id)),e.attempts.map(K=>i.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.jsxs("p",{children:[K.id===e.activeAttemptId?"当前分派":"历史分派"," · ",n(K.assignee)," · ",hl(K.createdAt)]}),i.jsxs("p",{className:"mt-1 break-all font-mono",children:["尝试 ID:",K.id]}),i.jsxs("p",{className:"mt-1",children:[K.deliveryStatus==="delivered"?`已写入终端 · ${K.deliveredAt?hl(K.deliveredAt):""}`:K.deliveryStatus==="failed"||K.deliveryStatus==="expired"?"本次消息投递未成功":"等待写入终端",K.report?` · ${km[K.report.status]}(${hl(K.report.createdAt)})`:""]})]},K.id)),e.deliveries.filter(K=>K.kind!=="task").map(K=>i.jsxs("p",{className:"text-xs text-muted-foreground",children:["后续消息 ",K.messageId," · ",K.status==="delivered"?"已写入终端":"等待投递",K.deliveredAt?` · ${hl(K.deliveredAt)}`:""]},K.id)),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"投递凭证确认终端写入。报告保留成员的原始陈述,验收由你决定。"})]})]}),!!e.artifacts.length&&i.jsxs("section",{className:"space-y-3",children:[i.jsx("h4",{className:"text-xs font-medium text-foreground",children:"方案、结果与独立评审"}),e.artifacts.slice().reverse().map(K=>i.jsxs("details",{open:K.id===Q?.id||K.id===X?.id&&e.approvedPlanArtifactId!==K.id||K.kind==="review"&&K.reviewsArtifactId===Q?.id?!0:void 0,className:`rounded-lg border p-3 ${e.acceptedArtifactId===K.id||e.approvedPlanArtifactId===K.id?"border-primary/35 bg-primary/5":"border-border/20"}`,children:[i.jsxs("summary",{className:"flex min-h-11 cursor-pointer flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"font-medium text-primary",children:K.kind==="result"?"结果":K.kind==="plan"?"方案":"独立评审"}),i.jsx("span",{children:n(K.actor)}),K.verdict&&i.jsx("span",{children:K.verdict==="pass"?"通过":K.verdict==="changes"?"需要修改":"受阻"}),i.jsx("span",{children:hl(K.createdAt)}),K.attemptId!==e.activeAttemptId&&i.jsx("span",{children:"历史分派"}),K.reviewsArtifactId&&i.jsxs("span",{children:["评审版本 ",K.reviewsArtifactId.slice(0,8)]}),e.acceptedArtifactId===K.id&&i.jsx("span",{children:e.completionMode==="reviewed"?"评审通过":"已验收"}),e.approvedPlanArtifactId===K.id&&i.jsx("span",{children:"方案已确认"})]}),i.jsx("p",{className:"mt-2 whitespace-pre-wrap break-words text-xs leading-relaxed text-foreground",children:K.content}),K.evidence!==void 0&&i.jsxs("details",{className:"mt-2 text-xs text-muted-foreground",children:[i.jsx("summary",{className:"min-h-11 cursor-pointer py-3",children:"查看证据"}),i.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(K.evidence,null,2)})]}),G&&K.attemptId===e.activeAttemptId&&K.kind!=="review"&&i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[Q?.id===K.id&&e.workflow?.kind!=="step"&&i.jsxs("button",{type:"button",className:Ul,disabled:a||!!ee||ze.length>0||he||!de||!!qe,onClick:()=>{l({kind:"accept",artifactId:K.id})},children:[i.jsx(Mi,{size:14}),"验收此结果"]}),X?.id===K.id&&e.approvedPlanArtifactId!==K.id&&i.jsxs("button",{type:"button",className:Ul,disabled:a,onClick:()=>{l({kind:"approve-plan",artifactId:K.id})},children:[i.jsx(Mi,{size:14}),"确认此方案"]}),!e.workflow&&i.jsxs(i.Fragment,{children:[i.jsxs("select",{"aria-label":"独立评审成员",className:`${Yi} min-w-0 sm:w-auto`,value:y,onChange:we=>A(we.target.value),children:[i.jsx("option",{value:"",children:"选择独立评审成员"}),r.filter(we=>we.sessionId!==e.memberSessions[Iu(K.actor)]).map(we=>i.jsx("option",{value:we.sessionId,children:we.name},we.sessionId))]}),i.jsx("button",{type:"button",className:zc,disabled:a||!y||y===e.memberSessions[Iu(K.actor)],onClick:()=>{l({kind:"request-review",artifactId:K.id,assigneeSessionId:y})},children:"请求评审此版本"})]})]})]},K.id)),ee&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"已提出修改要求,等待本轮新的结果再验收。"})]}),G&&i.jsxs("section",{className:"space-y-2 border-t border-border/20 pt-3",children:[i.jsx(io,{label:"补充说明或修改要求",children:i.jsx("textarea",{className:`${Yi} min-h-20 resize-y`,value:I,onChange:K=>M(K.target.value),placeholder:"写下需要补充的上下文,或要求成员修改的内容"})}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",className:zc,disabled:a||!I.trim(),onClick:()=>{l({kind:"comment",content:I})},children:"发送补充"}),i.jsx("button",{type:"button",className:zc,disabled:a||!U||!I.trim(),onClick:()=>{l({kind:"revise",content:I})},children:"要求修改"})]})]}),i.jsxs("details",{className:"border-t border-border/20 pt-1",children:[i.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"分派、协调者与归档"}),i.jsxs("div",{className:"space-y-3 pb-2",children:[G&&i.jsxs(i.Fragment,{children:[U&&e.workflow?.kind!=="goal"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[i.jsxs("select",{"aria-label":"任务负责人",className:Yi,value:g,onChange:K=>x(K.target.value),children:[i.jsx("option",{value:"",children:"选择负责人"}),r.map(K=>i.jsx("option",{value:K.sessionId,children:K.name},K.sessionId))]}),i.jsx("button",{type:"button",className:`${Ul} shrink-0`,disabled:a||!g||he,onClick:()=>{l({kind:"assign",assigneeSessionId:g,content:I||void 0})},children:U?"开始新一轮分派":"分派任务"})]}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:he?"依赖任务验收后可分派。":"新分派保留旧记录,并结束旧问题的回答入口。"})]}),i.jsx(io,{label:"协调者",children:i.jsxs("select",{className:Yi,disabled:a||e.workflow?.kind==="step",value:e.coordinator?e.memberSessions[Iu(e.coordinator)]??"":"",onChange:K=>{l({kind:"coordinator",coordinatorSessionId:K.target.value||null})},children:[!e.workflow&&i.jsx("option",{value:"",children:"由用户协调"}),r.map(K=>i.jsx("option",{value:K.sessionId,children:K.name},K.sessionId))]})}),i.jsx("button",{type:"button",className:`${Zi} text-muted-foreground hover:bg-surface-2`,disabled:a,onClick:()=>{l({kind:"close",content:I||void 0})},children:"关闭此任务"}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"关闭会保留历史,也会保留成员的终端工作。"})]}),!G&&i.jsx("button",{type:"button",className:zc,disabled:a,onClick:()=>{l({kind:"reopen"})},children:"重新打开任务"}),i.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[i.jsx("summary",{className:"min-h-11 cursor-pointer py-3",children:"任务标识与来源"}),i.jsxs("p",{className:"select-text break-all",children:["任务:",e.id,i.jsx("br",{}),"来源服务:",e.ownerServiceId,i.jsx("br",{}),"版本:",e.revision]})]})]})]}),i.jsxs("details",{children:[i.jsx("summary",{className:"cursor-pointer py-2 text-xs text-muted-foreground",children:"复制与导出"})," ",i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",className:`${Zi} text-muted-foreground hover:bg-surface-2`,onClick:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(oe)).then(()=>k("任务上下文已复制。")).catch(()=>k("复制失败,请使用导出记录保存任务上下文。"))},children:"复制任务上下文"}),i.jsx("button",{type:"button",className:`${Zi} text-muted-foreground hover:bg-surface-2`,onClick:Re,children:"导出记录"}),w&&i.jsx("span",{role:"status",className:"self-center text-[11px] text-muted-foreground",children:w})]})]}),i.jsxs("details",{className:"border-t border-border/20 pt-1",children:[i.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs font-medium text-foreground",children:["完整时间线 · ",e.events.length," 条"]}),i.jsx("ol",{className:"space-y-3",children:e.events.slice().reverse().map(K=>i.jsxs("li",{className:"border-l-2 border-border/25 pl-3",children:[i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[SQ[K.kind]??K.kind,K.reportStatus?` · ${km[K.reportStatus]}`:""," · ",K.source==="system"?"服务自动接续":n(K.actor)," · ",hl(K.createdAt),K.attemptId&&K.attemptId!==e.activeAttemptId?" · 历史分派":""]}),i.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs leading-relaxed text-foreground",children:K.content}),K.target&&i.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["接收人:",n(K.target),K.artifactId?` · 版本 ${K.artifactId.slice(0,8)}`:""]})]},K.id))})]})]})}function IQ(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?e.slice(0,10):e}function yh(e,t){try{const r=`termdock-workbench:${window.location.origin}:${e}`;return t!==void 0&&localStorage.setItem(r,t),localStorage.getItem(r)}catch{return null}}function EQ(){const e=yh("tab");return e==="automation"||e==="search"?e:"collaboration"}const As="w-full rounded-lg border border-border/20 bg-surface-2 px-3 py-2 text-[12px] text-foreground outline-none transition focus:border-primary/60",Qm="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",Tr="inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-40";function w5(e){const[t,r]=b.useState(null),[n,a]=b.useState(!1),[l,c]=b.useState({}),h=b.useCallback(x=>c(y=>({...x,...y})),[]),p=b.useCallback((x,y)=>c(A=>JSON.stringify(A[x])===JSON.stringify(y)?A:{...A,[x]:y}),[]),g={drafts:l,loadDrafts:h,updateDraft:p};return i.jsxs(i.Fragment,{children:[!n&&i.jsx(A5,{...e,...g,onOpenOverlay:r,onClose:()=>{t?a(!0):e.onClose()}}),t&&i.jsx(A5,{...e,...g,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),n&&e.onClose()}})]})}function A5({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:n,onEnterGroup:a,defaultSessionMode:l="shell",onClose:c,onNewSession:h,overlayOnly:p=!1,onOpenOverlay:g,drafts:x,loadDrafts:y,updateDraft:A}){const w=!!t,[k,E]=b.useState(r);b.useEffect(()=>{E(r)},[r]);const[I,M]=b.useState(!1),[B,F]=b.useState(t),U=Xn(fe=>fe.docks[t??"workbench"]),G=Xn(fe=>fe.hosts[t??"workbench"]),[Q,X]=b.useState("docked"),[ee,ze]=b.useState(null),[he,de]=b.useState({x:16,y:80}),$e=b.useRef(null),[qe]=b.useState(()=>document.createElement("div")),oe=b.useRef({x:.5,y:.5}),[Re,K]=b.useState(null),[we,Z]=b.useState(null);b.useEffect(()=>{let fe=!1;return vl().then(Ve=>{if(fe)return;const nr=zm(Ve.collaborationPanels?.[Qu()],t);nr.position&&(oe.current=nr.position),nr.size&&ze(nr.size),y(nr.drafts??{}),p||X(nr.mode??"docked"),K(nr)}).catch(()=>{fe||Z("面板草稿加载失败,请重新打开面板重试")}),()=>{fe=!0}},[]);const[Ue,Le]=b.useState(null);b.useEffect(()=>{const fe=Ve=>Z(String(Ve.detail));return window.addEventListener("termdock-panel-save-error",fe),()=>{window.removeEventListener("termdock-panel-save-error",fe),p||Xn.getState().setDock(t??"workbench",null)}},[]);const Y=!p&&k&&Q==="docked"&&!!G;b.useLayoutEffect(()=>(qe.className=Y?"h-full min-h-0 w-full min-w-0":"contents",(Y?G:document.body)?.appendChild(qe),()=>qe.remove()),[qe,Y,G]),b.useEffect(()=>{!p&&!k&&Xn.getState().setDock(t??"workbench",null)},[k]);const Ee=async fe=>{if(p||I||fe==="docked"&&!e)return;const Ve={sessionId:e,side:"right"};M(!0);try{await Io({mode:fe,...fe==="docked"?{dock:Ve}:{}},t),X(fe),Xn.getState().setDock(t??"workbench",fe==="docked"?{...Ve,...w?{preferredWidth:360}:{}}:null)}catch{Z("面板布局保存失败,请重试")}finally{M(!1)}},be=b.useRef(!1),Me=b.useRef(null),Ze=b.useCallback((fe,Ve)=>{const nr=$e.current?.getBoundingClientRect(),an=window.visualViewport,Nr=(an?.offsetLeft??0)+12,Ar=(an?.offsetTop??0)+12;return{x:Math.max(Nr,Math.min(fe,Nr+(an?.width??window.innerWidth)-(nr?.width??440)-24)),y:Math.max(Ar,Math.min(Ve,Ar+(an?.height??window.innerHeight)-(nr?.height??340)-24))}},[]),[Se,se]=b.useState(()=>t?"collaboration":EQ()),[Ye,pt]=b.useState(()=>new Set([Se])),rt=fe=>{se(fe),pt(Ve=>new Set([...Ve,fe])),ft(null),Dt(null),!t&&!p&&yh("tab",fe)},[ye,et]=b.useState([]),[ht,te]=b.useState([]),[ve,ct]=b.useState([]),[re,me]=b.useState([]),[je,mt]=b.useState([]),[ae,De]=b.useState(null),[gt,ft]=b.useState(null),[kt,Dt]=b.useState(null);b.useEffect(()=>{if(!kt)return;const fe=setTimeout(()=>Dt(null),5e3);return()=>clearTimeout(fe)},[kt]);const[Yt,xr]=b.useState("loading"),[rr,Ir]=b.useState("loading"),[ne,Ne]=b.useState(null),[tt,jt]=b.useState(null),[Et,dr]=b.useState(),[Jt,We]=b.useState(null),Lr=b.useRef(null),Xe=b.useRef(null),Pt=b.useRef(null),Ge=t?re.find(fe=>fe.id===t)??null:null,It=b.useRef(!1);b.useEffect(()=>{if(t||Yt!=="loaded"||It.current)return;It.current=!0;const fe=yh("group"),Ve=re.find(nr=>nr.id===fe)??re.find(nr=>e&&nr.sessionIds.includes(e))??re[0];F(nr=>nr??Ve?.id??null)},[t,Yt,re,e]),b.useEffect(()=>{!t&&!p&&B&&re.some(fe=>fe.id===B)&&yh("group",B)},[B,re,t,p]);const cn=B?re.find(fe=>fe.id===B)??null:re[0]??null,Lt=!!t&&Yt==="loaded"&&!Ge,Vr=!!Re||!!we,ut=!p&&k&&Q==="docked"&&!!(U??Re?.dock)&&!G,fn=Vr&&!ut&&!!e&&(!t||!!G||!!cn?.sessionIds.includes(e)||!!t&&(Yt!=="loading"&&!Ge||!!we));b.useLayoutEffect(()=>{if(!k||Y||!fn)return;const fe=()=>{const nr=window.visualViewport;Le(nr?.height??window.innerHeight);const an=$e.current?.getBoundingClientRect();!an?.width||!an.height||be.current||de(Ze((nr?.offsetLeft??0)+12+Math.max(0,(nr?.width??window.innerWidth)-an.width-24)*oe.current.x,(nr?.offsetTop??0)+12+Math.max(0,(nr?.height??window.innerHeight)-an.height-24)*oe.current.y))},Ve=new ResizeObserver(fe);return $e.current&&Ve.observe($e.current),window.addEventListener("resize",fe),window.visualViewport?.addEventListener("resize",fe),fe(),()=>{Ve.disconnect(),window.removeEventListener("resize",fe),window.visualViewport?.removeEventListener("resize",fe)}},[k,Y,fn,Ze,Re,ee]),b.useLayoutEffect(()=>{if(p)return;const fe=t??"workbench",Ve=Xn.getState();if(Lt)Ve.docks[fe]&&Ve.setDock(fe,null);else if(Vr&&k&&Q==="docked"&&e&&(!t||Ge)){const nr=Ve.docks[fe],an=!t||Ge?.sessionIds.includes(e)?e:je.find(Bt=>Ge?.sessionIds.includes(Bt.sessionId)&&!s0(Bt.sessionId))?.sessionId??e,Nr=nr??Re?.dock??{sessionId:an,side:window.innerWidth<640?"bottom":"right"},Ar={...Nr,sessionId:Ge?.sessionIds.includes(e)?e:Nr.sessionId,...w?{preferredWidth:nr?.preferredWidth??360}:{}};(!nr||Ar.sessionId!==nr.sessionId||Ar.preferredWidth!==nr.preferredWidth)&&Ve.setDock(fe,Ar),w&&nr&&Ar.sessionId!==nr.sessionId&&Io({dock:{sessionId:Ar.sessionId,side:Ar.side}},t).catch(()=>Z("协作位置保存失败,当前面板仍可使用"))}},[Lt,Ge,k,Q,Re,Vr,e,t,U,je]);const Sr=async(fe,Ve=!1)=>{if(!(I||fe&&!cn)){if(!p&&!fe&&!Ve&&U){g("full");return}if(p){Ve?c():(E(fe),g(fe?"floating":"full"));return}M(!0);try{await n?.(fe?cn.id:null),E(fe),fe&&Q==="docked"&&e&&Xn.getState().setDock(t??"workbench",{sessionId:e,side:U?.side??Re?.dock?.side??"right"}),Ve&&c()}catch(nr){ft(`常驻浮窗状态保存失败,请重试:${nr instanceof Error?nr.message:"连接失败"}`)}finally{M(!1)}}},Pr=b.useCallback(fe=>{me(fe.groups),mt(fe.sessions),dr(fe.peers),jt(null),xr("loaded")},[]);b.useEffect(()=>mb(Pr),[Pr]);const br=b.useCallback(async(fe={})=>{fe.silent||ft(null),!w&&!Xe.current&&(Xe.current=b8().then(Ve=>{et(Ve.automations),te(Ve.runs),Ir("loaded"),Ne(null)}).catch(Ve=>{Ir("error"),Ne(Ve instanceof Error?Ve.message:"自动任务加载失败")}).finally(()=>{Xe.current=null})),Pt.current||(Pt.current=pb().then(Ve=>{ct(Ve),We(null)}).catch(()=>{We("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{Pt.current=null})),Lr.current||(xr(Ve=>Ve==="error"?"loading":Ve),Lr.current=gb().then(Pr).catch(Ve=>{xr("error"),jt(`协作会话加载失败:${Ve instanceof Error?Ve.message:"请重试"}`)}).finally(()=>{Lr.current=null})),await Promise.all([Lr.current,Xe.current])},[Pr,w]);b.useEffect(()=>{br();const fe=window.setInterval(()=>{br({silent:!0})},1e4);return()=>window.clearInterval(fe)},[br]),b.useEffect(()=>{const fe=Ve=>{Ve.key==="Escape"&&!Ve.defaultPrevented&&!k&&c()};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[c,k]);const pe=fe=>{w&&fe&&fe!==t&&re.some(Ve=>Ve.id===fe)&&a?a(fe).catch(Ve=>ft(Ve instanceof Error?Ve.message:"无法打开工作区")):F(fe)},Er=async fe=>{await FQ(fe)};return Ai.createPortal(i.jsxs(i.Fragment,{children:[!k&&i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:c,"aria-label":"关闭 Agent 工作台"}),i.jsxs("section",{onPointerDown:fe=>{Y&&fe.stopPropagation()},ref:$e,"aria-label":Y?"工作组消息分屏":k?"工作组消息浮窗":"Agent 工作台",style:k&&!Y?{display:fn?void 0:"none",left:he.x,top:he.y,...ee?{width:`min(calc(100vw - 24px), max(280px, ${ee.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${ee.height*100}dvh))`}:{},maxHeight:Ue?Ue-24:"calc(100dvh - 24px)"}:void 0,className:Y?"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface":k?"fixed z-menu-panel flex w-[min(400px,calc(100vw-24px))] flex-col overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-xl":"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))] h-[calc(var(--app-visible-vh,100dvh)-max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))-max(1.5rem,env(safe-area-inset-bottom,0px)))] z-modal-panel mx-auto flex max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[calc(var(--app-visible-vh,100dvh)*0.08)] sm:h-[calc(var(--app-visible-vh,100dvh)*0.84)]",children:[i.jsxs("header",{"data-pane-titlebar":Y?"true":void 0,"data-panel-drag-title":Y?"true":void 0,onDragStart:fe=>fe.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${Y?"min-h-9 shrink-0 cursor-grab select-none bg-[var(--chrome-bg)] px-3 active:cursor-grabbing":k?"px-3 py-2 cursor-move touch-none select-none":"px-4 py-3"}`,onPointerDown:fe=>{!k||Y||fe.button!==0||fe.target.closest("button, summary")||(Me.current={x:fe.clientX,y:fe.clientY,left:he.x,top:he.y},fe.currentTarget.setPointerCapture?.(fe.pointerId))},onPointerMove:fe=>{Me.current&&de(Ze(Me.current.left+fe.clientX-Me.current.x,Me.current.top+fe.clientY-Me.current.y))},onPointerUp:()=>{if(!Me.current)return;Me.current=null;const fe=$e.current?.getBoundingClientRect(),Ve=window.visualViewport;fe&&(oe.current=xg(he.x,he.y,(Ve?.offsetLeft??0)+12,(Ve?.offsetTop??0)+12,(Ve?.width??window.innerWidth)-fe.width-24,(Ve?.height??window.innerHeight)-fe.height-24),Io({position:oe.current},t).catch(()=>Z("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{Me.current=null},children:[i.jsx(Ku,{size:Y?13:17,className:"shrink-0 text-primary"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{className:`${k?"truncate text-[12px]":"text-[14px]"} font-semibold text-foreground`,title:Y?"拖动标题移动面板;放在边缘拆分,中央交换":Ge?.name,children:Ge?Ge.name:t?"协作工作区":"Agent 工作台"}),!Y&&!w&&i.jsx("p",{className:"text-[10px] text-muted-foreground",children:k?"引用、文件路径和粘贴优先加入此处":Ge?"分派任务、回答问题、审阅与验收结果":"自动任务、会话协作与历史搜索"})]}),!Y&&Se==="collaboration"&&re.length>0&&i.jsx("button",{className:`${Tr} shrink-0 text-primary hover:bg-primary/10`,disabled:I,onClick:()=>{Sr(!k)},children:k?"展开":"放到终端旁"}),w&&Ge&&i.jsxs("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:[Ge.sessionIds.length," 人"]}),Y&&i.jsxs("details",{className:"relative z-20 shrink-0",children:[i.jsx("summary",{"aria-label":"面板布局",title:"面板布局",className:"flex min-h-8 cursor-pointer list-none items-center rounded px-2 text-muted-foreground hover:bg-surface-2 [&::-webkit-details-marker]:hidden",children:i.jsx(wl,{size:16})}),i.jsxs("div",{className:"absolute right-0 top-full z-30 w-36 rounded-lg border border-border/20 bg-surface-2 p-1 shadow-lg",children:[i.jsxs("button",{type:"button",disabled:I,className:`${Tr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:fe=>{fe.currentTarget.closest("details")?.removeAttribute("open"),g("full")},children:[i.jsx(Xw,{size:14}),"展开查看"]}),i.jsxs("button",{type:"button",disabled:I,className:`${Tr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:fe=>{fe.currentTarget.closest("details")?.removeAttribute("open"),Ee("floating")},children:[i.jsx(Xu,{size:14}),"小浮窗"]})]})]}),i.jsx("button",{className:`${Y?"min-h-8 rounded px-2":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:I,onClick:()=>{k?Sr(!1,!0):c()},"aria-label":"关闭",children:i.jsx(Kn,{size:16})})]}),k&&!Y&&!p&&i.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border/15 px-3 py-1.5",children:[i.jsx("button",{type:"button",disabled:I,"aria-pressed":Q==="floating",className:`${Qm} ${Q==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Ee("floating")},children:"浮窗"}),i.jsx("button",{type:"button",disabled:I||!e||Lt,"aria-pressed":Q==="docked",className:`${Qm} ${Q==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Ee("docked")},children:"放到终端旁"})]}),!w&&(!k||Y)&&i.jsx("nav",{"aria-label":"工作台功能",className:"grid shrink-0 grid-cols-3 gap-1 border-b border-border/15 px-2 py-1",children:[["collaboration",i0,"协作组"],["automation",Ru,"自动任务"],["search",o0,"历史搜索"]].map(([fe,Ve,nr])=>i.jsxs("button",{type:"button","aria-pressed":Se===fe,"aria-controls":`workbench-${fe}`,onClick:()=>rt(fe),className:`${Tr} ${Se===fe?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[i.jsx(Ve,{size:14}),nr]},fe))}),Se==="collaboration"&&tt&&i.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[tt,i.jsx("button",{className:`${Tr} ml-2`,onClick:()=>{br()},children:"重新加载会话"})]}),!w&&Se!=="search"&&Jt&&i.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:Jt}),gt&&i.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:gt}),kt&&(!k||Y)&&i.jsxs("div",{role:"status",className:"mx-3 mt-2 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[i.jsx(Mi,{size:13}),kt]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[Ye.has("automation")&&i.jsx("div",{id:"workbench-automation",className:Se==="automation"?"h-full min-h-0 p-4":"hidden",children:i.jsx(NQ,{automations:ye,runs:ht,agents:ve,sessions:je.filter(fe=>!s0(fe.sessionId)),activeSessionId:e,loading:rr==="loading",loadError:ne,busy:ae,setBusy:De,setError:ft,setNotice:Dt,refresh:br,onClose:c})}),Ye.has("collaboration")&&i.jsxs("div",{id:"workbench-collaboration",className:Se==="collaboration"?`h-full min-h-0 overflow-x-hidden overflow-y-auto overscroll-y-contain ${k?"p-3":"p-4"}`:"hidden",children:[!Re&&!we&&i.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),t&&!Ge&&i.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[i.jsx("p",{children:Yt==="loading"?"正在加载协作组…":Yt==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),Yt!=="loading"&&i.jsx("button",{className:Tr,onClick:()=>{br()},children:"重新加载"})]}),we&&i.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:we}),Re&&(!t||Ge)&&i.jsx(MQ,{active:Se==="collaboration",notice:kt,initialDrafts:x,onDraftChange:A,docked:Y,inputKeySuffix:p?":overlay":"",selectedGroupId:B,setSelectedGroupId:pe,floatingVisible:fn,floating:k,sessionsState:Yt,groups:re,sessions:je,agents:ve,activeSessionId:e,initialGroupId:t,onOpenSession:async fe=>{await Er(fe),k||c()},onOpenTaskSession:Er,onEnterGroup:a,defaultSessionMode:l,busy:ae,setBusy:De,setError:ft,setNotice:Dt,refresh:br}),!w&&Et&&i.jsx(jQ,{peers:Et,currentGroupId:cn?.id,busy:ae,setBusy:De,setError:ft,setNotice:Dt,onSelectGroup:pe})]}),Ye.has("search")&&i.jsx("div",{id:"workbench-search",className:Se==="search"?"h-full min-h-0 overflow-y-auto overscroll-y-contain p-4":"hidden",children:i.jsx(WQ,{active:Se==="search",onClose:c,onNewSession:h,setError:ft})})]}),k&&!Y&&i.jsx("button",{type:"button","aria-label":"调整协作浮窗大小",className:"absolute bottom-0 right-0 h-4 w-4 cursor-nwse-resize touch-none text-muted-foreground hover:text-primary",onPointerDown:fe=>{fe.preventDefault(),be.current=!0,fe.currentTarget.setPointerCapture(fe.pointerId)},onPointerMove:fe=>{if(!fe.currentTarget.hasPointerCapture(fe.pointerId))return;const Ve=window.visualViewport,nr=Ve?.width??window.innerWidth,an=Ve?.height??window.innerHeight;ze({width:Math.min(1,Math.max(280,fe.clientX-he.x)/nr),height:Math.min(1,Math.max(220,fe.clientY-he.y)/an)})},onPointerUp:()=>{be.current=!1;const fe=$e.current?.getBoundingClientRect(),Ve=window.visualViewport;fe&&(oe.current=xg(he.x,he.y,(Ve?.offsetLeft??0)+12,(Ve?.offsetTop??0)+12,(Ve?.width??window.innerWidth)-fe.width-24,(Ve?.height??window.innerHeight)-fe.height-24)),ee&&Io({size:ee,position:oe.current},t).catch(()=>Z("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{be.current=!1},onKeyDown:fe=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(fe.key))return;fe.preventDefault();const Ve=$e.current?.getBoundingClientRect(),nr={width:Math.max(.15,Math.min(1,(ee?.width??(Ve?.width??400)/window.innerWidth)+(fe.key==="ArrowRight"?.03:fe.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,(ee?.height??(Ve?.height??300)/window.innerHeight)+(fe.key==="ArrowDown"?.03:fe.key==="ArrowUp"?-.03:0)))};ze(nr),Io({size:nr},t).catch(()=>Z("浮窗大小保存失败,请重试"))},children:i.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),qe)}function NQ({automations:e,runs:t,agents:r,sessions:n,activeSessionId:a,loading:l,loadError:c,busy:h,setBusy:p,setError:g,setNotice:x,refresh:y,onClose:A}){const[w,k]=b.useState(null),[E,I]=b.useState(!1),[M,B]=b.useState(null),F=async(U,G,Q)=>{p(U),g(null),x(null);try{await G(),await y(),x(Q)}catch(X){g(X instanceof Error?X.message:"操作失败")}finally{p(null)}};return E?i.jsx(RQ,{agents:r,sessions:n,activeSessionId:a,initial:w,onCancel:()=>{k(null),I(!1),g(null)},onSaved:async(U,G)=>{k(null),I(!1),await y(),x(w?`“${U}”已更新`:G?`“${U}”已创建,将按计划自动运行`:`“${U}”已创建,当前未启用`)},setError:g},w?.id??"new"):i.jsxs("div",{className:"h-full space-y-4 overflow-y-auto overscroll-y-contain",children:[c&&i.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["自动任务同步失败:",c,i.jsx("button",{className:Tr,onClick:()=>{y()},children:"重新加载"})]}),i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),i.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"定时发送任务,打开运行会话查看输出。"})]}),!E&&e.length>0&&i.jsxs("button",{className:`${Tr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{k(null),I(!0),x(null)},children:[i.jsx(Os,{size:13}),"新建任务"]})]}),l&&i.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在加载自动任务…"}),!l&&!c&&e.length===0&&i.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[i.jsx(p9,{size:24,className:"mx-auto text-primary"}),i.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),i.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"写清任务内容,选择运行频率。创建后可以先手动运行一次确认效果。"}),i.jsxs("button",{className:`${Tr} mt-4 bg-primary text-primary-foreground`,onClick:()=>I(!0),children:[i.jsx(Os,{size:13}),"创建第一个任务"]})]}),i.jsx("div",{className:"space-y-2",children:e.map(U=>{const G=t.filter(X=>X.automationId===U.id).sort((X,ee)=>ee.startedAt-X.startedAt)[0],Q=r.find(X=>X.command===U.command);return i.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:U.name}),i.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${U.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:U.enabled?"已启用":"已停用"}),U.lastRunStatus&&i.jsx("span",{className:`text-[10px] ${ZQ(U.lastRunStatus)}`,children:YQ(U.lastRunStatus)})]}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Ru,{size:11}),VQ(U)]}),i.jsx("span",{children:U.enabled&&U.nextRunAt?`下次 ${qh(U.nextRunAt)}`:"不会自动运行"})]}),i.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:U.targetSessionId?`发送到 ${n.find(X=>X.sessionId===U.targetSessionId)?.name??"指定会话"}`:`新建 ${Q?.displayName??"Agent"} 会话 · ${U.cwd}`}),i.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:U.prompt}),U.lastRunAt&&i.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",qh(U.lastRunAt),U.lastRunMessage?` · ${U.lastRunMessage}`:""]})]}),i.jsx("button",{"aria-label":`编辑 ${U.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{k(U),I(!0),x(null)},children:i.jsx(sh,{size:13})})]}),i.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:M===U.id?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),i.jsx("button",{className:`${Tr} bg-surface-elevated text-foreground`,onClick:()=>B(null),children:"取消"}),i.jsxs("button",{disabled:h!==null,className:`${Tr} bg-destructive text-destructive-foreground`,onClick:()=>{F(`delete:${U.id}`,()=>y8(U.id),`“${U.name}”已删除`).then(()=>B(null))},children:[h===`delete:${U.id}`?i.jsx(Jn,{size:13,className:"animate-spin"}):i.jsx(ni,{size:13}),"确认删除"]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:`${Tr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>B(U.id),children:[i.jsx(ni,{size:13}),"删除"]}),i.jsxs("button",{disabled:h!==null,className:`${Tr} ${U.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{F(`toggle:${U.id}`,()=>v8(U.id,!U.enabled),U.enabled?`“${U.name}”已暂停,不会自动运行`:`“${U.name}”已恢复,将按原计划运行`)},children:[h===`toggle:${U.id}`?i.jsx(Jn,{size:13,className:"animate-spin"}):U.enabled?i.jsx(wA,{size:13}):i.jsx(Zp,{size:13}),U.enabled?"暂停":"恢复"]}),G?.frontendSessionId&&i.jsxs("button",{className:`${Tr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:G.frontendSessionId})),A()},children:[i.jsx(Xu,{size:13}),"打开上次会话"]}),i.jsxs("button",{disabled:h!==null,className:`${Tr} bg-primary/15 text-primary`,onClick:()=>{F(`run:${U.id}`,()=>w8(U.id),`“${U.name}”已投递,可打开会话查看进度`)},children:[h===`run:${U.id}`?i.jsx(Jn,{size:13,className:"animate-spin"}):i.jsx(Zp,{size:13}),"立即运行"]})]})})]},U.id)})})]})}function RQ({agents:e,sessions:t,activeSessionId:r,initial:n,onCancel:a,onSaved:l,setError:c}){const[h,p]=b.useState(n?.name??""),g=t.find(re=>re.sessionId===r),x=n?.cwd??g?.cwd??t[0]?.cwd??"",[y,A]=b.useState(x),w=b.useRef(!1),[k,E]=b.useState(!1),[I,M]=b.useState(()=>e.find(re=>re.command===n?.command)?.slug??""),[B,F]=b.useState(n?.prompt??""),[U,G]=b.useState(n?.targetSessionId??""),[Q,X]=b.useState(n?.targetSessionId?"existing":"new"),[ee,ze]=b.useState(n?.schedule.kind??"interval"),[he,de]=b.useState(n?.schedule.kind==="interval"?n.schedule.everyMinutes:60),[$e,qe]=b.useState(n?.schedule.kind==="daily"?n.schedule.time:"09:00"),[oe,Re]=b.useState(n?.schedule.kind==="daily"?n.schedule.weekdays:[1,2,3,4,5]),[K,we]=b.useState(()=>n?.schedule.kind==="interval"?![15,60,1440].includes(n.schedule.everyMinutes):!!n&&!["1,2,3,4,5","0,1,2,3,4,5,6"].includes([...n.schedule.weekdays].sort().join())),[Z,Ue]=b.useState(!1),[Le,Y]=b.useState(n?.enabled??!0),[Ee,be]=b.useState(!1),Me=e.find(re=>re.slug===I)??null,Ze=Me?.command??n?.command??"";b.useEffect(()=>{if(!I){const re=n?e.find(me=>me.command===n.command):e[0];re&&M(re.slug)}},[e,n,I]),b.useEffect(()=>{!n&&!w.current&&x&&A(x)},[n,x]);const Se=h.trim()||Array.from(B.trim().split(`
142
+ `)[0].trim()).slice(0,40).join(""),se=t.find(re=>re.sessionId===U),Ye=K?`custom-${ee}`:ee==="interval"?String(he):oe.length===7?"daily":"workdays",pt=re=>{we(re.startsWith("custom-")),["15","60","1440","custom-interval"].includes(re)?(ze("interval"),re!=="custom-interval"&&de(Number(re))):(ze("daily"),re==="daily"&&Re([0,1,2,3,4,5,6]),re==="workdays"&&Re([1,2,3,4,5]))},rt=async()=>{if(!(Ee||!ct)){be(!0),c(null);try{await E8({id:n?.id,name:Se,cwd:y,command:Q==="new"?Ze:"",prompt:B,targetSessionId:Q==="existing"&&U||null,enabled:Le,schedule:ee==="interval"?{kind:ee,everyMinutes:he}:{kind:ee,time:$e,weekdays:oe}}),await l(Se,Le)}catch(re){c(re instanceof Error?re.message:"保存失败")}finally{be(!1)}}},ye=ee==="interval"?{kind:ee,everyMinutes:he}:{kind:ee,time:$e,weekdays:oe},[et,ht]=$e.split(":"),te=(re,me)=>qe(`${re}:${me}`),ve=B.trim()?Q==="existing"&&!t.some(re=>re.sessionId===U)?"请选择当前服务的可用会话":Q==="new"&&!Ze?"请选择可启动的 Agent":ee==="interval"&&(!Number.isInteger(he)||he<1||he>43200)?"间隔需要是 1–43200 分钟的整数":ee==="daily"&&!oe.length?"至少选择一天":"":"请填写任务内容",ct=!ve;return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 pb-3",children:[i.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:n?"编辑自动任务":"创建自动任务"}),i.jsx("button",{disabled:Ee,className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground disabled:opacity-40",onClick:a,"aria-label":"关闭任务表单",children:i.jsx(Kn,{size:14})})]}),i.jsx("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain pb-4",children:i.jsxs("fieldset",{disabled:Ee,className:"min-w-0 space-y-4",children:[i.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["任务内容",i.jsx("textarea",{autoFocus:!0,className:`${As} min-h-24 resize-y`,rows:3,value:B,onChange:re=>F(re.target.value),placeholder:"例如:检查当前项目的待办,整理需要我处理的问题。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["运行频率",i.jsxs("select",{className:As,value:Ye,onChange:re=>pt(re.target.value),children:[i.jsx("option",{value:"15",children:"每 15 分钟"}),i.jsx("option",{value:"60",children:"每小时"}),i.jsx("option",{value:"1440",children:"每 24 小时"}),i.jsx("option",{value:"daily",children:"每天定时"}),i.jsx("option",{value:"workdays",children:"工作日定时"}),i.jsx("option",{value:"custom-interval",children:"自定义间隔"}),i.jsx("option",{value:"custom-daily",children:"自定义星期"})]})]}),ee==="interval"&&K&&i.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["每隔多少分钟",i.jsx("input",{className:`${As} min-w-0 flex-1`,type:"number",min:1,max:43200,value:he,onChange:re=>de(Number(re.target.value))})]}),ee==="daily"&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center rounded-lg border border-border/20 bg-surface-2 px-3 py-1.5 focus-within:border-primary/60",children:[i.jsx(Ru,{size:14,className:"mr-2 shrink-0 text-primary"}),i.jsx(T5,{label:"小时",value:et,options:24,onChange:re=>te(re,ht)}),i.jsx("span",{"aria-hidden":"true",className:"px-2 text-[16px] text-muted-foreground",children:":"}),i.jsx(T5,{label:"分钟",value:ht,options:60,onChange:re=>te(et,re)}),i.jsx("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground",children:"24 小时制"})]}),K&&i.jsx("div",{className:"grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((re,me)=>{const je=oe.includes(me);return i.jsx("button",{type:"button","aria-pressed":je,"aria-label":`星期${re}`,className:`rounded-lg py-2.5 text-[11px] transition ${je?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>Re(mt=>je?mt.filter(ae=>ae!==me):[...mt,me].sort()),children:re},me)})}),oe.length===0&&i.jsx("p",{className:"text-[10px] text-destructive",children:"至少选择一天"})]})]}),i.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[i.jsxs("p",{className:"flex items-center gap-1.5",children:[i.jsx(Ku,{size:13,className:"shrink-0"}),Q==="new"?`每次新建会话 · ${Me?.displayName??(n?.command?"原 Agent":"暂无可用 Agent")}`:`发送到现有会话 · ${se?.name??"目标会话不可用"}`]}),i.jsx("p",{className:"break-all pl-[19px] text-[10px]",children:Q==="new"?y||"默认使用当前目录":"直接写入终端,目标会话需保持在线"})]}),i.jsxs("div",{className:"border-t border-border/15 pt-2",children:[i.jsxs("button",{type:"button","aria-expanded":Z,"aria-controls":"automation-more-settings",className:`${Tr} -ml-2 px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>Ue(re=>!re),children:[i.jsx(Jo,{size:13,className:`transition-transform ${Z?"rotate-180":""}`}),"更多设置"]}),Z&&i.jsxs("div",{id:"automation-more-settings",className:"space-y-3 pt-2",children:[i.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称(可选)",i.jsx("input",{className:As,value:h,onChange:re=>p(re.target.value),placeholder:Se||"留空则从任务内容自动生成"})]}),i.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["运行方式",i.jsxs("select",{className:As,value:Q,onChange:re=>{const me=re.target.value;X(me),me==="existing"&&!U&&G(g?.sessionId??t[0]?.sessionId??"")},children:[i.jsx("option",{value:"new",children:"每次新建会话"}),i.jsx("option",{value:"existing",disabled:t.length===0,children:"发送到现有会话"})]})]}),Q==="new"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[i.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",i.jsxs("select",{className:As,value:I,onChange:re=>M(re.target.value),children:[n&&!e.some(re=>re.command===n.command)&&i.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(re=>i.jsxs("option",{value:re.slug,children:[re.displayName,re.isPlugin?" · Plugin":""]},re.slug))]})]}),i.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["工作目录",i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{className:`${As} min-w-0`,value:y,onChange:re=>{w.current=!0,A(re.target.value)},placeholder:"默认使用当前目录"}),i.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${Tr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>E(!0),children:[i.jsx(Jc,{size:13}),"选择"]})]})]})]}),e.length===0&&i.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):i.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",i.jsxs("select",{className:As,value:U,onChange:re=>G(re.target.value),children:[!se&&i.jsx("option",{value:U,children:U?"原目标会话不可用,请重新选择":"请选择会话"}),t.map(re=>i.jsxs("option",{value:re.sessionId,children:[re.name," · ",vh(re)]},re.sessionId))]}),i.jsx("span",{className:"block leading-relaxed",children:"仅支持当前服务的会话。运行时会直接写入终端,请确保目标会话保持在线。"})]}),i.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[i.jsx("input",{type:"checkbox",checked:Le,onChange:re=>Y(re.target.checked)}),"保存后启用"]})]})]})]})}),i.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border/15 pt-3",children:[i.jsx("p",{role:"status",className:"mr-auto min-w-0 flex-[1_1_160px] text-[10px] text-muted-foreground",children:ve||(Le?`${n?"下次运行":"首次运行"}:${qh(qQ(ye,Date.now(),n?.createdAt))}`:"保存后暂停,不会自动运行")}),i.jsx("button",{disabled:Ee,className:`${Tr} bg-surface-2 text-foreground`,onClick:a,children:"取消"}),i.jsx("button",{title:ve||void 0,disabled:Ee||!ct,className:`${Tr} bg-primary text-primary-foreground`,onClick:()=>{rt()},children:Ee?"保存中…":n?"保存修改":"创建任务"})]}),i.jsx(I1,{open:k,initialPath:y||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>E(!1),onConfirm:re=>{w.current=!0,A(re),E(!1)}})]})}function T5({label:e,value:t,options:r,onChange:n}){return i.jsxs("label",{className:"relative min-w-0 flex-1",children:[i.jsx("span",{className:"sr-only",children:e}),i.jsx("select",{"aria-label":e,className:"w-full appearance-none bg-transparent py-1 pl-1 pr-7 text-center text-[18px] font-semibold tabular-nums text-foreground outline-none",value:t,onChange:a=>n(a.target.value),children:Array.from({length:r},(a,l)=>{const c=String(l).padStart(2,"0");return i.jsx("option",{value:c,children:c},c)})}),i.jsx(Jo,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function MQ({active:e,notice:t,initialDrafts:r,onDraftChange:n,docked:a,inputKeySuffix:l,selectedGroupId:c,setSelectedGroupId:h,floatingVisible:p,floating:g,sessionsState:x,groups:y,sessions:A,agents:w,activeSessionId:k,initialGroupId:E,onOpenSession:I,onOpenTaskSession:M,onEnterGroup:B,defaultSessionMode:F,busy:U,setBusy:G,setError:Q,setNotice:X,refresh:ee}){const[ze,he]=b.useState("tasks"),[de,$e]=b.useState(0);b.useEffect(()=>$e(0),[c]);const[qe,oe]=b.useState(""),[Re,K]=b.useState(()=>new Set(k?[k]:[])),[we,Z]=b.useState(""),[Ue,Le]=b.useState(()=>new Set),[Y,Ee]=b.useState(!1),[be,Me]=b.useState(),[Ze,Se]=b.useState([]),[se,Ye]=b.useState(!1),[pt,rt]=b.useState(null),[ye,et]=b.useState("all"),[ht,te]=b.useState(!1),[ve,ct]=b.useState(new Set),[re,me]=b.useState(null),[je,mt]=b.useState(""),[ae,De]=b.useState(!1),[gt,ft]=b.useState(!1),[kt,Dt]=b.useState(null),[Yt,xr]=b.useState(new Set),[rr,Ir]=b.useState(),[ne,Ne]=b.useState({}),[tt,jt]=b.useState(!1),[Et,dr]=b.useState(""),[Jt,We]=b.useState(""),[Lr,Xe]=b.useState(""),[Pt,Ge]=b.useState(""),It=b.useRef(null),cn=a,Lt=(c??y[0]?.id??"")+l,Vr=b.useRef(!1),ut=c==="new"?null:(c?y.find(W=>W.id===c):y[0])??null,fn=ut?.sessionIds.flatMap(W=>{const Be=A.find(wt=>wt.sessionId===W);return Be?[Be]:[]})??[],[Sr,Pr]=b.useState(0),br=b.useRef(new Map(Object.entries(r??{}))),pe=b.useRef(void 0),Er=b.useRef(!1),fe=b.useRef(re);fe.current=re;const Ve=b.useRef(je);Ve.current=je,b.useLayoutEffect(()=>{if(pe.current===ut?.id)return;if(pe.current){const Be={content:Ve.current,targets:re};br.current.set(pe.current,Be),Io({drafts:{[pe.current]:Be}}).catch(()=>Q("草稿保存失败,请返回该组重试"))}pe.current=ut?.id,Er.current=!0;const W=br.current.get(ut?.id??"");mt(W?.content??""),me(W?.targets??null)},[ut?.id]),b.useEffect(()=>{Dt(null)},[ut?.id]);const nr=b.useRef(null),an=b.useRef(r);b.useLayoutEffect(()=>{if(an.current===r)return;an.current=r;for(const[Be,wt]of Object.entries(r??{}))br.current.set(Be,wt);const W=r?.[ut?.id??""];!W||W.content===Ve.current&&JSON.stringify(W.targets)===JSON.stringify(fe.current)||(Er.current=!0,nr.current=null,mt(W.content),me(W.targets))},[r,ut?.id]);const Nr=b.useCallback(W=>{Io(W).catch(()=>Q("草稿保存失败,请保持面板打开,修改内容后重试"))},[Q]);b.useEffect(()=>{if(Er.current){Er.current=!1;return}if(!ut||pe.current!==ut.id)return;const W={drafts:{[ut.id]:{content:je,targets:re}}};n(ut.id,W.drafts[ut.id]),nr.current=W;const Be=setTimeout(()=>{nr.current=null,Nr(W)},400);return()=>{clearTimeout(Be)}},[ut?.id,je,re,Nr]),b.useEffect(()=>{const W=()=>{nr.current&&(Nr(nr.current),nr.current=null)},Be=()=>{document.visibilityState==="hidden"&&W()};return document.addEventListener("visibilitychange",Be),window.addEventListener("pagehide",W),()=>{document.removeEventListener("visibilitychange",Be),window.removeEventListener("pagehide",W),W()}},[Nr]),b.useEffect(()=>{if(!(!g||!p||!ut||ze!=="messages"))return A8(W=>{he("messages"),mt(Be=>Be+(Be&&!/\s$/.test(Be)?`
143
+ `:"")+W.replace(/\r\n?/g,`
144
+ `))},Lt,cn)},[g,p,ut?.id,cn,Lt,ze]),b.useEffect(()=>{const W=It.current;if(!g||!W)return;const Be=wt=>Q(String(wt.detail));return W.addEventListener("termdock:file-drop-error",Be),()=>W.removeEventListener("termdock:file-drop-error",Be)},[g,ut?.id,Q]);const Ar=async W=>{const Be=ut?.id;Q(null),Pr(wt=>wt+1);try{const wt=await Zu("/tmp",W);if(wt.files.length!==W.length||wt.files.some(Rt=>!Rt.path))throw new Error("文件路径准备失败,请重试");const yr=wt.files.map(Rt=>Gc(Rt.path)).join(" ")+" ";if(pe.current===Be)mt(Rt=>Rt+(Rt&&!/\s$/.test(Rt)?`
145
+ `:"")+yr);else if(Be){const Rt=br.current.get(Be)??{content:"",targets:null},Mr={...Rt,content:Rt.content+`
146
+ `+yr};br.current.set(Be,Mr),Nr({drafts:{[Be]:Mr}})}}catch(wt){Q(wt instanceof Error?wt.message:"文件上传失败")}finally{Pr(wt=>wt-1)}},Bt=new Set(A.filter(Rp).map(W=>W.sessionId)),Rr=Re.size,fs=[...Re].filter(W=>!Bt.has(W)),Xr=PQ(ut,A),pn=we.trim().toLocaleLowerCase(),mn=A.filter(W=>!pn||[W.name,W.serviceLabel??"",W.cwd,Dp(W.currentTask)].some(Be=>Be.toLocaleLowerCase().includes(pn))),An=C5(mn),Rn=C5(Xr),dn=W=>!pn&&Ue.has(W),Mn=W=>Le(Be=>{const wt=new Set(Be);return wt.has(W)?wt.delete(W):wt.add(W),wt});b.useEffect(()=>{De(!1),ft(!1),jt(!1),Ee(!1),Ne({});try{ct(new Set(JSON.parse(localStorage.getItem(`collab-seen:${ut?.id}`)??"[]")))}catch{ct(new Set)}xr(new Set(ut?.sessionIds??[]))},[ut?.id]),b.useEffect(()=>{!Et&&w[0]&&dr(w[0].slug)},[w,Et]),b.useEffect(()=>{Se([]),rt(null)},[ut?.id]),b.useEffect(()=>{if(!E||!e||g&&!p||!ut){Ye(!1);return}Ye(!0);let W=!1,Be=0;const wt=()=>{const Rt=++Be;ag(ut.id).then(Mr=>{!W&&Rt===Be&&(Se(Mr.messages),rt(null))}).catch(Mr=>{!W&&Rt===Be&&rt(Mr instanceof Error?Mr.message:"消息加载失败")}).finally(()=>{!W&&Rt===Be&&Ye(!1)})};wt();const yr=window.setInterval(wt,3e3);return()=>{W=!0,window.clearInterval(yr)}},[ut?.id,e,g,p]),b.useEffect(()=>{!E||ut?.id!==E||Vr.current||(Vr.current=!0,ze==="messages"&&It.current?.scrollIntoView?.({block:"nearest"}))},[E,ut?.id]);const bn=async()=>{G("create-group"),Q(null),X(null);try{if(fs.length)throw new Error("所选会话已变化,请先清除不可用选择");const W=await fc({name:qe,sessionIds:[...Re]});oe(""),Z(""),h(W.group.id),await ee(),X(`“${W.group.name}”已创建,${W.group.sessionIds.length} 个会话可以开始协作`),B&&await B(W.group.id)}catch(W){Q(W instanceof Error?W.message:"创建失败")}finally{G(null)}},_n=ut?.sessionIds.filter(W=>re===null||re.includes(W))??[],Dn=async()=>{if(!ut||U||Sr||!je.trim()||!_n.length)return;const W=je,Be=ut.id;G("send-message"),Q(null),X(null);try{const wt=await C8(ut.id,{fromSessionId:null,toSessionIds:re===null?void 0:_n,kind:"message",content:je});if(pe.current===Be){const Dr=Ve.current,Zr=Dr===W?"":Dr.startsWith(W)?Dr.slice(W.length).replace(/^\n/,""):Dr;mt(Zr),Nr({drafts:{[Be]:{content:Zr,targets:fe.current}}})}else{const Dr=br.current.get(Be);if(Dr){const Zr={...Dr,content:Dr.content===W?"":Dr.content.startsWith(W)?Dr.content.slice(W.length).replace(/^\n/,""):Dr.content};br.current.set(Be,Zr),Nr({drafts:{[Be]:Zr}})}}const yr=await ag(Be).catch(()=>null);yr&&pe.current===Be&&Se(yr.messages);const Rt=wt.deliveries?.filter(Dr=>Dr.serviceUnavailable).length??0,Mr=wt.deliveries?.filter(Dr=>Dr.pending>0).length??0;X(Rt>0?`已保存消息;${Rt} 个接收成员的服务不可达,尚未送达,等待重连`:Mr>0?`已保存消息;${Mr} 个成员等待投递确认`:`消息已送达 ${wt.messages.length} 个会话`)}catch(wt){Q(wt instanceof Error?wt.message:"发送失败")}finally{G(null)}},kn=async()=>{if(!ut)return;G(`delete:${ut.id}`),Q(null),X(null);const W=ut.name;try{await Yp(ut.id,be),h(null),Ee(!1),await ee(),X(`“${W}”已删除`)}catch(Be){Q(Be instanceof Error?Be.message:"删除失败")}finally{G(null)}},$r=async()=>{if(!ut)return;const W=[...Yt];G("save-members"),Q(null),X(null);try{const Be=await fc({id:ut.id,name:ut.name,sessionIds:W,expectedUpdatedAt:rr});h(Be.group.id),De(!1),await ee(),X(`“${ut.name}”成员已更新,共 ${W.length} 个会话`)}catch(Be){Q(Be instanceof Error?Be.message:"成员更新失败")}finally{G(null)}},Ts=async W=>{if(!ut||!ut.sessionIds.includes(W)){Dt(null);return}const Be=A.find(Rt=>Rt.sessionId===W)?.name??W,wt=ut.name,yr=ut.sessionIds.length<=2;G(`remove-member:${W}`),Q(null),X(null);try{yr?await Yp(ut.id,ut.updatedAt):await fc({id:ut.id,name:wt,sessionIds:ut.sessionIds.filter(Rt=>Rt!==W),expectedUpdatedAt:ut.updatedAt}),Dt(null),xr(Rt=>new Set([...Rt].filter(Mr=>Mr!==W))),Ne(Rt=>Object.fromEntries(Object.entries(Rt).filter(([Mr])=>Mr!==W))),yr&&h(null),await ee(),X(yr?`“${wt}”已删除:移出“${Be}”后不足两个成员`:`已把“${Be}”移出“${wt}”`)}catch(Rt){Q(Rt instanceof Error?Rt.message:yr?"删除协作组失败":"移出成员失败")}finally{G(null)}},er=async W=>{if(!ut)return;const Be=ne[W]??"";G(`role:${W}`),Q(null),X(null);try{await R8(ut.id,W,Be.trim()||null),await ee(),X(Be.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(wt){Q(wt instanceof Error?wt.message:"定位保存失败")}finally{G(null)}},qr=()=>{const W=A.find(Be=>Be.sessionId===k)?.cwd??A.find(Be=>ut?.sessionIds.includes(Be.sessionId))?.cwd??"";Xe(W),We(""),Ge(""),jt(!0),De(!1)},Qn=async()=>{if(!(!ut||!Et)){G("spawn-agent"),Q(null),X(null);try{const W=await S8(ut.id,{agentSlug:Et,name:Jt.trim()||void 0,cwd:Lr.trim()||void 0,task:Pt.trim()||void 0,mode:F});jt(!1),await ee(),X(`“${W.session.name}”已创建并加入“${W.group.name}”`)}catch(W){Q(W instanceof Error?W.message:"Agent Session 创建失败")}finally{G(null)}}},Tn=Ze.filter(W=>(!ht||!ve.has(W.id))&&(ye==="all"||W.responseKind===ye)),Yr=zQ(Tn,A),jr=()=>{const W=new Set([...ve,...Tn.map(Be=>Be.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${ut?.id}`,JSON.stringify([...W]))}catch{Q("无法保存已看记录,请检查浏览器存储空间");return}ct(W)},rn=W=>i.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[i.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!Rp(W),checked:Re.has(W.sessionId),onChange:()=>K(Be=>{const wt=new Set(Be);return wt.has(W.sessionId)?wt.delete(W.sessionId):wt.add(W.sessionId),wt})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-[12px] text-foreground",children:W.name}),i.jsx(Mp,{session:W}),i.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:vh(W)})]}),i.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:W.currentTask?`${Dp(W.currentTask)} · ${W.cwd}`:W.cwd||W.capability||"终端会话"})]})]},W.sessionId),Br=W=>{const Be=ne[W.sessionId]??"",wt=ut?.roles?.[W.sessionId]??"";return i.jsxs("div",{className:"px-2 py-2 transition hover:bg-surface-2",children:[i.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[i.jsx("input",{type:"checkbox",disabled:!ut?.sessionIds.includes(W.sessionId)&&!Rp(W),checked:Yt.has(W.sessionId),onChange:()=>xr(yr=>{const Rt=new Set(yr);return Rt.has(W.sessionId)?Rt.delete(W.sessionId):Rt.add(W.sessionId),Rt})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[11px] text-foreground",children:W.name}),i.jsx(Mp,{session:W}),i.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[vh(W)," · ",W.cwd]})]})]}),i.jsxs("div",{className:"mt-2 flex items-center gap-2 pl-7",children:[i.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:"定位"}),i.jsx("input",{"aria-label":`${W.name} 的定位`,className:`${As} min-h-8 py-1 text-[10px]`,value:Be,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:yr=>Ne(Rt=>({...Rt,[W.sessionId]:yr.target.value}))}),i.jsx("button",{"aria-label":`保存 ${W.name} 的定位`,title:Be.trim()===wt?"定位未变化":"保存此成员的定位",disabled:U!==null||Be.trim()===wt,className:`${Tr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{er(W.sessionId)},children:U===`role:${W.sessionId}`?i.jsx(Jn,{size:12,className:"animate-spin"}):i.jsx(Mi,{size:12})})]})]},W.sessionId)};return i.jsxs("div",{className:"space-y-3",children:[pt&&i.jsxs("p",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",pt]}),i.jsxs("div",{children:[(!E||!ut)&&i.jsxs("div",{className:"flex items-center gap-2",children:[y.length>0?i.jsxs("label",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"sr-only",children:"选择协作组"}),i.jsxs("select",{className:As,value:ut?.id??"new",onChange:W=>h(W.target.value),children:[!ut&&i.jsx("option",{value:"new",children:"新建协作组"}),y.map(W=>i.jsxs("option",{value:W.id,children:[W.name," · ",W.sessionIds.length," 个成员"]},W.id))]})]}):i.jsx("h3",{className:"min-w-0 flex-1 text-sm font-medium text-foreground",children:"建立协作组"}),ut&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button","aria-label":"组设置",title:"组设置","aria-expanded":gt,className:`${Tr} min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:()=>{ft(W=>!W),Q(null),X(null)},children:i.jsx(sh,{size:14})}),i.jsx("button",{type:"button","aria-label":"新建协作组",title:"新建协作组",className:`${Tr} min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:()=>{h("new"),Ee(!1),X(null)},children:i.jsx(Os,{size:14})})]})]}),gt&&ut&&i.jsx(DQ,{group:ut,activeSessionId:k,sessions:A,busy:U,setBusy:G,setError:Q,setNotice:X,refresh:ee,onClose:()=>ft(!1)},ut.id),!ut&&i.jsxs("section",{className:"border-y border-border/15 py-4",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),i.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"至少选择两个会话。离线成员会在重新上线后收到消息;成员发生变化时会提示你重新选择。"})]}),i.jsxs("span",{className:`shrink-0 text-[10px] ${Rr>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",Rr," 个"]})]}),i.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",i.jsx("input",{className:As,value:qe,onChange:W=>oe(W.target.value),placeholder:"例如:发布准备"})]}),A.length>5&&i.jsxs("label",{className:"relative mt-3 block",children:[i.jsx("span",{className:"sr-only",children:"筛选会话"}),i.jsx(o0,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{className:`${As} pl-8`,value:we,onChange:W=>Z(W.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),i.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[An.length<=1?mn.map(rn):An.map(W=>{const Be=dn(W.key);return i.jsxs("div",{children:[i.jsx(S5,{label:W.label,count:W.sessions.length,collapsed:Be,onToggle:()=>Mn(W.key)}),!Be&&i.jsx("div",{className:"divide-y divide-border/10",children:W.sessions.map(rn)})]},W.key)}),A.length===0&&i.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:x==="loading"?"正在加载会话…":x==="error"?"会话加载失败,请重试":"先从会话侧栏启动至少两个会话,再回来创建协作组"}),A.length>0&&mn.length===0&&i.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),fs.length>0&&i.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",fs.length," 个所选会话暂不可用。",i.jsx("button",{className:Tr,onClick:()=>K(W=>new Set([...W].filter(Be=>Bt.has(Be)))),children:"清除不可用选择"})]}),i.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[i.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${Rr<2?"text-muted-foreground":"text-primary"}`,children:Rr<2?`还需选择 ${2-Rr} 个会话`:qe.trim()?"成员已满足要求,可以创建":"请填写协作组名称"}),i.jsxs("div",{className:"flex justify-end gap-2",children:[y.length>0&&i.jsx("button",{className:`${Tr} bg-surface-2 text-foreground`,onClick:()=>h(y[0]?.id??null),children:"取消"}),i.jsxs("button",{disabled:U!==null||x!=="loaded"||!qe.trim()||Rr<2||fs.length>0,className:`${Tr} bg-primary text-primary-foreground`,onClick:()=>{bn()},children:[U==="create-group"?i.jsx(Jn,{size:13,className:"animate-spin"}):i.jsx(Os,{size:13}),"创建协作组"]})]})]})]})]}),ut&&!E&&i.jsxs("div",{className:"space-y-3 py-3",children:[i.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"任务、消息和成员操作在终端旁的协作区处理。"}),i.jsxs("button",{type:"button",className:`${Tr} min-h-11 bg-primary text-primary-foreground`,onClick:()=>{B?.(ut.id).catch(W=>Q(W instanceof Error?W.message:"无法打开协作区"))},children:["打开 ",ut.name]})]}),ut&&E&&i.jsxs("div",{hidden:gt,className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-1 border-b border-border/15 pb-2","aria-label":"协作工作区",children:[[["tasks","目标与任务"],["messages","消息与成员"]].map(([W,Be])=>i.jsxs("button",{type:"button","aria-pressed":ze===W,className:`${Tr} min-h-11 ${ze===W?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2"}`,onClick:()=>he(W),children:[Be,W==="tasks"&&de>0&&i.jsxs("span",{className:"rounded bg-primary/15 px-1.5 text-[11px] text-primary",children:[de," 待处理"]})]},W)),i.jsx("button",{type:"button","aria-label":"组设置",title:"组设置","aria-expanded":gt,className:`${Tr} ml-auto min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:()=>{ft(W=>!W),Q(null),X(null)},children:i.jsx(sh,{size:14})})]}),i.jsx("div",{className:"flex gap-1 overflow-x-auto","aria-label":"工作组终端",children:fn.map(W=>i.jsx("button",{type:"button","aria-pressed":W.sessionId===k,title:`${W.name} · ${W.cwd||"终端会话"}`,className:`${Tr} min-h-9 shrink-0 ${W.sessionId===k?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2"}`,onClick:()=>{M(W).catch(Be=>Q(Be instanceof Error?Be.message:"无法打开终端"))},children:qp(W,fn)},W.sessionId))}),i.jsx("div",{hidden:ze!=="tasks",children:i.jsx(LQ,{group:ut,sessions:A,active:e&&(!g||p),onAttentionChange:$e,onOpenSession:M},ut.id)}),i.jsxs("div",{hidden:ze!=="messages",children:[i.jsxs("section",{onFocusCapture:()=>ig(Lt),onPointerDownCapture:()=>ig(Lt),"data-termdock-terminal-dropzone":g?k??"collaboration-composer":void 0,onDragOver:W=>{g&&W.preventDefault()},onDrop:W=>{if(!g)return;const Be=Array.from(W.dataTransfer.files);if(!(Be.length&&ko()))if(W.preventDefault(),W.stopPropagation(),Be.length)Ar(Be);else{const wt=W.dataTransfer.getData("text/plain")||W.dataTransfer.getData("text/uri-list");wt&&mt(yr=>yr+(yr?`
147
+ `:"")+wt)}},ref:It,className:g?"":"rounded-xl border border-primary/20 bg-primary/5 px-3 py-3",children:[!g&&i.jsxs("h4",{className:"truncate text-[12px] font-medium text-foreground",children:[ut.name," · 发送给成员"]}),i.jsx("div",{className:g?"space-y-2":"mt-2 space-y-2",children:i.jsxs("fieldset",{className:"min-w-0",children:[i.jsx("legend",{className:"mb-1 text-[10px] text-muted-foreground",children:"接收人(可多选)"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:[{id:"*",label:"全组成员"},...ut.sessionIds.map(W=>({id:W,label:(()=>{const Be=fn.find(wt=>wt.sessionId===W);return Be?qp(Be,fn):void 0})()??`${W.slice(0,8)}(离线)`}))].map(({id:W,label:Be})=>{const wt=W==="*"?re===null:re?.includes(W)??!1,yr=A.find(Rt=>Rt.sessionId===W);return i.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5",children:[i.jsxs("button",{type:"button","aria-pressed":wt,onClick:()=>me(Rt=>W==="*"?null:Rt?.includes(W)?Rt.filter(Mr=>Mr!==W):[...Rt??[],W]),className:`${Qm} min-h-9 min-w-0 gap-1 sm:min-h-7 ${wt?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[wt&&i.jsx(Mi,{size:12,"aria-hidden":"true",className:"shrink-0"}),i.jsx("span",{className:"break-words text-left",children:Be})]}),yr&&i.jsx("button",{type:"button","aria-label":`打开 ${Be} 的终端`,title:`打开 ${Be} 的终端`,className:"inline-flex h-9 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-2 hover:text-primary sm:h-7 sm:w-6",onClick:()=>{I(yr).catch(Rt=>Q(Rt instanceof Error?Rt.message:"无法打开会话"))},children:i.jsx(Xu,{size:12})})]},W)})})]})}),i.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",i.jsx("textarea",{onKeyDown:W=>{W.key==="Enter"&&(W.metaKey||W.ctrlKey)&&!W.nativeEvent.isComposing&&W.keyCode!==229&&(W.preventDefault(),Dn())},onPaste:W=>{const Be=Array.from(W.clipboardData.files);Be.length&&(W.preventDefault(),Ar(Be))},className:`${As} min-h-16 max-h-48 resize-y`,value:je,onChange:W=>mt(W.target.value),placeholder:"输入消息,可粘贴引用或文件…"})]}),i.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[i.jsx("p",{role:"status","aria-live":"polite",title:g&&t?t:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${g?"truncate":""} ${g&&t?"text-primary":"text-muted-foreground"}`,children:Sr>0?"正在准备文件路径…":g&&t?t:ut.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),i.jsxs("button",{disabled:U!==null||Sr>0||!je.trim()||!_n.length,className:`${Tr} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{Dn()},children:[U==="send-message"?i.jsx(Jn,{size:13,className:"animate-spin"}):null,"发送"]})]})]}),i.jsxs("div",{children:[i.jsxs("details",{className:"mt-4 rounded-xl border border-border/15",children:[i.jsxs("summary",{className:"cursor-pointer px-3 py-3 text-[11px] font-medium text-foreground",children:["管理成员、角色与删除 · ",ut.sessionIds.length," 个成员"]}),i.jsxs("section",{className:"border-t border-border/15 p-3",children:[i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:ut.name}),i.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[ut.sessionIds.length," 个成员 · 组 ID:",i.jsx("span",{className:"break-all font-mono",children:IQ(ut.id)})]})]}),Y?i.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[i.jsx("button",{className:`${Tr} bg-surface-2 px-2 text-foreground`,onClick:()=>Ee(!1),children:"取消"}),i.jsxs("button",{disabled:U!==null,className:`${Tr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{kn()},children:[U===`delete:${ut.id}`?i.jsx(Jn,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):i.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[i.jsxs("button",{className:`${Tr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{xr(new Set(ut.sessionIds)),Ir(ut.updatedAt);const W=!ae;De(W),W&&Ne(Object.fromEntries(ut.sessionIds.map(Be=>[Be,ut.roles?.[Be]??""]))),jt(!1)},children:[i.jsx(sh,{size:13}),"管理成员"]}),i.jsxs("button",{className:`${Tr} px-2 text-primary hover:bg-primary/10`,onClick:qr,children:[i.jsx(Os,{size:13}),"新建 Agent"]}),i.jsx("button",{"aria-label":`删除协作组 ${ut.name}`,title:"删除协作组",disabled:U!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>{Me(ut.updatedAt),Ee(!0)},children:i.jsx(ni,{size:14})})]})]}),Y&&i.jsxs("p",{role:"alert",className:"mt-2 rounded-lg bg-destructive/10 px-3 py-2 text-[10px] leading-relaxed text-destructive",children:["将删除“",ut.name,"”协作组及其协作记录,",ut.sessionIds.length," 个成员的终端会话会保留。"]}),i.jsx("div",{className:"mt-3 grid divide-y divide-border/10 border-y border-border/10 sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:ut.sessionIds.map(W=>{const Be=A.find(Mr=>Mr.sessionId===W),wt=ut.roles?.[W],yr=Be?.name??W,Rt=ut.sessionIds.length<=2;return i.jsxs("div",{className:`flex min-w-0 items-stretch transition ${kt===W?"bg-destructive/5":"hover:bg-surface-2"}`,children:[i.jsxs("button",{disabled:!Be,onClick:()=>Be&&void I(Be).catch(Mr=>Q(Mr instanceof Error?Mr.message:"无法打开会话")),className:"min-w-0 flex-1 px-3 py-2.5 text-left disabled:cursor-default",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${Be&&["ready","shell","terminal-connected","service-reachable","working","idle","done"].includes(Be.status)&&Be.serviceConnected!==!1?"bg-[var(--success)]":"bg-muted-foreground"}`}),i.jsx("span",{className:"truncate text-[11px] text-foreground",children:yr}),Be&&i.jsx(Mp,{session:Be}),i.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:Be?vh(Be):"已离线"})]}),i.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[wt?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",wt]}),i.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,Be?i.jsx("span",{className:"min-w-0 truncate",children:Dp(Be.currentTask)}):i.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]}),i.jsx("button",{"aria-label":`把 ${yr} 移出协作组`,"aria-expanded":kt===W,title:Rt?"移出后不足两个成员,将删除协作组":"移出协作组",disabled:U!==null,className:`mr-1 shrink-0 self-center rounded-lg p-2 transition ${kt===W?"text-destructive":"text-muted-foreground hover:bg-destructive/10 hover:text-destructive"}`,onClick:()=>Dt(kt===W?null:W),children:i.jsx(ni,{size:13})})]},W)})}),kt&&ut.sessionIds.includes(kt)&&(()=>{const W=A.find(yr=>yr.sessionId===kt)?.name??kt,Be=ut.sessionIds.length<=2,wt=U===`remove-member:${kt}`;return i.jsxs("div",{role:"group","aria-label":`确认移除成员 ${W}`,className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-y border-destructive/25 bg-destructive/5 px-3 py-2.5",children:[i.jsx("p",{className:"min-w-0 flex-1 text-[10px] leading-relaxed text-destructive",children:Be?`移出“${W}”后组内不足两个成员,协作组“${ut.name}”和它的 ${Ze.length} 条协作记录会一并删除`:`把“${W}”移出“${ut.name}”?移出后它不再收到这个组的消息,可以随时重新加入`}),i.jsxs("div",{className:"flex shrink-0 gap-2",children:[i.jsx("button",{className:`${Tr} min-h-8 bg-surface-2 px-2 text-[10px] text-foreground`,onClick:()=>Dt(null),children:"取消"}),i.jsxs("button",{disabled:U!==null,className:`${Tr} min-h-8 px-2 text-[10px] bg-destructive text-destructive-foreground`,onClick:()=>{Ts(kt)},children:[wt?i.jsx(Jn,{size:12,className:"animate-spin"}):i.jsx(ni,{size:12}),Be?"删除协作组":"移出"]})]})]})})(),ae&&i.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),i.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出;定位(角色)在每行独立保存,成员收到消息时会看到自己的定位。"})]}),i.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",Yt.size]})]}),i.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:Rn.length<=1?Xr.map(Br):Rn.map(W=>{const Be=dn(W.key);return i.jsxs("div",{children:[i.jsx(S5,{label:W.label,count:W.sessions.length,collapsed:Be,onToggle:()=>Mn(W.key)}),!Be&&i.jsx("div",{className:"divide-y divide-border/10",children:W.sessions.map(Br)})]},W.key)})}),i.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[i.jsx("button",{className:`${Tr} bg-surface-2 text-foreground`,onClick:()=>{De(!1),Ne({})},children:"取消"}),i.jsxs("button",{disabled:U!==null||x!=="loaded"||Yt.size<2,className:`${Tr} bg-primary text-primary-foreground`,onClick:()=>{$r()},children:[U==="save-members"?i.jsx(Jn,{size:13,className:"animate-spin"}):i.jsx(Mi,{size:13}),"保存成员"]})]})]}),tt&&i.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[i.jsxs("div",{children:[i.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),i.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),i.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[i.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",i.jsx("select",{"aria-label":"新 Agent 类型",className:As,value:Et,onChange:W=>dr(W.target.value),children:w.map(W=>i.jsxs("option",{value:W.slug,children:[W.displayName,W.isPlugin?" · Plugin":""]},W.slug))})]}),i.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",i.jsx("input",{"aria-label":"新 Agent 会话名称",className:As,value:Jt,onChange:W=>We(W.target.value),placeholder:"留空则自动命名"})]})]}),i.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",i.jsx("input",{"aria-label":"新 Agent 工作目录",className:As,value:Lr,onChange:W=>Xe(W.target.value),placeholder:"默认继承当前会话"})]}),i.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",i.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${As} min-h-16 resize-y`,value:Pt,onChange:W=>Ge(W.target.value),placeholder:"说明它加入后要先完成什么"})]}),i.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[i.jsx("button",{className:`${Tr} bg-surface-2 text-foreground`,onClick:()=>jt(!1),children:"取消"}),i.jsxs("button",{disabled:U!==null||!Et,className:`${Tr} bg-primary text-primary-foreground`,onClick:()=>{Qn()},children:[U==="spawn-agent"?i.jsx(Jn,{size:13,className:"animate-spin"}):i.jsx(Ku,{size:13}),"创建并加入"]})]})]})]})]},ut.id),i.jsxs("section",{className:"mt-4",children:[i.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[i.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),i.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[Yr.length," 条"]})]}),i.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[i.jsxs("select",{"aria-label":"筛选回复类型",className:`${As} w-auto`,value:ye,onChange:W=>et(W.target.value),children:[i.jsx("option",{value:"all",children:"全部类型"}),i.jsx("option",{value:"ack",children:"收到确认"}),i.jsx("option",{value:"progress",children:"进展"}),i.jsx("option",{value:"result",children:"结果与证据"})]}),i.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-[11px] text-muted-foreground",children:[i.jsx("input",{type:"checkbox",checked:ht,onChange:W=>te(W.target.checked)}),"只看新记录"]}),i.jsx("button",{className:`${Tr} min-h-9 text-muted-foreground`,disabled:!Tn.length,onClick:jr,children:"标记当前记录已看"})]}),i.jsxs("div",{className:"divide-y divide-border/10 border-y border-border/10 [overflow-wrap:anywhere]",children:[Yr.map(W=>i.jsxs("div",{className:"px-2 py-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[i.jsx("span",{className:"font-medium text-primary",children:W.responseKind==="ack"?"收到确认":W.responseKind==="progress"?"进展":W.responseKind==="result"?"结果":UQ(W.kind)}),i.jsx("span",{children:W.fromName}),i.jsx("span",{children:"→"}),i.jsx("span",{className:"truncate",children:W.toNames.join("、")}),i.jsx("span",{className:"ml-auto shrink-0",children:new Date(W.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),i.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:W.content}),i.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:W.status==="pending"?"已入队 · 等待投递":W.status==="failed"?"投递失败":W.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(W.task||W.failureReason)&&i.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[i.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),i.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(W.task??{failure_reason:W.failureReason},null,2)})]})]},W.key)),Yr.length===0&&i.jsx(KQ,{text:se?"正在加载协作记录…":Ze.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]})]})]})]})}function DQ({group:e,activeSessionId:t,sessions:r,busy:n,setBusy:a,setError:l,setNotice:c,refresh:h,onClose:p}){const[g,x]=b.useState(e),[y,A]=b.useState(e.name),[w,k]=b.useState(e.instructions?.text??""),[E,I]=b.useState(e.instructions?.version??""),[M,B]=b.useState(e.instructions?.text??""),F=r.filter(de=>e.sessionIds.includes(de.sessionId)&&!s0(de.sessionId)),[U,G]=b.useState(()=>t&&F.some(de=>de.sessionId===t)?t:""),Q=new TextEncoder().encode(w).length,X=F.some(de=>de.sessionId===U),ee=async()=>{if(!(n||!y.trim())){a("group-name"),l(null),c(null);try{const de=await fc({id:g.id,name:y.trim(),sessionIds:g.sessionIds,expectedUpdatedAt:g.updatedAt});x(de.group),A(de.group.name),w===M&&(k(de.group.instructions?.text??""),B(de.group.instructions?.text??""),I(de.group.instructions?.version??"")),await h(),c("协作组名称已更新")}catch(de){l(de instanceof Error?de.message:"改名失败")}finally{a(null)}}},ze=async()=>{if(!(n||!X||Q>8192)){a("group-rules"),l(null),c(null);try{const de=await N8(g.id,{sessionId:U,text:w,expectedVersion:E});y===g.name&&A(de.group.name),x(de.group),B(de.group.instructions?.text??""),I(de.group.instructions?.version??""),await h(),c(w.trim()?"群规已保存,变更通知已入队":"群规已清空,变更通知已入队")}catch(de){l(de instanceof Error?de.message:"群规保存失败")}finally{a(null)}}},he=()=>{x(e),A(e.name),k(e.instructions?.text??""),B(e.instructions?.text??""),I(e.instructions?.version??""),l(null)};return i.jsxs("section",{"aria-label":"协作组设置",className:"mt-3 rounded-xl border border-border/20 bg-surface-2 p-3",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[i.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"组设置"}),i.jsx("button",{type:"button",disabled:!!n,"aria-label":"关闭组设置",className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-elevated",onClick:p,children:i.jsx(Kn,{size:14})})]}),i.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",i.jsx("input",{autoFocus:!0,className:As,value:y,maxLength:240,disabled:!!n,onChange:de=>A(de.target.value)})]}),i.jsx("div",{className:"mt-2 flex justify-end",children:i.jsx("button",{type:"button",disabled:!!n||!y.trim()||y.trim()===g.name,className:`${Tr} min-h-9 bg-primary text-primary-foreground`,onClick:()=>{ee()},children:n==="group-name"?"保存中…":"保存名称"})}),i.jsxs("div",{className:"mt-3 space-y-2 border-t border-border/15 pt-3",children:[i.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["由本组成员发布群规变更",i.jsxs("select",{className:As,value:U,disabled:!!n||!F.length,onChange:de=>G(de.target.value),children:[i.jsx("option",{value:"",children:"选择当前服务的一个成员"}),!F.some(de=>de.sessionId===U)&&U&&i.jsx("option",{value:U,children:"原成员已不在组内,请重新选择"}),F.map(de=>i.jsx("option",{value:de.sessionId,children:de.name},de.sessionId))]})]}),i.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["群规与协作约定",i.jsx("textarea",{className:`${As} min-h-24 resize-y`,value:w,maxLength:8192,disabled:!!n,onChange:de=>k(de.target.value),placeholder:"例如:说明分工、交接要求和结果格式。清空后保存可移除群规。"})]})]}),!X&&i.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:F.length?"选择发布变更的成员后即可保存,不需要关闭工作台。":"当前服务没有本组成员,请先添加成员或切换到成员所在的服务。已有群规可在此查看。"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[i.jsx("p",{className:`text-[9px] ${Q>8192?"text-destructive":"text-muted-foreground"}`,children:Q>8192?"内容过长,请缩短群规":"保存或清空群规会通知本组其他成员"}),i.jsx("button",{type:"button",disabled:!!n||!X||Q>8192||w===M,className:`${Tr} min-h-9 shrink-0 bg-primary text-primary-foreground`,onClick:()=>{ze()},children:n==="group-rules"?"保存中…":w.trim()?"保存群规":"清空群规"})]}),i.jsxs("div",{className:"mt-3 flex justify-between gap-2 border-t border-border/15 pt-2",children:[i.jsxs("button",{type:"button",disabled:!!n,className:`${Tr} min-h-9 text-muted-foreground hover:bg-surface-elevated`,onClick:he,children:[i.jsx(Jn,{size:12}),"重新载入",(y!==g.name||w!==M)&&"(放弃草稿)"]}),i.jsx("button",{type:"button",disabled:!!n,className:`${Tr} min-h-9 bg-surface text-foreground`,onClick:p,children:"完成"})]})]})}function jQ({peers:e,currentGroupId:t,busy:r,setBusy:n,setError:a,setNotice:l,onSelectGroup:c}){const[h,p]=b.useState(null),[g,x]=b.useState(!1),y=e.services??[],A=e.removedServices??[],w=y.filter(I=>!I.connected),k=w.some(I=>I.groups?.some(M=>M.id===t)),E=async(I,M)=>{if(!r){n(`peer:${I}`),a(null),l(null);try{M?await _8(I):await L8(I),p(null),x(!1),l(M?"协作连接已恢复,正在连接服务":"协作连接已移除,不会再自动重连;已有会话和消息保留")}catch(B){a(B instanceof Error?B.message:M?"重新连接失败":"移除连接失败")}finally{n(null)}}};return i.jsxs("details",{className:"mt-4 shrink-0 rounded-lg border border-border/15",open:k||void 0,children:[i.jsxs("summary",{className:"cursor-pointer px-3 py-2.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"font-medium text-foreground",children:"协作连接与管理"}),i.jsx("span",{className:"ml-2",children:e.state==="loading"?"正在加载…":`${y.length-w.length} 个已连接${w.length?` · ${w.length} 个离线`:""}`})]}),i.jsxs("div",{className:"max-h-64 overflow-y-auto border-t border-border/15 px-3 py-2",children:[y.length>0&&i.jsx("p",{className:"mb-1 text-[10px] leading-relaxed text-muted-foreground",children:"与以下服务进行跨服务协作,名称与服务切换器一致。"}),w.length>0&&i.jsx("p",{className:"mb-2 text-[10px] leading-relaxed text-muted-foreground",children:k?"当前协作组的部分服务不可达,消息会保留并等待重连。":"其他服务暂时离线;当前服务内的协作可以继续。不再使用的连接可移除。"}),e.error&&i.jsx("p",{role:"status",className:"mb-2 break-words text-[10px] text-destructive",children:e.error}),e.state==="unsupported"&&i.jsx("p",{className:"mb-2 text-[10px] text-muted-foreground",children:"请更新客户端以管理跨服务连接。"}),i.jsx("div",{className:"divide-y divide-border/10",children:y.map(I=>i.jsxs("div",{className:"py-2.5",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("p",{className:"text-[11px] text-foreground",children:[Gl({serviceLabel:I.label,serviceOrigin:I.origin}),i.jsx("span",{className:`ml-2 text-[9px] ${I.connected?"text-[var(--success)]":"text-muted-foreground"}`,children:I.connected?"已连接":I.error==="CONNECTING"?"连接中":"暂时离线"})]}),i.jsx(BQ,{service:I})]}),I.serviceId&&i.jsxs("button",{type:"button",disabled:!!r,"aria-label":`移除协作连接 ${I.origin}`,className:`${Tr} min-h-9 shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,onClick:()=>p(h===I.serviceId?null:I.serviceId),children:[i.jsx(ni,{size:12}),"移除"]})]}),!!I.groups?.length&&i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 text-[9px] text-muted-foreground",children:[i.jsx("span",{children:"用于"}),I.groups.map(M=>i.jsx("button",{type:"button",className:"rounded px-1.5 py-1 text-primary hover:bg-primary/10",onClick:()=>c(M.id),children:M.name},M.id))]}),!I.connected&&I.error&&I.error!=="CONNECTING"&&i.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[i.jsx("summary",{className:"cursor-pointer",children:HQ(I.error)}),i.jsx("p",{className:"mt-1 select-text break-words",children:I.error})]}),h===I.serviceId&&i.jsxs("div",{role:"group","aria-label":"确认移除协作连接",className:"mt-2 rounded-lg bg-surface-2 p-2.5",children:[i.jsx("p",{className:"text-[10px] leading-relaxed text-foreground",children:I.groups?.length?"请先处理上方协作组的成员,再移除这条连接。":"移除后停止与该服务协作,保留已有会话和消息;以后可重新连接。"}),i.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[i.jsx("button",{type:"button",disabled:!!r,className:`${Tr} min-h-9 text-muted-foreground`,onClick:()=>p(null),children:"取消"}),i.jsx("button",{type:"button",disabled:!!r||!!I.groups?.length,className:`${Tr} min-h-9 bg-destructive text-destructive-foreground`,onClick:()=>{E(I.serviceId,!1)},children:r===`peer:${I.serviceId}`?"正在移除…":"确认移除"})]})]})]},I.serviceId||I.origin))}),y.length===0&&e.state==="ready"&&i.jsx("p",{className:"py-2 text-[10px] text-muted-foreground",children:"当前没有其他协作服务,当前服务内仍可创建协作组。"}),w.length>0&&i.jsxs("button",{type:"button",className:`${Tr} mt-1 min-h-9 text-primary hover:bg-primary/10`,onClick:T8,children:[i.jsx(Jn,{size:12}),"重试连接"]}),A.length>0&&i.jsxs("div",{className:"mt-2 border-t border-border/15 pt-1",children:[i.jsx("button",{type:"button","aria-expanded":g,className:`${Tr} min-h-9 text-muted-foreground hover:bg-surface-2`,onClick:()=>x(I=>!I),children:g?"收起恢复列表":"恢复已移除连接"}),g&&i.jsxs("section",{"aria-label":"恢复已移除连接",className:"mt-1 rounded-lg bg-surface-2 px-2.5 py-2",children:[i.jsx("p",{className:"text-[10px] leading-relaxed text-muted-foreground",children:"以下是恢复记录,连接已停用,不会自动重连。点击恢复后才会重新启用协作。"}),i.jsx("div",{className:"mt-1 divide-y divide-border/10",children:A.map(I=>i.jsxs("div",{className:"flex items-start gap-2 py-2",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("p",{className:"break-words text-[10px] text-foreground",children:[Gl({serviceLabel:I.label,serviceOrigin:I.origin}),i.jsx("span",{className:"ml-2 text-[9px] text-muted-foreground",children:"已停用"})]}),i.jsx("p",{className:"mt-0.5 select-text break-all text-[9px] text-muted-foreground",children:I.accessUrl||I.origin})]}),i.jsx("button",{type:"button",disabled:!!r||!I.serviceId,className:`${Tr} min-h-9 shrink-0 text-primary hover:bg-primary/10`,onClick:()=>{E(I.serviceId,!0)},children:r===`peer:${I.serviceId}`?"恢复中…":"恢复连接"})]},I.serviceId||I.origin))})]})]})]})]},k?"affected":"other")}function BQ({service:e}){let t=!1;try{t=["localhost","127.0.0.1","[::1]"].includes(new URL(e.origin).hostname)}catch{}const r=e.accessUrl||(t?"":e.origin);return i.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[i.jsx("summary",{className:"w-fit cursor-pointer py-1",children:"连接详情"}),i.jsxs("dl",{className:"mt-1 space-y-1 select-text break-all",children:[i.jsxs("div",{children:[i.jsx("dt",{className:"inline",children:"服务地址:"}),i.jsx("dd",{className:"inline",children:r||"暂未获取,请在服务切换器中查看"})]}),e.serviceId&&i.jsxs("div",{children:[i.jsx("dt",{className:"inline",children:"服务身份:"}),i.jsx("dd",{className:"inline",children:e.serviceId})]})]})]})}function Rp(e){return!s0(e.sessionId)||e.serviceConnected!==!1}function QQ(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:s0(e.sessionId)?.origin??""}function C5(e){const t=new Map;for(const r of e){const n=QQ(r),a=t.get(n)??{key:n,label:n?Gl(r):"本机服务",sessions:[]};n&&a.label==="远端服务"&&(a.label=Gl(r)),a.sessions.push(r),t.set(n,a)}return[...t.values()].sort((r,n)=>(r.key?1:0)-(n.key?1:0)||r.label.localeCompare(n.label))}function S5({label:e,count:t,collapsed:r,onToggle:n}){return i.jsxs("button",{type:"button","aria-expanded":!r,onClick:n,className:"flex w-full items-center gap-1.5 bg-surface-2/50 px-2 py-1.5 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[i.jsx(Jo,{size:12,className:`shrink-0 transition-transform ${r?"-rotate-90":""}`}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wide",children:e}),i.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground/70",children:t})]})}function PQ(e,t){const r=new Map(t.map(n=>[n.sessionId,n]));for(const n of e?.sessionIds??[]){if(r.has(n))continue;const a=e?.remoteSessions?.find(l=>l.sessionId===n);r.set(n,a?{...a,status:"offline",serviceConnected:!1}:{sessionId:n,name:n,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...s0(n)?{serviceConnected:!1}:{}})}return[...r.values()]}function Mp({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:i.jsxs("span",{className:"inline-flex max-w-28 shrink-0 items-center gap-1 rounded border border-border/20 px-1 py-0.5 text-[9px] text-muted-foreground",children:[i.jsx(Xu,{size:9}),i.jsx("span",{className:"truncate",children:Gl(e)})]})}function vh(e){return e.serviceConnected===!1?"服务不可达":e.status==="recovering"&&e.route_error==="ROUTE_NOT_CHECKED"?"投递目标未检查":$Q(e.status)}function OQ(e,t=[]){if(!e)return;const r=t.some(a=>a.sessionId!==e.sessionId&&a.name.trim()===e.name.trim()),n=e.sessionId.startsWith("remote:")?Gl(e):"本机服务";return r?`${e.name} · ${n}`:e.name}async function FQ(e){e.sessionId.startsWith("remote:")?await Xy(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function $Q(e){return{ready:"终端可达",shell:"Shell 终端",recovering:"正在检查投递目标",unchecked:"投递目标未检查","terminal-connected":"终端已连接",detached:"终端未连接","agent-exited":"Agent 已退出",offline:"已离线",ambiguous:"需确认目标终端","identity-mismatch":"终端身份已变化",unavailable:"终端暂不可达","service-reachable":"服务可达","service-unreachable":"服务不可达"}[e]??"在线"}function Dp(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return Vh(t.prompt)||"暂无任务摘要"}catch{}return Vh(e)||"暂无任务摘要"}function UQ(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function zQ(e,t){const r=new Map(t.map(a=>[a.sessionId,OQ(a,t)])),n=new Map;for(const a of e){const l=`${a.threadId}:${a.createdAt}:${a.fromSessionId??"user"}:${a.kind}:${a.responseKind??""}:${JSON.stringify(a.task??null)}:${a.content}`,c=n.get(l),h=r.get(a.toSessionId)??a.toSessionId.slice(0,8);if(c){c.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[a.status]<p[c.status]&&(c.status=a.status);continue}n.set(l,{key:l,kind:a.kind,content:a.content,createdAt:a.createdAt,fromName:a.fromSessionId?r.get(a.fromSessionId)??a.fromSessionId.slice(0,8):"你",toNames:[h],status:a.status,responseKind:a.responseKind,task:a.task,failureReason:a.failureReason})}return[...n.values()].sort((a,l)=>l.createdAt-a.createdAt)}function HQ(e){return/timeout|timed out|超时|operation was aborted/i.test(e)?"连接超时,暂时无法访问该服务。请确认远端服务已启动,并检查网络或 VPN 连接。":/ECONNREFUSED|connection refused/i.test(e)?"远端拒绝连接,请确认服务已启动且端口正确。":/ENOTFOUND|EHOSTUNREACH|ENETUNREACH/i.test(e)?"无法访问远端地址,请检查地址和网络连接。":/certificate|fingerprint|TLS|证书/i.test(e)?"远端证书校验失败,请检查服务连接授权。":"服务连接暂时不可用,可查看连接详情并重试。"}function jp({value:e,query:t}){const r=t.trim().toLocaleLowerCase();if(!r)return i.jsx(i.Fragment,{children:e});const n=e.toLocaleLowerCase(),a=[];let l=0,c;for(;(c=n.indexOf(r,l))>=0;)a.push(e.slice(l,c)),a.push(i.jsx("mark",{className:"rounded bg-primary/15 text-primary",children:e.slice(c,c+r.length)},c)),l=c+r.length;return a.push(e.slice(l)),i.jsx(i.Fragment,{children:a})}function WQ({active:e,onClose:t,onNewSession:r,setError:n}){const[a,l]=b.useState(""),[c,h]=b.useState([]),[p,g]=b.useState(0),[x,y]=b.useState(),[A,w]=b.useState(50),[k,E]=b.useState(0),[I,M]=b.useState(!1),[B,F]=b.useState(null),[U,G]=b.useState(null),Q=b.useRef(null),X=b.useRef(0);b.useEffect(()=>{e&&Q.current?.focus({preventScroll:!0})},[e]),b.useEffect(()=>{if(!e)return;const he=++X.current,de=new AbortController;let $e;F(null),M(!0);const qe=async()=>{try{const oe=await k8(a.trim(),A,de.signal);if(he!==X.current)return;h(oe.results),g(oe.total??oe.results.length),y(oe.index),oe.index?.building&&($e=window.setTimeout(()=>{qe()},2500))}catch(oe){he===X.current&&!de.signal.aborted&&F(oe instanceof Error?oe.message:"搜索失败")}finally{he===X.current&&M(!1)}};return $e=window.setTimeout(()=>{qe()},a.trim()?250:0),()=>{window.clearTimeout($e),de.abort(),++X.current}},[e,a,A,k]);const ee=he=>{n(null),l(he),h([]),g(0),w(50)},ze=async he=>{if(!U){if(he.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:he.sessionId})),t();return}if(!(!he.nativeKey&&!he.resumeHistoryId)){G(he.sessionId),n(null);try{const de=he.nativeKey?await I8(he.nativeKey):await xb(he.resumeHistoryId);if("sessionId"in de&&de.sessionId)window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:de.sessionId}));else if(de.command)r({mode:"shell",cwd:de.cwd,command:de.command});else throw new Error("这条会话暂时无法恢复,请重新搜索");t()}catch(de){n(de instanceof Error?de.message:"恢复失败")}finally{G(null)}}}};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"历史会话搜索"}),i.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"搜索当前服务的 Codex、Claude 历史对话和 Termdock 终端记录,未启动的会话也能找到并恢复。"})]}),i.jsxs("label",{className:"relative mt-3 block",children:[i.jsx("span",{className:"sr-only",children:"搜索历史会话"}),i.jsx(o0,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{ref:Q,maxLength:512,className:`${As} pl-9 pr-9`,value:a,onChange:he=>ee(he.target.value),placeholder:"搜索会话名称、对话关键词、目录或 session ID"}),I?i.jsx(Jn,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):a&&i.jsx("button",{type:"button","aria-label":"清空搜索",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>ee(""),children:i.jsx(Kn,{size:13})})]}),x?.building&&i.jsxs("div",{role:"status",className:"mt-2 text-[10px] text-muted-foreground",children:["正在建立历史索引:",x.indexed,"/",x.total," 个会话。可以先搜名称和目录,对话结果会自动补齐。"]}),x?.warning&&i.jsx("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:x.warning}),!!x?.failed&&i.jsxs("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:[x.failed," 个会话暂未完成索引,其余结果可正常使用。请稍后刷新重试。"]})]}),i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("p",{className:"text-[11px] text-foreground",children:[a.trim()?`找到 ${p} 个会话`:"最近的会话",p>c.length?` · 显示 ${c.length} 个`:""]}),i.jsxs("button",{type:"button",disabled:I,className:`${Tr} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>E(he=>he+1),children:[i.jsx(Jn,{size:12}),"刷新"]})]}),!a.trim()&&i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"记得之前讨论过什么?输入一句话中的关键词,就能找到对应会话。历史对话与索引保存在当前服务机器上。"}),i.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:c.map(he=>{const de=he.live||!!(he.nativeKey||he.resumeHistoryId),$e=U===he.sessionId?"正在恢复…":he.live?"打开会话":de?"恢复会话":"仅供查阅",qe=he.source==="codex"||he.source==="claude"?he.snippet:GQ(he),oe=he.source==="codex"?"Codex 历史":he.source==="claude"?"Claude 历史":"终端记录",Re=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"break-words text-[12px] font-medium text-foreground",children:i.jsx(jp,{value:he.title,query:a})}),i.jsx("p",{className:"mt-0.5 break-all text-[9px] text-muted-foreground",children:i.jsx(jp,{value:he.cwd||"项目目录待索引",query:a})})]}),i.jsx("span",{className:`shrink-0 text-[10px] ${he.live?"text-[var(--success)]":de?"text-primary":"text-muted-foreground"}`,children:$e})]}),qe&&i.jsx("p",{className:"mt-2 line-clamp-3 break-words text-[10px] leading-relaxed text-foreground/75",children:i.jsx(jp,{value:qe,query:a})}),i.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[oe," · ",qh(he.updatedAt),a.trim()?` · ${he.matchCount>=999?"999+":he.matchCount} 处匹配`:"",de?"":" · 没有可恢复记录"]}),he.agentNativeSessionId&&i.jsx("p",{className:"mt-1 select-text break-all text-[9px] text-muted-foreground",children:he.agentNativeSessionId})]});return de?i.jsx("button",{disabled:!!U,onClick:()=>{ze(he)},className:"block w-full px-2 py-3 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",children:Re},he.nativeKey||he.sessionId):i.jsx("article",{className:"px-2 py-3",children:Re},he.sessionId)})}),p>c.length&&A<5e3&&i.jsx("button",{type:"button",disabled:I,className:`${Tr} w-full bg-surface-2 text-foreground`,onClick:()=>w(he=>he+50),children:I?"正在加载…":"加载更多会话"}),B&&i.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["搜索失败:",B,i.jsx("button",{type:"button",className:`${Tr} ml-2`,onClick:()=>E(he=>he+1),children:"重试"})]}),!I&&!B&&c.length===0&&i.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[i.jsx("p",{className:"text-[12px] text-foreground",children:x?.building?"历史对话仍在索引,请稍候":x?.warning||x?.failed?"暂未找到结果,部分历史记录尚不可搜索":a.trim()?`没有找到“${a.trim()}”`:"当前服务还没有可搜索的历史会话"}),i.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:x?.building?"新结果会自动显示,也可以先搜会话名称或目录。":"可尝试更短的关键词、项目目录或 session ID;其他机器的历史需切换到对应服务搜索。"}),a.trim()&&i.jsx("button",{className:`${Tr} mt-3 bg-surface-2 text-foreground`,onClick:()=>ee(""),children:"查看最近会话"})]})]})}function Vh(e){return e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g," ").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g," ").replace(/\(B/g," ").replace(/<[^>]{1,120}>/g," ").replace(/[─━│┃┄┅┆┇┈┉┊┋┌┐└┘├┤┬┴┼╭╮╯╰═║╔╗╚╝╠╣╦╩╬]+/g," ").replace(/([^\p{L}\p{N}\s])\1{3,}/gu," ").replace(/([A-Za-z])\1{12,}/g," ").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g," ").replace(/\s+/g," ").trim().slice(0,280)}function GQ(e){let t=Vh(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return Vh(t)}function VQ(e){if(e.schedule.kind==="interval")return e.schedule.everyMinutes===60?"每小时":e.schedule.everyMinutes===1440?"每天":`每 ${e.schedule.everyMinutes} 分钟`;const t=["日","一","二","三","四","五","六"];return`${e.schedule.weekdays.length===7?"每天":e.schedule.weekdays.map(n=>`周${t[n]}`).join("、")} ${e.schedule.time}`}function qQ(e,t=Date.now(),r=t){if(e.kind==="interval"){const l=e.everyMinutes*6e4,c=Math.max(0,t-r);return r+(Math.floor(c/l)+1)*l}const[n,a]=e.time.split(":").map(Number);for(let l=0;l<=7;l+=1){const c=new Date(t);if(c.setDate(c.getDate()+l),c.setHours(n,a,0,0),c.getTime()>t&&e.weekdays.includes(c.getDay()))return c.getTime()}return t}function qh(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function YQ(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function ZQ(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function KQ({text:e}){return i.jsx("div",{className:"rounded-xl border border-dashed border-border/20 px-4 py-8 text-center text-[11px] text-muted-foreground",children:e})}function XQ({onOpenSettings:e,serverAttention:t,actions:r}){const{t:n}=Qr(),[a,l]=b.useState(!1),c=b.useRef(null),h=b.useRef(null),p=b.useRef(null),g=b.useId();return b.useLayoutEffect(()=>{if(!a)return;const x=c.current,y=p.current;if(!x||!y)return;const A=window.visualViewport,w=()=>{const E=x.getBoundingClientRect(),I=(A?.offsetLeft??0)+8,M=(A?.offsetTop??0)+8,B=(A?.width??window.innerWidth)-16,F=(A?.offsetTop??0)+(A?.height??window.innerHeight)-8,U=Math.max(0,Math.min(256,B)),G=Math.max(0,E.top-M-4),Q=Math.max(0,F-E.bottom-4),X=G>=180||G>=Q;Object.assign(y.style,{width:`${U}px`,left:`${Math.max(I,Math.min(E.right-U,I+B-U))}px`,top:`${X?E.top-4:E.bottom+4}px`,maxHeight:`${X?G:Q}px`,transform:X?"translateY(-100%)":"none"})};w();const k=typeof ResizeObserver>"u"?null:new ResizeObserver(w);return k?.observe(x),window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),A?.addEventListener("resize",w),A?.addEventListener("scroll",w),()=>{k?.disconnect(),window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0),A?.removeEventListener("resize",w),A?.removeEventListener("scroll",w)}},[a]),b.useEffect(()=>{if(!a)return;p.current?.querySelector('[role="menuitem"]')?.focus({preventScroll:!0});const x=y=>{y.target instanceof Node&&!c.current?.contains(y.target)&&!p.current?.contains(y.target)&&l(!1)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[a]),i.jsxs("div",{ref:c,role:"group","data-sidebar-gesture-ignore":!0,"aria-label":n("sidebar.moreActions"),className:"relative z-20 mt-2 flex items-center justify-between gap-2",onKeyDown:x=>{a&&x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l(!1),h.current?.focus({preventScroll:!0}))},children:[i.jsxs("button",{type:"button",onClick:e,title:t?n("sidebar.serverAttention"):void 0,className:"inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[i.jsx(UA,{size:14,className:t?"text-destructive":void 0}),i.jsx("span",{children:n("sidebar.settings")})]}),i.jsxs("button",{ref:h,type:"button","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?g:void 0,onClick:()=>l(x=>!x),onKeyDown:x=>{(x.key==="ArrowDown"||x.key==="ArrowUp")&&(x.preventDefault(),l(!0))},className:`inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${a?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[i.jsx(wl,{size:15}),i.jsx("span",{children:n("sidebar.moreActions")})]}),a&&Ai.createPortal(i.jsx("div",{ref:p,id:g,role:"menu","data-sidebar-gesture-ignore":!0,"data-sidebar-composer-popover":"sidebar-launch-options","aria-label":n("sidebar.moreActions"),className:"fixed z-popover overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 shadow-[0_12px_32px_var(--app-shadow-soft)] animate-fade-in",onKeyDown:x=>{const y=[...x.currentTarget.querySelectorAll('[role="menuitem"]')],A=y.indexOf(document.activeElement);let w;if(x.key==="ArrowDown")w=(A+1)%y.length;else if(x.key==="ArrowUp")w=(A-1+y.length)%y.length;else if(x.key==="Home")w=0;else if(x.key==="End")w=y.length-1;else if(x.key==="Tab"){l(!1);return}else return;x.preventDefault(),y[w]?.focus({preventScroll:!0})},children:r.map(({label:x,icon:y,onSelect:A,separated:w})=>i.jsxs("div",{role:"none",children:[w&&i.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/40"}),i.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{l(!1),A()},className:"flex min-h-10 w-full items-center gap-2.5 whitespace-nowrap rounded-lg px-2.5 text-left text-[12px] text-foreground transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none",children:[i.jsx(y,{size:15,className:"shrink-0 text-muted-foreground"}),i.jsx("span",{children:x})]})]},x))}),document.body)]})}function JQ(e,t){return $8(e,t)}function Vd(e,t){const r=new Set(e),n=t.filter(l=>l.sessionIds.length>=2&&l.sessionIds.every(c=>r.has(c))),a=new Set;return e.flatMap(l=>{const c=n.find(h=>h.sessionIds.includes(l));return c?a.has(c.id)?[]:(a.add(c.id),[{sessionIds:c.sessionIds,workspace:c}]):[{sessionIds:[l]}]})}function au(e,t,r,n=[]){const a=new Map,l=new Map,c=new Set(e.map(x=>x.id));for(const x of n){const y=x.sessionIds.filter(w=>c.has(w));if(y.length<(x.federated?1:2))continue;const A=y.length===x.sessionIds.length?x:{...x,sessionIds:y};y.forEach(w=>a.set(w,A))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(y=>c.has(y)))&&!x.sessionIds.some(y=>a.has(y)))for(const y of x.sessionIds)l.set(y,x);const h=new Set,p=new Set,g=[];for(const x of e){const y=a.get(x.id);if(y){if(h.has(y.id))continue;h.add(y.id);const k=y.sessionIds.flatMap(E=>{const I=r.get(E);return I?[I]:[]});g.push({kind:"collaboration",id:`collaboration:${y.id}`,group:y,members:k,sessionIds:y.sessionIds});continue}const A=l.get(x.id);if(!A){g.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(A.id))continue;p.add(A.id);const w=A.sessionIds.flatMap(k=>{const E=r.get(k);return E?[E]:[]});g.push({kind:"workspace",id:`workspace:${A.id}`,workspace:A,members:w,sessionIds:A.sessionIds})}return g}function _5(e,t,r){const n=Math.min(e.length,Math.max(0,r)),a=e.slice(0,n).flatMap(c=>c.sessionIds.filter(h=>h!==t)),l=e.slice(n).flatMap(c=>c.sessionIds.filter(h=>h!==t));return[...a,t,...l]}function eP({status:e,detail:t,needsReview:r,inCopyMode:n}){return i.jsx(KB,{status:e,detail:t,needsReview:r,inCopyMode:n})}function L5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,sessions:a,activeSessionId:l,sessionStates:c,onJumpToNextAttention:h,onNewSession:p,onCloseSession:g,onSplitSession:x,onCloseSplit:y,onRemoveFromSplit:A,splitWorkspaces:w,onSetSplitLayout:k,onReorderSplitWorkspace:E,onCombineSplitSessions:I,onReorderSessions:M,onSessionMenu:B,onOpenSettings:F,onOpenQuota:U,updateState:G,updateActionPending:Q=!1,onConfirmUpdateRestart:X,onRetryUpdate:ee,serverHealthState:ze,tmuxAvailable:he=!0,defaultSessionMode:de="shell",push:$e,pinned:qe,onTogglePinned:oe,recoverableTmuxSessions:Re=[],recoverableTmuxSessionsLoading:K=!1,onRefreshRecoverableTmuxSessions:we}){const{t:Z}=Qr(),[,Ue]=b.useState(0),[Le,Y]=b.useState(null),[Ee,be]=b.useState(!1),[Me,Ze]=b.useState(!1),[Se,se]=b.useState({}),Ye=Me||Object.keys(Se).length>0,pt=b.useRef(!1);b.useEffect(()=>{let $=!1;return vl().then(Te=>{$||pt.current||se(Object.fromEntries(Mb(Te.collaborationPanels?.[Qu()]).map(He=>[He,!0])))}).catch(()=>{}),()=>{$=!0}},[]);const rt=async($,Te)=>{pt.current=!0,await Io({floatingGroupId:Te},$),se(He=>({...He,[$]:Te!==null}))},[ye,et]=b.useState([]),[ht,te]=b.useState(!1),[ve,ct]=b.useState(null),[re,me]=b.useState(null),[je,mt]=b.useState(null),[ae,De]=b.useState(null),gt=vu($=>$.tasks),ft=vu($=>$.error),[kt,Dt]=b.useState(!1);b.useEffect(()=>{const $=()=>{document.hidden||vu.getState().refresh()};$();const Te=window.setInterval($,5e3);return document.addEventListener("visibilitychange",$),()=>{clearInterval(Te),document.removeEventListener("visibilitychange",$)}},[]);const Yt=async $=>{if(pt.current=!0,!$)return Ze(!0),dn(),!0;const Te=Tu.getState().collaborationGroups.find(Je=>Je.id===$),He=Xn.getState().docks[$]?.sessionId,Ke=a.find(Je=>Je.id===l&&Te?.sessionIds.includes(Je.id))??a.find(Je=>Je.id===He)??a.find(Je=>Te?.sessionIds.includes(Je.id));if(Ke&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Ke.id})),Se[$])return dn(),!0;try{const Je=await vl(),xt=zm(Je.collaborationPanels?.[Qu()],$),Qt=xt.mode??"docked";return await Io({floatingGroupId:$,mode:Qt,...Qt==="docked"&&(Ke||l)?{dock:{sessionId:Ke?.id??l,side:xt.dock?.side??(window.innerWidth<640?"bottom":"right")}}:{}},$),se(vt=>({...vt,[$]:!0})),dn(),!0}catch{return De("协作面板打开失败,请重试"),!1}},xr=Tu($=>$.collaborationGroups),rr=Tu($=>$.setCollaborationGroups),[Ir,ne]=b.useState({mode:de}),{preference:Ne,agents:tt,detecting:jt,refresh:Et,selectAgent:dr}=CQ(),Jt=b.useRef(null),We=!!(G?.latestVersion&&["installing","ready","restarting","error"].includes(G.status)),Lr=!!ze?.attention,Xe=[Z("sidebar.moreActions"),Lr?Z("sidebar.serverAttention"):null,We&&G?.latestVersion?Z("sidebar.updateAvailable",{version:G.latestVersion}):null].filter(Boolean).join(": "),Pt=Zt($=>$.groupByFolder),Ge=Zt($=>$.collapsedGroups),It=Zt($=>$.toggleGroupCollapsed),cn=b.useRef(null),Lt=b.useRef(null),Vr=b.useRef(null),ut=b.useRef(0),fn=b.useRef(!1),Sr=b.useRef(null),Pr=b.useRef(null),[br,pe]=b.useState(!1),Er=b.useRef([]),fe=b.useRef(null),Ve=b.useRef(null),nr=b.useRef(new Set),an=b.useRef(null),Nr=b.useMemo(()=>new Set(w.flatMap($=>$.sessionIds)),[w]),Ar=b.useMemo(()=>new Map(a.map($=>[$.id,$])),[a]),Bt=b.useMemo(()=>JQ(xr,new Set(Ar.keys())),[xr,Ar]),Rr=b.useCallback(async()=>{const $=++ut.current;try{const Te=await gb();if($!==ut.current)return;rr(Array.isArray(Te.groups)?Te.groups:[])}catch{}},[]);b.useEffect(()=>mb($=>rr($.groups)),[]),b.useEffect(()=>{Rr();const $=window.setInterval(()=>{Rr()},1e4),Te=()=>{Rr()};return window.addEventListener("focus",Te),()=>{ut.current+=1,window.clearInterval($),window.removeEventListener("focus",Te)}},[Rr]),b.useEffect(()=>{(e||!Ye)&&Rr()},[Ye,e,Rr]);const fs=b.useCallback(()=>{Er.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap($=>{const Te=$.dataset.collaborationMember??"",He=$.hasAttribute("data-collaboration-background"),Ke=$.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!Te&&!He||!Ke)return[];const Je=[];for(let xt=$.parentElement;xt;xt=xt.parentElement)Je.push({element:xt,top:xt.scrollTop,left:xt.scrollLeft});return[{element:$,sessionId:Te,groupId:Ke,background:He,rect:$.getBoundingClientRect(),scrollParents:Je}]})},[]),Xr=b.useCallback(($,Te)=>{if(!fn.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(Ct=>Ct.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Ct=>Ct.removeAttribute("data-drop-active"));const Ke=document.elementsFromPoint($,Te).map(Ct=>Ct.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(Ke?.dataset.collaborationGroup){Ke.dataset.dropActive="true",Ve.current={kind:"collaboration",groupId:Ke.dataset.collaborationGroup,background:!0};return}const Je=Er.current.find(Ct=>{if(Ct.sessionId===Pr.current||!Ct.element.isConnected)return!1;const ar=Ct.scrollParents.reduce(($t,Ur)=>$t+Ur.element.scrollLeft-Ur.left,0),cr=Ct.scrollParents.reduce(($t,Ur)=>$t+Ur.element.scrollTop-Ur.top,0);return $>=Ct.rect.left-ar&&$<=Ct.rect.right-ar&&Te>=Ct.rect.top-cr+Ct.rect.height*.25&&Te<=Ct.rect.bottom-cr-Ct.rect.height*.25});if(Je?.background){Je.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),Ve.current={kind:"collaboration",groupId:Je.groupId,background:!0};return}if(Je&&!w.find(ar=>ar.sessionIds.includes(Je.sessionId))?.sessionIds.includes(Pr.current??"")){Je.element.dataset.dropActive="true",Ve.current={kind:"split",sessionId:Je.sessionId,groupId:Je.groupId};return}const xt=document.elementsFromPoint($,Te).filter(Ct=>{const ar=Ct.closest("[data-rfd-draggable-id]");return!ar||!["session:","split-member:","collaboration-member:"].some(cr=>ar.dataset.rfdDraggableId===`${cr}${Pr.current}`)}),Qt=xt.map(Ct=>Ct.closest("[data-collaboration-group]")).find(Ct=>Ct?.dataset.collaborationGroup);if(Qt?.dataset.collaborationGroup){const Ct=Qt.dataset.collaborationGroup,ar=xt.map(Or=>Or.closest("[data-collaboration-split]")).find(Boolean),cr=xt.map(Or=>Or.closest("[data-collaboration-member]")).find(Boolean),$t=cr?.dataset.collaborationMember??ar?.dataset.splitAnchor,Ur=Ct===Sr.current&&w.some(Or=>Or.sessionIds.includes($t??"")&&Or.sessionIds.includes(Pr.current??""));if($t&&!Ur&&(Ct!==Sr.current||!cr&&ar)){Qt.dataset.dropActive="true";const Or=cr??ar;Or&&(Or.dataset.dropActive="true"),Ve.current={kind:"split",sessionId:$t,groupId:Ct}}else{const Or=xt.some(es=>es.closest("[data-collaboration-background]"));(Ct!==Sr.current||Or)&&(Qt.dataset.dropActive="true"),Ve.current={kind:"collaboration",groupId:Ct,background:Or}}return}const lt=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(Ct=>Ct.dataset.sidebarEntityListId===fe.current).find(Ct=>{const ar=Ct.getBoundingClientRect();return $>=ar.left&&$<=ar.right&&Te>=ar.top-8&&Te<=ar.bottom+8});if(!lt){Ve.current=null;return}const At=Array.from(lt.children).filter(Ct=>Ct instanceof HTMLElement&&Ct.hasAttribute("data-sidebar-entity-index")),Mt=At.findIndex(Ct=>{const ar=Ct.getBoundingClientRect();return Te<ar.top+ar.height/2}),Ot=Mt<0?At.length:Mt;Ve.current={kind:"list",listId:lt.dataset.sidebarEntityListId??"",index:Ot};const dt=Array.from(lt.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(Ct=>Ct.dataset.splitExitDropIndex===String(Ot));dt instanceof HTMLElement&&(dt.dataset.active="true")},[w]);b.useEffect(()=>{const $=He=>Xr(He.clientX,He.clientY),Te=He=>{const Ke=He.touches[0];Ke&&Xr(Ke.clientX,Ke.clientY)};return window.addEventListener("pointermove",$),window.addEventListener("touchmove",Te,{passive:!0}),()=>{window.removeEventListener("pointermove",$),window.removeEventListener("touchmove",Te)}},[Xr]);const pn=b.useCallback(($,Te)=>{try{$(Te)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(He=>{delete He.dataset.sidebarDragging}),fn.current=!1,Er.current=[],pe(!1),Sr.current=null,Pr.current=null,fe.current=null,Ve.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(He=>He.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(He=>He.removeAttribute("data-drop-active"))}},[]),mn=b.useMemo(()=>a.filter($=>!Nr.has($.id)),[a,Nr]),An=b.useMemo(()=>{let $=0;for(const Te of a)c.get(Te.id)?.agentStatus==="working"&&($+=1);return $},[a,c]);b.useLayoutEffect(()=>{const $=cn.current,Te=Lt.current;if(!e||!$||!Te){Vr.current=null;return}const He=Te.getBoundingClientRect(),Ke=$.getBoundingClientRect(),Je={item:$,top:Math.round(Ke.top-He.top+Te.scrollTop),height:Math.round(Ke.height),viewportHeight:Te.clientHeight},xt=Vr.current;if(Vr.current=Je,xt?.item===Je.item&&xt.top===Je.top&&xt.height===Je.height&&xt.viewportHeight===Je.viewportHeight||fn.current||Te.clientHeight===0)return;const Qt=8,vt=Ke.top-He.top,lt=Ke.bottom-He.top;vt<Qt?Te.scrollTop+=vt-Qt:lt>Te.clientHeight-Qt&&(Te.scrollTop+=lt-Te.clientHeight+Qt)});const Rn=b.useMemo(()=>{if(!Pt||!l)return null;const $=c.get(l)?.cwd??null;return M8($)},[Pt,l,c]);b.useEffect(()=>{if(!Pt){an.current=null,nr.current.clear();return}if(!l){an.current=null;return}const $=Zt.getState(),Te=nr.current,He=an.current,Ke=Rn;He!==null&&He!==Ke&&Te.has(He)&&($.collapsedGroups.has(He)||$.toggleGroupCollapsed(He),Te.delete(He)),Ke!==null&&Ke!==""&&$.collapsedGroups.has(Ke)&&($.toggleGroupCollapsed(Ke),Te.add(Ke)),an.current=Ke},[Pt,l,Rn]),b.useEffect(()=>{e||be(!1)},[e]),b.useEffect(()=>{ne($=>({...$,command:Ne?.command}))},[Ne]),b.useEffect(()=>{if(!Ee)return;let $=!1;return te(!0),me(null),og().then(Te=>{$||et(Te)}).catch(()=>{$||me(Z("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{$||te(!1)}),()=>{$=!0}},[Ee,Z]),b.useEffect(()=>{if(!Le)return;const $=Te=>{Te instanceof KeyboardEvent&&Te.key!=="Escape"||Te instanceof PointerEvent&&Te.target instanceof Node&&Jt.current?.contains(Te.target)||Y(null)};return window.addEventListener("pointerdown",$),window.addEventListener("keydown",$),()=>{window.removeEventListener("pointerdown",$),window.removeEventListener("keydown",$)}},[Le]);const dn=()=>{!$e&&!qe&&r()},Mn=de==="tmux"&&!he?"shell":de,bn=()=>{p({mode:Mn}),dn()},_n=()=>{Ne&&(p({mode:Mn,command:Ne.command}),dn())},Dn=$=>{mt($.name),p({mode:"tmux",tmuxSessionName:$.name,cwd:$.cwd??void 0}),dn()};b.useEffect(()=>{je&&(Re.some($=>$.name===je)||mt(null))},[je,Re]);const kn=($,Te)=>{p({...Ir,cwd:Ir.cwd?.trim()||void 0,command:Te??$?.command}),be(!1),dn()},$r=async $=>{ct($.id),me(null);try{const Te=await xb($.id);p({mode:"shell",cwd:Te.cwd,command:Te.command}),be(!1),dn()}catch(Te){const He=Te&&typeof Te=="object"&&"code"in Te?String(Te.code??""):"";me(Z(He==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{ct(null)}},Ts=async $=>{et(Te=>Te.filter(He=>He.id!==$));try{await U8($)}catch{me(Z("sidebar.resumeHistoryRemoveFailed")),og().then(et).catch(()=>{})}},er=()=>{if(Ee){be(!1);return}ne({mode:de==="tmux"&&!he?"shell":de,cwd:l?c.get(l)?.cwd??void 0:void 0,command:Ne?.command}),be(!0)},qr=b.useCallback($=>{const Te=c.get($);return Te?.agentStatus==="waiting"||Te?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":Te?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":Te?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[c]),Qn=Ky(),Tn=b.useCallback(($,Te,He,Ke)=>{const Je=$.id===l,xt=Nr.has($.id),Qt=!!(He&&xt),vt=c.get($.id),lt=Nu(vt?.cwd??null),At=vt?.shellTitle??D8($.id),Mt=At===vt?.cwd||At===lt?null:At,Ot=j8($,vt?.activeProgram??null,null,B8,Mt,vt?.promptState??null),dt=!!(vt?.tuiProgress&&vt.tuiProgress.state!=="remove"),ar=vt?.promptState==="running"||vt?.agentStatus==="working"||dt?"bg-[var(--success)]":vt?.agentStatus==="waiting"||vt?.agentNeedsReview?"bg-[var(--warning)]":vt?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:Je?cn:null,type:"button",...Te??{},onContextMenu:cr=>{B&&(cr.preventDefault(),B($.id,{x:cr.clientX,y:cr.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:$.id})),dn()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${Te?"cursor-grab active:cursor-grabbing ":""}${He?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:vt?.cwd??$.name,children:[Je&&i.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${ar}`}),i.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${He?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${Je?$.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":$.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[vt?.isConnecting||dt&&!vt?.agentStatus?i.jsx(Nn,{size:He?10:11,className:"animate-spin"}):vt?.agent??lg($.id)?i.jsx(bc,{agent:vt?.agent??lg($.id),size:He?13:15}):$.mode==="tmux"?i.jsx(a0,{size:He?10:11}):i.jsx(Ro,{size:He?10:11}),i.jsx(eP,{status:vt?.agentStatus??null,detail:vt?.agentStatusDetail,needsReview:vt?.agentNeedsReview,inCopyMode:vt?.inCopyMode})]}),i.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${He?"text-[11px]":"text-[12px]"} ${Je?"font-medium text-foreground":""} ${vt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:Ot}),i.jsx(Ox,{sessionIds:[$.id]})]}),Ke,i.jsx("button",{type:"button",onClick:cr=>{cr.stopPropagation(),Qt?A($.id):xt?y($.id):x($.id)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md transition hover:bg-primary/15 hover:text-primary active:scale-95 ${He?"h-6 w-6":"h-[26px] w-[26px]"} ${xt?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${Z(Qt?"tab.splitRemovePane":xt?"tab.splitClose":"tab.split")} ${Ot}`,title:Z(Qt?"tab.splitRemovePane":xt?"tab.splitClose":"tab.split"),children:Qt?i.jsx(sT,{size:11}):i.jsx(xl,{size:12})}),i.jsx("button",{type:"button",onClick:cr=>{cr.stopPropagation(),g($.id,cr)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition hover:bg-destructive/15 hover:text-destructive active:scale-95 ${He?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":Z("sidebar.closeSession",{name:Ot}),title:Z("common.close"),children:i.jsx(Kn,{size:He?11:12})})]})},[l,Nr,c,g,x,y,A,B,Z]),Yr=b.useMemo(()=>Th(a,$=>c.get($.id)?.cwd??null,Pt,Z("sidebar.ungrouped"),w,Bt).groups,[Bt,Pt,a,c,w,Z]),jr=b.useMemo(()=>au(a,w,Ar,Bt),[Bt,a,Ar,w]),rn=b.useCallback($=>{pe($.draggableId.startsWith("collaboration:")||$.draggableId.startsWith("workspace:"));const Te=$.draggableId.replace(/^split-member:/,"");Pr.current=$.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const He=$.type==="split-member"?w.find(vt=>vt.sessionIds.includes(Te)):null,Ke=$.type==="collaboration-member"?$.source.droppableId.replace(/^collaboration-members:/,""):null,Je=Ke?Bt.find(vt=>vt.id===Ke):null;fn.current=!!(He||Je||$.type==="session"&&$.draggableId.startsWith("session:")),fn.current&&document.querySelectorAll("[data-collaboration-group]").forEach(vt=>{vt.dataset.sidebarDragging="true"}),Sr.current=Je?.id??null;const xt=He?.sessionIds??Je?.sessionIds??[],Qt=xt.length>0?Yr.find(vt=>xt.every(lt=>vt.sessions.some(At=>At.id===lt))):null;fe.current=Pt?Qt?`group-sessions:${Qt.key}`:null:xt.length>0?"sidebar-entities":null,Ve.current=null},[Bt,Yr,Pt,w]),Br=b.useCallback(($,Te,He)=>{if(Te===He)return;const Ke=Te?xr.find(lt=>lt.id===Te):null,Je=He?xr.find(lt=>lt.id===He):null;if(He&&!Je)return;if(Je){const lt=a.map(Mt=>Mt.id).filter(Mt=>Mt!==$);let At=-1;lt.forEach((Mt,Ot)=>{Je.sessionIds.includes(Mt)&&(At=Ot)}),At>=0&&(lt.splice(At+1,0,$),M(lt))}const xt=Ke?.sessionIds.filter(lt=>lt!==$)??[],Qt=Je?[...Je.sessionIds.filter(lt=>lt!==$),$]:[];rr(lt=>lt.flatMap(At=>At.id===Te?xt.length>=2?[{...At,sessionIds:xt}]:[]:At.id===He?[{...At,sessionIds:Qt}]:[At])),De(null),(Ke&&Je?Q8({sourceGroupId:Ke.id,targetGroupId:Je.id,sessionId:$,expectedSourceUpdatedAt:Ke.updatedAt,expectedTargetUpdatedAt:Je.updatedAt}):Ke?xt.length>=2?fc({id:Ke.id,name:Ke.name,sessionIds:xt,expectedUpdatedAt:Ke.updatedAt}):Yp(Ke.id,Ke.updatedAt):Je?fc({id:Je.id,name:Je.name,sessionIds:Qt,expectedUpdatedAt:Je.updatedAt}):Promise.resolve()).then(()=>Rr(),lt=>(De(lt instanceof Error?lt.message:"协作成员移动失败"),Rr()))},[xr,Rr,a,M]),W=b.useCallback(($,Te,He)=>{const Ke=xr.find(lt=>lt.id===$);if(!Ke||Te===He)return;const Je=Ke.sessionIds.filter(lt=>!lt.startsWith("remote:")),xt=Vd(Je,w).flatMap(lt=>lt.sessionIds),[Qt]=xt.splice(Te,1);if(!Qt)return;xt.splice(He,0,Qt);const vt=w.find(lt=>lt.sessionIds.includes(Qt));if(vt&&vt.sessionIds.every(lt=>Ke.sessionIds.includes(lt))){const lt=xt.filter(At=>vt.sessionIds.includes(At));E(vt.id,lt)}xt.push(...Ke.sessionIds.filter(lt=>lt.startsWith("remote:"))),rr(lt=>lt.map(At=>At.id===$?{...At,sessionIds:xt}:At)),De(null),fc({id:Ke.id,name:Ke.name,sessionIds:xt,expectedUpdatedAt:Ke.updatedAt}).then(()=>Rr(),lt=>(De(lt instanceof Error?lt.message:"成员排序失败"),Rr()))},[xr,Rr,w,E]);b.useEffect(()=>{const $=Te=>{const{sourceId:He,targetId:Ke}=Te.detail;if(!He||!Ke||He===Ke)return;const Je=Th(a,$t=>c.get($t.id)?.cwd??null,Pt,"",w,Bt).arranged.map($t=>$t.id),xt=Je.indexOf(He),Qt=Je.indexOf(Ke);if(xt<0||Qt<0)return;const vt=Bt.find($t=>$t.sessionIds.includes(He));if(vt?.sessionIds.includes(Ke)){const $t=Vd(vt.sessionIds,w).flatMap(Ur=>Ur.sessionIds);W(vt.id,$t.indexOf(He),$t.indexOf(Ke));return}const lt=w.filter($t=>$t.sessionIds.length>=2&&$t.sessionIds.every(Ur=>Ar.has(Ur))&&!Bt.some(Ur=>$t.sessionIds.some(Or=>Ur.sessionIds.includes(Or)))),At=lt.find($t=>$t.sessionIds.includes(He));if(At?.sessionIds.includes(Ke)){const $t=[...At.sessionIds];$t.splice($t.indexOf(He),1),$t.splice(At.sessionIds.indexOf(Ke),0,He),E(At.id,$t);return}const Mt=$t=>Bt.find(Ur=>Ur.sessionIds.includes($t))?.sessionIds??lt.find(Ur=>Ur.sessionIds.includes($t))?.sessionIds??[$t],Ot=new Set(Mt(He)),dt=new Set(Mt(Ke)),Ct=Je.filter($t=>!Ot.has($t)),ar=Ct.flatMap(($t,Ur)=>dt.has($t)?[Ur]:[]),cr=xt<Qt?Math.max(...ar)+1:Math.min(...ar);Ct.splice(cr,0,...Je.filter($t=>Ot.has($t))),M(Ct)};return window.addEventListener("reorder-navigation-session",$),()=>window.removeEventListener("reorder-navigation-session",$)},[a,c,Pt,w,Bt,Ar,W,E,M]);const Be=b.useCallback($=>{if($.type!=="collaboration-member")return!1;if($.reason==="CANCEL")return!0;const Te=$.source.droppableId.replace(/^collaboration-members:/,""),He=$.draggableId.replace(/^collaboration-member:/,""),Ke=Ve.current;if(Ke?.kind==="split")return Br(He,Te,Ke.groupId),I(Ke.sessionId,He),!0;if(Ke?.kind==="collaboration"&&Ke.groupId!==Te)return Br(He,Te,Ke.groupId),!0;if(Ke?.kind==="collaboration"&&Ke.background)return Nr.has(He)&&A(He),!0;if($.destination&&$.destination.droppableId!==$.source.droppableId){const Je=$.destination.droppableId.replace(/^collaboration-members:/,"");if(Bt.some(xt=>xt.id===Je))return Br(He,Te,Je),!0}if($.combine){const Je=$.combine.droppableId.replace(/^collaboration-members:/,"");Je!==Te&&Br(He,Te,Je);const xt=$.combine.draggableId.replace(/^collaboration-member:/,"");if(w.find(vt=>vt.sessionIds.includes(He))?.sessionIds.includes(xt)){const vt=Bt.find(At=>At.id===Te),lt=vt?Vd(vt.sessionIds,w).flatMap(At=>At.sessionIds).indexOf(xt):-1;lt>=0&&W(Te,$.source.index,lt)}else Ar.has(xt)&&I(xt,He);return!0}if($.destination?.droppableId===$.source.droppableId)return W(Te,$.source.index,$.destination.index),!0;if(Ke?.kind!=="list")return!0;if(Ke?.kind==="list"){const Je=Yr.find(Qt=>`group-sessions:${Qt.key}`===Ke.listId),xt=Ke.listId==="sidebar-entities"?jr:Je?au(Je.sessions,w,Ar,Bt):null;if(xt){const Qt=_5(xt,He,Ke.index);Ke.listId==="sidebar-entities"?M(Qt):Je&&M(Yr.flatMap(vt=>vt.key===Je.key?Qt:vt.sessions.map(lt=>lt.id)))}}return Br(He,Te,null),!0},[Bt,jr,Yr,Br,M,W,Ar,w,Nr,A,I]),wt=b.useCallback($=>{if($.type!=="split-member")return!1;if($.reason==="CANCEL")return!0;const Te=$.draggableId.replace(/^split-member:/,""),He=w.find(lt=>lt.sessionIds.includes(Te));if(!He?.sessionIds.includes(Te))return!0;const Ke=He.id,Je=Ve.current;if(Je?.kind==="split")return Br(Te,null,Je.groupId),I(Je.sessionId,Te),!0;if(Je?.kind==="collaboration")return Br(Te,null,Je.groupId),!0;if(!$.destination&&Je?.kind==="list"){const lt=Yr.find(Ot=>`group-sessions:${Ot.key}`===Je.listId),At=Je.listId==="sidebar-entities"?jr:lt?au(lt.sessions,w,Ar,Bt):null;if(!At)return!0;const Mt=_5(At,Te,Je.index);return A(Te),Je.listId==="sidebar-entities"?M(Mt):lt&&M(Yr.flatMap(Ot=>Ot.key===lt.key?Mt:Ot.sessions.map(dt=>dt.id))),!0}if(!$.destination)return!0;const xt=$.destination.droppableId.replace(/^split-members:/,"");if(xt!==Ke){const At=w.find(Mt=>Mt.id===xt)?.sessionIds[0];return At&&I(At,Te),!0}if($.source.index===$.destination.index)return!0;const Qt=[...He.sessionIds],[vt]=Qt.splice($.source.index,1);return vt&&(Qt.splice($.destination.index,0,vt),E(Ke,Qt)),!0},[Bt,jr,Yr,Br,I,A,M,E,Ar,w]),yr=($,Te="top")=>i.jsx("div",{"data-split-exit-drop-index":$,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${Te==="top"?"-top-1":"-bottom-1"}`,children:i.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-1 top-1/2 h-px -translate-y-1/2 rounded-full bg-transparent transition-colors group-data-[active=true]/split-exit:bg-primary"})}),Rt=b.useCallback(($,Te,He)=>{if(Be($)||wt($)||$.reason==="CANCEL")return;const Ke=Te.find(lt=>lt.id===$.draggableId);if(!Ke)return;const Je=Ve.current;if(Je?.kind==="split"&&Ke.kind==="session"){Br(Ke.session.id,null,Je.groupId),I(Je.sessionId,Ke.session.id);return}if(Je?.kind==="collaboration"&&Ke.kind==="session"){Br(Ke.session.id,null,Je.groupId);return}if($.combine&&Ke.kind!=="session"){const lt=Te.findIndex(At=>At.id===$.combine?.draggableId);if(lt<0)return;$={...$,combine:null,destination:{...$.source,index:lt}}}if($.combine){const lt=Te.find(Ct=>Ct.id===$.combine?.draggableId);if(!lt)return;const At=lt.kind==="workspace"?lt:Ke.kind==="workspace"?Ke:lt,Mt=At===Ke?lt:Ke,Ot=At.sessionIds[0],dt=Mt.sessionIds[0];Ot&&dt&&Ot!==dt&&I(Ot,dt);return}if(!$.destination||$.source.index===$.destination.index)return;const xt=[...Te],[Qt]=xt.splice($.source.index,1);if(!Qt)return;xt.splice($.destination.index,0,Qt);const vt=xt.flatMap(lt=>lt.sessionIds);if(He===void 0){M(vt);return}M(Yr.flatMap(lt=>lt.key===He?vt:lt.sessions.map(At=>At.id)))},[Yr,Be,wt,Br,I,M]),Mr=b.useCallback($=>{if($.reason==="CANCEL"||Be($)||wt($))return;if($.type==="group"){if(!$.destination||$.source.index===$.destination.index)return;M(bb(Yr,$.source.index,$.destination.index));return}const Te=$.source.droppableId.replace(/^group-sessions:/,""),He=Yr.find(Je=>Je.key===Te);if(!He)return;const Ke=au(He.sessions,w,Ar,Bt);if($.combine||Ve.current?.kind==="collaboration"||Ve.current?.kind==="split"){Rt($,Ke,Te);return}!$.destination||$.destination.droppableId!==$.source.droppableId||Rt($,Ke,Te)},[Bt,Yr,Ar,w,Be,Rt,wt,M]),Dr=$=>{const Te=Le===$.id,He=[{layout:"horizontal",label:Z("tab.splitHorizontal"),icon:xl},{layout:"vertical",label:Z("tab.splitVertical"),icon:pg},...$.sessionIds.length>=3||$.layout==="grid"?[{layout:"grid",label:Z("tab.splitGrid"),icon:fg}]:[]],Ke=$.layout==="vertical"?pg:$.layout==="grid"?fg:xl,Je=He.find(xt=>xt.layout===$.layout)?.label??Z("tab.splitHorizontal");return i.jsxs("div",{ref:Te?Jt:void 0,className:"relative shrink-0",onPointerDown:xt=>xt.stopPropagation(),children:[i.jsx("button",{type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${Te?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${Z("tab.splitLayout")}: ${Je}`,"aria-haspopup":"menu","aria-expanded":Te,title:Z("tab.splitLayout"),onClick:xt=>{xt.stopPropagation(),Y(Qt=>Qt===$.id?null:$.id)},children:i.jsx(Ke,{size:12})}),Te&&i.jsx("div",{role:"menu","aria-label":Z("tab.splitLayout"),className:"absolute right-0 top-full z-30 mt-1 flex gap-0.5 rounded-md border border-border bg-surface-elevated p-1 shadow-lg",children:He.map(xt=>{const Qt=xt.icon,vt=xt.layout===$.layout;return i.jsx("button",{type:"button",role:"menuitemradio","aria-checked":vt,"aria-label":xt.label,title:xt.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${vt?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:lt=>{lt.stopPropagation(),k($.sessionIds[0],xt.layout),Y(null)},children:i.jsx(Qt,{size:13})},xt.layout)})})]})},Zr=($,Te)=>Te&&i.jsx("button",{type:"button",...Te,"aria-label":$,title:$,onClick:He=>He.stopPropagation(),className:"absolute -left-2 inset-y-0 z-10 flex w-3 cursor-grab items-start justify-center pt-1.5 text-muted-foreground/60 transition hover:text-foreground focus-visible:text-foreground active:cursor-grabbing",children:i.jsx(Zh,{size:10})}),nn=($,Te,He=!1,Ke=!1,Je)=>{if(Te.length<2)return null;const xt=Te.some(Ot=>Ot.id===l),Qt=[],vt=[],lt=[];for(const Ot of Te){const dt=c.get(Ot.id);dt?.agentStatus==="waiting"||dt?.agentNeedsReview?Qt.push(Ot):dt?.agentStatus==="working"?vt.push(Ot):dt?.inCopyMode&&lt.push(Ot)}const At=$.name?.trim()||`${Z("tab.splitWorkspace")} ${w.findIndex(Ot=>Ot.id===$.id)+1}`,Mt=Le===$.id;return i.jsxs("section",{"data-split-workspace":$.id,"aria-label":At,className:`group/split relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors ${Ke?"bg-primary/15 ring-1 ring-primary/40":He?"bg-surface-elevated opacity-90 shadow-lg":Qt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":vt.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":lt.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":xt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Zr(`移动分屏组 ${At}`,Je),i.jsx(gl,{droppableId:`split-members:${$.id}`,type:"split-member",direction:"vertical",children:(Ot,dt)=>i.jsxs("div",{ref:Ot.innerRef,...Ot.droppableProps,"data-split-members":!0,className:dt.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[Te.map((Ct,ar)=>i.jsx(ml,{draggableId:`split-member:${Ct.id}`,index:ar,disableInteractiveElementBlocking:!0,children:(cr,$t)=>i.jsx("div",{ref:cr.innerRef,...cr.draggableProps,...B?Qn(()=>B(Ct.id)):{},className:`${ar===0&&Mt?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${$t.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${qr(Ct.id)??(Ct.id===l?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:Tn(Ct,cr.dragHandleProps,!0,ar===0?Dr($):void 0)})},Ct.id)),Ot.placeholder]})})]})},zn=($,Te,He,Ke=!1,Je=!1)=>{if(Te.length<($.federated?1:2))return null;const xt=Te.some(At=>At.id===l),Qt=Vd($.sessionIds,w),vt=Qt.flatMap(At=>At.sessionIds),lt=Qt.length===1?Qt[0]?.workspace:void 0;return i.jsxs("section",{"data-collaboration-group":$.id,"data-collaboration-group-name":$.name,"aria-label":`Agent 工作组:${$.name}`,className:`group/collaboration relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${Je?"bg-primary/15 ring-1 ring-primary/40":Ke?"bg-surface-elevated opacity-90 shadow-lg":xt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Zr(`移动工作组 ${$.name}`,He),i.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-sm px-2 text-left text-xs font-medium text-foreground transition hover:bg-surface-elevated md:min-h-8",title:`打开 ${$.name} 的协作工作区`,"aria-label":`打开协作工作区:${$.name}`,onClick:At=>{At.stopPropagation(),Yt($.id)},children:[i.jsx(Ad,{size:14,className:"shrink-0 text-primary"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.name}),i.jsx("span",{className:`shrink-0 text-[10px] font-normal ${gt.some(At=>At.groupId===$.id)?"text-primary":"text-muted-foreground"}`,children:gt.filter(At=>At.groupId===$.id).length?`${gt.filter(At=>At.groupId===$.id).length} 待处理`:"协作"})]}),i.jsx(gl,{droppableId:`collaboration-members:${$.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(At,Mt)=>i.jsxs("div",{ref:At.innerRef,...At.droppableProps,"data-collaboration-members":!0,className:`${Mt.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[Qt.map(Ot=>i.jsx("div",{"data-collaboration-split":Ot.workspace?.id,"data-split-anchor":Ot.workspace?.sessionIds[0],role:Ot.workspace?"region":void 0,"aria-label":Ot.workspace?`${Z("tab.splitWorkspace")} · ${Ot.sessionIds.length}`:void 0,className:Ot.workspace&&!lt?`relative my-0.5 rounded-sm before:pointer-events-none before:absolute before:inset-0 before:rounded-sm before:border before:border-border data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${Ot.sessionIds.includes(l??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:Ot.sessionIds.map(dt=>{const Ct=Ar.get(dt);return Ct?i.jsx(ml,{draggableId:`collaboration-member:${Ct.id}`,index:vt.indexOf(Ct.id),disableInteractiveElementBlocking:!0,children:(ar,cr)=>i.jsxs("div",{ref:ar.innerRef,...ar.draggableProps,"data-collaboration-member":Ct.id,"data-split-member":Nr.has(Ct.id)?"true":void 0,...B?Qn(()=>B(Ct.id)):{},className:`${Ot.workspace&&dt===Ot.sessionIds[0]&&Le===Ot.workspace.id?"z-20 ":""}relative flex items-center rounded-sm pr-0.5 transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${cr.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":cr.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${qr(Ct.id)??(Ct.id===l?"bg-surface-elevated/80 text-foreground":Nr.has(Ct.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[Tn(Ct,ar.dragHandleProps,!0,Ot.workspace&&dt===Ot.sessionIds[0]?Dr(Ot.workspace):void 0),!Ot.workspace&&Nr.has(Ct.id)&&i.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${w.find($t=>$t.sessionIds.includes(Ct.id))?.sessionIds.filter($t=>$t!==Ct.id).map($t=>Ar.get($t)?.name??$t).join("、")} 分屏`,"aria-label":`查看 ${Ct.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Ct.id})),dn()},children:i.jsx(xl,{size:10})})]})},Ct.id):null})},Ot.workspace?.id??Ot.sessionIds[0])),At.placeholder]})}),$.remoteSessions?.map(At=>i.jsxs("button",{type:"button",title:`${Gl(At)} · ${At.serviceConnected===!1?"服务不可达,消息尚未送达":At.status}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[11px] text-muted-foreground hover:bg-surface-2",onClick:()=>{Xy(At.sessionId).catch(()=>{Yt($.id)})},children:[i.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${At.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:At.name}),i.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:Gl(At)}),At.serviceConnected===!1&&i.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},At.sessionId)),i.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},jn=($,Te,He)=>i.jsx(Uh,{onBeforeCapture:fs,onDragStart:rn,onDragEnd:Ke=>pn(Je=>Rt(Je,$,He),Ke),children:i.jsx(gl,{droppableId:Te,direction:"vertical",isCombineEnabled:!br,children:Ke=>i.jsxs("div",{ref:Ke.innerRef,...Ke.droppableProps,"data-sidebar-entity-list-id":Te,className:"flex-1 space-y-0.5",children:[$.map((Je,xt)=>i.jsx(ml,{draggableId:Je.id,index:xt,disableInteractiveElementBlocking:!0,children:(Qt,vt)=>i.jsxs("div",{ref:Qt.innerRef,...Qt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":xt,className:"relative",children:[yr(xt),xt===$.length-1&&yr($.length,"bottom"),Je.kind==="workspace"?nn(Je.workspace,Je.members,vt.isDragging,!!vt.combineTargetFor,Qt.dragHandleProps):Je.kind==="collaboration"?zn(Je.group,Je.members,Qt.dragHandleProps,vt.isDragging,!!vt.combineTargetFor):i.jsx("div",{...B?Qn(()=>B(Je.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${vt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":vt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":qr(Je.session.id)??(Je.session.id===l?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Tn(Je.session,Qt.dragHandleProps)})]})},Je.id)),Ke.placeholder]})})}),ss=i.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[i.jsxs("div",{"data-session-sidebar-header":!0,className:"relative z-20 shrink-0 px-3 py-0.5",children:[i.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-3 bottom-0 z-10 h-px bg-border opacity-40"}),i.jsxs("div",{className:"flex w-full items-center gap-1.5",children:[i.jsx("div",{className:"min-w-0 flex-1",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:Z("sidebar.sessions")}),i.jsx("span",{className:"text-[11px] text-muted-foreground",children:a.length}),An>0&&i.jsx("span",{className:"ml-0.5 flex items-center",children:i.jsx(p6,{count:An,tone:"running",title:Z("agent.aiRunning")})})]})}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",onClick:()=>{be(!1),Yt(null)},className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":"Agent 工作台",title:"Agent 工作台",children:i.jsx(Ad,{size:16})}),(!$e||qe)&&i.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",onClick:r,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":Z("common.close"),children:i.jsx(Kn,{size:16})})]})]})]}),ae&&i.jsxs("div",{role:"alert",className:"mx-2 mt-2 flex items-start gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[i.jsx("span",{className:"min-w-0 flex-1",children:ae}),i.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>De(null),children:i.jsx(Kn,{size:14})})]}),i.jsxs("div",{ref:Lt,className:"relative z-10 flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[(gt.length>0||ft)&&i.jsxs("section",{className:"mb-2 rounded-lg border border-primary/20 bg-primary/5","aria-label":"协作待处理事项",children:[i.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 px-3 text-left text-xs text-primary","aria-expanded":kt,onClick:()=>Dt($=>!$),children:[i.jsx(Ad,{size:14}),i.jsx("span",{className:"min-w-0 flex-1",children:"需要你处理"}),i.jsx("span",{children:gt.length}),i.jsx(yc,{size:12,className:kt?"rotate-90":""})]}),kt&&i.jsxs("div",{className:"space-y-1 p-1 pt-0",children:[ft&&i.jsxs("p",{role:"alert",className:"px-2 py-2 text-[11px] text-destructive",children:[ft,i.jsx("button",{type:"button",className:"ml-2 text-primary",onClick:()=>{vu.getState().refresh()},children:"重试"})]}),gt.map($=>i.jsxs("button",{type:"button",className:"min-h-11 w-full rounded-md px-2 py-2 text-left hover:bg-surface-2",onClick:()=>{Px($.groupId,$.id),Yt($.groupId).then(Te=>{Te&&Px($.groupId,$.id)})},children:[i.jsx("span",{className:"block truncate text-xs text-foreground",children:$.title}),i.jsxs("span",{className:"mt-1 block truncate text-[10px] text-muted-foreground",children:[xr.find(Te=>Te.id===$.groupId)?.name??"协作组"," · ",qu($)]})]},$.id))]})]}),Re.length>0&&i.jsxs("section",{className:"mb-2 shrink-0 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":Z("sidebar.recoverableSessions"),children:[i.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[i.jsx(uc,{size:12,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("sidebar.recoverableSessions")}),i.jsx("span",{className:"text-muted-foreground",children:Re.length}),we&&i.jsx("button",{type:"button",onClick:we,disabled:K,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":Z("sidebar.refreshRecoverableSessions"),title:Z("sidebar.refreshRecoverableSessions"),children:i.jsx(Jn,{size:11,className:K?"animate-spin":""})})]}),i.jsx("div",{className:"space-y-0.5",children:Re.slice(0,4).map($=>{const Te=$.friendlyName?.trim()||$.label?.trim()||$.name,He=Nu($.cwd??null),Ke=je===$.name;return i.jsxs("button",{type:"button",disabled:je!==null,onClick:()=>Dn($),className:"group flex min-h-10 w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-wait disabled:opacity-60","aria-label":Z("sidebar.restoreRecoverableSession",{name:Te}),title:$.cwd||$.name,children:[i.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--tmux-rgb)_/_0.11)] text-[color:var(--tmux)]",children:Ke?i.jsx(Nn,{size:12,className:"animate-spin"}):i.jsx(a0,{size:12})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:Te}),i.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[$.program,He].filter(Boolean).join(" · ")||`tmux:${$.name}`})]}),i.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:Z(Ke?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},$.name)})})]}),a.length===0?i.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[i.jsx(Ro,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),i.jsx("p",{className:"text-[12px] text-muted-foreground",children:Z("sidebar.noSessions")})]}):mn.length===0&&w.length===0?i.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:i.jsx("p",{className:"text-[12px] text-muted-foreground",children:Z("sidebar.noMatchingSessions")})}):Pt?i.jsx("div",{className:"flex flex-1 flex-col",children:i.jsx(Uh,{onBeforeCapture:fs,onDragStart:rn,onDragEnd:$=>pn(Mr,$),children:i.jsx(gl,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:$=>i.jsxs("div",{ref:$.innerRef,...$.droppableProps,className:"flex flex-1 flex-col space-y-1.5",children:[Yr.map((Te,He)=>{const Ke=Ge.has(Te.key),Je=!Ke&&He===Yr.length-1,xt=au(Te.sessions,w,Ar,Bt);let Qt=0,vt=0;for(const At of Te.sessions){const Mt=c.get(At.id);Mt?.agentStatus==="working"&&(Qt+=1),(Mt?.agentStatus==="waiting"||Mt?.agentNeedsReview)&&(vt+=1)}const lt=Te.key==="";return i.jsx(ml,{draggableId:`sidebar-group:${Te.key||"__ungrouped__"}`,index:He,isDragDisabled:lt,disableInteractiveElementBlocking:!0,children:(At,Mt)=>i.jsxs("div",{ref:At.innerRef,...At.draggableProps,className:`shrink-0 rounded-md transition-colors ${Je?"flex flex-1 flex-col ":""}${Mt.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[i.jsxs("button",{type:"button",...lt?{}:At.dragHandleProps,onClick:()=>{It(Te.key),nr.current.delete(Te.key)},className:`flex w-full shrink-0 items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${lt?"":"cursor-grab active:cursor-grabbing"}`,title:Te.key||Te.label,children:[i.jsx(yc,{size:13,className:`shrink-0 transition-transform ${Ke?"":"rotate-90"}`}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:Te.label}),Qt>0&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),vt>0&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),i.jsx(Ox,{sessionIds:Te.sessions.map(Ot=>Ot.id)}),i.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:Te.sessions.length})]}),!Ke&&i.jsx("div",{className:`mt-0.5 pl-2 ${Je?"flex flex-1 flex-col":""}`,children:i.jsx(gl,{droppableId:`group-sessions:${Te.key}`,type:"session",direction:"vertical",isCombineEnabled:!br,children:Ot=>i.jsxs("div",{ref:Ot.innerRef,...Ot.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${Te.key}`,className:`${Je?"flex-1 ":""}space-y-0.5`,children:[xt.map((dt,Ct)=>i.jsx(ml,{draggableId:dt.id,index:Ct,disableInteractiveElementBlocking:!0,children:(ar,cr)=>i.jsxs("div",{ref:ar.innerRef,...ar.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":Ct,className:"relative",children:[yr(Ct),Ct===xt.length-1&&yr(xt.length,"bottom"),dt.kind==="workspace"?nn(dt.workspace,dt.members,cr.isDragging,!!cr.combineTargetFor,ar.dragHandleProps):dt.kind==="collaboration"?zn(dt.group,dt.members,ar.dragHandleProps,cr.isDragging,!!cr.combineTargetFor):i.jsx("div",{...B?Qn(()=>B(dt.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${cr.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":cr.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":qr(dt.session.id)??(dt.session.id===l?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Tn(dt.session,ar.dragHandleProps)})]})},dt.id)),Ot.placeholder]})})})]})},Te.key||"__ungrouped__")}),$.placeholder]})})})}):jn(jr,"sidebar-entities")]}),i.jsx(P8,{onReselect:()=>{h&&(Vr.current=null,Ue($=>$+1),h())}}),Ee&&i.jsx(wQ,{directories:a.flatMap($=>{const Te=c.get($.id)?.cwd;return Te?[Te]:[]}),tmuxAvailable:he,options:Ir,agents:tt,selectedAgent:Ne,detecting:jt,resumeHistory:ye,resumeHistoryLoading:ht,resumeHistoryPendingId:ve,resumeHistoryError:re,onRefreshAgents:()=>{Et().catch(()=>{})},onSelectAgent:$=>{dr($).catch(()=>{})},onLaunchAgent:kn,onResumeHistory:$=>{$r($)},onRemoveResumeHistory:$=>{Ts($)},onClose:()=>be(!1),onOptionsChange:ne,additionalContent:We&&G?.latestVersion&&i.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]",children:i.jsx(Jn,{size:13,className:G.status==="installing"||G.status==="restarting"?"animate-spin":""})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-semibold",children:Z("sidebar.updateAvailable",{version:G.latestVersion})}),i.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:G.status==="installing"?Z("sidebar.updateInstalling"):G.status==="ready"?Z("sidebar.updateReady"):G.status==="restarting"?Z("sidebar.updateRestarting"):Z("sidebar.updateFailed")})]})]}),G.status==="ready"&&X&&i.jsx("button",{type:"button",disabled:Q,onClick:X,className:"mt-2 flex w-full items-center justify-center rounded-md bg-[var(--warning)] px-2 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:Z("sidebar.updateRestart")}),G.status==="error"&&ee&&i.jsx("button",{type:"button",disabled:Q,onClick:ee,className:"mt-2 flex w-full items-center justify-center rounded-md bg-surface-elevated px-2 py-1.5 text-[11px] font-semibold text-foreground transition hover:bg-surface-2 disabled:cursor-wait disabled:opacity-60",children:Z("sidebar.updateRetry")})]}),footerActions:i.jsx(XQ,{serverAttention:Lr,onOpenSettings:()=>{be(!1),F()},actions:[...U?[{label:Z("sidebar.subscriptionQuota"),icon:b9,onSelect:()=>{be(!1),U()}}]:[],{label:"Agent 工作台",icon:Ad,onSelect:()=>{be(!1),Yt(null)}},{label:"服务与设备",icon:O8,onSelect:()=>{be(!1),F8()}},...oe?[{label:Z(qe?"sidebar.unpinSidebar":"sidebar.pinSidebar"),icon:qe?ju:Du,separated:!0,onSelect:()=>{be(!1),oe()}}]:[]]})}),Me&&i.jsx(w5,{onEnterGroup:async $=>{if(!await Yt($))throw new Error("协作组已保存,打开工作区失败,请重试");Ze(!1)},onFloatingChange:async $=>{if($){if(!await Yt($))throw new Error("打开协作工作区失败");Ze(!1)}},activeSessionId:l,defaultSessionMode:de,onClose:()=>Ze(!1),onNewSession:$=>p($)}),Object.entries(Se).map(([$,Te])=>i.jsx(w5,{activeSessionId:l,initialCollaborationGroupId:$,initialFloating:Te,onEnterGroup:async He=>{if(He!==$){if(!await Yt(He))throw new Error("协作组已保存,打开工作区失败,请重试");await Io({floatingGroupId:null},$),se(Ke=>{const Je={...Ke};return delete Je[$],Je})}},onFloatingChange:He=>rt($,He),defaultSessionMode:de,onClose:()=>{pt.current=!0,se(He=>{const Ke={...He};return delete Ke[$],Ke})},onNewSession:He=>p(He)},$)),!Ee&&i.jsx("div",{className:"relative z-10 shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-1 md:border-t md:border-border md:p-2",children:i.jsxs("div",{className:`grid gap-1.5 [&>button]:min-h-11 [&>button]:shadow-none [&>button]:ring-0 md:[&>button]:min-h-0 ${Ne?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[i.jsxs("button",{type:"button",onClick:bn,className:`flex min-w-0 items-center justify-center gap-2 rounded-lg px-2 py-2.5 text-[12px] font-semibold transition active:scale-[0.99] ${Ne?"bg-surface-elevated text-foreground ring-1 ring-border/30 hover:bg-surface-2":"bg-primary text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90"}`,title:Z("sidebar.newSession"),"aria-label":Z("sidebar.newSession"),children:[i.jsx(Ro,{size:15,className:"shrink-0"}),i.jsx("span",{className:"truncate",children:"Terminal"})]}),Ne&&i.jsxs("button",{type:"button",onClick:_n,className:"flex min-w-0 items-center justify-center gap-2 rounded-lg bg-primary px-2 py-2.5 text-[12px] font-semibold text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 transition hover:bg-primary/90 active:scale-[0.99]",title:Z("sidebar.newSessionWithAgent",{agent:Ne.displayName}),"aria-label":Z("sidebar.newSessionWithAgent",{agent:Ne.displayName}),children:[i.jsx(bc,{agent:Ne,size:15}),i.jsx("span",{className:"truncate",children:Ne.displayName})]}),i.jsxs("button",{type:"button",onClick:er,className:"relative inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:Xe,"aria-label":Xe,"aria-expanded":Ee,"aria-controls":"sidebar-launch-options",children:[i.jsx(wl,{size:15}),Lr&&i.jsx("span",{className:"absolute right-0.5 top-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"}),We&&i.jsx("span",{className:`absolute top-0.5 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)] ${Lr?"right-3.5":"right-0.5"}`,"aria-hidden":"true"})]})]})})]});return qe?i.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:ss}):i.jsx(d6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:$e,children:ss})}function tP(){const{t:e}=Qr();return i.jsxs("div",{role:"status","aria-label":e("rightSidebar.loadingGitChanges"),className:"td-loading-skeleton flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[i.jsx("span",{className:"sr-only",children:e("rightSidebar.loadingGitChanges")}),i.jsxs("div",{"aria-hidden":"true",className:"shrink-0 border-b border-border/15 px-3 py-2",children:[i.jsxs("div",{className:"mb-2 flex h-5 items-center gap-1",children:[i.jsx("div",{className:"h-4 w-16 rounded bg-surface-2"}),i.jsx("div",{className:"h-4 w-7 rounded bg-surface-2"}),i.jsx("div",{className:"h-4 w-12 rounded bg-surface-2"})]}),i.jsxs("div",{className:"flex h-[15px] items-center justify-between",children:[i.jsx("div",{className:"h-2 w-14 rounded bg-surface-2"}),i.jsx("div",{className:"h-2 w-6 rounded bg-surface-2"})]}),i.jsxs("div",{className:"mt-2 flex h-7 items-center gap-1.5",children:[i.jsx("div",{className:"h-7 w-12 rounded-full bg-surface-2"}),i.jsx("div",{className:"h-7 w-16 rounded-full bg-surface-2"}),i.jsx("div",{className:"h-3 w-24 max-w-[30%] rounded bg-surface-2"}),i.jsx("div",{className:"ml-auto h-4 w-4 rounded-full bg-surface-2"})]})]}),i.jsxs("div",{"aria-hidden":"true",className:"overflow-hidden px-3 py-2",children:[i.jsxs("div",{className:"flex h-8 items-center gap-2",children:[i.jsx("div",{className:"h-3 w-3 rounded-sm bg-surface-2"}),i.jsx("div",{className:"h-2 w-32 max-w-[55%] rounded bg-surface-2"})]}),["w-3/5","w-2/5","w-1/2","w-1/3"].map((t,r)=>i.jsxs("div",{className:"flex h-9 items-center gap-2 pl-5",style:{opacity:1-r*.15},children:[i.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),i.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},t))]})]})}function rP({slow:e=!1}){const{t}=Qr();return i.jsxs("div",{role:"status","aria-label":t("rightSidebar.loadingGitChanges"),className:"td-loading-skeleton relative h-full min-h-0 overflow-hidden bg-surface px-3",children:[i.jsx("span",{className:"sr-only",children:t("rightSidebar.loadingGitChanges")}),i.jsxs("div",{"aria-hidden":"true",children:[i.jsxs("div",{className:"flex h-[76px] items-center gap-2 border-b border-border/40 px-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),i.jsx("div",{className:"h-2 w-12 rounded bg-surface-2"})]})]}),i.jsxs("div",{className:"flex h-11 items-center gap-2 px-1 pt-3",children:[i.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),i.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),i.jsx("div",{className:"ml-auto h-4 w-12 rounded-full bg-surface-2"})]}),[!1,!0].map(r=>i.jsxs("div",{className:"border-b border-border/40 px-1 py-4",children:[i.jsxs("div",{className:"mb-2 flex h-8 items-center justify-between",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),r&&i.jsx("div",{className:"h-2 w-28 rounded bg-surface-2"})]}),i.jsx("div",{className:"h-8 w-12 rounded-md bg-surface-2"})]}),i.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]},String(r))),i.jsx("div",{className:"flex h-[69px] items-center border-b border-border/40 px-2",children:i.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"})}),i.jsxs("div",{className:"space-y-2 px-1 py-4",children:[i.jsxs("div",{className:"flex h-8 items-center justify-between",children:[i.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),i.jsx("div",{className:"h-8 w-28 rounded-md bg-surface-2"})]}),i.jsx("div",{className:"h-7 rounded-md bg-surface-2"}),i.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]})]}),e&&i.jsx("div",{className:"absolute inset-x-3 bottom-3 rounded-md bg-surface-elevated px-3 py-2 text-xs text-muted-foreground",children:t("rightSidebar.loadingGitChangesSlow")})]})}const w6=()=>rh(()=>import("./RightSidebar-r_3Lk5Rp.js").then(e=>e.R),__vite__mapDeps([6,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16])).then(e=>({default:e.RightSidebar})),nP=b.lazy(w6);function k5(e){const t=b.useRef(!1);b.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return Hm(()=>{w6().catch(()=>{})},3e3)},[]);const{t:r}=Qr(),n=Zt(p=>p.rootPath),a=Zt(p=>p.rightTab),l=Zt(p=>p.setRightTab),c=n?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const h=i.jsx(d6,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[i.jsxs("div",{className:"shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"min-w-0 flex-1 px-1",children:i.jsx("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:i.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",children:c})})}),i.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[o0,SA,wl].map((p,g)=>i.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-surface-2 text-muted-foreground",children:i.jsx(p,{size:14})},g))}),i.jsx("button",{type:"button",onClick:e.onClose,"aria-label":r("common.close"),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:i.jsx(Kn,{size:14})})]}),i.jsx("div",{className:"mt-2 grid grid-cols-3 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[["git",Jw,"rightSidebar.tabGit"],["diff",t9,"rightSidebar.tabChanges"],["files",vc,"rightSidebar.tabFiles"]].map(([p,g,x])=>i.jsxs("button",{type:"button",onClick:()=>l(p),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium ${a===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[i.jsx(g,{size:12}),r(x)]},p))}),i.jsx("div",{className:"h-2"})]}),i.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:a==="git"?i.jsx(rP,{}):i.jsx(tP,{})})]})});return t.current?i.jsx(b.Suspense,{fallback:h,children:i.jsx(nP,{...e})}):h}const I5=p0(e=>({overlay:"off",setOverlay:t=>e({overlay:t})}));function sP(e){let t=1,r="terminal";for(;;){let n=!1;for(const a of e.values())if(a.name===r){n=!0;break}if(!n)break;r=`terminal-${t}`,t++}return r}const iP=p0((e,t)=>({sessions:new Map,activeSessionId:null,nextSessionNumber:1,createSession:r=>{const n=Db(),a=Date.now(),l=t().sessions,c=sP(l),h={id:n,cwd:r,sessionId:null,name:c,customName:!1,createdAt:a,lastActivity:a};return e(p=>{const g=new Map(p.sessions);return g.set(n,h),{sessions:g,activeSessionId:p.activeSessionId??n,nextSessionNumber:p.nextSessionNumber+1}}),n},closeSession:r=>{e(n=>{const a=new Map(n.sessions),l=n.activeSessionId===r;a.delete(r);let c=n.activeSessionId;if(l){const h=Array.from(a.keys());c=h.length>0?h[0]:null}return{sessions:a,activeSessionId:c}})},switchSession:r=>{e(n=>n.sessions.has(r)?{activeSessionId:r}:n)},updateSession:(r,n)=>{e(a=>{const l=a.sessions.get(r);if(!l)return a;const c=new Map(a.sessions);return c.set(r,{...l,...n,lastActivity:Date.now()}),{sessions:c}})},setTerminalSession:(r,n)=>{t().updateSession(r,{sessionId:n.sessionId})},getActiveSession:()=>{const r=t();if(r.activeSessionId)return r.sessions.get(r.activeSessionId)},getSessionCount:()=>t().sessions.size,clearAllSessions:()=>{e({sessions:new Map,activeSessionId:null,nextSessionNumber:1})}})),aP=[7e5,1e6,14e5,18e5,24e5,32e5,4e6,5e6,6e6,8e6,1e7,12e6].map(e=>({id:"auto",maxSize:1600,bitRate:e,maxFps:30}));class oP{level=6;badSince=null;goodSince=null;connectedAt=0;lastSample=-1/0;lastChange=-1/0;lastUpgrade=-1/0;upgradeAfter=0;failedProbes=0;baselineRtt=1/0;get quality(){return aP[this.level]}connected(t){this.connectedAt=t,this.badSince=this.goodSince=null,this.lastSample=-1/0}sample(t,r,n=1600){if(r-this.lastSample>2500&&(this.badSince=this.goodSince=null),this.lastSample=r,t.rttMs!==null&&(this.baselineRtt=Math.min(this.baselineRtt,t.rttMs)),r-this.connectedAt<3e3)return null;const a=t.rttMs!==null&&t.rttMs>this.baselineRtt+150,l=t.deliveryDelayMs>250||t.decodeQueue>=4||a&&t.frames>0&&t.deliveryDelayMs>100,c=t.deliveryDelayMs>800||t.decodeQueue>=8,h=t.rttMs!==null&&t.rttMs<this.baselineRtt+100&&t.deliveryDelayMs<80&&t.decodeQueue<=1;this.badSince=l?this.badSince??r:null,this.goodSince=h?this.goodSince??r:null;const p=n<=1080?7:n<=1600?9:11;if(this.badSince!==null&&r-this.badSince>=(c?1e3:2e3)&&r-this.lastChange>=(c?2e3:3e3)&&this.level>0){this.level=Math.max(0,this.level-(c?2:1));const g=r-this.lastUpgrade<2e4;this.failedProbes=g?this.failedProbes+1:0,this.upgradeAfter=r+(g?Math.min(3e4,8e3*2**(this.failedProbes-1)):5e3),this.lastUpgrade=-1/0}else if(this.goodSince!==null&&r-this.goodSince>=3e3&&r-this.lastChange>=4e3&&r>=this.upgradeAfter&&this.level<p)this.level++,this.lastUpgrade=r;else return null;return this.lastChange=r,this.badSince=this.goodSince=null,this.quality}}async function Sc(e,t){const r=await fetch(e,{...t,headers:{"Content-Type":"application/json",Accept:"application/json",...t?.headers??{}}}),n=await r.json().catch(()=>null);if(!r.ok||!n){const a=n?.error||n?.code||`ANDROID_REQUEST_FAILED_${r.status}`;throw new Error(a)}return n}async function lP(){return Sc("/api/android/devices")}async function cP(e){return Sc("/api/android/connect",{method:"POST",body:JSON.stringify({address:e})})}const Yh=[{id:"low",maxSize:720,bitRate:12e5,maxFps:30},{id:"medium",maxSize:1080,bitRate:4e6,maxFps:30},{id:"high",maxSize:1600,bitRate:8e6,maxFps:60}],Yu=Yh[1];function Pm(e){if(!e||typeof e!="object")return Yu;const t=e;if(t.id==="auto")return{id:"auto",maxSize:1600,bitRate:4e6,maxFps:30};const r=Yh.find(c=>c.id===t.id);if(r)return r;if(t.id!=="custom")return Yu;const n=typeof t.maxSize=="number"?Math.max(360,Math.min(2160,Math.round(t.maxSize))):1080,a=typeof t.bitRate=="number"?Math.max(3e5,Math.min(3e7,Math.round(t.bitRate))):4e6,l=typeof t.maxFps=="number"?Math.max(0,Math.min(60,Math.round(t.maxFps))):30;return{id:"custom",maxSize:n,bitRate:a,maxFps:l}}function uP(e,t){if(!/^[0-9a-zA-Z_.:\-]{1,128}$/.test(e))throw new Error("INVALID_SERIAL");const r=new URLSearchParams;t&&(r.set("max_size",String(t.maxSize)),r.set("bit_rate",String(t.bitRate)),t.maxFps>0&&r.set("max_fps",String(t.maxFps)));const n=r.toString();return`/api/android/${e}/ws${n?`?${n}`:""}`}function E5(e){const t={ADB_UNAVAILABLE:"本机没有可用的 adb,请先安装 Android platform-tools。",ADB_NOT_FOUND:"找不到 adb 可执行文件,可用 TERMDOCK_ADB_BIN 指定路径。",SCRCPY_NOT_FOUND:"本机没有 scrcpy,请先安装(含 scrcpy-server)。",SCRCPY_SERVER_NOT_FOUND:"找不到 scrcpy-server,可用 TERMDOCK_SCRCPY_SERVER 指定路径。",SCRCPY_VERSION_UNKNOWN:"无法读取 scrcpy 版本,请确认 scrcpy --version 可执行。",SCRCPY_CONNECT_TIMEOUT:"设备连接超时,请确认已授权 USB 调试并保持解锁。",SCRCPY_UNSUPPORTED_CODEC:"设备返回了不支持的视频编码。",INVALID_ADDRESS:"地址格式不正确,应为 ip:port。",API_NOT_ALLOWED:"当前设备权限不足:投屏需要全权服务授权。"};for(const[r,n]of Object.entries(t))if(e.includes(r))return n;return e}function dP(e){return Sc(`/api/android/recordings?serial=${encodeURIComponent(e)}`)}function hP(e){return Sc("/api/android/recordings",{method:"POST",body:JSON.stringify({serial:e})})}function fP(e){return Sc(`/api/android/recordings/${encodeURIComponent(e)}/stop`,{method:"POST"})}function pP(e,t){return Sc(`/api/android/recordings/${encodeURIComponent(e)}/save`,{method:"POST",body:JSON.stringify({directory:t})})}function mP(e){return Sc(`/api/android/recordings/${encodeURIComponent(e)}`,{method:"DELETE"})}const gP=0,xP=1,bP=2,yP=3,vP=4,wP=5,AP=7,TP=10,CP=11,SP=16,N5=17,R5=0,Bp=1,_P=2,M5=3,Qp=0,D5=1,j5=1,Hc=0xffffffffffffffffn,qd=0xfffffffffffffffen,ou={HOME:3,APP_SWITCH:187,POWER:26,VOLUME_UP:24,VOLUME_DOWN:25};function A6(e,t,r){e.setUint32(t,Math.max(0,Math.round(r.x))&4294967295),e.setUint32(t+4,Math.max(0,Math.round(r.y))&4294967295),e.setUint16(t+8,Math.min(65535,Math.round(r.screenWidth))),e.setUint16(t+10,Math.min(65535,Math.round(r.screenHeight)))}function LP(e,t,r,n,a,l){const c=new Uint8Array(32),h=new DataView(c.buffer);return h.setUint8(0,bP),h.setUint8(1,e),h.setBigUint64(2,t),A6(h,10,r),h.setUint16(22,Math.max(0,Math.min(65535,Math.round(n*65536)))),h.setUint32(24,a>>>0),h.setUint32(28,l>>>0),c}function Pp(e,t,r=0,n=0){const a=new Uint8Array(14),l=new DataView(a.buffer);return l.setUint8(0,gP),l.setUint8(1,e),l.setUint32(2,t>>>0),l.setUint32(6,r>>>0),l.setUint32(10,n>>>0),a}function kP(e,t,r,n=0){const a=new Uint8Array(21),l=new DataView(a.buffer);l.setUint8(0,yP),A6(l,1,e);const c=h=>Math.max(-32768,Math.min(32767,Math.round(Math.max(-1,Math.min(1,h/16))*32768)));return l.setInt16(13,c(t)),l.setInt16(15,c(r)),l.setUint32(17,n>>>0),a}function IP(e){const t=new TextEncoder().encode(e);if(!t.length)return null;const r=t.subarray(0,300),n=new Uint8Array(5+r.length),a=new DataView(n.buffer);return a.setUint8(0,xP),a.setUint32(1,r.length),n.set(r,5),n}function EP(e){const t=new TextEncoder().encode(e);if(!t.length||t.length>255)return null;const r=new Uint8Array(2+t.length);return r[0]=SP,r[1]=t.length,r.set(t,2),r}function lu(e){return new Uint8Array([e])}function B5(e){return new Uint8Array([vP,e])}function NP(e){return new Uint8Array([TP,e?1:0])}function RP(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function MP(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Op(e){return e.toString(16).padStart(2,"0")}function T6(e,t,r){for(let n=0;n+4<e.length;n++){const a=e[n]===0&&e[n+1]===0&&e[n+2]===1,c=e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1?n+4:a?n+3:-1;if(c<0||c>=e.length)continue;if((r?e[c]>>1&63:e[c]&31)!==t){n=c-1;continue}let p=c+1;for(;p+2<e.length&&!(e[p]===0&&e[p+1]===0&&(e[p+2]===1||e[p+2]===0&&e[p+3]===1));)p++;return e.subarray(c,Math.min(e.length,p))}return null}function DP(e){const t=e?T6(e,7,!1):null;return t&&t.length>=4?`avc1.${Op(t[1])}${Op(t[2])}${Op(t[3])}`:"avc1.42e01e"}function jP(e){const t=e?T6(e,32,!0):null;if(t&&t.length>=13){const r=t[1]>>6&3,n=t[1]&31,a=t[12];return`hev1.${r}.${n}.L${a}.B0`}return"hev1.1.6.L120.B0"}class BP{constructor(t,r){this.canvas=t,this.callbacks=r}canvas;callbacks;liveBitrate=!1;bitrateFailureDetail;get lastBitrateFailure(){return this.bitrateFailureDetail}bitrateRequestId=0;bitratePending=null;get supportsLiveBitrate(){return this.liveBitrate}get canSetBitrate(){return this.liveBitrate&&!this.bitratePending&&this.socket?.readyState===1}setBitrate(t){return!this.canSetBitrate||!Number.isInteger(t)||t<3e5||t>3e7?Promise.resolve(!1):new Promise(r=>{const n=++this.bitrateRequestId,a=setTimeout(()=>this.finishBitrate(!1,`BITRATE_CLIENT_TIMEOUT: requested=${t} bps; no server confirmation within 4000ms`),4e3);this.bitratePending={id:n,value:t,resolve:r,timer:a},this.send({type:"bitrate",requestId:n,bitRate:t})})}finishBitrate(t,r){const n=this.bitratePending;n&&(this.bitratePending=null,clearTimeout(n.timer),t||(this.liveBitrate=!1,this.bitrateFailureDetail=r??this.bitrateFailureDetail??"BITRATE_REASON_UNAVAILABLE: server rejected adjustment without a diagnostic",this.closedByUser||this.callbacks.onBitrateSupport?.(!1,this.bitrateFailureDetail)),n.resolve(t))}socket=null;decoder=null;configured=!1;configData=null;header=null;closedByUser=!1;lastMessageAt=0;lastFrameAt=0;lastResetAt=0;heartbeat=null;statsTimer=null;stallTimer=null;pendingConfig=null;needsKeyframe=!1;frameCount=0;receivedFrames=0;decodedFrames=0;controlsSent=0;lastSeq=0;lastType="";bytesSinceSample=0;warnedUnsupported=!1;lastSampleAt=0;serial="";autoQuality=!1;pingAt=null;rttMs=null;rttAt=0;minimumFrameOffset=1/0;deliveryDelayMs=0;peakDecodeQueue=0;sampleFrames=0;get currentHeader(){return this.header}connect(t,r){this.liveBitrate=!1,this.bitrateFailureDetail=void 0,this.serial=t,this.autoQuality=r?.id==="auto",this.closedByUser=!1,this.callbacks.onState("connecting");let n;try{n=z8(uP(t,r))}catch(a){this.callbacks.onState("error",a instanceof Error?a.message:"ANDROID_STREAM_FAILED");return}this.socket=n,n.onopen=()=>{this.lastMessageAt=Date.now()},n.onmessage=a=>{this.closedByUser||this.handleMessage(a.data)},n.onerror=()=>{this.closedByUser||this.callbacks.onState("error","SCRCPY_CONNECTION_LOST")},n.onclose=()=>{this.finishBitrate(!1,"BITRATE_CONNECTION_CLOSED: preview connection closed"),this.liveBitrate=!1,this.teardownTimers(),this.closedByUser?this.callbacks.onState("idle"):this.callbacks.onState("error","SCRCPY_CONNECTION_CLOSED")},this.startTimers()}disconnect(){this.closedByUser=!0,this.finishBitrate(!1),this.liveBitrate=!1,this.teardownTimers();try{this.decoder?.close()}catch{}this.decoder=null,this.configured=!1;try{this.socket?.close()}catch{}this.socket=null,this.callbacks.onState("idle")}teardownTimers(){this.heartbeat&&clearInterval(this.heartbeat),this.statsTimer&&clearInterval(this.statsTimer),this.stallTimer&&clearInterval(this.stallTimer),this.heartbeat=null,this.statsTimer=null,this.stallTimer=null}startTimers(){this.lastSampleAt=Date.now(),this.heartbeat=setInterval(()=>{if(!(!this.socket||this.socket.readyState!==1)){if(Date.now()-this.lastMessageAt>45e3){try{this.socket.close()}catch{}return}this.pingAt===null&&(this.pingAt=performance.now(),this.send({type:"ping"}))}},this.autoQuality?2e3:15e3),this.stallTimer=setInterval(()=>{if(!this.header||this.closedByUser)return;const t=Date.now();t-this.lastFrameAt>8e3&&t-this.lastResetAt>8e3&&(this.lastResetAt=t,console.warn("[android] no frames for 8s; requesting keyframe reset"),this.sendControl(lu(N5)))},2e3),this.statsTimer=setInterval(()=>{const t=Date.now(),r=(t-this.lastSampleAt)/1e3;r<=0||(this.callbacks.onStats({fps:Math.round(this.frameCount/r*10)/10,kbps:Math.round(this.bytesSinceSample*8/r/1e3),width:this.header?.width??0,height:this.header?.height??0,received:this.receivedFrames,decoded:this.decodedFrames,controls:this.controlsSent,last:this.lastType,adaptation:this.autoQuality?{rttMs:this.pingAt!==null&&performance.now()-this.pingAt>2e3?performance.now()-this.pingAt:performance.now()-this.rttAt<6e3?this.rttMs:null,deliveryDelayMs:this.sampleFrames?this.deliveryDelayMs:0,decodeQueue:Math.max(this.peakDecodeQueue,this.decoder?.decodeQueueSize??0),frames:this.sampleFrames}:void 0}),this.sampleFrames=0,this.peakDecodeQueue=0,this.frameCount=0,this.bytesSinceSample=0,this.lastSampleAt=t)},1e3)}send(t){if(!(!this.socket||this.socket.readyState!==1))try{this.socket.send(JSON.stringify(t))}catch{}}sendControl(t){t&&(this.controlsSent++,this.send({type:"control",data:RP(t)}))}ack(){this.send({type:"ack",seq:this.lastSeq})}handleMessage(t){if(typeof t!="string")return;this.lastMessageAt=Date.now();let r;try{r=JSON.parse(t)}catch{return}this.lastType=`${r.type??"?"}${r.config?":cfg":""}${r.key?":key":""}`;try{this.dispatchMessage(r)}catch(n){console.warn("[android] message handling failed",n),this.callbacks.onWarning(`处理消息失败:${n instanceof Error?n.message:String(n)}`)}}dispatchMessage(t){switch(t.type){case"bitrate-support":this.liveBitrate=t.supported===!0,this.bitrateFailureDetail=this.liveBitrate?void 0:typeof t.detail=="string"?t.detail.slice(0,4096):"BITRATE_REASON_UNAVAILABLE: server did not provide diagnostics",this.liveBitrate||this.finishBitrate(!1,this.bitrateFailureDetail),this.callbacks.onBitrateSupport?.(this.liveBitrate,this.bitrateFailureDetail);break;case"bitrate-result":t.requestId===this.bitratePending?.id&&this.finishBitrate(t.applied===!0&&t.bitRate===this.bitratePending?.value,typeof t.detail=="string"?t.detail.slice(0,4096):void 0);break;case"header":this.header={deviceName:t.deviceName??this.serial,codec:t.codec??"h264",width:t.width??0,height:t.height??0},this.lastFrameAt=Date.now(),this.callbacks.onHeader(this.header),this.callbacks.onState("streaming");break;case"frame":this.handleFrame(t);break;case"error":this.callbacks.onState("error",t.message||"SCRCPY_ERROR");break;case"closed":this.callbacks.onState("error","SCRCPY_SESSION_CLOSED");break;case"pong":this.pingAt!==null&&(this.rttMs=performance.now()-this.pingAt,this.rttAt=performance.now(),this.pingAt=null);break}}handleFrame(t){if(typeof t.data!="string")return;typeof t.seq=="number"&&(this.lastSeq=t.seq);const r=MP(t.data);if(this.bytesSinceSample+=t.data.length,this.receivedFrames++,this.lastFrameAt=Date.now(),this.decoder?.state==="closed"&&(this.decoder=null,this.configured=!1),t.config){this.configData=r,this.pendingConfig=r,this.configureDecoder(),this.ack();return}this.sampleFrames++;const n=Number(t.pts);if(t.pts!==void 0&&Number.isFinite(n)){const c=performance.now()-n/1e3;this.minimumFrameOffset=Math.min(this.minimumFrameOffset,c),this.deliveryDelayMs=Math.max(0,c-this.minimumFrameOffset)}this.configured||this.configureDecoder();const a=t.key===!0;if(this.needsKeyframe&&!a){this.ack();return}let l=r;this.pendingConfig&&(l=new Uint8Array(this.pendingConfig.length+r.length),l.set(this.pendingConfig,0),l.set(r,this.pendingConfig.length),this.pendingConfig=null),a&&(this.needsKeyframe=!1),this.decode(l,a,t.pts),this.ack()}configureDecoder(){const t=this.header?.codec??"h264";if(!this.decoder||this.decoder.state==="closed"){if(typeof VideoDecoder>"u"){this.warnedUnsupported||(this.warnedUnsupported=!0,this.callbacks.onWarning("当前浏览器不支持 WebCodecs(VideoDecoder),无法解码投屏画面。")),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED");return}try{this.decoder=new VideoDecoder({output:l=>this.onDecodedFrame(l),error:l=>{this.configured=!1,console.warn("[android] video decoder error",l),this.callbacks.onState("error",l instanceof Error?l.message:"VIDEO_DECODER_ERROR"),this.sendControl(lu(N5))}})}catch(l){console.warn("[android] VideoDecoder unavailable",l),this.callbacks.onWarning(`创建 VideoDecoder 失败:${l instanceof Error?l.message:String(l)}`),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED");return}}const r={codec:"avc1.42e01e",optimizeForLatency:!0};let n;t==="h264"?(n=[DP(this.configData),"avc1.42e01e","avc1.4d401e","avc1.64001f"].filter((c,h,p)=>p.indexOf(c)===h),r.avc={format:"annexb"}):t==="h265"?(n=[jP(this.configData),"hev1.1.6.L120.B0","hvc1.1.6.L120.B0"],r.hevc={format:"annexb"}):n=["av01.0.04M.08"];const a=[];for(const l of n)try{this.decoder.configure({...r,codec:l}),this.configured=!0,this.needsKeyframe=!0,l!==n[0]&&console.warn("[android] decoder configured with fallback codec",l);return}catch(c){a.push(`${l}: ${c instanceof Error?c.message:String(c)}`),console.warn("[android] decoder configure failed",l,c)}this.callbacks.onWarning(`解码器配置失败(${a.join(";")})`),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED")}decode(t,r,n){if(!(!this.decoder||this.decoder.state!=="configured"))try{this.decoder.decode(new EncodedVideoChunk({type:r?"key":"delta",timestamp:n?Number(n):this.lastTimestamp+1,data:t})),this.peakDecodeQueue=Math.max(this.peakDecodeQueue,this.decoder.decodeQueueSize),this.lastTimestamp=n?Number(n):this.lastTimestamp+1}catch(a){this.decodeFailureCount++<3&&(console.warn("[android] decode threw",a),this.callbacks.onWarning(`送入解码器失败:${a instanceof Error?a.message:String(a)}`))}}decodeFailureCount=0;lastTimestamp=0;onDecodedFrame(t){this.frameCount++,this.decodedFrames++;const r=t.displayWidth||t.codedWidth,n=t.displayHeight||t.codedHeight,a=this.canvas;(a.width!==r||a.height!==n)&&(a.width=r,a.height=n,this.header&&(this.header={...this.header,width:r,height:n},this.callbacks.onHeader(this.header)));const l=a.getContext("2d");l&&l.drawImage(t,0,0,a.width,a.height),t.close()}pointerPoint(t,r){return{x:t,y:r,screenWidth:this.header?.width??0,screenHeight:this.header?.height??0}}touch(t,r,n,a){const l=t===Bp||t===M5,c=l?0:1,h=a===Hc&&!l?j5:0,p=(t===R5||t===Bp)&&a===Hc?j5:0;this.sendControl(LP(t,a,this.pointerPoint(r,n),c,p,h))}pointerDown(t,r,n){this.touch(R5,t,r,n==="mouse"?Hc:qd)}pointerMove(t,r,n){this.touch(_P,t,r,n==="mouse"?Hc:qd)}pointerUp(t,r,n){this.touch(Bp,t,r,n==="mouse"?Hc:qd)}pointerCancel(t,r,n){this.touch(M5,t,r,n==="mouse"?Hc:qd)}scroll(t,r,n,a){this.sendControl(kP(this.pointerPoint(t,r),n,a))}key(t,r=Qp){this.sendControl(Pp(r,t))}tapKey(t){this.sendControl(Pp(Qp,t)),this.sendControl(Pp(D5,t))}back(){this.sendControl(B5(Qp)),this.sendControl(B5(D5))}home(){this.tapKey(ou.HOME)}recents(){this.tapKey(ou.APP_SWITCH)}power(){this.tapKey(ou.POWER)}volumeUp(){this.tapKey(ou.VOLUME_UP)}volumeDown(){this.tapKey(ou.VOLUME_DOWN)}rotate(){this.sendControl(lu(CP))}expandNotifications(){this.sendControl(lu(wP))}collapsePanels(){this.sendControl(lu(AP))}setDisplayPower(t){this.sendControl(NP(t))}sendText(t){this.sendControl(IP(t))}startApp(t){this.sendControl(EP(t))}}function QP(){try{return crypto.randomUUID().slice(0,8)}catch{return Math.random().toString(36).slice(2,10)}}function PP(){return`termdock-mirror-shot-${new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)}-${QP()}.png`}function Q5(e){const t=Math.max(0,Math.floor(e/1e3)),r=Math.floor(t/60),n=t%60;return`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`}async function OP(e,t=PP()){const r=e.width,n=e.height;if(!r||!n)throw new Error("投屏画面尚未就绪");const a=document.createElement("canvas");a.width=r,a.height=n;const l=a.getContext("2d");if(!l)throw new Error("无法读取投屏画面");l.drawImage(e,0,0);const c=await new Promise(h=>a.toBlob(h,"image/png"));if(!c||c.size===0)throw new Error("截图失败,请重试");return new File([c],t,{type:"image/png"})}function C6(e,t,r){const n=r.contentWidth*(t-1)/2,a=r.contentHeight*(t-1)/2;return{x:Math.max(-n,Math.min(n,e.x)),y:Math.max(-a,Math.min(a,e.y))}}function P5(e,t,r,n,a){const l=Math.max(1,Math.min(8,e.zoom*a)),c=l/e.zoom;return{zoom:l,pan:C6({x:n.x-t.cx-(r.x-t.cx-e.pan.x)*c,y:n.y-t.cy-(r.y-t.cy-e.pan.y)*c},l,t)}}function S6(e,t){return t?new Promise((r,n)=>{const a=crypto.randomUUID(),l=p=>{window.clearTimeout(h),window.removeEventListener("termdock-insert-reference-ack",c),p?r():n(new Error("目标终端不可用,内容尚未插入,请连接终端后重试"))},c=p=>{const g=p.detail;g?.nonce===a&&l(g.ok===!0)},h=window.setTimeout(()=>l(!1),1e4);window.addEventListener("termdock-insert-reference-ack",c),window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:e,sessionId:t,nonce:a,focus:!1,paste:!0}}))}):Promise.reject(new Error("没有可接收内容的终端"))}function O5(e,t){return S6(N3(e,null),t)}const Fp=p0(e=>({pending:[],enqueue:(t,r,n="/",a)=>e(l=>l.pending.some(c=>c.file.id===t.id)?l:{pending:[...l.pending,{file:t,sessionId:r,initialPath:n,insert:a}]}),remove:t=>e(r=>({pending:r.pending.filter(n=>n.file.id!==t)}))}));function FP({file:e,initialPath:t,onInsert:r,onDone:n}){const{t:a}=Qr(),[l,c]=b.useState(!1),[h,p]=b.useState(!1),[g,x]=b.useState(!1),[y,A]=b.useState(!1),[w,k]=b.useState(null),E=b.useRef(!1),I=b.useRef(null),M=async()=>{if(!E.current){E.current=!0,p(!0),A(!0);try{await mP(e.id),n()}catch(F){k(F instanceof Error?F.message:String(F))}finally{E.current=!1,p(!1),A(!1)}}};b.useEffect(()=>{if(l)return;I.current?.focus();const F=U=>{if(U.stopPropagation(),U.key==="Escape"&&U.preventDefault(),U.key!=="Tab")return;const G=Array.from(I.current?.querySelectorAll("button:not(:disabled)")??[]),Q=G[0],X=G.at(-1);U.shiftKey&&(document.activeElement===Q||document.activeElement===I.current)?(U.preventDefault(),X?.focus()):!U.shiftKey&&document.activeElement===X&&(U.preventDefault(),Q?.focus())};return document.addEventListener("keydown",F,!0),()=>document.removeEventListener("keydown",F,!0)},[l]);const B=async F=>{if(!E.current){E.current=!0,p(!0),x(F!==void 0),c(!1),k(null);try{const U=await pP(e.id,F);F===void 0&&await r(U.path),n()}catch(U){k(U instanceof Error?U.message:String(U))}finally{E.current=!1,p(!1)}}};return l?i.jsx(I1,{open:!0,initialPath:t||"/",title:a("android.recordingSave"),onCancel:()=>c(!1),onConfirm:F=>{B(F)}}):Ai.createPortal(i.jsx("div",{className:"fixed inset-0 z-modal-panel flex items-center justify-center bg-[var(--app-backdrop)] p-4",children:i.jsxs("div",{ref:I,role:"dialog","aria-modal":"true","aria-labelledby":"recording-save-title",tabIndex:-1,"aria-busy":h,className:"w-full max-w-sm rounded-xl border border-border bg-surface p-4 text-foreground shadow-xl outline-none",children:[i.jsx("h2",{id:"recording-save-title",className:"text-sm font-semibold",children:a("android.recordingConfirm")}),i.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:a("android.recordingSaveHint")}),i.jsxs("p",{className:"mt-2 break-all text-xs text-muted-foreground",children:[e.name," · ",(e.size/1024/1024).toFixed(1)," MB"]}),(w||e.error)&&i.jsx("p",{role:"alert",className:"mt-3 break-words text-xs text-destructive",children:w||e.error}),h&&i.jsxs("p",{role:"status",className:"mt-3 flex items-center gap-2 text-sm text-primary",children:[i.jsx(Nn,{size:16,className:"animate-spin"}),y?`${a("android.recordingDiscard")}…`:a(g?"android.recordingSaving":"android.captureInserting")]}),i.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[i.jsx("button",{type:"button",disabled:h||e.status!=="ready",onClick:()=>{B()},className:"min-h-10 rounded-lg bg-primary px-3 text-sm text-primary-foreground disabled:opacity-40",children:a("android.recordingInsert")}),i.jsx("button",{type:"button",disabled:h||e.status!=="ready",onClick:()=>c(!0),className:"min-h-10 rounded-lg bg-surface-2 px-3 text-sm disabled:opacity-40",children:a("android.recordingSave")}),i.jsx("button",{type:"button",disabled:h,onClick:()=>{M()},className:"min-h-10 rounded-lg px-3 text-sm text-muted-foreground disabled:opacity-40",children:a("android.recordingDiscard")})]})]})}),document.body)}const Au="android-mirror",cu=Au,_6="termdock:android:quality:v1",$p=176,$P=204,fl=1,wh=8,F5=[1,1.25,1.5,2,2.5,3,4,6,8],UP=e=>Math.max(fl,Math.min(wh,e));function zP(e){return`${Number.isInteger(e)?e:e.toFixed(1)}×`}function Yd(e){const t=e.parentElement;if(!t)return null;const r=t.getBoundingClientRect(),n=getComputedStyle(t),a=parseFloat(n.paddingLeft)||0,l=parseFloat(n.paddingTop)||0,c=t.clientWidth-a-(parseFloat(n.paddingRight)||0),h=t.clientHeight-l-(parseFloat(n.paddingBottom)||0);return{cx:r.left+t.clientLeft+a+c/2,cy:r.top+t.clientTop+l+h/2,width:c,height:h,contentWidth:e.offsetWidth,contentHeight:e.offsetHeight}}function HP(e,t){try{e.setPointerCapture?.(t)}catch{}}function $5(e,t){try{e.releasePointerCapture?.(t)}catch{}}const U5=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):window.setTimeout(e,16),Zd=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):window.clearTimeout(e)},Up={auto:"android.qualityAuto",low:"android.qualityLow",medium:"android.qualityMedium",high:"android.qualityHigh",custom:"android.qualityCustom"},WP=()=>{try{const e=localStorage.getItem(_6);return e?Pm(JSON.parse(e)):Yu}catch{return Yu}},uu=e=>{try{localStorage.setItem(_6,JSON.stringify(e))}catch{}};function GP({sessionId:e,dockOnly:t=!1,onInsertPrompt:r,onInsertFile:n,onRecordingComplete:a,onCloseTab:l}){const{t:c}=Qr(),h=I5(P=>P.overlay),p=I5(P=>P.setOverlay),g=b.useRef(null),x=b.useRef(null),y=b.useRef(null),A=b.useMemo(WP,[]),w=b.useRef(A),k=b.useRef(null),E=b.useRef(null),[I,M]=b.useState(4e6),B=b.useRef(null),F=b.useRef(new Map),U=b.useRef(null),G=b.useRef(!1),[Q,X]=b.useState(fl),ee=b.useRef(Q),ze=b.useRef({x:0,y:0}),he=b.useRef(null),de=b.useRef(0),$e=b.useRef(0),qe=b.useRef(null),oe=b.useRef(0),[Re,K]=b.useState(null),[we,Z]=b.useState(null),[Ue,Le]=b.useState(!0),[Y,Ee]=b.useState(""),[be,Me]=b.useState(A.id),[Ze,Se]=b.useState([]),[se,Ye]=b.useState(null),[pt,rt]=b.useState(""),[ye,et]=b.useState(!0),[ht,te]=b.useState({maxSize:A.maxSize,bitRate:A.bitRate,maxFps:A.maxFps}),[ve,ct]=b.useState("idle"),[re,me]=b.useState(null),[je,mt]=b.useState(null),[ae,De]=b.useState({fps:0,kbps:0,width:0,height:0,received:0,decoded:0,controls:0,last:""}),[gt,ft]=b.useState(null),[kt,Dt]=b.useState(null),[Yt,xr]=b.useState(!1),[rr,Ir]=b.useState([]),[ne,Ne]=b.useState(null),[tt,jt]=b.useState([]),[Et,dr]=b.useState(!1),Jt=b.useRef(null),We=b.useRef(0),Lr=b.useRef([]),[Xe,Pt]=b.useState(!1),[Ge,It]=b.useState(""),[cn,Lt]=b.useState(!1),[Vr,ut]=b.useState(!1),[fn,Sr]=b.useState(""),[Pr,br]=b.useState(null),[pe,Er]=b.useState(null),[fe,Ve]=b.useState(!1),[nr,an]=b.useState(0),Nr=b.useRef(null),[Ar,Bt]=b.useState(!1),Rr=b.useRef(!1),fs=b.useRef(new Set),Xr=b.useRef(null),pn=b.useRef(null),mn=b.useRef(!1),[An,Rn]=b.useState(!1),dn=b.useRef(a);dn.current=a;const[Mn,bn]=b.useState(!1),[_n,Dn]=b.useState(null),kn=b.useRef(null),$r=b.useRef(null),Ts=iP(P=>P.activeSessionId??P.sessions.keys().next().value??null),er=e??Ts,qr=Xn(P=>!!P.docks[cu]),Qn=Xn(P=>P.hosts[cu]),Tn=Xn(P=>P.setDock),Yr=b.useCallback(async()=>{Le(!0);try{const P=await lP();K(P),Z(null)}catch(P){Z(P instanceof Error?P.message:"ADB_UNAVAILABLE")}finally{Le(!1)}},[]);b.useEffect(()=>{Yr()},[Yr]);const jr=Re?.devices??[],rn=jr.find(P=>P.serial===Y)??null,Br=!!(we&&/ADB_NOT_FOUND|ADB_UNAVAILABLE/i.test(we)),W=!!(Re?.adbAvailable&&!Re.scrcpyVersion),Be=b.useCallback(()=>{const P=B.current,Ae=[...F.current.keys()];B.current=null,F.current.clear(),U.current=null,G.current=!1,Jt.current=null,Zd(de.current),de.current=0,P&&x.current?.pointerCancel(P.x,P.y,P.type);const _e=g.current;if(_e)for(const at of Ae)$5(_e,at);Ne(null),dr(!1),jt([]),X(ee.current)},[]);b.useEffect(()=>{const P=at=>{F.current.has(at.pointerId)&&(at.type==="pointercancel"||at.target!==g.current)&&Be()},Ae=()=>Be(),_e=()=>{document.hidden&&Be()};return window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0),window.addEventListener("blur",Ae),document.addEventListener("visibilitychange",_e),()=>{window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),window.removeEventListener("blur",Ae),document.removeEventListener("visibilitychange",_e),Be()}},[Be]);const wt=b.useCallback(()=>{Be(),x.current?.disconnect(),x.current=null,ct("idle"),me(null),mt(null)},[Be]),yr=b.useCallback((P,Ae=!1)=>{const _e=g.current;if(!_e||!P)return;Be(),x.current?.disconnect(),me(null),!Ae&&y.current!==P&&mt(null),y.current=P,Dt(null),ft(null);const at=new BP(_e,{onBitrateSupport:(ur,Vt)=>{x.current!==at||w.current.id!=="auto"||ft(ur?null:Vt??"BITRATE_REASON_UNAVAILABLE")},onState:(ur,Vt)=>{x.current===at&&(ct(ur),me(Vt??null))},onHeader:ur=>{x.current===at&&mt(ur)},onStats:ur=>{x.current===at&&De(ur)},onWarning:ur=>{x.current===at&&Dt(ur)}});x.current=at;let bt=w.current;bt.id==="auto"?(k.current?.serial!==P&&(k.current={serial:P,policy:new oP}),k.current.policy.connected(performance.now()),bt=k.current.policy.quality,M(bt.bitRate)):k.current=null,E.current=bt,at.connect(P,bt)},[Be]);b.useEffect(()=>{if(be!=="auto"||w.current.id!=="auto"||ve!=="streaming"||!ae.adaptation||document.hidden)return;const P=k.current,Ae=x.current;if(!P||P.serial!==Y||!Ae?.canSetBitrate)return;const _e=g.current,at=_e?Math.max(_e.clientWidth,_e.clientHeight)*(window.devicePixelRatio||1)*ee.current:1600,bt=P.policy.sample(ae.adaptation,performance.now(),at||1600);bt&&Ae.setBitrate(bt.bitRate).then(ur=>{ur&&x.current===Ae&&(E.current=bt,M(bt.bitRate))})},[ae,be,ve,Y,yr]);const Rt=b.useCallback(P=>{const Ae={...P.quality?{quality:{id:P.quality.id,maxSize:P.quality.maxSize,bitRate:P.quality.bitRate,maxFps:P.quality.maxFps}}:{},...P.activePresetId!==void 0?{activePresetId:P.activePresetId}:{},...P.presets!==void 0?{presets:P.presets}:{},...P.docked!==void 0?{docked:P.docked}:{},...P.deviceSerial!==void 0?{deviceSerial:P.deviceSerial}:{}};ha({androidPanel:Ae}).catch(()=>{})},[]);b.useEffect(()=>{let P=!1;return vl().then(Ae=>{if(P)return;const _e=Ae.androidPanel;if(_e?.quality){const at=Pm(_e.quality);w.current=at,Me(at.id),te({maxSize:at.maxSize,bitRate:at.bitRate,maxFps:at.maxFps}),uu(at)}Se(_e?.presets??[]),Ye(_e?.activePresetId??null),_e?.deviceSerial&&(qe.current=_e.deviceSerial,Ee(_e.deviceSerial))}).catch(()=>{}),()=>{P=!0}},[]);const Mr=b.useCallback(P=>{const Ae=++We.current;Ir(at=>[...at,{id:Ae,left:P.left,top:P.top}]);const _e=window.setTimeout(()=>{Ir(at=>at.filter(bt=>bt.id!==Ae)),Lr.current=Lr.current.filter(at=>at!==_e)},300);Lr.current.push(_e)},[]),Dr=b.useCallback((P,Ae)=>{const _e=x.current,at=E.current;_e?.supportsLiveBitrate&&y.current===P&&at&&at.maxSize===Ae.maxSize&&at.maxFps===Ae.maxFps?_e.setBitrate(Ae.bitRate).then(bt=>{x.current===_e&&(bt?(E.current=Ae,ft(null)):ft(_e.lastBitrateFailure??"BITRATE_REASON_UNAVAILABLE"))}):yr(P)},[yr,c]),Zr=b.useCallback(P=>{if(k.current=null,P.startsWith("user:")){const _e=Ze.find(bt=>bt.id===P.slice(5));if(!_e)return;const at={id:"custom",maxSize:_e.maxSize,bitRate:_e.bitRate,maxFps:_e.maxFps};w.current=at,Me("custom"),Ye(_e.id),te({maxSize:_e.maxSize,bitRate:_e.bitRate,maxFps:_e.maxFps}),et(!0),uu(at),Rt({quality:at,activePresetId:_e.id}),Y&&yr(Y);return}if(P==="custom"){const _e=w.current;Me("custom"),Ye(null),te({maxSize:_e.maxSize,bitRate:_e.bitRate,maxFps:_e.maxFps}),et(!0);return}const Ae=P==="auto"?Pm({id:"auto"}):Yh.find(_e=>_e.id===P)??Yu;w.current=Ae,Me(Ae.id),Ye(null),uu(Ae),Rt({quality:Ae,activePresetId:null}),Y&&yr(Y)},[yr,Y,Ze,Rt]),nn=b.useCallback(()=>{const P={id:"custom",maxSize:ht.maxSize,bitRate:ht.bitRate,maxFps:ht.maxFps};w.current=P,uu(P),Rt({quality:P,activePresetId:null}),Me("custom"),Ye(null),Y&&Dr(Y,P)},[Dr,Y,ht,Rt]),zn=b.useCallback(()=>{const P=pt.trim();if(!P)return;const Ae=`p${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,_e={id:Ae,name:P,maxSize:ht.maxSize,bitRate:ht.bitRate,maxFps:ht.maxFps},at=[...Ze.filter(ur=>ur.name!==P),_e].slice(-12),bt={id:"custom",maxSize:ht.maxSize,bitRate:ht.bitRate,maxFps:ht.maxFps};Se(at),rt(""),Ye(Ae),Me("custom"),w.current=bt,uu(bt),Rt({quality:bt,activePresetId:Ae,presets:at}),Y&&Dr(Y,bt)},[pt,ht,Ze,Y,Dr,Rt]),jn=b.useCallback(()=>{if(!se)return;const P=Ze.filter(Ae=>Ae.id!==se);Se(P),Ye(null),Rt({activePresetId:null,presets:P})},[se,Ze,Rt]);b.useEffect(()=>()=>{x.current?.disconnect(),x.current=null;for(const P of Lr.current)window.clearTimeout(P);Lr.current=[]},[]),b.useEffect(()=>{if(h==="off")return;const P=Ae=>{Ae.key==="Escape"&&p("off")};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[h,p]),b.useEffect(()=>{const P=jr.filter(_e=>_e.state==="device");if(Y||P.length!==1)return;const Ae=P[0].serial;qe.current!==Ae&&(qe.current=Ae,Ee(Ae))},[jr,Y]),b.useEffect(()=>{Y&&yr(Y)},[Y,yr]),b.useEffect(()=>{if(ve==="streaming"){oe.current=0,xr(!1);return}if(ve!=="error"||!Y||!qP(re??""))return;const P=Math.min(8e3,700*2**oe.current);oe.current+=1,xr(!0);const Ae=window.setTimeout(()=>{xr(!1),yr(Y)},P);return()=>window.clearTimeout(Ae)},[ve,re,Y,yr]);const ss=b.useCallback((P,Ae,_e)=>{const at=g.current,bt=_e??(at?Yd(at):null);return!at||!bt?{x:0,y:0}:C6(P,Ae,bt)},[]),$=b.useCallback(()=>{const P=g.current;if(!P)return;const{x:Ae,y:_e}=ze.current,at=ee.current,bt=at===fl&&Ae===0&&_e===0?"":`translate3d(${Ae}px, ${_e}px, 0) scale(${at})`;P.style.transform!==bt&&(P.style.transform=bt);const ur=he.current;ur&&(ur.textContent=at>fl?zP(at):"")},[]),Te=b.useCallback((P,Ae,_e=!0)=>{const at=g.current,bt=ee.current,ur=UP(P);if(!at||ur===bt)return;const Vt=Yd(at);if(!Vt)return;const Nt=Ae??{x:Vt.cx,y:Vt.cy},Wr=P5({zoom:bt,pan:ze.current},Vt,Nt,Nt,ur/bt);ee.current=Wr.zoom,ze.current=Wr.pan,_e&&$()},[$]),He=b.useCallback(()=>{const P=ee.current;X(Ae=>Ae<=fl+.01==P<=fl+.01&&Ae>=wh-.01==P>=wh-.01?Ae:P)},[]);b.useEffect(()=>()=>{Zd(de.current),Zd($e.current)},[]);const Ke=()=>{let P=0,Ae=0;for(const at of F.current.values())P+=at.x,Ae+=at.y;const _e=F.current.size;return _e?{x:P/_e,y:Ae/_e}:null},Je=()=>{const[P,Ae]=Array.from(F.current.values());return P&&Ae?Math.hypot(P.x-Ae.x,P.y-Ae.y):0},xt=()=>{const P=Ke(),Ae=g.current?Yd(g.current):null;!P||!Ae||(U.current={startCentroid:P,startDistance:Je(),box:Ae})},Qt=b.useCallback(()=>{const P=U.current,Ae=Ke();if(!P||!Ae)return;const _e=Je(),at=P.startDistance>0&&_e>0?_e/P.startDistance:1,bt=P5({zoom:ee.current,pan:ze.current},P.box,P.startCentroid,Ae,at);ee.current=bt.zoom,ze.current=bt.pan,P.startCentroid=Ae,P.startDistance=_e},[]),vt=b.useCallback(()=>{de.current||(de.current=U5(()=>{de.current=0,Qt(),$()}))},[Qt,$]),lt=b.useCallback(()=>{de.current&&(Zd(de.current),de.current=0,Qt(),$())},[Qt,$]);b.useEffect(()=>{const P=g.current;if(!P)return;const Ae=P.parentElement;if(!Ae)return;const _e=bt=>{if(bt.ctrlKey||bt.metaKey){if(bt.preventDefault(),!bt.deltaY||U.current)return;const Nt=bt.deltaMode===1?16:bt.deltaMode===2?P.parentElement?.clientHeight||600:1,Wr=Math.max(-600,Math.min(600,bt.deltaY*Nt));Te(ee.current*Math.exp(-Wr*.002),{x:bt.clientX,y:bt.clientY},!1),$e.current||($e.current=U5(()=>{$e.current=0,$(),He()}));return}const ur=x.current;if(!ur||bt.target!==P)return;bt.preventDefault();const Vt=Xd(P,bt.clientX,bt.clientY);ur.scroll(Vt.x,Vt.y,bt.deltaX,bt.deltaY)},at=bt=>bt.preventDefault();return Ae.addEventListener("wheel",_e,{passive:!1}),Ae.addEventListener("gesturestart",at,{passive:!1}),Ae.addEventListener("gesturechange",at,{passive:!1}),()=>{Ae.removeEventListener("wheel",_e),Ae.removeEventListener("gesturestart",at),Ae.removeEventListener("gesturechange",at)}},[Te,$,He]),b.useEffect(()=>{const P=g.current,Ae=P?.parentElement;if(!P||!Ae||typeof ResizeObserver>"u")return;const _e=new ResizeObserver(()=>{U.current&&(U.current.box=Yd(P));const at=ss(ze.current,ee.current);at.x===ze.current.x&&at.y===ze.current.y||(ze.current=at,$())});return _e.observe(P),_e.observe(Ae),()=>_e.disconnect()},[ss,$]),b.useLayoutEffect(()=>{$()});const At=P=>{const Ae=x.current,_e=g.current;if(!Ae||!_e)return;if(P.pointerType==="mouse"&&P.button!==0){P.preventDefault(),P.button===2?Ae.back():P.button===1&&Ae.home();return}P.preventDefault(),_e.closest(".android-mirror-panel")?.focus({preventScroll:!0}),$(),He(),lt(),HP(_e,P.pointerId),F.current.set(P.pointerId,{x:P.clientX,y:P.clientY});const at=P.pointerType==="mouse"&&P.altKey;if(F.current.size>=2||at){const Vt=B.current;Vt&&(Ae.pointerCancel(Vt.x,Vt.y,Vt.type),B.current=null,Jt.current=null,Ne(null),dr(!1),jt([])),G.current=!0,xt();return}if(G.current)return;const bt=Xd(_e,P.clientX,P.clientY);B.current={id:P.pointerId,type:P.pointerType,x:bt.x,y:bt.y},Ae.pointerDown(bt.x,bt.y,P.pointerType);const ur=V5(_e,P.clientX,P.clientY);ur&&(Jt.current={left:ur.left,top:ur.top},jt([]),dr(!1),Ne(ur))},Mt=P=>{const Ae=x.current,_e=g.current;if(!_e||!F.current.has(P.pointerId))return;if(P.pointerType==="mouse"){const Nt=_e.getBoundingClientRect(),Wr=_e.parentElement?.getBoundingClientRect()??Nt;if(!(P.buttons&1)||P.clientX<Math.max(Nt.left,Wr.left)||P.clientX>=Math.min(Nt.right,Wr.right)||P.clientY<Math.max(Nt.top,Wr.top)||P.clientY>=Math.min(Nt.bottom,Wr.bottom)){Be();return}}if(P.preventDefault(),F.current.set(P.pointerId,{x:P.clientX,y:P.clientY}),U.current){vt();return}const at=B.current;if(!Ae||!at||at.id!==P.pointerId)return;const bt=Xd(_e,P.clientX,P.clientY);at.x=bt.x,at.y=bt.y,Ae.pointerMove(bt.x,bt.y,at.type);const ur=V5(_e,P.clientX,P.clientY),Vt=Jt.current;!ur||!Vt||(Ne(ur),Math.hypot(ur.left-Vt.left,ur.top-Vt.top)>=6&&(dr(!0),jt(Nt=>{const Wr=Nt[Nt.length-1];if(Wr&&Math.hypot(ur.left-Wr.x,ur.top-Wr.y)<4)return Nt;const Pn=[...Nt,{x:ur.left,y:ur.top}];return Pn.length>12?Pn.slice(Pn.length-12):Pn})))},Ot=P=>{const Ae=x.current,_e=g.current;if(!_e||!F.current.has(P.pointerId))return;if(lt(),F.current.delete(P.pointerId),$5(_e,P.pointerId),F.current.size===0&&(G.current=!1),U.current){F.current.size===0?(U.current=null,X(ee.current)):xt();return}const at=B.current;if(!at||at.id!==P.pointerId)return;const bt=Xd(_e,P.clientX,P.clientY);Ae?.pointerUp(bt.x,bt.y,at.type),ne&&Mr(ne),Ne(null),dr(!1),window.setTimeout(()=>jt([]),200),B.current=null,Jt.current=null},dt=P=>{if(Mn||Xe||Vr)return;const Ae=x.current;Ae&&(P.key==="Backspace"?(P.preventDefault(),Ae.key(67)):P.key==="Escape"?(P.preventDefault(),Ae.back()):P.key==="Enter"&&(P.preventDefault(),Ae.key(66)))},Ct=async()=>{const P=Ge.trim();if(P){Lt(!0);try{const Ae=await cP(P);It(""),Pt(!1),await Yr(),Ee(Ae.serial)}catch(Ae){Z(Ae instanceof Error?Ae.message:"ADB_CONNECT_FAILED")}finally{Lt(!1)}}},ar=()=>{const P=x.current,Ae=fn;!P||!Ae||(P.sendText(Ae),Sr(""))},cr=b.useCallback(P=>{br(P),pn.current!==null&&window.clearTimeout(pn.current),pn.current=window.setTimeout(()=>{pn.current=null,br(null)},2500)},[]),$t=b.useCallback(P=>{const Ae=ee.current,_e=P==="in"?F5.find(at=>at>Ae+.01):[...F5].reverse().find(at=>at<Ae-.01);_e!==void 0&&(Ae<=fl&&_e>fl&&cr(c("android.zoomPanHint")),lt(),Te(_e),X(_e))},[Te,lt,cr,c]),Ur=P=>{Promise.resolve().then(()=>r?.(P)).catch(Ae=>{Er(Ae instanceof Error?Ae.message:String(Ae))})},Or=b.useCallback(async(P,Ae)=>{try{if(!n)throw new Error(c("android.captureUnavailable"));await n(P),cr(Ae)}catch(_e){Er(c("android.captureFailed")+(_e instanceof Error?`:${_e.message}`:""))}},[n,cr,c]),es=async()=>{const P=g.current;if(!(!P||mn.current)){mn.current=!0,Rn(!0),Er(null);try{const Ae=await OP(P);await Or(Ae,c("android.captureInserted"))}catch(Ae){Er(Ae instanceof Error?Ae.message:String(Ae))}finally{mn.current=!1,Rn(!1)}}},js=b.useCallback(P=>{(P.status==="ready"||P.status==="error")&&dn.current&&!fs.current.has(P.id)&&(fs.current.add(P.id),dn.current?.(P))},[]),ai=b.useCallback(async P=>{const Ae=Nr.current;if(!(!Ae||Rr.current)){Rr.current=!0,Bt(!0),Er(null);try{const _e=await fP(Ae.id);Nr.current=null,Ve(!1),js(_e)}catch(_e){Er(_e instanceof Error?_e.message:String(_e))}finally{Rr.current=!1,Bt(!1)}}},[js]),Fs=async()=>{if(!(!Y||Rr.current||Nr.current)){Rr.current=!0,Bt(!0),Er(null);try{const P=await hP(Y);P.status==="recording"||P.status==="starting"||P.status==="stopping"?(Nr.current=P,Ve(!0),an(Math.max(0,Date.now()-P.startedAt))):js(P)}catch(P){Er(P instanceof Error?P.message:String(P))}finally{Rr.current=!1,Bt(!1)}}};b.useEffect(()=>{let P=!1,Ae=!1;Nr.current=null,Ve(!1);const _e=async()=>{if(!(!Y||Ae||Rr.current)){Ae=!0;try{const{recordings:bt}=await dP(Y);if(P||Rr.current)return;const ur=bt.find(Vt=>["starting","recording","stopping"].includes(Vt.status));Nr.current=ur??null,Ve(!!ur);for(const Vt of bt)js(Vt)}catch{}finally{Ae=!1}}};_e();const at=window.setInterval(()=>{_e()},2e3);return Xr.current=window.setInterval(()=>{Nr.current&&an(Math.max(0,Date.now()-Nr.current.startedAt))},500),()=>{P=!0,window.clearInterval(at),Xr.current!==null&&window.clearInterval(Xr.current)}},[Y,js]),b.useEffect(()=>{if(!Mn)return;const P=()=>bn(!1),Ae=at=>{const bt=at.target;bt instanceof Node&&(kn.current?.contains(bt)||$r.current?.contains(bt)||P())},_e=at=>{at.key==="Escape"&&(at.preventDefault(),at.stopPropagation(),P())};return document.addEventListener("pointerdown",Ae,!0),document.addEventListener("keydown",_e,!0),window.addEventListener("resize",P),()=>{document.removeEventListener("pointerdown",Ae,!0),document.removeEventListener("keydown",_e,!0),window.removeEventListener("resize",P)}},[Mn]),b.useEffect(()=>()=>{pn.current!==null&&window.clearTimeout(pn.current)},[]);const zr=ve==="streaming",on=qr,Wn=on?"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded hover:bg-surface-2 disabled:opacity-40":"rounded p-1.5 hover:bg-surface-2 disabled:opacity-40",z=rn?(rn.model||rn.serial)+q5(rn,c):jr.length?c("android.selectDevice"):c("android.noDevices"),xe=(se?Ze.find(P=>P.id===se):null)?.name??(be==="auto"?`${c("android.qualityAuto")} · ${I/1e6} Mbps`:c(Up[be])),Pe=on?"relative flex h-5 min-w-0 items-center rounded bg-surface-2 focus-within:ring-1 focus-within:ring-primary/50":"relative flex h-7 min-w-0 items-center rounded bg-surface-2 focus-within:ring-1 focus-within:ring-primary/50",Ht=on?"pointer-events-none block min-w-0 truncate px-1 text-[10px] leading-none text-foreground":"pointer-events-none block min-w-0 truncate px-2 text-[11px] leading-none text-foreground",Ft="absolute inset-0 h-full w-full cursor-pointer opacity-0",tr=()=>{const P=kn.current?.getBoundingClientRect();P&&Dn({left:Math.max(8,Math.min(P.right-$p,window.innerWidth-$p-8)),top:Math.min(P.bottom+4,Math.max(8,window.innerHeight-$P-8))}),bn(!0)},Xt=()=>{if(qr){Tn(cu,null),Rt({docked:null});return}if(!er)return;const P={sessionId:er,side:"right"};Tn(cu,P),Rt({docked:P})},Hr=Xe||qr||h!=="off",yn=i.jsxs("div",{className:"android-mirror-panel flex h-full min-h-0 min-w-0 flex-col bg-surface text-foreground","data-sidebar-gesture-ignore":"true",onKeyDown:dt,tabIndex:-1,children:[i.jsxs("div",{"data-panel-drag-title":qr?"true":void 0,className:on?"flex h-6 min-h-6 shrink-0 flex-nowrap items-center gap-1 overflow-hidden border-b border-border/15 bg-[var(--chrome-bg)] px-1.5 cursor-grab select-none active:cursor-grabbing":"flex flex-wrap items-center gap-1.5 border-b border-border px-2 py-2",children:[qr&&i.jsx("span",{"data-panel-drag-title":"true",role:"button","aria-label":c("android.splitDrag"),title:c("android.splitDrag"),className:"flex h-4 w-4 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground hover:text-foreground active:cursor-grabbing",children:i.jsx(Zh,{size:12})}),i.jsx(H8,{size:on?12:14,className:"shrink-0 text-muted-foreground"}),i.jsxs("div",{className:`${Pe} flex-1`,children:[i.jsx("span",{"aria-hidden":"true",className:`${Ht} w-full`,children:z}),i.jsxs("select",{value:Y,onChange:P=>{const Ae=P.target.value;Ee(Ae),qe.current=Ae,Ae&&Rt({deviceSerial:Ae})},className:Ft,"aria-label":c("android.device"),children:[i.jsx("option",{value:"",children:jr.length?c("android.selectDevice"):c("android.noDevices")}),jr.map(P=>i.jsx("option",{value:P.serial,children:(P.model||P.serial)+q5(P,c)},P.serial))]})]}),i.jsxs("div",{className:`${Pe} max-w-[45%] shrink-0`,children:[i.jsx("span",{"aria-hidden":"true",className:Ht,children:xe}),i.jsxs("select",{value:se?`user:${se}`:be,onChange:P=>Zr(P.target.value),className:Ft,title:c(be==="auto"?"android.qualityAutoHint":"android.quality"),"aria-label":c("android.quality"),children:[i.jsxs("option",{value:"auto",children:[c("android.qualityAuto"),be==="auto"?` · ${I/1e6} Mbps`:""]}),Yh.map(P=>i.jsx("option",{value:P.id,children:c(Up[P.id])},P.id)),Ze.map(P=>i.jsx("option",{value:`user:${P.id}`,children:P.name},P.id)),i.jsx("option",{value:"custom",children:c(Up.custom)})]})]}),i.jsx("button",{type:"button",onClick:()=>{Yr()},className:`${Wn} text-muted-foreground`,title:c("android.refresh"),children:Ue?i.jsx(Nn,{size:13,className:"animate-spin"}):i.jsx(Jn,{size:13})}),zr?i.jsx("button",{type:"button",onClick:wt,className:`${Wn} text-destructive`,title:c("android.disconnect"),children:i.jsx(Eb,{size:13})}):i.jsx("button",{type:"button",onClick:()=>Y&&yr(Y),disabled:!Y,className:`${Wn} text-primary`,title:c("android.connect"),children:i.jsx(EA,{size:13})}),(zr||fe)&&i.jsx("button",{type:"button",onClick:()=>{es()},disabled:!n||An,className:`${Wn} text-muted-foreground`,title:c(n?"android.screenshot":"android.captureUnavailable"),"aria-label":c("android.screenshot"),children:An?i.jsx(Nn,{size:on?12:13,className:"animate-spin"}):i.jsx(g9,{size:on?12:13})}),(zr||fe)&&i.jsx("button",{type:"button",onClick:()=>{fe?ai("manual"):Fs()},disabled:Ar||!fe&&!a,className:`${Wn} ${fe?"text-destructive":"text-muted-foreground"}`,title:c(fe?"android.recordingStop":a?"android.recordingStart":"android.captureUnavailable"),"aria-label":c(fe?"android.recordingStop":"android.recordingStart"),children:Ar?i.jsx(Nn,{className:"animate-spin",size:13}):fe?i.jsx(Ib,{size:on?10:11,fill:"currentColor"}):i.jsx(Nb,{size:on?12:13})}),i.jsx("button",{ref:kn,type:"button",onClick:()=>Mn?bn(!1):tr(),"aria-haspopup":"menu","aria-expanded":Mn,className:`${Wn} ${Hr?"text-primary":"text-muted-foreground"}`,title:c("android.more"),"aria-label":c("android.more"),children:i.jsx(wl,{size:on?13:14})}),l&&!t&&i.jsx("button",{type:"button",onClick:()=>{bn(!1),p("off"),l()},className:`${Wn} text-muted-foreground hover:bg-destructive/20 hover:text-destructive`,title:c("android.closeTab"),"aria-label":c("android.closeTab"),children:i.jsx(Kn,{size:14})})]}),Mn&&_n&&Ai.createPortal(i.jsxs("div",{ref:$r,role:"menu","aria-label":c("android.more"),style:{left:_n.left,top:_n.top,width:$p},className:"fixed z-popover overflow-hidden rounded-md border border-border bg-surface-elevated py-1 text-[11px] shadow-lg",children:[i.jsx(Kd,{icon:i.jsx(Jo,{size:13}),label:c("android.addDevice"),active:Xe,onSelect:()=>{Pt(P=>!P),bn(!1)}}),i.jsx(Kd,{icon:qr?i.jsx(Kn,{size:13}):i.jsx(xl,{size:13}),label:c(qr?"android.splitClose":"android.splitOpen"),active:qr,disabled:!qr&&!er,onSelect:()=>{Xt(),bn(!1)}}),i.jsx(Kd,{icon:h==="window"?i.jsx(aA,{size:13}):i.jsx(nA,{size:13}),label:c(h==="window"?"android.exitFullscreen":"android.fullscreen"),active:h==="window",onSelect:()=>{p(h==="window"?"off":"window"),bn(!1)}}),!t&&i.jsx(Kd,{icon:h==="sidebar"?i.jsx(pA,{size:13}):i.jsx(bA,{size:13}),label:c(h==="sidebar"?"android.exitFullscreen":"android.fillSidebar"),active:h==="sidebar",onSelect:()=>{p(h==="sidebar"?"off":"sidebar"),bn(!1)}}),je&&i.jsxs("div",{className:"mt-1 border-t border-border px-3 py-2 text-[10px] leading-4 tabular-nums text-muted-foreground",children:[i.jsx("div",{className:"truncate",children:`${ae.fps} fps · ${ae.kbps} kbps`}),i.jsx("div",{className:"truncate",children:`${ae.width}×${ae.height}`})]})]}),document.body),(be==="custom"||se)&&i.jsxs("div",{className:"border-b border-border bg-surface-2/40 px-2 py-2 text-[11px]",children:[i.jsxs("button",{type:"button",onClick:()=>et(P=>!P),"aria-expanded":ye,className:"flex w-full items-center gap-1 rounded text-muted-foreground hover:text-foreground",children:[i.jsx(Jo,{size:12,className:`transition-transform ${ye?"":"-rotate-90"}`}),i.jsxs("span",{children:[c("android.quality"),se?` · ${Ze.find(P=>P.id===se)?.name??""}`:""]})]}),ye&&i.jsxs("div",{className:"mt-2 grid gap-2",children:[i.jsx(G5,{label:c("android.qualityResolution"),display:`${ht.maxSize}px`,min:360,max:2160,step:8,value:ht.maxSize,onChange:P=>te(Ae=>({...Ae,maxSize:P}))}),i.jsx(G5,{label:c("android.qualityBitRate"),display:`${(ht.bitRate/1e6).toFixed(1)} Mbps`,min:.5,max:20,step:.5,value:ht.bitRate/1e6,onChange:P=>te(Ae=>({...Ae,bitRate:Math.round(P*1e6)}))}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:c("android.qualityFrameRate")}),i.jsxs("div",{className:"flex gap-1",children:[[15,30,60].map(P=>i.jsx("button",{type:"button",onClick:()=>te(Ae=>({...Ae,maxFps:P})),className:`rounded px-2 py-0.5 ${ht.maxFps===P?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:P},P)),i.jsx("button",{type:"button",onClick:()=>te(P=>({...P,maxFps:0})),className:`rounded px-2 py-0.5 ${ht.maxFps===0?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:c("android.qualityAuto")})]}),i.jsx("button",{type:"button",onClick:nn,disabled:!Y,className:"ml-auto rounded bg-primary/15 px-2 py-1 text-primary disabled:opacity-40",children:c("android.qualityApply")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{value:pt,onChange:P=>rt(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!P.nativeEvent.isComposing&&zn()},placeholder:c("android.presetNamePlaceholder"),maxLength:40,className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),i.jsx("button",{type:"button",onClick:zn,disabled:!pt.trim(),className:"shrink-0 rounded bg-surface-2 px-2 py-1 text-primary disabled:opacity-40",children:c("android.presetSave")}),se&&i.jsx("button",{type:"button",onClick:jn,className:"shrink-0 rounded px-2 py-1 text-destructive hover:bg-surface-2",children:c("android.presetDelete")})]})]})]}),Xe&&i.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border px-2 py-2",children:[i.jsx("input",{value:Ge,onChange:P=>It(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Ct()},placeholder:c("android.addressPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),i.jsx("button",{type:"button",onClick:()=>{Ct()},disabled:cn,className:"rounded bg-surface-2 px-2 py-1 text-[11px] text-primary disabled:opacity-40",children:cn?i.jsx(Nn,{size:12,className:"animate-spin"}):c("android.connect")})]}),Br&&i.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:[i.jsx("span",{className:"min-w-0 flex-1",children:c("android.adbUnavailable")}),i.jsx(H5,{label:c("android.insertFixPrompt"),onClick:()=>Ur(W5("adb",we??"")),enabled:!!r})]}),!Br&&W&&i.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:[i.jsx("span",{className:"min-w-0 flex-1",children:c("android.scrcpyUnavailable")}),i.jsx(H5,{label:c("android.insertFixPrompt"),onClick:()=>Ur(W5("scrcpy","")),enabled:!!r})]}),rn&&rn.state!=="device"&&i.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:YP(rn,c)}),we&&!Br&&i.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:E5(we)}),gt&&i.jsxs("details",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:[i.jsxs("summary",{className:"cursor-pointer",children:[c("android.qualityAutoUnavailable")," ",c(gt.startsWith("SCRCPY_VERSION")?"android.qualityAutoVersionError":gt.startsWith("SCRCPY_BUILD")?"android.qualityAutoBuildError":/EXTENSION|SERVER_READ|PUSH/.test(gt.split(":")[0])?"android.qualityAutoExtensionError":/TIMEOUT/.test(gt.split(":")[0])?"android.qualityAutoTimeoutError":/ENCODER_REJECTED/.test(gt.split(":")[0])?"android.qualityAutoEncoderError":/CHANNEL|TUNNEL|LISTEN|PROTOCOL|CONNECTION/.test(gt.split(":")[0])?"android.qualityAutoChannelError":"android.qualityAutoUnknownError")]}),i.jsx("pre",{className:"mt-1 select-text whitespace-pre-wrap break-all text-[10px]",children:gt})]}),kt&&i.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:kt}),pe&&i.jsx("div",{role:"alert",className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:pe}),i.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 touch-none items-center justify-center overflow-hidden bg-[var(--chrome-bg)] p-1",children:[i.jsx("canvas",{ref:g,className:"max-h-full max-w-full touch-none select-none rounded",style:{display:zr||je?"block":"none",transformOrigin:"center",transition:"none"},onPointerDown:At,onPointerMove:Mt,onPointerUp:Ot,onPointerCancel:()=>Be(),onLostPointerCapture:P=>{F.current.has(P.pointerId)&&Be()},onPointerLeave:P=>{F.current.has(P.pointerId)&&!P.currentTarget.hasPointerCapture?.(P.pointerId)&&Be()},onContextMenu:P=>P.preventDefault()}),ne&&i.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border border-primary/80 bg-primary/35",style:{left:ne.left,top:ne.top}}),tt.length>1&&i.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full",style:{opacity:Et?1:0,transition:"opacity 160ms linear"},children:tt.slice(1).map((P,Ae)=>{const _e=tt[Ae],at=(Ae+1)/(tt.length-1);return i.jsx("line",{x1:_e.x,y1:_e.y,x2:P.x,y2:P.y,stroke:"var(--primary)",strokeWidth:1+1.6*at,strokeLinecap:"round",opacity:.06+.45*at},Ae)})}),rr.map(P=>i.jsx("span",{"aria-hidden":"true",className:"termdock-tap-fade pointer-events-none absolute h-4 w-4 rounded-full bg-primary",style:{left:P.left,top:P.top}},P.id)),!zr&&i.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-center text-[11px] text-muted-foreground",children:[ve==="connecting"&&i.jsxs(i.Fragment,{children:[i.jsx(Nn,{size:18,className:"animate-spin"}),i.jsx("span",{children:c("android.connecting")})]}),ve==="error"&&i.jsxs(i.Fragment,{children:[i.jsx(T9,{size:14,className:"text-destructive"}),i.jsx("span",{className:"max-w-[80%] text-destructive",children:Yt?c("android.reconnecting"):E5(re||"")}),Y&&i.jsx("button",{type:"button",onClick:()=>{oe.current=0,yr(Y)},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:c("android.retry")})]}),ve==="idle"&&!Br&&!W&&i.jsxs(i.Fragment,{children:[i.jsx(lA,{size:22,className:"opacity-60"}),i.jsx("span",{children:jr.length?c("android.idleHint"):c("android.noDevicesHint")})]})]})]}),i.jsxs("div",{className:`flex flex-wrap items-center gap-1 border-t border-border ${on?"px-1.5 py-0.5":"px-2 py-1.5"}`,children:[i.jsx(_o,{compact:on,label:c("android.back"),onClick:()=>x.current?.back(),disabled:!zr,children:i.jsx(Ch,{size:14})}),i.jsx(_o,{compact:on,label:c("android.home"),onClick:()=>x.current?.home(),disabled:!zr,children:i.jsx(X9,{size:14})}),i.jsx(_o,{compact:on,label:c("android.recents"),onClick:()=>x.current?.recents(),disabled:!zr,children:i.jsx(Sb,{size:14})}),i.jsx(_o,{compact:on,label:c("android.notifications"),onClick:()=>x.current?.expandNotifications(),disabled:!zr,children:i.jsx(wb,{size:14})}),i.jsx(_o,{compact:on,label:c("android.rotate"),onClick:()=>x.current?.rotate(),disabled:!zr,children:i.jsx(BA,{size:14})}),i.jsx(_o,{compact:on,label:c("android.volumeDown"),onClick:()=>x.current?.volumeDown(),disabled:!zr,children:i.jsx(lT,{size:14})}),i.jsx(_o,{compact:on,label:c("android.volumeUp"),onClick:()=>x.current?.volumeUp(),disabled:!zr,children:i.jsx(uT,{size:14})}),i.jsx(_o,{compact:on,label:c("android.power"),onClick:()=>x.current?.power(),disabled:!zr,children:i.jsx(RA,{size:14})}),i.jsx(_o,{compact:on,label:c("android.inputText"),active:Vr,onClick:()=>ut(P=>!P),disabled:!zr,children:i.jsx(Cb,{size:14})}),i.jsx(_o,{compact:on,label:c("android.zoomIn"),onClick:()=>$t("in"),disabled:!zr||Q>=wh-.01,children:i.jsx(Os,{size:14})}),i.jsx(_o,{compact:on,label:c("android.zoomOut"),onClick:()=>$t("out"),disabled:!zr||Q<=fl+.01,children:i.jsx(_b,{size:14})}),i.jsxs("div",{className:"relative ml-auto h-5 w-24 min-w-0 max-w-full shrink-0","data-mirror-capture-status":!0,children:[i.jsx("span",{"aria-hidden":fe||!!Pr||An,className:`block truncate text-right text-[10px] leading-5 tabular-nums text-muted-foreground ${fe||Pr||An?"invisible":""}`,children:je?i.jsx(i.Fragment,{children:i.jsx("span",{ref:he})}):""}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-end overflow-hidden",children:i.jsx(VP,{recording:fe,elapsed:nr,status:An?c("android.captureInserting"):Pr,stopLabel:c("android.recordingStop"),onStop:()=>{ai("manual")}})})]})]}),Vr&&i.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border px-2 py-1.5",children:[i.jsx("input",{value:fn,onChange:P=>Sr(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!P.nativeEvent.isComposing&&(P.preventDefault(),ar())},placeholder:c("android.inputPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground",autoFocus:!0}),i.jsx("button",{type:"button",onClick:ar,disabled:!fn,className:"rounded bg-surface-2 p-1.5 text-primary disabled:opacity-40",title:c("android.send"),children:i.jsx(FA,{size:13})})]})]});return h==="window"?Ai.createPortal(i.jsx("div",{className:"fixed inset-0 z-modal-panel flex flex-col bg-[var(--chrome-bg)]",style:{paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))"},children:yn}),document.body):t?qr&&Qn?Ai.createPortal(yn,Qn):null:qr&&Qn?i.jsxs(i.Fragment,{children:[Ai.createPortal(yn,Qn),i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-[11px] text-muted-foreground",children:[i.jsx(xl,{size:18,className:"opacity-60"}),i.jsx("span",{children:c("android.splitDockedHint")}),i.jsx("button",{type:"button",onClick:()=>{Tn(cu,null),Rt({docked:null})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:c("android.splitClose")})]})]}):yn}function Kd({icon:e,label:t,active:r=!1,disabled:n=!1,onSelect:a}){return i.jsxs("button",{type:"button",role:"menuitem",disabled:n,onClick:a,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left transition hover:bg-surface-2 disabled:opacity-40 disabled:hover:bg-transparent ${r?"text-primary":"text-foreground"}`,children:[i.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:e}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),r&&i.jsx(Mi,{size:12,className:"shrink-0"})]})}function VP({recording:e,elapsed:t,status:r,stopLabel:n,onStop:a}){return e?i.jsxs("span",{role:"status","aria-live":"polite",className:"ml-auto inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded bg-destructive/15 px-1.5 py-0.5 text-[10px] tabular-nums text-destructive",children:[i.jsx("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-destructive"}),Q5(t),i.jsx("button",{type:"button",onClick:a,title:n,"aria-label":`${n} · ${Q5(t)}`,className:"ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded hover:bg-destructive/25",children:i.jsx(Ib,{size:8,fill:"currentColor"})})]}):r?i.jsx("span",{role:"status","aria-live":"polite",title:r,className:"ml-auto truncate text-[10px] text-primary",children:r}):null}function z5({sessionId:e}){const t=Xn(x=>x.docks[Au]),r=!!t,n=t?.sessionId??e??null,l=Fp(x=>x.pending)[0],c=b.useCallback(async x=>{if(!n)throw new Error("没有可接收截图的终端");const A=(await Zu("/tmp",[x])).files[0]?.path;if(!A)throw new Error("截图上传未返回文件路径");await O5(A,n)},[n]),h=b.useCallback(x=>{Fp.getState().enqueue(x,n)},[n]),p=Xn(x=>!!x.hosts[Au]),g=b.useRef(!1);return b.useEffect(()=>{g.current||(g.current=!0,vl().then(x=>{const y=x.androidPanel?.docked;y&&(Xn.getState().docks[Au]||Xn.getState().setDock(Au,y))}).catch(()=>{}))},[]),i.jsxs(i.Fragment,{children:[r&&p&&i.jsx(GP,{sessionId:n,dockOnly:!0,onInsertFile:n?c:void 0,onInsertPrompt:n?x=>S6(x,n):void 0,onRecordingComplete:h}),l&&i.jsx(FP,{file:l.file,initialPath:l.initialPath,onInsert:x=>l.insert?l.insert(x):O5(x,l.sessionId),onDone:()=>Fp.getState().remove(l.file.id)},l.file.id)]})}function H5({label:e,onClick:t,enabled:r}){return r?i.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-elevated",children:e}):null}function W5(e,t){return[`Termdock 的“设备投屏”在当前服务端不可用:未找到 ${e==="adb"?"adb(Android platform-tools)":"scrcpy / scrcpy-server"}${t?`(错误:${t})`:""}。`,"请在本机安装并让 Termdock 恢复可用:","1) 安装依赖:"," - macOS: brew install android-platform-tools scrcpy"," - Ubuntu/Debian: sudo apt install adb scrcpy"," - Windows: winget install Google.PlatformTools && winget install Genymobile.scrcpy","2) 若不在 PATH,请在 ~/.termdock/.env 指定 TERMDOCK_ADB_BIN / TERMDOCK_SCRCPY_BIN / TERMDOCK_SCRCPY_SERVER。","3) 完成后重启 Termdock 服务,并用 adb version、scrcpy --version 验证。","边界:只做本机环境安装与配置,不要改动 Termdock 仓库代码。"].join(`
148
+ `)}function G5({label:e,display:t,min:r,max:n,step:a,value:l,onChange:c}){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:e}),i.jsx("input",{type:"range",min:r,max:n,step:a,value:l,onChange:h=>c(Number(h.target.value)),className:"h-1 min-w-0 flex-1 accent-primary","aria-label":e}),i.jsx("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",children:t})]})}function _o({label:e,onClick:t,disabled:r,active:n,compact:a,children:l}){return i.jsx("button",{type:"button",onClick:t,disabled:r,title:e,"aria-label":e,className:`${a?"inline-flex h-5 w-5 items-center justify-center":"p-1.5"} rounded transition active:scale-95 disabled:opacity-30 ${n?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:l})}function V5(e,t,r){const n=e.parentElement;if(!n)return null;const a=e.getBoundingClientRect(),l=n.getBoundingClientRect();return{left:a.left-l.left+(t-a.left),top:a.top-l.top+(r-a.top)}}function Xd(e,t,r){const n=e.getBoundingClientRect(),a=e.width||n.width,l=e.height||n.height,c=n.width?(t-n.left)/n.width*a:0,h=n.height?(r-n.top)/n.height*l:0;return{x:Math.max(0,Math.min(a,c)),y:Math.max(0,Math.min(l,h))}}function qP(e){return!(/ADB_NOT_FOUND|SCRCPY_NOT_FOUND|SCRCPY_SERVER_NOT_FOUND|SCRCPY_VERSION_UNKNOWN|SCRCPY_UNSUPPORTED_CODEC|VIDEO_DECODER_UNSUPPORTED|decoder|decode/i.test(e)||/INVALID_SERIAL|INVALID_ADDRESS|API_NOT_ALLOWED|AUTHORIZATION_DENIED/i.test(e))}function q5(e,t){return e.state==="device"?e.androidVersion?` · Android ${e.androidVersion}`:"":e.state==="unauthorized"?` · ${t("android.stateUnauthorized")}`:e.state==="offline"?` · ${t("android.stateOffline")}`:` · ${t("android.stateUnknown")}`}function YP(e,t){return e.state==="unauthorized"?t("android.unauthorizedHint"):e.state==="offline"?t("android.offlineHint"):t("android.stateUnknown")}function ZP(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function KP(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function XP(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const a=Math.floor(n/6e4),l=Math.floor(a/60),c=Math.floor(l/24),h=l%24,p=a%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let y;return c>0?y=`${c}d ${h}h`:h>0?y=`${h}h ${p}m`:p>0?y=`${p}m`:y="soon",`resets in ${y} (${g} ${x})`}function JP(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function eO({result:e}){const{t}=Qr(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),n=e.windows.filter(h=>h.percent>0||h.resetAt),a=r.length>0?r.map(h=>h.label).join(" · "):"",l=!!e.error;let c=null;return!l&&e.entitlement&&(e.usagePercent>=90?c=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?c=t("quota.left",{n:e.remaining}):c=`${Math.round(e.usagePercent)}%`),i.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[i.jsx("span",{className:"shrink-0",children:JP(e.slug)}),i.jsx("span",{className:"truncate",children:e.displayName}),a&&i.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:a})]}),c&&i.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:c})]}),n.length>0?i.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[i.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),i.jsx("div",{className:"flex-1",children:i.jsx("div",{className:"h-2 rounded-full",style:{background:KP(h.percent)},children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:ZP(h.percent)}})})}),i.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&i.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:XP(h.resetAt)})]},h.label)})}):l?i.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function tO({isOpen:e,onClose:t}){const{t:r}=Qr(),[n,a]=b.useState([]),[l,c]=b.useState(!1),h=async(x=!1)=>{c(!0);try{const y=x?await W8():await G8();a(y.providers||[])}catch{}finally{c(!1)}};if(b.useEffect(()=>{e&&h()},[e]),b.useEffect(()=>{if(!e)return;const x=y=>{const A=y.detail;Array.isArray(A)&&a(A)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=n.filter(x=>!x.error),g=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),i.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[i.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>h(!0),disabled:l,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":r("quota.refresh"),children:i.jsx(Jn,{size:15,className:l?"animate-spin":""})}),i.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":r("quota.close"),children:i.jsx(Kn,{size:17})})]})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[l&&p.length===0?i.jsx(Eu,{label:r("common.loading"),className:"py-12"}):p.length===0?i.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[i.jsx("p",{children:r("quota.noProviders")}),i.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):i.jsx("div",{className:"space-y-2.5",children:p.map(x=>i.jsx(eO,{result:x},x.slug))}),g&&i.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const Y5=[{label:"Esc",sequence:"\\u001b"},{label:"Tab",sequence:"\\t"},{label:"Enter",sequence:"\\r"},{label:"S-Tab",sequence:"\\u001b[Z"},{label:"C-c",sequence:"\\u0003"},{label:"C-d",sequence:"\\u0004"},{label:"C-l",sequence:"\\u000c"},{label:"C-r",sequence:"\\u0012"},{label:"C-z",sequence:"\\u001a"},{label:"C-w",sequence:"\\u0017"},{label:"Up",sequence:"\\u001b[A"},{label:"Down",sequence:"\\u001b[B"},{label:"Left",sequence:"\\u001b[D"},{label:"Right",sequence:"\\u001b[C"},{label:"PgUp",sequence:"\\u001b[5~"},{label:"PgDn",sequence:"\\u001b[6~"}],rO=2,nO=20;function sO({label:e}){return i.jsx("div",{className:"h-7 rounded-full bg-surface-2 px-3 text-[11px] leading-7 text-center text-muted-foreground truncate",children:e})}function iO({value:e,onChange:t,placeholder:r}){const{t:n}=Qr(),[a,l]=C.useState(""),c=y=>{const A=[];let w="",k=!1;const E=()=>{const M=w.trim();M&&A.push(M),w=""};for(let M=0;M<y.length;M+=1){const B=y[M];if(!k&&B==="/"&&w.trim().length===0){k=!0,w+=B;continue}if(k){if(w+=B,B==="/"&&y[M-1]!=="\\"&&w.length>1){for(;M+1<y.length&&/[gimsuy]/.test(y[M+1]??"");)M+=1,w+=y[M];E(),k=!1}continue}if(B===","||/\s/.test(B)){E();continue}w+=B}if(E(),A.length===0)return;const I=[...e];for(const M of A){const B=S3(M);B&&(I.includes(B)||I.push(B))}t(I),l("")},h=y=>{t(e.filter(A=>A!==y))},p=a.trim(),g=p.length>0&&D2(p),x=g&&!Rh(p);return i.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(y=>{const A=D2(y),w=A&&!Rh(y);return i.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${w?"bg-destructive/15 text-destructive":A?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:A?w?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[A&&i.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),y,i.jsx("button",{type:"button",onClick:()=>h(y),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:y}),children:i.jsx(Kn,{size:12})})]},y)}),i.jsx("input",{type:"text",value:a,onChange:y=>l(y.target.value),onKeyDown:y=>{y.key==="Enter"||y.key===","&&!g?(y.preventDefault(),c(a)):y.key==="Backspace"&&a.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>c(a),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${g?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function aO({value:e,min:t,max:r,onChange:n}){const{t:a}=Qr();return i.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[i.jsx("button",{type:"button",onClick:()=>n(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":a("common.decrease"),children:i.jsx(_b,{size:14})}),i.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),i.jsx("button",{type:"button",onClick:()=>n(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":a("common.increase"),children:i.jsx(Os,{size:14})})]})}const oO=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:a,onRemovePreset:l,onResetDefaults:c})=>{const{t:h}=Qr(),p=e.find(M=>M.id===t)??e[0]??null,[g,x]=C.useState(null);if(!p)return null;const y=p.actions.length>0,A=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...y?p.actions.map((M,B)=>({id:M.id,label:fm(M,B)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(M=>({id:M,label:M}))],w=_3(A,p.rowLayout),k=(M,B)=>{n(p.id,F=>{const U=F.actions.findIndex(X=>X.id===M);if(U===-1)return F;const G=U+B;if(G<0||G>=F.actions.length)return F;const Q=[...F.actions];return[Q[U],Q[G]]=[Q[G],Q[U]],{...F,actions:Q}})},E=p.rowLayout.reduce((M,B)=>M+B,0),I=1+(p.includeAlt?1:0);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",E," slot",E===1?"":"s"]})]}),i.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:w.map((M,B)=>{const F=M.items[0]?.kind==="preset",U=Math.max(2,M.columns),G=F?`${L3}px repeat(${Math.max(1,U-1)}, minmax(0, 1fr))`:`repeat(${U}, minmax(0, 1fr))`;return i.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:G},children:M.items.map(Q=>Q.kind==="preset"?i.jsx(k3,{mode:"auto",presetLabel:Q.label,title:`Auto preset · ${Q.label}`,disabled:!0},Q.id):i.jsx(sO,{label:Q.label},Q.id))},`preview-row-${B}`)})}),p.actions.length>E-I&&i.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[i.jsx(Os,{size:14}),h("toolbarPresets.new")]}),i.jsxs("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[i.jsx(Jn,{size:14}),h("toolbarPresets.reset")]})]})]}),i.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(M=>i.jsxs("button",{type:"button",onClick:()=>r(M.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${M.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[M.label,M.actions.length>0&&i.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:M.actions.length})]},M.id))})]}),i.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"text",value:p.label,onChange:M=>n(p.id,B=>({...B,label:M.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),p.id!=="default"&&i.jsx("button",{type:"button",onClick:()=>l(p.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":h("toolbarPresets.deletePreset",{name:p.label}),children:i.jsx(ni,{size:14})})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),i.jsx(iO,{value:p.programs,onChange:M=>n(p.id,B=>({...B,programs:M})),placeholder:h("toolbarPresets.programsPlaceholder")}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),i.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,includeAlt:!M.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[i.jsxs("span",{children:[i.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),i.jsx(Xo,{checked:p.includeAlt})]}),i.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,showOnDesktop:!M.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[i.jsxs("span",{children:[i.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),i.jsx(Xo,{checked:p.showOnDesktop===!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),i.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,rowLayout:[...e1(M.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[i.jsx(Os,{size:12}),h("toolbarPresets.addRow")]})]}),i.jsx("div",{className:"space-y-2",children:p.rowLayout.map((M,B)=>i.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[i.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:B+1})}),i.jsx("div",{className:"flex-1"}),i.jsx(aO,{value:M,min:rO,max:nO,onChange:F=>n(p.id,U=>({...U,rowLayout:U.rowLayout.map((G,Q)=>Q===B?F:G)}))}),p.rowLayout.length>1&&i.jsx("button",{type:"button",onClick:()=>n(p.id,F=>({...F,rowLayout:F.rowLayout.filter((U,G)=>G!==B)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeRow",{n:B+1}),children:h("toolbarPresets.del")})]},`row-${B}`))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),i.jsxs("button",{type:"button",onClick:()=>{const M=`${p.id}-action-${Date.now()}`;n(p.id,B=>({...B,actions:[...B.actions,{id:M,label:`Key ${B.actions.length+1}`,sequence:""}]})),x(M)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[i.jsx(Os,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&i.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:h("toolbarPresets.noCustomButtons")}),p.actions.map((M,B)=>{const F=g===M.id;return i.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${F?"ring-1 ring-accent/40":""}`,children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx("button",{type:"button",onClick:()=>k(M.id,-1),disabled:B===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveUp"),children:i.jsx(vb,{size:12})}),i.jsx("button",{type:"button",onClick:()=>k(M.id,1),disabled:B===p.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveDown"),children:i.jsx(i9,{size:12})})]}),i.jsxs("button",{type:"button",onClick:()=>x(F?null:M.id),className:"min-w-0 flex-1 text-left",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:fm(M,B)}),i.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[M.sequence?M.sequence:h("toolbarPresets.noSequence"),M.doubleTapSequence&&i.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",M.doubleTapSequence]})]})]}),i.jsx("button",{type:"button",onClick:()=>n(p.id,U=>({...U,actions:U.actions.filter(G=>G.id!==M.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeAction",{name:M.label}),children:i.jsx(ni,{size:14})})]}),F&&i.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),i.jsx("input",{type:"text",value:M.label,onChange:U=>n(p.id,G=>({...G,actions:G.actions.map(Q=>Q.id===M.id?{...Q,label:U.target.value}:Q)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),i.jsx("input",{type:"text",value:M.sequence,onChange:U=>n(p.id,G=>({...G,actions:G.actions.map(Q=>Q.id===M.id?{...Q,sequence:U.target.value}:Q)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),i.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:Y5.map(U=>i.jsx("button",{type:"button",onClick:()=>n(p.id,G=>({...G,actions:G.actions.map(Q=>Q.id===M.id?{...Q,sequence:U.sequence}:Q)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:U.label},U.label))})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!M.doubleTapSequence&&i.jsx("button",{type:"button",onClick:()=>n(p.id,U=>({...U,actions:U.actions.map(G=>G.id===M.id?{...G,doubleTapSequence:""}:G)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),M.doubleTapSequence!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:M.doubleTapSequence,onChange:U=>n(p.id,G=>({...G,actions:G.actions.map(Q=>Q.id===M.id?{...Q,doubleTapSequence:U.target.value}:Q)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[Y5.map(U=>i.jsx("button",{type:"button",onClick:()=>n(p.id,G=>({...G,actions:G.actions.map(Q=>Q.id===M.id?{...Q,doubleTapSequence:(Q.doubleTapSequence??"")+U.sequence}:Q)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:U.label},U.label)),i.jsx("button",{type:"button",onClick:()=>n(p.id,U=>({...U,actions:U.actions.map(G=>{if(G.id!==M.id)return G;const{doubleTapSequence:Q,...X}=G;return X})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:h("toolbarPresets.remove")})]})]})]})]})]},M.id)})]})]})]})},lO={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function cO(){const{t:e}=Qr(),[t,r]=C.useState(null),[n,a]=C.useState(null),[l,c]=C.useState(null),[h,p]=C.useState(null),[g,x]=C.useState(!1),[y,A]=C.useState(!1),[w,k]=C.useState(""),[E,I]=C.useState(""),[M,B]=C.useState(null),[F,U]=C.useState([]),[G,Q]=C.useState([]),[X,ee]=C.useState(null),[ze,he]=C.useState(new Set),[de,$e]=C.useState(null),[qe,oe]=C.useState("auto"),[Re,K]=C.useState({}),[we,Z]=C.useState(null),[Ue,Le]=C.useState(null),[Y,Ee]=C.useState(10),[be,Me]=C.useState(""),[Ze,Se]=C.useState(""),[se,Ye]=C.useState(12e3),[pt,rt]=C.useState(null),[ye,et]=C.useState(null),ht=C.useCallback(async()=>{const[ne,Ne,tt,jt]=await Promise.allSettled([V8(),q8(),vl(),M0()]);if(r(ne.status==="fulfilled"?ne.value:[]),Ne.status==="fulfilled"){const Et=Ne.value;U(Et.plugins??[]),Q(Et.errors??[])}else U([]),Q([]);if(tt.status==="fulfilled"){const Et=tt.value;he(new Set(Et.autoRenameAgents??[])),oe(Et.autoRenameNamer??"auto"),K(Et.autoRenameModels??{}),Ee(Et.autoRenameIntervalMinutes??10),Me(Et.autoRenamePromptPreference??""),Se(Et.autoRenamePromptPreference??""),Ye(Et.autoRenamePromptPayloadChars??12e3)}else he(new Set);Z(jt.status==="fulfilled"?jt.value:[])},[]);C.useEffect(()=>{ht()},[ht]);const te=async(ne,Ne)=>{a(ne),c(null);try{Ne==="install"?(await Y8(ne)).devMode&&p(ne):(await Z8(ne),h===ne&&p(null)),await ht()}catch(tt){c(tt instanceof Error?tt.message:String(tt))}finally{a(null)}},ve=ne=>e(ne==="installed"?"settings.agentHooksInstalled":ne==="outdated"?"settings.agentHooksOutdated":ne==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),ct=async()=>{B(null);let ne;try{ne=JSON.parse(E)}catch{B("Invalid JSON");return}try{await rw(ne),I(""),x(!1),await ht()}catch(Ne){if(Ne instanceof nw&&Ne.migration){Q(tt=>[{slug:typeof ne.slug=="string"?ne.slug:"manifest.json",errors:Ne.message.split(`
149
+ `),code:Ne.code,migration:Ne.migration},...tt.filter(jt=>jt.slug!==ne.slug)]);return}B(Ne instanceof Error?Ne.message:String(Ne))}},re=async()=>{const ne=w.trim();if(ne){rt("install"),B(null);try{await K8(ne),k(""),A(!1),await ht()}catch(Ne){B(Ne instanceof Error?Ne.message:String(Ne))}finally{rt(null)}}},me=async ne=>{rt(`remove:${ne}`);try{await tw(ne),et(Ne=>Ne?.slug===ne?null:Ne),await ht()}catch(Ne){c(Ne instanceof Error?Ne.message:String(Ne))}finally{rt(null)}},je=async ne=>{rt(`check:${ne}`),c(null);try{await ew(ne),await ht()}catch(Ne){c(Ne instanceof Error?Ne.message:String(Ne))}finally{rt(null)}},mt=async ne=>{rt(`update:${ne}`),c(null);try{const Ne=await J8(ne),tt=[Ne.hookWarning,Ne.titleWarning].filter(Boolean).join(" ");tt&&c(tt),et(jt=>jt?.slug===ne?null:jt),await ht()}catch(Ne){c(Ne instanceof Error?Ne.message:String(Ne))}finally{rt(null)}},ae=async ne=>{rt(`doctor:${ne}`),c(null),et(null);try{const Ne=await X8(ne);et(Ne),Z(await M0())}catch(Ne){c(Ne instanceof Error?Ne.message:String(Ne))}finally{rt(null)}},De=async ne=>{const Ne=ne.migration?.aiPrompt??ne.errors.join(`
150
+ `);try{await navigator.clipboard.writeText(Ne),ee(ne.slug),window.setTimeout(()=>ee(tt=>tt===ne.slug?null:tt),1800)}catch{B(Ne)}},gt=async ne=>{if(de)return;const Ne=ze,tt=new Set(Ne);tt.has(ne)?tt.delete(ne):tt.add(ne),he(tt),$e(ne),c(null);try{const jt=await ha({autoRenameAgents:[...tt]});he(new Set(jt.autoRenameAgents??[])),Z(await M0(!0))}catch(jt){he(Ne),c(jt instanceof Error?jt.message:String(jt))}finally{$e(null)}},ft=async ne=>{const Ne=qe;oe(ne),Le("namer"),c(null);try{const tt=await ha({autoRenameNamer:ne});oe(tt.autoRenameNamer??"auto"),Z(await M0(!0))}catch(tt){oe(Ne),c(tt instanceof Error?tt.message:String(tt))}finally{Le(null)}},kt=async(ne,Ne)=>{const tt=Re,jt={...tt};Ne?jt[ne]=Ne:delete jt[ne],K(jt),Le(ne),c(null);try{const Et=await ha({autoRenameModels:jt});K(Et.autoRenameModels??{})}catch(Et){K(tt),c(Et instanceof Error?Et.message:String(Et))}finally{Le(null)}},Dt=async ne=>{const Ne=Y;Ee(ne),Le("interval"),c(null);try{const tt=await ha({autoRenameIntervalMinutes:ne});Ee(tt.autoRenameIntervalMinutes??10)}catch(tt){Ee(Ne),c(tt instanceof Error?tt.message:String(tt))}finally{Le(null)}},Yt=async()=>{const ne=be.trim();if(ne!==Ze){Le("preference"),c(null);try{const tt=(await ha({autoRenamePromptPreference:ne})).autoRenamePromptPreference??"";Me(tt),Se(tt)}catch(Ne){Me(Ze),c(Ne instanceof Error?Ne.message:String(Ne))}finally{Le(null)}}},xr=async ne=>{const Ne=Math.max(1e3,Math.min(64e3,Math.round(ne||12e3))),tt=se;Ye(Ne),Le("payload-limit"),c(null);try{const jt=await ha({autoRenamePromptPayloadChars:Ne});Ye(jt.autoRenamePromptPayloadChars??12e3)}catch(jt){Ye(tt),c(jt instanceof Error?jt.message:String(jt))}finally{Le(null)}},rr=new Set(F.map(ne=>ne.slug)),Ir=ye?{ok:e("settings.agentPluginDoctorStatusOk"),"missing-title-namer":e("settings.agentPluginDoctorStatusMissing"),"cli-default":e("settings.agentPluginDoctorStatusCliDefault"),"no-models":e("settings.agentPluginDoctorStatusNoModels"),"probe-failed":e("settings.agentPluginDoctorStatusFailed")}[ye.status]:"";return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[i.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),i.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),i.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[i.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),i.jsxs("select",{value:qe,disabled:Ue!==null,onChange:ne=>{ft(ne.target.value)},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[i.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),we?.filter(ne=>ne.available).map(ne=>i.jsx("option",{value:ne.slug,children:ne.displayName},ne.slug))]})]}),i.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[i.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),i.jsx("select",{value:Y,disabled:Ue!==null,onChange:ne=>{Dt(Number(ne.target.value))},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[5,10,30,60].map(ne=>i.jsxs("option",{value:ne,children:[ne," ",e("settings.agentAutoRenameMinutes")]},ne))})]}),i.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[i.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),i.jsxs("label",{className:"mt-2 block",children:[i.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),i.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),i.jsx("textarea",{value:be,maxLength:2e3,rows:3,disabled:Ue!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:ne=>Me(ne.target.value),onBlur:()=>{Yt()},className:"mt-1.5 w-full resize-y rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:ring-1 focus:ring-primary/50 disabled:opacity-50"}),i.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:Ue==="preference"?e("settings.saving"):`${be.length}/2000`})]}),i.jsxs("label",{className:"mt-2 block",children:[i.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),i.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),i.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:se,disabled:Ue!==null,onChange:ne=>Ye(Number(ne.target.value)),onBlur:ne=>{xr(Number(ne.target.value))},className:"mt-1.5 w-full rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]})]}),i.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),i.jsx("button",{type:"button",onClick:async()=>{Z(null);try{Z(await M0(!0))}catch{Z([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:i.jsx(Jn,{size:11,className:we===null?"animate-spin":""})})]}),we?.filter(ne=>ne.available).map(ne=>{const Ne=ne.models.find(tt=>tt.id===ne.recommendedModel);return i.jsxs("label",{className:"flex items-center justify-between gap-3",children:[i.jsx("span",{className:"text-[11px] text-muted-foreground",children:ne.displayName}),i.jsxs("select",{value:Re[ne.slug]??"",disabled:Ue!==null,onChange:tt=>{kt(ne.slug,tt.target.value)},className:"min-w-0 max-w-[68%] rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[i.jsx("option",{value:"",children:Ne?`${e("settings.agentAutoRenameAutomatic")} · ${Ne.displayName}`:e("settings.agentAutoRenameCliDefault")}),ne.models.map(tt=>i.jsx("option",{value:tt.id,children:tt.displayName},tt.id))]})]},ne.slug)}),we?.length===0&&i.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&i.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[i.jsx(Nn,{size:12,className:"animate-spin"})," …"]}),t?.map(ne=>{const Ne=n===ne.slug,tt=ne.state!=="not-installed",jt=rr.has(ne.slug);return i.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[i.jsx(bc,{agent:{slug:ne.slug,displayName:ne.displayName,accentColor:ne.accentColor??"#878580",icon:ne.icon,isPlugin:jt,iconMode:ne.iconMode,iconVersion:ne.iconVersion??void 0},size:18}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[13px] font-medium text-foreground",children:ne.displayName}),jt&&i.jsx("span",{className:"rounded bg-[rgb(var(--success-rgb)_/_0.12)] px-1 py-px text-[9px] font-medium text-[color:var(--success)]",children:"plugin"}),i.jsxs("span",{className:`text-[10px] ${lO[ne.state]}`,children:[ne.state==="installed"&&i.jsx(hg,{size:10,className:"mr-0.5 inline"}),(ne.state==="outdated"||ne.state==="needs-approval")&&i.jsx(yb,{size:10,className:"mr-0.5 inline"}),ve(ne.state)]})]}),i.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:ne.targetDisplay,children:[e("settings.agentHooksTarget")," ",ne.targetDisplay]}),h===ne.slug&&i.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),ne.state==="needs-approval"&&i.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("button",{type:"button",disabled:de!==null,onClick:()=>{gt(ne.slug)},className:"flex shrink-0 items-center gap-1.5 rounded-full px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-pressed":ze.has(ne.slug),title:e("settings.agentAutoRenameToggle"),children:[i.jsx("span",{children:e("settings.agentAutoRenameShort")}),i.jsx(Xo,{checked:ze.has(ne.slug),disabled:de!==null,size:"sm"})]}),i.jsxs("button",{type:"button",disabled:Ne,onClick:()=>{te(ne.slug,tt?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${tt?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[Ne?i.jsx(Nn,{size:11,className:"animate-spin"}):tt?i.jsx(ni,{size:11}):ne.state==="outdated"?i.jsx(Jn,{size:11}):i.jsx(Mu,{size:11}),Ne?"…":tt?e("settings.agentHooksUninstall"):ne.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},ne.slug)}),l&&i.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:l}),i.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),i.jsxs("button",{type:"button",onClick:()=>A(!y),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[i.jsx(Os,{size:11}),e("settings.agentPluginAdd")]})]}),i.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),y&&i.jsxs("div",{className:"mt-2 space-y-2",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{value:w,onChange:ne=>k(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&re()},className:"min-w-0 flex-1 rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none",placeholder:e("settings.agentPluginSourcePlaceholder")}),i.jsxs("button",{type:"button",disabled:!w.trim()||pt!==null,onClick:()=>{re()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] transition hover:bg-[rgb(var(--success-rgb)_/_0.22)] disabled:opacity-50",children:[pt==="install"?i.jsx(Nn,{size:11,className:"animate-spin"}):i.jsx(Mu,{size:11}),e("settings.agentPluginInstallPackage")]})]}),i.jsx("button",{type:"button",onClick:()=>x(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),F.map(ne=>{const Ne=ne.revision?.slice(0,8),tt=pt?.endsWith(`:${ne.slug}`)===!0;return i.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[i.jsx("span",{className:"truncate",children:ne.displayName}),ne.updateAvailable&&i.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),i.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:ne.source??void 0,children:[ne.source??e("settings.agentPluginManualSource"),Ne?` · ${Ne}`:""]})]}),i.jsxs("button",{type:"button",disabled:pt!==null,onClick:()=>{ae(ne.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",title:e("settings.agentPluginDoctorHint"),children:[pt===`doctor:${ne.slug}`?i.jsx(Nn,{size:10,className:"animate-spin"}):i.jsx(KA,{size:10}),e("settings.agentPluginDoctor")]}),ne.updateSupported&&i.jsxs("button",{type:"button",disabled:pt!==null,onClick:()=>{ne.updateAvailable?mt(ne.slug):je(ne.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",children:[tt?i.jsx(Nn,{size:10,className:"animate-spin"}):i.jsx(Jn,{size:10}),ne.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),i.jsx("button",{type:"button",disabled:pt!==null,onClick:()=>{me(ne.slug)},className:"rounded-full p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-[color:var(--warning)] disabled:opacity-50",title:e("settings.agentPluginDelete"),children:i.jsx(ni,{size:11})})]},ne.slug)}),ye&&i.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${ye.status==="ok"||ye.status==="cli-default"?"bg-[rgb(var(--success-rgb)_/_0.10)] text-[color:var(--success)]":"bg-[rgb(var(--warning-rgb)_/_0.10)] text-[color:var(--warning)]"}`,children:[i.jsxs("div",{className:"font-medium",children:[ye.displayName,": ",Ir]}),i.jsx("div",{className:"mt-1 text-muted-foreground",children:ye.models.length>0?`${ye.models.length} ${e("settings.agentPluginDoctorModels")}${ye.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${ye.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),ye.error&&i.jsx("div",{className:"mt-1 break-words",children:ye.error}),ye.warnings.length>0&&i.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:ye.warnings.map(ne=>i.jsxs("div",{children:["• ",ne]},ne))}),ye.nextSteps.length>0&&i.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:ye.nextSteps.map(ne=>i.jsxs("div",{children:["→ ",ne]},ne))})]}),G.map(ne=>i.jsxs("div",{className:"mt-2 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[10px] text-[color:var(--warning)]",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"font-medium",children:[ne.slug,": ",ne.code??e("settings.agentPluginInvalid")]}),i.jsxs("button",{type:"button",onClick:()=>{De(ne)},className:"flex shrink-0 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-1 font-medium transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)]",children:[X===ne.slug?i.jsx(hg,{size:10}):i.jsx(Ab,{size:10}),X===ne.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),i.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:ne.errors.join(`
151
+ `)}),ne.migration?.guideCommand&&i.jsx("code",{className:"mt-1 block select-all text-foreground",children:ne.migration.guideCommand})]},ne.slug)),y&&g&&i.jsxs("div",{className:"mt-2 space-y-2",children:[i.jsx("textarea",{value:E,onChange:ne=>I(ne.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
152
+ "version": 2,
153
+ "slug": "my-agent",
154
+ "displayName": "My Agent",
155
+ "aliases": ["my-agent"],
156
+ "accentColor": "#4385BE",
157
+ "statuses": [
158
+ { "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
159
+ { "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
160
+ { "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
161
+ ],
162
+ "hooks": {
163
+ "target": "~/.my-agent/settings.json",
164
+ "events": [
165
+ { "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
166
+ { "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
167
+ { "hook": "Stop", "event": "stop", "status": "complete" }
168
+ ]
169
+ }
170
+ }`}),M&&i.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:M}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>{ct()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[i.jsx(N9,{size:11}),e("settings.agentPluginCreate")]}),i.jsx("button",{type:"button",onClick:()=>{x(!1),I(""),B(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function uO({state:e,pending:t,onCheck:r,onConfirmRestart:n,desktopState:a,desktopPending:l=!1,desktopSnapshot:c,desktopActions:h,onCheckDesktop:p,onInstallDesktop:g}){const{t:x}=Qr(),y=e?.status??"idle",A=t||y==="checking"||y==="installing"||y==="restarting",w=y==="ready"&&!!e?.latestVersion,k=y==="checking"?x("settings.updateChecking"):y==="installing"?x("sidebar.updateInstalling"):y==="ready"?x("sidebar.updateReady"):y==="restarting"?x("sidebar.updateRestarting"):y==="current"?x("settings.updateCurrent"):y==="error"?e?.error||x("sidebar.updateFailed"):x("settings.updateHint"),E=a?.currentVersion||c?.appVersion,I=a?.status??"idle",M=l||I==="checking"||I==="downloading"||I==="installing",B=I==="ready",F=a?.error||(I==="unsupported"?x("settings.desktopUpdateUnsupported"):I==="checking"?x("settings.desktopUpdateChecking"):I==="current"?x("settings.desktopUpdateCurrent"):I==="downloading"?x("settings.desktopUpdateDownloading"):I==="ready"?x("settings.desktopUpdateReady"):I==="installing"?x("settings.desktopUpdateInstalling"):I==="error"&&a?.error||x("settings.desktopUpdateHint"));return i.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[i.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:x("settings.updateTitle")}),i.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[i.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${w?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:i.jsx(Jn,{size:15,className:A?"animate-spin":""})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.updateRuntimeTitle")}),i.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:k}),e&&i.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:w&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),w?i.jsx("button",{type:"button",disabled:A,onClick:n,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:x("sidebar.updateRestart")}):i.jsx("button",{type:"button",disabled:A,onClick:r,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:x(y==="checking"?"settings.updateCheckingShort":y==="installing"?"settings.updateInstallingShort":y==="error"?"sidebar.updateRetry":y==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),(a||h)&&i.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[i.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${B?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:i.jsx(Jn,{size:15,className:M?"animate-spin":""})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.desktopUpdateTitle")}),i.jsx("div",{className:`mt-0.5 text-[10px] leading-relaxed ${a?.error?"text-destructive":"text-muted-foreground"}`,role:a?.error?"alert":void 0,children:a?F:x(p?"settings.desktopStatusLoading":"settings.desktopUpdateUnsupported")}),i.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:B&&a?.latestVersion?`${a.currentVersion} → ${a.latestVersion}`:E?`v${E}`:null})]})]}),B?i.jsx("button",{type:"button",disabled:M||!g,onClick:g,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:x("settings.desktopUpdateRestart")}):i.jsx("button",{type:"button",disabled:!a||M||I==="unsupported"||!p,onClick:p,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:x(I==="installing"?"settings.updateInstallingShort":I==="downloading"?"settings.desktopUpdateDownloadingShort":I==="checking"?"settings.updateCheckingShort":I==="current"||I==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]}),h]})}function dO({quality:e}){const{locale:t}=Qr(),r=(h,p)=>t==="zh"?h:p,n=h=>h==null||!Number.isFinite(h)?"—":`${h.toFixed(1)} ms`,a=e?.diagnostics,l=h=>i.jsx("dl",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1.5 tabular-nums",children:h.map(([p,g])=>i.jsxs(C.Fragment,{children:[i.jsx("dt",{children:p}),i.jsx("dd",{className:"text-right text-foreground break-all",children:g})]},p))}),c=(h,p)=>i.jsxs("section",{className:"mt-3 border-t border-border/30 pt-3",children:[i.jsx("h3",{className:"mb-2 font-medium text-foreground",children:h}),p]});return i.jsxs("div",{className:"text-[11px] leading-relaxed",children:[c(r("往返统计","Round-trip statistics"),i.jsxs(i.Fragment,{children:[l([[r("平均延迟","Average latency"),n(e?.average)],["P95",n(e?.p95)],[r("服务端回包处理","Server reply handler"),n(e?.handlerMs)]]),i.jsx("p",{className:"mt-2",children:r("8 秒未响应计为超时,不等于网络丢包。回包处理仅含消息解析至构造回复,不含解密、排队和发包。","A probe times out after 8s; this is not packet loss. Handler timing covers parsing through reply creation, excluding decryption, queues and transmission.")})]})),c(r("当前发送与排队","Current buffers and queues"),a?i.jsxs(i.Fragment,{children:[l([[r("传输层发送缓冲","Transport send buffer"),`${a.bufferedBytes} B`],[r("加密通道待发送","Channel writes pending"),a.pendingWrites?r("有","Yes"):r("无","No")],[r("进行中的非终端请求","Active non-terminal requests"),a.activeRequests],[r("等待通道的请求","Requests waiting for capacity"),a.waitingRequests]]),i.jsx("p",{className:"mt-2",children:r("属于此服务共用的连接,包含文件等其他请求。","Shared by this service, including file transfers and other requests.")})]}):i.jsx("p",{children:r("尚无连接记录。","No connection record yet.")})),c(r("本次连接建立 · 历史耗时","Connection setup · recorded timings"),i.jsxs(i.Fragment,{children:[l([[r("传输通道就绪","Transport ready"),n(a?.transportOpenMs)],...a?.relay?[[r("其中:连上入口 WebSocket","Within transport: entry WebSocket"),n(a.relay.entryOpenMs)],[r("其中:请求中转至通道打开","Within transport: relay open request"),n(a.relay.routeOpenMs)]]:[],[r("Noise 加密握手","Noise handshake"),n(a?.handshakeMs)],[r("终端逻辑通道就绪","Terminal logical channel ready"),n(a?.socketOpenMs)],[r("其中:等待本地通道名额","Within logical open: local capacity wait"),n(a?.socketQueueMs)]]),i.jsx("p",{className:"mt-2",children:r("这是建链时的历史耗时,不代表当前延迟。“其中”为子项,不能重复相加;中转耗时含处理和建链,不含之前的授权。","Recorded setup timings, not live latency. “Within” rows are subsets, not additive. Relay timing includes processing and setup, excluding earlier authorization.")})]}))]})}function hO({backendSessionId:e}){const{locale:t}=Qr(),r=t==="zh",[n,a]=C.useState(null),[l,c]=C.useState(!1);C.useEffect(()=>{if(a(null),!l||!e)return;const y=()=>a(sw(e));y();const A=setInterval(y,1e3);return document.addEventListener("visibilitychange",y),()=>{clearInterval(A),document.removeEventListener("visibilitychange",y)}},[e,l]);const h=n?.diagnostics,p=n?.rtt,g=n?.connected?n.waiting?r?"等待响应…":"Waiting for reply…":p==null?r?"测量中…":"Measuring…":`${p} ms · ${p<150?r?"流畅":"Low latency":p<300?r?"有延迟":"Moderate latency":r?"高延迟":"High latency"}`:r?"未连接":"Disconnected",x=y=>y==null?"—":`${Math.round(y)} ms`;return i.jsxs("div",{className:"mt-3 rounded-xl bg-surface-2 px-3 text-muted-foreground",children:[i.jsxs("button",{type:"button","aria-expanded":l,onClick:()=>c(y=>!y),className:"flex min-h-11 w-full items-center gap-2 py-2 text-[12px] tabular-nums hover:text-foreground","aria-label":`${r?"连接质量":"Connection quality"}${l?`: ${g}`:""}`,children:[i.jsx("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${l&&n&&(!n.connected||n.waiting||p!=null&&p>=300)?"bg-destructive":"bg-current"}`}),i.jsxs("span",{className:"flex-1 text-left",children:[r?"连接质量":"Connection quality",l?` · ${g}`:""]}),i.jsx("span",{"aria-hidden":"true",children:l?"▾":"▸"})]}),l&&i.jsxs("div",{className:"pb-3 text-[11px] leading-relaxed",children:[!e&&i.jsx("p",{children:r?"请先打开一个终端会话,再查看连接质量。":"Open a terminal session to measure connection quality."}),i.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 tabular-nums",children:[i.jsx("dt",{children:r?"近期延迟":"Recent latency"}),i.jsx("dd",{className:"text-right text-foreground",children:n?.minimum==null?"—":`${Math.round(n.minimum)}–${Math.round(n.maximum??n.minimum)} ms`}),i.jsx("dt",{children:r?"波动":"Jitter"}),i.jsx("dd",{className:"text-right text-foreground",children:x(n?.jitter)}),i.jsx("dt",{children:r?"探测超时":"Probe timeouts"}),i.jsx("dd",{className:"text-right text-foreground",children:n?.samples?`${n.timeouts} / ${n.samples}`:"—"}),i.jsx("dt",{children:r?"连接路径":"Connection route"}),i.jsx("dd",{className:"text-right text-foreground break-words",children:h?`${h.path==="relay"?r?"经入口中转":"Via relay":r?"直连":"Direct"} · ${h.endpoint}`:"—"})]}),i.jsx("p",{className:"mt-2",children:r?"每 5 秒更新,统计最近 20 次;波动越小越稳定。":"Updates every 5s, using the last 20 probes. Lower jitter means more consistent latency."}),i.jsxs("details",{className:"mt-3 border-t border-border/30 pt-2",children:[i.jsx("summary",{className:"cursor-pointer py-1 hover:text-foreground",children:r?"诊断详情":"Diagnostics"}),i.jsx(dO,{quality:n})]})]})]})}const Z5={"startup-failure":"settings.serverHealthEventStartupFailure",crash:"settings.serverHealthEventCrash","crash-native":"settings.serverHealthEventCrashNative",killed:"settings.serverHealthEventKilled",wedge:"settings.serverHealthEventWedge","port-conflict":"settings.serverHealthEventPortConflict","gave-up":"settings.serverHealthEventGaveUp","exit-zero-unexpected":"settings.serverHealthEventExitZero","terminated-externally":"settings.serverHealthEventTerminated","supervisor-lost":"settings.serverHealthEventSupervisorLost","uncaught-exception":"settings.serverHealthEventUncaughtException","unhandled-rejection":"settings.serverHealthEventUnhandledRejection","exit-nonzero":"settings.serverHealthEventExitNonzero"};function fO(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function pO({state:e,onDismiss:t}){const{t:r}=Qr(),[n,a]=b.useState(!1),[l,c]=b.useState(!1),h=b.useRef(!1),p=b.useRef(!0);b.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]),b.useEffect(()=>{e?.supervised&&(h.current=!1,a(!1),c(!1))},[e?.supervised]),b.useEffect(()=>{if(!n)return;const F=window.setTimeout(()=>{h.current=!1,a(!1),c(!0)},45e3);return()=>window.clearTimeout(F)},[n]);const g=async()=>{if(!h.current){h.current=!0,c(!1),a(!0);try{await iw()}catch{if(!p.current)return;h.current=!1,a(!1),c(!0)}}};if(!e)return null;const x=e.incident,y=!e.supervised&&e.supervisor?.phase==="gave-up",A=!e.supervised&&e.supervisor!==null&&!e.supervisor.alive,w=y||A||e.attention,k=e.supervised&&e.supervisor?.alive&&e.supervisor.phase==="running",E=y?r("settings.serverHealthGaveUp",{count:e.supervisor?.consecutiveCrashes??0}):A?r("settings.serverHealthSupervisorLost"):e.supervised?r("settings.serverHealthSupervised"):r("settings.serverHealthUnsupervised"),I=x?r(Z5[x.event]??"settings.serverHealthUnknownEvent"):"",M=x?.causeEvent?r(Z5[x.causeEvent]??"settings.serverHealthUnknownEvent"):"",B=x?[new Date(x.at).toLocaleString(),x.uptimeMs!==null?r("settings.serverHealthUptime",{duration:fO(x.uptimeMs)}):null,x.signal?`signal ${x.signal}`:null,x.exitCode!==null?`exit ${x.exitCode}`:null].filter(Boolean).join(" · "):"";return i.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"server-health-title",children:[i.jsx("div",{id:"server-health-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:r("settings.serverHealthTitle")}),i.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[i.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${w?"bg-destructive/15 text-destructive":"bg-primary/15 text-primary"}`,children:w?i.jsx(HA,{size:15}):i.jsx(GA,{size:15})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[12px] font-medium text-foreground",children:E}),i.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:x?`${r(k?"settings.serverHealthHistory":"settings.serverHealthLastIncident")}: ${I}${M?` · ${M}`:""}`:r("settings.serverHealthClean")}),x&&k&&i.jsx("div",{className:"mt-1 text-[11px] text-primary",children:r("settings.serverHealthRunningNow")}),x&&i.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:B}),x?.detail&&i.jsx("div",{className:"mt-1 break-words text-[10px] text-muted-foreground/75",children:x.detail}),x?.oomSuspect&&i.jsx("div",{className:"mt-1 text-[10px] text-[color:var(--warning)]",children:r("settings.serverHealthOomNote")}),e.supervisor&&e.supervisor.restarts>0&&!y&&i.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:r("settings.serverHealthRestarted",{count:e.supervisor.restarts})})]})]}),e.attention&&i.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:r("settings.serverHealthDismiss")})]}),!e.supervised&&i.jsxs("div",{className:"border-t border-border px-3 py-3",children:[i.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:e.canEnableSupervision?r("settings.serverHealthEnableHint"):r("settings.serverHealthEnableUnavailable")}),e.canEnableSupervision&&i.jsx("button",{type:"button",onClick:g,disabled:n,className:"mt-2 min-h-11 rounded-lg bg-primary px-3 text-[12px] font-medium text-primary-foreground disabled:opacity-60",children:r(n?"settings.serverHealthEnabling":"settings.serverHealthEnable")}),n&&i.jsx("p",{role:"status",className:"mt-2 text-[11px] text-muted-foreground",children:r("settings.serverHealthEnablePending")}),l&&i.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:r("settings.serverHealthEnableError")})]})]})}const mO=()=>()=>{},gO=()=>1/0;function xO(){const{t:e}=Qr(),t=b.useId(),r=Ko(),n=b.useSyncExternalStore(r?.subscribe??mO,r?.retentionLimit??gO);if(!r)return null;const a=aw+1,l=n===1/0?e("settings.workspaceUnlimited"):String(n);return i.jsxs("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("label",{htmlFor:t,className:"shrink-0 text-[12px] font-medium text-foreground/90",children:e("settings.workspaceLimit")}),i.jsx("input",{id:t,type:"range",min:3,max:a,step:1,value:n===1/0?a:n,"aria-valuetext":l,"aria-describedby":`${t}-hint`,onChange:c=>{const h=Number(c.target.value);r.setRetentionLimit(h===a?1/0:h)},className:"h-8 min-w-0 flex-1"}),i.jsx("output",{htmlFor:t,className:"min-w-12 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:l})]}),i.jsx("p",{id:`${t}-hint`,className:"text-[11px] leading-relaxed text-muted-foreground",children:e("settings.workspaceLimitHint")})]})}const Om="mobile-session-destroy";function bO(e,t){return t&&e.type==="session"&&e.destination?.droppableId===Om}const ca="termdock-program-rules-cache",Jd="termdock-toolbar-presets-cache",du="termdock-settings-cache",K5="termdock-color-theme",X5="termdock:right-sidebar:file-preview-open-by-session:v2",hu="termdock:running-session-button-enabled:v1",fu="termdock:attention-button-enabled:v1",yO=60,J5=320,eb=420,Lo=8;function tb(e,t,r){return Math.min(Math.max(e,t),r)}function rb(e){if(typeof window>"u")return{left:Lo,top:Lo};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),n=e?.x??t,a=e?.y??r,l=Math.max(Lo,window.innerWidth-J5-Lo),c=Math.max(Lo,window.innerHeight-eb-Lo);return{left:tb(n+Lo,Lo,l),top:tb(a+Lo,Lo,c),width:J5,maxHeight:`min(${eb}px, calc(100vh - ${Lo*2}px))`}}function vO(e){return e==="dark"||e==="light"}function wO(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.entries(e).every(([t,r])=>{if(!t||!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.updatedAt=="number"&&Number.isFinite(n.updatedAt)})}function zp(e){const t=Object.entries(e).filter(([r,n])=>r&&Number.isFinite(n.updatedAt)).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,yO);return Object.fromEntries(t)}function AO(e){return Array.isArray(e)&&e.every(t=>{if(!t||typeof t!="object")return!1;const r=t;return typeof r.id=="string"&&typeof r.pattern=="string"&&typeof r.output=="string"&&(r.matchType==="exact"||r.matchType==="includes"||r.matchType==="prefix"||r.matchType==="regex")})}function TO(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function CO(e,t){const r=Ou(),n=new Set(kk()),a=Array.isArray(e)?e:[],l=Kc(a),c=t<bu;if(l.length===0)return r;if(c){const p=new Map(l.map(A=>[A.id,A])),g=new Map(a.map(A=>[typeof A.id=="string"?A.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",A])),x=l.filter(A=>!n.has(A.id));return[...r.map(A=>{const w=p.get(A.id),k=g.get(A.id);return w?{...A,rowLayout:w.rowLayout,showOnDesktop:typeof k?.showOnDesktop=="boolean"?k.showOnDesktop:A.showOnDesktop}:A}),...x]}const h=new Set(l.map(p=>p.id));return[...l,...r.filter(p=>!h.has(p.id))]}function SO(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const _O={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},uf="__termdockOverlay",df="__termdockBaseAnchor",hf="__termdockBaseGuard",LO=3,nb=250,kO="termdock-notification-target-v1",sb="/__termdock-notification-target",ib=3e4;function IO(e){return e==="left-sidebar"||e==="right-sidebar"||e==="right-sidebar-repo-picker"||e==="right-sidebar-file-preview"||e==="settings"||e==="markdown-outline"||e==="markdown-image-lightbox"}function Wc(e){if(!e||typeof e!="object")return null;const t=e[uf];return IO(t)?t:null}function E1(e){return e&&typeof e=="object"?{...e}:{}}function L6(e){const t=E1(e);return delete t[uf],t}function EO(e){const t=L6(e);return delete t[hf],{...t,[df]:!0}}function NO(){typeof window>"u"||window.history.pushState({...L6(window.history.state),[df]:!0,[hf]:!0},"",window.location.href)}function k6(){for(let e=0;e<LO;e+=1)NO()}function eh(){typeof window>"u"||(window.history.replaceState(EO(window.history.state),"",window.location.href),k6())}function pu(e){typeof window>"u"||window.history.pushState({...E1(window.history.state),[df]:!0,[uf]:e,[hf]:!1},"",window.location.href)}function RO(e){typeof window>"u"||window.history.replaceState({...E1(window.history.state),[df]:!0,[uf]:e,[hf]:!1},"",window.location.href)}const I6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let ua=new Set(I6);function ab(e){const t=new Map;for(const[r,n]of e)t.set(r,{cwd:n.cwd,activeProgram:n.activeProgram,activeProgramRaw:n.activeProgramRaw,inCopyMode:n.inCopyMode,isConnecting:n.isConnecting,agentStatus:n.agentStatus,agentIndicator:n.agentIndicator,agentStatusDetail:n.agentStatusDetail,agent:n.agent,agentMessage:n.agentMessage,agentNativeSessionId:n.agentNativeSessionId,agentResumeRecovered:n.agentResumeRecovered,terminalSessionId:n.terminalSessionId,agentNeedsReview:n.agentNeedsReview,gitStatus:n.gitStatus,shellTitle:n.shellTitle,promptState:n.promptState,tuiProgress:n.tuiProgress});return t}function MO(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t){const a=e.get(r);if(!a||a.cwd!==n.cwd||a.activeProgram!==n.activeProgram||a.activeProgramRaw!==n.activeProgramRaw||a.inCopyMode!==n.inCopyMode||a.isConnecting!==n.isConnecting||a.agentStatus!==n.agentStatus||a.agentIndicator!==n.agentIndicator||a.agentStatusDetail!==n.agentStatusDetail||a.agent!==n.agent||a.agentMessage!==n.agentMessage||a.agentNativeSessionId!==n.agentNativeSessionId||a.agentResumeRecovered!==n.agentResumeRecovered||a.terminalSessionId!==n.terminalSessionId||a.agentNeedsReview!==n.agentNeedsReview||a.gitStatus!==n.gitStatus||a.shellTitle!==n.shellTitle||a.promptState!==n.promptState||a.tuiProgress?.state!==n.tuiProgress?.state||a.tuiProgress?.progress!==n.tuiProgress?.progress)return!1}return!0}function ob(e,t){return i.jsx(ZB,{sessionMode:e,state:t})}function DO(e,t){const r=new Map(e.map(c=>[c.id,c])),n=t.map(c=>r.get(c)).filter(c=>c!==void 0),a=new Set(t),l=e.filter(c=>!a.has(c.id));return[...n,...l]}function jO(){const{t:e,locale:t,setLocale:r}=Qr(),n="env(safe-area-inset-top, 0px)",a="env(safe-area-inset-bottom, 0px)";ow();const l=C.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[c,h]=C.useState(!1),[p,g]=C.useState(()=>ec(K5,vO)??"dark"),x=C.useRef(ec(du,SO)).current,[y,A]=C.useState(x?.preventSleep??!1),[w,k]=C.useState(x?.networkAvailable??!0),[E,I]=C.useState(lw),[M,B]=C.useState(cw),[F,U]=C.useState(uw),[G,Q]=C.useState(dw),[X,ee]=C.useState(Rf),[ze,he]=C.useState(x?.localAccess??_O),[de,$e]=C.useState(x?.localAccess?.name??""),[qe,oe]=C.useState(!1),[Re,K]=C.useState(null),[we,Z]=C.useState(null),[Ue,Le]=C.useState(null),[Y,Ee]=C.useState(!1),[be,Me]=C.useState(null),Ze=C.useMemo(()=>ko(),[]),Se=!!(Ze?.desktopUpdateState&&Ze.checkDesktopUpdate&&Ze.installDesktopUpdate),[se,Ye]=C.useState(null),[pt,rt]=C.useState(null),[ye,et]=C.useState(!1),[ht,te]=C.useState(null),[ve,ct]=C.useState(!1),[re,me]=C.useState(()=>zp(ec(X5,wO)??{})),[je,mt]=C.useState(0),[ae,De]=C.useState(!1),[gt,ft]=C.useState(0),[kt,Dt]=C.useState(!1),[Yt,xr]=C.useState(0),[rr,Ir]=C.useState(!1),[ne,Ne]=C.useState(0),tt=C.useRef(null),[jt,Et]=C.useState({}),{terminalSettings:dr,updateTerminalSettings:Jt}=ij(),We=dr.fontSize,Lr=dr.rendererMode,[Xe,Pt]=C.useState(!1),Ge=C.useRef(hw()).current,[It,cn]=b.useState(()=>Ge.sessions.map(S=>({id:S.sessionId,name:S.name,customName:S.customName,mode:S.mode,tmuxSessionName:S.tmuxSessionName}))),[Lt,Vr]=C.useState(Ge.activeSessionId),[ut,fn]=C.useState(!1);C.useEffect(()=>{ut&&fw({rendered:!0})},[ut]);const[Sr,Pr]=C.useState(null),[br,pe]=C.useState(null),[Er,fe]=C.useState([]),[Ve,nr]=b.useState(()=>{const S=Kr.getState();return Ge.sessions.forEach(D=>{D.backendSessionId&&S.setTerminalSession(D.sessionId,{sessionId:D.backendSessionId,cols:80,rows:24,mode:D.mode,tmuxSessionName:D.tmuxSessionName}),D.activeProgram!=null&&S.setSessionActiveProgram(D.sessionId,D.activeProgram),D.cwd!=null&&S.setSessionCwd(D.sessionId,D.cwd),D.shellTitle!=null&&S.setSessionShellTitle(D.sessionId,D.shellTitle)}),Xc("session-chrome-hydrated"),ab(Kr.getState().sessions)});b.useEffect(()=>{!Ze||!Xe||Promise.all([Ze.snapshot(),Ze.desktopUpdateState?.()??Promise.resolve(null)]).then(([S,D])=>{Ye(S),rt(D)}).catch(S=>te(S instanceof Error?S.message:String(S)))},[Ze,Xe]),b.useEffect(()=>{Ze?.onDesktopUpdateState&&Ze.onDesktopUpdateState(rt)},[Ze]),b.useEffect(()=>Kr.subscribe(S=>{const D=ab(S.sessions);nr(ue=>MO(ue,D)?ue:D)}),[]);const an=b.useCallback(async(S,D)=>{pe(null),Pr({sessionId:S,status:"submitting",error:null});try{await pw(D),Pr(ue=>ue?.sessionId===S?{...ue,status:"waiting",error:null}:ue)}catch(ue){const St=(ue&&typeof ue=="object"&&"code"in ue?String(ue.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ue instanceof Error&&/busy/i.test(ue.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");Pr(qt=>qt?.sessionId===S?{...qt,error:St}:qt),pe({tone:"error",message:St})}},[e]);b.useEffect(()=>{if(!Sr||Sr.status!=="waiting")return;const S=Ve.get(Sr.sessionId);if(!S||S.agentResumeRecovered||S.agentStatus===null&&!S.agent)return;const D=S.agent?.displayName??"Agent";Pr(null),pe({tone:"success",message:e("tab.resumeAgentSuccess",{agent:D})})},[Sr,Ve,e]),b.useEffect(()=>{if(!Sr||Sr.status!=="waiting"||Sr.error)return;const S=Sr.sessionId,D=window.setTimeout(()=>{const ue=e("tab.resumeAgentTimeout");Pr(nt=>nt?.sessionId===S&&nt.status==="waiting"?{...nt,error:ue}:nt),pe({tone:"error",message:ue})},15e3);return()=>window.clearTimeout(D)},[Sr,e]),b.useEffect(()=>{if(br?.tone!=="success")return;const S=window.setTimeout(()=>pe(null),3200);return()=>window.clearTimeout(S)},[br]),b.useEffect(()=>{let S=!1;mw().then(ue=>{S||Le(ue)}).catch(()=>{}),gw().then(ue=>{S||Me(ue)}).catch(()=>{});const D=cg(ue=>{S||(ue.type==="update-state"?Le(ue.state):ue.type==="server-health"&&Me(ue.state))});return()=>{S=!0,D()}},[]);const Nr=b.useCallback(async()=>{try{Me(await xw())}catch(S){window.alert(S instanceof Error?S.message:String(S))}},[]),Ar=b.useCallback(async()=>{const S=Ue?.latestVersion;if(!(!S||Y)&&window.confirm(e("sidebar.updateRestartConfirm",{version:S}))){Ee(!0);try{Le(await bw())}catch(D){window.alert(D instanceof Error?D.message:String(D))}finally{Ee(!1)}}},[Ue?.latestVersion,e,Y]),Bt=b.useCallback(async()=>{if(!Y){Ee(!0);try{Le(await yw())}catch(S){window.alert(S instanceof Error?S.message:String(S))}finally{Ee(!1)}}},[Y]),Rr=b.useCallback(async()=>{if(!(!Ze?.checkDesktopUpdate||ye)){et(!0);try{rt(await Ze.checkDesktopUpdate())}catch(S){te(S instanceof Error?S.message:String(S))}finally{et(!1)}}},[Ze,ye]),fs=b.useCallback(async()=>{if(!(!Ze?.installDesktopUpdate||ye||pt?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){et(!0);try{rt(await Ze.installDesktopUpdate())}catch(S){te(S instanceof Error?S.message:String(S))}finally{et(!1)}}},[Ze,ye,pt?.status,e]);b.useEffect(()=>{document.documentElement.dataset.theme=p,vw(p),$n(K5,p)},[p]),b.useEffect(()=>{$n(X5,zp(re))},[re]);const Xr=Zt(S=>S.leftOpen),pn=Zt(S=>S.rightOpen),mn=Zt(S=>S.leftPinned),An=Zt(S=>S.leftSidebarWidth),Rn=Zt(S=>S.rightPinned),dn=Zt(S=>S.rightSidebarWidth),Mn=Zt(S=>S.rootPath),bn=Zt(S=>S.contextKey),_n=Zt(S=>S.selectedFilePath),Dn=Zt(S=>S.groupByFolder),kn=Tu(S=>S.collaborationGroups),$r=Zt(S=>S.collapsedGroups),Ts=Zt(S=>S.toggleGroupCollapsed),[er,qr]=b.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[Qn,Tn]=b.useState(()=>typeof window>"u"?1024:window.innerWidth),[Yr,jr]=b.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[rn,Br]=b.useState([]),[W,Be]=b.useState({available:!0,version:null,reason:null}),[wt,yr]=b.useState(!1),[Rt,Mr]=b.useState(null),[Dr,Zr]=b.useState(null),[nn,zn]=b.useState(null),[jn,ss]=b.useState(null),[$,Te]=b.useState(null),[He,Ke]=b.useState(null),[Je,xt]=b.useState(null),[,Qt]=b.useState(0),[vt,lt]=b.useState(null),[At,Mt]=b.useState(null),[Ot,dt]=b.useState(null),[Ct,ar]=b.useState(!1),[cr,$t]=b.useState(()=>ec(hu,S=>typeof S=="boolean")??!1),Ur=b.useCallback(async S=>{const D=cr;$t(S),$n(hu,S);try{const ue=await ha({runningSessionButtonEnabled:S});$t(ue.runningSessionButtonEnabled),$n(hu,ue.runningSessionButtonEnabled)}catch{$t(D),$n(hu,D)}},[cr]),[Or,es]=b.useState(()=>ec(fu,S=>typeof S=="boolean")??!0),js=b.useCallback(async S=>{const D=Or;es(S),$n(fu,S);try{const ue=await ha({attentionButtonEnabled:S});es(ue.attentionButtonEnabled),$n(fu,ue.attentionButtonEnabled)}catch{es(D),$n(fu,D)}},[Or]),[ai,Fs]=b.useState(null),zr=b.useCallback(S=>{Fs(S)},[]),on=b.useRef(!1),[Wn,z]=b.useState(null),[le,xe]=b.useState(null),Pe=C.useRef(null),Ht=C.useRef(!1),Ft=C.useRef(null),tr=C.useRef(!1),Xt=b.useCallback(()=>{Ke(null),xt(null)},[]),Hr=C.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[yn,P]=C.useState(Hr.current),[Ae,_e]=C.useState(!0),at=C.useRef(Hr.current),bt=C.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));b.useEffect(()=>{if(typeof window>"u")return;const S=window.matchMedia("(min-width: 1024px)"),D=()=>{qr(S.matches),Tn(window.innerWidth)};return D(),S.addEventListener("change",D),window.addEventListener("resize",D),()=>{S.removeEventListener("change",D),window.removeEventListener("resize",D)}},[]),b.useEffect(()=>{if(typeof window>"u")return;const S=window.matchMedia("(orientation: landscape)"),D=()=>jr(S.matches);return D(),S.addEventListener("change",D),()=>S.removeEventListener("change",D)},[]);const ur=C.useMemo(()=>Lt?Er.find(S=>S.sessionIds.includes(Lt))??null:null,[Lt,Er]),Vt=ur?.id??null,Nt=ur?.sessionIds[0]??Lt,Wr=C.useRef([]);C.useLayoutEffect(()=>{const S=Wr.current;if(Wr.current=Er,S.length===0)return;const D=new Set(Er.flatMap(ue=>ue.sessionIds));for(const ue of S){const nt=ue.sessionIds.filter(St=>!D.has(St)).map(St=>({sessionId:St,rootPath:Kr.getState().sessions.get(St)?.cwd??null}));nt.length>0&&Zt.getState().inheritRightSidebarStateFromSplitWorkspace(ue.id,nt)}},[Er]),C.useLayoutEffect(()=>((()=>{const D=Nt?Kr.getState().sessions.get(Nt)?.cwd??null:null;Zt.getState().setRootPath(D,Nt,Vt)})(),Kr.subscribe((D,ue)=>{const nt=Nt?D.sessions.get(Nt)?.cwd??null:null,St=Nt?ue.sessions.get(Nt)?.cwd??null:null;nt!==St&&Zt.getState().setRootPath(nt,Nt,Vt)})),[Vt,Nt]);const Pn=er||Yr,xs=Qn*.95,Di=Pn?Math.min(Math.max(Qn*.22,280),340):Math.min(Qn*.86,380),is=Lt&&Mn?`${Lt}\0${Mn}`:"",oi=!!(is&&_n&&re[is]),li=b.useCallback(S=>{is&&(S&&!Zt.getState().selectedFilePath||me(D=>{if(!!D[is]===S)return D;if(S)return zp({...D,[is]:{updatedAt:Date.now()}});const nt={...D};return delete nt[is],nt}))},[is]);b.useEffect(()=>{dj(is,bn,_n)&&me(S=>{if(!S[is])return S;const D={...S};return delete D[is],D})},[is,bn,_n]);const vn=rr?"markdown-image-lightbox":kt?"markdown-outline":ae?"right-sidebar-repo-picker":pn&&oi?"right-sidebar-file-preview":Xe?"settings":pn&&!(Rn&&er)?"right-sidebar":Xr&&!(mn&&er)?"left-sidebar":null,cs=C.useRef(vn),ks=C.useRef(vn),Qa=C.useRef(!1),Ci=C.useRef(!1),ho=b.useCallback(()=>{if(typeof window>"u")return;const S=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!er||!S||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[er]),pa=b.useCallback(S=>{if(S==="markdown-image-lightbox"){Ir(!1),Ne(D=>D+1);return}if(S==="markdown-outline"){Dt(!1),xr(D=>D+1);return}if(S==="right-sidebar-file-preview"){Dt(!1),xr(D=>D+1),li(!1),mt(D=>D+1);return}if(S==="right-sidebar-repo-picker"){De(!1),ft(D=>D+1);return}if(S==="settings"){Pt(!1),ea(!1),ta(!1),_a(!1);return}if(S==="left-sidebar"){Zt.getState().closeLeft();return}Dt(!1),xr(D=>D+1),De(!1),ft(D=>D+1),Ir(!1),Ne(D=>D+1),Zt.getState().closeRight()},[li]),gn=b.useCallback(S=>{if(!l&&typeof window<"u"&&cs.current===S&&Wc(window.history.state)===S){window.history.back();return}pa(S)},[pa,l]),ma=b.useCallback(()=>{Pt(!1);const S=Zt.getState();S.closeRight(),S.openLeft()},[]),Is=b.useCallback(()=>{Pt(!1);const S=Zt.getState();S.closeLeft(),S.openRight()},[]),el=b.useCallback(()=>{Pt(!1);const S=Zt.getState();S.closeLeft(),S.openRight(),S.setRightTab("files"),S.openRightSearch()},[]),Si=b.useCallback(()=>{const S=Zt.getState();if(S.leftPinned){S.setLeftPinned(!1),S.closeLeft();return}if(Xr){gn("left-sidebar");return}ma()},[ma,gn,Xr]),fo=b.useCallback(()=>{const S=Zt.getState();S.leftPinned?(S.setLeftPinned(!1),S.openLeft()):(S.setLeftPinned(!0),S.openLeft())},[]),Pa=b.useCallback(()=>{const S=Zt.getState();S.setLeftPinned(!1),S.closeLeft()},[]),ga=b.useCallback(()=>{const S=Zt.getState();S.rightPinned?(S.setRightPinned(!1),S.openRight()):(S.setRightPinned(!0),S.openRight())},[]),Xi=b.useCallback(()=>{const S=Zt.getState();S.setRightPinned(!1),S.closeRight()},[]),Oa=b.useRef(0),ci=b.useRef(0),us=b.useRef(null),In=b.useCallback(S=>{S.preventDefault(),Oa.current=S.clientX,ci.current=Zt.getState().leftSidebarWidth;const D=nt=>{us.current===null&&(us.current=requestAnimationFrame(()=>{us.current=null;const St=nt.clientX-Oa.current;Zt.getState().setLeftSidebarWidth(ci.current+St)}))},ue=()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",ue),us.current!==null&&(cancelAnimationFrame(us.current),us.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",D),window.addEventListener("mouseup",ue)},[]),xa=b.useRef(0),ts=b.useRef(0),ui=b.useRef(null),_i=b.useCallback(S=>{S.preventDefault(),xa.current=S.clientX;const D=Zt.getState(),ue=D.leftPinned?D.leftSidebarWidth:0;ts.current=nh(D.rightSidebarWidth,window.innerWidth,ue);const nt=qt=>{ui.current===null&&(ui.current=requestAnimationFrame(()=>{ui.current=null;const wr=xa.current-qt.clientX,hn=Zt.getState(),un=hn.leftPinned?hn.leftSidebarWidth:0;hn.setRightSidebarWidth(nh(ts.current+wr,window.innerWidth,un))}))},St=()=>{window.removeEventListener("mousemove",nt),window.removeEventListener("mouseup",St),ui.current!==null&&(cancelAnimationFrame(ui.current),ui.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",nt),window.addEventListener("mouseup",St)},[]),Ji=b.useCallback(()=>{const S=Zt.getState();if(S.rightPinned){S.setRightPinned(!1),S.closeRight();return}if(pn){gn("right-sidebar");return}Is()},[Is,gn,pn]),Fa=b.useCallback(()=>{!oi&&!l&&typeof window<"u"&&cs.current==="right-sidebar"&&Wc(window.history.state)==="right-sidebar"&&(pu("right-sidebar-file-preview"),ks.current="right-sidebar-file-preview"),li(!0)},[oi,l,li]),$a=b.useCallback(()=>{gn("right-sidebar-file-preview")},[gn]),po=b.useCallback(()=>{!ae&&!l&&typeof window<"u"&&cs.current==="right-sidebar"&&Wc(window.history.state)==="right-sidebar"&&(pu("right-sidebar-repo-picker"),ks.current="right-sidebar-repo-picker"),De(!0)},[ae,l]),Al=b.useCallback(()=>{gn("right-sidebar-repo-picker")},[gn]),tl=b.useCallback(()=>{!kt&&!l&&typeof window<"u"&&cs.current&&Wc(window.history.state)===cs.current&&(pu("markdown-outline"),ks.current="markdown-outline"),Dt(!0)},[kt,l]),Mo=b.useCallback(()=>{gn("markdown-outline")},[gn]),$s=b.useCallback(()=>{!l&&typeof window<"u"&&cs.current&&Wc(window.history.state)===cs.current&&(pu("markdown-image-lightbox"),ks.current="markdown-image-lightbox"),Ir(!0)},[l]),Do=b.useCallback(()=>{gn("markdown-image-lightbox")},[gn]),ba=b.useCallback(()=>{!l&&typeof window<"u"&&cs.current&&Wc(window.history.state)===cs.current&&(RO("settings"),ks.current="settings"),Zt.getState().closeAll(),Pt(!0)},[l]),ya=b.useCallback(()=>{gn("settings")},[gn]);b.useEffect(()=>{if(!Ze)return;const S=()=>ba();return window.addEventListener("termdock:open-settings",S),()=>window.removeEventListener("termdock:open-settings",S)},[Ze,ba]);const va=b.useCallback(()=>{ct(!0),tt.current!==null&&(window.clearTimeout(tt.current),tt.current=null)},[]),ps=b.useCallback(()=>{tt.current!==null&&(window.clearTimeout(tt.current),tt.current=null),ct(!1),Ci.current=!0,eh(),Ci.current},[]);b.useEffect(()=>()=>{tt.current!==null&&window.clearTimeout(tt.current)},[]),b.useEffect(()=>{l||eh()},[l]),b.useEffect(()=>{if(typeof window>"u"||l)return;let S=null;const D=()=>{S!==null&&(window.clearTimeout(S),S=null)},ue=hn=>{if(cs.current,Ci.current,cs.current){cs.current;return}!hn?.force&&Ci.current||(hn?.userActivated&&(Ci.current=!0),eh(),Ci.current,void 0)},nt=()=>{D(),S=window.setTimeout(()=>{S=null,ue({force:!0})},nb)},St=()=>{ue({userActivated:!0})},qt=()=>{nt()},wr=()=>{document.visibilityState==="visible"&&nt()};return window.addEventListener("pointerdown",St,{capture:!0,passive:!0}),window.addEventListener("touchstart",St,{capture:!0,passive:!0}),window.addEventListener("keydown",St,{capture:!0}),window.addEventListener("pageshow",qt),document.addEventListener("visibilitychange",wr),()=>{D(),window.removeEventListener("pointerdown",St,{capture:!0}),window.removeEventListener("touchstart",St,{capture:!0}),window.removeEventListener("keydown",St,{capture:!0}),window.removeEventListener("pageshow",qt),document.removeEventListener("visibilitychange",wr)}},[l]),b.useEffect(()=>{cs.current=vn},[vn]),b.useEffect(()=>{if(typeof window>"u"||vn||l)return;const S=window.setTimeout(()=>{cs.current?(cs.current,void 0):eh()},nb);return()=>window.clearTimeout(S)},[vn,l]),b.useEffect(()=>{if(typeof window>"u"||l)return;const S=ks.current;Qa.current,vn&&vn!==S&&!Qa.current&&pu(vn),!vn&&S&&ho(),ks.current=vn,!vn&&Qa.current&&window.setTimeout(()=>{Qa.current=!1},0)},[vn,l,ho]),b.useEffect(()=>{if(typeof window>"u"||l)return;const S=()=>{const D=cs.current;if(Ci.current,!D){Ci.current=!1,Ci.current,va(),k6();return}Qa.current=!0,pa(D)};return window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[pa,va,l]),b.useEffect(()=>{const S=D=>{const ue=D.metaKey||D.ctrlKey;if(ue&&D.key==="b"&&!D.shiftKey&&(D.preventDefault(),Si()),ue&&D.shiftKey&&D.key==="E"&&(D.preventDefault(),Ji()),ue&&D.shiftKey&&D.key==="P"&&(D.preventDefault(),el()),ue&&!D.shiftKey&&D.altKey&&(D.key==="ArrowLeft"||D.key==="ArrowRight")){D.preventDefault();const nt=D.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:nt}}));return}if(ue&&D.shiftKey&&!D.altKey&&(D.code==="BracketLeft"||D.code==="BracketRight")){D.preventDefault();const nt=D.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:nt}}));return}};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[Si,Ji,el]);const Li=b.useCallback(async()=>{oe(!0),K(null);try{const S=await ha({localAccess:{name:de}});he(S.localAccess),$e(S.localAccess.name),$n(du,{preventSleep:S.preventSleep,networkAvailable:S.networkAvailable,localAccess:S.localAccess})}catch(S){K(S instanceof Error?S.message:"Failed to save local access name")}finally{oe(!1)}},[de]),mo=b.useCallback(async()=>{oe(!0),K(null);try{const S=await ha({localAccess:{reset:!0}});he(S.localAccess),$e(S.localAccess.name),$n(du,{preventSleep:S.preventSleep,networkAvailable:S.networkAvailable,localAccess:S.localAccess})}catch(S){K(S instanceof Error?S.message:"Failed to reset local access name")}finally{oe(!1)}},[]),go=b.useCallback(async(S,D="url")=>{if(S)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(S);else{const ue=document.createElement("textarea");ue.value=S,ue.style.position="fixed",ue.style.left="-9999px",document.body.appendChild(ue),ue.focus(),ue.select(),document.execCommand("copy"),document.body.removeChild(ue)}Z(D),window.setTimeout(()=>Z(ue=>ue===D?null:ue),1600)}catch{Z(null)}},[]),xo=b.useCallback(S=>{const D=DO(It,S);D.map(ue=>ue.id).join("\0")!==It.map(ue=>ue.id).join("\0")&&(cn(D),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:D.map(ue=>ue.id)}})))},[It]),Us=b.useCallback(S=>{er||S.type!=="session"||(on.current=!1,ar(!1),dt(S.draggableId))},[er]),zs=b.useCallback(S=>{if(er||S.type!=="session")return;const D=S.destination?.droppableId===Om;D!==on.current&&(on.current=D,ar(D),D&&navigator.vibrate?.(20))},[er]),jo=b.useCallback(S=>{const D=bO(S,!er);if(on.current=!1,ar(!1),dt(null),!D)return!1;const ue=It.find(St=>St.id===S.draggableId),nt=ue?Ve.get(ue.id):null;return ue&&Qx({mode:ue.mode,activeProgram:nt?.activeProgram??null,promptState:nt?.promptState??null,shellNames:ua})?(xe(null),z(ue.id),zn(null)):ue&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ue.id,source:"other",closeMode:ue.mode==="tmux"?"destroy":"auto"}})),!0},[er,It,Ve]),{groups:Yn,arranged:as}=C.useMemo(()=>Th(It,S=>Ve.get(S.id)?.cwd??null,Dn,e("sidebar.ungrouped"),Er,kn),[It,Ve,Dn,e,Er,kn]),di=b.useCallback(S=>{jo(S)||!S.destination||S.source.index===S.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:as[S.source.index]?.id,targetId:as[S.destination.index]?.id}}))},[jo,as]),ji=b.useCallback((S,D)=>{const ue=D.trim();ue&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:S,name:ue}}))},[]),Bi=b.useCallback(S=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:S}}))},[]),{newSessionMode:Hs,newSessionTmuxName:bo,userSelectedNewSessionMode:Ws,setNewSessionMode:hi}=lj(),[sn,wa]=b.useState(null),[Gs,ea]=C.useState(!1),[Aa,Ta]=C.useState(!1),[fi,ta]=C.useState(!1),[Cs,Ca]=C.useState("idle"),Ua=C.useRef(ec(Jd,TO)).current,[rs,ms]=C.useState(()=>{const S=Ua?.presets;if(S&&S.length>0){const D=Kc(S);if(D.length>0)return D}return Ou()}),[Sa,rl]=C.useState(!1),[Qi,yo]=C.useState("default"),za=C.useRef(typeof Ua?.updatedAt=="number"?Ua.updatedAt:null),nl=C.useRef(!1),[Ha,_a]=C.useState(!1),[ie,Fe]=C.useState(!1),yt=C.useRef(ec(ca,AO)).current,[Tt,Oe]=C.useState(yt??[]),[_t,hr]=C.useState(yt!==null),[Fr,L]=C.useState(!1),j=!vn&&!Aa&&!fi&&!Gs&&!Ha&&!ie&&!He&&!Wn&&!sn,O=C.useCallback(S=>{const D=typeof S.version=="number"?S.version:0,ue=CO(Array.isArray(S.presets)?S.presets:[],D);za.current=typeof S.updatedAt=="number"?S.updatedAt:null,ms(nt=>ww(nt,ue)?nt:(nl.current=!0,ue)),$n(Jd,{version:bu,presets:ue,updatedAt:za.current??void 0})},[]);b.useEffect(()=>{const S=D=>{if(D.key!=="Escape")return;if(Aa){D.preventDefault(),Ta(!1);return}if(fi){D.preventDefault(),ta(!1);return}if(Gs){D.preventDefault(),ea(!1);return}if(Ha){D.preventDefault(),_a(!1);return}if(ie){D.preventDefault(),Fe(!1);return}if(He){D.preventDefault(),Xt();return}if(vt){D.preventDefault(),Te(null),lt(null);return}if(Xe){D.preventDefault(),ya();return}if(pn&&!(Rn&&er)){D.preventDefault(),gn("right-sidebar");return}Xr&&!(mn&&er)&&(D.preventDefault(),gn("left-sidebar"))};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[Aa,fi,Gs,Ha,He,Xt,Xe,pn,Rn,Xr,mn,er,ya,gn]),b.useEffect(()=>{hr(!0)},[]);const[H,Qe]=C.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:I6}),[,ke]=C.useState(!1),st=C.useCallback(()=>Aw().then(S=>{Qe(S),ua=new Set(S.shellNames),ke(!0)}).catch(()=>{}),[]);b.useEffect(()=>{st()},[st]),b.useEffect(()=>cg(S=>{if(S.type==="config-updated"){if(S.key==="toolbar-presets"){ug().then(D=>O(D)).catch(D=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",D)});return}S.key==="program-detection"&&st()}}),[O,st]),b.useEffect(()=>{let S=!1;return(async()=>{try{const D=await ug();if(S)return;O(D)}catch(D){console.warn("[toolbar-presets] Failed to load from server:",D)}finally{S||rl(!0)}})(),()=>{S=!0}},[O]),b.useEffect(()=>{if(Sa){if(nl.current){nl.current=!1;return}$n(Jd,{version:bu,presets:rs,updatedAt:za.current??void 0}),Tw({version:bu,presets:rs,baseUpdatedAt:za.current??void 0}).then(S=>{za.current=typeof S.updatedAt=="number"?S.updatedAt:null,$n(Jd,{version:bu,presets:rs,updatedAt:za.current??void 0})}).catch(S=>{const D=S instanceof Error&&"current"in S?S.current:null;D&&typeof D=="object"&&O(D),console.warn("[toolbar-presets] Failed to save to server:",S)})}},[O,rs,Sa]),b.useEffect(()=>{vl().then(S=>{A(D=>D===S.preventSleep?D:S.preventSleep),k(D=>D===S.networkAvailable?D:S.networkAvailable),he(S.localAccess),$e(S.localAccess.name),$t(S.runningSessionButtonEnabled),$n(hu,S.runningSessionButtonEnabled),es(S.attentionButtonEnabled),$n(fu,S.attentionButtonEnabled),$n(du,{preventSleep:S.preventSleep,networkAvailable:S.networkAvailable,localAccess:S.localAccess})}).catch(()=>{})},[]),b.useEffect(()=>{if(!E)return;const S=Rf();ee(S),S!=="granted"&&(I(!1),vd(!1))},[E]),b.useEffect(()=>{if(!E)return;D0();const S=()=>{document.visibilityState==="visible"&&(D0(),Qw())},D=window.setInterval(()=>{D0()},360*60*1e3);return document.addEventListener("visibilitychange",S),window.addEventListener("focus",S),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",S),window.removeEventListener("focus",S)}},[E]);const ot=b.useCallback(async()=>{if(E){I(!1),vd(!1),Cw(),ee(Rf());return}const S=await Sw();if(ee(S),S!=="granted"){I(!1),vd(!1);return}I(!0),vd(!0),await D0(!0,!0),Ca("idle")},[E]),zt=b.useCallback(async()=>{Ca("checking"),await ko()?.prepareNotificationTest?.();const S=await _w({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});Ca(S?"delivered":"failed")},[e]),fr=b.useCallback(S=>{B(S),Lw(S),Mf()},[]),ln=b.useCallback(S=>{U(S),kw(S),Mf()},[]),On=b.useCallback(S=>{Q(S),Iw(S),Mf()},[]);b.useEffect(()=>{rs.some(S=>S.id===Qi)||yo(rs[0]?.id??"default")},[Qi,rs]),b.useEffect(()=>{if(!W.available&&Hs==="tmux"){hi("shell",{userInitiated:!1});return}W.available&&Ws!=="shell"&&Hs!=="tmux"&&hi("tmux",{userInitiated:!1})},[Hs,W.available,Ws,hi]),b.useEffect(()=>{wa(null)},[Xe,Hs,W.available]),b.useEffect(()=>{const S={};typeof navigator<"u"&&(S.userAgent=navigator.userAgent,S.platform=navigator.platform,S.maxTouchPoints=navigator.maxTouchPoints,S.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,S.vendor=navigator.vendor),typeof window<"u"&&(S.screenWidth=window.innerWidth,S.screenHeight=window.innerHeight,S.pixelRatio=window.devicePixelRatio,S.orientation=window.screen?.orientation?.type||"unknown",S.hasVisualViewport=!!window.visualViewport,S.visualViewportHeight=window.visualViewport?.height,S.visualViewportWidth=window.visualViewport?.width,S.location=window.location.href),S.timestamp=new Date().toISOString(),S.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,S.isAndroid=/Android/.test(navigator.userAgent),Et(S)},[]);const En=b.useCallback(S=>{if(jo(S)||!S.destination)return;if(S.type==="group"){if(S.source.index===S.destination.index)return;xo(bb(Yn,S.source.index,S.destination.index));return}if(S.source.droppableId!==S.destination.droppableId||S.source.index===S.destination.index)return;const D=S.source.droppableId.replace(/^group-sessions:/,""),ue=Yn.find(nt=>nt.key===D);ue&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ue.sessions[S.source.index]?.id,targetId:ue.sessions[S.destination.index]?.id}}))},[Yn,xo,jo]),Gn=C.useMemo(()=>as.flatMap(S=>{const D=Ve.get(S.id);if(D?.agentStatus!=="working")return[];const{primary:ue,secondary:nt}=qo(S,D?.activeProgram??null,D?.cwd??null,ua,D?.shellTitle??null,D?.promptState??null);return[{id:S.id,label:ue,detail:nt}]}),[as,Ve]),kr=Lt?as.findIndex(S=>S.id===Lt):-1,Cn=as.length>0&&kr>=0?`${kr+1}/${as.length}`:`${as.length}`,Ln=C.useMemo(()=>{let S=0;for(const D of It){const ue=Ve.get(D.id);(ue?.agentStatus==="waiting"||ue?.agentNeedsReview)&&(S+=1)}return{running:Gn.length,review:S}},[Gn.length,It,Ve]),Vs=C.useMemo(()=>as.flatMap(S=>{const D=Ve.get(S.id);if(D?.agentStatus!=="waiting"&&!D?.agentNeedsReview)return[];const{primary:ue}=qo(S,D.activeProgram,D.cwd,ua,D.shellTitle,D.promptState);return[{id:D.terminalSessionId??S.id,label:ue,waiting:D.agentStatus==="waiting"}]}),[as,Ve]);Ew(Ln.running,Ln.review,Vs);const La=Lt?It.find(S=>S.id===Lt)??null:null,ds=La?Ve.get(La.id):void 0,ql=!!(La&&ds?.agentResumeRecovered&&ds.agentNativeSessionId&&ds.terminalSessionId),Ss=La&&Sr?.sessionId===La.id?Sr:null;C.useLayoutEffect(()=>{if(!Ae)return;const S=Ft.current;if(!S)return;const D=!tr.current;S.scrollIntoView({inline:"nearest",block:"nearest",behavior:D?"auto":"smooth"}),tr.current=!0,D&&Xc("active-tab-positioned")},[Lt,Ae]),b.useEffect(()=>{$&&Pe.current&&(Pe.current.scrollIntoView({block:"nearest",inline:"nearest"}),Pe.current.focus(),Pe.current.select()),$||(Ht.current=!1)},[$]);const Bo=b.useCallback(S=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:S}))},[]),Tl=b.useCallback((S,D)=>{xt(D??null),Ke(S)},[]),_c=Ky(),ki=b.useCallback(S=>{if(!S)return;P(S),bt.current&&da("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:bt.current,requestedSessionId:S,activeSessionId:Lt,sessions:It.map(ue=>({id:ue.id,terminalSessionId:Ve.get(ue.id)?.terminalSessionId??null}))}),Nw(S);const D=It.find(ue=>ue.id===S||Ve.get(ue.id)?.terminalSessionId===S);D?(at.current=null,bt.current&&da("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:bt.current,requestedSessionId:S,targetSessionId:D.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):(at.current=S,bt.current&&da("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:bt.current,requestedSessionId:S}))},[Lt,It,Ve]);b.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let S=!1;const D=async()=>{if(window.parent!==window&&Ko()){_e(!0);return}try{const nt=await caches.open(kO),St=await nt.match(sb);if(!St)return;await nt.delete(sb);const qt=await St.json();if(S)return;const wr=typeof qt.sessionId=="string"?qt.sessionId:null,hn=typeof qt.traceId=="string"?qt.traceId:null,un=typeof qt.clickedAt=="number"?qt.clickedAt:0,wn=Date.now()-un;da("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:hn,sessionId:wr,ageMs:wn,valid:!!(wr&&wn>=0&&wn<=ib),visibilityState:document.visibilityState}),wr&&wn>=0&&wn<=ib&&(bt.current=hn,typeof qt.targetPeerId=="string"&&qt.targetPeerId!==j0()?.targetPeerId?Ko()?.focusSession(qt.targetPeerId,wr):ki(wr))}catch(nt){da("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:nt instanceof Error?nt.message:String(nt)})}finally{S||_e(!0)}},ue=()=>{document.visibilityState==="visible"&&D()};return D(),document.addEventListener("visibilitychange",ue),window.addEventListener("pageshow",D),()=>{S=!0,document.removeEventListener("visibilitychange",ue),window.removeEventListener("pageshow",D)}},[ki]),b.useEffect(()=>{if(typeof window>"u")return;const S=new URLSearchParams(window.location.search),D=S.get("session");if(!D)return;da("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:bt.current,targetSessionId:D,href:window.location.href,visibilityState:document.visibilityState});const ue=S.get("service");ue&&ue!==j0()?.targetPeerId?Ko()?.focusSession(ue,D):at.current=D,S.delete("service"),S.delete("session"),S.delete("_notifTrace");const nt=S.toString(),St=`${window.location.pathname}${nt?`?${nt}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",St)},[]),b.useEffect(()=>{if(typeof window>"u")return;const S=new URLSearchParams(window.location.search);if(S.get("_notif")!=="1")return;const D=S.get("session");S.delete("_notif");const ue=S.toString(),nt=`${window.location.pathname}${ue?`?${ue}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",nt),window.parent!==window&&Ko())return;const St=new BroadcastChannel("termdock:notif");let qt=!1;const wr=un=>{un.data?.type==="termdock:notif-pong"&&!qt&&(qt=!0,St.close(),window.close())};St.addEventListener("message",wr),St.postMessage({type:"termdock:notif-ping",sessionId:D,targetPeerId:S.get("service")});const hn=setTimeout(()=>{qt||St.close()},500);return()=>{clearTimeout(hn),qt||St.close()}},[]),b.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&Ko())return;const S=new BroadcastChannel("termdock:notif"),D=ue=>{ue.data?.type==="termdock:notif-ping"&&(S.postMessage({type:"termdock:notif-pong"}),typeof ue.data.sessionId=="string"&&(typeof ue.data.targetPeerId=="string"&&ue.data.targetPeerId!==j0()?.targetPeerId?Ko()?.focusSession(ue.data.targetPeerId,ue.data.sessionId):ki(ue.data.sessionId)))};return S.addEventListener("message",D),()=>S.close()},[ki]),b.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const S=D=>{const ue=D.data;if(ue&&ue.type==="termdock:focus-session"&&typeof ue.sessionId=="string"){if(typeof ue.targetPeerId=="string"&&ue.targetPeerId!==j0()?.targetPeerId){Ko()?.focusSession(ue.targetPeerId,ue.sessionId)&&D.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}D.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),ki(ue.sessionId)}else ue?.type==="termdock:push-subscription-changed"?D0(!0):ue?.type};return navigator.serviceWorker.addEventListener("message",S),()=>navigator.serviceWorker.removeEventListener("message",S)},[ki]),b.useEffect(()=>{const S=D=>{const ue=D.detail;typeof ue=="string"&&ki(ue)};return window.addEventListener("termdock:focus-session",S),()=>window.removeEventListener("termdock:focus-session",S)},[ki]),b.useEffect(()=>{const S=()=>{const D=Pw(j0()?.targetPeerId);D&&ki(D)};return S(),window.addEventListener("termdock:workspace-session",S),()=>window.removeEventListener("termdock:workspace-session",S)},[ki]),b.useEffect(()=>{const S=at.current;if(!S)return;const D=It.find(ue=>ue.id===S||Ve.get(ue.id)?.terminalSessionId===S);D?(at.current=null,bt.current&&da("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:bt.current,requestedSessionId:S,targetSessionId:D.id,activeSessionId:Lt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):bt.current&&da("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:bt.current,requestedSessionId:S,activeSessionId:Lt,sessions:It.map(ue=>({id:ue.id,terminalSessionId:Ve.get(ue.id)?.terminalSessionId??null}))})},[Lt,It,Ve]);const ka=C.useMemo(()=>{const S=[];for(const D of It){const ue=Ve.get(D.id);(ue?.agentStatus==="waiting"||ue?.agentNeedsReview)&&S.push(D.id)}return S},[It,Ve]),Es=b.useCallback(()=>{if(ka.length===0)return;Lt&&Kr.getState().clearAgentNeedsReview(Lt);const S=Lt?It.findIndex(ue=>ue.id===Lt):-1,D=ka.find(ue=>It.findIndex(nt=>nt.id===ue)>S)??ka[0];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[ka,It,Lt]),Cl=b.useCallback(()=>{if(ka.length===0)return;Lt&&Kr.getState().clearAgentNeedsReview(Lt);const S=Lt?It.findIndex(ue=>ue.id===Lt):It.length,D=[...ka].reverse().find(ue=>It.findIndex(nt=>nt.id===ue)<S)??ka[ka.length-1];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[ka,It,Lt]);b.useEffect(()=>{const S=D=>{!D.altKey||!D.shiftKey||D.metaKey||D.ctrlKey||D.key!=="ArrowUp"&&D.key!=="ArrowDown"||(D.preventDefault(),D.key==="ArrowUp"?Cl():Es())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Es,Cl]);const ff=b.useCallback(async S=>{const ue=Kr.getState().sessions.get(S)?.cwd;if(ue)try{await navigator.clipboard?.writeText(ue),Mt(ue),window.setTimeout(()=>{Mt(nt=>nt===ue?null:nt)},1400)}catch{}},[]),id=b.useCallback(S=>{cn(S.sessions),Vr(S.activeSessionId),fe(S.splitWorkspaces),Kr.getState().setActiveSessionId(S.activeSessionId)},[]),pf=b.useCallback(()=>{fn(!0)},[]),mf=b.useCallback(()=>{fn(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);b.useEffect(()=>{if(!yn||!Lt)return;It.find(D=>D.id===yn||Ve.get(D.id)?.terminalSessionId===yn)?.id===Lt&&P(null)},[Lt,yn,It,Ve]);const vo=b.useCallback(S=>{const D=S?.mode??Hs,ue=D==="tmux"&&(S?.tmuxSessionName?.trim()||bo.trim())||void 0,nt=S?.cwd||(Lt?Kr.getState().sessions.get(Lt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:D,tmuxSessionName:ue,cwd:nt,command:S?.command}}))},[Hs,bo,Lt]),sl=b.useCallback(async()=>{yr(!0);try{const S=await Hp();if(Be(S),!S.available){Br([]);return}const D=await Wp();Br(D)}catch{Be({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Br([])}finally{yr(!1)}},[]),gf=b.useCallback(async S=>{Zr(S),zn(null);try{const{cleanedSessions:D}=await db(S);for(const ue of D)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ue}));Mr(null),await sl()}catch(D){zn(D instanceof Error?D.message:"Failed to kill tmux session")}finally{Zr(null)}},[sl]);b.useEffect(()=>{if(!jn)return;if(rn.find(ue=>ue.name===jn&&(ue.connected||ue.boundFrontendSessionId))){ss(null);return}const D=setTimeout(()=>ss(null),1e4);return()=>clearTimeout(D)},[jn,rn]);const Yl=b.useCallback(S=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:S}))},[]),ad=b.useCallback(S=>{const D=S??Lt;D&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:D}))},[Lt]),od=b.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:S,layout:D}}))},[]),ld=b.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:S,sessionIds:D}}))},[]),Lc=b.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:S,name:D}}))},[]),v0=b.useCallback((S,D)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:S,secondaryId:D}}))},[]),Sl=b.useCallback((S,D)=>{const ue=It.find(St=>St.id===S);if(!ue)return;const nt=Ve.get(S);if(!Qx({mode:ue.mode,activeProgram:nt?.activeProgram??null,promptState:nt?.promptState??null,shellNames:ua})){Yl({sessionId:S,source:"sidebar",closeMode:ue.mode==="tmux"?"destroy":"auto"});return}xe(D?{x:D.clientX,y:D.clientY}:null),z(S),zn(null)},[It,Ve,Yl]);b.useEffect(()=>{if(!Ze)return;const S=D=>{const ue=D.detail;ue==="new-session"?vo():ue==="close-session"?Lt&&Sl(Lt):ue==="previous-session"||ue==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ue==="next-session"?"next":"prev"}})):ue==="toggle-left-sidebar"?Si():ue==="toggle-right-sidebar"?Ji():ue==="previous-attention"?Cl():ue==="next-attention"&&Es()};return window.addEventListener("termdock:native-command",S),()=>window.removeEventListener("termdock:native-command",S)},[Lt,Ze,vo,Sl,Si,Ji,Es,Cl]);const Pi=C.useMemo(()=>It.find(S=>S.id===Wn)??null,[It,Wn]),w0=b.useCallback(()=>{Pi&&(Yl({sessionId:Pi.id,source:"sidebar",closeMode:"destroy"}),z(null),xe(null))},[Pi,Yl]);b.useEffect(()=>{if(!Pi)return;const S=D=>{if(D.key==="Escape"){D.preventDefault(),D.stopImmediatePropagation(),z(null),xe(null),zn(null);return}D.key!=="Enter"||D.isComposing||D.keyCode===229||D.altKey||D.ctrlKey||D.metaKey||D.shiftKey||(D.preventDefault(),D.stopImmediatePropagation(),D.repeat||w0())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[Pi,w0]);const A0=C.useMemo(()=>{if(!Pi)return"";const S=Ve.get(Pi.id);return qo(Pi,S?.activeProgram??null,S?.cwd??null,ua,S?.shellTitle??null,S?.promptState??null).primary},[Pi,Ve]);b.useEffect(()=>{if(!Xe)return;let S=!1,D=!1;const ue=async()=>{if(!D)try{const St=await Hp();if(S||Be(St),!St.available){S||Br([]);return}const qt=await Wp();S||Br(qt)}catch{D=!0,S||(Be({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Br([]))}};ue();const nt=setInterval(()=>{ue()},4e3);return()=>{S=!0,clearInterval(nt)}},[Xe]);const T0=sn??Hs,C0=T0==="shell",S0=T0==="tmux"&&W.available,xf=C.useMemo(()=>Rw(rn.map(S=>({...S,id:S.name})),S=>S.cwd??null,e("sidebar.ungrouped")),[rn,e]),_0=C.useMemo(()=>rn.filter(S=>S.recoveryCandidate===!0&&!S.connected&&!S.boundFrontendSessionId).sort((S,D)=>(D.lastActiveAt??D.createdAt??0)-(S.lastActiveAt??S.createdAt??0)),[rn]);b.useEffect(()=>{!Xr&&!(mn&&er)||sl()},[Xr,mn,er,It.length,sl]);const L0=(S,D,ue,nt=!1)=>{const St=S.id===Lt,qt=S.id===$,wr=Ve.get(S.id),{primary:hn,secondary:un}=qo(S,wr?.activeProgram??null,wr?.cwd??null,ua,wr?.shellTitle??null,wr?.promptState??null),wn=Nu(wr?.cwd??null),Ii=D?un??(wn&&wn!==hn?wn:null):null,Jr=wr?.gitStatus,qs=`${wr?.cwd||S.name}${Jr?`
171
+ ⎇ ${Jr.branch} +${Jr.added} −${Jr.removed}`:""}`,Wa=!!(wr?.tuiProgress&&wr.tuiProgress.state!=="remove"),Ga=wr?.agentStatus==="working"||Wa?"var(--success)":wr?.agentStatus==="waiting"||wr?.agentNeedsReview?"var(--warning)":wr?.inCopyMode?"var(--tmux)":null;if(qt&&er&&!vt){const sa=S.customName?S.name:hn,pi=(Ia,dd)=>{const N0=dd.trim();N0?N0!==sa&&ji(Ia,N0):Bi(Ia),Te(null)};return i.jsx("input",{ref:Ia=>{Pe.current=Ia},type:"text",defaultValue:sa,className:"h-8 shrink-0 rounded-md bg-surface-elevated px-2 text-[12px] leading-none text-foreground outline-none ring-1 ring-primary/50 sm:h-8 min-w-[5rem]",style:{width:`${Math.max(sa.length,5)}ch`},onKeyDown:Ia=>{Ia.key==="Enter"?pi(S.id,Ia.target.value):Ia.key==="Escape"&&Te(null)},onBlur:Ia=>pi(S.id,Ia.target.value)})}return i.jsx("div",{ref:St?Ft:null,onContextMenu:sa=>{sa.preventDefault(),xt({x:sa.clientX,y:sa.clientY}),Ke(S.id)},..._c(()=>Tl(S.id)),className:nt?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${St?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/40 hover:text-foreground"}`:`group relative inline-flex h-8 shrink-0 items-center rounded-md text-[12px] leading-none transition sm:h-8 ${St?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!nt&&St&&Ga?{boxShadow:`inset 2px 0 0 0 ${Ga}`}:!nt&&St?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:qs,children:i.jsx("button",{type:"button",...ue??{},onClick:()=>Bo(S.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${nt?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ue?"cursor-grab active:cursor-grabbing":""}`,title:qs,children:i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[i.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[ob(S.mode,wr),wr?.agentResumeRecovered&&i.jsx(uc,{size:nt?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),Wa&&!wr?.agentStatus&&i.jsx(Nn,{size:nt?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),Ii?i.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[i.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${wr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:hn}),i.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:Ii})]}):i.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${wr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:hn})]})})})},cd=()=>i.jsx(gl,{droppableId:Om,type:"session",isDropDisabled:er,children:(S,D)=>{const ue=Ct||D.isDraggingOver;return i.jsxs("div",{ref:S.innerRef,...S.droppableProps,className:"pointer-events-none fixed left-1/2 top-[42%] z-toast flex h-32 w-32 -translate-x-1/2 -translate-y-1/2 items-center justify-center",role:"status","aria-live":"polite","aria-hidden":!Ot,"data-mobile-session-destroy-target":"","data-active":ue?"true":"false",children:[i.jsxs("div",{className:`flex h-28 w-28 flex-col items-center justify-center gap-2 rounded-full border bg-surface-elevated/95 shadow-2xl backdrop-blur transition duration-200 ${Ot?ue?"scale-110 border-destructive bg-destructive text-destructive-foreground opacity-100":"scale-100 border-destructive/50 text-destructive opacity-100":"scale-75 border-transparent opacity-0"}`,children:[i.jsx(ni,{size:28,strokeWidth:1.8}),i.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ue?"tab.releaseToClose":"tab.dragToClose")})]}),S.placeholder]})}}),ra=mn&&er,il=Rn&&er,_l=nh(dn,Qn,ra?An:0),Zl=il?_l+ub:0,na=ra?It.find(S=>S.id===Lt):null,_s=na?Ve.get(na.id):void 0,k0=na?qo(na,_s?.activeProgram??null,_s?.cwd??null,ua,_s?.shellTitle??null,_s?.promptState??null).primary:"",I0=er?ur:null,bf=ra&&!I0&&_s?_s.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":_s.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":_s.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":_s.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",E0=i.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[i.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:i.jsxs("div",{className:"relative flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:[i.jsxs("div",{className:`${er?"absolute inset-x-0 top-0 z-20":"relative"} shrink-0 items-center gap-1 app-chrome-bg px-1 sm:px-1.5 transition-colors duration-500 ${ra?"flex justify-end":"flex justify-between"} ${Dn?"h-10 sm:h-10":"h-9 sm:h-10"} ${bf}`,style:{position:er?"absolute":void 0,marginRight:Zl||void 0,display:I0?"none":void 0},children:[!ra&&i.jsxs("button",{type:"button",onClick:Si,className:"relative inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.sessionsTitle"),title:`${e("tab.sessionsTitle")} · ${e("agent.aiRunning")}: ${Ln.running} · ${e("agent.needsReview")}: ${Ln.review}`,children:[i.jsx(gA,{size:14}),i.jsx(XB,{runningCount:Ln.running,reviewCount:Ln.review,className:"sm:hidden"})]}),ra?i.jsx("div",{className:"absolute left-1/2 flex max-w-[40%] min-w-0 -translate-x-1/2 items-center justify-center gap-1.5 overflow-hidden",children:na?i.jsxs(i.Fragment,{children:[ob(na.mode,_s),i.jsx("span",{className:`truncate text-[12px] font-medium ${_s?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:k0}),_s?.agentStatus==="working"&&i.jsx("span",{title:_s?.agentMessage??void 0,children:i.jsx(Nn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),_s?.agentStatus==="waiting"&&i.jsx("span",{title:_s?.agentMessage??void 0,children:i.jsx(Sh,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!_s?.agentStatus&&_s?.agentNeedsReview&&i.jsx("span",{title:_s?.agentMessage??void 0,children:i.jsx(Wl,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):i.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):Dn?i.jsxs(Uh,{onDragStart:Us,onDragUpdate:zs,onDragEnd:En,children:[cd(),i.jsx(gl,{droppableId:"groups",type:"group",direction:"horizontal",children:S=>i.jsxs("div",{ref:S.innerRef,...S.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap px-0.5 py-0.5",style:{touchAction:"pan-x"},children:[Yn.map((D,ue)=>{let nt=0,St=0;for(const un of D.sessions){const wn=Ve.get(un.id);wn?.agentStatus==="working"&&(nt+=1),(wn?.agentStatus==="waiting"||wn?.agentNeedsReview)&&(St+=1)}const qt=D.sessions.some(un=>un.id===Lt),wr=$r.has(D.key),hn=D.key==="";return i.jsx(ml,{draggableId:`group-${D.key||"__ungrouped__"}`,index:ue,isDragDisabled:hn,disableInteractiveElementBlocking:!0,children:(un,wn)=>i.jsxs("div",{ref:un.innerRef,...un.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${wn.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":qt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[i.jsxs("button",{type:"button",...hn?{}:un.dragHandleProps,onClick:()=>Ts(D.key),className:`flex ${wr?"":D.sessions.length>1?"w-0 min-w-full":""} items-center gap-0.5 rounded text-[9px] font-semibold uppercase tracking-[0.08em] leading-none transition hover:bg-surface-elevated/40 ${hn?"":"cursor-grab active:cursor-grabbing"} ${qt?"text-primary/80":"text-muted-foreground/55"}`,title:D.key||D.label,children:[i.jsx(yc,{size:9,className:`shrink-0 opacity-70 transition-transform ${wr?"":"rotate-90"}`}),i.jsx("span",{className:"min-w-0 truncate",children:D.label}),nt>0&&i.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),St>0&&i.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${nt>0?"":"ml-auto"}`})]}),wr?i.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:D.sessions.length})}):i.jsx(gl,{droppableId:`group-sessions:${D.key}`,type:"session",direction:"horizontal",children:Ii=>i.jsxs("div",{ref:Ii.innerRef,...Ii.droppableProps,className:"flex items-center gap-px",children:[D.sessions.map((Jr,qs)=>i.jsx(ml,{draggableId:Jr.id,index:qs,disableInteractiveElementBlocking:!0,children:(Wa,Ga)=>i.jsx("div",{ref:Wa.innerRef,...Wa.draggableProps,className:`flex shrink-0 items-center ${Ga.isDragging?"opacity-70":""}`,children:L0(Jr,!1,Wa.dragHandleProps,!0)})},Jr.id)),Ii.placeholder]})})]})},D.key||"__ungrouped__")}),S.placeholder,i.jsx("button",{type:"button",onClick:()=>vo(),className:"my-auto inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:i.jsx(Os,{size:14})})]})})]}):i.jsxs(Uh,{onDragStart:Us,onDragUpdate:zs,onDragEnd:di,children:[cd(),i.jsx(gl,{droppableId:"tabs",type:"session",direction:"horizontal",children:S=>i.jsxs("div",{ref:S.innerRef,...S.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap",style:{touchAction:"pan-x"},children:[as.map((D,ue)=>D.id===$?i.jsx(C.Fragment,{children:i.jsx(ml,{draggableId:D.id,index:ue,isDragDisabled:!0,children:St=>i.jsx("div",{ref:St.innerRef,...St.draggableProps,className:"flex h-full items-center",children:L0(D,!0)})})},D.id):i.jsx(C.Fragment,{children:i.jsx(ml,{draggableId:D.id,index:ue,disableInteractiveElementBlocking:!0,children:(St,qt)=>i.jsx("div",{ref:St.innerRef,...St.draggableProps,className:`flex h-full shrink-0 items-center ${qt.isDragging?"opacity-70":""}`,children:L0(D,!0,St.dragHandleProps)})})},D.id)),i.jsx("button",{type:"button",onClick:()=>vo(),className:"ml-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:i.jsx(Os,{size:14})}),S.placeholder]})})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!ra&&Ln.running>0&&i.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:i.jsx(p6,{count:Ln.running,tone:"running",title:e("agent.aiRunning")})}),!ra&&It.length>0&&i.jsx("span",{className:"inline-flex shrink-0 items-center px-1 text-[10px] uppercase tracking-[0.16em] text-muted-foreground sm:text-[11px]",title:`Session ${kr+1} of ${It.length}`,children:Cn}),!il&&i.jsx("button",{type:"button",onClick:Ji,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.explorerTitle"),title:e("tab.explorerTitle"),children:i.jsx(Lb,{size:14})})]})]}),ql&&La&&ds?.terminalSessionId&&i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/15 bg-surface/80 px-3 py-2 animate-fade-in sm:px-4",style:{marginRight:Zl||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[i.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] text-[color:var(--warning)]",children:!Ss?.error&&(Ss?.status==="submitting"||Ss?.status==="waiting")?i.jsx(Nn,{size:14,className:"animate-spin"}):i.jsx(uc,{size:14})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:ds.agent?.displayName??"Agent"})}),i.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${Ss?.error?"text-destructive":"text-muted-foreground"}`,children:Ss?.error??(Ss?.status==="submitting"?e("tab.resumeAgentSubmitting"):Ss?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),i.jsx("button",{type:"button",disabled:!Ss?.error&&(Ss?.status==="submitting"||Ss?.status==="waiting"),onClick:()=>{an(La.id,ds.terminalSessionId)},className:"shrink-0 rounded-full bg-primary px-3 py-1.5 text-[11px] font-semibold text-primary-foreground transition hover:opacity-90 active:scale-95 disabled:cursor-wait disabled:opacity-60 sm:text-[12px]",children:Ss?.error?e("common.retry"):e("tab.resumeAgentNow")}),i.jsx("button",{type:"button",onClick:()=>{Kr.getState().setAgentResumeRecovered(La.id,!1),Pr(S=>S?.sessionId===La.id?null:S)},className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("tab.resumeAgentLater"),title:e("tab.resumeAgentLater"),children:i.jsx(Kn,{size:13})})]}),i.jsx("div",{ref:zr,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:i.jsx(OI,{terminalSettings:dr,colorTheme:p,toolbarPresets:rs,showDebug:c&&er,terminalFocusAvailable:j,defaultSessionMode:Hs,defaultTmuxSessionName:bo,connectionPrioritySessionId:yn,connectionPriorityReady:Ae,desktopRightSidebarEnabled:er,onToggleRightSidebar:Ji,desktopFloatingTitle:er,desktopPinnedLeftSidebarWidth:ra?An:0,desktopViewportWidth:Qn,onSessionDataUpdate:id,onInitialViewportReady:mf,onInitialRecoveryRequired:pf})})})]})}),i.jsx(nQ,{reviewCount:Ln.review,runningSessions:Gn,activeSessionId:Lt,runningButtonEnabled:cr,attentionButtonEnabled:Or,isDesktopLayout:er,containerElement:ai,occlusionInsets:{right:Zl}}),Xe&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:ya,"aria-label":e("settings.closeSettings")}),i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-dialog-title",className:"pointer-events-none fixed inset-0 z-drawer-panel flex items-stretch justify-center p-0 animate-fade-in sm:p-4 md:p-6",children:i.jsxs("div",{className:"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden bg-surface shadow-[0_28px_90px_var(--app-shadow-strong),0_14px_34px_var(--app-shadow-soft)] sm:max-h-[calc(100dvh-3rem)] sm:rounded-3xl sm:border sm:border-border/15",style:{paddingTop:n,paddingBottom:a},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border/15 px-4 py-3 sm:px-6 sm:py-4",children:[i.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[i.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-primary/15 text-primary sm:h-9 sm:w-9",children:i.jsx(qA,{size:15})}),i.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),i.jsx("button",{type:"button",onClick:ya,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive","aria-label":e("common.close"),children:i.jsx(Kn,{size:16})})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background/25 px-3 py-3 sm:px-6 sm:py-5 md:px-8",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[i.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),i.jsx("button",{type:"button",onClick:()=>Jt({fontSize:Math.max(8,We-1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"−"}),i.jsx("input",{type:"range",min:"8",max:"32",value:We,onChange:S=>Jt({fontSize:parseInt(S.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),i.jsx("button",{type:"button",onClick:()=>Jt({fontSize:Math.min(32,We+1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"+"}),i.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[We,"px"]})]}),i.jsx(xO,{}),i.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),i.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(S=>{const D=Lr===S;return i.jsx("button",{type:"button",onClick:()=>Jt({rendererMode:S}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(S==="auto"?"settings.auto":S==="webgl"?"settings.webgl":"settings.canvas")},S)})})]})}),i.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),i.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",uA,e("settings.darkTheme")],["light",JA,e("settings.lightTheme")]].map(([S,D,ue])=>{const nt=p===S;return i.jsxs("button",{type:"button",onClick:()=>g(S),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${nt?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[i.jsx(D,{size:12}),i.jsx("span",{children:ue})]},S)})})]})}),i.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[i.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),i.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(S=>{const D=Hs===S,ue=S==="tmux"&&!W.available;return i.jsx("button",{type:"button",disabled:ue,onClick:()=>hi(S,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":ue?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ue?W.reason||e("settings.installTmuxHint"):void 0,children:e(S==="shell"?"settings.shell":"settings.tmux")},S)})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>h(!c),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${c?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[i.jsx("span",{className:"font-medium",children:e("settings.debug")}),i.jsx(Xo,{checked:c,size:"sm"})]}),i.jsxs("button",{type:"button",onClick:async()=>{const S=!y;A(S);try{const D=await ha({preventSleep:S});A(D.preventSleep),k(D.networkAvailable),he(D.localAccess),$n(du,{preventSleep:D.preventSleep,networkAvailable:D.networkAvailable,localAccess:D.localAccess})}catch{A(!S)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${y?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!w&&y?e("settings.noSleepUnavailable"):void 0,children:[i.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),i.jsx(Xo,{checked:y,size:"sm"})]})]})]}),i.jsxs("div",{className:"mt-3 space-y-2",children:[i.jsxs("button",{type:"button",role:"switch","aria-checked":cr,"aria-label":e("sidebar.runningSessionButton"),onClick:()=>{Ur(!cr)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[i.jsx(Zp,{size:14,className:cr?"shrink-0 text-[color:var(--success)]":"shrink-0 text-muted-foreground"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.runningSessionButton")}),i.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.runningSessionButtonHint")})]}),i.jsx(Xo,{checked:cr,size:"sm"})]}),i.jsxs("button",{type:"button",role:"switch","aria-checked":Or,"aria-label":e("sidebar.attentionButton"),onClick:()=>{js(!Or)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[i.jsx(Wl,{size:14,className:Or?"shrink-0 text-[color:var(--warning)]":"shrink-0 text-muted-foreground"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.attentionButton")}),i.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.attentionButtonHint")})]}),i.jsx(Xo,{checked:Or,size:"sm"})]})]}),i.jsxs("button",{type:"button",onClick:()=>ta(!0),className:"mt-3 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(wb,{size:14,className:E?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),i.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(E?M&&F?"settings.notificationsBothOnSummary":M?"settings.notificationsAiOnSummary":F?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{children:e(E?"common.on":"common.off")}),i.jsx("span",{children:"›"})]})]}),i.jsxs("button",{type:"button",onClick:()=>Ta(!0),className:"mt-3 flex w-full items-center justify-between gap-3 rounded-xl bg-surface-2 px-3 py-3 text-left transition hover:bg-surface-elevated",children:[i.jsxs("span",{children:[i.jsx("span",{className:"block text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),i.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),i.jsx(yc,{size:16,className:"shrink-0 text-muted-foreground"})]}),i.jsx(uO,{state:Ue,pending:Y,onCheck:()=>{Bt()},onConfirmRestart:()=>{Ar()},desktopState:Se?pt:void 0,desktopPending:ye,onCheckDesktop:Se?()=>{Rr()}:void 0,onInstallDesktop:()=>{fs()},desktopSnapshot:se,desktopActions:Ze?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-px border-t border-border/10 bg-border/10 sm:grid-cols-2",children:[i.jsxs("button",{type:"button",onClick:()=>{Ze.showConnectionCenter()},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[i.jsx(h9,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),i.jsxs("button",{type:"button",onClick:()=>{te(null),Ze.revealDataDirectory().catch(S=>te(S instanceof Error?S.message:String(S)))},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[i.jsx(Jc,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),ht&&i.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:ht})]}):void 0}),i.jsx(hO,{backendSessionId:Lt?Ve.get(Lt)?.terminalSessionId??null:null}),i.jsx(pO,{state:be,onDismiss:()=>{Nr()}}),i.jsxs("div",{className:"mt-3 flex gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>{wa(null),vo({mode:"shell"}),ya()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${C0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:e(sn==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[i.jsx(Os,{size:14,className:C0?"shrink-0":"hidden"}),i.jsx(Ro,{size:12}),i.jsx("span",{className:C0?"whitespace-nowrap":"hidden",children:e(sn==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),i.jsxs("button",{type:"button",disabled:!W.available,onClick:()=>{W.available&&(wa(null),vo({mode:"tmux"}),ya())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${W.available?S0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"flex-1 bg-surface-2/50 text-muted-foreground/50 cursor-not-allowed"}`,title:W.available?e(sn==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):W.reason||e("settings.installTmuxHint"),children:[i.jsx(Os,{size:14,className:S0?"shrink-0":"hidden"}),i.jsx(a0,{size:12}),i.jsx("span",{className:S0?"whitespace-nowrap":"hidden",children:e(sn==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(W.available||rn.length>0)&&i.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[i.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${W.available?"bg-primary":"bg-destructive"}`}),i.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),i.jsx("span",{className:"text-[11px] text-muted-foreground",children:W.available?e("settings.sessions",{n:rn.length}):e("settings.tmuxUnavailable")})]}),i.jsx("button",{type:"button",onClick:S=>{S.preventDefault(),sl()},disabled:wt,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":e("settings.refresh"),children:i.jsx(Jn,{size:12,className:wt?"animate-spin":""})})]}),i.jsx("div",{className:"px-2 pb-2",children:W.available?rn.length===0?i.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):i.jsxs("div",{className:"space-y-2",children:[xf.map(S=>i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[i.jsx(vc,{size:11,className:"shrink-0 text-muted-foreground/70"}),i.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:S.label}),i.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:S.sessions.length})}),S.key&&i.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:S.key})]}),S.sessions.map(D=>{const ue=D.boundFrontendSessionId??null,nt=!!(D.connected||ue),St=ue?It.find(pi=>pi.id===ue)??null:null,qt=D.friendlyName?.trim()||null,wr=D.label&&D.label!==D.name?D.label:null,hn=qt||wr||D.name,un=qt||wr?`tmux:${D.name}`:null,wn=D.clientCount&&D.clientCount>0?t==="zh"?`网页连接 ${D.clientCount}`:`Web clients ${D.clientCount}`:null,Ii=D.attached>0?t==="zh"?`原生 tmux ${D.attached}`:`Native tmux ${D.attached}`:null,Jr=[un,nt?D.restorable?e("settings.restorable"):e("settings.attached"):null,wn,Ii].filter(pi=>!!pi),qs=[e("settings.windows",{n:D.windows}),D.createdAt?new Date(D.createdAt).toLocaleDateString():null].filter(pi=>!!pi),Wa=Rt===D.name,Ga=Dr===D.name,sa=jn===D.name;return i.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${Wa?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[i.jsx(a0,{size:13,className:nt?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),i.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:hn}),D.friendlyName&&i.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:t==="zh"?"自定义":"custom"})]}),Jr.length>0&&i.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:Jr.map(pi=>i.jsx("span",{className:"max-w-full truncate",children:pi},pi))}),(D.program||D.cwd)&&i.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[D.program&&i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx(Y9,{size:10,className:"shrink-0 text-muted-foreground/70"}),i.jsx("span",{className:"truncate text-foreground/75",children:D.program})]}),D.cwd&&i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx(vc,{size:10,className:"shrink-0 text-muted-foreground/70"}),i.jsx("span",{className:"truncate",children:D.cwd})]})]}),i.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:qs.map(pi=>i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(I9,{size:10,className:"shrink-0 text-muted-foreground/60"}),pi]},pi))})]}),Wa?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Ga,onClick:()=>{gf(D.name)},className:"shrink-0 rounded-full bg-destructive/90 px-2.5 py-1 text-[11px] font-medium text-destructive-foreground transition hover:bg-destructive disabled:opacity-50",children:Ga?"…":e("settings.destroy")}),i.jsx("button",{type:"button",disabled:Ga,onClick:()=>{Mr(null),zn(null)},className:"shrink-0 rounded-full bg-surface-2 px-2.5 py-1 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:e("common.cancel")})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>{St?Bo(St.id):(ss(D.name),vo({mode:"tmux",tmuxSessionName:D.name}))},disabled:sa,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${nt?"bg-surface text-foreground hover:bg-surface-elevated":sa?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:sa?i.jsxs(i.Fragment,{children:[i.jsx(Nn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(nt?"settings.attached":"settings.attach")}),i.jsx("button",{type:"button",disabled:Ga,onClick:()=>{zn(null),Mr(D.name)},className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-destructive/15 hover:text-destructive","aria-label":`Kill tmux session ${D.name}`,children:i.jsx(ni,{size:12})})]})]},D.name)})]},S.key||"__ungrouped_tmux__")),nn&&i.jsx("p",{className:"px-2 text-[11px] text-destructive",children:nn})]}):i.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:W.reason||e("settings.installTmuxHint")})})]}),i.jsxs("button",{type:"button",onClick:()=>ea(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Cb,{size:14,className:"text-muted-foreground"}),i.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),i.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{children:e("settings.sessions",{n:rs.length})}),i.jsx("span",{children:"›"})]})]}),i.jsxs("button",{type:"button",onClick:()=>_a(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Ku,{size:14,className:"text-muted-foreground"}),i.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),i.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{children:"hooks"}),i.jsx("span",{children:"›"})]})]}),i.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[i.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),i.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[{code:"en",label:"English"},{code:"zh",label:"中文"}].map(S=>{const D=t===S.code;return i.jsx("button",{type:"button",onClick:()=>r(S.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:S.label},S.code)})})]}),i.jsxs("button",{type:"button",onClick:async()=>{try{await Mw()}catch{}window.dispatchEvent(new CustomEvent("auth:unauthorized"))},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-destructive/10 px-3 py-2.5 text-[13px] font-medium text-destructive transition hover:bg-destructive/20 active:scale-[0.98]",children:[i.jsx(Eb,{size:14}),e("settings.signOut")]})]})]})})]}),Pi&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm cursor-default animate-fade-in",onClick:()=>{z(null),xe(null),zn(null)},"aria-label":e("common.close")}),i.jsxs("div",{className:`fixed z-menu-panel rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in ${le&&er?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:le&&er?{...rb(le),paddingBottom:a}:{paddingBottom:a},children:[i.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),i.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:A0}),i.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),i.jsxs("div",{className:"flex flex-col py-1",children:[i.jsxs("button",{type:"button",onClick:w0,className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[i.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:i.jsx(ni,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),nn&&i.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:nn})]}),i.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:i.jsx("button",{type:"button",onClick:()=>{z(null),xe(null),zn(null)},className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]}),He&&(()=>{const S=It.find(wn=>wn.id===He);if(!S)return null;const D=Ve.get(S.id),{primary:ue}=qo(S,D?.activeProgram??null,D?.cwd??null,ua),nt=er,St=nt?rb(Je):{paddingBottom:a},qt=nt?"fixed z-menu-panel overflow-y-auto overflow-x-hidden rounded-lg bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in":"fixed inset-x-3 bottom-6 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in sm:bottom-auto sm:top-[15%]",wr=nt?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",hn=nt?"flex items-center gap-2 px-3 py-2 text-left text-[12px] transition":"flex items-center gap-3 px-4 py-3 text-left text-[13px] transition",un=nt?"inline-flex h-6 w-6 items-center justify-center rounded-md":"inline-flex h-7 w-7 items-center justify-center rounded-full";return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${nt?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:Xt,"aria-label":"Close menu"}),i.jsxs("div",{className:qt,style:St,children:[i.jsxs("div",{className:wr,children:[i.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),i.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:ue}),D?.cwd&&i.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:D.cwd})]}),i.jsxs("div",{className:"flex flex-col py-1",children:[i.jsxs("button",{type:"button",onClick:()=>{const wn=Je;Xt(),lt(wn),Te(S.id)},className:`${hn} text-foreground hover:bg-surface-2`,children:[i.jsx("span",{className:`${un} bg-primary/15 text-primary`,children:i.jsx(TA,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium",children:e("tab.rename")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),i.jsxs("button",{type:"button",disabled:!D?.cwd,onClick:()=>{ff(S.id),Xt()},className:`${hn} ${D?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[i.jsx("span",{className:`${un} bg-surface-2 text-muted-foreground`,children:i.jsx(Sb,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),At&&At===D?.cwd&&i.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const wn=Gp(S.id),Ii=wn??We;return i.jsxs("div",{className:`${hn} text-foreground`,children:[i.jsx("span",{className:`${un} bg-surface-2 text-muted-foreground`,children:i.jsx(rT,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium",children:e("tab.fontSize")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.fontSizeHint")})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>{th(S.id,Ii-1),Qt(Jr=>Jr+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} -1`,children:"−"}),i.jsxs("span",{className:"w-8 text-center text-[11px] tabular-nums text-muted-foreground",children:[Ii,"px"]}),i.jsx("button",{type:"button",onClick:()=>{th(S.id,Ii+1),Qt(Jr=>Jr+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} +1`,children:"+"}),wn!==null&&i.jsx("button",{type:"button",onClick:()=>{th(S.id,null),Qt(Jr=>Jr+1)},className:"ml-1 shrink-0 rounded-md px-1.5 py-1 text-[11px] text-primary transition hover:bg-primary/10",children:e("tab.fontSizeReset")})]})]})})(),D?.agentNativeSessionId&&D.agentStatus!=="working"&&D.agentStatus!=="waiting"&&D.terminalSessionId&&i.jsxs("button",{type:"button",onClick:()=>{const wn=D.terminalSessionId;wn&&(Xt(),an(S.id,wn))},className:`${hn} text-foreground hover:bg-surface-2`,children:[i.jsx("span",{className:`${un} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:i.jsx(uc,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),D.agent?.displayName?` · ${D.agent.displayName}`:""]}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),i.jsx("div",{className:"my-1 border-t border-border/15"}),S.mode==="tmux"?i.jsxs("button",{type:"button",onClick:()=>{Xt(),Sl(S.id)},className:`${hn} text-destructive hover:bg-destructive/10`,children:[i.jsx("span",{className:`${un} bg-destructive/15 text-destructive`,children:i.jsx(ni,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):i.jsxs("button",{type:"button",onClick:()=>{Xt(),Yl({sessionId:S.id,source:"tab-menu",closeMode:"auto"})},className:`${hn} text-destructive hover:bg-destructive/10`,children:[i.jsx("span",{className:`${un} bg-destructive/15 text-destructive`,children:i.jsx(Kn,{size:14})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block font-medium",children:e("tab.close")}),i.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!nt&&i.jsx("button",{type:"button",className:"flex items-center justify-center px-4 py-2 text-[11px] text-muted-foreground/80 transition hover:text-foreground",onClick:()=>{Xt()},children:e("tab.longPressTip")})]}),!nt&&i.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:i.jsx("button",{type:"button",onClick:Xt,className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]})})(),$&&vt&&er&&(()=>{const S=It.find(Jr=>Jr.id===$);if(!S)return null;const D=Ve.get(S.id),{primary:ue}=qo(S,D?.activeProgram??null,D?.cwd??null,ua,D?.shellTitle??null,D?.promptState??null),nt=S.customName?S.name:ue,St=Jr=>{const qs=Jr.trim();qs?qs!==nt&&ji(S.id,qs):Bi(S.id),Te(null),lt(null)},qt=300,wr=160,hn=vt.x,un=vt.y,wn=Math.min(Math.max(hn-qt/2,12),window.innerWidth-qt-12),Ii=un+wr+20>window.innerHeight?Math.max(un-wr-12,12):un+12;return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{Te(null),lt(null)},"aria-label":e("common.cancel")}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed z-menu-panel w-[300px] rounded-xl bg-surface-elevated border border-border/15 shadow-[0_12px_36px_var(--app-shadow-soft)] animate-fade-in",style:{left:`${wn}px`,top:`${Ii}px`},children:[i.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),i.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ue}),D?.cwd&&i.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:D.cwd})]}),i.jsxs("form",{className:"px-3 py-2.5",onSubmit:Jr=>{Jr.preventDefault();const qs=new FormData(Jr.currentTarget).get("session-name");St(typeof qs=="string"?qs:"")},children:[i.jsx("input",{ref:Jr=>{Pe.current=Jr,Jr&&!Ht.current&&(Ht.current=!0,Jr.focus({preventScroll:!0}),Jr.select())},type:"text",name:"session-name",defaultValue:nt,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,className:"w-full rounded-lg bg-surface-2 px-3 py-2 text-[13px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:Jr=>{Jr.key==="Escape"&&(Jr.stopPropagation(),Te(null),lt(null))}}),i.jsxs("div",{className:"mt-2.5 flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>{Te(null),lt(null)},className:"flex-1 rounded-full bg-surface-2 px-3 py-1.5 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),i.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary px-3 py-1.5 text-[12px] font-semibold text-primary-foreground transition hover:bg-primary/90 active:scale-[0.97]",children:e("common.save")})]})]})]})]})})(),$&&!er&&(()=>{const S=It.find(qt=>qt.id===$);if(!S)return null;const D=Ve.get(S.id),{primary:ue}=qo(S,D?.activeProgram??null,D?.cwd??null,ua,D?.shellTitle??null,D?.promptState??null),nt=S.customName?S.name:ue,St=qt=>{const wr=qt.trim();wr?wr!==nt&&ji(S.id,wr):Bi(S.id),Te(null)};return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>Te(null),"aria-label":e("common.cancel")}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed inset-x-3 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",style:{top:`calc(${n} + 3.5rem)`},children:[i.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),i.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),i.jsxs("form",{className:"px-4 py-3",onSubmit:qt=>{qt.preventDefault();const wr=new FormData(qt.currentTarget).get("session-name");St(typeof wr=="string"?wr:"")},children:[i.jsx("input",{ref:qt=>{Pe.current=qt,qt&&!Ht.current&&(Ht.current=!0,qt.focus({preventScroll:!0}),qt.select())},type:"text",name:"session-name",defaultValue:nt,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"done",className:"w-full rounded-lg bg-surface-2 px-3 py-2.5 text-[16px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:qt=>{qt.key==="Escape"&&(qt.stopPropagation(),Te(null))}}),i.jsxs("div",{className:"mt-3 flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>Te(null),className:"flex-1 rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),i.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary/20 px-3 py-2 text-[12px] font-medium text-primary transition hover:bg-primary/30",children:e("common.save")})]})]})]})]})})(),Aa&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button","aria-label":e("common.close"),className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>Ta(!1)}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"local-access-title",className:"fixed inset-x-3 top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 p-4",children:[i.jsx("h2",{id:"local-access-title",className:"section-title",children:e("settings.localAccess")}),i.jsx("button",{autoFocus:!0,type:"button","aria-label":e("common.close"),onClick:()=>Ta(!1),className:"rounded-full bg-surface-2 p-2 text-muted-foreground",children:i.jsx(Kn,{size:18})})]}),i.jsxs("div",{className:"overflow-y-auto overscroll-contain p-4",children:[i.jsx(yT,{state:ze,onCopy:S=>{go(S,"setup")},copied:we==="setup"}),i.jsxs("div",{className:"mt-3 flex items-center overflow-hidden rounded-lg bg-surface ring-1 ring-border/10 focus-within:ring-primary/40",children:[i.jsx("input",{value:de,onChange:S=>$e(S.target.value.toLowerCase()),className:"min-w-0 flex-1 bg-transparent px-2.5 py-2 text-[12px] text-foreground outline-none",placeholder:"jovn",spellCheck:!1}),i.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",disabled:qe,onClick:()=>{Li()},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary transition hover:bg-primary/25 disabled:opacity-50",children:e(qe?"settings.saving":"common.save")}),i.jsx("button",{type:"button",disabled:qe,onClick:()=>{mo()},className:"rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-50",children:e("settings.resetAutoName")})]}),i.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[ze.url&&i.jsxs("button",{type:"button",onClick:()=>{go(ze.url,"lan")},className:"flex w-full items-center justify-between gap-2 rounded-lg bg-surface px-2.5 py-2 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[i.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",ze.url]}),i.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:we==="lan"?"Copied":e("common.copy")})]}),ze.interfaces.length>0&&i.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[i.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),i.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:ze.interfaces.map(S=>{const D=S.url??`${ze.httpsEnabled?"https":"http"}://${S.address}:9834`;return i.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[i.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[S.label," (",S.name,")"]}),i.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:S.address}),S.qrDataUrl&&i.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:i.jsx("img",{src:S.qrDataUrl,alt:`QR code for ${D}`,className:"h-28 w-28"})}),i.jsxs("button",{type:"button",onClick:()=>{go(D,`ip-${S.address}`)},className:"mt-2 flex w-full items-center justify-between gap-2 rounded-md bg-surface px-2 py-1.5 text-left text-[11px] transition hover:bg-surface-elevated",children:[i.jsx("span",{className:"min-w-0 truncate",children:D}),i.jsx("span",{className:"shrink-0 text-[10px]",children:we===`ip-${S.address}`?"Copied":e("common.copy")})]})]},`${S.name}-${S.address}`)})})]}),i.jsxs("div",{className:"text-muted-foreground",children:[ze.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!ze.caAvailable&&` · ${e("settings.caMissing")}`]}),ze.reason&&i.jsx("div",{className:"text-[color:var(--warning)]",children:ze.reason}),Re&&i.jsx("div",{className:"text-destructive",children:Re})]})]})]})]}),fi&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>ta(!1)}),i.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),i.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),i.jsx("button",{type:"button",onClick:()=>ta(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close notifications settings",children:i.jsx(Kn,{size:18})})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[i.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),i.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),i.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:X==="denied"?e("settings.notificationsDenied"):wd()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),wd()&&!Dw()&&i.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),i.jsx("button",{type:"button",onClick:()=>{ot()},disabled:!wd()||X==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":E,children:i.jsx(Xo,{checked:E,disabled:!wd()||X==="denied"})})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[i.jsxs("span",{className:`rounded-full px-2 py-0.5 ${X==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",ko()?e("settings.notificationsPermissionSystem"):X]}),i.jsx("button",{type:"button",disabled:!E||X!=="granted"||Cs==="checking",onClick:()=>{zt()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:e(Cs==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),ko()?.openNotificationSettings&&i.jsx("button",{type:"button",onClick:()=>{ko()?.openNotificationSettings?.()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:e("settings.notificationsOpenSystemSettings")})]}),Cs!=="idle"&&Cs!=="checking"&&i.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${Cs==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(Cs==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),i.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[i.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),i.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),i.jsx("div",{className:"mt-3 grid grid-cols-3 gap-1 rounded-xl bg-surface p-1",children:[["normal",e("settings.notificationsStyleNormal"),e("settings.notificationsStyleNormalHint")],["quiet",e("settings.notificationsStyleQuiet"),e("settings.notificationsStyleQuietHint")],["persistent",e("settings.notificationsStylePersistent"),e("settings.notificationsStylePersistentHint")]].map(([S,D,ue])=>{const nt=G===S;return i.jsxs("button",{type:"button",disabled:!E,onClick:()=>On(S),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${nt&&E?"bg-primary/15 text-primary":E?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ue,children:[i.jsx("span",{className:"block truncate text-[11px] font-semibold",children:D}),i.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ue})]},S)})})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),i.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),i.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),i.jsx("button",{type:"button",disabled:!E,onClick:()=>fr(!M),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":M&&E,children:i.jsx(Xo,{checked:M&&E,disabled:!E})})]}),i.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),i.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),i.jsx("button",{type:"button",disabled:!E,onClick:()=>ln(!F),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":F&&E,children:i.jsx(Xo,{checked:F&&E,disabled:!E})})]})]}),i.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),Gs&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>ea(!1)}),i.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),i.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),i.jsx("button",{type:"button",onClick:()=>ea(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close toolbar presets",children:i.jsx(Kn,{size:18})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:i.jsx(oO,{presets:rs,selectedPresetId:Qi,onSelectPreset:yo,onUpdatePreset:(S,D)=>{ms(ue=>Kc(ue.map(nt=>nt.id===S?D(nt):nt)))},onAddPreset:()=>{const S=`preset-${Date.now()}`;ms(D=>Kc([...D,{id:S,label:`Preset ${D.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),yo(S)},onRemovePreset:S=>{ms(D=>Kc(D.filter(ue=>ue.id!==S)))},onResetDefaults:()=>{ms(Ou()),yo("default")}})})]})]}),Ha&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>_a(!1)}),i.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),i.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("button",{type:"button",onClick:()=>_a(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close agent rules",children:i.jsx(Kn,{size:18})})})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[i.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),i.jsx(cO,{}),i.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[i.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),i.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),i.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),i.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:It.map(S=>{const D=Ve.get(S.id),ue=D?.activeProgramRaw??null,nt=D?.activeProgram??null;return i.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[i.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:S.name}),i.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[i.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",nt||"—"]}),i.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ue||"—"]})]},`raw-${S.id}`)})}),i.jsxs("div",{className:"mt-3 space-y-3",children:[[{key:"genericProgramNames",label:e("settings.genericProgramNames"),hint:e("settings.genericProgramNamesHint")},{key:"wrapperScriptNames",label:e("settings.wrapperScriptNames"),hint:e("settings.wrapperScriptNamesHint")},{key:"shellNames",label:e("settings.shellNamesConfig"),hint:e("settings.shellNamesHint")}].map(({key:S,label:D,hint:ue})=>i.jsxs("div",{children:[i.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:D}),i.jsx("div",{className:"text-[10px] text-muted-foreground",children:ue}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[H[S].map(nt=>i.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-mono text-foreground",children:[nt,i.jsx("button",{type:"button",onClick:()=>{const St={...H,[S]:H[S].filter(qt=>qt!==nt)};Qe(St),S==="shellNames"&&(ua=new Set(St.shellNames)),dg(St).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},nt)),i.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:nt=>{if(nt.key!=="Enter")return;const St=nt.target.value.trim().toLowerCase();if(!St||H[S].includes(St))return;const qt={...H,[S]:[...H[S],St]};Qe(qt),S==="shellNames"&&(ua=new Set(qt.shellNames)),nt.target.value="",dg(qt).catch(()=>{})}})]})]},S)),i.jsx("button",{type:"button",onClick:()=>{jw().then(S=>{Qe(S),ua=new Set(S.shellNames)}).catch(()=>{})},className:"rounded-full bg-surface-2 px-3 py-1 text-[11px] text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")})]}),i.jsxs("div",{className:"mt-3",children:[i.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),Tt.map((S,D)=>i.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("input",{type:"checkbox",checked:S.enabled!==!1,onChange:ue=>{const nt=Tt.map((St,qt)=>qt===D?{...St,enabled:ue.target.checked}:St);Oe(nt),$n(ca,nt),L(!0),Nc(nt).then(St=>{Oe(St),$n(ca,St)}).catch(()=>{}).finally(()=>L(!1))}}),i.jsxs("select",{value:S.matchType,onChange:ue=>{const nt=Tt.map((St,qt)=>qt===D?{...St,matchType:ue.target.value}:St);Oe(nt),$n(ca,nt),L(!0),Nc(nt).then(St=>{Oe(St),$n(ca,St)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[i.jsx("option",{value:"includes",children:"includes"}),i.jsx("option",{value:"exact",children:"exact"}),i.jsx("option",{value:"prefix",children:"prefix"}),i.jsx("option",{value:"regex",children:"regex"})]}),i.jsx("input",{value:S.pattern,onChange:ue=>{const nt=Tt.map((St,qt)=>qt===D?{...St,pattern:ue.target.value}:St);Oe(nt),$n(ca,nt)},onBlur:()=>{L(!0),Nc(Tt).then(ue=>{Oe(ue),$n(ca,ue)}).catch(()=>{}).finally(()=>L(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),i.jsx("input",{value:S.output,onChange:ue=>{const nt=Tt.map((St,qt)=>qt===D?{...St,output:ue.target.value}:St);Oe(nt),$n(ca,nt)},onBlur:()=>{L(!0),Nc(Tt).then(ue=>{Oe(ue),$n(ca,ue)}).catch(()=>{}).finally(()=>L(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),i.jsx("button",{type:"button",onClick:()=>{const ue=Tt.filter((nt,St)=>St!==D);Oe(ue),$n(ca,ue),L(!0),Nc(ue).then(nt=>{Oe(nt),$n(ca,nt)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},S.id)),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>{const S=[...Tt,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];Oe(S),$n(ca,S),L(!0),Nc(S).then(D=>{Oe(D),$n(ca,D)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-primary/25",children:e("settings.addRule")}),i.jsx("button",{type:"button",onClick:()=>{L(!0),Bw().then(S=>{Oe(S),$n(ca,S)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded-full bg-surface-2 px-3 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")}),i.jsx("span",{className:"text-[11px] text-muted-foreground",children:Fr?e("settings.saving"):_t?`${Tt.length} rules`:"…"})]})]})]})]})]})]}),ie&&i.jsx(tO,{isOpen:ie,onClose:()=>Fe(!1)}),!ra&&i.jsx(L5,{isOpen:Xr,drawerWidthPx:Di,onClose:()=>gn("left-sidebar"),onOpen:ma,sessions:It,activeSessionId:Lt,sessionStates:Ve,onNewSession:S=>vo(S),recoverableTmuxSessions:_0,recoverableTmuxSessionsLoading:wt,onRefreshRecoverableTmuxSessions:()=>{sl()},onCloseSession:Sl,onSplitSession:ad,onCloseSplit:S=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:S})),onRemoveFromSplit:S=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:S})),splitWorkspaces:Er,onSetSplitLayout:od,onReorderSplitWorkspace:ld,onRenameSplitWorkspace:Lc,onCombineSplitSessions:v0,onReorderSessions:xo,onSessionMenu:Tl,onOpenSettings:ba,onJumpToNextAttention:ka.length>0?Es:void 0,onOpenQuota:()=>Fe(!0),updateState:Ue,updateActionPending:Y,onConfirmUpdateRestart:Ar,onRetryUpdate:Bt,serverHealthState:be,tmuxAvailable:W.available,defaultSessionMode:Hs,onTogglePinned:er?fo:void 0}),!il&&i.jsx(k5,{isOpen:pn,sessionId:Lt,drawerWidthPx:xs,onClose:()=>gn("right-sidebar"),onOpen:Is,rightSidebarFilePreviewOpen:oi,rightSidebarFilePreviewCloseSignal:je,onOpenRightSidebarFilePreview:Fa,onCloseRightSidebarFilePreview:$a,rightSidebarRepoPickerOpen:ae,rightSidebarRepoPickerCloseSignal:gt,onOpenRightSidebarRepoPicker:po,onCloseRightSidebarRepoPicker:Al,markdownOutlineOpen:kt,markdownOutlineCloseSignal:Yt,onOpenMarkdownOutline:tl,onCloseMarkdownOutline:Mo,markdownImageLightboxOpen:rr,markdownImageLightboxCloseSignal:ne,onOpenMarkdownImageLightbox:$s,onCloseMarkdownImageLightbox:Do,onTogglePinned:er?ga:void 0}),ve&&!l&&i.jsx("button",{type:"button",onClick:ps,className:"fixed inset-0 z-toast flex cursor-default items-center justify-center bg-[var(--app-backdrop-soft)] px-6 text-left backdrop-blur-[1px]","aria-label":t==="zh"?"继续使用 Termdock":"Continue using Termdock",children:i.jsxs("div",{className:"max-w-[18rem] rounded-2xl border border-border/15 bg-surface/95 px-5 py-4 text-center shadow-[0_18px_50px_var(--app-shadow-strong)] backdrop-blur animate-fade-in",children:[i.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),i.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-muted-foreground",children:t==="zh"?"按 Home 退后台,点任意位置继续。":"Use Home to leave. Tap anywhere to continue."}),i.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),br&&i.jsxs("div",{className:`fixed inset-x-3 bottom-4 z-toast mx-auto flex max-w-md items-center gap-2 rounded-xl border px-4 py-3 text-[12px] shadow-lg animate-fade-in ${br.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:br.tone==="error"?"alert":"status",children:[br.tone==="success"?i.jsx(uc,{size:14,className:"shrink-0 text-[color:var(--success)]"}):i.jsx(Sh,{size:14,className:"shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1",children:br.message}),i.jsx("button",{type:"button",onClick:()=>pe(null),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("common.close"),children:i.jsx(Kn,{size:12})})]}),c&&i.jsxs(i.Fragment,{children:[!er&&i.jsx(vT,{onClose:()=>h(!1)}),i.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-toast hidden max-h-48 overflow-y-auto border-t border-border/15 bg-surface p-3 animate-fade-in md:block",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),i.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),i.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(jt,null,2)})]})]})]}),ud=ut?null:i.jsx(Ow,{className:"z-modal-panel",status:"正在恢复终端…"});return er?i.jsxs("div",{className:"w-screen h-full flex flex-row",children:[ra&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:An,flexShrink:0,height:"100%"},children:i.jsx(L5,{isOpen:Xr,drawerWidthPx:An,onClose:Pa,onOpen:ma,sessions:It,activeSessionId:Lt,sessionStates:Ve,onNewSession:S=>vo(S),recoverableTmuxSessions:_0,recoverableTmuxSessionsLoading:wt,onRefreshRecoverableTmuxSessions:()=>{sl()},onCloseSession:Sl,onSplitSession:ad,onCloseSplit:S=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:S})),onRemoveFromSplit:S=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:S})),splitWorkspaces:Er,onSetSplitLayout:od,onReorderSplitWorkspace:ld,onRenameSplitWorkspace:Lc,onCombineSplitSessions:v0,onReorderSessions:xo,onSessionMenu:Tl,onOpenSettings:ba,onJumpToNextAttention:ka.length>0?Es:void 0,onOpenQuota:()=>Fe(!0),updateState:Ue,updateActionPending:Y,onConfirmUpdateRestart:Ar,onRetryUpdate:Bt,serverHealthState:be,tmuxAvailable:W.available,defaultSessionMode:Hs,pinned:!0,onTogglePinned:fo})}),i.jsx("div",{role:"separator",tabIndex:-1,className:"shrink-0 w-[5px] h-full cursor-col-resize bg-border/10 hover:bg-primary/30 active:bg-primary/50 transition-colors",onMouseDown:In})]}),i.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[E0,il&&i.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Zl},children:[i.jsx("div",{role:"separator",tabIndex:-1,className:"h-full w-[5px] shrink-0 cursor-col-resize bg-border/10 transition-colors hover:bg-primary/30 active:bg-primary/50",onMouseDown:_i}),i.jsx("div",{style:{width:_l,flexShrink:0,height:"100%"},children:i.jsx(k5,{isOpen:!0,sessionId:Lt,drawerWidthPx:_l,onClose:Xi,onOpen:Is,pinned:!0,onTogglePinned:ga,rightSidebarFilePreviewOpen:oi,rightSidebarFilePreviewCloseSignal:je,onOpenRightSidebarFilePreview:Fa,onCloseRightSidebarFilePreview:$a,rightSidebarRepoPickerOpen:ae,rightSidebarRepoPickerCloseSignal:gt,onOpenRightSidebarRepoPicker:po,onCloseRightSidebarRepoPicker:Al,markdownOutlineOpen:kt,markdownOutlineCloseSignal:Yt,onOpenMarkdownOutline:tl,onCloseMarkdownOutline:Mo,markdownImageLightboxOpen:rr,markdownImageLightboxCloseSignal:ne,onOpenMarkdownImageLightbox:$s,onCloseMarkdownImageLightbox:Do})})]})]}),i.jsx(z5,{sessionId:Lt}),ud]}):i.jsxs(i.Fragment,{children:[E0,i.jsx(z5,{sessionId:Lt}),ud]})}const CF=Object.freeze(Object.defineProperty({__proto__:null,default:jO},Symbol.toStringTag,{value:"Module"}));export{Au as A,N3 as B,tP as C,Mu as D,O5 as E,Tb as F,rP as G,X9 as H,cI as I,AF as J,I5 as K,Sb as L,nA as M,Fp as N,TF as O,wA as P,iP as Q,Jn as R,o0 as S,QL as T,Db as U,uT as V,GP as a,CF as b,i9 as c,n9 as d,vb as e,Ru as f,D9 as g,yQ as h,Um as i,aA as j,uA as k,TA as l,SA as m,Du as n,ju as o,Zp as p,kb as q,BA as r,FA as s,d6 as t,qA as u,JA as v,ni as w,E3 as x,wF as y,F2 as z};