termdock 1.4.215 → 1.4.216

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 (321) hide show
  1. package/dist/client/assets/App-BVWkSLJO.js +156 -0
  2. package/dist/client/assets/App-BVWkSLJO.js.br +0 -0
  3. package/dist/client/assets/App-BVWkSLJO.js.gz +0 -0
  4. package/dist/client/assets/ChangeWalkthroughPanel-ClJFLOsY.js +2 -0
  5. package/dist/client/assets/ChangeWalkthroughPanel-ClJFLOsY.js.br +0 -0
  6. package/dist/client/assets/ChangeWalkthroughPanel-ClJFLOsY.js.gz +0 -0
  7. package/dist/client/assets/{DagPlayground-yu_rA4_Q.js → DagPlayground-BtAvuTCa.js} +1 -1
  8. package/dist/client/assets/DagPlayground-BtAvuTCa.js.br +0 -0
  9. package/dist/client/assets/DagPlayground-BtAvuTCa.js.gz +0 -0
  10. package/dist/client/assets/{DiffLab-DxonIqMt.js → DiffLab-BsVORgBM.js} +1 -1
  11. package/dist/client/assets/DiffLab-BsVORgBM.js.br +0 -0
  12. package/dist/client/assets/DiffLab-BsVORgBM.js.gz +0 -0
  13. package/dist/client/assets/DiffReview-B0fouDB5.js +1 -0
  14. package/dist/client/assets/DiffReview-B0fouDB5.js.br +0 -0
  15. package/dist/client/assets/DiffReview-B0fouDB5.js.gz +0 -0
  16. package/dist/client/assets/{DiffReviewLab-C9tmkKic.js → DiffReviewLab-BUO2nqkI.js} +1 -1
  17. package/dist/client/assets/DiffReviewLab-BUO2nqkI.js.br +0 -0
  18. package/dist/client/assets/DiffReviewLab-BUO2nqkI.js.gz +0 -0
  19. package/dist/client/assets/{DiffViewer-TIYVqovz.js → DiffViewer-84qdL8a3.js} +1 -1
  20. package/dist/client/assets/DiffViewer-84qdL8a3.js.br +0 -0
  21. package/dist/client/assets/DiffViewer-84qdL8a3.js.gz +0 -0
  22. package/dist/client/assets/{ModelPreview-Fd4YRrhE.js → ModelPreview-AlBS7WBE.js} +1 -1
  23. package/dist/client/assets/ModelPreview-AlBS7WBE.js.br +0 -0
  24. package/dist/client/assets/ModelPreview-AlBS7WBE.js.gz +0 -0
  25. package/dist/client/assets/{RightSidebar-DVtyAiqo.js → RightSidebar-DnbixLBX.js} +33 -33
  26. package/dist/client/assets/RightSidebar-DnbixLBX.js.br +0 -0
  27. package/dist/client/assets/RightSidebar-DnbixLBX.js.gz +0 -0
  28. package/dist/client/assets/{abnfDiagram-VCTEODGH-CYLdUxpT.js → abnfDiagram-VCTEODGH-BvNKLikS.js} +1 -1
  29. package/dist/client/assets/abnfDiagram-VCTEODGH-BvNKLikS.js.br +0 -0
  30. package/dist/client/assets/abnfDiagram-VCTEODGH-BvNKLikS.js.gz +0 -0
  31. package/dist/client/assets/app-Bf67B7nu.js +34 -0
  32. package/dist/client/assets/app-Bf67B7nu.js.br +0 -0
  33. package/dist/client/assets/app-Bf67B7nu.js.gz +0 -0
  34. package/dist/client/assets/{arc-C5C_UCGY.js → arc-BS5_QxBd.js} +1 -1
  35. package/dist/client/assets/arc-BS5_QxBd.js.br +0 -0
  36. package/dist/client/assets/arc-BS5_QxBd.js.gz +0 -0
  37. package/dist/client/assets/{architectureDiagram-5GKGNRK7-BhlTTPvP.js → architectureDiagram-5GKGNRK7-RAnGHk-1.js} +1 -1
  38. package/dist/client/assets/architectureDiagram-5GKGNRK7-RAnGHk-1.js.br +0 -0
  39. package/dist/client/assets/architectureDiagram-5GKGNRK7-RAnGHk-1.js.gz +0 -0
  40. package/dist/client/assets/{blockDiagram-I7D4REHJ-xahT3vIr.js → blockDiagram-I7D4REHJ-B74GNPCh.js} +1 -1
  41. package/dist/client/assets/blockDiagram-I7D4REHJ-B74GNPCh.js.br +0 -0
  42. package/dist/client/assets/blockDiagram-I7D4REHJ-B74GNPCh.js.gz +0 -0
  43. package/dist/client/assets/{c4Diagram-7LVT6UL2-CPVj8_0R.js → c4Diagram-7LVT6UL2-DwPuf6cG.js} +1 -1
  44. package/dist/client/assets/c4Diagram-7LVT6UL2-DwPuf6cG.js.br +0 -0
  45. package/dist/client/assets/c4Diagram-7LVT6UL2-DwPuf6cG.js.gz +0 -0
  46. package/dist/client/assets/channel-CH2bY7mN.js +1 -0
  47. package/dist/client/assets/{chunk-2Q5K7J3B-CtMDk7xp.js → chunk-2Q5K7J3B-DsHB8CDO.js} +1 -1
  48. package/dist/client/assets/{chunk-5VM5RSS4-BItHD2d0.js → chunk-5VM5RSS4-BGJFPCFF.js} +1 -1
  49. package/dist/client/assets/{chunk-F27PBJKO-9MNs997p.js → chunk-F27PBJKO-B0mLhbV9.js} +1 -1
  50. package/dist/client/assets/chunk-F27PBJKO-B0mLhbV9.js.br +0 -0
  51. package/dist/client/assets/chunk-F27PBJKO-B0mLhbV9.js.gz +0 -0
  52. package/dist/client/assets/{chunk-IMKFNOWR-DkZYkW_Z.js → chunk-IMKFNOWR-C15YzBXr.js} +1 -1
  53. package/dist/client/assets/chunk-IMKFNOWR-C15YzBXr.js.br +0 -0
  54. package/dist/client/assets/chunk-IMKFNOWR-C15YzBXr.js.gz +0 -0
  55. package/dist/client/assets/{chunk-JWPE2WC7-UXgT3HF2.js → chunk-JWPE2WC7-D-hPwJNJ.js} +1 -1
  56. package/dist/client/assets/{chunk-POPQ4Y6H-DKzPXHuO.js → chunk-POPQ4Y6H-DrB6rlmg.js} +1 -1
  57. package/dist/client/assets/{chunk-SVP7TREG-CAFBZo77.js → chunk-SVP7TREG-Dw-ef7TG.js} +1 -1
  58. package/dist/client/assets/chunk-SVP7TREG-Dw-ef7TG.js.br +0 -0
  59. package/dist/client/assets/chunk-SVP7TREG-Dw-ef7TG.js.gz +0 -0
  60. package/dist/client/assets/{chunk-TICWLB2K-B_4wy4N2.js → chunk-TICWLB2K-CuyxhxOQ.js} +1 -1
  61. package/dist/client/assets/chunk-TICWLB2K-CuyxhxOQ.js.br +0 -0
  62. package/dist/client/assets/chunk-TICWLB2K-CuyxhxOQ.js.gz +0 -0
  63. package/dist/client/assets/{chunk-XXDRQBXY-BFR3GehW.js → chunk-XXDRQBXY-DElV8i8a.js} +1 -1
  64. package/dist/client/assets/classDiagram-ZZMXUADV-BZFAua3n.js +1 -0
  65. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BZFAua3n.js +1 -0
  66. package/dist/client/assets/{cose-bilkent-JH36ORCC-CJdQoFsU.js → cose-bilkent-JH36ORCC-6Yb0qGFQ.js} +1 -1
  67. package/dist/client/assets/cose-bilkent-JH36ORCC-6Yb0qGFQ.js.br +0 -0
  68. package/dist/client/assets/{cose-bilkent-JH36ORCC-CJdQoFsU.js.gz → cose-bilkent-JH36ORCC-6Yb0qGFQ.js.gz} +0 -0
  69. package/dist/client/assets/{cynefin-OW5HDTMX-kZwRMtMu.js → cynefin-OW5HDTMX-CC8ChA_X.js} +1 -1
  70. package/dist/client/assets/cynefin-OW5HDTMX-CC8ChA_X.js.br +0 -0
  71. package/dist/client/assets/cynefin-OW5HDTMX-CC8ChA_X.js.gz +0 -0
  72. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-D_Pwm7Yo.js → cynefinDiagram-5FMLGOSQ-D9l3UGkQ.js} +1 -1
  73. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D9l3UGkQ.js.br +0 -0
  74. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D9l3UGkQ.js.gz +0 -0
  75. package/dist/client/assets/{dagre-GXQ25YYZ-GiUWR7a7.js → dagre-GXQ25YYZ-PPwL9Epb.js} +1 -1
  76. package/dist/client/assets/dagre-GXQ25YYZ-PPwL9Epb.js.br +0 -0
  77. package/dist/client/assets/dagre-GXQ25YYZ-PPwL9Epb.js.gz +0 -0
  78. package/dist/client/assets/{diagram-S7CK7UJ4-BQeJ4VT_.js → diagram-S7CK7UJ4-JCcQojC6.js} +1 -1
  79. package/dist/client/assets/diagram-S7CK7UJ4-JCcQojC6.js.br +0 -0
  80. package/dist/client/assets/diagram-S7CK7UJ4-JCcQojC6.js.gz +0 -0
  81. package/dist/client/assets/{diagram-UQ7AKVKN-Duc8vPlr.js → diagram-UQ7AKVKN-nQrpn9fe.js} +1 -1
  82. package/dist/client/assets/diagram-UQ7AKVKN-nQrpn9fe.js.br +0 -0
  83. package/dist/client/assets/diagram-UQ7AKVKN-nQrpn9fe.js.gz +0 -0
  84. package/dist/client/assets/{diagram-VSXAHHWV-ByxuzSd4.js → diagram-VSXAHHWV-ot1VVX6D.js} +1 -1
  85. package/dist/client/assets/diagram-VSXAHHWV-ot1VVX6D.js.br +0 -0
  86. package/dist/client/assets/diagram-VSXAHHWV-ot1VVX6D.js.gz +0 -0
  87. package/dist/client/assets/{diagram-VX7I27RA-BMd8lgqI.js → diagram-VX7I27RA-BnkRh0FY.js} +1 -1
  88. package/dist/client/assets/diagram-VX7I27RA-BnkRh0FY.js.br +0 -0
  89. package/dist/client/assets/diagram-VX7I27RA-BnkRh0FY.js.gz +0 -0
  90. package/dist/client/assets/{diagram-Z3DM3KII-Bh7bETZv.js → diagram-Z3DM3KII-0_-pP3jI.js} +1 -1
  91. package/dist/client/assets/diagram-Z3DM3KII-0_-pP3jI.js.br +0 -0
  92. package/dist/client/assets/diagram-Z3DM3KII-0_-pP3jI.js.gz +0 -0
  93. package/dist/client/assets/{ebnfDiagram-PWID7BFC-olNfh9ko.js → ebnfDiagram-PWID7BFC-C1F4bZda.js} +1 -1
  94. package/dist/client/assets/ebnfDiagram-PWID7BFC-C1F4bZda.js.br +0 -0
  95. package/dist/client/assets/ebnfDiagram-PWID7BFC-C1F4bZda.js.gz +0 -0
  96. package/dist/client/assets/{erDiagram-RLTQ6QDP-Cc0mXXov.js → erDiagram-RLTQ6QDP-oZrQsyBk.js} +1 -1
  97. package/dist/client/assets/erDiagram-RLTQ6QDP-oZrQsyBk.js.br +0 -0
  98. package/dist/client/assets/erDiagram-RLTQ6QDP-oZrQsyBk.js.gz +0 -0
  99. package/dist/client/assets/{flowDiagram-HODETNUW-CAOVSMig.js → flowDiagram-HODETNUW-BO7wTWnA.js} +1 -1
  100. package/dist/client/assets/flowDiagram-HODETNUW-BO7wTWnA.js.br +0 -0
  101. package/dist/client/assets/flowDiagram-HODETNUW-BO7wTWnA.js.gz +0 -0
  102. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-Bg_Nuwn9.js → ganttDiagram-EL5Y4UJY-RSp1mvw5.js} +1 -1
  103. package/dist/client/assets/ganttDiagram-EL5Y4UJY-RSp1mvw5.js.br +0 -0
  104. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-Bg_Nuwn9.js.gz → ganttDiagram-EL5Y4UJY-RSp1mvw5.js.gz} +0 -0
  105. package/dist/client/assets/gestureArbiter-CqgobOTI.js +1 -0
  106. package/dist/client/assets/gestureArbiter-CqgobOTI.js.br +0 -0
  107. package/dist/client/assets/gestureArbiter-CqgobOTI.js.gz +0 -0
  108. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BZc_55jp.js → gitGraphDiagram-WWUBYQGX-Bll9I9Sq.js} +1 -1
  109. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Bll9I9Sq.js.br +0 -0
  110. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Bll9I9Sq.js.gz +0 -0
  111. package/dist/client/assets/{index-h5sVWJNu.css → index-BJPuCkHm.css} +1 -1
  112. package/dist/client/assets/index-BJPuCkHm.css.br +0 -0
  113. package/dist/client/assets/{index-h5sVWJNu.css.gz → index-BJPuCkHm.css.gz} +0 -0
  114. package/dist/client/assets/{infoDiagram-27XIBGKW-DWIuLofA.js → infoDiagram-27XIBGKW-BEGS1z8T.js} +1 -1
  115. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DN8aLWDC.js → ishikawaDiagram-5VMMS53U-4N6cv4T2.js} +1 -1
  116. package/dist/client/assets/ishikawaDiagram-5VMMS53U-4N6cv4T2.js.br +0 -0
  117. package/dist/client/assets/ishikawaDiagram-5VMMS53U-4N6cv4T2.js.gz +0 -0
  118. package/dist/client/assets/{journeyDiagram-3NMN7TZE-Ct6aGnNW.js → journeyDiagram-3NMN7TZE-Bm2WNf21.js} +1 -1
  119. package/dist/client/assets/journeyDiagram-3NMN7TZE-Bm2WNf21.js.br +0 -0
  120. package/dist/client/assets/journeyDiagram-3NMN7TZE-Bm2WNf21.js.gz +0 -0
  121. package/dist/client/assets/{kanban-definition-UXKFOSKX-mdR2RvVB.js → kanban-definition-UXKFOSKX-mOozRtH0.js} +1 -1
  122. package/dist/client/assets/kanban-definition-UXKFOSKX-mOozRtH0.js.br +0 -0
  123. package/dist/client/assets/kanban-definition-UXKFOSKX-mOozRtH0.js.gz +0 -0
  124. package/dist/client/assets/{layout-DN8HXeEO.js → layout-BFk1q7nt.js} +1 -1
  125. package/dist/client/assets/layout-BFk1q7nt.js.br +0 -0
  126. package/dist/client/assets/layout-BFk1q7nt.js.gz +0 -0
  127. package/dist/client/assets/{linear-CFCpNtTo.js → linear-CPXynm7B.js} +1 -1
  128. package/dist/client/assets/linear-CPXynm7B.js.br +0 -0
  129. package/dist/client/assets/linear-CPXynm7B.js.gz +0 -0
  130. package/dist/client/assets/{mermaid.core-Tv_YSXBk.js → mermaid.core-Ba4l96YR.js} +5 -5
  131. package/dist/client/assets/mermaid.core-Ba4l96YR.js.br +0 -0
  132. package/dist/client/assets/mermaid.core-Ba4l96YR.js.gz +0 -0
  133. package/dist/client/assets/{mindmap-definition-YA3MSWOX-DfjFoXF_.js → mindmap-definition-YA3MSWOX-DZdl6uc-.js} +1 -1
  134. package/dist/client/assets/mindmap-definition-YA3MSWOX-DZdl6uc-.js.br +0 -0
  135. package/dist/client/assets/mindmap-definition-YA3MSWOX-DZdl6uc-.js.gz +0 -0
  136. package/dist/client/assets/{passwordBootstrap-CT__RJi-.js → passwordBootstrap-NIMQmJqW.js} +1 -1
  137. package/dist/client/assets/passwordBootstrap-NIMQmJqW.js.br +0 -0
  138. package/dist/client/assets/passwordBootstrap-NIMQmJqW.js.gz +0 -0
  139. package/dist/client/assets/{pegDiagram-XKGWAZYB-DmYT7JUL.js → pegDiagram-XKGWAZYB-CxXMwwWw.js} +1 -1
  140. package/dist/client/assets/pegDiagram-XKGWAZYB-CxXMwwWw.js.br +0 -0
  141. package/dist/client/assets/pegDiagram-XKGWAZYB-CxXMwwWw.js.gz +0 -0
  142. package/dist/client/assets/{pieDiagram-E7YTZNPT-Kuotva9-.js → pieDiagram-E7YTZNPT-BNY2m9Tf.js} +1 -1
  143. package/dist/client/assets/pieDiagram-E7YTZNPT-BNY2m9Tf.js.br +0 -0
  144. package/dist/client/assets/pieDiagram-E7YTZNPT-BNY2m9Tf.js.gz +0 -0
  145. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-CBGahKeF.js → quadrantDiagram-AXDQQJYC-sh99Gsbf.js} +1 -1
  146. package/dist/client/assets/quadrantDiagram-AXDQQJYC-sh99Gsbf.js.br +0 -0
  147. package/dist/client/assets/quadrantDiagram-AXDQQJYC-sh99Gsbf.js.gz +0 -0
  148. package/dist/client/assets/{railroadDiagram-O6MQD6OU-CIqkDHvI.js → railroadDiagram-O6MQD6OU-DHEXu_OI.js} +1 -1
  149. package/dist/client/assets/railroadDiagram-O6MQD6OU-DHEXu_OI.js.br +0 -0
  150. package/dist/client/assets/railroadDiagram-O6MQD6OU-DHEXu_OI.js.gz +0 -0
  151. package/dist/client/assets/referenceLongPress-sxDdnRK9.js +1 -0
  152. package/dist/client/assets/referenceLongPress-sxDdnRK9.js.br +0 -0
  153. package/dist/client/assets/referenceLongPress-sxDdnRK9.js.gz +0 -0
  154. package/dist/client/assets/{requirementDiagram-BXWQKSXE-B5jFF7T-.js → requirementDiagram-BXWQKSXE-BeykS4A9.js} +1 -1
  155. package/dist/client/assets/requirementDiagram-BXWQKSXE-BeykS4A9.js.br +0 -0
  156. package/dist/client/assets/requirementDiagram-BXWQKSXE-BeykS4A9.js.gz +0 -0
  157. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-BD7j9g5R.js → sankeyDiagram-P5KCCOFB-ITbT_fDy.js} +1 -1
  158. package/dist/client/assets/sankeyDiagram-P5KCCOFB-ITbT_fDy.js.br +0 -0
  159. package/dist/client/assets/sankeyDiagram-P5KCCOFB-ITbT_fDy.js.gz +0 -0
  160. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-Lxs3HFYy.js → sequenceDiagram-WJ2MYXX4-rpXvTufG.js} +1 -1
  161. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-rpXvTufG.js.br +0 -0
  162. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-rpXvTufG.js.gz +0 -0
  163. package/dist/client/assets/{sizeCapture-INFHLROL-CYPj7xBk.js → sizeCapture-INFHLROL-Dub9MK_t.js} +1 -1
  164. package/dist/client/assets/sizeCapture-INFHLROL-Dub9MK_t.js.br +0 -0
  165. package/dist/client/assets/sizeCapture-INFHLROL-Dub9MK_t.js.gz +0 -0
  166. package/dist/client/assets/sparkles-xIHgNZV_.js +1 -0
  167. package/dist/client/assets/{stateDiagram-D77RDMKH-B60ttdpA.js → stateDiagram-D77RDMKH-L1f4ArBt.js} +1 -1
  168. package/dist/client/assets/stateDiagram-D77RDMKH-L1f4ArBt.js.br +0 -0
  169. package/dist/client/assets/stateDiagram-D77RDMKH-L1f4ArBt.js.gz +0 -0
  170. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BXG39Il-.js +1 -0
  171. package/dist/client/assets/{swimlanes-42K2YHIH-DrEIRSWh.js → swimlanes-42K2YHIH-D97Yiq6N.js} +1 -1
  172. package/dist/client/assets/swimlanes-42K2YHIH-D97Yiq6N.js.br +0 -0
  173. package/dist/client/assets/swimlanes-42K2YHIH-D97Yiq6N.js.gz +0 -0
  174. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BCdj6Kxb.js +8 -0
  175. package/dist/client/assets/{timeline-definition-24CTP7MA-BoekuGLd.js → timeline-definition-24CTP7MA-CrqpPzWX.js} +1 -1
  176. package/dist/client/assets/timeline-definition-24CTP7MA-CrqpPzWX.js.br +0 -0
  177. package/dist/client/assets/timeline-definition-24CTP7MA-CrqpPzWX.js.gz +0 -0
  178. package/dist/client/assets/triangle-alert-vrxNhnNT.js +1 -0
  179. package/dist/client/assets/{vennDiagram-4TSXK5OY-DttegaxG.js → vennDiagram-4TSXK5OY-BciR-COZ.js} +1 -1
  180. package/dist/client/assets/vennDiagram-4TSXK5OY-BciR-COZ.js.br +0 -0
  181. package/dist/client/assets/vennDiagram-4TSXK5OY-BciR-COZ.js.gz +0 -0
  182. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-DdMEDzpE.js → wardleyDiagram-VM6X3IG4-DXdjTZNb.js} +1 -1
  183. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DXdjTZNb.js.br +0 -0
  184. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DXdjTZNb.js.gz +0 -0
  185. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-CtVCpsSv.js → xychartDiagram-S5SC5T6Z-B6sPePg6.js} +1 -1
  186. package/dist/client/assets/xychartDiagram-S5SC5T6Z-B6sPePg6.js.br +0 -0
  187. package/dist/client/assets/xychartDiagram-S5SC5T6Z-B6sPePg6.js.gz +0 -0
  188. package/dist/client/index.html +2 -2
  189. package/dist/client/index.html.br +0 -0
  190. package/dist/client/index.html.gz +0 -0
  191. package/dist/client/sw.js +1 -1
  192. package/dist/client/sw.js.br +0 -0
  193. package/dist/client/sw.js.gz +0 -0
  194. package/package.json +1 -1
  195. package/runtime-manifest.json +2 -2
  196. package/dist/client/assets/App-I6tWA3e3.js +0 -156
  197. package/dist/client/assets/App-I6tWA3e3.js.br +0 -0
  198. package/dist/client/assets/App-I6tWA3e3.js.gz +0 -0
  199. package/dist/client/assets/ChangeWalkthroughPanel-BsNjY-II.js +0 -2
  200. package/dist/client/assets/ChangeWalkthroughPanel-BsNjY-II.js.br +0 -0
  201. package/dist/client/assets/ChangeWalkthroughPanel-BsNjY-II.js.gz +0 -0
  202. package/dist/client/assets/DagPlayground-yu_rA4_Q.js.br +0 -0
  203. package/dist/client/assets/DagPlayground-yu_rA4_Q.js.gz +0 -0
  204. package/dist/client/assets/DiffLab-DxonIqMt.js.br +0 -0
  205. package/dist/client/assets/DiffLab-DxonIqMt.js.gz +0 -0
  206. package/dist/client/assets/DiffReview-Dr79uNMt.js +0 -1
  207. package/dist/client/assets/DiffReview-Dr79uNMt.js.br +0 -0
  208. package/dist/client/assets/DiffReview-Dr79uNMt.js.gz +0 -0
  209. package/dist/client/assets/DiffReviewLab-C9tmkKic.js.br +0 -0
  210. package/dist/client/assets/DiffReviewLab-C9tmkKic.js.gz +0 -0
  211. package/dist/client/assets/DiffViewer-TIYVqovz.js.br +0 -0
  212. package/dist/client/assets/DiffViewer-TIYVqovz.js.gz +0 -0
  213. package/dist/client/assets/ModelPreview-Fd4YRrhE.js.br +0 -0
  214. package/dist/client/assets/ModelPreview-Fd4YRrhE.js.gz +0 -0
  215. package/dist/client/assets/RightSidebar-DVtyAiqo.js.br +0 -0
  216. package/dist/client/assets/RightSidebar-DVtyAiqo.js.gz +0 -0
  217. package/dist/client/assets/abnfDiagram-VCTEODGH-CYLdUxpT.js.br +0 -0
  218. package/dist/client/assets/abnfDiagram-VCTEODGH-CYLdUxpT.js.gz +0 -0
  219. package/dist/client/assets/app-DgWai6ZR.js +0 -34
  220. package/dist/client/assets/app-DgWai6ZR.js.br +0 -0
  221. package/dist/client/assets/app-DgWai6ZR.js.gz +0 -0
  222. package/dist/client/assets/arc-C5C_UCGY.js.br +0 -0
  223. package/dist/client/assets/arc-C5C_UCGY.js.gz +0 -0
  224. package/dist/client/assets/architectureDiagram-5GKGNRK7-BhlTTPvP.js.br +0 -0
  225. package/dist/client/assets/architectureDiagram-5GKGNRK7-BhlTTPvP.js.gz +0 -0
  226. package/dist/client/assets/blockDiagram-I7D4REHJ-xahT3vIr.js.br +0 -0
  227. package/dist/client/assets/blockDiagram-I7D4REHJ-xahT3vIr.js.gz +0 -0
  228. package/dist/client/assets/c4Diagram-7LVT6UL2-CPVj8_0R.js.br +0 -0
  229. package/dist/client/assets/c4Diagram-7LVT6UL2-CPVj8_0R.js.gz +0 -0
  230. package/dist/client/assets/channel-DxXmP2az.js +0 -1
  231. package/dist/client/assets/chunk-F27PBJKO-9MNs997p.js.br +0 -0
  232. package/dist/client/assets/chunk-F27PBJKO-9MNs997p.js.gz +0 -0
  233. package/dist/client/assets/chunk-IMKFNOWR-DkZYkW_Z.js.br +0 -0
  234. package/dist/client/assets/chunk-IMKFNOWR-DkZYkW_Z.js.gz +0 -0
  235. package/dist/client/assets/chunk-SVP7TREG-CAFBZo77.js.br +0 -0
  236. package/dist/client/assets/chunk-SVP7TREG-CAFBZo77.js.gz +0 -0
  237. package/dist/client/assets/chunk-TICWLB2K-B_4wy4N2.js.br +0 -0
  238. package/dist/client/assets/chunk-TICWLB2K-B_4wy4N2.js.gz +0 -0
  239. package/dist/client/assets/classDiagram-ZZMXUADV-BtSaEJK_.js +0 -1
  240. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BtSaEJK_.js +0 -1
  241. package/dist/client/assets/cose-bilkent-JH36ORCC-CJdQoFsU.js.br +0 -0
  242. package/dist/client/assets/cynefin-OW5HDTMX-kZwRMtMu.js.br +0 -0
  243. package/dist/client/assets/cynefin-OW5HDTMX-kZwRMtMu.js.gz +0 -0
  244. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D_Pwm7Yo.js.br +0 -0
  245. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D_Pwm7Yo.js.gz +0 -0
  246. package/dist/client/assets/dagre-GXQ25YYZ-GiUWR7a7.js.br +0 -0
  247. package/dist/client/assets/dagre-GXQ25YYZ-GiUWR7a7.js.gz +0 -0
  248. package/dist/client/assets/diagram-S7CK7UJ4-BQeJ4VT_.js.br +0 -0
  249. package/dist/client/assets/diagram-S7CK7UJ4-BQeJ4VT_.js.gz +0 -0
  250. package/dist/client/assets/diagram-UQ7AKVKN-Duc8vPlr.js.br +0 -0
  251. package/dist/client/assets/diagram-UQ7AKVKN-Duc8vPlr.js.gz +0 -0
  252. package/dist/client/assets/diagram-VSXAHHWV-ByxuzSd4.js.br +0 -0
  253. package/dist/client/assets/diagram-VSXAHHWV-ByxuzSd4.js.gz +0 -0
  254. package/dist/client/assets/diagram-VX7I27RA-BMd8lgqI.js.br +0 -0
  255. package/dist/client/assets/diagram-VX7I27RA-BMd8lgqI.js.gz +0 -0
  256. package/dist/client/assets/diagram-Z3DM3KII-Bh7bETZv.js.br +0 -0
  257. package/dist/client/assets/diagram-Z3DM3KII-Bh7bETZv.js.gz +0 -0
  258. package/dist/client/assets/ebnfDiagram-PWID7BFC-olNfh9ko.js.br +0 -0
  259. package/dist/client/assets/ebnfDiagram-PWID7BFC-olNfh9ko.js.gz +0 -0
  260. package/dist/client/assets/erDiagram-RLTQ6QDP-Cc0mXXov.js.br +0 -0
  261. package/dist/client/assets/erDiagram-RLTQ6QDP-Cc0mXXov.js.gz +0 -0
  262. package/dist/client/assets/flowDiagram-HODETNUW-CAOVSMig.js.br +0 -0
  263. package/dist/client/assets/flowDiagram-HODETNUW-CAOVSMig.js.gz +0 -0
  264. package/dist/client/assets/ganttDiagram-EL5Y4UJY-Bg_Nuwn9.js.br +0 -0
  265. package/dist/client/assets/gestureArbiter-B7_ybJ2P.js +0 -1
  266. package/dist/client/assets/gestureArbiter-B7_ybJ2P.js.br +0 -0
  267. package/dist/client/assets/gestureArbiter-B7_ybJ2P.js.gz +0 -0
  268. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BZc_55jp.js.br +0 -0
  269. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BZc_55jp.js.gz +0 -0
  270. package/dist/client/assets/index-h5sVWJNu.css.br +0 -0
  271. package/dist/client/assets/ishikawaDiagram-5VMMS53U-DN8aLWDC.js.br +0 -0
  272. package/dist/client/assets/ishikawaDiagram-5VMMS53U-DN8aLWDC.js.gz +0 -0
  273. package/dist/client/assets/journeyDiagram-3NMN7TZE-Ct6aGnNW.js.br +0 -0
  274. package/dist/client/assets/journeyDiagram-3NMN7TZE-Ct6aGnNW.js.gz +0 -0
  275. package/dist/client/assets/kanban-definition-UXKFOSKX-mdR2RvVB.js.br +0 -0
  276. package/dist/client/assets/kanban-definition-UXKFOSKX-mdR2RvVB.js.gz +0 -0
  277. package/dist/client/assets/layout-DN8HXeEO.js.br +0 -0
  278. package/dist/client/assets/layout-DN8HXeEO.js.gz +0 -0
  279. package/dist/client/assets/linear-CFCpNtTo.js.br +0 -0
  280. package/dist/client/assets/linear-CFCpNtTo.js.gz +0 -0
  281. package/dist/client/assets/mermaid.core-Tv_YSXBk.js.br +0 -0
  282. package/dist/client/assets/mermaid.core-Tv_YSXBk.js.gz +0 -0
  283. package/dist/client/assets/mindmap-definition-YA3MSWOX-DfjFoXF_.js.br +0 -0
  284. package/dist/client/assets/mindmap-definition-YA3MSWOX-DfjFoXF_.js.gz +0 -0
  285. package/dist/client/assets/passwordBootstrap-CT__RJi-.js.br +0 -0
  286. package/dist/client/assets/passwordBootstrap-CT__RJi-.js.gz +0 -0
  287. package/dist/client/assets/pegDiagram-XKGWAZYB-DmYT7JUL.js.br +0 -0
  288. package/dist/client/assets/pegDiagram-XKGWAZYB-DmYT7JUL.js.gz +0 -0
  289. package/dist/client/assets/pieDiagram-E7YTZNPT-Kuotva9-.js.br +0 -0
  290. package/dist/client/assets/pieDiagram-E7YTZNPT-Kuotva9-.js.gz +0 -0
  291. package/dist/client/assets/quadrantDiagram-AXDQQJYC-CBGahKeF.js.br +0 -0
  292. package/dist/client/assets/quadrantDiagram-AXDQQJYC-CBGahKeF.js.gz +0 -0
  293. package/dist/client/assets/railroadDiagram-O6MQD6OU-CIqkDHvI.js.br +0 -0
  294. package/dist/client/assets/railroadDiagram-O6MQD6OU-CIqkDHvI.js.gz +0 -0
  295. package/dist/client/assets/referenceLongPress-Ai2fuaA-.js +0 -1
  296. package/dist/client/assets/referenceLongPress-Ai2fuaA-.js.br +0 -0
  297. package/dist/client/assets/referenceLongPress-Ai2fuaA-.js.gz +0 -0
  298. package/dist/client/assets/requirementDiagram-BXWQKSXE-B5jFF7T-.js.br +0 -0
  299. package/dist/client/assets/requirementDiagram-BXWQKSXE-B5jFF7T-.js.gz +0 -0
  300. package/dist/client/assets/sankeyDiagram-P5KCCOFB-BD7j9g5R.js.br +0 -0
  301. package/dist/client/assets/sankeyDiagram-P5KCCOFB-BD7j9g5R.js.gz +0 -0
  302. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Lxs3HFYy.js.br +0 -0
  303. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Lxs3HFYy.js.gz +0 -0
  304. package/dist/client/assets/sizeCapture-INFHLROL-CYPj7xBk.js.br +0 -0
  305. package/dist/client/assets/sizeCapture-INFHLROL-CYPj7xBk.js.gz +0 -0
  306. package/dist/client/assets/sparkles-BizlTJdy.js +0 -1
  307. package/dist/client/assets/stateDiagram-D77RDMKH-B60ttdpA.js.br +0 -0
  308. package/dist/client/assets/stateDiagram-D77RDMKH-B60ttdpA.js.gz +0 -0
  309. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-B0d5y84i.js +0 -1
  310. package/dist/client/assets/swimlanes-42K2YHIH-DrEIRSWh.js.br +0 -0
  311. package/dist/client/assets/swimlanes-42K2YHIH-DrEIRSWh.js.gz +0 -0
  312. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Dhrz4hVv.js +0 -8
  313. package/dist/client/assets/timeline-definition-24CTP7MA-BoekuGLd.js.br +0 -0
  314. package/dist/client/assets/timeline-definition-24CTP7MA-BoekuGLd.js.gz +0 -0
  315. package/dist/client/assets/triangle-alert-sWaK_Y9l.js +0 -1
  316. package/dist/client/assets/vennDiagram-4TSXK5OY-DttegaxG.js.br +0 -0
  317. package/dist/client/assets/vennDiagram-4TSXK5OY-DttegaxG.js.gz +0 -0
  318. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DdMEDzpE.js.br +0 -0
  319. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DdMEDzpE.js.gz +0 -0
  320. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CtVCpsSv.js.br +0 -0
  321. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CtVCpsSv.js.gz +0 -0
@@ -1,156 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RightSidebar-DVtyAiqo.js","assets/app-DgWai6ZR.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-h5sVWJNu.css","assets/gestureArbiter-B7_ybJ2P.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-Dr79uNMt.js","assets/sparkles-BizlTJdy.js","assets/DiffViewer-TIYVqovz.js","assets/referenceLongPress-Ai2fuaA-.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-sWaK_Y9l.js","assets/ChangeWalkthroughPanel-BsNjY-II.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
2
- import{$ as or,U as Q5,aU as a,cd as _a,bU as a7,ay as Vs,bH as $l,Q as l7,O as c7,bL as X1,c8 as kp,c9 as an,Z as j0,bC as J1,b_ as u7,a7 as rd,aT as Bc,e as d7,z as h7,aC as jf,b0 as Pf,bR as f7,ab as p7,bx as m7,J as j5,bv as g7,bP as P5,N as x7,a0 as b7,L as un,C as la,X as vs,c as wl,aH as y7,a$ as Ep,cb as Ht,ag as v7,ch as w7,m as A7,b5 as O5,bg as T7,b7 as C7,bN as em,bO as tm,bQ as rm,W as nm,bf as S7,bV as _7,k as sm,c6 as nd,aA as L7,g as I7,T as $o,bK as k7,aw as E7,bn as R7,bo as M7,I as N7,by as D7,a4 as B7,av as Q7,bd as j7,be as P7,P as F5,V as im,aW as U5,i as Xi,D as sd,b$ as kh,B as P0,l as O7,a3 as F7,u as Of,bI as U7,d as zd,f as Hc,aR as $7,aS as z7,a6 as $5,ax as Rp,ae as z5,c7 as ia,bZ as H5,aX as H7,aZ as W5,bA as W7,h as G5,bk as G7,bS as V7,bD as q7,bi as Z7,bJ as Y7,bj as V5,a_ as om,bG as Fc,bm as q5,bT as K7,bY as X7,bM as J7,b6 as Z5,bF as ev,aY as am,b2 as tv,j as rv,S as nv,b4 as sv,bl as iv,_ as ov,bh as av,a9 as lv,ad as cv,af as uv,aB as ac,aL as dv,c3 as hv,aM as fv,a5 as pv,c4 as mv,w as gv,a2 as xv,Y as bv,A as yv,cc as vv,b8 as h0,bs as wv,bz as Av,az as Tv,K as Cv,y as Sv,c1 as _v,cf as Un,bX as Lv,at as Iv,aD as lm,br as kv,ca as Ev,aG as Ml,b1 as Rv,bp as cm,bt as Mv,bq as f0,bu as Nv,R as Dv}from"./app-DgWai6ZR.js";import{R as _,b as T,r as Ya,a as Bv}from"./dnd-BCFAPC0L.js";import{b as Qv,c as jv,F as O0,S as Pv,e as Ov,h as Fv,r as Uv,y as $v,d as zv,u as Hv}from"./gestureArbiter-B7_ybJ2P.js";import{L as Wv,l as Gv}from"./terminal-C7X98Amf.js";import{C as Vv,u as Mp}from"./referenceLongPress-Ai2fuaA-.js";import{T as Y5,L as F0,C as um}from"./triangle-alert-sWaK_Y9l.js";import{r as qv}from"./react-XDCjal2T.js";const Zv=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Yv=or("app-window",Zv);const Kv=[["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"}]],Xv=or("arrow-down-a-z",Kv);const Jv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],e8=or("arrow-down",Jv);const t8=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],K5=or("arrow-up",t8);const r8=[["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"}]],n8=or("bell",r8);const s8=[["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"}]],Hd=or("bot",s8);const i8=[["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"}]],o8=or("box",i8);const a8=[["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"}]],l8=or("cable",a8);const c8=[["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"}]],u8=or("calendar-clock",c8);const d8=[["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"}]],h8=or("chart-bar",d8);const f8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],p8=or("circle-dot",f8);const m8=[["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"}]],gd=or("circle-question-mark",m8);const g8=[["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"}]],x8=or("clipboard-paste",g8);const b8=[["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"}]],X5=or("clipboard",b8);const y8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],Wc=or("clock-3",y8);const v8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],w8=or("clock",v8);const A8=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],T8=or("code",A8);const C8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Hl=or("columns-2",C8);const S8=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],_8=or("corner-down-left",S8);const L8=[["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"}]],Gc=or("download",L8);const I8=[["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"}]],J5=or("external-link",I8);const k8=[["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"}]],E8=or("file-code",k8);const R8=[["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"}]],M8=or("file-up",R8);const N8=[["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"}]],ex=or("file",N8);const D8=[["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"}]],D0=or("folder-open",D8);const B8=[["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"}]],Np=or("folder-search",B8);const Q8=[["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"}]],j8=or("folder-tree",Q8);const P8=[["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"}]],dm=or("grid-2x2",P8);const O8=[["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"}]],F8=or("grip-vertical",O8);const U8=[["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"}]],$8=or("hash",U8);const z8=[["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"}]],k0=or("history",z8);const H8=[["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"}]],W8=or("keyboard",H8);const G8=[["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"}]],V8=or("layers",G8);const q8=[["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"}]],U0=or("layout-grid",q8);const Z8=[["path",{d:"M5 12h14",key:"1ays0h"}]],Y8=or("minus",Z8);const K8=[["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"}]],X8=or("moon",K8);const J8=[["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"}]],e9=or("move",J8);const t9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],r9=or("panel-left",t9);const n9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],tx=or("panel-right",n9);const s9=[["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"}]],i9=or("pause",s9);const o9=[["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"}]],a9=or("pen-line",o9);const l9=[["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"}]],Vc=or("pin",l9);const c9=[["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"}]],qc=or("pin-off",c9);const u9=[["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"}]],hm=or("play",u9);const d9=[["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"}]],hs=or("refresh-cw",d9);const h9=[["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"}]],rx=or("rotate-ccw",h9);const f9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],fm=or("rows-2",f9);const p9=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],xd=or("search",p9);const m9=[["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"}]],g9=or("settings",m9);const x9=[["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"}]],b9=or("sliders-horizontal",x9);const y9=[["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"}]],v9=or("stethoscope",y9);const w9=[["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"}]],A9=or("sun",w9);const T9=[["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"}]],Ji=or("trash-2",T9);const C9=[["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"}]],S9=or("unlink",C9);const _9=[["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"}]],L9=or("unplug",_9);const I9=[["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"}]],k9=or("video",I9);const E9=[["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"}]],R9=or("wand-sparkles",E9);const M9=[["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"}]],pm=or("workflow",M9),bd=Q5(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function mm(){const e=_a(),t=e.visualViewport,r=document.documentElement.style,s=m=>m===void 0?"?":Math.round(m),i=m=>r.getPropertyValue(m)||"?";let u=document.activeElement?.parentElement,c=null;for(;u&&!c;)c=u.querySelector('[data-mobile-keyboard="true"]'),u=u.parentElement;const h=c?.getBoundingClientRect(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${s(t?.height)} off ${s(t?.offsetTop)} win ${e.innerHeight}`,`base ${i("--app-base-vh")} kb ${i("--kb-height")} move ${i("--kb-translate-y")}`,`bar ${s(h?.top)}…${s(h?.bottom)} h ${s(h?.height)} root ${s(p?.bottom)}`,`safe ${i("--safe-top-inset")}/${i("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
3
- `)}function N9({onClose:e}){const[t,r]=_.useState(mm);return _.useEffect(()=>{const s=window.setInterval(()=>r(mm()),200);return()=>window.clearInterval(s)},[]),a.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:[a.jsx("button",{type:"button",className:"pointer-events-auto absolute right-1 top-1 px-2 py-1 text-xs",onPointerDown:s=>s.preventDefault(),onClick:e,"aria-label":"关闭布局诊断",children:"×"}),a.jsx("pre",{className:"pr-5 font-mono text-[10px] leading-tight",children:t})]})}let Ff=0,gm=!1,E0=0;function D9(){if(gm||typeof window>"u")return;gm=!0;const e=()=>{Ff=performance.now()};window.addEventListener("pointerdown",()=>{E0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{E0=Math.max(0,E0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{E0=0,e()})}function Dp(e,t=500){D9();let r=!1,s,i;const u=()=>{if(r)return;if(E0>0||performance.now()-Ff<400){i=setTimeout(u,100);return}const c=()=>{if(!r){if(E0>0||performance.now()-Ff<400){i=setTimeout(u,100);return}e()}};"requestIdleCallback"in window?s=window.requestIdleCallback(c):i=setTimeout(c,16)};return i=setTimeout(u,t),()=>{r=!0,clearTimeout(i),s!==void 0&&window.cancelIdleCallback(s)}}function B9(e){const[t,r]=T.useState(e);return T.useEffect(()=>Dp(()=>r(e),0),[e]),t}function Q9(e,t,r){T.useEffect(()=>{e&&a7(e,!0)},[e,r])}const vi=[];for(let e=0;e<256;++e)vi.push((e+256).toString(16).slice(1));function j9(e,t=0){return(vi[e[t+0]]+vi[e[t+1]]+vi[e[t+2]]+vi[e[t+3]]+"-"+vi[e[t+4]]+vi[e[t+5]]+"-"+vi[e[t+6]]+vi[e[t+7]]+"-"+vi[e[t+8]]+vi[e[t+9]]+"-"+vi[e[t+10]]+vi[e[t+11]]+vi[e[t+12]]+vi[e[t+13]]+vi[e[t+14]]+vi[e[t+15]]).toLowerCase()}let Eh;const P9=new Uint8Array(16);function O9(){if(!Eh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Eh=crypto.getRandomValues.bind(crypto)}return Eh(P9)}const F9=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xm={randomUUID:F9};function U9(e,t,r){e=e||{};const s=e.random??e.rng?.()??O9();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,j9(s)}function $9(e,t,r){return xm.randomUUID&&!e?xm.randomUUID():U9(e)}const z9=256*1024,H9=256*1024,W9=128;function bm(e,t=z9){if(!e)return[];if(e.length<=t)return[e];const r=[];let s=0;for(;s<e.length;){let i=Math.min(s+t,e.length);if(i<e.length){const u=e.lastIndexOf(`
4
- `,i);u>s&&(i=u+1)}r.push(e.slice(s,i)),s=i}return r}function G9(e,t=H9,r=W9){const s=new Map;let i=0,u=0;for(const c of[...e.keys()]){const h=e.get(c);if(!h||h.length===0){e.delete(c);continue}const p=[];for(;h.length>0;){const m=h[0];if(u>0&&(u>=r||i+m.length>t))break;h.shift(),p.push(m),i+=m.length,u+=1}if(p.length>0&&s.set(c,p),e.delete(c),h.length>0&&e.set(c,h),u>=r||i>=t)break}return s}async function nx(e,t=!1,r="termdock-encrypted-background"){const s=await new Promise((i,u)=>{const c=indexedDB.open(r,1);c.onupgradeneeded=()=>c.result.createObjectStore("state"),c.onsuccess=()=>i(c.result),c.onerror=()=>u(c.error)});try{return await new Promise((i,u)=>{const c=s.transaction("state",t?"readwrite":"readonly"),h=e(c.objectStore("state"));c.oncomplete=()=>i(h.result),c.onabort=c.onerror=()=>u(c.error)})}finally{s.close()}}const V9=e=>nx(t=>t.put(e,e.targetPeerId),!0),q9=e=>nx(t=>t.delete(e),!0),sx="termdock-pwa-notifications-enabled",ix="termdock-pwa-ai-notifications-enabled",ox="termdock-pwa-exit-notifications-enabled",ax="termdock-pwa-notification-alert-style",Z9="termdock-notification-claim:",Uf=5e3,Y9=1500,$f="termdock-push-last-sync",ym=360*60*1e3,K9=10080*60*1e3,Uc=new Map;function Wl(){return Vs()?!0:typeof window<"u"&&typeof Notification<"u"&&"serviceWorker"in navigator&&window.isSecureContext}function X9(){if(typeof navigator>"u")return!1;const e=navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function J9(){return typeof window>"u"?!1:!!(window.matchMedia("(display-mode: standalone)").matches||"standalone"in navigator&&navigator.standalone===!0)}function lx(){return Vs()?!0:!(!Wl()||X9()&&!J9())}function Rh(){return Vs()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function Wd(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sx)==="true"}catch{return!1}}function Lu(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sx,String(e))}catch{}}function Zc(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(ix);return e===null?!0:e==="true"}catch{return!0}}function ew(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ix,String(e))}catch{}}function yd(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(ox)==="true"}catch{return!1}}function tw(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ox,String(e))}catch{}}function $0(){if(typeof window>"u")return"normal";try{const e=window.localStorage.getItem(ax);if(e==="quiet"||e==="persistent")return e}catch{}return"normal"}function rw(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ax,e)}catch{}}async function nw(){return Vs()?"granted":Wl()?Notification.permission==="default"?Notification.requestPermission():Notification.permission:"unsupported"}function sw(){return typeof document>"u"?!0:document.visibilityState==="visible"&&document.hasFocus()}function iw(e){for(const[t,r]of Uc)e-r>Uf&&Uc.delete(t)}function ow(e){return e.dedupKey?.trim()?e.dedupKey.trim():e.tag?.trim()?e.tag.trim():[e.data?.sessionId,e.title,e.body].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim()).join("|")}function aw(e){const t=ow(e);if(!t)return!0;const r=Date.now();iw(r);const s=Uc.get(t)??0;if(r-s<Uf)return!1;try{if(typeof window<"u"&&window.localStorage){const i=`${Z9}${t}`,u=Number(window.localStorage.getItem(i)??"0");if(Number.isFinite(u)&&r-u<Uf)return Uc.set(t,u),!1;Number.isFinite(u)&&u>0&&window.localStorage.removeItem(i),window.localStorage.setItem(i,String(r))}}catch{}return Uc.set(t,r),!0}async function Gd(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const e=await navigator.serviceWorker.getRegistration()??null;return e?.active?e:await Promise.race([navigator.serviceWorker.ready,new Promise(r=>{window.setTimeout(()=>r(null),Y9)})])??e}catch{return null}}function lw(e){const t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(r),i=new Uint8Array(new ArrayBuffer(s.length));for(let u=0;u<s.length;u+=1)i[u]=s.charCodeAt(u);return i}async function Bp(e,t){const r=await fetch("/api/csrf-token");if(!r.ok)throw new Error("Unable to get notification security token");const{csrfToken:s}=await r.json();return fetch(`/api/notifications/${e}`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":s},body:JSON.stringify(t)})}async function _0(e=!1,t=!1){if(Vs())return!0;if(!Wd()||!lx()||Notification.permission!=="granted")return!1;const r=await Gd();if(!r?.pushManager)return!1;try{const s=await fetch("/api/notifications/status");if(!s.ok)return!1;const i=await s.json();let u=await r.pushManager.getSubscription();const c=!!(u?.expirationTime&&u.expirationTime-Date.now()<K9);if(!u)try{u=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:lw(i.publicKey)})}catch(x){return console.warn(`[PWA notifications] Push subscription missing; re-subscribe failed${t?" (user gesture)":""}:`,x),!1}const h=Number(window.localStorage.getItem($f)??"0"),p=!i.subscription||i.subscription.endpoint!==u.endpoint||Date.now()-(i.subscription.updatedAt??0)>=ym;if(e||p||Date.now()-h>=ym||c){if(!(await Bp("subscribe",{subscription:u.toJSON(),aiEnabled:Zc(),exitEnabled:yd(),alertStyle:$0(),locale:navigator.language})).ok)return!1;window.localStorage.setItem($f,String(Date.now()))}const m=$l();return m&&await V9({targetPeerId:m.targetPeerId,addresses:c7(m),routes:l7(m),publicKey:i.publicKey,preferences:{aiEnabled:Zc(),exitEnabled:yd(),alertStyle:$0(),locale:navigator.language}}),!0}catch(s){return console.warn("[PWA notifications] Push subscription sync failed:",s),!1}}async function cw(){if(Vs())return;const t=await(await Gd())?.pushManager?.getSubscription();try{await Bp("unsubscribe",{endpoint:t?.endpoint})}finally{const r=$l();r&&await q9(r.targetPeerId),await t?.unsubscribe();try{window.localStorage.removeItem($f)}catch{}}}async function Mh(){if(Vs()||!Wd())return;(await Bp("preferences",{aiEnabled:Zc(),exitEnabled:yd(),alertStyle:$0(),locale:navigator.language})).status===404&&await _0(!0)}async function uw(){if(!Vs())try{const e=navigator;typeof e.clearAppBadge=="function"&&await e.clearAppBadge()}catch{}}async function dw(e){if(!Vs())try{const t=await Gd();if(!t||typeof t.getNotifications!="function")return;const r=`agent:${e}`,s=await t.getNotifications({tag:r});for(const u of s)u.close();const i=navigator;if(typeof i.setAppBadge=="function"){const u=await t.getNotifications();await i.setAppBadge(u.length)}}catch{}}async function id(e){if(!Wd()||!Wl())return!1;if(e.requireHidden!==!1&&sw())return!0;const t=Vs();if(t){const u=e.alertStyle??$0(),c=await t.showNotification({title:e.title,body:e.body,tag:e.tag,sessionId:e.data?.sessionId,silent:u==="quiet",persistent:u==="persistent"});return t.notificationDeliveryConfirmation===!0&&c}if(Notification.permission!=="granted")return!1;const r=await Gd();if(e.deferToPush&&await r?.pushManager?.getSubscription())return!0;if(e.requireHidden!==!1){if(await r?.pushManager?.getSubscription())return!0}if(!aw(e))return!0;const s=e.alertStyle??$0(),i={body:e.body,tag:e.tag,icon:"/pwa-192x192.png",badge:"/maskable-icon-512x512.png",requireInteraction:s==="persistent",renotify:s==="persistent"?!!e.tag:!1,silent:s==="quiet",vibrate:s==="quiet"?[]:[80,40,80],data:{url:e.data?.url??"/",sessionId:e.data?.sessionId}};try{if(r&&typeof r.showNotification=="function")return await r.showNotification(e.title,i),!0;const u=new Notification(e.title,i);return u.onclick=()=>{window.focus(),e.data?.url&&window.location.href!==e.data.url&&window.location.assign(e.data.url),u.close()},!0}catch(u){if(u instanceof DOMException&&u.name==="NotSupportedError"&&i.renotify)try{const c={...i,renotify:!1};return r&&typeof r.showNotification=="function"?await r.showNotification(e.title,c):new Notification(e.title,c),!0}catch(c){return console.warn("[PWA notifications] Failed to show notification (renotify fallback):",c),!1}return console.warn("[PWA notifications] Failed to show notification:",u),!1}}function hw(){try{return localStorage.getItem("termdock:locale")||"en"}catch{return"en"}}function fw(e,t){return e==="zh"?{waitingTitle:`${t} 需要你的处理`,waitingBody:`${t} 需要你的处理。`,doneTitle:`${t} 已完成`,doneBody:`${t} 已完成,点按查看结果。`,exitedTitle:`${t} 已退出`,exitedBody:`${t} 已退出,点按查看结果。`}:{waitingTitle:`${t} needs your input`,waitingBody:`${t} is waiting for your input.`,doneTitle:`${t} finished`,doneBody:"Tap to see the result.",exitedTitle:`${t} exited`,exitedBody:"Tap to see the result."}}const vm=1e6;function hl(e){return{sessionId:e,directory:"",terminalSessionId:null,mode:"shell",tmuxSessionName:null,activeProgram:null,activeProgramRaw:null,activeProgramSource:null,cwd:null,inCopyMode:!1,isConnecting:!1,agentStatus:null,agentIndicator:null,agentStatusDetail:null,agent:null,agentMessage:null,agentNativeSessionId:null,agentResumeRecovered:!1,agentRich:!1,agentActivity:0,agentCwd:null,agentNeedsReview:!1,shellTitle:null,promptState:null,shellExitCode:null,tuiProgress:null,gitStatus:null,bufferChunks:[],bufferLength:0,lastOutputAt:null,updatedAt:Date.now()}}const Vd="termdock-shell-titles-v1";function qd(){if(typeof window>"u")return{};try{const e=localStorage.getItem(Vd);if(!e)return{};const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function pw(e){return qd()[e]??null}function mw(e,t){if(!(typeof window>"u"))try{const r=qd();t?r[e]=t:delete r[e],localStorage.setItem(Vd,JSON.stringify(r))}catch{}}function gw(e){if(!(typeof window>"u"))try{const t=qd();delete t[e],localStorage.setItem(Vd,JSON.stringify(t))}catch{}}const Zd="termdock-agent-cache-v1";function Qp(){if(typeof window>"u")return{};try{const e=localStorage.getItem(Zd);if(!e)return{};const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function xw(e,t){if(!(typeof window>"u"))try{const r=Qp();t?r[e]=t:delete r[e],localStorage.setItem(Zd,JSON.stringify(r))}catch{}}function bw(e){if(!(typeof window>"u"))try{const t=Qp();delete t[e],localStorage.setItem(Zd,JSON.stringify(t))}catch{}}function yw(){if(!(typeof window>"u"))try{localStorage.removeItem(Zd)}catch{}}function wm(e){return Qp()[e]??null}function vw(){if(!(typeof window>"u"))try{localStorage.removeItem(Vd)}catch{}}const Br=Q5((e,t)=>{const r={pendingChunksBySession:new Map,activitySessionIds:new Set,batchFlushRafRef:null},s=(c,h)=>{const p=new Map;return e(m=>{const x=new Map(m.sessions);let b=m.nextChunkId;const v=Date.now();for(const[w,I]of c){const k=x.get(w)??hl(w);let N=k.bufferChunks.length>0?[...k.bufferChunks]:[],R=k.bufferLength;for(const D of I){const P=b++;N.push({id:P,data:D}),p.set(w,P),R+=D.length}for(;R>vm&&N.length>1;){const D=N.shift();if(!D)break;R-=D.data.length}x.set(w,{...k,bufferChunks:N,bufferLength:R,lastOutputAt:h.has(w)?v:k.lastOutputAt,updatedAt:v})}return{sessions:x,nextChunkId:b}}),p},i=()=>{if(r.batchFlushRafRef===null){if(typeof window>"u"){u();return}r.batchFlushRafRef=window.requestAnimationFrame(()=>{r.batchFlushRafRef=null,u()})}},u=()=>{if(r.pendingChunksBySession.size===0)return;const c=G9(r.pendingChunksBySession),h=new Set([...c.keys()].filter(p=>r.activitySessionIds.has(p)));for(const p of c.keys())r.pendingChunksBySession.has(p)||r.activitySessionIds.delete(p);s(c,h),r.pendingChunksBySession.size>0&&i()};return{sessions:new Map,nextChunkId:1,activeSessionId:null,getTerminalSession:c=>t().sessions.get(c),setActiveSessionId:c=>{if(e({activeSessionId:c}),c){const h=t().sessions.get(c);if(h?.agentNeedsReview){const p=new Map(t().sessions);p.set(c,{...h,agentNeedsReview:!1,updatedAt:Date.now()}),e({sessions:p}),h.terminalSessionId&&X1(h.terminalSessionId)}}},setTerminalSession:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c),v=!x||x.terminalSessionId!==h.sessionId?hl(c):x??hl(c),w=h.history??x?.history??[];return m.set(c,{...v,terminalSessionId:h.sessionId,mode:h.mode??v.mode,tmuxSessionName:h.tmuxSessionName??v.tmuxSessionName,activeProgram:h.activeProgram??x?.activeProgram??v.activeProgram,activeProgramRaw:h.activeProgramRaw??x?.activeProgramRaw??v.activeProgramRaw,activeProgramSource:h.activeProgramSource??x?.activeProgramSource??v.activeProgramSource,cwd:h.cwd??x?.cwd??v.cwd,agentResumeRecovered:x?.agentResumeRecovered??v.agentResumeRecovered,shellTitle:x?.shellTitle??qd()[c]??v.shellTitle,sessionId:c,isConnecting:!1,history:w,updatedAt:Date.now()}),{sessions:m}})},setSessionHistory:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c)??hl(c);return m.set(c,{...x,history:h,updatedAt:Date.now()}),{sessions:m}})},setSessionActiveProgram:(c,h,p=null,m=null)=>{e(x=>{const b=new Map(x.sessions),v=b.get(c)??hl(c);return b.set(c,{...v,activeProgram:h,activeProgramRaw:m,activeProgramSource:p,updatedAt:Date.now()}),{sessions:b}})},setSessionCwd:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c)??hl(c);return m.set(c,{...x,cwd:h,updatedAt:Date.now()}),{sessions:m}})},setSessionShellTitle:(c,h)=>{e(p=>{const m=p.sessions.get(c);if(!m||m.shellTitle===h)return p;const x=new Map(p.sessions);return x.set(c,{...m,shellTitle:h,updatedAt:Date.now()}),{sessions:x}}),mw(c,h)},setSessionPromptState:(c,h,p)=>{e(m=>{const x=m.sessions.get(c);if(!x||x.promptState===h)return m;const b=new Map(m.sessions);return b.set(c,{...x,promptState:h,shellExitCode:p??x.shellExitCode,updatedAt:Date.now()}),{sessions:b}})},setSessionTuiProgress:(c,h)=>{e(p=>{const m=p.sessions.get(c);if(!m)return p;const x=h?.state==="remove"?null:h;if(m.tuiProgress?.state===x?.state&&m.tuiProgress?.progress===x?.progress)return p;const b=new Map(p.sessions);return b.set(c,{...m,tuiProgress:x,updatedAt:Date.now()}),{sessions:b}})},setSessionGitStatus:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c);return!x||JSON.stringify(x.gitStatus)===JSON.stringify(h)?p:(m.set(c,{...x,gitStatus:h,updatedAt:Date.now()}),{sessions:m})})},setSessionCopyMode:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c);return!x||x.inCopyMode===h?p:(m.set(c,{...x,inCopyMode:h,updatedAt:Date.now()}),{sessions:m})})},setSessionAgentStatus:(c,h)=>{const p=t(),m=p.sessions.get(c);if(!m)return;const x=h.agentStatus??null,b=x&&x!=="idle"?h.agentIndicator??m.agentIndicator??null:null,v=x&&x!=="idle"?h.agentStatusDetail??null:null,w=h.agent!==void 0?h.agent:m.agent,I=h.agentMessage!==void 0?h.agentMessage:x?m.agentMessage:null,k=h.agentNativeSessionId!==void 0?h.agentNativeSessionId:m.agentNativeSessionId,N=h.agentResumeRecovered!==void 0?h.agentResumeRecovered:m.agentResumeRecovered,R=h.agentRich??m.agentRich,D=h.agentActivity??m.agentActivity,P=h.agentCwd!==void 0?h.agentCwd:m.agentCwd,V=p.activeSessionId!==c,F=m.agentStatus==="working"||m.agentStatus==="waiting"||m.agentStatus==="done",Y=h.reviewed===!1||h.reviewed===null&&x===null&&F&&V;if(m.agentStatus===x&&m.agentIndicator===b&&m.agentStatusDetail===v&&m.agent===w&&m.agentMessage===I&&m.agentNativeSessionId===k&&m.agentResumeRecovered===N&&m.agentRich===R&&m.agentActivity===D&&m.agentCwd===P&&m.agentNeedsReview===Y)return;const Z=new Map(p.sessions);if(Z.set(c,{...m,agentStatus:x,agentIndicator:b,agentStatusDetail:v,agent:w,agentMessage:I,agentNativeSessionId:k,agentResumeRecovered:N,agentRich:R,agentActivity:D,agentCwd:P,agentNeedsReview:Y,updatedAt:Date.now()}),e({sessions:Z}),w&&xw(c,w),!Zc())return;const he=w?.displayName??m.agent?.displayName??"Agent",Ee=hw(),Ie=fw(Ee,he);if(x==="waiting"&&m.agentStatus!=="waiting"&&V){id({title:Ie.waitingTitle,body:I??Ie.waitingBody,tag:`agent:${c}`,dedupKey:`agent:${c}:waiting:${D}`,data:{url:"/",sessionId:c},deferToPush:!0});return}if(x==="done"&&m.agentStatus!=="done"&&V){id({title:Ie.doneTitle,body:Ie.doneBody,tag:`agent:${c}`,dedupKey:`agent:${c}:done:${D}`,data:{url:"/",sessionId:c},deferToPush:!0});return}x===null&&(m.agentStatus==="working"||m.agentStatus==="waiting")&&V&&id({title:Ie.exitedTitle,body:Ie.exitedBody,tag:`agent:${c}`,dedupKey:`agent:${c}:exited:${D}`,data:{url:"/",sessionId:c},deferToPush:!0})},setAgentResumeRecovered:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c)??hl(c);return x.agentResumeRecovered===h?p:(m.set(c,{...x,agentResumeRecovered:h,updatedAt:Date.now()}),{sessions:m})})},clearAgentNeedsReview:c=>{const h=t().sessions.get(c);h?.agentNeedsReview&&(e(p=>{const m=new Map(p.sessions),x=m.get(c);return!x||!x.agentNeedsReview?p:(m.set(c,{...x,agentNeedsReview:!1,updatedAt:Date.now()}),{sessions:m})}),h.terminalSessionId&&X1(h.terminalSessionId))},setConnecting:(c,h)=>{e(p=>{const m=new Map(p.sessions),x=m.get(c)??hl(c);return m.set(c,{...x,isConnecting:h,updatedAt:Date.now()}),{sessions:m}})},appendToBuffer:(c,h,p)=>{if(!h)return;let m=r.pendingChunksBySession.get(c);m||(m=[],r.pendingChunksBySession.set(c,m)),m.push(...bm(h)),p?.markActivity!==!1&&r.activitySessionIds.add(c),i()},hasPendingBufferWrites:c=>(r.pendingChunksBySession.get(c)?.length??0)>0,flushPendingBufferWrites:c=>{const h=r.pendingChunksBySession.get(c);if(!h?.length)return t().sessions.get(c)?.bufferChunks.at(-1)?.id??null;r.pendingChunksBySession.delete(c);const p=r.activitySessionIds.delete(c);return r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),s(new Map([[c,h]]),p?new Set([c]):new Set).get(c)??null},replaceBuffer:(c,h)=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null);let p=null;return e(m=>{const x=new Map(m.sessions),b=x.get(c);if(!b)return m;if(!h||h.length===0)return x.set(c,{...b,bufferChunks:[],bufferLength:0,updatedAt:Date.now()}),{sessions:x};let v=m.nextChunkId;const w=[];let I=0;for(const k of h)if(k)for(const N of bm(k)){const R=v++;w.push({id:R,data:N}),p=R,I+=N.length}for(;I>vm&&w.length>1;){const k=w.shift();if(!k)break;I-=k.data.length}return x.set(c,{...b,bufferChunks:w,bufferLength:I,updatedAt:Date.now()}),{sessions:x,nextChunkId:v}}),p},clearTerminalSession:c=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),e(h=>{const p=new Map(h.sessions),m=p.get(c);return m&&p.set(c,{...m,terminalSessionId:null,isConnecting:!1,agentStatus:null,agentIndicator:null,agentStatusDetail:null,agent:null,agentMessage:null,agentNeedsReview:!1,updatedAt:Date.now()}),{sessions:p}})},clearBuffer:c=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),e(h=>{const p=new Map(h.sessions),m=p.get(c);return m?(p.set(c,{...m,bufferChunks:[],bufferLength:0,updatedAt:Date.now()}),{sessions:p}):h})},removeTerminalSession:c=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),e(h=>{const p=new Map(h.sessions);return p.delete(c),{sessions:p}}),gw(c),bw(c)},clearAllTerminalSessions:()=>{r.pendingChunksBySession.clear(),r.activitySessionIds.clear(),r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),e({sessions:new Map,nextChunkId:1}),vw(),yw()}}}),cx="\x1B[?2026h",ww="\x1B[?2026l",ux="\x1Bc";function Aw(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,s)=>{if(t===ux||t.endsWith("!p"))return t+cx;if(r===void 0)return t;const i=r.split(";").filter(u=>Number(u)!==2026);return i.length?`\x1B[?${i.join(";")}${s}`:""})}function Tw(e){const t=e.filter(s=>s.length>0).join("");if(!t)return[];const r=Aw(t.replace(/^(?:\x1bc)+/,""));return[`${ux}${cx}${r}${ww}`]}function Cw(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const Sw={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},_w={F1:"P",F2:"Q",F3:"R",F4:"S"},Lw={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 Iw(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:s,altKey:i,ctrlKey:u}=e,c=1+Number(s)+2*Number(i)+4*Number(u),h=c===1?"":`;${c}`,p=Sw[r];if(p)return c!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const m=_w[r];if(m)return c!==1?`\x1B[1${h}${m}`:`\x1BO${m}`;if(r==="Insert"&&!i&&(s||u))return null;const x=Lw[r];if(x)return`\x1B[${x}${h}~`;if(r==="Tab")return i?`\x1B${s?"\x1B[Z":" "}`:s?"\x1B[Z":" ";if(r==="Escape")return i?"\x1B\x1B":"\x1B";if(r==="Enter")return i?"\x1B\r":null;if(r==="Backspace")return u||i?`${i?"\x1B":""}${u?"\b":""}`:null;if(r.length!==1)return null;if(u){const b=r.toUpperCase();let v;return/^[A-Z]$/.test(b)?v=b.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?v=0:"[\\]^_".includes(r)?v=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?v=Number(r)+24:r==="?"||r==="8"?v=127:r==="/"&&(v=31),v===void 0?null:`${i?"\x1B":""}${String.fromCharCode(v)}`}return i?`\x1B${r}`:null}async function kw(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:s}=await kp("/tmp",[r]);if(!s[0]?.path)throw new Error("Upload did not return an image path");return s[0].path}async function Am(e){const t=Vs();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 s=r.types.find(c=>c.startsWith("image/"));if(!s)continue;const i=await r.getType(s),u=s==="image/jpeg"?"jpg":s.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([i],`termdock-clipboard-${Date.now()}.${u}`,{type:s})}return null}function Gs(e){return{dispose:e}}function Ew(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function Rw(...e){return Gs(()=>Ew(e))}var dx=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()}},e0=class{constructor(){this._store=new dx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};e0.None=Object.freeze({dispose(){}});var lc=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}},hx=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),ou=hx?"node":navigator.userAgent,Mw=hx?"node":navigator.platform,Nw=ou.includes("Firefox");ou.includes("Chrome");var Dw=ou.includes("Edge"),fx=/^((?!chrome|android).)*safari/i.test(ou);function Bw(){if(!fx)return 0;let e=ou.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}Mw.indexOf("Linux")>=0;var ri=0,ni=0,si=0,us=0,Po={css:"#00000000",rgba:0},Ki;(e=>{function t(i,u,c,h){return h!==void 0?`#${Nl(i)}${Nl(u)}${Nl(c)}${Nl(h)}`:`#${Nl(i)}${Nl(u)}${Nl(c)}`}e.toCss=t;function r(i,u,c,h=255){return(i<<24|u<<16|c<<8|h)>>>0}e.toRgba=r;function s(i,u,c,h){return{css:e.toCss(i,u,c,h),rgba:e.toRgba(i,u,c,h)}}e.toColor=s})(Ki||={});var Qc;(e=>{function t(p,m){if(us=(m.rgba&255)/255,us===1)return{css:m.css,rgba:m.rgba};let x=m.rgba>>24&255,b=m.rgba>>16&255,v=m.rgba>>8&255,w=p.rgba>>24&255,I=p.rgba>>16&255,k=p.rgba>>8&255;ri=w+Math.round((x-w)*us),ni=I+Math.round((b-I)*us),si=k+Math.round((v-k)*us);let N=Ki.toCss(ri,ni,si),R=Ki.toRgba(ri,ni,si);return{css:N,rgba:R}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,m,x){let b=Vl.ensureContrastRatio(p.rgba,m.rgba,x);if(b)return Ki.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=s;function i(p){let m=(p.rgba|255)>>>0;return[ri,ni,si]=Vl.toChannels(m),{css:Ki.toCss(ri,ni,si),rgba:m}}e.opaque=i;function u(p,m){return us=Math.round(m*255),[ri,ni,si]=Vl.toChannels(p.rgba),{css:Ki.toCss(ri,ni,si,us),rgba:Ki.toRgba(ri,ni,si,us)}}e.opacity=u;function c(p,m){return us=p.rgba&255,u(p,us*m/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Qc||={});var Qw;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let u=i.getContext("2d",{willReadFrequently:!0});u&&(t=u,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return ri=parseInt(i.slice(1,2).repeat(2),16),ni=parseInt(i.slice(2,3).repeat(2),16),si=parseInt(i.slice(3,4).repeat(2),16),Ki.toColor(ri,ni,si);case 5:return ri=parseInt(i.slice(1,2).repeat(2),16),ni=parseInt(i.slice(2,3).repeat(2),16),si=parseInt(i.slice(3,4).repeat(2),16),us=parseInt(i.slice(4,5).repeat(2),16),Ki.toColor(ri,ni,si,us);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let u=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(u)return ri=parseInt(u[1],10),ni=parseInt(u[2],10),si=parseInt(u[3],10),us=Math.round((u[5]===void 0?1:parseFloat(u[5]))*255),Ki.toColor(ri,ni,si,us);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ri,ni,si,us]=t.getImageData(0,0,1,1).data,us!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ki.toRgba(ri,ni,si,us),css:i}}e.toColor=s})(Qw||={});var qi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,i,u){let c=s/255,h=i/255,p=u/255,m=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),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return m*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(qi||={});var Vl;(e=>{function t(c,h){if(us=(h&255)/255,us===1)return h;let p=h>>24&255,m=h>>16&255,x=h>>8&255,b=c>>24&255,v=c>>16&255,w=c>>8&255;return ri=b+Math.round((p-b)*us),ni=v+Math.round((m-v)*us),si=w+Math.round((x-w)*us),Ki.toRgba(ri,ni,si)}e.blend=t;function r(c,h,p){let m=qi.relativeLuminance(c>>8),x=qi.relativeLuminance(h>>8);if(Fa(m,x)<p){if(x<m){let w=s(c,h,p),I=Fa(m,qi.relativeLuminance(w>>8));if(I<p){let k=i(c,h,p),N=Fa(m,qi.relativeLuminance(k>>8));return I>N?w:k}return w}let b=i(c,h,p),v=Fa(m,qi.relativeLuminance(b>>8));if(v<p){let w=s(c,h,p),I=Fa(m,qi.relativeLuminance(w>>8));return v>I?b:w}return b}}e.ensureContrastRatio=r;function s(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,w=h>>16&255,I=h>>8&255,k=Fa(qi.relativeLuminance2(v,w,I),qi.relativeLuminance2(m,x,b));for(;k<p&&(v>0||w>0||I>0);)v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),I-=Math.max(0,Math.ceil(I*.1)),k=Fa(qi.relativeLuminance2(v,w,I),qi.relativeLuminance2(m,x,b));return(v<<24|w<<16|I<<8|255)>>>0}e.reduceLuminance=s;function i(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,w=h>>16&255,I=h>>8&255,k=Fa(qi.relativeLuminance2(v,w,I),qi.relativeLuminance2(m,x,b));for(;k<p&&(v<255||w<255||I<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),I=Math.min(255,I+Math.ceil((255-I)*.1)),k=Fa(qi.relativeLuminance2(v,w,I),qi.relativeLuminance2(m,x,b));return(v<<24|w<<16|I<<8|255)>>>0}e.increaseLuminance=i;function u(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=u})(Vl||={});function Nl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Fa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Bs(e){if(!e)throw new Error("value must not be falsy");return e}function jp(e){return 57508<=e&&e<=57558}function jw(e){return 57520<=e&&e<=57527}function Pw(e){return 57344<=e&&e<=63743}function Ow(e){return 9472<=e&&e<=9631}function Fw(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 Uw(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!Fw(e)&&!jp(e)&&!Pw(e)}function px(e){return jp(e)||Ow(e)}function $w(){return{css:{canvas:Iu(),cell:Iu()},device:{canvas:Iu(),cell:Iu(),char:{width:0,height:0,left:0,top:0}}}}function Iu(){return{width:0,height:0}}function zw(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var me;(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})))(me||={});var Hw={"─":{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},"":me.LINE_H,"":me.LINE_V,"":me.FADE_RIGHT,"":me.FADE_LEFT,"":me.FADE_DOWN,"":me.FADE_UP,"":me.CURVE_DOWN_RIGHT,"":me.CURVE_DOWN_LEFT,"":me.CURVE_UP_RIGHT,"":me.CURVE_UP_LEFT,"":[me.LINE_V,me.CURVE_UP_RIGHT],"":[me.LINE_V,me.CURVE_DOWN_RIGHT],"":[me.CURVE_DOWN_RIGHT,me.CURVE_UP_RIGHT],"":[me.LINE_V,me.CURVE_UP_LEFT],"":[me.LINE_V,me.CURVE_DOWN_LEFT],"":[me.CURVE_DOWN_LEFT,me.CURVE_UP_LEFT],"":[me.LINE_H,me.CURVE_DOWN_LEFT],"":[me.LINE_H,me.CURVE_DOWN_RIGHT],"":[me.CURVE_DOWN_LEFT,me.CURVE_DOWN_RIGHT],"":[me.LINE_H,me.CURVE_UP_LEFT],"":[me.LINE_H,me.CURVE_UP_RIGHT],"":[me.CURVE_UP_LEFT,me.CURVE_UP_RIGHT],"":[me.LINE_V,me.CURVE_UP_LEFT,me.CURVE_UP_RIGHT],"":[me.LINE_V,me.CURVE_DOWN_LEFT,me.CURVE_DOWN_RIGHT],"":[me.LINE_H,me.CURVE_DOWN_LEFT,me.CURVE_UP_LEFT],"":[me.LINE_H,me.CURVE_DOWN_RIGHT,me.CURVE_UP_RIGHT],"":[me.LINE_V,me.CURVE_DOWN_RIGHT,me.CURVE_UP_LEFT],"":[me.LINE_V,me.CURVE_DOWN_LEFT,me.CURVE_UP_RIGHT],"":[me.LINE_H,me.CURVE_DOWN_RIGHT,me.CURVE_UP_LEFT],"":[me.LINE_H,me.CURVE_DOWN_LEFT,me.CURVE_UP_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE],"":me.NODE_STROKE,"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_LEFT],"":[me.NODE_STROKE,me.NODE_LINE_LEFT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_DOWN],"":[me.NODE_STROKE,me.NODE_LINE_DOWN],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP],"":[me.NODE_STROKE,me.NODE_LINE_UP],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_UP],"":[me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_UP],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT],"":[me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_LEFT],"":[me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_LEFT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_DOWN,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_DOWN,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT],"":[me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_FILL,me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"":[me.NODE_STROKE,me.NODE_LINE_UP,me.NODE_LINE_DOWN,me.NODE_LINE_LEFT,me.NODE_LINE_RIGHT],"🬀":sr(1),"🬁":sr(2),"🬂":sr(3),"🬃":sr(4),"🬄":sr(5),"🬅":sr(6),"🬆":sr(7),"🬇":sr(8),"🬈":sr(9),"🬉":sr(10),"🬊":sr(11),"🬋":sr(12),"🬌":sr(13),"🬍":sr(14),"🬎":sr(15),"🬏":sr(16),"🬐":sr(17),"🬑":sr(18),"🬒":sr(19),"🬓":sr(20),"🬔":sr(22),"🬕":sr(23),"🬖":sr(24),"🬗":sr(25),"🬘":sr(26),"🬙":sr(27),"🬚":sr(28),"🬛":sr(29),"🬜":sr(30),"🬝":sr(31),"🬞":sr(32),"🬟":sr(33),"🬠":sr(34),"🬡":sr(35),"🬢":sr(36),"🬣":sr(37),"🬤":sr(38),"🬥":sr(39),"🬦":sr(40),"🬧":sr(41),"🬨":sr(43),"🬩":sr(44),"🬪":sr(45),"🬫":sr(46),"🬬":sr(47),"🬭":sr(48),"🬮":sr(49),"🬯":sr(50),"🬰":sr(51),"🬱":sr(52),"🬲":sr(53),"🬳":sr(54),"🬴":sr(55),"🬵":sr(56),"🬶":sr(57),"🬷":sr(58),"🬸":sr(59),"🬹":sr(60),"🬺":sr(61),"🬻":sr(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:xa(126),type:0},scaleType:1},"🯱":{type:5,data:{d:xa(48),type:0},scaleType:1},"🯲":{type:5,data:{d:xa(109),type:0},scaleType:1},"🯳":{type:5,data:{d:xa(121),type:0},scaleType:1},"🯴":{type:5,data:{d:xa(51),type:0},scaleType:1},"🯵":{type:5,data:{d:xa(91),type:0},scaleType:1},"🯶":{type:5,data:{d:xa(95),type:0},scaleType:1},"🯷":{type:5,data:{d:xa(114),type:0},scaleType:1},"🯸":{type:5,data:{d:xa(127),type:0},scaleType:1},"🯹":{type:5,data:{d:xa(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}]))},Ww=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function sr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],s=[0,3/8,5/8];for(let i=0;i<3;i++){let u=e>>i*2&1,c=e>>i*2+1&1;u&&c?t.push(`M0,${s[i]} L1,${s[i]} L1,${s[i]+r[i]} L0,${s[i]+r[i]} Z`):u?t.push(`M0,${s[i]} L${.5},${s[i]} L${.5},${s[i]+r[i]} L0,${s[i]+r[i]} Z`):c&&t.push(`M${.5},${s[i]} L1,${s[i]} L1,${s[i]+r[i]} L${.5},${s[i]+r[i]} Z`)}return t.join(" ")}}}function xa(e){let t=[];if(e&64){let r=.21500000000000002,s=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${s-.075},${.175} L${s},${.2125} L${s-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,s=.95-.15/2,i=.95,u=.175+.075+.015,c=.5-.015;t.push(`M${s},${u} L${i},${u+.0375} L${i},${c-.0375} L${s},${c} L${r},${c-.0375} L${r},${u+.0375} Z`)}if(e&16){let r=.7999999999999999,s=.95-.15/2,i=.95,u=.5+.015,c=.825-.075-.015;t.push(`M${s},${u} L${i},${u+.0375} L${i},${c-.0375} L${s},${c} L${r},${c-.0375} L${r},${u+.0375} Z`)}if(e&8){let r=.21500000000000002,s=.95-.15-.015;t.push(`M${r},${.7875} L${r+.075},${.75} L${s-.075},${.75} L${s},${.7875} L${s-.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,s=.95-.15-.015;t.push(`M${r},${.5} L${r+.075},${.4625} L${s-.075},${.4625} L${s},${.5} L${s-.075},${.5375} L${r+.075},${.5375} Z`)}return t.join(" ")}var xi=0,Js=0,ba=!1,Ua=!1,ku=!1,io,cc=0,Gw=class{constructor(e,t,r,s,i,u){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=i,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s,i){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Js=0,xi=0,Ua=!1,ba=!1,ku=!1,io=this._themeService.colors,cc=0;let u=e.getCode();if(u!==0&&e.extended.underlineStyle===4){let c=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));cc=t*s%(Math.round(c)*2)}if(cc===0&&Ww.has(u)&&(cc=t*s%2*2+r*i%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",c=>{c.backgroundColorRGB&&(Js=c.backgroundColorRGB.rgba>>8&16777215,Ua=!0),c.foregroundColorRGB&&(xi=c.foregroundColorRGB.rgba>>8&16777215,ba=!0)}),ku=this._selectionRenderModel.isCellSelected(this._terminal,t,r),ku){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Js=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Js=(this.result.fg&16777215)<<8|255;break;default:Js=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Js=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Js=(this.result.bg&16777215)<<8|255;break}Js=Vl.blend(Js,(this._coreBrowserService.isFocused?io.selectionBackgroundOpaque:io.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Js=(this._coreBrowserService.isFocused?io.selectionBackgroundOpaque:io.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ua=!0,io.selectionForeground&&(xi=io.selectionForeground.rgba>>8&16777215,ba=!0),px(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)xi=(this._coreBrowserService.isFocused?io.selectionBackgroundOpaque:io.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:xi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:xi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:xi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:xi=(this.result.fg&16777215)<<8|255;break;default:xi=this._themeService.colors.foreground.rgba}xi=Vl.blend(xi,(this._coreBrowserService.isFocused?io.selectionBackgroundOpaque:io.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ba=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",c=>{c.backgroundColorRGB&&(Js=c.backgroundColorRGB.rgba>>8&16777215,Ua=!0),c.foregroundColorRGB&&(xi=c.foregroundColorRGB.rgba>>8&16777215,ba=!0)}),Ua&&(ku?Js=e.bg&-16777216&-134217729|Js|50331648:Js=e.bg&-16777216|Js|50331648),ba&&(xi=e.fg&-16777216&-67108865|xi|50331648),this.result.fg&67108864&&(Ua&&!ba&&((this.result.bg&50331648)===0?xi=this.result.fg&-134217728|io.background.rgba>>8&16777215&16777215|50331648:xi=this.result.fg&-134217728|this.result.bg&67108863,ba=!0),!Ua&&ba&&((this.result.fg&50331648)===0?Js=this.result.bg&-67108864|io.foreground.rgba>>8&16777215&16777215|50331648:Js=this.result.bg&-67108864|this.result.fg&67108863,Ua=!0)),io=void 0,this.result.bg=Ua?Js:this.result.bg,this.result.fg=ba?xi:this.result.fg,this.result.ext&=536870911,this.result.ext|=cc<<29&3758096384}},Vw=.5,mx=Nw||Dw?"bottom":"ideographic";function qw(e,t,r,s,i,u,c,h,p,m,x,b,v=0){let w=Hw[t];if(w){let I=Array.isArray(w)?w:[w];for(let k of I)Zw(e,k,r,s,i,u,c,h,p,m,x,b,v);return!0}return!1}function Zw(e,t,r,s,i,u,c,h,p,m,x,b,v=0){let w=i,I=u,k=r,N=s;switch(t.scaleType===1&&(w=c,I=h,k=r+(i-c)/2,N=s+(u-h)/2),t.clipPath&&(e.save(),nA(e,t.clipPath,k,N,w,I)),t.type){case 0:Yw(e,t.data,k,N,w,I);break;case 1:tA(e,t.data,k,N,w,I,v);break;case 2:rA(e,t.data,k,N,w,I,m,x,t.strokeWidth);break;case 3:Xw(e,t.data,k,N,w,I,m,t.strokeWidth);break;case 4:eA(e,t.data,k,N,w,I,m,b);break;case 5:sA(e,t.data,k,N,w,I,p,m,x);break;case 6:Kw(e,t.data,k,N,w,I);break}t.clipPath&&e.restore()}function Yw(e,t,r,s,i,u){for(let c=0;c<t.length;c++){let h=t[c],p=i/8,m=u/8;e.fillRect(r+h.x*p,s+h.y*m,h.w*p,h.h*m)}}var Tm=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function Kw(e,t,r,s,i,u){let c=i/8,h=u*.1,p=u*.8/8,m=Math.min(c,p);for(let x=0;x<8;x++)if(t&1<<x){let b=Tm[x*2],v=Tm[x*2+1],w=r+(b+1)*c,I=s+h+(v+1)*p;e.beginPath(),e.arc(w,I,m,0,Math.PI*2),e.fill()}}function Xw(e,t,r,s,i,u,c,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let m=0,x=0,b=0,v=0,w="";for(let I of p.split(" ")){let k=I[0],N=I.substring(1).split(",");if(k==="Z"){e.closePath(),w=k;continue}if(k==="V"){let D=s+parseFloat(N[0])*u;e.lineTo(m,D),x=D,b=m,v=x,w=k;continue}if(k==="H"){let D=r+parseFloat(N[0])*i;e.lineTo(D,x),m=D,b=m,v=x,w=k;continue}if(!N[0]||!N[1])continue;if(k==="A"){let D=parseFloat(N[0])*i,P=parseFloat(N[1])*u,V=parseFloat(N[2])*Math.PI/180,F=parseInt(N[3],10),Y=parseInt(N[4],10),Z=r+parseFloat(N[5])*i,he=s+parseFloat(N[6])*u;Jw(e,m,x,D,P,V,F,Y,Z,he),m=Z,x=he;continue}let R=N.map((D,P)=>{let V=parseFloat(D);return P%2===0?r+V*i:s+V*u});if(k==="M")e.moveTo(R[0],R[1]),m=R[0],x=R[1],b=m,v=x;else if(k==="L")e.lineTo(R[0],R[1]),m=R[0],x=R[1],b=m,v=x;else if(k==="Q")e.quadraticCurveTo(R[0],R[1],R[2],R[3]),b=R[0],v=R[1],m=R[2],x=R[3];else if(k==="T"){let D,P;w==="Q"||w==="T"?(D=2*m-b,P=2*x-v):(D=m,P=x),e.quadraticCurveTo(D,P,R[0],R[1]),b=D,v=P,m=R[0],x=R[1]}else k==="C"&&(e.bezierCurveTo(R[0],R[1],R[2],R[3],R[4],R[5]),b=R[2],v=R[3],m=R[4],x=R[5]);w=k}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*h,e.stroke()):e.fill()}function Jw(e,t,r,s,i,u,c,h,p,m){if(s===0||i===0){e.lineTo(p,m);return}s=Math.abs(s),i=Math.abs(i);let x=Math.cos(u),b=Math.sin(u),v=(t-p)/2,w=(r-m)/2,I=x*v+b*w,k=-b*v+x*w,N=s*s,R=i*i,D=I*I,P=k*k,V=D/N+P/R;if(V>1){let ce=Math.sqrt(V);s*=ce,i*=ce,N=s*s,R=i*i}let F=(N*R-N*P-R*D)/(N*P+R*D);F<0&&(F=0);let Y=(c===h?-1:1)*Math.sqrt(F),Z=Y*(s*k/i),he=Y*-(i*I/s),Ee=x*Z-b*he+(t+p)/2,Ie=b*Z+x*he+(r+m)/2,be=(I-Z)/s,et=(k-he)/i,Pe=(-I-Z)/s,fe=(-k-he)/i,De=Math.atan2(et,be),pe=Math.atan2(fe,Pe)-De;h===0&&pe>0?pe-=2*Math.PI:h===1&&pe<0&&(pe+=2*Math.PI);let ae=De+pe;e.ellipse(Ee,Ie,s,i,u,De,ae,h===0)}function eA(e,t,r,s,i,u,c,h){e.save(),e.fillRect(r,s,i,u),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=c,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let m=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){m==="Z"&&e.closePath();continue}let b=x.map((v,w)=>{let I=parseFloat(v);return w%2===0?r+I*i:s+I*u});m==="M"?e.moveTo(b[0],b[1]):m==="L"&&e.lineTo(b[0],b[1])}t.type===1?e.stroke():e.fill(),e.restore()}var Cm=new Map;function tA(e,t,r,s,i,u,c=0){let h=Cm.get(t);h||(h=new Map,Cm.set(t,h));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let m=h.get(p);if(!m){let v=t[0].length,w=t.length,I=e.canvas.ownerDocument.createElement("canvas");I.width=v,I.height=w;let k=Bs(I.getContext("2d")),N=new ImageData(v,w),R,D,P,V;if(p.startsWith("#"))R=parseInt(p.slice(1,3),16),D=parseInt(p.slice(3,5),16),P=parseInt(p.slice(5,7),16),V=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[R,D,P,V]=p.substring(5,p.length-1).split(",").map(F=>parseFloat(F));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let F=0;F<w;F++)for(let Y=0;Y<v;Y++)N.data[(F*v+Y)*4]=R,N.data[(F*v+Y)*4+1]=D,N.data[(F*v+Y)*4+2]=P,N.data[(F*v+Y)*4+3]=t[F][Y]*(V*255);k.putImageData(N,0,0),m=Bs(e.createPattern(I,null)),h.set(p,m)}let x=c>>1&1,b=c&1;x!==0||b!==0?m.setTransform(new DOMMatrix().translateSelf(-x,-b)):m.setTransform(new DOMMatrix),e.fillStyle=m,e.fillRect(r,s,i,u)}function rA(e,t,r,s,i,u,c,h,p){e.save(),e.beginPath(),e.rect(r,s,i,u),e.clip(),e.beginPath();let m;if(typeof t=="function"){let b=.15/u*i;m=t(.15,b)}else m=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of m.split(" ")){let v=b[0];if(v==="Z"){e.closePath(),x.lastCommand=v;continue}let w=gx[v];if(!w){h.error(`Could not find drawing instructions for "${v}"`);continue}let I=b.substring(1).split(",");!I[0]||!I[1]||(w(e,xx(I,i,u,r,s,!0,c,0,0,!1),x),x.lastCommand=v)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function nA(e,t,r,s,i,u){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 m=r+parseFloat(p[0])*i,x=s+parseFloat(p[1])*u;h==="M"?e.moveTo(m,x):h==="L"&&e.lineTo(m,x)}e.clip()}function sA(e,t,r,s,i,u,c,h,p){let m=new Path2D;m.rect(r,s,i,u),e.clip(m),e.beginPath();let x=c/12;e.lineWidth=h*x;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let v of t.d.split(" ")){let w=v[0];if(w==="Z"){e.closePath(),b.lastCommand=w;continue}let I=gx[w];if(!I){p.error(`Could not find drawing instructions for "${w}"`);continue}let k=v.substring(1).split(",");!k[0]||!k[1]||(I(e,xx(k,i,u,r,s,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),b),b.lastCommand=w)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Sm(e,t,r=0){return Math.max(Math.min(e,t),r)}var gx={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 s,i;r.lastCommand==="Q"||r.lastCommand==="T"?(s=2*r.currentX-r.lastControlX,i=2*r.currentY-r.lastControlY):(s=r.currentX,i=r.currentY),e.quadraticCurveTo(s,i,t[0],t[1]),r.lastControlX=s,r.lastControlY=i,r.currentX=t[0],r.currentY=t[1]}};function xx(e,t,r,s,i,u,c,h=0,p=0,m=!0){let x=e.map(b=>parseFloat(b)||parseInt(b));if(x.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<x.length;b+=2){if(x[b]*=t-h*c-p*c,u&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=m?Sm(v,t,0):v}x[b]+=s+h*c}for(let b=1;b<x.length;b+=2){if(x[b]*=r,u&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=m?Sm(v,r,0):v}x[b]+=i}return x}var _m=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={}}},Lm=class{constructor(){this._data=new _m}set(e,t,r,s,i){this._data.get(e,t)||this._data.set(e,t,new _m),this._data.get(e,t).set(r,s,i)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}},bx=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,s=e.timeRemaining(),i;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),i=e.timeRemaining(),r*1.5>i){s-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=i}this.clear()}},iA=class extends bx{_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())}}},oA=class extends bx{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},aA="requestIdleCallback"in globalThis?oA:iA,R0=class yx{constructor(){this.fg=0,this.bg=0,this.extended=new vx}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 yx;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}},vx=class wx{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 wx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oa=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return Gs(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let u=Gs(()=>{let c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)});return s&&(Array.isArray(s)?s.push(u):s.add(u)),u},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:s}=this._listeners[0];r.call(s,t);return}default:{let r=this._listeners.slice();for(let{fn:s,thisArgs:i}of r)s.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Gl;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,m)=>u(x=>h.call(p,c(x)),void 0,m)}e.map=r;function s(...u){return(c,h,p)=>{let m=new dx;for(let x of u)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(Gl||={});var Im={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}},uc=2,dc,xl=class L0{constructor(t,r,s,i){this._document=t,this._config=r,this._unicodeService=s,this._logService=i,this._didWarmUp=!1,this._cacheMap=new Lm,this._cacheMapCombined=new Lm,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new R0,this._textureSize=512,this._onAddTextureAtlasCanvas=new oa,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new oa,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Tx(t,this._config.deviceCellWidth*4+uc*2,this._config.deviceCellHeight+uc*2),this._tmpCtx=Bs(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 aA(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let s=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,s)}})}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(L0.maxAtlasPages&&this._pages.length>=Math.max(4,L0.maxAtlasPages)){let r=this._pages.filter(m=>m.canvas.width*2<=(L0.maxTextureSize||4096)).sort((m,x)=>x.canvas.width!==m.canvas.width?x.canvas.width-m.canvas.width:x.percentageUsed-m.percentageUsed),s=-1,i=0;for(let m=0;m<r.length;m++)if(r[m].canvas.width!==i)s=m,i=r[m].canvas.width;else if(m-s===3)break;let u=r.slice(s,s+4);if(u.length<4||u.some(m=>m.canvas.width!==u[0].canvas.width)){let m=new Dl(this._document,this._textureSize);return this._pages.push(m),this._activePages.push(m),this._onAddTextureAtlasCanvas.fire(m.canvas),m}let c=u.map(m=>m.glyphs[0].texturePage).sort((m,x)=>m-x),h=this.pages.length-u.length,p=this._mergePages(u,h);p.version=++Dl.nextVersion;for(let m=c.length-1;m>=0;m--)this._deletePage(c[m]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new Dl(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let s=t[0].canvas.width*2,i=new Dl(this._document,s,t);for(let[u,c]of t.entries()){let h=u*c.canvas.width%s,p=Math.floor(u/2)*c.canvas.height;i.ctx.drawImage(c.canvas,h,p);for(let x of c.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/s,x.sizeClipSpace.y=x.size.y/s,x.texturePosition.x+=h,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/s,x.texturePositionClipSpace.y=x.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let m=this._activePages.indexOf(c);m!==-1&&this._activePages.splice(m,1)}return i}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let s=this._pages[r];for(let i of s.glyphs)i.texturePage--;s.version=++Dl.nextVersion}}getRasterizedGlyphCombinedChar(t,r,s,i,u,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,i,u,c)}getRasterizedGlyph(t,r,s,i,u,c){return this._getFromCacheMap(this._cacheMap,t,r,s,i,u,c)}_getFromCacheMap(t,r,s,i,u,c,h){return dc=t.get(r,s,i,u),dc||(dc=this._drawToCache(r,s,i,u,c,h),t.set(r,s,i,u,dc)),dc}_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,s,i){if(this._config.allowTransparency)return Po;let u;switch(t){case 16777216:case 33554432:u=this._getColorFromAnsiIndex(r);break;case 50331648:let c=R0.toColorRGB(r);u=Ki.toColor(c[0],c[1],c[2]);break;default:s?u=Qc.opaque(this._config.colors.foreground):u=this._config.colors.background;break}return this._config.allowTransparency||(u=Qc.opaque(u)),u}_getForegroundColor(t,r,s,i,u,c,h,p,m,x){let b=this._getMinimumContrastColor(t,r,s,i,u,c,h,m,p,x);if(b)return b;let v;switch(u){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&m&&c<8&&(c+=8),v=this._getColorFromAnsiIndex(c);break;case 50331648:let w=R0.toColorRGB(c);v=Ki.toColor(w[0],w[1],w[2]);break;default:h?v=this._config.colors.background:v=this._config.colors.foreground}return this._config.allowTransparency&&(v=Qc.opaque(v)),p&&(v=Qc.multiplyOpacity(v,Vw)),v}_resolveBackgroundRgba(t,r,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,s,i){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&i&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,s,i,u,c,h,p,m,x){if(this._config.minimumContrastRatio===1||x)return;let b=this._getContrastCache(m),v=b.getColor(t,i);if(v!==void 0)return v??void 0;let w=this._resolveBackgroundRgba(r,s,h),I=this._resolveForegroundRgba(u,c,h,p),k=Vl.ensureContrastRatio(w,I,this._config.minimumContrastRatio/(m?2:1));if(!k){b.setColor(t,i,null);return}let N=Ki.toColor(k>>24&255,k>>16&255,k>>8&255);return b.setColor(t,i,N),N}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,i,u,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)+uc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let m=Math.min(this._config.deviceCellHeight+uc*4,this._textureSize);if(this._tmpCanvas.height<m&&(this._tmpCanvas.height=m),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=i,!!this._workAttributeData.isInvisible())return Im;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),v=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),I=!!this._workAttributeData.isUnderline(),k=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),D=this._workAttributeData.getFgColorMode(),P=this._workAttributeData.getBgColor(),V=this._workAttributeData.getBgColorMode();if(b){let we=R;R=P,P=we;let Ge=D;D=V,V=Ge}let F=this._getBackgroundColor(V,P,b,v);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=F.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let Y=x?this._config.fontWeightBold:this._config.fontWeight,Z=w?"italic":"";this._tmpCtx.font=`${Z} ${Y} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=mx;let he=h.length===1&&jp(h.charCodeAt(0)),Ee=h.length===1&&jw(h.charCodeAt(0)),Ie=this._getForegroundColor(r,V,P,s,D,R,b,v,x,px(h.charCodeAt(0)));this._tmpCtx.fillStyle=Ie.css;let be=Ee?0:uc*2,et=!1;if(this._config.customGlyphs!==!1){let we=this._workAttributeData.getUnderlineVariantOffset();et=qw(this._tmpCtx,h,be,be,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,F.css,we)}let Pe=!he,fe;if(typeof t=="number"?fe=this._unicodeService.wcwidth(t):fe=this._unicodeService.getStringCellWidth(t),I){this._tmpCtx.save();let we=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ge=we%2===1?.5:0;if(this._tmpCtx.lineWidth=we,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Pe=!1,this._tmpCtx.strokeStyle=`rgb(${R0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Pe=!1;let Xe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Xe<8&&(Xe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Xe).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let ie=be,ve=Math.ceil(be+this._config.deviceCharHeight)-Ge-(u?we*2:0),ft=ve+we*2,Rt=this._workAttributeData.getUnderlineVariantOffset(),He=0,K=0;for(let Xe=0;Xe<fe;Xe++){let Ce=!1;this._tmpCtx.save(),He=ve,K=ft;let z=ie+Xe*this._config.deviceCellWidth,q=ie+(Xe+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(z,ve),this._tmpCtx.lineTo(q,ve),this._tmpCtx.moveTo(z,ft),this._tmpCtx.lineTo(q,ft);break;case 3:He=this._config.deviceCharHeight+1,K=He+3*this._config.devicePixelRatio;let ye=new Path2D;ye.rect(z,He,this._config.deviceCellWidth,K-He),this._tmpCtx.clip(ye);let Ve=this._config.deviceCellWidth,pt=K-He,ht=Ve/6,It=pt/3,Se=[[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 ir of Se){this._tmpCtx.beginPath();for(let it=0;it<ir.length;it+=2){let dt=z+ir[it]*ht,Bt=K-ir[it+1]*It;it===0?this._tmpCtx.moveTo(dt,Bt):this._tmpCtx.lineTo(dt,Bt)}this._tmpCtx.closePath(),this._tmpCtx.fill()}Ce=!0;break;case 4:let ge=Rt===0?0:Rt>=we?we*2-Rt:we-Rt;Rt>=we||ge===0?(this._tmpCtx.setLineDash([Math.round(we),Math.round(we)]),this._tmpCtx.moveTo(z+ge,ve),this._tmpCtx.lineTo(q,ve)):(this._tmpCtx.setLineDash([Math.round(we),Math.round(we)]),this._tmpCtx.moveTo(z,ve),this._tmpCtx.lineTo(z+ge,ve),this._tmpCtx.moveTo(z+ge+we,ve),this._tmpCtx.lineTo(q,ve)),Rt=zw(q-z,we,Rt);break;case 5:let Ue=.6,bt=.3,Ke=q-z,Mt=Math.floor(Ue*Ke),We=Math.floor(bt*Ke),vt=Ke-Mt-We;this._tmpCtx.setLineDash([Mt,We,vt]),this._tmpCtx.moveTo(z,ve),this._tmpCtx.lineTo(q,ve);break;default:this._tmpCtx.moveTo(z,ve),this._tmpCtx.lineTo(q,ve);break}Ce||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!et&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Xe=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Xe&&Xe.actualBoundingBoxDescent>0){this._tmpCtx.save();let Ce=new Path2D;Ce.rect(ie,He-Math.ceil(we/2),this._config.deviceCellWidth*fe,K-He+Math.ceil(we/2)),this._tmpCtx.clip(Ce),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=F.css,this._tmpCtx.strokeText(h,be,be+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){let we=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ge=we%2===1?.5:0;this._tmpCtx.lineWidth=we,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(be,be+Ge),this._tmpCtx.lineTo(be+this._config.deviceCharWidth*fe,be+Ge),this._tmpCtx.stroke()}if(et||this._tmpCtx.fillText(h,be,be+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let we=Nh(this._tmpCtx.getImageData(be,be,this._config.deviceCellWidth,this._config.deviceCellHeight),F,Ie,Pe);if(we)for(let Ge=1;Ge<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=F.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,be,be+this._config.deviceCharHeight-Ge),we=Nh(this._tmpCtx.getImageData(be,be,this._config.deviceCellWidth,this._config.deviceCellHeight),F,Ie,Pe),!!we);Ge++);}if(k){let we=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ge=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=we,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(be,be+Math.floor(this._config.deviceCharHeight/2)-Ge),this._tmpCtx.lineTo(be+this._config.deviceCharWidth*fe,be+Math.floor(this._config.deviceCharHeight/2)-Ge),this._tmpCtx.stroke()}this._tmpCtx.restore();let De=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),pe;if(this._config.allowTransparency?pe=lA(De):pe=Nh(De,F,Ie,Pe),pe)return Im;let ae=this._findGlyphBoundingBox(De,this._workBoundingBox,p,Ee,et,be),ce,Te;for(;;){if(this._activePages.length===0){let we=this._createNewPage();ce=we,Te=we.currentRow,Te.height=ae.size.y;break}ce=this._activePages[this._activePages.length-1],Te=ce.currentRow;for(let we of this._activePages)ae.size.y<=we.currentRow.height&&(ce=we,Te=we.currentRow);for(let we=this._activePages.length-1;we>=0;we--)for(let Ge of this._activePages[we].fixedRows)Ge.height<=Te.height&&ae.size.y<=Ge.height&&(ce=this._activePages[we],Te=Ge);if(ae.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Dl(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),ce=this._overflowSizePage,Te=this._overflowSizePage.currentRow,Te.x+ae.size.x>=ce.canvas.width&&(Te.x=0,Te.y+=Te.height,Te.height=0);break}if(Te.y+ae.size.y>=ce.canvas.height||Te.height>ae.size.y+2){let we=!1;if(ce.currentRow.y+ce.currentRow.height+ae.size.y>=ce.canvas.height){let Ge;for(let ie of this._activePages)if(ie.currentRow.y+ie.currentRow.height+ae.size.y<ie.canvas.height){Ge=ie;break}if(Ge)ce=Ge;else if(L0.maxAtlasPages&&this._pages.length>=L0.maxAtlasPages&&Te.y+ae.size.y<=ce.canvas.height&&Te.height>=ae.size.y&&Te.x+ae.size.x<=ce.canvas.width)we=!0;else{let ie=this._createNewPage();ce=ie,Te=ie.currentRow,Te.height=ae.size.y,we=!0}}we||(ce.currentRow.height>0&&ce.fixedRows.push(ce.currentRow),Te={x:0,y:ce.currentRow.y+ce.currentRow.height,height:ae.size.y},ce.fixedRows.push(Te),ce.currentRow={x:0,y:Te.y+Te.height,height:0})}if(Te.x+ae.size.x<=ce.canvas.width)break;Te===ce.currentRow?(Te.x=0,Te.y+=Te.height,Te.height=0):ce.fixedRows.splice(ce.fixedRows.indexOf(Te),1)}return ae.texturePage=this._pages.indexOf(ce),ae.texturePosition.x=Te.x,ae.texturePosition.y=Te.y,ae.texturePositionClipSpace.x=Te.x/ce.canvas.width,ae.texturePositionClipSpace.y=Te.y/ce.canvas.height,ae.sizeClipSpace.x/=ce.canvas.width,ae.sizeClipSpace.y/=ce.canvas.height,Te.height=Math.max(Te.height,ae.size.y),Te.x+=ae.size.x,ce.ctx.putImageData(De,ae.texturePosition.x-this._workBoundingBox.left,ae.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ae.size.x,ae.size.y),ce.addGlyph(ae),ce.version=++Dl.nextVersion,ae}_findGlyphBoundingBox(t,r,s,i,u,c){r.top=0;let h=i?this._config.deviceCellHeight:this._tmpCanvas.height,p=i?this._config.deviceCellWidth:s,m=!1;for(let x=0;x<h;x++){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.top=x,m=!0;break}}if(m)break}r.left=0,m=!1;for(let x=0;x<c+p;x++){for(let b=0;b<h;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.left=x,m=!0;break}}if(m)break}r.right=p,m=!1;for(let x=c+p-1;x>=c;x--){for(let b=0;b<h;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.right=x,m=!0;break}}if(m)break}r.bottom=h,m=!1;for(let x=h-1;x>=0;x--){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.bottom=x,m=!0;break}}if(m)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+(i||u?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(i||u?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Ax=class zf{constructor(t,r,s){if(this._usedPixels=0,this._glyphs=[],this.version=++zf.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=Tx(t,r,r),this.ctx=Bs(this.canvas.getContext("2d",{alpha:!0})),s)if(s.length===4)this._glyphs=this._glyphs.concat(s[0].glyphs,s[1].glyphs,s[2].glyphs,s[3].glyphs),this._usedPixels=s[0]._usedPixels+s[1]._usedPixels+s[2]._usedPixels+s[3]._usedPixels;else for(let i=0;i<s.length;++i)this._glyphs=this._glyphs.concat(s[i].glyphs),this._usedPixels+=s[i]._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=++zf.nextVersion}};Ax.nextVersion=0;var Dl=Ax;function Nh(e,t,r,s){let i=t.rgba>>>24,u=t.rgba>>>16&255,c=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,m=r.rgba>>>8&255,x=Math.floor((Math.abs(i-h)+Math.abs(u-p)+Math.abs(c-m))/12),b=!0;for(let v=0;v<e.data.length;v+=4)e.data[v]===i&&e.data[v+1]===u&&e.data[v+2]===c||s&&Math.abs(e.data[v]-i)+Math.abs(e.data[v+1]-u)+Math.abs(e.data[v+2]-c)<x?e.data[v+3]=0:b=!1;return b}function lA(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function Tx(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function cA(e,t,r,s,i,u,c,h,p=!0){let m={foreground:u.foreground,background:u.background,cursor:Po,cursorAccent:Po,selectionForeground:Po,selectionBackgroundTransparent:Po,selectionBackgroundOpaque:Po,selectionInactiveBackgroundTransparent:Po,selectionInactiveBackgroundOpaque:Po,overviewRulerBorder:Po,scrollbarSliderBackground:Po,scrollbarSliderHoverBackground:Po,scrollbarSliderActiveBackground:Po,ansi:u.ansi.slice(),contrastCache:u.contrastCache,halfContrastCache:u.halfContrastCache};return{customGlyphs:p,devicePixelRatio:c,deviceMaxTextureSize:h,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:m}}function km(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 uA(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Oo=[];function Cx(e,t,r,s,i,u,c,h,p,m=!0){let x=cA(s,i,u,c,t,r,h,p,m);for(let I=0;I<Oo.length;I++){let k=Oo[I],N=k.ownedBy.indexOf(e);if(N>=0){if(km(k.config,x))return k.atlas;k.ownedBy.length===1?(k.atlas.dispose(),Oo.splice(I,1)):k.ownedBy.splice(N,1);break}}for(let I=0;I<Oo.length;I++){let k=Oo[I];if(km(k.config,x))return k.ownedBy.push(e),k.atlas}let b=e._core,v=b._logService,w={atlas:new xl(document,x,b.unicodeService,v),config:x,ownedBy:[e]};return Oo.push(w),w.atlas}function Em(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 dA=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 Rm(e,t,r){let s=new t.ResizeObserver(i=>{let u=i.find(p=>p.target===e);if(!u)return;if(!("devicePixelContentBoxSize"in u)){s?.disconnect(),s=void 0;return}let c=u.devicePixelContentBoxSize[0].inlineSize,h=u.devicePixelContentBoxSize[0].blockSize;c>0&&h>0&&r(c,h)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Gs(()=>s?.disconnect())}function hA(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var fA=class Sx extends R0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new vx,this.combinedData=""}static fromCharData(t){let r=new Sx;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?hA(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 s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(s-55296)*1024+i-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(),s=t.isUnderlineColorDefault();if(!(r&&s)&&(r!==s||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())}},pA=class extends e0{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",s=>{this.setIntervalDuration(s)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Gs(()=>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)}},_x=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Lx(e,t,r,s){let i=Bs(e.createProgram());if(e.attachShader(i,Bs(Mm(e,e.VERTEX_SHADER,t,s))),e.attachShader(i,Bs(Mm(e,e.FRAGMENT_SHADER,r,s))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;s.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function Mm(e,t,r,s){let i=Bs(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;s.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function mA(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let i=0;i<e.length;i++)s[i]=e[i];return s}var gA=class{constructor(t){this.texture=t,this.version=-1}},xA=`#version 300 es
5
- layout (location = 0) in vec2 a_unitquad;
6
- layout (location = 1) in vec2 a_cellpos;
7
- layout (location = 2) in vec2 a_offset;
8
- layout (location = 3) in vec2 a_size;
9
- layout (location = 4) in float a_texpage;
10
- layout (location = 5) in vec2 a_texcoord;
11
- layout (location = 6) in vec2 a_texsize;
12
-
13
- uniform mat4 u_projection;
14
- uniform vec2 u_resolution;
15
-
16
- out vec2 v_texcoord;
17
- flat out int v_texpage;
18
-
19
- void main() {
20
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
21
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
22
- v_texpage = int(a_texpage);
23
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
24
- }`;function bA(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
25
- precision lowp float;
26
-
27
- in vec2 v_texcoord;
28
- flat in int v_texpage;
29
-
30
- uniform sampler2D u_texture[${e}];
31
-
32
- out vec4 outColor;
33
-
34
- void main() {
35
- if (v_texpage == 0) {
36
- outColor = texture(u_texture[0], v_texcoord);
37
- } ${t}
38
- }`}var cs=0,qn,Dh=0,hc=0,yA=class extends e0{constructor(t,r,s,i,u){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._optionsService=i,this._logService=u,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let c=this._gl;xl.maxAtlasPages===void 0&&(xl.maxAtlasPages=Math.min(32,Bs(c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS))),xl.maxTextureSize=Bs(c.getParameter(c.MAX_TEXTURE_SIZE))),this._program=Bs(Lx(c,xA,bA(xl.maxAtlasPages),this._logService)),this._register(Gs(()=>c.deleteProgram(this._program))),this._projectionLocation=Bs(c.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Bs(c.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Bs(c.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=c.createVertexArray();this._register(Gs(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),m=c.createBuffer();this._register(Gs(()=>c.deleteBuffer(m))),c.bindBuffer(c.ARRAY_BUFFER,m),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]),b=c.createBuffer();this._register(Gs(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Bs(c.createBuffer()),this._register(Gs(()=>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 v=new Int32Array(xl.maxAtlasPages);for(let w=0;w<xl.maxAtlasPages;w++)v[w]=w;c.uniform1iv(this._textureLocation,v),c.uniformMatrix4fv(this._projectionLocation,!1,_x),this._atlasTextures=[];for(let w=0;w<xl.maxAtlasPages;w++){let I=new gA(Bs(c.createTexture()));this._register(Gs(()=>c.deleteTexture(I.texture))),c.activeTexture(c.TEXTURE0+w),c.bindTexture(c.TEXTURE_2D,I.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]=I}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,s,i,u,c,h,p,m){this._updateCell(this._vertices.attributes,t,r,s,i,u,c,h,p,m)}_updateCell(t,r,s,i,u,c,h,p,m,x){if(cs=(s*this._terminal.cols+r)*11,i===0||i===void 0){t.fill(0,cs,cs+11-1-2);return}this._atlas&&(p&&p.length>1?qn=this._atlas.getRasterizedGlyphCombinedChar(p,u,c,h,!1,this._terminal.element):qn=this._atlas.getRasterizedGlyph(i,u,c,h,!1,this._terminal.element),Dh=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),u!==x&&qn.offset.x>Dh?(hc=qn.offset.x-Dh,t[cs]=-(qn.offset.x-hc)+this._dimensions.device.char.left,t[cs+1]=-qn.offset.y+this._dimensions.device.char.top,t[cs+2]=(qn.size.x-hc)/this._dimensions.device.canvas.width,t[cs+3]=qn.size.y/this._dimensions.device.canvas.height,t[cs+4]=qn.texturePage,t[cs+5]=qn.texturePositionClipSpace.x+hc/this._atlas.pages[qn.texturePage].canvas.width,t[cs+6]=qn.texturePositionClipSpace.y,t[cs+7]=qn.sizeClipSpace.x-hc/this._atlas.pages[qn.texturePage].canvas.width,t[cs+8]=qn.sizeClipSpace.y):(t[cs]=-qn.offset.x+this._dimensions.device.char.left,t[cs+1]=-qn.offset.y+this._dimensions.device.char.top,t[cs+2]=qn.size.x/this._dimensions.device.canvas.width,t[cs+3]=qn.size.y/this._dimensions.device.canvas.height,t[cs+4]=qn.texturePage,t[cs+5]=qn.texturePositionClipSpace.x,t[cs+6]=qn.texturePositionClipSpace.y,t[cs+7]=qn.sizeClipSpace.x,t[cs+8]=qn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Uw(i,m,qn.size.x,this._dimensions.device.cell.width)&&(t[cs+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 s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let i=0;i<t.rows;i++)for(let u=0;u<t.cols;u++)this._vertices.attributes[s+9]=u/t.cols,this._vertices.attributes[s+10]=i/t.rows,s+=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 s=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let u=0;u<t.lineLengths.length;u++){let c=u*this._terminal.cols*11,h=this._vertices.attributes.subarray(c,c+t.lineLengths[u]*11);s.set(h,i),i+=h.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,i),r.STREAM_DRAW);for(let u=0;u<this._atlas.pages.length;u++)this._atlas.pages[u].version!==this._atlasTextures[u].version&&this._bindAtlasPageTexture(r,this._atlas,u);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,i/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].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[s].canvas),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}},vA=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,s,i=!1){if(this.selectionStart=r,this.selectionEnd=s,!r||!s||r[0]===s[0]&&r[1]===s[1]){this.clear();return}let u=t.buffers.active.ydisp,c=r[1]-u,h=s[1]-u,p=Math.max(c,0),m=Math.min(h,t.rows-1);if(p>=t.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=r[0],this.endCol=s[0]}isCellSelected(t,r,s){return this.hasSelection?(s-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&s>=this.viewportCappedStartRow&&r<this.endCol&&s<=this.viewportCappedEndRow:r<this.startCol&&s>=this.viewportCappedStartRow&&r>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol):!1}};function wA(){return new vA}var AA=2147483648,TA=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=wA()}resize(t,r){let s=t*r*4;s!==this.cells.length&&(this.cells=new Uint32Array(s),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},CA=`#version 300 es
39
- layout (location = 0) in vec2 a_position;
40
- layout (location = 1) in vec2 a_size;
41
- layout (location = 2) in vec4 a_color;
42
- layout (location = 3) in vec2 a_unitquad;
43
-
44
- uniform mat4 u_projection;
45
-
46
- out vec4 v_color;
47
-
48
- void main() {
49
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
50
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
51
- v_color = a_color;
52
- }`,SA=`#version 300 es
53
- precision lowp float;
54
-
55
- in vec4 v_color;
56
-
57
- out vec4 outColor;
58
-
59
- void main() {
60
- outColor = v_color;
61
- }`,La=8,Bh=La*Float32Array.BYTES_PER_ELEMENT,_A=20*La,Nm=class{constructor(){this.attributes=new Float32Array(_A),this.count=0}},$a=0,Dm=0,Bm=0,Qm=0,jm=0,Pm=0,Om=0,LA=class extends e0{constructor(t,r,s,i,u){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._themeService=i,this._logService=u,this._vertices=new Nm,this._verticesCursor=new Nm;let c=this._gl;this._program=Bs(Lx(c,CA,SA,this._logService)),this._register(Gs(()=>c.deleteProgram(this._program))),this._projectionLocation=Bs(c.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=c.createVertexArray();this._register(Gs(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),m=c.createBuffer();this._register(Gs(()=>c.deleteBuffer(m))),c.bindBuffer(c.ARRAY_BUFFER,m),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]),b=c.createBuffer();this._register(Gs(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Bs(c.createBuffer()),this._register(Gs(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,Bh,0),c.vertexAttribDivisor(0,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Bh,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,Bh,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(v=>{this._updateCachedColors(v),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,_x),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,s=this._vertices,i=1,u,c,h,p,m,x,b,v,w,I,k;for(u=0;u<r.rows;u++){for(h=-1,p=0,m=0,x=!1,c=0;c<r.cols;c++)b=(u*r.cols+c)*4,v=t.cells[b+1],w=t.cells[b+2],I=!!(w&67108864),(v!==p||w!==m&&(x||I))&&((p!==0||x&&m!==0)&&(k=i++*La,this._updateRectangle(s,k,m,p,h,c,u)),h=c,p=v,m=w,x=I);(p!==0||x&&m!==0)&&(k=i++*La,this._updateRectangle(s,k,m,p,h,r.cols,u))}s.count=i}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let i,u=0;(s.style==="bar"||s.style==="outline")&&(i=u++*La,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(i=u++*La,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(i=u++*La,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),i=u++*La,this._addRectangleFloat(r.attributes,i,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=u}_updateRectangle(t,r,s,i,u,c,h){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:$a=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:$a=(s&16777215)<<8;break;default:$a=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:$a=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:$a=(i&16777215)<<8;break;default:$a=this._themeService.colors.background.rgba}t.attributes.length<r+La&&(t.attributes=mA(t.attributes,(this._terminal.rows*this._terminal.cols+1)*La)),Dm=u*this._dimensions.device.cell.width,Bm=h*this._dimensions.device.cell.height,Qm=($a>>24&255)/255,jm=($a>>16&255)/255,Pm=($a>>8&255)/255,Om=1,this._addRectangle(t.attributes,r,Dm,Bm,(c-u)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Qm,jm,Pm,Om)}_addRectangle(t,r,s,i,u,c,h,p,m,x){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=u/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]=m,t[r+7]=x}_addRectangleFloat(t,r,s,i,u,c,h){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=u/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])}},IA=class extends e0{constructor(e,t,r,s,i,u,c,h){super(),this._container=t,this._alpha=i,this._coreBrowserService=u,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=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(Gs(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Bs(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,s=!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=Cx(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,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=mx,this._clipCell(r,s,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,s*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 s=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},kA=class extends IA{constructor(t,r,s,i,u,c,h){super(s,t,"link",r,!0,u,c,h),this._register(i.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(i.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&&uA(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()}},EA=class{constructor(t,r,s,i){this._node=t,this._type=r,this._handler=s,this._options=i,t.addEventListener(r,s,i)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Qh(e,t,r,s){return new EA(e,t,r,s)}var RA=class extends e0{constructor(e,t,r,s,i,u,c,h,p,m=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=s,this._coreService=i,this._decorationService=u,this._logService=c,this._optionsService=h,this._themeService=p,this._customGlyphs=m,this._cursorBlinkStateManager=this._register(new lc),this._charAtlasDisposable=this._register(new lc),this._observerDisposable=this._register(new lc),this._model=new TA,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new fA,this._rectangleRenderer=this._register(new lc),this._glyphRenderer=this._register(new lc),this._onChangeTextureAtlas=this._register(new oa),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new oa),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new oa),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new oa),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new oa),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let b={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",b),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Gw(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new kA(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=$w(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new pA(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Qh(this._canvas,"webglcontextlost",v=>{this._logService.debug("webglcontextlost event received"),v.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(v)},3e3)})),this._register(Qh(this._canvas,"webglcontextrestored",v=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Em(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Rm(this._canvas,this._coreBrowserService.window,(v,w)=>this._setCanvasDevicePixelDimensions(v,w)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=Rm(this._canvas,v,(w,I)=>this._setCanvasDevicePixelDimensions(w,I))})),this._register(Qh(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(Gs(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),Em(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 s of this._renderLayers)s.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 LA(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new yA(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=Cx(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=Rw(Gl.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Gl.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 i of this._renderLayers)i.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,s=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&s++<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 dA(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,s=this._workCell,i,u,c,h,p,m,x,b,v,w,I,k,N,R,D,P,V;e=Fm(e,r.rows-1,0),t=Fm(t,r.rows-1,0);let F=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",Y=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,Z=Y-r.buffer.ydisp,he=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Ee=-1,Ie=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let be=!1;for(u=e;u<=t;u++){c=u+r.buffer.ydisp;let et=r.buffer.lines.get(c);if(!et){for(this._model.lineLengths[u]=0,P=0;P<r.cols;P++)V=(u*r.cols+P)*4,be=!0,this._nullModelCell(P,u,V,0,0,0);this._setRowBlinkState(u,!1);continue}h=et;let Pe=!1;for(this._model.lineLengths[u]=0,I=Y===c,x=0,p=this._characterJoinerService.getJoinedCharacters(c),P=0;P<r.cols;P++){if(i=this._cellColorResolver.result.bg,h.loadCell(P,s),P===0&&(i=this._cellColorResolver.result.bg),m=!1,b=P>=x,v=P,p.length>0&&P===p[0][0]&&b){w=p.shift();let fe=this._model.selection.isCellSelected(this._terminal,w[0],c);for(D=w[0]+1;D<w[1];D++)b&&=fe===this._model.selection.isCellSelected(this._terminal,D,c);b&&=!I||he<w[0]||he>=w[1],b?(m=!0,s=new MA(s,h.translateToString(!0,w[0],w[1]),w[1]-w[0]),v=w[1]-1):x=w[1]}if(k=s.getChars(),N=s.getCode(),D=(u*r.cols+P)*4,!Pe&&s.isBlink()&&(Pe=!0),this._cellColorResolver.resolve(s,P,c,this.dimensions.device.cell.width,this.dimensions.device.cell.height),Ie&&c===Y&&(P===he&&(this._model.cursor={x:he,y:Z,width:s.getWidth(),style:this._coreBrowserService.isFocused?F:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Ee=he+s.getWidth()-1),P>=he&&P<=Ee&&(this._coreBrowserService.isFocused&&F==="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&&s.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),N!==0&&(this._model.lineLengths[u]=P+1),!(this._model.cells[D]===N&&this._model.cells[D+1]===this._cellColorResolver.result.bg&&this._model.cells[D+2]===this._cellColorResolver.result.fg&&this._model.cells[D+3]===this._cellColorResolver.result.ext)&&(be=!0,k.length>1&&(N|=AA),this._model.cells[D]=N,this._model.cells[D+1]=this._cellColorResolver.result.bg,this._model.cells[D+2]=this._cellColorResolver.result.fg,this._model.cells[D+3]=this._cellColorResolver.result.ext,R=s.getWidth(),this._glyphRenderer.value.updateCell(P,u,N,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,R,i),m)){for(s=this._workCell,P++;P<=v;P++)V=(u*r.cols+P)*4,this._nullModelCell(P,u,V,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);P--}}this._setRowBlinkState(u,Pe)}be&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,s,i,u){this._glyphRenderer.value.updateCell(e,t,0,s,i,u,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=s,this._model.cells[r+2]=i,this._model.cells[r+3]=u}_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})}},MA=class extends R0{constructor(t,r,s){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}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 Fm(e,t,r=0){return Math.max(Math.min(e,t),r)}var NA=class extends e0{constructor(e){if(fx&&Bw()<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 oa),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new oa),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new oa),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new oa),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,s=t.optionsService,i=t,u=i._renderService,c=i._characterJoinerService,h=i._charSizeService,p=i._coreBrowserService,m=i._decorationService,x=i._logService,b=i._themeService;this._renderer=this._register(new RA(e,c,h,p,r,m,x,s,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(Gl.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Gl.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Gl.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Gl.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(Gs(()=>{if(this._terminal._core._store._isDisposed)return;let v=this._terminal._core._renderService;v.setRenderer(this._terminal._core._createRenderer()),v.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var DA=class{constructor(t,r,s,i={}){this._terminal=t,this._regex=r,this._handler=s,this._options=i}provideLinks(t,r){let s=QA.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(s,i)=>{if(this._options.hover){let{range:u}=r;this._options.hover(s,i,u)}},r))}};function BA(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 QA=class od{static computeLink(t,r,s,i){let u=r.flags.includes("g")?r.flags:`${r.flags}g`,c=new RegExp(r.source,u),[h,p]=od._getWindowedLineStrings(t-1,s),m=h.join(""),x,b=[];for(;x=c.exec(m);){let v=x[0];if(!BA(v))continue;let[w,I]=od._mapStrIdx(s,p,0,x.index),[k,N]=od._mapStrIdx(s,w,I,v.length);if(w===-1||I===-1||k===-1||N===-1)continue;let R={start:{x:I+1,y:w+1},end:{x:N,y:k+1}};b.push({range:R,text:v,activate:i})}return b}static _getWindowedLineStrings(t,r){let s,i=t,u=t,c,h,p=[];if(s=r.buffer.active.getLine(t)){let m=s.translateToString(!0);if(s.isWrapped&&m[0]!==" "){for(c=0;(s=r.buffer.active.getLine(--i))&&c<2048&&(h=s.translateToString(!0),c+=h.length,p.push(h),!(!s.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(m),c=0;(s=r.buffer.active.getLine(++u))&&s.isWrapped&&c<2048&&(h=s.translateToString(!0),c+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,i]}static _mapStrIdx(t,r,s,i){let u=t.buffer.active,c=u.getNullCell(),h=s;for(;i;){let p=u.getLine(r);if(!p)return[-1,-1];for(let m=h;m<p.length;++m){p.getCell(m,c);let x=c.getChars();if(c.getWidth()&&(i-=x.length||1,m===p.length-1&&x==="")){let b=u.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,c),c.getWidth()===2&&(i+=1))}if(i<0)return[r,m]}r++,h=0}return[r,h]}},jA=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function PA(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 OA=class{constructor(t=PA,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,s=r.urlRegex??jA;this._linkProvider=this._terminal.registerLinkProvider(new DA(this._terminal,s,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function Um(e){return{dispose:e}}var FA=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()}},UA=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return Um(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let u=Um(()=>{let c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)});return s&&(Array.isArray(s)?s.push(u):s.add(u)),u},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:s}=this._listeners[0];r.call(s,t);return}default:{let r=this._listeners.slice();for(let{fn:s,thisArgs:i}of r)s.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},$A;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,m)=>u(x=>h.call(p,c(x)),void 0,m)}e.map=r;function s(...u){return(c,h,p)=>{let m=new FA;for(let x of u)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})($A||={});var $m=class ad{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new UA,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,s=!1){return(t&16777215)<<3|(r&3)<<1|(s?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,s=0,i=t.length;for(let u=0;u<i;++u){let c=t.charCodeAt(u);if(55296<=c&&c<=56319){if(++u>=i)return r+this.wcwidth(c);let m=t.charCodeAt(u);56320<=m&&m<=57343?c=(c-55296)*1024+m-56320+65536:r+=this.wcwidth(m)}let h=this.charProperties(c,s),p=ad.extractWidth(h);ad.extractShouldJoin(h)&&(p-=ad.extractWidth(s)),r+=p,s=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jh=[[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]],zA=[[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]],Ph=[[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]],HA=[[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]],za;function zm(e,t){let r=0,s=t.length-1,i;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(i=r+s>>1,e>t[i][1])r=i+1;else if(e<t[i][0])s=i-1;else return!0;return!1}var WA=class{constructor(){if(this.version="11",!za){za=new Uint8Array(65536),za.fill(1),za[0]=0,za.fill(0,1,32),za.fill(0,127,160);for(let e=0;e<jh.length;++e)za.fill(0,jh[e][0],jh[e][1]+1);for(let e=0;e<Ph.length;++e)za.fill(2,Ph[e][0],Ph[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?za[e]:zm(e,zA)?0:zm(e,HA)?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let i=$m.extractWidth(t);i===0?s=!1:i>r&&(r=i)}return $m.createPropertyValue(0,r,s)}},GA=class{activate(e){e.unicode.register(new WA)}dispose(){}};function Xl(e){return{dispose:e}}function ld(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function VA(...e){return Xl(()=>ld(e))}var Ix=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()}},au=class{constructor(){this._store=new Ix}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};au.None=Object.freeze({dispose(){}});var vd=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}},Hf=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Xl(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=Xl(()=>{let u=this._listeners.indexOf(s);u!==-1&&this._listeners.splice(u,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},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:s}of t)r.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},qA;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,m)=>u(x=>h.call(p,c(x)),void 0,m)}e.map=r;function s(...u){return(c,h,p)=>{let m=new Ix;for(let x of u)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(qA||={});function kx(e,t=0,r){let s=setTimeout(()=>{e()},t);return Xl(()=>{clearTimeout(s)})}var ZA=class extends au{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new vd),this._linesCacheDisposables=this._register(new vd),this._lastAccessTimestamp=0,this._register(Xl(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=VA(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=kx(()=>{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=[],s=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let u=this._terminal.buffer.active.getLine(e+1),c=u?u.isWrapped:!1,h=i.translateToString(!c&&t);if(c&&u){let p=i.getCell(i.length-1);p&&p.getCode()===0&&p.getWidth()===1&&u.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),c)s.push(s[s.length-1]+h.length);else break;e++,i=u}return[r.join(""),s]}},YA=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}},KA=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,s,i){if(!t||t.length===0){this._terminal.clearSelection();return}if(s>=this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let u={startRow:r,startCol:s},c=this._findInLine(t,u,i);if(!c)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(u.startRow=h,u.startCol=0,c=this._findInLine(t,u,i),!c);h++);return c}findNextWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let u=0,c=0;i&&(s===t?(u=i.end.x,c=i.end.y):(u=i.start.x,c=i.start.y)),this._lineCache.initLinesCache();let h={startRow:c,startCol:u},p=this._findInLine(t,h,r);if(!p)for(let m=c+1;m<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=m,h.startCol=0,p=this._findInLine(t,h,r),!p);m++);if(!p&&c!==0)for(let m=0;m<c&&(h.startRow=m,h.startCol=0,p=this._findInLine(t,h,r),!p);m++);return!p&&i&&(h.startRow=i.start.y,h.startCol=0,p=this._findInLine(t,h,r)),p}findPreviousWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let u=this._terminal.buffer.active.baseY+this._terminal.rows-1,c=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:u,startCol:c},m;if(i&&(p.startRow=u=i.start.y,p.startCol=i.start.x,s!==t&&(m=this._findInLine(t,p,r,!1),m||(p.startRow=u=i.end.y,p.startCol=i.end.x))),m??=this._findInLine(t,p,r,h),!m){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=u-1;x>=0&&(p.startRow=x,m=this._findInLine(t,p,r,h),!m);x--);}if(!m&&u!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=u&&(p.startRow=x,m=this._findInLine(t,p,r,h),!m);x--);return m}_isWholeWord(t,r,s){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+s.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+s.length]))}_findInLine(t,r,s={},i=!1){let u=r.startRow,c=r.startCol;if(this._terminal.buffer.active.getLine(u)?.isWrapped){if(i){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,s)}let h=this._lineCache.getLineFromCache(u);h||(h=this._lineCache.translateBufferLineToStringWithWrap(u,!0),this._lineCache.setLineInCache(u,h));let[p,m]=h,x=this._bufferColsToStringOffset(u,c),b=t,v=p;s.regex||(b=s.caseSensitive?t:t.toLowerCase(),v=s.caseSensitive?p:p.toLowerCase());let w=-1;if(s.regex){let I=RegExp(b,s.caseSensitive?"g":"gi"),k;if(i)for(;k=I.exec(v.slice(0,x));)w=I.lastIndex-k[0].length,t=k[0],I.lastIndex-=t.length-1;else k=I.exec(v.slice(x)),k&&k[0].length>0&&(w=x+(I.lastIndex-k[0].length),t=k[0])}else i?x-b.length>=0&&(w=v.lastIndexOf(b,x-b.length)):w=v.indexOf(b,x);if(w>=0){if(s.wholeWord&&!this._isWholeWord(w,v,t))return;let I=0;for(;I<m.length-1&&w>=m[I+1];)I++;let k=I;for(;k<m.length-1&&w+t.length>=m[k+1];)k++;let N=w-m[I],R=w+t.length-m[k],D=this._stringLengthToBufferSize(u+I,N),P=this._stringLengthToBufferSize(u+k,R)-D+this._terminal.cols*(k-I);return{term:t,col:D,row:u+I,size:P}}}_stringLengthToBufferSize(t,r){let s=this._terminal.buffer.active.getLine(t);if(!s)return 0;for(let i=0;i<r;i++){let u=s.getCell(i);if(!u)break;let c=u.getChars();c.length>1&&(r-=c.length-1);let h=s.getCell(i+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let s=t,i=0,u=this._terminal.buffer.active.getLine(s);for(;r>0&&u;){for(let c=0;c<r&&c<this._terminal.cols;c++){let h=u.getCell(c);if(!h)break;h.getWidth()&&(i+=h.getCode()===0?1:h.getChars().length)}if(s++,u=this._terminal.buffer.active.getLine(s),u&&!u.isWrapped)break;r-=this._terminal.cols}return i}},XA=class extends au{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Xl(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let s of t){let i=this._createResultDecorations(s,r,!1);if(i)for(let u of i)this._storeDecoration(u,s)}}createActiveDecoration(t,r){let s=this._createResultDecorations(t,r,!0);if(s)return{decorations:s,match:t,dispose(){ld(s)}}}clearHighlightDecorations(){ld(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,s){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),s&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,s){let i=[],u=t.col,c=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;c>0;){let m=Math.min(this._terminal.cols-u,c);i.push([h,u,m]),u=0,c-=m,h++}let p=[];for(let m of i){let x=this._terminal.registerMarker(m[0]),b=this._terminal.registerDecoration({marker:x,x:m[1],width:m[2],layer:s?"top":"bottom",backgroundColor:s?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:s?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(b){let v=[];v.push(x),v.push(b.onRender(w=>this._applyStyles(w,s?r.activeMatchBorder:r.matchBorder,!1))),v.push(b.onDispose(()=>ld(v))),p.push(b)}}return p.length===0?void 0:p}},JA=class extends au{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Hf)}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 s=this._searchResults[r];if(s.row===t.row&&s.col===t.col&&s.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()}},eT=class extends au{constructor(t){super(),this._highlightTimeout=this._register(new vd),this._lineCache=this._register(new vd),this._state=new YA,this._resultTracker=this._register(new JA),this._onAfterSearch=this._register(new Hf),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Hf),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 ZA(t),this._engine=new KA(t,this._lineCache.value),this._decorationManager=new XA(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Xl(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=kx(()=>{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,s){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 i=this._findNextAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_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 s=[],i,u=this._engine.find(t,0,0,r);for(;u&&(i?.row!==u.row||i?.col!==u.col)&&!(s.length>=this._highlightLimit);){i=u,s.push(i);let c=this._terminal.cols,h=i.col+i.size,p=i.row;h>=c&&(p+=Math.floor(h/c),h=h%c),u=this._engine.find(t,p,h,r)}this._resultTracker.updateResults(s,this._highlightLimit),r.decorations&&this._decorationManager.createHighlightDecorations(s,r.decorations)}_findNextAndSelect(t,r,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,s?.noScroll)}findPrevious(t,r,s){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 i=this._findPreviousAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,s?.noScroll)}_selectResult(t,r,s){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 i=this._decorationManager.createActiveDecoration(t,r);i&&(this._resultTracker.selectedDecoration=i)}if(!s&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let i=t.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var ii=0,oi=0,ai=0,ds=0,Ni;(e=>{function t(i,u,c,h){return h!==void 0?`#${Bl(i)}${Bl(u)}${Bl(c)}${Bl(h)}`:`#${Bl(i)}${Bl(u)}${Bl(c)}`}e.toCss=t;function r(i,u,c,h=255){return(i<<24|u<<16|c<<8|h)>>>0}e.toRgba=r;function s(i,u,c,h){return{css:e.toCss(i,u,c,h),rgba:e.toRgba(i,u,c,h)}}e.toColor=s})(Ni||={});var tT;(e=>{function t(p,m){if(ds=(m.rgba&255)/255,ds===1)return{css:m.css,rgba:m.rgba};let x=m.rgba>>24&255,b=m.rgba>>16&255,v=m.rgba>>8&255,w=p.rgba>>24&255,I=p.rgba>>16&255,k=p.rgba>>8&255;ii=w+Math.round((x-w)*ds),oi=I+Math.round((b-I)*ds),ai=k+Math.round((v-k)*ds);let N=Ni.toCss(ii,oi,ai),R=Ni.toRgba(ii,oi,ai);return{css:N,rgba:R}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,m,x){let b=cd.ensureContrastRatio(p.rgba,m.rgba,x);if(b)return Ni.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=s;function i(p){let m=(p.rgba|255)>>>0;return[ii,oi,ai]=cd.toChannels(m),{css:Ni.toCss(ii,oi,ai),rgba:m}}e.opaque=i;function u(p,m){return ds=Math.round(m*255),[ii,oi,ai]=cd.toChannels(p.rgba),{css:Ni.toCss(ii,oi,ai,ds),rgba:Ni.toRgba(ii,oi,ai,ds)}}e.opacity=u;function c(p,m){return ds=p.rgba&255,u(p,ds*m/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(tT||={});var wi;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let u=i.getContext("2d",{willReadFrequently:!0});u&&(t=u,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return ii=parseInt(i.slice(1,2).repeat(2),16),oi=parseInt(i.slice(2,3).repeat(2),16),ai=parseInt(i.slice(3,4).repeat(2),16),Ni.toColor(ii,oi,ai);case 5:return ii=parseInt(i.slice(1,2).repeat(2),16),oi=parseInt(i.slice(2,3).repeat(2),16),ai=parseInt(i.slice(3,4).repeat(2),16),ds=parseInt(i.slice(4,5).repeat(2),16),Ni.toColor(ii,oi,ai,ds);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let u=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(u)return ii=parseInt(u[1],10),oi=parseInt(u[2],10),ai=parseInt(u[3],10),ds=Math.round((u[5]===void 0?1:parseFloat(u[5]))*255),Ni.toColor(ii,oi,ai,ds);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ii,oi,ai,ds]=t.getImageData(0,0,1,1).data,ds!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ni.toRgba(ii,oi,ai,ds),css:i}}e.toColor=s})(wi||={});var Zi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,i,u){let c=s/255,h=i/255,p=u/255,m=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),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return m*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(Zi||={});var cd;(e=>{function t(c,h){if(ds=(h&255)/255,ds===1)return h;let p=h>>24&255,m=h>>16&255,x=h>>8&255,b=c>>24&255,v=c>>16&255,w=c>>8&255;return ii=b+Math.round((p-b)*ds),oi=v+Math.round((m-v)*ds),ai=w+Math.round((x-w)*ds),Ni.toRgba(ii,oi,ai)}e.blend=t;function r(c,h,p){let m=Zi.relativeLuminance(c>>8),x=Zi.relativeLuminance(h>>8);if(Ha(m,x)<p){if(x<m){let w=s(c,h,p),I=Ha(m,Zi.relativeLuminance(w>>8));if(I<p){let k=i(c,h,p),N=Ha(m,Zi.relativeLuminance(k>>8));return I>N?w:k}return w}let b=i(c,h,p),v=Ha(m,Zi.relativeLuminance(b>>8));if(v<p){let w=s(c,h,p),I=Ha(m,Zi.relativeLuminance(w>>8));return v>I?b:w}return b}}e.ensureContrastRatio=r;function s(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,w=h>>16&255,I=h>>8&255,k=Ha(Zi.relativeLuminance2(v,w,I),Zi.relativeLuminance2(m,x,b));for(;k<p&&(v>0||w>0||I>0);)v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),I-=Math.max(0,Math.ceil(I*.1)),k=Ha(Zi.relativeLuminance2(v,w,I),Zi.relativeLuminance2(m,x,b));return(v<<24|w<<16|I<<8|255)>>>0}e.reduceLuminance=s;function i(c,h,p){let m=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,w=h>>16&255,I=h>>8&255,k=Ha(Zi.relativeLuminance2(v,w,I),Zi.relativeLuminance2(m,x,b));for(;k<p&&(v<255||w<255||I<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),I=Math.min(255,I+Math.ceil((255-I)*.1)),k=Ha(Zi.relativeLuminance2(v,w,I),Zi.relativeLuminance2(m,x,b));return(v<<24|w<<16|I<<8|255)>>>0}e.increaseLuminance=i;function u(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=u})(cd||={});function Bl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ha(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var rT=Object.freeze((()=>{let e=[wi.toColor("#2e3436"),wi.toColor("#cc0000"),wi.toColor("#4e9a06"),wi.toColor("#c4a000"),wi.toColor("#3465a4"),wi.toColor("#75507b"),wi.toColor("#06989a"),wi.toColor("#d3d7cf"),wi.toColor("#555753"),wi.toColor("#ef2929"),wi.toColor("#8ae234"),wi.toColor("#fce94f"),wi.toColor("#729fcf"),wi.toColor("#ad7fa8"),wi.toColor("#34e2e2"),wi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],i=t[r/6%6|0],u=t[r%6];e.push({css:Ni.toCss(s,i,u),rgba:Ni.toRgba(s,i,u)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:Ni.toCss(s,s,s),rgba:Ni.toRgba(s,s,s)})}return e})());function Hm(e,t,r){return Math.max(t,Math.min(e,r))}function nT(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var Ex=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),i=r,u=e.start.y,c=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(c-u,u,c);for(let m=u;m<=c;m++){let x=this._buffer.getLine(m);if(x){let b=m===e.start.y?h:0,v=m===e.end.y?p:x.length;for(let w=b;w<v;w++){let I=x.getCell(w,i===r?s:r);if(!I){console.warn(`Can't get cell at row=${m}, col=${w}`);continue}this._nextCell(I,i,m,w),i=I}}this._rowEnd(m,m===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,s){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function Pp(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Ia(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Rx(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=e.isUnderlineColorDefault(),s=t.isUnderlineColorDefault();return r&&s?!0:r!==s?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function Op(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&Rx(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 Mx(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):Pp(e,t)&&Ia(e,t)&&Op(e,t)}var sT=class extends Ex{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,s){this._allRows=new Array(t),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){this._nullCellCount>0&&!Ia(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let s="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let i=this._buffer.getLine(t),u=this._buffer.getLine(t+1);if(!u.isWrapped)s=`\r
62
- `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{s="";let c=i.getCell(i.length-1,this._thisRowLastChar),h=i.getCell(i.length-2,this._thisRowLastSecondChar),p=u.getCell(0,this._nextRowFirstChar),m=p.getWidth()>1,x=!1;(p.getChars()&&m?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Ia(c,p)&&(x=!0),m&&(h.getChars()||h.getWidth()===0)&&Ia(c,p)&&Ia(h,p)&&(x=!0)),x||(s="-".repeat(this._nullCellCount+1),s+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(s+="\x1B[A",s+=`\x1B[${i.length-this._nullCellCount}C`,s+=`\x1B[${this._nullCellCount}X`,s+=`\x1B[${i.length-this._nullCellCount}D`,s+="\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++]=s,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let s=[];if(Mx(t,r))return s;let i=!Pp(t,r),u=!Ia(t,r),c=!Op(t,r);if(i||u||c)if(t.isAttributeDefault())r.isAttributeDefault()||s.push(0);else{if(i){let h=t.getFgColor();t.isFgRGB()?s.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?s.push(38,5,h):s.push(h&8?90+(h&7):30+(h&7)):s.push(39)}if(u){let h=t.getBgColor();t.isBgRGB()?s.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?s.push(48,5,h):s.push(h&8?100+(h&7):40+(h&7)):s.push(49)}if(c){if(t.isInverse()!==r.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&s.push(t.isBold()?1:22),Rx(t,r))t.isUnderline()!==r.isUnderline()&&s.push(t.isUnderline()?4:24);else{let h=t.getUnderlineStyle();if(h===0)s.push(24);else if(h===1&&t.isUnderlineColorDefault())s.push(4);else if(s.push("4:"+h),!t.isUnderlineColorDefault()){let p=t.getUnderlineColor();t.isUnderlineColorRGB()?s.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):s.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&s.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&s.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&s.push(t.isStrikethrough()?9:29)}}return s}_nextCell(t,r,s,i){if(t.getWidth()===0)return;let u=t.getChars()==="",c=this._diffStyle(t,this._cursorStyle);if(u?!Ia(this._cursorStyle,t):c.length>0){this._nullCellCount>0&&(Ia(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=s,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+=`\x1B[${c.join(";")}m`;let h=this._buffer.getLine(s);h!==void 0&&(h.getCell(i,this._cursorStyle),this._cursorStyleRow=s,this._cursorStyleCol=i)}u?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Ia(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=s,this._lastContentCursorCol=this._lastCursorCol=i+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 s="";for(let c=0;c<r;c++)s+=this._allRows[c],c+1<r&&(s+=this._allRowSeparators[c]);if(!t){let c=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=c!==this._lastCursorRow||h!==this._lastCursorCol,m=x=>{x>0?s+=`\x1B[${x}C`:x<0&&(s+=`\x1B[${-x}D`)};p&&((x=>{x>0?s+=`\x1B[${x}B`:x<0&&(s+=`\x1B[${-x}A`)})(c-this._lastCursorRow),m(h-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,u=this._diffStyle(i,this._cursorStyle);return u.length>0&&(s+=`\x1B[${u.join(";")}m`),s}},iT=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,s){let i=r.length,u=s===void 0?i:Hm(s+t.rows,0,i);return this._serializeBufferByRange(t,r,{start:i-u,end:i-1},!1)}_serializeBufferByRange(t,r,s,i){return new sT(r,t).serialize({start:{x:0,y:typeof s.start=="number"?s.start:s.start.line},end:{x:t.cols,y:typeof s.end=="number"?s.end:s.end.line}},i)}_serializeBufferAsHTML(t,r){let s=t.buffer.active,i=new oT(s,t,r),u=r.onlySelection??!1,c=r.range;if(c)return i.serialize({start:{x:c.startCol,y:(c.startLine,c.startLine)},end:{x:t.cols,y:(c.endLine,c.endLine)}});if(!u){let p=s.length,m=r.scrollback,x=m===void 0?p:Hm(m+t.rows,0,p);return i.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?i.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,s=r.scrollTop,i=r.scrollBottom;return s!==0||i!==t.rows-1?`\x1B[${s+1};${i+1}r`:""}_serializeModes(t){let r="",s=t.modes;if(s.applicationCursorKeysMode&&(r+="\x1B[?1h"),s.applicationKeypadMode&&(r+="\x1B[?66h"),s.bracketedPasteMode&&(r+="\x1B[?2004h"),s.insertMode&&(r+="\x1B[4h"),s.originMode&&(r+="\x1B[?6h"),s.reverseWraparoundMode&&(r+="\x1B[?45h"),s.sendFocusMode&&(r+="\x1B[?1004h"),s.wraparoundMode===!1&&(r+="\x1B[?7l"),s.mouseTrackingMode!=="none")switch(s.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 s.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 s=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${s}`}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(){}},oT=class extends Ex{constructor(t,r,s){super(t),this._terminal=r,this._options=s,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=rT}_beforeSerialize(t,r,s){this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",u="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=this._terminal.options.theme?.foreground??"#ffffff",u=this._terminal.options.theme?.background??"#000000");let c=[];c.push("color: "+i+";"),c.push("background-color: "+u+";"),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 s=r?t.getFgColor():t.getBgColor();if(r?t.isFgRGB():t.isBgRGB())return"#"+[s>>16&255,s>>8&255,s&255].map(i=>i.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[s].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(s=>s.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 s=[];if(Mx(t,r))return;let i=!Pp(t,r),u=!Ia(t,r),c=!Op(t,r);if(i||u||c){let h=this._getHexColor(t,!0);h&&s.push("color: "+h+";");let p=this._getHexColor(t,!1);p&&s.push("background-color: "+p+";"),t.isInverse()&&s.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&s.push("font-weight: bold;");let m=[];if(t.isUnderline()&&m.push(this._getUnderlineStyle(t)),t.isOverline()&&m.push("overline"),t.isStrikethrough()&&m.push("line-through"),t.isBlink()&&m.push("blink"),m.length>0&&s.push("text-decoration: "+m.join(" ")+";"),t.isUnderline()){let x=this._getUnderlineColor(t);x&&s.push("text-decoration-color: "+x+";")}return t.isInvisible()&&s.push("visibility: hidden;"),t.isItalic()&&s.push("font-style: italic;"),t.isDim()&&s.push("opacity: 0.5;"),s}}_nextCell(t,r,s,i){if(t.getWidth()===0)return;let u=t.getChars()==="",c=this._diffStyle(t,r);c&&(this._currentRow+=c.length===0?"</span><span>":"</span><span style='"+c.join(" ")+"'>"),u?this._currentRow+=" ":this._currentRow+=nT(t.getChars())}_serializeString(){return this._htmlContent}};var aT=class{constructor(e=new lT,t=new Nx){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],s=t[1];if(s==="?"){let c=this._provider.readText(r);return c instanceof Promise?c.then(h=>(this._readText(r,h),!0)):(this._readText(r,c),!0)}let i="";try{i=this._base64.decodeText(s)}catch{}let u=this._provider.writeText(r,i);return u instanceof Promise?u.then(()=>!0):!0}},Nx=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},lT=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let s="";for(let i=0;i<r.length;i++)s+=String.fromCharCode(r[i]);return btoa(s)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return new TextDecoder().decode(s)}catch{}return""}};var cT=Object.create,Dx=Object.defineProperty,uT=Object.getOwnPropertyDescriptor,dT=Object.getOwnPropertyNames,hT=Object.getPrototypeOf,fT=Object.prototype.hasOwnProperty,Z0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},pT=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dT(t))!fT.call(e,i)&&i!==r&&Dx(e,i,{get:()=>t[i],enumerable:!(s=uT(t,i))||s.enumerable});return e},Y0=(e,t,r)=>(r=e!=null?cT(hT(e)):{},pT(!e||!e.__esModule?Dx(r,"default",{value:e,enumerable:!0}):r,e)),Fp=Z0(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 s(w){return w>>>16&255}e.blue=s;function i(w){return w>>>24&255}e.alpha=i;function u(w,I,k,N=255){return((N&255)<<24|(k&255)<<16|(I&255)<<8|w&255)>>>0}e.toRGBA8888=u;function c(w){return[w&255,w>>8&255,w>>16&255,w>>>24]}e.fromRGBA8888=c;function h(w,I){let k=t(w),N=r(w),R=s(w),D=Number.MAX_SAFE_INTEGER,P=-1;for(let V=0;V<I.length;++V){let F=k-I[V][0],Y=N-I[V][1],Z=R-I[V][2],he=F*F+Y*Y+Z*Z;if(!he)return V;he<D&&(D=he,P=V)}return P}e.nearestColorIndex=h;function p(w,I,k){return Math.max(w,Math.min(k,I))}function m(w,I,k){return k<0&&(k+=1),k>1&&(k-=1),k*6<1?I+(w-I)*6*k:k*2<1?w:k*3<2?I+(w-I)*(4-k*6):I}function x(w,I,k){if(!k){let D=Math.round(I*255);return u(D,D,D)}let N=I<.5?I*(1+k):I+k-I*k,R=2*I-N;return u(p(0,255,Math.round(m(N,R,w+1/3)*255)),p(0,255,Math.round(m(N,R,w)*255)),p(0,255,Math.round(m(N,R,w-1/3)*255)))}function b(w,I,k){return(4278190080|Math.round(k/100*255)<<16|Math.round(I/100*255)<<8|Math.round(w/100*255))>>>0}e.normalizeRGB=b;function v(w,I,k){return x((w+240%360)/360,I/100,k/100)}e.normalizeHLS=v,e.PALETTE_VT340_COLOR=new Uint32Array([b(0,0,0),b(20,20,80),b(80,13,13),b(20,80,20),b(80,20,80),b(20,80,80),b(80,80,20),b(53,53,53),b(26,26,26),b(33,33,60),b(60,26,26),b(33,60,33),b(60,33,60),b(33,60,60),b(60,60,33),b(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46),b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let w=[u(0,0,0),u(205,0,0),u(0,205,0),u(205,205,0),u(0,0,238),u(205,0,205),u(0,250,205),u(229,229,229),u(127,127,127),u(255,0,0),u(0,255,0),u(255,255,0),u(92,92,255),u(255,0,255),u(0,255,255),u(255,255,255)],I=[0,95,135,175,215,255];for(let k=0;k<6;++k)for(let N=0;N<6;++N)for(let R=0;R<6;++R)w.push(u(I[k],I[N],I[R]));for(let k=8;k<=238;k+=10)w.push(u(k,k,k));return new Uint32Array(w)})(),e.DEFAULT_BACKGROUND=u(0,0,0,255),e.DEFAULT_FOREGROUND=u(255,255,255,255)}),Bx=Z0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=s=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(s);if(typeof Buffer<"u")return Buffer.from(s,"base64");let i=atob(s),u=new Uint8Array(i.length);for(let c=0;c<u.length;++c)u[c]=i.charCodeAt(c);return u};function r(s){if(s.d){let{t:i,s:u,d:c}=s,h,p,m=WebAssembly;return i===0?u?x=>new m.Instance(p||(p=new m.Module(h||(h=t(c)))),x):x=>p?m.instantiate(p,x):m.instantiate(h||(h=t(c)),x).then(b=>(p=b.module)&&b.instance):i===1?u?()=>p||(p=new m.Module(h||(h=t(c)))):()=>p?Promise.resolve(p):m.compile(h||(h=t(c))).then(x=>p=x):u?()=>h||(h=t(c)):()=>Promise.resolve(h||(h=t(c)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(s)}}),Qx=Z0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Bx(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),s=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(h=>h.charCodeAt(0))),i=new Uint32Array(1024);i.fill(4278190080);for(let h=0;h<s.length;++h)i[s[h]]=h<<2;for(let h=0;h<s.length;++h)i[256+s[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<s.length;++h)i[512+s[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<s.length;++h)i[768+s[h]]=h<<16;var u=new Uint8Array(0),c=class{constructor(h,p,m){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=h??1048576,this.maxBytes=p??4294901760,this._bytes=m??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]):u}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 m=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),m=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}}),m=new Uint32Array(this._mem.buffer,0),m.set(i,256),this._d=new Uint8Array(this._mem.buffer,5152)),m[1280]=0,m[1281]=0,m[1282]=0,this._m32=m,this._ended=!1}_realloc(h){let p=this._m32[1280]+h;if(this._bytes<p){if(p>this.maxBytes)return-3;let m=this._bytes;for(;(m*=2)<p;);if(m=Math.min(m,this.maxBytes),m<p)return-3;if(m+5152>this._mem.buffer.byteLength){let x=Math.ceil((m+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=m}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}),mT=Z0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Bx(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),s=class{constructor(i){this.keepSize=i,this.width=0,this.height=0}decode(i){this.width=i[4]<<24|i[5]<<16|i[6]<<8|i[7],this.height=i[8]<<24|i[9]<<16|i[10]<<8|i[11];let u=this.width*this.height,c=u*4,h=i.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 m=this._mem.buffer.byteLength-h&-256;return this._d.set(i,m),this._inst.exports.dec(m,h,u),this._d.subarray(1024,1024+c)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=s}),gT=Z0(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"}}),xT=Z0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=Fp(),r=gT();function s(w){if(typeof Buffer<"u")return Buffer.from(w,"base64");let I=atob(w),k=new Uint8Array(I.length);for(let N=0;N<k.length;++N)k[N]=I.charCodeAt(N);return k}var i=s(r.LIMITS.BYTES),u,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 m(w){let I=new h,k={env:{handle_band:I.handle_band.bind(I),mode_parsed:I.mode_parsed.bind(I)}};return WebAssembly.instantiate(u||i,k).then(N=>(u=u||N.module,new x(w,N.instance||N,I)))}e.DecoderAsync=m;var x=class{constructor(w,I,k){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(I)k.bandHandler=this._handle_band.bind(this),k.modeHandler=this._initCanvas.bind(this);else{let N=u||(u=new WebAssembly.Module(i));I=new WebAssembly.Instance(N,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=I,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 I=this.width*this.height;if(I>this._canvas.length){if(this._opts.memoryLimit&&I*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(I)}this._maxWidth=this._width}else if(w===1)if(this._level===2){let I=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(I>this._canvas.length){if(this._opts.memoryLimit&&I*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(I)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(w,I){let k=w+I;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let N=new Uint32Array(Math.ceil(k/65536)*65536);N.set(this._canvas),this._canvas=N}}_handle_band(w){let I=this._PIXEL_OFFSET,k=this._lastOffset;if(this._mode===2){let N=this.height-this._currentHeight,R=0;for(;R<6&&N>0;)this._canvas.set(this._pSrc.subarray(I*R,I*R+w),k+w*R),R++,N--;this._lastOffset+=w*R,this._currentHeight+=R}else if(this._mode===1){this._realloc(k,w*6),this._maxWidth=Math.max(this._maxWidth,w),this._minWidth=Math.min(this._minWidth,w);for(let N=0;N<6;++N)this._canvas.set(this._pSrc.subarray(I*N,I*N+w),k+w*N);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,I=this._opts.palette,k=this._opts.paletteLimit,N=this._opts.truncate){this._wasm.init(this._opts.sixelColor,w,k,N?1:0),I&&this._palette.set(I.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,I=0,k=w.length){let N=I;for(;N<k;){let R=Math.min(k-N,r.LIMITS.CHUNK_SIZE);this._chunk.set(w.subarray(N,N+=R)),this._wasm.decode(0,R)}}decodeString(w,I=0,k=w.length){let N=I;for(;N<k;){let R=Math.min(k-N,r.LIMITS.CHUNK_SIZE);for(let D=0,P=N;D<R;++D,++P)this._chunk[D]=w.charCodeAt(P);N+=R,this._wasm.decode(0,R)}}get data32(){if(this._mode===0||!this.width||!this.height)return c;let w=this._wasm.current_width();if(this._mode===2){let I=this.height-this._currentHeight;if(I>0){let k=this._PIXEL_OFFSET,N=this._lastOffset,R=0;for(;R<6&&I>0;)this._canvas.set(this._pSrc.subarray(k*R,k*R+w),N+w*R),R++,I--;I&&this._canvas.fill(this._fillColor,N+w*R)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let R=!1;if(w)if(w!==this._minWidth)R=!0;else{let D=this._PIXEL_OFFSET,P=this._lastOffset;this._realloc(P,w*6);for(let V=0;V<6;++V)this._canvas.set(this._pSrc.subarray(D*V,D*V+w),P+w*V)}if(!R)return this._canvas.subarray(0,this.width*this.height)}let I=new Uint32Array(this.width*this.height);I.fill(this._fillColor);let k=0,N=0;for(let R=0;R<this._bandWidths.length;++R){let D=this._bandWidths[R];for(let P=0;P<6;++P)I.set(this._canvas.subarray(N,N+=D),k),k+=this.width}if(w){let R=this._PIXEL_OFFSET,D=this._wasm.current_height();for(let P=0;P<D;++P)I.set(this._pSrc.subarray(R*P,R*P+w),k+this.width*P)}return I}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 b(w,I){let k=new x(I);return k.init(),typeof w=="string"?k.decodeString(w):k.decode(w),{width:k.width,height:k.height,data32:k.data32,data8:k.data8}}e.decode=b;async function v(w,I){let k=await m(I);return k.init(),typeof w=="string"?k.decodeString(w):k.decode(w),{width:k.width,height:k.height,data32:k.data32,data8:k.data8}}e.decodeAsync=v});function Wf(e){return{dispose:e}}var jx=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()}},Px=class{constructor(){this._store=new jx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Px.None=Object.freeze({dispose(){}});var bT=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}},yT=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Wf(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=Wf(()=>{let u=this._listeners.indexOf(s);u!==-1&&this._listeners.splice(u,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},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:s}of t)r.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},vT;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,m)=>u(x=>h.call(p,c(x)),void 0,m)}e.map=r;function s(...u){return(c,h,p)=>{let m=new jx;for(let x of u)m.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(m):p.add(m)),m}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(vT||={});var Wm=Y0(Fp()),z0=class bl extends Px{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new bT),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(Wf(()=>{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,s){let i=(t??document).createElement("canvas");return i.width=r|0,i.height=s|0,i}static createImageData(t,r,s,i){if(typeof ImageData!="function"){let u=t.createImageData(r,s);return i&&u.data.set(new Uint8ClampedArray(i,0,r*s*4)),u}return i?new ImageData(new Uint8ClampedArray(i,0,r*s*4),r,s):new ImageData(r,s)}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,s){let i=t*(this.dimensions?.css.cell.height||0),u=this.dimensions?.css.canvas.width||0,c=(r+1-t)*(this.dimensions?.css.cell.height||0);(!s||s==="top")&&this._layers.get("top")?.clearRect(0,i,u,c),(!s||s==="bottom")&&this._layers.get("bottom")?.clearRect(0,i,u,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,s,i,u=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 m=t.actual,x=Math.ceil(m.width/h),b=r%x*h,v=Math.floor(r/x)*p,w=s*h,I=i*p,k=u*h+b>m.width?m.width-b:u*h,N=v+p>m.height?m.height-v:p;c.drawImage(m,Math.floor(b),Math.floor(v),Math.ceil(k),Math.ceil(N),Math.floor(w),Math.floor(I),Math.ceil(k),Math.ceil(N))}extractTile(t,r){let{width:s,height:i}=this.cellSize;if(s===-1||i===-1)return;this._rescaleImage(t,s,i);let u=t.actual,c=Math.ceil(u.width/s),h=r%c*s,p=Math.floor(r/c)*i,m=s+h>u.width?u.width-h:s,x=p+i>u.height?u.height-p:i,b=bl.createCanvas(this.document,m,x),v=b.getContext("2d");if(v)return v.drawImage(u,Math.floor(h),Math.floor(p),Math.floor(m),Math.floor(x),0,0,Math.floor(m),Math.floor(x)),b}drawPlaceholder(t,r,s=1){let i=this._layers.get("top");if(i){let{width:u,height:c}=this.cellSize;if(u===-1||c===-1||(this._placeholder?c>=this._placeholder.height&&this._createPlaceHolder(c+1):this._createPlaceHolder(Math.max(c+1,24)),!this._placeholder))return;i.drawImage(this._placeholderBitmap??this._placeholder,t*u,r*c%2?0:1,u*s,c,t*u,r*c,u*s,c)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,r=this.dimensions?.css.canvas.height||0;for(let s of this._layers.values())(s.canvas.width!==t||s.canvas.height!==r)&&(s.canvas.width=t,s.canvas.height=r)}_rescaleImage(t,r,s){if(r===t.actualCellSize.width&&s===t.actualCellSize.height)return;let{width:i,height:u}=t.origCellSize;if(r===i&&s===u){t.actual=t.orig,t.actualCellSize.width=i,t.actualCellSize.height=u;return}let c=bl.createCanvas(this.document,Math.ceil(t.orig.width*r/i),Math.ceil(t.orig.height*s/u)),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=s)}_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=bl.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let s=this._terminal._core.screenElement;s.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",s.insertBefore(r,s.firstChild)):(r.style.zIndex="0",s.appendChild(r));let i=r.getContext("2d",{alpha:!0});if(!i){r.remove();return}this._layers.set(t,i),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,s=bl.createCanvas(this.document,r,t),i=s.getContext("2d",{alpha:!1});if(!i)return;let u=bl.createImageData(i,r,t),c=new Uint32Array(u.data.buffer),h=(0,Wm.toRGBA8888)(0,0,0),p=(0,Wm.toRGBA8888)(255,255,255);c.fill(h);for(let b=0;b<t;++b){let v=b%2,w=b*r;for(let I=0;I<r;I+=2)c[w+I+v]=p}i.putImageData(u,0,0);let m=screen.width+r-1&-32||4096;this._placeholder=bl.createCanvas(this.document,m,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let b=0;b<m;b+=r)x.drawImage(s,b,0);bl.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},qa={width:7,height:14},Gf=class Ox{constructor(t=0,r=0,s=-1,i=-1){this.imageId=s,this.tileId=i,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 Ox(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},Eu=new Gf,wT=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(s){s instanceof Error&&console.error(s.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=qa);let s=Math.ceil(e.width/r.width),i=Math.ceil(e.height/r.height),u=++this._lastId,c=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,m=c.x,x=c.y,b=m,v=0;t.scrolling||(c.x=0,c.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y);for(let N=0;N<i;++N){let R=c.lines.get(c.y+c.ybase);for(let D=0;D<s&&!(b+D>=h);++D)this._writeToCell(R,b+D,u,N*s+D),v++;if(t.scrolling)N<i-1&&this._terminal._core._inputHandler.lineFeed();else if(++c.y>=p)break;c.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y),t.scrolling?t.cursorPos==="iip"?c.x=Math.min(b+s,h):c.x=b:(c.x=m,c.y=x);let w=[];for(let[N,R]of this._images.entries())R.tileCount<1&&(R.marker?.dispose(),w.push(N));for(let N of w)this._delImg(N);let I=this._terminal.registerMarker(0);I?.onDispose(()=>{this._images.get(u)&&this._delImg(u)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let k={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:I||void 0,tileCount:v,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(u,k),this.onImageAdded?.(),u}render(e){let t=!1,r=!1;for(let m of this._images.values())if(m.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:s,end:i}=e,u=this._terminal._core.buffer,c=this._terminal._core.cols;this._renderer.clearLines(s,i);let h=[],p=[];for(let m=s;m<=i;++m){let x=u.lines.get(m+u.ydisp);if(!x)return;for(let b=0;b<c;++b){let v;if(x.getBg(b)&268435456)v=x._extendedAttrs[b]??Eu;else{let k=x._extendedAttrs[b];if(!k||k.imageId===void 0||k.imageId===-1)continue;v=k}let w=v.imageId;if(w===void 0||w===-1)continue;let I=this._images.get(w);if(v.tileId!==-1){let k=v.tileId,N=b,R=1;for(;++b<c;){let D=x._extendedAttrs[b];if(!D||D.imageId!==w||D.tileId!==k+R)break;R++}b--,I?I.actual&&h.push({imgSpec:I,tileId:k,col:N,row:m,count:R}):this._opts.showPlaceholder&&p.push({col:N,row:m,count:R}),this._fullyCleared=!1}}}h.sort((m,x)=>m.imgSpec.zIndex-x.imgSpec.zIndex);for(let m of p)this._renderer.drawPlaceholder(m.col,m.row,m.count);for(let m of h)this._renderer.draw(m.imgSpec,m.tileId,m.col,m.row,m.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,s=this._viewportMetrics.cols-1;for(let i=0;i<r;++i){let u=t.lines.get(i);if(u.getBg(s)&268435456){let c=u._extendedAttrs[s]??Eu,h=c.imageId;if(h===void 0||h===-1)continue;let p=this._images.get(h);if(!p)continue;let m=Math.ceil((p.actual?.width||0)/p.actualCellSize.width);if(c.tileId%m+1>=m)continue;let x=!1;for(let w=s+1;w>e.cols;++w)if(u._data[w*3+0]&4194303){x=!0;break}if(x)continue;let b=Math.min(e.cols,m-c.tileId%m+s),v=c.tileId;for(let w=s+1;w<b;++w)this._writeToCell(u,w,h,++v),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??Eu;if(s.imageId&&s.imageId!==-1){let i=this._images.get(s.imageId)?.orig;if(window.ImageBitmap&&i instanceof ImageBitmap){let u=z0.createCanvas(window.document,i.width,i.height);return u.getContext("2d")?.drawImage(i,0,0,i.width,i.height),u}return i}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??Eu;if(s.imageId&&s.imageId!==-1&&s.tileId!==-1){let i=this._images.get(s.imageId);if(i)return this._renderer.extractTile(i,s.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let s=this._images.get(++this._lowestId);s&&s.orig&&(r-=s.orig.width*s.orig.height,s.actual&&s.orig!==s.actual&&(r-=s.actual.width*s.actual.height),s.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,s){if(e._data[t*3+2]&268435456){let i=e._extendedAttrs[t];if(i){if(i.imageId!==void 0){let u=this._images.get(i.imageId);u&&u.tileCount--,i.imageId=r,i.tileId=s;return}e._extendedAttrs[t]=new Gf(i.ext,i.urlId,r,s);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Gf(0,0,r,s)}_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 s=e.lines.get(r);if(s){for(let i=0;i<this._terminal.cols;++i)if(s._data[i*3+2]&268435456){let u=s._extendedAttrs[i]?.imageId;if(u){let c=this._images.get(u);c&&c.tileCount++}}}}let t=[];for(let[r,s]of this._images.entries())s.bufferType==="alternate"&&!s.tileCount&&(s.marker?.dispose(),t.push(r));for(let r of t)this._delImg(r)}},AT=Y0(Qx()),TT=Y0(mT());function wd(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Oh(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 Gm(e){let t=wd(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function CT(e){if(typeof Buffer<"u")return Buffer.from(wd(e),"base64").toString();let t=atob(wd(e)),r=new Uint8Array(t.length);for(let s=0;s<r.length;++s)r[s]=t.charCodeAt(s);return new TextDecoder().decode(r)}var Vm={inline:Oh,size:Oh,name:CT,width:Gm,height:Gm,preserveAspectRatio:Oh},qm=[70,105,108,101],Zm=[77,117,108,116,105,112,97,114,116,70,105,108,101],Fh=[70,105,108,101,80,97,114,116],Uh=[70,105,108,101,69,110,100],$h=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],zh=1024,ST=class{constructor(){this.state=0,this._buffer=new Uint32Array(zh),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===Uh.length){for(let t=0;t<Uh.length;++t)if(this._buffer[t]!==Uh[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===$h.length){for(let t=0;t<$h.length;++t)if(this._buffer[t]!==$h[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,s){let i=this.state,u=this._position,c=this._buffer;if(i===1||i===4||i===0&&u>14)return-1;for(let h=r;h<s;++h){let p=t[h];switch(p){case 59:if(!this._storeValue(u))return this._a();i=2,u=0;break;case 61:if(i===0){if(c[0]===70){let m=0;for(;m<qm.length;++m)if(c[m]!==qm[m])return this._a();if(this.fields.type=1,u===Fh.length){for(;m<Fh.length;++m)if(c[m]!==Fh[m])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(c[0]===77){for(let m=0;m<Zm.length;++m)if(c[m]!==Zm[m])return this._a();this.fields.type=2}else return this._a();i=2,u=0}else if(i===2){if(!this._storeKey(u))return this._a();i=3,u=0}else if(i===3){if(u>=zh)return this._a();c[u++]=p}break;case 58:return i===3&&!this._storeValue(u)?this._a():(this.state=4,h+1);default:if(u>=zh)return this._a();c[u++]=p}}return this.state=i,this._position=u,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=wd(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]=Vm[this._key]?Vm[this._key](r):r}catch{return!1}return!0}return!1}},Ad={mime:"unsupported",width:0,height:0};function _T(e){if(e.length<24)return Ad;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,s]=LT(e);return{mime:"image/jpeg",width:r,height:s}}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]}:Ad}function LT(e){let t=e.length,r=4,s=e[r]<<8|e[r+1];for(;;){if(r+=s,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,s=e[r]<<8|e[r+1]}}var Hh={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},IT=class{constructor(e,t,r,s){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=s,this._aborted=!1,this._hp=new ST,this._header=Hh,this._metrics=Ad,this._isMultipart=!1,this._abortMulti=!1;let i=Math.ceil(this._opts.iipSizeLimit*4/3),u=Math.min(1048576,i);this._dec=new AT.default(4194304,i,u),this._qoiDec=new TT.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=Ad,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 s=this._hp.parse(e,t,r);if(s===-1){this._aborted=!0;return}if(s>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},Hh,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(s,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=qa.width,h=qa.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,m=`\x1B]1337;ReportCellSize=${h.toFixed(3)};${c.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(m,!1),!0}if(t===2)return this._header=Object.assign({},Hh,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,s=0,i;if((i=e)&&(i=!this._dec.end())&&(this._metrics=_T(this._dec.data8),(i=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,s=this._metrics.height,(i=r&&s&&r*s<this._opts.pixelLimit)&&([r,s]=this._resize(r,s).map(Math.floor),i=r&&s&&r*s<this._opts.pixelLimit))),!i)return this._dec.release(),!0;let u;if(this._metrics.mime==="image/qoi"){let c=this._qoiDec.decode(this._dec.data8);if(u=new ImageData(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&s===this._qoiDec.height){this._dec.release();let h=z0.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return h.getContext("2d")?.putImageData(u,0,0),this._storage.addImage(h),!0}}else u=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(u,{resizeWidth:r,resizeHeight:s}).then(c=>(this._storage.addImage(c),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||qa.width,s=this._renderer.dimensions?.css.cell.height||qa.height,i=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,u=this._renderer.dimensions?.css.canvas.height||s*this._coreTerminal.rows,c=this._dim(this._header.width,i,r),h=this._dim(this._header.height,u,s);if(!c&&!h){let p=i/e,m=(u-s)/t,x=Math.min(p,m);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}},kT=Y0(Qx());function Ym(e){let t={},r=e.split(",");for(let s of r){let i=s.indexOf("=");if(i===-1)continue;let u=s.substring(0,i),c=s.substring(i+1);if(u==="a"){t.action=c;continue}if(u==="o"){t.compression=c;continue}if(u==="t"){t.transmission=c;continue}if(u==="d"){t.deleteSelector=c;continue}let h=parseInt(c,10);switch(u){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 Km=0,ET=class{constructor(e,t,r,s){this._opts=e,this._renderer=t,this._kittyStorage=r,this._coreTerminal=s,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 s=r;for(let u=t;u<r;u++)if(e[u]===59){this._inControlData=!1,s=u;break}let i=s-t;if(this._controlLength+i>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,s),this._controlLength),this._controlLength+=i,!this._inControlData){if(this._parsedCommand=Ym(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 u=s+1;u<r&&this._streamPayload(e,u,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let s=this._parsedCommand?.id??this._lastPendingKey??0,i=this._pendingTransmissions.get(s),u=i?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,u+this._totalEncodedSize>this._encodedSizeLimit){let c=this._activeDecoder??i?.decoder;c&&c.release(),this._activeDecoder=null,i&&this._removePendingEntry(s),this._aborted=!0;return}this._decodeError||(i?.decoder&&!this._activeDecoder&&(this._activeDecoder=i.decoder),this._activeDecoder||(this._activeDecoder=new kT.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==Km&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,i&&this._removePendingEntry(s)))}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,s=t.more===1,i=this._pendingTransmissions.get(r);if(s)return this._activeDecoder&&(i?(i.totalEncodedSize+=this._totalEncodedSize,i.decodeError=i.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;i&&(this._lastPendingKey=void 0);let u=this._decodeError,c=t,h=this._activeDecoder;i&&(c=i.cmd,h=i.decoder,u=u||i.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==Km&&(u=!0),p=h.data8),this._activeDecoder=null;let m=this._handleCommandWithBytesAndCmd(c,p,u);return h&&h.release(),m}_parseControlDataString(){let e="";for(let t=0;t<this._controlLength;t++)e+=String.fromCodePoint(this._controlData[t]);return e}_handleNoPayloadCommand(){let e=Ym(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 s=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)),s}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(s=>(this._sendResponse(t,s?"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 s=e.id??this._kittyStorage.lastImageId,i=this._kittyStorage.getImage(s);if(i){let u=this._displayImage(i,e);return e.id!==void 0?u.then(c=>(this._sendResponse(s,c?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):u.then(()=>!0)}return!0}_handleQuery(e,t,r){let s=e.id??0,i=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(s,"EINVAL:unsupported transmission medium",i),!0;if(r)return this._sendResponse(s,"EINVAL:invalid base64 data",i),!0;if(t.length===0)return this._sendResponse(s,"OK",i),!0;let u=e.format??32;if(u===100)this._sendResponse(s,"OK",i);else{let c=e.width??0,h=e.height??0;if(!c||!h)return this._sendResponse(s,"EINVAL:width and height required for raw pixel data",i),!0;let p=u===32?4:3,m=c*h*p;if(t.length<m)return this._sendResponse(s,"EINVAL:insufficient pixel data",i),!0;this._sendResponse(s,"OK",i)}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,s){let i=t==="OK";if(i&&r>=1||!i&&r>=2)return;let u=s?`,p=${s}`:"",c=`\x1B_Gi=${e}${u};${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 s=Math.max(0,t.x??0),i=Math.max(0,t.y??0),u=t.sourceWidth||r.width-s,c=t.sourceHeight||r.height-i,h=Math.max(0,r.width-s),p=Math.max(0,r.height-i),m=Math.max(0,Math.min(u,h)),x=Math.max(0,Math.min(c,p));if(m===0||x===0)throw new Error("invalid source rectangle");if(s!==0||i!==0||m!==r.width||x!==r.height){let Ee=await createImageBitmap(r,s,i,m,x);r.close(),r=Ee}let b=this._renderer.dimensions?.css.cell.width||qa.width,v=this._renderer.dimensions?.css.cell.height||qa.height,w,I;t.columns!==void 0&&t.rows!==void 0?(w=t.columns,I=t.rows):t.columns!==void 0?(w=t.columns,I=Math.max(1,Math.ceil(r.height/r.width*(w*b)/v))):t.rows!==void 0?(I=t.rows,w=Math.max(1,Math.ceil(r.width/r.height*(I*v)/b))):(w=Math.ceil(r.width/b),I=Math.ceil(r.height/v));let k=r.width,N=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(k=Math.round(w*b),N=Math.round(I*v)),k*N>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let R=this._coreTerminal._core.buffer,D=R.x,P=R.y,V=R.ybase,F=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(k!==r.width||N!==r.height){let Ee=await createImageBitmap(r,{resizeWidth:k,resizeHeight:N});r.close(),r=Ee}let Y=Math.min(Math.max(0,t.xOffset??0),b-1),Z=Math.min(Math.max(0,t.yOffset??0),v-1);if(Y!==0||Z!==0){let Ee=t.columns!==void 0?Math.round(w*b):r.width+Y,Ie=t.rows!==void 0?Math.round(I*v):r.height+Z,be=z0.createCanvas(window.document,Ee,Ie),et=be.getContext("2d");if(!et)throw new Error("Failed to create offset canvas context");et.drawImage(r,Y,Z);let Pe=await createImageBitmap(be);if(be.width=be.height=0,r.close(),r=Pe,k=r.width,N=r.height,k*N>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(w=Math.ceil(r.width/b)),t.rows===void 0&&(I=Math.ceil(r.height/v))}let he=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,F,he),r=void 0,t.cursorMovement===1){let Ee=R.ybase-V;R.x=D,R.y=Math.max(P-Ee,0)}else R.x=Math.min(D+w,this._coreTerminal.cols)}catch(s){throw r?.close(),s}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let k=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let N=URL.createObjectURL(k),R=new Image;return new Promise((D,P)=>{R.addEventListener("load",()=>{URL.revokeObjectURL(N);let V=z0.createCanvas(window.document,R.width,R.height);V.getContext("2d")?.drawImage(R,0,0),createImageBitmap(V).then(D).catch(P)}),R.addEventListener("error",()=>{URL.revokeObjectURL(N),P(new Error("Failed to load image"))}),R.src=N})}return createImageBitmap(k)}let r=e.width,s=e.height;if(!r||!s)throw new Error("Width and height required for raw pixel data");let i=e.format===32?4:3,u=r*s*i;if(t.length<u)throw new Error("Insufficient pixel data");let c=r*s;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,c*4),r,s));let h=new Uint8ClampedArray(c*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),m=new Uint32Array(h.buffer),x=c&-4,b=0,v=0;for(let k=0;k<x;k+=4){let N=p[b++],R=p[b++],D=p[b++];m[v++]=4278190080|N,m[v++]=4278190080|N>>>24|R<<8,m[v++]=4278190080|R>>>16|D<<16,m[v++]=4278190080|D>>>8}let w=x*3,I=x*4;for(let k=x;k<c;k++)h[I]=t[w],h[I+1]=t[w+1],h[I+2]=t[w+2],h[I+3]=255,w+=3,I+=4;return createImageBitmap(new ImageData(h,r,s))}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),s=r.writable.getWriter();s.write(e),s.close();let i=[],u=r.readable.getReader();for(;;){let{done:m,value:x}=await u.read();if(m)break;i.push(x)}let c=i.reduce((m,x)=>m+x.length,0),h=new Uint8Array(c),p=0;for(let m of i)h.set(m,p),p+=m.length;return h}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},Fx=class Vf{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let s=this._storageIdToKittyId.get(r);s!==void 0&&(this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(r),this._images.delete(s))},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 s=t??this._nextImageId++,i=this._kittyIdToStorageId.get(s);return i!==void 0&&(this._storage.deleteImage(i),this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(i)),!this._images.has(s)&&this._images.size>=Vf._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(s,{...r,id:s}),s}addImage(t,r,s,i,u){let c=this._kittyIdToStorageId.get(t);c!==void 0&&this._storageIdToKittyId.delete(c),this._addImageOpts.scrolling=s,this._addImageOpts.layer=i,this._addImageOpts.zIndex=u;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<=Vf._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};Fx._maxStoredImages=256;var RT=Fx,Yc=Y0(Fp()),MT=Y0(xT()),NT=4194304,qf=Yc.PALETTE_ANSI_256;qf.set(Yc.PALETTE_VT340_COLOR);var DT=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,MT.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:qf,paletteLimit:this._opts.sixelPaletteLimit}).then(s=>this._dec=s)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,qf,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:BT(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(s){console.warn(`SIXEL: error while decoding image - ${s}`),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 s=z0.createCanvas(void 0,t,r);return s.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>NT&&this._dec.release(),this._storage.addImage(s),!0}};function BT(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=Ru(t.foreground.rgba);else if(e.isFgRGB()){let s=e.constructor.toColorRGB(e.getFgColor());r=(0,Yc.toRGBA8888)(...s)}else r=Ru(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=Ru(t.background.rgba);else if(e.isBgRGB()){let s=e.constructor.toColorRGB(e.getBgColor());r=(0,Yc.toRGBA8888)(...s)}else r=Ru(t.ansi[e.getBgColor()].rgba);return r}function Ru(e){return Yc.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var QT=class{constructor(e,t,r,s){this._storage=e,this._opts=t,this._renderer=r,this._terminal=s,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=qa);let r=Math.ceil(e/t.height);for(let s=1;s<r;++s)this._terminal._core._inputHandler.lineFeed()}}},jT=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},Xm={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Jm=4096,PT=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new yT,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},Xm,t),this._defaultOpts=Object.assign({},Xm,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 z0(t),this._storage=new wT(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 QT(this._storage,this._opts,this._renderer,t),s=new DT(this._opts,r,t);this._handlers.set("sixel",s),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},s))}if(this._opts.iipSupport){let r=new jT(this._storage),s=new IT(this._opts,this._renderer,r,t);this._handlers.set("iip",s),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,s))}if(this._opts.kittySupport){let r=new RT(this._storage),s=new ET(this._opts,this._renderer,r,t);this._handlers.set("kitty",s),this._disposeLater(r,s,t._core._inputHandler._parser.registerApcHandler({final:"G"},s))}}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]<=Jm?(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;${Jm}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,s=this._renderer?.dimensions?.css.canvas.height;if(!r||!s){let u=qa;r=(this._terminal?.cols||80)*u.width,s=(this._terminal?.rows||24)*u.height}if(r*s<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${s.toFixed(0)}S`);else{let u=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${u};${u}S`)}return!0;case 4:let i=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${i};${i}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const p0=new Map;function I0(e){return{name:e,get hasSubscribers(){return(p0.get(e)?.size??0)>0},publish(t){const r=p0.get(e);if(r)for(const s of r)s(t,e)},subscribe(t){const r=p0.get(e)??new Set;r.add(t),p0.set(e,r)},unsubscribe(t){const r=p0.get(e);if(!r)return!1;const s=r.delete(t);return r.size===0&&p0.delete(e),s}}}function OT(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:I0(t.start),end:I0(t.end),asyncStart:I0(t.asyncStart),asyncEnd:I0(t.asyncEnd),error:I0(t.error),traceSync(s,i,u,...c){r.start.publish(i);try{const h=s.apply(u,c);return r.end.publish(i),h}catch(h){throw r.error.publish(h),h}},async tracePromise(s,i,u,...c){r.asyncStart.publish(i);try{const h=await s.apply(u,c);return r.asyncEnd.publish(i),h}catch(h){throw r.error.publish(h),h}},traceCallback(s,i,u,c,...h){r.start.publish(u);try{const p=s.apply(c,h);return r.end.publish(u),p}catch(p){throw r.error.publish(p),p}}};return r}var FT=Object.create,Up=Object.defineProperty,UT=Object.getOwnPropertyDescriptor,$T=Object.getOwnPropertyNames,zT=Object.getPrototypeOf,HT=Object.prototype.hasOwnProperty,Ux=e=>{throw TypeError(e)},WT=(e,t,r)=>t in e?Up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,GT=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},VT=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $T(t))!HT.call(e,i)&&i!==r&&Up(e,i,{get:()=>t[i],enumerable:!(s=UT(t,i))||s.enumerable});return e},qT=(e,t,r)=>(r=e!=null?FT(zT(e)):{},VT(!e||!e.__esModule?Up(r,"default",{value:e,enumerable:!0}):r,e)),Ws=(e,t,r)=>WT(e,typeof t!="symbol"?t+"":t,r),$p=(e,t,r)=>t.has(e)||Ux("Cannot "+r),G=(e,t,r)=>($p(e,t,"read from private field"),r?r.call(e):t.get(e)),$r=(e,t,r)=>t.has(e)?Ux("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),fr=(e,t,r,s)=>($p(e,t,"write to private field"),t.set(e,r),r),St=(e,t,r)=>($p(e,t,"access private method"),r),Wh=(e,t,r,s)=>({set _(i){fr(e,t,i)},get _(){return G(e,t,s)}}),ZT=GT((e,t)=>{var r=(()=>{var s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,h=(n,o)=>{for(var l in o)s(n,l,{get:o[l],enumerable:!0})},p=(n,o,l,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of u(o))!c.call(n,f)&&f!==l&&s(n,f,{get:()=>o[f],enumerable:!(d=i(o,f))||d.enumerable});return n},m=n=>p(s({},"__esModule",{value:!0}),n),x={};h(x,{BoundingBox:()=>Ge,Font:()=>V1,Glyph:()=>Ur,Path:()=>Xe,_parse:()=>ct,load:()=>s7,loadSync:()=>i7,parse:()=>n7});var b=0,v=-3;function w(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function I(n,o){this.source=n,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new w,this.dtree=new w}var k=new w,N=new w,R=new Uint8Array(30),D=new Uint16Array(30),P=new Uint8Array(30),V=new Uint16Array(30),F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Y=new w,Z=new Uint8Array(320);function he(n,o,l,d){var f,g;for(f=0;f<l;++f)n[f]=0;for(f=0;f<30-l;++f)n[f+l]=f/l|0;for(g=d,f=0;f<30;++f)o[f]=g,g+=1<<n[f]}function Ee(n,o){var l;for(l=0;l<7;++l)n.table[l]=0;for(n.table[7]=24,n.table[8]=152,n.table[9]=112,l=0;l<24;++l)n.trans[l]=256+l;for(l=0;l<144;++l)n.trans[24+l]=l;for(l=0;l<8;++l)n.trans[168+l]=280+l;for(l=0;l<112;++l)n.trans[176+l]=144+l;for(l=0;l<5;++l)o.table[l]=0;for(o.table[5]=32,l=0;l<32;++l)o.trans[l]=l}var Ie=new Uint16Array(16);function be(n,o,l,d){var f,g;for(f=0;f<16;++f)n.table[f]=0;for(f=0;f<d;++f)n.table[o[l+f]]++;for(n.table[0]=0,g=0,f=0;f<16;++f)Ie[f]=g,g+=n.table[f];for(f=0;f<d;++f)o[l+f]&&(n.trans[Ie[o[l+f]]++]=f)}function et(n){n.bitcount--||(n.tag=n.source[n.sourceIndex++],n.bitcount=7);var o=n.tag&1;return n.tag>>>=1,o}function Pe(n,o,l){if(!o)return l;for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var d=n.tag&65535>>>16-o;return n.tag>>>=o,n.bitcount-=o,d+l}function fe(n,o){for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var l=0,d=0,f=0,g=n.tag;do d=2*d+(g&1),g>>>=1,++f,l+=o.table[f],d-=o.table[f];while(d>=0);return n.tag=g,n.bitcount-=f,o.trans[l+d]}function De(n,o,l){var d,f,g,y,A,S;for(d=Pe(n,5,257),f=Pe(n,5,1),g=Pe(n,4,4),y=0;y<19;++y)Z[y]=0;for(y=0;y<g;++y){var M=Pe(n,3,0);Z[F[y]]=M}for(be(Y,Z,0,19),A=0;A<d+f;){var E=fe(n,Y);switch(E){case 16:var $=Z[A-1];for(S=Pe(n,2,3);S;--S)Z[A++]=$;break;case 17:for(S=Pe(n,3,3);S;--S)Z[A++]=0;break;case 18:for(S=Pe(n,7,11);S;--S)Z[A++]=0;break;default:Z[A++]=E;break}}be(o,Z,0,d),be(l,Z,d,f)}function pe(n,o,l){for(;;){var d=fe(n,o);if(d===256)return b;if(d<256)n.dest[n.destLen++]=d;else{var f,g,y,A;for(d-=257,f=Pe(n,R[d],D[d]),g=fe(n,l),y=n.destLen-Pe(n,P[g],V[g]),A=y;A<y+f;++A)n.dest[n.destLen++]=n.dest[A]}}}function ae(n){for(var o,l,d;n.bitcount>8;)n.sourceIndex--,n.bitcount-=8;if(o=n.source[n.sourceIndex+1],o=256*o+n.source[n.sourceIndex],l=n.source[n.sourceIndex+3],l=256*l+n.source[n.sourceIndex+2],o!==(~l&65535))return v;for(n.sourceIndex+=4,d=o;d;--d)n.dest[n.destLen++]=n.source[n.sourceIndex++];return n.bitcount=0,b}function ce(n,o){var l=new I(n,o),d,f,g;do{switch(d=et(l),f=Pe(l,2,0),f){case 0:g=ae(l);break;case 1:g=pe(l,k,N);break;case 2:De(l,l.ltree,l.dtree),g=pe(l,l.ltree,l.dtree);break;default:g=v}if(g!==b)throw new Error("Data error")}while(!d);return l.destLen<l.dest.length?typeof l.dest.slice=="function"?l.dest.slice(0,l.destLen):l.dest.subarray(0,l.destLen):l.dest}Ee(k,N),he(R,D,4,3),he(P,V,2,1),R[28]=0,D[28]=258;function Te(n,o,l,d,f){return Math.pow(1-f,3)*n+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*l+Math.pow(f,3)*d}function we(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}we.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},we.prototype.addPoint=function(n,o){typeof n=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=n,this.x2=n),n<this.x1&&(this.x1=n),n>this.x2&&(this.x2=n)),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))},we.prototype.addX=function(n){this.addPoint(n,null)},we.prototype.addY=function(n){this.addPoint(null,n)},we.prototype.addBezier=function(n,o,l,d,f,g,y,A){let S=[n,o],M=[l,d],E=[f,g],$=[y,A];this.addPoint(n,o),this.addPoint(y,A);for(let U=0;U<=1;U++){let oe=6*S[U]-12*M[U]+6*E[U],X=-3*S[U]+9*M[U]-9*E[U]+3*$[U],de=3*M[U]-3*S[U];if(X===0){if(oe===0)continue;let gr=-de/oe;0<gr&&gr<1&&(U===0&&this.addX(Te(S[U],M[U],E[U],$[U],gr)),U===1&&this.addY(Te(S[U],M[U],E[U],$[U],gr)));continue}let Fe=Math.pow(oe,2)-4*de*X;if(Fe<0)continue;let rr=(-oe+Math.sqrt(Fe))/(2*X);0<rr&&rr<1&&(U===0&&this.addX(Te(S[U],M[U],E[U],$[U],rr)),U===1&&this.addY(Te(S[U],M[U],E[U],$[U],rr)));let Gt=(-oe-Math.sqrt(Fe))/(2*X);0<Gt&&Gt<1&&(U===0&&this.addX(Te(S[U],M[U],E[U],$[U],Gt)),U===1&&this.addY(Te(S[U],M[U],E[U],$[U],Gt)))}},we.prototype.addQuad=function(n,o,l,d,f,g){let y=n+.6666666666666666*(l-n),A=o+2/3*(d-o),S=y+1/3*(f-n),M=A+1/3*(g-o);this.addBezier(n,o,y,A,S,M,f,g)};var Ge=we;function ie(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var ve={};function ft(n,o){let l=Math.floor(n),d=n-l;if(ve[o]||(ve[o]={}),ve[o][d]!==void 0){let g=ve[o][d];return l+g}let f=+(Math.round(d+"e+"+o)+"e-"+o);return ve[o][d]=f,l+f}function Rt(n){let o=[[]],l=0,d=0;for(let f=0;f<n.length;f+=1){let g=o[o.length-1],y=n[f],A=g[0],S=g[1],M=g[g.length-1],E=n[f+1];g.push(y),y.type==="M"?(l=y.x,d=y.y):y.type==="L"&&(!E||E.type==="Z")?Math.abs(y.x-l)>1||Math.abs(y.y-d)>1||g.pop():y.type==="L"&&M&&M.x===y.x&&M.y===y.y?g.pop():y.type==="Z"&&(A&&S&&M&&A.type==="M"&&S.type==="L"&&M.type==="L"&&M.x===A.x&&M.y===A.y&&(g.shift(),g[0].type="M"),f+1<n.length&&o.push([]))}return n=[].concat.apply([],o),n}function He(n){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},n)}function K(n){return parseInt(n)===n&&(n={decimalPlaces:n,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},n)}ie.prototype.fromSVG=function(n,o={}){typeof SVGPathElement<"u"&&n instanceof SVGPathElement&&(n=n.getAttribute("d")),o=He(o),this.commands=[];let l="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",g="-+",y={},A=[""],S=!1;function M(X){return X.filter(de=>de.length).map(de=>{let Fe=parseFloat(de);return(o.decimalPlaces||o.decimalPlaces===0)&&(Fe=ft(Fe,o.decimalPlaces)),Fe})}function E(X){if(!this.commands.length)return X;let de=this.commands[this.commands.length-1];for(let Fe=0;Fe<X.length;Fe++)X[Fe]+=de[Fe&1?"y":"x"];return X}function $(){if(y.type===void 0)return;let X=y.type.toUpperCase(),de=X!=="Z"&&y.type.toUpperCase()!==y.type,Fe=M(A);if(A=[""],!Fe.length&&X!=="Z")return;de&&X!=="H"&&X!=="V"&&(Fe=E.apply(this,[Fe]));let rr=this.commands.length&&this.commands[this.commands.length-1].x||0,Gt=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(X){case"M":this.moveTo(...Fe);break;case"L":this.lineTo(...Fe);break;case"V":for(let gr=0;gr<Fe.length;gr++){let Mr=0;de&&(Mr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(rr,Fe[gr]+Mr)}break;case"H":for(let gr=0;gr<Fe.length;gr++){let Mr=0;de&&(Mr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Fe[gr]+Mr,Gt)}break;case"C":this.bezierCurveTo(...Fe);break;case"Q":this.quadraticCurveTo(...Fe);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let gr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][gr]===void 0&&(this.commands[this.commands.length-1][gr]=0)}for(let X=0;X<n.length;X++){let de=n.charAt(X),Fe=A[A.length-1];if(l.indexOf(de)>-1)A[A.length-1]+=de;else if(g.indexOf(de)>-1)if(!y.type&&!this.commands.length&&(y.type="L"),de==="-")!y.type||Fe.indexOf("-")>0?S=!0:Fe.length?A.push("-"):A[A.length-1]=de;else if(!y.type||Fe.length>0)S=!0;else continue;else if(d.indexOf(de)>-1)y.type?($.apply(this),y={type:de}):y.type=de;else{if(f.indexOf(de)>-1)throw new Error("Unsupported path command: "+de+". Currently supported commands are "+d.split("").join(", ")+".");` ,
63
- \r\f\v`.indexOf(de)>-1?A.push(""):de==="."?!y.type||Fe.indexOf(de)>-1?S=!0:A[A.length-1]+=de:S=!0}if(S)throw new Error("Unexpected character: "+de+" at offset "+X)}$.apply(this),o.optimize&&(this.commands=Rt(this.commands));let U=o.flipY,oe=o.flipYBase;if(U===!0&&o.flipYBase===void 0){let X=this.getBoundingBox();oe=X.y1+X.y2}for(let X in this.commands){let de=this.commands[X];for(let Fe in de)["x","x1","x2"].includes(Fe)?this.commands[X][Fe]=o.x+de[Fe]*o.scale:["y","y1","y2"].includes(Fe)&&(this.commands[X][Fe]=o.y+(U?oe-de[Fe]:de[Fe])*o.scale)}return this},ie.fromSVG=function(n,o){return new ie().fromSVG(n,o)},ie.prototype.moveTo=function(n,o){this.commands.push({type:"M",x:n,y:o})},ie.prototype.lineTo=function(n,o){this.commands.push({type:"L",x:n,y:o})},ie.prototype.curveTo=ie.prototype.bezierCurveTo=function(n,o,l,d,f,g){this.commands.push({type:"C",x1:n,y1:o,x2:l,y2:d,x:f,y:g})},ie.prototype.quadTo=ie.prototype.quadraticCurveTo=function(n,o,l,d){this.commands.push({type:"Q",x1:n,y1:o,x:l,y:d})},ie.prototype.close=ie.prototype.closePath=function(){this.commands.push({type:"Z"})},ie.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof Ge){let o=n;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,n)},ie.prototype.getBoundingBox=function(){let n=new Ge,o=0,l=0,d=0,f=0;for(let g=0;g<this.commands.length;g++){let y=this.commands[g];switch(y.type){case"M":n.addPoint(y.x,y.y),o=d=y.x,l=f=y.y;break;case"L":n.addPoint(y.x,y.y),d=y.x,f=y.y;break;case"Q":n.addQuad(d,f,y.x1,y.y1,y.x,y.y),d=y.x,f=y.y;break;case"C":n.addBezier(d,f,y.x1,y.y1,y.x2,y.y2,y.x,y.y),d=y.x,f=y.y;break;case"Z":d=o,f=l;break;default:throw new Error("Unexpected path command "+y.type)}}return n.isEmpty()&&n.addPoint(0,0),n},ie.prototype.draw=function(n){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],n);return}let l=this._image;if(l){n.drawImage(l.image,l.x,l.y,l.width,l.height);return}n.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?n.moveTo(f.x,f.y):f.type==="L"?n.lineTo(f.x,f.y):f.type==="C"?n.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?n.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&n.closePath()}this.fill&&(n.fillStyle=this.fill,n.fill()),this.stroke&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeWidth,n.stroke())},ie.prototype.toPathData=function(n){n=K(n);function o(A){let S=ft(A,n.decimalPlaces);return Math.round(A)===S?""+S:S.toFixed(n.decimalPlaces)}function l(){let A="";for(let S=0;S<arguments.length;S+=1){let M=arguments[S];M>=0&&S>0&&(A+=" "),A+=o(M)}return A}let d=this.commands;n.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=Rt(d));let f=n.flipY,g=n.flipYBase;if(f===!0&&g===void 0){let A=new ie;A.extend(d);let S=A.getBoundingBox();g=S.y1+S.y2}let y="";for(let A=0;A<d.length;A+=1){let S=d[A];S.type==="M"?y+="M"+l(S.x,f?g-S.y:S.y):S.type==="L"?y+="L"+l(S.x,f?g-S.y:S.y):S.type==="C"?y+="C"+l(S.x1,f?g-S.y1:S.y1,S.x2,f?g-S.y2:S.y2,S.x,f?g-S.y:S.y):S.type==="Q"?y+="Q"+l(S.x1,f?g-S.y1:S.y1,S.x,f?g-S.y:S.y):S.type==="Z"&&(y+="Z")}return y},ie.prototype.toSVG=function(n,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(n));let l='<path d="';return l+=o,l+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?l+=' fill="none"':l+=' fill="'+this.fill+'"'),this.stroke&&(l+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),l+="/>",l},ie.prototype.toDOMElement=function(n,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(n));let l=document.createElementNS("http://www.w3.org/2000/svg","path");return l.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?l.setAttribute("fill","none"):l.setAttribute("fill",this.fill)),this.stroke&&(l.setAttribute("stroke",this.stroke),l.setAttribute("stroke-width",this.strokeWidth)),l};var Xe=ie;function Ce(n){throw new Error(n)}function z(n,o){n||Ce(o)}var q={fail:Ce,argument:z,assert:z},ye=32768,Ve=2147483648,pt=-32768,ht=32767+1/65536,It={},Se={},ge={};function Ue(n){return function(){return n}}Se.BYTE=function(n){return q.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]},ge.BYTE=Ue(1),Se.CHAR=function(n){return[n.charCodeAt(0)]},ge.CHAR=Ue(1),Se.CHARARRAY=function(n){(n===null||typeof n>"u")&&(n="",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 l=0;l<n.length;l+=1)o[l]=n.charCodeAt(l);return o},ge.CHARARRAY=function(n){return typeof n>"u"?0:n.length},Se.USHORT=function(n){return[n>>8&255,n&255]},ge.USHORT=Ue(2),Se.SHORT=function(n){return n>=ye&&(n=-(2*ye-n)),[n>>8&255,n&255]},ge.SHORT=Ue(2),Se.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]},ge.UINT24=Ue(3),Se.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]},ge.ULONG=Ue(4),Se.LONG=function(n){return n>=Ve&&(n=-(2*Ve-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]},ge.LONG=Ue(4),Se.FLOAT=function(n){if(n>ht||n<pt)throw new Error(`Value ${n} is outside the range of representable values in 16.16 format`);let o=Math.round(n*65536)<<0;return Se.ULONG(o)},ge.FLOAT=ge.ULONG,Se.FIXED=Se.ULONG,ge.FIXED=ge.ULONG,Se.FWORD=Se.SHORT,ge.FWORD=ge.SHORT,Se.UFWORD=Se.USHORT,ge.UFWORD=ge.USHORT,Se.F2DOT14=function(n){return Se.USHORT(n*16384)},ge.F2DOT14=ge.USHORT,Se.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]},ge.LONGDATETIME=Ue(8),Se.TAG=function(n){return q.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]},ge.TAG=Ue(4),Se.Card8=Se.BYTE,ge.Card8=ge.BYTE,Se.Card16=Se.USHORT,ge.Card16=ge.USHORT,Se.OffSize=Se.BYTE,ge.OffSize=ge.BYTE,Se.SID=Se.USHORT,ge.SID=ge.USHORT,Se.NUMBER=function(n){return n>=-107&&n<=107?[n+139]:n>=108&&n<=1131?(n=n-108,[(n>>8)+247,n&255]):n>=-1131&&n<=-108?(n=-n-108,[(n>>8)+251,n&255]):n>=-32768&&n<=32767?Se.NUMBER16(n):Se.NUMBER32(n)},ge.NUMBER=function(n){return Se.NUMBER(n).length},Se.NUMBER16=function(n){return[28,n>>8&255,n&255]},ge.NUMBER16=Ue(3),Se.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]},ge.NUMBER32=Ue(5),Se.REAL=function(n){let o=n.toString(),l=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(l){let g=parseFloat("1e"+((l[2]?+l[2]:0)+l[1].length));o=(Math.round(n*g)/g).toString()}let d="";for(let g=0,y=o.length;g<y;g+=1){let A=o[g];A==="e"?d+=o[++g]==="-"?"c":"b":A==="."?d+="a":A==="-"?d+="e":d+=A}d+=d.length&1?"f":"ff";let f=[30];for(let g=0,y=d.length;g<y;g+=2)f.push(parseInt(d.substr(g,2),16));return f},ge.REAL=function(n){return Se.REAL(n).length},Se.NAME=Se.CHARARRAY,ge.NAME=ge.CHARARRAY,Se.STRING=Se.CHARARRAY,ge.STRING=ge.CHARARRAY,It.UTF8=function(n,o,l){let d=[],f=l;for(let g=0;g<f;g++,o+=1)d[g]=n.getUint8(o);return String.fromCharCode.apply(null,d)},It.UTF16=function(n,o,l){let d=[],f=l/2;for(let g=0;g<f;g++,o+=2)d[g]=n.getUint16(o);return String.fromCharCode.apply(null,d)},Se.UTF16=function(n){let o=[];for(let l=0;l<n.length;l+=1){let d=n.charCodeAt(l);o[o.length]=d>>8&255,o[o.length]=d&255}return o},ge.UTF16=function(n){return n.length*2};var bt={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};It.MACSTRING=function(n,o,l,d){let f=bt[d];if(f===void 0)return;let g="";for(let y=0;y<l;y++){let A=n.getUint8(o+y);A<=127?g+=String.fromCharCode(A):g+=f[A&127]}return g};var Ke=typeof WeakMap=="function"&&new WeakMap,Mt,We=function(n){if(!Mt){Mt={};for(let f in bt)Mt[f]=new String(f)}let o=Mt[n];if(o===void 0)return;if(Ke){let f=Ke.get(o);if(f!==void 0)return f}let l=bt[n];if(l===void 0)return;let d={};for(let f=0;f<l.length;f++)d[l.charCodeAt(f)]=f+128;return Ke&&Ke.set(o,d),d};Se.MACSTRING=function(n,o){let l=We(o);if(l===void 0)return;let d=[];for(let f=0;f<n.length;f++){let g=n.charCodeAt(f);if(g>=128&&(g=l[g],g===void 0))return;d[f]=g}return d},ge.MACSTRING=function(n,o){let l=Se.MACSTRING(n,o);return l!==void 0?l.length:0};function vt(n){return n>=-128&&n<=127}function ir(n,o,l){let d=0,f=n.length;for(;o<f&&d<64&&n[o]===0;)++o,++d;return l.push(128|d-1),o}function it(n,o,l){let d=0,f=n.length,g=o;for(;g<f&&d<64;){let y=n[g];if(!vt(y)||y===0&&g+1<f&&n[g+1]===0)break;++g,++d}l.push(d-1);for(let y=o;y<g;++y)l.push(n[y]+256&255);return g}function dt(n,o,l){let d=0,f=n.length,g=o;for(;g<f&&d<64;){let y=n[g];if(y===0||vt(y)&&g+1<f&&vt(n[g+1]))break;++g,++d}l.push(64|d-1);for(let y=o;y<g;++y){let A=n[y];l.push(A+65536>>8&255,A+256&255)}return g}Se.VARDELTAS=function(n){let o=0,l=[];for(;o<n.length;){let d=n[o];d===0?o=ir(n,o,l):d>=-128&&d<=127?o=it(n,o,l):o=dt(n,o,l)}return l},Se.INDEX=function(n){let o=1,l=[o],d=[];for(let A=0;A<n.length;A+=1){let S=Se.OBJECT(n[A]);Array.prototype.push.apply(d,S),o+=S.length,l.push(o)}if(d.length===0)return[0,0];let f=[],g=1+Math.floor(Math.log(o)/Math.log(2))/8|0,y=[void 0,Se.BYTE,Se.USHORT,Se.UINT24,Se.ULONG][g];for(let A=0;A<l.length;A+=1){let S=y(l[A]);Array.prototype.push.apply(f,S)}return Array.prototype.concat(Se.Card16(n.length),Se.OffSize(g),f,d)},ge.INDEX=function(n){return Se.INDEX(n).length},Se.DICT=function(n){let o=[],l=Object.keys(n),d=l.length;for(let f=0;f<d;f+=1){let g=parseInt(l[f],0),y=n[g],A=Se.OPERAND(y.value,y.type),S=Se.OPERATOR(g);for(let M=0;M<A.length;M++)o.push(A[M]);for(let M=0;M<S.length;M++)o.push(S[M])}return o},ge.DICT=function(n){return Se.DICT(n).length},Se.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]},Se.OPERAND=function(n,o){let l=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){q.argument(n.length===o.length,"Not enough arguments given for type"+o);let f=Se.OPERAND(n[d],o[d]);for(let g=0;g<f.length;g++)l.push(f[g])}else if(o==="SID"){let d=Se.NUMBER(n);for(let f=0;f<d.length;f++)l.push(d[f])}else if(o==="offset"){let d=Se.NUMBER32(n);for(let f=0;f<d.length;f++)l.push(d[f])}else if(o==="number"){let d=Se.NUMBER(n);for(let f=0;f<d.length;f++)l.push(d[f])}else if(o==="real"){let d=Se.REAL(n);for(let f=0;f<d.length;f++)l.push(d[f])}else throw new Error("Unknown operand type "+o);return l},Se.OP=Se.BYTE,ge.OP=ge.BYTE;var Bt=typeof WeakMap=="function"&&new WeakMap;Se.CHARSTRING=function(n){if(Bt){let d=Bt.get(n);if(d!==void 0)return d}let o=[],l=n.length;for(let d=0;d<l;d+=1){let f=n[d],g=Se[f.type](f.value);for(let y=0;y<g.length;y++)o.push(g[y])}return Bt&&Bt.set(n,o),o},ge.CHARSTRING=function(n){return Se.CHARSTRING(n).length},Se.OBJECT=function(n){let o=Se[n.type];return q.argument(o!==void 0,"No encoding function for type "+n.type),o(n.value)},ge.OBJECT=function(n){let o=ge[n.type];return q.argument(o!==void 0,"No sizeOf function for type "+n.type),o(n.value)},Se.TABLE=function(n){let o=[],l=(n.fields||[]).length,d=[],f=[];for(let g=0;g<l;g+=1){let y=n.fields[g],A=Se[y.type];q.argument(A!==void 0,"No encoding function for field type "+y.type+" ("+y.name+")");let S=n[y.name];S===void 0&&(S=y.value);let M=A(S);if(y.type==="TABLE")S.fields!==null&&(f.push(o.length),d.push(M)),o.push(0,0);else for(let E=0;E<M.length;E++)o.push(M[E])}for(let g=0;g<d.length;g+=1){let y=f[g],A=o.length;q.argument(A<65536,"Table "+n.tableName+" too big."),o[y]=A>>8,o[y+1]=A&255;for(let S=0;S<d[g].length;S++)o.push(d[g][S])}return o},ge.TABLE=function(n){let o=0,l=(n.fields||[]).length;for(let d=0;d<l;d+=1){let f=n.fields[d],g=ge[f.type];q.argument(g!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let y=n[f.name];y===void 0&&(y=f.value),o+=g(y),f.type==="TABLE"&&(o+=2)}return o},Se.RECORD=Se.TABLE,ge.RECORD=ge.TABLE,Se.LITERAL=function(n){return n},ge.LITERAL=function(n){return n.length};function Et(n,o,l){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=n,this.fields=o,l){let d=Object.keys(l);for(let f=0;f<d.length;f+=1){let g=d[f],y=l[g];this[g]!==void 0&&(this[g]=y)}}}Et.prototype.encode=function(){return Se.TABLE(this)},Et.prototype.sizeOf=function(){return ge.TABLE(this)};function Vt(n,o,l){l===void 0&&(l=o.length);let d=new Array(o.length+1);d[0]={name:n+"Count",type:"USHORT",value:l};for(let f=0;f<o.length;f++)d[f+1]={name:n+f,type:"USHORT",value:o[f]};return d}function te(n,o,l){let d=o.length,f=new Array(d+1);f[0]={name:n+"Count",type:"USHORT",value:d};for(let g=0;g<d;g++)f[g+1]={name:n+g,type:"TABLE",value:l(o[g],g)};return f}function Qe(n,o,l){let d=o.length,f=[];f[0]={name:n+"Count",type:"USHORT",value:d};for(let g=0;g<d;g++)f=f.concat(l(o[g],g));return f}function qe(n){n.format===1?Et.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Vt("glyph",n.glyphs))):n.format===2?Et.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Qe("rangeRecord",n.ranges,function(o,l){return[{name:"startGlyphID"+l,type:"USHORT",value:o.start},{name:"endGlyphID"+l,type:"USHORT",value:o.end},{name:"startCoverageIndex"+l,type:"USHORT",value:o.index}]}))):q.assert(!1,"Coverage format must be 1 or 2.")}qe.prototype=Object.create(Et.prototype),qe.prototype.constructor=qe;function kt(n){Et.call(this,"scriptListTable",Qe("scriptRecord",n,function(o,l){let d=o.script,f=d.defaultLangSys;return q.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+l,type:"TAG",value:o.tag},{name:"script"+l,type:"TABLE",value:new Et("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Et("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(Vt("featureIndex",f.featureIndexes)))}].concat(Qe("langSys",d.langSysRecords,function(g,y){let A=g.langSys;return[{name:"langSysTag"+y,type:"TAG",value:g.tag},{name:"langSys"+y,type:"TABLE",value:new Et("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:A.reqFeatureIndex}].concat(Vt("featureIndex",A.featureIndexes)))}]})))}]}))}kt.prototype=Object.create(Et.prototype),kt.prototype.constructor=kt;function Oe(n){Et.call(this,"featureListTable",Qe("featureRecord",n,function(o,l){let d=o.feature;return[{name:"featureTag"+l,type:"TAG",value:o.tag},{name:"feature"+l,type:"TABLE",value:new Et("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Vt("lookupListIndex",d.lookupListIndexes)))}]}))}Oe.prototype=Object.create(Et.prototype),Oe.prototype.constructor=Oe;function Nt(n,o){Et.call(this,"lookupListTable",te("lookup",n,function(l){let d=o[l.lookupType];return q.assert(!!d,"Unable to write GSUB lookup type "+l.lookupType+" tables."),new Et("lookupTable",[{name:"lookupType",type:"USHORT",value:l.lookupType},{name:"lookupFlag",type:"USHORT",value:l.lookupFlag}].concat(te("subtable",l.subtables,d)))}))}Nt.prototype=Object.create(Et.prototype),Nt.prototype.constructor=Nt;function hr(n){n.format===1?Et.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:n.startGlyph}].concat(Vt("glyph",n.classes))):n.format===2?Et.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Qe("rangeRecord",n.ranges,function(o,l){return[{name:"startGlyphID"+l,type:"USHORT",value:o.start},{name:"endGlyphID"+l,type:"USHORT",value:o.end},{name:"class"+l,type:"USHORT",value:o.classId}]}))):q.assert(!1,"Class format must be 1 or 2.")}hr.prototype=Object.create(Et.prototype),hr.prototype.constructor=hr;var Ae={Table:Et,Record:Et,Coverage:qe,ClassDef:hr,ScriptList:kt,FeatureList:Oe,LookupList:Nt,ushortList:Vt,tableList:te,recordList:Qe};function bn(n,o){return n.getUint8(o)}function _r(n,o){return n.getUint16(o,!1)}function _e(n,o){return n.getInt16(o,!1)}function Qr(n,o){return(n.getUint16(o)<<8)+n.getUint8(o+2)}function wt(n,o){return n.getUint32(o,!1)}function en(n,o){return n.getInt32(o,!1)}function Er(n,o){let l=n.getInt16(o,!1),d=n.getUint16(o+2,!1);return l+d/65535}function le(n,o){let l="";for(let d=o;d<o+4;d+=1)l+=String.fromCharCode(n.getInt8(d));return l}function st(n,o,l){let d=0;for(let f=0;f<l;f+=1)d<<=8,d+=n.getUint8(o+f);return d}function Ut(n,o,l){let d=[];for(let f=o;f<l;f+=1)d.push(n.getUint8(f));return d}function lr(n){let o="";for(let l=0;l<n.length;l+=1)o+=String.fromCharCode(n[l]);return o}var Zt={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},Qt={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 re(n,o){this.data=n,this.offset=o,this.relativeOffset=0}re.prototype.parseByte=function(){let n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},re.prototype.parseChar=function(){let n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},re.prototype.parseCard8=re.prototype.parseByte,re.prototype.parseUShort=function(){let n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},re.prototype.parseCard16=re.prototype.parseUShort,re.prototype.parseSID=re.prototype.parseUShort,re.prototype.parseOffset16=re.prototype.parseUShort,re.prototype.parseShort=function(){let n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},re.prototype.parseF2Dot14=function(){let n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n},re.prototype.parseUInt24=function(){let n=Qr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,n},re.prototype.parseULong=function(){let n=wt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},re.prototype.parseLong=function(){let n=en(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},re.prototype.parseOffset32=re.prototype.parseULong,re.prototype.parseFixed=function(){let n=Er(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},re.prototype.parseString=function(n){let o=this.data,l=this.offset+this.relativeOffset,d="";this.relativeOffset+=n;for(let f=0;f<n;f++)d+=String.fromCharCode(o.getUint8(l+f));return d},re.prototype.parseTag=function(){return this.parseString(4)},re.prototype.parseLongDateTime=function(){let n=wt(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n},re.prototype.parseVersion=function(n){let o=_r(this.data,this.offset+this.relativeOffset),l=_r(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),o+l/n/10},re.prototype.skip=function(n,o){o===void 0&&(o=1),this.relativeOffset+=Zt[n]*o},re.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=l.getUint32(d),d+=4;return this.relativeOffset+=n*4,o},re.prototype.parseOffset16List=re.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=l.getUint16(d),d+=2;return this.relativeOffset+=n*2,o},re.prototype.parseShortList=function(n){let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=l.getInt16(d),d+=2;return this.relativeOffset+=n*2,o},re.prototype.parseByteList=function(n){let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=l.getUint8(d++);return this.relativeOffset+=n,o},re.prototype.parseList=function(n,o){o||(o=n,n=this.parseUShort());let l=new Array(n);for(let d=0;d<n;d++)l[d]=o.call(this);return l},re.prototype.parseList32=function(n,o){o||(o=n,n=this.parseULong());let l=new Array(n);for(let d=0;d<n;d++)l[d]=o.call(this);return l},re.prototype.parseRecordList=function(n,o){o||(o=n,n=this.parseUShort());let l=new Array(n),d=Object.keys(o);for(let f=0;f<n;f++){let g={};for(let y=0;y<d.length;y++){let A=d[y],S=o[A];g[A]=S.call(this)}l[f]=g}return l},re.prototype.parseRecordList32=function(n,o){o||(o=n,n=this.parseULong());let l=new Array(n),d=Object.keys(o);for(let f=0;f<n;f++){let g={};for(let y=0;y<d.length;y++){let A=d[y],S=o[A];g[A]=S.call(this)}l[f]=g}return l},re.prototype.parseTupleRecords=function(n,o){let l=[];for(let d=0;d<n;d++){let f=[];for(let g=0;g<o;g++)f.push(this.parseF2Dot14());l.push(f)}return l},re.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);{let o=Object.keys(n),l={};for(let d=0;d<o.length;d++){let f=o[d],g=n[f];l[f]=g.call(this)}return l}},re.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n===0)return;let o={};return n&1&&(o.xPlacement=this.parseShort()),n&2&&(o.yPlacement=this.parseShort()),n&4&&(o.xAdvance=this.parseShort()),n&8&&(o.yAdvance=this.parseShort()),n&16&&(o.xPlaDevice=void 0,this.parseShort()),n&32&&(o.yPlaDevice=void 0,this.parseShort()),n&64&&(o.xAdvDevice=void 0,this.parseShort()),n&128&&(o.yAdvDevice=void 0,this.parseShort()),o},re.prototype.parseValueRecordList=function(){let n=this.parseUShort(),o=this.parseUShort(),l=new Array(o);for(let d=0;d<o;d++)l[d]=this.parseValueRecord(n);return l},re.prototype.parsePointer=function(n){let o=this.parseOffset16();if(o>0)return new re(this.data,this.offset+o).parseStruct(n)},re.prototype.parsePointer32=function(n){let o=this.parseOffset32();if(o>0)return new re(this.data,this.offset+o).parseStruct(n)},re.prototype.parseListOfLists=function(n){let o=this.parseOffset16List(),l=o.length,d=this.relativeOffset,f=new Array(l);for(let g=0;g<l;g++){let y=o[g];if(y===0){f[g]=void 0;continue}if(this.relativeOffset=y,n){let A=this.parseOffset16List(),S=new Array(A.length);for(let M=0;M<A.length;M++)this.relativeOffset=y+A[M],S[M]=n.call(this);f[g]=S}else f[g]=this.parseUShortList()}return this.relativeOffset=d,f},re.prototype.parseCoverage=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort(),l=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(l)};if(o===2){let d=new Array(l);for(let f=0;f<l;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+n.toString(16)+": Coverage format must be 1 or 2.")},re.prototype.parseClassDef=function(){let n=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:re.uShort,end:re.uShort,classId:re.uShort})}:(console.warn(`0x${n.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})},re.list=function(n,o){return function(){return this.parseList(n,o)}},re.list32=function(n,o){return function(){return this.parseList32(n,o)}},re.recordList=function(n,o){return function(){return this.parseRecordList(n,o)}},re.recordList32=function(n,o){return function(){return this.parseRecordList32(n,o)}},re.pointer=function(n){return function(){return this.parsePointer(n)}},re.pointer32=function(n){return function(){return this.parsePointer32(n)}},re.tag=re.prototype.parseTag,re.byte=re.prototype.parseByte,re.uShort=re.offset16=re.prototype.parseUShort,re.uShortList=re.prototype.parseUShortList,re.uInt24=re.prototype.parseUInt24,re.uLong=re.offset32=re.prototype.parseULong,re.uLongList=re.prototype.parseULongList,re.fixed=re.prototype.parseFixed,re.f2Dot14=re.prototype.parseF2Dot14,re.struct=re.prototype.parseStruct,re.coverage=re.prototype.parseCoverage,re.classDef=re.prototype.parseClassDef;var br={reserved:re.uShort,reqFeatureIndex:re.uShort,featureIndexes:re.uShortList};re.prototype.parseScriptList=function(){return this.parsePointer(re.recordList({tag:re.tag,script:re.pointer({defaultLangSys:re.pointer(br),langSysRecords:re.recordList({tag:re.tag,langSys:re.pointer(br)})})}))||[]},re.prototype.parseFeatureList=function(){return this.parsePointer(re.recordList({tag:re.tag,feature:re.pointer({featureParams:re.offset16,lookupListIndexes:re.uShortList})}))||[]},re.prototype.parseLookupList=function(n){return this.parsePointer(re.list(re.pointer(function(){let o=this.parseUShort();q.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let l=this.parseUShort(),d=l&16;return{lookupType:o,lookupFlag:l,subtables:this.parseList(re.pointer(n[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},re.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let n=this.parseUShort(),o=this.parseUShort();return q.argument(n===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:re.offset32,featureTableSubstitutionOffset:re.offset32})})||[]},re.prototype.parseVariationStore=function(){let n=this.relativeOffset,o=this.parseUShort(),l={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=n+o+2,l},re.prototype.parseItemVariationStore=function(){let n=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},l=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=n+l,o.variationRegions=this.parseVariationRegionList();for(let g=0;g<d;g++){let y=f[g];this.relativeOffset=n+y,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},re.prototype.parseVariationRegionList=function(){let n=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:re.recordList(n,{startCoord:re.f2Dot14,peakCoord:re.f2Dot14,endCoord:re.f2Dot14})})},re.prototype.parseItemVariationSubtable=function(){let n=this.parseUShort(),o=this.parseUShort(),l=this.parseUShortList(),d=l.length;return{regionIndexes:l,deltaSets:n&&d?this.parseDeltaSets(n,o,d):[]}},re.prototype.parseDeltaSetIndexMap=function(){let n=this.parseByte(),o=this.parseByte(),l=[],d=0;switch(n){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${n}`)}if(!d)return{format:n,entryFormat:o};let f=(o&Qt.INNER_INDEX_BIT_COUNT_MASK)+1,g=((o&Qt.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let y=0;y<d;y++){let A;if(g===1)A=this.parseByte();else if(g===2)A=this.parseUShort();else if(g===3)A=this.parseUInt24();else if(g===4)A=this.parseULong();else throw new Error(`Invalid entry size of ${g}`);let S=A>>f,M=A&(1<<f)-1;l.push({outerIndex:S,innerIndex:M})}return{format:n,entryFormat:o,map:l}},re.prototype.parseDeltaSets=function(n,o,l){let d=Array.from({length:n},()=>[]),f=o&Qt.LONG_WORDS,g=o&Qt.WORD_DELTA_COUNT_MASK;if(g>l)throw Error("wordCount must be less than or equal to regionIndexCount");let y=(f?this.parseLong:this.parseShort).bind(this),A=(f?this.parseShort:this.parseChar).bind(this);for(let S=0;S<n;S++)for(let M=0;M<l;M++)M<g?d[S].push(y()):d[S].push(A());return d},re.prototype.parseTupleVariationStoreList=function(n,o,l){let d=this.parseUShort(),f=this.parseUShort()&1,g=this.parseOffset32(),y=(f?this.parseULong:this.parseUShort).bind(this),A={},S=y();f||(S*=2);let M;for(let E=0;E<d;E++){M=y(),f||(M*=2);let $=M-S;A[E]=$?this.parseTupleVariationStore(g+S,n,o,l,E):void 0,S=M}return A},re.prototype.parseTupleVariationStore=function(n,o,l,d,f){let g=this.relativeOffset;this.relativeOffset=n,l==="cvar"&&(this.relativeOffset+=4);let y=this.parseUShort(),A=!!(y&Qt.SHARED_POINT_NUMBERS),S=y&Qt.COUNT_MASK,M=this.parseOffset16(),E=[],$=[];for(let X=0;X<S;X++){let de=this.parseTupleVariationHeader(o,l);E.push(de)}this.relativeOffset!==n+M&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${n+M}, actually ${this.relativeOffset}`),this.relativeOffset=n+M),A&&($=this.parsePackedPointNumbers());let U=this.relativeOffset;for(let X=0;X<S;X++){let de=E[X];de.privatePoints=[],this.relativeOffset=U,l==="cvar"&&!de.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),de.flags.privatePointNumbers&&(de.privatePoints=this.parsePackedPointNumbers()),delete de.flags;let Fe=this.offset,rr=this.relativeOffset,Gt=gr=>{let Mr,gn,En=()=>{let Rn=0;if(l==="gvar"){if(Rn=de.privatePoints.length||$.length,!Rn){let Ns=d.get(f);Ns.path,Rn=Ns.points.length,Rn+=4}}else l==="cvar"&&(Rn=d.length);this.offset=Fe,this.relativeOffset=rr,Mr=this.parsePackedDeltas(Rn),l==="gvar"&&(gn=this.parsePackedDeltas(Rn))};return{configurable:!0,get:function(){return Mr===void 0&&En(),gr==="deltasY"?gn:Mr},set:function(Rn){Mr===void 0&&En(),gr==="deltasY"?gn=Rn:Mr=Rn}}};Object.defineProperty(de,"deltas",Gt.call(this,"deltas")),l==="gvar"&&Object.defineProperty(de,"deltasY",Gt.call(this,"deltasY")),U+=de.variationDataSize,delete de.variationDataSize}this.relativeOffset=g;let oe={headers:E};return oe.sharedPoints=$,oe},re.prototype.parseTupleVariationHeader=function(n,o){let l=this.parseUShort(),d=this.parseUShort(),f=!!(d&Qt.EMBEDDED_PEAK_TUPLE),g=!!(d&Qt.INTERMEDIATE_REGION),y=!!(d&Qt.PRIVATE_POINT_NUMBERS),A=f?void 0:d&Qt.TUPLE_INDEX_MASK,S=f?this.parseTupleRecords(1,n)[0]:void 0,M=g?this.parseTupleRecords(1,n)[0]:void 0,E=g?this.parseTupleRecords(1,n)[0]:void 0,$={variationDataSize:l,peakTuple:S,intermediateStartTuple:M,intermediateEndTuple:E,flags:{embeddedPeakTuple:f,intermediateRegion:g,privatePointNumbers:y}};return o==="gvar"&&($.sharedTupleRecordsIndex=A),$},re.prototype.parsePackedPointNumbers=function(){let n=this.parseByte(),o=[],l=n;if(n>=128){let f=this.parseByte();l=(n&Qt.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<l;){let f=this.parseByte(),g=!!(f&Qt.POINTS_ARE_WORDS),y=(f&Qt.POINT_RUN_COUNT_MASK)+1;for(let A=0;A<y&&o.length<l;A++){let S;g?S=this.parseUShort():S=this.parseByte(),d=d+S,o.push(d)}}return o},re.prototype.parsePackedDeltas=function(n){let o=[];for(;o.length<n;){let l=this.parseByte(),d=!!(l&Qt.DELTAS_ARE_ZERO),f=!!(l&Qt.DELTAS_ARE_WORDS),g=(l&Qt.DELTA_RUN_COUNT_MASK)+1;for(let y=0;y<g&&o.length<n;y++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var ct={getByte:bn,getCard8:bn,getUShort:_r,getCard16:_r,getShort:_e,getUInt24:Qr,getULong:wt,getFixed:Er,getTag:le,getOffset:st,getBytes:Ut,bytesToString:lr,Parser:re},jn=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],dr={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"},js={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},qs={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 fs(n,o,l){switch(n){case 0:if(o===65535)return"und";if(l)return l[o];break;case 1:return dr[o];case 3:return qs[o]}}var Cn="utf-16",ns={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"},zn={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 Mn(n,o,l){switch(n){case 0:return Cn;case 1:return zn[l]||ns[o];case 3:if(o===1||o===10)return Cn;break}}var ws={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Hn(n){return ws[n]}function tn(n,o,l){let d={},f=new ct.Parser(n,o),g=f.parseUShort(),y=f.parseUShort(),A=f.offset+f.parseUShort();for(let S=0;S<y;S++){let M=f.parseUShort(),E=f.parseUShort(),$=f.parseUShort(),U=f.parseUShort(),oe=jn[U]||U,X=f.parseUShort(),de=f.parseUShort(),Fe=fs(M,$,l),rr=Mn(M,E,$),Gt=Hn(M);if(rr!==void 0&&Fe!==void 0&&Gt!==void 0){let gr;if(rr===Cn?gr=It.UTF16(n,A+de,X):gr=It.MACSTRING(n,A+de,X,rr),gr){let Mr=d[Gt];Mr===void 0&&(Mr=d[Gt]={});let gn=Mr[oe];gn===void 0&&(gn=Mr[oe]={}),gn[Fe]=gr}}}return g===1&&f.parseUShort(),d}function Pn(n){let o={};for(let l in n)o[n[l]]=parseInt(l);return o}function Gr(n,o,l,d,f,g){return new Ae.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:l},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:g}])}function Cr(n,o){let l=n.length,d=o.length-l+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let g=0;g<l;g++)if(o[f+g]!==n[g])continue e;return f}return-1}function dn(n,o){let l=Cr(n,o);if(l<0){l=o.length;let d=0,f=n.length;for(;d<f;++d)o.push(n[d])}return l}function wr(n,o){let l=Pn(ws),d=Pn(dr),f=Pn(qs),g=[],y=[];for(let S in n){let M,E=[],$={},U=Pn(jn),oe=l[S];for(let X in n[S]){let de=U[X];if(de===void 0&&(de=X),M=parseInt(de),isNaN(M))throw new Error('Name table entry "'+X+'" does not exist, see nameTableNames for complete list.');$[M]=n[S][X],E.push(M)}for(let X=0;X<E.length;X++){M=E[X];let de=$[M];for(let Fe in de){let rr=de[Fe];if(oe===1||oe===0){let Gt=d[Fe],gr=js[Gt],Mr=Mn(oe,gr,Gt),gn=Se.MACSTRING(rr,Mr);if(oe===0&&(Gt=o.indexOf(Fe),Gt<0&&(Gt=o.length,o.push(Fe)),gr=4,gn=Se.UTF16(rr)),gn!==void 0){let En=dn(gn,y);g.push(Gr(oe,gr,Gt,M,gn.length,En))}}if(oe===3){let Gt=f[Fe];if(Gt!==void 0){let gr=Se.UTF16(rr),Mr=dn(gr,y);g.push(Gr(3,1,Gt,M,gr.length,Mr))}}}}}g.sort(function(S,M){return S.platformID-M.platformID||S.encodingID-M.encodingID||S.languageID-M.languageID||S.nameID-M.nameID});let A=new Ae.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:g.length},{name:"stringOffset",type:"USHORT",value:6+g.length*12}]);for(let S=0;S<g.length;S++)A.fields.push({name:"record_"+S,type:"RECORD",value:g[S]});return A.fields.push({name:"strings",type:"LITERAL",value:y}),A}function hn(n,o,l=[]){if(o<256&&o in jn){if(l.length&&!l.includes(parseInt(o)))return;o=jn[o]}for(let d in n)for(let f in n[d])if(f===o||parseInt(f)===o)return n[d][f]}var jt={parse:tn,make:wr,getNameByID:hn};function jr(n,o,l,d){n.length=o.parseUShort(),n.language=o.parseUShort()-1;let f=o.parseByteList(n.length),g=Object.assign({},f),y=Mn(l,d,n.language),A=bt[y];for(let S=0;S<A.length;S++)g[A.charCodeAt(S)]=f[128+S];n.glyphIndexMap=g}function Ar(n,o,l){o.parseUShort(),n.length=o.parseULong(),n.language=o.parseULong();let d;n.groupCount=d=o.parseULong(),n.glyphIndexMap={};for(let f=0;f<d;f+=1){let g=o.parseULong(),y=o.parseULong(),A=o.parseULong();for(let S=g;S<=y;S+=1)n.glyphIndexMap[S]=A,l===12&&A++}}function fn(n,o,l,d,f){n.length=o.parseUShort(),n.language=o.parseUShort();let g;n.segCount=g=o.parseUShort()>>1,o.skip("uShort",3),n.glyphIndexMap={};let y=new ct.Parser(l,d+f+14),A=new ct.Parser(l,d+f+16+g*2),S=new ct.Parser(l,d+f+16+g*4),M=new ct.Parser(l,d+f+16+g*6),E=d+f+16+g*8;for(let $=0;$<g-1;$+=1){let U,oe=y.parseUShort(),X=A.parseUShort(),de=S.parseShort(),Fe=M.parseUShort();for(let rr=X;rr<=oe;rr+=1)Fe!==0?(E=M.offset+M.relativeOffset-2,E+=Fe,E+=(rr-X)*2,U=ct.getUShort(l,E),U!==0&&(U=U+de&65535)):U=rr+de&65535,n.glyphIndexMap[rr]=U}}function ss(n,o){let l={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let g=o.parseUInt24(),y={varSelector:g},A=o.parseOffset32(),S=o.parseOffset32(),M=o.relativeOffset;A&&(o.relativeOffset=A,y.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),S&&(o.relativeOffset=S,y.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let E={},$=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let U=0;U<$.length;U+=1)E[$[U].unicodeValue]=$[U];return E}})),l[g]=y,o.relativeOffset=M}n.varSelectorList=l}function Yn(n,o){let l={};l.version=ct.getUShort(n,o),q.argument(l.version===0,"cmap table version should be 0."),l.numTables=ct.getUShort(n,o+2);let d=null,f=-1,g=-1,y=null,A=null,S=[0,1,2,3,4,6],M=[0,1,10];for(let $=l.numTables-1;$>=0;$-=1)if(y=ct.getUShort(n,o+4+$*8),A=ct.getUShort(n,o+4+$*8+2),y===3&&M.includes(A)||y===0&&S.includes(A)||y===1&&A===0){if(g>0)continue;if(g=ct.getULong(n,o+4+$*8+4),d)break}else if(y===0&&A===5){if(f=ct.getULong(n,o+4+$*8+4),d=new ct.Parser(n,o+f),d.parseUShort()!==14)f=-1,d=null;else if(g>0)break}if(g===-1)throw new Error("No valid cmap sub-tables found.");let E=new ct.Parser(n,o+g);if(l.format=E.parseUShort(),l.format===0)jr(l,E,y,A);else if(l.format===12||l.format===13)Ar(l,E,l.format);else if(l.format===4)fn(l,E,n,o,g);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+l.format+", platformId "+y+", encodingId "+A+").");return d&&ss(l,d),l}function yn(n,o,l){n.segments.push({end:o,start:o,delta:-(o-l),offset:0,glyphIndex:l})}function Yr(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function Fr(n){if(n.length===0)return n;let o=[n[0]];for(let l=1;l<n.length;l++){let d=o[o.length-1],f=n[l];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function On(n){let o=!0,l;for(l=n.length-1;l>0;l-=1)if(n.get(l).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 Ae.Table("cmap",d);for(f.segments=[],l=0;l<n.length;l+=1){let oe=n.get(l);for(let X=0;X<oe.unicodes.length;X+=1)yn(f,oe.unicodes[X],l)}f.segments.sort(function(oe,X){return oe.start-X.start}),f.segments=Fr(f.segments),Yr(f);let g=f.segments.length,y=0,A=[],S=[],M=[],E=[],$=[],U=[];for(l=0;l<g;l+=1){let oe=f.segments[l];oe.end<=65535&&oe.start<=65535?(A.push({name:"end_"+l,type:"USHORT",value:oe.end}),S.push({name:"start_"+l,type:"USHORT",value:oe.start}),M.push({name:"idDelta_"+l,type:"SHORT",value:oe.delta}),E.push({name:"idRangeOffset_"+l,type:"USHORT",value:oe.offset}),oe.glyphId!==void 0&&$.push({name:"glyph_"+l,type:"USHORT",value:oe.glyphId})):y+=1,!o&&oe.glyphIndex!==void 0&&(U.push({name:"cmap12Start_"+l,type:"ULONG",value:oe.start}),U.push({name:"cmap12End_"+l,type:"ULONG",value:oe.end}),U.push({name:"cmap12Glyph_"+l,type:"ULONG",value:oe.glyphIndex}))}f.segCountX2=(g-y)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(g-y)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let oe=0;oe<A.length;oe++)f.fields.push(A[oe]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let oe=0;oe<S.length;oe++)f.fields.push(S[oe]);for(let oe=0;oe<M.length;oe++)f.fields.push(M[oe]);for(let oe=0;oe<E.length;oe++)f.fields.push(E[oe]);for(let oe=0;oe<$.length;oe++)f.fields.push($[oe]);if(f.cmap4Length=14+A.length*2+2+S.length*2+M.length*2+E.length*2+$.length*2,!o){let oe=16+U.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:oe},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:U.length/3});for(let X=0;X<U.length;X++)f.fields.push(U[X])}return f}var As={parse:Yn,make:On},Ps=[".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"],eo=[".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"],Rr=[".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"],H=[".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"],se=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],$e=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],ke=[".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 ze(n){this.font=n}ze.prototype.charToGlyphIndex=function(n){let o=n.codePointAt(0),l=this.font.glyphs;if(l)for(let d=0;d<l.length;d+=1){let f=l.get(d);for(let g=0;g<f.unicodes.length;g+=1)if(f.unicodes[g]===o)return d}return null};function Ze(n){this.cmap=n}Ze.prototype.charToGlyphIndex=function(n){return this.cmap.glyphIndexMap[n.codePointAt(0)]||0};function xt(n,o){this.encoding=n,this.charset=o}xt.prototype.charToGlyphIndex=function(n){let o=n.codePointAt(0),l=this.encoding[o];return this.charset.indexOf(l)};function tt(n){switch(n.version){case 1:this.names=ke.slice();break;case 2:this.names=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)n.glyphNameIndex[o]<ke.length?this.names[o]=ke[n.glyphNameIndex[o]]:this.names[o]=n.names[n.glyphNameIndex[o]-ke.length];break;case 2.5:this.names=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)this.names[o]=ke[o+n.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}tt.prototype.nameToGlyphIndex=function(n){return this.names.indexOf(n)},tt.prototype.glyphIndexToName=function(n){return this.names[n]};function Re(n){let o,l=n.tables.cmap.glyphIndexMap,d=Object.keys(l);for(let f=0;f<d.length;f+=1){let g=d[f],y=l[g];o=n.glyphs.get(y),o.addUnicode(parseInt(g))}for(let f=0;f<n.glyphs.length;f+=1)o=n.glyphs.get(f),n.cffEncoding?o.name=n.cffEncoding.charset[f]:n.glyphNames.names&&(o.name=n.glyphNames.glyphIndexToName(f))}function ot(n){n._IndexToUnicodeMap={};let o=n.tables.cmap.glyphIndexMap,l=Object.keys(o);for(let d=0;d<l.length;d+=1){let f=l[d],g=o[f];n._IndexToUnicodeMap[g]===void 0?n._IndexToUnicodeMap[g]={unicodes:[parseInt(f)]}:n._IndexToUnicodeMap[g].unicodes.push(parseInt(f))}}function pr(n,o){o.lowMemory?ot(n):Re(n)}function At(n,o,l,d,f){n.beginPath(),n.moveTo(o,l),n.lineTo(d,f),n.stroke()}var Yt={line:At};function at(n,o){let l=new re(n,o),d=l.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=l.parseShort(),g=l.parseShort(),y=l.parseShort(),A=l.parseOffset32(),S=l.parseUShortList(g);l.relativeOffset=A;let M=l.parseULongList(y);return l.relativeOffset=A,{version:d,numPaletteEntries:f,colorRecords:M,colorRecordIndices:S}}function Xt({version:n=0,numPaletteEntries:o=0,colorRecords:l=[],colorRecordIndices:d=[0]}){return q.argument(n===0,"Only CPALv0 are supported."),q.argument(l.length,"No colorRecords given."),q.argument(d.length,"No colorRecordIndices given."),d.length>1&&q.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Ae.Table("CPAL",[{name:"version",type:"USHORT",value:n},{name:"numPaletteEntries",type:"USHORT",value:o||l.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:l.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,g)=>({name:"colorRecordIndices_"+g,type:"USHORT",value:f})),...l.map((f,g)=>({name:"colorRecords_"+g,type:"ULONG",value:f}))])}function $t(n){var o=(n&4278190080)>>24,l=(n&16711680)>>16,d=(n&65280)>>8,f=n&255;return o=o+256&255,l=l+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:l,r:d,a:f}}function Ft(n,o,l=0,d="hexa"){if(o==65535)return"currentColor";let f=n&&n.tables&&n.tables.cpal;if(!f)return"currentColor";if(l>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 g=f.colorRecordIndices[l]+o;if(g>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${g})`);let y=$t(f.colorRecords[g]);return d==="bgra"?y:Fs(y,d)}function Jt(n){return("0"+parseInt(n).toString(16)).slice(-2)}function Kn(n){let o=n.r/255,l=n.g/255,d=n.b/255,f=Math.max(o,l,d),g=Math.min(o,l,d),y,A,S=(f+g)/2;if(f===g)y=A=0;else{let M=f-g;switch(A=S>.5?M/(2-f-g):M/(f+g),f){case o:y=(l-d)/M+(l<d?6:0);break;case l:y=(d-o)/M+2;break;case d:y=(o-l)/M+4;break}y/=6}return{h:y*360,s:A*100,l:S*100}}function Xn(n){let{h:o,s:l,l:d,a:f}=n;o=o%360,l/=100,d/=100;let g=(1-Math.abs(2*d-1))*l,y=g*(1-Math.abs(o/60%2-1)),A=d-g/2,S=0,M=0,E=0;return 0<=o&&o<60?(S=g,M=y,E=0):60<=o&&o<120?(S=y,M=g,E=0):120<=o&&o<180?(S=0,M=g,E=y):180<=o&&o<240?(S=0,M=y,E=g):240<=o&&o<300?(S=y,M=0,E=g):300<=o&&o<=360&&(S=g,M=0,E=y),{r:Math.round((S+A)*255),g:Math.round((M+A)*255),b:Math.round((E+A)*255),a:f}}function Vr(n){return parseInt(`0x${Jt(n.b)}${Jt(n.g)}${Jt(n.r)}${Jt(n.a*255)}`,16)}function Os(n,o="hexa"){let l=o=="raw"||o=="cpal",d=Number.isInteger(n),f=!0;if(d&&l||n==="currentColor")return n;if(typeof n=="object"){if(o=="bgra")return n;if(l)return Vr(n)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(n.trim())){switch(n=n.trim().substring(1),n.length){case 3:n={r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:1};break;case 4:n={r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:parseInt(n[3].repeat(2),16)/255};break;case 6:n={r:parseInt(n[0]+n[1],16),g:parseInt(n[2]+n[3],16),b:parseInt(n[4]+n[5],16),a:1};break;case 8:n={r:parseInt(n[0]+n[1],16),g:parseInt(n[2]+n[3],16),b:parseInt(n[4]+n[5],16),a:parseInt(n[6]+n[7],16)/255};break}if(o=="bgra")return n}else if(typeof document<"u"&&/^[a-z]+$/i.test(n)){let g=document.createElement("canvas").getContext("2d");g.fillStyle=n;let y=Fs(g.fillStyle,"hexa");y==="#000000ff"&&n.toLowerCase()!=="black"?f=!1:n=y}else{n=n.trim();let g=/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(g.test(n)){let y=n.match(g).filter(A=>typeof A<"u");n={r:Math.round(parseFloat(y[1])/(y[2]?.39215686274509803:1)),g:Math.round(parseFloat(y[3])/(y[4]?.39215686274509803:1)),b:Math.round(parseFloat(y[5])/(y[6]?.39215686274509803:1)),a:y[7]?parseFloat(y[7])/(y[8]?100:1):1}}else{let y=/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(y.test(n)){let A=n.match(y).filter(S=>typeof S<"u");n=Xn({h:parseFloat(A[1])*(A[2]==="turn"?360:1),s:parseFloat(A[3]),l:parseFloat(A[4]),a:A[5]?parseFloat(A[5])/(A[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${n}`);return Fs(n,o)}function Fs(n,o="hexa"){if(n==="currentColor")return n;if(Number.isInteger(n)){if(o=="raw"||o=="cpal")return n;n=$t(n)}else typeof n!="object"&&(n=Os(n,"bgra"));let l=["hsl","hsla"].includes(o)?Kn(n):null;switch(o){case"rgba":return`rgba(${n.r}, ${n.g}, ${n.b}, ${parseFloat(n.a.toFixed(3))})`;case"rgb":return`rgb(${n.r}, ${n.g}, ${n.b})`;case"hex":case"hex6":case"hex-6":return`#${Jt(n.r)}${Jt(n.g)}${Jt(n.b)}`;case"hexa":case"hex8":case"hex-8":return`#${Jt(n.r)}${Jt(n.g)}${Jt(n.b)}${Jt(n.a*255)}`;case"hsl":return`hsl(${l.h.toFixed(2)}, ${l.s.toFixed(2)}%, ${l.l.toFixed(2)}%)`;case"hsla":return`hsla(${l.h.toFixed(2)}, ${l.s.toFixed(2)}%, ${l.l.toFixed(2)}%, ${parseFloat(n.a.toFixed(3))})`;case"bgra":return n;case"raw":case"cpal":return Vr(n);default:throw new Error("Unknown color format: "+o)}}var co={parse:at,make:Xt,getPaletteColor:Ft,parseColor:Os,formatColor:Fs};function vn(n,o){let l=o||new Xe;return{configurable:!0,get:function(){return typeof l=="function"&&(l=l()),l},set:function(d){l=d}}}function rn(n){this.bindConstructorValues(n)}rn.prototype.bindConstructorValues=function(n){if(this.index=n.index||0,n.name===".notdef"?n.unicode=void 0:n.name===".null"&&(n.unicode=0),n.unicode===0&&n.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=n.name||null,this.unicode=n.unicode,this.unicodes=n.unicodes||(n.unicode!==void 0?[n.unicode]:[]),"xMin"in n&&(this.xMin=n.xMin),"yMin"in n&&(this.yMin=n.yMin),"xMax"in n&&(this.xMax=n.xMax),"yMax"in n&&(this.yMax=n.yMax),"advanceWidth"in n&&(this.advanceWidth=n.advanceWidth),"leftSideBearing"in n&&(this.leftSideBearing=n.leftSideBearing),"points"in n&&(this.points=n.points),Object.defineProperty(this,"path",vn(this,n.path))},rn.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)},rn.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},rn.prototype.getPath=function(n,o,l,d,f){n=n!==void 0?n:0,o=o!==void 0?o:0,l=l!==void 0?l:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let g,y,A=d.xScale,S=d.yScale,M=1/(this.path.unitsPerEm||1e3)*l,E=this;f&&f.variation&&(E=f.variation.getTransform(this,d.variation),g=E.path.commands),d.hinting&&f&&f.hinting&&(y=E.path&&f.hinting.exec(E,l,d)),y?(g=f.hinting.getCommands(y),n=Math.round(n),o=Math.round(o),A=S=1):(g=E.path.commands,A===void 0&&(A=M),S===void 0&&(S=M));let $=new Xe;if(d.drawSVG){let U=this.getSvgImage(f);if(U){let oe=new Xe;return oe._image={image:U.image,x:n+U.leftSideBearing*M,y:o-U.baseline*M,width:U.image.width*M,height:U.image.height*M},$._layers=[oe],$}}if(d.drawLayers){let U=this.getLayers(f);if(U&&U.length){$._layers=[];for(let oe=0;oe<U.length;oe+=1){let X=U[oe],de=Ft(f,X.paletteIndex,d.usePalette);de==="currentColor"?de=d.fill||"black":de=Fs(de,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:de}),$._layers.push(this.getPath.call(X.glyph,n,o,l,d,f))}return $}}$.fill=d.fill||this.path.fill,$.stroke=this.path.stroke,$.strokeWidth=this.path.strokeWidth*M;for(let U=0;U<g.length;U+=1){let oe=g[U];oe.type==="M"?$.moveTo(n+oe.x*A,o+-oe.y*S):oe.type==="L"?$.lineTo(n+oe.x*A,o+-oe.y*S):oe.type==="Q"?$.quadraticCurveTo(n+oe.x1*A,o+-oe.y1*S,n+oe.x*A,o+-oe.y*S):oe.type==="C"?$.curveTo(n+oe.x1*A,o+-oe.y1*S,n+oe.x2*A,o+-oe.y2*S,n+oe.x*A,o+-oe.y*S):oe.type==="Z"&&$.stroke&&$.strokeWidth&&$.closePath()}return $},rn.prototype.getLayers=function(n){if(!n)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return n.layers.get(this.index)},rn.prototype.getSvgImage=function(n){if(!n)throw new Error("The font object is required to read the svg table in order to get the image.");return n.svgImages.get(this.index)},rn.prototype.getContours=function(n=null){if(this.points===void 0&&!n)return[];let o=[],l=[],d=n||this.points;for(let f=0;f<d.length;f+=1){let g=d[f];l.push(g),g.lastPointOfContour&&(o.push(l),l=[])}return q.argument(l.length===0,"There are still points left in the current contour."),o},rn.prototype.getMetrics=function(){let n=this.path.commands,o=[],l=[];for(let f=0;f<n.length;f+=1){let g=n[f];g.type!=="Z"&&(o.push(g.x),l.push(g.y)),(g.type==="Q"||g.type==="C")&&(o.push(g.x1),l.push(g.y1)),g.type==="C"&&(o.push(g.x2),l.push(g.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,l),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},rn.prototype.draw=function(n,o,l,d,f,g){f=Object.assign({},g&&g.defaultRenderOptions,f),this.getPath(o,l,d,f,g).draw(n)},rn.prototype.drawPoints=function(n,o,l,d,f,g){if(f=Object.assign({},g&&g.defaultRenderOptions,f),f.drawLayers){let $=this.getLayers(g);if($&&$.length){for(let U=0;U<$.length;U+=1)$[U].glyph.index!==this.index&&this.drawPoints.call($[U].glyph,n,o,l,d);return}}function y($,U,oe,X){n.beginPath();for(let de=0;de<$.length;de+=1)n.moveTo(U+$[de].x*X,oe+$[de].y*X),n.arc(U+$[de].x*X,oe+$[de].y*X,2,0,Math.PI*2,!1);n.fill()}o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:24;let A=1/this.path.unitsPerEm*d,S=[],M=[],E=this.path.commands;g&&g.variation&&(E=g.variation.getTransform(this,f.variation).path.commands);for(let $=0;$<E.length;$+=1){let U=E[$];U.x!==void 0&&S.push({x:U.x,y:-U.y}),U.x1!==void 0&&M.push({x:U.x1,y:-U.y1}),U.x2!==void 0&&M.push({x:U.x2,y:-U.y2})}n.fillStyle="blue",y(S,o,l,A),n.fillStyle="red",y(M,o,l,A)},rn.prototype.drawMetrics=function(n,o,l,d){let f;o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,n.lineWidth=1,n.strokeStyle="black",Yt.line(n,o,-1e4,o,1e4),Yt.line(n,-1e4,l,1e4,l);let g=this.xMin||0,y=this.yMin||0,A=this.xMax||0,S=this.yMax||0,M=this.advanceWidth||0;n.strokeStyle="blue",Yt.line(n,o+g*f,-1e4,o+g*f,1e4),Yt.line(n,o+A*f,-1e4,o+A*f,1e4),Yt.line(n,-1e4,l+-y*f,1e4,l+-y*f),Yt.line(n,-1e4,l+-S*f,1e4,l+-S*f),n.strokeStyle="green",Yt.line(n,o+M*f,-1e4,o+M*f,1e4)},rn.prototype.toPathData=function(n,o){n=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},n);let l=this;o&&o.variation&&(l=o.variation.getTransform(this,n.variation));let d=l.points&&n.pointsTransform?n.pointsTransform(l.points):l.path;return n.pathTransform&&(d=n.pathTransform(d)),d.toPathData(n)},rn.prototype.fromSVG=function(n,o={}){return this.path.fromSVG(n,o)},rn.prototype.toSVG=function(n,o){let l=this.toPathData.apply(this,[n,o]);return this.path.toSVG(n,l)},rn.prototype.toDOMElement=function(n,o){n=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},n);let l=this.path;return o&&o.variation&&(l=o.variation.getTransform(this,n.variation).path),l.toDOMElement(n)};var Ur=rn;function Nn(n,o,l){Object.defineProperty(n,o,{get:function(){return typeof n[l]>"u"&&n.path,n[l]},set:function(d){n[l]=d},enumerable:!0,configurable:!0})}function Sn(n,o){if(this.font=n,this.glyphs={},Array.isArray(o))for(let l=0;l<o.length;l++){let d=o[l];d.path.unitsPerEm=n.unitsPerEm,this.glyphs[l]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(Sn.prototype[Symbol.iterator]=function(){let n=-1;return{next:(function(){n++;let o=n>=this.length-1;return{value:this.get(n),done:o}}).bind(this)}}),Sn.prototype.get=function(n){if(this.font._push&&this.glyphs[n]===void 0){this.font._push(n),typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());let o=this.glyphs[n],l=this.font._IndexToUnicodeMap[n];if(l)for(let d=0;d<l.unicodes.length;d++)o.addUnicode(l.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[n]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(n)),this.glyphs[n].advanceWidth=this.font._hmtxTableData[n].advanceWidth,this.glyphs[n].leftSideBearing=this.font._hmtxTableData[n].leftSideBearing}else typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());return this.glyphs[n]},Sn.prototype.push=function(n,o){this.glyphs[n]=o,this.length++};function Zs(n,o){return new Ur({index:o,font:n})}function Jn(n,o,l,d,f,g){return function(){let y=new Ur({index:o,font:n});return y.path=function(){l(y,d,f);let A=g(n.glyphs,y);return A.unitsPerEm=n.unitsPerEm,A},Nn(y,"numberOfContours","_numberOfContours"),Nn(y,"xMin","_xMin"),Nn(y,"xMax","_xMax"),Nn(y,"yMin","_yMin"),Nn(y,"yMax","_yMax"),Nn(y,"points","_points"),y}}function Us(n,o,l,d,f){return function(){let g=new Ur({index:o,font:n});return g.path=function(){let y=l(n,g,d,f);return y.unitsPerEm=n.unitsPerEm,y},g}}var Lr={GlyphSet:Sn,glyphLoader:Zs,ttfGlyphLoader:Jn,cffGlyphLoader:Us};function qr(n,o){if(n===o)return!0;if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(let l=0;l<n.length;l+=1)if(!qr(n[l],o[l]))return!1;return!0}else return!1}var is=10;function O(n){let o;return n.length<1240?o=107:n.length<33900?o=1131:o=32768,o}function J(n,o,l,d){let f=[],g=[],y=d>1?ct.getULong(n,o):ct.getCard16(n,o),A=d>1?4:2,S,M;if(y!==0){let E=ct.getByte(n,o+A);S=o+(y+1)*E+A;let $=o+A+1;for(let U=0;U<y+1;U+=1)f.push(ct.getOffset(n,$,E)),$+=E;M=S+f[y]}else M=o+A;for(let E=0;E<f.length-1;E+=1){let $=ct.getBytes(n,S+f[E],S+f[E+1]);l&&($=l($,n,o,d)),g.push($)}return{objects:g,startOffset:o,endOffset:M}}function ue(n,o,l){let d=[],f=l>1?ct.getULong(n,o):ct.getCard16(n,o),g=l>1?4:2,y,A;if(f!==0){let S=ct.getByte(n,o+g);y=o+(f+1)*S+g;let M=o+g+1;for(let E=0;E<f+1;E+=1)d.push(ct.getOffset(n,M,S)),M+=S;A=y+d[f]}else A=o+g;return{offsets:d,startOffset:o,endOffset:A}}function Be(n,o,l,d,f,g){let y=g>1?ct.getULong(l,d):ct.getCard16(l,d),A=g>1?4:2,S=0;if(y!==0){let E=ct.getByte(l,d+A);S=d+(y+1)*E+A}let M=ct.getBytes(l,S+o[n],S+o[n+1]);return f&&(M=f(M)),M}function Tt(n){let o="",l=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=n.parseByte(),f=d>>4,g=d&15;if(f===15||(o+=l[f],g===15))break;o+=l[g]}return parseFloat(o)}function _t(n,o){let l,d,f,g;if(o===28)return l=n.parseByte(),d=n.parseByte(),l<<8|d;if(o===29)return l=n.parseByte(),d=n.parseByte(),f=n.parseByte(),g=n.parseByte(),l<<24|d<<16|f<<8|g;if(o===30)return Tt(n);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return l=n.parseByte(),(o-247)*256+l+108;if(o>=251&&o<=254)return l=n.parseByte(),-(o-251)*256-l-108;throw new Error("Invalid b0 "+o)}function er(n){let o={};for(let l=0;l<n.length;l+=1){let d=n[l][0],f=n[l][1],g;if(f.length===1?g=f[0]:g=f,Object.prototype.hasOwnProperty.call(o,d)&&!isNaN(o[d]))throw new Error("Object "+o+" already has key "+d);o[d]=g}return o}function ut(n,o,l,d){o=o!==void 0?o:0;let f=new ct.Parser(n,o),g=[],y=[];l=l!==void 0?l:n.byteLength;let A=d<2?22:28;for(;f.relativeOffset<l;){let S=f.parseByte();if(S<A){if(S===12&&(S=1200+f.parseByte()),d>1&&S===23){ps(y);continue}g.push([S,y]),y=[]}else y.push(_t(f,S,d))}return er(g)}function Lt(n,o){return o<=390?o=Ps[o]:n?o=n[o-391]:o=void 0,o}function Pr(n,o,l){let d={},f;for(let g=0;g<o.length;g+=1){let y=o[g];if(Array.isArray(y.type)){let A=[];A.length=y.type.length;for(let S=0;S<y.type.length;S++)f=n[y.op]!==void 0?n[y.op][S]:void 0,f===void 0&&(f=y.value!==void 0&&y.value[S]!==void 0?y.value[S]:null),y.type[S]==="SID"&&(f=Lt(l,f)),A[S]=f;d[y.name]=A}else f=n[y.op],f===void 0&&(f=y.value!==void 0?y.value:null),y.type==="SID"&&(f=Lt(l,f)),d[y.name]=f}return d}function yr(n,o){let l={};if(l.formatMajor=ct.getCard8(n,o),l.formatMinor=ct.getCard8(n,o+1),l.formatMajor>2)throw new Error(`Unsupported CFF table version ${l.formatMajor}.${l.formatMinor}`);return l.size=ct.getCard8(n,o+2),l.formatMajor<2?(l.offsetSize=ct.getCard8(n,o+3),l.startOffset=o,l.endOffset=o+4):(l.topDictLength=ct.getCard16(n,o+3),l.endOffset=o+8),l}var Hr=[{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"}],Tr=[{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"}],Fn=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],wn=[{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"}],Ts=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function tr(n,o,l,d){let f=ut(n,o,n.byteLength,d);return Pr(f,d>1?Tr:Hr,l)}function Pt(n,o,l,d,f){let g=ut(n,o,l,f);return Pr(g,f>1?wn:Fn,d)}function cr(n,o,l){let d=ut(n,o,void 0,l);return Pr(d,Ts)}function Ir(n,o,l){let d=[];for(let f=0;f<l.length;f++){let g=new DataView(new Uint8Array(l[f]).buffer),y=cr(g,0,2),A=y.private[0],S=y.private[1];if(A!==0&&S!==0){let M=Pt(n,S+o,A,[],2);if(M.subrs){let E=S+M.subrs,$=J(n,E+o,void 0,2);y._subrs=$.objects,y._subrsBias=O(y._subrs)}y._privateDict=M}d.push(y)}return d}function Wt(n,o,l,d,f){let g=[];for(let y=0;y<l.length;y+=1){let A=new DataView(new Uint8Array(l[y]).buffer),S=tr(A,0,d,f);S._subrs=[],S._subrsBias=0,S._defaultWidthX=0,S._nominalWidthX=0;let M=f<2?S.private[0]:0,E=f<2?S.private[1]:0;if(M!==0&&E!==0){let $=Pt(n,E+o,M,d,f);if(S._defaultWidthX=$.defaultWidthX,S._nominalWidthX=$.nominalWidthX,$.subrs!==0){let U=E+$.subrs,oe=J(n,U+o,void 0,f);S._subrs=oe.objects,S._subrsBias=O(S._subrs)}S._privateDict=$}g.push(S)}return g}function Kt(n,o,l,d,f){let g,y,A=new ct.Parser(n,o);l-=1;let S=[".notdef"],M=A.parseCard8();if(M===0)for(let E=0;E<l;E+=1)g=A.parseSID(),f?S.push(g):S.push(Lt(d,g)||g);else if(M===1)for(;S.length<=l;){g=A.parseSID(),y=A.parseCard8();for(let E=0;E<=y;E+=1)f?S.push("cid"+("00000"+g).slice(-5)):S.push(Lt(d,g)||g),g+=1}else if(M===2)for(;S.length<=l;){g=A.parseSID(),y=A.parseCard16();for(let E=0;E<=y;E+=1)f?S.push("cid"+("00000"+g).slice(-5)):S.push(Lt(d,g)||g),g+=1}else throw new Error("Unknown charset format "+M);return S}function nn(n,o){let l,d={},f=new ct.Parser(n,o),g=f.parseCard8();if(g===0){let y=f.parseCard8();for(let A=0;A<y;A+=1)l=f.parseCard8(),d[l]=A}else if(g===1){let y=f.parseCard8();l=1;for(let A=0;A<y;A+=1){let S=f.parseCard8(),M=f.parseCard8();for(let E=S;E<=S+M;E+=1)d[E]=l,l+=1}}else throw new Error("Unknown encoding format "+g);return d}function ps(n){let o=n.pop();for(;n.length>o;)n.pop()}function Kr(n,o){let l=n.tables.cff&&n.tables.cff.topDict&&n.tables.cff.topDict.paintType||0;return l===2&&(o.fill=null,o.stroke="black",o.strokeWidth=n.tables.cff.topDict.strokeWidth||0),l}function Cs(n,o,l,d,f){let g,y,A,S,M=new Xe,E=[],$=0,U=!1,oe=!1,X=0,de=0,Fe,rr,Gt,gr,Mr=0,gn=[],En,Rn=0,Ns=n.tables.cff2||n.tables.cff;if(Gt=Ns.topDict._defaultWidthX,gr=Ns.topDict._nominalWidthX,f=f||n.variation&&n.variation.get(),o.getBlendPath||(o.getBlendPath=function(Ot){return Cs(n,o,l,d,Ot)}),n.isCIDFont||d>1){let Ot=Ns.topDict._fdSelect?Ns.topDict._fdSelect[o.index]:0,zt=Ns.topDict._fdArray[Ot];Fe=zt._subrs,rr=zt._subrsBias,d>1?(gn=Ns.topDict._vstore.itemVariationStore,Mr=zt._privateDict.vsindex):(Gt=zt._defaultWidthX,gr=zt._nominalWidthX)}else Fe=Ns.topDict._subrs,rr=Ns.topDict._subrsBias;let Jo=Kr(n,M),Nr=Gt;function po(Ot,zt){oe&&Jo!==2&&M.closePath(),M.moveTo(Ot,zt),oe=!0}function $i(){let Ot;Ot=(E.length&1)!==0,Ot&&!U&&(Nr=E.shift()+gr),$+=E.length>>1,E.length=0,U=!0}function nr(Ot){let zt,Ri,dl,Cu,El,ea,zi,Io,Mi,mo,Hi,Wi,ys=0;for(;ys<Ot.length;){let Eo=Ot[ys];switch(ys+=1,Eo){case 1:$i();break;case 3:$i();break;case 4:E.length>1&&!U&&(Nr=E.shift()+gr,U=!0),de+=E.pop(),po(X,de);break;case 5:for(;E.length>0;)X+=E.shift(),de+=E.shift(),M.lineTo(X,de);break;case 6:for(;E.length>0&&(X+=E.shift(),M.lineTo(X,de),E.length!==0);)de+=E.shift(),M.lineTo(X,de);break;case 7:for(;E.length>0&&(de+=E.shift(),M.lineTo(X,de),E.length!==0);)X+=E.shift(),M.lineTo(X,de);break;case 8:for(;E.length>0;)g=X+E.shift(),y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),X=A+E.shift(),de=S+E.shift(),M.curveTo(g,y,A,S,X,de);break;case 10:if(El=E.pop()+rr,ea=Fe[El],ea){if(Rn>=is){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Rn++,nr(ea),Rn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Eo=Ot[ys],ys+=1,Eo){case 35:g=X+E.shift(),y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),zi=A+E.shift(),Io=S+E.shift(),Mi=zi+E.shift(),mo=Io+E.shift(),Hi=Mi+E.shift(),Wi=mo+E.shift(),X=Hi+E.shift(),de=Wi+E.shift(),E.shift(),M.curveTo(g,y,A,S,zi,Io),M.curveTo(Mi,mo,Hi,Wi,X,de);break;case 34:g=X+E.shift(),y=de,A=g+E.shift(),S=y+E.shift(),zi=A+E.shift(),Io=S,Mi=zi+E.shift(),mo=S,Hi=Mi+E.shift(),Wi=de,X=Hi+E.shift(),M.curveTo(g,y,A,S,zi,Io),M.curveTo(Mi,mo,Hi,Wi,X,de);break;case 36:g=X+E.shift(),y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),zi=A+E.shift(),Io=S,Mi=zi+E.shift(),mo=S,Hi=Mi+E.shift(),Wi=mo+E.shift(),X=Hi+E.shift(),M.curveTo(g,y,A,S,zi,Io),M.curveTo(Mi,mo,Hi,Wi,X,de);break;case 37:g=X+E.shift(),y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),zi=A+E.shift(),Io=S+E.shift(),Mi=zi+E.shift(),mo=Io+E.shift(),Hi=Mi+E.shift(),Wi=mo+E.shift(),Math.abs(Hi-X)>Math.abs(Wi-de)?X=Hi+E.shift():de=Wi+E.shift(),M.curveTo(g,y,A,S,zi,Io),M.curveTo(Mi,mo,Hi,Wi,X,de);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+Eo),E.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(E.length>=4){let Rl=se[E.pop()],d0=se[E.pop()],Su=E.pop(),_u=E.pop();if(Rl&&d0){o.isComposite=!0,o.components=[];let Y1=n.cffEncoding.charset.indexOf(Rl),K1=n.cffEncoding.charset.indexOf(d0);o.components.push({glyphIndex:K1,dx:0,dy:0}),o.components.push({glyphIndex:Y1,dx:_u,dy:Su}),M.extend(n.glyphs.get(K1).path);let o7=n.glyphs.get(Y1),Lh=JSON.parse(JSON.stringify(o7.path.commands));for(let Ih=0;Ih<Lh.length;Ih+=1){let ga=Lh[Ih];ga.type!=="Z"&&(ga.x+=_u,ga.y+=Su),(ga.type==="Q"||ga.type==="C")&&(ga.x1+=_u,ga.y1+=Su),ga.type==="C"&&(ga.x2+=_u,ga.y2+=Su)}M.extend(Lh)}}else E.length>0&&!U&&(Nr=E.shift()+gr,U=!0);oe&&Jo!==2&&(M.closePath(),oe=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}Mr=E.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}En||(En=n.variation&&f&&n.variation.process.getBlendVector(gn,Mr,f));var Qn=E.pop(),so=En?En.length:gn.itemVariationSubtables[Mr].regionIndexes.length,ko=Qn*so,ta=E.length-ko,Oa=ta-Qn;if(En)for(let Rl=0;Rl<Qn;Rl++){var Z1=E[Oa+Rl];for(let d0=0;d0<so;d0++)Z1+=En[d0]*E[ta++];E[Oa+Rl]=Z1}for(;ko--;)E.pop();break;case 18:$i();break;case 19:case 20:$i(),ys+=$+7>>3;break;case 21:E.length>2&&!U&&(Nr=E.shift()+gr,U=!0),de+=E.pop(),X+=E.pop(),po(X,de);break;case 22:E.length>1&&!U&&(Nr=E.shift()+gr,U=!0),X+=E.pop(),po(X,de);break;case 23:$i();break;case 24:for(;E.length>2;)g=X+E.shift(),y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),X=A+E.shift(),de=S+E.shift(),M.curveTo(g,y,A,S,X,de);X+=E.shift(),de+=E.shift(),M.lineTo(X,de);break;case 25:for(;E.length>6;)X+=E.shift(),de+=E.shift(),M.lineTo(X,de);g=X+E.shift(),y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),X=A+E.shift(),de=S+E.shift(),M.curveTo(g,y,A,S,X,de);break;case 26:for(E.length&1&&(X+=E.shift());E.length>0;)g=X,y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),X=A,de=S+E.shift(),M.curveTo(g,y,A,S,X,de);break;case 27:for(E.length&1&&(de+=E.shift());E.length>0;)g=X+E.shift(),y=de,A=g+E.shift(),S=y+E.shift(),X=A+E.shift(),de=S,M.curveTo(g,y,A,S,X,de);break;case 28:zt=Ot[ys],Ri=Ot[ys+1],E.push((zt<<24|Ri<<16)>>16),ys+=2;break;case 29:if(El=E.pop()+n.gsubrsBias,ea=n.gsubrs[El],ea){if(Rn>=is){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Rn++,nr(ea),Rn--}break;case 30:for(;E.length>0&&(g=X,y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),X=A+E.shift(),de=S+(E.length===1?E.shift():0),M.curveTo(g,y,A,S,X,de),E.length!==0);)g=X+E.shift(),y=de,A=g+E.shift(),S=y+E.shift(),de=S+E.shift(),X=A+(E.length===1?E.shift():0),M.curveTo(g,y,A,S,X,de);break;case 31:for(;E.length>0&&(g=X+E.shift(),y=de,A=g+E.shift(),S=y+E.shift(),de=S+E.shift(),X=A+(E.length===1?E.shift():0),M.curveTo(g,y,A,S,X,de),E.length!==0);)g=X,y=de+E.shift(),A=g+E.shift(),S=y+E.shift(),X=A+E.shift(),de=S+(E.length===1?E.shift():0),M.curveTo(g,y,A,S,X,de);break;default:Eo<32?console.log("Glyph "+o.index+": unknown operator "+Eo):Eo<247?E.push(Eo-139):Eo<251?(zt=Ot[ys],ys+=1,E.push((Eo-247)*256+zt+108)):Eo<255?(zt=Ot[ys],ys+=1,E.push(-(Eo-251)*256-zt-108)):(zt=Ot[ys],Ri=Ot[ys+1],dl=Ot[ys+2],Cu=Ot[ys+3],ys+=4,E.push((zt<<24|Ri<<16|dl<<8|Cu)/65536))}}}return nr(l),n.variation&&f&&(M.commands=M.commands.map(Ot=>{let zt=Object.keys(Ot);for(let Ri=0;Ri<zt.length;Ri++){let dl=zt[Ri];dl!=="type"&&(Ot[dl]=Math.round(Ot[dl]))}return Ot})),U&&(o.advanceWidth=Nr),M}function Wn(n,o,l,d,f){let g=[],y,A=new ct.Parser(n,o),S=A.parseCard8();if(S===0)for(let M=0;M<l;M++){if(y=A.parseCard8(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");g.push(y)}else if(S===3||f>1&&S===4){let M=S===4?A.parseULong():A.parseCard16(),E=S===4?A.parseULong():A.parseCard16();if(E!==0)throw new Error(`CFF Table CID Font FDSelect format ${S} range has bad initial GID ${E}`);let $;for(let U=0;U<M;U++){if(y=S===4?A.parseUShort():A.parseCard8(),$=S===4?A.parseULong():A.parseCard16(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");if($>l)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${$}`);for(;E<$;E++)g.push(y);E=$}if($!==l)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+$)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+S);return g}function An(n,o,l,d){let f,g=yr(n,o);g.formatMajor===2?f=l.tables.cff2={}:f=l.tables.cff={};let y=g.formatMajor>1?null:J(n,g.endOffset,ct.bytesToString),A=g.formatMajor>1?null:J(n,y.endOffset),S=g.formatMajor>1?null:J(n,A.endOffset,ct.bytesToString),M=J(n,g.formatMajor>1?o+g.size+g.topDictLength:S.endOffset,void 0,g.formatMajor);l.gsubrs=M.objects,l.gsubrsBias=O(l.gsubrs);let E;if(g.formatMajor>1){let U=o+g.size,oe=ct.getBytes(n,U,U+g.topDictLength);E=Wt(n,0,[oe],void 0,g.formatMajor)[0]}else{let U=Wt(n,o,A.objects,S.objects,g.formatMajor);if(U.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+U.length);E=U[0]}if(f.topDict=E,E._privateDict&&(l.defaultWidthX=E._privateDict.defaultWidthX,l.nominalWidthX=E._privateDict.nominalWidthX),g.formatMajor<2&&E.ros[0]!==void 0&&E.ros[1]!==void 0&&(l.isCIDFont=!0),g.formatMajor>1){let U=E.fdArray,oe=E.fdSelect;if(!U)throw new Error("This is a CFF2 font, but FDArray information is missing");let X=J(n,o+U,null,g.formatMajor),de=Ir(n,o,X.objects);E._fdArray=de,oe&&(E._fdSelect=Wn(n,o+oe,l.numGlyphs,de.length,g.formatMajor))}else if(l.isCIDFont){let U=E.fdArray,oe=E.fdSelect;if(U===0||oe===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");U+=o;let X=J(n,U),de=Wt(n,o,X.objects,S.objects,g.formatMajor);E._fdArray=de,oe+=o,E._fdSelect=Wn(n,oe,l.numGlyphs,de.length,g.formatMajor)}if(g.formatMajor<2){let U=o+E.private[1],oe=Pt(n,U,E.private[0],S.objects,g.formatMajor);if(l.defaultWidthX=oe.defaultWidthX,l.nominalWidthX=oe.nominalWidthX,oe.subrs!==0){let X=U+oe.subrs,de=J(n,X);l.subrs=de.objects,l.subrsBias=O(l.subrs)}else l.subrs=[],l.subrsBias=0}let $;if(d.lowMemory?($=ue(n,o+E.charStrings,g.formatMajor),l.nGlyphs=$.offsets.length-(g.formatMajor>1?1:0)):($=J(n,o+E.charStrings,null,g.formatMajor),l.nGlyphs=$.objects.length),g.formatMajor>1&&l.tables.maxp&&l.nGlyphs!==l.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${l.nGlyphs}) must correspond to the glyph count in the maxp table (${l.tables.maxp.numGlyphs})`),g.formatMajor<2){let U=[],oe=[];E.charset===0?U=eo:E.charset===1?U=Rr:E.charset===2?U=H:U=Kt(n,o+E.charset,l.nGlyphs,S.objects,l.isCIDFont),E.encoding===0?oe=se:E.encoding===1?oe=$e:oe=nn(n,o+E.encoding),l.cffEncoding=new xt(oe,U),l.encoding=l.encoding||l.cffEncoding}if(l.glyphs=new Lr.GlyphSet(l),d.lowMemory)l._push=function(U){let oe=Be(U,$.offsets,n,o+E.charStrings,void 0,g.formatMajor);l.glyphs.push(U,Lr.cffGlyphLoader(l,U,Cs,oe,g.formatMajor))};else for(let U=0;U<l.nGlyphs;U+=1){let oe=$.objects[U];l.glyphs.push(U,Lr.cffGlyphLoader(l,U,Cs,oe,g.formatMajor))}if(E.vstore){let U=new ct.Parser(n,o+E.vstore);E._vstore=U.parseVariationStore()}}function $s(n,o){let l,d=Ps.indexOf(n);return d>=0&&(l=d),d=o.indexOf(n),d>=0?l=d+Ps.length:(l=Ps.length+o.length,o.push(n)),l}function Ho(){return new Ae.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 ca(n){let o=new Ae.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let l=0;l<n.length;l+=1)o.names.push({name:"name_"+l,type:"NAME",value:n[l]});return o}function Ao(n,o,l){let d={};for(let f=0;f<n.length;f+=1){let g=n[f],y=o[g.name];y!==void 0&&!qr(y,g.value)&&(g.type==="SID"&&(y=$s(y,l)),d[g.op]={name:g.name,type:g.type,value:y})}return d}function Wo(n,o,l){let d=new Ae.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Ao(l>1?Tr:Hr,n,o),d}function ua(n){let o=new Ae.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],o}function to(n){let o=new Ae.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let l=0;l<n.length;l+=1)o.strings.push({name:"string_"+l,type:"STRING",value:n[l]});return o}function da(){return new Ae.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function ha(n,o){let l=new Ae.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<n.length;d+=1){let f=n[d],g=$s(f,o);l.fields.push({name:"glyph_"+d,type:"SID",value:g})}return l}function Go(n,o){let l=[],d=n.path;o<2&&l.push({name:"width",type:"NUMBER",value:n.advanceWidth});let f=0,g=0;for(let y=0;y<d.commands.length;y+=1){let A,S,M=d.commands[y];if(M.type==="Q"){let E=.3333333333333333,$=2/3;M={type:"C",x:M.x,y:M.y,x1:Math.round(E*f+$*M.x1),y1:Math.round(E*g+$*M.y1),x2:Math.round(E*M.x+$*M.x1),y2:Math.round(E*M.y+$*M.y1)}}if(M.type==="M")A=Math.round(M.x-f),S=Math.round(M.y-g),l.push({name:"dx",type:"NUMBER",value:A}),l.push({name:"dy",type:"NUMBER",value:S}),l.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(M.x),g=Math.round(M.y);else if(M.type==="L")A=Math.round(M.x-f),S=Math.round(M.y-g),l.push({name:"dx",type:"NUMBER",value:A}),l.push({name:"dy",type:"NUMBER",value:S}),l.push({name:"rlineto",type:"OP",value:5}),f=Math.round(M.x),g=Math.round(M.y);else if(M.type==="C"){let E=Math.round(M.x1-f),$=Math.round(M.y1-g),U=Math.round(M.x2-M.x1),oe=Math.round(M.y2-M.y1);A=Math.round(M.x-M.x2),S=Math.round(M.y-M.y2),l.push({name:"dx1",type:"NUMBER",value:E}),l.push({name:"dy1",type:"NUMBER",value:$}),l.push({name:"dx2",type:"NUMBER",value:U}),l.push({name:"dy2",type:"NUMBER",value:oe}),l.push({name:"dx",type:"NUMBER",value:A}),l.push({name:"dy",type:"NUMBER",value:S}),l.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(M.x),g=Math.round(M.y)}}return o<2&&l.push({name:"endchar",type:"OP",value:14}),l}function Ss(n,o){let l=new Ae.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<n.length;d+=1){let f=n.get(d),g=Go(f,o);l.charStrings.push({name:f.name,type:"CHARSTRING",value:g})}return l}function zs(n,o,l){let d=new Ae.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Ao(l>1?wn:Fn,n,o),d}function _s(n,o){let l=new Ae.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]},g=o&&o.topDict||{};g.paintType&&(f.paintType=g.paintType,f.strokeWidth=g.strokeWidth||0);let y={},A=[],S;for(let U=1;U<n.length;U+=1)S=n.get(U),A.push(S.name);let M=[];l.header=Ho(),l.nameIndex=ca([o.postScriptName]);let E=Wo(f,M);l.topDictIndex=ua(E),l.globalSubrIndex=da(),l.charsets=ha(A,M),l.charStringsIndex=Ss(n,1),l.privateDict=zs(y,M),l.stringIndex=to(M);let $=l.header.sizeOf()+l.nameIndex.sizeOf()+l.topDictIndex.sizeOf()+l.stringIndex.sizeOf()+l.globalSubrIndex.sizeOf();return f.charset=$,f.encoding=0,f.charStrings=f.charset+l.charsets.sizeOf(),f.private[1]=f.charStrings+l.charStringsIndex.sizeOf(),E=Wo(f,M),l.topDictIndex=ua(E),l}var Vo={parse:An,make:_s};function ms(n,o){let l={},d=new ct.Parser(n,o);return l.version=d.parseVersion(),l.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,l.checkSumAdjustment=d.parseULong(),l.magicNumber=d.parseULong(),q.argument(l.magicNumber===1594834165,"Font header has wrong magic number."),l.flags=d.parseUShort(),l.unitsPerEm=d.parseUShort(),l.created=d.parseLongDateTime(),l.modified=d.parseLongDateTime(),l.xMin=d.parseShort(),l.yMin=d.parseShort(),l.xMax=d.parseShort(),l.yMax=d.parseShort(),l.macStyle=d.parseUShort(),l.lowestRecPPEM=d.parseUShort(),l.fontDirectionHint=d.parseShort(),l.indexToLocFormat=d.parseShort(),l.glyphDataFormat=d.parseShort(),l}function Ka(n){let o=Math.round(new Date().getTime()/1e3)+2082844800,l=o,d=n.macStyle||0;return n.createdTimestamp&&(l=n.createdTimestamp+2082844800),new Ae.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:l},{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}],n)}var ro={parse:ms,make:Ka};function Ma(n,o){let l={},d=new ct.Parser(n,o);return l.version=d.parseVersion(),l.ascender=d.parseShort(),l.descender=d.parseShort(),l.lineGap=d.parseShort(),l.advanceWidthMax=d.parseUShort(),l.minLeftSideBearing=d.parseShort(),l.minRightSideBearing=d.parseShort(),l.xMaxExtent=d.parseShort(),l.caretSlopeRise=d.parseShort(),l.caretSlopeRun=d.parseShort(),l.caretOffset=d.parseShort(),d.relativeOffset+=8,l.metricDataFormat=d.parseShort(),l.numberOfHMetrics=d.parseUShort(),l}function Si(n){return new Ae.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}],n)}var To={parse:Ma,make:Si};function Xa(n,o,l,d,f){let g,y,A=new ct.Parser(n,o);for(let S=0;S<d;S+=1){S<l&&(g=A.parseUShort(),y=A.parseShort());let M=f.get(S);M.advanceWidth=g,M.leftSideBearing=y}}function fa(n,o,l,d,f){n._hmtxTableData={};let g,y,A=new ct.Parser(o,l);for(let S=0;S<f;S+=1)S<d&&(g=A.parseUShort(),y=A.parseShort()),n._hmtxTableData[S]={advanceWidth:g,leftSideBearing:y}}function Na(n,o,l,d,f,g,y){y.lowMemory?fa(n,o,l,d,f):Xa(o,l,d,f,g)}function Da(n){let o=new Ae.Table("hmtx",[]);for(let l=0;l<n.length;l+=1){let d=n.get(l),f=d.advanceWidth||0,g=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+l,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+l,type:"SHORT",value:g})}return o}var Ys={parse:Na,make:Da};function qo(n){let o=new Ae.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:n.length}]),l="",d=12+n.length*4;for(let f=0;f<n.length;++f){let g=l.indexOf(n[f]);g<0&&(g=l.length,l+=n[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+g}),o.fields.push({name:"length "+f,type:"USHORT",value:n[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),o}function ui(n,o){let l=new ct.Parser(n,o),d=l.parseULong();q.argument(d===1,"Unsupported ltag table version."),l.skip("uLong",1);let f=l.parseULong(),g=[];for(let y=0;y<f;y++){let A="",S=o+l.parseUShort(),M=l.parseUShort();for(let E=S;E<S+M;++E)A+=String.fromCharCode(n.getInt8(E));g.push(A)}return g}var Zo={make:qo,parse:ui};function _i(n,o){let l={},d=new ct.Parser(n,o);return l.version=d.parseVersion(),l.numGlyphs=d.parseUShort(),l.version===1&&(l.maxPoints=d.parseUShort(),l.maxContours=d.parseUShort(),l.maxCompositePoints=d.parseUShort(),l.maxCompositeContours=d.parseUShort(),l.maxZones=d.parseUShort(),l.maxTwilightPoints=d.parseUShort(),l.maxStorage=d.parseUShort(),l.maxFunctionDefs=d.parseUShort(),l.maxInstructionDefs=d.parseUShort(),l.maxStackElements=d.parseUShort(),l.maxSizeOfInstructions=d.parseUShort(),l.maxComponentElements=d.parseUShort(),l.maxComponentDepth=d.parseUShort()),l}function os(n){return new Ae.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}var di={parse:_i,make:os},Di=[{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 Co(n){for(let o=0;o<Di.length;o+=1){let l=Di[o];if(n>=l.begin&&n<l.end)return o}return-1}function Ja(n,o){let l={},d=new ct.Parser(n,o);l.version=d.parseUShort(),l.xAvgCharWidth=d.parseShort(),l.usWeightClass=d.parseUShort(),l.usWidthClass=d.parseUShort(),l.fsType=d.parseUShort(),l.ySubscriptXSize=d.parseShort(),l.ySubscriptYSize=d.parseShort(),l.ySubscriptXOffset=d.parseShort(),l.ySubscriptYOffset=d.parseShort(),l.ySuperscriptXSize=d.parseShort(),l.ySuperscriptYSize=d.parseShort(),l.ySuperscriptXOffset=d.parseShort(),l.ySuperscriptYOffset=d.parseShort(),l.yStrikeoutSize=d.parseShort(),l.yStrikeoutPosition=d.parseShort(),l.sFamilyClass=d.parseShort(),l.panose=[];for(let f=0;f<10;f++)l.panose[f]=d.parseByte();return l.ulUnicodeRange1=d.parseULong(),l.ulUnicodeRange2=d.parseULong(),l.ulUnicodeRange3=d.parseULong(),l.ulUnicodeRange4=d.parseULong(),l.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),l.fsSelection=d.parseUShort(),l.usFirstCharIndex=d.parseUShort(),l.usLastCharIndex=d.parseUShort(),l.sTypoAscender=d.parseShort(),l.sTypoDescender=d.parseShort(),l.sTypoLineGap=d.parseShort(),l.usWinAscent=d.parseUShort(),l.usWinDescent=d.parseUShort(),l.version>=1&&(l.ulCodePageRange1=d.parseULong(),l.ulCodePageRange2=d.parseULong()),l.version>=2&&(l.sxHeight=d.parseShort(),l.sCapHeight=d.parseShort(),l.usDefaultChar=d.parseUShort(),l.usBreakChar=d.parseUShort(),l.usMaxContent=d.parseUShort()),l}function el(n){return new Ae.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}],n)}var uo={parse:Ja,make:el,unicodeRanges:Di,getUnicodeRange:Co};function pa(n,o){let l={},d=new ct.Parser(n,o);switch(l.version=d.parseVersion(),l.italicAngle=d.parseFixed(),l.underlinePosition=d.parseShort(),l.underlineThickness=d.parseShort(),l.isFixedPitch=d.parseULong(),l.minMemType42=d.parseULong(),l.maxMemType42=d.parseULong(),l.minMemType1=d.parseULong(),l.maxMemType1=d.parseULong(),l.version){case 1:l.names=ke.slice();break;case 2:l.numberOfGlyphs=d.parseUShort(),l.glyphNameIndex=new Array(l.numberOfGlyphs);for(let f=0;f<l.numberOfGlyphs;f++)l.glyphNameIndex[f]=d.parseUShort();l.names=[];for(let f=0;f<l.numberOfGlyphs;f++)if(l.glyphNameIndex[f]>=ke.length){let g=d.parseChar();l.names.push(d.parseString(g))}break;case 2.5:l.numberOfGlyphs=d.parseUShort(),l.offset=new Array(l.numberOfGlyphs);for(let f=0;f<l.numberOfGlyphs;f++)l.offset[f]=d.parseChar();break}return l}function Dn(n){let{italicAngle:o=Math.round((n.italicAngle||0)*65536),underlinePosition:l=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:g=0,maxMemType42:y=0,minMemType1:A=0,maxMemType1:S=0}=n.tables.post||{};return new Ae.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:l},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:g},{name:"maxMemType42",type:"ULONG",value:y},{name:"minMemType1",type:"ULONG",value:A},{name:"maxMemType1",type:"ULONG",value:S}])}var Bi={parse:pa,make:Dn},Bn=new Array(9);Bn[1]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(re.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(re.coverage),substitute:this.parseOffset16List()};q.assert(!1,"0x"+n.toString(16)+": lookup type 1 format must be 1 or 2.")},Bn[2]=function(){let n=this.parseUShort();return q.argument(n===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(re.coverage),sequences:this.parseListOfLists()}},Bn[3]=function(){let n=this.parseUShort();return q.argument(n===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(re.coverage),alternateSets:this.parseListOfLists()}},Bn[4]=function(){let n=this.parseUShort();return q.argument(n===1,"GSUB ligature table identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(re.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Ls={sequenceIndex:re.uShort,lookupListIndex:re.uShort};Bn[5]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(re.coverage),ruleSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,Ls)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(re.coverage),classDef:this.parsePointer(re.classDef),classSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,Ls)}})};if(o===3){let l=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(l,re.pointer(re.coverage)),lookupRecords:this.parseRecordList(d,Ls)}}q.assert(!1,"0x"+n.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Bn[6]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(re.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Ls)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(re.coverage),backtrackClassDef:this.parsePointer(re.classDef),inputClassDef:this.parsePointer(re.classDef),lookaheadClassDef:this.parsePointer(re.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Ls)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(re.pointer(re.coverage)),inputCoverage:this.parseList(re.pointer(re.coverage)),lookaheadCoverage:this.parseList(re.pointer(re.coverage)),lookupRecords:this.parseRecordList(Ls)};q.assert(!1,"0x"+n.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Bn[7]=function(){let n=this.parseUShort();q.argument(n===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),l=new re(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:Bn[o].call(l)}},Bn[8]=function(){let n=this.parseUShort();return q.argument(n===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(re.coverage),backtrackCoverage:this.parseList(re.pointer(re.coverage)),lookaheadCoverage:this.parseList(re.pointer(re.coverage)),substitutes:this.parseUShortList()}};function es(n,o){o=o||0;let l=new re(n,o),d=l.parseVersion(1);return q.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Bn)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Bn),variations:l.parseFeatureVariationsList()}}var Qi=new Array(9);Qi[1]=function(n){if(n.substFormat===1)return new Ae.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)},{name:"deltaGlyphID",type:"SHORT",value:n.deltaGlyphId}]);if(n.substFormat===2)return new Ae.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)}].concat(Ae.ushortList("substitute",n.substitute)));q.fail("Lookup type 1 substFormat must be 1 or 2.")},Qi[2]=function(n){return q.assert(n.substFormat===1,"Lookup type 2 substFormat must be 1."),new Ae.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)}].concat(Ae.tableList("seqSet",n.sequences,function(o){return new Ae.Table("sequenceSetTable",Ae.ushortList("sequence",o))})))},Qi[3]=function(n){return q.assert(n.substFormat===1,"Lookup type 3 substFormat must be 1."),new Ae.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)}].concat(Ae.tableList("altSet",n.alternateSets,function(o){return new Ae.Table("alternateSetTable",Ae.ushortList("alternate",o))})))},Qi[4]=function(n){return q.assert(n.substFormat===1,"Lookup type 4 substFormat must be 1."),new Ae.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)}].concat(Ae.tableList("ligSet",n.ligatureSets,function(o){return new Ae.Table("ligatureSetTable",Ae.tableList("ligature",o,function(l){return new Ae.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:l.ligGlyph}].concat(Ae.ushortList("component",l.components,l.components.length+1)))}))})))},Qi[5]=function(n){if(n.substFormat===1)return new Ae.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)}].concat(Ae.tableList("sequenceRuleSet",n.ruleSets,function(o){return o?new Ae.Table("sequenceRuleSetTable",Ae.tableList("sequenceRule",o,function(l){let d=Ae.ushortList("seqLookup",[],l.lookupRecords.length).concat(Ae.ushortList("inputSequence",l.input,l.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<l.lookupRecords.length;f++){let g=l.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:g.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:g.lookupListIndex})}return new Ae.Table("sequenceRuleTable",d)})):new Ae.Table("NULL",null)})));if(n.substFormat===2)return new Ae.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)},{name:"classDef",type:"TABLE",value:new Ae.ClassDef(n.classDef)}].concat(Ae.tableList("classSeqRuleSet",n.classSets,function(o){return o?new Ae.Table("classSeqRuleSetTable",Ae.tableList("classSeqRule",o,function(l){let d=Ae.ushortList("classes",l.classes,l.classes.length+1).concat(Ae.ushortList("seqLookupCount",[],l.lookupRecords.length));for(let f=0;f<l.lookupRecords.length;f++){let g=l.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:g.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:g.lookupListIndex})}return new Ae.Table("classSeqRuleTable",d)})):new Ae.Table("NULL",null)})));if(n.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:n.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:n.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let l=0;l<n.coverages.length;l++){let d=n.coverages[l];o.push({name:"inputCoverage"+l,type:"TABLE",value:new Ae.Coverage(d)})}for(let l=0;l<n.lookupRecords.length;l++){let d=n.lookupRecords[l];o=o.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new Ae.Table("contextualSubstitutionTable",o)}q.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Qi[6]=function(n){if(n.substFormat===1)return new Ae.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new Ae.Coverage(n.coverage)}].concat(Ae.tableList("chainRuleSet",n.chainRuleSets,function(o){return new Ae.Table("chainRuleSetTable",Ae.tableList("chainRule",o,function(l){let d=Ae.ushortList("backtrackGlyph",l.backtrack,l.backtrack.length).concat(Ae.ushortList("inputGlyph",l.input,l.input.length+1)).concat(Ae.ushortList("lookaheadGlyph",l.lookahead,l.lookahead.length)).concat(Ae.ushortList("substitution",[],l.lookupRecords.length));for(let f=0;f<l.lookupRecords.length;f++){let g=l.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:g.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:g.lookupListIndex})}return new Ae.Table("chainRuleTable",d)}))})));if(n.substFormat===2)q.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(n.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:n.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:n.backtrackCoverage.length});for(let l=0;l<n.backtrackCoverage.length;l++){let d=n.backtrackCoverage[l];o.push({name:"backtrackCoverage"+l,type:"TABLE",value:new Ae.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:n.inputCoverage.length});for(let l=0;l<n.inputCoverage.length;l++){let d=n.inputCoverage[l];o.push({name:"inputCoverage"+l,type:"TABLE",value:new Ae.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:n.lookaheadCoverage.length});for(let l=0;l<n.lookaheadCoverage.length;l++){let d=n.lookaheadCoverage[l];o.push({name:"lookaheadCoverage"+l,type:"TABLE",value:new Ae.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let l=0;l<n.lookupRecords.length;l++){let d=n.lookupRecords[l];o=o.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new Ae.Table("chainContextTable",o)}q.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function Ba(n){return new Ae.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Ae.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new Ae.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new Ae.LookupList(n.lookups,Qi)}])}var hi={parse:es,make:Ba};function fi(n,o){let l=new ct.Parser(n,o),d=l.parseULong();q.argument(d===1,"Unsupported META table version."),l.parseULong(),l.parseULong();let f=l.parseULong(),g={};for(let y=0;y<f;y++){let A=l.parseTag(),S=l.parseULong(),M=l.parseULong();if(A==="appl"||A==="bild")continue;let E=It.UTF8(n,o+S,M);g[A]=E}return g}function _n(n){let o=Object.keys(n).length,l="",d=16+o*12,f=new Ae.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 g in n){let y=l.length;l+=n[g],f.fields.push({name:"tag "+g,type:"TAG",value:g}),f.fields.push({name:"offset "+g,type:"ULONG",value:d+y}),f.fields.push({name:"length "+g,type:"ULONG",value:n[g].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),f}var Li={parse:fi,make:_n};function pi(n,o){let l=new re(n,o),d=l.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=l.parseUShort(),g=l.parseOffset32(),y=l.parseOffset32(),A=l.parseUShort();l.relativeOffset=g;let S=l.parseRecordList(f,{glyphID:re.uShort,firstLayerIndex:re.uShort,numLayers:re.uShort});l.relativeOffset=y;let M=l.parseRecordList(A,{glyphID:re.uShort,paletteIndex:re.uShort});return{version:d,baseGlyphRecords:S,layerRecords:M}}function ne({version:n=0,baseGlyphRecords:o=[],layerRecords:l=[]}){q.argument(n===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new Ae.Table("COLR",[{name:"version",type:"USHORT",value:n},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:l.length},...o.map((g,y)=>[{name:"glyphID_"+y,type:"USHORT",value:g.glyphID},{name:"firstLayerIndex_"+y,type:"USHORT",value:g.firstLayerIndex},{name:"numLayers_"+y,type:"USHORT",value:g.numLayers}]).flat(),...l.map((g,y)=>[{name:"LayerGlyphID_"+y,type:"USHORT",value:g.glyphID},{name:"paletteIndex_"+y,type:"USHORT",value:g.paletteIndex}]).flat()])}var je={parse:pi,make:ne};function rt(n,o){return[{name:"tag_"+n,type:"TAG",value:o.tag},{name:"minValue_"+n,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+n,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+n,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+n,type:"USHORT",value:0},{name:"nameID_"+n,type:"USHORT",value:o.axisNameID}]}function mt(n,o,l){let d={},f=new ct.Parser(n,o);d.tag=f.parseTag(),d.minValue=f.parseFixed(),d.defaultValue=f.parseFixed(),d.maxValue=f.parseFixed(),f.skip("uShort",1);let g=f.parseUShort();return d.axisNameID=g,d.name=hn(l,g),d}function Me(n,o,l,d={}){let f=[{name:"nameID_"+n,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+n,type:"USHORT",value:0}];for(let g=0;g<l.length;++g){let y=l[g].tag;f.push({name:"axis_"+n+" "+y,type:"FIXED",value:o.coordinates[y]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function nt(n,o,l,d,f){let g={},y=new ct.Parser(n,o),A=y.parseUShort();g.subfamilyNameID=A,g.name=hn(d,A,[2,17]),y.skip("uShort",1),g.coordinates={};for(let M=0;M<l.length;++M)g.coordinates[l[M].tag]=y.parseFixed();if(y.relativeOffset===f)return g.postScriptNameID=void 0,g.postScriptName=void 0,g;let S=y.parseUShort();return g.postScriptNameID=S==65535?void 0:S,g.postScriptName=g.postScriptNameID!==void 0?hn(d,S,[6]):"",g}function vr(n,o){let l=new Ae.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:n.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:n.instances.length},{name:"instanceSize",type:"USHORT",value:4+n.axes.length*4}]);l.offsetToData=l.sizeOf();for(let f=0;f<n.axes.length;f++)l.fields=l.fields.concat(rt(f,n.axes[f],o));let d={};for(let f=0;f<n.instances.length;f++)if(n.instances[f].postScriptNameID!==void 0){l.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<n.instances.length;f++)l.fields=l.fields.concat(Me(f,n.instances[f],n.axes,d));return l}function Dr(n,o,l){let d=new ct.Parser(n,o),f=d.parseULong();q.argument(f===65536,"Unsupported fvar table version.");let g=d.parseOffset16();d.skip("uShort",1);let y=d.parseUShort(),A=d.parseUShort(),S=d.parseUShort(),M=d.parseUShort(),E=[];for(let oe=0;oe<y;oe++)E.push(mt(n,o+g+oe*A,l));let $=[],U=o+g+y*A;for(let oe=0;oe<S;oe++)$.push(nt(n,U+oe*M,E,l,M));return{axes:E,instances:$}}var Xr={make:vr,parse:Dr},kr={tag:re.tag,nameID:re.uShort,ordering:re.uShort},Gn=new Array(5);Gn[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Gn[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Gn[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Gn[4]=function(){let n=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(n,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function sn(){let n=this.parseUShort(),o=Gn[n],l={format:n};return o===void 0?(console.warn(`Unknown axis value table format ${n}`),l):Object.assign(l,this.parseStruct(o.bind(this)))}function Is(n,o,l){o||(o=0);let d=new ct.Parser(n,o),f=d.parseUShort(),g=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${g}`);let y=[f,g],A=d.parseUShort(),S=d.parseUShort(),M=d.parseOffset32(),E=d.parseUShort(),$=d.parseOffset32(),U=f>1||g>0?d.parseUShort():void 0;l!==void 0&&q.argument(S>=l.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),E>0&&q.argument(S>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let oe=[];for(let Fe=0;Fe<S;Fe++)d.offset=o+M,d.relativeOffset=Fe*A,oe.push(d.parseStruct(kr));d.offset=o,d.relativeOffset=$;let X=d.parseUShortList(E),de=[];for(let Fe=0;Fe<E;Fe++)d.offset=o+$,d.relativeOffset=X[Fe],de.push(sn.apply(d));return{version:y,axes:oe,values:de,elidedFallbackNameID:U}}var ks=new Array(5);ks[1]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:1},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`value${n}`,type:"FLOAT",value:o.value}]},ks[2]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:2},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${n}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${n}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${n}`,type:"FLOAT",value:o.rangeMaxValue}]},ks[3]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:3},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`value${n}`,type:"FLOAT",value:o.value},{name:`linkedValue${n}`,type:"FLOAT",value:o.linkedValue}]},ks[4]=function(n,o){let l=[{name:`format${n}`,type:"USHORT",value:4},{name:`axisCount${n}`,type:"USHORT",value:o.axisValues.length},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)l=l.concat([{name:`format${n}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${n}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return l};function no(n,o){return new Ae.Record("axisRecord_"+n,[{name:"axisTag_"+n,type:"TAG",value:o.tag},{name:"axisNameID_"+n,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+n,type:"USHORT",value:o.ordering}])}function gs(n,o){let l=o.format,d=ks[l];q.argument(d!==void 0,`Unknown axis value table format ${l}`);let f=d(n,o);return new Ae.Table("axisValueTable_"+n,f)}function as(n){let o=new Ae.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:n.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:n.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:n.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let g=0;g<n.axes.length;g++){let y=no(g,n.axes[g]);o.offsetToAxisValueOffsets+=y.sizeOf(),o.fields=o.fields.concat(y.fields)}let l=[],d=[],f=n.values.length*2;for(let g=0;g<n.values.length;g++){let y=gs(g,n.values[g]);l.push({name:"offset_"+g,type:"USHORT",value:f}),f+=y.sizeOf(),d=d.concat(y.fields)}return o.fields=o.fields.concat(l),o.fields=o.fields.concat(d),o}var Sl={make:as,parse:Is};function mi(n,o){return new Ae.Record("axisValueMap_"+n,[{name:"fromCoordinate_"+n,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+n,type:"F2DOT14",value:o.toCoordinate}])}function Ks(n,o){let l=new Ae.Record("segmentMap_"+n,[{name:"positionMapCount_"+n,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let g=mi(`${n}_${f}`,o.axisValueMaps[f]);d=d.concat(g.fields)}return l.fields=l.fields.concat(d),l}function r0(n,o){q.argument(n.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let l=new Ae.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:n.axisSegmentMaps.length}]);for(let d=0;d<n.axisSegmentMaps.length;d++){let f=Ks(d,n.axisSegmentMaps[d]);l.fields=l.fields.concat(f.fields)}return l}function L(n,o,l){o||(o=0);let d=new re(n,o),f=d.parseUShort(),g=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${g}`),d.skip("uShort",1);let y=d.parseUShort();q.argument(y===l.axes.length,"avar axis count must correspond to fvar axis count");let A=[];for(let S=0;S<y;S++){let M=[],E=d.parseUShort();for(let $=0;$<E;$++){let U=d.parseF2Dot14(),oe=d.parseF2Dot14();M.push({fromCoordinate:U,toCoordinate:oe})}A.push({axisValueMaps:M})}return{version:[f,g],axisSegmentMaps:A}}var Q={make:r0,parse:L};function j(n,o,l,d){let f=new ct.Parser(n,o),g=f.parseTupleVariationStore(f.relativeOffset,l.axes.length,"cvar",d),y=f.parseUShort(),A=f.parseUShort();return y!==1&&console.warn(`Unsupported cvar table version ${y}.${A}`),{version:[y,A],...g}}function W(){console.warn("Writing of cvar tables is not yet supported.")}var Le={make:W,parse:j};function xe(n,o,l,d){let f=new ct.Parser(n,o),g=f.parseUShort(),y=f.parseUShort();g!==1&&console.warn(`Unsupported gvar table version ${g}.${y}`);let A=f.parseUShort();A!==l.axes.length&&console.warn(`axisCount ${A} in gvar table does not match the number of axes ${l.axes.length} in the fvar table!`);let S=f.parseUShort(),M=f.parsePointer32(function(){return this.parseTupleRecords(S,A)}),E=f.parseTupleVariationStoreList(A,"gvar",d);return{version:[g,y],sharedTuples:M,glyphVariations:E}}function Je(){console.warn("Writing of gvar tables is not yet supported.")}var Ye={make:Je,parse:xe};function Ct(n,o){let l={},d=new ct.Parser(n,o);l.version=d.parseUShort(),q.argument(l.version<=1,"Unsupported gasp table version."),l.numRanges=d.parseUShort(),l.gaspRanges=[];for(let f=0;f<l.numRanges;f++)l.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return l}function xr(n){let o=new Ae.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:n.numRanges}]);for(let l in n.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:n.gaspRanges[l].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:n.gaspRanges[l].rangeGaspBehavior});return o}var Jr={parse:Ct,make:xr};function ln(n,o){let l=new Map,d=n.buffer,f=new re(n,o);if(f.parseUShort()!==0)return l;f.relativeOffset=f.parseOffset32();let g=n.byteOffset+o+f.relativeOffset,y=f.parseUShort(),A=new Map;for(let S=0;S<y;S++){let M=f.parseUShort(),E=f.parseUShort(),$=g+f.parseOffset32(),U=f.parseULong(),oe=A.get($);oe===void 0&&(oe=new Uint8Array(d,$,U),A.set($,oe));for(let X=M;X<=E;X++)l.set(X,oe)}return l}function pn(n){let o=Array.from(n.keys()).sort(),l=[],d=[],f=new Map,g=0,y={endGlyphID:null};for(let U=0,oe=o.length;U<oe;U++){let X=o[U],de=n.get(X),Fe=f.get(de);Fe===void 0&&(Fe=g,d.push(de),f.set(de,Fe),g+=de.byteLength),X-1===y.endGlyphID&&Fe===y.svgDocOffset?y.endGlyphID=X:(y={startGlyphID:X,endGlyphID:X,svgDocOffset:Fe,svgDocLength:de.byteLength},l.push(y))}let A=l.length,S=d.length,M=2+A*12,E=new Array(4+A*4+S),$=0;E[$++]={name:"version",type:"USHORT",value:0},E[$++]={name:"svgDocumentListOffset",type:"ULONG",value:10},E[$++]={name:"reserved",type:"ULONG",value:0},E[$++]={name:"numEntries",type:"USHORT",value:A};for(let U=0;U<A;U++){let oe="documentRecord_"+U,{startGlyphID:X,endGlyphID:de,svgDocOffset:Fe,svgDocLength:rr}=l[U];E[$++]={name:oe+"_startGlyphID",type:"USHORT",value:X},E[$++]={name:oe+"_endGlyphID",type:"USHORT",value:de},E[$++]={name:oe+"_svgDocOffset",type:"ULONG",value:M+Fe},E[$++]={name:oe+"_svgDocLength",type:"ULONG",value:rr}}for(let U=0;U<S;U++)E[$++]={name:"svgDoc_"+U,type:"LITERAL",value:d[U]};return new Ae.Table("SVG ",E)}var ur={make:pn,parse:ln};function Or(n){return Math.log(n)/Math.log(2)|0}function Vn(n){for(;n.length%4!==0;)n.push(0);let o=0;for(let l=0;l<n.length;l+=4)o+=(n[l]<<24)+(n[l+1]<<16)+(n[l+2]<<8)+n[l+3];return o%=Math.pow(2,32),o}function xs(n,o,l,d){return new Ae.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:l!==void 0?l:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function ho(n){let o=new Ae.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=n,o.numTables=n.length;let l=Math.pow(2,Or(o.numTables));o.searchRange=16*l,o.entrySelector=Or(l),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],g=o.sizeOf()+xs().sizeOf()*o.numTables;for(;g%4!==0;)g+=1,f.push({name:"padding",type:"BYTE",value:0});for(let y=0;y<n.length;y+=1){let A=n[y];q.argument(A.tableName.length===4,"Table name"+A.tableName+" is invalid.");let S=A.sizeOf(),M=xs(A.tableName,Vn(A.encode()),g,S);for(d.push({name:M.tag+" Table Record",type:"RECORD",value:M}),f.push({name:A.tableName+" table",type:"RECORD",value:A}),g+=S,q.argument(!isNaN(g),"Something went wrong calculating the offset.");g%4!==0;)g+=1,f.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(y,A){return y.value.tag>A.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function Ln(n,o,l){for(let d=0;d<o.length;d+=1){let f=n.charToGlyphIndex(o[d]);if(f>0)return n.glyphs.get(f).getMetrics()}return l}function ji(n){let o=0;for(let l=0;l<n.length;l+=1)o+=n[l];return o/n.length}function Ii(n){let o=[],l=[],d=[],f=[],g=[],y=[],A=[],S,M=0,E=0,$=0,U=0,oe=0;for(let Qn=0;Qn<n.glyphs.length;Qn+=1){let so=n.glyphs.get(Qn),ko=so.unicode|0;if(isNaN(so.advanceWidth))throw new Error("Glyph "+so.name+" ("+Qn+"): advanceWidth is not a number.");(S>ko||S===void 0)&&ko>0&&(S=ko),M<ko&&(M=ko);let ta=uo.getUnicodeRange(ko);if(ta<32)E|=1<<ta;else if(ta<64)$|=1<<ta-32;else if(ta<96)U|=1<<ta-64;else if(ta<123)oe|=1<<ta-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(so.name===".notdef")continue;let Oa=so.getMetrics();o.push(Oa.xMin),l.push(Oa.yMin),d.push(Oa.xMax),f.push(Oa.yMax),y.push(Oa.leftSideBearing),A.push(Oa.rightSideBearing),g.push(so.advanceWidth)}let X={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,g),advanceWidthAvg:ji(g),minLeftSideBearing:Math.min.apply(null,y),maxLeftSideBearing:Math.max.apply(null,y),minRightSideBearing:Math.min.apply(null,A)};X.ascender=n.ascender,X.descender=n.descender;let de=0;n.weightClass>=600&&(de|=n.macStyleValues.BOLD),n.italicAngle<0&&(de|=n.macStyleValues.ITALIC);let Fe=ro.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:X.xMin,yMin:X.yMin,xMax:X.xMax,yMax:X.yMax,lowestRecPPEM:3,macStyle:de,createdTimestamp:n.createdTimestamp}),rr=To.make({ascender:X.ascender,descender:X.descender,advanceWidthMax:X.advanceWidthMax,minLeftSideBearing:X.minLeftSideBearing,minRightSideBearing:X.minRightSideBearing,xMaxExtent:X.maxLeftSideBearing+(X.xMax-X.xMin),numberOfHMetrics:n.glyphs.length}),Gt=di.make(n.glyphs.length),gr=uo.make(Object.assign({xAvgCharWidth:Math.round(X.advanceWidthAvg),usFirstCharIndex:S,usLastCharIndex:M,ulUnicodeRange1:E,ulUnicodeRange2:$,ulUnicodeRange3:U,ulUnicodeRange4:oe,sTypoAscender:X.ascender,sTypoDescender:X.descender,sTypoLineGap:0,usWinAscent:X.yMax,usWinDescent:Math.abs(X.yMin),ulCodePageRange1:1,sxHeight:Ln(n,"xyvw",{yMax:Math.round(X.ascender/2)}).yMax,sCapHeight:Ln(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",X).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0},n.tables.os2)),Mr=Ys.make(n.glyphs),gn=As.make(n.glyphs),En=n.getEnglishName("fontFamily"),Rn=n.getEnglishName("fontSubfamily"),Ns=En+" "+Rn,Jo=n.getEnglishName("postScriptName");Jo||(Jo=En.replace(/\s/g,"")+"-"+Rn);let Nr={};for(let Qn in n.names)Nr[Qn]=n.names[Qn];Nr.unicode=Nr.unicode||{},Nr.macintosh=Nr.macintosh||{},Nr.windows=Nr.windows||{};let po=n.names.unicode||{},$i=n.names.macintosh||{},nr=n.names.windows||{};for(let Qn in Nr){if(Nr[Qn]=Nr[Qn]||{},!Nr[Qn].uniqueID){let so=n.getEnglishName("manufacturer")||"";Nr[Qn].uniqueID={en:`${so}: ${Ns}`}}Nr[Qn].postScriptName||(Nr[Qn].postScriptName={en:Jo})}Nr.unicode.preferredFamily||(Nr.unicode.preferredFamily=po.fontFamily||$i.fontFamily||nr.fontFamily),Nr.macintosh.preferredFamily||(Nr.macintosh.preferredFamily=$i.fontFamily||po.fontFamily||nr.fontFamily),Nr.windows.preferredFamily||(Nr.windows.preferredFamily=nr.fontFamily||po.fontFamily||$i.fontFamily),Nr.unicode.preferredSubfamily||(Nr.unicode.preferredSubfamily=po.fontSubfamily||$i.fontSubfamily||nr.fontSubfamily),Nr.macintosh.preferredSubfamily||(Nr.macintosh.preferredSubfamily=$i.fontSubfamily||po.fontSubfamily||nr.fontSubfamily),Nr.windows.preferredSubfamily||(Nr.windows.preferredSubfamily=nr.fontSubfamily||po.fontSubfamily||$i.fontSubfamily);let Ot=[],zt=jt.make(Nr,Ot),Ri=Ot.length>0?Zo.make(Ot):void 0,dl=Bi.make(n),Cu=Vo.make(n.glyphs,{version:n.getEnglishName("version"),fullName:Ns,familyName:En,weightName:Rn,postScriptName:Jo,unitsPerEm:n.unitsPerEm,fontBBox:[0,X.yMin,X.ascender,X.advanceWidthMax],topDict:n.tables.cff&&n.tables.cff.topDict||{}}),El=n.metas&&Object.keys(n.metas).length>0?Li.make(n.metas):void 0,ea=[Fe,rr,Gt,gr,zt,gn,dl,Cu,Mr];Ri&&ea.push(Ri);let zi={gsub:hi,cpal:co,colr:je,stat:Sl,avar:Q,cvar:Le,fvar:Xr,gvar:Ye,gasp:Jr,svg:ur},Io={avar:[n.tables.fvar],fvar:[n.names]};for(let Qn in zi){let so=n.tables[Qn];if(so){let ko=zi[Qn].make.call(n,so,...Io[Qn]||[]);ko&&ea.push(ko)}}El&&ea.push(El);let Mi=ho(ea),mo=Mi.encode(),Hi=Vn(mo),Wi=Mi.fields,ys=!1;for(let Qn=0;Qn<Wi.length;Qn+=1)if(Wi[Qn].name==="head table"){Wi[Qn].value.checkSumAdjustment=2981146554-Hi,ys=!0;break}if(!ys)throw new Error("Could not find head table with checkSum to adjust.");return Mi}var Qa={make:ho,fontToTable:Ii,computeCheckSum:Vn};function gi(n,o){let l=0,d=n.length-1;for(;l<=d;){let f=l+d>>>1,g=n[f].tag;if(g===o)return f;g<o?l=f+1:d=f-1}return-l-1}function tl(n,o){let l=0,d=n.length-1;for(;l<=d;){let f=l+d>>>1,g=n[f];if(g===o)return f;g<o?l=f+1:d=f-1}return-l-1}function ja(n,o){let l,d=0,f=n.length-1;for(;d<=f;){let g=d+f>>>1;l=n[g];let y=l.start;if(y===o)return l;y<o?d=g+1:f=g-1}if(d>0)return l=n[d-1],o>l.end?0:l}function hu(n,o){this.font=n,this.tableName=o}hu.prototype={searchTag:gi,binSearch:tl,getTable:function(n){let o=this.font.tables[this.tableName];return!o&&n&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let n=this.getTable();return n?n.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let n=this.getTable();if(!n)return;let o=!1;for(let l=0;l<n.scripts.length;l++){let d=n.scripts[l].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(n,o){let l=this.getTable(o);if(l){n=n||"DFLT";let d=l.scripts,f=gi(l.scripts,n);if(f>=0)return d[f].script;if(o){let g={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,g),g.script}}},getLangSysTable:function(n,o,l){let d=this.getScriptTable(n,l);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=gi(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(l){let g={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,g),g.langSys}}},getFeatureTable:function(n,o,l,d){let f=this.getLangSysTable(n,o,d);if(f){let g,y=f.featureIndexes,A=this.font.tables[this.tableName].features;for(let S=0;S<y.length;S++)if(g=A[y[S]],g.tag===l)return g.feature;if(d){let S=A.length;return q.assert(S===0||l>=A[S-1].tag,"Features must be added in alphabetical order."),g={tag:l,feature:{params:0,lookupListIndexes:[]}},A.push(g),y.push(S),g.feature}}},getLookupTables:function(n,o,l,d,f){let g=this.getFeatureTable(n,o,l,f),y=[];if(g){let A,S=g.lookupListIndexes,M=this.font.tables[this.tableName].lookups;for(let E=0;E<S.length;E++)A=M[S[E]],A.lookupType===d&&y.push(A);if(y.length===0&&f){A={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let E=M.length;return M.push(A),S.push(E),[A]}}return y},getGlyphClass:function(n,o){switch(n.format){case 1:return n.startGlyph<=o&&o<n.startGlyph+n.classes.length?n.classes[o-n.startGlyph]:0;case 2:{let l=ja(n.ranges,o);return l?l.classId:0}}},getCoverageIndex:function(n,o){switch(n.format){case 1:{let l=tl(n.glyphs,o);return l>=0?l:-1}case 2:{let l=ja(n.ranges,o);return l?l.index+o-l.start:-1}}},expandCoverage:function(n){if(n.format===1)return n.glyphs;{let o=[],l=n.ranges;for(let d=0;d<l.length;d++){let f=l[d],g=f.start,y=f.end;for(let A=g;A<=y;A++)o.push(A)}return o}}};var Pi=hu;function Oi(n){Pi.call(this,n,"gpos")}Oi.prototype=Pi.prototype,Oi.prototype.init=function(){let n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)},Oi.prototype.getKerningValue=function(n,o,l){for(let d=0;d<n.length;d++){let f=n[d].subtables;for(let g=0;g<f.length;g++){let y=f[g],A=this.getCoverageIndex(y.coverage,o);if(!(A<0))switch(y.posFormat){case 1:{let S=y.pairSets[A];for(let M=0;M<S.length;M++){let E=S[M];if(E.secondGlyph===l)return E.value1&&E.value1.xAdvance||0}break}case 2:{let S=this.getGlyphClass(y.classDef1,o),M=this.getGlyphClass(y.classDef2,l),E=y.classRecords[S][M];return E.value1&&E.value1.xAdvance||0}}}}return 0},Oi.prototype.getKerningTables=function(n,o){if(this.font.tables.gpos)return this.getLookupTables(n,o,"kern",2)};var n0=Oi;function s0(n,o){let l=n.length;if(l!==o.length)return!1;for(let d=0;d<l;d++)if(n[d]!==o[d])return!1;return!0}function dh(n,o,l){let d=0,f=n.length-1,g=null;for(;d<=f;){let y=Math.floor((d+f)/2),A=n[y],S=A[o];if(S<l)d=y+1;else if(S>l)f=y-1;else{g=A;break}}return g}function hh(n,o,l){let d=0,f=n.length-1;for(;d<=f;){let g=Math.floor((d+f)/2),y=n[g];if(y[o]<l)d=g+1;else if(y[o]>l)f=g-1;else return g}return-1}function fh(n,o,l){let d=0,f=n.length,g=(y,A)=>y[o]-A[o];for(;d<f;){let y=d+f>>>1;g(n[y],l)<0?d=y+1:f=y}return n.splice(d,0,l),d}function fu(n){return n[0]===31&&n[1]===139&&n[2]===8}function Yo(n){let o=new DataView(n.buffer,n.byteOffset,n.byteLength),l=10,d=n.byteLength-8,f=o.getInt8(3);if(f&4&&(l+=2+o.getUint16(l,!0)),f&8)for(;l<d&&n[l++]!==0;);if(f&16)for(;l<d&&n[l++]!==0;);if(f&2&&(l+=2),l>=d)throw new Error("Can't find compressed blocks");let g=o.getUint32(o.byteLength-4,!0);return ce(n.subarray(l,d),new Uint8Array(g))}function ma(n){return{x:n.x,y:n.y,onCurve:n.onCurve,lastPointOfContour:n.lastPointOfContour}}function ph(n){return{glyphIndex:n.glyphIndex,xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:n.dx,dy:n.dy}}function Xs(n){Pi.call(this,n,"gsub")}function i0(n,o,l){let d=n.subtables;for(let f=0;f<d.length;f++){let g=d[f];if(g.substFormat===o)return g}if(l)return d.push(l),l}Xs.prototype=Pi.prototype,Xs.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Xs.prototype.getSingle=function(n,o,l){let d=[],f=this.getLookupTables(o,l,n,1);for(let g=0;g<f.length;g++){let y=f[g].subtables;for(let A=0;A<y.length;A++){let S=y[A],M=this.expandCoverage(S.coverage),E;if(S.substFormat===1){let $=S.deltaGlyphId;for(E=0;E<M.length;E++){let U=M[E];d.push({sub:U,by:U+$})}}else{let $=S.substitute;for(E=0;E<M.length;E++)d.push({sub:M[E],by:$[E]})}}}return d},Xs.prototype.getMultiple=function(n,o,l){let d=[],f=this.getLookupTables(o,l,n,2);for(let g=0;g<f.length;g++){let y=f[g].subtables;for(let A=0;A<y.length;A++){let S=y[A],M=this.expandCoverage(S.coverage),E;for(E=0;E<M.length;E++){let $=M[E],U=S.sequences[E];d.push({sub:$,by:U})}}}return d},Xs.prototype.getAlternates=function(n,o,l){let d=[],f=this.getLookupTables(o,l,n,3);for(let g=0;g<f.length;g++){let y=f[g].subtables;for(let A=0;A<y.length;A++){let S=y[A],M=this.expandCoverage(S.coverage),E=S.alternateSets;for(let $=0;$<M.length;$++)d.push({sub:M[$],by:E[$]})}}return d},Xs.prototype.getLigatures=function(n,o,l){let d=[],f=this.getLookupTables(o,l,n,4);for(let g=0;g<f.length;g++){let y=f[g].subtables;for(let A=0;A<y.length;A++){let S=y[A],M=this.expandCoverage(S.coverage),E=S.ligatureSets;for(let $=0;$<M.length;$++){let U=M[$],oe=E[$];for(let X=0;X<oe.length;X++){let de=oe[X];d.push({sub:[U].concat(de.components),by:de.ligGlyph})}}}}return d},Xs.prototype.addSingle=function(n,o,l,d){let f=this.getLookupTables(l,d,n,1,!0)[0],g=i0(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});q.assert(g.coverage.format===1,"Single: unable to modify coverage table format "+g.coverage.format);let y=o.sub,A=this.binSearch(g.coverage.glyphs,y);A<0&&(A=-1-A,g.coverage.glyphs.splice(A,0,y),g.substitute.splice(A,0,0)),g.substitute[A]=o.by},Xs.prototype.addMultiple=function(n,o,l,d){q.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(l,d,n,2,!0)[0],g=i0(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});q.assert(g.coverage.format===1,"Multiple: unable to modify coverage table format "+g.coverage.format);let y=o.sub,A=this.binSearch(g.coverage.glyphs,y);A<0&&(A=-1-A,g.coverage.glyphs.splice(A,0,y),g.sequences.splice(A,0,0)),g.sequences[A]=o.by},Xs.prototype.addAlternate=function(n,o,l,d){let f=this.getLookupTables(l,d,n,3,!0)[0],g=i0(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});q.assert(g.coverage.format===1,"Alternate: unable to modify coverage table format "+g.coverage.format);let y=o.sub,A=this.binSearch(g.coverage.glyphs,y);A<0&&(A=-1-A,g.coverage.glyphs.splice(A,0,y),g.alternateSets.splice(A,0,0)),g.alternateSets[A]=o.by},Xs.prototype.addLigature=function(n,o,l,d){let f=this.getLookupTables(l,d,n,4,!0)[0],g=f.subtables[0];g||(g={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=g),q.assert(g.coverage.format===1,"Ligature: unable to modify coverage table format "+g.coverage.format);let y=o.sub[0],A=o.sub.slice(1),S={ligGlyph:o.by,components:A},M=this.binSearch(g.coverage.glyphs,y);if(M>=0){let E=g.ligatureSets[M];for(let $=0;$<E.length;$++)if(s0(E[$].components,A))return;E.push(S)}else M=-1-M,g.coverage.glyphs.splice(M,0,y),g.ligatureSets.splice(M,0,[S])},Xs.prototype.getFeature=function(n,o,l){if(/ss\d\d/.test(n))return this.getSingle(n,o,l);switch(n){case"aalt":case"salt":return this.getSingle(n,o,l).concat(this.getAlternates(n,o,l));case"dlig":case"liga":case"rlig":return this.getLigatures(n,o,l);case"ccmp":return this.getMultiple(n,o,l).concat(this.getLigatures(n,o,l));case"stch":return this.getMultiple(n,o,l)}},Xs.prototype.add=function(n,o,l,d){if(/ss\d\d/.test(n))return this.addSingle(n,o,l,d);switch(n){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(n,o,l,d):this.addAlternate(n,o,l,d);case"dlig":case"liga":case"rlig":return this.addLigature(n,o,l,d);case"ccmp":return o.by instanceof Array?this.addMultiple(n,o,l,d):this.addLigature(n,o,l,d)}};var pu=Xs,ec=class{constructor(n){this.defaultValue=255,this.font=n}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(n){let o=[],l=this.cpal();if(!l)return o;for(let d=0;d<l.colorRecordIndices.length;d++){let f=l.colorRecordIndices[d],g=[];for(let y=f;y<f+l.numPaletteEntries;y++)g.push(Fs(l.colorRecords[y],n||"hexa"));o.push(g)}return o}toCPALcolor(n){return Array.isArray(n)?n.map(o=>Os(o,"raw")):Os(n,"raw")}fillPalette(n,o=[],l=this.cpal().numPaletteEntries){return n=Number.isInteger(n)?this.get(n,"raw"):n,Object.assign(Array(l).fill(this.defaultValue),this.toCPALcolor(n).concat(this.toCPALcolor(o)))}extend(n){if(this.ensureCPAL(Array(n).fill(this.defaultValue)))return;let o=this.cpal(),l=o.numPaletteEntries+n,d=this.getAll().map(f=>this.fillPalette(f,[],l));o.numPaletteEntries=l,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(n,o="hexa"){return this.getAll(o)[n]||null}getColor(n,o=0,l="hexa"){return Ft(this.font,n,o,l)}setColor(n,o,l=0){n=parseInt(n),l=parseInt(l);let d=this.getAll("raw"),f=d[l];if(!f)throw Error(`paletteIndex ${l} out of range`);let g=this.cpal(),y=g.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+n>y&&(this.extend(o.length+n-y),d=this.getAll("raw"),f=d[l]);for(let A=0;A<o.length;A++)f[A+n]=this.toCPALcolor(o[A]);g.colorRecords=d.flat(),this.updateIndices()}add(n){if(this.ensureCPAL(n))return;let o=this.cpal(),l=o.numPaletteEntries;n&&n.length?(n=this.toCPALcolor(n),n.length>l?this.extend(n.length-l):n.length<l&&(n=this.fillPalette(n)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...n)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(l).fill(this.defaultValue)))}delete(n){let o=this.getAll("raw");delete o[n];let l=this.cpal();l.colorRecordIndices.pop(),l.colorRecords=o.flat()}deleteColor(n,o){if(n===o)throw Error("replacementIndex cannot be the same as colorIndex");let l=this.cpal(),d=this.getAll("raw"),f=[];if(o>l.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${l.numPaletteEntries-1}, replacementIndex: ${o})`);for(let A=0;A<d.length;A++){let S=d[A].filter((M,E)=>E!==n);f.push(S)}let g=this.font.tables.colr;if(g){let A=g.layerRecords;for(let S=0;S<A.length;S++){let M=A[S].paletteIndex;if(M>n)A[S].paletteIndex-=1;else if(M===n){let E=0;for(let $=0;$<d.length;$++)if(o>n&&o<=n+d[$].length){E++;break}A[S].paletteIndex=o-E}}this.font.tables.colr={...g,layerRecords:A}}let y=f.flat();for(let A=0;A<d.length;A++)l.colorRecordIndices[A]-=A;l.numPaletteEntries=Math.max(0,l.numPaletteEntries-1),l.colorRecords=this.toCPALcolor(y)}ensureCPAL(n){return this.cpal()?!1:(!n||!n.length?n=[this.defaultValue]:n=this.toCPALcolor(n),this.font.tables.cpal={version:0,numPaletteEntries:n.length,colorRecords:n,colorRecordIndices:[0]},!0)}updateIndices(){let n=this.cpal(),o=Math.ceil(n.colorRecords.length/n.numPaletteEntries);n.colorRecordIndices=[];for(let l=0;l<o;l++)n.colorRecordIndices.push(l*n.numPaletteEntries)}},mu=class{constructor(n){this.font=n}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(n){let o=this.font,l=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return l;let g=dh(d.baseGlyphRecords,"glyphID",n);if(!g)return l;let y=g.firstLayerIndex,A=g.numLayers;for(let S=0;S<A;S++){let M=d.layerRecords[y+S];l.push({glyph:o.glyphs.get(M.glyphID),paletteIndex:M.paletteIndex})}return l}add(n,o,l){let d=this.get(n);o=Array.isArray(o)?o:[o],l===void 0||l===1/0||l>d.length?l=d.length:l<0&&(l=d.length+1+l%(d.length+1),l>=d.length+1&&(l-=d.length+1));let f=[];for(let g=0;g<l;g++){let y=Number.isInteger(d[g].glyph)?d[g].glyph:d[g].glyph.index;f.push({glyphID:y,paletteIndex:d[g].paletteIndex})}for(let g of o){let y=Number.isInteger(g.glyph)?g.glyph:g.glyph.index;f.push({glyphID:y,paletteIndex:g.paletteIndex})}for(let g=l;g<d.length;g++){let y=Number.isInteger(d[g].glyph)?d[g].glyph:d[g].glyph.index;f.push({glyphID:y,paletteIndex:d[g].paletteIndex})}this.updateColrTable(n,f)}setPaletteIndex(n,o,l){let d=this.get(n);d[o]?(d=d.map((f,g)=>({glyphID:f.glyph.index,paletteIndex:g===o?l:f.paletteIndex})),this.updateColrTable(n,d)):console.error("Invalid layer index")}remove(n,o,l=o){let d=this.get(n);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,l-o+1),this.updateColrTable(n,d)}updateColrTable(n,o){this.ensureCOLR();let l=this.font.tables.colr,d=hh(l.baseGlyphRecords,"glyphID",n);if(d===-1){let S={glyphID:n,firstLayerIndex:l.layerRecords.length,numLayers:0};d=fh(l.baseGlyphRecords,"glyphID",S)}let f=l.baseGlyphRecords[d],g=f.numLayers,y=o.length,A=y-g;if(A>0){let S=o.slice(g).map(M=>({glyphID:M.glyphID,paletteIndex:M.paletteIndex}));l.layerRecords.splice(f.firstLayerIndex+g,0,...S)}else A<0&&l.layerRecords.splice(f.firstLayerIndex+y,-A);for(let S=0;S<Math.min(g,y);S++)l.layerRecords[f.firstLayerIndex+S]={glyphID:o[S].glyphID,paletteIndex:o[S].paletteIndex};if(f.numLayers=y,A!==0)for(let S=0;S<l.baseGlyphRecords.length;S++){let M=l.baseGlyphRecords[S];S===d||M.firstLayerIndex<f.firstLayerIndex||(l.baseGlyphRecords[S].firstLayerIndex+=A)}}},gu=class{constructor(n){this.font=n,this.cache=new WeakMap}get(n){let o=this.getOrCreateSvgImageCacheEntry(n);return o&&o.image}getAsync(n){let o=this.getOrCreateSvgImageCacheEntry(n);return o&&o.promise}getOrCreateSvgImageCacheEntry(n){let o=this.font.tables.svg;if(o===void 0)return;let l=o.get(n);if(l===void 0)return;let d=this.cache.get(l);d===void 0&&(d=_l(l),this.cache.set(l,d));let f=d.images.get(n);return f===void 0&&(f=rl(this.font,d.template,n),f.promise.then(g=>{if(f.image=g,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(n)}catch(y){console.error("font.onGlyphUpdated",n,y)}}),d.images.set(n,f)),f}};function _l(n){return{template:mh(n).then(rc),images:new Map}}function rl(n,o,l){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=l,f=d.join(""));let g=gh(f,n.unitsPerEm);return g.image.decode().then(()=>g)}),image:void 0}}var mh=typeof DecompressionStream=="function"?tc:xu;function xu(n){try{return Promise.resolve(new TextDecoder().decode(fu(n)?Yo(n):n))}catch(o){return Promise.reject(o)}}function tc(n){if(fu(n))return new Response(new Response(n).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(n))}catch(o){return Promise.reject(o)}}function rc(n){let o=n.indexOf("<svg"),l=n.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(n.substring(o,l)))return n;let d=n.lastIndexOf("</svg>");return[n.substring(0,l),"<defs>",n.substring(l,d),'</defs><use href="#glyph',"",'"/>',n.substring(d)]}function gh(n,o){let l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,d=l.viewBox.baseVal,f=l.width.baseVal,g=l.height.baseVal,y=1,A=1;d.width>0&&d.height>0&&(f.unitType===1?(y=f.valueInSpecifiedUnits/d.width,A=g.unitType===1?g.valueInSpecifiedUnits/d.height:y):g.unitType===1?(A=g.valueInSpecifiedUnits/d.height,y=A):o&&(y=o/d.width,A=o/d.height));let S=document.createElement("div");S.style.position="fixed",S.style.visibility="hidden",S.appendChild(l),document.body.appendChild(S);let M=l.getBBox();document.body.removeChild(S);let E=(M.x-d.x)*y,$=(d.y-M.y)*A,U=M.width*y,oe=M.height*A;l.setAttribute("viewBox",[M.x,M.y,M.width,M.height].join(" ")),y!==1&&l.setAttribute("width",U),A!==1&&l.setAttribute("height",oe);let X=new Image(U,oe);return X.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l.outerHTML),{leftSideBearing:E,baseline:$,image:X}}var o0=new WeakMap;function a0(n,o,l,d,f){let g;return(o&d)>0?(g=n.parseByte(),(o&f)===0&&(g=-g),g=l+g):(o&f)>0?g=l:g=l+n.parseShort(),g}function nc(n,o,l){let d=new ct.Parser(o,l);n._numberOfContours=d.parseShort(),n._xMin=d.parseShort(),n._yMin=d.parseShort(),n._xMax=d.parseShort(),n._yMax=d.parseShort();let f,g;if(n._numberOfContours>0){let y=n.endPointIndices=[];for(let S=0;S<n._numberOfContours;S+=1)y.push(d.parseUShort());n.instructionLength=d.parseUShort(),n.instructions=[];for(let S=0;S<n.instructionLength;S+=1)n.instructions.push(d.parseByte());let A=y[y.length-1]+1;f=[];for(let S=0;S<A;S+=1)if(g=d.parseByte(),f.push(g),(g&8)>0){let M=d.parseByte();for(let E=0;E<M;E+=1)f.push(g),S+=1}if(q.argument(f.length===A,"Bad flags."),y.length>0){let S=[],M;if(A>0){for(let U=0;U<A;U+=1)g=f[U],M={},M.onCurve=!!(g&1),M.lastPointOfContour=y.indexOf(U)>=0,S.push(M);let E=0;for(let U=0;U<A;U+=1)g=f[U],M=S[U],M.x=a0(d,g,E,2,16),E=M.x;let $=0;for(let U=0;U<A;U+=1)g=f[U],M=S[U],M.y=a0(d,g,$,4,32),$=M.y}n.points=S}else n.points=[]}else if(n._numberOfContours===0)n.points=[];else{n.isComposite=!0,n.points=[],n.components=[];let y=!0;for(;y;){f=d.parseUShort();let A={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(A.dx=d.parseShort(),A.dy=d.parseShort()):A.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(A.dx=d.parseChar(),A.dy=d.parseChar()):A.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?A.xScale=A.yScale=d.parseF2Dot14():(f&64)>0?(A.xScale=d.parseF2Dot14(),A.yScale=d.parseF2Dot14()):(f&128)>0&&(A.xScale=d.parseF2Dot14(),A.scale01=d.parseF2Dot14(),A.scale10=d.parseF2Dot14(),A.yScale=d.parseF2Dot14()),n.components.push(A),y=!!(f&32)}if(f&256){n.instructionLength=d.parseUShort(),n.instructions=[];for(let A=0;A<n.instructionLength;A+=1)n.instructions.push(d.parseByte())}}}function ki(n,o){let l=[];for(let d=0;d<n.length;d+=1){let f=n[d],g={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};l.push(g)}return l}function l0(n){let o=[],l=[];for(let d=0;d<n.length;d+=1){let f=n[d];l.push(f),f.lastPointOfContour&&(o.push(l),l=[])}return q.argument(l.length===0,"There are still points left in the current contour."),o}function Ll(n){let o=new Xe;if(!n)return o;let l=l0(n);for(let d=0;d<l.length;++d){let f=l[d],g=f[f.length-1],y=f[0];if(g.onCurve)o.moveTo(g.x,g.y);else if(y.onCurve)o.moveTo(y.x,y.y);else{let A={x:(g.x+y.x)*.5,y:(g.y+y.y)*.5};o.moveTo(A.x,A.y)}for(let A=0;A<f.length;++A)if(g=y,y=f[(A+1)%f.length],g.onCurve)o.lineTo(g.x,g.y);else{let S=y;y.onCurve||(S={x:(g.x+y.x)*.5,y:(g.y+y.y)*.5}),o.quadraticCurveTo(g.x,g.y,S.x,S.y)}o.closePath()}return o}function Il(n,o){if(o.isComposite){o0.has(n)||o0.set(n,new Set);let l=o0.get(n);l.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(l.has(f.glyphIndex))continue;let g=n.get(f.glyphIndex);if(g.getPath(),g.points){let y;if(f.matchedPoints===void 0)y=ki(g.points,f);else{if(f.matchedPoints[0]>o.points.length-1||f.matchedPoints[1]>g.points.length-1)throw Error("Matched points out of range in "+o.name);let A=o.points[f.matchedPoints[0]],S=g.points[f.matchedPoints[1]],M={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};S=ki([S],M)[0],M.dx=A.x-S.x,M.dy=A.y-S.y,y=ki(g.points,M)}o.points=o.points.concat(y)}}}finally{l.delete(o.index)}}return Ll(o.points)}function nl(n,o,l,d){let f=new Lr.GlyphSet(d);for(let g=0;g<l.length-1;g+=1){let y=l[g],A=l[g+1];y!==A?f.push(g,Lr.ttfGlyphLoader(d,g,nc,n,o+y,Il)):f.push(g,Lr.glyphLoader(d,g))}return f}function Es(n,o,l,d){let f=new Lr.GlyphSet(d);return d._push=function(g){let y=l[g],A=l[g+1];y!==A?f.push(g,Lr.ttfGlyphLoader(d,g,nc,n,o+y,Il)):f.push(g,Lr.glyphLoader(d,g))},f}function xh(n,o,l,d,f){return f.lowMemory?Es(n,o,l,d):nl(n,o,l,d)}var sc={getPath:Ll,parse:xh},bh=class{constructor(n){this.font=n}normalizeCoordTags(n){for(let o in n)if(o.length<4){let l=o.padEnd(4," ");n[l]===void 0&&(n[l]=n[o]),delete n[o]}}getNormalizedCoords(n){n||(n=this.font.variation.get());let o=[];this.normalizeCoordTags(n);for(let l=0;l<this.fvar().axes.length;l++){let d=this.fvar().axes[l],f=n[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 l=0;l<this.avar().axisSegmentMaps.length;l++){let d=this.avar().axisSegmentMaps[l];for(let f=0;f<d.axisValueMaps.length;f++){let g=d.axisValueMaps[f];if(f>=1&&o[l]<g.fromCoordinate){let y=d.axisValueMaps[f-1];o[l]=((o[l]-y.fromCoordinate)*(g.toCoordinate-y.toCoordinate)+Number.EPSILON)/(g.fromCoordinate-y.fromCoordinate+Number.EPSILON)+y.toCoordinate;break}}}return o}interpolatePoints(n,o,l){if(n.length===0)return;let d=0;for(;d<n.length;){let f=d,g=d,y=n[g];for(;!y.lastPointOfContour;)y=n[++g];for(;d<=g&&!l[d];)d++;if(d>g)continue;let A=d,S=d;for(d++;d<=g;)l[d]&&(this.deltaInterpolate(S+1,d-1,S,d,o,n),S=d),d++;S===A?this.deltaShift(f,g,S,o,n):(this.deltaInterpolate(S+1,g,S,A,o,n),A>0&&this.deltaInterpolate(f,A-1,S,A,o,n)),d=g+1}}deltaInterpolate(n,o,l,d,f,g){if(n>o)return;let y=["x","y"];for(let S=0;S<y.length;S++){let M=y[S];if(f[l][M]>f[d][M]){var A=l;l=d,d=A}let E=f[l][M],$=f[d][M],U=g[l][M],oe=g[d][M];if(E!==$||U===oe){let X=E===$?0:(oe-U)/($-E);for(let de=n;de<=o;de++){let Fe=f[de][M];Fe<=E?Fe+=U-E:Fe>=$?Fe+=oe-$:Fe=U+(Fe-E)*X,g[de][M]=Fe}}}}deltaShift(n,o,l,d,f){let g=f[l].x-d[l].x,y=f[l].y-d[l].y;if(!(g===0&&y===0))for(let A=n;A<=o;A++)A!==l&&(f[A].x+=g,f[A].y+=y)}transformComponents(n,o,l,d,f,g){let y=0;for(let A=0;A<n.components.length;A++){let S=n.components[A],M=this.font.glyphs.get(S.glyphIndex),E=ph(S),$=d.indexOf(A);$>-1&&(E.dx+=Math.round(f.deltas[$]*g),E.dy+=Math.round(f.deltasY[$]*g));let U=ki(this.getTransform(M,l).points,E);o.splice(y,U.length,...U),y+=M.points.length}}applyTupleVariationStore(n,o,l,d="gvar",f={}){l||(l=this.font.variation.get());let g=this.getNormalizedCoords(l),{headers:y,sharedPoints:A}=n,S=this.fvar().axes.length,M;d==="gvar"?M=o.map(ma):d==="cvar"&&(M=[...o]);for(let E=0;E<y.length;E++){let $=y[E],U=1;for(let X=0;X<S;X++){let de=[0];switch(d){case"gvar":de=$.peakTuple?$.peakTuple:this.gvar().sharedTuples[$.sharedTupleRecordsIndex];break;case"cvar":de=$.peakTuple;break}if(de[X]!==0){if(g[X]===0){U=0;break}if($.intermediateStartTuple)if(g[X]<$.intermediateStartTuple[X]||g[X]>$.intermediateEndTuple[X]){U=0;break}else g[X]<de[X]?U=U*(g[X]-$.intermediateStartTuple[X]+Number.EPSILON)/(de[X]-$.intermediateStartTuple[X]+Number.EPSILON):U=U*($.intermediateEndTuple[X]-g[X]+Number.EPSILON)/($.intermediateEndTuple[X]-de[X]+Number.EPSILON);else{if(g[X]<Math.min(0,de[X])||g[X]>Math.max(0,de[X])){U=0;break}U=(U*g[X]+Number.EPSILON)/(de[X]+Number.EPSILON)}}}if(U===0)continue;let oe=$.privatePoints.length?$.privatePoints:A;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,M,l,oe,$,U);else if(oe.length===0)for(let X=0;X<M.length;X++){let de=M[X];d==="gvar"?M[X]={x:Math.round(de.x+$.deltas[X]*U),y:Math.round(de.y+$.deltasY[X]*U),onCurve:de.onCurve,lastPointOfContour:de.lastPointOfContour}:d==="cvar"&&(M[X]=Math.round(de+$.deltas[X]*U))}else{let X;d==="gvar"?X=M.map(ma):d==="cvar"&&(X=M);let de=Array(o.length).fill(!1);for(let Fe=0;Fe<oe.length;Fe++){let rr=oe[Fe];if(rr<o.length){let Gt=X[rr];d==="gvar"?(de[rr]=!0,Gt.x+=$.deltas[Fe]*U,Gt.y+=$.deltasY[Fe]*U):d==="cvar"&&(M[rr]=Math.round(Gt+$.deltas[Fe]*U))}}if(d==="gvar"){this.interpolatePoints(X,M,de);for(let Fe=0;Fe<o.length;Fe++){let rr=X[Fe].x-M[Fe].x,Gt=X[Fe].y-M[Fe].y;M[Fe].x=Math.round(M[Fe].x+rr),M[Fe].y=Math.round(M[Fe].y+Gt)}}}}return M}getTransform(n,o){Number.isInteger(n)&&(n=this.font.glyphs.get(n));let l=n.getBlendPath,d=!!(n.points&&n.points.length),f=n;if(l||d){if(o||(o=this.font.variation.get()),d){let g=this.gvar()&&this.gvar().glyphVariations[n.index];if(g){let y=n.points,A=this.applyTupleVariationStore(g,y,o,"gvar",{glyph:n});f=new Ur(Object.assign({},n,{points:A,path:Ll(A)}))}}else if(l){let g=n.getBlendPath(o);f=new Ur(Object.assign({},n,{path:g}))}}return this.font.tables.hvar&&(n._advanceWidth=typeof n._advanceWidth<"u"?n._advanceWidth:n.advanceWidth,n.advanceWidth=f.advanceWidth=Math.round(n._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),n._leftSideBearing=typeof n._leftSideBearing<"u"?n._leftSideBearing:n.leftSideBearing,n.leftSideBearing=f.leftSideBearing=Math.round(n._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(n){let o=this.font.tables.cvt,l=this.cvar();return!o||!o.length||!l||!l.headers.length?o:this.applyTupleVariationStore(l,o,n,"cvar")}getVariableAdjustment(n,o,l,d){d=d||this.font.variation.get();let f,g,y=this.font.tables[o];if(!y)throw Error(`trying to get variation adjustment from non-existent table "${y}"`);if(!y.itemVariationStore)throw Error(`trying to get variation adjustment from table "${y}" which does not have an itemVariationStore`);let A=y[l]&&y[l].map.length;if(A){let S=n;S>=A&&(S=A-1),{outerIndex:f,innerIndex:g}=y[l].map[S]}else f=0,g=n;return this.getDelta(y.itemVariationStore,f,g,d)}getDelta(n,o,l,d){if(o>=n.itemVariationSubtables.length)return 0;let f=n.itemVariationSubtables[o];if(l>=f.deltaSets.length)return 0;let g=f.deltaSets[l],y=this.getBlendVector(n,o,d),A=0;for(let S=0;S<f.regionIndexes.length;S++)A+=g[S]*y[S];return A}getBlendVector(n,o,l){l||(l=this.font.variation.get());let d=n.itemVariationSubtables[o],f=this.getNormalizedCoords(l),g=[];for(let y=0;y<d.regionIndexes.length;y++){let A=1,S=d.regionIndexes[y],M=n.variationRegions[S].regionAxes;for(let E=0;E<M.length;E++){let $=M[E],U;$.startCoord>$.peakCoord||$.peakCoord>$.endCoord||$.startCoord<0&&$.endCoord>0&&$.peakCoord!==0||$.peakCoord===0?U=1:f[E]<$.startCoord||f[E]>$.endCoord?U=0:f[E]===$.peakCoord?U=1:f[E]<$.peakCoord?U=(f[E]-$.startCoord+Number.EPSILON)/($.peakCoord-$.startCoord+Number.EPSILON):U=($.endCoord-f[E]+Number.EPSILON)/($.endCoord-$.peakCoord+Number.EPSILON),A*=U}g[y]=A}return g}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}},bu=class{constructor(n){this.font=n,this.process=new bh(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let n=this.getDefaultInstanceIndex();n>-1?this.set(n):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((n,o)=>(n[o.tag]=o.defaultValue,n),{})}getDefaultInstanceIndex(){let n=this.getDefaultCoordinates(),o=this.getInstanceIndex(n);return o<0&&(o=this.fvar().instances.findIndex(l=>l.name&&l.name.en==="Regular")),o}getInstanceIndex(n){return this.fvar().instances.findIndex(o=>Object.keys(n).every(l=>o.coordinates[l]===n[l]))}getInstance(n){return this.fvar().instances&&this.fvar().instances[n]}set(n){let o;if(Number.isInteger(n)){let l=this.getInstance(n);if(!l)throw Error(`Invalid instance index ${n}`);o={...l.coordinates}}else o=n,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}},ic=1e6,C=64,B=1e4,ee,Ne,lt,Dt;function mr(n){this.font=n,this.getCommands=function(o){return sc.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function on(n){return n}function mn(n){return Math.sign(n)*Math.round(Math.abs(n))}function In(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function So(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function kn(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function Fi(n){return Math.sign(n)*Math.floor(Math.abs(n))}var _o=function(n){let o=this.srPeriod,l=this.srPhase,d=this.srThreshold,f=1;return n<0&&(n=-n,f=-1),n+=d-l,n=Math.trunc(n/o)*o,n+=l,n<0?l*f:n*f},Rs={x:1,y:0,axis:"x",distance:function(n,o,l,d){return(l?n.xo:n.x)-(d?o.xo:o.x)},interpolate:function(n,o,l,d){let f,g,y,A,S,M,E;if(!d||d===this){if(f=n.xo-o.xo,g=n.xo-l.xo,S=o.x-o.xo,M=l.x-l.xo,y=Math.abs(f),A=Math.abs(g),E=y+A,E===0){n.x=n.xo+(S+M)/2;return}n.x=n.xo+(S*A+M*y)/E;return}if(f=d.distance(n,o,!0,!0),g=d.distance(n,l,!0,!0),S=d.distance(o,o,!1,!0),M=d.distance(l,l,!1,!0),y=Math.abs(f),A=Math.abs(g),E=y+A,E===0){Rs.setRelative(n,n,(S+M)/2,d,!0);return}Rs.setRelative(n,n,(S*A+M*y)/E,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,o,l,d,f){if(!d||d===this){n.x=(f?o.xo:o.x)+l;return}let g=f?o.xo:o.x,y=f?o.yo:o.y,A=g+l*d.x,S=y+l*d.y;n.x=A+(n.y-S)/d.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},bs={x:0,y:1,axis:"y",distance:function(n,o,l,d){return(l?n.yo:n.y)-(d?o.yo:o.y)},interpolate:function(n,o,l,d){let f,g,y,A,S,M,E;if(!d||d===this){if(f=n.yo-o.yo,g=n.yo-l.yo,S=o.y-o.yo,M=l.y-l.yo,y=Math.abs(f),A=Math.abs(g),E=y+A,E===0){n.y=n.yo+(S+M)/2;return}n.y=n.yo+(S*A+M*y)/E;return}if(f=d.distance(n,o,!0,!0),g=d.distance(n,l,!0,!0),S=d.distance(o,o,!1,!0),M=d.distance(l,l,!1,!0),y=Math.abs(f),A=Math.abs(g),E=y+A,E===0){bs.setRelative(n,n,(S+M)/2,d,!0);return}bs.setRelative(n,n,(S*A+M*y)/E,d,!0)},normalSlope:0,setRelative:function(n,o,l,d,f){if(!d||d===this){n.y=(f?o.yo:o.y)+l;return}let g=f?o.xo:o.x,y=f?o.yo:o.y,A=g+l*d.x,S=y+l*d.y;n.y=S+d.normalSlope*(n.x-A)},slope:Number.POSITIVE_INFINITY,touch:function(n){n.yTouched=!0},touched:function(n){return n.yTouched},untouch:function(n){n.yTouched=!1}};Object.freeze(Rs),Object.freeze(bs);function Ms(n,o){this.x=n,this.y=o,this.axis=void 0,this.slope=o/n,this.normalSlope=-n/o,Object.freeze(this)}Ms.prototype.distance=function(n,o,l,d){return this.x*Rs.distance(n,o,l,d)+this.y*bs.distance(n,o,l,d)},Ms.prototype.interpolate=function(n,o,l,d){let f,g,y,A,S,M,E;if(y=d.distance(n,o,!0,!0),A=d.distance(n,l,!0,!0),f=d.distance(o,o,!1,!0),g=d.distance(l,l,!1,!0),S=Math.abs(y),M=Math.abs(A),E=S+M,E===0){this.setRelative(n,n,(f+g)/2,d,!0);return}this.setRelative(n,n,(f*M+g*S)/E,d,!0)},Ms.prototype.setRelative=function(n,o,l,d,f){d=d||this;let g=f?o.xo:o.x,y=f?o.yo:o.y,A=g+l*d.x,S=y+l*d.y,M=d.normalSlope,E=this.slope,$=n.x,U=n.y;n.x=(E*$-M*A+S-U)/(E-M),n.y=E*(n.x-$)+U},Ms.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function Ei(n,o){let l=Math.sqrt(n*n+o*o);return n/=l,o/=l,n===1&&o===0?Rs:n===0&&o===1?bs:new Ms(n,o)}function Ko(n,o,l,d){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=l,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Ko.prototype.nextTouched=function(n){let o=this.nextPointOnContour;for(;!n.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},Ko.prototype.prevTouched=function(n){let o=this.prevPointOnContour;for(;!n.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var Pa=Object.freeze(new Ko(0,0)),sb={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function sl(n,o){switch(this.env=n,this.stack=[],this.prog=o,n){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Rs,this.round=mn}}mr.prototype.exec=function(n,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let l=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){sl.prototype=sb,f=this._fpgmState=new sl("fpgm",l.tables.fpgm),f.funcs=[],f.font=l,f.instructionCount=0,f.callDepth=0;try{Ne(f)}catch(y){console.log("Hinting error in FPGM:"+y),this._errorState=3;return}}sl.prototype=f,d=this._prepState=new sl("prep",l.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let g=l.variation&&l.variation.process.getCvarTransform()||l.tables.cvt;if(g){let y=d.cvt=new Array(g.length),A=o/l.unitsPerEm;for(let S=0;S<g.length;S++)y[S]=g[S]*A}else d.cvt=[];try{Ne(d)}catch(y){this._errorState<2&&console.log("Hinting error in PREP:"+y),this._errorState=2}}if(!(this._errorState>1))try{return lt(n,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},lt=function(n,o){let l=o.ppem/o.font.unitsPerEm,d=l,f=n.components,g,y,A;if(sl.prototype=o,!f)A=new sl("glyf",n.instructions),A.instructionCount=0,A.callDepth=0,Dt(n,A,l,d),y=A.gZone;else{let S=o.font;y=[],g=[];for(let M=0;M<f.length;M++){let E=f[M],$=S.glyphs.get(E.glyphIndex);A=new sl("glyf",$.instructions),A.instructionCount=0,A.callDepth=0,Dt($,A,l,d);let U=Math.round(E.dx*l),oe=Math.round(E.dy*d),X=A.gZone,de=A.contours;for(let rr=0;rr<X.length;rr++){let Gt=X[rr];Gt.xTouched=Gt.yTouched=!1,Gt.xo=Gt.x=Gt.x+U,Gt.yo=Gt.y=Gt.y+oe}let Fe=y.length;y.push.apply(y,X);for(let rr=0;rr<de.length;rr++)g.push(de[rr]+Fe)}n.instructions&&!A.inhibitGridFit&&(A=new sl("glyf",n.instructions),A.gZone=A.z0=A.z1=A.z2=y,A.contours=g,y.push(new Ko(0,0),new Ko(Math.round(n.advanceWidth*l),0)),Ne(A),y.length-=2)}return y},Dt=function(n,o,l,d){let f=n.points||[],g=f.length,y=o.gZone=o.z0=o.z1=o.z2=[],A=o.contours=[],S;for(let $=0;$<g;$++)S=f[$],y[$]=new Ko(S.x*l,S.y*d,S.lastPointOfContour,S.onCurve);let M,E;for(let $=0;$<g;$++)S=y[$],M||(M=S,A.push($)),S.lastPointOfContour?(S.nextPointOnContour=M,M.prevPointOnContour=S,M=void 0):(E=y[$+1],S.nextPointOnContour=E,E.prevPointOnContour=S);o.inhibitGridFit||(y.push(new Ko(0,0),new Ko(Math.round(n.advanceWidth*l),0)),Ne(o),y.length-=2)},Ne=function(n){let o=n.prog;if(!o)return;let l=o.length,d;for(n.ip=0;n.ip<l;n.ip++){if(++n.instructionCount>ic)throw new Error("Hinting instructions exceeded maximum of "+ic);if(d=ee[o[n.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[n.ip]).toString(16));d(n)}};function yu(n){let o=n.tZone=new Array(n.gZone.length);for(let l=0;l<o.length;l++)o[l]=new Ko(0,0)}function T1(n,o){let l=n.prog,d=n.ip,f=1,g;do if(g=l[++d],g===88)f++;else if(g===89)f--;else if(g===64)d+=l[d+1]+1;else if(g===65)d+=2*l[d+1]+1;else if(g>=176&&g<=183)d+=g-176+1;else if(g>=184&&g<=191)d+=(g-184+1)*2;else if(o&&f===1&&g===27)break;while(f>0);n.ip=d}function C1(n,o){o.fv=o.pv=o.dpv=n}function S1(n,o){o.pv=o.dpv=n}function _1(n,o){o.fv=n}function L1(n,o){let l=o.stack,d=l.pop(),f=l.pop(),g=o.z2[d],y=o.z1[f],A,S;n?(A=g.y-y.y,S=y.x-g.x):(A=y.x-g.x,S=y.y-g.y),o.pv=o.dpv=Ei(A,S)}function I1(n,o){let l=o.stack,d=l.pop(),f=l.pop(),g=o.z2[d],y=o.z1[f],A,S;n?(A=g.y-y.y,S=y.x-g.x):(A=y.x-g.x,S=y.y-g.y),o.fv=Ei(A,S)}function ib(n){let o=n.stack,l=o.pop(),d=o.pop();n.pv=n.dpv=Ei(d,l)}function ob(n){let o=n.stack,l=o.pop(),d=o.pop();n.fv=Ei(d,l)}function ab(n){let o=n.stack,l=n.pv;o.push(l.x*16384),o.push(l.y*16384)}function lb(n){let o=n.stack,l=n.fv;o.push(l.x*16384),o.push(l.y*16384)}function cb(n){n.fv=n.pv}function ub(n){let o=n.stack,l=o.pop(),d=o.pop(),f=o.pop(),g=o.pop(),y=o.pop(),A=n.z0,S=n.z1,M=A[l],E=A[d],$=S[f],U=S[g],oe=n.z2[y],X=M.x,de=M.y,Fe=E.x,rr=E.y,Gt=$.x,gr=$.y,Mr=U.x,gn=U.y,En=(X-Fe)*(gr-gn)-(de-rr)*(Gt-Mr),Rn=X*rr-de*Fe,Ns=Gt*gn-gr*Mr;oe.x=(Rn*(Gt-Mr)-Ns*(X-Fe))/En,oe.y=(Rn*(gr-gn)-Ns*(de-rr))/En}function db(n){n.rp0=n.stack.pop()}function hb(n){n.rp1=n.stack.pop()}function fb(n){n.rp2=n.stack.pop()}function pb(n){let o=n.stack.pop();switch(n.zp0=o,o){case 0:n.tZone||yu(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function mb(n){let o=n.stack.pop();switch(n.zp1=o,o){case 0:n.tZone||yu(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function gb(n){let o=n.stack.pop();switch(n.zp2=o,o){case 0:n.tZone||yu(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function xb(n){let o=n.stack.pop();switch(n.zp0=n.zp1=n.zp2=o,o){case 0:n.tZone||yu(n),n.z0=n.z1=n.z2=n.tZone;break;case 1:n.z0=n.z1=n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function bb(n){n.loop=n.stack.pop(),n.loop>B&&(n.loop=B)}function yb(n){n.round=mn}function vb(n){n.round=So}function wb(n){let o=n.stack.pop();n.minDis=o/64}function Ab(n){T1(n,!1)}function Tb(n){let o=n.stack.pop();n.ip+=o-1}function Cb(n){let o=n.stack.pop();n.cvCutIn=o/64}function Sb(n){let o=n.stack;o.push(o[o.length-1])}function yh(n){n.stack.pop()}function _b(n){n.stack.length=0}function Lb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l),o.push(d)}function Ib(n){let o=n.stack;o.push(o.length)}function kb(n){let o=n.stack,l=o.pop(),d=o.pop();if(d>B&&(d=B),++n.callDepth>C)throw new Error("Hinting call depth exceeded maximum of "+C);let f=n.ip,g=n.prog;n.prog=n.funcs[l];for(let y=0;y<d;y++)Ne(n);n.ip=f,n.prog=g,n.callDepth--}function Eb(n){let o=n.stack.pop();if(++n.callDepth>C)throw new Error("Hinting call depth exceeded maximum of "+C);let l=n.ip,d=n.prog;n.prog=n.funcs[o],Ne(n),n.ip=l,n.prog=d,n.callDepth--}function Rb(n){let o=n.stack,l=o.pop();o.push(o[o.length-l])}function Mb(n){let o=n.stack,l=o.pop();o.push(o.splice(o.length-l,1)[0])}function Nb(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");let o=n.stack,l=n.prog,d=n.ip,f=o.pop(),g=d;for(;l[++d]!==45;);n.ip=d,n.funcs[f]=l.slice(g+1,d)}function k1(n,o){let l=o.stack.pop(),d=o.z0[l],f=o.fv,g=o.pv,y=g.distance(d,Pa);n&&(y=o.round(y)),f.setRelative(d,Pa,y,g),f.touch(d),o.rp0=o.rp1=l}function E1(n,o){let l=o.z2,d=l.length-2,f,g,y;for(let A=0;A<d;A++)f=l[A],!n.touched(f)&&(g=f.prevTouched(n),g!==f&&(y=f.nextTouched(n),g===y&&n.setRelative(f,f,n.distance(g,g,!1,!0),n,!0),n.interpolate(f,g,y,n)))}function R1(n,o){let l=o.stack,d=n?o.rp1:o.rp2,f=(n?o.z0:o.z1)[d],g=o.fv,y=o.pv,A=o.loop,S=o.z2;for(;A--;){let M=l.pop(),E=S[M],$=y.distance(f,f,!1,!0);g.setRelative(E,E,$,y),g.touch(E)}o.loop=1}function M1(n,o){let l=o.stack,d=n?o.rp1:o.rp2,f=(n?o.z0:o.z1)[d],g=o.fv,y=o.pv,A=l.pop(),S=o.z2[o.contours[A]],M=S,E=y.distance(f,f,!1,!0);do M!==f&&g.setRelative(M,M,E,y),M=M.nextPointOnContour;while(M!==S)}function N1(n,o){let l=o.stack,d=n?o.rp1:o.rp2,f=(n?o.z0:o.z1)[d],g=o.fv,y=o.pv,A=l.pop(),S;switch(A){case 0:S=o.tZone;break;case 1:S=o.gZone;break;default:throw new Error("Invalid zone")}let M,E=y.distance(f,f,!1,!0),$=S.length-2;for(let U=0;U<$;U++)M=S[U],g.setRelative(M,M,E,y)}function Db(n){let o=n.stack,l=n.loop,d=n.fv,f=o.pop()/64,g=n.z2;for(;l--;){let y=o.pop(),A=g[y];d.setRelative(A,A,f),d.touch(A)}n.loop=1}function Bb(n){let o=n.stack,l=n.rp1,d=n.rp2,f=n.loop,g=n.z0[l],y=n.z1[d],A=n.fv,S=n.dpv,M=n.z2;for(;f--;){let E=o.pop(),$=M[E];A.interpolate($,g,y,S),A.touch($)}n.loop=1}function D1(n,o){let l=o.stack,d=l.pop()/64,f=l.pop(),g=o.z1[f],y=o.z0[o.rp0],A=o.fv,S=o.pv;A.setRelative(g,y,d,S),A.touch(g),o.rp1=o.rp0,o.rp2=f,n&&(o.rp0=f)}function Qb(n){let o=n.stack,l=n.rp0,d=n.z0[l],f=n.loop,g=n.fv,y=n.pv,A=n.z1;for(;f--;){let S=o.pop(),M=A[S];g.setRelative(M,d,0,y),g.touch(M)}n.loop=1}function jb(n){n.round=In}function B1(n,o){let l=o.stack,d=l.pop(),f=l.pop(),g=o.z0[f],y=o.fv,A=o.pv,S=o.cvt[d],M=A.distance(g,Pa);n&&(Math.abs(M-S)<o.cvCutIn&&(M=S),M=o.round(M)),y.setRelative(g,Pa,M,A),o.zp0===0&&(g.xo=g.x,g.yo=g.y),y.touch(g),o.rp0=o.rp1=f}function Pb(n){let o=n.prog,l=n.ip,d=n.stack,f=o[++l];for(let g=0;g<f;g++)d.push(o[++l]);n.ip=l}function Ob(n){let o=n.ip,l=n.prog,d=n.stack,f=l[++o];for(let g=0;g<f;g++){let y=l[++o]<<8|l[++o];y&32768&&(y=-((y^65535)+1)),d.push(y)}n.ip=o}function Fb(n){let o=n.stack,l=n.store;l||(l=n.store=[]);let d=o.pop(),f=o.pop();l[f]=d}function Ub(n){let o=n.stack,l=n.store,d=o.pop(),f=l&&l[d]||0;o.push(f)}function $b(n){let o=n.stack,l=o.pop(),d=o.pop();n.cvt[d]=l/64}function zb(n){let o=n.stack,l=o.pop();o.push(n.cvt[l]*64)}function Q1(n,o){let l=o.stack,d=l.pop(),f=o.z2[d];l.push(o.dpv.distance(f,Pa,n,!1)*64)}function j1(n,o){let l=o.stack,d=l.pop(),f=l.pop(),g=o.z1[d],y=o.z0[f],A=o.dpv.distance(y,g,n,n);o.stack.push(Math.round(A*64))}function Hb(n){n.stack.push(n.ppem)}function Wb(n){n.autoFlip=!0}function Gb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d<l?1:0)}function Vb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d<=l?1:0)}function qb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d>l?1:0)}function Zb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d>=l?1:0)}function Yb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l===d?1:0)}function Kb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l!==d?1:0)}function Xb(n){let o=n.stack,l=o.pop();o.push(Math.trunc(l)&1?1:0)}function Jb(n){let o=n.stack,l=o.pop();o.push(Math.trunc(l)&1?0:1)}function e4(n){let o=n.stack.pop(),l;o||T1(n,!0)}function t4(n){}function r4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l&&d?1:0)}function n4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l||d?1:0)}function s4(n){let o=n.stack,l=o.pop();o.push(l?0:1)}function vh(n,o){let l=o.stack,d=l.pop(),f=o.fv,g=o.pv,y=o.ppem,A=o.deltaBase+(n-1)*16,S=o.deltaShift,M=o.z0;for(let E=0;E<d;E++){let $=l.pop(),U=l.pop();if(A+((U&240)>>4)!==y)continue;let oe=(U&15)-8;oe>=0&&oe++;let X=M[$];f.setRelative(X,X,oe*S,g)}}function i4(n){let o=n.stack.pop();n.deltaBase=o}function o4(n){let o=n.stack.pop();n.deltaShift=Math.pow(.5,o)}function a4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d+l)}function l4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d-l)}function c4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d*64/l)}function u4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d*l/64)}function d4(n){let o=n.stack,l=o.pop();o.push(Math.abs(l))}function h4(n){let o=n.stack,l=o.pop();o.push(-l)}function f4(n){let o=n.stack,l=o.pop();o.push(Math.floor(l/64)*64)}function p4(n){let o=n.stack,l=o.pop();o.push(Math.ceil(l/64)*64)}function vu(n,o){let l=o.stack,d=l.pop();l.push(o.round(d/64)*64)}function m4(n){let o=n.stack,l=o.pop(),d=o.pop();n.cvt[d]=l*n.ppem/n.font.unitsPerEm}function wh(n,o){let l=o.stack,d=l.pop(),f=o.ppem,g=o.deltaBase+(n-1)*16,y=o.deltaShift;for(let A=0;A<d;A++){let S=l.pop(),M=l.pop();if(g+((M&240)>>4)!==f)continue;let E=(M&15)-8;E>=0&&E++;let $=E*y;o.cvt[S]+=$}}function g4(n){let o=n.stack.pop();n.round=_o;let l;switch(o&192){case 0:l=.5;break;case 64:l=1;break;case 128:l=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=l,o&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*l;break;case 32:n.srPhase=.5*l;break;case 48:n.srPhase=.75*l;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?n.srThreshold=0:n.srThreshold=(o/8-.5)*l}function x4(n){let o=n.stack.pop();n.round=_o;let l;switch(o&192){case 0:l=Math.sqrt(2)/2;break;case 64:l=Math.sqrt(2);break;case 128:l=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=l,o&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*l;break;case 32:n.srPhase=.5*l;break;case 48:n.srPhase=.75*l;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?n.srThreshold=0:n.srThreshold=(o/8-.5)*l}function b4(n){n.round=on}function y4(n){n.round=kn}function v4(n){n.round=Fi}function w4(n){let o=n.stack.pop()}function P1(n,o){let l=o.stack,d=l.pop(),f=l.pop(),g=o.z2[d],y=o.z1[f],A,S;n?(A=g.y-y.y,S=y.x-g.x):(A=y.x-g.x,S=y.y-g.y),o.dpv=Ei(A,S)}function A4(n){let o=n.stack,l=o.pop(),d=0;l&1&&(d=35),l&32&&(d|=4096),o.push(d)}function T4(n){let o=n.stack,l=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(l),o.push(f)}function C4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(Math.max(d,l))}function S4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(Math.min(d,l))}function _4(n){let o=n.stack.pop()}function L4(n){let o=n.stack.pop(),l=n.stack.pop();switch(o){case 1:n.inhibitGridFit=!!l;return;case 2:n.ignoreCvt=!!l;return;default:throw new Error("invalid INSTCTRL[] selector")}}function il(n,o){let l=o.stack,d=o.prog,f=o.ip;for(let g=0;g<n;g++)l.push(d[++f]);o.ip=f}function ol(n,o){let l=o.ip,d=o.prog,f=o.stack;for(let g=0;g<n;g++){let y=d[++l]<<8|d[++l];y&32768&&(y=-((y^65535)+1)),f.push(y)}o.ip=l}function qt(n,o,l,d,f,g){let y=g.stack,A=n&&y.pop(),S=y.pop(),M=g.rp0,E=g.z0[M],$=g.z1[S],U=g.minDis,oe=g.fv,X=g.dpv,de,Fe,rr,Gt;Fe=de=X.distance($,E,!0,!0),rr=Fe>=0?1:-1,Fe=Math.abs(Fe),n&&(Gt=g.cvt[A],d&&Math.abs(Fe-Gt)<g.cvCutIn&&(Fe=Gt)),l&&Fe<U&&(Fe=U),d&&(Fe=g.round(Fe)),oe.setRelative($,E,rr*Fe,X),oe.touch($),g.rp1=g.rp0,g.rp2=S,o&&(g.rp0=S)}ee=[C1.bind(void 0,bs),C1.bind(void 0,Rs),S1.bind(void 0,bs),S1.bind(void 0,Rs),_1.bind(void 0,bs),_1.bind(void 0,Rs),L1.bind(void 0,0),L1.bind(void 0,1),I1.bind(void 0,0),I1.bind(void 0,1),ib,ob,ab,lb,cb,ub,db,hb,fb,pb,mb,gb,xb,bb,yb,vb,wb,Ab,Tb,Cb,void 0,void 0,Sb,yh,_b,Lb,Ib,Rb,Mb,void 0,void 0,void 0,kb,Eb,Nb,void 0,k1.bind(void 0,0),k1.bind(void 0,1),E1.bind(void 0,bs),E1.bind(void 0,Rs),R1.bind(void 0,0),R1.bind(void 0,1),M1.bind(void 0,0),M1.bind(void 0,1),N1.bind(void 0,0),N1.bind(void 0,1),Db,Bb,D1.bind(void 0,0),D1.bind(void 0,1),Qb,jb,B1.bind(void 0,0),B1.bind(void 0,1),Pb,Ob,Fb,Ub,$b,zb,Q1.bind(void 0,0),Q1.bind(void 0,1),void 0,j1.bind(void 0,0),j1.bind(void 0,1),Hb,void 0,Wb,void 0,void 0,Gb,Vb,qb,Zb,Yb,Kb,Xb,Jb,e4,t4,r4,n4,s4,vh.bind(void 0,1),i4,o4,a4,l4,c4,u4,d4,h4,f4,p4,vu.bind(void 0,0),vu.bind(void 0,1),vu.bind(void 0,2),vu.bind(void 0,3),void 0,void 0,void 0,void 0,m4,vh.bind(void 0,2),vh.bind(void 0,3),wh.bind(void 0,1),wh.bind(void 0,2),wh.bind(void 0,3),g4,x4,void 0,void 0,b4,void 0,y4,v4,yh,yh,void 0,void 0,void 0,void 0,void 0,w4,P1.bind(void 0,0),P1.bind(void 0,1),A4,void 0,T4,C4,S4,_4,L4,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,il.bind(void 0,1),il.bind(void 0,2),il.bind(void 0,3),il.bind(void 0,4),il.bind(void 0,5),il.bind(void 0,6),il.bind(void 0,7),il.bind(void 0,8),ol.bind(void 0,1),ol.bind(void 0,2),ol.bind(void 0,3),ol.bind(void 0,4),ol.bind(void 0,5),ol.bind(void 0,6),ol.bind(void 0,7),ol.bind(void 0,8),qt.bind(void 0,0,0,0,0,0),qt.bind(void 0,0,0,0,0,1),qt.bind(void 0,0,0,0,0,2),qt.bind(void 0,0,0,0,0,3),qt.bind(void 0,0,0,0,1,0),qt.bind(void 0,0,0,0,1,1),qt.bind(void 0,0,0,0,1,2),qt.bind(void 0,0,0,0,1,3),qt.bind(void 0,0,0,1,0,0),qt.bind(void 0,0,0,1,0,1),qt.bind(void 0,0,0,1,0,2),qt.bind(void 0,0,0,1,0,3),qt.bind(void 0,0,0,1,1,0),qt.bind(void 0,0,0,1,1,1),qt.bind(void 0,0,0,1,1,2),qt.bind(void 0,0,0,1,1,3),qt.bind(void 0,0,1,0,0,0),qt.bind(void 0,0,1,0,0,1),qt.bind(void 0,0,1,0,0,2),qt.bind(void 0,0,1,0,0,3),qt.bind(void 0,0,1,0,1,0),qt.bind(void 0,0,1,0,1,1),qt.bind(void 0,0,1,0,1,2),qt.bind(void 0,0,1,0,1,3),qt.bind(void 0,0,1,1,0,0),qt.bind(void 0,0,1,1,0,1),qt.bind(void 0,0,1,1,0,2),qt.bind(void 0,0,1,1,0,3),qt.bind(void 0,0,1,1,1,0),qt.bind(void 0,0,1,1,1,1),qt.bind(void 0,0,1,1,1,2),qt.bind(void 0,0,1,1,1,3),qt.bind(void 0,1,0,0,0,0),qt.bind(void 0,1,0,0,0,1),qt.bind(void 0,1,0,0,0,2),qt.bind(void 0,1,0,0,0,3),qt.bind(void 0,1,0,0,1,0),qt.bind(void 0,1,0,0,1,1),qt.bind(void 0,1,0,0,1,2),qt.bind(void 0,1,0,0,1,3),qt.bind(void 0,1,0,1,0,0),qt.bind(void 0,1,0,1,0,1),qt.bind(void 0,1,0,1,0,2),qt.bind(void 0,1,0,1,0,3),qt.bind(void 0,1,0,1,1,0),qt.bind(void 0,1,0,1,1,1),qt.bind(void 0,1,0,1,1,2),qt.bind(void 0,1,0,1,1,3),qt.bind(void 0,1,1,0,0,0),qt.bind(void 0,1,1,0,0,1),qt.bind(void 0,1,1,0,0,2),qt.bind(void 0,1,1,0,0,3),qt.bind(void 0,1,1,0,1,0),qt.bind(void 0,1,1,0,1,1),qt.bind(void 0,1,1,0,1,2),qt.bind(void 0,1,1,0,1,3),qt.bind(void 0,1,1,1,0,0),qt.bind(void 0,1,1,1,0,1),qt.bind(void 0,1,1,1,0,2),qt.bind(void 0,1,1,1,0,3),qt.bind(void 0,1,1,1,1,0),qt.bind(void 0,1,1,1,1,1),qt.bind(void 0,1,1,1,1,2),qt.bind(void 0,1,1,1,1,3)];var I4=mr;function c0(n){this.char=n,this.state={},this.activeState=null}function Ah(n,o,l){this.contextName=l,this.startIndex=n,this.endOffset=o}function k4(n,o,l){this.contextName=n,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=l}function Ui(n,o){this.context=n,this.index=o,this.length=n.length,this.current=n[o],this.backtrack=n.slice(0,o),this.lookahead=n.slice(o+1)}function wu(n){this.eventId=n,this.subscribers=[]}function E4(n){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 wu(f)})}if(n)for(let d=0;d<o.length;d++){let f=o[d],g=n[f];typeof g=="function"&&this.events[f].subscribe(g)}let l=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<l.length;d++){let f=l[d];this.events[f].subscribe(this.updateContextsRanges)}}function ls(n){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],E4.call(this,n)}c0.prototype.setState=function(n,o){return this.state[n]=o,this.activeState={key:n,value:this.state[n]},this.activeState},c0.prototype.getState=function(n){return this.state[n]||null},ls.prototype.inboundIndex=function(n){return n>=0&&n<this.tokens.length},ls.prototype.composeRUD=function(n){let o=n.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),l=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(l))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(l)};this.dispatch("composeRUD",[o.filter(d=>!l(d))])},ls.prototype.replaceRange=function(n,o,l,d){o=o!==null?o:this.tokens.length;let f=l.every(g=>g instanceof c0);if(!isNaN(n)&&this.inboundIndex(n)&&f){let g=this.tokens.splice.apply(this.tokens,[n,o].concat(l));return d||this.dispatch("replaceToken",[n,o,l]),[g,l]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ls.prototype.replaceToken=function(n,o,l){if(!isNaN(n)&&this.inboundIndex(n)&&o instanceof c0){let d=this.tokens.splice(n,1,o);return l||this.dispatch("replaceToken",[n,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},ls.prototype.removeRange=function(n,o,l){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(n,o);return l||this.dispatch("removeRange",[d,n,o]),d},ls.prototype.removeToken=function(n,o){if(!isNaN(n)&&this.inboundIndex(n)){let l=this.tokens.splice(n,1);return o||this.dispatch("removeToken",[l,n]),l}else return{FAIL:"removeToken: invalid token index."}},ls.prototype.insertToken=function(n,o,l){return n.every(d=>d instanceof c0)?(this.tokens.splice.apply(this.tokens,[o,0].concat(n)),l||this.dispatch("insertToken",[n,o]),n):{FAIL:"insertToken: invalid token(s)."}},ls.prototype.registerModifier=function(n,o,l){this.events.newToken.subscribe(function(d,f){let g=[d,f],y=o===null||o.apply(this,g)===!0,A=[d,f];if(y){let S=l.apply(this,A);d.setState(n,S)}}),this.registeredModifiers.push(n)},wu.prototype.subscribe=function(n){return typeof n=="function"?this.subscribers.push(n)-1:{FAIL:`invalid '${this.eventId}' event handler`}},wu.prototype.unsubscribe=function(n){this.subscribers.splice(n,1)},Ui.prototype.setCurrentIndex=function(n){this.index=n,this.current=this.context[n],this.backtrack=this.context.slice(0,n),this.lookahead=this.context.slice(n+1)},Ui.prototype.get=function(n){switch(!0){case n===0:return this.current;case(n<0&&Math.abs(n)<=this.backtrack.length):return this.backtrack.slice(n)[0];case(n>0&&n<=this.lookahead.length):return this.lookahead[n-1];default:return null}},ls.prototype.rangeToText=function(n){if(n instanceof Ah)return this.getRangeTokens(n).map(o=>o.char).join("")},ls.prototype.getText=function(){return this.tokens.map(n=>n.char).join("")},ls.prototype.getContext=function(n){return this.registeredContexts[n]||null},ls.prototype.on=function(n,o){let l=this.events[n];return l?l.subscribe(o):null},ls.prototype.dispatch=function(n,o){let l=this.events[n];if(l instanceof wu)for(let d=0;d<l.subscribers.length;d++)l.subscribers[d].apply(this,o||[])},ls.prototype.registerContextChecker=function(n,o,l){if(this.getContext(n))return{FAIL:`context name '${n}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof l!="function")return{FAIL:"missing context end check."};let d=new k4(n,o,l);return this.registeredContexts[n]=d,this.contextCheckers.push(d),d},ls.prototype.getRangeTokens=function(n){let o=n.startIndex+n.endOffset;return[].concat(this.tokens.slice(n.startIndex,o))},ls.prototype.getContextRanges=function(n){let o=this.getContext(n);return o?o.ranges:{FAIL:`context checker '${n}' is not registered.`}},ls.prototype.resetContextsRanges=function(){let n=this.registeredContexts;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o)){let l=n[o];l.ranges=[]}},ls.prototype.updateContextsRanges=function(){this.resetContextsRanges();let n=this.tokens.map(o=>o.char);for(let o=0;o<n.length;o++){let l=new Ui(n,o);this.runContextCheck(l)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ls.prototype.setEndOffset=function(n,o){let l=this.getContext(o).openRange.startIndex,d=new Ah(l,n,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},ls.prototype.runContextCheck=function(n){let o=n.index;for(let l=0;l<this.contextCheckers.length;l++){let d=this.contextCheckers[l],f=d.contextName,g=this.getContext(f).openRange;if(!g&&d.checkStart(n)&&(g=new Ah(o,null,f),this.getContext(f).openRange=g,this.dispatch("contextStart",[f,o])),g&&d.checkEnd(n)){let y=o-g.startIndex+1,A=this.setEndOffset(y,f);this.dispatch("contextEnd",[f,A])}}},ls.prototype.tokenize=function(n){this.tokens=[],this.resetContextsRanges();let o=Array.from(n);this.dispatch("start");for(let l=0;l<o.length;l++){let d=o[l],f=new Ui(o,l);this.dispatch("next",[f]),this.runContextCheck(f);let g=new c0(d);this.tokens.push(g),this.dispatch("newToken",[g,f])}return this.dispatch("end",[this.tokens]),this.tokens};var R4=ls;function al(n){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(n)}function O1(n){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(n)}function ll(n){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(n)}function Au(n){return/[\u0E00-\u0E7F]/.test(n)}function Tu(n){return/[A-z]/.test(n)}function M4(n){return/\s/.test(n)}function fo(n){this.font=n,this.features={}}function cl(n){this.id=n.id,this.tag=n.tag,this.substitution=n.substitution}function ul(n,o){if(!n)return-1;switch(o.format){case 1:return o.glyphs.indexOf(n);case 2:{let l=o.ranges;for(let d=0;d<l.length;d++){let f=l[d];if(n>=f.start&&n<=f.end){let g=n-f.start;return f.index+g}}break}default:return-1}return-1}function N4(n,o){return ul(n,o.coverage)===-1?null:n+o.deltaGlyphId}function D4(n,o){let l=ul(n,o.coverage);return l===-1?null:o.substitute[l]}function Th(n,o){let l=[];for(let d=0;d<n.length;d++){let f=n[d],g=o.current;g=Array.isArray(g)?g[0]:g;let y=ul(g,f);y!==-1&&l.push(y)}return l.length!==n.length?-1:l}function B4(n,o){let l=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(n.context.length<l)return[];let d=Th(o.inputCoverage,n);if(d===-1)return[];let f=o.inputCoverage.length-1;if(n.lookahead.length<o.lookaheadCoverage.length)return[];let g=n.lookahead.slice(f);for(;g.length&&ll(g[0].char);)g.shift();let y=new Ui(g,0),A=Th(o.lookaheadCoverage,y),S=[].concat(n.backtrack);for(S.reverse();S.length&&ll(S[0].char);)S.shift();if(S.length<o.backtrackCoverage.length)return[];let M=new Ui(S,0),E=Th(o.backtrackCoverage,M),$=d.length===o.inputCoverage.length&&A.length===o.lookaheadCoverage.length&&E.length===o.backtrackCoverage.length,U=[];if($)for(let oe=0;oe<o.lookupRecords.length;oe++){let X=o.lookupRecords[oe],de=X.lookupListIndex,Fe=this.getLookupByIndex(de);for(let rr=0;rr<Fe.subtables.length;rr++){let Gt=Fe.subtables[rr],gr,Mr=this.getSubstitutionType(Fe,Gt);if(Mr==="71"?(Mr=this.getSubstitutionType(Gt,Gt.extension),gr=this.getLookupMethod(Gt,Gt.extension),Gt=Gt.extension):gr=this.getLookupMethod(Fe,Gt),Mr==="12"){let gn=n.get(X.sequenceIndex),En=gr(gn);En&&U.push(En)}else if(Mr==="21"){let gn=n.get(X.sequenceIndex),En=gr(gn);En&&U.push(En)}else throw new Error(`Substitution type ${Mr} is not supported in chaining substitution`)}}return U}function Q4(n,o){let l=n.current,d=ul(l,o.coverage);if(d===-1)return null;let f,g=o.ligatureSets[d];for(let y=0;y<g.length;y++){f=g[y];for(let A=0;A<f.components.length;A++){let S=n.lookahead[A],M=f.components[A];if(S!==M)break;if(A===f.components.length-1)return f}}return null}function j4(n,o){let l=n.current;if(ul(l,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let g=!0;for(let y=0;y<f.input.length;y++)if(n.lookahead[y]!==f.input[y]){g=!1;break}if(g){let y=[];y.push(l);for(let S=0;S<f.input.length;S++)y.push(f.input[S]);let A=(S,M)=>{let{lookupListIndex:E,sequenceIndex:$}=M,{subtables:U}=this.getLookupByIndex(E);for(let oe of U)ul(S[$],oe.coverage)!==-1&&(S[$]=oe.deltaGlyphId)};for(let S=0;S<f.lookupRecords.length;S++){let M=f.lookupRecords[S];A(y,M)}return y}}return null}function P4(n,o){if(n.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=n.get(d);if(f=Array.isArray(f)?f[0]:f,ul(f,o.coverages[d])===-1)return[]}let l=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],g=f.lookupListIndex,y=this.getLookupByIndex(g);for(let A=0;A<y.subtables.length;A++){let S=y.subtables[A],M,E=this.getSubstitutionType(y,S);if(E==="71"?(E=this.getSubstitutionType(S,S.extension),M=this.getLookupMethod(S,S.extension),S=S.extension):M=this.getLookupMethod(y,S),E==="12"){let $=n.get(f.sequenceIndex),U=M($);U&&l.push(U)}else if(E==="21"){let $=n.get(f.sequenceIndex),U=M($);U&&l.push(U)}}}return l}function O4(n,o){let l=ul(n,o.coverage);return l===-1?null:o.sequences[l]}fo.prototype.getDefaultScriptFeaturesIndexes=function(){let n=this.font.tables.gsub.scripts;for(let o=0;o<n.length;o++){let l=n[o];if(l.tag==="DFLT")return l.script.defaultLangSys.featureIndexes}return[]},fo.prototype.getScriptFeaturesIndexes=function(n){if(!this.font.tables.gsub)return[];if(!n)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let l=0;l<o.length;l++){let d=o[l];if(d.tag===n&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let g=0;g<f.length;g++){let y=f[g];if(y.tag===n)return y.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},fo.prototype.mapTagsToFeatures=function(n,o){let l={};for(let d=0;d<n.length;d++){let f=n[d].tag,g=n[d].feature;l[f]=g}this.features[o].tags=l},fo.prototype.getScriptFeatures=function(n){let o=this.features[n];if(Object.prototype.hasOwnProperty.call(this.features,n))return o;let l=this.getScriptFeaturesIndexes(n);if(!l)return null;let d=this.font.tables.gsub;return o=l.map(f=>d.features[f]),this.features[n]=o,this.mapTagsToFeatures(o,n),o},fo.prototype.getSubstitutionType=function(n,o){let l=n.lookupType.toString(),d=o.substFormat.toString();return l+d},fo.prototype.getLookupMethod=function(n,o){let l=this.getSubstitutionType(n,o);switch(l){case"11":return d=>N4.apply(this,[d,o]);case"12":return d=>D4.apply(this,[d,o]);case"63":return d=>B4.apply(this,[d,o]);case"41":return d=>Q4.apply(this,[d,o]);case"21":return d=>O4.apply(this,[d,o]);case"51":return d=>j4.apply(this,[d,o]);case"53":return d=>P4.apply(this,[d,o]);default:throw new Error(`substitutionType : ${l} lookupType: ${n.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},fo.prototype.lookupFeature=function(n){let o=n.contextParams,l=o.index,d=this.getFeature({tag:n.tag,script:n.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 '${n.tag}' for script '${n.script}'.`);let f=this.getFeatureLookups(d),g=[].concat(o.context);for(let y=0;y<f.length;y++){let A=f[y],S=this.getLookupSubtables(A);for(let M=0;M<S.length;M++){let E=S[M],$=this.getSubstitutionType(A,E),U;$==="71"?($=this.getSubstitutionType(E,E.extension),U=this.getLookupMethod(E,E.extension),E=E.extension):U=this.getLookupMethod(A,E);let oe;switch($){case"11":oe=U(o.current),oe&&g.splice(l,1,new cl({id:11,tag:n.tag,substitution:oe}));break;case"12":oe=U(o.current),oe&&g.splice(l,1,new cl({id:12,tag:n.tag,substitution:oe}));break;case"63":oe=U(o),Array.isArray(oe)&&oe.length&&g.splice(l,1,new cl({id:63,tag:n.tag,substitution:oe}));break;case"41":oe=U(o),oe&&g.splice(l,1,new cl({id:41,tag:n.tag,substitution:oe}));break;case"21":oe=U(o.current),oe&&g.splice(l,1,new cl({id:21,tag:n.tag,substitution:oe}));break;case"51":case"53":oe=U(o),Array.isArray(oe)&&oe.length&&g.splice(l,1,new cl({id:parseInt($),tag:n.tag,substitution:oe}));break}o=new Ui(g,l),!(Array.isArray(oe)&&!oe.length)&&(oe=null)}}return g.length?g:null},fo.prototype.supports=function(n){if(!n.script)return!1;this.getScriptFeatures(n.script);let o=Object.prototype.hasOwnProperty.call(this.features,n.script);if(!n.tag)return o;let l=this.features[n.script].some(d=>d.tag===n.tag);return o&&l},fo.prototype.getLookupSubtables=function(n){return n.subtables||null},fo.prototype.getLookupByIndex=function(n){return this.font.tables.gsub.lookups[n]||null},fo.prototype.getFeatureLookups=function(n){return n.lookupListIndexes.map(this.getLookupByIndex.bind(this))},fo.prototype.getFeature=function(n){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,n.script)||this.getScriptFeatures(n.script);let o=this.features[n.script];return o?o.tags[n.tag]?this.features[n.script].tags[n.tag]:null:{FAIL:`No feature for script ${n.script}`}};var F4=fo;function U4(n){let o=n.current,l=n.get(-1);return l===null&&al(o)||!al(l)&&al(o)}function $4(n){let o=n.get(1);return o===null||!al(o)}var z4={startCheck:U4,endCheck:$4};function H4(n){let o=n.current,l=n.get(-1);return(al(o)||ll(o))&&!al(l)}function W4(n){let o=n.get(1);switch(!0){case o===null:return!0;case(!al(o)&&!ll(o)):{let l=M4(o);if(!l)return!0;if(l){let d=!1;if(d=n.lookahead.some(f=>al(f)||ll(f)),!d)return!0}break}default:return!1}}var G4={startCheck:H4,endCheck:W4};function V4(n,o,l){o[l].setState(n.tag,n.substitution)}function q4(n,o,l){o[l].setState(n.tag,n.substitution)}function Ch(n,o,l){for(let d=0;d<n.substitution.length;d++){let f=n.substitution[d],g=o[l+d];if(Array.isArray(f)){f.length?g.setState(n.tag,f[0]):g.setState("deleted",!0);continue}g.setState(n.tag,f)}}function Z4(n,o,l){let d=o[l];d.setState(n.tag,n.substitution.ligGlyph);let f=n.substitution.components.length;for(let g=0;g<f;g++)d=o[l+g+1],d.setState("deleted",!0)}var F1={11:V4,12:q4,63:Ch,41:Z4,51:Ch,53:Ch};function Y4(n,o,l){n instanceof cl&&F1[n.id]&&F1[n.id](n,o,l)}var kl=Y4;function K4(n){let o=[].concat(n.backtrack);for(let l=o.length-1;l>=0;l--){let d=o[l],f=O1(d),g=ll(d);if(!f&&!g)return!0;if(f)return!1}return!1}function X4(n){if(O1(n.current))return!1;for(let o=0;o<n.lookahead.length;o++){let l=n.lookahead[o];if(!ll(l))return!0}return!1}function J4(n){let o="arab",l=this.featuresTags[o],d=this.tokenizer.getRangeTokens(n);if(d.length===1)return;let f=new Ui(d.map(y=>y.getState("glyphIndex")),0),g=new Ui(d.map(y=>y.char),0);for(let y=0;y<d.length;y++){let A=d[y];if(ll(A.char))continue;f.setCurrentIndex(y),g.setCurrentIndex(y);let S=0;K4(g)&&(S|=1),X4(g)&&(S|=2);let M;switch(S){case 1:M="fina";break;case 2:M="init";break;case 3:M="medi";break}if(l.indexOf(M)===-1)continue;let E=this.query.lookupFeature({tag:M,script:o,contextParams:f});if(E instanceof Error){console.info(E.message);continue}for(let $=0;$<E.length;$++){let U=E[$];U instanceof cl&&(kl(U,d,$),f.context[$]=U.substitution)}}}var ey=J4;function U1(n,o){let l=n.map(d=>d.activeState.value);return new Ui(l,o||0)}function ty(n){let o="arab",l=this.tokenizer.getRangeTokens(n),d=U1(l);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(g.length){for(let y=0;y<g.length;y++){let A=g[y];kl(A,l,f)}d=U1(l)}}}var ry=ty;function ny(n){return n.index===0&&n.context.length>1}function sy(n){return n.index===n.context.length-1}var iy={startCheck:ny,endCheck:sy};function $1(n,o){let l=n.map(d=>d.activeState.value);return new Ui(l,o||0)}function oy(n){let o="delf",l="ccmp",d=this.tokenizer.getRangeTokens(n),f=$1(d);for(let g=0;g<f.context.length;g++){if(!this.query.getFeature({tag:l,script:o,contextParams:f}))continue;f.setCurrentIndex(g);let y=this.query.lookupFeature({tag:l,script:o,contextParams:f});if(y.length){for(let A=0;A<y.length;A++){let S=y[A];kl(S,d,g)}f=$1(d)}}}var ay=oy;function ly(n){let o=n.current,l=n.get(-1);return l===null&&Tu(o)||!Tu(l)&&Tu(o)}function cy(n){let o=n.get(1);return o===null||!Tu(o)}var uy={startCheck:ly,endCheck:cy};function z1(n,o){let l=n.map(d=>d.activeState.value);return new Ui(l,o||0)}function dy(n){let o="latn",l=this.tokenizer.getRangeTokens(n),d=z1(l);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(g.length){for(let y=0;y<g.length;y++){let A=g[y];kl(A,l,f)}d=z1(l)}}}var hy=dy;function fy(n){let o=n.current,l=n.get(-1);return l===null&&Au(o)||!Au(l)&&Au(o)}function py(n){let o=n.get(1);return o===null||!Au(o)}var my={startCheck:fy,endCheck:py};function H1(n,o){let l=n.map(d=>d.activeState.value);return new Ui(l,o||0)}function gy(n){let o="thai",l=this.tokenizer.getRangeTokens(n),d=H1(l,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(g.length){for(let y=0;y<g.length;y++){let A=g[y];kl(A,l,f)}d=H1(l,f)}}}var xy=gy;function W1(n,o){let l=n.map(d=>d.activeState.value);return new Ui(l,o||0)}function by(n){let o="thai",l=this.tokenizer.getRangeTokens(n),d=W1(l,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(g.length){for(let y=0;y<g.length;y++){let A=g[y];kl(A,l,f)}d=W1(l,f)}}}var yy=by;function G1(n,o){let l=n.map(d=>d.activeState.value);return new Ui(l,o||0)}function vy(n){let o="thai",l=this.tokenizer.getRangeTokens(n),d=G1(l,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let g=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(g.length){for(let y=0;y<g.length;y++){let A=g[y];kl(A,l,f)}d=G1(l,f)}}}var wy=vy;function Sh(n){if(n===null)return!1;let o=n.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function Ay(n){let o=n.current,l=n.get(1);return l===null&&Sh(o)||Sh(l)}function Ty(n){let o=n.get(1);return o===null||!Sh(o)}var Cy={startCheck:Ay,endCheck:Ty};function Sy(n){let o=this.query.font,l=this.tokenizer.getRangeTokens(n);if(l[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=l[0].char.codePointAt(0),f=l[1].char.codePointAt(0),g=o.tables.cmap.varSelectorList[f];if(g!==void 0&&g.nonDefaultUVS){let y=g.nonDefaultUVS.uvsMappings;if(y[d]){let A=y[d].glyphID;o.glyphs.glyphs[A]!==void 0&&l[0].setState("glyphIndex",A)}}}}var _y=Sy;function Lo(n){this.baseDir=n||"ltr",this.tokenizer=new R4,this.featuresTags={}}Lo.prototype.setText=function(n){this.text=n},Lo.prototype.contextChecks={ccmpReplacementCheck:iy,latinWordCheck:uy,arabicWordCheck:z4,arabicSentenceCheck:G4,thaiWordCheck:my,unicodeVariationSequenceCheck:Cy};function u0(n){let o=this.contextChecks[`${n}Check`];return this.tokenizer.registerContextChecker(n,o.startCheck,o.endCheck)}function Ly(){return u0.call(this,"ccmpReplacement"),u0.call(this,"latinWord"),u0.call(this,"arabicWord"),u0.call(this,"arabicSentence"),u0.call(this,"thaiWord"),u0.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function Iy(){let n=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<n.length;o++){let l=n[o],d=this.tokenizer.getRangeTokens(l);this.tokenizer.replaceRange(l.startIndex,l.endOffset,d.reverse())}}Lo.prototype.registerFeatures=function(n,o){let l=o.filter(d=>this.query.supports({script:n,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,n)?this.featuresTags[n]=this.featuresTags[n].concat(l):this.featuresTags[n]=l},Lo.prototype.applyFeatures=function(n,o){if(!n)throw new Error("No valid font was provided to apply features");this.query||(this.query=new F4(n));for(let l=0;l<o.length;l++){let d=o[l];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Lo.prototype.registerModifier=function(n,o,l){this.tokenizer.registerModifier(n,o,l)};function oc(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function ky(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;oc.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<n.length;o++){let l=n[o];ey.call(this,l)}}function Ey(){oc.call(this);let n=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<n.length;o++){let l=n[o];ay.call(this,l)}}function Ry(){if(!this.hasFeatureEnabled("arab","rlig"))return;oc.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<n.length;o++){let l=n[o];ry.call(this,l)}}function My(){if(!this.hasFeatureEnabled("latn","liga"))return;oc.call(this);let n=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<n.length;o++){let l=n[o];hy.call(this,l)}}function Ny(){let n=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<n.length;o++){let l=n[o];_y.call(this,l)}}function Dy(){oc.call(this);let n=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<n.length;o++){let l=n[o];this.hasFeatureEnabled("thai","liga")&&yy.call(this,l),this.hasFeatureEnabled("thai","rlig")&&wy.call(this,l),this.hasFeatureEnabled("thai","ccmp")&&xy.call(this,l)}}Lo.prototype.checkContextReady=function(n){return!!this.tokenizer.getContext(n)},Lo.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&Ey.call(this),this.checkContextReady("arabicWord")&&(ky.call(this),Ry.call(this)),this.checkContextReady("latinWord")&&My.call(this),this.checkContextReady("arabicSentence")&&Iy.call(this),this.checkContextReady("thaiWord")&&Dy.call(this),this.checkContextReady("unicodeVariationSequence")&&Ny.call(this)},Lo.prototype.hasFeatureEnabled=function(n,o){return(this.featuresTags[n]||[]).indexOf(o)!==-1},Lo.prototype.processText=function(n){(!this.text||this.text!==n)&&(this.setText(n),Ly.call(this),this.applyFeaturesToContexts())},Lo.prototype.getBidiText=function(n){return this.processText(n),this.tokenizer.getText()},Lo.prototype.getTextGlyphs=function(n){this.processText(n);let o=[];for(let l=0;l<this.tokenizer.tokens.length;l++){let d=this.tokenizer.tokens[l];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var By=Lo;function _h(n){return{fontFamily:{en:n.familyName||" "},fontSubfamily:{en:n.styleName||" "},fullName:{en:n.fullName||n.familyName+" "+n.styleName},postScriptName:{en:n.postScriptName||(n.familyName+n.styleName).replace(/\s/g,"")},designer:{en:n.designer||" "},designerURL:{en:n.designerURL||" "},manufacturer:{en:n.manufacturer||" "},manufacturerURL:{en:n.manufacturerURL||" "},license:{en:n.license||" "},licenseURL:{en:n.licenseURL||" "},version:{en:n.version||"Version 0.1"},description:{en:n.description||" "},copyright:{en:n.copyright||" "},trademark:{en:n.trademark||" "}}}function Tn(n){if(n=n||{},n.tables=n.tables||{},!n.empty){if(!n.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!n.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!n.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!n.ascender)throw new Error("When creating a new Font object, ascender is required.");if(n.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=_h(n),this.names.macintosh=_h(n),this.names.windows=_h(n),this.unitsPerEm=n.unitsPerEm||1e3,this.ascender=n.ascender,this.descender=n.descender,this.createdTimestamp=n.createdTimestamp,this.italicAngle=n.italicAngle||0,this.weightClass=n.weightClass||0;let o=0;n.fsSelection?o=n.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)),(!n.panose||!Array.isArray(n.panose))&&(n.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(n.tables,{os2:Object.assign({usWeightClass:n.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:n.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:n.panose[0]||0,bSerifStyle:n.panose[1]||0,bWeight:n.panose[2]||0,bProportion:n.panose[3]||0,bContrast:n.panose[4]||0,bStrokeVariation:n.panose[5]||0,bArmStyle:n.panose[6]||0,bLetterform:n.panose[7]||0,bMidline:n.panose[8]||0,bXHeight:n.panose[9]||0,fsSelection:o},n.tables.os2)})}this.supported=!0,this.glyphs=new Lr.GlyphSet(this,n.glyphs||[]),this.encoding=new ze(this),this.position=new n0(this),this.substitution=new pu(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,l,d)=>(o[l]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new bu(this)),!0)}),this.palettes=new ec(this),this.layers=new mu(this),this.svgImages=new gu(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new I4(this):null}})}Tn.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)>0},Tn.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)},Tn.prototype.charToGlyph=function(n){let o=this.charToGlyphIndex(n),l=this.glyphs.get(o);return l||(l=this.glyphs.get(0)),l},Tn.prototype.updateFeatures=function(n){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(l=>n[l])}:o)},Tn.prototype.stringToGlyphIndexes=function(n,o){let l=new By,d=g=>this.charToGlyphIndex(g.char);l.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return l.applyFeatures(this,f),l.getTextGlyphs(n)},Tn.prototype.stringToGlyphs=function(n,o){let l=this.stringToGlyphIndexes(n,o),d=l.length,f=new Array(d),g=this.glyphs.get(0);for(let y=0;y<d;y+=1)f[y]=this.glyphs.get(l[y])||g;return f},Tn.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)},Tn.prototype.nameToGlyph=function(n){let o=this.nameToGlyphIndex(n),l=this.glyphs.get(o);return l||(l=this.glyphs.get(0)),l},Tn.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""},Tn.prototype.getKerningValue=function(n,o){n=n.index||n,o=o.index||o;let l=this.position.defaultKerningTables;return l?this.position.getKerningValue(l,n,o):this.kerningPairs[n+","+o]||0},Tn.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},Tn.prototype.forEachGlyph=function(n,o,l,d,f,g){o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let y=1/this.unitsPerEm*d,A=this.stringToGlyphs(n,f),S;if(f.kerning){let M=f.script||this.position.getDefaultScriptName();S=this.position.getKerningTables(M,f.language)}for(let M=0;M<A.length;M+=1){let E=A[M];if(g.call(this,E,o,l,d,f),E.advanceWidth&&(o+=E.advanceWidth*y),f.kerning&&M<A.length-1){let $=S?this.position.getKerningValue(S,E.index,A[M+1].index):this.getKerningValue(E,A[M+1]);o+=$*y}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Tn.prototype.getPath=function(n,o,l,d,f){f=Object.assign({},this.defaultRenderOptions,f);let g=new Xe;if(g._layers=[],Kr(this,g,d),g.stroke){let y=1/(g.unitsPerEm||1e3)*d;g.strokeWidth*=y}return this.forEachGlyph(n,o,l,d,f,(y,A,S,M)=>{let E=y.getPath(A,S,M,f,this);if(f.drawSVG||f.drawLayers){let $=E._layers;if($&&$.length){for(let U=0;U<$.length;U++){let oe=$[U];g._layers.push(oe)}return}}g.extend(E)}),g},Tn.prototype.getPaths=function(n,o,l,d,f){f=Object.assign({},this.defaultRenderOptions,f);let g=[];return this.forEachGlyph(n,o,l,d,f,function(y,A,S,M){let E=y.getPath(A,S,M,f,this);g.push(E)}),g},Tn.prototype.getAdvanceWidth=function(n,o,l){return l=Object.assign({},this.defaultRenderOptions,l),this.forEachGlyph(n,0,0,o,l,function(){})},Tn.prototype.draw=function(n,o,l,d,f,g){this.getPath(o,l,d,f,g).draw(n)},Tn.prototype.drawPoints=function(n,o,l,d,f,g){g=Object.assign({},this.defaultRenderOptions,g),this.forEachGlyph(o,l,d,f,g,function(y,A,S,M){y.drawPoints(n,A,S,M,g,this)})},Tn.prototype.drawMetrics=function(n,o,l,d,f,g){g=Object.assign({},this.defaultRenderOptions,g),this.forEachGlyph(o,l,d,f,g,function(y,A,S,M){y.drawMetrics(n,A,S,M)})},Tn.prototype.getEnglishName=function(n){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[n];if(o)return o.en},Tn.prototype.validate=function(){let n=[],o=this;function l(f,g){f||(console.warn(`[opentype.js] ${g}`),n.push(g))}function d(f){let g=o.getEnglishName(f);l(g&&g.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),l(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,g=-1;for(let y=0;y<f.length;y++){let A=f[y].glyphID;if(l(g<f[y].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${A} comes after ${g}`),g>f[y].glyphID)break;g=A}}return n},Tn.prototype.toTables=function(){return Qa.fontToTable(this)},Tn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Tn.prototype.toArrayBuffer=function(){let n=this.toTables().encode(),o=new ArrayBuffer(n.length),l=new Uint8Array(o);for(let d=0;d<n.length;d++)l[d]=n[d];return o},Tn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Tn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Tn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Tn.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},Tn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var V1=Tn;function Qy(n,o){let l=new ct.Parser(n,o),d=l.parseUShort(),f=l.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let g=[d,f],y=l.parsePointer32(function(){return this.parseItemVariationStore()}),A=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),S=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),M=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:g,itemVariationStore:y,advanceWidth:A,lsb:S,rsb:M}}function jy(){console.warn("Writing of hvar tables is not yet supported.")}var Py={make:jy,parse:Qy},Oy=function(){return{coverage:this.parsePointer(re.coverage),attachPoints:this.parseList(re.pointer(re.uShortList))}},Fy=function(){var n=this.parseUShort();if(q.argument(n===1||n===2||n===3,"Unsupported CaretValue table version."),n===1)return{coordinate:this.parseShort()};if(n===2)return{pointindex:this.parseShort()};if(n===3)return{coordinate:this.parseShort()}},Uy=function(){return this.parseList(re.pointer(Fy))},$y=function(){return{coverage:this.parsePointer(re.coverage),ligGlyphs:this.parseList(re.pointer(Uy))}},zy=function(){return this.parseUShort(),this.parseList(re.pointer(re.coverage))};function Hy(n,o){o=o||0;let l=new re(n,o),d=l.parseVersion(1);q.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:l.parsePointer(re.classDef),attachList:l.parsePointer(Oy),ligCaretList:l.parsePointer($y),markAttachClassDef:l.parsePointer(re.classDef)};return d>=1.2&&(f.markGlyphSets=l.parsePointer(zy)),f}var Wy={parse:Hy},Xo=new Array(10);Xo[1]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(re.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(re.coverage),values:this.parseValueRecordList()};q.assert(!1,"0x"+n.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Xo[2]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();q.assert(o===1||o===2,"0x"+n.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let l=this.parsePointer(re.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:l,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(re.pointer(re.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let g=this.parsePointer(re.classDef),y=this.parsePointer(re.classDef),A=this.parseUShort(),S=this.parseUShort();return{posFormat:o,coverage:l,valueFormat1:d,valueFormat2:f,classDef1:g,classDef2:y,class1Count:A,class2Count:S,classRecords:this.parseList(A,re.list(S,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},Xo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Xo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Xo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Xo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Xo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Xo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Xo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Gy(n,o){o=o||0;let l=new re(n,o),d=l.parseVersion(1);return q.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Xo)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Xo),variations:l.parseFeatureVariationsList()}}var Vy=new Array(10);function qy(n){return new Ae.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Ae.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new Ae.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new Ae.LookupList(n.lookups,Vy)}])}var Zy={parse:Gy,make:qy};function Yy(n){let o={};n.skip("uShort");let l=n.parseUShort();q.argument(l===0,"Unsupported kern sub-table version."),n.skip("uShort",2);let d=n.parseUShort();n.skip("uShort",3);for(let f=0;f<d;f+=1){let g=n.parseUShort(),y=n.parseUShort(),A=n.parseShort();o[g+","+y]=A}return o}function Ky(n){let o={};n.skip("uShort"),n.parseULong()>1&&console.warn("Only the first kern subtable is supported."),n.skip("uLong");let l=n.parseUShort()&255;if(n.skip("uShort"),l===0){let d=n.parseUShort();n.skip("uShort",3);for(let f=0;f<d;f+=1){let g=n.parseUShort(),y=n.parseUShort(),A=n.parseShort();o[g+","+y]=A}}return o}function Xy(n,o){let l=new ct.Parser(n,o),d=l.parseUShort();if(d===0)return Yy(l);if(d===1)return Ky(l);throw new Error("Unsupported kern table version ("+d+").")}var Jy={parse:Xy};function e7(n,o,l,d){let f=new ct.Parser(n,o),g=d?f.parseUShort:f.parseULong,y=[];for(let A=0;A<l+1;A+=1){let S=g.call(f);d&&(S*=2),y.push(S)}return y}var t7={parse:e7};function q1(n,o){let l=[],d=12;for(let f=0;f<o;f+=1){let g=ct.getTag(n,d),y=ct.getULong(n,d+4),A=ct.getULong(n,d+8),S=ct.getULong(n,d+12);l.push({tag:g,checksum:y,offset:A,length:S,compression:!1}),d+=16}return l}function r7(n,o){let l=[],d=44;for(let f=0;f<o;f+=1){let g=ct.getTag(n,d),y=ct.getULong(n,d+4),A=ct.getULong(n,d+8),S=ct.getULong(n,d+12),M;A<S?M="WOFF":M=!1,l.push({tag:g,offset:y,compression:M,compressedLength:A,length:S}),d+=20}return l}function cn(n,o){if(o.compression==="WOFF"){let l=new Uint8Array(n.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(ce(l,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:n,offset:o.offset}}function n7(n,o={}){let l,d,f=new V1({empty:!0});n.constructor!==ArrayBuffer&&(n=new Uint8Array(n).buffer);let g=new DataView(n,0),y,A=[],S=ct.getTag(g,0);if(S==="\0\0\0"||S==="true"||S==="typ1")f.outlinesFormat="truetype",y=ct.getUShort(g,4),A=q1(g,y);else if(S==="OTTO")f.outlinesFormat="cff",y=ct.getUShort(g,4),A=q1(g,y);else if(S==="wOFF"){let nr=ct.getTag(g,4);if(nr==="\0\0\0")f.outlinesFormat="truetype";else if(nr==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+S);y=ct.getUShort(g,12),A=r7(g,y)}else if(S==="wOF2"){let nr="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+nr)}else throw new Error("Unsupported OpenType signature "+S);let M,E,$,U,oe,X,de,Fe,rr,Gt,gr,Mr,gn,En,Rn,Ns,Jo,Nr;for(let nr=0;nr<y;nr+=1){let Ot=A[nr],zt;switch(Ot.tag){case"avar":de=Ot;break;case"cmap":zt=cn(g,Ot),f.tables.cmap=As.parse(zt.data,zt.offset),f.encoding=new Ze(f.tables.cmap);break;case"cvt ":zt=cn(g,Ot),Nr=new ct.Parser(zt.data,zt.offset),f.tables.cvt=Nr.parseShortList(Ot.length/2);break;case"fvar":$=Ot;break;case"STAT":U=Ot;break;case"gvar":oe=Ot;break;case"cvar":X=Ot;break;case"fpgm":zt=cn(g,Ot),Nr=new ct.Parser(zt.data,zt.offset),f.tables.fpgm=Nr.parseByteList(Ot.length);break;case"head":zt=cn(g,Ot),f.tables.head=ro.parse(zt.data,zt.offset),f.unitsPerEm=f.tables.head.unitsPerEm,l=f.tables.head.indexToLocFormat;break;case"hhea":zt=cn(g,Ot),f.tables.hhea=To.parse(zt.data,zt.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":gn=Ot;break;case"hmtx":Mr=Ot;break;case"ltag":zt=cn(g,Ot),d=Zo.parse(zt.data,zt.offset);break;case"COLR":zt=cn(g,Ot),f.tables.colr=je.parse(zt.data,zt.offset);break;case"CPAL":zt=cn(g,Ot),f.tables.cpal=co.parse(zt.data,zt.offset);break;case"maxp":zt=cn(g,Ot),f.tables.maxp=di.parse(zt.data,zt.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Ns=Ot;break;case"OS/2":zt=cn(g,Ot),f.tables.os2=uo.parse(zt.data,zt.offset);break;case"post":zt=cn(g,Ot),f.tables.post=Bi.parse(zt.data,zt.offset),f.glyphNames=new tt(f.tables.post);break;case"prep":zt=cn(g,Ot),Nr=new ct.Parser(zt.data,zt.offset),f.tables.prep=Nr.parseByteList(Ot.length);break;case"glyf":Fe=Ot;break;case"loca":Rn=Ot;break;case"CFF ":M=Ot;break;case"CFF2":E=Ot;break;case"kern":En=Ot;break;case"GDEF":rr=Ot;break;case"GPOS":Gt=Ot;break;case"GSUB":gr=Ot;break;case"meta":Jo=Ot;break;case"gasp":try{zt=cn(g,Ot),f.tables.gasp=Jr.parse(zt.data,zt.offset)}catch(Ri){console.warn("Failed to parse gasp table, skipping."),console.warn(Ri)}break;case"SVG ":zt=cn(g,Ot),f.tables.svg=ur.parse(zt.data,zt.offset);break;default:break}}let po=cn(g,Ns);if(f.tables.name=jt.parse(po.data,po.offset,d),f.names=f.tables.name,Fe&&Rn){let nr=l===0,Ot=cn(g,Rn),zt=t7.parse(Ot.data,Ot.offset,f.numGlyphs,nr),Ri=cn(g,Fe);f.glyphs=sc.parse(Ri.data,Ri.offset,zt,f,o)}else if(M){let nr=cn(g,M);Vo.parse(nr.data,nr.offset,f,o)}else if(E){let nr=cn(g,E);Vo.parse(nr.data,nr.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let $i=cn(g,Mr);if(Ys.parse(f,$i.data,$i.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),pr(f,o),En){let nr=cn(g,En);f.kerningPairs=Jy.parse(nr.data,nr.offset)}else f.kerningPairs={};if(rr){let nr=cn(g,rr);f.tables.gdef=Wy.parse(nr.data,nr.offset)}if(Gt){let nr=cn(g,Gt);f.tables.gpos=Zy.parse(nr.data,nr.offset),f.position.init()}if(gr){let nr=cn(g,gr);f.tables.gsub=hi.parse(nr.data,nr.offset)}if($){let nr=cn(g,$);f.tables.fvar=Xr.parse(nr.data,nr.offset,f.names)}if(U){let nr=cn(g,U);f.tables.stat=Sl.parse(nr.data,nr.offset,f.tables.fvar)}if(oe){$||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),Fe||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let nr=cn(g,oe);f.tables.gvar=Ye.parse(nr.data,nr.offset,f.tables.fvar,f.glyphs)}if(X){$||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."),Fe||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let nr=cn(g,X);f.tables.cvar=Le.parse(nr.data,nr.offset,f.tables.fvar,f.tables.cvt||[])}if(de){$||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let nr=cn(g,de);f.tables.avar=Q.parse(nr.data,nr.offset,f.tables.fvar)}if(gn){$||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),Mr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let nr=cn(g,gn);f.tables.hvar=Py.parse(nr.data,nr.offset,f.tables.fvar)}if(Jo){let nr=cn(g,Jo);f.tables.meta=Li.parse(nr.data,nr.offset),f.metas=f.tables.meta}return f.palettes=new ec(f),f}function s7(){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 m(x)})();(function(s,i){typeof define=="function"&&define.amd?define(i):typeof t=="object"&&t.exports?t.exports=i():s.opentype=i()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),YT=qT(ZT()),Ai=I0("lru-cache:metrics"),jc=OT("lru-cache"),KT=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Gh=()=>Ai.hasSubscribers||jc.hasSubscribers,$x=new Set,eg=typeof process=="object"&&process?process:{},XT=(e,t,r,s)=>{typeof eg.emitWarning=="function"?eg.emitWarning(e,t,r,s):console.error(`[${r}] ${t}: ${e}`)},JT=e=>!$x.has(e),yl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),zx=e=>yl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ud:null:null,ud=class extends Array{constructor(e){super(e),this.fill(0)}},Ql,fc,eC=(Ql=class{constructor(e,t){if(Ws(this,"heap"),Ws(this,"length"),!G(Ql,fc))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=zx(e);if(!t)return[];fr(Ql,fc,!0);let r=new Ql(e,t);return fr(Ql,fc,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},fc=new WeakMap,$r(Ql,fc,!1),Ql),tg,rg,ra,Ro,ya,m0,va,pc,mc,wa,ei,Mo,Hs,ts,Sr,oo,No,Gi,bi,Aa,yi,Ta,Ca,Do,Bo,Sa,gc,ao,g0,yt,Vh,x0,fl,Mu,Qo,ng,b0,xc,Nu,pl,ml,qh,y0,Du,sg,ig,Bu,$n,Zh,og,ag,bc,Yh,yc,gl,Kh,Xh,tC=(Xh=class{constructor(e){$r(this,yt),$r(this,ra),$r(this,Ro),$r(this,ya),$r(this,m0),$r(this,va),$r(this,pc),$r(this,mc),$r(this,wa),Ws(this,"ttl"),Ws(this,"ttlResolution"),Ws(this,"ttlAutopurge"),Ws(this,"updateAgeOnGet"),Ws(this,"updateAgeOnHas"),Ws(this,"allowStale"),Ws(this,"noDisposeOnSet"),Ws(this,"noUpdateTTL"),Ws(this,"maxEntrySize"),Ws(this,"sizeCalculation"),Ws(this,"noDeleteOnFetchRejection"),Ws(this,"noDeleteOnStaleGet"),Ws(this,"allowStaleOnFetchAbort"),Ws(this,"allowStaleOnFetchRejection"),Ws(this,"ignoreFetchAbort"),Ws(this,"backgroundFetchSize"),$r(this,ei),$r(this,Mo),$r(this,Hs),$r(this,ts),$r(this,Sr),$r(this,oo),$r(this,No),$r(this,Gi),$r(this,bi),$r(this,Aa),$r(this,yi),$r(this,Ta),$r(this,Ca),$r(this,Do),$r(this,Bo),$r(this,Sa),$r(this,gc),$r(this,ao),$r(this,g0),$r(this,x0,()=>{}),$r(this,fl,()=>{}),$r(this,Mu,()=>{}),$r(this,Qo,()=>!1),$r(this,b0,Ie=>{}),$r(this,xc,(Ie,be,et)=>{}),$r(this,Nu,(Ie,be,et,Pe)=>{if(et||Pe)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Ws(this,tg,"LRUCache");let{max:t=0,ttl:r,ttlResolution:s=1,ttlAutopurge:i,updateAgeOnGet:u,updateAgeOnHas:c,allowStale:h,dispose:p,onInsert:m,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:v,maxSize:w=0,maxEntrySize:I=0,sizeCalculation:k,fetchMethod:N,memoMethod:R,noDeleteOnFetchRejection:D,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:F,ignoreFetchAbort:Y,backgroundFetchSize:Z=1,perf:he}=e;if(this.backgroundFetchSize=Z,he!==void 0&&typeof he?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(fr(this,wa,he??KT),t!==0&&!yl(t))throw new TypeError("max option must be a nonnegative integer");let Ee=t?zx(t):Array;if(!Ee)throw new Error("invalid max value: "+t);if(fr(this,ra,t),fr(this,Ro,w),this.maxEntrySize=I||G(this,Ro),this.sizeCalculation=k,this.sizeCalculation){if(!G(this,Ro)&&!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(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(fr(this,mc,R),N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(fr(this,pc,N),fr(this,gc,!!N),fr(this,Hs,new Map),fr(this,ts,Array.from({length:t}).fill(void 0)),fr(this,Sr,Array.from({length:t}).fill(void 0)),fr(this,oo,new Ee(t)),fr(this,No,new Ee(t)),fr(this,Gi,0),fr(this,bi,0),fr(this,Aa,eC.create(t)),fr(this,ei,0),fr(this,Mo,0),typeof p=="function"&&fr(this,ya,p),typeof m=="function"&&fr(this,m0,m),typeof x=="function"?(fr(this,va,x),fr(this,yi,[])):(fr(this,va,void 0),fr(this,yi,void 0)),fr(this,Sa,!!G(this,ya)),fr(this,g0,!!G(this,m0)),fr(this,ao,!!G(this,va)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!D,this.allowStaleOnFetchRejection=!!V,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!Y,this.maxEntrySize!==0){if(G(this,Ro)!==0&&!yl(G(this,Ro)))throw new TypeError("maxSize must be a positive integer if specified");if(!yl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");St(this,yt,ng).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!u,this.updateAgeOnHas=!!c,this.ttlResolution=yl(s)||s===0?s:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!yl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");St(this,yt,Vh).call(this)}if(G(this,ra)===0&&this.ttl===0&&G(this,Ro)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!G(this,ra)&&!G(this,Ro)){let Ie="LRU_CACHE_UNBOUNDED";JT(Ie)&&($x.add(Ie),XT("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ie,Xh))}}get perf(){return G(this,wa)}static unsafeExposeInternals(e){return{starts:G(e,Ca),ttls:G(e,Do),autopurgeTimers:G(e,Bo),sizes:G(e,Ta),keyMap:G(e,Hs),keyList:G(e,ts),valList:G(e,Sr),next:G(e,oo),prev:G(e,No),get head(){return G(e,Gi)},get tail(){return G(e,bi)},free:G(e,Aa),isBackgroundFetch:t=>{var r;return St(r=e,yt,$n).call(r,t)},backgroundFetch:(t,r,s,i)=>{var u;return St(u=e,yt,Bu).call(u,t,r,s,i)},moveToTail:t=>{var r;return St(r=e,yt,yc).call(r,t)},indexes:t=>{var r;return St(r=e,yt,pl).call(r,t)},rindexes:t=>{var r;return St(r=e,yt,ml).call(r,t)},isStale:t=>{var r;return G(r=e,Qo).call(r,t)}}}get max(){return G(this,ra)}get maxSize(){return G(this,Ro)}get calculatedSize(){return G(this,Mo)}get size(){return G(this,ei)}get fetchMethod(){return G(this,pc)}get memoMethod(){return G(this,mc)}get dispose(){return G(this,ya)}get onInsert(){return G(this,m0)}get disposeAfter(){return G(this,va)}getRemainingTTL(e){return G(this,Hs).has(e)?1/0:0}*entries(){for(let e of St(this,yt,pl).call(this))G(this,Sr)[e]!==void 0&&G(this,ts)[e]!==void 0&&!St(this,yt,$n).call(this,G(this,Sr)[e])&&(yield[G(this,ts)[e],G(this,Sr)[e]])}*rentries(){for(let e of St(this,yt,ml).call(this))G(this,Sr)[e]!==void 0&&G(this,ts)[e]!==void 0&&!St(this,yt,$n).call(this,G(this,Sr)[e])&&(yield[G(this,ts)[e],G(this,Sr)[e]])}*keys(){for(let e of St(this,yt,pl).call(this)){let t=G(this,ts)[e];t!==void 0&&!St(this,yt,$n).call(this,G(this,Sr)[e])&&(yield t)}}*rkeys(){for(let e of St(this,yt,ml).call(this)){let t=G(this,ts)[e];t!==void 0&&!St(this,yt,$n).call(this,G(this,Sr)[e])&&(yield t)}}*values(){for(let e of St(this,yt,pl).call(this))G(this,Sr)[e]!==void 0&&!St(this,yt,$n).call(this,G(this,Sr)[e])&&(yield G(this,Sr)[e])}*rvalues(){for(let e of St(this,yt,ml).call(this))G(this,Sr)[e]!==void 0&&!St(this,yt,$n).call(this,G(this,Sr)[e])&&(yield G(this,Sr)[e])}[(rg=Symbol.iterator,tg=Symbol.toStringTag,rg)](){return this.entries()}find(e,t={}){for(let r of St(this,yt,pl).call(this)){let s=G(this,Sr)[r],i=St(this,yt,$n).call(this,s)?s.__staleWhileFetching:s;if(i!==void 0&&e(i,G(this,ts)[r],this))return St(this,yt,bc).call(this,G(this,ts)[r],t)}}forEach(e,t=this){for(let r of St(this,yt,pl).call(this)){let s=G(this,Sr)[r],i=St(this,yt,$n).call(this,s)?s.__staleWhileFetching:s;i!==void 0&&e.call(t,i,G(this,ts)[r],this)}}rforEach(e,t=this){for(let r of St(this,yt,ml).call(this)){let s=G(this,Sr)[r],i=St(this,yt,$n).call(this,s)?s.__staleWhileFetching:s;i!==void 0&&e.call(t,i,G(this,ts)[r],this)}}purgeStale(){let e=!1;for(let t of St(this,yt,ml).call(this,{allowStale:!0}))G(this,Qo).call(this,t)&&(St(this,yt,gl).call(this,G(this,ts)[t],"expire"),e=!0);return e}info(e){let t=G(this,Hs).get(e);if(t===void 0)return;let r=G(this,Sr)[t],s=St(this,yt,$n).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let i={value:s};if(G(this,Do)&&G(this,Ca)){let u=G(this,Do)[t],c=G(this,Ca)[t];if(u&&c){let h=u-(G(this,wa).now()-c);i.ttl=h,i.start=Date.now()}}return G(this,Ta)&&(i.size=G(this,Ta)[t]),i}dump(){let e=[];for(let t of St(this,yt,pl).call(this,{allowStale:!0})){let r=G(this,ts)[t],s=G(this,Sr)[t],i=St(this,yt,$n).call(this,s)?s.__staleWhileFetching:s;if(i===void 0||r===void 0)continue;let u={value:i};if(G(this,Do)&&G(this,Ca)){u.ttl=G(this,Do)[t];let c=G(this,wa).now()-G(this,Ca)[t];u.start=Math.floor(Date.now()-c)}G(this,Ta)&&(u.size=G(this,Ta)[t]),e.unshift([r,u])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let s=Date.now()-r.start;r.start=G(this,wa).now()-s}St(this,yt,y0).call(this,t,r.value,r)}}set(e,t,r={}){let{status:s=Ai.hasSubscribers?{}:void 0}=r;r.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let i=St(this,yt,y0).call(this,e,t,r);return s&&Ai.hasSubscribers&&Ai.publish(s),i}pop(){var e;try{for(;G(this,ei);){let t=G(this,Sr)[G(this,Gi)];if(St(this,yt,Du).call(this,!0),St(this,yt,$n).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(G(this,ao)&&G(this,yi)){let t=G(this,yi),r;for(;r=t?.shift();)(e=G(this,va))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=Ai.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let s=St(this,yt,sg).call(this,e,t);return Ai.hasSubscribers&&Ai.publish(r),s}peek(e,t={}){let{status:r=Gh()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let s=St(this,yt,ig).call(this,e,t);return Ai.hasSubscribers&&Ai.publish(r),s}fetch(e,t={}){let r=jc.hasSubscribers,{status:s=Gh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let i=St(this,yt,Zh).call(this,e,t);return s&&r&&(s.trace=!0,jc.tracePromise(()=>i,s).catch(()=>{})),i}forceFetch(e,t={}){let r=jc.hasSubscribers,{status:s=Gh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let i=St(this,yt,og).call(this,e,t);return s&&r&&(s.trace=!0,jc.tracePromise(()=>i,s).catch(()=>{})),i}memo(e,t={}){let{status:r=Ai.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let s=St(this,yt,ag).call(this,e,t);return r&&(r.value=s),Ai.hasSubscribers&&Ai.publish(r),s}get(e,t={}){let{status:r=Ai.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let s=St(this,yt,bc).call(this,e,t);return r&&(s!==void 0&&(r.value=s),Ai.hasSubscribers&&Ai.publish(r)),s}delete(e){return St(this,yt,gl).call(this,e,"delete")}clear(){return St(this,yt,Kh).call(this,"delete")}},ra=new WeakMap,Ro=new WeakMap,ya=new WeakMap,m0=new WeakMap,va=new WeakMap,pc=new WeakMap,mc=new WeakMap,wa=new WeakMap,ei=new WeakMap,Mo=new WeakMap,Hs=new WeakMap,ts=new WeakMap,Sr=new WeakMap,oo=new WeakMap,No=new WeakMap,Gi=new WeakMap,bi=new WeakMap,Aa=new WeakMap,yi=new WeakMap,Ta=new WeakMap,Ca=new WeakMap,Do=new WeakMap,Bo=new WeakMap,Sa=new WeakMap,gc=new WeakMap,ao=new WeakMap,g0=new WeakMap,yt=new WeakSet,Vh=function(){let e=new ud(G(this,ra)),t=new ud(G(this,ra));fr(this,Do,e),fr(this,Ca,t);let r=this.ttlAutopurge?Array.from({length:G(this,ra)}):void 0;fr(this,Bo,r),fr(this,Mu,(c,h,p=G(this,wa).now())=>{t[c]=h!==0?p:0,e[c]=h,s(c,h)}),fr(this,x0,c=>{t[c]=e[c]!==0?G(this,wa).now():0,s(c,e[c])});let s=this.ttlAutopurge?(c,h)=>{if(r?.[c]&&(clearTimeout(r[c]),r[c]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{G(this,Qo).call(this,c)&&St(this,yt,gl).call(this,G(this,ts)[c],"expire")},h+1);p.unref&&p.unref(),r[c]=p}}:()=>{};fr(this,fl,(c,h)=>{if(e[h]){let p=e[h],m=t[h];if(!p||!m)return;c.ttl=p,c.start=m,c.now=i||u();let x=c.now-m;c.remainingTTL=p-x}});let i=0,u=()=>{let c=G(this,wa).now();if(this.ttlResolution>0){i=c;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return c};this.getRemainingTTL=c=>{let h=G(this,Hs).get(c);if(h===void 0)return 0;let p=e[h],m=t[h];if(!p||!m)return 1/0;let x=(i||u())-m;return p-x},fr(this,Qo,c=>{let h=t[c],p=e[c];return!!p&&!!h&&(i||u())-h>p})},x0=new WeakMap,fl=new WeakMap,Mu=new WeakMap,Qo=new WeakMap,ng=function(){let e=new ud(G(this,ra));fr(this,Mo,0),fr(this,Ta,e),fr(this,b0,t=>{fr(this,Mo,G(this,Mo)-e[t]),e[t]=0}),fr(this,Nu,(t,r,s,i)=>{if(!yl(s)){if(St(this,yt,$n).call(this,r))return this.backgroundFetchSize;if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(s=i(r,t),!yl(s))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 s}),fr(this,xc,(t,r,s)=>{if(e[t]=r,G(this,Ro)){let i=G(this,Ro)-e[t];for(;G(this,Mo)>i;)St(this,yt,Du).call(this,!0)}fr(this,Mo,G(this,Mo)+e[t]),s&&(s.entrySize=r,s.totalCalculatedSize=G(this,Mo))})},b0=new WeakMap,xc=new WeakMap,Nu=new WeakMap,pl=function*({allowStale:e=this.allowStale}={}){if(G(this,ei))for(let t=G(this,bi);St(this,yt,qh).call(this,t)&&((e||!G(this,Qo).call(this,t))&&(yield t),t!==G(this,Gi));)t=G(this,No)[t]},ml=function*({allowStale:e=this.allowStale}={}){if(G(this,ei))for(let t=G(this,Gi);St(this,yt,qh).call(this,t)&&((e||!G(this,Qo).call(this,t))&&(yield t),t!==G(this,bi));)t=G(this,oo)[t]},qh=function(e){return e!==void 0&&G(this,Hs).get(G(this,ts)[e])===e},y0=function(e,t,r,s){var i,u,c,h;let{ttl:p=this.ttl,start:m,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:v}=r,w=St(this,yt,$n).call(this,t);if(t===void 0)return v&&(v.set="deleted"),this.delete(e),this;let{noUpdateTTL:I=this.noUpdateTTL}=r;v&&!w&&(v.value=t);let k=G(this,Nu).call(this,e,t,r.size||0,b,v);if(this.maxEntrySize&&k>this.maxEntrySize)return St(this,yt,gl).call(this,e,"set"),v&&(v.set="miss",v.maxEntrySizeExceeded=!0),this;let N=G(this,ei)===0?void 0:G(this,Hs).get(e);if(N===void 0)N=G(this,ei)===0?G(this,bi):G(this,Aa).length!==0?G(this,Aa).pop():G(this,ei)===G(this,ra)?St(this,yt,Du).call(this,!1):G(this,ei),G(this,ts)[N]=e,G(this,Sr)[N]=t,G(this,Hs).set(e,N),G(this,oo)[G(this,bi)]=N,G(this,No)[N]=G(this,bi),fr(this,bi,N),Wh(this,ei)._++,G(this,xc).call(this,N,k,v),v&&(v.set="add"),I=!1,G(this,g0)&&!w&&((i=G(this,m0))==null||i.call(this,t,e,"add"));else{St(this,yt,yc).call(this,N);let R=G(this,Sr)[N];if(t!==R){if(!x)if(St(this,yt,$n).call(this,R)){R!==s&&R.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:D}=R;D!==void 0&&D!==t&&(G(this,Sa)&&((u=G(this,ya))==null||u.call(this,D,e,"set")),G(this,ao)&&G(this,yi)?.push([D,e,"set"]))}else G(this,Sa)&&((c=G(this,ya))==null||c.call(this,R,e,"set")),G(this,ao)&&G(this,yi)?.push([R,e,"set"]);if(G(this,b0).call(this,N),G(this,xc).call(this,N,k,v),G(this,Sr)[N]=t,!w){let D=R&&St(this,yt,$n).call(this,R)?R.__staleWhileFetching:R,P=D===void 0?"add":t!==D?"replace":"update";v&&(v.set=P,D!==void 0&&(v.oldValue=D)),G(this,g0)&&this.onInsert?.(t,e,P)}}else w||(v&&(v.set="update"),G(this,g0)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!G(this,Do)&&St(this,yt,Vh).call(this),G(this,Do)&&(I||G(this,Mu).call(this,N,p,m),v&&G(this,fl).call(this,v,N)),!x&&G(this,ao)&&G(this,yi)){let R=G(this,yi),D;for(;D=R?.shift();)(h=G(this,va))==null||h.call(this,...D)}return this},Du=function(e){var t;let r=G(this,Gi),s=G(this,ts)[r],i=G(this,Sr)[r],u=St(this,yt,$n).call(this,i);u&&i.__abortController.abort(new Error("evicted"));let c=u?i.__staleWhileFetching:i;return(G(this,Sa)||G(this,ao))&&c!==void 0&&(G(this,Sa)&&((t=G(this,ya))==null||t.call(this,c,s,"evict")),G(this,ao)&&G(this,yi)?.push([c,s,"evict"])),G(this,b0).call(this,r),G(this,Bo)?.[r]&&(clearTimeout(G(this,Bo)[r]),G(this,Bo)[r]=void 0),e&&(G(this,ts)[r]=void 0,G(this,Sr)[r]=void 0,G(this,Aa).push(r)),G(this,ei)===1?(fr(this,Gi,fr(this,bi,0)),G(this,Aa).length=0):fr(this,Gi,G(this,oo)[r]),G(this,Hs).delete(s),Wh(this,ei)._--,r},sg=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=t,i=G(this,Hs).get(e);if(i!==void 0){let u=G(this,Sr)[i];if(St(this,yt,$n).call(this,u)&&u.__staleWhileFetching===void 0)return!1;if(G(this,Qo).call(this,i))s&&(s.has="stale",G(this,fl).call(this,s,i));else return r&&G(this,x0).call(this,i),s&&(s.has="hit",G(this,fl).call(this,s,i)),!0}else s&&(s.has="miss");return!1},ig=function(e,t){let{status:r,allowStale:s=this.allowStale}=t,i=G(this,Hs).get(e);if(i===void 0||!s&&G(this,Qo).call(this,i)){r&&(r.peek=i===void 0?"miss":"stale");return}let u=G(this,Sr)[i],c=St(this,yt,$n).call(this,u)?u.__staleWhileFetching:u;return r&&(c!==void 0?(r.peek="hit",r.value=c):r.peek="miss"),c},Bu=function(e,t,r,s){let i=t===void 0?void 0:G(this,Sr)[t];if(St(this,yt,$n).call(this,i))return i;let u=new AbortController,{signal:c}=r;c?.addEventListener("abort",()=>u.abort(c.reason),{signal:u.signal});let h={signal:u.signal,options:r,context:s},p=(I,k=!1)=>{let{aborted:N}=u.signal,R=r.ignoreFetchAbort&&I!==void 0,D=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&I!==void 0);if(r.status&&(N&&!k?(r.status.fetchAborted=!0,r.status.fetchError=u.signal.reason,R&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),N&&!R&&!k)return x(u.signal.reason,D);let P=v,V=G(this,Sr)[t];return(V===v||V===void 0&&R&&k)&&(I===void 0?P.__staleWhileFetching!==void 0?G(this,Sr)[t]=P.__staleWhileFetching:St(this,yt,gl).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),St(this,yt,y0).call(this,e,I,h.options,P))),I},m=I=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=I),x(I,!1)),x=(I,k)=>{let{aborted:N}=u.signal,R=N&&r.allowStaleOnFetchAbort,D=R||r.allowStaleOnFetchRejection,P=D||r.noDeleteOnFetchRejection,V=v;if(G(this,Sr)[t]===v&&(!P||!k&&V.__staleWhileFetching===void 0?St(this,yt,gl).call(this,e,"fetch"):R||(G(this,Sr)[t]=V.__staleWhileFetching)),D)return r.status&&V.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),V.__staleWhileFetching;if(V.__returned===V)throw I},b=(I,k)=>{var N;let R=(N=G(this,pc))==null?void 0:N.call(this,e,i,h);u.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(I(void 0),r.allowStaleOnFetchAbort&&(I=D=>p(D,!0)))}),R&&R instanceof Promise?R.then(D=>I(D===void 0?void 0:D),k):R!==void 0&&I(R)};r.status&&(r.status.fetchDispatched=!0);let v=new Promise(b).then(p,m),w=Object.assign(v,{__abortController:u,__staleWhileFetching:i,__returned:void 0});return t===void 0?(St(this,yt,y0).call(this,e,w,{...h.options,status:void 0}),t=G(this,Hs).get(e)):G(this,Sr)[t]=w,w},$n=function(e){if(!G(this,gc))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Zh=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:u=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:m=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:I,forceRefresh:k=!1,status:N,signal:R}=t;if(N&&(N.op="fetch",N.key=e,k&&(N.forceRefresh=!0),N.cache=this),!G(this,gc))return N&&(N.fetch="get"),St(this,yt,bc).call(this,e,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:N});let D={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:u,noDisposeOnSet:c,size:h,sizeCalculation:p,noUpdateTTL:m,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:w,ignoreFetchAbort:v,status:N,signal:R},P=G(this,Hs).get(e);if(P===void 0){N&&(N.fetch="miss");let V=St(this,yt,Bu).call(this,e,P,D,I);return V.__returned=V}else{let V=G(this,Sr)[P];if(St(this,yt,$n).call(this,V)){let he=r&&V.__staleWhileFetching!==void 0;return N&&(N.fetch="inflight",he&&(N.returnedStale=!0)),he?V.__staleWhileFetching:V.__returned=V}let F=G(this,Qo).call(this,P);if(!k&&!F)return N&&(N.fetch="hit"),St(this,yt,yc).call(this,P),s&&G(this,x0).call(this,P),N&&G(this,fl).call(this,N,P),V;let Y=St(this,yt,Bu).call(this,e,P,D,I),Z=Y.__staleWhileFetching!==void 0&&r;return N&&(N.fetch=F?"stale":"refresh",Z&&F&&(N.returnedStale=!0)),Z?Y.__staleWhileFetching:Y.__returned=Y}},og=async function(e,t={}){let r=await St(this,yt,Zh).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},ag=function(e,t={}){let r=G(this,mc);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,status:i,forceRefresh:u,...c}=t;i&&u&&(i.forceRefresh=!0);let h=St(this,yt,bc).call(this,e,c),p=u||h===void 0;if(i&&(i.memo=p?"miss":"hit",p||(i.value=h)),!p)return h;let m=r(e,h,{options:c,context:s});return i&&(i.value=m),St(this,yt,y0).call(this,e,m,c),m},bc=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:u}=t,c=G(this,Hs).get(e);if(c===void 0){u&&(u.get="miss");return}let h=G(this,Sr)[c],p=St(this,yt,$n).call(this,h);return u&&G(this,fl).call(this,u,c),G(this,Qo).call(this,c)?p?(u&&(u.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(u&&(u.returnedStale=!0),h.__staleWhileFetching):void 0):(i||St(this,yt,gl).call(this,e,"expire"),u&&(u.get="stale"),r?(u&&(u.returnedStale=!0),h):void 0):(u&&(u.get=p?"fetching":"hit"),St(this,yt,yc).call(this,c),s&&G(this,x0).call(this,c),p?h.__staleWhileFetching:h)},Yh=function(e,t){G(this,No)[t]=e,G(this,oo)[e]=t},yc=function(e){e!==G(this,bi)&&(e===G(this,Gi)?fr(this,Gi,G(this,oo)[e]):St(this,yt,Yh).call(this,G(this,No)[e],G(this,oo)[e]),St(this,yt,Yh).call(this,G(this,bi),e),fr(this,bi,e))},gl=function(e,t){var r,s;Ai.hasSubscribers&&Ai.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(G(this,ei)!==0){let u=G(this,Hs).get(e);if(u!==void 0)if(G(this,Bo)?.[u]&&(clearTimeout(G(this,Bo)?.[u]),G(this,Bo)[u]=void 0),i=!0,G(this,ei)===1)St(this,yt,Kh).call(this,t);else{G(this,b0).call(this,u);let c=G(this,Sr)[u];if(St(this,yt,$n).call(this,c)?c.__abortController.abort(new Error("deleted")):(G(this,Sa)||G(this,ao))&&(G(this,Sa)&&((r=G(this,ya))==null||r.call(this,c,e,t)),G(this,ao)&&G(this,yi)?.push([c,e,t])),G(this,Hs).delete(e),G(this,ts)[u]=void 0,G(this,Sr)[u]=void 0,u===G(this,bi))fr(this,bi,G(this,No)[u]);else if(u===G(this,Gi))fr(this,Gi,G(this,oo)[u]);else{let h=G(this,No)[u];G(this,oo)[h]=G(this,oo)[u];let p=G(this,oo)[u];G(this,No)[p]=G(this,No)[u]}Wh(this,ei)._--,G(this,Aa).push(u)}}if(G(this,ao)&&G(this,yi)?.length){let u=G(this,yi),c;for(;c=u?.shift();)(s=G(this,va))==null||s.call(this,...c)}return i},Kh=function(e){var t,r;for(let s of St(this,yt,ml).call(this,{allowStale:!0})){let i=G(this,Sr)[s];if(St(this,yt,$n).call(this,i))i.__abortController.abort(new Error("deleted"));else{let u=G(this,ts)[s];G(this,Sa)&&((t=G(this,ya))==null||t.call(this,i,u,e)),G(this,ao)&&G(this,yi)?.push([i,u,e])}}if(G(this,Hs).clear(),G(this,Sr).fill(void 0),G(this,ts).fill(void 0),G(this,Do)&&G(this,Ca)){G(this,Do).fill(0),G(this,Ca).fill(0);for(let s of G(this,Bo)??[])s!==void 0&&clearTimeout(s);G(this,Bo)?.fill(void 0)}if(G(this,Ta)&&G(this,Ta).fill(0),fr(this,Gi,0),fr(this,bi,0),G(this,Aa).length=0,fr(this,Mo,0),fr(this,ei,0),G(this,ao)&&G(this,yi)){let s=G(this,yi),i;for(;i=s?.shift();)(r=G(this,va))==null||r.call(this,...i)}},Xh);function Hx(e){let t={individual:{},range:[]},r=new WeakMap;for(let s of e)Zf(t,s,r);return t}function Zf(e,t,r){for(let[s,i]of Object.entries(t.individual))if(e.individual[s])v0(e.individual[s],i,r);else{let u=!1;for(let[c,{range:h,entry:p}]of e.range.entries()){let m=Jh(Number(s),h);if(m.both!==null){u=!0,e.individual[s]=i,v0(e.individual[s],Ti(p),r),e.range.splice(c,1);for(let x of m.second)Array.isArray(x)?e.range.push({range:x,entry:Ti(p)}):e.individual[x]=Ti(p)}}u||(e.individual[s]=i)}for(let{range:s,entry:i}of t.range){let u=[s];for(let c=0;c<e.range.length;c++){let{range:h,entry:p}=e.range[c];for(let[m,x]of u.entries())if(Array.isArray(x)){let b=rC(x,h);if(b.both===null)continue;e.range.splice(c,1),c--;let v=Ti(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:v}):e.individual[b.both]=v,v0(v,Ti(i),r);for(let w of b.second)Array.isArray(w)?e.range.push({range:w,entry:Ti(p)}):e.individual[w]=Ti(p);u=b.first}else{let b=Jh(x,h);if(b.both===null)continue;e.individual[x]=Ti(i),v0(e.individual[x],Ti(p),r),e.range.splice(c,1),c--;for(let v of b.second)Array.isArray(v)?e.range.push({range:v,entry:Ti(p)}):e.individual[v]=Ti(p);u.splice(m,1,...b.first);break}}for(let c of Object.keys(e.individual))for(let[h,p]of u.entries())if(Array.isArray(p)){let m=Jh(Number(c),p);if(m.both===null)continue;v0(e.individual[c],Ti(i),r),u.splice(h,1,...m.second);break}else if(Number(c)===p){v0(e.individual[c],Ti(i),r);break}for(let c of u)Array.isArray(c)?e.range.push({range:c,entry:Ti(i)}):e.individual[c]=Ti(i)}}function v0(e,t,r){let s=r.get(e);s?.has(t)||(s||(s=new Set,r.set(e,s)),s.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?Zf(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Zf(e.reverse,t.reverse,r):e.reverse=t.reverse))}function rC(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let s=Math.max(e[0],t[0]),i=Math.min(e[1],t[1]);r.both=zl(s,i)}if(e[0]<t[0]){let s=e[0],i=Math.min(t[0],e[1]);r.first.push(zl(s,i))}else if(t[0]<e[0]){let s=t[0],i=Math.min(t[1],e[0]);r.second.push(zl(s,i))}if(e[1]>t[1]){let s=Math.max(e[0],t[1]),i=e[1];r.first.push(zl(s,i))}else if(t[1]>e[1]){let s=Math.max(e[1],t[0]),i=t[1];r.second.push(zl(s,i))}return r}function Jh(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(zl(t[0],e)),t[1]>e&&r.second.push(zl(e+1,t[1])),r}function zl(e,t){return t-e===1?e:[e,t]}function Ti(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=lg(e.forward,t)),e.reverse&&(r.reverse=lg(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 lg(e,t=new Map){let r={};for(let[s,i]of Object.entries(e.individual))r[s]=Ti(i,t);return{individual:r,range:e.range.map(({range:s,entry:i})=>({range:s.slice(),entry:Ti(i,t)}))}}function Yf(e,t,r,s){let i=t[s],u=e[i];if(!u)return;let c=u.lookup;if(u.reverse){let p=nC(u.reverse,t,r);(!c&&p||p&&c&&(c.index>p.index||c.index===p.index&&c.subIndex>p.subIndex))&&(c=p)}if(++s>=t.length||!u.forward)return c;let h=Yf(u.forward,t,r,s);return(!c&&h||h&&c&&(c.index>h.index||c.index===h.index&&c.subIndex>h.subIndex))&&(c=h),c}function nC(e,t,r){let s=e[t[--r]],i=s&&s.lookup;for(;s&&((!i&&s.lookup||s.lookup&&i&&i.index>s.lookup.index)&&(i=s.lookup),!(--r<0||!s.reverse));)s=s.reverse[t[r]];return i}function cg(e,t,r){let s=!1;for(let i=0;i<e.length;i++){let u=e[i];if(s){if(r<=u[0])return e[i-1][1]=r,e;if(r<=u[1])return e[i-1][1]=Math.max(r,u[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(r<=u[0])return e.splice(i,0,[t,r]),e;if(r<=u[1])return u[0]=Math.min(t,u[0]),e;if(t<u[1])u[0]=Math.min(t,u[0]),s=!0;else continue}}return s?e[e.length-1][1]=r:e.push([t,r]),e}function sC(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let s=e.ranges.find(i=>i.start<=t&&i.end>=t);return s?s.index:null}}function Za(e){switch(e.format){case 1:return e.glyphs.map((r,s)=>({glyphId:r,index:s}));case 2:let t=[];for(let[r,s]of e.ranges.entries())s.end===s.start?t.push({glyphId:s.start,index:r}):t.push({glyphId:[s.start,s.end+1],index:r});return t}}function iC(e,t){let r=t[0],s=Kf(e,r),i=t[0]+1,u=new Map;for(;i<t[1];)Kf(e,i)!==s&&(i-r<=1?u.set(r,s):u.set([r,i],s)),i++;return i-r<=1?u.set(r,s):u.set([r,i],s),u}function Kf(e,t){let r=sC(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 zp(e,t,r,s,i){let u=[];for(let c of r){c.entry.forward={individual:{},range:[]};for(let h of e)u.push(...Xd(c.entry.forward,s,i,t,h).map(({entry:p,substitution:m})=>({entry:p,substitutions:[...c.substitutions,m]})))}return u}function Yd(e,t){let r=[],s=new Set;for(let i of t){if(s.has(i.entry))continue;s.add(i.entry),i.entry.forward??={individual:{},range:[]};let u={};for(let c of e)Array.isArray(c)?i.entry.forward.range.push({entry:u,range:c}):i.entry.forward.individual[c]=u;r.push({entry:u,substitutions:i.substitutions})}return r}function Kd(e,t){let r=[],s=new Set;for(let i of t){if(s.has(i.entry))continue;s.add(i.entry),i.entry.reverse??={individual:{},range:[]};let u={};for(let c of e)Array.isArray(c)?i.entry.reverse.range.push({entry:u,range:c}):i.entry.reverse.individual[c]=u;r.push({entry:u,substitutions:i.substitutions})}return r}function Xd(e,t,r,s,i){let u=[];if(!Array.isArray(i))e.individual[i]={},u.push({entry:e.individual[i],substitution:aC(t,r,s,i)});else{let c=oC(t,r,s,i);for(let[h,p]of c){let m={};Array.isArray(h)?e.range.push({range:h,entry:m}):e.individual[h]={},u.push({entry:m,substitution:p})}}return u}function oC(e,t,r,s){for(let i of e.filter(u=>u.sequenceIndex===r))for(let u of t[i.lookupListIndex].subtables){let c=iC(u,s);if(!Array.from(c.values()).every(h=>h!==null))return c}return new Map([[s,null]])}function aC(e,t,r,s){for(let i of e.filter(u=>u.sequenceIndex===r))for(let u of t[i.lookupListIndex].subtables){let c=Kf(u,s);if(c!==null)return c}return null}function lC(e,t,r){let s={individual:{},range:[]},i=Za(e.coverage);for(let{glyphId:u,index:c}of i){let h=e.chainRuleSets[c];if(h)for(let[p,m]of h.entries()){let x=Xd(s,m.lookupRecords,t,0,u).map(({entry:b,substitution:v})=>({entry:b,substitutions:[v]}));for(let[b,v]of m.input.entries())x=zp([v],b+1,x,m.lookupRecords,t);for(let b of m.lookahead)x=Yd([b],x);for(let b of m.backtrack)x=Kd([b],x);for(let{entry:b,substitutions:v}of x)b.lookup={substitutions:v,length:m.input.length+1,index:r,subIndex:p,contextRange:[-1*m.backtrack.length,1+m.input.length+m.lookahead.length]}}}return s}function cC(e,t){return e.format===2?Array.isArray(t)?uC(e,t):new Map([[t,Xf(e,t)]]):new Map([[t,null]])}function uC(e,t){let r=t[0],s=Xf(e,r),i=t[0]+1,u=new Map;for(;i<t[1];)Xf(e,i)!==s&&(i-r<=1?u.set(r,s):u.set([r,i],s)),i++;return i-r<=1?u.set(r,s):u.set([r,i],s),u}function Xf(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function ef(e,t){switch(e.format){case 2:let r=[];for(let s of e.ranges)s.classId===t&&(s.end===s.start?r.push(s.start):r.push([s.start,s.end+1]));return r;default:return[]}}function dC(e,t,r){let s=[],i=Za(e.coverage);for(let{glyphId:u}of i){let c=cC(e.inputClassDef,u);for(let[h,p]of c.entries()){if(p===null)continue;let m=e.chainClassSet[p];if(m)for(let[x,b]of m.entries()){let v={individual:{},range:[]},w=Xd(v,b.lookupRecords,t,0,h).map(({entry:I,substitution:k})=>({entry:I,substitutions:[k]}));for(let[I,k]of b.input.entries())w=zp(ef(e.inputClassDef,k),I+1,w,b.lookupRecords,t);for(let I of b.lookahead)w=Yd(ef(e.lookaheadClassDef,I),w);for(let I of b.backtrack)w=Kd(ef(e.backtrackClassDef,I),w);for(let{entry:I,substitutions:k}of w)I.lookup={substitutions:k,index:r,subIndex:x,length:b.input.length+1,contextRange:[-1*b.backtrack.length,1+b.input.length+b.lookahead.length]};s.push(v)}}}return Hx(s)}function hC(e,t,r){let s={individual:{},range:[]},i=Za(e.inputCoverage[0]);for(let{glyphId:u}of i){let c=Xd(s,e.lookupRecords,t,0,u).map(({entry:h,substitution:p})=>({entry:h,substitutions:[p]}));for(let[h,p]of e.inputCoverage.slice(1).entries())c=zp(Za(p).map(m=>m.glyphId),h+1,c,e.lookupRecords,t);for(let h of e.lookaheadCoverage)c=Yd(Za(h).map(p=>p.glyphId),c);for(let h of e.backtrackCoverage)c=Kd(Za(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 s}function fC(e,t){let r={individual:{},range:[]},s=Za(e.coverage);for(let{glyphId:i,index:u}of s){let c={};Array.isArray(i)?r.range.push({entry:c,range:i}):r.individual[i]=c;let h=[{entry:c,substitutions:[e.substitutes[u]]}];for(let p of e.lookaheadCoverage)h=Yd(Za(p).map(m=>m.glyphId),h);for(let p of e.backtrackCoverage)h=Kd(Za(p).map(m=>m.glyphId),h);for(let{entry:p,substitutions:m}of h)p.lookup={substitutions:m,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function Jf(e,t=new Map){let r={};for(let[s,i]of Object.entries(e.individual))r[s]=ug(i,t);for(let{range:s,entry:i}of e.range){let u=ug(i,t);for(let c=s[0];c<s[1];c++)r[c]=u}return r}function ug(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Jf(e.forward,t)),e.reverse&&(r.reverse=Jf(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var pC=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new tC({maxSize:t.cacheSize,sizeCalculation:((u,c)=>c.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(u=>u.tag==="calt")||[]).reduce((u,c)=>[...u,...c.feature.lookupListIndexes],[]),s=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],i=s.filter((u,c)=>r.some(h=>h===c));for(let[u,c]of i.entries()){let h=[];switch(c.lookupType){case 6:for(let[m,x]of c.subtables.entries())switch(x.substFormat){case 1:h.push(lC(x,s,m));break;case 2:h.push(dC(x,s,m));break;case 3:h.push(hC(x,s,m));break}break;case 8:for(let[m,x]of c.subtables.entries())h.push(fC(x,m));break}let p=Jf(Hx(h));this._lookupTrees.push({tree:p,processForward:c.lookupType!==8});for(let m of Object.keys(p))this._glyphLookups[m]||(this._glyphLookups[m]=[]),this._glyphLookups[m].push(u)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let u of e)r.push(this._font.charToGlyphIndex(u));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let s=this._findInternal(r.slice()),i={inputGlyphs:r,outputGlyphs:s.sequence,contextRanges:s.ranges};return this._cache&&this._cache.set(e,i),i}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 i of e)r.push(this._font.charToGlyphIndex(i));let s=this._findInternal(r);return this._cache&&this._cache.set(e,s.ranges),s.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let s=this._lookupTrees[r.index];if(s.processForward){let i=r.last;for(let u=r.first;u<i;u++){let c=Yf(s.tree,e,u,u);if(c){for(let h=0;h<c.substitutions.length;h++){let p=c.substitutions[h];p!==null&&(e[u+h]=p)}cg(t,c.contextRange[0]+u,c.contextRange[1]+u),u+c.length>=i&&(i=u+c.length+1),u+=c.length-1}}}else for(let i=r.last-1;i>=r.first;i--){let u=Yf(s.tree,e,i,i);if(u){for(let c=0;c<u.substitutions.length;c++){let h=u.substitutions[c];h!==null&&(e[i+c]=h)}cg(t,u.contextRange[0]+i,u.contextRange[1]+i),i-=u.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 s=0;s<e.length;s++){let i=this._glyphLookups[e[s]];if(i)for(let u=0;u<i.length;u++){let c=i[u];if(c>=t){(r.index===null||c<=r.index)&&(r.index=c,r.first>s&&(r.first=s),r.last=s+1);break}}}return r}};function mC(e,t){let r=YT.parse(e);return new pC(r,{cacheSize:0,...t})}function gC(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],s="";for(;t.offset<t.input.length;){let i=t.input[t.offset++];switch(i){case"'":case'"':s+=xC(t,i);break;case",":r.push(s),s="";break;default:/\s/.test(i)||(t.offset--,s+=bC(t),r.push(s),s="")}}return r}function xC(e,t){let r="",s=!1;for(;e.offset<e.input.length;){let i=e.input[e.offset++];if(s)/[\dA-Fa-f]/.test(i)?(e.offset--,r+=Wx(e)):i!==`
64
- `&&(r+=i),s=!1;else switch(i){case t:return r;case"\\":s=!0;break;default:r+=i}}throw new Error("Unterminated string")}function bC(e){let t="",r=!1;for(;e.offset<e.input.length;){let s=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(s)?(e.offset--,t+=Wx(e)):t+=s,r=!1;else switch(s){case"\\":r=!0;break;case",":return t;default:/\s/.test(s)?t.endsWith(" ")||(t+=" "):t+=s}}return t}function Wx(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return tf(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,tf(t);t+=r}return tf(t)}function tf(e){return String.fromCodePoint(parseInt(e,16))}var vc;async function yC(e,t){if(!vc){if(typeof navigator<"u"&&"fonts"in navigator){try{let i=await navigator.permissions.request?.({name:"local-fonts"});if(i&&i.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(i){if(i instanceof Error&&i.name!=="TypeError")throw i}let s={};try{let i=await navigator.fonts.query();for(let u of i)s.hasOwnProperty(u.family)||(s[u.family]=[]),s[u.family].push(u);vc=Promise.resolve(s)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let s={};try{let i=await window.queryLocalFonts();for(let u of i)s.hasOwnProperty(u.family)||(s[u.family]=[]),s[u.family].push(u);vc=Promise.resolve(s)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}vc??=Promise.resolve({})}let r=await vc;for(let s of gC(e)){if(vC.includes(s))return;if(r.hasOwnProperty(s)&&r[s].length>0){let i=r[s][0];if("blob"in i){let u=await(await i.blob()).arrayBuffer();return mC(u,{cacheSize:t})}return}}}var vC=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],wC=1e5;function AC(e,t=[]){let r,s,i=0,u;return e.registerCharacterJoiner(c=>{let h=e.options.fontFamily;if(h&&(i===0||r!==h)){s=void 0,i=1,r=h;let p=r;yC(p,wC).then(m=>{p===e.options.fontFamily&&(i=2,s=m,m&&e.refresh(0,e.rows-1))}).catch(m=>{p===e.options.fontFamily&&(i=3,e.options.logLevel==="debug"&&console.debug(u,new Error("Failure while loading font")),s=void 0,u=m)})}return s&&i===2?s.findLigatureRanges(c).map(p=>[p[0],p[1]]):TC(c,t)})}function TC(e,t){let r=[];for(let s=0;s<e.length;s++)for(let i=0;i<t.length;i++)if(e.startsWith(t[i],s)){r.push([s,s+t[i].length]),s+=t[i].length-1;break}return r}var CC=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=AC(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 dg(e){let t=0;for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);if(s<48||57<s)return-1;t=t*10+s-48}return t}var SC=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 s=dg(r[1]),i=dg(r[2]);switch(s){case 0:this.progress={state:s,value:0};break;case 1:if(i<0)return!0;this.progress={state:s,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:s,value:i||this._pr};break;case 3:this.progress={state:s,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 Gx(e,t){const r=Math.max(e.left,t.left),s=Math.max(e.top,t.top),i=Math.min(e.right,t.right),u=Math.min(e.bottom,t.bottom);return i>r&&u>s?{left:r,top:s,right:i,bottom:u}:null}function hg(e,t){const r=Gx(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function ql(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const s=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!s.width||!s.height)return null;const i=e.dimensions?.css?.cell?.height,u=s.width/e.cols,c=i&&i>0?i:s.height/e.rows;return{originLeft:s.left,originTop:s.top,cellW:u,cellH:c}}function dd(e,t){const r=ql(e);if(!r)return null;const s=t.row-e.buffer.active.viewportY;if(s<0||s>=e.rows)return null;const i=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(i+.5)*r.cellW,y:r.originTop+s*r.cellH}}function _C(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 Td(e,t,r){const s=e.row*r+e.col,i=t.row*r+t.col;return s<=i?{start:e,end:t}:{start:t,end:e}}function LC(e,t,r){const s=ql(e);if(!s)return null;const{start:i,end:u}=Td(t,r,e.cols),c=e.buffer.active.viewportY,h=c+e.rows-1;if(u.row<c||i.row>h)return null;const p=Math.max(i.row,c),m=Math.min(u.row,h),x=s.originTop+(p-c)*s.cellH,b=s.originTop+(m-c+1)*s.cellH;return i.row===u.row?{left:s.originLeft+i.col*s.cellW,top:x,right:s.originLeft+(u.col+1)*s.cellW,bottom:b}:{left:s.originLeft,top:x,right:s.originLeft+e.cols*s.cellW,bottom:b}}function IC(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),s=Math.min(e.viewport.right,e.terminal.right),i=Math.min(e.viewport.bottom,e.terminal.bottom),u=t+e.margin,c=r+e.margin,h=Math.max(u,s-e.width-e.margin),p=Math.max(c,i-e.height-e.margin),m=he=>Math.max(u,Math.min(he,h)),x=he=>Math.max(c,Math.min(he,p)),b=e.selection?Gx(e.selection,{left:t,top:r,right:s,bottom:i}):null;if(!b){const he=m(e.clientX-e.width/2),Ee=e.clientY-e.height-e.fingerGap,Ie=e.clientY+e.fingerGap,be=x(Ee>=c?Ee:Ie);return{left:Math.round(he),top:Math.round(be)}}const v=(b.left+b.right)/2,w=(b.top+b.bottom)/2,I=e.preference?.alignX??v,k=e.selectionGap??e.fingerGap,N=b.top-e.height-k,R=b.bottom+k,D=e.preference?.vertical==="below"?R:N,P=e.preference?.vertical==="below"?N:R,V=[{left:u,top:c},{left:h,top:c},{left:u,top:p},{left:h,top:p}];e.preference&&V.sort((he,Ee)=>{const Ie=be=>{const et=be.left+e.width/2,Pe=be.top+e.height/2;return Math.hypot(et-e.preference.focusX,Pe-e.preference.focusY)};return Ie(Ee)-Ie(he)});const F=[{left:I-e.width/2,top:D},{left:v-e.width/2,top:D},{left:I-e.width/2,top:P},{left:v-e.width/2,top:P},{left:b.left-e.width-e.fingerGap,top:w-e.height/2},{left:b.right+e.fingerGap,top:w-e.height/2},...V].map(he=>({left:m(he.left),top:x(he.top)}));let Y=F[0],Z=Number.POSITIVE_INFINITY;return F.forEach((he,Ee)=>{const Ie={left:he.left,top:he.top,right:he.left+e.width,bottom:he.top+e.height},be=(e.avoid??[]).reduce((Pe,fe)=>Pe+hg(Ie,fe),0),et=(be>0?1e6:0)+be*100+hg(Ie,b)*10+Ee*.01;et<Z&&(Y=he,Z=et)}),{left:Math.round(Y.left),top:Math.round(Y.top)}}function kC(e){const t=e.willChange.split(",").map(s=>s.trim()),r=(s,i)=>!!(s&&s!==i);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 EC(e){let t=e.parentElement;for(;t;){if(kC(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function RC(e,t,r,s){const i=e.getBoundingClientRect();let u=0,c=0;if(t){const h=t.getBoundingClientRect();u=h.left+t.clientLeft,c=h.top+t.clientTop}return{x:i.left-u+r,y:i.top-c+s}}function MC(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 NC(e,t,r){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let i=0;const u=e.length-s,c=t.length-s;for(;i<u&&i<c&&e[e.length-1-i]===t[t.length-1-i];)i+=1;const h=t.slice(s,t.length-i);return h&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(h))?h:null}const fg=2,DC=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function BC(e){const t=e.reason.replace(/^refresh:/,""),r=DC.has(t),s=Math.abs(e.proposedCols-e.currentCols),i=Math.abs(e.proposedRows-e.currentRows);return{accept:r?s>0||i>0:s>=fg||i>=fg,isRealResize:r,colsDelta:s,rowsDelta:i}}function QC(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 jC(e,t){return!e||t}function PC(e,t,r){return e!=="alternate"&&r>=t}function OC(e,t){return e?"none":t?"single":"settled"}function FC(e,t,r){return!r&&(e||t)}function UC(e,t){return e==="webgl"&&t}function $C(e){let t,r,s=!1,i=0;const u=e.parser.registerCsiHandler({prefix:"?",final:"l"},h=>(t&&h.some(p=>p===2026)&&(s=!0),!1)),c=h=>{const p=t;if(!p)return;const m=r;if(t=void 0,r=void 0,s=!1,p(),h){const x=e._core?._renderService?._renderer?.value;m&&x?.handleResize(...m),x?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(i++,s=!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,m=h.renderRows,x=h.clear;h.handleResize=(b,v)=>{r=[b,v]},h.renderRows=()=>{},h.clear=()=>{},t=()=>{h.handleResize=p,h.renderRows=m,h.clear=x}},get generation(){return i},written(h){h===i&&s&&!e.modes.synchronizedOutputMode&&c(!0)},cancel(){c(!0)},dispose(){c(!1),u.dispose()}}}function rf(){return{confirmed:null,pending:null,nextSeq:1}}function pg(e,t){return e?.cols===t.cols&&e.rows===t.rows}function Hp(e,t,r){const s={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:s,nextSeq:e.nextSeq+1},request:s}}function zC(e,t){return pg(e.pending,t)||!e.pending&&pg(e.confirmed,t)?{state:e,request:null}:Hp(e,t,0)}function HC(e,t){return Hp(e,t,0)}function WC(e,t){const r=e.pending;if(!r||t.seq!==r.seq)return{state:e,accepted:!1};const s=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:s,pending:null},accepted:!0}}function mg(e,t,r=1){const s=e.pending;return!s||s.seq!==t?{state:e,request:null,exhausted:!1}:s.attempt>=r?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...Hp(e,s,s.attempt+1),exhausted:!1}}function GC(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 VC(e){return{...e,pending:null}}const ep="termdock-settings",qC=6,ZC=100,YC='"calt" on',KC=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function XC(){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 Wp(){return{fontFamily:"var(--font-mono)",fontSize:XC(),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 Qu(e,t,r,s){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):s}function gg(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 B0(e){const t=Wp(),r=e&&typeof e=="object"?e:{},s=r.rendererMode??r.renderer;return{fontFamily:typeof r.fontFamily=="string"&&r.fontFamily.trim()?r.fontFamily.trim():t.fontFamily,fontSize:Qu(r.fontSize,qC,ZC,t.fontSize),rendererMode:s==="auto"||s==="webgl"||s==="canvas"?s:t.rendererMode,fontWeight:gg(r.fontWeight,t.fontWeight),fontWeightBold:gg(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Qu(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Qu(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Qu(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 ju(e){return e.pointerType==="touch"||e.pointerType==="pen"}class JC{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,s]of this.active)s===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,s){this.changeListeners.size!==0&&this.changeListeners.forEach(i=>{try{i({type:t,pointerId:r,handler:s})}catch{}})}log(t,r,s=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const i=performance.now().toFixed(0);console.debug(`[GestureManager ${i}] ${t} ${r} ${s}`)}}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(!ju(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let s=!1;for(const i of this.sortedHandlers()){if(!this.handlerMatchesContainer(i,t)){this.log("skip-container",i.name);continue}i.onPointerDown(t,r)&&!s&&(this.active.set(t.pointerId,i.name),s=!0,this.log("claim",i.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,i.name))}s&&t.preventDefault()};handlePointerMove=t=>{if(!ju(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const s of this.sortedHandlers()){if(!this.handlerMatchesContainer(s,t))continue;const i=this.active.get(t.pointerId)===s.name,u=s.onPointerMove(t,i);if(u==="claim"&&!r){const c=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,s.name),r=!0,t.preventDefault(),c&&c!==s.name&&this.log("handoff",`${c}->${s.name}`,`pid=${t.pointerId}`),this.log("claim",s.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,s.name)}if(u==="release"&&i&&!r){const c=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",s.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,c??null)}}};handlePointerUp=t=>{if(!ju(t))return;for(const s of this.sortedHandlers())this.handlerMatchesContainer(s,t)&&s.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(!ju(t))return;for(const s of this.sortedHandlers())this.handlerMatchesContainer(s,t)&&s.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 Vx=new JC,eS=90,tS=80,rS=70,nS=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:s=.8,boostDenominator:i=50,velocityAlpha:u=.15,maxVelocity:c=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:m=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:v,onScrollWithCoords:w,onTap:I,onClickWithCoords:k,onClaimChange:N,tapThreshold:R=10,gestureName:D="normal-scroll"}=t,P=1.06,V=_.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),F=_.useRef(0),Y=_.useRef(0),Z=_.useRef(0),he=_.useRef(null),Ee=_.useRef(0),Ie=_.useRef(!1),be=_.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),et=_.useCallback(()=>{he.current=null,F.current!==0&&(w&&Y.current>0&&Z.current>0?w(F.current,Y.current,Z.current):v&&v(F.current),F.current=0,Y.current=0,Z.current=0)},[v,w]),Pe=_.useCallback(()=>{he.current===null&&typeof window<"u"&&(he.current=window.requestAnimationFrame(et))},[et]),fe=_.useCallback((He,K,Xe)=>{F.current+=He,K!==void 0&&Xe!==void 0&&(Y.current=K,Z.current=Xe),Pe()},[Pe]),De=_.useCallback(He=>{if(!He||!v)return!1;const K=v(He);return K?Ee.current=0:Ee.current++,K},[v]),pe=_.useCallback(He=>{Ie.current!==He&&(Ie.current=He,N?.(He))},[N]),ae=_.useCallback(()=>{const He=V.current;He.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(He.rafId),He.rafId=null,he.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(he.current),he.current=null,F.current=0},[]),ce=_.useRef(I);ce.current=I;const Te=_.useRef(k);Te.current=k;const we=_.useRef(x);we.current=x;const Ge=_.useCallback(()=>{const He=e.current;if(!He||!("PointerEvent"in window))return()=>{};const K=V.current,Xe={name:D,priority:rS,get container(){return e.current??void 0},onPointerDown:(q,ye)=>(q.pointerType!=="touch"||(K.pointerId=q.pointerId,K.startX=ye.startX,K.startY=ye.startY,K.didMove=!1,K.gestureAxis=null,K.lastY=q.clientY,K.lastTime=be(),K.velocity=0,ae()),!1),onPointerMove:(q,ye)=>{if(q.pointerType!=="touch"||K.pointerId!==q.pointerId||!K.lastY||!K.lastTime)return"neutral";const Ve=q.clientX,pt=q.clientY,ht=be(),It=ht-K.lastTime,Se=pt-K.lastY;if(K.startX!==null&&K.startY!==null){const Ue=Ve-K.startX,bt=pt-K.startY;if(!K.didMove&&Math.hypot(Ue,bt)>=R&&(K.didMove=!0),K.gestureAxis===null&&K.didMove){const Ke=Math.abs(Ue),Mt=Math.abs(bt);Ke>Mt*P?K.gestureAxis="x":Mt>Ke*P&&(K.gestureAxis="y")}if(K.gestureAxis==="x")return K.isCurrentlyScrolling=!1,pe(!1),K.lastY=pt,K.lastTime=ht,ye?"release":"neutral";if(K.gestureAxis===null)return K.lastY=pt,K.lastTime=ht,"neutral"}if(K.gestureAxis==="y"&&!ye&&!(b?.()??!0))return K.lastY=pt,K.lastTime=ht,pe(!1),"neutral";const ge=Se/Math.max(It,1);if(K.velocity=K.velocity*(1-u)+ge*u,K.velocity=Math.max(-c,Math.min(c,K.velocity)),Math.abs(Se)>1){if(!ye)return pe(!0),K.lastY=pt,K.lastTime=ht,"claim";K.isCurrentlyScrolling=!0;const Ue=r+Math.min(s,Math.abs(Se)/i),bt=-Se*Ue;fe(bt,Ve,pt),pe(!0)}return K.lastY=pt,K.lastTime=ht,ye?"claim":"neutral"},onPointerUp:q=>{if(q.pointerType!=="touch"||K.pointerId!==q.pointerId)return;const ye=K.isCurrentlyScrolling;K.isCurrentlyScrolling=!1,pe(!1);const Ve=K.rafId!==null||he.current!==null;!K.didMove&&!Ve&&K.startX!==null&&K.startY!==null&&ce.current?.(K.startX,K.startY),!K.didMove&&!Ve&&K.startX!==null&&K.startY!==null&&Te.current?.(K.startX,K.startY),K.pointerId=null,K.startX=null,K.startY=null;const pt=K.gestureAxis==="x";if(K.gestureAxis=null,m&&ye&&!pt&&Math.abs(K.velocity)>h&&K.didMove){const ht=()=>{const It=be(),Se=It-(K.lastTime||It);if(K.lastTime=It,K.velocity*=Math.pow(p,Se),Math.abs(K.velocity)<h){K.velocity=0,ae();return}if(!De(-K.velocity*Se)&&Ee.current>2){K.velocity=0,ae();return}K.rafId=requestAnimationFrame(ht)};K.rafId=requestAnimationFrame(ht)}},onPointerCancel:q=>{q.pointerType!=="touch"||K.pointerId!==q.pointerId||(K.isCurrentlyScrolling=!1,pe(!1),K.pointerId=null,K.startX=null,K.startY=null,K.gestureAxis=null,ae())}},Ce=Vx.register(Xe),z=He.style.touchAction;return He.style.touchAction="none",()=>{pe(!1),Ce(),He.style.touchAction=z,ae()}},[e,D,r,s,i,u,c,h,p,be,ae,De,fe,R,m,pe,b]),ie=_.useCallback(()=>{const He=e.current;if(!He)return()=>{};const K=V.current,Xe=ye=>{ye.touches.length===1&&((x?.()??!0)&&ye.cancelable&&ye.preventDefault(),K.isCurrentlyScrolling=!1,K.gestureAxis=null,K.lastY=ye.touches[0].clientY,K.startX=ye.touches[0].clientX,K.startY=ye.touches[0].clientY,K.didMove=!1,K.velocity=0,ae())},Ce=ye=>{if(ye.touches.length!==1)return;const Ve=ye.touches[0].clientX,pt=ye.touches[0].clientY;if(K.startX!==null&&K.startY!==null){const It=Ve-K.startX,Se=pt-K.startY;if(!K.didMove&&Math.hypot(It,Se)>=R&&(K.didMove=!0),K.gestureAxis===null&&K.didMove){const ge=Math.abs(It),Ue=Math.abs(Se);ge>Ue*P?K.gestureAxis="x":Ue>ge*P&&(K.gestureAxis="y")}if(K.gestureAxis==="x"){K.isCurrentlyScrolling=!1,K.lastY=pt;return}if(K.gestureAxis===null){(x?.()??!1)&&ye.cancelable&&ye.preventDefault(),K.lastY=pt;return}}if(ye.preventDefault(),!K.lastY){K.lastY=pt;return}const ht=pt-K.lastY;if(Math.abs(ht)>1){K.isCurrentlyScrolling=!0;const It=r+Math.min(s,Math.abs(ht)/i),Se=-ht*It;fe(Se,Ve,pt)}K.lastY=pt},z=ye=>{if(!ye.changedTouches?.[0])return;const pt=K.isCurrentlyScrolling;K.isCurrentlyScrolling=!1;const ht=K.rafId!==null||he.current!==null;!K.didMove&&!ht&&I&&K.startX!==null&&K.startY!==null&&I(K.startX,K.startY),!K.didMove&&!ht&&k&&K.startX!==null&&K.startY!==null&&k(K.startX,K.startY),K.startX=null,K.startY=null;const It=K.gestureAxis==="x";if(K.gestureAxis=null,m&&pt&&!It&&K.didMove&&Math.abs(K.velocity)>h){const Se=()=>{if(K.velocity*=Math.pow(p,16),Math.abs(K.velocity)<h){K.velocity=0,ae();return}if(!De(-K.velocity*16)&&Ee.current>2){K.velocity=0,ae();return}K.rafId=requestAnimationFrame(Se)};K.rafId=requestAnimationFrame(Se)}};He.addEventListener("touchstart",Xe,{passive:!1}),He.addEventListener("touchmove",Ce,{passive:!1}),He.addEventListener("touchend",z,{passive:!1}),He.addEventListener("touchcancel",z,{passive:!1});const q=He.style.touchAction;return He.style.touchAction="none",()=>{He.removeEventListener("touchstart",Xe),He.removeEventListener("touchmove",Ce),He.removeEventListener("touchend",z),He.removeEventListener("touchcancel",z),He.style.touchAction=q,ae()}},[e,r,s,i,h,p,ae,De,fe,I,k,R,x,m]),ve=_.useCallback(()=>{ae();const He=typeof window<"u"&&"PointerEvent"in window,K=He?Ge():()=>{},Xe=He?()=>{}:ie();return()=>{K(),Xe(),ae()}},[Ge,ie,ae]),ft=_.useCallback(()=>V.current.isCurrentlyScrolling||V.current.rafId!==null||he.current!==null,[]),Rt=_.useCallback(()=>{ae();const He=V.current;He.isCurrentlyScrolling=!1,He.velocity=0,He.lastY=null,He.lastTime=null,He.startX=null,He.startY=null,He.pointerId=null,He.didMove=!1,He.gestureAxis=null},[ae]);return{setupTouchScroll:ve,isScrolling:ft,stopAllScroll:Rt}};function xg(e){const{name:t,priority:r}=e,s=T.useRef(e.onPointerDown),i=T.useRef(e.onPointerMove),u=T.useRef(e.onPointerUp),c=T.useRef(e.onPointerCancel),h=T.useRef(e.container);s.current=e.onPointerDown,i.current=e.onPointerMove,u.current=e.onPointerUp,c.current=e.onPointerCancel,h.current=e.container,T.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,b){return s.current?.(x,b)??!1},onPointerMove(x,b){return i.current?.(x,b)??"neutral"},onPointerUp(x){u.current?.(x)},onPointerCancel(x){c.current?.(x)}};return Vx.register(p)},[t,r])}var Qs;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Qs||(Qs={}));Qs.Light,Qs.Medium,Qs.Heavy,Qs.Success,Qs.Warning,Qs.Error;Qs.Light,Qs.Medium,Qs.Heavy,Qs.Success,Qs.Warning,Qs.Error;Qs.Light,Qs.Medium,Qs.Heavy,Qs.Success,Qs.Warning,Qs.Error;const sS=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",iS=()=>typeof document<"u"&&!!document.body,oS=()=>{if(iS())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{}},bg=e=>Array.isArray(e)?[...e]:[e],aS=e=>{if(sS()){try{const i=bg(e),u=i.length===1?i[0]:i;navigator.vibrate(u)}catch{}return}const t=bg(e),r=Array.from({length:Math.ceil(t.length/2)},(i,u)=>[t[u*2]??0,t[u*2+1]??0]);let s=0;for(const[i,u]of r)i>0&&setTimeout(oS,s),s+=i+u},sa=e=>aS(e),lS=({message:e})=>{const{t}=an();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e??t("terminal.loading")})]})})},cS=()=>{const{t:e}=an();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e("terminal.initializing")})]})})},uS=({message:e,onRetry:t})=>{const{t:r}=an();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:a.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:[a.jsx("title",{children:r("terminal.error")}),a.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"})]})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&a.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 hd(e){return Array.from(e)}function yg(e,t,r){return Math.max(t,Math.min(r,e))}function dS(e,t,r,s){const i=hd(e),u=hd(t);let c=yg(r,0,i.length);const h=yg(s,0,u.length);let p=0;for(;p<i.length&&p<u.length&&i[p]===u[p];)p++;let m=0;for(;m<i.length-p&&m<u.length-p&&i[i.length-1-m]===u[u.length-1-m];)m++;const x=i.length-p-m,b=u.slice(p,u.length-m).join(""),v=[];if(x>0||b){const w=p+x;c>w?v.push({left:c-w}):c<w&&v.push({right:w-c}),c=w,x>0&&(v.push({backspace:x}),c=p),b&&(v.push({insert:b}),c+=hd(b).length)}return c>h?v.push({left:c-h}):c<h&&v.push({right:h-c}),c=h,{ops:v,cursor:c}}function vg(e){const t=e.value,r=e.selectionStart??t.length;return hd(t.slice(0,r)).length}const Cd=16,hS=10,wg=1.5,fS=1.8,Ag=240,pS=125,mS=92;function gS(e,t,r){const s=Math.hypot(e,t),i=Math.abs(e),u=Math.abs(t),c=()=>i>=u*wg?e>0?"right":"left":u>=i*wg?t>0?"down":"up":"";if(r==="")return s>Cd?c():"";if(s<hS)return"";if(s<=Cd)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 m=r==="left"||r==="right";return(m?u:i)>=(m?i:u)*fS?h:r}function xS(e){const t=mS-Cd,r=Math.min(Math.max((e-Cd)/t,0),1);return Ag-r*(Ag-pS)}const bS="termdock-open-terminal-directory",tp=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,yS=new RegExp(`^( *)(${tp.source})`,"u"),vS=/[,;:!?]+$/u,wS=/^[a-z][a-z\d+.-]*:\/\//iu;function AS(e){return!e||e==="/"||wS.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function qx(e){const t=[];tp.lastIndex=0;let r;for(;(r=tp.exec(e))!==null;){const i=r[0].replace(vS,"");if(!AS(i))continue;const u=e.slice(r.index+i.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),c=u?Number(u[1]):void 0,h=c!==void 0&&Number.isSafeInteger(c)&&c>0;t.push({text:i,...h?{line:c}:{},startIndex:r.index,endIndex:r.index+i.length+(h?u[0].length:0)})}return t}function nf(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function TS(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function CS(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return nf(r);if(r==="~"||r.startsWith("~/")){const s=t?TS(t):null;return s?nf(`${s}/${r.slice(2)}`):null}return t?.startsWith("/")?nf(`${t}/${r}`):null}function Pu(e,t){const r=e.buffer.active.getLine(t-1),s=e.buffer.active.getLine(t);if(!r||!s||s.isWrapped)return null;const i=r.translateToString(!0).trimEnd(),u=s.translateToString(!0),c=qx(i).at(-1),h=u.match(yS);if(!c||c.endIndex!==i.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 m=r.length-1;for(;m>=0&&!(r.getCell(m)?.getChars()||"").trim();)m-=1;const x=h[1].length;let b=0;for(let k=x;k<s.length;k+=1){const N=s.getCell(k);if(N?.getWidth()!==0){if(!N||/[\s/:]/u.test(N.getChars()||" "))break;b+=N.getWidth()}}if(r.length-m-1>=Math.max(8,x+2,b))return null;const w=r.getCell(m),I=s.getCell(x);return!w||!I||w.isFgDefault()||I.isFgDefault()||w.getFgColorMode()!==I.getFgColorMode()||w.getFgColor()!==I.getFgColor()?null:x}function SS(e,t){const r=e.buffer.active;let s=t-1;if(!r.getLine(s))return null;for(;s>0&&(r.getLine(s)?.isWrapped||Pu(e,s)!==null);)s-=1;let i=t-1;for(;i+1<r.length&&(r.getLine(i+1)?.isWrapped||Pu(e,i+1)!==null);)i+=1;let u="";const c=[],h=[];for(let m=s;m<=i&&u.length<=2048;m+=1){const x=r.getLine(m);if(!x)break;const b=m>s?Pu(e,m)??0:0;let v=x.length;if(m<i&&Pu(e,m+1)!==null)for(;v>0&&!(x.getCell(v-1)?.getChars()||"").trim();)v-=1;for(let w=b;w<v;w+=1){const I=x.getCell(w);if(!I||I.getWidth()===0)continue;const k=I.getChars()||" ";u+=k;for(let N=0;N<k.length;N+=1)c.push({x:w+1,y:m+1}),h.push({x:w+Math.max(1,I.getWidth()),y:m+1})}}const p=u.trimEnd().length;return{text:u.slice(0,p),startPositions:c.slice(0,p),endPositions:h.slice(0,p)}}function _S(e,t){return{provideLinks(r,s){const i=SS(e,r);if(!i){s(void 0);return}const u=qx(i.text).map(c=>({text:c.text,range:{start:i.startPositions[c.startIndex]??{x:c.startIndex+1,y:r},end:i.endPositions[c.endIndex-1]??{x:c.endIndex,y:r}},activate:()=>c.line===void 0?t(c.text):t(c.text,c.line)}));s(u.length>0?u:void 0)}}}function Tg(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const r=Math.floor(t),s=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let i=0;if(s!==null){const p=Math.max(0,s-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++)}let u=Math.max(0,Math.floor(e.ybase)+r),c=s===null?u:Math.min(u,s),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)),i++),u=Math.max(0,Math.floor(e.ybase)+r),c=s===null?u:Math.min(u,s),h=Math.max(0,c-e.lines.length)}for(let p=0;p<h;p++){const m=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=m)break;i++}return i}function Cg(e,t=e.rows){const s=e._core?._bufferService?.buffers;return s?Tg(s.normal,t)+Tg(s.alt,t):0}function Ou(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function LS(e,t,r){const s=Ou(e.fontBoundingBoxAscent)+Ou(e.fontBoundingBoxDescent),i=Ou(e.actualBoundingBoxAscent)+Ou(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(s||i||t)*r))}const jl=8,Fu=36,Sg=10,IS=1.08,kS=1.16,Uu=6,ES=.94,RS=.08,MS=.12,NS=88,DS=36,BS=10,QS=14,jS=52;function wc(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 PS=80,OS=8;function $u(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function FS(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function US(e){try{const t=atob(e),r=Uint8Array.from(t,s=>s.charCodeAt(0));return new TextDecoder("utf-8").decode(r)}catch{return null}}function $S(e){const t="\x1B]52;";let r=0,s="";for(;r<e.length;){const i=e.indexOf(t,r);if(i===-1)return s+=e.slice(r),{cleaned:s,remainder:""};s+=e.slice(r,i);let u=-1,c=1;for(let m=i+t.length;m<e.length;m+=1){const x=e.charCodeAt(m);if(x===7){u=m,c=1;break}if(x===27&&m+1<e.length&&e[m+1]==="\\"){u=m,c=2;break}}if(u===-1)return{cleaned:s,remainder:e.slice(i)};const h=e.slice(i+t.length,u),p=h.indexOf(";");if(p>=0){const m=h.slice(p+1);if(m&&m!=="?"){const x=US(m);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=u+c}return{cleaned:s,remainder:""}}function zS(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const s of t){const u=window.getComputedStyle(s).overflowY;if(!(u!=="auto"&&u!=="scroll")){if(s.scrollHeight-s.clientHeight>2)return s;r||(r=s)}}return r}const HS=new Set(["visibility","bfcache","online"]),WS=5e5,GS=1e5,Ac=260,Tc=140,_g=80;function VS(e){return!e}let w0=null;const qS=[{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:"⏺⏸⏹✓✗"}],ZS=()=>{if(w0)return w0;if(typeof document>"u"||!("fonts"in document))return w0=Promise.resolve(),w0;const e=document.fonts;return w0=Promise.allSettled(qS.map(({font:r,text:s})=>e.load(r,s))).then(()=>e.ready).then(()=>{}).catch(()=>{}),w0},Lg=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 Ig(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Pl(e,t,r){const s=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(s||t*r))}function YS(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 kg=new Map;function KS(e,t,r,s,i){if(typeof window>"u"||typeof document>"u")return null;const u=e.getBoundingClientRect();if(u.width<24||u.height<24)return null;const c=window.devicePixelRatio||1,h=`${r}::${s}::${i}::${c}::${t}`;let p=kg.get(h);if(!p)try{const v=document.createElement("canvas").getContext("2d");if(!v)return null;v.font=`${r}px ${t}`;const w=v.measureText("M"),k=(Math.floor(w.width*c)+Math.round(s))/c,N=LS(w,r,i);k>=1&&N>=1&&(p={cellWidth:k,cellHeight:N},kg.set(h,p))}catch{return null}if(!p)return null;const m=Math.max(2,Math.floor(u.width/p.cellWidth)),x=Math.max(2,Math.floor(u.height/p.cellHeight));return!Number.isFinite(m)||!Number.isFinite(x)?null:{cols:m,rows:x}}async function Eg(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 XS(e){const t=e.buffer.active,r=t.viewportY,s=Math.min(t.length,r+e.rows),i=[];for(let u=r;u<s;u+=1){const c=t.getLine(u);c&&i.push(c.translateToString(!0))}return i.join(`
65
- `).replace(/\s+$/g,"")}function Cc(e,t,r){const s=ql(e);if(!s)return null;const i=Math.max(0,Math.min(e.cols-1,Math.floor((t-s.originLeft)/s.cellW))),u=Math.max(0,Math.min(e.rows-1,Math.floor((r-s.originTop)/s.cellH)));return{col:i,row:e.buffer.active.viewportY+u}}function sf(e,t,r){const s=t.row*e.cols+t.col,i=r.row*e.cols+r.col;if(s===i)return e.clearSelection(),!1;const u=Math.min(s,i),c=Math.max(s,i)+1,h=u%e.cols,p=Math.floor(u/e.cols);return e.select(h,p,c-u),!0}function Rg(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function JS(e,t,r,s,i=!0){if(typeof window>"u")return{left:0,top:0};const u=window.visualViewport,c=u?.offsetLeft??0,h=u?.offsetTop??0,p=u?.width??window.innerWidth,m=u?.height??window.innerHeight,x=Rg("--safe-top-inset"),b=Rg("--safe-bottom-inset"),v=s?LC(s.terminal,s.anchor,s.focus):null,w=[];let I;if(i&&w.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),s){const N=ql(s.terminal),{start:R,end:D}=Td(s.anchor,s.focus,s.terminal.cols),P=dd(s.terminal,R),V=dd(s.terminal,D);if(P&&w.push({left:P.x-24,top:P.y-48,right:P.x+24,bottom:P.y+4}),V&&N){const F=V.y+N.cellH;w.push({left:V.x-24,top:F-4,right:V.x+24,bottom:F+48})}if(v){const F=s.anchor.row*s.terminal.cols+s.anchor.col,Y=s.focus.row*s.terminal.cols+s.focus.col,Z=F<=Y,he=v.right-v.left,Ie=s.anchor.row===s.focus.row?Z?v.left+he*.25:v.right-he*.25:(v.left+v.right)/2,be=dd(s.terminal,s.focus),et=be&&N?be.y+N.cellH/2:t;I={vertical:s.focus.row<s.anchor.row?"below":"above",alignX:Ie,focusX:be?.x??e,focusY:et}}}const k=IC({clientX:e,clientY:t,viewport:{left:c,top:h+x,right:c+p,bottom:h+m-b},terminal:r,width:NS,height:DS,margin:BS,fingerGap:QS,selection:v,avoid:w,preference:I,selectionGap:jS});return{left:k.left-r.left,top:k.top-r.top}}const Zx=_.forwardRef(({sessionKey:e,isLayoutVisible:t=!0,chunks:r,onInput:s,onResize:i,onFlowControl:u,onTmuxScroll:c,tmuxScrollSensitivity:h=.55,onDoubleTap:p,onInputFocusChange:m,onMobileLongPressCopyResult:x,onMobilePasteResult:b,onReadyChange:v,onSizeSynchronizedChange:w,onWritesSettled:I,onWriteProgress:k,onCursorPositionChange:N,onDirectoryLinkActivate:R,terminalSettings:D,theme:P,className:V,enableTouchScroll:F,mobileLongPressMode:Y="arrows",autoFocus:Z=!0,cursorVisible:he=!0,suppressSmoothScroll:Ee=!1},Ie)=>{const{t:be}=an(),et=_.useRef(null),Pe=_.useRef(null),fe=_.useRef(null),De=_.useRef(null),pe=_.useRef(null),ae=_.useRef(Ee);ae.current=Ee;const ce=_.useRef(null),Te=_.useRef(s),we=_.useRef(i),Ge=_.useRef(m),ie=_.useRef(u),ve=_.useRef(v);ve.current=v;const ft=_.useRef(w);ft.current=w;const Rt=_.useRef(I);Rt.current=I;const He=_.useRef(k);He.current=k;const K=_.useRef(N);K.current=N;const Xe=_.useRef(R);Xe.current=R;const Ce=_.useRef(D.rendererMode),z=_.useRef(""),q=_.useRef(0),ye=_.useRef(!1),Ve=_.useRef(null),pt=_.useRef(0),ht=_.useRef(0),It=_.useRef(!1),Se=_.useRef(null),ge=_.useRef(null),Ue=_.useRef(()=>{}),bt=_.useRef(null),Ke=_.useRef(null),Mt=_.useRef(void 0),We=_.useRef(null),vt=_.useRef(!1),ir=_.useRef(0),it=_.useRef(""),dt=_.useRef(null),Bt=_.useRef(null),Et=_.useRef(!1),Vt=_.useRef(typeof window<"u"?window.devicePixelRatio:1),te=_.useRef(!1),Qe=_.useRef(!1),qe=_.useRef(null),kt=_.useRef(""),Oe=_.useRef(0),Nt=_.useRef(null),hr=_.useRef(null),Ae=_.useRef(null),bn=_.useRef(0),_r=_.useRef(0),_e=_.useRef(0),Qr=_.useRef(null),wt=_.useRef(0),en=_.useRef(0),Er=_.useRef(!1),le=_.useRef(0),[,st]=_.useReducer(L=>L+1,0),[Ut,lr]=_.useReducer(L=>L+1,0),[Zt,Qt]=_.useState("loading"),[re,br]=_.useState(null),[ct,jn]=_.useState(null);_.useEffect(()=>{const L=Q=>{(Q.target instanceof Element?Q.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&jn(String(Q.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const dr=_.useMemo(()=>j0("terminal"),[]),[js,qs]=_.useState(!0),[fs,Cn]=_.useState(!1);_.useEffect(()=>{if(!js&&Zt!=="loading"){Cn(!1);return}const L=window.setTimeout(()=>Cn(!0),160);return()=>window.clearTimeout(L)},[js,Zt]);const[ns,zn]=_.useState(!1),[Mn,ws]=_.useState({visible:!1,activeDir:""}),[Hn,tn]=_.useState(null),Pn=_.useRef(null),Gr=_.useRef(!1),Cr=_.useRef({active:!1,anchor:null,focus:null,dragging:null}),[dn,wr]=_.useState(null),[hn,jt]=_.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),jr=_.useRef(hn);jr.current=hn;const Ar=_.useRef(null),[fn,ss]=_.useState({active:!1,text:""}),Yn=_.useRef(null),yn=_.useRef(null);Te.current=s,we.current=i,Ge.current=m,ie.current=u,Ce.current=D.rendererMode;const Yr=_.useRef(Z);Yr.current=Z;const Fr=_.useRef(he);Fr.current=he;const On=_.useRef(F);On.current=F;const As=_.useRef(t);As.current=t;const eo=VS(!!c),{rendererMode:Rr,fontFamily:H,fontSize:se,fontWeight:$e,fontWeightBold:ke,letterSpacing:ze,lineHeight:Ze,minimumContrastRatio:xt,drawBoldTextInBrightColors:tt,unicodeVersion:Re,customGlyphs:ot,rescaleOverlappingGlyphs:pr,fontLigatures:At,enableImages:Yt,smoothScrolling:at}=D,Xt=Rr==="webgl",$t=_.useCallback(()=>{Pn.current!==null&&(clearTimeout(Pn.current),Pn.current=null),tn(null)},[]),Ft=_.useCallback((L,Q)=>{Pn.current!==null&&(clearTimeout(Pn.current),Pn.current=null),Gr.current=!1,tn(L),!Q?.persistent&&(Pn.current=setTimeout(()=>{Pn.current=null,tn(null)},3e3))},[]);_.useEffect(()=>{if(!Hn)return;const L=()=>{Cr.current.active||$t()},Q=()=>$t();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",Q),document.addEventListener("visibilitychange",Q),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",Q),document.removeEventListener("visibilitychange",Q)}},[$t,Hn]),_.useEffect(()=>()=>{Pn.current!==null&&(clearTimeout(Pn.current),Pn.current=null)},[]);const Jt=_.useCallback(()=>{const L=fe.current,Q=et.current,j=Cr.current;if(!L||!Q||!j.active||!j.anchor||!j.focus){wr(null);return}const W=Q.getBoundingClientRect(),Le=ql(L)?.cellH??16,{start:xe,end:Je}=Td(j.anchor,j.focus,L.cols),Ye=j.dragging==="start"?j.focus:j.dragging==="end"?j.anchor:xe,Ct=j.dragging==="end"?j.focus:j.dragging==="start"?j.anchor:Je,xr=(Jr,ln)=>{const pn=dd(L,Jr);return pn?{left:pn.x-W.left,top:ln?pn.y-W.top:pn.y+Le-W.top}:null};wr({start:xr(Ye,!0),end:xr(Ct,!1)})},[]),Kn=_.useCallback(L=>{const Q=fe.current,j=et.current,W=Cr.current;if(!Q||!j||!W.active||!W.anchor||!W.focus)return;if(W.dragging){$t();return}const Le=j.getBoundingClientRect(),xe={x:(Le.left+Le.right)/2,y:(Le.top+Le.bottom)/2};Ft(JS(L?.x??xe.x,L?.y??xe.y,Le,{terminal:Q,anchor:W.anchor,focus:W.focus},L!==void 0),{persistent:!0})},[$t,Ft]),Xn=_.useCallback(()=>{const L=Cr.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,wr(null),$t()},[$t]);_.useEffect(()=>{if(!dn)return;const L=fe.current;if(!L)return;const Q=L.onScroll(()=>{Jt(),Kn()}),j=L.onResize(()=>Xn());return()=>{Q.dispose(),j.dispose()}},[dn,Jt,Kn,Xn]),_.useEffect(()=>{F||Ge.current?.(!1)},[F]);const Vr=_.useCallback((L,Q,j)=>{const W=(j.element?.offsetWidth||0)/j.cols||8,Le=(j.element?.offsetHeight||0)/j.rows||16,xe=Math.max(1,Math.min(j.cols,Math.floor(L/W)+1)),Je=Math.max(1,Math.min(j.rows,Math.floor(Q/Le)+1));return{x:xe,y:Je}},[]),Os=_.useCallback((L,Q,j)=>{const W=fe.current;if(!W)return!1;const Le=L>0?-1:1;if(W.modes?.mouseTrackingMode!=="none"){let xe,Je;if(Q!==void 0&&j!==void 0){const xr=Vr(Q,j,W);xe=xr.x,Je=xr.y}else xe=W.buffer.active.cursorX+1,Je=W.buffer.active.cursorY+1;const Ct=`\x1B[<${Le>0?64:65};${xe};${Je}M`;return Te.current(Ct),!0}if(W.buffer.active.type==="alternate"){const xe=Le>0?"\x1B[A":"\x1B[B";return Te.current(xe),!0}return null},[Vr]),Fs=_.useCallback(L=>{const Q=fe.current;if(!Q)return!1;const j=Pl(fe.current,se,Ze),W=ir.current+L,Le=Math.trunc(W/j);return ir.current=W-Le*j,Le!==0?(Q.scrollLines(Le),!0):!1},[se,Ze]),co=_.useCallback(L=>{if(!fe.current)return!1;const W=Pl(fe.current,se,Ze)/Math.max(.1,h),Le=ir.current+L;let xe=Math.trunc(Le/W);if(ir.current=Le-xe*W,xe===0&&Math.abs(Le)>=W/3&&(xe=Le>0?1:-1,ir.current=0),xe===0)return!1;const Je=xe>0?"down":"up",Ye=Math.max(1,Math.min(Math.abs(xe),10));return c(Je,Ye),!0},[se,Ze,c,h]),vn=_.useRef(Os);vn.current=Os;const rn=_.useRef(Fs);rn.current=Fs;const Ur=_.useRef(co);Ur.current=co;const Nn=_.useRef(c);Nn.current=c;const Sn=_.useRef({pointerId:null,tmuxActiveAtDown:!1});_.useEffect(()=>{if(!F)return;const L=et.current;if(!L)return;const Q=W=>{W.pointerType==="touch"&&(Sn.current.pointerId=W.pointerId,Sn.current.tmuxActiveAtDown=!!Nn.current)},j=W=>{W.pointerType==="touch"&&Sn.current.pointerId===W.pointerId&&(Sn.current.pointerId=null,Sn.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",Q,{capture:!0,passive:!0}),L.addEventListener("pointerup",j,{capture:!0,passive:!0}),L.addEventListener("pointercancel",j,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",Q,!0),L.removeEventListener("pointerup",j,!0),L.removeEventListener("pointercancel",j,!0)}},[F]);const Zs=_.useCallback(()=>{if(Er.current)return!1;const L=Sn.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!Nn.current},[]),Jn=_.useCallback((L,Q,j)=>{const W=vn.current(L,Q,j);return W!==null?W:Nn.current?Ur.current(L):rn.current(L)},[]),Us=_.useCallback((L,Q)=>{if(performance.now()<=en.current){en.current=0;return}const j=fe.current;if(j&&j.modes?.mouseTrackingMode!=="none"){const W=Vr(L,Q,j),Le=W.x,xe=W.y,Je=`\x1B[<0;${Le};${xe}M`,Ye=`\x1B[<0;${Le};${xe}m`;Te.current(Je),Te.current(Ye)}},[Vr]),Lr=_.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),qr=_.useCallback((L=700)=>{Qr.current=null,wt.current=Lr()+L},[Lr]),is=_.useCallback(()=>On.current&&Lr()<=wt.current,[Lr]),O=_.useCallback(()=>{const L=Ke.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),J=_.useCallback(()=>{if(typeof window>"u")return!1;const L=Ye=>{if(typeof document>"u")return 0;const Ct=Number.parseFloat(document.documentElement.style.getPropertyValue(Ye)||"0");return Number.isFinite(Ct)?Ct:0},Q=L("--kb-height");if(Q>0)return Q>=_g;const j=window.visualViewport;if(!j)return!1;const W=L("--app-base-vh")||window.innerHeight,Le=L("--safe-bottom-inset"),xe=j.height+j.offsetTop;return Math.max(0,Math.round(W-xe-Le))>=_g},[]),ue=_.useCallback(()=>{Nt.current!==null&&(clearTimeout(Nt.current),Nt.current=null),hr.current=null},[]),Be=_.useCallback(L=>{const Q=fe.current;let j="";for(const W of L)W.left&&(j+=(Q?$u(Q,"D"):"\x1B[D").repeat(W.left)),W.right&&(j+=(Q?$u(Q,"C"):"\x1B[C").repeat(W.right)),W.backspace&&(j+="".repeat(W.backspace)),W.insert&&(j+=W.insert);return j},[]),Tt=_.useCallback(L=>{const Q=L.value,j=wc(Q),W=kt.current;if(!(On.current&&!j.includes("\r")&&!W.includes("\r"))){if(j===W)return;let xr=0;for(;xr<W.length&&xr<j.length&&W[xr]===j[xr];)xr++;const Jr=W.length-xr;Jr>0&&Te.current("".repeat(Jr));const ln=j.slice(xr);if(ln){try{fe.current?.clearSelection()}catch{}Te.current(ln)}kt.current=j,Oe.current=Array.from(j).length;return}const xe=vg(L),{ops:Je,cursor:Ye}=dS(W,j,Oe.current,xe),Ct=Be(Je);if(Ct){if(Je.some(xr=>xr.insert))try{fe.current?.clearSelection()}catch{}Te.current(Ct)}kt.current=j,Oe.current=Ye},[Be]),_t=_.useCallback((L,Q)=>{const j=L.value,W=wc(j),Le=kt.current;if(W===Le){ue();return}let xe=0;for(;xe<Le.length&&xe<W.length&&Le[xe]===W[xe];)xe++;const Je=Le.length-xe;if(F&&!Q?.immediate&&Je>=OS){hr.current=L,Nt.current!==null&&clearTimeout(Nt.current),Nt.current=setTimeout(()=>{Nt.current=null;const Ct=hr.current;hr.current=null,Ct&&Tt(Ct)},PS);return}ue(),Tt(L)},[ue,F,Tt]),er=_.useCallback(L=>{_t(L,{immediate:!0}),Te.current("\r"),L.value="",kt.current="",Oe.current=0},[_t]),ut=_.useCallback((L,Q,j)=>{if(!L)return;ue();const W=Q??Ke.current;W&&(W.value=""),kt.current="",Oe.current=0;try{fe.current?.clearSelection()}catch{}if(Xn(),j?.paste&&/[\r\n]/.test(L)){const Le=j.submitAfterPaste??L.endsWith("\r"),xe=MC(L,Le);Te.current(xe,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier});return}Te.current(L,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier})},[ue]),Lt=_.useCallback((L,Q)=>{const j=wc(L);return j?(jn(null),J1(j)||(ut(j,Q,{paste:!0,submitAfterPaste:!1}),$t()),!0):!1},[$t,ut]);_.useEffect(()=>u7(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const Q=L.paths.map(rd).join(" ");ut(`${Q} `);try{Ke.current?.focus({preventScroll:!0})}catch{}}),[ut,e]);const Pr=_.useCallback(async(L,Q)=>{jn(null);try{const j=await kw(L);return J1(`${rd(j)} `)||(ut(`${rd(j)} `,Q),$t()),!0}catch(j){return jn(j instanceof Error?j.message:"Image upload failed"),!1}},[$t,ut]),yr=_.useCallback(async L=>{jn(null);try{if(!Vs()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const W=await navigator.clipboard.read(),Le=await Am({read:async()=>W});if(Le)return Pr(Le,L);for(const xe of W){if(!xe.types.includes("text/plain"))continue;const Je=await(await xe.getType("text/plain")).text();return Lt(Je,L)}return!1}return navigator.clipboard?.readText?Lt(await navigator.clipboard.readText(),L):!1}const Q=await Am(navigator.clipboard);if(Q)return Pr(Q,L);if(!navigator.clipboard?.readText)return!1;const j=await navigator.clipboard.readText();return Lt(j,L)}catch(Q){return jn(Q instanceof Error?Q.message:"Clipboard read failed"),!1}},[Pr,Lt]),Hr=_.useCallback(L=>{if(Ar.current&&!L?.repositionFrozen)return null;const Q=fe.current;if(!Q||!Q.element)return null;const j=ql(Q),Le=Q.element.querySelector(".xterm-screen")??Q.element,xe=Le.getBoundingClientRect(),Je=j?.cellW??(xe.width>0&&Q.cols>0?xe.width/Q.cols:8),Ye=j?.cellH??(xe.height>0&&Q.rows>0?xe.height/Q.rows:17),Ct=Ke.current;let xr=Mt.current;Ct&&(xr===void 0||xr!==null&&(!xr.isConnected||!xr.contains(Ct)))&&(xr=EC(Ct),Mt.current=xr);const Jr=Q.buffer.active,ln=Jr.cursorX*Je,pn=Jr.cursorY*Ye,ur=RC(Le,xr??null,ln,pn),Or=Math.round(ur.x),Vn=Math.round(ur.y),xs={x:Or,y:Vn,cellW:Je,cellH:Ye,cursorX:Jr.cursorX};return jr.current=xs,Ar.current&&L?.repositionFrozen&&(Ar.current={...xs}),jt(ho=>Math.abs(ho.x-Or)<.5&&Math.abs(ho.y-Vn)<.5&&Math.abs(ho.cellW-Je)<.5&&Math.abs(ho.cellH-Ye)<.5&&ho.cursorX===Jr.cursorX?ho:xs),xs},[]),Tr=_.useRef(Hr);Tr.current=Hr,_.useEffect(()=>{if(!F)return;let L=null,Q=null;const j=()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),L=window.requestAnimationFrame(()=>{L=null,Q=window.requestAnimationFrame(()=>{Q=null,Tr.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",j),window.visualViewport?.addEventListener("scroll",j),document.addEventListener("termdock:viewport-keyboard-change",j),()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),window.visualViewport?.removeEventListener("resize",j),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("termdock:viewport-keyboard-change",j)}},[F]);const Fn=_.useCallback(L=>{let Q=0;for(const j of L){const W=j.codePointAt(0)??0,Le=W>=4352&&W<=4447||W>=11904&&W<=12350||W>=12353&&W<=13311||W>=13312&&W<=19903||W>=19968&&W<=40959||W>=40960&&W<=42191||W>=44032&&W<=55203||W>=63744&&W<=64255||W>=65072&&W<=65103||W>=65280&&W<=65376||W>=65504&&W<=65510||W>=127744&&W<=129791;Q+=Le?2:1}return Q},[]),wn=_.useCallback(L=>{const Q=fe.current,{cellW:j,cellH:W}=hn;if(!Q||!L)return{width:Math.max(1,Math.round(j)),height:Math.max(1,Math.round(W)),whiteSpace:"pre"};const xe=Ar.current?.cursorX??Q.buffer.active.cursorX,Je=Math.max(1,Q.cols),Ye=Math.max(1,Fn(L)),Ct=Math.max(1,Je-xe);if(Ye<=Ct)return{width:Math.max(1,Math.round(Ye*j)),height:Math.max(1,Math.round(W)),whiteSpace:"pre"};const xr=Ye-Ct,ln=1+Math.ceil(xr/Je);return{width:Math.max(1,Math.round(Ct*j)),height:Math.max(1,Math.round(ln*W)),whiteSpace:"pre-wrap"}},[hn,Fn]),Ts=_.useCallback(()=>{Mt.current=void 0;const L=Tr.current();Ar.current={...L??jr.current}},[]),tr=_.useCallback(()=>{Ar.current=null},[]),Pt=_.useCallback(L=>{if(!te.current&&Ar.current===null)return!1;if(te.current=!1,Ar.current=null,ue(),qe.current!==null&&(clearTimeout(qe.current),qe.current=null),Qe.current=!1,L){L.value=kt.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return ss(Q=>Q.active||Q.text?{active:!1,text:""}:Q),!0},[ue]),cr=_.useCallback((L,Q)=>{const j=Ke.current;if(j)try{j.removeAttribute("readonly");const Le=typeof document<"u"&&document.activeElement===j&&!J(),xe=Lr(),Je=xe-le.current;le.current=xe,Le&&Je>600?(j.blur(),j.removeAttribute("readonly"),j.focus(),le.current=Lr()):j.focus()}catch{}},[J,Lr]),Ir=_.useCallback(L=>{_r.current=Lr()+L},[Lr]),Wt=_.useCallback(()=>F?Lr()<=_r.current:!1,[F,Lr]),Kt=_.useCallback(L=>{Ir(L),_e.current=Lr()},[Ir,Lr]),nn=_.useCallback(()=>{F&&Ke.current?.removeAttribute("readonly")},[F]),ps=_.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),[]),Kr=_.useCallback(L=>{if(nn(),Kt(Ac),!F||L.pointerType!=="touch"){Qr.current=null;return}const Q=L.target;if(ps(Q)){qr();return}Hn&&!(Q instanceof HTMLElement&&Q.closest('[data-terminal-copy-popover="true"]'))&&$t(),Qr.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[$t,F,Kt,ps,Hn,nn,qr]),Cs=_.useCallback(L=>{Kt(Ac);const Q=Qr.current;!Q||Q.pointerId!==L.pointerId||Math.hypot(L.clientX-Q.startX,L.clientY-Q.startY)>12&&(Q.moved=!0)},[Kt]),Wn=_.useCallback(L=>{Kt(Tc);const Q=Qr.current;Qr.current=null,!(!F||L.pointerType!=="touch")&&(!Q||Q.pointerId!==L.pointerId||Q.moved||is()||cr(L.clientX,L.clientY))},[F,Kt,cr,is]),An=_.useCallback(()=>{Qr.current=null,Kt(Tc)},[Kt]),$s=_.useMemo(()=>({enableKinetic:!0}),[]),Ho=_.useRef(()=>!1),ca=_.useRef(cr);ca.current=cr;const Ao=_.useCallback((L,Q)=>{is()||ca.current(L,Q)},[is]),Wo=_.useRef(p);Wo.current=p;const ua=_.useRef(x);ua.current=x;const to=_.useRef(b);to.current=b;const da=_.useCallback(()=>{if(Gr.current)return;Gr.current=!0,qr();const L=fe.current,Q=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}Ya.flushSync(()=>{Xn()}),(async()=>{const j=await Eg(Q);ua.current?.(j)})()},[Xn,qr]),ha=_.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:Go,stopAllScroll:Ss}=nS(et,{...$s,shouldCaptureTouch:Ho.current,canStartScrollGesture:Zs,onScroll:Jn,onScrollWithCoords:Jn,onClickWithCoords:Us,onTap:Ao,onClaimChange:ha,tapThreshold:12,gestureName:`normal-scroll:${e}`});_.useEffect(()=>{if(!F)return;Ke.current?.setAttribute("readonly","");const L=Go();return()=>{L()}},[F,Go]),_.useEffect(()=>{if(!F)return;let L=J();const Q=()=>{const j=J();if(L&&!j){const W=Ke.current;W&&typeof document<"u"&&document.activeElement===W&&(W.setAttribute("readonly",""),W.blur())}L=j};return window.visualViewport?.addEventListener("resize",Q),window.visualViewport?.addEventListener("scroll",Q),document.addEventListener("termdock:viewport-keyboard-change",Q),()=>{window.visualViewport?.removeEventListener("resize",Q),window.visualViewport?.removeEventListener("scroll",Q),document.removeEventListener("termdock:viewport-keyboard-change",Q)}},[F,J]),_.useEffect(()=>{if(!F)return;const L=et.current;if(!L)return;const Q=W=>{const xe=W.sourceCapabilities?.firesTouchEvents===!0,Je=Lr()-_e.current<=1200;return!xe&&!Je?!1:L.contains(W.target)},j=W=>{Q(W)&&(W.cancelable&&W.preventDefault(),W.stopImmediatePropagation(),W.stopPropagation())};return L.addEventListener("mousedown",j,{capture:!0,passive:!1}),L.addEventListener("mouseup",j,{capture:!0,passive:!1}),L.addEventListener("click",j,{capture:!0,passive:!1}),document.addEventListener("mouseup",j,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",j,!0),L.removeEventListener("mouseup",j,!0),L.removeEventListener("click",j,!0),document.removeEventListener("mouseup",j,!0)}},[F,Lr]);const zs=_.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),_s=_.useCallback(()=>{const L=zs.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),Vo=_.useCallback((L,Q,j)=>{const W=fe.current;if(!W||!W.element||!W.cols||!W.rows)return null;const Le=zs.current,xe=W.element.getBoundingClientRect(),Je=Q??Le.lastX??xe.left+xe.width/2,Ye=j??Le.lastY??xe.top+xe.height/2,Ct=Je-xe.left,xr=Ye-xe.top,Jr=W.element.offsetWidth/W.cols||8,ln=W.element.offsetHeight/W.rows||16,pn=Math.max(1,Math.min(W.cols,Math.floor(Ct/Jr)+1)),ur=Math.max(1,Math.min(W.rows,Math.floor(xr/ln)+1));return`\x1B[<${L==="up"?64:65};${pn};${ur}M`},[]),ms=_.useCallback((L,Q,j,W)=>{if(Q<=0)return;const Le=Vo(L,j,W);Le&&Te.current(Q===1?Le:Le.repeat(Q))},[Vo]),Ka=_.useRef(ms);Ka.current=ms;const ro=_.useRef(()=>{}),Ma=_.useCallback(()=>{const Q=Pl(fe.current,se,Ze)/Math.max(.1,h),j=1+zs.current.instantSpeed*.1;return Q/Math.min(6,j)},[se,Ze,h]),Si=_.useCallback(()=>{const L=zs.current;L.rafId=null;const Q=Ma();let j=0,W=0;for(;j+W<Uu&&L.remainder>=Q;)L.remainder-=Q,W++;for(;j+W<Uu&&L.remainder<=-Q;)L.remainder+=Q,j++;if(W>0&&ms("down",W),j>0&&ms("up",j),j+W>0)L.rafId=requestAnimationFrame(Si);else if(L.pointerId!==null&&Math.abs(L.remainder)>=Q/3){const xe=L.remainder>0?"down":"up";L.remainder=0,ms(xe,1),L.rafId=requestAnimationFrame(Si)}},[Ma,ms]),To=_.useCallback(()=>{const L=zs.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(Si))},[Si]),Xa=_.useCallback(L=>{if(L.pointerType!=="touch")return!1;_s();const Q=zs.current;return Q.pointerId=L.pointerId,Q.lastX=L.clientX,Q.lastY=L.clientY,Q.startX=L.clientX,Q.startY=L.clientY,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.instantSpeed=0,Q.didScroll=!1,!1},[_s]),fa=_.useCallback((L,Q)=>{if(Er.current)return Q?"release":"neutral";if(performance.now()<=en.current)return"neutral";const j=zs.current;if(L.pointerType!=="touch"||L.pointerId!==j.pointerId||j.lastY==null)return"neutral";if(j.gestureAxis===null&&j.startX!==null&&j.startY!==null){const xe=Math.abs(L.clientX-j.startX),Je=Math.abs(L.clientY-j.startY);if(xe>Sg||Je>Sg){if(xe>Je*IS)return j.gestureAxis="x","release";Je>xe*kS&&(j.gestureAxis="y")}}if(j.gestureAxis==="x")return j.lastX=L.clientX,j.lastY=L.clientY,"release";if(j.gestureAxis===null)return j.lastX=L.clientX,j.lastY=L.clientY,"neutral";const W=L.clientY-j.lastY;j.lastX=L.clientX,j.lastY=L.clientY;const Le=-W;if(j.remainder+=Le,j.instantSpeed=Math.abs(Le),j.velocity=j.velocity*.45+Le*.55,Q){const Je=Pl(fe.current,se,Ze)/Math.max(.1,h);Math.abs(j.remainder)>=Je/3&&(j.didScroll=!0,To())}return"claim"},[se,Ze,h,To]),Na=_.useCallback(L=>{const Q=zs.current;if(L.pointerType!=="touch"||L.pointerId!==Q.pointerId)return;if(_s(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.instantSpeed=0,Q.gestureAxis==="x"){Q.gestureAxis=null;return}Q.gestureAxis=null;const W=Pl(fe.current,se,Ze)/Math.max(.1,h);if(Q.didScroll&&Math.abs(Q.velocity)>W*RS){const Le=()=>{Q.velocity*=ES,Q.remainder+=Q.velocity;const xe=1+Math.abs(Q.velocity)*.1,Je=W/Math.min(6,xe);if(Math.abs(Q.velocity)<W*MS){if(Math.abs(Q.remainder)>=Je/3){const xr=Q.remainder>0?"down":"up";ms(xr,1),Q.remainder=0}Q.velocity=0,Q.rafId=null;return}let Ye=0,Ct=0;for(;Ye+Ct<Uu&&Q.remainder>=Je;)Q.remainder-=Je,Ct++;for(;Ye+Ct<Uu&&Q.remainder<=-Je;)Q.remainder+=Je,Ye++;Ct>0&&ms("down",Ct),Ye>0&&ms("up",Ye),Q.rafId=requestAnimationFrame(Le)};Q.rafId=requestAnimationFrame(Le)}else Math.abs(Q.remainder)>=W/3&&To();Q.didScroll&&L.stopImmediatePropagation()},[_s,ms,To,h,se,Ze]),Da=_.useCallback(L=>{const Q=zs.current;L.pointerType!=="touch"||L.pointerId!==Q.pointerId||(_s(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.didScroll=!1)},[_s]);xg({name:`tmux-scroll:${e}`,priority:tS,container:()=>et.current,onPointerDown:F&&c?Xa:void 0,onPointerMove:F&&c?fa:void 0,onPointerUp:F&&c?Na:void 0,onPointerCancel:F&&c?Da:void 0});const Ys=_.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}),qo=_.useRef(null);qo.current=et.current;const ui=qo,Zo=Te,_i=_.useRef(Y);_i.current=Y;const os=_.useCallback(L=>{const Q=Ys.current;Q.gestureLocked!==L&&(Q.gestureLocked=L,ha(L))},[ha]),di=_.useCallback(()=>{const L=Ys.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),Di=_.useCallback(L=>{const Q=fe.current,j=Ys.current;if(Q){if(j.mode==="copy"&&j.copyStart){j.copyDidSelect=sf(Q,j.copyStart,L)||j.copyDidSelect;return}if(j.mode==="adjust"){const W=Cr.current;if(!W.active||!W.anchor)return;W.focus=_C(Q,L),sf(Q,W.anchor,W.focus),Jt()}}},[Jt]),Co=_.useCallback((L,Q)=>{const j=fe.current,W=Ys.current;if(!j)return;const Le=ql(j);if(!Le)return;const xe=Le.originTop,Je=Le.originTop+j.rows*Le.cellH,Ye=Math.max(28,Le.cellH*1.5),Ct=Q-xe,xr=Je-Q;let Jr=0,ln=0;if(Ct<Ye?(Jr=-1,ln=Math.min(1,(Ye-Ct)/Ye)):xr<Ye&&(Jr=1,ln=Math.min(1,(Ye-xr)/Ye)),W.edgeClientX=L,W.edgeClientY=Q,Jr===0){di();return}W.edgeScrollDir=Jr,W.edgeScrollLines=1+Math.round(ln*5),W.edgeScrollTimer===null&&(W.edgeScrollTimer=setInterval(()=>{const pn=fe.current,ur=Ys.current;if(!pn||ur.edgeScrollDir===0)return;if(ur.mode!=="copy"&&ur.mode!=="adjust"){di();return}pn.scrollLines(ur.edgeScrollDir*ur.edgeScrollLines);const Or=Cc(pn,ur.edgeClientX,ur.edgeClientY-Fu);Or&&Di(Or)},60))},[Di,di]),Ja=_.useCallback(L=>{if(L.pointerType!=="touch")return!1;const Q=ui.current;if(!Q)return!1;const j=L.target;if(!(j instanceof HTMLElement)||!Q.contains(j)||j.closest('[data-mobile-keyboard="true"]'))return!1;const W=Ys.current;W.longPressMode=_i.current;const Le=Cr.current;if(Le.active&&W.pointerId===null){const xe=j.closest("[data-selection-handle]");if(xe instanceof HTMLElement){const Je=fe.current,Ye=xe.dataset.selectionHandle==="start"?"start":"end";if(Je&&Le.anchor&&Le.focus){const Ct=Td(Le.anchor,Le.focus,Je.cols);return Le.anchor=Ye==="start"?Ct.end:Ct.start,Le.focus=Ye==="start"?Ct.start:Ct.end,Le.dragging=Ye,$t(),W.pointerId=L.pointerId,W.tapStartX=L.clientX,W.tapStartY=L.clientY,W.tapDidMove=!1,W.mode="adjust",Er.current=!0,qr(1800),Ke.current?.setAttribute("readonly",""),Ss(),_s(),sa(jl),os(!0),!0}}if(!j.closest("[data-terminal-copy-popover]")){Xn();try{fe.current?.clearSelection()}catch{}}}if(W.pointerId!==null)return!0;if(Er.current=!1,Wo.current){const xe=performance.now(),Je=L.clientX,Ye=L.clientY;if(W.lastTapTime!==0&&xe-W.lastTapTime<=300&&Math.hypot(Je-W.lastTapX,Ye-W.lastTapY)<=25)return sa(jl),en.current=performance.now()+500,Wo.current?.(),zn(!0),yn.current&&clearTimeout(yn.current),yn.current=setTimeout(()=>zn(!1),400),W.lastTapTime=0,!0}return W.holdTimer!==null&&(clearTimeout(W.holdTimer),W.holdTimer=null),W.joystickRepeatTimer!==null&&(clearTimeout(W.joystickRepeatTimer),W.joystickRepeatTimer=null),W.joystickDir="",W.copyStart=null,W.copyDidSelect=!1,W.pointerId=L.pointerId,W.originX=L.clientX,W.originY=L.clientY,W.tapStartX=L.clientX,W.tapStartY=L.clientY,W.tapDidMove=!1,W.mode="holding",W.longPressMode==="copy"&&os(!0),W.holdTimer=setTimeout(()=>{if(W.holdTimer=null,W.mode==="holding"){if(W.longPressMode==="copy"){const xe=fe.current,Je=xe?Cc(xe,W.tapStartX,W.tapStartY):null;if(!xe||!Je){W.mode="idle";return}W.mode="copy",Er.current=!0,qr(1800),Ke.current?.setAttribute("readonly",""),W.copyStart=Je,W.copyDidSelect=!1,Ss(),_s(),xe.clearSelection(),sa(jl),os(!0);return}W.mode="arrow",Er.current=!0,qr(1e3),Ss(),_s(),sa(jl),os(!0),requestAnimationFrame(()=>{ws({visible:!0,activeDir:""})})}},350),!0},[os,$t,Xn]),el=_.useCallback((L,Q)=>{if(L.pointerType!=="touch")return"neutral";const j=Ys.current;if(j.mode==="arrow"&&L.pointerId!==j.pointerId||j.mode==="copy"&&L.pointerId!==j.pointerId||j.mode!=="arrow"&&j.mode!=="copy"&&L.pointerId!==j.pointerId)return"neutral";const W=L.clientX-j.tapStartX,Le=L.clientY-j.tapStartY;if(Math.hypot(W,Le)>10&&(j.tapDidMove=!0),j.mode==="holding"){if(!Q)return j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),os(!1),Er.current=!1,j.mode="idle","neutral";const xe=L.clientX-j.originX,Je=L.clientY-j.originY;return j.longPressMode==="copy"&&Math.hypot(xe,Je)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),os(!1),Er.current=!1,j.mode="idle","release"):Math.hypot(xe,Je)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),os(!1),j.mode="idle","release"):"claim"}if(j.mode==="adjust"){if(!Q)return"claim";Ss();const xe=fe.current,Je=Cr.current;if(!xe||!Je.active||!Je.anchor||!Je.focus)return"claim";const Ye=Cc(xe,L.clientX,L.clientY-Fu);return Ye&&(Di(Ye),Co(L.clientX,L.clientY)),"claim"}if(j.mode==="copy"){if(!Q)return"claim";Ss();const xe=fe.current;if(!xe||!j.copyStart)return"claim";const Je=Cc(xe,L.clientX,L.clientY-Fu);return Je&&(Di(Je),Co(L.clientX,L.clientY)),"claim"}if(j.mode==="arrow"){if(!Q)return"claim";const xe={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},Je=L.clientX-j.tapStartX,Ye=L.clientY-j.tapStartY,Ct=gS(Je,Ye,j.joystickDir);if(Ct&&Ct!==j.joystickDir&&(j.originX=L.clientX,j.originY=L.clientY),Ct){const xr=L.clientX-j.originX,Jr=L.clientY-j.originY,ln=Math.hypot(xr,Jr);if(j.repeatIntervalMs=xS(ln),Ct!==j.joystickDir){j.joystickRepeatTimer!==null&&clearTimeout(j.joystickRepeatTimer);const pn=j.joystickDir==="";j.joystickDir=Ct,Zo.current(xe[Ct]);const ur=performance.now();ur-j.lastHapticTime>120&&(sa(jl),j.lastHapticTime=ur);const Or=pn?400:300;j.joystickRepeatTimer=setTimeout(function Vn(){if(j.joystickDir!==Ct)return;Zo.current(xe[Ct]);const xs=performance.now();xs-j.lastHapticTime>120&&(sa(jl),j.lastHapticTime=xs),j.joystickRepeatTimer=setTimeout(Vn,j.repeatIntervalMs)},Or)}ws({visible:!0,activeDir:Ct})}else j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",ws({visible:!0,activeDir:""});return"claim"}return"neutral"},[os,Di,Co]),uo=_.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==Ys.current.pointerId)return;const Q=Ys.current;if(Q.mode==="copy"){Ss(),_s(),di(),os(!1);const W=fe.current;let Le=null;if(W&&Q.copyStart&&(Le=Cc(W,L.clientX,L.clientY-Fu),Le&&(Q.copyDidSelect=sf(W,Q.copyStart,Le)||Q.copyDidSelect)),W&&Q.copyDidSelect&&W.hasSelection()&&Q.copyStart){const xe=Cr.current;xe.active=!0,xe.anchor=Q.copyStart,xe.focus=Le??Q.copyStart,xe.dragging=null,Jt(),Kn({x:L.clientX,y:L.clientY}),qr(1800),sa(jl)}else ua.current?.(!1);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle",Er.current=!1;return}if(Q.mode==="adjust"){Ss(),_s(),di(),os(!1),Cr.current.dragging=null,Jt(),Kn({x:L.clientX,y:L.clientY}),qr(1800),Q.pointerId=null,Q.mode="idle",Er.current=!1;return}if(Q.mode==="arrow"){Ss(),_s(),os(!1),ws({visible:!1,activeDir:""}),Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",Q.pointerId=null,Q.mode="idle",Er.current=!1;return}const j=ui.current;if(j&&!Q.tapDidMove){const W=L.target;W instanceof HTMLElement&&j.contains(W)&&!W.closest('[data-mobile-keyboard="true"]')&&(Q.lastTapTime=performance.now(),Q.lastTapX=L.clientX,Q.lastTapY=L.clientY)}else Q.tapDidMove&&(Q.lastTapTime=0);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",os(!1),Er.current=!1,Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle"},[os,Ss,qr,di,Jt,Kn]),pa=_.useCallback(()=>{const L=Ys.current;os(!1),di(),L.mode==="arrow"&&ws({visible:!1,activeDir:""}),L.mode==="adjust"&&(Cr.current.dragging=null,Jt(),Kn()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",Er.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[os,di,Jt,Kn]);xg({name:`long-press:${e}`,priority:eS,container:()=>et.current,onPointerDown:F?Ja:void 0,onPointerMove:F?el:void 0,onPointerUp:F?uo:void 0,onPointerCancel:F?pa:void 0});const Dn=_.useCallback((L={})=>{ht.current+=1,z.current="",ge.current=null,q.current=0,ye.current&&(ye.current=!1,L.notifyFlowResume===!0&&ie.current?.(!1)),Ve.current=null,It.current=!1,Se.current=null,it.current=""},[]),Bi=_.useCallback((L="unknown")=>{const Q=ce.current,j=fe.current,W=et.current;if(!Q||!j||!W||!j.element||!j.cols||!j.rows)return;const Le=W.getBoundingClientRect();if(Le.width<24||Le.height<24){dr("skip fit: container too small",{reason:L,width:Math.round(Le.width),height:Math.round(Le.height)});return}try{const xe={cols:j.cols,rows:j.rows},Je=j.buffer.active,Ye=PC(Je.type,Je.baseY,Je.viewportY),Ct=Q.proposeDimensions();if(!Ct||Ct.cols<=0||Ct.rows<=0)return;const xr=Cg(j,xe.rows),Jr=BC({reason:L,currentCols:xe.cols,currentRows:xe.rows,proposedCols:Ct.cols,proposedRows:Ct.rows});let ln=0;if(Jr.accept){mt.current&&Nn.current&&(xe.cols!==Ct.cols||xe.rows!==Ct.rows)&&pe.current?.begin();const ur=j.options.smoothScrollDuration;try{j.options.smoothScrollDuration=0,j.resize(Ct.cols,Ct.rows),ln=Cg(j,Ct.rows),Ye&&j.scrollToBottom()}finally{j.options.smoothScrollDuration=ur}ir.current=0}(xr>0||ln>0)&&(j.refresh(0,Math.max(0,j.rows-1)),dr("xterm buffer invariant repaired",{reason:L,before:xr,after:ln,cols:j.cols,rows:j.rows}));const pn={cols:j.cols,rows:j.rows};dr("fit",{reason:L,backend:"xterm",width:Math.round(Le.width),height:Math.round(Le.height),before:xe,proposed:Ct,next:pn,hysteresis:Jr,changed:xe.cols!==pn.cols||xe.rows!==pn.rows})}catch{pe.current?.cancel()}},[dr]),Bn=_.useCallback(L=>{const Q=fe.current;if(Q)try{Q.refresh(0,Math.max(0,Q.rows-1)),dr("terminal refreshed (sync)",{reason:L,cols:Q.cols,rows:Q.rows,hasWebgl:!!dt.current})}catch(j){dr("terminal refresh (sync) failed",{reason:L,error:j})}},[dr]),Ls=_.useCallback(L=>{const Q=Bt.current;if(Q){try{Q.dispose()}catch{}Bt.current=null}const j=dt.current;if(!j)return!1;pe.current?.cancel();try{j.dispose()}catch{}return dt.current=null,dr("renderer disposed",{type:"webgl",reason:L}),!0},[dr]),es=_.useCallback((L,Q)=>{if(dt.current)return!0;try{const j=new NA({customGlyphs:ot});return Bt.current=j.onContextLoss(()=>{dr("webgl context loss",{reason:"onContextLoss"}),Et.current=!0,typeof window<"u"&&window.setTimeout(()=>{as("webgl-context-loss",{forceRendererRecreate:!0})},0)}),pe.current?.cancel(),L.loadAddon(j),dt.current=j,Et.current=!1,dr("renderer",{type:"webgl",reason:Q,mobile:F,mode:Ce.current}),Bn(`webgl-enabled:${Q}`),Bi(`webgl-enabled:${Q}`),rt.current=!0,!0}catch(j){return dr("webgl load failed, fallback to dom renderer",{reason:Q,error:j,mobile:F,mode:Ce.current}),!1}},[dr,ot,F,Bi,Bn]),Qi=200,Ba=_.useRef(0),hi=_.useRef(new Map),fi=_.useRef(new Map),_n=_.useRef(rf()),Li=_.useRef(null),pi=_.useRef(null),ne=_.useRef(-1),je=_.useRef(new Map),rt=_.useRef(!1),mt=_.useRef(!1),Me=_.useCallback(()=>{const L=hi.current;L.forEach(Q=>cancelAnimationFrame(Q)),L.clear(),fi.current.clear()},[]),nt=_.useCallback(()=>{Li.current!==null&&(window.clearTimeout(Li.current),Li.current=null)},[]),vr=_.useRef(()=>{}),Dr=_.useCallback(L=>{nt(),ft.current?.(!1),we.current(L.cols,L.rows,L.seq),Li.current=window.setTimeout(()=>{Li.current=null;const Q=mg(_n.current,L.seq);_n.current=Q.state,Q.request&&mt.current?(dr("resize ack timeout; retrying",{seq:L.seq,retrySeq:Q.request.seq,cols:Q.request.cols,rows:Q.request.rows}),vr.current(Q.request)):Q.exhausted&&(pe.current?.cancel(),dr("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[nt,dr]);vr.current=Dr;const Xr=_.useCallback((L,Q)=>{if(!mt.current)return;const j=zC(_n.current,{cols:L,rows:Q});_n.current=j.state,j.request&&Dr(j.request)},[Dr]),kr=1500,Gn=400,sn=_.useRef(0),Is=_.useRef(0),ks=_.useCallback((L,Q,j)=>{if(!Number.isFinite(L)||!Number.isFinite(Q)||L<=0||Q<=0)return;const W=Math.floor(L),Le=Math.floor(Q);_n.current=GC(_n.current,{cols:W,rows:Le}),sn.current=Date.now(),dr("pty-size broadcast received",{cols:W,rows:Le,source:j??"unknown"})},[dr]),no=_.useCallback(L=>{const Q=fe.current;if(!Q||!Q.cols||!Q.rows||!mt.current||typeof document<"u"&&(document.visibilityState!=="visible"||!Bc()))return;const j=Date.now();if(j-sn.current<kr||j-Is.current<Gn)return;const W=Q.cols,Le=Q.rows,xe=_n.current.confirmed;xe&&xe.cols===W&&xe.rows===Le||(Is.current=j,dr("ensureSizeMatches push",{reason:L,cols:W,rows:Le,lastServerSize:xe}),Xr(W,Le))},[dr,Xr]),gs=_.useCallback((L,Q)=>{const j=fe.current,W=ce.current;if(!j||!W)return;if(!rt.current){dr("refresh skipped: renderer not ready",{reason:L});return}if(Q.dedupeKey!==void 0){if(je.current.get(L)===Q.dedupeKey){dr("refresh deduped",{reason:L,dedupeKey:Q.dedupeKey});return}je.current.set(L,Q.dedupeKey)}dr("refresh",{reason:L,options:Q});const Le=Q.forceRendererRecreate===!0||Et.current||Xt&&!!dt.current&&HS.has(L)&&/Android/i.test(navigator.userAgent);let xe=!1;Le&&(Et.current=!1,Xt?(Ls(`refresh:${L}`),es(j,`refresh:${L}`)||Bn(`refresh:${L}:webgl-fallback`),xe=!0):(Bn(`refresh:${L}`),xe=!0)),FC(Q.forceRedraw===!0,L==="dpr-change",xe)?Bn(`refresh:${L}`):xe||dr("terminal redraw skipped: fit/write already repaints",{reason:L});const Je={cols:j.cols,rows:j.rows};Bi(`refresh:${L}`);const Ye={cols:j.cols,rows:j.rows};if(Q.skipResizePush||QC({before:Je,after:Ye,lastServerSize:_n.current.confirmed,reconcileServerSize:Q.reconcileServerSize})&&Xr(Ye.cols,Ye.rows),!Q.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const xr=requestAnimationFrame(()=>{const pn=fe.current;if(pn&&pn.buffer.active.type!=="alternate")try{pn.scrollToBottom()}catch{}}),Jr=hi.current,ln=Jr.get(L);ln!==void 0&&cancelAnimationFrame(ln),Jr.set(L,xr)}},[dr,Xt,Ls,es,Bn,Bi,Xr]),as=_.useCallback((L,Q={})=>{if(fe.current,L==="session-key-change"&&(_n.current=rf(),nt(),je.current.clear(),Me()),!Q.force&&(L==="visibility"||L==="bfcache"||L==="online")){const W=Date.now();if(W-Ba.current<Qi){dr("refresh throttled",{reason:L});return}Ba.current=W}if(fi.current.set(L,Q),hi.current.has(L))return;const j=requestAnimationFrame(()=>{const W=fi.current.get(L)??{};hi.current.delete(L),fi.current.delete(L),gs(L,W)});hi.current.set(L,j)},[dr,Me,nt,gs]),Sl=_.useCallback(L=>{const Q=hi.current.get(L);if(Q===void 0)return;const j=fi.current.get(L)??{};cancelAnimationFrame(Q),hi.current.delete(L),fi.current.delete(L),gs(L,j)},[gs]);ro.current=()=>Sl("resize"),_.useEffect(()=>()=>{Me(),We.current!==null&&(window.clearTimeout(We.current),We.current=null)},[e,Me]),_.useEffect(()=>{_n.current=rf(),nt(),je.current.clear()},[e,nt]);const mi=_.useCallback(()=>{if(It.current)return;const L=fe.current;if(!L){Dn();return}if(!z.current)return;const Q=z.current,j=Q.length,W=ge.current;z.current="",ge.current=null,It.current=!0;const Le=pe.current,xe=Le?.generation;L.write(Q,()=>{if(xe!==void 0&&Le?.written(xe),It.current=!1,q.current-=j,q.current<0&&(q.current=0),W!==null&&He.current?.(W),ye.current&&q.current<GS&&(ye.current=!1,ie.current?.(!1)),z.current){mi();return}const Je=++ht.current,Ye=()=>{if(Je!==ht.current||It.current||z.current)return;const Ct=L.buffer.active;Rt.current?.({x:Ct.cursorX,y:Ct.cursorY,rows:L.rows,lastProcessedChunkId:Se.current})};typeof window>"u"?Ye():window.requestAnimationFrame(()=>{window.requestAnimationFrame(Ye)})})},[Dn]);Ue.current=mi;const Ks=_.useCallback(()=>{if(Ve.current!==null)return;const L=++pt.current;Ve.current=L,queueMicrotask(()=>{Ve.current===L&&(Ve.current=null,mi())})},[mi]),r0=_.useCallback((L,Q)=>{L&&(ht.current+=1,z.current+=L,ge.current=Q,q.current+=L.length,!ye.current&&q.current>=WS&&(ye.current=!0,ie.current?.(!0)),Ks())},[Ks]);return _.useEffect(()=>{let L=!1,Q=null,j=null,W=[];const Le=et.current;return Le?(Le.tabIndex=F?-1:0,(async()=>{if(ve.current?.(!1),Qt("loading"),br(null),qs(!0),await ZS(),!L)try{const Je=KS(Le,Lg(H),se,ze,Ze),Ye=new Wv({...Je?{cols:Je.cols,rows:Je.rows}:{},allowProposedApi:!0,fontFamily:Lg(H),fontSize:se,fontWeight:Ig($e),fontWeightBold:Ig(ke),theme:YS(P),logLevel:"off",cursorBlink:!Xt,cursorStyle:"block",cursorInactiveStyle:Fr.current?"bar":"none",scrollback:c?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:UC(Rr,Yt),convertEol:eo,drawBoldTextInBrightColors:tt,rescaleOverlappingGlyphs:pr,minimumContrastRatio:xt,letterSpacing:ze,lineHeight:Ze,smoothScrollDuration:at&&!ae.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),Ct=new Gv;Ye.loadAddon(Ct),Ye.loadAddon(new OA),Ye.registerLinkProvider(_S(Ye,(ur,Or)=>{Xe.current?.(ur,Or)}));const xr=new GA;Ye.loadAddon(xr),Ye.unicode.activeVersion=Re,Ye.loadAddon(new eT({highlightLimit:1e3}));const Jr=new iT;Ye.loadAddon(Jr),De.current=Jr,Ye.loadAddon(new SC);try{Ye.loadAddon(new aT(void 0,new Nx))}catch(ur){dr("clipboard addon skipped",{error:ur})}Q=Ye,fe.current=Ye,ce.current=Ct,Vt.current=typeof window<"u"?window.devicePixelRatio:1,Ye.open(Le),pe.current=$C(Ye),At&&Ye.loadAddon(new CC({fontFeatureSettings:YC,fallbackLigatures:KC}));try{const ur=Ye._core;ur?.coreService&&(ur.coreService.isCursorInitialized=!0),Ye.refresh(0,Ye.rows-1)}catch{}if(Xt?(es(Ye,"init"),rt.current=!0):(dr("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:F,mode:Rr}),rt.current=!0),qs(!1),lr(),F){const ur=Or=>{if(Or.ctrlKey||Or.metaKey){Or.preventDefault();const Vn=Or.deltaY>0?-1:1,xs=Math.max(8,Math.min(32,se+Vn));xs!==se&&Le.dispatchEvent(new CustomEvent("termfontchange",{detail:xs}))}};Ae.current=ur,Le.addEventListener("wheel",ur,{passive:!1})}if(!F){let ur=0,Or=null,Vn=null,xs=null;const ho=()=>{xs=null,ro.current();const Ln=Pl(fe.current,se,Ze),ji=bn.current+ur;ur=0;const Ii=Math.trunc(ji/Ln);if(bn.current=ji-Ii*Ln,Ii!==0){const Qa=Ii>0?"down":"up",gi=fe.current,tl=Math.max(3,Math.floor((gi?.rows??24)/2)),ja=Math.abs(Ii);ja>tl&&(bn.current=0),Ka.current(Qa,Math.min(ja,tl),Or??void 0,Vn??void 0)}};Ye.attachCustomWheelEventHandler(Ln=>{if(Ln.ctrlKey||Ln.metaKey||Ln.shiftKey)return!0;if(Ln.deltaY===0)return!1;if(!fe.current||!Nn.current)return!0;const Ii=Pl(fe.current,se,Ze);let Qa=Ln.deltaY;return Ln.deltaMode===1?Qa=Ln.deltaY*Ii:Ln.deltaMode===2&&(Qa=Ln.deltaY*(Le.clientHeight||Ii*20)),ur+=Qa,Or=Ln.clientX,Vn=Ln.clientY,xs===null&&(xs=requestAnimationFrame(ho)),Ln.preventDefault(),!1})}const ln=zS(Le);if(ln?(ln.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),Pe.current=ln,st()):Pe.current=null,as("mount",{skipResizePush:!0,skipScrollToBottom:!0}),Yr.current&&(F?Ye.focus():Ke.current?.focus({preventScroll:!0})),F||Tr.current(),W.push(Ye.onRender(()=>{const ur=Ye.buffer.active;K.current?.({x:ur.cursorX,y:ur.cursorY,rows:Ye.rows}),F||Tr.current()})),!F){try{const ur=Ye.textarea;if(ur){ur.tabIndex=-1,ur.setAttribute("aria-hidden","true"),ur.setAttribute("readonly",""),ur.value="";const Or=()=>{Ke.current?.focus({preventScroll:!0})};ur.addEventListener("focus",Or),W.push({dispose:()=>ur.removeEventListener("focus",Or)})}}catch{}try{W.push(Ye.onCursorMove(()=>Tr.current())),W.push(Ye.onResize(()=>Tr.current()))}catch{}}W.push(Ye.onData(ur=>{Te.current(ur)}));const pn=ur=>{const Or=typeof window<"u"?window.devicePixelRatio:1,Vn=Math.abs(Or-Vt.current)>.001;return Vn&&(Vt.current=Or,dr("device pixel ratio changed",{value:Or,source:ur})),Vn};if(j=new ResizeObserver(ur=>{if(!jC(!!On.current,As.current)){dr("resize observer skipped: hidden mobile session");return}Mt.current=void 0;const Or=ur[0];Or&&dr("resize observer",{width:Math.round(Or.contentRect.width),height:Math.round(Or.contentRect.height)});const Vn=pn("resize-observer");as(Vn?"dpr-change":"resize")}),j.observe(Le),typeof window<"u"){const ur=()=>{pn("window-resize")&&as("dpr-change")};window.addEventListener("resize",ur),W.push({dispose:()=>window.removeEventListener("resize",ur)});const Or=window.visualViewport;if(Or){const Vn=()=>{pn("visual-viewport-resize")&&as("dpr-change")};Or.addEventListener("resize",Vn),W.push({dispose:()=>Or.removeEventListener("resize",Vn)})}}Bi("init-fit"),Qt("ready"),ve.current?.(!0)}catch(Je){console.error("Failed to initialize terminal:",Je),qs(!1),Qt("error"),br(Je instanceof Error?Je.message:"Failed to load terminal")}})(),()=>{ve.current?.(!1),L=!0,Ge.current?.(!1),bt.current?.(),bt.current=null,te.current=!1,qe.current!==null&&(clearTimeout(qe.current),qe.current=null),Qe.current=!1,Ar.current=null,ue(),ss({active:!1,text:""});for(const Je of W)Je.dispose();j?.disconnect(),Ae.current&&(Le.removeEventListener("wheel",Ae.current),Ae.current=null),pe.current?.dispose(),pe.current=null,Ls("component-unmount"),Q?.dispose(),fe.current=null,ce.current=null,Pe.current=null,Dn({notifyFlowResume:!0}),nt()}):void 0},[Bi,H,se,$e,ke,ze,Ze,xt,tt,Re,ot,pr,At,Yt,at,P,Dn,ue,F,es,Ls,dr,nt]),_.useEffect(()=>{const L=fe.current;L&&(L.options.smoothScrollDuration=at&&!Ee?125:0)},[at,Ee,Ut]),_.useEffect(()=>{const L=fe.current;L&&(L.options.cursorInactiveStyle=he?"bar":"none",he||L.blur())},[he,Ut]),_.useEffect(()=>{const L=fe.current;if(L){if(Xt){if(L.options.cursorBlink=!1,es(L,"renderer-mode-change")&&Yt&&!vt.current)try{L.loadAddon(new PT({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),vt.current=!0}catch(j){dr("image addon skipped",{error:j})}return}L.options.cursorBlink=!0,Ls("renderer-mode-change")&&(Bn("renderer-mode-change:webgl-disabled"),Bi("renderer-mode-change:webgl-disabled"))}},[Xt,Yt,es,Ls,Bn,Bi,dr]),_.useEffect(()=>{const L=fe.current;L&&(Se.current!==null&&L.reset(),Dn(),kt.current="",Oe.current=0,Ke.current&&(Ke.current.value=""),as("session-reset",{skipScrollToBottom:!0}),Yr.current&&(On.current?L.focus():Ke.current?.focus({preventScroll:!0})))},[e,Ut,as,Dn]),_.useEffect(()=>{if(!F||typeof document>"u")return;let L=null;const Q=()=>{L=null;const W=Ke.current;if(!W||document.activeElement!==W||te.current)return;const Le=kt.current,xe=wc(W.value);if(xe!==Le||xe.includes("\r")||!J())return;const Je=Math.min(vg(W),Array.from(xe).length),Ye=Je-Oe.current;if(Ye===0)return;const Ct=fe.current,xr=Ye<0?(Ct?$u(Ct,"D"):"\x1B[D").repeat(-Ye):(Ct?$u(Ct,"C"):"\x1B[C").repeat(Ye);Te.current(xr),Oe.current=Je},j=()=>{L===null&&(L=requestAnimationFrame(Q))};return document.addEventListener("selectionchange",j),()=>{document.removeEventListener("selectionchange",j),L!==null&&cancelAnimationFrame(L)}},[F,J]),_.useEffect(()=>{if(!F)return;const L=Go();return bt.current=L,()=>{L(),bt.current=null}},[F,Go]),_.useEffect(()=>{const L=fe.current;if(L)try{L.options.scrollback=c?0:1e3}catch{}},[c,Ut]),_.useEffect(()=>{const L=fe.current;if(!L)return;if(r.length===0){Se.current!==null&&(L.reset(),Dn(),as("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const Q=Se.current;let j;if(Q===null)j=r;else{const W=r.findIndex(Le=>Le.id===Q);j=W>=0?r.slice(W+1):r}if(j.length>0){const W=j.map(Ye=>Ye.data).join(""),Le=it.current+W,{cleaned:xe,remainder:Je}=$S(Le);it.current=Je,xe?r0(xe,j[j.length-1].id):He.current?.(j[j.length-1].id)}Se.current=r[r.length-1].id},[r,Ut,r0,as,Dn]),_.useImperativeHandle(Ie,()=>({serializeSnapshot:()=>fe.current?De.current?.serialize({scrollback:100})??null:null,focus:()=>{if(On.current){cr();return}Ke.current?.focus({preventScroll:!0})},blur:()=>{const L=Ke.current;Pt(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),On.current&&L?.setAttribute("readonly",""),Ge.current?.(!1)},clear:()=>{const L=fe.current;L&&(L.reset(),Dn(),as("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Dn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=fe.current;if(!L)return!1;const Q=L.hasSelection()?L.getSelection():XS(L),j=await Eg(Q);return j&&L.hasSelection()&&$t(),j},pasteClipboardText:async()=>{qr();const L=await yr(Ke.current);return to.current?.(L),L},sendSequence:(L,Q)=>{ut(L,null,Q)},getDimensions:()=>{const L=fe.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:as,setSessionReady:L=>{mt.current=L,L||(pe.current?.cancel(),nt(),_n.current=VC(_n.current),pi.current=null,ne.current=-1,ft.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const xe=mg(_n.current,L.seq);if(!xe.request&&!xe.exhausted)return;nt(),_n.current=xe.state,xe.request&&mt.current?vr.current(xe.request):xe.exhausted&&pe.current?.cancel();return}const Q=WC(_n.current,L);if(!Q.accepted)return;nt(),_n.current=Q.state,dr("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const j=fe.current,W=Q.state.confirmed;if(!!!(j&&W&&j.cols===W.cols&&j.rows===W.rows)){ft.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){pi.current=L.screenSyncGeneration;const xe=ne.current>=L.screenSyncGeneration;ft.current?.(xe),xe&&(pi.current=null);return}pi.current=null,ft.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;ne.current=Math.max(ne.current,L);const Q=pi.current;if(Q===null||L<Q)return;pi.current=null;const j=fe.current,W=_n.current.confirmed;ft.current?.(!!(j&&W&&j.cols===W.cols&&j.rows===W.rows))},notifyServerSize:ks,ensureSizeMatches:no,requestPtyRedraw:()=>{const L=fe.current;if(!L||!mt.current||_n.current.pending||pi.current!==null)return;const Q=HC(_n.current,{cols:L.cols,rows:L.rows});_n.current=Q.state,vr.current(Q.request)}}),[F,Pt,cr,Dn,yr,ut,as,nt,dr,Xr,ks,no]),a.jsxs("div",{ref:et,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${V||""}`,style:{backgroundColor:P.background,touchAction:Mn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Kr,onPointerMoveCapture:Cs,onPointerUpCapture:Wn,onPointerCancelCapture:An,onTouchStartCapture:L=>{if(ps(L.target)){qr(),Kt(Ac);return}nn(),Kt(Ac)},onTouchMoveCapture:()=>Kt(Ac),onTouchEndCapture:()=>Kt(Tc),onTouchCancelCapture:()=>Kt(Tc),onMouseDown:L=>{F||L.button===0&&(We.current!==null&&(window.clearTimeout(We.current),We.current=null),requestAnimationFrame(()=>{try{Ke.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{F||L.button===0&&(We.current!==null&&window.clearTimeout(We.current),We.current=window.setTimeout(()=>{We.current=null;try{Ke.current?.focus({preventScroll:!0})}catch{}},0))},children:[ct&&a.jsx("button",{type:"button",role:"alert",onClick:()=>jn(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:ct}),Hn&&a.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:Hn.left,top:Hn.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{qr(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),da()},onTouchStart:L=>{qr(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),da()},onClick:L=>{L.preventDefault(),L.stopPropagation(),da()},children:[a.jsx(d7,{size:14,strokeWidth:2.4}),a.jsx("span",{children:be("common.copy")})]}),dn?.start&&a.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:dn.start.left,top:dn.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:a.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[a.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),a.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),dn?.end&&a.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:dn.end.left,top:dn.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:a.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[a.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),a.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),fs&&js&&a.jsx(cS,{}),fs&&Zt==="loading"&&!js&&a.jsx(lS,{}),Zt==="error"&&a.jsx(uS,{message:re||void 0,onRetry:()=>{window.location.reload()}}),Zt==="ready"&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:Ke,"aria-label":be("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",...F?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=hn.x,Q=hn.y,j={position:"fixed",left:L,top:Q,pointerEvents:"none",touchAction:"auto",fontSize:`${se}px`,fontFamily:H,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(hn.cellW)),height:Math.max(1,Math.round(hn.cellH))};if(!fn.active)return j;const W=wn(fn.text);return{...j,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:W.width,height:W.height,whiteSpace:W.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{dr("input anchor focus"),Mt.current=void 0,Tr.current(),as("focus",{skipResizePush:!0,skipScrollToBottom:!0}),Ge.current?.(!0)},onBlur:L=>{F||Pt(L.currentTarget);const Q=Wt(),j=typeof document<"u"?document.activeElement:null;if(dr("input anchor blur",{guarded:Q,activeTag:j?.tagName??null,activeClass:j?.className??null}),!Q){F&&Ke.current?.setAttribute("readonly",""),Ge.current?.(!1);return}if(typeof window>"u"){Ge.current?.(!1);return}window.setTimeout(()=>{O()||J()||(F&&Ke.current?.setAttribute("readonly",""),Ge.current?.(!1))},Tc)},onBeforeInput:L=>{if(te.current)return;const Q=L.nativeEvent;if(Q instanceof InputEvent){if(Q.inputType==="insertFromPaste"||Q.inputType==="insertFromPasteAsQuotation"){const j=Q.dataTransfer?.getData("text/plain")||Q.data;if(j){L.preventDefault();const W=Lt(j,L.currentTarget);F&&to.current?.(W)}return}if(Q.inputType==="insertLineBreak"){if(Qe.current){Qe.current=!1,qe.current!==null&&(clearTimeout(qe.current),qe.current=null),L.preventDefault();return}L.preventDefault(),er(L.currentTarget);return}if(Q.inputType==="deleteContentBackward"||Q.inputType==="deleteContentForward"||Q.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),Te.current("");return}if(Q.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Te.current("");return}return}}},onInput:L=>{if(te.current)return;const Q=L.nativeEvent,j=NC(kt.current,wc(L.currentTarget.value),Q.inputType);if(j){const W=Lt(j,L.currentTarget);F&&to.current?.(W);return}_t(L.currentTarget)},onPaste:L=>{const Q=Array.from(L.clipboardData.files).find(Le=>Le.type.startsWith("image/"));if(Q){L.preventDefault(),Pr(Q,L.currentTarget);return}const j=L.clipboardData.getData("text/plain");if(!j){window.termdockDesktop&&(L.preventDefault(),yr(L.currentTarget));return}L.preventDefault();const W=Lt(j,L.currentTarget);F&&to.current?.(W)},onKeyDown:L=>{const Q=FS(L);if(!Q&&!te.current){if(L.getModifierState("AltGraph"))return;const j=fe.current,W=L.metaKey,Le=L.ctrlKey,xe=L.altKey,Je=L.shiftKey,Ye=L.key;if(W&&!Le&&!xe&&!Je&&Ye==="Enter"){L.preventDefault(),er(L.currentTarget);return}if((W||Le)&&!xe&&!Je&&(Ye==="v"||Ye==="V")){if(window.termdockDesktop?.readClipboardImage){L.preventDefault(),yr(L.currentTarget);return}return}if(W&&!Le&&!xe&&!Je&&(Ye==="c"||Ye==="C")){L.preventDefault();const xr=j?.hasSelection()?j.getSelection():"";xr&&navigator.clipboard?.writeText(xr).catch(()=>{});return}if((W||Le)&&!xe&&!Je&&(Ye==="k"||Ye==="K")){L.preventDefault(),j&&(j.reset(),Dn(),as("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",kt.current="",Oe.current=0;return}if(W&&!Le&&!xe&&!Je&&Ye==="Backspace"){L.preventDefault(),ut("",L.currentTarget);return}if(W&&!Le&&!xe&&!Je&&Ye==="Delete"){L.preventDefault(),ut("\v",L.currentTarget);return}if(W&&!Le&&!xe&&!Je&&Ye==="ArrowLeft"){L.preventDefault(),ut("",L.currentTarget);return}if(W&&!Le&&!xe&&!Je&&Ye==="ArrowRight"){L.preventDefault(),ut("",L.currentTarget);return}if(W)return;if(xe&&!Le&&!W&&!Je&&Ye==="Backspace"){L.preventDefault(),ut("\x1B",L.currentTarget);return}if(xe&&!Le&&!W&&!Je&&Ye==="Delete"){L.preventDefault(),ut("\x1Bd",L.currentTarget);return}if(xe&&!Le&&!W&&!Je&&Ye==="ArrowLeft"){L.preventDefault(),ut("\x1Bb",L.currentTarget);return}if(xe&&!Le&&!W&&!Je&&Ye==="ArrowRight"){L.preventDefault(),ut("\x1Bf",L.currentTarget);return}const Ct=Iw(L,j?.modes?.applicationCursorKeysMode===!0);if(Ct!==null){L.preventDefault(),ut(Ct,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(Q||te.current){L.preventDefault();return}if(Qe.current){Qe.current=!1,qe.current!==null&&(clearTimeout(qe.current),qe.current=null),L.preventDefault();return}L.preventDefault(),er(L.currentTarget);return}if(L.key==="Backspace"){if(Q||te.current)return;if(!L.currentTarget.value){L.preventDefault(),Te.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Te.current("");return}}},onCompositionStart:()=>{te.current=!0,Ts(),ss({active:!0,text:""})},onCompositionUpdate:L=>{te.current=!0;const Q=L.data??L.currentTarget.value;ss(j=>j.active&&j.text===Q?j:{active:!0,text:Q})},onCompositionEnd:L=>{te.current=!1,Qe.current=!0,qe.current!==null&&clearTimeout(qe.current),qe.current=setTimeout(()=>{Qe.current=!1,qe.current=null},50),ss({active:!1,text:""}),_t(L.currentTarget),tr()}}),fn.active&&(()=>{const L=wn(fn.text);return a.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:hn.x,top:hn.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:P.foreground,background:P.background,boxShadow:`-1px 0 0 1px ${P.background}`,fontSize:`${se}px`,fontFamily:H,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:P.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:fn.text})})(),a.jsx("div",{"aria-hidden":!0,className:`absolute left-1/2 -translate-x-1/2 top-6 z-30 pointer-events-none
66
- rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
67
- shadow-lg transition-all duration-150 ease-out`,style:{opacity:ns?1:0,transform:ns?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),a.jsx("div",{ref:Yn,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:Mn.visible?1:0,transform:Mn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:Mn.visible&&(()=>{const{activeDir:L}=Mn,Q=j=>L===j;return a.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:[a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),a.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});Zx.displayName="TerminalViewport";const e_=Zx,Gp=new Set(["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"]);function Ea(e){if(!e)return null;if(e==="/")return"/";const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}function ka(e,t,r,s=Gp,i=null,u=null){if(e.customName)return{primary:e.name,secondary:Ea(r)};if(i){const h=Ea(r),p=i===r||i===h;if(u!=="idle"&&!s.has(i)&&!p)return{primary:i,secondary:h}}if(t&&!s.has(t))return{primary:t,secondary:Ea(r)};const c=Ea(r);return c?{primary:c,secondary:null}:{primary:e.name,secondary:null}}function t_(e,t,r,s=Gp,i=null,u=null){return ka(e,t,r,s,i,u).primary}function Yx(e,t,r){const s=[],i=new Map;for(const u of e){const c=t(u),h=c&&c.trim().length>0?c:"";let p=i.get(h);p||(p={key:h,label:h?Ea(h)??h:r,sessions:[]},i.set(h,p),s.push(p)),p.sessions.push(u)}return s.sort((u,c)=>(u.key===""?1:0)-(c.key===""?1:0))}function r_(e){return e&&e.trim().length>0?e:""}function Kx(e,t,r){const s=[...e],[i]=s.splice(t,1);return i?(s.splice(r,0,i),s.flatMap(u=>u.sessions.map(c=>c.id))):e.flatMap(u=>u.sessions.map(c=>c.id))}function Xx(e,t){const r=new Set;return e.flatMap(s=>{const i=[...new Set(s.sessionIds)].filter(u=>t.has(u)&&!r.has(u));return i.length<(s.federated?1:2)?[]:(i.forEach(u=>r.add(u)),[{...s,sessionIds:i}])})}function Sd(e,t,r,s,i=[],u=[]){const c=new Map(e.map(I=>[I.id,I])),h=Xx(u,new Set(c.keys())),p=new Map,m=new Map,x=i.filter(I=>I.sessionIds.length>=2&&I.sessionIds.every(k=>c.has(k))),b=(I,k)=>{const N=c.get(k);I.forEach(R=>{p.set(R,I),m.set(R,N)})};for(const I of h){const k=new Set(I.sessionIds),N=new Map;for(const P of x)P.sessionIds.every(V=>k.has(V))&&P.sessionIds.forEach(V=>N.set(V,P.sessionIds));const R=new Set,D=I.sessionIds.flatMap(P=>{if(R.has(P))return[];const V=N.get(P)??[P];return V.forEach(F=>R.add(F)),V});b(D,I.sessionIds[0])}for(const I of x)I.sessionIds.some(k=>p.has(k))||b(I.sessionIds,I.sessionIds[0]);const v=I=>{const k=new Set;return I.flatMap(N=>{if(k.has(N.id))return[];const R=p.get(N.id)??[N.id];return R.forEach(D=>k.add(D)),R.map(D=>c.get(D))})};if(!r)return{arranged:v(e),groups:[]};const w=Yx(e,I=>t(m.get(I.id)??I),s).map(I=>({...I,sessions:v(I.sessions)}));return{arranged:w.flatMap(I=>I.sessions),groups:w}}function n_(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function s_(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function i_(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function o_(e,t){return!e&&t}const a_=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},l_=()=>({async createSession(e){return b7(e)},connect(e,t,r){const s=x7(e,t.onEvent,t.onError,{...a_(r),getDimensions:r?.getDimensions});return{close:()=>s()}},async sendInput(e,t){await P5(e,t)},async resize(e){await g7(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await j5(e)},async restartSession(e,t){return m7(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await p7(e)},async tmuxAction(e,t){return f7(e,t)},async listTmuxSessions(){return Pf()},async getTmuxStatus(){return jf()},async checkHealth(e){return h7(e)}}),c_="\x1B",u_=/\x1b\[[IO]/g,d_=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,h_=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function Mg(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function f_(e){const t=e.replace(u_,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let s=Mg(d_,t,r);if(s<0&&(s=Mg(h_,t,r)),s<0&&t.startsWith("\x1B[M",r)&&t.length>=r+6&&(s=r+6),s<0)return!1;r=s}return!0}function p_(e){return e===c_}function rp(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const Pc=15;function m_(){return Jx.map(e=>e.id)}const Jx=[{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 Kc(){return Jx.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function Vp(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 e3(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const qp=/^\/(.+)\/([gimsuy]*)$/;function Ng(e){return qp.test(e.trim())}function _d(e){const t=e.trim().match(qp);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function t3(e){if(typeof e!="string")return null;const t=e.trim();return t?qp.test(t)?_d(t)?t:null:t.toLowerCase():null}function Dg(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,`
68
- `).replace(/\\t/g," ")}const Bg="||",g_=120;function x_(e){return e.includes(Bg)?e.split(Bg).filter(t=>t.length>0):[e]}function M0(e){const t=new Set,r=e.map((i,u)=>{const c=typeof i.id=="string"&&i.id.trim().length>0?i.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${u+1}`,h=t.has(c)?`${c}-${u+1}`:c;return t.add(h),{id:h,label:typeof i.label=="string"&&i.label.trim().length>0?i.label.trim():"Preset",programs:Array.isArray(i.programs)?i.programs.map(p=>t3(p)).filter(p=>!!p):[],includeAlt:typeof i.includeAlt=="boolean"?!!i.includeAlt:!1,rowLayout:Vp(i.rowLayout),showOnDesktop:typeof i.showOnDesktop=="boolean"?!!i.showOnDesktop:!1,actions:Array.isArray(i.actions)?i.actions.map((p,m)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${h}-action-${m+1}`,label:typeof p.label=="string"?p.label:`Key ${m+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(i=>i.id!=="auto"),s=Kc()[0];return s&&!r.some(i=>i.id==="default")&&r.unshift(s),r}function b_(e,t){const r=e3(e);if(!r)return"default";for(const s of t)if(s.id!=="default")for(const i of s.programs){const u=_d(i);if(u){if(u.test(r))return s.id}else if(r.includes(i))return s.id}return"default"}function Qg(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??Kc()[0]}function y_(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function v_(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function r3(e,t){const r=Vp(t),s=[];let i=0,u=0;for(;i<e.length;){const c=r[Math.min(u,r.length-1)]??3;s.push({columns:c,items:e.slice(i,i+c)}),i+=c,u+=1}return s}const n3=28,s3=({mode:e,presetLabel:t,title:r,ariaLabel:s,disabled:i,onPointerDown:u,buttonRef:c})=>a.jsx("button",{ref:c,type:"button",onPointerDown:u,tabIndex:-1,disabled:i,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":s??r,children:e==="auto"?a.jsx(R9,{size:14}):(t.charAt(0)||"?").toUpperCase()}),w_={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},zu=8;function A_(e,t){return w_[e]??null}const T_=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:s,lockedModifier:i,disabled:u,defaultShowExtended:c=!1,presetLabel:h,presetModeLabel:p,presetMode:m,presetOptions:x,includeAlt:b,presetRowLayout:v,extraActions:w,onKeyPress:I,onTextPress:k,onPastePress:N,onFilePress:R,fileUploadState:D="idle",fileUploadProgress:P=0,longPressMode:V="arrows",copyFeedback:F="idle",onLongPressModeToggle:Y,onModifierToggle:Z,onPresetSelect:he,onExpandedChange:Ee})=>{const{t:Ie}=an(),[be,et]=_.useState(c),[Pe,fe]=_.useState(!1),De=_.useRef(null),pe=r==="desktop-actions",ae=pe||be,[ce,Te]=_.useState(!1),[we,Ge]=_.useState(null),ie=u||!e||!t,ve=u||!e,ft=_.useRef(null),Rt=_.useRef(null),He=_.useRef(null),K=_.useRef(null),Xe=_.useRef(null),Ce=_.useRef(F),z=_.useRef(null),q=_.useRef(0),ye=_.useCallback(Oe=>{if(ie)return;const Nt=Oe.target;if(!(Nt instanceof Element))return;const hr=Nt.closest("button"),Ae=hr?.hasAttribute("data-mobile-native-action")===!0;hr&&!Ae?(Oe.preventDefault(),sa(zu)):hr&&sa(zu)},[ie]),Ve=_.useCallback(Oe=>{Oe.preventDefault()},[]),pt=_.useCallback(Oe=>{const Nt=Oe.target;ie||Nt instanceof HTMLElement&&Nt.closest("button")&&Nt.blur()},[ie]);_.useEffect(()=>{et(c)},[c]),_.useEffect(()=>{pe||Ee?.(be)},[pe,Ee,be]),_.useEffect(()=>{ie&&(z.current!==null&&(window.clearTimeout(z.current.timer),z.current=null),Te(!1),Ge(null))},[ie]),_.useEffect(()=>{e||(Te(!1),Ge(null))},[e]),_.useEffect(()=>{if(!ce)return;const Oe=()=>{const Nt=ft.current?.getBoundingClientRect();Nt&&Ge({left:Math.max(8,Nt.left),top:Math.max(8,Nt.top-8)})};return Oe(),window.addEventListener("resize",Oe),window.addEventListener("scroll",Oe,!0),()=>{window.removeEventListener("resize",Oe),window.removeEventListener("scroll",Oe,!0)}},[ce]),_.useEffect(()=>{const Oe=Ce.current;if(Ce.current=F,F==="idle"||F===Oe)return;if(Xe.current!==null&&window.clearTimeout(Xe.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(F==="copied"){Rt.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 hr=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];He.current?.animate?.(hr,{duration:760,easing:"ease-out"}),K.current?.animate?.(hr,{duration:760,delay:130,easing:"ease-out"})}else Rt.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});sa(zu),F==="copied"&&(Xe.current=window.setTimeout(()=>{sa(zu),Xe.current=null},90),V==="copy"&&Y?.())},[F,V,Y]),_.useEffect(()=>()=>{Xe.current!==null&&window.clearTimeout(Xe.current)},[]);const ht=_.useCallback((Oe,Nt)=>{ie||(Oe.preventDefault(),I(Nt))},[I,ie]),It=_.useCallback((Oe,Nt)=>{ie||(Oe.preventDefault(),Z(Nt))},[Z,ie]),Se=_.useCallback(Oe=>{ie||(Oe.preventDefault(),et(Nt=>{const hr=!Nt;return hr&&(fe(!0),De.current!==null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>{fe(!1),De.current=null},350)),hr}))},[ie]),ge=_.useCallback(()=>{const Oe=typeof performance<"u"?performance.now():Date.now();Oe-q.current<350||(q.current=Oe,N?.())},[N]),Ue=_.useCallback(Oe=>{ie||(Oe.stopPropagation(),Oe.pointerType!=="touch"&&(Oe.preventDefault(),ge()))},[ie,ge]),bt=_.useCallback(Oe=>{ie||(Oe.preventDefault(),Oe.stopPropagation(),ge())},[ie,ge]),Ke=_.useCallback(Oe=>{ie||D==="uploading"||!R||(Oe.preventDefault(),Oe.stopPropagation(),R())},[D,R,ie]),Mt=_.useCallback(Oe=>{ie||Oe.stopPropagation()},[ie]),We=250,vt=_.useCallback(()=>{z.current!==null&&(window.clearTimeout(z.current.timer),z.current=null)},[]);_.useEffect(()=>()=>{vt(),De.current!==null&&(window.clearTimeout(De.current),De.current=null)},[vt]);const ir=_.useCallback((Oe,Nt)=>{if(ie)return;if(Oe.preventDefault(),!Nt.doubleTapSequence){k(Nt.sequence);return}const hr=z.current;if(hr!==null&&hr.actionId===Nt.id){window.clearTimeout(hr.timer),z.current=null,k(Nt.doubleTapSequence);return}vt();const Ae=window.setTimeout(()=>{z.current=null,k(Nt.sequence)},We);z.current={actionId:Nt.id,timer:Ae}},[vt,k,ie]),it=_.useCallback(Oe=>{ie||(Oe.preventDefault(),Oe.stopPropagation(),Y?.())},[Y,ie]),dt=_.useCallback(Oe=>{ie||Oe.stopPropagation()},[ie]),Bt=_.useCallback(Oe=>{if(ie)return;Oe.preventDefault();const Nt=Oe.currentTarget.getBoundingClientRect();Ge({left:Math.max(8,Nt.left),top:Math.max(8,Nt.top-8)}),Te(hr=>!hr)},[ie]),Et=_.useCallback((Oe,Nt)=>{ie||(Oe.preventDefault(),Te(!1),Ge(null),he(Nt))},[he,ie]),Vt=w.length>0,te=_.useMemo(()=>{const Oe=[{id:"preset",kind:"preset"}];if(!pe&&b&&Oe.push({id:"alt",kind:"alt"}),Vt){const Nt=w.map(hr=>({id:hr.id,kind:"text",action:hr}));return Oe.concat(Nt)}return pe?Oe:Oe.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[w,Vt,b,pe]),Qe=_.useMemo(()=>r3(te,v),[te,v]),qe=`${pe?"space-y-1":"mt-1 space-y-1"}${Pe?" pointer-events-none":""}`,kt=ce&&we?Ya.createPortal(a.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:we.left,top:we.top},children:a.jsx("div",{className:"grid gap-1",children:x.map(Oe=>a.jsx("button",{type:"button",onPointerDown:Nt=>Et(Nt,Oe.id),tabIndex:-1,disabled:ve,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${Oe.id===m?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:Oe.label},Oe.id))})}),document.body):null;return a.jsxs(a.Fragment,{children:[kt,a.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?pe?"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:ye,onPointerDownCapture:ye,onContextMenuCapture:Ve,onFocusCapture:pt,children:a.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!pe&&a.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[a.jsx("button",{type:"button",onPointerDown:Oe=>ht(Oe,"esc"),tabIndex:-1,disabled:ve,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"}),a.jsx("button",{type:"button",onPointerDown:Oe=>It(Oe,"ctrl"),tabIndex:-1,disabled:ve,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${s==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="ctrl"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="ctrl"?"Ctrl*":"Ctrl"})}),a.jsx("button",{type:"button",onPointerDown:Oe=>ht(Oe,"ctrl-c"),tabIndex:-1,disabled:ve,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"}),a.jsx("button",{type:"button",onPointerDown:Oe=>ht(Oe,"ctrl-u"),tabIndex:-1,disabled:ve,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"}),a.jsxs("button",{type:"button",onPointerDown:Mt,onTouchStart:Mt,onClick:Ke,tabIndex:-1,disabled:ve||!R||D==="uploading",title:D==="uploading"?`${Ie("rightSidebar.uploading")} ${Math.round(P)}%`:Ie(D==="inserted"?"rightSidebar.inserted":D==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":Ie("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 ${D==="inserted"?"bg-primary/15 text-primary":D==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[D==="uploading"&&a.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,P))}%`}}),a.jsx("span",{className:"relative z-10 flex items-center justify-center",children:D==="uploading"?a.jsx(un,{size:15,className:"animate-spin"}):D==="inserted"?a.jsx(la,{size:15}):D==="failed"?a.jsx(vs,{size:15}):a.jsx(M8,{size:15})}),D!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:D==="uploading"?`${Ie("rightSidebar.uploading")} ${Math.round(P)}%`:Ie(D==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),a.jsx("button",{type:"button",onPointerDown:()=>k("/"),tabIndex:-1,disabled:ve,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:"/"}),a.jsx("button",{type:"button",onPointerDown:Oe=>ht(Oe,"enter"),tabIndex:-1,disabled:ve,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:a.jsx(_8,{size:16})}),a.jsxs("button",{ref:Rt,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:dt,onTouchStart:dt,onClick:it,tabIndex:-1,disabled:ve,title:Ie(F==="copied"?"terminal.copied":F==="failed"?"terminal.copyFailed":V==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":Ie(V==="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 ${F==="copied"?"bg-primary/15 text-primary":F==="failed"?"bg-destructive/15 text-destructive":V==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[a.jsx("span",{ref:He,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),a.jsx("span",{ref:K,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),a.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[a.jsx(la,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${F==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),a.jsx(vs,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${F==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(X5,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${F==="idle"&&V==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(e9,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${F==="idle"&&V==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),F!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:F==="copied"?`${Ie("terminal.copied")} · ${Ie("terminal.longPressSendsArrows")}`:`${Ie("terminal.copyFailed")} · ${Ie("terminal.longPressSelectsText")}`})]}),a.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Ue,onPointerUp:Mt,onTouchStart:Mt,onTouchEnd:Mt,onClick:bt,tabIndex:-1,disabled:ve,title:Ie("terminal.paste"),"aria-label":Ie("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:a.jsx(x8,{size:15})}),a.jsx("button",{type:"button",onPointerDown:Se,tabIndex:-1,disabled:ve,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:be?a.jsx(Vv,{size:16}):a.jsx(wl,{size:16})})]}),ae&&a.jsx("div",{className:qe,children:Qe.map((Oe,Nt)=>{const hr=Oe.items[0]?.kind==="preset",Ae=Math.max(2,Oe.columns),bn=hr?`${n3}px repeat(${Math.max(1,Ae-1)}, minmax(0, 1fr))`:`repeat(${Ae}, minmax(0, 1fr))`;return a.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:bn},children:Oe.items.map(_r=>_r.kind==="preset"?a.jsx(s3,{buttonRef:_r.id==="preset"?ft:void 0,mode:m,presetLabel:h,title:p,disabled:ve,onPointerDown:Bt},_r.id):_r.kind==="alt"?a.jsx("button",{type:"button",onPointerDown:_e=>It(_e,"alt"),tabIndex:-1,disabled:ve,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${s==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="alt"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="alt"?"Alt*":"Alt"})},_r.id):_r.kind==="text"?a.jsxs("button",{type:"button",onPointerDown:_e=>ir(_e,_r.action),tabIndex:-1,disabled:ve,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:[_r.action.label,_r.action.doubleTapSequence&&a.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},_r.id):a.jsx("button",{type:"button",onPointerDown:_e=>ht(_e,_r.keyName),tabIndex:-1,disabled:ve,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:_r.keyName==="ctrl-d"?"Ctrl-D":_r.keyName==="home"?"Home":"End"},_r.id))},`row-${Nt}`)})})]})})]})},C_=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:s,connectionError:i,terminalSessionId:u})=>{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 a.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[a.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),a.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[a.jsxs("div",{children:["isMobile: ",a.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),a.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),a.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),a.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),a.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),a.jsxs("div",{children:["inputFocused: ",String(t)]}),a.jsxs("div",{children:["keyboard~: ",c,"px"]}),a.jsxs("div",{children:["connecting:"," ",a.jsx("span",{className:s?"text-muted-foreground":"text-accent",children:String(s)})]}),a.jsxs("div",{children:["sessionId:"," ",a.jsx("span",{className:u?"text-accent":"text-destructive",children:u?"✓":"✗"})]}),a.jsxs("div",{children:["error:"," ",a.jsx("span",{className:i?"text-destructive":"text-accent",children:i?"Yes":"No"})]}),a.jsxs("div",{children:["isIOS:"," ",a.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),a.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:a.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},S_=/^Reconnecting/i,__=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:s,onHardRestart:i})=>{const{t:u}=an(),c=!!e&&S_.test(e),h=!!(s&&!e||c),[p,m]=_.useState(!1);return _.useEffect(()=>{if(!h){m(!1);return}const x=setTimeout(()=>m(!0),1500);return()=>clearTimeout(x)},[h]),h?p?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:a.jsx("span",{className:"text-[11px] text-muted-foreground/60 animate-pulse tracking-wide",children:u("connection.reconnecting")})}):null:e?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[a.jsx("span",{children:e}),t&&a.jsx("button",{type:"button",onClick:i,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:u("common.retry")})]})}):null};let Oc=[],of=!1;function xo(e,t,r={}){typeof window>"u"||(Oc.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),L_())}async function L_(){if(!of){of=!0;try{for(;Oc.length>0;){const e=Oc[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Oc.shift()}catch{Oc=[];break}}}finally{of=!1}}}const I_=120,k_=80,E_=400;function jg(){if(typeof window>"u"||document.visibilityState!=="visible"||!y7())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=_a().visualViewport;if(!t)return 0;const r=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,s=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,i=t.height+t.offsetTop;return Math.max(0,Math.round(r-i-s))}function i3(e){const{enabled:t,openThresholdPx:r=I_,closeThresholdPx:s=k_,settleDelayMs:i=E_}=e,u=_.useMemo(()=>j0("keyboard"),[]),c=_.useRef(!1),h=_.useRef(null),p=_.useRef(0),[m,x]=_.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return _.useEffect(()=>{if(typeof window>"u"||!t){c.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x(Y=>!Y.isOpen&&!Y.isSettled&&Y.keyboardHeight===0?Y:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let b=null;const v=()=>{b=null;const Y=jg();let Z=c.current;if(Y>=r?Z=!0:Y<=s&&(Z=!1),c.current=Z,Z){const he=Math.abs(Y-p.current);p.current=Y,he>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(Ee=>Ee.isSettled?Ee:{...Ee,isSettled:!0})},i))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(he=>{const Ee=Z?he.isSettled:!1;return he.isOpen===Z&&he.keyboardHeight===Y&&he.isSettled===Ee?he:(u("sync",{keyboardHeight:Y,isOpen:Z,isSettled:Ee,visualViewport:_a().visualViewport?{width:Math.round(_a().visualViewport.width),height:Math.round(_a().visualViewport.height),offsetTop:Math.round(_a().visualViewport.offsetTop)}:null}),{isOpen:Z,isSettled:Ee,keyboardHeight:Y})})},w=(Y="event")=>{(Y.includes("visibilitychange")||Y.includes("pageshow"))&&u("schedule",{source:Y}),b===null&&(b=window.requestAnimationFrame(v))};w("mount");const I=()=>w("resize"),k=()=>w("orientationchange"),N=()=>w("visualViewport.resize"),R=()=>w("visualViewport.scroll"),D=()=>w("viewport-keyboard-change");window.addEventListener("resize",I),window.addEventListener("orientationchange",k),_a().visualViewport?.addEventListener("resize",N),_a().visualViewport?.addEventListener("scroll",R),document.addEventListener("termdock:viewport-keyboard-change",D);const P=Y=>{u("resume",{source:Y,keyboardHeight:jg(),hidden:document.hidden}),w(`${Y}:now`),window.setTimeout(()=>w(`${Y}:50ms`),50),window.setTimeout(()=>w(`${Y}:200ms`),200)},V=()=>{document.hidden||P("visibilitychange")},F=()=>P("pageshow");return document.addEventListener("visibilitychange",V),window.addEventListener("pageshow",F),()=>{window.removeEventListener("resize",I),window.removeEventListener("orientationchange",k),_a().visualViewport?.removeEventListener("resize",N),_a().visualViewport?.removeEventListener("scroll",R),document.removeEventListener("termdock:viewport-keyboard-change",D),document.removeEventListener("visibilitychange",V),window.removeEventListener("pageshow",F),b!==null&&window.cancelAnimationFrame(b),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[u,t,r,s,i]),m}const fd=300,R_=120,M_=2e3,N_=250,D_=6e4;function B_(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 s=e.slides.findIndex(c=>c.some(h=>r.has(h)));if(s<0)return r;const i=e.slides[s-1]??[],u=e.slides[s+1]??[];for(let c=0;c<Math.max(i.length,u.length)&&r.size<3;c+=1)for(const h of[i[c],u[c]])h&&r.size<3&&r.add(h);return r}function af(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function Hu(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function Q_(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function j_(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function P_(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function O_(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function F_(e){return!e.initialConnectionPending}function U_(e){return!e}function $_(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function z_(e,t){return[...e].every(r=>t.has(r))}function H_(e,t){return e===null||t-e>=N_}function W_(e){return!1}function G_(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,D_-(e.now-e.reconnectStartedAt))}function V_(e,t){const r=new Map;let s=0;for(const i of e)if(!r.has(i)){if(t.has(i)){r.set(i,0);continue}r.set(i,fd+s*R_),s+=1}return r}const q_="Session not found on server",lf="Terminal session not found",Z_="STALE_SESSION_RESTORE_REJECTED";function Y_(e){return e?.message===q_}function Pg(e){return e?.code===Z_}function K_(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function o3(e,t){return K_(e,t).replace(/ /g,"\\ ")}function X_(e,t){return`${o3(e,t)} `}function Og(e,t){return o3(e,t)}function rj(e,t,r){if(!r)return Og(e,t);const s=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${Og(e,t)}:${s}`}const J_="/tmp";async function a3(e,t,r){const i=(await t(J_,[e])).files[0];if(!i?.path)throw new Error("Upload did not return a file path");return r(i.path),i}const nj=a3,eL=320,Fg="termdock:mobile-keyboard-expanded",Ug="termdock:mobile-keyboard-preset-mode",$g="termdock:mobile-long-press-mode",tL=80;function cf(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const rL={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},nL=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:s=Wp(),colorTheme:i="dark",toolbarPresets:u=[],isActive:c=!0,focusSuspended:h=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:m=!0,focusRequestToken:x=0,resumeRequestToken:b=0,resumeRequestReason:v="visibility",resumeRequestDelayMs:w=0,forceResumeReconnect:I=!1,initialConnectDelayMs:k=0,initialConnectEnabled:N=!0,resumeRequestEnabled:R=!0,onStreamReadyChange:D,onStreamConnected:P,onViewportReadyChange:V,onContentReadyChange:F,onKeyboardVisibilityChange:Y,suppressKeyboard:Z=!1,keyboardPortalTarget:he=null,sharedMobileKeyboardLayout:Ee=!1,suppressPageFlipRefresh:Ie=!1,showDebug:be,onStatusChange:et})=>{const{t:Pe}=an(),[fe,De]=_.useState(s.fontSize),pe=_.useMemo(()=>l_(),[]),ae=_.useMemo(()=>j0("session"),[]),ce=_.useMemo(()=>j0("keyboard"),[]),Te=_.useRef(null),we=_.useRef(null);_.useEffect(()=>{De(s.fontSize)},[s.fontSize]);const Ge=_.useMemo(()=>({...s,fontSize:fe}),[s,fe]),[ie]=_.useState(e||$9()),[ve,ft]=_.useState(cf),[Rt,He]=_.useState(!1),[K,Xe]=_.useState(!1),[Ce,z]=_.useState(!1),[q,ye]=_.useState(()=>typeof document>"u"?!0:!document.hidden&&Bc()),[Ve,pt]=_.useState(()=>typeof document>"u"?!0:document.hasFocus()),[ht,It]=_.useState(!1),[Se,ge]=_.useState(!1),[Ue,bt]=_.useState(!1),[Ke,Mt]=_.useState(!1),[We,vt]=_.useState(!0),{isOpen:ir,keyboardHeight:it}=i3({enabled:ve&&c}),[dt,Bt]=_.useState(null),[Et,Vt]=_.useState(null),[te,Qe]=_.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Fg)==="true"),[qe,kt]=_.useState(()=>{if(typeof window>"u")return"auto";const ne=window.localStorage.getItem(Ug);return ne&&ne.length>0?ne:"auto"}),[Oe,Nt]=_.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem($g)==="copy"?"copy":"arrows"),[hr,Ae]=_.useState("idle"),[bn,_r]=_.useState("idle"),[_e,Qr]=_.useState(0),wt=Br(ne=>ne.sessions.get(ie)),{setTerminalSession:en,setConnecting:Er,appendToBuffer:le,replaceBuffer:st,clearTerminalSession:Ut,removeTerminalSession:lr,clearBuffer:Zt,setSessionActiveProgram:Qt,setSessionCwd:re,setSessionCopyMode:br,setSessionAgentStatus:ct,setSessionShellTitle:jn,setSessionPromptState:dr,clearAgentNeedsReview:js}=Br.getState(),qs=_.useMemo(()=>`wt-${ie.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[ie]),fs=wt?.terminalSessionId??null,Cn=wt?.mode??"shell",ns=wt?.activeProgram??null,zn=_.useMemo(()=>M0(u),[u]),Mn=Cn==="tmux",ws=wt?.bufferChunks??[],Hn=wt?.isConnecting??!1,tn=fs,Pn=_.useCallback(async(ne,je)=>{const rt=CS(ne,wt?.cwd||wt?.directory);if(!rt)return;let mt=rt,Me="directory";try{mt=(await Ep(rt)).path}catch(nt){if(!(nt instanceof Error)||nt.message!=="Path is not a directory")return;Me="file"}try{const nt=Ht.getState();nt.setRightTab("files"),nt.openRight(),window.dispatchEvent(new CustomEvent(bS,{detail:{path:mt,kind:Me,line:je}}))}catch{}},[wt?.cwd,wt?.directory]),Gr=t??wt?.mode??"shell",Cr=Gr==="tmux"?r??wt?.tmuxSessionName??null:null,[dn,wr]=_.useState(null),hn=_.useRef(!1),[jt,jr]=_.useState(!1),[Ar,fn]=_.useState(!1),[ss,Yn]=_.useState(null),[yn,Yr]=_.useState(0),[Fr,On]=_.useState(null),As=be!==void 0?be:!1,Ps=_.useRef(null),eo=_.useRef(null),Rr=_.useRef(null),H=_.useRef(null),se=_.useRef(null),$e=_.useRef(!1),ke=_.useRef(null),ze=_.useRef([]),Ze=_.useRef(0),xt=_.useRef(!1),tt=_.useRef(null),Re=_.useRef(null),ot=_.useRef(-1),pr=_.useRef(null),At=_.useRef(0),Yt=_.useRef(null),at=_.useRef(null),Xt=_.useRef(0),$t=_.useRef(!1),Ft=_.useRef(null),Jt=_.useRef(null),Kn=_.useRef(!1),Xn=_.useRef(0),Vr=_.useRef(!1),Os=_.useRef(!1),Fs=_.useRef(!1),co=_.useRef(null),vn=_.useRef(null),rn=_.useRef(null),Ur=_.useRef(c);Ur.current=c;const Nn=_.useRef(h);Nn.current=h;const Sn=_.useRef(ve),Zs=_.useRef(null),Jn=_.useRef(null),Us=_.useRef(null),Lr=_.useRef(null),qr=_.useRef(null),is=_.useRef(null),O=_.useRef(null),J=_.useCallback(()=>{const ne=++Xn.current,je=()=>{ne===Xn.current&&ge(!0)};if(typeof window>"u"){je();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(je))},[]),ue=_.useCallback(ne=>{if(Vr.current){if(vn.current!==null&&(window.clearTimeout(vn.current),vn.current=null),ne.x===0&&ne.y>=ne.rows-1){vt(!1);return}vn.current=window.setTimeout(()=>{vn.current=null,vt(!0)},tL)}},[]),Be=_.useRef(null);_.useEffect(()=>()=>{Be.current?.()},[]);const Tt=_.useCallback(()=>{Be.current||(Be.current=Dp(()=>{Be.current=null;const ne=Br.getState(),je=Rr.current,rt=ne.getTerminalSession(ie);if(!je||rt?.mode!=="shell"||ne.hasPendingBufferWrites(ie))return;const mt=v7(je),Me=se.current?.getDimensions();if(!mt||!Me)return;const nt=se.current?.serializeSnapshot();nt&&w7({id:je,version:1,...mt,...Me,data:nt,savedAt:Date.now()})},2e3))},[ie]),_t=_.useCallback(ne=>{const je=Br.getState(),rt=je.getTerminalSession(ie)?.bufferChunks.at(-1)?.id;if(Rr.current&&rt!==void 0&&rt<=ne&&!je.hasPendingBufferWrites(ie)&&(A7(Rr.current),Tt()),!$t.current||!O_({writtenChunkId:ne,initialTargetChunkId:Ft.current}))return;const mt=Jt.current;Jt.current=null,mt!==null&&se.current?.notifyScreenSynchronized(mt),$t.current=!1,Ft.current=null,J()},[J,Tt,ie]),er=_.useCallback(ne=>{if(!Vr.current)return;const je=co.current;je&&je.x===ne.x&&je.y===ne.y&&je.rows===ne.rows||(co.current=ne,vn.current!==null&&(window.clearTimeout(vn.current),vn.current=null),ne.x===0&&ne.y>=ne.rows-1&&vt(!1))},[]);_.useEffect(()=>{if(!p){Os.current=!1;return}Os.current||(Os.current=!0,Fs.current=!1,Vr.current=!0,co.current=null,vt(!1),vn.current!==null&&(window.clearTimeout(vn.current),vn.current=null),rn.current!==null&&window.clearTimeout(rn.current),rn.current=window.setTimeout(()=>{rn.current=null,vn.current!==null&&typeof window<"u"&&window.clearTimeout(vn.current),vn.current=null,Vr.current=!1,vt(!0)},15e3))},[p]);const ut=_.useCallback(()=>{Lr.current=null;const ne=Us.current;Us.current=null,ne&&jn(ne.sessionId,ne.title)},[jn]),Lt=_.useCallback((ne,je)=>{if(Us.current={sessionId:ne,title:je},Lr.current===null){if(typeof window>"u"){ut();return}Lr.current=window.requestAnimationFrame(ut)}},[ut]),Pr=_.useCallback(()=>{Lr.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Lr.current),Lr.current=null,Us.current=null},[]),yr=_.useCallback(async()=>{const ne=Gr;return(await O5({preferredFrontendSessionId:ie,mode:ne,tmuxSessionName:ne==="tmux"?Cr||qs:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Gr,Cr,qs,ie]),Hr=_.useRef(c);_.useEffect(()=>{if(!c){se.current?.blur(),Hr.current=!1;return}if(Hr.current)return;Hr.current=!0;const ne=OC(ve,Ie);if(ne==="single"){se.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}ne!=="none"&&se.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[c,ve,Ie,tn]),_.useEffect(()=>{Sn.current=ve},[ve]);const Tr=_.useCallback(()=>{!Ur.current||Nn.current||se.current?.focus()},[]);_.useLayoutEffect(()=>{h&&se.current?.blur()},[h]),_.useEffect(()=>{if(!c||h||We||Fs.current)return;Fs.current=!0;const ne=window.requestAnimationFrame(()=>{se.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(ne)},[h,c,We]);const Fn=_.useCallback(ne=>{typeof window>"u"||typeof document>"u"||!Ur.current||Nn.current||Sn.current||document.hidden||!Bc()||(Zs.current!==null&&window.clearTimeout(Zs.current),Zs.current=window.setTimeout(()=>{if(Zs.current=null,!Ur.current||Nn.current||Sn.current||document.hidden||!Bc())return;const je=document.activeElement,rt=je?.getAttribute("data-terminal-input-anchor")==="true";if((je instanceof HTMLInputElement||je instanceof HTMLTextAreaElement||je instanceof HTMLSelectElement||je?.isContentEditable===!0)&&!rt){ce("desktop resume focus skipped: editable active",{reason:ne});return}ce("desktop resume focus",{reason:ne}),se.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),se.current?.focus()},50))},[ce]);_.useEffect(()=>()=>{Zs.current!==null&&typeof window<"u"&&window.clearTimeout(Zs.current),Zs.current=null,Jn.current!==null&&typeof window<"u"&&window.clearTimeout(Jn.current),Jn.current=null,qr.current!==null&&typeof window<"u"&&window.clearTimeout(qr.current),qr.current=null,is.current!==null&&typeof window<"u"&&window.clearTimeout(is.current),is.current=null,rn.current!==null&&typeof window<"u"&&window.clearTimeout(rn.current),rn.current=null,vn.current!==null&&typeof window<"u"&&window.clearTimeout(vn.current),vn.current=null},[]),_.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const ne=()=>{Jn.current!==null&&window.clearTimeout(Jn.current),Jn.current=window.setTimeout(()=>{Jn.current=null;const je=document.activeElement,mt=!(je?.getAttribute("data-terminal-input-anchor")==="true")&&!!(je&&(je instanceof HTMLInputElement||je instanceof HTMLTextAreaElement||je instanceof HTMLSelectElement||je.isContentEditable));i_({isActive:Ur.current&&!Nn.current,isMobile:Sn.current,documentVisible:!document.hidden,activeElementIsEditable:mt})&&Tr()},0)};return document.addEventListener("pointerup",ne),()=>{document.removeEventListener("pointerup",ne),Jn.current!==null&&(window.clearTimeout(Jn.current),Jn.current=null)}},[Tr]);const wn=_.useCallback(()=>{Wn.current=!1,Yr(ne=>ne+1)},[]),Ts=_.useCallback((ne,je,rt)=>{const mt=Rr.current,Me=Date.now();if(mt&&je&&T7(mt)){we.current={startedAt:Me,strategy:"reconnect",reason:ne},xo("info","PWA_RESUME terminal-start",{frontendSessionId:ie,backendSessionId:mt,strategy:"reconnect",reason:ne,active:Ur.current});return}if(mt&&C7(mt,()=>{const nt=we.current;xo("info","PWA_RESUME terminal-responsive",{frontendSessionId:ie,backendSessionId:mt,durationMs:nt?Date.now()-nt.startedAt:null,strategy:nt?.strategy??"probe",reason:nt?.reason??ne}),we.current=null,P?.(ie)},{visible:rt})){we.current={startedAt:Me,strategy:"probe",reason:ne},xo("info","PWA_RESUME terminal-start",{frontendSessionId:ie,backendSessionId:mt,strategy:"probe",reason:ne,active:Ur.current}),ae("[Terminal] resume probe sent",{reason:ne,backendSessionId:mt,active:Ur.current});return}if(ae("[Terminal] resume probe missing connection, restarting ensureSession",{reason:ne,backendSessionId:mt,active:Ur.current}),!F_({initialConnectionPending:Kn.current})){ae("[Terminal] resume probe deferred during initial websocket handshake",{reason:ne,backendSessionId:mt});return}wn()},[ae,P,wn,ie]),tr=_.useCallback((ne,je)=>{const rt=Rr.current;rt&&ke.current!==ne&&(ke.current=ne,em(rt,ne,je),ae("[Terminal] flow-control state sent",{backendSessionId:rt,paused:ne,reason:je}))},[ae]),Pt=_.useCallback((ne,je)=>{const rt=Rr.current;rt&&Yt.current!==ne&&(Yt.current=ne,tm(rt,ne,je),ae("[Terminal] focus state sent",{backendSessionId:rt,focused:ne,reason:je}))},[ae]),cr=_.useCallback((ne,je)=>{const rt=Rr.current;rt&&at.current!==ne&&(at.current=ne,rm(rt,ne,je),ae("[Terminal] viewing state sent",{backendSessionId:rt,viewing:ne,reason:je}))},[ae]),Ir=n_({isActive:c&&!h,viewportFocused:Ce,documentVisible:q,windowFocused:Ve,streamReady:ht}),Wt=s_({isActive:c,documentVisible:q,windowFocused:Ve,streamReady:ht,isDesktop:Vs()!==null}),Kt=_.useRef(Ir),nn=_.useRef(Wt);_.useEffect(()=>{Kt.current=Ir,Pt(Ir,"logical-focus-change")},[Ir,Pt,tn]),_.useEffect(()=>{nn.current=Wt,cr(Wt,"logical-viewing-change")},[Wt,cr,tn]),Q9(tn,q,ht),_.useEffect(()=>{const ne=je=>{const mt=je.detail;typeof mt=="number"&&mt>=8&&mt<=32&&De(mt)};return document.addEventListener("termfontchange",ne),()=>document.removeEventListener("termfontchange",ne)},[]),_.useEffect(()=>{const ne=()=>{const Me=!document.hidden&&Bc();ye(Me),Me&&c&&Fn("visibility")},je=Me=>{c&&Fn(Me.persisted?"bfcache":"pageshow")},rt=()=>{pt(!0),Fn("window-focus")},mt=()=>pt(!1);return document.addEventListener("visibilitychange",ne),window.addEventListener(nm,ne),window.addEventListener("pageshow",je),window.addEventListener("focus",rt),window.addEventListener("blur",mt),()=>{document.removeEventListener("visibilitychange",ne),window.removeEventListener(nm,ne),window.removeEventListener("pageshow",je),window.removeEventListener("focus",rt),window.removeEventListener("blur",mt)}},[c,Fn]),_.useEffect(()=>{if(!b||!R||!An.current)return;const ne=w,je=ne<=0,rt=Te.current;if(rt?.token===b&&(rt.visible||!je))return;const mt=()=>{Te.current={token:b,visible:je},se.current?.requestRefresh(v,{skipScrollToBottom:!0}),Ts(ne>0?"global-resume-background":"global-resume-visible",ne<=0&&I,je)};if(ne<=0){mt();return}const Me=window.setTimeout(mt,ne);return()=>window.clearTimeout(Me)},[b,v,R,w,I,Ts]);const ps=_.useRef(0);_.useEffect(()=>{if(ht){ps.current=0;return}if(!jt||dn==="Authentication required"||dn===lf)return;const ne=ps.current,je=Math.min(2e3*Math.pow(2,Math.min(ne,4)),3e4),rt=setTimeout(()=>{ps.current+=1,ae("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:ps.current,backendSessionId:Rr.current}),wr("Reconnecting..."),jr(!1),wn()},je);return()=>clearTimeout(rt)},[dn,jt,ht,yn,ae,wn]),_.useEffect(()=>{if(typeof window>"u"){He(!1);return}const ne=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;He(ne)},[]),_.useEffect(()=>{(!c||!ve)&&Xe(!1),c||z(!1)},[c,ve]),_.useEffect(()=>{Rr.current=tn,ot.current=-1,Jt.current=null,Yt.current=null,at.current=null,ke.current=null},[tn]),_.useEffect(()=>{D?.(ie,ht)},[ht,D,ie]),_.useEffect(()=>{F?.(ie,ht&&Se&&Ue)},[Se,Ue,ht,F,ie]),_.useEffect(()=>{Mn||(xt.current=!1,tt.current=null,Re.current&&(clearTimeout(Re.current),Re.current=null))},[Mn]),_.useEffect(()=>{tn&&se.current?.requestRefresh("session-key-change",{force:!0})},[tn]),_.useEffect(()=>{const ne=c&&ve&&ir;ce("visibility signal",{sessionId:ie,isActive:c,isMobile:ve,isInputFocused:K,isViewportKeyboardOpen:ir,viewportKeyboardHeight:it,visible:ne}),Y?.(ie,ne)},[Y,ie,c,ve,ir,it,ce]),_.useEffect(()=>{c&&x&&x!==At.current&&(At.current=x,Tr())},[x,Tr,c]),_.useEffect(()=>{H.current=ie},[ie]),_.useEffect(()=>{!ve&&(dt!==null||Et!==null)&&(Bt(null),Vt(null),pr.current=null)},[ve,dt,Et]),_.useEffect(()=>{!tn&&(dt!==null||Et!==null)&&(Bt(null),Vt(null),pr.current=null)},[tn,dt,Et]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Fg,te?"true":"false")},[te]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Ug,qe)},[qe]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem($g,Oe)},[Oe]),_.useEffect(()=>{ft(cf());const ne=()=>{ft(cf())};return window.addEventListener("resize",ne),()=>window.removeEventListener("resize",ne)},[]);const Kr=_.useCallback(()=>{Xt.current+=1,ut(),Pr();const ne=Ps.current;Ps.current=null,eo.current=null,Kn.current=!1,It(!1),se.current?.setSessionReady(!1);const je=Rr.current;je&&em(je,!1,"stream-disconnect"),$e.current=!1,ke.current=null,ze.current=[],ne?.()},[Pr,ut]),Cs=_.useCallback(async ne=>{if(eo.current===ne){ae(`[startStream] Skipping - already connected to ${ne}`);return}ae(`[startStream] Starting stream for frontendSessionId=${ie} backendSessionId=${ne}`),Yn(null),Xn.current+=1,$t.current=!1,Ft.current=null,ge(!1),bt(!1),Kr();const je=Xt.current+1;Xt.current=je,Kn.current=!0;const rt=Br.getState().getTerminalSession(ie);if(rt?.mode==="shell"&&!rt.bufferChunks.length){const Me=await Promise.race([S7(ne),new Promise(nt=>window.setTimeout(()=>nt(null),75))]);if(Xt.current!==je||H.current!==ie)return;if(Me&&!Br.getState().getTerminalSession(ie)?.bufferChunks.length){Br.getState().replaceBuffer(ie,[Me.data]);const nt=se.current?.getDimensions();nt?.cols===Me.cols&&nt.rows===Me.rows&&_7(ne,Me.seq,Me.epoch)}}const mt=pe.connect(ne,{onEvent:Me=>{if(Xt.current!==je)return;const nt=ie;if(nt)switch(Me.type){case"connected":{Kn.current=!1;const vr=we.current;vr&&(xo("info","PWA_RESUME terminal-connected",{frontendSessionId:nt,backendSessionId:Rr.current,durationMs:Date.now()-vr.startedAt,strategy:vr.strategy,reason:vr.reason}),we.current=null),P?.(nt),(Me.runtime||Me.ptyBackend)&&ae(`[Terminal] connected frontendSessionId=${nt} backendSessionId=${Rr.current} runtime=${Me.runtime??"unknown"} pty=${Me.ptyBackend??"unknown"} cwd=${Me.cwd??"unknown"}`),Er(nt,!1),wr(null),jr(!1),Yn(null),It(!0),Rr.current&&(tm(Rr.current,Kt.current,"stream-connected"),rm(Rr.current,nn.current,"stream-connected")),se.current?.setSessionReady(!0),ke.current=null,tr($e.current,"stream-connected"),Me.tuiProgress!==void 0&&Br.getState().setSessionTuiProgress(nt,Me.tuiProgress??null),Me.shellTitle!==void 0&&Br.getState().setSessionShellTitle(nt,Me.shellTitle??null),Me.promptState!==void 0&&Me.promptState!==null&&Br.getState().setSessionPromptState(nt,Me.promptState);const Dr=Br.getState().getTerminalSession(nt);if(Dr?.terminalSessionId&&Me.mode&&Br.getState().setTerminalSession(nt,{sessionId:Dr.terminalSessionId,cols:80,rows:24,mode:Me.mode,tmuxSessionName:Me.tmuxSessionName??null,cwd:Me.cwd??null}),Me.activeProgram!==void 0&&Qt(nt,Me.activeProgram??null,Me.activeProgramSource??null,Me.activeProgramRaw??null),se.current?.requestRefresh("connected",{force:!0,reconcileServerSize:Ur.current}),Me.mode!=="tmux"&&(On(null),br(nt,!1)),ae("[Terminal] Connected event received:",{frontendSessionId:nt,backendSessionId:Rr.current,storeHasState:!!Dr,storeTerminalId:Dr?.terminalSessionId,hasHistoryInStore:!!Dr?.history?.length,historyLength:Dr?.history?.length??0}),Dr?.history&&Dr.history.length>0){ae(`[Terminal] Restoring ${Dr.history.length} history chunks to frontend session ${nt}`);const Gn=Dr.history.reduce((Is,ks)=>Is+ks.length,0),sn=Math.max(300,Math.min(2e3,Math.ceil(Gn/200)));Ze.current=Date.now()+sn,Dr.history.forEach(Is=>{le(nt,Is,{markActivity:!1})}),Br.getState().setSessionHistory(nt,[]),ae(`[Terminal] History restoration complete for ${nt}`)}else ae(`[Terminal] No history to restore for ${nt}`);const Xr=Me.replayChunks,kr=!!Dr?.history?.length||!!Xr?.length;if(kr?$t.current=!0:J(),Xr&&Xr.length>0){let Gn=null;if(Me.replayOutOfWindow)ae(`[Terminal] Replay out-of-window, atomically replacing buffer (${Xr.length} chunks)`),Gn=st(nt,Tw(Xr));else{ae(`[Terminal] Replay incremental: ${Xr.length} chunks`);for(const ks of Xr)le(nt,ks)}const sn=Xr.reduce((ks,no)=>ks+no.length,0),Is=Math.max(200,Math.min(1500,Math.ceil(sn/200)));Ze.current=Math.max(Ze.current,Date.now()+Is),Ft.current=Gn}kr&&Ft.current===null&&(Ft.current=Br.getState().flushPendingBufferWrites(nt),Ft.current===null&&($t.current=!1,J()));break}case"reconnecting":{Yn(vr=>vr??Date.now()),wr("Reconnecting..."),jr(!1);break}case"data":{Me.data&&($e.current?ze.current.push(Me.data):le(nt,Me.data));break}case"tmux-layout":{On(Me.layout??null),Me.layout&&br(nt,Me.layout.inCopyMode);break}case"tmux-screen-sync":{const vr=Me.generation??0;if(vr<ot.current)break;ot.current=vr,Xn.current+=1,$t.current=!0,ge(!1),ze.current=[],se.current?.prepareScreenReplacement(),Jt.current=vr,Ft.current=st(nt,Cw(Me.chunks??[])),Ft.current===null&&(Jt.current=null,se.current?.notifyScreenSynchronized(vr),$t.current=!1,J()),typeof Me.cols=="number"&&typeof Me.rows=="number"&&se.current?.notifyServerSize(Me.cols,Me.rows,"tmux-screen-sync");break}case"active-program":{Qt(nt,Me.activeProgram??null,Me.activeProgramSource??null,Me.activeProgramRaw??null);break}case"cwd":{re(nt,Me.cwd??null);break}case"agent-status":{ct(nt,{agentStatus:Me.agentStatus??null,agentIndicator:Me.agentIndicator??null,agentStatusDetail:Me.agentStatusDetail??null,agent:Me.agent??null,agentMessage:Me.agentMessage??null,agentNativeSessionId:Me.agentNativeSessionId??null,agentResumeRecovered:Me.agentResumeRecovered===!0,agentRich:Me.agentRich===!0,agentActivity:Me.agentActivity??0,agentCwd:Me.agentCwd??null,reviewed:Me.reviewed??null});break}case"git-status":{Br.getState().setSessionGitStatus(nt,Me.gitStatus??null);break}case"focus-mode":{ae("[Terminal] focus tracking mode",{backendSessionId:Rr.current,requested:Me.focusTrackingRequested===!0});break}case"resize-ack":{se.current?.acknowledgeResize({seq:Me.seq,ok:Me.ok!==!1,cols:Me.cols,rows:Me.rows,screenSyncPending:Me.screenSyncPending,screenSyncGeneration:Me.screenSyncGeneration});break}case"pty-size":{typeof Me.cols=="number"&&typeof Me.rows=="number"&&se.current?.notifyServerSize(Me.cols,Me.rows,Me.source);break}case"shell-title":{Lt(nt,Me.title??null);break}case"prompt-state":{dr(nt,Me.state??"idle",Me.exitCode??null);break}case"tui-progress":{Br.getState().setSessionTuiProgress(nt,Me.tuiProgress??null);break}case"exit":{const vr=typeof Me.exitCode=="number"?Me.exitCode:null,Dr=typeof Me.signal=="number"?Me.signal:null;le(nt,`\r
69
- [Process exited${vr!==null?` with code ${vr}`:""}${Dr!==null?` (signal ${Dr})`:""}]\r
70
- `),Ut(nt),Er(nt,!1),wr("Terminal session ended"),It(!1),jr(!1),Yn(null),On(null),br(nt,!1),Kr();break}}},onError:(Me,nt)=>{if(Xt.current!==je)return;const vr=ie;if(!vr)return;Kn.current=!1;const Dr=nt&&Me.message==="Authentication required",Xr=Y_(Me),kr=Dr?Me.message:Xr||nt?"Reconnecting...":Me.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${nt}):`,kr),Xr&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:Rr.current,frontendSessionId:vr,isActive:c,isMobile:ve,fatal:nt,stack:new Error().stack}),wr(kr),jr(!!nt),nt&&(Yn(null),Er(vr,!1),Kr(),Xr&&(ae("[onError] Session lost, auto-recreating"),wr("Reconnecting..."),jr(!1),Ut(vr),Zt(vr),Rr.current=null,Wn.current=!1,wn()))}},{...rL,getDimensions:()=>se.current?.getDimensions()??null});Ps.current=()=>{mt.close(),Xt.current===je&&(eo.current=null)},eo.current=ne},[le,Zt,Ut,ae,Kr,J,P,tr,wn,Lt,Er,Qt,ct,br,re,dr,pe,ie]);_.useEffect(()=>{const ne=G_({isActive:c,isStreamReady:ht,reconnectStartedAt:ss,now:Date.now()});if(ne===null)return;const je=window.setTimeout(()=>{ae("[Terminal] visible reconnect watchdog expired",{backendSessionId:Rr.current,reconnectStartedAt:ss}),Kr(),Er(ie,!1),wr("Reconnecting..."),jr(!1),Yn(Date.now()),wn()},ne);return()=>window.clearTimeout(je)},[ae,Kr,c,ht,ss,wn,ie,Er]);const Wn=_.useRef(!1),An=_.useRef(!1),$s=_.useRef(0);_.useEffect(()=>()=>{$s.current+=1,Wn.current=!1,Kr()},[Kr]);const Ho=_.useRef(Gr),ca=_.useRef(Cr);_.useEffect(()=>{const ne=Ho.current,je=ca.current;Ho.current=Gr,ca.current=Cr,H.current===ie&&(ne===Gr&&je===Cr||(Wn.current=!1,Kr(),Yr(rt=>rt+1)))},[Gr,Cr,Kr,ie]),_.useEffect(()=>{if(H.current!==ie&&(ae(`[useEffect] sessionId changed from ${H.current} to ${ie}, allowing reinitialization`),Wn.current=!1,An.current=!1),Wn.current&&H.current===ie){ae(`[useEffect] Already initialized for sessionId=${ie}, skipping`);return}if(!Ke)return;const ne=async nt=>{if(ae(`[ensureSession] Starting for sessionId=${ie}, runId=${nt}`),!H.current||H.current!==ie){ae(`[ensureSession] SessionId mismatch or stale run (current=${H.current}, target=${ie}), skipping`);return}if(nt!==$s.current){ae(`[ensureSession] Stale run detected (runId=${nt}, currentRunId=${$s.current}), skipping`);return}const vr=Br.getState(),Dr=vr.getTerminalSession(ie),Xr=Dr?.mode??Gr;ae("[ensureSession] Current state from store:",{terminalSessionId:Dr?.terminalSessionId,mode:Dr?.mode,tmuxSessionName:Dr?.tmuxSessionName,isConnecting:Dr?.isConnecting});let kr=Dr?.terminalSessionId??null,Gn=!kr;if(kr&&Xr!==Gr?(ae(`[ensureSession] Store mode mismatch for ${kr}: current=${Xr} desired=${Gr}, will create new session`),Gn=!0,vr.clearTerminalSession(ie),kr=null):kr&&Gr==="tmux"&&Cr&&Dr?.tmuxSessionName!==Cr&&(ae(`[ensureSession] Store tmux name mismatch for ${kr}: current=${Dr?.tmuxSessionName} desired=${Cr}, will create new session`),Gn=!0,vr.clearTerminalSession(ie),kr=null),kr&&pe.checkHealth&&!Ur.current){ae(`[ensureSession] Checking health of existing session ${kr}`);try{const sn=await pe.checkHealth(kr);if(ae("[ensureSession] Health check result:",sn),!sn.healthy)ae(`[ensureSession] Session ${kr} is NOT healthy (healthy=${sn.healthy}), will create new session`),ae("[ensureSession] Health check details:",sn),Gn=!0,sn.mode&&Dr?.terminalSessionId&&vr.setTerminalSession(ie,{sessionId:Dr.terminalSessionId,cols:80,rows:24,mode:sn.mode,tmuxSessionName:sn.tmuxSessionName??null}),vr.clearTerminalSession(ie),ae("[ensureSession] Cleared unhealthy session from store");else{ae(`[ensureSession] Session ${kr} is healthy, reusing it, cwd=${sn.cwd}, clients=${sn.clients}, lastActivity=${Date.now()-(sn.lastActivity||0)}ms ago`),sn.mode&&Dr?.terminalSessionId&&vr.setTerminalSession(ie,{sessionId:Dr.terminalSessionId,cols:80,rows:24,mode:sn.mode,tmuxSessionName:sn.tmuxSessionName??null}),ae(`[ensureSession] Setting terminalIdRef to ${kr} and starting stream`),Rr.current=kr,Cs(kr),ae(`[ensureSession] Successfully reused healthy session ${kr}, returning early`);return}}catch(sn){ae(`[ensureSession] Failed to check health of session ${kr}:`,sn),ae("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(ae(`[ensureSession] Decision: shouldCreateNewSession=${Gn}, terminalId=${kr}`),Gn){ae(`[ensureSession] Creating new session, shouldCreateNewSession=${Gn}, runId=${nt}`),wr(null),jr(!1),vr.setConnecting(ie,!0);const Is=Br.getState().getTerminalSession(ie),no=(Is?.mode??Gr)===Gr&&(Gr!=="tmux"||!Cr||Is?.tmuxSessionName===Cr);if(Is?.terminalSessionId&&no)ae(`[ensureSession] Race condition avoided: another instance already created session ${Is.terminalSessionId}`),vr.setConnecting(ie,!1),kr=Is.terminalSessionId,Gn=!1;else try{const gs=await yr();if(ae(`[ensureSession] Opened managed backend session ${gs.sessionId}`),nt!==$s.current){ae(`[ensureSession] Stale run after session creation (runId=${nt}, currentRunId=${$s.current}), leaving ${gs.sessionId} for sibling`);return}vr.setTerminalSession(ie,gs),ae(`[ensureSession] Updated store with new session ${gs.sessionId}`),kr=gs.sessionId}catch(gs){if(nt!==$s.current){ae("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(gs instanceof sm&&Pg(gs)){ae("[ensureSession] Confirmed missing persisted session:",{sessionId:ie,error:gs.message}),vr.clearTerminalSession(ie),wr(lf),jr(!0),vr.setConnecting(ie,!1);return}wr("Reconnecting..."),jr(!0),vr.setConnecting(ie,!1);return}}if(nt!==$s.current){ae(`[ensureSession] Stale run before starting stream (runId=${nt}, currentRunId=${$s.current}), skipping`);return}if(!kr){ae(`[ensureSession] No terminalId, terminalId=${kr}`);return}ae(`[ensureSession] Starting stream for session ${kr}`),Rr.current=kr,Cs(kr),ae(`[ensureSession] ensureSession completed for sessionId=${ie}, terminalId=${kr}`)};let je=null,rt=null;const mt=()=>{rt=null,!(Wn.current&&H.current===ie)&&(ae(`[useEffect] Running ensureSession for sessionId=${ie}, hasInitialized=${Wn.current}`),Wn.current=!0,An.current=!0,je=++$s.current,ne(je))};if(!N&&!An.current){ae(`[useEffect] Holding background connection until the selected session is ready: ${ie}`);return}const Me=An.current?0:Math.max(0,k);return Me>0?(ae(`[useEffect] Delaying initial connection for sessionId=${ie} by ${Me}ms`),rt=window.setTimeout(mt,Me)):mt(),()=>{rt!==null&&window.clearTimeout(rt),ae(`[useEffect] Cleanup for sessionId=${ie}, runId=${je??"pending"}`)}},[ie,yn,Cs,Kr,pe,ae,Gr,Cr,qs,k,N,Ke]);const Ao=_.useCallback(async()=>{if(ie&&!Ar){fn(!0),wr(null),jr(!1),Yn(null),Kr();try{pe.forceKill&&await pe.forceKill({sessionId:ie})}catch{}lr(ie),Zt(ie),se.current?.clear(),await new Promise(ne=>setTimeout(ne,100));try{Er(ie,!0);const ne=await yr();en(ie,ne),Rr.current=ne.sessionId,Cs(ne.sessionId)}catch(ne){wr(ne instanceof sm&&Pg(ne)?lf:"Reconnecting..."),jr(!0),Er(ie,!1)}finally{fn(!1)}}},[ie,Ar,Kr,pe,lr,Zt,Er,en,Cs,yr]),Wo=_.useCallback((ne,je)=>{if(!Ur.current||!ne)return;const rt=f_(ne),mt=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(ne);if(Mn&&mt&&(xt.current=!0),Date.now()<Ze.current)return;let Me=ne,nt=je?.consumeModifier??!1;if(!je?.skipModifierTransform&&dt&&ne.length>0){const Xr=ne[0];if(Xr.length===1&&/[a-zA-Z]/.test(Xr)){const kr=Xr.toUpperCase();dt==="ctrl"?(Me=String.fromCharCode(kr.charCodeAt(0)&31),nt=!0):dt==="alt"&&(Me=`\x1B${ne}`,nt=!0)}nt||(dt==="alt"&&(Me=`\x1B${ne}`),nt=!0)}const vr=Rr.current;if(!vr)return;(async()=>{try{if(Mn&&!rt&&xt.current&&pe.tmuxAction){xt.current=!1;try{await pe.tmuxAction(vr,{action:"copy-mode",enabled:!1})}catch{}if(p_(Me))return}await pe.sendInput(vr,Me),js(ie)}catch(Xr){wr(Xr instanceof Error?Xr.message:"Failed to send input")}})(),nt&&(Et||Bt(null),Tr())},[dt,js,Tr,Mn,Et,pe]);_.useEffect(()=>{const ne=je=>{if(!Ur.current)return;const rt=je,mt=rt.detail?.text;if(!mt)return;const Me=rt.detail?.nonce;if(hn.current){Me&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Me,ok:!1}}));return}se.current?.sendSequence(mt,{paste:rt.detail?.paste}),Me&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Me,ok:!0}})),o_(Sn.current,rt.detail?.focus!==!1)&&Tr()};return window.addEventListener("termdock-insert-reference",ne),()=>window.removeEventListener("termdock-insert-reference",ne)},[Tr]);const ua=_.useCallback((ne,je,rt)=>{const mt=Rr.current;if(!mt){ce("xterm resize push skipped: no terminalId",{cols:ne,rows:je});return}ce("xterm resize push",{cols:ne,rows:je}),pe.resize({sessionId:mt,cols:ne,rows:je,seq:rt}).catch(Me=>{se.current?.acknowledgeResize({seq:rt,ok:!1}),Me&&/session not found/i.test(String(Me.message||Me))&&console.warn("[Terminal] resize 404 session not found",{sessionId:mt,cols:ne,rows:je,stack:new Error().stack})})},[pe,ce]),to=_.useCallback(async ne=>{const je=Rr.current;if(!(!je||!pe.tmuxAction))try{const rt=await pe.tmuxAction(je,ne);rt.layout&&(On(rt.layout),ne.action==="switch-session"&&(en(ie,{sessionId:je,cols:80,rows:24,mode:"tmux",tmuxSessionName:rt.layout.sessionName}),nd(ie,{tmuxSessionName:rt.layout.sessionName}).catch(mt=>{console.warn("[Terminal] failed to update inventory after tmux switch",mt)})))}catch(rt){wr(rt instanceof Error?rt.message:"Failed to execute tmux action")}},[ie,en,pe]);_.useEffect(()=>{if(!Fr||!tn)return;const je=Fr.windows.find(rt=>rt.id===Fr.activeWindowId)?.panes.find(rt=>rt.id===Fr.activePaneId);je&&se.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${tn}:${Fr.sessionId}:${je.id}:${je.width}x${je.height}`})},[Fr,tn]);const da=_.useCallback((ne,je=5)=>{const rt=Math.max(1,Math.min(Math.floor(je)||1,40));xt.current=!0;const mt=tt.current;if(mt&&mt.direction===ne){mt.lines+=rt;return}mt&&to({action:"scroll",direction:mt.direction,lines:mt.lines}).finally(()=>{Tr()}),tt.current={direction:ne,lines:rt},Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{const Me=tt.current;Me&&(tt.current=null,to({action:"scroll",direction:Me.direction,lines:Me.lines}).finally(()=>{Tr()}))},0)},[Tr,to]),ha=_.useCallback(ne=>{const je=Date.now(),rt=pr.current,mt=rt!==null&&rt.modifier===ne&&je-rt.timestamp<=eL;if(pr.current={modifier:ne,timestamp:je},Et===ne){Vt(null),Bt(null);return}if(mt){Vt(ne),Bt(ne);return}Et!==null&&Et!==ne&&Vt(null),Bt(Me=>Me===ne?null:ne)},[Et]),Go=_.useCallback(ne=>{if(z(ne&&Ur.current),ce("input focus changed",{focused:ne,isActive:Ur.current,isMobile:Sn.current}),!Sn.current||!Ur.current){Xe(!1);return}Xe(je=>je===ne?je:ne)},[ce]),Ss=_.useCallback(ne=>{if($e.current=ne,tr(ne,"viewport-watermark"),!ne&&ze.current.length>0){const je=ie;if(je){const rt=ze.current;ze.current=[];for(const mt of rt)le(je,mt)}}},[le,tr,ie]),zs=_.useCallback(ne=>{Ur.current&&se.current?.ensureSizeMatches(ne)},[]),_s=_.useRef(null);_.useEffect(()=>{if(!c)return;const ne=_s.current;if(!ne)return;const je=()=>zs("pointerdown"),rt=()=>zs("keydown"),mt=()=>zs("touchstart"),Me=()=>zs("wheel");return ne.addEventListener("pointerdown",je),ne.addEventListener("keydown",rt),ne.addEventListener("touchstart",mt,{passive:!0}),ne.addEventListener("wheel",Me,{passive:!0}),()=>{ne.removeEventListener("pointerdown",je),ne.removeEventListener("keydown",rt),ne.removeEventListener("touchstart",mt),ne.removeEventListener("wheel",Me)}},[c,zs]);const Vo=_.useCallback(ne=>{se.current=ne},[]),ms=_.useCallback(ne=>{Mt(ne),V?.(ie,ne)},[V,ie]),Ka=_.useCallback(ne=>{const je=A_(ne);if(!je)return;const rt=dt!==null;se.current?.sendSequence(je,{consumeModifier:rt})},[dt]),ro=_.useCallback(ne=>{const je=x_(ne);if(je.length===0)return;const rt=dt!==null;se.current?.sendSequence(Dg(je[0]),{consumeModifier:rt});for(let mt=1;mt<je.length;mt+=1){const Me=je[mt];window.setTimeout(()=>{se.current?.sendSequence(Dg(Me))},g_*mt)}},[dt]),Ma=_.useCallback(()=>{se.current?.pasteClipboardText()},[]),Si=_.useCallback(ne=>{is.current!==null&&(window.clearTimeout(is.current),is.current=null),_r(ne),(ne==="inserted"||ne==="failed")&&(is.current=window.setTimeout(()=>{is.current=null,_r("idle")},1400))},[]),To=_.useCallback(()=>{Si("idle"),Qr(0),O.current?.click()},[Si]),Xa=_.useCallback(ne=>{const je=ne.currentTarget.files?.[0];ne.currentTarget.value="",je&&(Qr(0),Si("uploading"),a3(je,(rt,mt)=>kp(rt,mt,void 0,Qr),rt=>{if(!Ur.current||hn.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:X_(rt,null),focus:!0}}))}).then(()=>Si("inserted"),()=>Si("failed")))},[Si]),fa=Hn||dn!==null;hn.current=fa;const Na=_.useRef(ns);fa||(Na.current=ns);const Da=fa?Na.current:ns,Ys=_.useMemo(()=>b_(Da,zn),[Da,zn]),qo=_.useMemo(()=>Qg(zn,qe),[qe,zn]),ui=!ve&&qe!=="auto"&&qo.showOnDesktop!==!0?"auto":qe,Zo=ui==="auto"?Ys:ui,_i=_.useMemo(()=>Qg(zn,Zo),[Zo,zn]),os=_.useMemo(()=>_i.actions.filter(ne=>ne.sequence.trim().length>0).map((ne,je)=>({...ne,label:rp(ne,je)})),[_i.actions]),di=_.useMemo(()=>e3(ns),[ns]),Di=_i.label,Co=_.useMemo(()=>ui!=="auto"?`Manual preset: ${_i.label}`:di?`Auto preset · ${_i.label} (${di})`:"Auto preset",[di,ui,_i.label]),Ja=_.useCallback(ne=>{kt(ne)},[]),el=_.useCallback(()=>{Nt(ne=>ne==="copy"?"arrows":"copy"),Ae("idle")},[]),uo=_.useCallback(()=>{typeof window>"u"||(qr.current!==null&&window.clearTimeout(qr.current),qr.current=window.setTimeout(()=>{qr.current=null,Ae("idle")},1200))},[]),pa=_.useCallback(ne=>{qr.current!==null&&typeof window<"u"&&(window.clearTimeout(qr.current),qr.current=null),Ae(ne?"copied":"failed"),uo()},[uo]),Dn=_.useCallback(ne=>{Qe(ne)},[]),Bi=_.useMemo(()=>ve?y_(zn):v_(zn),[ve,zn]),Bn=_.useMemo(()=>L7(i),[i]),Ls=_.useMemo(()=>`terminal::${ie}`,[ie]);_.useEffect(()=>{et?.({isConnecting:Hn,isRestarting:Ar,hasError:!!dn,sessionId:tn})},[Hn,Ar,dn,tn,et]);const es=!tn||Hn||Ar,Qi=_.useCallback((ne,je)=>{if(es)return;const rt=Math.max(1,Math.min(Math.floor(je)||1,40));da(ne,rt)},[da,es]);_.useEffect(()=>{if(!c||!ve)return;se.current?.requestRefresh("resize",{skipScrollToBottom:!ir,force:!0})},[c,ve,ir,it,ie]),_.useEffect(()=>{if(!c||!ve)return;const ne=je=>{const rt=je.detail;se.current?.requestRefresh("resize",{skipScrollToBottom:rt?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",ne),()=>{document.removeEventListener("termdock:viewport-keyboard-change",ne)}},[c,ve,ie]);const Ba=!Z&&(ve||_i.showOnDesktop===!0),hi=c,fi=ve&&!Ee?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,_n=ve&&!Ee?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,Li=a.jsx(T_,{visible:Ba,interactive:hi,presentation:ve?"mobile":"desktop-actions",activeModifier:dt,lockedModifier:Et,disabled:es,defaultShowExtended:te,presetLabel:Di,presetModeLabel:Co,presetMode:ui,presetOptions:Bi,includeAlt:_i.includeAlt,presetRowLayout:_i.rowLayout,extraActions:os,onKeyPress:Ka,onTextPress:ro,onPastePress:ve?Ma:void 0,onFilePress:ve?To:void 0,fileUploadState:bn,fileUploadProgress:_e,longPressMode:Oe,copyFeedback:hr,onLongPressModeToggle:el,onModifierToggle:ha,onPresetSelect:Ja,onExpandedChange:Dn}),pi=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return a.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:fi,children:[a.jsx("input",{ref:O,type:"file",className:"hidden",onChange:Xa}),As&&a.jsx(C_,{isMobile:ve,isInputFocused:K,isIOS:Rt,isConnecting:Hn,connectionError:dn,terminalSessionId:tn}),a.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:Bn.background,..._n},children:[a.jsx("div",{ref:_s,className:"h-full w-full box-border",children:a.jsx(I7,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("span",{className:"text-sm text-muted-foreground",children:Pe("terminal.componentFailed")})]})}),children:a.jsx(e_,{ref:Vo,sessionKey:Ls,isLayoutVisible:m,chunks:ws,onInput:Wo,onResize:ua,onFlowControl:Ss,onTmuxScroll:Mn?Qi:void 0,tmuxScrollSensitivity:.38,onDoubleTap:ve?()=>{se.current?.sendSequence(" ")}:void 0,onInputFocusChange:Go,onMobileLongPressCopyResult:pa,onReadyChange:ms,onSizeSynchronizedChange:bt,onWritesSettled:ue,onWriteProgress:_t,onCursorPositionChange:er,onDirectoryLinkActivate:Pn,terminalSettings:Ge,theme:Bn,enableTouchScroll:ve,mobileLongPressMode:Oe,autoFocus:!h&&!ve&&!pi,cursorVisible:!h&&We,suppressSmoothScroll:!Se||!Ue,className:h||!We?"terminal-focus-suspended":void 0},Ls)})}),a.jsx(__,{connectionError:dn,isFatalError:jt,isRestarting:Ar,isConnecting:Hn,onHardRestart:Ao})]}),he?Z?null:Ya.createPortal(Li,he):Li]})};function sL({session:e,active:t,onActivate:r,onToggleRightSidebar:s}){const{t:i}=an(),u=Br(c=>{const h=c.sessions.get(e.id);return ka(e,h?.activeProgram??null,h?.cwd??null,void 0,h?.shellTitle??null,h?.promptState??null).primary});return a.jsxs("div",{className:"swiper-no-swiping flex h-6 min-h-6 shrink-0 items-center border-b border-border app-chrome-bg",children:[a.jsxs("button",{type:"button","data-split-pane-title":e.id,"aria-pressed":t,title:u,onClick:r,className:"flex h-full min-w-0 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:[a.jsx($o,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:u}),t&&a.jsx("span",{"aria-hidden":"true",className:"h-1 w-1 shrink-0 rounded-full bg-primary"})]}),s&&a.jsx("button",{type:"button",onClick:s,"aria-label":i("tab.explorerTitle"),title:i("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:a.jsx(tx,{size:14})})]})}const iL=1e3,oL=2e4,aL=9e4,lL=5e3,Wr={ws:null,listeners:new Set,reconnectAttempt:0,reconnectTimer:null,idleCloseTimer:null,closing:!1};let Wu=0,Q0=null;function cL(){return typeof window>"u"?null:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/control/ws`}function l3(){Wr.idleCloseTimer&&(clearTimeout(Wr.idleCloseTimer),Wr.idleCloseTimer=null)}function uL(){l3(),!(Wr.ws&&Wr.ws.readyState===WebSocket.OPEN)&&(Wr.idleCloseTimer=setTimeout(()=>{Wr.idleCloseTimer=null,Wr.listeners.size===0&&dL()},lL))}function dL(){if(Wr.ws){try{Wr.ws.close()}catch{}Wr.ws=null}Q0&&(clearInterval(Q0),Q0=null)}function zg(){if(Wr.reconnectTimer)return;const e=Math.min(iL*Math.pow(2,Wr.reconnectAttempt),oL);Wr.reconnectAttempt+=1,Wr.reconnectTimer=setTimeout(()=>{Wr.reconnectTimer=null,c3()},e)}function c3(){const e=cL();if(!e||Wr.ws&&Wr.ws.readyState===WebSocket.OPEN)return;let t;try{t=k7(e)}catch{zg();return}Wr.ws=t,t.onopen=()=>{Wr.reconnectAttempt=0,Wu=Date.now(),Q0||(Q0=setInterval(()=>{if(!(!Wr.ws||Wr.ws.readyState!==WebSocket.OPEN)&&Wu>0&&Date.now()-Wu>aL)try{Wr.ws.close()}catch{}},3e4),Q0.unref?.())},t.onmessage=r=>{Wu=Date.now();let s=null;try{s=JSON.parse(r.data)}catch{return}if(!s)return;if(s.type==="update-state"){const c=s.state;if(!c||typeof c.status!="string"||typeof c.currentVersion!="string")return;const h={type:"update-state",state:c};for(const p of Wr.listeners)try{p(h)}catch(m){console.error("[clientStateSync] listener threw:",m)}return}if(s.type==="context-draft"){if(typeof s.text!="string")return;const c={type:"context-draft",text:s.text,updatedAt:typeof s.updatedAt=="number"?s.updatedAt:Date.now(),origin:typeof s.origin=="string"?s.origin:null};for(const h of Wr.listeners)try{h(c)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(s.type==="pinned-explorer-roots"){if(!s.pinnedExplorerRoots||typeof s.pinnedExplorerRoots!="object"||Array.isArray(s.pinnedExplorerRoots))return;const c={type:"pinned-explorer-roots",pinnedExplorerRoots:s.pinnedExplorerRoots,updatedAt:typeof s.updatedAt=="number"?s.updatedAt:Date.now(),origin:typeof s.origin=="string"?s.origin:null};for(const h of Wr.listeners)try{h(c)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(s.type==="config-updated"){if(s.key!=="toolbar-presets"&&s.key!=="agent-rules"&&s.key!=="program-detection")return;const c={type:"config-updated",key:s.key,updatedAt:typeof s.updatedAt=="number"?s.updatedAt:void 0};for(const h of Wr.listeners)try{h(c)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(s.type!=="client-state"||!s.state)return;const i=s.state,u={type:"client-state",clientState:{sessions:Array.isArray(i.sessions)?i.sessions:[],updatedAt:typeof i.updatedAt=="number"?i.updatedAt:Date.now()},inventory:s.inventory,seq:typeof s.seq=="number"?s.seq:void 0};for(const c of Wr.listeners)try{c(u)}catch(h){console.error("[clientStateSync] listener threw:",h)}},t.onclose=()=>{Wr.ws===t&&(Wr.ws=null),Wr.listeners.size>0&&zg()},t.onerror=()=>{}}function np(e){return Wr.listeners.add(e),l3(),Wr.ws||c3(),()=>{Wr.listeners.delete(e),Wr.listeners.size===0&&uL()}}function u3(e,t,r){const s=e.findIndex(i=>r(i)===t);return s<0?null:e[s+1]?r(e[s+1]):s>0?r(e[s-1]):null}const uf="termdock-sessions",sp="termdock-active-session",Zp="termdock-sessions-cache";function ip(){try{const e=localStorage.getItem(sp);return e&&e.trim().length>0?e:null}catch{return null}}function A0(e){try{e?localStorage.setItem(sp,e):localStorage.removeItem(sp)}catch{}}function d3(){if(typeof window>"u")return null;try{const e=localStorage.getItem(Zp);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null&&typeof r.sessionId=="string"&&typeof r.name=="string"):null}catch{return null}}function Ol(e){if(!(typeof window>"u"))try{localStorage.setItem(Zp,JSON.stringify(e))}catch{}}function Hg(){if(!(typeof window>"u"))try{localStorage.removeItem(Zp)}catch{}}function h3(e){return e.map(t=>({...t,mode:t.mode==="tmux"?"tmux":"shell",tmuxSessionName:t.tmuxSessionName??null,customName:t.customName===!0}))}function Wg(e){return h3(e.map(t=>({sessionId:t.sessionId,name:t.name,customName:t.customName===!0,backendSessionId:t.backendSessionId,mode:t.mode,tmuxSessionName:t.tmuxSessionName,createdAt:t.createdAt,lastActivity:t.lastActivity}))).map((t,r)=>({...t,activeProgram:e[r]?.activeProgram??null,cwd:e[r]?.cwd??null}))}function Gg(e){return e.map(t=>`${t.sessionId}:${t.name}:${t.customName}:${t.backendSessionId}:${t.mode}:${t.tmuxSessionName}:${t.lastActivity}:${t.activeProgram??""}:${t.cwd??""}`).join("|")}function op(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function hL(){const e=d3()??[];return{sessions:e,activeSessionId:op(e,ip())}}function fL(){const e=T.useRef(d3()).current,t=T.useRef(ip()).current,[r,s]=T.useState(e??[]),[i,u]=T.useState(null),[c,h]=T.useState(e&&e.length>0?op(e,t):t),[p,m]=T.useState(e===null),x=T.useRef(!1),b=T.useRef(null),v=T.useRef(e===null),w=T.useRef(0),I=T.useRef(new Set),k=T.useRef(0);T.useEffect(()=>{v.current=p},[p]),T.useEffect(()=>{b.current=c},[c]);const N=T.useCallback(fe=>{const De=op(fe,b.current??ip());return h(pe=>pe===De?pe:De),A0(De),b.current=De,De},[]),R=T.useCallback((fe,De)=>{const pe=fe.filter(ae=>!I.current.has(ae.sessionId));s(ae=>Gg(ae)===Gg(pe)?ae:pe),Ol(pe),De?.reconcileActive&&N(pe)},[N]),D=T.useCallback((fe,De)=>{const pe=I.current.size===0?fe:{...fe,clientSessions:fe.clientSessions.filter(ae=>!I.current.has(ae.sessionId))};u(pe),R(Wg(pe.clientSessions),De)},[R]),P=T.useCallback(()=>typeof window>"u"?[]:localStorage.getItem(uf)?(localStorage.removeItem(uf),Hg(),A0(null),s([]),h(null),console.info("[session-persist] discarded legacy local session cache"),[]):[],[]),V=T.useCallback(async()=>{if(typeof window>"u")return[];const fe=k.current;try{const De=await E7(),pe=Wg(De.clientSessions);return fe!==k.current?(console.info("[session-inventory] ignored restore snapshot superseded by a local mutation"),pe.filter(ae=>!I.current.has(ae.sessionId))):(D(De,{reconcileActive:!0}),pe.length>0?pe:P())}catch(De){console.error("Failed to restore sessions from server:",De);try{return P()}catch(pe){console.error("Failed to discard legacy local sessions:",pe)}}finally{m(!1)}return[]},[D,P]),F=T.useCallback(async fe=>{const De=++k.current,pe=await O5(fe);return De===k.current&&(D(pe.inventory),h(pe.session.sessionId),A0(pe.session.sessionId)),pe},[D]),Y=T.useCallback(async(fe,De)=>{++k.current,I.current.add(fe),s(pe=>{const ae=pe.filter(we=>we.sessionId!==fe),ce=De!=null&&ae.some(we=>we.sessionId===De),Te=b.current===fe?ce?De:u3(pe,fe,we=>we.sessionId):b.current;return h(Te),A0(Te),Ol(ae),ae});try{await R7(fe)}catch(pe){console.error("Failed to remove session from inventory:",pe)}},[]),Z=T.useCallback(fe=>{const De=Date.now();s(pe=>{const ae=pe.map(ce=>ce.sessionId===fe?{...ce,lastActivity:De}:ce);return Ol(ae),ae})},[]),he=T.useCallback(fe=>{h(fe),A0(fe)},[]),Ee=T.useCallback(async(fe,De)=>{const pe=De.trim();if(!pe)return;const ae=++k.current;s(ce=>{const Te=ce.map(we=>we.sessionId===fe?{...we,name:pe,customName:!0}:we);return Ol(Te),Te});try{const ce=await nd(fe,{name:pe,customName:!0});ae===k.current&&D(ce)}catch(ce){console.error("Failed to rename session in inventory:",ce)}},[D]),Ie=T.useCallback(async fe=>{const De=++k.current;s(pe=>{const ae=pe.map(ce=>ce.sessionId===fe?{...ce,customName:!1}:ce);return Ol(ae),ae});try{const pe=await nd(fe,{customName:!1});De===k.current&&D(pe)}catch(pe){console.error("Failed to reset session name in inventory:",pe)}},[D]),be=T.useCallback(async fe=>{const De=++k.current;s(pe=>{const ae=new Map(pe.map(ie=>[ie.sessionId,ie])),ce=fe.map(ie=>ae.get(ie)).filter(ie=>ie!==void 0),Te=new Set(fe),we=pe.filter(ie=>!Te.has(ie.sessionId)),Ge=[...ce,...we];return Ol(Ge),Ge});try{const pe=await M7(fe);De===k.current&&D(pe)}catch(pe){console.error("Failed to reorder sessions in inventory:",pe)}},[D]),et=T.useCallback(async()=>{++k.current;for(const fe of r)I.current.add(fe.sessionId);s([]),u(null),h(null),A0(null),Hg(),typeof window<"u"&&localStorage.removeItem(uf);try{await N7()}catch(fe){console.error("Failed to clear session inventory:",fe)}},[r]),Pe=T.useCallback(async(fe,De)=>{const pe=++k.current;s(ae=>{const ce=ae.map(Te=>Te.sessionId===fe?{...Te,backendSessionId:De}:Te);return Ol(ce),ce});try{const ae=await nd(fe,{backendSessionId:De});pe===k.current&&D(ae)}catch(ae){console.error("Failed to update session backend in inventory:",ae)}},[D]);return T.useEffect(()=>{x.current||(x.current=!0,V())},[V]),T.useEffect(()=>np(De=>{if(De.type!=="client-state"||v.current)return;const pe=typeof De.seq=="number"?De.seq:null;if(pe!==null){if(pe<w.current){console.warn("[session-inventory] ignored stale control snapshot",{seq:pe,latestSeq:w.current});return}w.current=pe}if(De.inventory){D(De.inventory,{reconcileActive:!0});return}const ae=h3(De.clientState.sessions||[]);R(ae,{reconcileActive:!0})}),[D,R]),{sessions:r,inventory:i,activeSessionId:c,isLoading:p,openSession:F,removeSession:Y,updateSessionActivity:Z,setActiveSession:he,updateSessionBackendId:Pe,renameSession:Ee,resetSessionCustomName:Ie,reorderSessions:be,clearAllSessions:et,restoreSessions:V}}const pL="termdock:startup:";function N0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${pL}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function mL(e,t){e||Ya.flushSync(t)}const ap="horizontal";function Ra(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function Zl(e,t){if(!Array.isArray(e)||e.length!==t)return Ra(t);const r=e.map(Number);if(r.some(i=>!Number.isFinite(i)||i<=0))return Ra(t);const s=r.reduce((i,u)=>i+u,0);return s<=0?Ra(t):r.map(i=>i/s)}function f3(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 gL(e,t,r,s){if(t<0||t>=e.length-1)return e;const i=[...e],u=i.slice(0,t).reduce((m,x)=>m+x,0),c=i[t]+i[t+1],h=Math.max(0,Math.min(c/2,s)),p=Math.min(c-h,Math.max(h,r-u));return i[t]=p,i[t+1]=c-p,i}function xL(e){return e==="horizontal"||e==="vertical"||e==="grid"}function bL(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,s=[];for(const i of e){if(!i||typeof i!="object")continue;const u=i;if(typeof u.id!="string"||!u.id||r.has(u.id))continue;const c=Array.isArray(u.sessionIds)?u.sessionIds.filter(m=>typeof m=="string"&&!!m&&!t.has(m)):[],h=[...new Set(c)];if(h.length<2)continue;const p=f3(h.length);h.forEach(m=>t.add(m)),r.add(u.id),s.push({id:u.id,...typeof u.name=="string"&&u.name.trim()?{name:u.name.trim().slice(0,80)}:{},sessionIds:h,layout:xL(u.layout)?u.layout:ap,ratios:Zl(u.ratios,h.length),...u.gridColumnRatios!==void 0?{gridColumnRatios:Zl(u.gridColumnRatios,p.columns)}:{},...u.gridRowRatios!==void 0?{gridRowRatios:Zl(u.gridRowRatios,p.rows)}:{}})}return s}function yL(e,t){const r=new Set(t);return e.flatMap(s=>{const i=s.sessionIds.filter(u=>r.has(u));return i.length<2?[]:[{...s,sessionIds:i,ratios:i.length===s.sessionIds.length?Zl(s.ratios,i.length):Ra(i.length)}]})}function Xc(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function df(e,t,r){if(!t||!r||t===r)return e;const s=Xc(e,t),i=Xc(e,r);if(s&&s.id===i?.id)return e;const u=[...s?.sessionIds??[t],...i?.sessionIds??[r]],c=[...new Set(u)],h={id:s?.id??`split:${t}`,...s?.name?{name:s.name}:{},sessionIds:c,layout:c.length>2&&(!s||s.layout===ap)?"grid":s?.layout??ap,ratios:Ra(c.length)},p=new Set([s?.id,i?.id].filter(Boolean)),m=e.filter(b=>!p.has(b.id)),x=s?Math.max(0,e.findIndex(b=>b.id===s.id)):m.length;return m.splice(Math.min(x,m.length),0,h),m}function vL(e,t){const r=Xc(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(i=>i.id!==r.id);const s=r.sessionIds.filter(i=>i!==t);return e.map(i=>i.id===r.id?{...i,sessionIds:s,ratios:Ra(s.length)}:i)}function wL(e,t){const r=Xc(e,t);return r?e.filter(s=>s.id!==r.id):e}function AL(e,t,r){return e.map(s=>{if(s.id!==t)return s;const i=[...new Set(r)],u=new Set(s.sessionIds);return i.length===s.sessionIds.length&&i.every(h=>u.has(h))?{...s,sessionIds:i}:s})}function TL(e,t,r){const s=r.trim().slice(0,80);return e.map(i=>i.id===t?{...i,...s?{name:s}:{name:void 0}}:i)}const lp=320,p3=1,CL=lp+120,cp="termdock:split-workspaces:v2",m3="termdock:split-workspace:v1",SL=.1,_L=.9,LL=.28,IL=300,kL=8,EL=280,RL=160;function hf(){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 ML(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(cp);if(e)return bL(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(m3)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(_L,Math.max(SL,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 NL(e,t){const r=new Map(e.map(c=>[c.id,c])),s=new Map;t.forEach(c=>c.sessionIds.forEach(h=>s.set(h,c)));const i=new Set,u=[];for(const c of e){const h=s.get(c.id);if(!h){u.push({key:c.id,sessions:[c]});continue}if(i.has(h.id))continue;i.add(h.id);const p=h.sessionIds.flatMap(m=>{const x=r.get(m);return x?[x]:[]});p.length>=2&&u.push({key:h.id,sessions:p,workspace:h})}return u}function Vg(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function Gu(e,t){const r=Ld(e,t);if(r===null)return;const s=e.wrapperEl;Vg(e),s&&(s.style.transitionDuration="0ms");try{const i=e;i.setTransition?.(0),i.setTranslate?.(r),Vg(e),s&&(s.style.transitionDuration="0ms",s.style.transform=`translate3d(${r}px, 0px, 0px)`)}catch{s&&(s.style.transitionDuration="0ms",s.style.transform=`translate3d(${r}px, 0px, 0px)`)}}function up(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 Ld(e,t){const r=e.snapGrid,s=Array.isArray(r)?r[t]:void 0;return typeof s!="number"||!Number.isFinite(s)?null:-s}function DL(e,t){const r=up(e),s=Ld(e,t);return r!==null&&s!==null&&Math.abs(r-s)<=p3}function BL(e){const t=[],r=new Map,s=new Map,i=new Map;for(const u of e){const c=r.get(u.id)??[];if(c.push(u.id),r.set(u.id,c),u.sessionId){const h=s.get(u.sessionId)??[];h.push(u.id),s.set(u.sessionId,h)}if(u.mode==="tmux"&&u.tmuxSessionName){const h=i.get(u.tmuxSessionName)??[];h.push(u.id),i.set(u.tmuxSessionName,h)}}for(const[u,c]of r)c.length>1&&t.push({kind:"frontend",key:u,sessionIds:c});for(const[u,c]of s)c.length>1&&t.push({kind:"backend",key:u,sessionIds:c});for(const[u,c]of i)c.length>1&&t.push({kind:"tmux",key:u,sessionIds:c});return t}function g3(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function x3(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 QL(e,t){const r=g3(e),s=r.findIndex(i=>i.id===t.id);if(s>=0){const i=[...r];return i[s]=t,i}return[...r,t]}function qg(e,t){const r=new Map(e.map(s=>[s.id,s]));return t.map(s=>{const i=r.get(s.sessionId);return{...x3(s),history:i?.history}})}function Zg(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function Yg(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 Kg(e){const t=new Map;for(const[r,s]of e)t.set(r,s.cwd??null);return t}function jL(e,t){if(e.size!==t.size)return!1;for(const[r,s]of t)if(e.get(r)!==s)return!1;return!0}function PL(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const r=Date.now().toString(36),s=Math.random().toString(36).slice(2,8);return`wt-${r}${s}`}const OL=({terminalSettings:e=Wp(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:s,terminalFocusAvailable:i=!0,defaultSessionMode:u="shell",defaultTmuxSessionName:c="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:m=!1,onToggleRightSidebar:x,desktopFloatingTitle:b=!1,desktopPinnedLeftSidebarWidth:v=0,desktopViewportWidth:w=0,onStatusChange:I,onSessionDataUpdate:k,onInitialViewportReady:N,onInitialRecoveryRequired:R})=>{const{t:D}=an(),P=T.useMemo(()=>j0("session"),[]),V=T.useMemo(()=>j0("terminal"),[]),[F,Y]=T.useState([]),[Z,he]=T.useState(null),[Ee,Ie]=T.useState(null),[be,et]=T.useState(!0),[Pe,fe]=T.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[De,pe]=T.useState(()=>new Set),[ae,ce]=T.useState(()=>({token:0,completed:new Set})),[Te,we]=T.useState(0),[Ge,ie]=T.useState(()=>new Set),[ve,ft]=T.useState(()=>new Set),[Rt,He]=T.useState(()=>new Set),K=T.useRef(!1),Xe=T.useRef(null),Ce=T.useRef({}),[z,q]=T.useState(null),[ye,Ve]=T.useState(()=>ML()),[pt,ht]=T.useState(!1),[It,Se]=T.useState(null),[ge,Ue]=T.useState(null),[bt,Ke]=T.useState(null),[Mt,We]=T.useState(!1),[vt,ir]=T.useState(()=>hf().mobile),[it,dt]=T.useState(()=>hf().landscape),[Bt,Et]=T.useState(null),[Vt,te]=T.useState(null),Qe=T.useRef(i),qe=T.useRef(!1),kt=T.useRef(!1),Oe=T.useRef(null),Nt=T.useRef(null),hr=T.useRef(vt),Ae=T.useRef(null),bn=T.useRef(0),_r=T.useRef([]),_e=T.useRef(0),Qr=T.useRef(null),wt=T.useRef(!1),en=T.useRef(!0),Er=T.useRef(null),le=T.useRef(""),st=T.useRef(null),Ut=T.useRef(0);T.useEffect(()=>{if(typeof window>"u")return;const O=()=>{const J=hf();hr.current=J.mobile,ir(J.mobile),dt(J.landscape)};return O(),window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);const{sessions:lr,inventory:Zt,activeSessionId:Qt,isLoading:re,openSession:br,setActiveSession:ct,removeSession:jn,renameSession:dr,resetSessionCustomName:js,reorderSessions:qs,restoreSessions:fs}=fL(),Cn=Zt?.tmuxRecovery??null;T.useEffect(()=>{Cn&&R?.()},[Cn,R]),T.useEffect(()=>{Ke(null),Ue(null)},[Cn?.id]);const ns=T.useCallback(async()=>{Ue("restore"),Ke(null);try{const O=await D7();await fs(),O.failed>0&&Ke(D("tab.tmuxRecoveryPartial",{restored:O.restored,failed:O.failed}))}catch{Ke(D("tab.tmuxRecoveryFailed"))}finally{Ue(null)}},[fs,D]),zn=T.useCallback(async()=>{Ue("dismiss"),Ke(null);try{await B7(),await fs()}catch{Ke(D("tab.tmuxRecoveryDismissFailed"))}finally{Ue(null)}},[fs,D]),Mn=Ht(O=>O.groupByFolder),ws=bd(O=>O.collaborationGroups),Hn=Ht(O=>O.leftOpen||O.rightOpen),tn=Ht(O=>O.rightSidebarWidthContextKey),Pn=Ht(O=>O.rightSidebarWidth),Gr=Ht(O=>O.rightPinned),[Cr,dn]=T.useState(()=>Kg(Br.getState().sessions));T.useEffect(()=>Br.subscribe(O=>{const J=Kg(O.sessions);dn(ue=>jL(ue,J)?ue:J)}),[]);const{arranged:wr}=T.useMemo(()=>Sd(F,O=>Cr.get(O.id)??null,Mn,"",ye,ws),[F,Cr,Mn,ye,ws]),hn=T.useRef(wr);hn.current=wr;const jt=T.useMemo(()=>NL(wr,ye),[wr,ye]),jr=T.useRef(jt);jr.current=jt;const Ar=T.useMemo(()=>Xc(ye,Z),[Z,ye]),fn=T.useMemo(()=>{const O=jt.find(J=>J.sessions.some(ue=>ue.id===Z));return new Set(O?.sessions.map(J=>J.id)??[])},[Z,jt]),ss=T.useMemo(()=>{const O=new Map;if(!m||w<=0)return O;for(const J of jt){const ue=J.sessions[0];if(!ue)continue;const Be=Q7(ue.id,Cr.get(ue.id)??null,J.workspace?.id??null);if(!(Be===tn?Gr:j7(ue.id,Cr.get(ue.id)??null,J.workspace?.id??null)))continue;const _t=Be===tn?Pn:P7(ue.id,Cr.get(ue.id)??null,J.workspace?.id??null),er=sd(_t,w,v);O.set(J.key,er+F5)}return O},[Cr,v,m,Gr,tn,Pn,w,jt]),Yn=T.useMemo(()=>af(F.map(O=>({id:O.id,backendSessionId:O.sessionId})),h),[h,F]),yn=T.useMemo(()=>Zg(lr,Qt),[Qt,lr]),Yr=Hu({prioritySessionId:Yn,activeSessionId:Ee??Z,persistedActiveSessionId:yn,firstSessionId:F[0]?.id??null}),Fr=T.useMemo(()=>V_(jt.flatMap(O=>O.sessions.map(J=>J.id)),fn),[fn,jt]),On=Yr!==null&&De.has(Yr),As=T.useMemo(()=>{const O=new Set(fn);return Ee&&O.add(Ee),!O.size&&Yr&&O.add(Yr),O},[fn,Ee,Yr]),Ps=ae.token===Pe.token&&z_(As,ae.completed),eo=Ps||Te===Pe.token?Pe.token:-1;T.useEffect(()=>{if(!Pe.token||Ps)return;const O=window.setTimeout(()=>we(Pe.token),M_);return()=>window.clearTimeout(O)},[Pe.token,Ps]);const Rr=T.useCallback((O,J)=>{pe(ue=>{if(ue.has(O)===J)return ue;const Tt=new Set(ue);return J?Tt.add(O):Tt.delete(O),Tt})},[]),H=T.useCallback(O=>{const J=bn.current;ce(Be=>{if(Be.token===J&&Be.completed.has(O))return Be;const Tt=new Set(Be.token===J?Be.completed:[]);return Tt.add(O),{token:J,completed:Tt}});const ue=Yn??Ee??Ae.current;O===ue&&N0("foreground-stream-connected")},[Ee,Yn]),se=T.useCallback((O,J)=>{ie(ue=>{if(ue.has(O)===J)return ue;const Be=new Set(ue);return J?Be.add(O):Be.delete(O),Be})},[]),$e=T.useCallback((O,J)=>{ft(ue=>{if(ue.has(O)===J)return ue;const Be=new Set(ue);return J?Be.add(O):Be.delete(O),Be})},[]),ke=Yr!==null&&Ge.has(Yr),ze=Yr!==null&&ve.has(Yr);T.useEffect(()=>{ke&&N0("foreground-viewport-ready")},[ke]),T.useEffect(()=>{ze&&N0("foreground-content-ready")},[ze]),T.useEffect(()=>{if(N){if(!be&&F.length===0){N();return}!ke||!On||!ze||(N0("initial-viewport-presented"),N())}},[On,ze,ke,be,N,F.length]);const Ze=T.useMemo(()=>vt?B_({slides:jt.map(O=>O.sessions.map(J=>J.id)),visibleSessionIds:fn,foregroundSessionId:Yr}):Rt,[vt,jt,fn,Yr,Rt]);T.useEffect(()=>{if(vt||fn.size===0)return;const O=new Set(fn),J=jt.findIndex(ue=>ue.sessions.some(Be=>fn.has(Be.id)));for(let ue=-2;ue<=2;ue+=1)ue!==0&&jt[J+ue]?.sessions.forEach(Be=>O.add(Be.id));He(ue=>{let Be=!1;const Tt=new Set(ue);for(const _t of O)Tt.has(_t)||(Tt.add(_t),Be=!0);return Be?Tt:ue})},[vt,fn,jt]);const xt=B9(Ze);T.useEffect(()=>{if(!Ee)return;if(!F.some(J=>J.id===Ee)){Ie(null);return}if(!Ge.has(Ee)||!De.has(Ee)||!ve.has(Ee))return;const O=window.setTimeout(()=>{Ie(J=>J===Ee?null:J),Qe.current&&!hr.current&&q({sessionId:Ee,token:Date.now()})},80);return()=>window.clearTimeout(O)},[ve,Ee,De,F,Ge]),T.useEffect(()=>{typeof window>"u"||(ye.length>0?(window.localStorage.setItem(cp,JSON.stringify(ye)),window.localStorage.removeItem(m3)):window.localStorage.removeItem(cp))},[ye]),T.useEffect(()=>{re||be||ye.length===0||Ve(O=>yL(O,F.map(J=>J.id)))},[re,be,F,ye.length]),T.useEffect(()=>{if(!It)return;const O=window.setTimeout(()=>Se(null),3200);return()=>window.clearTimeout(O)},[It]),T.useEffect(()=>()=>st.current?.(),[]),Ae.current=Z,bn.current=Pe.token,_r.current=F,Qr.current=Qt,wt.current=re,en.current=be,Qe.current=i;const tt=T.useCallback((O=Xe.current)=>{const J=_e.current,ue=typeof window<"u"?window.visualViewport:null,Be=O?up(O):null,Tt=O?Ld(O,J):null;return{sessionsLength:_r.current.length,workspaceSlidesLength:jr.current.length,sessionIds:_r.current.map(_t=>_t.id),activeSessionId:Ae.current,activeSessionIndex:J,persistedActiveId:Qr.current,isLoading:wt.current,isRestoring:en.current,activeIndex:O?.activeIndex??null,previousIndex:O?.previousIndex??null,animating:O?.animating??null,allowTouchMove:O?.allowTouchMove??null,width:O?.width??null,translate:Be,targetTranslate:Tt,translateDelta:Be!==null&&Tt!==null?Be-Tt:null,snapGridLength:O?.snapGrid?.length??null,targetSnap:O?.snapGrid?.[J]??null,visualViewport:ue?{width:Math.round(ue.width),height:Math.round(ue.height),offsetTop:Math.round(ue.offsetTop)}:null}},[]),Re=T.useCallback((O,J)=>{P(O,{...tt(),...J})},[P,tt]);T.useEffect(()=>{re||be||Z!==Qt&&ct(Z)},[Z,re,be,Qt,ct]);const ot=T.useMemo(()=>{if(wr.length===0||!Z)return 0;const O=jt.findIndex(J=>J.sessions.some(ue=>ue.id===Z));return O>=0?O:0},[jt,Z]);_e.current=ot;const pr=T.useCallback(()=>{Oe.current&&(clearTimeout(Oe.current),Oe.current=null)},[]),At=T.useCallback(O=>{pr(),Oe.current=setTimeout(()=>{Oe.current=null,qe.current=!1,Re("[swiper:touch-guard-clear]",{reason:O})},CL)},[pr,Re]),Yt=T.useCallback((O,J={})=>{const ue=Xe.current,Be=_e.current,Tt=jr.current;if(!ue||Tt.length===0||Be<0||Be>=Tt.length)return;if(qe.current){Re("[swiper:sync-skip-touch]",{reason:O});return}if(ue.animating){Re("[swiper:sync-skip-animating]",{reason:O});return}const _t=up(ue),er=Ld(ue,Be),ut=_t!==null&&er!==null&&Math.abs(_t-er)<=p3,Lt=ue.activeIndex===Be;if(Re("[swiper:sync-check]",{reason:O,activeIndexAligned:Lt,translateAligned:ut,immediate:J.immediate===!0}),!(Lt&&ut)){if(Lt){Gu(ue,Be),Re("[swiper:sync-forced-active]",{reason:O,translateAligned:ut,immediate:J.immediate===!0});return}J.immediate?(Gu(ue,Be),ue.slideTo(Be,0,!1),Gu(ue,Be)):ue.slideTo(Be,lp,!1),Re("[swiper:sync-applied]",{reason:O,activeIndexAligned:Lt,translateAligned:ut,immediate:J.immediate===!0})}},[Re]);T.useEffect(()=>{const O=J=>{const ue=J;Xe.current&&(Xe.current.allowTouchMove=!ue.detail.locked),Re("[swiper:gesture-lock]",{locked:ue.detail.locked})};return document.addEventListener("termdock:gesture-lock",O),()=>document.removeEventListener("termdock:gesture-lock",O)},[Re]),T.useEffect(()=>{if(F.length===0){Z!==null&&he(null);return}if(!Z){if(!p)return;he(Hu({prioritySessionId:Yn,activeSessionId:null,persistedActiveSessionId:yn,firstSessionId:F[0]?.id??null}));return}F.some(J=>J.id===Z)||he(F[0].id)},[F,Z,p,Yn,yn]);const at=T.useCallback((O,J)=>{if(J&&Date.now()<Ut.current){Ce.current[O]=!1;return}Ce.current[O]=J,te(ue=>J?O:ue===O?null:ue)},[]),Xt=T.useCallback(O=>{if(!qe.current&&O.activeIndex!==_e.current){Re("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:O.activeIndex,expectedActiveIndex:_e.current}),requestAnimationFrame(()=>Yt("ignored-layout-slide-change",{immediate:!0}));return}const J=jr.current[O.activeIndex],ue=J?.sessions.some(_t=>_t.id===Z)?Z:J?.sessions[0]?.id;if(Re("[swiper:slide-change]",{nextSessionId:ue??null,instanceActiveIndex:O.activeIndex}),!ue||ue===Z)return;const Be=!!Z&&Ce.current[Z]===!0,Tt=Qe.current&&(!hr.current||Be);if(Nt.current=ue,he(ue),Tt){q({sessionId:ue,token:Date.now()});return}q(null)},[F,Z,Re,Yt]);T.useLayoutEffect(()=>{if(Nt.current===Z){Re("[swiper:sync-skip-swiper-driven]",{activeSessionId:Z}),Nt.current=null;return}Yt("active-session-index",{immediate:!0})},[Z,ot,F.length,Yt,Re]),T.useEffect(()=>{const O=Xe.current;if(!O)return;const J=jt.length>1&&!Hn&&!pt;O.allowTouchMove!==J&&(O.allowTouchMove=J,Re("[swiper:allow-touch-sync]",{nextAllow:J,sidebarOverlayOpen:Hn}))},[jt.length,Re,Hn,pt]);const $t=T.useCallback(O=>{const J=Xe.current;if(!J)return;const ue=J.el;if(Re("[swiper:layout-before]",{reason:O,scrollLeft:ue?.scrollLeft??null}),ue&&(ue.scrollLeft=0),J.updateSize(),J.updateSlides(),J.updateProgress(),J.updateSlidesClasses(),ue&&(ue.scrollLeft=0),Re("[swiper:layout-after]",{reason:O,scrollLeft:ue?.scrollLeft??null}),qe.current||J.animating){Re("[swiper:layout-skip-sync-motion]",{reason:O});return}Yt(`layout:${O}`,{immediate:!0}),requestAnimationFrame(()=>{const Be=Xe.current;Be&&(qe.current||Be.animating||Gu(Be,_e.current))})},[Re,Yt]);T.useEffect(()=>()=>pr(),[pr]);const Ft=jt.map(O=>O.key).join("\0");T.useEffect(()=>{requestAnimationFrame(()=>$t("group-change"))},[Mn,Ft,$t]),T.useEffect(()=>{let O=null,J="mount";const ue=ut=>{J=ut,O===null&&(O=requestAnimationFrame(()=>{O=null,$t(`viewport-change:${J}`)}))},Be=()=>ue("window-resize"),Tt=()=>ue("visual-viewport-resize"),_t=()=>ue("visual-viewport-scroll"),er=ut=>{ue(`measured:${ut.detail?.source??"unknown"}`)};return window.addEventListener("resize",Be),window.visualViewport?.addEventListener("resize",Tt),window.visualViewport?.addEventListener("scroll",_t),document.addEventListener(im,er),ue("mount"),()=>{window.removeEventListener("resize",Be),window.visualViewport?.removeEventListener("resize",Tt),window.visualViewport?.removeEventListener("scroll",_t),document.removeEventListener(im,er),O!==null&&cancelAnimationFrame(O)}},[$t]),T.useEffect(()=>{if(typeof document>"u")return;let O=null,J=null;const ue=Lt=>{if(Lt!=="online"&&document.hidden)return;const Pr=performance.now();if(!H_(J,Pr))return;J=Pr;const yr=Lt==="bfcache"||Lt==="online"?Lt:"visibility",Hr=W_();kh(),xo("info","PWA_RESUME scheduled",{source:Lt,forceForegroundReconnect:Hr,activeSessionId:Ae.current}),fe(Tr=>({token:Tr.token+1,reason:yr,forceForegroundReconnect:Hr})),requestAnimationFrame(()=>$t(`resume:${Lt}:raf`)),O&&clearTimeout(O),O=setTimeout(()=>{O=null,$t(`resume:${Lt}:settled`)},320)},Be=()=>{if(document.hidden){kh();return}ue("visibility")},Tt=()=>{kh()},_t=Lt=>{ue(Lt.persisted?"bfcache":"pageshow")},er=()=>ue("online"),ut=()=>ue("focus");return document.addEventListener("visibilitychange",Be),window.addEventListener("pagehide",Tt),window.addEventListener("pageshow",_t),window.addEventListener("online",er),window.addEventListener("focus",ut),()=>{document.removeEventListener("visibilitychange",Be),window.removeEventListener("pagehide",Tt),window.removeEventListener("pageshow",_t),window.removeEventListener("online",er),window.removeEventListener("focus",ut),O&&clearTimeout(O)}},[$t]),T.useLayoutEffect(()=>{if(!U_(be))return;const O=BL(F),J=JSON.stringify(O);O.length>0&&J!==le.current?(le.current=J,console.warn("[session-invariant] duplicate mapping detected",O)):O.length===0&&le.current&&(le.current=""),k?.({sessions:F.map(ue=>({id:ue.id,name:ue.name,customName:ue.customName,mode:ue.mode,tmuxSessionName:ue.tmuxSessionName})),activeSessionId:Z,splitWorkspaces:ye.map(({id:ue,name:Be,sessionIds:Tt,layout:_t})=>({id:ue,...Be?{name:Be}:{},sessionIds:Tt,layout:_t}))})},[F,Z,ye,k,be]),T.useEffect(()=>{if(re||K.current)return;K.current=!0;const O=af(lr.map(_t=>({id:_t.sessionId,backendSessionId:_t.backendSessionId??null})),h),J=Zg(lr,Qt),ue=Hu({prioritySessionId:p?O:null,activeSessionId:null,persistedActiveSessionId:J,firstSessionId:lr[0]?.sessionId??null}),Be=g3(lr.map(x3));if(P("[Session] Restoring",Be.length,"persisted sessions (one-shot)"),Re("[swiper:restore-start]",{persistedSessionIds:lr.map(_t=>_t.sessionId),nextActiveSessionId:ue}),Be.length>0){const _t=Br.getState();Be.forEach(ut=>{ut.sessionId&&_t.setTerminalSession(ut.id,{sessionId:ut.sessionId,cols:80,rows:24,mode:ut.mode,tmuxSessionName:ut.tmuxSessionName,history:ut.history})}),lr.forEach(ut=>{ut.activeProgram!=null&&_t.setSessionActiveProgram(ut.sessionId,ut.activeProgram),ut.cwd!=null&&_t.setSessionCwd(ut.sessionId,ut.cwd)}),Y(Be);const er=ue||Be[0]?.id||null;he(er),Re("[swiper:restore-complete]",{restoredSessionIds:Be.map(ut=>ut.id),nextActiveSessionId:er})}(async()=>(Be.length===0&&await Er.current?.({createIfEmpty:!0}),et(!1),requestAnimationFrame(()=>Yt("restore-finished",{immediate:!0}))))()},[re,lr,Qt,P,Re,Yt,p,h]),T.useEffect(()=>{if(!p||be||F.length===0)return;const O=af(F.map(ue=>({id:ue.id,backendSessionId:ue.sessionId})),h),J=Hu({prioritySessionId:O,activeSessionId:Ae.current,persistedActiveSessionId:yn,firstSessionId:F[0]?.id??null});J&&J!==Ae.current&&he(J)},[p,h,be,yn,F]);const Jt=T.useRef([]),Kn=T.useRef(!1);Ae.current=Z,T.useEffect(()=>{if(be)return;const O=Jt.current,J=lr;if(!Kn.current){Y(Lt=>qg(Lt,J)),Jt.current=J,Kn.current=!0;return}const ue=new Set(O.map(Lt=>Lt.sessionId)),Be=new Set(J.map(Lt=>Lt.sessionId)),Tt=new Map(O.map(Lt=>[Lt.sessionId,Lt.name]));Jt.current=J,Y(Lt=>{const Pr=qg(Lt,J);return(!Ae.current||!Pr.some(yr=>yr.id===Ae.current))&&he(Pr[0]?.id??null),Pr});const _t=J.filter(Lt=>!ue.has(Lt.sessionId)),er=[...ue].filter(Lt=>!Be.has(Lt)),ut=J.filter(Lt=>ue.has(Lt.sessionId)&&Tt.get(Lt.sessionId)!==Lt.name);(_t.length>0||er.length>0||ut.length>0)&&P("[Session] Synced persisted sessions:",{newSessionIds:_t.map(Lt=>Lt.sessionId),removedSessionIds:er,renamedSessionIds:ut.map(Lt=>Lt.sessionId),currentSessionIds:J.map(Lt=>Lt.sessionId)});for(const Lt of J){if(!Lt.backendSessionId)continue;Br.getState().setTerminalSession(Lt.sessionId,{sessionId:Lt.backendSessionId,cols:80,rows:24,mode:Lt.mode,tmuxSessionName:Lt.tmuxSessionName})}},[lr,be,P]);const Xn=T.useCallback(async O=>{try{const J=O?.mode==="tmux"||O?.mode==="shell"?O.mode:u,ue=(O?.tmuxSessionName||"").trim(),Be=c.trim(),Tt=J==="tmux"?ue||Be||PL():null,_t=typeof O?.cwd=="string"?O.cwd:null,er=Z?Br.getState().sessions.get(Z)?.cwd??null:null,ut=typeof _t=="string"&&_t.trim().length>0?_t:typeof er=="string"&&er.trim().length>0?er:void 0,Lt=await br({mode:J,tmuxSessionName:Tt,cwd:ut,termType:"xterm-256color",createIfEmpty:O?.createIfEmpty===!0}),Pr=Lt.session,yr=Lt.terminalSession,Hr={id:Pr.sessionId,name:Pr.name,customName:Pr.customName===!0,sessionId:yr.sessionId,mode:yr.mode??Pr.mode,tmuxSessionName:yr.tmuxSessionName??Pr.tmuxSessionName};Y(wn=>QL(wn,Hr)),he(Hr.id),Br.getState().setTerminalSession(Hr.id,{sessionId:yr.sessionId,cols:80,rows:24,mode:Hr.mode,tmuxSessionName:Hr.tmuxSessionName,activeProgram:yr.activeProgram,activeProgramRaw:yr.activeProgramRaw,activeProgramSource:yr.activeProgramSource,cwd:yr.cwd}),P("[Session] Inventory opened session:",{frontendSessionId:Hr.id,backendSessionId:yr.sessionId,reused:Lt.reused,mode:Hr.mode,tmuxSessionName:Hr.tmuxSessionName});const Fn=O?.command?.trim();return Fn&&await P5(yr.sessionId,`${Fn}\r`),Hr.id}catch(J){return console.error("[Session] Failed to create new session:",J),null}},[u,c,Z,br,P]);Er.current=Xn;const Vr=T.useCallback((O,J={})=>{const ue=Ae.current,Be=!!ue&&Ce.current[ue]===!0;if(he(O),hr.current&&J.preserveMobileKeyboard===!1){Ut.current=Date.now()+600,ue&&(Ce.current[ue]=!1),te(null),q(null);const Tt=document.activeElement;Tt instanceof HTMLTextAreaElement&&Tt.closest(".terminal-viewport-container")&&Tt.blur();return}Be&&hr.current&&te(O),Qe.current&&(!hr.current||Be)&&q({sessionId:O,token:Date.now()})},[]),Os=T.useCallback(O=>{he(O),ht(!0),Se(null)},[]),Fs=T.useCallback(O=>{const J=Ae.current;!J||J===O||(Ve(ue=>df(ue,J,O)),ht(!1),Vr(J,{preserveMobileKeyboard:!1}))},[Vr]),co=T.useCallback(async()=>{const O=Ae.current;if(!O||Mt)return;We(!0);const J=Br.getState().sessions.get(O)?.cwd??void 0,ue=await Xn({cwd:J||void 0,mode:u});if(We(!1),!ue){Se(D("common.error"));return}Ve(Be=>df(Be,O,ue)),ht(!1),Vr(O,{preserveMobileKeyboard:!1})},[Vr,u,Xn,Mt,D]),vn=T.useCallback(O=>{Ve(J=>wL(J,O)),O&&Vr(O,{preserveMobileKeyboard:!1})},[Vr]),rn=T.useCallback(O=>{Ve(J=>vL(J,O)),Vr(O,{preserveMobileKeyboard:!1})},[Vr]),Ur=T.useCallback((O,J,ue,Be,Tt,_t="linear",er)=>{O.preventDefault(),O.stopPropagation();const ut=O.currentTarget,Lt=O.pointerId,Pr={x:O.clientX,y:O.clientY};ut.setPointerCapture?.(Lt);const yr=J.getBoundingClientRect();let Hr=!vt,Tr=null;const Fn=Ts=>{if(Ts.pointerId!==Lt)return;if(!Hr){Math.hypot(Ts.clientX-Pr.x,Ts.clientY-Pr.y)>kL&&Tr!==null&&(window.clearTimeout(Tr),Tr=null);return}Ts.preventDefault();const tr=ue?(Ts.clientY-yr.top)/yr.height:(Ts.clientX-yr.left)/yr.width,Pt=ue?yr.height:yr.width,cr=vt?0:ue?RL:EL;Ve(Ir=>Ir.map(Wt=>{if(Wt.id!==Be)return Wt;const Kt=er??Wt.sessionIds.length,nn=_t==="grid-columns"?Wt.gridColumnRatios:_t==="grid-rows"?Wt.gridRowRatios:Wt.ratios,ps=Zl(nn,Kt),Kr=ps[Tt]+ps[Tt+1],Cs=cr>0?Math.min(Kr/2,cr/Math.max(1,Pt)):Math.min(Kr/2,LL),Wn=gL(ps,Tt,tr,Cs);return _t==="grid-columns"?{...Wt,gridColumnRatios:Wn}:_t==="grid-rows"?{...Wt,gridRowRatios:Wn}:{...Wt,ratios:Wn}}))},wn=()=>{Tr!==null&&(window.clearTimeout(Tr),Tr=null),window.removeEventListener("pointermove",Fn),window.removeEventListener("pointerup",wn),window.removeEventListener("pointercancel",wn),ut.classList.remove("bg-primary"),vt&&document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),st.current=null};st.current?.(),st.current=wn,window.addEventListener("pointermove",Fn),window.addEventListener("pointerup",wn),window.addEventListener("pointercancel",wn),vt&&(document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),Tr=window.setTimeout(()=>{Tr=null,Hr=!0,ut.classList.add("bg-primary"),navigator.vibrate?.(8)},IL))},[vt]),Nn=T.useCallback(O=>{if(F.find(ue=>ue.id===O)){if(O===Ae.current)return;if(he(O),!P_({isMobile:hr.current,viewportReady:Ge.has(O),streamReady:De.has(O),contentReady:ve.has(O)})){Ie(null),Qe.current&&q({sessionId:O,token:Date.now()}),P("[Session] Switched to session:",O);return}He(Be=>{if(Be.has(O))return Be;const Tt=new Set(Be);return Tt.add(O),Tt}),Ie(O),P("[Session] Switched to session:",O)}},[ve,P,De,F,Ge]),Sn=T.useCallback((O,J)=>{J.trim()&&(Y(ue=>ue.map(Be=>Be.id===O?{...Be,name:J.trim(),customName:!0}:Be)),dr(O,J.trim()))},[dr]),Zs=T.useCallback(O=>{Y(J=>J.map(ue=>ue.id===O?{...ue,customName:!1}:ue)),js(O)},[js]),Jn=T.useCallback(O=>{Y(J=>{const ue=new Map(J.map(er=>[er.id,er])),Be=O.map(er=>ue.get(er)).filter(er=>er!==void 0),Tt=new Set(O),_t=J.filter(er=>!Tt.has(er.id));return[...Be,..._t]}),qs(O),P("[Session] Reordered sessions:",O),requestAnimationFrame(()=>{Xe.current?.update()})},[qs,P]),Us=T.useCallback(async O=>{const J=typeof O=="string"?O:O.sessionId,ue=typeof O=="string"?"auto":O.closeMode??"auto",Be=F.find(_t=>_t.id===J);if(!Be)return;const Tt=u3(wr,J,_t=>_t.id);try{ue==="destroy"&&Be.mode==="tmux"&&Be.tmuxSessionName?(await U5(Be.tmuxSessionName),P("[Session] Destroyed tmux session:",{frontendSessionId:Be.id,tmuxSessionName:Be.tmuxSessionName})):Be.sessionId&&(await j5(Be.sessionId),P("[Session] Closed backend terminal:",Be.sessionId))}catch(_t){console.error("[Session] Failed to close backend terminal:",_t);return}Y(_t=>{const er=_t.filter(ut=>ut.id!==J);return he(Tt),er}),jn(J,Tt),delete Ce.current[J],P("[Session] Closed session:",{sessionId:J,closeMode:ue})},[F,wr,jn,P]),Lr=T.useCallback(O=>{if(!O)return;const J=F.filter(ue=>ue.sessionId===O);if(J.length!==0){J.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:O,frontendSessionIds:J.map(ue=>ue.id)}),Y(ue=>{const Be=ue.filter(Tt=>Tt.sessionId!==O);return Be.length!==ue.length&&!Be.some(_t=>_t.id===Z)&&he(Be.length>0?Be[0].id:null),Be});for(const ue of J)jn(ue.id),delete Ce.current[ue.id];P("[Session] Backend gone, dropped local session(s):",J.map(ue=>ue.id))}},[F,Z,jn,P]);T.useEffect(()=>{const O=tr=>{Xn(tr.detail)},J=tr=>{Nn(tr.detail)},ue=()=>{const tr=Ae.current;!tr||hr.current||q({sessionId:tr,token:Date.now()})},Be=tr=>{const Pt=tr;Pt.detail&&Os(Pt.detail)},Tt=tr=>{const Pt=tr.detail;vn(Pt??Ae.current??void 0)},_t=tr=>{const Pt=tr.detail;Pt&&rn(Pt)},er=tr=>{const Pt=tr.detail,cr=typeof Pt=="string"?Pt:Pt?.layout,Ir=typeof Pt=="string"?Ae.current:Pt?.sessionId;cr!=="horizontal"&&cr!=="vertical"&&cr!=="grid"||Ve(Wt=>Wt.map(Kt=>Kt.sessionIds.includes(Ir??"")?{...Kt,layout:cr}:Kt))},ut=tr=>{const cr=tr.detail?.direction;if(cr!=="prev"&&cr!=="next")return;const Ir=hn.current;if(Ir.length<=1)return;const Wt=Ae.current,Kt=Wt?Ir.findIndex(Wn=>Wn.id===Wt):-1,Kr=((Kt>=0?Kt:0)+(cr==="next"?1:-1)+Ir.length)%Ir.length,Cs=Ir[Kr]?.id;Cs&&Cs!==Wt&&Nn(Cs)},Lt=tr=>{Us(tr.detail)},Pr=tr=>{Lr(tr.detail)},yr=tr=>{const Pt=tr;!Pt.detail?.sessionId||!Pt.detail?.name||Sn(Pt.detail.sessionId,Pt.detail.name)},Hr=tr=>{const Pt=tr;Pt.detail?.sessionId&&Zs(Pt.detail.sessionId)},Tr=tr=>{const Pt=tr;Pt.detail?.sessionIds&&Jn(Pt.detail.sessionIds)},Fn=tr=>{const Pt=tr.detail;!Pt?.workspaceId||!Array.isArray(Pt.sessionIds)||Ve(cr=>AL(cr,Pt.workspaceId,Pt.sessionIds))},wn=tr=>{const Pt=tr.detail;!Pt?.workspaceId||typeof Pt.name!="string"||Ve(cr=>TL(cr,Pt.workspaceId,Pt.name))},Ts=tr=>{const Pt=tr.detail;!Pt?.primaryId||!Pt.secondaryId||Pt.primaryId===Pt.secondaryId||(Ve(cr=>df(cr,Pt.primaryId,Pt.secondaryId)),Vr(Pt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",O),window.addEventListener("switch-terminal-session",J),window.addEventListener("focus-active-terminal-session",ue),window.addEventListener("open-terminal-split-chooser",Be),window.addEventListener("close-terminal-split",Tt),window.addEventListener("remove-terminal-split-pane",_t),window.addEventListener("set-terminal-split-direction",er),window.addEventListener("cycle-terminal-session",ut),window.addEventListener("close-terminal-session",Lt),window.addEventListener("close-terminal-session-by-backend",Pr),window.addEventListener("rename-terminal-session",yr),window.addEventListener("reset-terminal-session-name",Hr),window.addEventListener("reorder-terminal-session",Tr),window.addEventListener("reorder-terminal-split-workspace",Fn),window.addEventListener("rename-terminal-split-workspace",wn),window.addEventListener("combine-terminal-split-sessions",Ts),()=>{window.removeEventListener("new-terminal-session",O),window.removeEventListener("switch-terminal-session",J),window.removeEventListener("focus-active-terminal-session",ue),window.removeEventListener("open-terminal-split-chooser",Be),window.removeEventListener("close-terminal-split",Tt),window.removeEventListener("remove-terminal-split-pane",_t),window.removeEventListener("set-terminal-split-direction",er),window.removeEventListener("cycle-terminal-session",ut),window.removeEventListener("close-terminal-session",Lt),window.removeEventListener("close-terminal-session-by-backend",Pr),window.removeEventListener("rename-terminal-session",yr),window.removeEventListener("reset-terminal-session-name",Hr),window.removeEventListener("reorder-terminal-session",Tr),window.removeEventListener("reorder-terminal-split-workspace",Fn),window.removeEventListener("rename-terminal-split-workspace",wn),window.removeEventListener("combine-terminal-split-sessions",Ts)}},[Vr,Xn,Nn,Os,vn,rn,Us,Lr,Sn,Zs,Jn]),T.useEffect(()=>{if(!Ar||vt)return;const O=J=>{if(!(J.ctrlKey||J.metaKey)||!J.shiftKey)return;if(Ar.layout==="horizontal"?J.key==="ArrowLeft"||J.key==="ArrowRight":Ar.layout==="vertical"?J.key==="ArrowUp"||J.key==="ArrowDown":J.key.startsWith("Arrow")){J.preventDefault(),J.stopPropagation();const Be=Ar.sessionIds.indexOf(Ae.current??""),Tt=J.key==="ArrowLeft"||J.key==="ArrowUp"?-1:1,_t=(Math.max(0,Be)+Tt+Ar.sessionIds.length)%Ar.sessionIds.length,er=Ar.sessionIds[_t];if(!er)return;Vr(er);return}J.key==="Backspace"&&(J.preventDefault(),J.stopPropagation(),vn(Ae.current??void 0))};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[Vr,Ar,vn,vt]);const qr=O=>{const J=Br.getState().sessions.get(O.id);return ka(O,J?.activeProgram??null,J?.cwd??null,void 0,J?.shellTitle??null,J?.promptState??null)},is=(O,J={})=>{const ue=O.id===Z,Be=fn.has(O.id)&&!J.hidden,Tt=p&&j_({sessionId:O.id,foregroundSessionId:Yr,visibleSessionIds:fn,deferredViewportSessionIds:vt?xt:Ze}),_t=Q_({sessionId:O.id,foregroundSessionId:Yr,foregroundReady:On,isVisible:Be})&&p,er=$_({sessionId:O.id,foregroundSessionId:Yr,requestToken:Pe.token,foregroundCompletedToken:eo,isVisible:As.has(O.id)})&&p,ut=Be||O.id===Yr||Ze.has(O.id)?0:Fr.get(O.id)??fd;return a.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${J.hidden?"invisible pointer-events-none":""}`,style:J.containerStyle,"aria-hidden":J.hidden||void 0,onPointerDown:()=>{!ue&&Be&&Vr(O.id)},onWheelCapture:()=>{mL(ue,()=>Vr(O.id))},children:[J.showPaneTitle&&a.jsx(sL,{session:O,active:ue,onActivate:()=>Vr(O.id),onToggleRightSidebar:ue?x:void 0}),a.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Tt&&a.jsx(nL,{sessionId:O.id,mode:O.mode,tmuxSessionName:O.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:ue,focusSuspended:Ee!==null,deferCursorUntilPositioned:Ee===O.id||O.mode==="tmux"&&!ve.has(O.id),isLayoutVisible:Be,initialConnectEnabled:_t&&er,resumeRequestEnabled:er,suppressKeyboard:J.suppressKeyboard,keyboardPortalTarget:J.keyboardPortalTarget,sharedMobileKeyboardLayout:J.sharedMobileKeyboardLayout,suppressPageFlipRefresh:J.suppressPageFlipRefresh,focusRequestToken:z?.sessionId===O.id?z.token:0,resumeRequestToken:Pe.token,resumeRequestReason:Pe.reason,forceResumeReconnect:Pe.forceForegroundReconnect&&As.has(O.id),resumeRequestDelayMs:As.has(O.id)?0:J.hidden?fd:Fr.get(O.id)??fd,initialConnectDelayMs:ut,onStreamReadyChange:Rr,onStreamConnected:H,onViewportReadyChange:se,onContentReadyChange:$e,onKeyboardVisibilityChange:at,showDebug:s,onStatusChange:ue?I:void 0})})]},O.id)};return a.jsxs("div",{className:"relative h-full flex flex-col",children:[Cn&&a.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:a.jsxs("div",{className:"flex items-start gap-3",children:[a.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:a.jsx(Y5,{size:18})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:D("tab.tmuxRecoveryTitle",{count:Cn.sessions.length})}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.tmuxRecoveryHint")}),a.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Cn.sessions.map(O=>O.name).join(" · ")}),bt&&a.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:bt}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsxs("button",{type:"button",disabled:ge!==null,onClick:()=>{ns()},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:[a.jsx(rx,{size:13,className:ge==="restore"?"animate-spin":""}),D(ge==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),a.jsx("button",{type:"button",disabled:ge!==null,onClick:()=>{zn()},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:D("tab.tmuxRecoveryDismiss")})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Qv,{onSwiper:O=>{Xe.current=O,O.allowTouchMove=jt.length>1&&!Hn&&!pt,Re("[swiper:on-swiper]",{allowTouchMove:O.allowTouchMove}),requestAnimationFrame(()=>$t("on-swiper"))},onSlideChange:Xt,onTouchStart:(O,J)=>{const ue=Yg(J),Be=ue==="touch"||ue==="pen"||ue==="unknown";V("[swipe:touch-start]",{pointerType:ue,allowed:Be}),Re("[swiper:touch-start]",{pointerType:ue,allowed:Be}),Be&&(pr(),kt.current=!0,qe.current=!0)},onTouchEnd:(O,J)=>{const ue=Yg(J),Be=ue==="touch"||ue==="pen"||ue==="unknown";V("[swipe:touch-end]",{pointerType:ue,allowed:Be}),Re("[swiper:touch-end]",{pointerType:ue,allowed:Be}),Be&&(kt.current=!1,At("touch-end"))},onTransitionEnd:()=>{const O=Xe.current;if(kt.current){Re("[swiper:transition-end-during-touch]");return}if(qe.current&&O&&!DL(O,_e.current)){Re("[swiper:transition-end-deferred]");return}pr(),qe.current=!1,Re("[swiper:transition-end]")},initialSlide:Math.max(0,ot),speed:lp,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:jt.map(O=>{const J=O.workspace,ue=!!J&&O.sessions.length>=2,Be=vt?it?"horizontal":"vertical":J?.layout??"horizontal",Tt=Be==="vertical",_t=J?.ratios.length===O.sessions.length?J.ratios:Ra(O.sessions.length),er=Vt?O.sessions.findIndex(cr=>cr.id===Vt):-1,ut=vt&&Vt?O.sessions.some(cr=>cr.id===Vt):!1,Lt=O.sessions.some(cr=>cr.id===Z)?Z:O.sessions[0]?.id,Pr=_t.flatMap((cr,Ir)=>[ut&&Ir!==er?"0px":`minmax(0, ${cr}fr)`,...Ir<_t.length-1?[ut?"0px":"1px"]:[]]).join(" "),{columns:yr,rows:Hr}=f3(O.sessions.length),Tr=Zl(J?.gridColumnRatios,yr),Fn=Zl(J?.gridRowRatios,Hr),wn=Tr.slice(0,-1).map((cr,Ir)=>Tr.slice(0,Ir+1).reduce((Wt,Kt)=>Wt+Kt,0)),Ts=Fn.slice(0,-1).map((cr,Ir)=>Fn.slice(0,Ir+1).reduce((Wt,Kt)=>Wt+Kt,0)),tr=O.sessions.length%yr,Pt={...Be==="grid"?{gridTemplateColumns:Tr.map(cr=>`minmax(0, ${cr}fr)`).join(" "),gridTemplateRows:Fn.map(cr=>`minmax(0, ${cr}fr)`).join(" "),gap:"1px"}:Tt?{gridTemplateRows:Pr}:{gridTemplateColumns:Pr},...vt?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:{}};return a.jsx(jv,{className:"h-full",children:a.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":ss.get(O.key)??0,style:{paddingRight:ss.get(O.key)??0,paddingTop:b&&!ue?"2.5rem":void 0},children:ue?a.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:vt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[a.jsxs("div",{"data-split-container":"true",className:"relative grid min-h-0 min-w-0 flex-1 overflow-hidden",style:Pt,children:[O.sessions.map((cr,Ir)=>a.jsxs(_.Fragment,{children:[is(cr,{showPaneTitle:!vt,suppressKeyboard:vt&&cr.id!==Lt,keyboardPortalTarget:vt?Bt:null,sharedMobileKeyboardLayout:vt,suppressPageFlipRefresh:!0,hidden:ut&&er!==Ir,containerStyle:Be==="grid"&&tr>0&&Ir===O.sessions.length-1?{gridColumn:`span ${yr-tr+1}`}:void 0}),Be!=="grid"&&Ir<O.sessions.length-1&&J&&a.jsx("button",{type:"button",className:`swiper-no-swiping relative z-20 touch-none select-none bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary ${Tt?"cursor-row-resize":"cursor-col-resize"} ${ut?"invisible pointer-events-none":""}`,onPointerDownCapture:Wt=>{const Kt=Wt.currentTarget.closest('[data-split-container="true"]');Kt instanceof HTMLDivElement&&Ur(Wt,Kt,Tt,J.id,Ir)},onDoubleClick:Wt=>{vt||(Wt.preventDefault(),Wt.stopPropagation(),Ve(Kt=>Kt.map(nn=>nn.id===J.id?{...nn,ratios:Ra(nn.sessionIds.length)}:nn)))},onContextMenu:Wt=>{vt&&Wt.preventDefault()},"aria-label":D("tab.split"),children:a.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:`absolute ${Tt?"inset-x-0":"inset-y-0"}`,style:Tt?{top:-12,bottom:-12}:{left:-12,right:-12}})})]},cr.id)),Be==="grid"&&J&&wn.map((cr,Ir)=>a.jsx("button",{type:"button","data-split-grid-column-divider":Ir,className:"swiper-no-swiping absolute top-0 z-20 w-px -translate-x-1/2 touch-none select-none cursor-col-resize bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary",style:{left:`${cr*100}%`,bottom:tr===0||Ir<tr-1?0:`${(Fn.at(-1)??0)*100}%`},onPointerDownCapture:Wt=>{const Kt=Wt.currentTarget.closest('[data-split-container="true"]');Kt instanceof HTMLDivElement&&Ur(Wt,Kt,!1,J.id,Ir,"grid-columns",yr)},onDoubleClick:Wt=>{Wt.preventDefault(),Wt.stopPropagation(),Ve(Kt=>Kt.map(nn=>nn.id===J.id?{...nn,gridColumnRatios:Ra(yr)}:nn))},"aria-label":D("tab.split"),children:a.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:"absolute inset-y-0",style:{left:-12,right:-12}})},`grid-column-divider:${Ir}`)),Be==="grid"&&J&&Ts.map((cr,Ir)=>a.jsx("button",{type:"button","data-split-grid-row-divider":Ir,className:"swiper-no-swiping absolute inset-x-0 z-20 h-px -translate-y-1/2 touch-none select-none cursor-row-resize bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary",style:{top:`${cr*100}%`},onPointerDownCapture:Wt=>{const Kt=Wt.currentTarget.closest('[data-split-container="true"]');Kt instanceof HTMLDivElement&&Ur(Wt,Kt,!0,J.id,Ir,"grid-rows",Hr)},onDoubleClick:Wt=>{Wt.preventDefault(),Wt.stopPropagation(),Ve(Kt=>Kt.map(nn=>nn.id===J.id?{...nn,gridRowRatios:Ra(Hr)}:nn))},"aria-label":D("tab.split"),children:a.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:"absolute inset-x-0",style:{top:-12,bottom:-12}})},`grid-row-divider:${Ir}`))]}),vt&&a.jsx("div",{ref:Et,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):is(O.sessions[0])})},O.key)})})}),pt&&Z&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>ht(!1),"aria-label":D("common.close")}),a.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":D("tab.splitTitle"),children:[a.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[a.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:a.jsx(Hl,{size:17})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:D("tab.splitTitle")}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.splitExistingHint")})]}),a.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:()=>ht(!1),"aria-label":D("common.close"),children:a.jsx(vs,{size:16})})]}),a.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[a.jsxs("button",{type:"button",disabled:Mt,onClick:()=>{co()},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:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:a.jsx(Xi,{size:17})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:D("tab.splitNew")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:D("tab.splitNewHint")})]})]}),ye.filter(O=>O.id!==Ar?.id).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitExistingGroups")}),ye.filter(O=>O.id!==Ar?.id).map((O,J)=>{const ue=O.sessionIds.flatMap(_t=>{const er=F.find(ut=>ut.id===_t);return er?[er]:[]});if(ue.length<2)return null;const Be=O.name||`${D("tab.splitWorkspace")} ${J+1}`,Tt=ue.map(_t=>qr(_t).primary).join(" · ");return a.jsxs("button",{type:"button",onClick:()=>Fs(ue[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:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(Hl,{size:15})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:Be}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:D("tab.splitOccupied")})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[D("tab.sessionCount",{count:ue.length})," · ",Tt]})]}),a.jsx(la,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},O.id)})]}),a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitAvailableSessions")}),F.filter(O=>!ye.some(J=>J.sessionIds.includes(O.id))&&O.id!==Z).length===0&&ye.filter(O=>O.id!==Ar?.id).length===0?a.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:D("tab.splitNoOtherSessions")}):F.filter(O=>!ye.some(J=>J.sessionIds.includes(O.id))&&O.id!==Z).map(O=>{const J=Cr.get(O.id)??null,ue=qr(O);return a.jsxs("button",{type:"button",onClick:()=>Fs(O.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:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:J?a.jsx(O0,{size:15}):a.jsx(Hl,{size:15})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:ue.primary}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:J?Ea(J)??J:O.name})]}),a.jsx(la,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},O.id)})]})]})]}),It&&a.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:It})]})},FL={sm:"h-4 w-7",md:"h-6 w-10"},UL={sm:"h-3 w-3",md:"h-5 w-5"},$L={sm:"translate-x-3",md:"translate-x-4"};function Wa({checked:e,disabled:t=!1,size:r="md",className:s=""}){return a.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${FL[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${s}`,children:a.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${UL[r]} ${e?$L[r]:""}`})})}function Yi(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 zL=typeof Symbol=="function"&&Symbol.observable||"@@observable",Xg=zL,Jg=()=>Math.random().toString(36).substring(7).split("").join("."),HL={INIT:`@@redux/INIT${Jg()}`,REPLACE:`@@redux/REPLACE${Jg()}`},e2=HL;function WL(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 b3(e,t,r){if(typeof e!="function")throw new Error(Yi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Yi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Yi(1));return r(b3)(e,t)}let s=e,i=t,u=new Map,c=u,h=0,p=!1;function m(){c===u&&(c=new Map,u.forEach((N,R)=>{c.set(R,N)}))}function x(){if(p)throw new Error(Yi(3));return i}function b(N){if(typeof N!="function")throw new Error(Yi(4));if(p)throw new Error(Yi(5));let R=!0;m();const D=h++;return c.set(D,N),function(){if(R){if(p)throw new Error(Yi(6));R=!1,m(),c.delete(D),u=null}}}function v(N){if(!WL(N))throw new Error(Yi(7));if(typeof N.type>"u")throw new Error(Yi(8));if(typeof N.type!="string")throw new Error(Yi(17));if(p)throw new Error(Yi(9));try{p=!0,i=s(i,N)}finally{p=!1}return(u=c).forEach(D=>{D()}),N}function w(N){if(typeof N!="function")throw new Error(Yi(10));s=N,v({type:e2.REPLACE})}function I(){const N=b;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Yi(11));function D(){const V=R;V.next&&V.next(x())}return D(),{unsubscribe:N(D)}},[Xg](){return this}}}return v({type:e2.INIT}),{dispatch:v,subscribe:b,getState:x,replaceReducer:w,[Xg]:I}}function t2(e,t){return function(...r){return t(e.apply(this,r))}}function r2(e,t){if(typeof e=="function")return t2(e,t);if(typeof e!="object"||e===null)throw new Error(Yi(16));const r={};for(const s in e){const i=e[s];typeof i=="function"&&(r[s]=t2(i,t))}return r}function y3(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...s)=>t(r(...s)))}function GL(...e){return t=>(r,s)=>{const i=t(r,s);let u=()=>{throw new Error(Yi(15))};const c={getState:i.getState,dispatch:(p,...m)=>u(p,...m)},h=e.map(p=>p(c));return u=y3(...h)(i.dispatch),{...i,dispatch:u}}}var ff={exports:{}},pf={};var n2;function VL(){if(n2)return pf;n2=1;var e=qv();function t(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var r=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,i=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return pf.useSyncExternalStoreWithSelector=function(p,m,x,b,v){var w=i(null);if(w.current===null){var I={hasValue:!1,value:null};w.current=I}else I=w.current;w=c(function(){function N(F){if(!R){if(R=!0,D=F,F=b(F),v!==void 0&&I.hasValue){var Y=I.value;if(v(Y,F))return P=Y}return P=F}if(Y=P,r(D,F))return Y;var Z=b(F);return v!==void 0&&v(Y,Z)?(D=F,Y):(D=F,P=Z)}var R=!1,D,P,V=x===void 0?null:x;return[function(){return N(m())},V===null?void 0:function(){return N(V())}]},[m,x,b,v]);var k=s(p,w[0],w[1]);return u(function(){I.hasValue=!0,I.value=k},[k]),h(k),k},pf}var s2;function qL(){return s2||(s2=1,ff.exports=VL()),ff.exports}qL();var ZL=T.version.startsWith("19"),YL=Symbol.for(ZL?"react.transitional.element":"react.element"),KL=Symbol.for("react.portal"),XL=Symbol.for("react.fragment"),JL=Symbol.for("react.strict_mode"),eI=Symbol.for("react.profiler"),tI=Symbol.for("react.consumer"),rI=Symbol.for("react.context"),v3=Symbol.for("react.forward_ref"),nI=Symbol.for("react.suspense"),sI=Symbol.for("react.suspense_list"),Yp=Symbol.for("react.memo"),iI=Symbol.for("react.lazy"),oI=v3,aI=Yp;function lI(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case YL:switch(e=e.type,e){case XL:case eI:case JL:case nI:case sI:return e;default:switch(e=e&&e.$$typeof,e){case rI:case v3:case iI:case Yp:return e;case tI:return e;default:return t}}case KL:return t}}}function cI(e){return lI(e)===Yp}function uI(e,t,r,s,{areStatesEqual:i,areOwnPropsEqual:u,areStatePropsEqual:c}){let h=!1,p,m,x,b,v;function w(D,P){return p=D,m=P,x=e(p,m),b=t(s,m),v=r(x,b,m),h=!0,v}function I(){return x=e(p,m),t.dependsOnOwnProps&&(b=t(s,m)),v=r(x,b,m),v}function k(){return e.dependsOnOwnProps&&(x=e(p,m)),t.dependsOnOwnProps&&(b=t(s,m)),v=r(x,b,m),v}function N(){const D=e(p,m),P=!c(D,x);return x=D,P&&(v=r(x,b,m)),v}function R(D,P){const V=!u(P,m),F=!i(D,p,P,m);return p=D,m=P,V&&F?I():V?k():F?N():v}return function(P,V){return h?R(P,V):w(P,V)}}function dI(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:s,...i}){const u=t(e,i),c=r(e,i),h=s(e,i);return uI(u,c,h,e,i)}function hI(e,t){const r={};for(const s in e){const i=e[s];typeof i=="function"&&(r[s]=(...u)=>t(i(...u)))}return r}function dp(e){return function(r){const s=e(r);function i(){return s}return i.dependsOnOwnProps=!1,i}}function i2(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function w3(e,t){return function(s,{displayName:i}){const u=function(h,p){return u.dependsOnOwnProps?u.mapToProps(h,p):u.mapToProps(h,void 0)};return u.dependsOnOwnProps=!0,u.mapToProps=function(h,p){u.mapToProps=e,u.dependsOnOwnProps=i2(e);let m=u(h,p);return typeof m=="function"&&(u.mapToProps=m,u.dependsOnOwnProps=i2(m),m=u(h,p)),m},u}}function Kp(e,t){return(r,s)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${s.wrappedComponentName}.`)}}function fI(e){return e&&typeof e=="object"?dp(t=>hI(e,t)):e?typeof e=="function"?w3(e):Kp(e,"mapDispatchToProps"):dp(t=>({dispatch:t}))}function pI(e){return e?typeof e=="function"?w3(e):Kp(e,"mapStateToProps"):dp(()=>({}))}function mI(e,t,r){return{...r,...e,...t}}function gI(e){return function(r,{displayName:s,areMergedPropsEqual:i}){let u=!1,c;return function(p,m,x){const b=e(p,m,x);return u?i(b,c)||(c=b):(u=!0,c=b),c}}}function xI(e){return e?typeof e=="function"?gI(e):Kp(e,"mergeProps"):()=>mI}function bI(e){e()}function yI(){let e=null,t=null;return{clear(){e=null,t=null},notify(){bI(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let s=e;for(;s;)r.push(s),s=s.next;return r},subscribe(r){let s=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!s||e===null||(s=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var o2={notify(){},get:()=>[]};function A3(e,t){let r,s=o2,i=0,u=!1;function c(k){x();const N=s.subscribe(k);let R=!1;return()=>{R||(R=!0,N(),b())}}function h(){s.notify()}function p(){I.onStateChange&&I.onStateChange()}function m(){return u}function x(){i++,r||(r=t?t.addNestedSub(p):e.subscribe(p),s=yI())}function b(){i--,r&&i===0&&(r(),r=void 0,s.clear(),s=o2)}function v(){u||(u=!0,x())}function w(){u&&(u=!1,b())}const I={addNestedSub:c,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:m,trySubscribe:v,tryUnsubscribe:w,getListeners:()=>s};return I}var vI=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wI=vI(),AI=()=>typeof navigator<"u"&&navigator.product==="ReactNative",TI=AI(),CI=()=>wI||TI?T.useLayoutEffect:T.useEffect,Id=CI();function a2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function mf(e,t){if(a2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!a2(e[r[i]],t[r[i]]))return!1;return!0}var SI={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},_I={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},LI={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},T3={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},II={[oI]:LI,[aI]:T3};function l2(e){return cI(e)?T3:II[e.$$typeof]||SI}var kI=Object.defineProperty,EI=Object.getOwnPropertyNames,c2=Object.getOwnPropertySymbols,RI=Object.getOwnPropertyDescriptor,MI=Object.getPrototypeOf,u2=Object.prototype;function hp(e,t){if(typeof t!="string"){if(u2){const u=MI(t);u&&u!==u2&&hp(e,u)}let r=EI(t);c2&&(r=r.concat(c2(t)));const s=l2(e),i=l2(t);for(let u=0;u<r.length;++u){const c=r[u];if(!_I[c]&&!(i&&i[c])&&!(s&&s[c])){const h=RI(t,c);try{kI(e,c,h)}catch{}}}}return e}var NI=Symbol.for("react-redux-context"),DI=typeof globalThis<"u"?globalThis:{};function BI(){if(!T.createContext)return{};const e=DI[NI]??=new Map;let t=e.get(T.createContext);return t||(t=T.createContext(null),e.set(T.createContext,t)),t}var C3=BI(),QI=[null,null];function jI(e,t,r){Id(()=>e(...t),r)}function PI(e,t,r,s,i,u){e.current=s,r.current=!1,i.current&&(i.current=null,u())}function OI(e,t,r,s,i,u,c,h,p,m,x){if(!e)return()=>{};let b=!1,v=null;const w=()=>{if(b||!h.current)return;const k=t.getState();let N,R;try{N=s(k,i.current)}catch(D){R=D,v=D}R||(v=null),N===u.current?c.current||m():(u.current=N,p.current=N,c.current=!0,x())};return r.onStateChange=w,r.trySubscribe(),w(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,v)throw v}}function FI(e,t){return e===t}function UI(e,t,r,{pure:s,areStatesEqual:i=FI,areOwnPropsEqual:u=mf,areStatePropsEqual:c=mf,areMergedPropsEqual:h=mf,forwardRef:p=!1,context:m=C3}={}){const x=m,b=pI(e),v=fI(t),w=xI(r),I=!!e;return N=>{const R=N.displayName||N.name||"Component",D=`Connect(${R})`,P={shouldHandleStateChanges:I,displayName:D,wrappedComponentName:R,WrappedComponent:N,initMapStateToProps:b,initMapDispatchToProps:v,initMergeProps:w,areStatesEqual:i,areStatePropsEqual:c,areOwnPropsEqual:u,areMergedPropsEqual:h};function V(Z){const[he,Ee,Ie]=T.useMemo(()=>{const{reactReduxForwardedRef:ye,...Ve}=Z;return[Z.context,ye,Ve]},[Z]),be=T.useMemo(()=>{let ye=x;return he?.Consumer,ye},[he,x]),et=T.useContext(be),Pe=!!Z.store&&!!Z.store.getState&&!!Z.store.dispatch,fe=!!et&&!!et.store,De=Pe?Z.store:et.store,pe=fe?et.getServerState:De.getState,ae=T.useMemo(()=>dI(De.dispatch,P),[De]),[ce,Te]=T.useMemo(()=>{if(!I)return QI;const ye=A3(De,Pe?void 0:et.subscription),Ve=ye.notifyNestedSubs.bind(ye);return[ye,Ve]},[De,Pe,et]),we=T.useMemo(()=>Pe?et:{...et,subscription:ce},[Pe,et,ce]),Ge=T.useRef(void 0),ie=T.useRef(Ie),ve=T.useRef(void 0),ft=T.useRef(!1),Rt=T.useRef(!1),He=T.useRef(void 0);Id(()=>(Rt.current=!0,()=>{Rt.current=!1}),[]);const K=T.useMemo(()=>()=>ve.current&&Ie===ie.current?ve.current:ae(De.getState(),Ie),[De,Ie]),Xe=T.useMemo(()=>Ve=>ce?OI(I,De,ce,ae,ie,Ge,ft,Rt,ve,Te,Ve):()=>{},[ce]);jI(PI,[ie,Ge,ft,Ie,ve,Te]);let Ce;try{Ce=T.useSyncExternalStore(Xe,K,pe?()=>ae(pe(),Ie):K)}catch(ye){throw He.current&&(ye.message+=`
71
- The error may be correlated with this previous error:
72
- ${He.current.stack}
73
-
74
- `),ye}Id(()=>{He.current=void 0,ve.current=void 0,Ge.current=Ce});const z=T.useMemo(()=>T.createElement(N,{...Ce,ref:Ee}),[Ee,N,Ce]);return T.useMemo(()=>I?T.createElement(be.Provider,{value:we},z):z,[be,z,we])}const Y=T.memo(V);if(Y.WrappedComponent=N,Y.displayName=V.displayName=D,p){const he=T.forwardRef(function(Ie,be){return T.createElement(Y,{...Ie,reactReduxForwardedRef:be})});return he.displayName=D,he.WrappedComponent=N,hp(he,N)}return hp(Y,N)}}var S3=UI;function $I(e){const{children:t,context:r,serverState:s,store:i}=e,u=T.useMemo(()=>{const p=A3(i);return{store:i,subscription:p,getServerState:s?()=>s:void 0}},[i,s]),c=T.useMemo(()=>i.getState(),[i]);Id(()=>{const{subscription:p}=u;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),c!==i.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[u,c]);const h=r||C3;return T.createElement(h.Provider,{value:u},t)}var zI=$I,HI="Invariant failed";function WI(e,t){throw new Error(HI)}var aa=function(t){var r=t.top,s=t.right,i=t.bottom,u=t.left,c=s-u,h=i-r,p={top:r,right:s,bottom:i,left:u,width:c,height:h,x:u,y:r,center:{x:(s+u)/2,y:(i+r)/2}};return p},Xp=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},d2=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},GI=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},gf={top:0,right:0,bottom:0,left:0},Jp=function(t){var r=t.borderBox,s=t.margin,i=s===void 0?gf:s,u=t.border,c=u===void 0?gf:u,h=t.padding,p=h===void 0?gf:h,m=aa(Xp(r,i)),x=aa(d2(r,c)),b=aa(d2(x,p));return{marginBox:m,borderBox:aa(r),paddingBox:x,contentBox:b,margin:i,border:c,padding:p}},jo=function(t){var r=t.slice(0,-2),s=t.slice(-2);if(s!=="px")return 0;var i=Number(r);return isNaN(i)&&WI(),i},VI=function(){return{x:window.pageXOffset,y:window.pageYOffset}},kd=function(t,r){var s=t.borderBox,i=t.border,u=t.margin,c=t.padding,h=GI(s,r);return Jp({borderBox:h,border:i,margin:u,padding:c})},Ed=function(t,r){return r===void 0&&(r=VI()),kd(t,r)},_3=function(t,r){var s={top:jo(r.marginTop),right:jo(r.marginRight),bottom:jo(r.marginBottom),left:jo(r.marginLeft)},i={top:jo(r.paddingTop),right:jo(r.paddingRight),bottom:jo(r.paddingBottom),left:jo(r.paddingLeft)},u={top:jo(r.borderTopWidth),right:jo(r.borderRightWidth),bottom:jo(r.borderBottomWidth),left:jo(r.borderLeftWidth)};return Jp({borderBox:t,margin:s,padding:i,border:u})},L3=function(t){var r=t.getBoundingClientRect(),s=window.getComputedStyle(t);return _3(r,s)},Jc=function(t){var r=[],s=null,i=function(){for(var c=arguments.length,h=new Array(c),p=0;p<c;p++)h[p]=arguments[p];r=h,!s&&(s=requestAnimationFrame(function(){s=null,t.apply(void 0,r)}))};return i.cancel=function(){s&&(cancelAnimationFrame(s),s=null)},i};function Rd(){return Rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)({}).hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Rd.apply(null,arguments)}function I3(e,t){}I3.bind(null,"warn");I3.bind(null,"error");function Al(){}function qI(e,t){return{...e,...t}}function Uo(e,t,r){const s=t.map(i=>{const u=qI(r,i.options);return e.addEventListener(i.eventName,i.fn,u),function(){e.removeEventListener(i.eventName,i.fn,u)}});return function(){s.forEach(u=>{u()})}}const ZI="Invariant failed";class Md extends Error{}Md.prototype.toString=function(){return this.message};function gt(e,t){throw new Md(ZI)}class YI extends _.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Al,this.onWindowError=r=>{const s=this.getCallbacks();s.isDragging()&&s.tryAbort(),r.error instanceof Md&&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=Uo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Md){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const KI=`
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
- `,Nd=e=>e+1,XI=e=>`
79
- You have lifted an item in position ${Nd(e.source.index)}
80
- `,k3=(e,t)=>{const r=e.droppableId===t.droppableId,s=Nd(e.index),i=Nd(t.index);return r?`
81
- You have moved the item from position ${s}
82
- to position ${i}
83
- `:`
84
- You have moved the item from position ${s}
85
- in list ${e.droppableId}
86
- to list ${t.droppableId}
87
- in position ${i}
88
- `},E3=(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
- `,JI=e=>{const t=e.destination;if(t)return k3(e.source,t);const r=e.combine;return r?E3(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},h2=e=>`
96
- The item has returned to its starting position
97
- of ${Nd(e.index)}
98
- `,ek=e=>{if(e.reason==="CANCEL")return`
99
- Movement cancelled.
100
- ${h2(e.source)}
101
- `;const t=e.destination,r=e.combine;return t?`
102
- You have dropped the item.
103
- ${k3(e.source,t)}
104
- `:r?`
105
- You have dropped the item.
106
- ${E3(e.draggableId,e.source,r)}
107
- `:`
108
- The item has been dropped while not over a drop area.
109
- ${h2(e.source)}
110
- `},pd={dragHandleUsageInstructions:KI,onDragStart:XI,onDragUpdate:JI,onDragEnd:ek};function tk(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function R3(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!tk(e[r],t[r]))return!1;return!0}function Zr(e,t){const r=T.useState(()=>({inputs:t,result:e()}))[0],s=T.useRef(!0),i=T.useRef(r),c=s.current||!!(t&&i.current.inputs&&R3(t,i.current.inputs))?i.current:{inputs:t,result:e()};return T.useEffect(()=>{s.current=!1,i.current=c},[c]),c.result}function ar(e,t){return Zr(()=>e,t)}const ci={x:0,y:0},Ci=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),bo=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Tl=(e,t)=>e.x===t.x&&e.y===t.y,K0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Jl=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},eu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),f2=(e,t)=>Math.min(...t.map(r=>eu(e,r))),M3=e=>t=>({x:e(t.x),y:e(t.y)});var rk=(e,t)=>{const r=aa({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 lu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),p2=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}],nk={top:0,right:0,bottom:0,left:0},sk=(e,t)=>t?lu(e,t.scroll.diff.displacement):e,ik=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,ok=(e,t)=>t&&t.shouldClipSubject?rk(t.pageMarginBox,e):aa(e);var H0=({page:e,withPlaceholder:t,axis:r,frame:s})=>{const i=sk(e.marginBox,s),u=ik(i,r,t),c=ok(u,s);return{page:e,withPlaceholder:t,active:c}},e1=(e,t)=>{e.frame||gt();const r=e.frame,s=bo(t,r.scroll.initial),i=K0(s),u={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:s,displacement:i},max:r.scroll.max}},c=H0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:u});return{...e,frame:u,subject:c}};function li(e,t=R3){let r=null;function s(...i){if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;const u=e.apply(this,i);return r={lastResult:u,lastArgs:i,lastThis:this},u}return s.clear=function(){r=null},s}const N3=li(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),D3=li(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Jd=li(e=>Object.values(e)),ak=li(e=>Object.values(e));var X0=li((e,t)=>ak(t).filter(s=>e===s.descriptor.droppableId).sort((s,i)=>s.descriptor.index-i.descriptor.index));function t1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function eh(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var th=li((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),lk=({isMovingForward:e,draggable:t,destination:r,insideDestination:s,previousImpact:i})=>{if(!r.isCombineEnabled||!t1(i))return null;function c(w){const I={type:"COMBINE",combine:{draggableId:w,droppableId:r.descriptor.id}};return{...i,at:I}}const h=i.displaced.all,p=h.length?h[0]:null;if(e)return p?c(p):null;const m=th(t,s);if(!p){if(!m.length)return null;const w=m[m.length-1];return c(w.descriptor.id)}const x=m.findIndex(w=>w.descriptor.id===p);x===-1&&gt();const b=x-1;if(b<0)return null;const v=m[b];return c(v.descriptor.id)},J0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const B3={point:ci,value:0},tu={invisible:{},visible:{},all:[]},ck={displaced:tu,displacedBy:B3,at:null};var zo=(e,t)=>r=>e<=r&&r<=t,Q3=e=>{const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return s=>{if(t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right))return!0;const u=t(s.top)||t(s.bottom),c=r(s.left)||r(s.right);if(u&&c)return!0;const p=s.top<e.top&&s.bottom>e.bottom,m=s.left<e.left&&s.right>e.right;return p&&m?!0:p&&c||m&&u}},uk=e=>{const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return s=>t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right)};const r1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},j3={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var dk=e=>t=>{const r=zo(t.top,t.bottom),s=zo(t.left,t.right);return i=>e===r1?r(i.top)&&r(i.bottom):s(i.left)&&s(i.right)};const hk=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:ci;return lu(e,r)},fk=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,pk=(e,t,r)=>r(t)(e),n1=({target:e,destination:t,viewport:r,withDroppableDisplacement:s,isVisibleThroughFrameFn:i})=>{const u=s?hk(e,t):e;return fk(u,t,i)&&pk(u,r,i)},mk=e=>n1({...e,isVisibleThroughFrameFn:Q3}),P3=e=>n1({...e,isVisibleThroughFrameFn:uk}),gk=e=>n1({...e,isVisibleThroughFrameFn:dk(e.destination.axis)}),xk=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:s,visible:i}=t;if(s[e])return!1;const u=i[e];return u?u.shouldAnimate:!0};function bk(e,t){const r=e.page.marginBox,s={top:t.point.y,right:0,bottom:0,left:t.point.x};return aa(Xp(r,s))}function ru({afterDragging:e,destination:t,displacedBy:r,viewport:s,forceShouldAnimate:i,last:u}){return e.reduce(function(h,p){const m=bk(p,r),x=p.descriptor.id;if(h.all.push(x),!mk({target:m,destination:t,viewport:s,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const v=xk(x,u,i),w={draggableId:x,shouldAnimate:v};return h.visible[x]=w,h},{all:[],visible:{},invisible:{}})}function yk(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function m2({insideDestination:e,inHomeList:t,displacedBy:r,destination:s}){const i=yk(e,{inHomeList:t});return{displaced:tu,displacedBy:r,at:{type:"REORDER",destination:{droppableId:s.descriptor.id,index:i}}}}function Dd({draggable:e,insideDestination:t,destination:r,viewport:s,displacedBy:i,last:u,index:c,forceShouldAnimate:h}){const p=J0(e,r);if(c==null)return m2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const m=t.find(I=>I.descriptor.index===c);if(!m)return m2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const x=th(e,t),b=t.indexOf(m),v=x.slice(b);return{displaced:ru({afterDragging:v,destination:r,displacedBy:i,last:u,viewport:s.frame,forceShouldAnimate:h}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:c}}}}function Cl(e,t){return!!t.effected[e]}var vk=({isMovingForward:e,destination:t,draggables:r,combine:s,afterCritical:i})=>{if(!t.isCombineEnabled)return null;const u=s.draggableId,h=r[u].descriptor.index;return Cl(u,i)?e?h:h-1:e?h+1:h},wk=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:s})=>{if(!r.length)return null;const i=s.index,u=e?i+1:i-1,c=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return u<c||u>p?null:u},Ak=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:s,destination:i,insideDestination:u,previousImpact:c,viewport:h,afterCritical:p})=>{const m=c.at;if(m||gt(),m.type==="REORDER"){const b=wk({isMovingForward:e,isInHomeList:t,location:m.destination,insideDestination:u});return b==null?null:Dd({draggable:r,insideDestination:u,destination:i,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:b})}const x=vk({isMovingForward:e,destination:i,displaced:c.displaced,draggables:s,combine:m.combine,afterCritical:p});return x==null?null:Dd({draggable:r,insideDestination:u,destination:i,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:x})},Tk=({displaced:e,afterCritical:t,combineWith:r,displacedBy:s})=>{const i=!!(e.visible[r]||e.invisible[r]);return Cl(r,t)?i?ci:K0(s.point):i?s.point:ci},Ck=({afterCritical:e,impact:t,draggables:r})=>{const s=eh(t);s||gt();const i=s.draggableId,u=r[i].page.borderBox.center,c=Tk({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return Ci(u,c)};const O3=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,Sk=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,s1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,g2=({axis:e,moveRelativeTo:t,isMoving:r})=>Jl(e.line,t.marginBox[e.end]+O3(e,r),s1(e,t.marginBox,r)),x2=({axis:e,moveRelativeTo:t,isMoving:r})=>Jl(e.line,t.marginBox[e.start]-Sk(e,r),s1(e,t.marginBox,r)),_k=({axis:e,moveInto:t,isMoving:r})=>Jl(e.line,t.contentBox[e.start]+O3(e,r),s1(e,t.contentBox,r));var Lk=({impact:e,draggable:t,draggables:r,droppable:s,afterCritical:i})=>{const u=X0(s.descriptor.id,r),c=t.page,h=s.axis;if(!u.length)return _k({axis:h,moveInto:s.page,isMoving:c});const{displaced:p,displacedBy:m}=e,x=p.all[0];if(x){const v=r[x];if(Cl(x,i))return x2({axis:h,moveRelativeTo:v.page,isMoving:c});const w=kd(v.page,m.point);return x2({axis:h,moveRelativeTo:w,isMoving:c})}const b=u[u.length-1];if(b.descriptor.id===t.descriptor.id)return c.borderBox.center;if(Cl(b.descriptor.id,i)){const v=kd(b.page,K0(i.displacedBy.point));return g2({axis:h,moveRelativeTo:v,isMoving:c})}return g2({axis:h,moveRelativeTo:b.page,isMoving:c})},fp=(e,t)=>{const r=e.frame;return r?Ci(t,r.scroll.diff.displacement):t};const Ik=({impact:e,draggable:t,droppable:r,draggables:s,afterCritical:i})=>{const u=t.page.borderBox.center,c=e.at;return!r||!c?u:c.type==="REORDER"?Lk({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:i}):Ck({impact:e,draggables:s,afterCritical:i})};var rh=e=>{const t=Ik(e),r=e.droppable;return r?fp(r,t):t},F3=(e,t)=>{const r=bo(t,e.scroll.initial),s=K0(r);return{frame:aa({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:s}}}};function b2(e,t){return e.map(r=>t[r])}function kk(e,t){for(let r=0;r<t.length;r++){const s=t[r].visible[e];if(s)return s}return null}var Ek=({impact:e,viewport:t,destination:r,draggables:s,maxScrollChange:i})=>{const u=F3(t,Ci(t.scroll.current,i)),c=r.frame?e1(r,Ci(r.frame.scroll.current,i)):r,h=e.displaced,p=ru({afterDragging:b2(h.all,s),destination:r,displacedBy:e.displacedBy,viewport:u.frame,last:h,forceShouldAnimate:!1}),m=ru({afterDragging:b2(h.all,s),destination:c,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},b={},v=[h,p,m];return h.all.forEach(I=>{const k=kk(I,v);if(k){b[I]=k;return}x[I]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:b}}},Rk=(e,t)=>Ci(e.scroll.diff.displacement,t),i1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const s=Rk(r,e),i=bo(s,t.page.borderBox.center);return Ci(t.client.borderBox.center,i)},U3=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:s,withDroppableDisplacement:i,onlyOnMainAxis:u=!1})=>{const c=bo(r,e.page.borderBox.center),p={target:lu(e.page.borderBox,c),destination:t,withDroppableDisplacement:i,viewport:s};return u?gk(p):P3(p)},Mk=({isMovingForward:e,draggable:t,destination:r,draggables:s,previousImpact:i,viewport:u,previousPageBorderBoxCenter:c,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const m=X0(r.descriptor.id,s),x=J0(t,r),b=lk({isMovingForward:e,draggable:t,destination:r,insideDestination:m,previousImpact:i})||Ak({isMovingForward:e,isInHomeList:x,draggable:t,draggables:s,destination:r,insideDestination:m,previousImpact:i,viewport:u,afterCritical:p});if(!b)return null;const v=rh({impact:b,draggable:t,droppable:r,draggables:s,afterCritical:p});if(U3({draggable:t,destination:r,newPageBorderBoxCenter:v,viewport:u.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:i1({pageBorderBoxCenter:v,draggable:t,viewport:u}),impact:b,scrollJumpRequest:null};const I=bo(v,c),k=Ek({impact:b,viewport:u,destination:r,draggables:s,maxScrollChange:I});return{clientSelection:h,impact:k,scrollJumpRequest:I}};const Vi=e=>{const t=e.subject.active;return t||gt(),t};var Nk=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:s,viewport:i})=>{const u=r.subject.active;if(!u)return null;const c=r.axis,h=zo(u[c.start],u[c.end]),p=Jd(s).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>Q3(i.frame)(Vi(x))).filter(x=>{const b=Vi(x);return e?u[c.crossAxisEnd]<b[c.crossAxisEnd]:b[c.crossAxisStart]<u[c.crossAxisStart]}).filter(x=>{const b=Vi(x),v=zo(b[c.start],b[c.end]);return h(b[c.start])||h(b[c.end])||v(u[c.start])||v(u[c.end])}).sort((x,b)=>{const v=Vi(x)[c.crossAxisStart],w=Vi(b)[c.crossAxisStart];return e?v-w:w-v}).filter((x,b,v)=>Vi(x)[c.crossAxisStart]===Vi(v[0])[c.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const m=p.filter(x=>zo(Vi(x)[c.start],Vi(x)[c.end])(t[c.line]));return m.length===1?m[0]:m.length>1?m.sort((x,b)=>Vi(x)[c.start]-Vi(b)[c.start])[0]:p.sort((x,b)=>{const v=f2(t,p2(Vi(x))),w=f2(t,p2(Vi(b)));return v!==w?v-w:Vi(x)[c.start]-Vi(b)[c.start]})[0]};const y2=(e,t)=>{const r=e.page.borderBox.center;return Cl(e.descriptor.id,t)?bo(r,t.displacedBy.point):r},Dk=(e,t)=>{const r=e.page.borderBox;return Cl(e.descriptor.id,t)?lu(r,K0(t.displacedBy.point)):r};var Bk=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:s,afterCritical:i})=>s.filter(c=>P3({target:Dk(c,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((c,h)=>{const p=eu(e,fp(r,y2(c,i))),m=eu(e,fp(r,y2(h,i)));return p<m?-1:m<p?1:c.descriptor.index-h.descriptor.index})[0]||null,cu=li(function(t,r){const s=r[t.line];return{value:s,point:Jl(t.line,s)}});const Qk=(e,t,r)=>{const s=e.axis;if(e.descriptor.mode==="virtual")return Jl(s.line,t[s.line]);const i=e.subject.page.contentBox[s.size],p=X0(e.descriptor.id,r).reduce((m,x)=>m+x.client.marginBox[s.size],0)+t[s.line]-i;return p<=0?null:Jl(s.line,p)},$3=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),z3=(e,t,r)=>{const s=e.frame;J0(t,e)&&gt(),e.subject.withPlaceholder&&gt();const i=cu(e.axis,t.displaceBy).point,u=Qk(e,i,r),c={placeholderSize:i,increasedBy:u,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!s){const x=H0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=u?Ci(s.scroll.max,u):s.scroll.max,p=$3(s,h),m=H0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:p});return{...e,subject:m,frame:p}},jk=e=>{const t=e.subject.withPlaceholder;t||gt();const r=e.frame;if(!r){const c=H0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:c}}const s=t.oldFrameMaxScroll;s||gt();const i=$3(r,s),u=H0({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:u,frame:i}};var Pk=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:s,draggables:i,destination:u,viewport:c,afterCritical:h})=>{if(!t){if(r.length)return null;const b={displaced:tu,displacedBy:B3,at:{type:"REORDER",destination:{droppableId:u.descriptor.id,index:0}}},v=rh({impact:b,draggable:s,droppable:u,draggables:i,afterCritical:h}),w=J0(s,u)?u:z3(u,s,i);return U3({draggable:s,destination:w,newPageBorderBoxCenter:v,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?b:null}const p=e[u.axis.line]<=t.page.borderBox.center[u.axis.line],m=(()=>{const b=t.descriptor.index;return t.descriptor.id===s.descriptor.id||p?b:b+1})(),x=cu(u.axis,s.displaceBy);return Dd({draggable:s,insideDestination:r,destination:u,viewport:c,displacedBy:x,last:tu,index:m})},Ok=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:s,draggables:i,droppables:u,viewport:c,afterCritical:h})=>{const p=Nk({isMovingForward:e,pageBorderBoxCenter:t,source:s,droppables:u,viewport:c});if(!p)return null;const m=X0(p.descriptor.id,i),x=Bk({pageBorderBoxCenter:t,viewport:c,destination:p,insideDestination:m,afterCritical:h}),b=Pk({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:i,moveRelativeTo:x,insideDestination:m,viewport:c,afterCritical:h});if(!b)return null;const v=rh({impact:b,draggable:r,droppable:p,draggables:i,afterCritical:h});return{clientSelection:i1({pageBorderBoxCenter:v,draggable:r,viewport:c}),impact:b,scrollJumpRequest:null}},vo=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const Fk=(e,t)=>{const r=vo(e);return r?t[r]:null};var Uk=({state:e,type:t})=>{const r=Fk(e.impact,e.dimensions.droppables),s=!!r,i=e.dimensions.droppables[e.critical.droppable.id],u=r||i,c=u.axis.direction,h=c==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||c==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(h&&!s)return null;const p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",m=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:b,droppables:v}=e.dimensions;return h?Mk({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:m,destination:u,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):Ok({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:m,isOver:u,draggables:b,droppables:v,viewport:e.viewport,afterCritical:e.afterCritical})};function Ul(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function H3(e){const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return function(i){return t(i.y)&&r(i.x)}}function $k(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function zk({pageBorderBox:e,draggable:t,candidates:r}){const s=t.page.borderBox.center,i=r.map(u=>{const c=u.axis,h=Jl(u.axis.line,e.center[c.line],u.page.borderBox.center[c.crossAxisLine]);return{id:u.descriptor.id,distance:eu(s,h)}}).sort((u,c)=>c.distance-u.distance);return i[0]?i[0].id:null}function Hk({pageBorderBox:e,draggable:t,droppables:r}){const s=Jd(r).filter(i=>{if(!i.isEnabled)return!1;const u=i.subject.active;if(!u||!$k(e,u))return!1;if(H3(u)(e.center))return!0;const c=i.axis,h=u.center[c.crossAxisLine],p=e[c.crossAxisStart],m=e[c.crossAxisEnd],x=zo(u[c.crossAxisStart],u[c.crossAxisEnd]),b=x(p),v=x(m);return!b&&!v?!0:b?p<h:m>h});return s.length?s.length===1?s[0].descriptor.id:zk({pageBorderBox:e,draggable:t,candidates:s}):null}const W3=(e,t)=>aa(lu(e,t));var Wk=(e,t)=>{const r=e.frame;return r?W3(t,r.scroll.diff.value):t};function G3({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function Gk({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var Vk=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:s,last:i,viewport:u,afterCritical:c})=>{const h=r.axis,p=cu(r.axis,t.displaceBy),m=p.value,x=e[h.start],b=e[h.end],w=th(t,s).find(k=>{const N=k.descriptor.id,R=k.page.borderBox.center[h.line],D=Cl(N,c),P=G3({displaced:i,id:N});return D?P?b<=R:x<R-m:P?b<=R+m:x<R})||null,I=Gk({draggable:t,closest:w,inHomeList:J0(t,r)});return Dd({draggable:t,insideDestination:s,destination:r,viewport:u,last:i,displacedBy:p,index:I})};const qk=4;var Zk=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:s,insideDestination:i,afterCritical:u})=>{if(!s.isCombineEnabled)return null;const c=s.axis,h=cu(s.axis,e.displaceBy),p=h.value,m=t[c.start],x=t[c.end],v=th(e,i).find(I=>{const k=I.descriptor.id,N=I.page.borderBox,D=N[c.size]/qk,P=Cl(k,u),V=G3({displaced:r.displaced,id:k});return P?V?x>N[c.start]+D&&x<N[c.end]-D:m>N[c.start]-p+D&&m<N[c.end]-p-D:V?x>N[c.start]+p+D&&x<N[c.end]+p-D:m>N[c.start]+D&&m<N[c.end]-D});return v?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:v.descriptor.id,droppableId:s.descriptor.id}}}:null},V3=({pageOffset:e,draggable:t,draggables:r,droppables:s,previousImpact:i,viewport:u,afterCritical:c})=>{const h=W3(t.page.borderBox,e),p=Hk({pageBorderBox:h,draggable:t,droppables:s});if(!p)return ck;const m=s[p],x=X0(m.descriptor.id,r),b=Wk(m,h);return Zk({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:i,destination:m,insideDestination:x,afterCritical:c})||Vk({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:m,insideDestination:x,last:i.displaced,viewport:u,afterCritical:c})},o1=(e,t)=>({...e,[t.descriptor.id]:t});const Yk=({previousImpact:e,impact:t,droppables:r})=>{const s=vo(e),i=vo(t);if(!s||s===i)return r;const u=r[s];if(!u.subject.withPlaceholder)return r;const c=jk(u);return o1(r,c)};var Kk=({draggable:e,draggables:t,droppables:r,previousImpact:s,impact:i})=>{const u=Yk({previousImpact:s,impact:i,droppables:r}),c=vo(i);if(!c)return u;const h=r[c];if(J0(e,h)||h.subject.withPlaceholder)return u;const p=z3(h,e,t);return o1(u,p)},$c=({state:e,clientSelection:t,dimensions:r,viewport:s,impact:i,scrollJumpRequest:u})=>{const c=s||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,m=bo(p,e.initial.client.selection),x={offset:m,selection:p,borderBoxCenter:Ci(e.initial.client.borderBoxCenter,m)},b={selection:Ci(x.selection,c.scroll.current),borderBoxCenter:Ci(x.borderBoxCenter,c.scroll.current),offset:Ci(x.offset,c.scroll.diff.value)},v={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:c,current:v};const w=h.draggables[e.critical.draggable.id],I=i||V3({pageOffset:b.offset,draggable:w,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:c,afterCritical:e.afterCritical}),k=Kk({draggable:w,impact:I,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:v,dimensions:{draggables:h.draggables,droppables:k},impact:I,viewport:c,scrollJumpRequest:u||null,forceShouldAnimate:u?!1:null}};function Xk(e,t){return e.map(r=>t[r])}var q3=({impact:e,viewport:t,draggables:r,destination:s,forceShouldAnimate:i})=>{const u=e.displaced,c=Xk(u.all,r),h=ru({afterDragging:c,destination:s,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:u});return{...e,displaced:h}},Z3=({impact:e,draggable:t,droppable:r,draggables:s,viewport:i,afterCritical:u})=>{const c=rh({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:u});return i1({pageBorderBoxCenter:c,draggable:t,viewport:i})},Y3=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&gt();const s=e.impact,i=r||e.viewport,u=t||e.dimensions,{draggables:c,droppables:h}=u,p=c[e.critical.draggable.id],m=vo(s);m||gt();const x=h[m],b=q3({impact:s,viewport:i,destination:x,draggables:c}),v=Z3({impact:b,draggable:p,droppable:x,draggables:c,viewport:i,afterCritical:e.afterCritical});return $c({impact:b,clientSelection:v,state:e,dimensions:u,viewport:i})},Jk=e=>({index:e.index,droppableId:e.droppableId}),K3=({draggable:e,home:t,draggables:r,viewport:s})=>{const i=cu(t.axis,e.displaceBy),u=X0(t.descriptor.id,r),c=u.indexOf(e);c===-1&&gt();const h=u.slice(c+1),p=h.reduce((v,w)=>(v[w.descriptor.id]=!0,v),{}),m={inVirtualList:t.descriptor.mode==="virtual",displacedBy:i,effected:p};return{impact:{displaced:ru({afterDragging:h,destination:t,displacedBy:i,last:null,viewport:s.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:Jk(e.descriptor)}},afterCritical:m}},eE=(e,t)=>({draggables:e.draggables,droppables:o1(e.droppables,t)}),tE=({draggable:e,offset:t,initialWindowScroll:r})=>{const s=kd(e.client,t),i=Ed(s,r);return{...e,placeholder:{...e.placeholder,client:s},client:s,page:i}},rE=e=>{const t=e.frame;return t||gt(),t},nE=({additions:e,updatedDroppables:t,viewport:r})=>{const s=r.scroll.diff.value;return e.map(i=>{const u=i.descriptor.droppableId,c=t[u],p=rE(c).scroll.diff.value,m=Ci(s,p);return tE({draggable:i,offset:m,initialWindowScroll:r.scroll.initial})})},sE=({state:e,published:t})=>{const r=t.modified.map(R=>{const D=e.dimensions.droppables[R.droppableId];return e1(D,R.scroll)}),s={...e.dimensions.droppables,...N3(r)},i=D3(nE({additions:t.additions,updatedDroppables:s,viewport:e.viewport})),u={...e.dimensions.draggables,...i};t.removals.forEach(R=>{delete u[R]});const c={droppables:s,draggables:u},h=vo(e.impact),p=h?c.droppables[h]:null,m=c.draggables[e.critical.draggable.id],x=c.droppables[e.critical.droppable.id],{impact:b,afterCritical:v}=K3({draggable:m,home:x,draggables:u,viewport:e.viewport}),w=p&&p.isCombineEnabled?e.impact:b,I=V3({pageOffset:e.current.page.offset,draggable:c.draggables[e.critical.draggable.id],draggables:c.draggables,droppables:c.droppables,previousImpact:w,viewport:e.viewport,afterCritical:v}),k={...e,phase:"DRAGGING",impact:I,onLiftImpact:b,dimensions:c,afterCritical:v,forceShouldAnimate:!1};return e.phase==="COLLECTING"?k:{...k,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const pp=e=>e.movementMode==="SNAP",xf=(e,t,r)=>{const s=eE(e.dimensions,t);return!pp(e)||r?$c({state:e,dimensions:s}):Y3({state:e,dimensions:s})};function bf(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const v2={phase:"IDLE",completed:null,shouldFlush:!1};var iE=(e=v2,t)=>{if(t.type==="FLUSH")return{...v2,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&gt();const{critical:r,clientSelection:s,viewport:i,dimensions:u,movementMode:c}=t.payload,h=u.draggables[r.draggable.id],p=u.droppables[r.droppable.id],m={selection:s,borderBoxCenter:h.client.borderBox.center,offset:ci},x={client:m,page:{selection:Ci(m.selection,i.scroll.initial),borderBoxCenter:Ci(m.selection,i.scroll.initial),offset:Ci(m.selection,i.scroll.diff.value)}},b=Jd(u.droppables).every(k=>!k.isFixedOnPage),{impact:v,afterCritical:w}=K3({draggable:h,home:p,draggables:u.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:c,dimensions:u,initial:x,current:x,isWindowScrollAllowed:b,impact:v,afterCritical:w,onLiftImpact:v,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&gt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||gt(),sE({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Ul(e)||gt();const{client:r}=t.payload;return Tl(r,e.current.client.selection)?e:$c({state:e,clientSelection:r,impact:pp(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return bf(e);Ul(e)||gt();const{id:r,newScroll:s}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const u=e1(i,s);return xf(e,u,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Ul(e)||gt();const{id:r,isEnabled:s}=t.payload,i=e.dimensions.droppables[r];i||gt(),i.isEnabled===s&&gt();const u={...i,isEnabled:s};return xf(e,u,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Ul(e)||gt();const{id:r,isCombineEnabled:s}=t.payload,i=e.dimensions.droppables[r];i||gt(),i.isCombineEnabled===s&&gt();const u={...i,isCombineEnabled:s};return xf(e,u,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Ul(e)||gt(),e.isWindowScrollAllowed||gt();const r=t.payload.newScroll;if(Tl(e.viewport.scroll.current,r))return bf(e);const s=F3(e.viewport,r);return pp(e)?Y3({state:e,viewport:s}):$c({state:e,viewport:s})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Ul(e))return e;const r=t.payload.maxScroll;if(Tl(r,e.viewport.scroll.max))return e;const s={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:s}}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"&&gt();const r=Uk({state:e,type:t.type});return r?$c({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"&&gt(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:s,newHomeClientOffset:i}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||gt(),{phase:"DROP_ANIMATING",completed:r,dropDuration:s,newHomeClientOffset:i,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function xn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const oE=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),aE=e=>({type:"LIFT",payload:e}),lE=e=>({type:"INITIAL_PUBLISH",payload:e}),cE=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),uE=()=>({type:"COLLECTION_STARTING",payload:null}),dE=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),hE=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),fE=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),X3=e=>({type:"MOVE",payload:e}),pE=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),mE=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),gE=()=>({type:"MOVE_UP",payload:null}),xE=()=>({type:"MOVE_DOWN",payload:null}),bE=()=>({type:"MOVE_RIGHT",payload:null}),yE=()=>({type:"MOVE_LEFT",payload:null}),a1=()=>({type:"FLUSH",payload:null}),vE=e=>({type:"DROP_ANIMATE",payload:e}),l1=e=>({type:"DROP_COMPLETE",payload:e}),J3=e=>({type:"DROP",payload:e}),wE=e=>({type:"DROP_PENDING",payload:e}),e6=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var AE=e=>({getState:t,dispatch:r})=>s=>i=>{if(!xn(i,"LIFT")){s(i);return}const{id:u,clientSelection:c,movementMode:h}=i.payload,p=t();p.phase==="DROP_ANIMATING"&&r(l1({completed:p.completed})),t().phase!=="IDLE"&&gt(),r(a1()),r(oE({draggableId:u,movementMode:h}));const x={draggableId:u,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:b,dimensions:v,viewport:w}=e.startPublishing(x);r(lE({critical:b,dimensions:v,clientSelection:c,movementMode:h,viewport:w}))},TE=e=>()=>t=>r=>{xn(r,"INITIAL_PUBLISH")&&e.dragging(),xn(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(xn(r,"FLUSH")||xn(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const c1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},nu={opacity:{drop:0,combining:.7},scale:{drop:.75}},t6={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Fl=`${t6.outOfTheWay}s ${c1.outOfTheWay}`,zc={fluid:`opacity ${Fl}`,snap:`transform ${Fl}, opacity ${Fl}`,drop:e=>{const t=`${e}s ${c1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Fl}`,placeholder:`height ${Fl}, width ${Fl}, margin ${Fl}`},w2=e=>Tl(e,ci)?void 0:`translate(${e.x}px, ${e.y}px)`,mp={moveTo:w2,drop:(e,t)=>{const r=w2(e);if(r)return t?`${r} scale(${nu.scale.drop})`:r}},{minDropTime:gp,maxDropTime:r6}=t6,CE=r6-gp,A2=1500,SE=.6;var _E=({current:e,destination:t,reason:r})=>{const s=eu(e,t);if(s<=0)return gp;if(s>=A2)return r6;const i=s/A2,u=gp+CE*i,c=r==="CANCEL"?u*SE:u;return Number(c.toFixed(2))},LE=({impact:e,draggable:t,dimensions:r,viewport:s,afterCritical:i})=>{const{draggables:u,droppables:c}=r,h=vo(e),p=h?c[h]:null,m=c[t.descriptor.droppableId],x=Z3({impact:e,draggable:t,draggables:u,afterCritical:i,droppable:p||m,viewport:s});return bo(x,t.client.borderBox.center)},IE=({draggables:e,reason:t,lastImpact:r,home:s,viewport:i,onLiftImpact:u})=>!r.at||t!=="DROP"?{impact:q3({draggables:e,impact:u,destination:s,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:tu},didDropInsideDroppable:!0};const kE=({getState:e,dispatch:t})=>r=>s=>{if(!xn(s,"DROP")){r(s);return}const i=e(),u=s.payload.reason;if(i.phase==="COLLECTING"){t(wE({reason:u}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&gt(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||gt();const h=i.critical,p=i.dimensions,m=p.draggables[i.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=IE({reason:u,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),v=b?t1(x):null,w=b?eh(x):null,I={index:h.draggable.index,droppableId:h.droppable.id},k={draggableId:m.descriptor.id,type:m.descriptor.type,source:I,reason:u,mode:i.movementMode,destination:v,combine:w},N=LE({impact:x,draggable:m,dimensions:p,viewport:i.viewport,afterCritical:i.afterCritical}),R={critical:i.critical,afterCritical:i.afterCritical,result:k,impact:x};if(!(!Tl(i.current.client.offset,N)||!!k.combine)){t(l1({completed:R}));return}const P=_E({current:i.current.client.offset,destination:N,reason:u});t(vE({newHomeClientOffset:N,dropDuration:P,completed:R}))};var n6=()=>({x:window.pageXOffset,y:window.pageYOffset});function EE(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function RE({onWindowScroll:e}){function t(){e(n6())}const r=Jc(t),s=EE(r);let i=Al;function u(){return i!==Al}function c(){u()&&gt(),i=Uo(window,[s])}function h(){u()||gt(),r.cancel(),i(),i=Al}return{start:c,stop:h,isActive:u}}const ME=e=>xn(e,"DROP_COMPLETE")||xn(e,"DROP_ANIMATE")||xn(e,"FLUSH"),NE=e=>{const t=RE({onWindowScroll:r=>{e.dispatch(pE({newScroll:r}))}});return r=>s=>{!t.isActive()&&xn(s,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&ME(s)&&t.stop(),r(s)}};var DE=e=>{let t=!1,r=!1;const s=setTimeout(()=>{r=!0}),i=u=>{t||r||(t=!0,e(u),clearTimeout(s))};return i.wasCalled=()=>t,i},BE=()=>{const e=[],t=i=>{const u=e.findIndex(h=>h.timerId===i);u===-1&&gt();const[c]=e.splice(u,1);c.callback()};return{add:i=>{const u=setTimeout(()=>t(u)),c={timerId:u,callback:i};e.push(c)},flush:()=>{if(!e.length)return;const i=[...e];e.length=0,i.forEach(u=>{clearTimeout(u.timerId),u.callback()})}}};const QE=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,jE=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,PE=(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,s=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&s},Sc=(e,t)=>{t()},Vu=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function yf(e,t,r,s){if(!e){r(s(t));return}const i=DE(r);e(t,{announce:i}),i.wasCalled()||r(s(t))}var OE=(e,t)=>{const r=BE();let s=null;const i=(b,v)=>{s&&gt(),Sc("onBeforeCapture",()=>{const w=e().onBeforeCapture;w&&w({draggableId:b,mode:v})})},u=(b,v)=>{s&&gt(),Sc("onBeforeDragStart",()=>{const w=e().onBeforeDragStart;w&&w(Vu(b,v))})},c=(b,v)=>{s&&gt();const w=Vu(b,v);s={mode:v,lastCritical:b,lastLocation:w.source,lastCombine:null},r.add(()=>{Sc("onDragStart",()=>yf(e().onDragStart,w,t,pd.onDragStart))})},h=(b,v)=>{const w=t1(v),I=eh(v);s||gt();const k=!PE(b,s.lastCritical);k&&(s.lastCritical=b);const N=!QE(s.lastLocation,w);N&&(s.lastLocation=w);const R=!jE(s.lastCombine,I);if(R&&(s.lastCombine=I),!k&&!N&&!R)return;const D={...Vu(b,s.mode),combine:I,destination:w};r.add(()=>{Sc("onDragUpdate",()=>yf(e().onDragUpdate,D,t,pd.onDragUpdate))})},p=()=>{s||gt(),r.flush()},m=b=>{s||gt(),s=null,Sc("onDragEnd",()=>yf(e().onDragEnd,b,t,pd.onDragEnd))};return{beforeCapture:i,beforeStart:u,start:c,update:h,flush:p,drop:m,abort:()=>{if(!s)return;const b={...Vu(s.lastCritical,s.mode),combine:null,destination:null,reason:"CANCEL"};m(b)}}},FE=(e,t)=>{const r=OE(e,t);return s=>i=>u=>{if(xn(u,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(u.payload.draggableId,u.payload.movementMode);return}if(xn(u,"INITIAL_PUBLISH")){const h=u.payload.critical;r.beforeStart(h,u.payload.movementMode),i(u),r.start(h,u.payload.movementMode);return}if(xn(u,"DROP_COMPLETE")){const h=u.payload.completed.result;r.flush(),i(u),r.drop(h);return}if(i(u),xn(u,"FLUSH")){r.abort();return}const c=s.getState();c.phase==="DRAGGING"&&r.update(c.critical,c.impact)}};const UE=e=>t=>r=>{if(!xn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const s=e.getState();s.phase!=="DROP_ANIMATING"&&gt(),e.dispatch(l1({completed:s.completed}))},$E=e=>{let t=null,r=null;function s(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return i=>u=>{if((xn(u,"FLUSH")||xn(u,"DROP_COMPLETE")||xn(u,"DROP_ANIMATION_FINISHED"))&&s(),i(u),!xn(u,"DROP_ANIMATE"))return;const c={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(e6())}};r=requestAnimationFrame(()=>{r=null,t=Uo(window,[c])})}};var zE=e=>()=>t=>r=>{(xn(r,"DROP_COMPLETE")||xn(r,"FLUSH")||xn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},HE=e=>{let t=!1;return()=>r=>s=>{if(xn(s,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(s.payload.critical.draggable.id),r(s),e.tryRestoreFocusRecorded();return}if(r(s),!!t){if(xn(s,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(xn(s,"DROP_COMPLETE")){t=!1;const i=s.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const WE=e=>xn(e,"DROP_COMPLETE")||xn(e,"DROP_ANIMATE")||xn(e,"FLUSH");var GE=e=>t=>r=>s=>{if(WE(s)){e.stop(),r(s);return}if(xn(s,"INITIAL_PUBLISH")){r(s);const i=t.getState();i.phase!=="DRAGGING"&&gt(),e.start(i);return}r(s),e.scroll(t.getState())};const VE=e=>t=>r=>{if(t(r),!xn(r,"PUBLISH_WHILE_DRAGGING"))return;const s=e.getState();s.phase==="DROP_PENDING"&&(s.isWaiting||e.dispatch(J3({reason:s.reason})))},qE=y3;var ZE=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:s,announce:i,autoScroller:u})=>b3(iE,qE(GL(TE(r),zE(e),AE(e),kE,UE,$E,VE,GE(u),NE,HE(t),FE(s,i))));const vf=()=>({additions:{},removals:{},modified:{}});function YE({registry:e,callbacks:t}){let r=vf(),s=null;const i=()=>{s||(t.collectionStarting(),s=requestAnimationFrame(()=>{s=null;const{additions:p,removals:m,modified:x}=r,b=Object.keys(p).map(I=>e.draggable.getById(I).getDimension(ci)).sort((I,k)=>I.descriptor.index-k.descriptor.index),v=Object.keys(x).map(I=>{const N=e.droppable.getById(I).callbacks.getScrollWhileDragging();return{droppableId:I,scroll:N}}),w={additions:b,removals:Object.keys(m),modified:v};r=vf(),t.publish(w)}))};return{add:p=>{const m=p.descriptor.id;r.additions[m]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[m]&&delete r.removals[m],i()},remove:p=>{const m=p.descriptor;r.removals[m.id]=!0,r.modified[m.droppableId]=!0,r.additions[m.id]&&delete r.additions[m.id],i()},stop:()=>{s&&(cancelAnimationFrame(s),s=null,r=vf())}}}var s6=({scrollHeight:e,scrollWidth:t,height:r,width:s})=>{const i=bo({x:t,y:e},{x:s,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},i6=()=>{const e=document.documentElement;return e||gt(),e},o6=()=>{const e=i6();return s6({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},KE=()=>{const e=n6(),t=o6(),r=e.y,s=e.x,i=i6(),u=i.clientWidth,c=i.clientHeight,h=s+u,p=r+c;return{frame:aa({top:r,left:s,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:ci,displacement:ci}}}},XE=({critical:e,scrollOptions:t,registry:r})=>{const s=KE(),i=s.scroll.current,u=e.droppable,c=r.droppable.getAllByType(u.type).map(x=>x.callbacks.getDimensionAndWatchScroll(i,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(i));return{dimensions:{draggables:D3(h),droppables:N3(c)},critical:e,viewport:s}};function T2(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var JE=(e,t)=>{let r=null;const s=YE({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=(v,w)=>{e.droppable.exists(v)||gt(),r&&t.updateDroppableIsEnabled({id:v,isEnabled:w})},u=(v,w)=>{r&&(e.droppable.exists(v)||gt(),t.updateDroppableIsCombineEnabled({id:v,isCombineEnabled:w}))},c=(v,w)=>{r&&(e.droppable.exists(v)||gt(),t.updateDroppableScroll({id:v,newScroll:w}))},h=(v,w)=>{r&&e.droppable.getById(v).callbacks.scroll(w)},p=()=>{if(!r)return;s.stop();const v=r.critical.droppable;e.droppable.getAllByType(v.type).forEach(w=>w.callbacks.dragStopped()),r.unsubscribe(),r=null},m=v=>{r||gt();const w=r.critical.draggable;v.type==="ADDITION"&&T2(e,w,v.value)&&s.add(v.value),v.type==="REMOVAL"&&T2(e,w,v.value)&&s.remove(v.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:u,scrollDroppable:h,updateDroppableScroll:c,startPublishing:v=>{r&&gt();const w=e.draggable.getById(v.draggableId),I=e.droppable.getById(w.descriptor.droppableId),k={draggable:w.descriptor,droppable:I.descriptor},N=e.subscribe(m);return r={critical:k,unsubscribe:N},XE({critical:k,registry:e,scrollOptions:v.scrollOptions})},stopPublishing:p}},a6=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",eR=e=>{window.scrollBy(e.x,e.y)};const tR=li(e=>Jd(e).filter(t=>!(!t.isEnabled||!t.frame))),rR=(e,t)=>tR(t).find(s=>(s.frame||gt(),H3(s.frame.pageMarginBox)(e)))||null;var nR=({center:e,destination:t,droppables:r})=>{if(t){const i=r[t];return i.frame?i:null}return rR(e,r)};const su={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var sR=(e,t,r=()=>su)=>{const s=r(),i=e[t.size]*s.startFromPercentage,u=e[t.size]*s.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:u}},l6=({startOfRange:e,endOfRange:t,current:r})=>{const s=t-e;return s===0?0:(r-e)/s},u1=1,iR=(e,t,r=()=>su)=>{const s=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return s.maxPixelScroll;if(e===t.startScrollingFrom)return u1;const u=1-l6({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),c=s.maxPixelScroll*s.ease(u);return Math.ceil(c)},oR=(e,t,r)=>{const s=r(),i=s.durationDampening.accelerateAt,u=s.durationDampening.stopDampeningAt,c=t,h=u,m=Date.now()-c;if(m>=u)return e;if(m<i)return u1;const x=l6({startOfRange:i,endOfRange:h,current:m}),b=e*s.ease(x);return Math.ceil(b)},C2=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const u=iR(e,t,i);return u===0?0:s?Math.max(oR(u,r,i),u1):u},S2=({container:e,distanceToEdges:t,dragStartTime:r,axis:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c=sR(e,s,u);return t[s.end]<t[s.start]?C2({distanceToEdge:t[s.end],thresholds:c,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u}):-1*C2({distanceToEdge:t[s.start],thresholds:c,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u})},aR=({container:e,subject:t,proposedScroll:r})=>{const s=t.height>e.height,i=t.width>e.width;return!i&&!s?r:i&&s?null:{x:i?0:r.x,y:s?0:r.y}};const lR=M3(e=>e===0?0:e);var c6=({dragStartTime:e,container:t,subject:r,center:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c={top:s.y-t.top,right:t.right-s.x,bottom:t.bottom-s.y,left:s.x-t.left},h=S2({container:t,distanceToEdges:c,dragStartTime:e,axis:r1,shouldUseTimeDampening:i,getAutoScrollerOptions:u}),p=S2({container:t,distanceToEdges:c,dragStartTime:e,axis:j3,shouldUseTimeDampening:i,getAutoScrollerOptions:u}),m=lR({x:p,y:h});if(Tl(m,ci))return null;const x=aR({container:t,subject:r,proposedScroll:m});return x?Tl(x,ci)?null:x:null};const cR=M3(e=>e===0?0:e>0?1:-1),d1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:s})=>{const i=Ci(t,s),u={x:e(i.x,r.x),y:e(i.y,r.y)};return Tl(u,ci)?null:u}})(),u6=({max:e,current:t,change:r})=>{const s={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=cR(r),u=d1({max:s,current:t,change:i});return!u||i.x!==0&&u.x===0||i.y!==0&&u.y===0},h1=(e,t)=>u6({current:e.scroll.current,max:e.scroll.max,change:t}),uR=(e,t)=>{if(!h1(e,t))return null;const r=e.scroll.max,s=e.scroll.current;return d1({current:s,max:r,change:t})},f1=(e,t)=>{const r=e.frame;return r?u6({current:r.scroll.current,max:r.scroll.max,change:t}):!1},dR=(e,t)=>{const r=e.frame;return!r||!f1(e,t)?null:d1({current:r.scroll.current,max:r.scroll.max,change:t})};var hR=({viewport:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c=c6({dragStartTime:s,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u});return c&&h1(e,c)?c:null},fR=({droppable:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c=e.frame;if(!c)return null;const h=c6({dragStartTime:s,container:c.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u});return h&&f1(e,h)?h:null},_2=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:s,scrollDroppable:i,getAutoScrollerOptions:u})=>{const c=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,v=hR({dragStartTime:t,viewport:b,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:u});if(v){s(v);return}}const m=nR({center:c,destination:vo(e.impact),droppables:e.dimensions.droppables});if(!m)return;const x=fR({dragStartTime:t,droppable:m,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:u});x&&i(m.descriptor.id,x)},pR=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>su})=>{const s=Jc(e),i=Jc(t);let u=null;const c=m=>{u||gt();const{shouldUseTimeDampening:x,dragStartTime:b}=u;_2({state:m,scrollWindow:s,scrollDroppable:i,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:m=>{u&&gt();const x=Date.now();let b=!1;const v=()=>{b=!0};_2({state:m,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:v,scrollDroppable:v,getAutoScrollerOptions:r}),u={dragStartTime:x,shouldUseTimeDampening:b},b&&c(m)},stop:()=>{u&&(s.cancel(),i.cancel(),u=null)},scroll:c}},mR=({move:e,scrollDroppable:t,scrollWindow:r})=>{const s=(h,p)=>{const m=Ci(h.current.client.selection,p);e({client:m})},i=(h,p)=>{if(!f1(h,p))return p;const m=dR(h,p);if(!m)return t(h.descriptor.id,p),null;const x=bo(p,m);return t(h.descriptor.id,x),bo(p,x)},u=(h,p,m)=>{if(!h||!h1(p,m))return m;const x=uR(p,m);if(!x)return r(m),null;const b=bo(m,x);return r(b),bo(m,b)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const m=vo(h.impact);m||gt();const x=i(h.dimensions.droppables[m],p);if(!x)return;const b=h.viewport,v=u(h.isWindowScrollAllowed,b,x);v&&s(h,v)}},gR=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:s})=>{const i=pR({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:s}),u=mR({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(s().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){i.scroll(p);return}p.scrollJumpRequest&&u(p)}},start:i.start,stop:i.stop}};const W0="data-rfd",G0=(()=>{const e=`${W0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),xp=(()=>{const e=`${W0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),xR=(()=>{const e=`${W0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),L2={contextId:`${W0}-scroll-container-context-id`},bR=e=>t=>`[${t}="${e}"]`,_c=(e,t)=>e.map(r=>{const s=r.styles[t];return s?`${r.selector} { ${s} }`:""}).join(" "),yR="pointer-events: none;";var vR=e=>{const t=bR(e),r=(()=>{const h=`
111
- cursor: -webkit-grab;
112
- cursor: grab;
113
- `;return{selector:t(G0.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:yR,dropAnimating:h}}})(),s=(()=>{const h=`
118
- transition: ${zc.outOfTheWay};
119
- `;return{selector:t(xp.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),i={selector:t(xR.contextId),styles:{always:"overflow-anchor: none;"}},c=[s,r,i,{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:_c(c,"always"),resting:_c(c,"resting"),dragging:_c(c,"dragging"),dropAnimating:_c(c,"dropAnimating"),userCancel:_c(c,"userCancel")}};const wo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?T.useLayoutEffect:T.useEffect,wf=()=>{const e=document.querySelector("head");return e||gt(),e},I2=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function wR(e,t){const r=Zr(()=>vR(e),[e]),s=T.useRef(null),i=T.useRef(null),u=ar(li(b=>{const v=i.current;v||gt(),v.textContent=b}),[]),c=ar(b=>{const v=s.current;v||gt(),v.textContent=b},[]);wo(()=>{!s.current&&!i.current||gt();const b=I2(t),v=I2(t);return s.current=b,i.current=v,b.setAttribute(`${W0}-always`,e),v.setAttribute(`${W0}-dynamic`,e),wf().appendChild(b),wf().appendChild(v),c(r.always),u(r.resting),()=>{const w=I=>{const k=I.current;k||gt(),wf().removeChild(k),I.current=null};w(s),w(i)}},[t,c,u,r.always,r.resting,e]);const h=ar(()=>u(r.dragging),[u,r.dragging]),p=ar(b=>{if(b==="DROP"){u(r.dropAnimating);return}u(r.userCancel)},[u,r.dropAnimating,r.userCancel]),m=ar(()=>{i.current&&u(r.resting)},[u,r.resting]);return Zr(()=>({dragging:h,dropping:p,resting:m}),[h,p,m])}function d6(e,t){return Array.from(e.querySelectorAll(t))}var h6=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function nh(e){return e instanceof h6(e).HTMLElement}function AR(e,t){const r=`[${G0.contextId}="${e}"]`,s=d6(document,r);if(!s.length)return null;const i=s.find(u=>u.getAttribute(G0.draggableId)===t);return!i||!nh(i)?null:i}function TR(e){const t=T.useRef({}),r=T.useRef(null),s=T.useRef(null),i=T.useRef(!1),u=ar(function(v,w){const I={id:v,focus:w};return t.current[v]=I,function(){const N=t.current;N[v]!==I&&delete N[v]}},[]),c=ar(function(v){const w=AR(e,v);w&&w!==document.activeElement&&w.focus()},[e]),h=ar(function(v,w){r.current===v&&(r.current=w)},[]),p=ar(function(){s.current||i.current&&(s.current=requestAnimationFrame(()=>{s.current=null;const v=r.current;v&&c(v)}))},[c]),m=ar(function(v){r.current=null;const w=document.activeElement;w&&w.getAttribute(G0.draggableId)===v&&(r.current=v)},[]);return wo(()=>(i.current=!0,function(){i.current=!1;const v=s.current;v&&cancelAnimationFrame(v)}),[]),Zr(()=>({register:u,tryRecordFocus:m,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[u,m,p,h])}function CR(){const e={draggables:{},droppables:{}},t=[];function r(b){return t.push(b),function(){const w=t.indexOf(b);w!==-1&&t.splice(w,1)}}function s(b){t.length&&t.forEach(v=>v(b))}function i(b){return e.draggables[b]||null}function u(b){const v=i(b);return v||gt(),v}const c={register:b=>{e.draggables[b.descriptor.id]=b,s({type:"ADDITION",value:b})},update:(b,v)=>{const w=e.draggables[v.descriptor.id];w&&w.uniqueId===b.uniqueId&&(delete e.draggables[v.descriptor.id],e.draggables[b.descriptor.id]=b)},unregister:b=>{const v=b.descriptor.id,w=i(v);w&&b.uniqueId===w.uniqueId&&(delete e.draggables[v],e.droppables[b.descriptor.droppableId]&&s({type:"REMOVAL",value:b}))},getById:u,findById:i,exists:b=>!!i(b),getAllByType:b=>Object.values(e.draggables).filter(v=>v.descriptor.type===b)};function h(b){return e.droppables[b]||null}function p(b){const v=h(b);return v||gt(),v}const m={register:b=>{e.droppables[b.descriptor.id]=b},unregister:b=>{const v=h(b.descriptor.id);v&&b.uniqueId===v.uniqueId&&delete e.droppables[b.descriptor.id]},getById:p,findById:h,exists:b=>!!h(b),getAllByType:b=>Object.values(e.droppables).filter(v=>v.descriptor.type===b)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:c,droppable:m,subscribe:r,clean:x}}function SR(){const e=Zr(CR,[]);return T.useEffect(()=>function(){e.clean()},[e]),e}var p1=_.createContext(null),Bd=()=>{const e=document.body;return e||gt(),e};const _R={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},LR=e=>`rfd-announcement-${e}`;function IR(e){const t=Zr(()=>LR(e),[e]),r=T.useRef(null);return T.useEffect(function(){const u=document.createElement("div");return r.current=u,u.id=t,u.setAttribute("aria-live","assertive"),u.setAttribute("aria-atomic","true"),Rd(u.style,_R),Bd().appendChild(u),function(){setTimeout(function(){const p=Bd();p.contains(u)&&p.removeChild(u),u===r.current&&(r.current=null)})}},[t]),ar(i=>{const u=r.current;if(u){u.textContent=i;return}},[])}const kR={separator:"::"};function m1(e,t=kR){const r=_.useId();return Zr(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function ER({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function RR({contextId:e,text:t}){const r=m1("hidden-text",{separator:"-"}),s=Zr(()=>ER({contextId:e,uniqueId:r}),[r,e]);return T.useEffect(function(){const u=document.createElement("div");return u.id=s,u.textContent=t,u.style.display="none",Bd().appendChild(u),function(){const h=Bd();h.contains(u)&&h.removeChild(u)}},[s,t]),s}var sh=_.createContext(null);function f6(e){const t=T.useRef(e);return T.useEffect(()=>{t.current=e}),t}function MR(){let e=null;function t(){return!!e}function r(c){return c===e}function s(c){e&&gt();const h={abandon:c};return e=h,h}function i(){e||gt(),e=null}function u(){e&&(e.abandon(),i())}return{isClaimed:t,isActive:r,claim:s,release:i,tryAbandon:u}}function iu(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const NR=9,DR=13,g1=27,p6=32,BR=33,QR=34,jR=35,PR=36,OR=37,FR=38,UR=39,$R=40,zR={[DR]:!0,[NR]:!0};var m6=e=>{zR[e.keyCode]&&e.preventDefault()};const ih=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(s=>`on${s}`in document)||e})(),g6=0,k2=5;function HR(e,t){return Math.abs(t.x-e.x)>=k2||Math.abs(t.y-e.y)>=k2}const E2={type:"IDLE"};function WR({cancel:e,completed:t,getPhase:r,setPhase:s}){return[{eventName:"mousemove",fn:i=>{const{button:u,clientX:c,clientY:h}=i;if(u!==g6)return;const p={x:c,y:h},m=r();if(m.type==="DRAGGING"){i.preventDefault(),m.actions.move(p);return}m.type!=="PENDING"&&gt();const x=m.point;if(!HR(x,p))return;i.preventDefault();const b=m.actions.fluidLift(p);s({type:"DRAGGING",actions:b})}},{eventName:"mouseup",fn:i=>{const u=r();if(u.type!=="DRAGGING"){e();return}i.preventDefault(),u.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:i=>{r().type==="DRAGGING"&&i.preventDefault(),e()}},{eventName:"keydown",fn:i=>{if(r().type==="PENDING"){e();return}if(i.keyCode===g1){i.preventDefault(),e();return}m6(i)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:i=>{const u=r();if(u.type==="IDLE"&&gt(),u.actions.shouldRespectForcePress()){e();return}i.preventDefault()}},{eventName:ih,fn:e}]}function GR(e){const t=T.useRef(E2),r=T.useRef(Al),s=Zr(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==g6||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const v=e.findClosestDraggableId(b);if(!v)return;const w=e.tryGetLock(v,c,{sourceEvent:b});if(!w)return;b.preventDefault();const I={x:b.clientX,y:b.clientY};r.current(),m(w,I)}}),[e]),i=Zr(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const b=e.findClosestDraggableId(x);if(!b)return;const v=e.findOptionsForDraggable(b);v&&(v.shouldRespectForcePress||e.canGetLock(b)&&x.preventDefault())}}),[e]),u=ar(function(){const b={passive:!1,capture:!0};r.current=Uo(window,[i,s],b)},[i,s]),c=ar(()=>{t.current.type!=="IDLE"&&(t.current=E2,r.current(),u())},[u]),h=ar(()=>{const x=t.current;c(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[c]),p=ar(function(){const b={capture:!0,passive:!1},v=WR({cancel:h,completed:c,getPhase:()=>t.current,setPhase:w=>{t.current=w}});r.current=Uo(window,v,b)},[h,c]),m=ar(function(b,v){t.current.type!=="IDLE"&&gt(),t.current={type:"PENDING",point:v,actions:b},p()},[p]);wo(function(){return u(),function(){r.current()}},[u])}function VR(){}const qR={[QR]:!0,[BR]:!0,[PR]:!0,[jR]:!0};function ZR(e,t){function r(){t(),e.cancel()}function s(){t(),e.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===g1){i.preventDefault(),r();return}if(i.keyCode===p6){i.preventDefault(),s();return}if(i.keyCode===$R){i.preventDefault(),e.moveDown();return}if(i.keyCode===FR){i.preventDefault(),e.moveUp();return}if(i.keyCode===UR){i.preventDefault(),e.moveRight();return}if(i.keyCode===OR){i.preventDefault(),e.moveLeft();return}if(qR[i.keyCode]){i.preventDefault();return}m6(i)}},{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:ih,fn:r}]}function YR(e){const t=T.useRef(VR),r=Zr(()=>({eventName:"keydown",fn:function(u){if(u.defaultPrevented||u.keyCode!==p6)return;const c=e.findClosestDraggableId(u);if(!c)return;const h=e.tryGetLock(c,x,{sourceEvent:u});if(!h)return;u.preventDefault();let p=!0;const m=h.snapLift();t.current();function x(){p||gt(),p=!1,t.current(),s()}t.current=Uo(window,ZR(m,x),{capture:!0,passive:!1})}}),[e]),s=ar(function(){const u={passive:!1,capture:!0};t.current=Uo(window,[r],u)},[r]);wo(function(){return s(),function(){t.current()}},[s])}const Af={type:"IDLE"},KR=120,XR=.15;function JR({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===g1&&r.preventDefault(),e()}},{eventName:ih,fn:e}]}function eM({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:s=>{const i=r();if(i.type!=="DRAGGING"){e();return}i.hasMoved=!0;const{clientX:u,clientY:c}=s.touches[0],h={x:u,y:c};s.preventDefault(),i.actions.move(h)}},{eventName:"touchend",fn:s=>{const i=r();if(i.type!=="DRAGGING"){e();return}s.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:s=>{if(r().type!=="DRAGGING"){e();return}s.preventDefault(),e()}},{eventName:"touchforcechange",fn:s=>{const i=r();i.type==="IDLE"&&gt();const u=s.touches[0];if(!u||!(u.force>=XR))return;const h=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){h&&e();return}if(h){if(i.hasMoved){s.preventDefault();return}e();return}s.preventDefault()}},{eventName:ih,fn:e}]}function tM(e){const t=T.useRef(Af),r=T.useRef(Al),s=ar(function(){return t.current},[]),i=ar(function(w){t.current=w},[]),u=Zr(()=>({eventName:"touchstart",fn:function(w){if(w.defaultPrevented)return;const I=e.findClosestDraggableId(w);if(!I)return;const k=e.tryGetLock(I,h,{sourceEvent:w});if(!k)return;const N=w.touches[0],{clientX:R,clientY:D}=N,P={x:R,y:D};r.current(),b(k,P)}}),[e]),c=ar(function(){const w={capture:!0,passive:!1};r.current=Uo(window,[u],w)},[u]),h=ar(()=>{const v=t.current;v.type!=="IDLE"&&(v.type==="PENDING"&&clearTimeout(v.longPressTimerId),i(Af),r.current(),c())},[c,i]),p=ar(()=>{const v=t.current;h(),v.type==="DRAGGING"&&v.actions.cancel({shouldBlockNextClick:!0}),v.type==="PENDING"&&v.actions.abort()},[h]),m=ar(function(){const w={capture:!0,passive:!1},I={cancel:p,completed:h,getPhase:s},k=Uo(window,eM(I),w),N=Uo(window,JR(I),w);r.current=function(){k(),N()}},[p,s,h]),x=ar(function(){const w=s();w.type!=="PENDING"&&gt();const I=w.actions.fluidLift(w.point);i({type:"DRAGGING",actions:I,hasMoved:!1})},[s,i]),b=ar(function(w,I){s().type!=="IDLE"&&gt();const k=setTimeout(x,KR);i({type:"PENDING",point:I,actions:w,longPressTimerId:k}),m()},[m,s,i,x]);wo(function(){return c(),function(){r.current();const I=s();I.type==="PENDING"&&(clearTimeout(I.longPressTimerId),i(Af))}},[s,c,i]),wo(function(){return Uo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const rM=["input","button","textarea","select","option","optgroup","video","audio"];function x6(e,t){if(t==null)return!1;if(rM.includes(t.tagName.toLowerCase()))return!0;const s=t.getAttribute("contenteditable");return s==="true"||s===""?!0:t===e?!1:x6(e,t.parentElement)}function nM(e,t){const r=t.target;return nh(r)?x6(e,r):!1}var sM=e=>aa(e.getBoundingClientRect()).center;function iM(e){return e instanceof h6(e).Element}const oM=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(s=>s in Element.prototype)||e})();function b6(e,t){return e==null?null:e[oM](t)?e:b6(e.parentElement,t)}function aM(e,t){return e.closest?e.closest(t):b6(e,t)}function lM(e){return`[${G0.contextId}="${e}"]`}function cM(e,t){const r=t.target;if(!iM(r))return null;const s=lM(e),i=aM(r,s);return!i||!nh(i)?null:i}function uM(e,t){const r=cM(e,t);return r?r.getAttribute(G0.draggableId):null}function dM(e,t){const r=`[${xp.contextId}="${e}"]`,i=d6(document,r).find(u=>u.getAttribute(xp.id)===t);return!i||!nh(i)?null:i}function hM(e){e.preventDefault()}function qu({expected:e,phase:t,isLockActive:r,shouldWarn:s}){return!(!r()||e!==t)}function y6({lockAPI:e,store:t,registry:r,draggableId:s}){if(e.isClaimed())return!1;const i=r.draggable.findById(s);return!(!i||!i.options.isEnabled||!a6(t.getState(),s))}function fM({lockAPI:e,contextId:t,store:r,registry:s,draggableId:i,forceSensorStop:u,sourceEvent:c}){if(!y6({lockAPI:e,store:r,registry:s,draggableId:i}))return null;const p=s.draggable.getById(i),m=dM(t,p.descriptor.id);if(!m||c&&!p.options.canDragInteractiveElements&&nM(m,c))return null;const x=e.claim(u||Al);let b="PRE_DRAG";function v(){return p.options.shouldRespectForcePress}function w(){return e.isActive(x)}function I(F,Y){qu({expected:F,phase:b,isLockActive:w,shouldWarn:!0})&&r.dispatch(Y())}const k=I.bind(null,"DRAGGING");function N(F){function Y(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&(Y(),gt()),r.dispatch(aE(F.liftActionArgs)),b="DRAGGING";function Z(he,Ee={shouldBlockNextClick:!1}){if(F.cleanup(),Ee.shouldBlockNextClick){const Ie=Uo(window,[{eventName:"click",fn:hM,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(Ie)}Y(),r.dispatch(J3({reason:he}))}return{isActive:()=>qu({expected:"DRAGGING",phase:b,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:v,drop:he=>Z("DROP",he),cancel:he=>Z("CANCEL",he),...F.actions}}function R(F){const Y=Jc(he=>{k(()=>X3({client:he}))});return{...N({liftActionArgs:{id:i,clientSelection:F,movementMode:"FLUID"},cleanup:()=>Y.cancel(),actions:{move:Y}}),move:Y}}function D(){const F={moveUp:()=>k(gE),moveRight:()=>k(bE),moveDown:()=>k(xE),moveLeft:()=>k(yE)};return N({liftActionArgs:{id:i,clientSelection:sM(m),movementMode:"SNAP"},cleanup:Al,actions:F})}function P(){qu({expected:"PRE_DRAG",phase:b,isLockActive:w,shouldWarn:!0})&&e.release()}return{isActive:()=>qu({expected:"PRE_DRAG",phase:b,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:v,fluidLift:R,snapLift:D,abort:P}}const pM=[GR,YR,tM];function mM({contextId:e,store:t,registry:r,customSensors:s,enableDefaultSensors:i}){const u=[...i?pM:[],...s||[]],c=T.useState(()=>MR())[0],h=ar(function(N,R){iu(N)&&!iu(R)&&c.tryAbandon()},[c]);wo(function(){let N=t.getState();return t.subscribe(()=>{const D=t.getState();h(N,D),N=D})},[c,t,h]),wo(()=>c.tryAbandon,[c.tryAbandon]);const p=ar(k=>y6({lockAPI:c,registry:r,store:t,draggableId:k}),[c,r,t]),m=ar((k,N,R)=>fM({lockAPI:c,registry:r,contextId:e,store:t,draggableId:k,forceSensorStop:N||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[e,c,r,t]),x=ar(k=>uM(e,k),[e]),b=ar(k=>{const N=r.draggable.findById(k);return N?N.options:null},[r.draggable]),v=ar(function(){c.isClaimed()&&(c.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(a1()))},[c,t]),w=ar(()=>c.isClaimed(),[c]),I=Zr(()=>({canGetLock:p,tryGetLock:m,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:v,isLockClaimed:w}),[p,m,x,b,v,w]);for(let k=0;k<u.length;k++)u[k](I)}const gM=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Ya.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),xM=e=>({...su,...e.autoScrollerOptions,durationDampening:{...su.durationDampening,...e.autoScrollerOptions}});function Lc(e){return e.current||gt(),e.current}function bM(e){const{contextId:t,setCallbacks:r,sensors:s,nonce:i,dragHandleUsageInstructions:u}=e,c=T.useRef(null),h=f6(e),p=ar(()=>gM(h.current),[h]),m=ar(()=>xM(h.current),[h]),x=IR(t),b=RR({contextId:t,text:u}),v=wR(t,i),w=ar(Ie=>{Lc(c).dispatch(Ie)},[]),I=Zr(()=>r2({publishWhileDragging:cE,updateDroppableScroll:dE,updateDroppableIsEnabled:hE,updateDroppableIsCombineEnabled:fE,collectionStarting:uE},w),[w]),k=SR(),N=Zr(()=>JE(k,I),[k,I]),R=Zr(()=>gR({scrollWindow:eR,scrollDroppable:N.scrollDroppable,getAutoScrollerOptions:m,...r2({move:X3},w)}),[N.scrollDroppable,w,m]),D=TR(t),P=Zr(()=>ZE({announce:x,autoScroller:R,dimensionMarshal:N,focusMarshal:D,getResponders:p,styleMarshal:v}),[x,R,N,D,p,v]);c.current=P;const V=ar(()=>{const Ie=Lc(c);Ie.getState().phase!=="IDLE"&&Ie.dispatch(a1())},[]),F=ar(()=>{const Ie=Lc(c).getState();return Ie.phase==="DROP_ANIMATING"?!0:Ie.phase==="IDLE"?!1:Ie.isDragging},[]),Y=Zr(()=>({isDragging:F,tryAbort:V}),[F,V]);r(Y);const Z=ar(Ie=>a6(Lc(c).getState(),Ie),[]),he=ar(()=>Ul(Lc(c).getState()),[]),Ee=Zr(()=>({marshal:N,focus:D,contextId:t,canLift:Z,isMovementAllowed:he,dragHandleUsageInstructionsId:b,registry:k}),[t,N,b,D,Z,he,k]);return mM({contextId:t,store:P,registry:k,customSensors:s||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),T.useEffect(()=>V,[V]),_.createElement(sh.Provider,{value:Ee},_.createElement(zI,{context:p1,store:P},e.children))}function yM(){return _.useId()}function Qd(e){const t=yM(),r=e.dragHandleUsageInstructions||pd.dragHandleUsageInstructions;return _.createElement(YI,null,s=>_.createElement(bM,{nonce:e.nonce,contextId:t,setCallbacks:s,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 R2={dragging:5e3,dropAnimating:4500},vM=(e,t)=>t?zc.drop(t.duration):e?zc.snap:zc.fluid,wM=(e,t)=>{if(e)return t?nu.opacity.drop:nu.opacity.combining},AM=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function TM(e){const r=e.dimension.client,{offset:s,combineWith:i,dropping:u}=e,c=!!i,h=AM(e),p=!!u,m=p?mp.drop(s,c):mp.moveTo(s);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:vM(h,u),transform:m,opacity:wM(c,p),zIndex:p?R2.dropAnimating:R2.dragging,pointerEvents:"none"}}function CM(e){return{transform:mp.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function SM(e){return e.type==="DRAGGING"?TM(e):CM(e)}function _M(e,t,r=ci){const s=window.getComputedStyle(t),i=t.getBoundingClientRect(),u=_3(i,s),c=Ed(u,r),h={client:u,tagName:t.tagName.toLowerCase(),display:s.display},p={x:u.marginBox.width,y:u.marginBox.height};return{descriptor:e,placeholder:h,displaceBy:p,client:u,page:c}}function LM(e){const t=m1("draggable"),{descriptor:r,registry:s,getDraggableRef:i,canDragInteractiveElements:u,shouldRespectForcePress:c,isEnabled:h}=e,p=Zr(()=>({canDragInteractiveElements:u,shouldRespectForcePress:c,isEnabled:h}),[u,h,c]),m=ar(w=>{const I=i();return I||gt(),_M(r,I,w)},[r,i]),x=Zr(()=>({uniqueId:t,descriptor:r,options:p,getDimension:m}),[r,m,p,t]),b=T.useRef(x),v=T.useRef(!0);wo(()=>(s.draggable.register(b.current),()=>s.draggable.unregister(b.current)),[s.draggable]),wo(()=>{if(v.current){v.current=!1;return}const w=b.current;b.current=x,s.draggable.update(x,w)},[x,s.draggable])}var x1=_.createContext(null);function jd(e){const t=T.useContext(e);return t||gt(),t}function IM(e){e.preventDefault()}const kM=e=>{const t=T.useRef(null),r=ar((Y=null)=>{t.current=Y},[]),s=ar(()=>t.current,[]),{contextId:i,dragHandleUsageInstructionsId:u,registry:c}=jd(sh),{type:h,droppableId:p}=jd(x1),m=Zr(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:b,isEnabled:v,shouldRespectForcePress:w,canDragInteractiveElements:I,isClone:k,mapped:N,dropAnimationFinished:R}=e;if(!k){const Y=Zr(()=>({descriptor:m,registry:c,getDraggableRef:s,canDragInteractiveElements:I,shouldRespectForcePress:w,isEnabled:v}),[m,c,s,I,w,v]);LM(Y)}const D=Zr(()=>v?{tabIndex:0,role:"button","aria-describedby":u,"data-rfd-drag-handle-draggable-id":b,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:IM}:null,[i,u,b,v]),P=ar(Y=>{N.type==="DRAGGING"&&N.dropping&&Y.propertyName==="transform"&&Ya.flushSync(R)},[R,N]),V=Zr(()=>{const Y=SM(N),Z=N.type==="DRAGGING"&&N.dropping?P:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":b,style:Y,onTransitionEnd:Z},dragHandleProps:D}},[i,D,b,N,P,r]),F=Zr(()=>({draggableId:m.id,type:m.type,source:{index:m.index,droppableId:m.droppableId}}),[m.droppableId,m.id,m.index,m.type]);return _.createElement(_.Fragment,null,x(V,N.snapshot,F))};var v6=(e,t)=>e===t,w6=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const EM=e=>e.combine?e.combine.draggableId:null,RM=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function MM(){const e=li((i,u)=>({x:i,y:u})),t=li((i,u,c=null,h=null,p=null)=>({isDragging:!0,isClone:u,isDropAnimating:!!p,dropAnimation:p,mode:i,draggingOver:c,combineWith:h,combineTargetFor:null})),r=li((i,u,c,h,p=null,m=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:m,mode:u,offset:i,dimension:c,forceShouldAnimate:x,snapshot:t(u,h,p,m,null)}}));return(i,u)=>{if(iu(i)){if(i.critical.draggable.id!==u.draggableId)return null;const c=i.current.client.offset,h=i.dimensions.draggables[u.draggableId],p=vo(i.impact),m=RM(i.impact),x=i.forceShouldAnimate;return r(e(c.x,c.y),i.movementMode,h,u.isClone,p,m,x)}if(i.phase==="DROP_ANIMATING"){const c=i.completed;if(c.result.draggableId!==u.draggableId)return null;const h=u.isClone,p=i.dimensions.draggables[u.draggableId],m=c.result,x=m.mode,b=w6(m),v=EM(m),I={duration:i.dropDuration,curve:c1.drop,moveTo:i.newHomeClientOffset,opacity:v?nu.opacity.drop:null,scale:v?nu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:p,dropping:I,draggingOver:b,combineWith:v,mode:x,forceShouldAnimate:null,snapshot:t(x,h,b,v,I)}}}return null}}function A6(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const NM={mapped:{type:"SECONDARY",offset:ci,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:A6(null)}};function DM(){const e=li((c,h)=>({x:c,y:h})),t=li(A6),r=li((c,h=null,p)=>({mapped:{type:"SECONDARY",offset:c,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),s=c=>c?r(ci,c,!0):null,i=(c,h,p,m)=>{const x=p.displaced.visible[c],b=!!(m.inVirtualList&&m.effected[c]),v=eh(p),w=v&&v.draggableId===c?h:null;if(!x){if(!b)return s(w);if(p.displaced.invisible[c])return null;const N=K0(m.displacedBy.point),R=e(N.x,N.y);return r(R,w,!0)}if(b)return s(w);const I=p.displacedBy.point,k=e(I.x,I.y);return r(k,w,x.shouldAnimate)};return(c,h)=>{if(iu(c))return c.critical.draggable.id===h.draggableId?null:i(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:i(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const BM=()=>{const e=MM(),t=DM();return(s,i)=>e(s,i)||t(s,i)||NM},QM={dropAnimationFinished:e6},jM=S3(BM,QM,null,{context:p1,areStatePropsEqual:v6})(kM);function T6(e){return jd(x1).isUsingCloneFor===e.draggableId&&!e.isClone?null:_.createElement(jM,e)}function Ga(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,s=!!e.shouldRespectForcePress;return _.createElement(T6,Rd({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:s}))}const C6=e=>t=>e===t,PM=C6("scroll"),OM=C6("auto"),M2=(e,t)=>t(e.overflowX)||t(e.overflowY),FM=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return M2(r,PM)||M2(r,OM)},UM=()=>!1,S6=e=>e==null?null:e===document.body?UM()?e:null:e===document.documentElement?null:FM(e)?e:S6(e.parentElement);var bp=e=>({x:e.scrollLeft,y:e.scrollTop});const _6=e=>e?window.getComputedStyle(e).position==="fixed"?!0:_6(e.parentElement):!1;var $M=e=>{const t=S6(e),r=_6(e);return{closestScrollable:t,isFixedOnPage:r}},zM=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:s,direction:i,client:u,page:c,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:v,client:w}=h,I=s6({scrollHeight:v.scrollHeight,scrollWidth:v.scrollWidth,height:w.paddingBox.height,width:w.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:w,scrollSize:v,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:I,diff:{value:ci,displacement:ci}}}})(),m=i==="vertical"?r1:j3,x=H0({page:c,withPlaceholder:null,axis:m,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:s,axis:m,isEnabled:t,client:u,page:c,frame:p,subject:x}};const HM=(e,t)=>{const r=L3(e);if(!t||e!==t)return r;const s=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,u=s+t.scrollHeight,c=i+t.scrollWidth,p=Xp({top:s,right:c,bottom:u,left:i},r.border);return Jp({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var WM=({ref:e,descriptor:t,env:r,windowScroll:s,direction:i,isDropDisabled:u,isCombineEnabled:c,shouldClipSubject:h})=>{const p=r.closestScrollable,m=HM(e,p),x=Ed(m,s),b=(()=>{if(!p)return null;const w=L3(p),I={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:w,page:Ed(w,s),scroll:bp(p),scrollSize:I,shouldClipSubject:h}})();return zM({descriptor:t,isEnabled:!u,isCombineEnabled:c,isFixedOnPage:r.isFixedOnPage,direction:i,client:m,page:x,closest:b})};const GM={passive:!1},VM={passive:!0};var N2=e=>e.shouldPublishImmediately?GM:VM;const Zu=e=>e&&e.env.closestScrollable||null;function qM(e){const t=T.useRef(null),r=jd(sh),s=m1("droppable"),{registry:i,marshal:u}=r,c=f6(e),h=Zr(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=T.useRef(h),m=Zr(()=>li((V,F)=>{t.current||gt();const Y={x:V,y:F};u.updateDroppableScroll(h.id,Y)}),[h.id,u]),x=ar(()=>{const V=t.current;return!V||!V.env.closestScrollable?ci:bp(V.env.closestScrollable)},[]),b=ar(()=>{const V=x();m(V.x,V.y)},[x,m]),v=Zr(()=>Jc(b),[b]),w=ar(()=>{const V=t.current,F=Zu(V);if(V&&F||gt(),V.scrollOptions.shouldPublishImmediately){b();return}v()},[v,b]),I=ar((V,F)=>{t.current&&gt();const Y=c.current,Z=Y.getDroppableRef();Z||gt();const he=$M(Z),Ee={ref:Z,descriptor:h,env:he,scrollOptions:F};t.current=Ee;const Ie=WM({ref:Z,descriptor:h,env:he,windowScroll:V,direction:Y.direction,isDropDisabled:Y.isDropDisabled,isCombineEnabled:Y.isCombineEnabled,shouldClipSubject:!Y.ignoreContainerClipping}),be=he.closestScrollable;return be&&(be.setAttribute(L2.contextId,r.contextId),be.addEventListener("scroll",w,N2(Ee.scrollOptions))),Ie},[r.contextId,h,w,c]),k=ar(()=>{const V=t.current,F=Zu(V);return V&&F||gt(),bp(F)},[]),N=ar(()=>{const V=t.current;V||gt();const F=Zu(V);t.current=null,F&&(v.cancel(),F.removeAttribute(L2.contextId),F.removeEventListener("scroll",w,N2(V.scrollOptions)))},[w,v]),R=ar(V=>{const F=t.current;F||gt();const Y=Zu(F);Y||gt(),Y.scrollTop+=V.y,Y.scrollLeft+=V.x},[]),D=Zr(()=>({getDimensionAndWatchScroll:I,getScrollWhileDragging:k,dragStopped:N,scroll:R}),[N,I,k,R]),P=Zr(()=>({uniqueId:s,descriptor:h,callbacks:D}),[D,h,s]);wo(()=>(p.current=P.descriptor,i.droppable.register(P),()=>{t.current&&N(),i.droppable.unregister(P)}),[D,h,N,P,u,i.droppable]),wo(()=>{t.current&&u.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,u]),wo(()=>{t.current&&u.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,u])}function Tf(){}const D2={width:0,height:0,margin:nk},ZM=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?D2:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},YM=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const s=ZM({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:s.width,height:s.height,marginTop:s.margin.top,marginRight:s.margin.right,marginBottom:s.margin.bottom,marginLeft:s.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?zc.placeholder:null}},KM=e=>{const t=T.useRef(null),r=ar(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:s,onTransitionEnd:i,onClose:u,contextId:c}=e,[h,p]=T.useState(e.animate==="open");T.useEffect(()=>h?s!=="open"?(r(),p(!1),Tf):t.current?Tf:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):Tf,[s,h,r]);const m=ar(b=>{b.propertyName==="height"&&(i(),s==="close"&&u())},[s,u,i]),x=YM({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return _.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":c,onTransitionEnd:m,ref:e.innerRef})};var XM=_.memo(KM);class JM extends _.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 eN=e=>{const t=T.useContext(sh);t||gt();const{contextId:r,isMovementAllowed:s}=t,i=T.useRef(null),u=T.useRef(null),{children:c,droppableId:h,type:p,mode:m,direction:x,ignoreContainerClipping:b,isDropDisabled:v,isCombineEnabled:w,snapshot:I,useClone:k,updateViewportMaxScroll:N,getContainerForClone:R}=e,D=ar(()=>i.current,[]),P=ar((be=null)=>{i.current=be},[]);ar(()=>u.current,[]);const V=ar((be=null)=>{u.current=be},[]),F=ar(()=>{s()&&N({maxScroll:o6()})},[s,N]);qM({droppableId:h,type:p,mode:m,direction:x,isDropDisabled:v,isCombineEnabled:w,ignoreContainerClipping:b,getDroppableRef:D});const Y=Zr(()=>_.createElement(JM,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:be,data:et,animate:Pe})=>_.createElement(XM,{placeholder:et,onClose:be,innerRef:V,animate:Pe,contextId:r,onTransitionEnd:F})),[r,F,e.placeholder,e.shouldAnimatePlaceholder,V]),Z=Zr(()=>({innerRef:P,placeholder:Y,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,Y,P]),he=k?k.dragging.draggableId:null,Ee=Zr(()=>({droppableId:h,type:p,isUsingCloneFor:he}),[h,he,p]);function Ie(){if(!k)return null;const{dragging:be,render:et}=k,Pe=_.createElement(T6,{draggableId:be.draggableId,index:be.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(fe,De)=>et(fe,De,be));return Bv.createPortal(Pe,R())}return _.createElement(x1.Provider,{value:Ee},c(Z,I),Ie())};function tN(){return document.body||gt(),document.body}const B2={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:tN},L6=e=>{let t={...e},r;for(r in B2)e[r]===void 0&&(t={...t,[r]:B2[r]});return t},Cf=(e,t)=>e===t.droppable.type,Q2=(e,t)=>t.draggables[e.draggable.id],rN=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=li(u=>({draggableId:u.id,type:u.type,source:{index:u.index,droppableId:u.droppableId}})),s=li((u,c,h,p,m,x)=>{const b=m.descriptor.id;if(m.descriptor.droppableId===u){const I=x?{render:x,dragging:r(m.descriptor)}:null,k={isDraggingOver:h,draggingOverWith:h?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:m.placeholder,shouldAnimatePlaceholder:!1,snapshot:k,useClone:I}}if(!c)return t;if(!p)return e;const w={isDraggingOver:h,draggingOverWith:b,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:m.placeholder,shouldAnimatePlaceholder:!0,snapshot:w,useClone:null}});return(u,c)=>{const h=L6(c),p=h.droppableId,m=h.type,x=!h.isDropDisabled,b=h.renderClone;if(iu(u)){const v=u.critical;if(!Cf(m,v))return t;const w=Q2(v,u.dimensions),I=vo(u.impact)===p;return s(p,x,I,I,w,b)}if(u.phase==="DROP_ANIMATING"){const v=u.completed;if(!Cf(m,v.critical))return t;const w=Q2(v.critical,u.dimensions);return s(p,x,w6(v.result)===p,vo(v.impact)===p,w,b)}if(u.phase==="IDLE"&&u.completed&&!u.shouldFlush){const v=u.completed;if(!Cf(m,v.critical))return t;const w=vo(v.impact)===p,I=!!(v.impact.at&&v.impact.at.type==="COMBINE"),k=v.critical.droppable.id===p;return w?I?e:t:k?e:t}return t}},nN={updateViewportMaxScroll:mE},Va=S3(rN,nN,(e,t,r)=>({...L6(r),...e,...t}),{context:p1,areStatePropsEqual:v6})(eN);function sN(){if(typeof window>"u")return B0(void 0);try{const e=window.localStorage.getItem(ep);return B0(e?JSON.parse(e):void 0)}catch{return B0(void 0)}}function Sf(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(ep),r=t?JSON.parse(t):{},s=B0({...r,...e});window.localStorage.setItem(ep,JSON.stringify(s))}catch{}}function iN(){const[e,t]=_.useState(sN);_.useEffect(()=>{Sf(e)},[e]);const r=_.useCallback(i=>{t(u=>{const c=B0({...u,...i});return Sf(c),c})},[]),s=_.useCallback(()=>{const i=B0(void 0);t(i),Sf(i)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:s}}const yp="termdock-settings";function oN(e){return e==="shell"||e==="tmux"}function aN(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(yp);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&oN(t.newSessionMode)?t.newSessionMode:null,s=r??"shell",i=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:s,tmuxName:i,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function j2(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(yp),s={...t?JSON.parse(t):{},...e};window.localStorage.setItem(yp,JSON.stringify(s))}catch{}}function lN(){const[e,t]=_.useState(aN),r=_.useCallback((i,u)=>{const c=u?.userInitiated!==!1;t(h=>({...h,mode:i,userSelectedMode:c?i:h.userSelectedMode})),c&&j2({newSessionMode:i,newSessionModeUserSelected:!0})},[]),s=_.useCallback(i=>{t(u=>({...u,tmuxName:i})),j2({newSessionTmuxName:i})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:s}}const cN=550,uN=10;function I6(){const e=T.useRef(null),t=T.useRef(null),r=T.useRef(!1),s=T.useRef(!1),i=T.useRef(null),u=T.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),c=T.useCallback(()=>{u(),t.current=null},[u]);return T.useCallback(p=>({onPointerDown:m=>{m.pointerType!=="touch"&&m.pointerType!=="pen"||(c(),r.current=!1,t.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(r.current=!0,p())},cN))},onPointerMove:m=>{const x=t.current;if(!x||x.pointerId!==m.pointerId||r.current)return;const b=m.clientX-x.startX,v=m.clientY-x.startY;Math.hypot(b,v)>uN&&c()},onPointerUp:m=>{r.current&&(m.preventDefault(),r.current=!1,s.current=!0,i.current!=null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{s.current=!1,i.current=null},600)),c()},onPointerCancel:c,onPointerLeave:m=>{t.current?.pointerId===m.pointerId&&!r.current&&c()},onClickCapture:m=>{s.current&&(s.current=!1,i.current!=null&&(window.clearTimeout(i.current),i.current=null),m.preventDefault(),m.stopPropagation())}}),[c])}function P2({mode:e,activeProgram:t,promptState:r,shellNames:s}){return e!=="tmux"?!1:r==="running"?!0:r==="idle"?!1:t===null||!s.has(t.toLowerCase())}function dN(e,t,r){return!!(e&&t===e&&!r)}function hN(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]),s=decodeURIComponent(t[1]),i=new URL(r);return!["https:","http:"].includes(i.protocol)||i.origin!==r||!s?null:{origin:r,sessionId:s}}catch{return null}}async function k6(e){const t=hN(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 fN(e,t,r){return Math.max(t,Math.min(e,r))}const Zn={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 O2(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function F2(e,t,r,s=.15){return s===0?fN(e,t,r):e<t?-O2(t-e,r-t,s)+t:e>r?+O2(e-r,r-t,s)+r:e}function pN(e,[t,r],[s,i]){const[[u,c],[h,p]]=e;return[F2(t,u,c,s),F2(r,h,p,i)]}function mN(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gN(e){var t=mN(e,"string");return typeof t=="symbol"?t:String(t)}function Ds(e,t,r){return t=gN(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function rs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U2(Object(r),!0).forEach(function(s){Ds(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U2(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const E6={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 $2(e){return e?e[0].toUpperCase()+e.slice(1):""}const xN=["enter","leave"];function bN(e=!1,t){return e&&!xN.includes(t)}function yN(e,t="",r=!1){const s=E6[e],i=s&&s[t]||t;return"on"+$2(e)+$2(i)+(bN(r,i)?"Capture":"")}const vN=["gotpointercapture","lostpointercapture"];function wN(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const s=vN.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(s);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function AN(e,t=""){const r=E6[e],s=r&&r[t]||t;return e+s}function oh(e){return"touches"in e}function R6(e){return oh(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function TN(e){return Array.from(e.touches).filter(t=>{var r,s;return t.target===e.currentTarget||((r=e.currentTarget)===null||r===void 0||(s=r.contains)===null||s===void 0?void 0:s.call(r,t.target))})}function CN(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function M6(e){return oh(e)?CN(e)[0]:e}function vp(e,t){try{const r=t.clientX-e.clientX,s=t.clientY-e.clientY,i=(t.clientX+e.clientX)/2,u=(t.clientY+e.clientY)/2,c=Math.hypot(r,s);return{angle:-(Math.atan2(r,s)*180)/Math.PI,distance:c,origin:[i,u]}}catch{}return null}function SN(e){return TN(e).map(t=>t.identifier)}function z2(e,t){const[r,s]=Array.from(e.touches).filter(i=>t.includes(i.identifier));return vp(r,s)}function _f(e){const t=M6(e);return oh(e)?t.identifier:t.pointerId}function V0(e){const t=M6(e);return[t.clientX,t.clientY]}const H2=40,W2=800;function N6(e){let{deltaX:t,deltaY:r,deltaMode:s}=e;return s===1?(t*=H2,r*=H2):s===2&&(t*=W2,r*=W2),[t,r]}function _N(e){var t,r;const{scrollX:s,scrollY:i,scrollLeft:u,scrollTop:c}=e.currentTarget;return[(t=s??u)!==null&&t!==void 0?t:0,(r=i??c)!==null&&r!==void 0?r:0]}function LN(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:s,metaKey:i,ctrlKey:u}=e;Object.assign(t,{shiftKey:r,altKey:s,metaKey:i,ctrlKey:u})}return t}function Pd(e,...t){return typeof e=="function"?e(...t):e}function IN(){}function kN(...e){return e.length===0?IN:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function G2(e,t){return Object.assign({},t,e||{})}const EN=32;class D6{constructor(t,r,s){this.ctrl=t,this.args=r,this.key=s,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:s,args:i}=this;r[s]=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=i,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,s=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=t.target,r.currentTarget=t.currentTarget,r.lastOffset=s.from?Pd(s.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:s,shared:i}=this;r.args=this.args;let u=0;if(t&&(r.event=t,s.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,LN(t)),i.down=i.pressed=i.buttons%2===1||i.touches>0,u=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const Y=r._delta.map(Math.abs);Zn.addTo(r._distance,Y)}this.axisIntent&&this.axisIntent(t);const[c,h]=r._movement,[p,m]=s.threshold,{_step:x,values:b}=r;if(s.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(c)>=p&&b[0]),x[1]===!1&&(x[1]=Math.abs(h)>=m&&b[1])):(x[0]===!1&&(x[0]=Math.abs(c)>=p&&Math.sign(c)*p),x[1]===!1&&(x[1]=Math.abs(h)>=m&&Math.sign(h)*m)),r.intentional=x[0]!==!1||x[1]!==!1,!r.intentional)return;const v=[0,0];if(s.hasCustomTransform){const[Y,Z]=b;v[0]=x[0]!==!1?Y-x[0]:0,v[1]=x[1]!==!1?Z-x[1]:0}else v[0]=x[0]!==!1?c-x[0]:0,v[1]=x[1]!==!1?h-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(v);const w=r.offset,I=r._active&&!r._blocked||r.active;I&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=i[this.ingKey]=r._active,t&&(r.first&&("bounds"in s&&(r._bounds=Pd(s.bounds,r)),this.setup&&this.setup()),r.movement=v,this.computeOffset()));const[k,N]=r.offset,[[R,D],[P,V]]=r._bounds;r.overflow=[k<R?-1:k>D?1:0,N<P?-1:N>V?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 F=r._active?s.rubberband||[0,0]:[0,0];if(r.offset=pN(r._bounds,r.offset,F),r.delta=Zn.sub(r.offset,w),this.computeMovement(),I&&(!r.last||u>EN)){r.delta=Zn.sub(r.offset,w);const Y=r.delta.map(Math.abs);Zn.addTo(r.distance,Y),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&u>0&&(r.velocity=[Y[0]/u,Y[1]/u],r.timeDelta=u)}}emit(){const t=this.state,r=this.shared,s=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!s.triggerAllEvents)return;const i=this.handler(rs(rs(rs({},r),t),{},{[this.aliasKey]:t.values}));i!==void 0&&(t.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function RN([e,t],r){const s=Math.abs(e),i=Math.abs(t);if(s>i&&s>r)return"x";if(i>s&&i>r)return"y"}class uu extends D6{constructor(...t){super(...t),Ds(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=Zn.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Zn.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,s=this.config;if(!r.axis&&t){const i=typeof s.axisThreshold=="object"?s.axisThreshold[R6(t)]:s.axisThreshold;r.axis=RN(r._movement,i)}r._blocked=(s.lockDirection||!!s.axis)&&!r.axis||!!s.axis&&s.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 MN=e=>e,V2=.15,B6={enabled(e=!0){return e},eventOptions(e,t,r){return rs(rs({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[V2,V2];case!1:return[0,0];default:return Zn.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return Zn.toVector(e)},transform(e,t,r){const s=e||r.shared.transform;return this.hasCustomTransform=!!s,s||MN},threshold(e){return Zn.toVector(e,0)}},NN=0,t0=rs(rs({},B6),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=NN){return e},bounds(e={}){if(typeof e=="function")return u=>t0.bounds(e(u));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:s=-1/0,bottom:i=1/0}=e;return[[t,r],[s,i]]}}),q2={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 DN extends uu{constructor(...t){super(...t),Ds(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(),s=t.currentTarget.getBoundingClientRect(),i={left:r.left-s.left+t.offset[0],right:r.right-s.right+t.offset[0],top:r.top-s.top+t.offset[1],bottom:r.bottom-s.bottom+t.offset[1]};t._bounds=t0.bounds(i)}}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,s=this.state;if(t.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(t.buttons):r.pointerButtons!==-1&&r.pointerButtons!==t.buttons))return;const i=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(i&&i.size>1&&s._pointerActive)&&(this.start(t),this.setupPointer(t),s._pointerId=_f(t),s._pointerActive=!0,this.computeValues(V0(t)),this.computeInitial(),r.preventScrollAxis&&R6(t)!=="mouse"?(s._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,s=this.config;if(!r._pointerActive)return;const i=_f(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;const u=V0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=Zn.sub(u,r._values),this.computeValues(u)),Zn.addTo(r._movement,r._delta),this.compute(t),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(t);return}if(s.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===s.preventScrollAxis||s.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,s=this.config;if(!r._active||!r._pointerActive)return;const i=_f(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[u,c]=r._distance;if(r.tap=u<=s.tapsThreshold&&c<=s.tapsThreshold,r.tap&&s.filterTaps)r._force=!0;else{const[h,p]=r._delta,[m,x]=r._movement,[b,v]=s.swipe.velocity,[w,I]=s.swipe.distance,k=s.swipe.duration;if(r.elapsedTime<k){const N=Math.abs(h/r.timeDelta),R=Math.abs(p/r.timeDelta);N>b&&Math.abs(m)>w&&(r.swipe[0]=Math.sign(h)),R>v&&Math.abs(x)>I&&(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,s=r.device;r.pointerLock&&t.currentTarget.requestPointerLock(),r.pointerCapture||(this.eventStore.add(this.sharedConfig.window,s,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,s,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,s,"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,BN(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=q2[t.key];if(r){const s=this.state,i=t.shiftKey?10:t.altKey?.1:1;this.start(t),s._delta=r(this.config.keyboardDisplacement,i),s._keyboardActive=!0,Zn.addTo(s._movement,s._delta),this.compute(t),this.emit()}}keyUp(t){t.key in q2&&(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 BN(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const du=typeof window<"u"&&window.document&&window.document.createElement;function Q6(){return du&&"ontouchstart"in window}function QN(){return Q6()||du&&window.navigator.maxTouchPoints>1}function jN(){return du&&"onpointerdown"in window}function PN(){return du&&"exitPointerLock"in window.document}function ON(){try{return"constructor"in GestureEvent}catch{return!1}}const Fo={isBrowser:du,gesture:ON(),touch:Q6(),touchscreen:QN(),pointer:jN(),pointerLock:PN()},FN=250,UN=180,$N=.5,zN=50,HN=250,WN=10,Z2={mouse:0,touch:0,pen:8},GN=rs(rs({},t0),{},{device(e,t,{pointer:{touch:r=!1,lock:s=!1,mouse:i=!1}={}}){return this.pointerLock=s&&Fo.pointerLock,Fo.touch&&r?"touch":this.pointerLock?"mouse":Fo.pointer&&!i?"pointer":Fo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?FN:void 0,!(!Fo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:s=1,keys:i=!0}={}}){return this.pointerButtons=s,this.keys=i,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:s=3,axis:i=void 0}){const u=Zn.toVector(e,r?s:i?1:0);return this.filterTaps=r,this.tapsThreshold=s,u},swipe({velocity:e=$N,distance:t=zN,duration:r=HN}={}){return{velocity:this.transform(Zn.toVector(e)),distance:this.transform(Zn.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return UN;case!1:return 0;default:return e}},axisThreshold(e){return e?rs(rs({},Z2),e):Z2},keyboardDisplacement(e=WN){return e}});function j6(e){const[t,r]=e.overflow,[s,i]=e._delta,[u,c]=e._direction;(t<0&&s>0&&u<0||t>0&&s<0&&u>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&c<0||r>0&&i<0&&c>0)&&(e._movement[1]=e._movementBound[1])}const VN=30,qN=100;class ZN extends D6{constructor(...t){super(...t),Ds(this,"ingKey","pinching"),Ds(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:s}=this.state;t==="wheel"?this.state.offset=Zn.add(r,s):this.state.offset=[(1+r[0])*s[0],r[1]+s[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,s]=t._movement;if(!t.axis){const i=Math.abs(r)*VN-Math.abs(s);i<0?t.axis="angle":i>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,s=this.ctrl.touchIds;if(r._active&&r._touchIds.every(u=>s.has(u))||s.size<2)return;this.start(t),r._touchIds=Array.from(s).slice(0,2);const i=z2(t,r._touchIds);i&&this.pinchStart(t,i)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const r=this.state,s=r._pointerEvents,i=this.ctrl.pointerIds;if(r._active&&Array.from(s.keys()).every(c=>i.has(c))||(s.size<2&&s.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const u=vp(...Array.from(s.values()));u&&this.pinchStart(t,u)}pinchStart(t,r){const s=this.state;s.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=z2(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 s=vp(...Array.from(r.values()));s&&this.pinchMove(t,s)}pinchMove(t,r){const s=this.state,i=s._values[1],u=r.angle-i;let c=0;Math.abs(u)>270&&(c+=Math.sign(u)),this.computeValues([r.distance,r.angle-360*c]),s.origin=r.origin,s.turns=c,s._movement=[s._values[0]/s._initial[0]-1,s._values[1]-s._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 s=r._movement;r._movement=[t.scale-1,t.rotation],r._delta=Zn.sub(r._movement,s),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(s=>t[s]):!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 s=this.state;s._delta=[-N6(t)[1]/qN*s.offset[0],0],Zn.addTo(s._movement,s._delta),j6(s),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 YN=rs(rs({},B6),{},{device(e,t,{shared:r,pointer:{touch:s=!1}={}}){if(r.target&&!Fo.touch&&Fo.gesture)return"gesture";if(Fo.touch&&s)return"touch";if(Fo.touchscreen){if(Fo.pointer)return"pointer";if(Fo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:s={}}){const i=c=>{const h=G2(Pd(r,c),{min:-1/0,max:1/0});return[h.min,h.max]},u=c=>{const h=G2(Pd(s,c),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof s!="function"?[i(),u()]:c=>[i(c),u(c)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",Zn.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class KN extends uu{constructor(...t){super(...t),Ds(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(V0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=V0(t),s=this.state;s._delta=Zn.sub(r,s._values),Zn.addTo(s._movement,s._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 XN=rs(rs({},t0),{},{mouseOnly:(e=!0)=>e});class JN extends uu{constructor(...t){super(...t),Ds(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,s=_N(t);r._delta=Zn.sub(s,r._values),Zn.addTo(r._movement,r._delta),this.computeValues(s),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 eD=t0;class tD extends uu{constructor(...t){super(...t),Ds(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=N6(t),Zn.addTo(r._movement,r._delta),j6(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 rD=t0;class nD extends uu{constructor(...t){super(...t),Ds(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(V0(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 s=V0(t);r._movement=r._delta=Zn.sub(s,r._values),this.computeValues(s),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 sD=rs(rs({},t0),{},{mouseOnly:(e=!0)=>e}),b1=new Map,wp=new Map;function P6(e){b1.set(e.key,e.engine),wp.set(e.key,e.resolver)}const O6={key:"drag",engine:DN,resolver:GN},iD={key:"hover",engine:nD,resolver:sD},oD={key:"move",engine:KN,resolver:XN},aD={key:"pinch",engine:ZN,resolver:YN},lD={key:"scroll",engine:JN,resolver:eD},cD={key:"wheel",engine:tD,resolver:rD};function uD(e,t){if(e==null)return{};var r={},s=Object.keys(e),i,u;for(u=0;u<s.length;u++)i=s[u],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function dD(e,t){if(e==null)return{};var r=uD(e,t),s,i;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(i=0;i<u.length;i++)s=u[i],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}const hD={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=Fo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},fD=["target","eventOptions","window","enabled","transform"];function md(e={},t){const r={};for(const[s,i]of Object.entries(t))switch(typeof i){case"function":r[s]=i.call(r,e[s],s,e);break;case"object":r[s]=md(e[s],i);break;case"boolean":i&&(r[s]=e[s]);break}return r}function pD(e,t,r={}){const s=e,{target:i,eventOptions:u,window:c,enabled:h,transform:p}=s,m=dD(s,fD);if(r.shared=md({target:i,eventOptions:u,window:c,enabled:h,transform:p},hD),t){const x=wp.get(t);r[t]=md(rs({shared:r.shared},m),x)}else for(const x in m){const b=wp.get(x);b&&(r[x]=md(rs({shared:r.shared},m[x]),b))}return r}class F6{constructor(t,r){Ds(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,s,i,u){const c=this._listeners,h=AN(r,s),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},m=rs(rs({},p),u);t.addEventListener(h,i,m);const x=()=>{t.removeEventListener(h,i,m),c.delete(x)};return c.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class mD{constructor(){Ds(this,"_timeouts",new Map)}add(t,r,s=140,...i){this.remove(t),this._timeouts.set(t,window.setTimeout(r,s,...i))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class gD{constructor(t){Ds(this,"gestures",new Set),Ds(this,"_targetEventStore",new F6(this)),Ds(this,"gestureEventStores",{}),Ds(this,"gestureTimeoutStores",{}),Ds(this,"handlers",{}),Ds(this,"config",{}),Ds(this,"pointerIds",new Set),Ds(this,"touchIds",new Set),Ds(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),xD(this,t)}setEventIds(t){if(oh(t))return this.touchIds=new Set(SN(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=pD(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,s={};let i;if(!(r.target&&(i=r.target(),!i))){if(r.enabled){for(const c of this.gestures){const h=this.config[c],p=Y2(s,h.eventOptions,!!i);if(h.enabled){const m=b1.get(c);new m(this,t,c).bind(p)}}const u=Y2(s,r.eventOptions,!!i);for(const c in this.nativeHandlers)u(c,"",h=>this.nativeHandlers[c](rs(rs({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const u in s)s[u]=kN(...s[u]);if(!i)return s;for(const u in s){const{device:c,capture:h,passive:p}=wN(u);this._targetEventStore.add(i,c,"",s[u],{capture:h,passive:p})}}}}function T0(e,t){e.gestures.add(t),e.gestureEventStores[t]=new F6(e,t),e.gestureTimeoutStores[t]=new mD}function xD(e,t){t.drag&&T0(e,"drag"),t.wheel&&T0(e,"wheel"),t.scroll&&T0(e,"scroll"),t.move&&T0(e,"move"),t.pinch&&T0(e,"pinch"),t.hover&&T0(e,"hover")}const Y2=(e,t,r)=>(s,i,u,c={},h=!1)=>{var p,m;const x=(p=c.capture)!==null&&p!==void 0?p:t.capture,b=(m=c.passive)!==null&&m!==void 0?m:t.passive;let v=h?s:yN(s,i,x);r&&b&&(v+="Passive"),e[v]=e[v]||[],e[v].push(u)},bD=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function yD(e){const t={},r={},s=new Set;for(let i in e)bD.test(i)?(s.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,s]}function C0(e,t,r,s,i,u){if(!e.has(r)||!b1.has(s))return;const c=r+"Start",h=r+"End",p=m=>{let x;return m.first&&c in t&&t[c](m),r in t&&(x=t[r](m)),m.last&&h in t&&t[h](m),x};i[s]=p,u[s]=u[s]||{}}function vD(e,t){const[r,s,i]=yD(e),u={};return C0(i,r,"onDrag","drag",u,t),C0(i,r,"onWheel","wheel",u,t),C0(i,r,"onScroll","scroll",u,t),C0(i,r,"onPinch","pinch",u,t),C0(i,r,"onMove","move",u,t),C0(i,r,"onHover","hover",u,t),{handlers:u,config:t,nativeHandlers:s}}function U6(e,t={},r,s){const i=_.useMemo(()=>new gD(e),[]);if(i.applyHandlers(e,s),i.applyConfig(t,r),_.useEffect(i.effect.bind(i)),_.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function K2(e,t){return P6(O6),U6({drag:e},t||{},"drag")}function wD(e){return e.forEach(P6),function(r,s){const{handlers:i,nativeHandlers:u,config:c}=vD(r,s||{});return U6(i,c,void 0,u)}}function sj(e,t){return wD([O6,aD,lD,cD,oD,iD])(e,t||{})}const X2={dampingRatio:.8,response:.3},AD=.998;function TD(e,t,r,s){const i=2*Math.PI/Math.max(e.response,.001),u=t-s,c=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const w=u,I=c+i*u;return{value:k=>s+(w+I*k)*Math.exp(-i*k),velocity:k=>(I-i*(w+I*k))*Math.exp(-i*k)}}if(h<1){const w=i*Math.sqrt(1-h*h),I=u,k=(c+h*i*u)/w;return{value:N=>s+Math.exp(-h*i*N)*(I*Math.cos(w*N)+k*Math.sin(w*N)),velocity:N=>Math.exp(-h*i*N)*((k*w-h*i*I)*Math.cos(w*N)-(I*w+h*i*k)*Math.sin(w*N))}}const p=i*Math.sqrt(h*h-1),m=-h*i+p,x=-h*i-p,b=(c-x*u)/(m-x),v=u-b;return{value:w=>s+b*Math.exp(m*w)+v*Math.exp(x*w),velocity:w=>b*m*Math.exp(m*w)+v*x*Math.exp(x*w)}}function CD(e,t=AD){return e/1e3*(t/(1-t))}function J2(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function SD(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const _D=.1,LD=5;function ID(e,t,r,s,i){const u=TD(e,t,r,s),c=1e3/60,h=240,p=[];for(let m=0;m<h;m++){const x=m*c/1e3,b=u.value(x),v=u.velocity(x);if(p.push(i?i(b):b),m>0&&Math.abs(b-s)<_D&&Math.abs(v)<LD)break}return p.push(i?i(s):s),{frames:p,durationMs:(p.length-1)*c,solver:u}}const kD='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function ED(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(kD)&&e.blur()}const RD=18,e5=8,t5={touch:e5,pen:e5},MD=500,Lf=200,r5=50,ND=`[${Pv}]`;function If(e,t,r){return Math.min(r,Math.max(t,e))}function n5(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 s5(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(ND)}function Ic(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const $6=_.forwardRef(function({side:t,isOpen:r,drawerWidthPx:s,onClose:i,onOpen:u,children:c,pinned:h=!1},p){const{t:m}=an(),x=t==="left",b=x?-s:s,v=T.useRef(null),w=T.useRef(null),I=T.useRef(r?0:b),k=T.useRef(null),N=T.useRef(null),R=T.useRef(0),D=T.useRef(null),P=T.useRef(null),V=T.useRef(!1),F=T.useRef(null),Y=T.useRef(!1),Z=T.useRef([]),he=T.useRef(null),Ee=T.useRef(I.current),Ie=T.useRef(r?1:0),be=T.useRef(r);be.current=r;const et=T.useRef(b);et.current=b;const Pe=T.useRef(s);Pe.current=s;const fe=T.useRef(x);fe.current=x;const De=T.useRef(i);De.current=i;const pe=T.useRef(u);pe.current=u;const ae=T.useCallback(ge=>{v.current=ge,typeof p=="function"?p(ge):p&&(p.current=ge)},[p]),ce=T.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),k.current=null},[]),Te=T.useCallback(ge=>{const Ue=Pe.current;return fe.current?(ge+Ue)/Ue:(Ue-ge)/Ue},[]),we=T.useCallback(ge=>{const Ue=w.current;Ue&&(Ue.style.opacity=String(If(Te(ge),0,1)))},[Te]),Ge=T.useCallback(ge=>{I.current=ge;const Ue=v.current;Ue&&(Ue.style.transform=`translateX(${ge}px)`,we(ge))},[we]),ie=T.useCallback(ge=>{k.current=ge,N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null;const Ue=k.current;k.current=null,Ue!==null&&Ge(Ue)}))},[Ge]),ve=T.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null);const ge=k.current;k.current=null,ge!==null&&Ge(ge)},[Ge]),ft=T.useCallback(ge=>{const Ue=et.current;return If(ge,Math.min(0,Ue),Math.max(0,Ue))},[]),Rt=T.useCallback(()=>{const ge=D.current;if(!ge)return null;D.current=null;const Ue=(performance.now()-ge.startTime)/1e3,bt={value:ge.solver.value(Ue),velocity:ge.solver.velocity(Ue)};return ge.animations.forEach(Ke=>Ke.cancel()),bt},[]),He=T.useCallback(()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[]),K=T.useCallback(()=>{he.current?.(),he.current=null},[]),Xe=T.useCallback(()=>{ve(),He();const ge=Rt();ge&&Ge(ft(ge.value));const Ue=v.current,bt=w.current;Ue?.getAnimations().forEach(Ke=>Ke.cancel()),Ue&&(Ue.style.transition="none",Ue.style.opacity="1"),bt?.getAnimations().forEach(Ke=>Ke.cancel()),bt&&(bt.style.transition="none")},[Ge,He,ft,ve,Rt]),Ce=T.useCallback((ge,Ue)=>{ve(),He();const bt=v.current,Ke=w.current,Mt=ge?0:et.current;Ke&&(Ke.style.pointerEvents=ge?"auto":"none");const We=Rt(),vt=We?ft(We.value):I.current,ir=Ue?.velocity??We?.velocity??0;if(SD())return I.current=Mt,bt&&(bt.style.transition=`opacity ${Lf}ms ease`,bt.style.opacity=ge?"1":"0",bt.style.transform=`translateX(${Mt}px)`),Ke&&(Ke.style.transition=`opacity ${Lf}ms ease`,Ke.style.opacity=ge?"1":"0"),Lf;bt&&(bt.style.transition="none",bt.style.opacity="1"),Ke&&(Ke.style.transition="none");const it=Math.abs(Ue?.velocity??0)>MD,{frames:dt,durationMs:Bt,solver:Et}=ID({dampingRatio:it?X2.dampingRatio:1,response:X2.response},vt,ir,Mt,ft);if(!bt||Math.abs(vt-Mt)<.5&&Math.abs(ir)<5)return Ge(Mt),0;const Vt=bt.animate(dt.map(Qe=>({transform:`translateX(${Qe}px)`})),{duration:Bt,easing:"linear",fill:"forwards"}),te=[Vt];return Ke&&te.push(Ke.animate(dt.map(Qe=>({opacity:String(If(Te(Qe),0,1))})),{duration:Bt,easing:"linear",fill:"forwards"})),D.current={solver:Et,startTime:performance.now(),target:Mt,animations:te},Ic("spring start",{startX:vt,startVelocity:ir,targetX:Mt,frames:dt.length,durationMs:Bt}),Vt.onfinish=()=>{const Qe=D.current;!Qe||!Qe.animations.includes(Vt)||(D.current=null,Ge(Mt),Qe.animations.forEach(qe=>qe.cancel()),Ic("spring finish",{targetX:Mt}))},Bt},[Ge,He,ft,ve,Te,Rt]),z=T.useCallback(ge=>{ve();const Ue=ge,bt=0,Ke=et.current,Mt=I.current+CD(Ue),We=Math.abs(Mt-bt)<=Math.abs(Mt-Ke);Ic("decideSnap",{velocity:Ue,currentX:I.current,projected:Mt,shouldOpen:We});const vt=Ce(We,{velocity:Ue});return We&&!be.current?P.current=window.setTimeout(()=>{P.current=null,pe.current?.()},vt+r5):!We&&be.current&&(P.current=window.setTimeout(()=>{P.current=null,De.current()},vt+r5)),We},[Ce,ve]),q=T.useCallback(ge=>{const Ue=et.current,bt=Math.min(0,Ue),Ke=Math.max(0,Ue),Mt=Pe.current;return ge<bt?bt-J2(bt-ge,Mt):ge>Ke?Ke+J2(ge-Ke,Mt):ge},[]),ye=T.useCallback(ge=>{const Ue=Z.current,bt=performance.now();Ue.push({t:bt,x:ge});const Ke=bt-120;for(;Ue.length>0&&Ue[0].t<Ke;)Ue.shift()},[]),Ve=T.useCallback(()=>{const ge=Z.current;if(ge.length<2)return 0;const Ue=ge[ge.length-1];if(performance.now()-Ue.t>60)return 0;const bt=ge[0],Ke=(Ue.t-bt.t)/1e3;return Ke<.016?0:(Ue.x-bt.x)/Ke},[]);T.useEffect(()=>{He();const ge=D.current,Ue=r?0:et.current;ge&&ge.target===Ue||Ce(r)},[r,Ce,He]),T.useEffect(()=>{Xe(),ie(be.current?0:b)},[b,Xe,ie]),T.useEffect(()=>()=>{ce(),He(),Rt(),K()},[He,ce,K,Rt]);const pt=K2(({active:ge,cancel:Ue,first:bt,last:Ke,movement:[Mt],event:We})=>{if(Ic("bindPanel",{active:ge,first:bt,last:Ke,mx:Mt}),!n5(We)){Ue();return}if(bt){if(K(),V.current=!1,F.current=null,Z.current=[],s5(We)){Ue();return}const vt=v.current,ir=vt?Ov(We.target,vt):null;if(!ir||Fv()){Ue();return}const it=Uv(ir,Mt,fe.current?-1:1);if(Ic("arbitrate",{owner:it.kind,mx:Mt}),it.kind==="swiper"){he.current=$v(it.instance),Ue();return}if(it.kind==="scroller"){const dt=zv(it.element);if(dt)F.current=dt;else{Ue();return}}F.current||(V.current=!0,Xe(),R.current=I.current)}if(!ge){F.current=null,V.current&&(V.current=!1,z(Ve()));return}if(F.current){Hv(F.current,Mt);return}if(V.current){const vt=q(R.current+Mt);ye(vt),ie(vt)}},{axis:"x",axisThreshold:t5,filterTaps:!0,pointer:{touch:!0}}),ht=K2(({active:ge,cancel:Ue,first:bt,movement:[Ke],event:Mt})=>{if(!n5(Mt)){Ue();return}if(be.current){Ue();return}if(bt&&(Y.current=!0,Z.current=[],Xe(),R.current=I.current),!ge){Y.current&&(Y.current=!1,z(Ve())&&ED());return}if(Y.current){const We=q(R.current+Ke);ye(We),ie(We)}},{axis:"x",axisThreshold:t5,filterTaps:!0,pointer:{touch:!0}}),It=T.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation(),be.current||pe.current?.()},[]);if(h)return a.jsx("aside",{ref:ae,"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 Se=pt();return a.jsxs(a.Fragment,{children:[a.jsx("div",{...ht(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:RD,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:It,"aria-label":m(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),a.jsx("div",{ref:w,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:Ie.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:i,"aria-label":m("sidebar.closeSidebar")}),a.jsx("aside",{...Se,onClickCapture:ge=>{s5(ge)||Se.onClickCapture?.(ge)},ref:ae,"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:s,maxWidth:"94vw",transform:`translateX(${Ee.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})]})});function DD(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function BD(e,t,r,s="next"){if(e.length===0)return null;const i=t?e.findIndex(u=>u.sessionId===t):-1;for(let u=1;u<=e.length;u+=1){const c=s==="next"?u:-u,h=(i+c+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function QD(e,t,r="next"){return BD(e,t,DD,r)}const yo=42,Od=20,jD=10;function Ap(e,t,r){return Math.min(r,Math.max(t,e))}function ah(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),s=Math.max(0,e.safeBottom??0),i=Math.max(0,e.safeLeft??0),u=Math.max(0,e.bottomClearance??72),c=i+Od,h=Math.max(c,e.width-r-Od-yo),p=Math.max(t+12,52),m=Math.max(p,e.height-s-u-yo);return{minX:c,maxX:h,minY:p,maxY:m}}function i5(e,t){const r=ah(e),s=Ap(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*s}}function Yl(e,t){const r=ah(e);return{x:Ap(t.x,r.minX,r.maxX),y:Ap(t.y,r.minY,r.maxY)}}function o5(e,t){const r=ah(e),s=Yl(e,t),i=(r.minX+r.maxX+yo)/2,u=s.x+yo/2<i?"left":"right",c=r.maxY-r.minY;return{position:{x:u==="left"?r.minX:r.maxX,y:s.y},preference:{side:u,yRatio:c>0?(s.y-r.minY)/c:0}}}function a5(e,t,r){const s=Yl(e,t),i=yo+jD,u=m=>Math.abs(m.x-r.x)<i&&Math.abs(m.y-r.y)<i;if(!u(s))return s;const c=[{...s,y:r.y-i},{...s,y:r.y+i}].map(m=>Yl(e,m)).filter(m=>!u(m)).sort((m,x)=>Math.abs(m.y-s.y)-Math.abs(x.y-s.y));if(c[0])return c[0];const h=ah(e);return[{...s,x:h.minX},{...s,x:h.maxX}].map(m=>Yl(e,m)).filter(m=>!u(m)).sort((m,x)=>Math.abs(m.x-s.x)-Math.abs(x.x-s.x))[0]??s}const kf="var(--warning)",PD="var(--success)",l5="var(--tmux)",c5="termdock:mobile-attention-position:v1",u5="termdock:running-session-position:v1",OD={side:"right",yRatio:.68},FD={side:"right",yRatio:.54};function d5(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 UD(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Yu(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 $D(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const s=window.visualViewport,i=s?.width??window.innerWidth,u=s?.height??window.innerHeight,c=t?.getBoundingClientRect(),h=!!(c&&c.width>0&&c.height>0);return{width:i,height:u,safeTop:Math.max(Yu("--safe-top-inset"),(h?Math.max(0,c.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(Yu("--safe-right-inset"),(h?Math.max(0,i-c.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(Yu("--safe-bottom-inset"),(h?Math.max(0,u-c.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(Yu("--safe-left-inset"),(h?Math.max(0,c.left):0)+Math.max(0,r.left??0)),bottomClearance:e?Od:72}}function z6(){const e=Br.getState(),t=Array.from(e.sessions.values()),r=QD(t,e.activeSessionId);if(!r)return;const s=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;s?.agentNeedsReview&&e.clearAgentNeedsReview(s.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:r}))}function h5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function H6(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 zD({indicator:e,tone:t,size:r}){const s=H6(t);switch(e){case"spinner":return a.jsx(un,{size:r,className:"shrink-0 animate-spin",style:{color:s}});case"question":return a.jsx(gd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:s}});case"badge":return a.jsx(P0,{size:r+1,className:"shrink-0 animate-pulse",style:{color:s}});case"terminal":return a.jsx($o,{size:r,className:"shrink-0",style:{color:s}});case"pulse":return a.jsx(p8,{size:r,className:"shrink-0 animate-pulse",style:{color:s}});case"ring":return a.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:s}});case"dot":return a.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:s}})}}function Kl({agent:e,size:t=12}){const r=t-4;if(!e.icon)return a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:a.jsx(Hd,{size:r,className:"text-white"})});let s;return e.isPlugin?(s=`/api/terminal/agent-plugin-icon/${e.slug}`,e.iconVersion&&(s+=`?v=${Math.floor(e.iconVersion)}`)):s=`/icons/agents/${e.icon}.svg`,e.iconMode==="native"?a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:a.jsx("img",{src:s,alt:e.displayName,style:{width:r,height:r}})}):a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:a.jsx("span",{className:"block bg-white",style:{width:r,height:r,WebkitMask:`url(${s}) center / contain no-repeat`,mask:`url(${s}) center / contain no-repeat`}})})}function HD({sessionMode:e,state:t,size:r=11}){const s=t?.agent?a.jsx(Kl,{agent:t.agent,size:r+1}):e==="tmux"?a.jsx(U0,{size:r,className:"shrink-0"}):a.jsx($o,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?a.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:a.jsx(zD,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?a.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:a.jsx(un,{size:r,className:"shrink-0 animate-spin",style:{color:PD}})}):t?.agentStatus==="waiting"?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(gd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:kf}})}):t?.agentStatus==="done"&&t.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(P0,{size:r+1,className:"shrink-0 animate-pulse",style:{color:kf}})}):t?.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(P0,{size:r+1,className:"shrink-0 animate-pulse",style:{color:kf}})}):t?.inCopyMode?e==="tmux"?a.jsx(U0,{size:r,className:"shrink-0 animate-pulse",style:{color:l5}}):a.jsx($o,{size:r,className:"shrink-0 animate-pulse",style:{color:l5}}):s}function WD({status:e,detail:t,needsReview:r,inCopyMode:s}){const{t:i}=an();return t&&!r?a.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:H6(t.tone)},title:t.label}):e==="working"?a.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:i("agent.aiRunning")}):e==="waiting"||r?a.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:i(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?a.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:i("agent.finishedReview")}):s?a.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:i("agent.copyMode")}):null}function W6({count:e,tone:t,title:r}){const{t:s}=an();if(e<=0)return null;const i=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]",u=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??s("agent.jumpToNext");return a.jsxs("button",{type:"button",className:i,title:`${c} · ${s("agent.jumpToNext")}`,"aria-label":`${c}: ${e}. ${s("agent.jumpToNext")}`,onClick:z6,children:[a.jsx(P0,{size:11,className:"shrink-0"}),a.jsx("span",{children:s("agent.needsReview")}),a.jsx("span",{className:"tabular-nums",children:e})]})}return a.jsxs("span",{className:i,title:r,children:[a.jsx("span",{className:u}),e]})}function GD({runningCount:e,reviewCount:t,className:r=""}){const s=[];return e>0&&s.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&s.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),s.length===0?null:a.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${s.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:s.map(i=>a.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 ${i.className}`,children:i.count>9?"9+":i.count},i.key))})}const VD=380,f5=10,Ku=10,Ef=52,qD=104;function ZD(e,t,r){const s=Math.max(0,t.safeLeft??0),i=t.width-Math.max(0,t.safeRight??0),u=Math.max(0,t.safeTop??0),c=t.height-Math.max(0,t.safeBottom??0),h=Od,p=e.x+yo/2>=s+(i-s)/2,m=p?e.x-Ku-s-h:i-h-e.x-yo-Ku,x=Math.max(1,Math.min(Math.max(0,m),Math.max(168,r*qD))),b=p?e.x-Ku-x:e.x+yo+Ku,v=Math.min(Math.max(b,s+h),Math.max(s+h,i-h-x)),w=e.y+yo/2-Ef/2,I=Math.min(Math.max(w,u+h),Math.max(u+h,c-h-Ef));return{left:v,top:I,width:x,height:Ef,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function p5(e,t,r,s){return t<e.left||t>e.left+e.width||r<e.top-14||r>e.top+e.height+14?null:Math.min(s-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function YD(e,t){if(e.length===0)return null;const r=t?e.findIndex(s=>s.id===t):-1;return e[(r+1)%e.length]?.id??null}function KD({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:s,isDesktopLayout:i,containerElement:u,occlusionInsets:c}){const{t:h}=an(),p=Ht(z=>z.leftOpen),m=Ht(z=>z.rightOpen),{isOpen:x}=i3({enabled:!i}),b=i||!p&&!m&&!x,v=e>0&&b,w=t.length>1||t.length===1&&t[0]?.id!==r,I=s&&t.length>0&&w&&b,k=Math.max(0,c?.top??0),N=Math.max(0,c?.right??0),R=Math.max(0,c?.bottom??0),D=Math.max(0,c?.left??0),P=_.useCallback(()=>$D(i,u,{top:k,right:N,bottom:R,left:D}),[u,i,R,D,N,k]),V=_.useRef({attention:d5(c5,OD),running:d5(u5,FD)}),F=_.useCallback(()=>{const z=P(),q=i5(z,V.current.attention),ye=i5(z,V.current.running);return{attention:q,running:v&&I?a5(z,ye,q):ye}},[v,P,I]),[Y,Z]=_.useState(()=>F()),he=_.useRef(Y);he.current=Y;const[Ee,Ie]=_.useState(null),be=_.useRef(null),[et,Pe]=_.useState("idle"),[fe,De]=_.useState(null),pe=_.useRef(null),ae=_.useRef({attention:!1,running:!1});_.useEffect(()=>()=>{const z=pe.current?.longPressTimer;z!=null&&window.clearTimeout(z)},[]),_.useEffect(()=>{if(I)return;const z=pe.current?.longPressTimer;z!=null&&window.clearTimeout(z),pe.current=null,Pe("idle"),De(null)},[I]),_.useLayoutEffect(()=>{const z=()=>{const ye=F();he.current=ye,Z(ye)};z(),window.addEventListener("resize",z),window.addEventListener("orientationchange",z),window.visualViewport?.addEventListener("resize",z);const q=typeof ResizeObserver>"u"?null:new ResizeObserver(z);return u&&q?.observe(u),()=>{window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),window.visualViewport?.removeEventListener("resize",z),q?.disconnect()}},[u,F]);const ce=_.useCallback(z=>z==="attention"?I:v,[v,I]),Te=_.useCallback((z,q)=>{if(!ce(z))return q;const ye=z==="attention"?"running":"attention";return a5(P(),q,he.current[ye])},[P,ce]),we=_.useCallback((z,q,ye,Ve)=>{const pt=P(),ht=q.moved?Yl(pt,{x:q.startX+(ye-q.originX),y:q.startY+(Ve-q.originY)}):he.current[z],It=o5(pt,ht),Se=Te(z,It.position),ge=o5(pt,Se);V.current[z]=ge.preference,UD(z==="attention"?c5:u5,ge.preference);const Ue={...he.current,[z]:ge.position};he.current=Ue,Z(Ue)},[Te,P]),Ge=_.useCallback(z=>{ae.current[z]=!0,window.setTimeout(()=>{ae.current[z]=!1},0)},[]),ie=_.useCallback(z=>{const q=be.current;!q||q.kind!=="attention"||q.pointerId!==z.pointerId||(be.current=null,Ie(null),we("attention",q,z.clientX,z.clientY),q.moved&&Ge("attention"))},[we,Ge]),ve={onPointerDown:z=>{z.stopPropagation(),z.currentTarget.setPointerCapture(z.pointerId),be.current={kind:"attention",pointerId:z.pointerId,originX:z.clientX,originY:z.clientY,startX:Y.attention.x,startY:Y.attention.y,moved:!1}},onPointerMove:z=>{const q=be.current;if(!q||q.kind!=="attention"||q.pointerId!==z.pointerId)return;const ye=z.clientX-q.originX,Ve=z.clientY-q.originY;if(!q.moved&&Math.hypot(ye,Ve)<5)return;q.moved=!0,Ie("attention");const pt=P(),ht=Te("attention",Yl(pt,{x:q.startX+ye,y:q.startY+Ve})),It={...he.current,attention:ht};he.current=It,Z(It)},onPointerUp:ie,onPointerCancel:ie},ft=u?ZD(Y.running,P(),t.length):null,Rt=z=>{z.longPressTimer!==null&&(window.clearTimeout(z.longPressTimer),z.longPressTimer=null)},He={onPointerDown:z=>{z.stopPropagation(),z.currentTarget.setPointerCapture(z.pointerId);const q=z.pointerId,ye={pointerId:q,originX:z.clientX,originY:z.clientY,startX:Y.running.x,startY:Y.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};ye.longPressTimer=window.setTimeout(()=>{const Ve=pe.current;!Ve||Ve.pointerId!==q||Ve.mode!=="pressing"||(Ve.longPressTimer=null,Ve.mode="dragging",ae.current.running=!0,Pe("dragging"))},VD),pe.current=ye,Pe("pressing"),De(null)},onPointerMove:z=>{const q=pe.current;if(!q||q.pointerId!==z.pointerId)return;const ye=z.clientX-q.originX,Ve=z.clientY-q.originY;if(q.mode==="pressing")if(Math.abs(ye)>=f5&&Math.abs(ye)>=Math.abs(Ve))Rt(q),q.mode="selecting",ae.current.running=!0,Pe("selecting");else if(Math.hypot(ye,Ve)>=f5){Rt(q),q.mode="cancelled",ae.current.running=!0,Pe("idle");return}else return;if(q.mode==="selecting"){const Se=ft?p5(ft,z.clientX,z.clientY,t.length):null;q.selectedIndex=Se,De(Se);return}if(q.mode!=="dragging"||!q.moved&&Math.hypot(ye,Ve)<5)return;q.moved=!0;const pt=P(),ht=Te("running",Yl(pt,{x:q.startX+ye,y:q.startY+Ve})),It={...he.current,running:ht};he.current=It,Z(It)},onPointerUp:z=>{const q=pe.current;if(!q||q.pointerId!==z.pointerId)return;Rt(q);const ye=q.mode;if(ye==="selecting"){const Ve=ft?p5(ft,z.clientX,z.clientY,t.length):q.selectedIndex,pt=Ve===null?null:t[Ve]?.id;pt&&h5(pt)}else ye==="dragging"&&we("running",q,z.clientX,z.clientY);pe.current=null,Pe("idle"),De(null),ye!=="pressing"&&Ge("running")},onPointerCancel:z=>{const q=pe.current;!q||q.pointerId!==z.pointerId||(Rt(q),pe.current=null,Pe("idle"),De(null),Ge("running"))}},K=(z,q)=>a.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)] ${q==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:z>9?"9+":z}),Xe=()=>{const z=h("agent.jumpToNext"),q=Y.attention,ye=Ee==="attention";return a.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...ve,onClick:Ve=>{Ve.stopPropagation(),!ae.current.attention&&z6()},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 ${ye?"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:{left:q.x,top:q.y,width:yo,height:yo,touchAction:"none"},"aria-label":`${z}: ${e}`,title:z,children:[a.jsx(P0,{size:17,className:"shrink-0"}),K(e,"attention")]},"attention")},Ce=()=>{const z=t.length,q=Y.running,ye=et==="selecting",Ve=et==="dragging";return a.jsxs(_.Fragment,{children:[a.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":et,...He,onClick:pt=>{if(pt.stopPropagation(),ae.current.running)return;const ht=YD(t,r);ht&&h5(ht)},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 ${Ve?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":ye?"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:q.x,top:q.y,width:yo,height:yo,touchAction:"none"},"aria-label":`${h("agent.jumpToNextRunning")}: ${z}`,title:h("agent.runningSessionGestureHint"),children:[a.jsx(un,{size:18,className:"shrink-0 animate-spin"}),K(z,"running")]}),ye&&ft&&a.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":ft.side,"aria-label":h("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:ft.left,top:ft.top,width:ft.width,height:ft.height},children:t.map((pt,ht)=>{const It=ht===fe,Se=pt.id===r,ge=`${pt.label}${pt.detail?` · ${pt.detail}`:""}${Se?` · ${h("agent.currentSession")}`:""}`;return a.jsxs("div",{role:"option","aria-selected":It,"data-running-session-option":pt.id,"data-selected":It?"true":"false",title:ge,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 ${It?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":Se?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[a.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${It?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:ht+1}),a.jsx("span",{className:"truncate text-[10px] font-medium",children:pt.label})]},pt.id)})})]},"running")};return!v&&!I||u===null||typeof document>"u"?null:a.jsxs(O7,{children:[v&&Xe(),I&&Ce()]})}const XD=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"]),m5=120,g5=120,JD=new Set,eB=[],tB={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 y1(e,t){if(t==="directory")return null;if($7(e))return a.jsx(o8,{size:14});if(z7(e))return a.jsx(k9,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return XD.has(r)?a.jsx(E8,{size:14}):a.jsx(ex,{size:14})}function G6({path:e}){const r=Ht(i=>i.changedFiles.get(e))?.status;if(!r)return null;const s=tB[r]??{label:"?",className:"text-muted-foreground",title:r};return a.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${s.className}`,title:s.title,children:s.label})}function q0(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 v1(e){return q0(e)}const rB=T.memo(function({path:t}){const{t:r}=an(),[s,i]=T.useState("idle"),[u,c]=T.useState(null),h=T.useCallback(async p=>{if(p.stopPropagation(),s!=="pending"){i("pending"),c(null);try{await $5(t),i("idle")}catch(m){i("error"),c(m instanceof Error?m.message:r("rightSidebar.downloadFailed"))}}},[t,s,r]);return a.jsx("span",{role:"button",tabIndex:-1,onClick:p=>{h(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${q0(s==="pending")} ${s==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:s==="error"?u??r("rightSidebar.downloadFailed"):r("rightSidebar.downloadFile"),children:s==="pending"?a.jsx(un,{size:12,className:"animate-spin"}):a.jsx(Gc,{size:12})})});function V6(){const{t:e}=an(),[t,r]=T.useState({status:"idle"}),s=T.useCallback(async i=>{r({status:"pending"});try{await $5(i),r({status:"idle"})}catch(u){r({status:"error",message:u instanceof Error?u.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:s}}function Tp(e){return e instanceof DOMException&&e.name==="AbortError"}function Fd(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function q6(e){return e.button===2||e.ctrlKey}const nB=176,sB=160,kc=8;function x5(e,t,r,s){const i=window.visualViewport,u=i?.offsetLeft??0,c=i?.offsetTop??0,h=u+(i?.width??window.innerWidth),p=c+(i?.height??window.innerHeight),m=u+kc,x=c+kc,b=Math.max(m,h-r-kc),v=Math.max(x,p-s-kc),w=t+s<=p-kc?t:t-s;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,m),b),top:Math.min(Math.max(w,x),v)}}function Z6(e){const[t,r]=T.useState(null),s=T.useRef(null),i=T.useCallback((u,c)=>{r(x5(u,c,nB,sB))},[]);return T.useLayoutEffect(()=>{if(!e||!t||!s.current)return;const u=s.current.getBoundingClientRect();if(u.width<=0||u.height<=0)return;const c=x5(t.anchorX,t.anchorY,u.width,u.height);c.left===t.left&&c.top===t.top||r(c)},[e,t]),{position:t,menuRef:s,openAt:i,clearPosition:()=>r(null)}}function Y6(e,t){return t&&typeof document<"u"?Ya.createPortal(e,document.body):e}function iB(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function w1(e,t,r){if(!t||iB(e,t))return!0;const s=r.get(e.path);return s?s.some(i=>w1(i,t,r)):!1}function Cp(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 Sp(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const oB=T.memo(function e({node:t,depth:r,onFileSelect:s,directoriesOnly:i=!1,onPathReference:u,getReferenceText:c,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:m,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:w,onOpenInFileBrowser:I,canOpenInFileBrowser:k,pinnedPaths:N,selectedFilePath:R,queryLower:D,onDirectoryDropFiles:P,onFileDeleteRequest:V,deletingFilePath:F,revealedDirectoryPath:Y}){const{t:Z}=an(),he=Ht(_e=>_e.expandedPaths.has(t.path)),Ee=Ht(_e=>_e.directoryCache.get(t.path)),Ie=Ht(_e=>_e.showHiddenFiles),be=Ht(_e=>_e.toggleExpanded),et=Ht(_e=>_e.setDirectoryCache),Pe=Ht(_e=>_e.fileSortModes[t.path]??"name"),fe=Ht(_e=>_e.setDirectorySortMode),[De,pe]=T.useState(!1),[ae,ce]=T.useState(!1),{position:Te,menuRef:we,openAt:Ge,clearPosition:ie}=Z6(ae),[ve,ft]=T.useState(!1),Rt=T.useRef(0),He=T.useRef(null),K=T.useRef(null),Xe=t.path===R||t.path===Y,Ce=t.type==="directory"&&(he||!!D),z=t.type==="directory",q=N.has(t.path),ye=!z&&!!w,Ve=!!(k&&I),pt=`path:${t.path}`,ht=p===pt,It=m===pt,Se=c?.(t.path)??t.path,ge=Mp(h),{state:Ue,run:bt}=V6(),Ke=F===t.path,Mt=z&&!i&&!!(x||b||v||Ve),We=T.useMemo(()=>{if(!Ee)return;if(!D)return Ee;const _e=Ht.getState().directoryCache;return Ee.filter(Qr=>(!i||Qr.type==="directory")&&w1(Qr,D,_e))},[Ee,i,D]),vt=T.useCallback(async()=>{if(!Ht.getState().directoryCache.has(t.path)&&!De){const Qr=`file-tree:${t.path}`;He.current?.abort(),Of(Qr);const wt=new AbortController;He.current=wt,pe(!0);try{const en=await Ep(t.path,wt.signal,Ie,"expand_directory",Qr,Pe),Er=Cp(en.entries);et(t.path,Er)}catch(en){Tp(en)}finally{He.current===wt&&(He.current=null),pe(!1)}}},[t.path,De,et,Ie,Pe]),ir=T.useCallback(async()=>{if(t.type!=="directory"){s(t.path);return}if(i&&x){x(t.path);return}const _e=!Ht.getState().expandedPaths.has(t.path);be(t.path),_e&&await vt()},[i,t.path,t.type,vt,x,be,s]);T.useEffect(()=>{t.type==="directory"&&he&&!Ee&&!De&&vt()},[Ee,he,vt,De,t.type]);const it=T.useCallback(_e=>{_e.stopPropagation(),u?.(t.path,pt)},[u,t.path,pt]),dt=T.useCallback(_e=>{_e.stopPropagation(),x?.(t.path),ce(!1)},[t.path,x]),Bt=T.useCallback(_e=>{_e.stopPropagation(),b?.(t.path),ce(!1)},[t.path,b]),Et=T.useCallback(_e=>{_e.stopPropagation(),v?.(t.path),ce(!1)},[t.path,v]),Vt=T.useCallback(_e=>{_e.stopPropagation(),fe(t.path,Pe==="modified"?"name":"modified"),ce(!1)},[t.path,fe,Pe]),te=T.useCallback(_e=>{_e.stopPropagation(),w?.(t.path),ce(!1)},[t.path,w]),Qe=T.useCallback(_e=>{_e.stopPropagation(),ce(!1),bt(t.path)},[t.path,bt]),qe=T.useCallback(_e=>{_e.stopPropagation(),ce(!1),V(t)},[t,V]),kt=T.useCallback(_e=>{_e.stopPropagation(),I?.(t.path),ce(!1)},[t.path,I]),Oe=T.useCallback(_e=>{!z||!P||!_e.dataTransfer.types.includes("Files")||(_e.preventDefault(),_e.stopPropagation(),Rt.current+=1,ft(!0))},[z,P]),Nt=T.useCallback(_e=>{!z||!P||!_e.dataTransfer.types.includes("Files")||(_e.preventDefault(),_e.stopPropagation(),_e.dataTransfer.dropEffect="copy",ft(!0))},[z,P]),hr=T.useCallback(_e=>{!z||!P||(_e.preventDefault(),_e.stopPropagation(),Rt.current-=1,Rt.current<=0&&(Rt.current=0,ft(!1)))},[z,P]),Ae=T.useCallback(_e=>{if(!z||!P)return;_e.preventDefault(),_e.stopPropagation(),Rt.current=0,ft(!1);const Qr=Array.from(_e.dataTransfer.files);Qr.length>0&&P(t.path,Qr)},[z,t.path,P]),bn=T.useCallback(_e=>{_e.stopPropagation(),ie(),ce(Qr=>!Qr)},[ie]),_r=T.useCallback(_e=>{!Mt||!q6(_e)||(_e.preventDefault(),_e.stopPropagation(),Ge(_e.clientX,_e.clientY),ce(!0))},[Mt,Ge]);return T.useEffect(()=>{if(!ae)return;const _e=wt=>{const en=wt.target;en instanceof Node&&(K.current?.contains(en)||we.current?.contains(en))||ce(!1)},Qr=wt=>{wt.key==="Escape"&&ce(!1)};return document.addEventListener("pointerdown",_e),document.addEventListener("keydown",Qr),()=>{document.removeEventListener("pointerdown",_e),document.removeEventListener("keydown",Qr)}},[ae,we]),T.useEffect(()=>()=>{He.current?.abort()},[]),a.jsxs("div",{style:!Ce&&!ae?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[a.jsxs("div",{ref:K,className:"relative",children:[ge.popoverNode,a.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":Pe,role:"button",tabIndex:0,onClick:()=>{Fd()||ir()},onContextMenu:_r,onKeyDown:_e=>{_e.key!=="Enter"&&_e.key!==" "||(_e.preventDefault(),ir())},onDragEnter:Oe,onDragOver:Nt,onDragLeave:hr,onDrop:Ae,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${ve?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":Xe?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[r>0&&a.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:`${r*14-4}px`}}),ve&&a.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:Z("fileTree.dropToUploadHere")}),t.type==="directory"?a.jsxs(a.Fragment,{children:[Ce?a.jsx(wl,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(zd,{size:14,className:"shrink-0 text-muted-foreground/80"}),Ce?a.jsx(D0,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):a.jsx(O0,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:Xe?"text-primary":"text-muted-foreground/80",children:y1(t.name,t.type)})]}),a.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${Xe?"font-medium":""}`,children:[t.name,Pe==="modified"&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:Z("fileTree.sortedByModified"),"aria-label":Z("fileTree.sortedByModified"),children:a.jsx(Wc,{size:11})}),t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:Z("fileTree.symbolicLink"),children:a.jsx(F0,{size:11})})]}),a.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${Xe?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:_e=>_e.stopPropagation(),onKeyDown:_e=>_e.stopPropagation(),children:[De&&a.jsx(un,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),a.jsx(G6,{path:t.path}),Mt&&a.jsx("span",{onClick:bn,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${q0(ae)} ${ae?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Z("fileTree.moreDirActions"),children:a.jsx(Hc,{size:13})}),!z&&a.jsx("span",{onClick:bn,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${q0(ae||Ue.status==="pending"||Ke||q)} ${ae?"bg-surface-elevated text-foreground":q?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Ue.status==="error"?Ue.message??Z("rightSidebar.downloadFailed"):Z("fileTree.moreFileActions"),children:Ue.status==="pending"||Ke?a.jsx(un,{size:13,className:"animate-spin"}):a.jsx(Hc,{size:13})}),u&&a.jsx("span",{onClick:it,...ge(Se,pt),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${v1(ht||It)} ${ht||It?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":Z(It?"rightSidebar.copied":ht?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:Z(It?"rightSidebar.copied":ht?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:It||ht?a.jsx(la,{size:12}):a.jsx(F0,{size:12})}),Mt&&ae&&Y6(a.jsxs("div",{ref:we,className:`${Te?"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:Te?{left:Te.left,top:Te.top}:void 0,children:[Ve&&a.jsxs("button",{type:"button",onClick:kt,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:Z("fileTree.openInFileBrowserTitle"),children:[a.jsx(D0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("fileTree.openInFileBrowser")})]}),x&&a.jsxs("button",{type:"button",onClick:dt,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:Z("fileTree.openDirRootTitle"),children:[a.jsx(D0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("fileTree.openDirRoot")})]}),b&&a.jsxs("button",{type:"button",onClick:Bt,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:Z("fileTree.searchFromDirTitle"),children:[a.jsx(Np,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("fileTree.searchFromDir")})]}),v&&a.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 transition active:scale-[0.99] ${q?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:Z(q?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[q?a.jsx(qc,{size:13,className:"shrink-0"}):a.jsx(Vc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z(q?"fileTree.unpinDir":"fileTree.pinDir")})]}),a.jsxs("button",{type:"button",onClick:Vt,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:[Pe==="modified"?a.jsx(Xv,{size:13,className:"shrink-0"}):a.jsx(Wc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z(Pe==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!Te),!z&&ae&&a.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:[Ve&&a.jsxs("button",{type:"button",onClick:kt,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:Z("fileTree.openInFileBrowserTitle"),children:[a.jsx(ex,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("fileTree.openInFileBrowser")})]}),a.jsxs("button",{type:"button",onClick:Qe,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:Z("rightSidebar.downloadFile"),children:[a.jsx(Gc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("rightSidebar.downloadFile")})]}),ye&&a.jsxs("button",{type:"button",onClick:te,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] ${q?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:Z(q?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[q?a.jsx(qc,{size:13,className:"shrink-0"}):a.jsx(Vc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z(q?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:qe,disabled:Ke,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:Z("fileTree.deleteFile"),children:[Ke?a.jsx(un,{size:13,className:"shrink-0 animate-spin"}):a.jsx(Ji,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z("fileTree.deleteFile")})]})]})]})]})]}),Ce&&We&&We.length>0&&a.jsx("div",{className:r===0?"mt-0.5":"",children:We.map(_e=>a.jsx(e,{node:_e,depth:r+1,onFileSelect:s,directoriesOnly:i,onPathReference:u,getReferenceText:c,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:w,onOpenInFileBrowser:I,canOpenInFileBrowser:k,pinnedPaths:N,selectedFilePath:R,queryLower:D,insertedReferenceKey:p,copiedReferenceKey:m,onDirectoryDropFiles:P,onFileDeleteRequest:V,deletingFilePath:F,revealedDirectoryPath:Y},_e.path))})]})}),aB=T.memo(function({node:t,rootPath:r,onFileSelect:s,onPathReference:i,getReferenceText:u,onReferenceCopied:c,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:m,onSearchFromDirectory:x,onDirectoryPinToggle:b,onFilePinToggle:v,pinnedPaths:w,selectedFilePath:I,onFileDeleteRequest:k,deletingFilePath:N}){const{t:R}=an(),D=t.path===I,P=t.type==="directory",V=w.has(t.path),F=!P&&!!v,Y=`path:${t.path}`,Z=h===Y,he=p===Y,Ee=u?.(t.path)??t.path,Ie=Mp(c),{state:be,run:et}=V6(),[Pe,fe]=T.useState(!1),{position:De,menuRef:pe,openAt:ae,clearPosition:ce}=Z6(Pe),Te=T.useRef(null),we=N===t.path,Ge=P&&!!(m||x||b),ie=T.useCallback(()=>{Fd()||(t.type==="directory"?m?.(t.path):s(t.path))},[t.path,t.type,m,s]),ve=T.useCallback(z=>{z.stopPropagation(),i?.(t.path,Y)},[i,t.path,Y]),ft=T.useCallback(z=>{z.stopPropagation(),b?.(t.path),fe(!1)},[t.path,b]),Rt=T.useCallback(z=>{z.stopPropagation(),v?.(t.path),fe(!1)},[t.path,v]),He=T.useCallback(z=>{z.stopPropagation(),fe(!1),et(t.path)},[t.path,et]),K=T.useCallback(z=>{z.stopPropagation(),fe(!1),k(t)},[t,k]),Xe=T.useCallback(z=>{z.stopPropagation(),ce(),fe(q=>!q)},[ce]),Ce=T.useCallback(z=>{!Ge||!q6(z)||(z.preventDefault(),z.stopPropagation(),ae(z.clientX,z.clientY),fe(!0))},[Ge,ae]);return T.useEffect(()=>{if(!Pe)return;const z=ye=>{const Ve=ye.target;Ve instanceof Node&&(Te.current?.contains(Ve)||pe.current?.contains(Ve))||fe(!1)},q=ye=>{ye.key==="Escape"&&fe(!1)};return document.addEventListener("pointerdown",z),document.addEventListener("keydown",q),()=>{document.removeEventListener("pointerdown",z),document.removeEventListener("keydown",q)}},[Pe,pe]),a.jsxs("div",{ref:Te,className:"relative border-b border-border/10 last:border-b-0",children:[Ie.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:ie,onContextMenu:Ce,onKeyDown:z=>{z.key!=="Enter"&&z.key!==" "||(z.preventDefault(),ie())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${D?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx(O0,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:D?"text-primary":"text-muted-foreground/80",children:y1(t.name,t.type)})]}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${D?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:R("fileTree.symbolicLink"),children:a.jsx(F0,{size:11})})]}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:Sp(r,t.path)})]}),a.jsx(G6,{path:t.path}),t.type==="directory"&&(b||x)&&a.jsx("span",{onClick:Xe,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${q0(Pe)} ${Pe?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:R("fileTree.moreDirActions"),children:a.jsx(Hc,{size:13})}),!P&&a.jsx("span",{onClick:Xe,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${q0(Pe||be.status==="pending"||we||V)} ${Pe?"bg-surface-elevated text-foreground":V?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:be.status==="error"?be.message??R("rightSidebar.downloadFailed"):R("fileTree.moreFileActions"),children:be.status==="pending"||we?a.jsx(un,{size:13,className:"animate-spin"}):a.jsx(Hc,{size:13})}),i&&a.jsx("span",{onClick:ve,...Ie(Ee,Y),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${v1(Z||he)} ${Z||he?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":R(he?"rightSidebar.copied":Z?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:R(he?"rightSidebar.copied":Z?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:he||Z?a.jsx(la,{size:12}):a.jsx(F0,{size:12})})]}),Ge&&Pe&&Y6(a.jsxs("div",{ref:pe,className:`${De?"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:De?{left:De.left,top:De.top}:void 0,children:[m&&a.jsxs("button",{type:"button",onClick:z=>{z.stopPropagation(),m(t.path),fe(!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:R("fileTree.openDirRootTitle"),children:[a.jsx(D0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.openDirRoot")})]}),x&&a.jsxs("button",{type:"button",onClick:z=>{z.stopPropagation(),x(t.path),fe(!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:[a.jsx(Np,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.searchFromDir")})]}),b&&a.jsxs("button",{type:"button",onClick:ft,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] ${V?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(V?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[V?a.jsx(qc,{size:13,className:"shrink-0"}):a.jsx(Vc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(V?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!De),!P&&Pe&&a.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:[a.jsxs("button",{type:"button",onClick:He,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:R("rightSidebar.downloadFile"),children:[a.jsx(Gc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("rightSidebar.downloadFile")})]}),F&&a.jsxs("button",{type:"button",onClick:Rt,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] ${V?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(V?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[V?a.jsx(qc,{size:13,className:"shrink-0"}):a.jsx(Vc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(V?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:K,disabled:we,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:R("fileTree.deleteFile"),children:[we?a.jsx(un,{size:13,className:"shrink-0 animate-spin"}):a.jsx(Ji,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.deleteFile")})]})]})]})}),lB=60,b5=60,cB=20;function y5({count:e,loading:t,engine:r,limited:s,scope:i,content:u}){const{t:c}=an();return a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[a.jsx(Np,{size:14,className:"shrink-0 text-primary"}),a.jsx("span",{children:u?c("fileTree.contentMatchesCount",{count:e}):c("fileTree.searchResults",{count:e})})]}),r&&a.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&&a.jsx(un,{size:9,className:"animate-spin"}),r,s?" · limited":""]})]}),a.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[a.jsx("span",{className:"shrink-0",children:c("fileTree.searchScope")}),a.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:i,children:i}),t&&a.jsx("span",{className:"ml-auto shrink-0",children:c("fileTree.searching")})]})]})}function uB(e,t){if(!t)return e;const r=e.toLowerCase(),s=t.toLowerCase(),i=[];let u=0,c=r.indexOf(s,u),h=0;for(;c>=0&&s;)c>u&&i.push(e.slice(u,c)),i.push(a.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(c,c+s.length)},`m-${h++}`)),u=c+s.length,c=r.indexOf(s,u);return u<e.length&&i.push(e.slice(u)),i.length>0?i:e}const dB=T.memo(function({entry:t,rootPath:r,selectedFilePath:s,query:i,onContentMatchSelect:u,onPathReference:c,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:m,copiedReferenceKey:x}){const{t:b}=an(),[v,w]=T.useState(!0),I=t.path===s,k=v?t.matches.slice(0,cB):[],N=t.matches.length-k.length,R=`path:${t.path}`,D=m===R,P=x===R,V=h?.(t.path)??t.path,F=Mp(p);return a.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[F.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Fd()||w(Y=>!Y)},onKeyDown:Y=>{Y.key!=="Enter"&&Y.key!==" "||(Y.preventDefault(),w(Z=>!Z))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${I?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[v?a.jsx(wl,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(zd,{size:14,className:"shrink-0 text-muted-foreground/80"}),a.jsx("span",{className:I?"text-primary":"text-muted-foreground/80",children:y1(t.name,"file")}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:Sp(r,t.path)})]}),a.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}),a.jsx(rB,{path:t.path}),c&&a.jsx("span",{onClick:Y=>{Y.stopPropagation(),c(t.path,R)},...F(V,R),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${v1(D||P)} ${D||P?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":b(P?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:b(P?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:P||D?a.jsx(la,{size:12}):a.jsx(F0,{size:12})})]}),v&&a.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[k.map((Y,Z)=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Fd()||u?.(t.path,Y.line)},onKeyDown:he=>{he.key!=="Enter"&&he.key!==" "||(he.preventDefault(),u?.(t.path,Y.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:`${Sp(r,t.path)}:${Y.line}`,children:[a.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:Y.line}),a.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:uB(Y.text,i)})]},`${Y.line}-${Z}`)),N>0&&a.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:b("fileTree.moreMatches",{count:N})})]})]})});function hB({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:s,getReferenceText:i,onReferenceCopied:u,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:m,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:w=!1,pinnedPaths:I=JD,selectedFilePath:k,query:N="",searchRootPath:R,searchOptions:D={},searchMode:P="name",onContentMatchSelect:V,onDirectoryDropFiles:F,revealDirectory:Y}){const{t:Z}=an(),he=Ht(it=>e?it.directoryCache.get(e):void 0),Ee=Ht(it=>it.setDirectoryCache),Ie=Ht(it=>it.showHiddenFiles),be=Ht(it=>it.fileSortModesHydrated),et=Ht(it=>it.fileSortModes[e]??"name"),Pe=Ht(it=>it.hydrateFileSortModes),[fe,De]=T.useState(!1),[pe,ae]=T.useState(null),[ce,Te]=T.useState(!1),[we,Ge]=T.useState(!1),[ie,ve]=T.useState(null),[ft,Rt]=T.useState(be),He=be||ft;T.useEffect(()=>{let it=!1;return Pe().catch(()=>{}).finally(()=>{it||Rt(!0)}),()=>{it=!0}},[Pe]);const[K,Xe]=T.useState([]),[Ce,z]=T.useState(null),[q,ye]=T.useState(m5),[Ve,pt]=T.useState([]),[ht,It]=T.useState(null),Se=T.useRef(null),ge=T.useRef(0),Ue=N.trim().toLowerCase(),bt=P==="content",Ke=R||e,Mt=D.excludePatterns??eB,We=Mt.join(`
128
- `);T.useEffect(()=>{const it=Y?.path;if(!it||!it.startsWith(`${e}/`)&&it!==e)return;const dt=it.slice(e.length).replace(/^\/+/,""),Bt=dt?dt.split("/"):[],Et=Bt.map((Nt,hr)=>`${e}/${Bt.slice(0,hr+1).join("/")}`),Vt=Ht.getState(),te=Et.filter(Nt=>!Vt.expandedPaths.has(Nt));te.length>0&&Ht.setState(Nt=>({expandedPaths:new Set([...Nt.expandedPaths,...te])}));let Qe=!1,qe=0;const kt=()=>{if(Qe)return;const Nt=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(hr=>hr.dataset.fileTreePath===it);if(Nt){Nt.scrollIntoView({block:"center",behavior:"smooth"});return}qe+=1,qe<80&&window.setTimeout(kt,50)},Oe=window.requestAnimationFrame(kt);return()=>{Qe=!0,window.cancelAnimationFrame(Oe)}},[Y?.nonce,Y?.path,e]);const vt=T.useCallback(async it=>{if(!(ht||it.type==="directory")&&window.confirm(Z("fileTree.deleteFileConfirm",{name:it.name}))){It(it.path);try{await F7(it.path),Ht.getState().applyFileWatchEvents([{type:"deleted",path:it.path}]),Xe(dt=>dt.filter(Bt=>Bt.path!==it.path)),pt(dt=>dt.filter(Bt=>Bt.path!==it.path)),I.has(it.path)&&b?.(it.path)}catch(dt){const Bt=dt instanceof Error?dt.message:String(dt);window.alert(Z("fileTree.deleteFileFailed",{message:Bt}))}finally{It(null)}}},[ht,b,I,Z]);T.useEffect(()=>{if(!e||!He)return;if(Ue){De(!1);return}if(Ht.getState().directoryCache.has(e)){De(!1);return}let it=!1;const dt=new AbortController;return De(!0),ae(null),Ep(e,dt.signal,Ie,"load_file_tree_root",`file-tree-root:${e}`,et).then(Bt=>{if(it)return;const Et=Cp(Bt.entries);Te(!!Bt.truncated),Ee(e,Et)}).catch(Bt=>{it||Tp(Bt)||ae(Bt instanceof Error?Bt.message:"Failed to load directory")}).finally(()=>{it||De(!1)}),()=>{it=!0,dt.abort(),Of(`file-tree-root:${e}`)}},[Ue,he,e,et,Ee,Ie,He]),T.useEffect(()=>{if(!Ke||!Ue){Ge(!1),ve(null),Xe([]),pt([]),z(null);return}let it=!1;const dt=new AbortController,Bt=new Set;Ge(!0),ve(null),Xe([]),pt([]),ye(bt?lB:m5),z({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const Et=`file-search:${Ke}:${++ge.current}`;return U7(Ke,N.trim(),Vt=>{if(!it){if(Vt.engine&&z(te=>({truncated:te?.truncated??!1,total:te?.total??0,engine:Vt.engine,limited:Vt.limited??te?.limited??!1,done:te?.done??!1})),Vt.entries?.length){const te=Vt.entries.filter(Qe=>Bt.has(Qe.path)?!1:(Bt.add(Qe.path),!0));te.length>0&&(Xe(Qe=>[...Qe,...Cp(te)]),z(Qe=>Qe?{...Qe,total:Bt.size}:{truncated:!1,total:Bt.size,engine:"rg",limited:!1,done:!1}))}if(Vt.contentEntries?.length){const te=Vt.contentEntries.filter(Qe=>Bt.has(Qe.path)?!1:(Bt.add(Qe.path),!0));te.length>0&&(pt(Qe=>[...Qe,...te]),z(Qe=>Qe?{...Qe,total:Bt.size}:{truncated:!1,total:Bt.size,engine:"rg",limited:!1,done:!1}))}Vt.done&&z(te=>({truncated:!!Vt.truncated,total:typeof Vt.total=="number"?Vt.total:Bt.size,engine:Vt.engine??te?.engine??"rg",limited:!!Vt.limited,done:!0}))}},dt.signal,Ie,P,Et,{excludePatterns:Mt,caseSensitive:D.caseSensitive,wholeWord:D.wholeWord,regex:D.regex}).catch(Vt=>{it||Tp(Vt)||(ve(Vt instanceof Error?Vt.message:"Failed to search files"),Xe([]),pt([]),z(null))}).finally(()=>{it||Ge(!1)}),()=>{it=!0,dt.abort(),Of(Et)}},[Ke,We,bt,N,Ue,P,D.caseSensitive,D.regex,D.wholeWord,Ie]),T.useEffect(()=>{if(!Ue)return;const it=Se.current;if(!it)return;const dt=bt?Ve.length:K.length,Bt=bt?b5:g5,Et=new IntersectionObserver(Vt=>{Vt.some(te=>te.isIntersecting)&&ye(te=>Math.min(te+Bt,dt))},{rootMargin:"160px 0px"});return Et.observe(it),()=>Et.disconnect()},[Ue,K.length,Ve.length,bt]);const ir=T.useMemo(()=>{if(!he)return;if(!Ue)return r?he.filter(dt=>dt.type==="directory"):he;const it=Ht.getState().directoryCache;return he.filter(dt=>(!r||dt.type==="directory")&&w1(dt,Ue,it))},[r,Ue,he]);if(!e)return a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:Z("fileTree.noWorkingDir")});if(fe||!He)return a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(un,{size:20,className:"animate-spin text-muted-foreground"})});if(Ue&&bt){const it=Ce?.total??Ve.length,dt=Ve.slice(0,q),Bt=q<Ve.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(y5,{count:it,loading:we,engine:Ce?.engine,limited:Ce?.limited,scope:Ke,content:!0}),ie?a.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:[Z("fileTree.contentSearchNeedsRipgrep"),a.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:ie})]}):we&&Ve.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(un,{size:20,className:"animate-spin text-muted-foreground"})}):Ve.length===0?a.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:Z("fileTree.noContentMatches")}):a.jsxs(a.Fragment,{children:[Ce?.limited&&a.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:Z("fileTree.searchTruncatedHint",{count:Ce.total})}),dt.map(Et=>a.jsx(dB,{entry:Et,rootPath:Ke,selectedFilePath:k,query:N.trim(),onContentMatchSelect:V,onPathReference:s,getReferenceText:i,onReferenceCopied:u,insertedReferenceKey:c,copiedReferenceKey:h},Et.path)),a.jsx("div",{ref:Se,className:"py-2 text-center text-[11px] text-muted-foreground",children:Bt?a.jsx("button",{type:"button",onClick:()=>ye(Et=>Math.min(Et+b5,Ve.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:Z("fileTree.loadMoreSearchResults",{shown:dt.length,total:Ve.length})}):we?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(un,{size:10,className:"animate-spin"}),Z("fileTree.searchStillRunning")]}):dt.length>0?a.jsx("span",{children:Z("fileTree.showingSearchResults",{shown:dt.length,total:it})}):null})]})]})}if(Ue){const it=Ce?.total??K.length,dt=K.slice(0,q),Bt=q<K.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(y5,{count:it,loading:we,engine:Ce?.engine,limited:Ce?.limited,scope:Ke,content:!1}),we&&K.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(un,{size:20,className:"animate-spin text-muted-foreground"})}):ie?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:ie}):K.length===0?a.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:Z("fileTree.noMatchingFiles")}):a.jsxs(a.Fragment,{children:[Ce?.limited&&a.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:Z("fileTree.searchTruncatedHint",{count:Ce.total})}),dt.map(Et=>a.jsx(aB,{node:Et,rootPath:Ke,onFileSelect:t,onPathReference:s,getReferenceText:i,onReferenceCopied:u,onDirectoryRoot:p,onSearchFromDirectory:m,onDirectoryPinToggle:x,onFilePinToggle:b,pinnedPaths:I,selectedFilePath:k,insertedReferenceKey:c,copiedReferenceKey:h,onFileDeleteRequest:vt,deletingFilePath:ht},Et.path)),a.jsx("div",{ref:Se,className:"py-2 text-center text-[11px] text-muted-foreground",children:Bt?a.jsx("button",{type:"button",onClick:()=>ye(Et=>Math.min(Et+g5,K.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:Z("fileTree.loadMoreSearchResults",{shown:dt.length,total:K.length})}):we?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(un,{size:10,className:"animate-spin"}),Z("fileTree.searchStillRunning")]}):dt.length>0?a.jsx("span",{children:Z("fileTree.showingSearchResults",{shown:dt.length,total:it})}):null})]})]})}return pe?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:pe}):!he||he.length===0?a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:Z("fileTree.emptyDir")}):!ir||ir.length===0?a.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:Z("fileTree.noMatchingFiles")}):a.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[ce&&a.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:Z("fileTree.truncatedHint")}),ir.map(it=>a.jsx(oB,{node:it,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:s,getReferenceText:i,onReferenceCopied:u,onDirectoryRoot:p,onSearchFromDirectory:m,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:w,pinnedPaths:I,selectedFilePath:k,queryLower:Ue,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryDropFiles:F,onFileDeleteRequest:vt,deletingFilePath:ht,revealedDirectoryPath:Y?.path},it.path))]})}function _p(e){return e.trim().replace(/\/+$/,"")||"/"}function fB(e){const t=_p(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function K6({open:e,initialPath:t,title:r,labels:s,onCancel:i,onConfirm:u}){const{t:c}=an(),h={hint:s?.hint??c("sidebar.directoryPickerHint"),cancel:s?.cancel??c("common.cancel"),confirm:s?.confirm??c("sidebar.useThisFolder"),close:s?.close??c("common.close"),parent:s?.parent??c("rightSidebar.parentFolder")},[p,m]=T.useState(()=>_p(t));return T.useEffect(()=>{e&&m(_p(t))},[t,e]),T.useEffect(()=>{if(!e)return;const x=document.body.style.overflow,b=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),i())};return document.body.style.overflow="hidden",document.addEventListener("keydown",b,!0),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",b,!0)}},[i,e]),e?Ya.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:i,"aria-label":h.cancel}),a.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:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:a.jsx(j8,{size:15})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:r}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:h.hint})]}),a.jsx("button",{type:"button",autoFocus:!0,onClick:i,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:a.jsx(vs,{size:15})})]}),a.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:p==="/",onClick:()=>m(fB(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:a.jsx(K5,{size:14})}),a.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:p,children:p})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:a.jsx(hB,{rootPath:p,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:m,selectedFilePath:t||null})}),a.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:[a.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:h.cancel}),a.jsxs("button",{type:"button",onClick:()=>u(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:[a.jsx(la,{size:13}),h.confirm]})]})]})]}),document.body):null}const Lp="termdock:new-session-commands:v1",vl="__saved_command__:";function Xu(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(vl)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function Ec(){try{const e=JSON.parse(localStorage.getItem(Lp)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function pB({directories:e,tmuxAvailable:t,options:r,agents:s,selectedAgent:i,detecting:u,resumeHistory:c,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:m,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:v,onResumeHistory:w,onRemoveResumeHistory:I,onClose:k,onOptionsChange:N}){const{t:R,locale:D}=an(),[P,V]=T.useState(i),[F,Y]=T.useState(!1),[Z,he]=T.useState(!1),[Ee,Ie]=T.useState(Ec),[be,et]=T.useState(()=>Xu(Ec())),[Pe,fe]=T.useState(null),[De,pe]=T.useState("idle"),ae=Z?"__custom__":P?.slug??"__terminal__",ce=P?.command??"",Te=Z?Ee.__custom__??Ee.__terminal__??"":P?Ee[ae]??ce:"",we=()=>{const Ce=Te.trim()||ce;if(!(Z&&!Ce))try{const z={...Ec(),[ae]:Ce};if(Z){for(const q of Xu(Ec()))z[vl+q]=q;z[vl+Ce]=Ce}localStorage.setItem(Lp,JSON.stringify(z)),et(Xu(z)),Z&&fe(Ce),pe("saved")}catch{pe("error")}},Ge=()=>{if(Pe)try{const Ce=Ec();for(const[z,q]of Object.entries(Ce))(z.startsWith(vl)||z==="__custom__"||z==="__terminal__")&&q.trim()===Pe&&delete Ce[z];localStorage.setItem(Lp,JSON.stringify(Ce)),et(Xu(Ce)),Ie(z=>({...z,__custom__:""})),fe(null),pe("idle")}catch{pe("error")}},ie=()=>{const Ce=Te.trim()||ce;Z&&!Ce||(we(),v(P,Ce))},ve=T.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),ft=Z?Pe??R("sidebar.customStartupCommand"):P?.displayName??"Terminal",Rt=i?.displayName??"Terminal",He=!Z&&(P===null?i===null:i?.slug===P.slug);T.useEffect(()=>{const Ce=z=>{z.key==="Escape"&&(F||k())};return document.addEventListener("keydown",Ce),()=>document.removeEventListener("keydown",Ce)},[F,k]);const K=Ce=>{N({...r,cwd:Ce}),Y(!1)},Xe=Ce=>new Intl.DateTimeFormat(D==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(Ce));return a.jsxs("section",{className:"relative z-20 flex max-h-[min(56svh,36rem)] shrink-0 flex-col overflow-hidden border-t border-border bg-[var(--chrome-bg)] animate-slide-down","aria-label":R("sidebar.newSessionComposerTitle"),children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:a.jsx($o,{size:14})}),a.jsx("div",{className:"min-w-0",children:a.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:R("sidebar.newSessionComposerTitle")})})]}),a.jsx("button",{type:"button",onClick:k,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":R("common.close"),children:a.jsx(vs,{size:14})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-1",children:[a.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[a.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:R("sidebar.sessionMode")}),a.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(Ce=>a.jsx("button",{type:"button",disabled:Ce==="tmux"&&!t,onClick:()=>N({...r,mode:Ce}),"aria-pressed":r.mode===Ce,title:Ce==="tmux"?R(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===Ce?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:R(Ce==="shell"?"sidebar.newShell":"sidebar.newTmux")},Ce))})]}),a.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:R("sidebar.startupCommand")}),a.jsx("button",{type:"button",onClick:x,disabled:u,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:R("sidebar.detectAgents"),"aria-label":R("sidebar.detectAgents"),children:a.jsx(hs,{size:12,className:u?"animate-spin":""})})]}),a.jsxs("label",{className:"relative flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-transparent bg-surface px-3 text-foreground transition hover:bg-surface-2 focus-within:border-primary",children:[P?a.jsx(Kl,{agent:P,size:16}):a.jsx($o,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:ft}),He&&a.jsx("span",{className:"shrink-0 text-[9.5px] text-muted-foreground",children:R("sidebar.defaultAgent")}),u?a.jsx(un,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}):a.jsx(wl,{size:13,className:"shrink-0 text-muted-foreground"}),a.jsxs("select",{"aria-label":R("sidebar.startupCommand"),value:Z?Pe?vl+Pe:"__custom__":P?.slug??"__terminal__",onChange:Ce=>{const z=Ce.target.value;pe("idle");const q=z.startsWith(vl)?z.slice(vl.length):null;fe(q),he(z==="__custom__"||q!==null),(q!==null||z==="__custom__")&&Ie(ye=>({...ye,__custom__:q??""})),V(s.find(ye=>ye.slug===z)??null)},className:"absolute inset-0 h-full w-full cursor-pointer opacity-0",children:[a.jsx("option",{value:"__terminal__",children:"Terminal"}),a.jsx("option",{value:"__custom__",children:R("sidebar.addStartupCommand")}),be.map(Ce=>a.jsx("option",{value:vl+Ce,children:Ce},Ce)),s.map(Ce=>a.jsx("option",{value:Ce.slug,children:Ce.displayName},Ce.slug))]})]}),!He&&!Z&&a.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[a.jsx("span",{className:"truncate text-muted-foreground",children:R("sidebar.currentDefaultAgent",{name:Rt})}),a.jsx("button",{type:"button",onClick:()=>b(P),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:R("sidebar.makeDefault")})]}),De==="error"&&a.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:R("sidebar.saveStartupCommandFailed")}),(P||Z)&&a.jsxs("details",{open:Z&&!Pe||void 0,className:"group/command mt-0.5",children:[a.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:[R(Z&&!Pe?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),a.jsx(wl,{size:11,className:"transition-transform group-open/command:rotate-180"})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("label",{htmlFor:"new-session-command",className:"sr-only",children:R("sidebar.startupCommand")}),P&&Te!==ce&&a.jsx("button",{type:"button",onClick:()=>{Ie(Ce=>({...Ce,[ae]:ce})),pe("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:R("sidebar.resetStartupCommand")})]}),a.jsx("input",{id:"new-session-command",value:Te,onChange:Ce=>{Ie(z=>({...z,[ae]:Ce.target.value})),pe("idle")},placeholder:ce||R("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]"}),a.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2","aria-live":"polite",children:[Z&&Pe&&a.jsxs("button",{type:"button",onClick:Ge,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":R("sidebar.deleteStartupCommand"),children:[a.jsx(Ji,{size:11}),R("sidebar.deleteStartupCommand")]}),a.jsx("button",{type:"button",onClick:we,disabled:De==="saved"||Z&&!Te.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:R(De==="saved"?"sidebar.startupCommandSaved":"sidebar.saveStartupCommand")})]}),a.jsx("p",{className:"mb-2 mt-1.5 px-0.5 text-[10px] leading-relaxed text-muted-foreground",children:R(P?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},Pe??ae),a.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:R("sidebar.workingDirectory")}),a.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>Y(!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:[a.jsx(O0,{size:12,className:"shrink-0 text-muted-foreground"}),a.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||R("sidebar.directoryPlaceholder")})]}),ve.length>0&&a.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":R("sidebar.recentDirectories"),children:ve.map(Ce=>a.jsx("button",{type:"button",onClick:()=>K(Ce),title:Ce,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:Ea(Ce)||Ce},Ce))}),(c.length>0||m)&&a.jsxs("details",{className:"mt-1",children:[a.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:[a.jsx(k0,{size:11}),a.jsx("span",{className:"flex-1",children:R("sidebar.resumeHistory")}),h&&a.jsx(un,{size:10,className:"animate-spin"}),c.length>0&&a.jsx("span",{className:"normal-case tracking-normal",children:R("sidebar.resumeHistoryCount",{n:c.length})}),a.jsx(wl,{size:11})]}),c.length>0&&a.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:c.slice(0,6).map(Ce=>{const z=p===Ce.id;return a.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>w(Ce),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":R("sidebar.resumeHistoryAction",{title:Ce.title}),children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:z?a.jsx(un,{size:13,className:"animate-spin"}):a.jsx(Kl,{agent:Ce.agent,size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:Ce.title}),a.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[Ce.agent.displayName," · ",Xe(Ce.closedAt)]})]}),a.jsx(rx,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>I(Ce.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":R("sidebar.resumeHistoryRemove",{title:Ce.title}),children:[a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),a.jsx(Ji,{size:12})]})]},Ce.id)})}),m&&a.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:m})]})]}),a.jsx("div",{className:"shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-2",children:a.jsxs("button",{type:"button",onClick:ie,disabled:Z&&!Te.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":R("sidebar.launchSessionWith",{name:ft}),children:[P?a.jsx(Kl,{agent:P,size:15}):a.jsx($o,{size:14}),a.jsx("span",{className:"truncate",children:R("sidebar.launchSessionWith",{name:ft})})]})}),a.jsx(K6,{open:F,initialPath:r.cwd?.trim()||ve[0]||"/",title:R("sidebar.chooseDirectory"),onCancel:()=>Y(!1),onConfirm:K})]})}const X6="termdock:new-session-agent:v1";function mB(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(X6)||"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 Rf(e){if(!(typeof window>"u"))try{window.localStorage.setItem(X6,JSON.stringify(e))}catch{}}function gB(e,t){return e?t.find(r=>r.slug===e)??null:null}function xB(){const[e,t]=T.useState(mB),[r,s]=T.useState([]),[i,u]=T.useState(!0),c=T.useCallback(async()=>{u(!0);try{const[p,m]=await Promise.all([Rp(),z5()]),x=gB(p.newSessionAgentSlug,m);s(m),t(x),Rf(x)}finally{u(!1)}},[]);T.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=T.useCallback(async p=>{const m=e;t(p),Rf(p);try{await ia({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(m),Rf(m),x}},[e]);return{preference:e,agents:r,detecting:i,refresh:c,selectAgent:h}}function bB(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}const ti="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",zr="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 yB({activeSessionId:e,initialCollaborationGroupId:t=null,defaultSessionMode:r="shell",onClose:s,onNewSession:i}){const[u,c]=T.useState(!1),[h,p]=T.useState({x:16,y:80}),m=T.useRef(null),[x,b]=T.useState(null),v=T.useRef(null),w=T.useCallback((z,q)=>{const ye=m.current?.getBoundingClientRect(),Ve=window.visualViewport,pt=(Ve?.offsetLeft??0)+12,ht=(Ve?.offsetTop??0)+12;return{x:Math.max(pt,Math.min(z,pt+(Ve?.width??window.innerWidth)-(ye?.width??440)-24)),y:Math.max(ht,Math.min(q,ht+(Ve?.height??window.innerHeight)-(ye?.height??340)-24))}},[]);T.useEffect(()=>{if(!u)return;const z=()=>{b(window.visualViewport?.height??window.innerHeight),p(ye=>w(ye.x,ye.y))},q=new ResizeObserver(z);return m.current&&q.observe(m.current),window.addEventListener("resize",z),window.visualViewport?.addEventListener("resize",z),z(),()=>{q.disconnect(),window.removeEventListener("resize",z),window.visualViewport?.removeEventListener("resize",z)}},[u,w]);const[I,k]=T.useState(t?"collaboration":"automation"),[N,R]=T.useState([]),[D,P]=T.useState([]),[V,F]=T.useState([]),[Y,Z]=T.useState([]),[he,Ee]=T.useState([]),[Ie,be]=T.useState(null),[et,Pe]=T.useState(null),[fe,De]=T.useState(null),[pe,ae]=T.useState("loading"),[ce,Te]=T.useState(null),[we,Ge]=T.useState(),[ie,ve]=T.useState(null),ft=T.useRef(null),Rt=T.useRef(null),He=T.useRef(null),K=t?Y.find(z=>z.id===t)??null:null,Xe=T.useCallback(z=>{Z(z.groups),Ee(z.sessions),Ge(z.peers),Te(null),ae("loaded")},[]);T.useEffect(()=>H5(Xe),[Xe]);const Ce=T.useCallback(async(z={})=>{z.silent||Pe(null),Rt.current||(Rt.current=H7().then(q=>{R(q.automations),P(q.runs)}).catch(q=>{z.silent||Pe(q instanceof Error?q.message:"自动任务加载失败")}).finally(()=>{Rt.current=null})),He.current||(He.current=z5().then(q=>{F(q),ve(null)}).catch(()=>{ve("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{He.current=null})),ft.current||(ae(q=>q==="error"?"loading":q),ft.current=W5().then(Xe).catch(q=>{ae("error"),Te(`协作会话加载失败:${q instanceof Error?q.message:"请重试"}`)}).finally(()=>{ft.current=null})),await ft.current},[Xe]);return T.useEffect(()=>{Ce();const z=window.setInterval(()=>{Ce({silent:!0})},1e4);return()=>window.clearInterval(z)},[Ce]),T.useEffect(()=>{const z=q=>{q.key==="Escape"&&!u&&s()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[s,u]),Ya.createPortal(a.jsxs(a.Fragment,{children:[!u&&a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:s,"aria-label":"关闭 Agent 工作台"}),a.jsxs("section",{ref:m,"aria-label":u?"工作组消息浮窗":"Agent 工作台",style:u?{left:h.x,top:h.y,maxHeight:x?x-24:"calc(100dvh - 24px)"}:void 0,className:u?"fixed z-menu-panel flex w-[min(440px,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,env(safe-area-inset-top,0px))] bottom-[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-[8%] sm:bottom-auto sm:max-h-[84vh]",children:[a.jsxs("header",{className:`flex items-center gap-2 border-b border-border/15 px-4 py-3 ${u?"cursor-move touch-none select-none":""}`,onPointerDown:z=>{!u||z.button!==0||z.target.closest("button")||(v.current={x:z.clientX,y:z.clientY,left:h.x,top:h.y},z.currentTarget.setPointerCapture?.(z.pointerId))},onPointerMove:z=>{v.current&&p(w(v.current.left+z.clientX-v.current.x,v.current.top+z.clientY-v.current.y))},onPointerUp:()=>{v.current=null},onPointerCancel:()=>{v.current=null},children:[a.jsx(Hd,{size:17,className:"text-primary"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:K?`${K.name} · 协作消息`:"Agent 工作台"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:u?"引用、文件路径和粘贴优先加入此处":K?"发送任务、问题或工作交接":"自动任务、会话协作与全文恢复"})]}),I==="collaboration"&&Y.length>0&&a.jsx("button",{className:`${zr} shrink-0 text-primary hover:bg-primary/10`,onClick:()=>c(z=>!z),children:u?"完整面板":"常驻浮窗"}),a.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:s,"aria-label":"关闭",children:a.jsx(vs,{size:16})})]}),!u&&a.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",Wc,"自动任务"],["collaboration",F0,"会话协作"],["search",xd,"全文搜索"]].map(([z,q,ye])=>a.jsxs("button",{onClick:()=>k(z),className:`${zr} ${I===z?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(q,{size:14}),ye]},z))}),ce&&a.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[ce,a.jsx("button",{className:`${zr} ml-2`,onClick:()=>{Ce()},children:"重新加载会话"})]}),I==="collaboration"&&we&&["loading","partial","error","unsupported"].includes(we.state)&&a.jsxs("div",{role:"status",className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:[we.state==="loading"?"正在加载其他服务的会话;当前服务内可先组队。":we.state==="unsupported"?"当前客户端不支持跨服务会话,请更新客户端;当前服务内可继续组队。":we.state==="partial"?"部分服务的协作会话暂不可用;已有成员会保留,恢复后继续同步。":"其他服务的会话暂时加载失败;当前服务内仍可组队。",we.error&&a.jsx("span",{className:"mt-1 block break-words text-[10px]",children:we.error}),we.services?.filter(z=>!z.connected&&z.error).map(z=>a.jsxs("span",{className:"mt-1 block break-words text-[10px]",children:[z.label,":",z.error]},z.origin)),["partial","error"].includes(we.state)&&a.jsx("button",{className:`${zr} ml-2`,onClick:W7,children:"重试跨服务连接"})]}),ie&&a.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:ie}),et&&a.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:et}),fe&&a.jsxs("div",{className:"mx-4 mt-3 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[a.jsx(la,{size:13}),fe]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[I==="automation"&&a.jsx(vB,{automations:N,runs:D,agents:V,sessions:he,activeSessionId:e,busy:Ie,setBusy:be,setError:Pe,setNotice:De,refresh:Ce,onClose:s}),I==="collaboration"&&a.jsx(AB,{floating:u,sessionsState:pe,groups:Y,sessions:he,agents:V,activeSessionId:e,initialGroupId:t,defaultSessionMode:r,busy:Ie,setBusy:be,setError:Pe,setNotice:De,refresh:Ce}),I==="search"&&a.jsx(IB,{onClose:s,onNewSession:i,setError:Pe})]})]})]}),document.body)}function vB({automations:e,runs:t,agents:r,sessions:s,activeSessionId:i,busy:u,setBusy:c,setError:h,setNotice:p,refresh:m,onClose:x}){const[b,v]=T.useState(null),[w,I]=T.useState(!1),[k,N]=T.useState(null),R=async(D,P,V)=>{c(D),h(null),p(null);try{await P(),await m(),p(V)}catch(F){h(F instanceof Error?F.message:"操作失败")}finally{c(null)}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),a.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"按计划把任务交给 Agent。每次运行都有独立会话和结果入口。"})]}),!w&&e.length>0&&a.jsxs("button",{className:`${zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{v(null),I(!0),p(null)},children:[a.jsx(Xi,{size:13}),"新建任务"]})]}),w&&a.jsx(wB,{agents:r,sessions:s,activeSessionId:i,initial:b,onCancel:()=>{v(null),I(!1)},onSaved:async D=>{v(null),I(!1),await m(),p(b?`“${D}”已更新`:`“${D}”已创建,将按计划自动运行`)},setError:h}),e.length===0&&!w&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx(u8,{size:24,className:"mx-auto text-primary"}),a.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),a.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"选择运行会话、写清任务内容,再设定时间。创建后可以先手动运行一次确认效果。"}),a.jsxs("button",{className:`${zr} mt-4 bg-primary text-primary-foreground`,onClick:()=>I(!0),children:[a.jsx(Xi,{size:13}),"创建第一个任务"]})]}),a.jsx("div",{className:"space-y-2",children:e.map(D=>{const P=t.find(F=>F.automationId===D.id),V=r.find(F=>F.command===D.command);return a.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:D.name}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${D.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:D.enabled?"已启用":"已停用"}),D.lastRunStatus&&a.jsx("span",{className:`text-[10px] ${NB(D.lastRunStatus)}`,children:MB(D.lastRunStatus)})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Wc,{size:11}),EB(D)]}),a.jsx("span",{children:D.enabled&&D.nextRunAt?`下次 ${$d(D.nextRunAt)}`:"不会自动运行"})]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:D.targetSessionId?`发送到 ${s.find(F=>F.sessionId===D.targetSessionId)?.name??"指定会话"}`:`新建 ${V?.displayName??"Agent"} 会话 · ${D.cwd}`}),a.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:D.prompt}),D.lastRunAt&&a.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",$d(D.lastRunAt),D.lastRunMessage?` · ${D.lastRunMessage}`:""]})]}),a.jsx("button",{"aria-label":`编辑 ${D.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{v(D),I(!0),p(null)},children:a.jsx(G5,{size:13})})]}),a.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:k===D.id?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),a.jsx("button",{className:`${zr} bg-surface-elevated text-foreground`,onClick:()=>N(null),children:"取消"}),a.jsxs("button",{disabled:u!==null,className:`${zr} bg-destructive text-destructive-foreground`,onClick:()=>{R(`delete:${D.id}`,()=>G7(D.id),`“${D.name}”已删除`).then(()=>N(null))},children:[u===`delete:${D.id}`?a.jsx(hs,{size:13,className:"animate-spin"}):a.jsx(Ji,{size:13}),"确认删除"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`${zr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>N(D.id),children:[a.jsx(Ji,{size:13}),"删除"]}),a.jsxs("button",{disabled:u!==null,className:`${zr} ${D.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{R(`toggle:${D.id}`,()=>V7(D.id,!D.enabled),D.enabled?`“${D.name}”已暂停,不会自动运行`:`“${D.name}”已恢复,将按原计划运行`)},children:[u===`toggle:${D.id}`?a.jsx(hs,{size:13,className:"animate-spin"}):D.enabled?a.jsx(i9,{size:13}):a.jsx(hm,{size:13}),D.enabled?"暂停":"恢复"]}),P?.frontendSessionId&&a.jsxs("button",{className:`${zr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:P.frontendSessionId})),x()},children:[a.jsx(J5,{size:13}),"打开上次会话"]}),a.jsxs("button",{disabled:u!==null,className:`${zr} bg-primary/15 text-primary`,onClick:()=>{R(`run:${D.id}`,()=>q7(D.id),`“${D.name}”已投递,可打开会话查看进度`)},children:[u===`run:${D.id}`?a.jsx(hs,{size:13,className:"animate-spin"}):a.jsx(hm,{size:13}),"立即运行"]})]})})]},D.id)})})]})}function wB({agents:e,sessions:t,activeSessionId:r,initial:s,onCancel:i,onSaved:u,setError:c}){const[h,p]=T.useState(s?.name??""),m=t.find(K=>K.sessionId===r),x=s?.cwd??m?.cwd??t[0]?.cwd??"",[b,v]=T.useState(x),[w,I]=T.useState(!1),[k,N]=T.useState(()=>e.find(K=>K.command===s?.command)?.slug??""),[R,D]=T.useState(s?.prompt??""),[P,V]=T.useState(s?.targetSessionId??""),[F,Y]=T.useState(s?.targetSessionId?"existing":"new"),[Z,he]=T.useState(s?.schedule.kind??"interval"),[Ee,Ie]=T.useState(s?.schedule.kind==="interval"?s.schedule.everyMinutes:60),[be,et]=T.useState(s?.schedule.kind==="daily"?s.schedule.time:"09:00"),[Pe,fe]=T.useState(s?.schedule.kind==="daily"?s.schedule.weekdays:[1,2,3,4,5]),[De,pe]=T.useState(s?.enabled??!0),[ae,ce]=T.useState(!1),we=(e.find(K=>K.slug===k)??null)?.command??s?.command??"";T.useEffect(()=>{!s&&!k&&e[0]&&N(e[0].slug)},[e,s,k]);const Ge=async()=>{ce(!0),c(null);try{await ev({id:s?.id,name:h,cwd:b,command:F==="new"?we:"",prompt:R,targetSessionId:F==="existing"&&P||null,enabled:De,schedule:Z==="interval"?{kind:Z,everyMinutes:Ee}:{kind:Z,time:be,weekdays:Pe}}),await u(h.trim())}catch(K){c(K instanceof Error?K.message:"保存失败")}finally{ce(!1)}},ie=Z==="interval"?{kind:Z,everyMinutes:Ee}:{kind:Z,time:be,weekdays:Pe},[ve,ft]=be.split(":"),Rt=(K,Xe)=>et(`${K}:${Xe}`),He=!!(h.trim()&&R.trim()&&(F==="existing"?P:we)&&(Z==="interval"?Ee>=1:Pe.length>0));return a.jsxs("div",{className:"overflow-hidden rounded-xl border border-primary/25 bg-primary/5",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-primary/15 px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[13px] font-medium text-foreground",children:s?"编辑自动任务":"创建自动任务"}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"三步完成,保存后可立即试跑"})]}),a.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:i,"aria-label":"关闭任务表单",children:a.jsx(vs,{size:14})})]}),a.jsxs("div",{className:"space-y-5 p-4",children:[a.jsxs("fieldset",{className:"space-y-3",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"1"}),"要做什么"]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称",a.jsx("input",{autoFocus:!0,className:ti,value:h,onChange:K=>p(K.target.value),placeholder:"例如:每日代码巡检"})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",a.jsx("textarea",{className:`${ti} min-h-24 resize-y`,value:R,onChange:K=>D(K.target.value),placeholder:"说明目标、检查范围和期望产出,例如:检查当前分支的测试与待办,修复可安全处理的问题并总结结果。"})]})]}),a.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"2"}),"在哪里运行"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{type:"button","aria-pressed":F==="new",className:`${zr} justify-start border px-3 text-left ${F==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>Y("new"),children:"每次新建会话"}),a.jsx("button",{type:"button","aria-pressed":F==="existing",disabled:t.length===0,className:`${zr} justify-start border px-3 text-left ${F==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{Y("existing"),P||V(r??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),F==="new"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",a.jsxs("select",{className:ti,value:k,onChange:K=>N(K.target.value),children:[s&&!e.some(K=>K.command===s.command)&&a.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(K=>a.jsxs("option",{value:K.slug,children:[K.displayName,K.isPlugin?" · Plugin":""]},K.slug))]})]}),a.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["工作目录",a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:ti,value:b,onChange:K=>v(K.target.value),placeholder:"默认使用当前目录"}),a.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${zr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>I(!0),children:[a.jsx(D0,{size:13}),"选择"]})]})]})]}),e.length===0&&a.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",a.jsx("select",{className:ti,value:P,onChange:K=>V(K.target.value),children:t.map(K=>a.jsxs("option",{value:K.sessionId,children:[K.name," · ",K.status]},K.sessionId))}),a.jsx("span",{className:"block leading-relaxed",children:"运行时该会话需要在线,并且 Agent 处于可接收任务的状态。"})]})]}),a.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"3"}),"什么时候运行"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{type:"button","aria-pressed":Z==="interval",className:`${zr} border ${Z==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>he("interval"),children:"固定间隔"}),a.jsx("button",{type:"button","aria-pressed":Z==="daily",className:`${zr} border ${Z==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>he("daily"),children:"指定日期与时间"})]}),Z==="interval"?a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",a.jsx("input",{className:ti,type:"number",min:1,max:43200,value:Ee,onChange:K=>Ie(Number(K.target.value))}),a.jsx("span",{className:"block",children:"例如 60 = 每小时,1440 = 每天。始终按任务创建时间计算,之后编辑不会重置节奏。"})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行时间"}),a.jsxs("div",{className:"mt-1 flex items-center rounded-xl border border-border/20 bg-surface-2 px-3 py-2.5 focus-within:border-primary/60",children:[a.jsx(Wc,{size:15,className:"mr-3 shrink-0 text-primary"}),a.jsx(v5,{label:"小时",value:ve,options:24,onChange:K=>Rt(K,ft)}),a.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),a.jsx(v5,{label:"分钟",value:ft,options:60,onChange:K=>Rt(ve,K)}),a.jsx("span",{className:"ml-3 shrink-0 rounded-md bg-surface-elevated px-2 py-1 text-[9px] font-medium text-muted-foreground",children:"24 小时制"})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行日期"}),a.jsx("div",{className:"mt-1 grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((K,Xe)=>{const Ce=Pe.includes(Xe);return a.jsx("button",{type:"button","aria-pressed":Ce,"aria-label":`星期${K}`,className:`rounded-lg py-2.5 text-[10px] transition ${Ce?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>fe(z=>Ce?z.filter(q=>q!==Xe):[...z,Xe].sort()),children:K},Xe)})}),Pe.length===0&&a.jsx("p",{className:"mt-1 text-[10px] text-destructive",children:"至少选择一天"})]})]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3 border-t border-primary/15 bg-surface/50 px-4 py-3 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:De,onChange:K=>pe(K.target.checked)}),"保存后启用"]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:De&&He?`${s?"下次运行":"首次运行"}:${$d(RB(ie,Date.now(),s?.createdAt))}`:De?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{className:`${zr} bg-surface-2 text-foreground`,onClick:i,children:"取消"}),a.jsx("button",{disabled:ae||!He,className:`${zr} bg-primary text-primary-foreground`,onClick:()=>{Ge()},children:ae?"保存中…":s?"保存修改":"创建任务"})]})]}),a.jsx(K6,{open:w,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>I(!1),onConfirm:K=>{v(K),I(!1)}})]})}function v5({label:e,value:t,options:r,onChange:s}){return a.jsxs("label",{className:"relative min-w-0 flex-1",children:[a.jsx("span",{className:"sr-only",children:e}),a.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:i=>s(i.target.value),children:Array.from({length:r},(i,u)=>{const c=String(u).padStart(2,"0");return a.jsx("option",{value:c,children:c},c)})}),a.jsx(wl,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function AB({floating:e,sessionsState:t,groups:r,sessions:s,agents:i,activeSessionId:u,initialGroupId:c,defaultSessionMode:h,busy:p,setBusy:m,setError:x,setNotice:b,refresh:v}){const[w,I]=T.useState(""),[k,N]=T.useState(()=>new Set(u?[u]:[])),[R,D]=T.useState(c??r[0]?.id??null),[P,V]=T.useState(""),[F,Y]=T.useState(!1),[Z,he]=T.useState([]),[Ee,Ie]=T.useState(!1),[be,et]=T.useState("all"),[Pe,fe]=T.useState(!0),[De,pe]=T.useState(new Set),[ae,ce]=T.useState("*"),[Te,we]=T.useState("message"),[Ge,ie]=T.useState(""),[ve,ft]=T.useState(!1),[Rt,He]=T.useState(new Set),[K,Xe]=T.useState(),[Ce,z]=T.useState({}),[q,ye]=T.useState(!1),[Ve,pt]=T.useState(""),[ht,It]=T.useState(""),[Se,ge]=T.useState(""),[Ue,bt]=T.useState(""),Ke=T.useRef(null),Mt=T.useRef(!1),We=R==="new"?null:r.find(le=>le.id===R)??r[0]??null,[vt,ir]=T.useState(0),it=T.useRef(new Map),dt=T.useRef(We?.id),Bt=T.useRef(Ge);Bt.current=Ge,T.useEffect(()=>{if(dt.current===We?.id)return;dt.current&&it.current.set(dt.current,{content:Bt.current,target:ae,kind:Te}),dt.current=We?.id;const le=it.current.get(We?.id??"");ie(le?.content??""),ce(le?.target??"*"),we(le?.kind??"message")},[We?.id]),T.useEffect(()=>{if(!(!e||!We))return Z7(le=>{ie(st=>st+(st&&!/\s$/.test(st)?`
129
- `:"")+le.replace(/\r\n?/g,`
130
- `))})},[e,We?.id]),T.useEffect(()=>{const le=Ke.current;if(!e||!le)return;const st=Ut=>x(String(Ut.detail));return le.addEventListener("termdock:file-drop-error",st),()=>le.removeEventListener("termdock:file-drop-error",st)},[e,We?.id,x]);const Et=async le=>{const st=We?.id;x(null),ir(Ut=>Ut+1);try{const Ut=await kp("/tmp",le);if(Ut.files.length!==le.length||Ut.files.some(Zt=>!Zt.path))throw new Error("文件路径准备失败,请重试");const lr=Ut.files.map(Zt=>rd(Zt.path)).join(" ")+" ";if(dt.current===st)ie(Zt=>Zt+(Zt&&!/\s$/.test(Zt)?`
131
- `:"")+lr);else if(st){const Zt=it.current.get(st)??{content:"",target:"*",kind:"message"};it.current.set(st,{...Zt,content:Zt.content+`
132
- `+lr})}}catch(Ut){x(Ut instanceof Error?Ut.message:"文件上传失败")}finally{ir(Ut=>Ut-1)}},Vt=new Set(s.filter(Mf).map(le=>le.sessionId)),te=k.size,Qe=[...k].filter(le=>!Vt.has(le)),qe=TB(We,s),kt=P.trim().toLocaleLowerCase(),Oe=s.filter(le=>!kt||[le.name,le.serviceLabel??"",le.cwd,Bf(le.currentTask)].some(st=>st.toLocaleLowerCase().includes(kt)));T.useEffect(()=>{!R&&r[0]&&D(r[0].id)},[r,R]),T.useEffect(()=>{ft(!1),ye(!1);try{pe(new Set(JSON.parse(localStorage.getItem(`collab-seen:${We?.id}`)??"[]")))}catch{pe(new Set)}He(new Set(We?.sessionIds??[]))},[We?.id]),T.useEffect(()=>{!Ve&&i[0]&&pt(i[0].slug)},[i,Ve]),T.useEffect(()=>{if(he([]),!We){Ie(!1);return}Ie(!0);let le=!1,st=0;const Ut=()=>{const Zt=++st;om(We.id).then(Qt=>{!le&&Zt===st&&he(Qt.messages)}).catch(Qt=>{!le&&Zt===st&&x(Qt instanceof Error?Qt.message:"消息加载失败")}).finally(()=>{!le&&Zt===st&&Ie(!1)})};Ut();const lr=window.setInterval(Ut,3e3);return()=>{le=!0,window.clearInterval(lr)}},[We?.id,x]),T.useEffect(()=>{!c||We?.id!==c||Mt.current||(Mt.current=!0,Ke.current?.scrollIntoView?.({block:"nearest"}))},[c,We?.id]);const Nt=async()=>{m("create-group"),x(null),b(null);try{if(Qe.length)throw new Error("所选会话已变化,请先清除不可用选择");const le=await Fc({name:w,sessionIds:[...k]});I(""),V(""),D(le.group.id),await v(),b(`“${le.group.name}”已创建,${le.group.sessionIds.length} 个会话可以开始协作`)}catch(le){x(le instanceof Error?le.message:"创建失败")}finally{m(null)}},hr=async()=>{if(!We||p||vt||!Ge.trim())return;const le=Ge,st=We.id;m("send-message"),x(null),b(null);try{const Ut=await J7(We.id,{fromSessionId:null,toSessionIds:ae==="*"?void 0:[ae],kind:Te,content:Ge});if(dt.current===st)ie(re=>re===le?"":re.startsWith(le)?re.slice(le.length).replace(/^\n/,""):re);else{const re=it.current.get(st);re&&it.current.set(st,{...re,content:re.content===le?"":re.content.startsWith(le)?re.content.slice(le.length).replace(/^\n/,""):re.content})}const lr=await om(st).catch(()=>null);lr&&dt.current===st&&he(lr.messages);const Zt=Ut.deliveries?.filter(re=>re.serviceUnavailable).length??0,Qt=Ut.deliveries?.filter(re=>re.pending>0).length??0;b(Zt>0?`已保存消息;${Zt} 个接收成员的服务不可达,尚未送达,等待重连`:Qt>0?`已保存消息;${Qt} 个成员等待投递确认`:`消息已送达 ${Ut.messages.length} 个会话`)}catch(Ut){x(Ut instanceof Error?Ut.message:"发送失败")}finally{m(null)}},Ae=async()=>{if(!We)return;m(`delete:${We.id}`),x(null),b(null);const le=We.name;try{await q5(We.id),D(null),Y(!1),await v(),b(`“${le}”已删除`)}catch(st){x(st instanceof Error?st.message:"删除失败")}finally{m(null)}},bn=async()=>{if(!We)return;const le=[...Rt];m("save-members"),x(null),b(null);try{const st=await Fc({id:We.id,name:We.name,sessionIds:le,expectedUpdatedAt:K});D(st.group.id),ft(!1),await v(),b(`“${We.name}”成员已更新,共 ${le.length} 个会话`)}catch(st){x(st instanceof Error?st.message:"成员更新失败")}finally{m(null)}},_r=async le=>{if(!We)return;const st=Ce[le]??"";m(`role:${le}`),x(null),b(null);try{await K7(We.id,le,st.trim()||null),await v(),b(st.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(Ut){x(Ut instanceof Error?Ut.message:"定位保存失败")}finally{m(null)}},_e=()=>{const le=s.find(st=>st.sessionId===u)?.cwd??s.find(st=>We?.sessionIds.includes(st.sessionId))?.cwd??"";ge(le),It(""),bt(""),ye(!0),ft(!1)},Qr=async()=>{if(!(!We||!Ve)){m("spawn-agent"),x(null),b(null);try{const le=await X7(We.id,{agentSlug:Ve,name:ht.trim()||void 0,cwd:Se.trim()||void 0,task:Ue.trim()||void 0,mode:h});ye(!1),await v(),b(`“${le.session.name}”已创建并加入“${le.group.name}”`)}catch(le){x(le instanceof Error?le.message:"Agent Session 创建失败")}finally{m(null)}}},wt=Z.filter(le=>(!Pe||!De.has(le.id))&&(be==="all"||le.responseKind===be)),en=LB(wt,s),Er=()=>{const le=new Set([...De,...wt.map(st=>st.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${We?.id}`,JSON.stringify([...le]))}catch{x("无法保存已看记录,请检查浏览器存储空间");return}pe(le)};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{hidden:e,children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"会话协作"}),a.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"创建协作组后,一个 Agent 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),We&&a.jsxs("button",{className:`${zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{D("new"),Y(!1),b(null)},children:[a.jsx(Xi,{size:13}),"新建组"]})]}),r.length>0&&a.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:r.map(le=>a.jsxs("button",{onClick:()=>D(le.id),className:`${zr} shrink-0 ${We?.id===le.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[le.name,a.jsx("span",{className:"text-[9px] opacity-70",children:le.sessionIds.length})]},le.id))}),!We&&a.jsxs("section",{className:"border-y border-border/15 py-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),a.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"至少选择两个会话。离线成员会在重新上线后收到消息;成员发生变化时会提示你重新选择。"})]}),a.jsxs("span",{className:`shrink-0 text-[10px] ${te>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",te," 个"]})]}),a.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",a.jsx("input",{className:ti,value:w,onChange:le=>I(le.target.value),placeholder:"例如:发布准备"})]}),s.length>5&&a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"筛选会话"}),a.jsx(xd,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:`${ti} pl-8`,value:P,onChange:le=>V(le.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),a.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[Oe.map(le=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[a.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!Mf(le),checked:k.has(le.sessionId),onChange:()=>N(st=>{const Ut=new Set(st);return Ut.has(le.sessionId)?Ut.delete(le.sessionId):Ut.add(le.sessionId),Ut})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"truncate text-[12px] text-foreground",children:le.name}),a.jsx(Nf,{session:le}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Df(le)})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[Bf(le.currentTask)," · ",le.cwd]})]})]},le.sessionId)),s.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:t==="loading"?"正在加载会话…":t==="error"?"会话加载失败,请重试":"当前服务暂无可选会话"}),s.length>0&&Oe.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Qe.length>0&&a.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Qe.length," 个所选会话暂不可用。",a.jsx("button",{className:zr,onClick:()=>N(le=>new Set([...le].filter(st=>Vt.has(st)))),children:"清除不可用选择"})]}),a.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${te<2?"text-muted-foreground":"text-primary"}`,children:te<2?`还需选择 ${2-te} 个会话`:"成员已满足要求,可以创建"}),a.jsxs("div",{className:"flex justify-end gap-2",children:[r.length>0&&a.jsx("button",{className:`${zr} bg-surface-2 text-foreground`,onClick:()=>D(r[0]?.id??null),children:"取消"}),a.jsxs("button",{disabled:p!==null||t!=="loaded"||!w.trim()||te<2||Qe.length>0,className:`${zr} bg-primary text-primary-foreground`,onClick:()=>{Nt()},children:[p==="create-group"?a.jsx(hs,{size:13,className:"animate-spin"}):a.jsx(Xi,{size:13}),"创建协作组"]})]})]})]})]}),We&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{hidden:e,children:[a.jsxs("section",{className:"border-y border-border/15 py-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:We.name}),a.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[We.sessionIds.length," 个成员 · 组 ID:",a.jsx("span",{className:"break-all font-mono",children:bB(We.id)})]})]}),F?a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsx("button",{className:`${zr} bg-surface-2 px-2 text-foreground`,onClick:()=>Y(!1),children:"取消"}),a.jsxs("button",{disabled:p!==null,className:`${zr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{Ae()},children:[p===`delete:${We.id}`?a.jsx(hs,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsxs("button",{className:`${zr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{He(new Set(We.sessionIds)),Xe(We.updatedAt);const le=!ve;ft(le),le&&z(Object.fromEntries(We.sessionIds.map(st=>[st,We.roles?.[st]??""]))),ye(!1)},children:[a.jsx(G5,{size:13}),"管理成员"]}),a.jsxs("button",{className:`${zr} px-2 text-primary hover:bg-primary/10`,onClick:_e,children:[a.jsx(Xi,{size:13}),"新建 Agent"]}),a.jsx("button",{"aria-label":`删除协作组 ${We.name}`,title:"删除协作组",disabled:p!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>Y(!0),children:a.jsx(Ji,{size:14})})]})]}),a.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:We.sessionIds.map(le=>{const st=s.find(lr=>lr.sessionId===le),Ut=We.roles?.[le];return a.jsxs("button",{disabled:!st,onClick:()=>st&&void CB(st).catch(lr=>x(lr instanceof Error?lr.message:"无法打开会话")),className:"min-w-0 px-3 py-2.5 text-left transition hover:bg-surface-2 disabled:cursor-default",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${st?.status==="working"?"bg-primary":st?"bg-[var(--success)]":"bg-muted-foreground"}`}),a.jsx("span",{className:"truncate text-[11px] text-foreground",children:st?.name??le}),st&&a.jsx(Nf,{session:st}),a.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:st?Df(st):"已离线"})]}),a.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[Ut?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",Ut]}),a.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,st?a.jsx("span",{className:"min-w-0 truncate",children:Bf(st.currentTask)}):a.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]},le)})}),ve&&a.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出;定位(角色)在每行独立保存,成员收到消息时会看到自己的定位。"})]}),a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",Rt.size]})]}),a.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:qe.map(le=>{const st=Ce[le.sessionId]??"",Ut=We.roles?.[le.sessionId]??"";return a.jsxs("div",{className:"px-2 py-2 transition hover:bg-surface-2",children:[a.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[a.jsx("input",{type:"checkbox",disabled:!We.sessionIds.includes(le.sessionId)&&!Mf(le),checked:Rt.has(le.sessionId),onChange:()=>He(lr=>{const Zt=new Set(lr);return Zt.has(le.sessionId)?Zt.delete(le.sessionId):Zt.add(le.sessionId),Zt})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] text-foreground",children:le.name}),a.jsx(Nf,{session:le}),a.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Df(le)," · ",le.cwd]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2 pl-7",children:[a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:"定位"}),a.jsx("input",{"aria-label":`${le.name} 的定位`,className:`${ti} min-h-8 py-1 text-[10px]`,value:st,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:lr=>z(Zt=>({...Zt,[le.sessionId]:lr.target.value}))}),a.jsx("button",{"aria-label":`保存 ${le.name} 的定位`,title:st.trim()===Ut?"定位未变化":"保存此成员的定位",disabled:p!==null||st.trim()===Ut,className:`${zr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{_r(le.sessionId)},children:p===`role:${le.sessionId}`?a.jsx(hs,{size:12,className:"animate-spin"}):a.jsx(la,{size:12})})]})]},le.sessionId)})}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${zr} bg-surface-2 text-foreground`,onClick:()=>{ft(!1),z({})},children:"取消"}),a.jsxs("button",{disabled:p!==null||t!=="loaded"||Rt.size<2,className:`${zr} bg-primary text-primary-foreground`,onClick:()=>{bn()},children:[p==="save-members"?a.jsx(hs,{size:13,className:"animate-spin"}):a.jsx(la,{size:13}),"保存成员"]})]})]}),q&&a.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[a.jsxs("div",{children:[a.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),a.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",a.jsx("select",{"aria-label":"新 Agent 类型",className:ti,value:Ve,onChange:le=>pt(le.target.value),children:i.map(le=>a.jsxs("option",{value:le.slug,children:[le.displayName,le.isPlugin?" · Plugin":""]},le.slug))})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",a.jsx("input",{"aria-label":"新 Agent 会话名称",className:ti,value:ht,onChange:le=>It(le.target.value),placeholder:"留空则自动命名"})]})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",a.jsx("input",{"aria-label":"新 Agent 工作目录",className:ti,value:Se,onChange:le=>ge(le.target.value),placeholder:"默认继承当前会话"})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",a.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${ti} min-h-16 resize-y`,value:Ue,onChange:le=>bt(le.target.value),placeholder:"说明它加入后要先完成什么"})]}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${zr} bg-surface-2 text-foreground`,onClick:()=>ye(!1),children:"取消"}),a.jsxs("button",{disabled:p!==null||!Ve,className:`${zr} bg-primary text-primary-foreground`,onClick:()=>{Qr()},children:[p==="spawn-agent"?a.jsx(hs,{size:13,className:"animate-spin"}):a.jsx(Hd,{size:13}),"创建并加入"]})]})]})]}),a.jsxs("section",{children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[en.length," 条"]})]}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[a.jsxs("select",{"aria-label":"筛选回复类型",className:`${ti} w-auto`,value:be,onChange:le=>et(le.target.value),children:[a.jsx("option",{value:"all",children:"全部类型"}),a.jsx("option",{value:"ack",children:"收到确认"}),a.jsx("option",{value:"progress",children:"进展"}),a.jsx("option",{value:"result",children:"结果与证据"})]}),a.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:Pe,onChange:le=>fe(le.target.checked)}),"只看新记录"]}),a.jsx("button",{className:`${zr} min-h-9 text-muted-foreground`,disabled:!wt.length,onClick:Er,children:"标记当前记录已看"})]}),a.jsxs("div",{className:"max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[en.map(le=>a.jsxs("div",{className:"px-2 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-primary",children:le.responseKind==="ack"?"收到确认":le.responseKind==="progress"?"进展":le.responseKind==="result"?"结果":_B(le.kind)}),a.jsx("span",{children:le.fromName}),a.jsx("span",{children:"→"}),a.jsx("span",{className:"truncate",children:le.toNames.join("、")}),a.jsx("span",{className:"ml-auto shrink-0",children:new Date(le.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:le.content}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:le.status==="pending"?"尚未送达 · 等待连接或接收方读取":le.status==="read"?"接收方已确认读取 · 不代表任务完成":le.status==="failed"?"投递失败":le.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(le.task||le.failureReason)&&a.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[a.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),a.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(le.task??{failure_reason:le.failureReason},null,2)})]})]},le.key)),en.length===0&&a.jsx(DB,{text:Ee?"正在加载协作记录…":Z.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]}),a.jsxs("section",{"data-termdock-terminal-dropzone":e?u??"collaboration-composer":void 0,onDragOver:le=>{e&&le.preventDefault()},onDrop:le=>{if(!e)return;const st=Array.from(le.dataTransfer.files);if(!(st.length&&Vs()))if(le.preventDefault(),le.stopPropagation(),st.length)Et(st);else{const Ut=le.dataTransfer.getData("text/plain")||le.dataTransfer.getData("text/uri-list");Ut&&ie(lr=>lr+(lr?`
133
- `:"")+Ut)}},ref:Ke,className:"border-t border-primary/20 bg-primary/5 px-3 py-3",children:[a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:e?`${We.name} · 发送给成员`:"发送给成员"}),a.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["接收人",a.jsxs("select",{className:ti,value:ae,onChange:le=>ce(le.target.value),children:[a.jsx("option",{value:"*",children:"全组成员"}),We.sessionIds.map(le=>a.jsx("option",{value:le,children:J6(s.find(st=>st.sessionId===le))??`${le.slice(0,8)}(离线)`},le))]})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["消息类型",a.jsxs("select",{className:ti,value:Te,onChange:le=>we(le.target.value),children:[a.jsx("option",{value:"message",children:"普通消息"}),a.jsx("option",{value:"ask",children:"需要回答的问题"}),a.jsx("option",{value:"task",children:"需要执行的任务"}),a.jsx("option",{value:"handoff",children:"工作交接"}),a.jsx("option",{value:"done",children:"完成通知"})]})]})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",a.jsx("textarea",{onPaste:le=>{const st=Array.from(le.clipboardData.files);st.length&&(le.preventDefault(),Et(st))},className:`${ti} min-h-20 max-h-48 resize-y`,value:Ge,onChange:le=>ie(le.target.value),placeholder:"说明背景、期望产出,以及对方需要回复或完成什么…"})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{className:"text-[9px] leading-relaxed text-muted-foreground",children:vt>0?"正在准备文件路径…":We.federated?"跨服务消息由当前客户端转发,请保持窗口或网页运行;手机后台可能暂停,返回后继续同步。":"在线成员立即入队;离线成员上线后送达。"}),a.jsxs("button",{disabled:p!==null||vt>0||!Ge.trim(),className:`${zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{hr()},children:[p==="send-message"?a.jsx(hs,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function Mf(e){return!V5(e.sessionId)||e.serviceConnected!==!1}function TB(e,t){const r=new Map(t.map(s=>[s.sessionId,s]));for(const s of e?.sessionIds??[]){if(r.has(s))continue;const i=e?.remoteSessions?.find(u=>u.sessionId===s);r.set(s,i?{...i,status:"offline",serviceConnected:!1}:{sessionId:s,name:s,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...V5(s)?{serviceConnected:!1}:{}})}return[...r.values()]}function Nf({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:a.jsxs("span",{title:e.serviceOrigin,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:[a.jsx(J5,{size:9}),a.jsx("span",{className:"truncate",children:e.serviceLabel??e.serviceOrigin})]})}function Df(e){return e.serviceConnected===!1?"服务不可达":SB(e.status)}function J6(e){return e?`${e.name}${e.serviceOrigin&&e.serviceOrigin!==window.location.origin?` · ${e.serviceLabel??e.serviceOrigin}`:""}`:void 0}async function CB(e){e.sessionId.startsWith("remote:")?await k6(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function SB(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function Bf(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return Ud(t.prompt)||"暂无任务摘要"}catch{}return Ud(e)||"暂无任务摘要"}function _B(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function LB(e,t){const r=new Map(t.map(i=>[i.sessionId,J6(i)])),s=new Map;for(const i of e){const u=`${i.threadId}:${i.createdAt}:${i.fromSessionId??"user"}:${i.kind}:${i.responseKind??""}:${JSON.stringify(i.task??null)}:${i.content}`,c=s.get(u),h=r.get(i.toSessionId)??i.toSessionId.slice(0,8);if(c){c.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[i.status]<p[c.status]&&(c.status=i.status);continue}s.set(u,{key:u,kind:i.kind,content:i.content,createdAt:i.createdAt,fromName:i.fromSessionId?r.get(i.fromSessionId)??i.fromSessionId.slice(0,8):"你",toNames:[h],status:i.status,responseKind:i.responseKind,task:i.task,failureReason:i.failureReason})}return[...s.values()].sort((i,u)=>u.createdAt-i.createdAt)}function IB({onClose:e,onNewSession:t,setError:r}){const[s,i]=T.useState(""),[u,c]=T.useState([]),[h,p]=T.useState(!1),m=T.useRef(0);T.useEffect(()=>{const b=s.trim(),v=++m.current;if(c([]),!b){p(!1);return}p(!0);const w=window.setTimeout(()=>{Y7(b).then(I=>{v===m.current&&c(I.results)}).catch(I=>{v===m.current&&r(I instanceof Error?I.message:"搜索失败")}).finally(()=>{v===m.current&&p(!1)})},250);return()=>window.clearTimeout(w)},[s,r]);const x=async b=>{if(b.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:b.sessionId})),e();return}if(b.resumeHistoryId)try{const v=await Z5(b.resumeHistoryId);t({mode:"shell",cwd:v.cwd,command:v.command}),e()}catch(v){r(v instanceof Error?v.message:"恢复失败")}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"全文搜索"}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"搜索会话标题、项目目录、任务内容和终端记录"})]}),a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"搜索全部会话"}),a.jsx(xd,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{autoFocus:!0,className:`${ti} pl-9 pr-9`,value:s,onChange:b=>{r(null),i(b.target.value)},placeholder:"输入你记得的关键词"}),h?a.jsx(hs,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):s&&a.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:()=>i(""),children:a.jsx(vs,{size:13})})]})]}),!s.trim()&&a.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[a.jsx(xd,{size:24,className:"mx-auto text-primary"}),a.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"找回之前做过的事"}),a.jsx("p",{className:"mx-auto mt-1 max-w-md text-[11px] leading-relaxed text-muted-foreground",children:"可以输入任务名、报错片段或目录名,例如“自动任务”“web-terminal”“构建失败”。搜索索引只保存在本机。"})]}),s.trim()&&!h&&u.length>0&&a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-[11px] text-foreground",children:["显示 ",u.length," 个会话"]}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"在线可打开 · 已关闭可恢复"})]}),a.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:u.map(b=>{const v=b.live||!!b.resumeHistoryId,w=b.live?"打开会话":b.resumeHistoryId?"恢复会话":"仅供查阅",I=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-[12px] font-medium text-foreground",children:b.title}),a.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:b.cwd})]}),a.jsx("span",{className:`shrink-0 text-[10px] ${b.live?"text-[var(--success)]":b.resumeHistoryId?"text-primary":"text-muted-foreground"}`,children:w})]}),a.jsx("p",{className:"mt-2 line-clamp-3 text-[10px] leading-relaxed text-foreground/75",children:kB(b)||"匹配内容来自标题、目录或终端控制信息"}),a.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[$d(b.updatedAt)," · ",b.matchCount," 处匹配",v?"":" · 没有可恢复记录"]})]});return v?a.jsx("button",{onClick:()=>{x(b)},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:I},b.sessionId):a.jsx("article",{className:"px-2 py-3",children:I},b.sessionId)})}),s.trim()&&!h&&u.length===0&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsxs("p",{className:"text-[12px] text-foreground",children:["没有找到“",s.trim(),"”"]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"试试更短的关键词、目录名或报错中的一小段。"}),a.jsx("button",{className:`${zr} mt-3 bg-surface-2 text-foreground`,onClick:()=>i(""),children:"清空后重试"})]})]})}function Ud(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 kB(e){let t=Ud(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return Ud(t)}function EB(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(s=>`周${t[s]}`).join("、")} ${e.schedule.time}`}function RB(e,t=Date.now(),r=t){if(e.kind==="interval"){const u=e.everyMinutes*6e4,c=Math.max(0,t-r);return r+(Math.floor(c/u)+1)*u}const[s,i]=e.time.split(":").map(Number);for(let u=0;u<=7;u+=1){const c=new Date(t);if(c.setDate(c.getDate()+u),c.setHours(s,i,0,0),c.getTime()>t&&e.weekdays.includes(c.getDay()))return c.getTime()}return t}function $d(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function MB(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function NB(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function DB({text:e}){return a.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 BB(e,t){return Xx(e,t)}function Ju(e,t){const r=new Set(e),s=t.filter(u=>u.sessionIds.length>=2&&u.sessionIds.every(c=>r.has(c))),i=new Set;return e.flatMap(u=>{const c=s.find(h=>h.sessionIds.includes(u));return c?i.has(c.id)?[]:(i.add(c.id),[{sessionIds:c.sessionIds,workspace:c}]):[{sessionIds:[u]}]})}function Rc(e,t,r,s=[]){const i=new Map,u=new Map,c=new Set(e.map(x=>x.id));for(const x of s){const b=x.sessionIds.filter(w=>c.has(w));if(b.length<(x.federated?1:2))continue;const v=b.length===x.sessionIds.length?x:{...x,sessionIds:b};b.forEach(w=>i.set(w,v))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(b=>c.has(b)))&&!x.sessionIds.some(b=>i.has(b)))for(const b of x.sessionIds)u.set(b,x);const h=new Set,p=new Set,m=[];for(const x of e){const b=i.get(x.id);if(b){if(h.has(b.id))continue;h.add(b.id);const I=b.sessionIds.flatMap(k=>{const N=r.get(k);return N?[N]:[]});m.push({kind:"collaboration",id:`collaboration:${b.id}`,group:b,members:I,sessionIds:b.sessionIds});continue}const v=u.get(x.id);if(!v){m.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(v.id))continue;p.add(v.id);const w=v.sessionIds.flatMap(I=>{const k=r.get(I);return k?[k]:[]});m.push({kind:"workspace",id:`workspace:${v.id}`,workspace:v,members:w,sessionIds:v.sessionIds})}return m}function w5(e,t,r){const s=Math.min(e.length,Math.max(0,r)),i=e.slice(0,s).flatMap(c=>c.sessionIds.filter(h=>h!==t)),u=e.slice(s).flatMap(c=>c.sessionIds.filter(h=>h!==t));return[...i,t,...u]}function QB({status:e,detail:t,needsReview:r,inCopyMode:s}){return a.jsx(WD,{status:e,detail:t,needsReview:r,inCopyMode:s})}function A5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,sessions:i,activeSessionId:u,sessionStates:c,onNewSession:h,onCloseSession:p,onSplitSession:m,onCloseSplit:x,onRemoveFromSplit:b,splitWorkspaces:v,onSetSplitLayout:w,onReorderSplitWorkspace:I,onCombineSplitSessions:k,onReorderSessions:N,onSessionMenu:R,onOpenSettings:D,onOpenQuota:P,updateState:V,updateActionPending:F=!1,onConfirmUpdateRestart:Y,onRetryUpdate:Z,tmuxAvailable:he=!0,defaultSessionMode:Ee="shell",push:Ie,pinned:be,runningSessionButtonEnabled:et=!1,onRunningSessionButtonEnabledChange:Pe,onTogglePinned:fe,recoverableTmuxSessions:De=[],recoverableTmuxSessionsLoading:pe=!1,onRefreshRecoverableTmuxSessions:ae}){const{t:ce}=an(),[Te,we]=T.useState(!1),[Ge,ie]=T.useState(null),[ve,ft]=T.useState(!1),[Rt,He]=T.useState(!1),[K,Xe]=T.useState(null),[Ce,z]=T.useState([]),[q,ye]=T.useState(!1),[Ve,pt]=T.useState(null),[ht,It]=T.useState(null),[Se,ge]=T.useState(null),[Ue,bt]=T.useState(null),Ke=bd(H=>H.collaborationGroups),Mt=bd(H=>H.setCollaborationGroups),[We,vt]=T.useState({mode:Ee}),{preference:ir,agents:it,detecting:dt,refresh:Bt,selectAgent:Et}=xB(),Vt=T.useRef(null),te=T.useRef(null),Qe=T.useRef(null),qe=!!(V?.latestVersion&&["installing","ready","restarting","error"].includes(V.status)),kt=Ht(H=>H.groupByFolder),Oe=Ht(H=>H.collapsedGroups),Nt=Ht(H=>H.toggleGroupCollapsed),hr=T.useRef(null),Ae=T.useRef(0),bn=T.useRef(!1),_r=T.useRef(null),_e=T.useRef(null),[Qr,wt]=T.useState(!1),en=T.useRef([]),Er=T.useRef(null),le=T.useRef(null),st=T.useRef(new Set),Ut=T.useRef(null),lr=T.useMemo(()=>new Set(v.flatMap(H=>H.sessionIds)),[v]),Zt=T.useMemo(()=>new Map(i.map(H=>[H.id,H])),[i]),Qt=T.useMemo(()=>BB(Ke,new Set(Zt.keys())),[Ke,Zt]),re=T.useCallback(async()=>{const H=++Ae.current;try{const se=await W5();if(H!==Ae.current)return;Mt(Array.isArray(se.groups)?se.groups:[])}catch{}},[]);T.useEffect(()=>H5(H=>Mt(H.groups)),[]),T.useEffect(()=>{re();const H=window.setInterval(()=>{re()},1e4),se=()=>{re()};return window.addEventListener("focus",se),()=>{Ae.current+=1,window.clearInterval(H),window.removeEventListener("focus",se)}},[re]),T.useEffect(()=>{(e||!Rt)&&re()},[Rt,e,re]);const br=T.useCallback(()=>{en.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(H=>{const se=H.dataset.collaborationMember??"",$e=H.hasAttribute("data-collaboration-background"),ke=H.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!se&&!$e||!ke)return[];const ze=[];for(let Ze=H.parentElement;Ze;Ze=Ze.parentElement)ze.push({element:Ze,top:Ze.scrollTop,left:Ze.scrollLeft});return[{element:H,sessionId:se,groupId:ke,background:$e,rect:H.getBoundingClientRect(),scrollParents:ze}]})},[]),ct=T.useCallback((H,se)=>{if(!bn.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(at=>at.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(at=>at.removeAttribute("data-drop-active"));const ke=document.elementsFromPoint(H,se).map(at=>at.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(ke?.dataset.collaborationGroup){ke.dataset.dropActive="true",le.current={kind:"collaboration",groupId:ke.dataset.collaborationGroup,background:!0};return}const ze=en.current.find(at=>{if(at.sessionId===_e.current||!at.element.isConnected)return!1;const Xt=at.scrollParents.reduce((Ft,Jt)=>Ft+Jt.element.scrollLeft-Jt.left,0),$t=at.scrollParents.reduce((Ft,Jt)=>Ft+Jt.element.scrollTop-Jt.top,0);return H>=at.rect.left-Xt&&H<=at.rect.right-Xt&&se>=at.rect.top-$t+at.rect.height*.25&&se<=at.rect.bottom-$t-at.rect.height*.25});if(ze?.background){ze.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),le.current={kind:"collaboration",groupId:ze.groupId,background:!0};return}if(ze&&!v.find(Xt=>Xt.sessionIds.includes(ze.sessionId))?.sessionIds.includes(_e.current??"")){ze.element.dataset.dropActive="true",le.current={kind:"split",sessionId:ze.sessionId,groupId:ze.groupId};return}const Ze=document.elementsFromPoint(H,se).filter(at=>{const Xt=at.closest("[data-rfd-draggable-id]");return!Xt||!["session:","split-member:","collaboration-member:"].some($t=>Xt.dataset.rfdDraggableId===`${$t}${_e.current}`)}),xt=Ze.map(at=>at.closest("[data-collaboration-group]")).find(at=>at?.dataset.collaborationGroup);if(xt?.dataset.collaborationGroup){const at=xt.dataset.collaborationGroup,Xt=Ze.map(Jt=>Jt.closest("[data-collaboration-split]")).find(Boolean),$t=Ze.map(Jt=>Jt.closest("[data-collaboration-member]")).find(Boolean),Ft=$t?.dataset.collaborationMember??Xt?.dataset.splitAnchor;if(Ft&&(at!==_r.current||!$t&&Xt)){xt.dataset.dropActive="true";const Jt=$t??Xt;Jt&&(Jt.dataset.dropActive="true"),le.current={kind:"split",sessionId:Ft,groupId:at}}else{const Jt=Ze.some(Kn=>Kn.closest("[data-collaboration-background]"));(at!==_r.current||Jt)&&(xt.dataset.dropActive="true"),le.current={kind:"collaboration",groupId:at,background:Jt}}return}const Re=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(at=>at.dataset.sidebarEntityListId===Er.current).find(at=>{const Xt=at.getBoundingClientRect();return H>=Xt.left&&H<=Xt.right&&se>=Xt.top-8&&se<=Xt.bottom+8});if(!Re){le.current=null;return}const ot=Array.from(Re.children).filter(at=>at instanceof HTMLElement&&at.hasAttribute("data-sidebar-entity-index")),pr=ot.findIndex(at=>{const Xt=at.getBoundingClientRect();return se<Xt.top+Xt.height/2}),At=pr<0?ot.length:pr;le.current={kind:"list",listId:Re.dataset.sidebarEntityListId??"",index:At};const Yt=Array.from(Re.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(at=>at.dataset.splitExitDropIndex===String(At));Yt instanceof HTMLElement&&(Yt.dataset.active="true")},[v]);T.useEffect(()=>{const H=$e=>ct($e.clientX,$e.clientY),se=$e=>{const ke=$e.touches[0];ke&&ct(ke.clientX,ke.clientY)};return window.addEventListener("pointermove",H),window.addEventListener("touchmove",se,{passive:!0}),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("touchmove",se)}},[ct]);const jn=T.useCallback((H,se)=>{try{H(se)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach($e=>{delete $e.dataset.sidebarDragging}),bn.current=!1,en.current=[],wt(!1),_r.current=null,_e.current=null,Er.current=null,le.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach($e=>$e.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach($e=>$e.removeAttribute("data-drop-active"))}},[]),dr=T.useMemo(()=>i.filter(H=>!lr.has(H.id)),[i,lr]),js=T.useMemo(()=>{let H=0;for(const se of i)c.get(se.id)?.agentStatus==="working"&&(H+=1);return H},[i,c]);T.useEffect(()=>{e&&hr.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[u,e,dr.length,Oe]);const qs=T.useMemo(()=>{if(!kt||!u)return null;const H=c.get(u)?.cwd??null;return r_(H)},[kt,u,c]);T.useEffect(()=>{if(!kt){Ut.current=null,st.current.clear();return}if(!u){Ut.current=null;return}const H=Ht.getState(),se=st.current,$e=Ut.current,ke=qs;$e!==null&&$e!==ke&&se.has($e)&&(H.collapsedGroups.has($e)||H.toggleGroupCollapsed($e),se.delete($e)),ke!==null&&ke!==""&&H.collapsedGroups.has(ke)&&(H.toggleGroupCollapsed(ke),se.add(ke)),Ut.current=ke},[kt,u,qs]),T.useEffect(()=>{e||(we(!1),ft(!1))},[e]),T.useEffect(()=>{vt(H=>({...H,command:ir?.command}))},[ir]),T.useEffect(()=>{if(!ve)return;let H=!1;return ye(!0),It(null),am().then(se=>{H||z(se)}).catch(()=>{H||It(ce("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{H||ye(!1)}),()=>{H=!0}},[ve,ce]),T.useLayoutEffect(()=>{if(!Te)return;const H=Vt.current,se=te.current;if(!H||!se)return;const $e=window.visualViewport,ke=()=>{const xt=($e?.offsetLeft??0)+8,tt=($e?.offsetTop??0)+8,Re=Math.max(0,($e?.width??window.innerWidth)-16),ot=Math.max(0,($e?.height??window.innerHeight)-16);se.style.maxWidth=`${Re}px`,se.style.maxHeight=`${ot}px`;const pr=H.getBoundingClientRect(),At=Math.max(xt,Math.min(pr.right-se.offsetWidth,xt+Re-se.offsetWidth)),Yt=Math.max(tt,Math.min(pr.bottom+4,tt+ot-se.offsetHeight));se.style.left=`${At-pr.left}px`,se.style.top=`${Yt-pr.top}px`};ke();const ze=typeof ResizeObserver>"u"?null:new ResizeObserver(ke);return ze?.observe(H),ze?.observe(se),window.addEventListener("resize",ke),window.addEventListener("scroll",ke,!0),$e?.addEventListener("resize",ke),$e?.addEventListener("scroll",ke),()=>{ze?.disconnect(),window.removeEventListener("resize",ke),window.removeEventListener("scroll",ke,!0),$e?.removeEventListener("resize",ke),$e?.removeEventListener("scroll",ke)}},[Te,t]),T.useEffect(()=>{if(!Te)return;const H=se=>{se instanceof KeyboardEvent&&se.key!=="Escape"||se instanceof MouseEvent&&se.target instanceof Node&&Vt.current?.contains(se.target)||we(!1)};return window.addEventListener("mousedown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("mousedown",H),window.removeEventListener("keydown",H)}},[Te]),T.useEffect(()=>{if(!Ge)return;const H=se=>{se instanceof KeyboardEvent&&se.key!=="Escape"||se instanceof PointerEvent&&se.target instanceof Node&&Qe.current?.contains(se.target)||ie(null)};return window.addEventListener("pointerdown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H)}},[Ge]);const fs=()=>{!Ie&&!be&&r()},Cn=Ee==="tmux"&&!he?"shell":Ee,ns=()=>{h({mode:Cn}),fs()},zn=()=>{ir&&(h({mode:Cn,command:ir.command}),fs())},Mn=H=>{ge(H.name),h({mode:"tmux",tmuxSessionName:H.name,cwd:H.cwd??void 0}),fs()};T.useEffect(()=>{Se&&(De.some(H=>H.name===Se)||ge(null))},[Se,De]);const ws=(H,se)=>{h({...We,cwd:We.cwd?.trim()||void 0,command:se??H?.command}),ft(!1),fs()},Hn=async H=>{pt(H.id),It(null);try{const se=await Z5(H.id);h({mode:"shell",cwd:se.cwd,command:se.command}),ft(!1),fs()}catch(se){const $e=se&&typeof se=="object"&&"code"in se?String(se.code??""):"";It(ce($e==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{pt(null)}},tn=async H=>{z(se=>se.filter($e=>$e.id!==H));try{await iv(H)}catch{It(ce("sidebar.resumeHistoryRemoveFailed")),am().then(z).catch(()=>{})}},Pn=()=>{if(ve){ft(!1);return}vt({mode:Ee==="tmux"&&!he?"shell":Ee,cwd:u?c.get(u)?.cwd??void 0:void 0,command:ir?.command}),ft(!0)},Gr=T.useCallback(H=>{const se=c.get(H);return se?.agentStatus==="waiting"||se?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":se?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":se?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[c]),Cr=I6(),dn=T.useCallback((H,se,$e,ke)=>{const ze=H.id===u,Ze=lr.has(H.id),xt=!!($e&&Ze),tt=c.get(H.id),Re=Ea(tt?.cwd??null),ot=tt?.shellTitle??pw(H.id),pr=ot===tt?.cwd||ot===Re?null:ot,At=t_(H,tt?.activeProgram??null,null,Gp,pr,tt?.promptState??null),Yt=!!(tt?.tuiProgress&&tt.tuiProgress.state!=="remove"),Xt=tt?.promptState==="running"||tt?.agentStatus==="working"||Yt?"bg-[var(--success)]":tt?.agentStatus==="waiting"||tt?.agentNeedsReview?"bg-[var(--warning)]":tt?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:ze?hr:null,type:"button",...se??{},onContextMenu:$t=>{R&&($t.preventDefault(),R(H.id,{x:$t.clientX,y:$t.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:H.id})),fs()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${se?"cursor-grab active:cursor-grabbing ":""}${$e?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:tt?.cwd??H.name,children:[ze&&a.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${Xt}`}),a.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${$e?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${ze?H.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":H.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[tt?.isConnecting||Yt&&!tt?.agentStatus?a.jsx(un,{size:$e?10:11,className:"animate-spin"}):tt?.agent??wm(H.id)?a.jsx(Kl,{agent:tt?.agent??wm(H.id),size:$e?13:15}):H.mode==="tmux"?a.jsx(U0,{size:$e?10:11}):a.jsx($o,{size:$e?10:11}),a.jsx(QB,{status:tt?.agentStatus??null,detail:tt?.agentStatusDetail,needsReview:tt?.agentNeedsReview,inCopyMode:tt?.inCopyMode})]}),a.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${$e?"text-[11px]":"text-[12px]"} ${ze?"font-medium text-foreground":""} ${tt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:At})]}),ke,a.jsx("button",{type:"button",onClick:$t=>{$t.stopPropagation(),xt?b(H.id):Ze?x(H.id):m(H.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 ${$e?"h-6 w-6":"h-[26px] w-[26px]"} ${Ze?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${ce(xt?"tab.splitRemovePane":Ze?"tab.splitClose":"tab.split")} ${At}`,title:ce(xt?"tab.splitRemovePane":Ze?"tab.splitClose":"tab.split"),children:xt?a.jsx(S9,{size:11}):a.jsx(Hl,{size:12})}),a.jsx("button",{type:"button",onClick:$t=>{$t.stopPropagation(),p(H.id,$t)},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 ${$e?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":ce("sidebar.closeSession",{name:At}),title:ce("common.close"),children:a.jsx(vs,{size:$e?11:12})})]})},[u,lr,c,p,m,x,b,R,ce]),wr=T.useMemo(()=>Sd(i,H=>c.get(H.id)?.cwd??null,kt,ce("sidebar.ungrouped"),v,Qt).groups,[Qt,kt,i,c,v,ce]),hn=T.useMemo(()=>Rc(i,v,Zt,Qt),[Qt,i,Zt,v]),jt=T.useCallback(H=>{wt(H.draggableId.startsWith("collaboration:")||H.draggableId.startsWith("workspace:"));const se=H.draggableId.replace(/^split-member:/,"");_e.current=H.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const $e=H.type==="split-member"?v.find(tt=>tt.sessionIds.includes(se)):null,ke=H.type==="collaboration-member"?H.source.droppableId.replace(/^collaboration-members:/,""):null,ze=ke?Qt.find(tt=>tt.id===ke):null;bn.current=!!($e||ze||H.type==="session"&&H.draggableId.startsWith("session:")),bn.current&&document.querySelectorAll("[data-collaboration-group]").forEach(tt=>{tt.dataset.sidebarDragging="true"}),_r.current=ze?.id??null;const Ze=$e?.sessionIds??ze?.sessionIds??[],xt=Ze.length>0?wr.find(tt=>Ze.every(Re=>tt.sessions.some(ot=>ot.id===Re))):null;Er.current=kt?xt?`group-sessions:${xt.key}`:null:Ze.length>0?"sidebar-entities":null,le.current=null},[Qt,wr,kt,v]),jr=T.useCallback((H,se,$e)=>{if(se===$e)return;const ke=se?Ke.find(Re=>Re.id===se):null,ze=$e?Ke.find(Re=>Re.id===$e):null;if($e&&!ze)return;if(ze){const Re=i.map(pr=>pr.id).filter(pr=>pr!==H);let ot=-1;Re.forEach((pr,At)=>{ze.sessionIds.includes(pr)&&(ot=At)}),ot>=0&&(Re.splice(ot+1,0,H),N(Re))}const Ze=ke?.sessionIds.filter(Re=>Re!==H)??[],xt=ze?[...ze.sessionIds.filter(Re=>Re!==H),H]:[];Mt(Re=>Re.flatMap(ot=>ot.id===se?Ze.length>=2?[{...ot,sessionIds:Ze}]:[]:ot.id===$e?[{...ot,sessionIds:xt}]:[ot])),bt(null),(ke&&ze?tv({sourceGroupId:ke.id,targetGroupId:ze.id,sessionId:H,expectedSourceUpdatedAt:ke.updatedAt,expectedTargetUpdatedAt:ze.updatedAt}):ke?Ze.length>=2?Fc({id:ke.id,name:ke.name,sessionIds:Ze,expectedUpdatedAt:ke.updatedAt}):q5(ke.id,ke.updatedAt):ze?Fc({id:ze.id,name:ze.name,sessionIds:xt,expectedUpdatedAt:ze.updatedAt}):Promise.resolve()).then(()=>re(),Re=>(bt(Re instanceof Error?Re.message:"协作成员移动失败"),re()))},[Ke,re,i,N]),Ar=T.useCallback((H,se,$e)=>{const ke=Ke.find(Re=>Re.id===H);if(!ke||se===$e)return;const ze=ke.sessionIds.filter(Re=>!Re.startsWith("remote:")),Ze=Ju(ze,v).flatMap(Re=>Re.sessionIds),[xt]=Ze.splice(se,1);if(!xt)return;Ze.splice($e,0,xt);const tt=v.find(Re=>Re.sessionIds.includes(xt));if(tt&&tt.sessionIds.every(Re=>ke.sessionIds.includes(Re))){const Re=Ze.filter(ot=>tt.sessionIds.includes(ot));I(tt.id,Re)}Ze.push(...ke.sessionIds.filter(Re=>Re.startsWith("remote:"))),Mt(Re=>Re.map(ot=>ot.id===H?{...ot,sessionIds:Ze}:ot)),bt(null),Fc({id:ke.id,name:ke.name,sessionIds:Ze,expectedUpdatedAt:ke.updatedAt}).then(()=>re(),Re=>(bt(Re instanceof Error?Re.message:"成员排序失败"),re()))},[Ke,re,v,I]);T.useEffect(()=>{const H=se=>{const{sourceId:$e,targetId:ke}=se.detail;if(!$e||!ke||$e===ke)return;const ze=Sd(i,Ft=>c.get(Ft.id)?.cwd??null,kt,"",v,Qt).arranged.map(Ft=>Ft.id),Ze=ze.indexOf($e),xt=ze.indexOf(ke);if(Ze<0||xt<0)return;const tt=Qt.find(Ft=>Ft.sessionIds.includes($e));if(tt?.sessionIds.includes(ke)){const Ft=Ju(tt.sessionIds,v).flatMap(Jt=>Jt.sessionIds);Ar(tt.id,Ft.indexOf($e),Ft.indexOf(ke));return}const Re=v.filter(Ft=>Ft.sessionIds.length>=2&&Ft.sessionIds.every(Jt=>Zt.has(Jt))&&!Qt.some(Jt=>Ft.sessionIds.some(Kn=>Jt.sessionIds.includes(Kn)))),ot=Re.find(Ft=>Ft.sessionIds.includes($e));if(ot?.sessionIds.includes(ke)){const Ft=[...ot.sessionIds];Ft.splice(Ft.indexOf($e),1),Ft.splice(ot.sessionIds.indexOf(ke),0,$e),I(ot.id,Ft);return}const pr=Ft=>Qt.find(Jt=>Jt.sessionIds.includes(Ft))?.sessionIds??Re.find(Jt=>Jt.sessionIds.includes(Ft))?.sessionIds??[Ft],At=new Set(pr($e)),Yt=new Set(pr(ke)),at=ze.filter(Ft=>!At.has(Ft)),Xt=at.flatMap((Ft,Jt)=>Yt.has(Ft)?[Jt]:[]),$t=Ze<xt?Math.max(...Xt)+1:Math.min(...Xt);at.splice($t,0,...ze.filter(Ft=>At.has(Ft))),N(at)};return window.addEventListener("reorder-navigation-session",H),()=>window.removeEventListener("reorder-navigation-session",H)},[i,c,kt,v,Qt,Zt,Ar,I,N]);const fn=T.useCallback(H=>{if(H.type!=="collaboration-member")return!1;if(H.reason==="CANCEL")return!0;const se=H.source.droppableId.replace(/^collaboration-members:/,""),$e=H.draggableId.replace(/^collaboration-member:/,""),ke=le.current;if(ke?.kind==="split")return jr($e,se,ke.groupId),k(ke.sessionId,$e),!0;if(ke?.kind==="collaboration"&&ke.groupId!==se)return jr($e,se,ke.groupId),!0;if(ke?.kind==="collaboration"&&ke.background)return lr.has($e)&&b($e),!0;if(H.destination&&H.destination.droppableId!==H.source.droppableId){const ze=H.destination.droppableId.replace(/^collaboration-members:/,"");if(Qt.some(Ze=>Ze.id===ze))return jr($e,se,ze),!0}if(H.combine){const ze=H.combine.droppableId.replace(/^collaboration-members:/,"");ze!==se&&jr($e,se,ze);const Ze=H.combine.draggableId.replace(/^collaboration-member:/,"");if(v.find(tt=>tt.sessionIds.includes($e))?.sessionIds.includes(Ze)){const tt=Qt.find(ot=>ot.id===se),Re=tt?Ju(tt.sessionIds,v).flatMap(ot=>ot.sessionIds).indexOf(Ze):-1;Re>=0&&Ar(se,H.source.index,Re)}else Zt.has(Ze)&&k(Ze,$e);return!0}if(H.destination?.droppableId===H.source.droppableId)return Ar(se,H.source.index,H.destination.index),!0;if(ke?.kind!=="list")return!0;if(ke?.kind==="list"){const ze=wr.find(xt=>`group-sessions:${xt.key}`===ke.listId),Ze=ke.listId==="sidebar-entities"?hn:ze?Rc(ze.sessions,v,Zt,Qt):null;if(Ze){const xt=w5(Ze,$e,ke.index);ke.listId==="sidebar-entities"?N(xt):ze&&N(wr.flatMap(tt=>tt.key===ze.key?xt:tt.sessions.map(Re=>Re.id)))}}return jr($e,se,null),!0},[Qt,hn,wr,jr,N,Ar,Zt,v,lr,b,k]),ss=T.useCallback(H=>{if(H.type!=="split-member")return!1;if(H.reason==="CANCEL")return!0;const se=H.draggableId.replace(/^split-member:/,""),$e=v.find(Re=>Re.sessionIds.includes(se));if(!$e?.sessionIds.includes(se))return!0;const ke=$e.id,ze=le.current;if(ze?.kind==="split")return jr(se,null,ze.groupId),k(ze.sessionId,se),!0;if(ze?.kind==="collaboration")return jr(se,null,ze.groupId),!0;if(!H.destination&&ze?.kind==="list"){const Re=wr.find(At=>`group-sessions:${At.key}`===ze.listId),ot=ze.listId==="sidebar-entities"?hn:Re?Rc(Re.sessions,v,Zt,Qt):null;if(!ot)return!0;const pr=w5(ot,se,ze.index);return b(se),ze.listId==="sidebar-entities"?N(pr):Re&&N(wr.flatMap(At=>At.key===Re.key?pr:At.sessions.map(Yt=>Yt.id))),!0}if(!H.destination)return!0;const Ze=H.destination.droppableId.replace(/^split-members:/,"");if(Ze!==ke){const ot=v.find(pr=>pr.id===Ze)?.sessionIds[0];return ot&&k(ot,se),!0}if(H.source.index===H.destination.index)return!0;const xt=[...$e.sessionIds],[tt]=xt.splice(H.source.index,1);return tt&&(xt.splice(H.destination.index,0,tt),I(ke,xt)),!0},[Qt,hn,wr,jr,k,b,N,I,Zt,v]),Yn=(H,se="top")=>a.jsx("div",{"data-split-exit-drop-index":H,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${se==="top"?"-top-1":"-bottom-1"}`,children:a.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"})}),yn=T.useCallback((H,se,$e)=>{if(fn(H)||ss(H)||H.reason==="CANCEL")return;const ke=se.find(Re=>Re.id===H.draggableId);if(!ke)return;const ze=le.current;if(ze?.kind==="split"&&ke.kind==="session"){jr(ke.session.id,null,ze.groupId),k(ze.sessionId,ke.session.id);return}if(ze?.kind==="collaboration"&&ke.kind==="session"){jr(ke.session.id,null,ze.groupId);return}if(H.combine&&ke.kind!=="session"){const Re=se.findIndex(ot=>ot.id===H.combine?.draggableId);if(Re<0)return;H={...H,combine:null,destination:{...H.source,index:Re}}}if(H.combine){const Re=se.find(at=>at.id===H.combine?.draggableId);if(!Re)return;const ot=Re.kind==="workspace"?Re:ke.kind==="workspace"?ke:Re,pr=ot===ke?Re:ke,At=ot.sessionIds[0],Yt=pr.sessionIds[0];At&&Yt&&At!==Yt&&k(At,Yt);return}if(!H.destination||H.source.index===H.destination.index)return;const Ze=[...se],[xt]=Ze.splice(H.source.index,1);if(!xt)return;Ze.splice(H.destination.index,0,xt);const tt=Ze.flatMap(Re=>Re.sessionIds);if($e===void 0){N(tt);return}N(wr.flatMap(Re=>Re.key===$e?tt:Re.sessions.map(ot=>ot.id)))},[wr,fn,ss,jr,k,N]),Yr=T.useCallback(H=>{if(H.reason==="CANCEL"||fn(H)||ss(H))return;if(H.type==="group"){if(!H.destination||H.source.index===H.destination.index)return;N(Kx(wr,H.source.index,H.destination.index));return}const se=H.source.droppableId.replace(/^group-sessions:/,""),$e=wr.find(ze=>ze.key===se);if(!$e)return;const ke=Rc($e.sessions,v,Zt,Qt);if(H.combine||le.current?.kind==="collaboration"||le.current?.kind==="split"){yn(H,ke,se);return}!H.destination||H.destination.droppableId!==H.source.droppableId||yn(H,ke,se)},[Qt,wr,Zt,v,fn,yn,ss,N]),Fr=H=>{const se=Ge===H.id,$e=[{layout:"horizontal",label:ce("tab.splitHorizontal"),icon:Hl},{layout:"vertical",label:ce("tab.splitVertical"),icon:fm},...H.sessionIds.length>=3||H.layout==="grid"?[{layout:"grid",label:ce("tab.splitGrid"),icon:dm}]:[]],ke=H.layout==="vertical"?fm:H.layout==="grid"?dm:Hl,ze=$e.find(Ze=>Ze.layout===H.layout)?.label??ce("tab.splitHorizontal");return a.jsxs("div",{ref:se?Qe:void 0,className:"relative shrink-0",onPointerDown:Ze=>Ze.stopPropagation(),children:[a.jsx("button",{type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${se?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${ce("tab.splitLayout")}: ${ze}`,"aria-haspopup":"menu","aria-expanded":se,title:ce("tab.splitLayout"),onClick:Ze=>{Ze.stopPropagation(),ie(xt=>xt===H.id?null:H.id)},children:a.jsx(ke,{size:12})}),se&&a.jsx("div",{role:"menu","aria-label":ce("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:$e.map(Ze=>{const xt=Ze.icon,tt=Ze.layout===H.layout;return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":tt,"aria-label":Ze.label,title:Ze.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${tt?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:Re=>{Re.stopPropagation(),w(H.sessionIds[0],Ze.layout),ie(null)},children:a.jsx(xt,{size:13})},Ze.layout)})})]})},On=(H,se)=>se&&a.jsx("button",{type:"button",...se,"aria-label":H,title:H,onClick:$e=>$e.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:a.jsx(F8,{size:10})}),As=(H,se,$e=!1,ke=!1,ze)=>{if(se.length<2)return null;const Ze=se.some(At=>At.id===u),xt=[],tt=[],Re=[];for(const At of se){const Yt=c.get(At.id);Yt?.agentStatus==="waiting"||Yt?.agentNeedsReview?xt.push(At):Yt?.agentStatus==="working"?tt.push(At):Yt?.inCopyMode&&Re.push(At)}const ot=H.name?.trim()||`${ce("tab.splitWorkspace")} ${v.findIndex(At=>At.id===H.id)+1}`,pr=Ge===H.id;return a.jsxs("section",{"data-split-workspace":H.id,"aria-label":ot,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":$e?"bg-surface-elevated opacity-90 shadow-lg":xt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":tt.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":Re.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":Ze?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[On(`移动分屏组 ${ot}`,ze),a.jsx(Va,{droppableId:`split-members:${H.id}`,type:"split-member",direction:"vertical",children:(At,Yt)=>a.jsxs("div",{ref:At.innerRef,...At.droppableProps,"data-split-members":!0,className:Yt.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[se.map((at,Xt)=>a.jsx(Ga,{draggableId:`split-member:${at.id}`,index:Xt,disableInteractiveElementBlocking:!0,children:($t,Ft)=>a.jsx("div",{ref:$t.innerRef,...$t.draggableProps,...R?Cr(()=>R(at.id)):{},className:`${Xt===0&&pr?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${Ft.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Gr(at.id)??(at.id===u?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:dn(at,$t.dragHandleProps,!0,Xt===0?Fr(H):void 0)})},at.id)),At.placeholder]})})]})},Ps=(H,se,$e,ke=!1,ze=!1)=>{if(se.length<(H.federated?1:2))return null;const Ze=se.some(ot=>ot.id===u),xt=Ju(H.sessionIds,v),tt=xt.flatMap(ot=>ot.sessionIds),Re=xt.length===1?xt[0]?.workspace:void 0;return a.jsxs("section",{"data-collaboration-group":H.id,"data-collaboration-group-name":H.name,"aria-label":`Agent 工作组:${H.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 ${ze?"bg-primary/15 ring-1 ring-primary/40":ke?"bg-surface-elevated opacity-90 shadow-lg":Ze?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[On(`移动工作组 ${H.name}`,$e),a.jsx("button",{type:"button",className:"absolute -right-1 top-1.5 z-10 inline-flex h-4 w-4 items-center justify-center rounded-sm bg-[var(--chrome-bg)] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:`打开 ${H.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${H.name}`,onClick:ot=>{ot.stopPropagation(),Xe(H.id),He(!0)},children:a.jsx(pm,{size:9})}),a.jsx(Va,{droppableId:`collaboration-members:${H.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(ot,pr)=>a.jsxs("div",{ref:ot.innerRef,...ot.droppableProps,"data-collaboration-members":!0,className:`${pr.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[xt.map(At=>a.jsx("div",{"data-collaboration-split":At.workspace?.id,"data-split-anchor":At.workspace?.sessionIds[0],role:At.workspace?"region":void 0,"aria-label":At.workspace?`${ce("tab.splitWorkspace")} · ${At.sessionIds.length}`:void 0,className:At.workspace&&!Re?`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 ${At.sessionIds.includes(u??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:At.sessionIds.map(Yt=>{const at=Zt.get(Yt);return at?a.jsx(Ga,{draggableId:`collaboration-member:${at.id}`,index:tt.indexOf(at.id),disableInteractiveElementBlocking:!0,children:(Xt,$t)=>a.jsxs("div",{ref:Xt.innerRef,...Xt.draggableProps,"data-collaboration-member":at.id,"data-split-member":lr.has(at.id)?"true":void 0,...R?Cr(()=>R(at.id)):{},className:`${At.workspace&&Yt===At.sessionIds[0]&&Ge===At.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 ${$t.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":$t.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Gr(at.id)??(at.id===u?"bg-surface-elevated/80 text-foreground":lr.has(at.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[dn(at,Xt.dragHandleProps,!0,At.workspace&&Yt===At.sessionIds[0]?Fr(At.workspace):void 0),!At.workspace&&lr.has(at.id)&&a.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${v.find(Ft=>Ft.sessionIds.includes(at.id))?.sessionIds.filter(Ft=>Ft!==at.id).map(Ft=>Zt.get(Ft)?.name??Ft).join("、")} 分屏`,"aria-label":`查看 ${at.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:at.id})),fs()},children:a.jsx(Hl,{size:10})})]})},at.id):null})},At.workspace?.id??At.sessionIds[0])),ot.placeholder]})}),H.remoteSessions?.map(ot=>a.jsxs("button",{type:"button",title:`${ot.serviceLabel??ot.serviceOrigin} · ${ot.serviceConnected===!1?"服务不可达,消息尚未送达":ot.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:()=>{k6(ot.sessionId).catch(()=>{Xe(H.id),He(!0)})},children:[a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ot.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:ot.name}),a.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:ot.serviceLabel??ot.serviceOrigin}),ot.serviceConnected===!1&&a.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},ot.sessionId)),a.jsx("div",{"data-collaboration-background":!0,className:"absolute inset-x-0 bottom-0 h-1.5",title:`工作组:${H.name}`,children:a.jsx("span",{className:"absolute inset-x-0 bottom-0 z-20 hidden rounded-sm bg-surface-elevated px-2 py-1 text-[10px] text-muted-foreground group-data-[sidebar-dragging=true]/collaboration:block",children:"拖入工作组 · 在此移出分屏"})})]})},eo=(H,se,$e)=>a.jsx(Qd,{onBeforeCapture:br,onDragStart:jt,onDragEnd:ke=>jn(ze=>yn(ze,H,$e),ke),children:a.jsx(Va,{droppableId:se,direction:"vertical",isCombineEnabled:!Qr,children:ke=>a.jsxs("div",{ref:ke.innerRef,...ke.droppableProps,"data-sidebar-entity-list-id":se,className:"space-y-0.5",children:[H.map((ze,Ze)=>a.jsx(Ga,{draggableId:ze.id,index:Ze,disableInteractiveElementBlocking:!0,children:(xt,tt)=>a.jsxs("div",{ref:xt.innerRef,...xt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":Ze,className:"relative",children:[Yn(Ze),Ze===H.length-1&&Yn(H.length,"bottom"),ze.kind==="workspace"?As(ze.workspace,ze.members,tt.isDragging,!!tt.combineTargetFor,xt.dragHandleProps):ze.kind==="collaboration"?Ps(ze.group,ze.members,xt.dragHandleProps,tt.isDragging,!!tt.combineTargetFor):a.jsx("div",{...R?Cr(()=>R(ze.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${tt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":tt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Gr(ze.session.id)??(ze.session.id===u?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:dn(ze.session,xt.dragHandleProps)})]})},ze.id)),ke.placeholder]})})}),Rr=a.jsxs(a.Fragment,{children:[a.jsx(rv,{}),a.jsxs("div",{"data-session-sidebar-header":!0,className:"relative z-20 shrink-0 px-3 py-0.5",children:[a.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-3 bottom-0 z-10 h-px bg-border opacity-40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:ce("sidebar.sessions")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length}),js>0&&a.jsx("span",{className:"ml-0.5 flex items-center",children:a.jsx(W6,{count:js,tone:"running",title:ce("agent.aiRunning")})})]})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs("div",{ref:Vt,className:Te?"relative z-20":"relative",children:[a.jsxs("button",{type:"button",onClick:()=>we(H=>!H),className:`relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${Te?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":Te,"aria-haspopup":"menu","aria-label":qe&&V?.latestVersion?`${ce("sidebar.moreActions")}: ${ce("sidebar.updateAvailable",{version:V.latestVersion})}`:ce("sidebar.moreActions"),title:qe&&V?.latestVersion?`${ce("sidebar.moreActions")}: ${ce("sidebar.updateAvailable",{version:V.latestVersion})}`:ce("sidebar.moreActions"),children:[a.jsx(Hc,{size:15}),qe&&a.jsx("span",{className:"absolute right-0.5 top-0.5 z-10 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"})]}),Te&&a.jsxs("div",{ref:te,role:"menu",className:"absolute z-30 w-60 overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",children:[qe&&V?.latestVersion&&a.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.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:a.jsx(hs,{size:13,className:V.status==="installing"||V.status==="restarting"?"animate-spin":""})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-semibold",children:ce("sidebar.updateAvailable",{version:V.latestVersion})}),a.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:V.status==="installing"?ce("sidebar.updateInstalling"):V.status==="ready"?ce("sidebar.updateReady"):V.status==="restarting"?ce("sidebar.updateRestarting"):ce("sidebar.updateFailed")})]})]}),V.status==="ready"&&Y&&a.jsx("button",{type:"button",role:"menuitem",disabled:F,onClick:Y,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:ce("sidebar.updateRestart")}),V.status==="error"&&Z&&a.jsx("button",{type:"button",role:"menuitem",disabled:F,onClick:Z,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:ce("sidebar.updateRetry")})]}),Pe&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":et,onClick:()=>Pe(!et),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",title:ce("sidebar.runningSessionButtonHint"),children:[a.jsx(un,{size:14,className:et?"text-[color:var(--success)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:ce("sidebar.runningSessionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:ce("sidebar.runningSessionButtonHint")})]}),a.jsx(Wa,{checked:et,size:"sm"})]}),P&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{we(!1),P()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(h8,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:ce("sidebar.subscriptionQuota")})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{we(!1),Xe(null),He(!0)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(pm,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"Agent 工作台"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{we(!1),sv()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(nv,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"服务与设备"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{we(!1),D()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(g9,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:ce("sidebar.settings")})]}),fe&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{we(!1),fe()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${be?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[be?a.jsx(qc,{size:14}):a.jsx(Vc,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:ce(be?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!Ie||be)&&a.jsx("button",{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":ce("common.close"),children:a.jsx(vs,{size:14})})]})]})]}),Ue&&a.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:[a.jsx("span",{className:"min-w-0 flex-1",children:Ue}),a.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>bt(null),children:a.jsx(vs,{size:14})})]}),a.jsxs("div",{className:"relative z-10 min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[De.length>0&&a.jsxs("section",{className:"mb-2 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":ce("sidebar.recoverableSessions"),children:[a.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[a.jsx(k0,{size:12,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:ce("sidebar.recoverableSessions")}),a.jsx("span",{className:"text-muted-foreground",children:De.length}),ae&&a.jsx("button",{type:"button",onClick:ae,disabled:pe,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":ce("sidebar.refreshRecoverableSessions"),title:ce("sidebar.refreshRecoverableSessions"),children:a.jsx(hs,{size:11,className:pe?"animate-spin":""})})]}),a.jsx("div",{className:"space-y-0.5",children:De.slice(0,4).map(H=>{const se=H.friendlyName?.trim()||H.label?.trim()||H.name,$e=Ea(H.cwd??null),ke=Se===H.name;return a.jsxs("button",{type:"button",disabled:Se!==null,onClick:()=>Mn(H),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":ce("sidebar.restoreRecoverableSession",{name:se}),title:H.cwd||H.name,children:[a.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?a.jsx(un,{size:12,className:"animate-spin"}):a.jsx(U0,{size:12})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:se}),a.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[H.program,$e].filter(Boolean).join(" · ")||`tmux:${H.name}`})]}),a.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:ce(ke?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},H.name)})})]}),i.length===0?a.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[a.jsx($o,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-[12px] text-muted-foreground",children:ce("sidebar.noSessions")})]}):dr.length===0&&v.length===0?a.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:a.jsx("p",{className:"text-[12px] text-muted-foreground",children:ce("sidebar.noMatchingSessions")})}):kt?a.jsx("div",{className:"space-y-1.5",children:a.jsx(Qd,{onBeforeCapture:br,onDragStart:jt,onDragEnd:H=>jn(Yr,H),children:a.jsx(Va,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:H=>a.jsxs("div",{ref:H.innerRef,...H.droppableProps,className:"space-y-1.5",children:[wr.map((se,$e)=>{const ke=Oe.has(se.key),ze=Rc(se.sessions,v,Zt,Qt);let Ze=0,xt=0;for(const Re of se.sessions){const ot=c.get(Re.id);ot?.agentStatus==="working"&&(Ze+=1),(ot?.agentStatus==="waiting"||ot?.agentNeedsReview)&&(xt+=1)}const tt=se.key==="";return a.jsx(Ga,{draggableId:`sidebar-group:${se.key||"__ungrouped__"}`,index:$e,isDragDisabled:tt,disableInteractiveElementBlocking:!0,children:(Re,ot)=>a.jsxs("div",{ref:Re.innerRef,...Re.draggableProps,className:`rounded-md transition-colors ${ot.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[a.jsxs("button",{type:"button",...tt?{}:Re.dragHandleProps,onClick:()=>{Nt(se.key),st.current.delete(se.key)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${tt?"":"cursor-grab active:cursor-grabbing"}`,title:se.key||se.label,children:[a.jsx(zd,{size:13,className:`shrink-0 transition-transform ${ke?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:se.label}),Ze>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),xt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),a.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:se.sessions.length})]}),!ke&&a.jsx("div",{className:"mt-0.5 pl-2",children:a.jsx(Va,{droppableId:`group-sessions:${se.key}`,type:"session",direction:"vertical",isCombineEnabled:!Qr,children:pr=>a.jsxs("div",{ref:pr.innerRef,...pr.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${se.key}`,className:"space-y-0.5",children:[ze.map((At,Yt)=>a.jsx(Ga,{draggableId:At.id,index:Yt,disableInteractiveElementBlocking:!0,children:(at,Xt)=>a.jsxs("div",{ref:at.innerRef,...at.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":Yt,className:"relative",children:[Yn(Yt),Yt===ze.length-1&&Yn(ze.length,"bottom"),At.kind==="workspace"?As(At.workspace,At.members,Xt.isDragging,!!Xt.combineTargetFor,at.dragHandleProps):At.kind==="collaboration"?Ps(At.group,At.members,at.dragHandleProps,Xt.isDragging,!!Xt.combineTargetFor):a.jsx("div",{...R?Cr(()=>R(At.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Xt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Xt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Gr(At.session.id)??(At.session.id===u?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:dn(At.session,at.dragHandleProps)})]})},At.id)),pr.placeholder]})})})]})},se.key||"__ungrouped__")}),H.placeholder]})})})}):eo(hn,"sidebar-entities")]}),ve&&a.jsx(pB,{directories:i.flatMap(H=>{const se=c.get(H.id)?.cwd;return se?[se]:[]}),tmuxAvailable:he,options:We,agents:it,selectedAgent:ir,detecting:dt,resumeHistory:Ce,resumeHistoryLoading:q,resumeHistoryPendingId:Ve,resumeHistoryError:ht,onRefreshAgents:()=>{Bt().catch(()=>{})},onSelectAgent:H=>{Et(H).catch(()=>{})},onLaunchAgent:ws,onResumeHistory:H=>{Hn(H)},onRemoveResumeHistory:H=>{tn(H)},onClose:()=>ft(!1),onOptionsChange:vt}),Rt&&a.jsx(yB,{activeSessionId:u,initialCollaborationGroupId:K,defaultSessionMode:Ee,onClose:()=>{He(!1),Xe(null)},onNewSession:H=>h(H)}),!ve&&a.jsx("div",{className:"relative z-10 shrink-0 border-t border-border bg-[var(--chrome-bg)] p-2",children:a.jsxs("div",{className:`grid gap-1.5 ${ir?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[a.jsxs("button",{type:"button",onClick:ns,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] ${ir?"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:ce("sidebar.newSession"),"aria-label":ce("sidebar.newSession"),children:[a.jsx($o,{size:15,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:"Terminal"})]}),ir&&a.jsxs("button",{type:"button",onClick:zn,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:ce("sidebar.newSessionWithAgent",{agent:ir.displayName}),"aria-label":ce("sidebar.newSessionWithAgent",{agent:ir.displayName}),children:[a.jsx(Kl,{agent:ir,size:15}),a.jsx("span",{className:"truncate",children:ir.displayName})]}),a.jsx("button",{type:"button",onClick:Pn,className:"inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/20 transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:ce("sidebar.moreLaunchOptions"),"aria-label":ce("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:a.jsx(wl,{size:15,className:"transition-transform duration-200"})})]})})]});return be?a.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:Rr}):a.jsx($6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,push:Ie,children:Rr})}const eb=()=>ov(()=>import("./RightSidebar-DVtyAiqo.js").then(e=>e.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.RightSidebar})),jB=T.lazy(eb);function T5(e){const t=T.useRef(!1);T.useEffect(()=>{const i=navigator.connection;if(!(i?.saveData||/2g|3g/.test(i?.effectiveType??"")))return Dp(()=>{eb().catch(()=>{})},3e3)},[]);const{t:r}=an();(e.isOpen||e.pinned)&&(t.current=!0);const s=a.jsx($6,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-3 px-3 py-2",children:[a.jsxs("div",{"aria-hidden":"true",className:"flex min-w-0 flex-1 items-center gap-2 motion-safe:animate-pulse",children:[a.jsx("div",{className:"h-7 w-7 rounded-lg bg-surface-elevated"}),a.jsx("div",{className:"h-2 w-28 max-w-[50%] rounded-full bg-surface-elevated"})]}),a.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:a.jsx(vs,{size:14})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden bg-surface px-4 py-5",role:"status","aria-label":r("common.loading"),children:[a.jsx("span",{className:"sr-only",children:r("common.loading")}),a.jsxs("div",{"aria-hidden":"true",className:"space-y-5 motion-safe:animate-pulse",children:[a.jsxs("div",{className:"mb-7 flex items-center gap-2",children:[a.jsx("div",{className:"h-2 w-16 rounded-full bg-surface-elevated"}),a.jsx("div",{className:"h-4 w-6 rounded-md bg-surface-2"})]}),["w-3/5","w-4/5","w-1/2","w-2/3","w-2/5"].map((i,u)=>a.jsxs("div",{className:"flex items-center gap-3",style:{opacity:1-u*.15},children:[a.jsx("div",{className:"h-4 w-4 shrink-0 rounded bg-surface-elevated"}),a.jsx("div",{className:`h-2 rounded-full bg-surface-elevated ${i}`})]},i))]})]})]})});return t.current?a.jsx(T.Suspense,{fallback:s,children:a.jsx(jB,{...e})}):s}function PB(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function OB(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function FB(e){if(!e)return"";const t=new Date(e),r=Date.now(),s=t.getTime()-r;if(s<=0)return"";const i=Math.floor(s/6e4),u=Math.floor(i/60),c=Math.floor(u/24),h=u%24,p=i%60,m=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return c>0?b=`${c}d ${h}h`:h>0?b=`${h}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${m} ${x})`}function UB(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function $B({result:e}){const{t}=an(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),s=e.windows.filter(h=>h.percent>0||h.resetAt),i=r.length>0?r.map(h=>h.label).join(" · "):"",u=!!e.error;let c=null;return!u&&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)}%`),a.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[a.jsx("span",{className:"shrink-0",children:UB(e.slug)}),a.jsx("span",{className:"truncate",children:e.displayName}),i&&a.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:i})]}),c&&a.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:c})]}),s.length>0?a.jsx("div",{className:"mt-2.5 space-y-2",children:s.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[a.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),a.jsx("div",{className:"flex-1",children:a.jsx("div",{className:"h-2 rounded-full",style:{background:OB(h.percent)},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:PB(h.percent)}})})}),a.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&a.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:FB(h.resetAt)})]},h.label)})}):u?a.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function zB({isOpen:e,onClose:t}){const{t:r}=an(),[s,i]=T.useState([]),[u,c]=T.useState(!1),h=async(x=!1)=>{c(!0);try{const b=x?await av():await lv();i(b.providers||[])}catch{}finally{c(!1)}};if(T.useEffect(()=>{e&&h()},[e]),T.useEffect(()=>{if(!e)return;const x=b=>{const v=b.detail;Array.isArray(v)&&i(v)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=s.filter(x=>!x.error),m=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),a.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:[a.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:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>h(!0),disabled:u,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:a.jsx(hs,{size:15,className:u?"animate-spin":""})}),a.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:a.jsx(vs,{size:17})})]})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[u&&p.length===0?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(hs,{size:24,className:"animate-spin text-muted-foreground"})}):p.length===0?a.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[a.jsx("p",{children:r("quota.noProviders")}),a.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):a.jsx("div",{className:"space-y-2.5",children:p.map(x=>a.jsx($B,{result:x},x.slug))}),m&&a.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:m.toLocaleTimeString()})})]})]})]})}const C5=[{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~"}],HB=2,WB=20;function GB({label:e}){return a.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 VB({value:e,onChange:t,placeholder:r}){const{t:s}=an(),[i,u]=_.useState(""),c=b=>{const v=[];let w="",I=!1;const k=()=>{const R=w.trim();R&&v.push(R),w=""};for(let R=0;R<b.length;R+=1){const D=b[R];if(!I&&D==="/"&&w.trim().length===0){I=!0,w+=D;continue}if(I){if(w+=D,D==="/"&&b[R-1]!=="\\"&&w.length>1){for(;R+1<b.length&&/[gimsuy]/.test(b[R+1]??"");)R+=1,w+=b[R];k(),I=!1}continue}if(D===","||/\s/.test(D)){k();continue}w+=D}if(k(),v.length===0)return;const N=[...e];for(const R of v){const D=t3(R);D&&(N.includes(D)||N.push(D))}t(N),u("")},h=b=>{t(e.filter(v=>v!==b))},p=i.trim(),m=p.length>0&&Ng(p),x=m&&!_d(p);return a.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const v=Ng(b),w=v&&!_d(b);return a.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${w?"bg-destructive/15 text-destructive":v?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:v?w?s("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[v&&a.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,a.jsx("button",{type:"button",onClick:()=>h(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":s("toolbarPresets.removeAction",{name:b}),children:a.jsx(vs,{size:12})})]},b)}),a.jsx("input",{type:"text",value:i,onChange:b=>u(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!m?(b.preventDefault(),c(i)):b.key==="Backspace"&&i.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>c(i),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${m?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function qB({value:e,min:t,max:r,onChange:s}){const{t:i}=an();return a.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[a.jsx("button",{type:"button",onClick:()=>s(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":i("common.decrease"),children:a.jsx(Y8,{size:14})}),a.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),a.jsx("button",{type:"button",onClick:()=>s(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":i("common.increase"),children:a.jsx(Xi,{size:14})})]})}const ZB=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:s,onAddPreset:i,onRemovePreset:u,onResetDefaults:c})=>{const{t:h}=an(),p=e.find(R=>R.id===t)??e[0]??null,[m,x]=_.useState(null);if(!p)return null;const b=p.actions.length>0,v=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?p.actions.map((R,D)=>({id:R.id,label:rp(R,D)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(R=>({id:R,label:R}))],w=r3(v,p.rowLayout),I=(R,D)=>{s(p.id,P=>{const V=P.actions.findIndex(Z=>Z.id===R);if(V===-1)return P;const F=V+D;if(F<0||F>=P.actions.length)return P;const Y=[...P.actions];return[Y[V],Y[F]]=[Y[F],Y[V]],{...P,actions:Y}})},k=p.rowLayout.reduce((R,D)=>R+D,0),N=1+(p.includeAlt?1:0);return a.jsxs("div",{className:"space-y-4",children:[a.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:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",k," slot",k===1?"":"s"]})]}),a.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:w.map((R,D)=>{const P=R.items[0]?.kind==="preset",V=Math.max(2,R.columns),F=P?`${n3}px repeat(${Math.max(1,V-1)}, minmax(0, 1fr))`:`repeat(${V}, minmax(0, 1fr))`;return a.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:F},children:R.items.map(Y=>Y.kind==="preset"?a.jsx(s3,{mode:"auto",presetLabel:Y.label,title:`Auto preset · ${Y.label}`,disabled:!0},Y.id):a.jsx(GB,{label:Y.label},Y.id))},`preview-row-${D}`)})}),p.actions.length>k-N&&a.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",onClick:i,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:[a.jsx(Xi,{size:14}),h("toolbarPresets.new")]}),a.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:[a.jsx(hs,{size:14}),h("toolbarPresets.reset")]})]})]}),a.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(R=>a.jsxs("button",{type:"button",onClick:()=>r(R.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${R.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[R.label,R.actions.length>0&&a.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:R.actions.length})]},R.id))})]}),a.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:p.label,onChange:R=>s(p.id,D=>({...D,label:R.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"&&a.jsx("button",{type:"button",onClick:()=>u(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:a.jsx(Ji,{size:14})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),a.jsx(VB,{value:p.programs,onChange:R=>s(p.id,D=>({...D,programs:R})),placeholder:h("toolbarPresets.programsPlaceholder")}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),a.jsxs("button",{type:"button",onClick:()=>s(p.id,R=>({...R,includeAlt:!R.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:[a.jsxs("span",{children:[a.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),a.jsx(Wa,{checked:p.includeAlt})]}),a.jsxs("button",{type:"button",onClick:()=>s(p.id,R=>({...R,showOnDesktop:!R.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:[a.jsxs("span",{children:[a.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),a.jsx(Wa,{checked:p.showOnDesktop===!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),a.jsxs("button",{type:"button",onClick:()=>s(p.id,R=>({...R,rowLayout:[...Vp(R.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:[a.jsx(Xi,{size:12}),h("toolbarPresets.addRow")]})]}),a.jsx("div",{className:"space-y-2",children:p.rowLayout.map((R,D)=>a.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[a.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:D+1})}),a.jsx("div",{className:"flex-1"}),a.jsx(qB,{value:R,min:HB,max:WB,onChange:P=>s(p.id,V=>({...V,rowLayout:V.rowLayout.map((F,Y)=>Y===D?P:F)}))}),p.rowLayout.length>1&&a.jsx("button",{type:"button",onClick:()=>s(p.id,P=>({...P,rowLayout:P.rowLayout.filter((V,F)=>F!==D)})),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:D+1}),children:h("toolbarPresets.del")})]},`row-${D}`))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),a.jsxs("button",{type:"button",onClick:()=>{const R=`${p.id}-action-${Date.now()}`;s(p.id,D=>({...D,actions:[...D.actions,{id:R,label:`Key ${D.actions.length+1}`,sequence:""}]})),x(R)},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:[a.jsx(Xi,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&a.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((R,D)=>{const P=m===R.id;return a.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${P?"ring-1 ring-accent/40":""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("button",{type:"button",onClick:()=>I(R.id,-1),disabled:D===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:a.jsx(K5,{size:12})}),a.jsx("button",{type:"button",onClick:()=>I(R.id,1),disabled:D===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:a.jsx(e8,{size:12})})]}),a.jsxs("button",{type:"button",onClick:()=>x(P?null:R.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:rp(R,D)}),a.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[R.sequence?R.sequence:h("toolbarPresets.noSequence"),R.doubleTapSequence&&a.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",R.doubleTapSequence]})]})]}),a.jsx("button",{type:"button",onClick:()=>s(p.id,V=>({...V,actions:V.actions.filter(F=>F.id!==R.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:R.label}),children:a.jsx(Ji,{size:14})})]}),P&&a.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),a.jsx("input",{type:"text",value:R.label,onChange:V=>s(p.id,F=>({...F,actions:F.actions.map(Y=>Y.id===R.id?{...Y,label:V.target.value}:Y)})),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"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),a.jsx("input",{type:"text",value:R.sequence,onChange:V=>s(p.id,F=>({...F,actions:F.actions.map(Y=>Y.id===R.id?{...Y,sequence:V.target.value}:Y)})),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}),a.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:C5.map(V=>a.jsx("button",{type:"button",onClick:()=>s(p.id,F=>({...F,actions:F.actions.map(Y=>Y.id===R.id?{...Y,sequence:V.sequence}:Y)})),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:V.label},V.label))})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!R.doubleTapSequence&&a.jsx("button",{type:"button",onClick:()=>s(p.id,V=>({...V,actions:V.actions.map(F=>F.id===R.id?{...F,doubleTapSequence:""}:F)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),R.doubleTapSequence!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:R.doubleTapSequence,onChange:V=>s(p.id,F=>({...F,actions:F.actions.map(Y=>Y.id===R.id?{...Y,doubleTapSequence:V.target.value}:Y)})),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}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[C5.map(V=>a.jsx("button",{type:"button",onClick:()=>s(p.id,F=>({...F,actions:F.actions.map(Y=>Y.id===R.id?{...Y,doubleTapSequence:(Y.doubleTapSequence??"")+V.sequence}:Y)})),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:V.label},V.label)),a.jsx("button",{type:"button",onClick:()=>s(p.id,V=>({...V,actions:V.actions.map(F=>{if(F.id!==R.id)return F;const{doubleTapSequence:Y,...Z}=F;return Z})})),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")})]})]})]})]})]},R.id)})]})]})]})},YB={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function KB(){const{t:e}=an(),[t,r]=_.useState(null),[s,i]=_.useState(null),[u,c]=_.useState(null),[h,p]=_.useState(null),[m,x]=_.useState(!1),[b,v]=_.useState(!1),[w,I]=_.useState(""),[k,N]=_.useState(""),[R,D]=_.useState(null),[P,V]=_.useState([]),[F,Y]=_.useState([]),[Z,he]=_.useState(null),[Ee,Ie]=_.useState(new Set),[be,et]=_.useState(null),[Pe,fe]=_.useState("auto"),[De,pe]=_.useState({}),[ae,ce]=_.useState(null),[Te,we]=_.useState(null),[Ge,ie]=_.useState(10),[ve,ft]=_.useState(""),[Rt,He]=_.useState(""),[K,Xe]=_.useState(12e3),[Ce,z]=_.useState(null),[q,ye]=_.useState(null),Ve=_.useCallback(async()=>{const[te,Qe,qe,kt]=await Promise.allSettled([cv(),uv(),Rp(),ac()]);if(r(te.status==="fulfilled"?te.value:[]),Qe.status==="fulfilled"){const Oe=Qe.value;V(Oe.plugins??[]),Y(Oe.errors??[])}else V([]),Y([]);if(qe.status==="fulfilled"){const Oe=qe.value;Ie(new Set(Oe.autoRenameAgents??[])),fe(Oe.autoRenameNamer??"auto"),pe(Oe.autoRenameModels??{}),ie(Oe.autoRenameIntervalMinutes??10),ft(Oe.autoRenamePromptPreference??""),He(Oe.autoRenamePromptPreference??""),Xe(Oe.autoRenamePromptPayloadChars??12e3)}else Ie(new Set);ce(kt.status==="fulfilled"?kt.value:[])},[]);_.useEffect(()=>{Ve()},[Ve]);const pt=async(te,Qe)=>{i(te),c(null);try{Qe==="install"?(await dv(te)).devMode&&p(te):(await hv(te),h===te&&p(null)),await Ve()}catch(qe){c(qe instanceof Error?qe.message:String(qe))}finally{i(null)}},ht=te=>e(te==="installed"?"settings.agentHooksInstalled":te==="outdated"?"settings.agentHooksOutdated":te==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),It=async()=>{D(null);let te;try{te=JSON.parse(k)}catch{D("Invalid JSON");return}try{await bv(te),N(""),x(!1),await Ve()}catch(Qe){if(Qe instanceof yv&&Qe.migration){Y(qe=>[{slug:typeof te.slug=="string"?te.slug:"manifest.json",errors:Qe.message.split(`
134
- `),code:Qe.code,migration:Qe.migration},...qe.filter(kt=>kt.slug!==te.slug)]);return}D(Qe instanceof Error?Qe.message:String(Qe))}},Se=async()=>{const te=w.trim();if(te){z("install"),D(null);try{await fv(te),I(""),v(!1),await Ve()}catch(Qe){D(Qe instanceof Error?Qe.message:String(Qe))}finally{z(null)}}},ge=async te=>{z(`remove:${te}`);try{await xv(te),ye(Qe=>Qe?.slug===te?null:Qe),await Ve()}catch(Qe){c(Qe instanceof Error?Qe.message:String(Qe))}finally{z(null)}},Ue=async te=>{z(`check:${te}`),c(null);try{await gv(te),await Ve()}catch(Qe){c(Qe instanceof Error?Qe.message:String(Qe))}finally{z(null)}},bt=async te=>{z(`update:${te}`),c(null);try{const Qe=await mv(te),qe=[Qe.hookWarning,Qe.titleWarning].filter(Boolean).join(" ");qe&&c(qe),ye(kt=>kt?.slug===te?null:kt),await Ve()}catch(Qe){c(Qe instanceof Error?Qe.message:String(Qe))}finally{z(null)}},Ke=async te=>{z(`doctor:${te}`),c(null),ye(null);try{const Qe=await pv(te);ye(Qe),ce(await ac())}catch(Qe){c(Qe instanceof Error?Qe.message:String(Qe))}finally{z(null)}},Mt=async te=>{const Qe=te.migration?.aiPrompt??te.errors.join(`
135
- `);try{await navigator.clipboard.writeText(Qe),he(te.slug),window.setTimeout(()=>he(qe=>qe===te.slug?null:qe),1800)}catch{D(Qe)}},We=async te=>{if(be)return;const Qe=Ee,qe=new Set(Qe);qe.has(te)?qe.delete(te):qe.add(te),Ie(qe),et(te),c(null);try{const kt=await ia({autoRenameAgents:[...qe]});Ie(new Set(kt.autoRenameAgents??[])),ce(await ac(!0))}catch(kt){Ie(Qe),c(kt instanceof Error?kt.message:String(kt))}finally{et(null)}},vt=async te=>{const Qe=Pe;fe(te),we("namer"),c(null);try{const qe=await ia({autoRenameNamer:te});fe(qe.autoRenameNamer??"auto"),ce(await ac(!0))}catch(qe){fe(Qe),c(qe instanceof Error?qe.message:String(qe))}finally{we(null)}},ir=async(te,Qe)=>{const qe=De,kt={...qe};Qe?kt[te]=Qe:delete kt[te],pe(kt),we(te),c(null);try{const Oe=await ia({autoRenameModels:kt});pe(Oe.autoRenameModels??{})}catch(Oe){pe(qe),c(Oe instanceof Error?Oe.message:String(Oe))}finally{we(null)}},it=async te=>{const Qe=Ge;ie(te),we("interval"),c(null);try{const qe=await ia({autoRenameIntervalMinutes:te});ie(qe.autoRenameIntervalMinutes??10)}catch(qe){ie(Qe),c(qe instanceof Error?qe.message:String(qe))}finally{we(null)}},dt=async()=>{const te=ve.trim();if(te!==Rt){we("preference"),c(null);try{const qe=(await ia({autoRenamePromptPreference:te})).autoRenamePromptPreference??"";ft(qe),He(qe)}catch(Qe){ft(Rt),c(Qe instanceof Error?Qe.message:String(Qe))}finally{we(null)}}},Bt=async te=>{const Qe=Math.max(1e3,Math.min(64e3,Math.round(te||12e3))),qe=K;Xe(Qe),we("payload-limit"),c(null);try{const kt=await ia({autoRenamePromptPayloadChars:Qe});Xe(kt.autoRenamePromptPayloadChars??12e3)}catch(kt){Xe(qe),c(kt instanceof Error?kt.message:String(kt))}finally{we(null)}},Et=new Set(P.map(te=>te.slug)),Vt=q?{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")}[q.status]:"";return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),a.jsxs("select",{value:Pe,disabled:Te!==null,onChange:te=>{vt(te.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:[a.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),ae?.filter(te=>te.available).map(te=>a.jsx("option",{value:te.slug,children:te.displayName},te.slug))]})]}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),a.jsx("select",{value:Ge,disabled:Te!==null,onChange:te=>{it(Number(te.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(te=>a.jsxs("option",{value:te,children:[te," ",e("settings.agentAutoRenameMinutes")]},te))})]}),a.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),a.jsx("textarea",{value:ve,maxLength:2e3,rows:3,disabled:Te!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:te=>ft(te.target.value),onBlur:()=>{dt()},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"}),a.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:Te==="preference"?e("settings.saving"):`${ve.length}/2000`})]}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),a.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:K,disabled:Te!==null,onChange:te=>Xe(Number(te.target.value)),onBlur:te=>{Bt(Number(te.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"})]})]}),a.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),a.jsx("button",{type:"button",onClick:async()=>{ce(null);try{ce(await ac(!0))}catch{ce([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:a.jsx(hs,{size:11,className:ae===null?"animate-spin":""})})]}),ae?.filter(te=>te.available).map(te=>{const Qe=te.models.find(qe=>qe.id===te.recommendedModel);return a.jsxs("label",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:te.displayName}),a.jsxs("select",{value:De[te.slug]??"",disabled:Te!==null,onChange:qe=>{ir(te.slug,qe.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:[a.jsx("option",{value:"",children:Qe?`${e("settings.agentAutoRenameAutomatic")} · ${Qe.displayName}`:e("settings.agentAutoRenameCliDefault")}),te.models.map(qe=>a.jsx("option",{value:qe.id,children:qe.displayName},qe.id))]})]},te.slug)}),ae?.length===0&&a.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx(un,{size:12,className:"animate-spin"})," …"]}),t?.map(te=>{const Qe=s===te.slug,qe=te.state!=="not-installed",kt=Et.has(te.slug);return a.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx(Kl,{agent:{slug:te.slug,displayName:te.displayName,accentColor:te.accentColor??"#878580",icon:te.icon,isPlugin:kt,iconMode:te.iconMode,iconVersion:te.iconVersion??void 0},size:18}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium text-foreground",children:te.displayName}),kt&&a.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"}),a.jsxs("span",{className:`text-[10px] ${YB[te.state]}`,children:[te.state==="installed"&&a.jsx(um,{size:10,className:"mr-0.5 inline"}),(te.state==="outdated"||te.state==="needs-approval")&&a.jsx(Y5,{size:10,className:"mr-0.5 inline"}),ht(te.state)]})]}),a.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:te.targetDisplay,children:[e("settings.agentHooksTarget")," ",te.targetDisplay]}),h===te.slug&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),te.state==="needs-approval"&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",disabled:be!==null,onClick:()=>{We(te.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":Ee.has(te.slug),title:e("settings.agentAutoRenameToggle"),children:[a.jsx("span",{children:e("settings.agentAutoRenameShort")}),a.jsx(Wa,{checked:Ee.has(te.slug),disabled:be!==null,size:"sm"})]}),a.jsxs("button",{type:"button",disabled:Qe,onClick:()=>{pt(te.slug,qe?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${qe?"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:[Qe?a.jsx(un,{size:11,className:"animate-spin"}):qe?a.jsx(Ji,{size:11}):te.state==="outdated"?a.jsx(hs,{size:11}):a.jsx(Gc,{size:11}),Qe?"…":qe?e("settings.agentHooksUninstall"):te.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},te.slug)}),u&&a.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:u}),a.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),a.jsxs("button",{type:"button",onClick:()=>v(!b),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:[a.jsx(Xi,{size:11}),e("settings.agentPluginAdd")]})]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),b&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:w,onChange:te=>I(te.target.value),onKeyDown:te=>{te.key==="Enter"&&Se()},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")}),a.jsxs("button",{type:"button",disabled:!w.trim()||Ce!==null,onClick:()=>{Se()},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:[Ce==="install"?a.jsx(un,{size:11,className:"animate-spin"}):a.jsx(Gc,{size:11}),e("settings.agentPluginInstallPackage")]})]}),a.jsx("button",{type:"button",onClick:()=>x(!m),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),P.map(te=>{const Qe=te.revision?.slice(0,8),qe=Ce?.endsWith(`:${te.slug}`)===!0;return a.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"truncate",children:te.displayName}),te.updateAvailable&&a.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),a.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:te.source??void 0,children:[te.source??e("settings.agentPluginManualSource"),Qe?` · ${Qe}`:""]})]}),a.jsxs("button",{type:"button",disabled:Ce!==null,onClick:()=>{Ke(te.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:[Ce===`doctor:${te.slug}`?a.jsx(un,{size:10,className:"animate-spin"}):a.jsx(v9,{size:10}),e("settings.agentPluginDoctor")]}),te.updateSupported&&a.jsxs("button",{type:"button",disabled:Ce!==null,onClick:()=>{te.updateAvailable?bt(te.slug):Ue(te.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:[qe?a.jsx(un,{size:10,className:"animate-spin"}):a.jsx(hs,{size:10}),te.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),a.jsx("button",{type:"button",disabled:Ce!==null,onClick:()=>{ge(te.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:a.jsx(Ji,{size:11})})]},te.slug)}),q&&a.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${q.status==="ok"||q.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:[a.jsxs("div",{className:"font-medium",children:[q.displayName,": ",Vt]}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:q.models.length>0?`${q.models.length} ${e("settings.agentPluginDoctorModels")}${q.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${q.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),q.error&&a.jsx("div",{className:"mt-1 break-words",children:q.error}),q.warnings.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:q.warnings.map(te=>a.jsxs("div",{children:["• ",te]},te))}),q.nextSteps.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:q.nextSteps.map(te=>a.jsxs("div",{children:["→ ",te]},te))})]}),F.map(te=>a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"font-medium",children:[te.slug,": ",te.code??e("settings.agentPluginInvalid")]}),a.jsxs("button",{type:"button",onClick:()=>{Mt(te)},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:[Z===te.slug?a.jsx(um,{size:10}):a.jsx(X5,{size:10}),Z===te.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),a.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:te.errors.join(`
136
- `)}),te.migration?.guideCommand&&a.jsx("code",{className:"mt-1 block select-all text-foreground",children:te.migration.guideCommand})]},te.slug)),b&&m&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("textarea",{value:k,onChange:te=>N(te.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:`{
137
- "version": 2,
138
- "slug": "my-agent",
139
- "displayName": "My Agent",
140
- "aliases": ["my-agent"],
141
- "accentColor": "#4385BE",
142
- "statuses": [
143
- { "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
144
- { "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
145
- { "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
146
- ],
147
- "hooks": {
148
- "target": "~/.my-agent/settings.json",
149
- "events": [
150
- { "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
151
- { "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
152
- { "hook": "Stop", "event": "stop", "status": "complete" }
153
- ]
154
- }
155
- }`}),R&&a.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:R}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{It()},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:[a.jsx(T8,{size:11}),e("settings.agentPluginCreate")]}),a.jsx("button",{type:"button",onClick:()=>{x(!1),N(""),D(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function XB({state:e,pending:t,onCheck:r,onConfirmRestart:s,desktopState:i,desktopPending:u=!1,onCheckDesktop:c,onInstallDesktop:h}){const{t:p}=an(),m=e?.status??"idle",x=t||m==="checking"||m==="installing"||m==="restarting",b=m==="ready"&&!!e?.latestVersion,v=m==="checking"?p("settings.updateChecking"):m==="installing"?p("sidebar.updateInstalling"):m==="ready"?p("sidebar.updateReady"):m==="restarting"?p("sidebar.updateRestarting"):m==="current"?p("settings.updateCurrent"):m==="error"?e?.error||p("sidebar.updateFailed"):p("settings.updateHint"),w=i?.status??"idle",I=u||w==="checking"||w==="downloading"||w==="installing",k=w==="ready",N=w==="unsupported"?p("settings.desktopUpdateUnsupported"):w==="checking"?p("settings.desktopUpdateChecking"):w==="current"?p("settings.desktopUpdateCurrent"):w==="downloading"?p("settings.desktopUpdateDownloading"):w==="ready"?p("settings.desktopUpdateReady"):w==="installing"?p("settings.desktopUpdateInstalling"):w==="error"&&i?.error||p("settings.desktopUpdateHint");return a.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[a.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:p("settings.updateTitle")}),a.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.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:a.jsx(hs,{size:15,className:x?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.updateRuntimeTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:v}),e&&a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:b&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),b?a.jsx("button",{type:"button",disabled:x,onClick:s,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:p("sidebar.updateRestart")}):a.jsx("button",{type:"button",disabled:x,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:p(m==="checking"?"settings.updateCheckingShort":m==="installing"?"settings.updateInstallingShort":m==="error"?"sidebar.updateRetry":m==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),i&&a.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${k?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(hs,{size:15,className:I?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.desktopUpdateTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:N}),a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:k&&i.latestVersion?`${i.currentVersion} → ${i.latestVersion}`:`v${i.currentVersion}`})]})]}),k?a.jsx("button",{type:"button",disabled:I||!h,onClick:h,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:p("settings.desktopUpdateRestart")}):a.jsx("button",{type:"button",disabled:I||w==="unsupported"||!c,onClick:c,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:p(w==="checking"?"settings.updateCheckingShort":w==="current"||w==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]})]})}const Ip="mobile-session-destroy";function JB(e,t){return t&&e.type==="session"&&e.destination?.droppableId===Ip}const lo="termdock-program-rules-cache",ed="termdock-toolbar-presets-cache",Mc="termdock-settings-cache",S5="termdock-color-theme",_5="termdock:right-sidebar:file-preview-open-by-session:v2",Nc="termdock:running-session-button-enabled:v1",eQ=60,L5=320,I5=420,na=8;function k5(e,t,r){return Math.min(Math.max(e,t),r)}function E5(e){if(typeof window>"u")return{left:na,top:na};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),s=e?.x??t,i=e?.y??r,u=Math.max(na,window.innerWidth-L5-na),c=Math.max(na,window.innerHeight-I5-na);return{left:k5(s+na,na,u),top:k5(i+na,na,c),width:L5,maxHeight:`min(${I5}px, calc(100vh - ${na*2}px))`}}function tQ(e){return e==="dark"||e==="light"}function rQ(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 s=r;return typeof s.updatedAt=="number"&&Number.isFinite(s.updatedAt)})}function Qf(e){const t=Object.entries(e).filter(([r,s])=>r&&Number.isFinite(s.updatedAt)).sort(([,r],[,s])=>s.updatedAt-r.updatedAt).slice(0,eQ);return Object.fromEntries(t)}function nQ(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 sQ(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function iQ(e,t){const r=Kc(),s=new Set(m_()),i=Array.isArray(e)?e:[],u=M0(i),c=t<Pc;if(u.length===0)return r;if(c){const p=new Map(u.map(v=>[v.id,v])),m=new Map(i.map(v=>[typeof v.id=="string"?v.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",v])),x=u.filter(v=>!s.has(v.id));return[...r.map(v=>{const w=p.get(v.id),I=m.get(v.id);return w?{...v,rowLayout:w.rowLayout,showOnDesktop:typeof I?.showOnDesktop=="boolean"?I.showOnDesktop:v.showOnDesktop}:v}),...x]}const h=new Set(u.map(p=>p.id));return[...u,...r.filter(p=>!h.has(p.id))]}function oQ(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const aQ={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},lh="__termdockOverlay",ch="__termdockBaseAnchor",uh="__termdockBaseGuard",lQ=3,R5=250,cQ="termdock-notification-target-v1",M5="/__termdock-notification-target",N5=3e4;function uQ(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 S0(e){if(!e||typeof e!="object")return null;const t=e[lh];return uQ(t)?t:null}function A1(e){return e&&typeof e=="object"?{...e}:{}}function tb(e){const t=A1(e);return delete t[lh],t}function dQ(e){const t=tb(e);return delete t[uh],{...t,[ch]:!0}}function hQ(){typeof window>"u"||window.history.pushState({...tb(window.history.state),[ch]:!0,[uh]:!0},"",window.location.href)}function rb(){for(let e=0;e<lQ;e+=1)hQ()}function td(){typeof window>"u"||(window.history.replaceState(dQ(window.history.state),"",window.location.href),rb())}function Dc(e){typeof window>"u"||window.history.pushState({...A1(window.history.state),[ch]:!0,[lh]:e,[uh]:!1},"",window.location.href)}function fQ(e){typeof window>"u"||window.history.replaceState({...A1(window.history.state),[ch]:!0,[lh]:e,[uh]:!1},"",window.location.href)}const nb=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let go=new Set(nb);function D5(e){const t=new Map;for(const[r,s]of e)t.set(r,{cwd:s.cwd,activeProgram:s.activeProgram,activeProgramRaw:s.activeProgramRaw,inCopyMode:s.inCopyMode,isConnecting:s.isConnecting,agentStatus:s.agentStatus,agentIndicator:s.agentIndicator,agentStatusDetail:s.agentStatusDetail,agent:s.agent,agentMessage:s.agentMessage,agentNativeSessionId:s.agentNativeSessionId,agentResumeRecovered:s.agentResumeRecovered,terminalSessionId:s.terminalSessionId,agentNeedsReview:s.agentNeedsReview,gitStatus:s.gitStatus,shellTitle:s.shellTitle,promptState:s.promptState,tuiProgress:s.tuiProgress});return t}function pQ(e,t){if(e.size!==t.size)return!1;for(const[r,s]of t){const i=e.get(r);if(!i||i.cwd!==s.cwd||i.activeProgram!==s.activeProgram||i.activeProgramRaw!==s.activeProgramRaw||i.inCopyMode!==s.inCopyMode||i.isConnecting!==s.isConnecting||i.agentStatus!==s.agentStatus||i.agentIndicator!==s.agentIndicator||i.agentStatusDetail!==s.agentStatusDetail||i.agent!==s.agent||i.agentMessage!==s.agentMessage||i.agentNativeSessionId!==s.agentNativeSessionId||i.agentResumeRecovered!==s.agentResumeRecovered||i.terminalSessionId!==s.terminalSessionId||i.agentNeedsReview!==s.agentNeedsReview||i.gitStatus!==s.gitStatus||i.shellTitle!==s.shellTitle||i.promptState!==s.promptState||i.tuiProgress?.state!==s.tuiProgress?.state||i.tuiProgress?.progress!==s.tuiProgress?.progress)return!1}return!0}function B5(e,t){return a.jsx(HD,{sessionMode:e,state:t})}function mQ(e,t){const r=new Map(e.map(c=>[c.id,c])),s=t.map(c=>r.get(c)).filter(c=>c!==void 0),i=new Set(t),u=e.filter(c=>!i.has(c.id));return[...s,...u]}function gQ(){const{t:e,locale:t,setLocale:r}=an(),s="env(safe-area-inset-top, 0px)",i="env(safe-area-inset-bottom, 0px)";vv();const u=_.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[c,h]=_.useState(!1),[p,m]=_.useState(()=>h0(S5,tQ)??"dark"),x=_.useRef(h0(Mc,oQ)).current,[b,v]=_.useState(x?.preventSleep??!1),[w,I]=_.useState(x?.networkAvailable??!0),[k,N]=_.useState(Wd),[R,D]=_.useState(Zc),[P,V]=_.useState(yd),[F,Y]=_.useState($0),[Z,he]=_.useState(Rh),[Ee,Ie]=_.useState(x?.localAccess??aQ),[be,et]=_.useState(x?.localAccess?.name??""),[Pe,fe]=_.useState(!1),[De,pe]=_.useState(null),[ae,ce]=_.useState(null),[Te,we]=_.useState(null),[Ge,ie]=_.useState(!1),ve=_.useMemo(()=>Vs(),[]),ft=!!(ve?.desktopUpdateState&&ve.checkDesktopUpdate&&ve.installDesktopUpdate),[Rt,He]=_.useState(null),[K,Xe]=_.useState(null),[Ce,z]=_.useState(!1),[q,ye]=_.useState(null),[Ve,pt]=_.useState(!1),[ht,It]=_.useState(()=>Qf(h0(_5,rQ)??{})),[Se,ge]=_.useState(0),[Ue,bt]=_.useState(!1),[Ke,Mt]=_.useState(0),[We,vt]=_.useState(!1),[ir,it]=_.useState(0),[dt,Bt]=_.useState(!1),[Et,Vt]=_.useState(0),te=_.useRef(null),[Qe,qe]=_.useState({}),{terminalSettings:kt,updateTerminalSettings:Oe}=iN(),Nt=kt.fontSize,hr=kt.rendererMode,[Ae,bn]=_.useState(!1),_r=_.useRef(hL()).current,[_e,Qr]=T.useState(()=>_r.sessions.map(C=>({id:C.sessionId,name:C.name,customName:C.customName,mode:C.mode,tmuxSessionName:C.tmuxSessionName}))),[wt,en]=_.useState(_r.activeSessionId),[Er,le]=_.useState(!1);_.useEffect(()=>{Er&&wv({rendered:!0})},[Er]);const[st,Ut]=_.useState(null),[lr,Zt]=_.useState(null),[Qt,re]=_.useState([]),[br,ct]=T.useState(()=>{const C=Br.getState();return _r.sessions.forEach(B=>{B.backendSessionId&&C.setTerminalSession(B.sessionId,{sessionId:B.backendSessionId,cols:80,rows:24,mode:B.mode,tmuxSessionName:B.tmuxSessionName}),B.activeProgram!=null&&C.setSessionActiveProgram(B.sessionId,B.activeProgram),B.cwd!=null&&C.setSessionCwd(B.sessionId,B.cwd)}),N0("session-chrome-hydrated"),D5(Br.getState().sessions)});T.useEffect(()=>{!ve||!Ae||Promise.all([ve.snapshot(),ve.desktopUpdateState?.()??Promise.resolve(null)]).then(([C,B])=>{He(C),Xe(B)}).catch(C=>ye(C instanceof Error?C.message:String(C)))},[ve,Ae]),T.useEffect(()=>{ve?.onDesktopUpdateState&&ve.onDesktopUpdateState(Xe)},[ve]),T.useEffect(()=>Br.subscribe(C=>{const B=D5(C.sessions);ct(ee=>pQ(ee,B)?ee:B)}),[]);const jn=T.useCallback(async(C,B)=>{Zt(null),Ut({sessionId:C,status:"submitting",error:null});try{await Av(B),Ut(ee=>ee?.sessionId===C?{...ee,status:"waiting",error:null}:ee)}catch(ee){const lt=(ee&&typeof ee=="object"&&"code"in ee?String(ee.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ee instanceof Error&&/busy/i.test(ee.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");Ut(Dt=>Dt?.sessionId===C?{...Dt,error:lt}:Dt),Zt({tone:"error",message:lt})}},[e]);T.useEffect(()=>{if(!st||st.status!=="waiting")return;const C=br.get(st.sessionId);if(!C||C.agentResumeRecovered||C.agentStatus===null&&!C.agent)return;const B=C.agent?.displayName??"Agent";Ut(null),Zt({tone:"success",message:e("tab.resumeAgentSuccess",{agent:B})})},[st,br,e]),T.useEffect(()=>{if(!st||st.status!=="waiting"||st.error)return;const C=st.sessionId,B=window.setTimeout(()=>{const ee=e("tab.resumeAgentTimeout");Ut(Ne=>Ne?.sessionId===C&&Ne.status==="waiting"?{...Ne,error:ee}:Ne),Zt({tone:"error",message:ee})},15e3);return()=>window.clearTimeout(B)},[st,e]),T.useEffect(()=>{if(lr?.tone!=="success")return;const C=window.setTimeout(()=>Zt(null),3200);return()=>window.clearTimeout(C)},[lr]),T.useEffect(()=>{let C=!1;Tv().then(ee=>{C||we(ee)}).catch(()=>{});const B=np(ee=>{ee.type==="update-state"&&!C&&we(ee.state)});return()=>{C=!0,B()}},[]);const dr=T.useCallback(async()=>{const C=Te?.latestVersion;if(!(!C||Ge)&&window.confirm(e("sidebar.updateRestartConfirm",{version:C}))){ie(!0);try{we(await Cv())}catch(B){window.alert(B instanceof Error?B.message:String(B))}finally{ie(!1)}}},[Te?.latestVersion,e,Ge]),js=T.useCallback(async()=>{if(!Ge){ie(!0);try{we(await Sv())}catch(C){window.alert(C instanceof Error?C.message:String(C))}finally{ie(!1)}}},[Ge]),qs=T.useCallback(async()=>{if(!(!ve?.checkDesktopUpdate||Ce)){z(!0);try{Xe(await ve.checkDesktopUpdate())}catch(C){ye(C instanceof Error?C.message:String(C))}finally{z(!1)}}},[ve,Ce]),fs=T.useCallback(async()=>{if(!(!ve?.installDesktopUpdate||Ce||K?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){z(!0);try{Xe(await ve.installDesktopUpdate())}catch(C){ye(C instanceof Error?C.message:String(C)),z(!1)}}},[ve,Ce,K?.status,e]);T.useEffect(()=>{document.documentElement.dataset.theme=p,_v(p),Un(S5,p)},[p]),T.useEffect(()=>{Un(_5,Qf(ht))},[ht]);const Cn=Ht(C=>C.leftOpen),ns=Ht(C=>C.rightOpen),zn=Ht(C=>C.leftPinned),Mn=Ht(C=>C.leftSidebarWidth),ws=Ht(C=>C.rightPinned),Hn=Ht(C=>C.rightSidebarWidth),tn=Ht(C=>C.rootPath),Pn=Ht(C=>C.contextKey),Gr=Ht(C=>C.selectedFilePath),Cr=Ht(C=>C.groupByFolder),dn=bd(C=>C.collaborationGroups),wr=Ht(C=>C.collapsedGroups),hn=Ht(C=>C.toggleGroupCollapsed),[jt,jr]=T.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[Ar,fn]=T.useState(()=>typeof window>"u"?1024:window.innerWidth),[ss,Yn]=T.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[yn,Yr]=T.useState([]),[Fr,On]=T.useState({available:!0,version:null,reason:null}),[As,Ps]=T.useState(!1),[eo,Rr]=T.useState(null),[H,se]=T.useState(null),[$e,ke]=T.useState(null),[ze,Ze]=T.useState(null),[xt,tt]=T.useState(null),[Re,ot]=T.useState(null),[pr,At]=T.useState(null),[Yt,at]=T.useState(null),[Xt,$t]=T.useState(null),[Ft,Jt]=T.useState(null),[Kn,Xn]=T.useState(!1),[Vr,Os]=T.useState(()=>h0(Nc,C=>typeof C=="boolean")??!1),Fs=T.useCallback(async C=>{const B=Vr;Os(C),Un(Nc,C);try{const ee=await ia({runningSessionButtonEnabled:C});Os(ee.runningSessionButtonEnabled),Un(Nc,ee.runningSessionButtonEnabled)}catch{Os(B),Un(Nc,B)}},[Vr]),[co,vn]=T.useState(null),rn=T.useCallback(C=>{vn(C)},[]),Ur=T.useRef(!1),[Nn,Sn]=T.useState(null),[Zs,Jn]=T.useState(null),Us=_.useRef(null),Lr=_.useRef(!1),qr=_.useRef(null),is=_.useRef(!1),O=T.useCallback(()=>{ot(null),At(null)},[]),J=_.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[ue,Be]=_.useState(J.current),[Tt,_t]=_.useState(!0),er=_.useRef(J.current),ut=_.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));T.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(min-width: 1024px)"),B=()=>{jr(C.matches),fn(window.innerWidth)};return B(),C.addEventListener("change",B),window.addEventListener("resize",B),()=>{C.removeEventListener("change",B),window.removeEventListener("resize",B)}},[]),T.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(orientation: landscape)"),B=()=>Yn(C.matches);return B(),C.addEventListener("change",B),()=>C.removeEventListener("change",B)},[]);const Lt=_.useMemo(()=>wt?Qt.find(C=>C.sessionIds.includes(wt))??null:null,[wt,Qt]),Pr=Lt?.id??null,yr=Lt?.sessionIds[0]??wt,Hr=_.useRef([]);_.useLayoutEffect(()=>{const C=Hr.current;if(Hr.current=Qt,C.length===0)return;const B=new Set(Qt.flatMap(ee=>ee.sessionIds));for(const ee of C){const Ne=ee.sessionIds.filter(lt=>!B.has(lt)).map(lt=>({sessionId:lt,rootPath:Br.getState().sessions.get(lt)?.cwd??null}));Ne.length>0&&Ht.getState().inheritRightSidebarStateFromSplitWorkspace(ee.id,Ne)}},[Qt]),_.useLayoutEffect(()=>((()=>{const B=yr?Br.getState().sessions.get(yr)?.cwd??null:null;Ht.getState().setRootPath(B,yr,Pr)})(),Br.subscribe((B,ee)=>{const Ne=yr?B.sessions.get(yr)?.cwd??null:null,lt=yr?ee.sessions.get(yr)?.cwd??null:null;Ne!==lt&&Ht.getState().setRootPath(Ne,yr,Pr)})),[Pr,yr]);const Tr=jt||ss,Fn=jt||ss,wn=Tr?Math.min(Math.max(Ar*.9,360),Ar-56):Math.min(Ar*.92,420),Ts=Fn?Math.min(Math.max(Ar*.22,280),340):Math.min(Ar*.86,380),tr=wt&&tn?`${wt}\0${tn}`:"",Pt=!!(tr&&Gr&&ht[tr]),cr=T.useCallback(C=>{tr&&(C&&!Ht.getState().selectedFilePath||It(B=>{if(!!B[tr]===C)return B;if(C)return Qf({...B,[tr]:{updatedAt:Date.now()}});const Ne={...B};return delete Ne[tr],Ne}))},[tr]);T.useEffect(()=>{dN(tr,Pn,Gr)&&It(C=>{if(!C[tr])return C;const B={...C};return delete B[tr],B})},[tr,Pn,Gr]);const Wt=dt?"markdown-image-lightbox":We?"markdown-outline":Ue?"right-sidebar-repo-picker":ns&&Pt?"right-sidebar-file-preview":Ae?"settings":ns&&!(ws&&jt)?"right-sidebar":Cn&&!(zn&&jt)?"left-sidebar":null,Kt=_.useRef(Wt),nn=_.useRef(Wt),ps=_.useRef(!1),Kr=_.useRef(!1),Cs=T.useCallback(()=>{if(typeof window>"u")return;const C=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!jt||!C||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[jt]),Wn=T.useCallback(C=>{if(C==="markdown-image-lightbox"){Bt(!1),Vt(B=>B+1);return}if(C==="markdown-outline"){vt(!1),it(B=>B+1);return}if(C==="right-sidebar-file-preview"){vt(!1),it(B=>B+1),cr(!1),ge(B=>B+1);return}if(C==="right-sidebar-repo-picker"){bt(!1),Mt(B=>B+1);return}if(C==="settings"){bn(!1),pi(!1),je(!1),no(!1);return}if(C==="left-sidebar"){Ht.getState().closeLeft();return}vt(!1),it(B=>B+1),bt(!1),Mt(B=>B+1),Bt(!1),Vt(B=>B+1),Ht.getState().closeRight()},[cr]),An=T.useCallback(C=>{if(!u&&typeof window<"u"&&Kt.current===C&&S0(window.history.state)===C){window.history.back();return}Wn(C)},[Wn,u]),$s=T.useCallback(()=>{bn(!1);const C=Ht.getState();C.closeRight(),C.openLeft()},[]),Ho=T.useCallback(()=>{bn(!1);const C=Ht.getState();C.closeLeft(),C.openRight()},[]),ca=T.useCallback(()=>{bn(!1);const C=Ht.getState();C.closeLeft(),C.openRight(),C.setRightTab("files"),C.openRightSearch()},[]),Ao=T.useCallback(()=>{const C=Ht.getState();if(C.leftPinned){C.setLeftPinned(!1),C.closeLeft();return}if(Cn){An("left-sidebar");return}$s()},[$s,An,Cn]),Wo=T.useCallback(()=>{const C=Ht.getState();C.leftPinned?(C.setLeftPinned(!1),C.openLeft()):(C.setLeftPinned(!0),C.openLeft())},[]),ua=T.useCallback(()=>{const C=Ht.getState();C.setLeftPinned(!1),C.closeLeft()},[]),to=T.useCallback(()=>{const C=Ht.getState();C.rightPinned?(C.setRightPinned(!1),C.openRight()):(C.setRightPinned(!0),C.openRight())},[]),da=T.useCallback(()=>{const C=Ht.getState();C.setRightPinned(!1),C.closeRight()},[]),ha=T.useRef(0),Go=T.useRef(0),Ss=T.useRef(null),zs=T.useCallback(C=>{C.preventDefault(),ha.current=C.clientX,Go.current=Ht.getState().leftSidebarWidth;const B=Ne=>{Ss.current===null&&(Ss.current=requestAnimationFrame(()=>{Ss.current=null;const lt=Ne.clientX-ha.current;Ht.getState().setLeftSidebarWidth(Go.current+lt)}))},ee=()=>{window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",ee),Ss.current!==null&&(cancelAnimationFrame(Ss.current),Ss.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",B),window.addEventListener("mouseup",ee)},[]),_s=T.useRef(0),Vo=T.useRef(0),ms=T.useRef(null),Ka=T.useCallback(C=>{C.preventDefault(),_s.current=C.clientX;const B=Ht.getState(),ee=B.leftPinned?B.leftSidebarWidth:0;Vo.current=sd(B.rightSidebarWidth,window.innerWidth,ee);const Ne=Dt=>{ms.current===null&&(ms.current=requestAnimationFrame(()=>{ms.current=null;const mr=_s.current-Dt.clientX,on=Ht.getState(),mn=on.leftPinned?on.leftSidebarWidth:0;on.setRightSidebarWidth(sd(Vo.current+mr,window.innerWidth,mn))}))},lt=()=>{window.removeEventListener("mousemove",Ne),window.removeEventListener("mouseup",lt),ms.current!==null&&(cancelAnimationFrame(ms.current),ms.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Ne),window.addEventListener("mouseup",lt)},[]),ro=T.useCallback(()=>{const C=Ht.getState();if(C.rightPinned){C.setRightPinned(!1),C.closeRight();return}if(ns){An("right-sidebar");return}Ho()},[Ho,An,ns]),Ma=T.useCallback(()=>{!Pt&&!u&&typeof window<"u"&&Kt.current==="right-sidebar"&&S0(window.history.state)==="right-sidebar"&&(Dc("right-sidebar-file-preview"),nn.current="right-sidebar-file-preview"),cr(!0)},[Pt,u,cr]),Si=T.useCallback(()=>{An("right-sidebar-file-preview")},[An]),To=T.useCallback(()=>{!Ue&&!u&&typeof window<"u"&&Kt.current==="right-sidebar"&&S0(window.history.state)==="right-sidebar"&&(Dc("right-sidebar-repo-picker"),nn.current="right-sidebar-repo-picker"),bt(!0)},[Ue,u]),Xa=T.useCallback(()=>{An("right-sidebar-repo-picker")},[An]),fa=T.useCallback(()=>{!We&&!u&&typeof window<"u"&&Kt.current&&S0(window.history.state)===Kt.current&&(Dc("markdown-outline"),nn.current="markdown-outline"),vt(!0)},[We,u]),Na=T.useCallback(()=>{An("markdown-outline")},[An]),Da=T.useCallback(()=>{!u&&typeof window<"u"&&Kt.current&&S0(window.history.state)===Kt.current&&(Dc("markdown-image-lightbox"),nn.current="markdown-image-lightbox"),Bt(!0)},[u]),Ys=T.useCallback(()=>{An("markdown-image-lightbox")},[An]),qo=T.useCallback(()=>{!u&&typeof window<"u"&&Kt.current&&S0(window.history.state)===Kt.current&&(fQ("settings"),nn.current="settings"),Ht.getState().closeAll(),bn(!0)},[u]),ui=T.useCallback(()=>{An("settings")},[An]);T.useEffect(()=>{if(!ve)return;const C=()=>qo();return window.addEventListener("termdock:open-settings",C),()=>window.removeEventListener("termdock:open-settings",C)},[ve,qo]);const Zo=T.useCallback(()=>{pt(!0),te.current!==null&&(window.clearTimeout(te.current),te.current=null)},[]),_i=T.useCallback(()=>{te.current!==null&&(window.clearTimeout(te.current),te.current=null),pt(!1),Kr.current=!0,td(),Kr.current},[]);T.useEffect(()=>()=>{te.current!==null&&window.clearTimeout(te.current)},[]),T.useEffect(()=>{u||td()},[u]),T.useEffect(()=>{if(typeof window>"u"||u)return;let C=null;const B=()=>{C!==null&&(window.clearTimeout(C),C=null)},ee=on=>{if(Kt.current,Kr.current,Kt.current){Kt.current;return}!on?.force&&Kr.current||(on?.userActivated&&(Kr.current=!0),td(),Kr.current,void 0)},Ne=()=>{B(),C=window.setTimeout(()=>{C=null,ee({force:!0})},R5)},lt=()=>{ee({userActivated:!0})},Dt=()=>{Ne()},mr=()=>{document.visibilityState==="visible"&&Ne()};return window.addEventListener("pointerdown",lt,{capture:!0,passive:!0}),window.addEventListener("touchstart",lt,{capture:!0,passive:!0}),window.addEventListener("keydown",lt,{capture:!0}),window.addEventListener("pageshow",Dt),document.addEventListener("visibilitychange",mr),()=>{B(),window.removeEventListener("pointerdown",lt,{capture:!0}),window.removeEventListener("touchstart",lt,{capture:!0}),window.removeEventListener("keydown",lt,{capture:!0}),window.removeEventListener("pageshow",Dt),document.removeEventListener("visibilitychange",mr)}},[u]),T.useEffect(()=>{Kt.current=Wt},[Wt]),T.useEffect(()=>{if(typeof window>"u"||Wt||u)return;const C=window.setTimeout(()=>{Kt.current?(Kt.current,void 0):td()},R5);return()=>window.clearTimeout(C)},[Wt,u]),T.useEffect(()=>{if(typeof window>"u"||u)return;const C=nn.current;ps.current,Wt&&Wt!==C&&!ps.current&&Dc(Wt),!Wt&&C&&Cs(),nn.current=Wt,!Wt&&ps.current&&window.setTimeout(()=>{ps.current=!1},0)},[Wt,u,Cs]),T.useEffect(()=>{if(typeof window>"u"||u)return;const C=()=>{const B=Kt.current;if(Kr.current,!B){Kr.current=!1,Kr.current,Zo(),rb();return}ps.current=!0,Wn(B)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[Wn,Zo,u]),T.useEffect(()=>{const C=B=>{const ee=B.metaKey||B.ctrlKey;if(ee&&B.key==="b"&&!B.shiftKey&&(B.preventDefault(),Ao()),ee&&B.shiftKey&&B.key==="E"&&(B.preventDefault(),ro()),ee&&B.shiftKey&&B.key==="P"&&(B.preventDefault(),ca()),ee&&!B.shiftKey&&B.altKey&&(B.key==="ArrowLeft"||B.key==="ArrowRight")){B.preventDefault();const Ne=B.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Ne}}));return}if(ee&&B.shiftKey&&!B.altKey&&(B.code==="BracketLeft"||B.code==="BracketRight")){B.preventDefault();const Ne=B.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Ne}}));return}};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[Ao,ro,ca]);const os=T.useCallback(async()=>{fe(!0),pe(null);try{const C=await ia({localAccess:{name:be}});Ie(C.localAccess),et(C.localAccess.name),Un(Mc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){pe(C instanceof Error?C.message:"Failed to save local access name")}finally{fe(!1)}},[be]),di=T.useCallback(async()=>{fe(!0),pe(null);try{const C=await ia({localAccess:{reset:!0}});Ie(C.localAccess),et(C.localAccess.name),Un(Mc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){pe(C instanceof Error?C.message:"Failed to reset local access name")}finally{fe(!1)}},[]),Di=T.useCallback(async(C,B="url")=>{if(C)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(C);else{const ee=document.createElement("textarea");ee.value=C,ee.style.position="fixed",ee.style.left="-9999px",document.body.appendChild(ee),ee.focus(),ee.select(),document.execCommand("copy"),document.body.removeChild(ee)}ce(B),window.setTimeout(()=>ce(ee=>ee===B?null:ee),1600)}catch{ce(null)}},[]),Co=T.useCallback(C=>{const B=mQ(_e,C);B.map(ee=>ee.id).join("\0")!==_e.map(ee=>ee.id).join("\0")&&(Qr(B),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:B.map(ee=>ee.id)}})))},[_e]),Ja=T.useCallback(C=>{jt||C.type!=="session"||(Ur.current=!1,Xn(!1),Jt(C.draggableId))},[jt]),el=T.useCallback(C=>{if(jt||C.type!=="session")return;const B=C.destination?.droppableId===Ip;B!==Ur.current&&(Ur.current=B,Xn(B),B&&navigator.vibrate?.(20))},[jt]),uo=T.useCallback(C=>{const B=JB(C,!jt);if(Ur.current=!1,Xn(!1),Jt(null),!B)return!1;const ee=_e.find(lt=>lt.id===C.draggableId),Ne=ee?br.get(ee.id):null;return ee&&P2({mode:ee.mode,activeProgram:Ne?.activeProgram??null,promptState:Ne?.promptState??null,shellNames:go})?(Jn(null),Sn(ee.id),ke(null)):ee&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ee.id,source:"other",closeMode:ee.mode==="tmux"?"destroy":"auto"}})),!0},[jt,_e,br]),{groups:pa,arranged:Dn}=_.useMemo(()=>Sd(_e,C=>br.get(C.id)?.cwd??null,Cr,e("sidebar.ungrouped"),Qt,dn),[_e,br,Cr,e,Qt,dn]),Bi=T.useCallback(C=>{uo(C)||!C.destination||C.source.index===C.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:Dn[C.source.index]?.id,targetId:Dn[C.destination.index]?.id}}))},[uo,Dn]),Bn=T.useCallback((C,B)=>{const ee=B.trim();ee&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:C,name:ee}}))},[]),Ls=T.useCallback(C=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:C}}))},[]),{newSessionMode:es,newSessionTmuxName:Qi,userSelectedNewSessionMode:Ba,setNewSessionMode:hi}=lN(),[fi,_n]=T.useState(null),[Li,pi]=_.useState(!1),[ne,je]=_.useState(!1),[rt,mt]=_.useState("idle"),Me=_.useRef(h0(ed,sQ)).current,[nt,vr]=_.useState(()=>{const C=Me?.presets;if(C&&C.length>0){const B=M0(C);if(B.length>0)return B}return Kc()}),[Dr,Xr]=_.useState(!1),[kr,Gn]=_.useState("default"),sn=_.useRef(typeof Me?.updatedAt=="number"?Me.updatedAt:null),Is=_.useRef(!1),[ks,no]=_.useState(!1),[gs,as]=_.useState(!1),Sl=_.useRef(h0(lo,nQ)).current,[mi,Ks]=_.useState(Sl??[]),[r0,L]=_.useState(Sl!==null),[Q,j]=_.useState(!1),W=!Wt&&!ne&&!Li&&!ks&&!gs&&!Re&&!Nn&&!fi,Le=_.useCallback(C=>{const B=typeof C.version=="number"?C.version:0,ee=iQ(Array.isArray(C.presets)?C.presets:[],B);sn.current=typeof C.updatedAt=="number"?C.updatedAt:null,vr(Ne=>Lv(Ne,ee)?Ne:(Is.current=!0,ee)),Un(ed,{version:Pc,presets:ee,updatedAt:sn.current??void 0})},[]);T.useEffect(()=>{const C=B=>{if(B.key!=="Escape")return;if(ne){B.preventDefault(),je(!1);return}if(Li){B.preventDefault(),pi(!1);return}if(ks){B.preventDefault(),no(!1);return}if(gs){B.preventDefault(),as(!1);return}if(Re){B.preventDefault(),O();return}if(Yt){B.preventDefault(),tt(null),at(null);return}if(Ae){B.preventDefault(),ui();return}if(ns&&!(ws&&jt)){B.preventDefault(),An("right-sidebar");return}Cn&&!(zn&&jt)&&(B.preventDefault(),An("left-sidebar"))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[ne,Li,ks,Re,O,Ae,ns,ws,Cn,zn,jt,ui,An]),T.useEffect(()=>{L(!0)},[]);const[xe,Je]=_.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:nb}),[,Ye]=_.useState(!1),Ct=_.useCallback(()=>Iv().then(C=>{Je(C),go=new Set(C.shellNames),Ye(!0)}).catch(()=>{}),[]);T.useEffect(()=>{Ct()},[Ct]),T.useEffect(()=>np(C=>{if(C.type==="config-updated"){if(C.key==="toolbar-presets"){lm().then(B=>Le(B)).catch(B=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",B)});return}C.key==="program-detection"&&Ct()}}),[Le,Ct]),T.useEffect(()=>{let C=!1;return(async()=>{try{const B=await lm();if(C)return;Le(B)}catch(B){console.warn("[toolbar-presets] Failed to load from server:",B)}finally{C||Xr(!0)}})(),()=>{C=!0}},[Le]),T.useEffect(()=>{if(Dr){if(Is.current){Is.current=!1;return}Un(ed,{version:Pc,presets:nt,updatedAt:sn.current??void 0}),kv({version:Pc,presets:nt,baseUpdatedAt:sn.current??void 0}).then(C=>{sn.current=typeof C.updatedAt=="number"?C.updatedAt:null,Un(ed,{version:Pc,presets:nt,updatedAt:sn.current??void 0})}).catch(C=>{const B=C instanceof Error&&"current"in C?C.current:null;B&&typeof B=="object"&&Le(B),console.warn("[toolbar-presets] Failed to save to server:",C)})}},[Le,nt,Dr]),T.useEffect(()=>{Rp().then(C=>{v(B=>B===C.preventSleep?B:C.preventSleep),I(B=>B===C.networkAvailable?B:C.networkAvailable),Ie(C.localAccess),et(C.localAccess.name),Os(C.runningSessionButtonEnabled),Un(Nc,C.runningSessionButtonEnabled),Un(Mc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}).catch(()=>{})},[]),T.useEffect(()=>{if(!k)return;const C=Rh();he(C),C!=="granted"&&(N(!1),Lu(!1))},[k]),T.useEffect(()=>{if(!k)return;_0();const C=()=>{document.visibilityState==="visible"&&(_0(),uw())},B=window.setInterval(()=>{_0()},360*60*1e3);return document.addEventListener("visibilitychange",C),window.addEventListener("focus",C),()=>{window.clearInterval(B),document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",C)}},[k]);const xr=T.useCallback(async()=>{if(k){N(!1),Lu(!1),cw(),he(Rh());return}const C=await nw();if(he(C),C!=="granted"){N(!1),Lu(!1);return}N(!0),Lu(!0),await _0(!0,!0),mt("idle")},[k]),Jr=T.useCallback(async()=>{mt("checking"),await Vs()?.prepareNotificationTest?.();const C=await id({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});mt(C?"delivered":"failed")},[e]),ln=T.useCallback(C=>{D(C),ew(C),Mh()},[]),pn=T.useCallback(C=>{V(C),tw(C),Mh()},[]),ur=T.useCallback(C=>{Y(C),rw(C),Mh()},[]);T.useEffect(()=>{nt.some(C=>C.id===kr)||Gn(nt[0]?.id??"default")},[kr,nt]),T.useEffect(()=>{if(!Fr.available&&es==="tmux"){hi("shell",{userInitiated:!1});return}Fr.available&&Ba!=="shell"&&es!=="tmux"&&hi("tmux",{userInitiated:!1})},[es,Fr.available,Ba,hi]),T.useEffect(()=>{_n(null)},[Ae,es,Fr.available]),T.useEffect(()=>{const C={};typeof navigator<"u"&&(C.userAgent=navigator.userAgent,C.platform=navigator.platform,C.maxTouchPoints=navigator.maxTouchPoints,C.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,C.vendor=navigator.vendor),typeof window<"u"&&(C.screenWidth=window.innerWidth,C.screenHeight=window.innerHeight,C.pixelRatio=window.devicePixelRatio,C.orientation=window.screen?.orientation?.type||"unknown",C.hasVisualViewport=!!window.visualViewport,C.visualViewportHeight=window.visualViewport?.height,C.visualViewportWidth=window.visualViewport?.width,C.location=window.location.href),C.timestamp=new Date().toISOString(),C.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,C.isAndroid=/Android/.test(navigator.userAgent),qe(C)},[]);const Or=T.useCallback(C=>{if(uo(C)||!C.destination)return;if(C.type==="group"){if(C.source.index===C.destination.index)return;Co(Kx(pa,C.source.index,C.destination.index));return}if(C.source.droppableId!==C.destination.droppableId||C.source.index===C.destination.index)return;const B=C.source.droppableId.replace(/^group-sessions:/,""),ee=pa.find(Ne=>Ne.key===B);ee&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ee.sessions[C.source.index]?.id,targetId:ee.sessions[C.destination.index]?.id}}))},[pa,Co,uo]),Vn=_.useMemo(()=>Dn.flatMap(C=>{const B=br.get(C.id);if(B?.agentStatus!=="working")return[];const{primary:ee,secondary:Ne}=ka(C,B?.activeProgram??null,B?.cwd??null,go,B?.shellTitle??null,B?.promptState??null);return[{id:C.id,label:ee,detail:Ne}]}),[Dn,br]),xs=wt?Dn.findIndex(C=>C.id===wt):-1,ho=Dn.length>0&&xs>=0?`${xs+1}/${Dn.length}`:`${Dn.length}`,Ln=_.useMemo(()=>{let C=0;for(const B of _e){const ee=br.get(B.id);(ee?.agentStatus==="waiting"||ee?.agentNeedsReview)&&(C+=1)}return{running:Vn.length,review:C}},[Vn.length,_e,br]);Ev(Ln.running,Ln.review);const ji=wt?_e.find(C=>C.id===wt)??null:null,Ii=ji?br.get(ji.id):void 0,Qa=!!(ji&&Ii?.agentResumeRecovered&&Ii.agentNativeSessionId&&Ii.terminalSessionId),gi=ji&&st?.sessionId===ji.id?st:null;_.useLayoutEffect(()=>{if(!Tt)return;const C=qr.current;if(!C)return;const B=!is.current;C.scrollIntoView({inline:"nearest",block:"nearest",behavior:B?"auto":"smooth"}),is.current=!0,B&&N0("active-tab-positioned")},[wt,Tt]),T.useEffect(()=>{xt&&Us.current&&(Us.current.scrollIntoView({block:"nearest",inline:"nearest"}),Us.current.focus(),Us.current.select()),xt||(Lr.current=!1)},[xt]);const tl=T.useCallback(C=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:C}))},[]),ja=T.useCallback((C,B)=>{At(B??null),ot(C)},[]),hu=I6(),Pi=T.useCallback(C=>{if(!C)return;Be(C),ut.current&&xo("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:ut.current,requestedSessionId:C,activeSessionId:wt,sessions:_e.map(ee=>({id:ee.id,terminalSessionId:br.get(ee.id)?.terminalSessionId??null}))}),dw(C);const B=_e.find(ee=>ee.id===C||br.get(ee.id)?.terminalSessionId===C);B?(er.current=null,ut.current&&xo("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:ut.current,requestedSessionId:C,targetSessionId:B.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.id}))):(er.current=C,ut.current&&xo("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:ut.current,requestedSessionId:C}))},[wt,_e,br]);T.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let C=!1;const B=async()=>{if(window.parent!==window&&Ml()){_t(!0);return}try{const Ne=await caches.open(cQ),lt=await Ne.match(M5);if(!lt)return;await Ne.delete(M5);const Dt=await lt.json();if(C)return;const mr=typeof Dt.sessionId=="string"?Dt.sessionId:null,on=typeof Dt.traceId=="string"?Dt.traceId:null,mn=typeof Dt.clickedAt=="number"?Dt.clickedAt:0,In=Date.now()-mn;xo("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:on,sessionId:mr,ageMs:In,valid:!!(mr&&In>=0&&In<=N5),visibilityState:document.visibilityState}),mr&&In>=0&&In<=N5&&(ut.current=on,typeof Dt.targetPeerId=="string"&&Dt.targetPeerId!==$l()?.targetPeerId?Ml()?.focusSession(Dt.targetPeerId,mr):Pi(mr))}catch(Ne){xo("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:Ne instanceof Error?Ne.message:String(Ne)})}finally{C||_t(!0)}},ee=()=>{document.visibilityState==="visible"&&B()};return B(),document.addEventListener("visibilitychange",ee),window.addEventListener("pageshow",B),()=>{C=!0,document.removeEventListener("visibilitychange",ee),window.removeEventListener("pageshow",B)}},[Pi]),T.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search),B=C.get("session");if(!B)return;xo("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:ut.current,targetSessionId:B,href:window.location.href,visibilityState:document.visibilityState});const ee=C.get("service");ee&&ee!==$l()?.targetPeerId?Ml()?.focusSession(ee,B):er.current=B,C.delete("service"),C.delete("session"),C.delete("_notifTrace");const Ne=C.toString(),lt=`${window.location.pathname}${Ne?`?${Ne}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",lt)},[]),T.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search);if(C.get("_notif")!=="1")return;const B=C.get("session");C.delete("_notif");const ee=C.toString(),Ne=`${window.location.pathname}${ee?`?${ee}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",Ne),window.parent!==window&&Ml())return;const lt=new BroadcastChannel("termdock:notif");let Dt=!1;const mr=mn=>{mn.data?.type==="termdock:notif-pong"&&!Dt&&(Dt=!0,lt.close(),window.close())};lt.addEventListener("message",mr),lt.postMessage({type:"termdock:notif-ping",sessionId:B,targetPeerId:C.get("service")});const on=setTimeout(()=>{Dt||lt.close()},500);return()=>{clearTimeout(on),Dt||lt.close()}},[]),T.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&Ml())return;const C=new BroadcastChannel("termdock:notif"),B=ee=>{ee.data?.type==="termdock:notif-ping"&&(C.postMessage({type:"termdock:notif-pong"}),typeof ee.data.sessionId=="string"&&(typeof ee.data.targetPeerId=="string"&&ee.data.targetPeerId!==$l()?.targetPeerId?Ml()?.focusSession(ee.data.targetPeerId,ee.data.sessionId):Pi(ee.data.sessionId)))};return C.addEventListener("message",B),()=>C.close()},[Pi]),T.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=B=>{const ee=B.data;if(ee&&ee.type==="termdock:focus-session"&&typeof ee.sessionId=="string"){if(typeof ee.targetPeerId=="string"&&ee.targetPeerId!==$l()?.targetPeerId){Ml()?.focusSession(ee.targetPeerId,ee.sessionId)&&B.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}B.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),Pi(ee.sessionId)}else ee?.type==="termdock:push-subscription-changed"?_0(!0):ee?.type};return navigator.serviceWorker.addEventListener("message",C),()=>navigator.serviceWorker.removeEventListener("message",C)},[Pi]),T.useEffect(()=>{const C=B=>{const ee=B.detail;typeof ee=="string"&&Pi(ee)};return window.addEventListener("termdock:focus-session",C),()=>window.removeEventListener("termdock:focus-session",C)},[Pi]),T.useEffect(()=>{const C=()=>{const B=Dv($l()?.targetPeerId);B&&Pi(B)};return C(),window.addEventListener("termdock:workspace-session",C),()=>window.removeEventListener("termdock:workspace-session",C)},[Pi]),T.useEffect(()=>{const C=er.current;if(!C)return;const B=_e.find(ee=>ee.id===C||br.get(ee.id)?.terminalSessionId===C);B?(er.current=null,ut.current&&xo("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:ut.current,requestedSessionId:C,targetSessionId:B.id,activeSessionId:wt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.id}))):ut.current&&xo("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:ut.current,requestedSessionId:C,activeSessionId:wt,sessions:_e.map(ee=>({id:ee.id,terminalSessionId:br.get(ee.id)?.terminalSessionId??null}))})},[wt,_e,br]);const Oi=_.useMemo(()=>{const C=[];for(const B of _e){const ee=br.get(B.id);(ee?.agentStatus==="waiting"||ee?.agentNeedsReview)&&C.push(B.id)}return C},[_e,br]),n0=T.useCallback(()=>{if(Oi.length===0)return;wt&&Br.getState().clearAgentNeedsReview(wt);const C=wt?_e.findIndex(ee=>ee.id===wt):-1,B=Oi.find(ee=>_e.findIndex(Ne=>Ne.id===ee)>C)??Oi[0];B&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B}))},[Oi,_e,wt]),s0=T.useCallback(()=>{if(Oi.length===0)return;wt&&Br.getState().clearAgentNeedsReview(wt);const C=wt?_e.findIndex(ee=>ee.id===wt):_e.length,B=[...Oi].reverse().find(ee=>_e.findIndex(Ne=>Ne.id===ee)<C)??Oi[Oi.length-1];B&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B}))},[Oi,_e,wt]);T.useEffect(()=>{const C=B=>{!B.altKey||!B.shiftKey||B.metaKey||B.ctrlKey||B.key!=="ArrowUp"&&B.key!=="ArrowDown"||(B.preventDefault(),B.key==="ArrowUp"?s0():n0())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[n0,s0]);const dh=T.useCallback(async C=>{const ee=Br.getState().sessions.get(C)?.cwd;if(ee)try{await navigator.clipboard?.writeText(ee),$t(ee),window.setTimeout(()=>{$t(Ne=>Ne===ee?null:Ne)},1400)}catch{}},[]),hh=T.useCallback(C=>{Qr(C.sessions),en(C.activeSessionId),re(C.splitWorkspaces),Br.getState().setActiveSessionId(C.activeSessionId)},[]),fh=T.useCallback(()=>{le(!0)},[]),fu=T.useCallback(()=>{le(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);T.useEffect(()=>{if(!ue||!wt)return;_e.find(B=>B.id===ue||br.get(B.id)?.terminalSessionId===ue)?.id===wt&&Be(null)},[wt,ue,_e,br]);const Yo=T.useCallback(C=>{const B=C?.mode??es,ee=B==="tmux"&&(C?.tmuxSessionName?.trim()||Qi.trim())||void 0,Ne=C?.cwd||(wt?Br.getState().sessions.get(wt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:B,tmuxSessionName:ee,cwd:Ne,command:C?.command}}))},[es,Qi,wt]),ma=T.useCallback(async()=>{Ps(!0);try{const C=await jf();if(On(C),!C.available){Yr([]);return}const B=await Pf();Yr(B)}catch{On({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Yr([])}finally{Ps(!1)}},[]),ph=T.useCallback(async C=>{se(C),ke(null);try{const{cleanedSessions:B}=await U5(C);for(const ee of B)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ee}));Rr(null),await ma()}catch(B){ke(B instanceof Error?B.message:"Failed to kill tmux session")}finally{se(null)}},[ma]);T.useEffect(()=>{if(!ze)return;if(yn.find(ee=>ee.name===ze&&(ee.connected||ee.boundFrontendSessionId))){Ze(null);return}const B=setTimeout(()=>Ze(null),1e4);return()=>clearTimeout(B)},[ze,yn]);const Xs=T.useCallback(C=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:C}))},[]),i0=T.useCallback(C=>{const B=C??wt;B&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:B}))},[wt]),pu=T.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:C,layout:B}}))},[]),ec=T.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:C,sessionIds:B}}))},[]),mu=T.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:C,name:B}}))},[]),gu=T.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:C,secondaryId:B}}))},[]),_l=T.useCallback((C,B)=>{const ee=_e.find(lt=>lt.id===C);if(!ee)return;const Ne=br.get(C);if(!P2({mode:ee.mode,activeProgram:Ne?.activeProgram??null,promptState:Ne?.promptState??null,shellNames:go})){Xs({sessionId:C,source:"sidebar",closeMode:ee.mode==="tmux"?"destroy":"auto"});return}Jn(B?{x:B.clientX,y:B.clientY}:null),Sn(C),ke(null)},[_e,br,Xs]);T.useEffect(()=>{if(!ve)return;const C=B=>{const ee=B.detail;ee==="new-session"?Yo():ee==="close-session"?wt&&_l(wt):ee==="previous-session"||ee==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ee==="next-session"?"next":"prev"}})):ee==="toggle-left-sidebar"?Ao():ee==="toggle-right-sidebar"?ro():ee==="previous-attention"?s0():ee==="next-attention"&&n0()};return window.addEventListener("termdock:native-command",C),()=>window.removeEventListener("termdock:native-command",C)},[wt,ve,Yo,_l,Ao,ro,n0,s0]);const rl=_.useMemo(()=>_e.find(C=>C.id===Nn)??null,[_e,Nn]),mh=_.useMemo(()=>{if(!rl)return"";const C=br.get(rl.id);return ka(rl,C?.activeProgram??null,C?.cwd??null,go,C?.shellTitle??null,C?.promptState??null).primary},[rl,br]);T.useEffect(()=>{if(!Ae)return;let C=!1,B=!1;const ee=async()=>{if(!B)try{const lt=await jf();if(C||On(lt),!lt.available){C||Yr([]);return}const Dt=await Pf();C||Yr(Dt)}catch{B=!0,C||(On({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Yr([]))}};ee();const Ne=setInterval(()=>{ee()},4e3);return()=>{C=!0,clearInterval(Ne)}},[Ae]);const xu=fi??es,tc=xu==="shell",rc=xu==="tmux"&&Fr.available,gh=_.useMemo(()=>Yx(yn.map(C=>({...C,id:C.name})),C=>C.cwd??null,e("sidebar.ungrouped")),[yn,e]),o0=_.useMemo(()=>yn.filter(C=>C.recoveryCandidate===!0&&!C.connected&&!C.boundFrontendSessionId).sort((C,B)=>(B.lastActiveAt??B.createdAt??0)-(C.lastActiveAt??C.createdAt??0)),[yn]);T.useEffect(()=>{!Cn&&!(zn&&jt)||ma()},[Cn,zn,jt,_e.length,ma]);const a0=(C,B,ee,Ne=!1)=>{const lt=C.id===wt,Dt=C.id===xt,mr=br.get(C.id),{primary:on,secondary:mn}=ka(C,mr?.activeProgram??null,mr?.cwd??null,go,mr?.shellTitle??null,mr?.promptState??null),In=Ea(mr?.cwd??null),So=B?mn??(In&&In!==on?In:null):null,kn=mr?.gitStatus,Fi=`${mr?.cwd||C.name}${kn?`
156
- ⎇ ${kn.branch} +${kn.added} −${kn.removed}`:""}`,_o=!!(mr?.tuiProgress&&mr.tuiProgress.state!=="remove"),Rs=mr?.agentStatus==="working"||_o?"var(--success)":mr?.agentStatus==="waiting"||mr?.agentNeedsReview?"var(--warning)":mr?.inCopyMode?"var(--tmux)":null;if(Dt&&jt&&!Yt){const bs=C.customName?C.name:on,Ms=(Ei,Ko)=>{const Pa=Ko.trim();Pa?Pa!==bs&&Bn(Ei,Pa):Ls(Ei),tt(null)};return a.jsx("input",{ref:Ei=>{Us.current=Ei},type:"text",defaultValue:bs,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(bs.length,5)}ch`},onKeyDown:Ei=>{Ei.key==="Enter"?Ms(C.id,Ei.target.value):Ei.key==="Escape"&&tt(null)},onBlur:Ei=>Ms(C.id,Ei.target.value)})}return a.jsx("div",{ref:lt?qr:null,onContextMenu:bs=>{bs.preventDefault(),At({x:bs.clientX,y:bs.clientY}),ot(C.id)},...hu(()=>ja(C.id)),className:Ne?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${lt?"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 ${lt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!Ne&&lt&&Rs?{boxShadow:`inset 2px 0 0 0 ${Rs}`}:!Ne&&lt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Fi,children:a.jsx("button",{type:"button",...ee??{},onClick:()=>tl(C.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${Ne?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ee?"cursor-grab active:cursor-grabbing":""}`,title:Fi,children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[a.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[B5(C.mode,mr),mr?.agentResumeRecovered&&a.jsx(k0,{size:Ne?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),_o&&!mr?.agentStatus&&a.jsx(un,{size:Ne?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),So?a.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${mr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:on}),a.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:So})]}):a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${mr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:on})]})})})},nc=()=>a.jsx(Va,{droppableId:Ip,type:"session",isDropDisabled:jt,children:(C,B)=>{const ee=Kn||B.isDraggingOver;return a.jsxs("div",{ref:C.innerRef,...C.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":!Ft,"data-mobile-session-destroy-target":"","data-active":ee?"true":"false",children:[a.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 ${Ft?ee?"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:[a.jsx(Ji,{size:28,strokeWidth:1.8}),a.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ee?"tab.releaseToClose":"tab.dragToClose")})]}),C.placeholder]})}}),ki=zn&&jt,l0=ws&&jt,Ll=sd(Hn,Ar,ki?Mn:0),Il=l0?Ll+F5:0,nl=ki?_e.find(C=>C.id===wt):null,Es=nl?br.get(nl.id):void 0,xh=nl?ka(nl,Es?.activeProgram??null,Es?.cwd??null,go,Es?.shellTitle??null,Es?.promptState??null).primary:"",sc=jt?Lt:null,bh=ki&&!sc&&Es?Es.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":Es.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":Es.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":Es.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",bu=a.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[a.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:a.jsxs("div",{className:"relative flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:[a.jsxs("div",{className:`${jt?"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 ${ki?"flex justify-end":"flex justify-between"} ${Cr?"h-10 sm:h-10":"h-9 sm:h-10"} ${bh}`,style:{marginRight:Il||void 0,display:sc?"none":void 0},children:[!ki&&a.jsxs("button",{type:"button",onClick:Ao,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:[a.jsx(r9,{size:14}),a.jsx(GD,{runningCount:Ln.running,reviewCount:Ln.review,className:"sm:hidden"})]}),ki?a.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:nl?a.jsxs(a.Fragment,{children:[B5(nl.mode,Es),a.jsx("span",{className:`truncate text-[12px] font-medium ${Es?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:xh}),Es?.agentStatus==="working"&&a.jsx("span",{title:Es?.agentMessage??void 0,children:a.jsx(un,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),Es?.agentStatus==="waiting"&&a.jsx("span",{title:Es?.agentMessage??void 0,children:a.jsx(gd,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!Es?.agentStatus&&Es?.agentNeedsReview&&a.jsx("span",{title:Es?.agentMessage??void 0,children:a.jsx(P0,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):a.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):Cr?a.jsxs(Qd,{onDragStart:Ja,onDragUpdate:el,onDragEnd:Or,children:[nc(),a.jsx(Va,{droppableId:"groups",type:"group",direction:"horizontal",children:C=>a.jsxs("div",{ref:C.innerRef,...C.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:[pa.map((B,ee)=>{let Ne=0,lt=0;for(const mn of B.sessions){const In=br.get(mn.id);In?.agentStatus==="working"&&(Ne+=1),(In?.agentStatus==="waiting"||In?.agentNeedsReview)&&(lt+=1)}const Dt=B.sessions.some(mn=>mn.id===wt),mr=wr.has(B.key),on=B.key==="";return a.jsx(Ga,{draggableId:`group-${B.key||"__ungrouped__"}`,index:ee,isDragDisabled:on,disableInteractiveElementBlocking:!0,children:(mn,In)=>a.jsxs("div",{ref:mn.innerRef,...mn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${In.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Dt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[a.jsxs("button",{type:"button",...on?{}:mn.dragHandleProps,onClick:()=>hn(B.key),className:`flex ${mr?"":B.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 ${on?"":"cursor-grab active:cursor-grabbing"} ${Dt?"text-primary/80":"text-muted-foreground/55"}`,title:B.key||B.label,children:[a.jsx(zd,{size:9,className:`shrink-0 opacity-70 transition-transform ${mr?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 truncate",children:B.label}),Ne>0&&a.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),lt>0&&a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${Ne>0?"":"ml-auto"}`})]}),mr?a.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:B.sessions.length})}):a.jsx(Va,{droppableId:`group-sessions:${B.key}`,type:"session",direction:"horizontal",children:So=>a.jsxs("div",{ref:So.innerRef,...So.droppableProps,className:"flex items-center gap-px",children:[B.sessions.map((kn,Fi)=>a.jsx(Ga,{draggableId:kn.id,index:Fi,disableInteractiveElementBlocking:!0,children:(_o,Rs)=>a.jsx("div",{ref:_o.innerRef,..._o.draggableProps,className:`flex shrink-0 items-center ${Rs.isDragging?"opacity-70":""}`,children:a0(kn,!1,_o.dragHandleProps,!0)})},kn.id)),So.placeholder]})})]})},B.key||"__ungrouped__")}),C.placeholder,a.jsx("button",{type:"button",onClick:()=>Yo(),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:a.jsx(Xi,{size:14})})]})})]}):a.jsxs(Qd,{onDragStart:Ja,onDragUpdate:el,onDragEnd:Bi,children:[nc(),a.jsx(Va,{droppableId:"tabs",type:"session",direction:"horizontal",children:C=>a.jsxs("div",{ref:C.innerRef,...C.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:[Dn.map((B,ee)=>B.id===xt?a.jsx(_.Fragment,{children:a.jsx(Ga,{draggableId:B.id,index:ee,isDragDisabled:!0,children:lt=>a.jsx("div",{ref:lt.innerRef,...lt.draggableProps,className:"flex h-full items-center",children:a0(B,!0)})})},B.id):a.jsx(_.Fragment,{children:a.jsx(Ga,{draggableId:B.id,index:ee,disableInteractiveElementBlocking:!0,children:(lt,Dt)=>a.jsx("div",{ref:lt.innerRef,...lt.draggableProps,className:`flex h-full shrink-0 items-center ${Dt.isDragging?"opacity-70":""}`,children:a0(B,!0,lt.dragHandleProps)})})},B.id)),a.jsx("button",{type:"button",onClick:()=>Yo(),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:a.jsx(Xi,{size:14})}),C.placeholder]})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!ki&&Ln.running>0&&a.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:a.jsx(W6,{count:Ln.running,tone:"running",title:e("agent.aiRunning")})}),!ki&&_e.length>0&&a.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 ${xs+1} of ${_e.length}`,children:ho}),!l0&&a.jsx("button",{type:"button",onClick:ro,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:a.jsx(tx,{size:14})})]})]}),Qa&&ji&&Ii?.terminalSessionId&&a.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:Il||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[a.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:!gi?.error&&(gi?.status==="submitting"||gi?.status==="waiting")?a.jsx(un,{size:14,className:"animate-spin"}):a.jsx(k0,{size:14})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:Ii.agent?.displayName??"Agent"})}),a.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${gi?.error?"text-destructive":"text-muted-foreground"}`,children:gi?.error??(gi?.status==="submitting"?e("tab.resumeAgentSubmitting"):gi?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),a.jsx("button",{type:"button",disabled:!gi?.error&&(gi?.status==="submitting"||gi?.status==="waiting"),onClick:()=>{jn(ji.id,Ii.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:gi?.error?e("common.retry"):e("tab.resumeAgentNow")}),a.jsx("button",{type:"button",onClick:()=>{Br.getState().setAgentResumeRecovered(ji.id,!1),Ut(C=>C?.sessionId===ji.id?null:C)},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:a.jsx(vs,{size:13})})]}),a.jsx("div",{ref:rn,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a.jsx(OL,{terminalSettings:kt,colorTheme:p,toolbarPresets:nt,showDebug:c&&jt,terminalFocusAvailable:W,defaultSessionMode:es,defaultTmuxSessionName:Qi,connectionPrioritySessionId:ue,connectionPriorityReady:Tt,desktopRightSidebarEnabled:jt,onToggleRightSidebar:ro,desktopFloatingTitle:jt,desktopPinnedLeftSidebarWidth:ki?Mn:0,desktopViewportWidth:Ar,onSessionDataUpdate:hh,onInitialViewportReady:fu,onInitialRecoveryRequired:fh})})})]})}),a.jsx(KD,{reviewCount:Ln.review,runningSessions:Vn,activeSessionId:wt,runningButtonEnabled:Vr,isDesktopLayout:jt,containerElement:co,occlusionInsets:{right:Il}}),Ae&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:ui,"aria-label":e("settings.closeSettings")}),a.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:a.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:s,paddingBottom:i},children:[a.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:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.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:a.jsx(b9,{size:15})}),a.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),a.jsx("button",{type:"button",onClick:ui,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:a.jsx(vs,{size:16})})]}),a.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:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>Oe({fontSize:Math.max(8,Nt-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:"−"}),a.jsx("input",{type:"range",min:"8",max:"32",value:Nt,onChange:C=>Oe({fontSize:parseInt(C.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>Oe({fontSize:Math.min(32,Nt+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:"+"}),a.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[Nt,"px"]})]}),a.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(C=>{const B=hr===C;return a.jsx("button",{type:"button",onClick:()=>Oe({rendererMode:C}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(C==="auto"?"settings.auto":C==="webgl"?"settings.webgl":"settings.canvas")},C)})})]})}),a.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",X8,e("settings.darkTheme")],["light",A9,e("settings.lightTheme")]].map(([C,B,ee])=>{const Ne=p===C;return a.jsxs("button",{type:"button",onClick:()=>m(C),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${Ne?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[a.jsx(B,{size:12}),a.jsx("span",{children:ee})]},C)})})]})}),a.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(C=>{const B=es===C,ee=C==="tmux"&&!Fr.available;return a.jsx("button",{type:"button",disabled:ee,onClick:()=>hi(C,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":ee?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ee?Fr.reason||e("settings.installTmuxHint"):void 0,children:e(C==="shell"?"settings.shell":"settings.tmux")},C)})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.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:[a.jsx("span",{className:"font-medium",children:e("settings.debug")}),a.jsx(Wa,{checked:c,size:"sm"})]}),a.jsxs("button",{type:"button",onClick:async()=>{const C=!b;v(C);try{const B=await ia({preventSleep:C});v(B.preventSleep),I(B.networkAvailable),Ie(B.localAccess),Un(Mc,{preventSleep:B.preventSleep,networkAvailable:B.networkAvailable,localAccess:B.localAccess})}catch{v(!C)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${b?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!w&&b?e("settings.noSleepUnavailable"):void 0,children:[a.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),a.jsx(Wa,{checked:b,size:"sm"})]})]})]}),a.jsxs("button",{type:"button",onClick:()=>je(!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:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(n8,{size:14,className:k?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),a.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(k?R&&P?"settings.notificationsBothOnSummary":R?"settings.notificationsAiOnSummary":P?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:e(k?"common.on":"common.off")}),a.jsx("span",{children:"›"})]})]}),a.jsxs("details",{className:"mt-3 rounded-xl bg-surface-2 px-3 py-3",open:!1,children:[a.jsxs("summary",{className:"flex cursor-pointer items-start justify-between gap-2 list-none",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),a.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] ${Ee.status==="active"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:Ee.status})]}),a.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:[a.jsx("input",{value:be,onChange:C=>et(C.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}),a.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[a.jsx("button",{type:"button",disabled:Pe,onClick:()=>{os()},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(Pe?"settings.saving":"common.save")}),a.jsx("button",{type:"button",disabled:Pe,onClick:()=>{di()},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")})]}),a.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[Ee.url&&a.jsxs("button",{type:"button",onClick:()=>{Di(Ee.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:[a.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",Ee.url]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:ae==="lan"?"Copied":e("common.copy")})]}),Ee.interfaces.length>0&&a.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[a.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),a.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:Ee.interfaces.map(C=>{const B=C.url??`${Ee.httpsEnabled?"https":"http"}://${C.address}:9834`;return a.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[a.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[C.label," (",C.name,")"]}),a.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:C.address}),C.qrDataUrl&&a.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:a.jsx("img",{src:C.qrDataUrl,alt:`QR code for ${B}`,className:"h-28 w-28"})}),a.jsxs("button",{type:"button",onClick:()=>{Di(B,`ip-${C.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:[a.jsx("span",{className:"min-w-0 truncate",children:B}),a.jsx("span",{className:"shrink-0 text-[10px]",children:ae===`ip-${C.address}`?"Copied":e("common.copy")})]})]},`${C.name}-${C.address}`)})})]}),Ee.onboardingUrl&&a.jsxs("button",{type:"button",onClick:()=>{Di(Ee.onboardingUrl,"setup")},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:[a.jsxs("span",{className:"min-w-0 truncate",children:[e("settings.onboardingUrl"),": ",Ee.onboardingUrl]}),a.jsx("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium",children:ae==="setup"?"Copied":e("common.copy")})]}),a.jsxs("div",{className:"text-muted-foreground",children:[Ee.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Ee.caAvailable&&` · ${e("settings.caMissing")}`]}),Ee.reason&&a.jsx("div",{className:"text-[color:var(--warning)]",children:Ee.reason}),De&&a.jsx("div",{className:"text-destructive",children:De})]})]}),a.jsx(XB,{state:Te,pending:Ge,onCheck:()=>{js()},onConfirmRestart:()=>{dr()},desktopState:ft?K:void 0,desktopPending:Ce,onCheckDesktop:()=>{qs()},onInstallDesktop:()=>{fs()}}),ve&&a.jsxs("div",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:a.jsx(Yv,{size:15})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.desktopTitle")}),a.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Rt?`App ${Rt.appVersion} · CLI ${Rt.bundledCliVersion}`:e("settings.desktopStatusLoading")})]})]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary",children:"macOS"})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-px bg-border/10 sm:grid-cols-3",children:[a.jsxs("button",{type:"button",onClick:()=>{ve.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:[a.jsx(l8,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),a.jsxs("button",{type:"button",onClick:()=>{ye(null),ve.installCli().then(C=>{He(C),ye(e("settings.desktopCliUpdated"))}).catch(C=>ye(C instanceof Error?C.message:String(C)))},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:[a.jsx($o,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),a.jsxs("button",{type:"button",onClick:()=>{ye(null),ve.revealDataDirectory().catch(C=>ye(C instanceof Error?C.message:String(C)))},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:[a.jsx(D0,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),q&&a.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:q})]}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{_n(null),Yo({mode:"shell"}),ui()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${tc?"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(fi==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[a.jsx(Xi,{size:14,className:tc?"shrink-0":"hidden"}),a.jsx($o,{size:12}),a.jsx("span",{className:tc?"whitespace-nowrap":"hidden",children:e(fi==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),a.jsxs("button",{type:"button",disabled:!Fr.available,onClick:()=>{Fr.available&&(_n(null),Yo({mode:"tmux"}),ui())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${Fr.available?rc?"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:Fr.available?e(fi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):Fr.reason||e("settings.installTmuxHint"),children:[a.jsx(Xi,{size:14,className:rc?"shrink-0":"hidden"}),a.jsx(U0,{size:12}),a.jsx("span",{className:rc?"whitespace-nowrap":"hidden",children:e(fi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(Fr.available||yn.length>0)&&a.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[a.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${Fr.available?"bg-primary":"bg-destructive"}`}),a.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Fr.available?e("settings.sessions",{n:yn.length}):e("settings.tmuxUnavailable")})]}),a.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),ma()},disabled:As,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:a.jsx(hs,{size:12,className:As?"animate-spin":""})})]}),a.jsx("div",{className:"px-2 pb-2",children:Fr.available?yn.length===0?a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):a.jsxs("div",{className:"space-y-2",children:[gh.map(C=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[a.jsx(O0,{size:11,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:C.label}),a.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:C.sessions.length})}),C.key&&a.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:C.key})]}),C.sessions.map(B=>{const ee=B.boundFrontendSessionId??null,Ne=!!(B.connected||ee),lt=ee?_e.find(Ms=>Ms.id===ee)??null:null,Dt=B.friendlyName?.trim()||null,mr=B.label&&B.label!==B.name?B.label:null,on=Dt||mr||B.name,mn=Dt||mr?`tmux:${B.name}`:null,In=B.clientCount&&B.clientCount>0?t==="zh"?`网页连接 ${B.clientCount}`:`Web clients ${B.clientCount}`:null,So=B.attached>0?t==="zh"?`原生 tmux ${B.attached}`:`Native tmux ${B.attached}`:null,kn=[mn,Ne?B.restorable?e("settings.restorable"):e("settings.attached"):null,In,So].filter(Ms=>!!Ms),Fi=[e("settings.windows",{n:B.windows}),B.createdAt?new Date(B.createdAt).toLocaleDateString():null].filter(Ms=>!!Ms),_o=eo===B.name,Rs=H===B.name,bs=ze===B.name;return a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${_o?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[a.jsx(U0,{size:13,className:Ne?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:on}),B.friendlyName&&a.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"})]}),kn.length>0&&a.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:kn.map(Ms=>a.jsx("span",{className:"max-w-full truncate",children:Ms},Ms))}),(B.program||B.cwd)&&a.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[B.program&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx($8,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate text-foreground/75",children:B.program})]}),B.cwd&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(O0,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate",children:B.cwd})]})]}),a.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Fi.map(Ms=>a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(w8,{size:10,className:"shrink-0 text-muted-foreground/60"}),Ms]},Ms))})]}),_o?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:Rs,onClick:()=>{ph(B.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:Rs?"…":e("settings.destroy")}),a.jsx("button",{type:"button",disabled:Rs,onClick:()=>{Rr(null),ke(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")})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>{lt?tl(lt.id):(Ze(B.name),Yo({mode:"tmux",tmuxSessionName:B.name}))},disabled:bs,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${Ne?"bg-surface text-foreground hover:bg-surface-elevated":bs?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:bs?a.jsxs(a.Fragment,{children:[a.jsx(un,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(Ne?"settings.attached":"settings.attach")}),a.jsx("button",{type:"button",disabled:Rs,onClick:()=>{ke(null),Rr(B.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 ${B.name}`,children:a.jsx(Ji,{size:12})})]})]},B.name)})]},C.key||"__ungrouped_tmux__")),$e&&a.jsx("p",{className:"px-2 text-[11px] text-destructive",children:$e})]}):a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:Fr.reason||e("settings.installTmuxHint")})})]}),a.jsxs("button",{type:"button",onClick:()=>pi(!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:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(W8,{size:14,className:"text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:e("settings.sessions",{n:nt.length})}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>no(!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:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Hd,{size:14,className:"text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:"hooks"}),a.jsx("span",{children:"›"})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),a.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(C=>{const B=t===C.code;return a.jsx("button",{type:"button",onClick:()=>r(C.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:C.label},C.code)})})]}),a.jsxs("button",{type:"button",onClick:async()=>{try{await Rv()}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:[a.jsx(L9,{size:14}),e("settings.signOut")]})]})]})})]}),rl&&a.jsxs(a.Fragment,{children:[a.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:()=>{Sn(null),Jn(null),ke(null)},"aria-label":e("common.close")}),a.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 ${Zs&&jt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:Zs&&jt?{...E5(Zs),paddingBottom:i}:{paddingBottom:i},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:mh}),a.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{Xs({sessionId:rl.id,source:"sidebar",closeMode:"destroy"}),Sn(null),Jn(null)},className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[a.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:a.jsx(Ji,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),$e&&a.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:$e})]}),a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:()=>{Sn(null),Jn(null),ke(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")})})]})]}),Re&&(()=>{const C=_e.find(In=>In.id===Re);if(!C)return null;const B=br.get(C.id),{primary:ee}=ka(C,B?.activeProgram??null,B?.cwd??null,go),Ne=jt,lt=Ne?E5(pr):{paddingBottom:i},Dt=Ne?"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%]",mr=Ne?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",on=Ne?"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",mn=Ne?"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 a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${Ne?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:O,"aria-label":"Close menu"}),a.jsxs("div",{className:Dt,style:lt,children:[a.jsxs("div",{className:mr,children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:ee}),B?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:B.cwd})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{const In=pr;O(),at(In),tt(C.id)},className:`${on} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${mn} bg-primary/15 text-primary`,children:a.jsx(a9,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.rename")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),a.jsxs("button",{type:"button",disabled:!B?.cwd,onClick:()=>{dh(C.id),O()},className:`${on} ${B?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[a.jsx("span",{className:`${mn} bg-surface-2 text-muted-foreground`,children:a.jsx(V8,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),Xt&&Xt===B?.cwd&&a.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),B?.agentNativeSessionId&&B.agentStatus!=="working"&&B.agentStatus!=="waiting"&&B.terminalSessionId&&a.jsxs("button",{type:"button",onClick:()=>{const In=B.terminalSessionId;In&&(O(),jn(C.id,In))},className:`${on} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${mn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:a.jsx(k0,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),B.agent?.displayName?` · ${B.agent.displayName}`:""]}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),a.jsx("div",{className:"my-1 border-t border-border/15"}),C.mode==="tmux"?a.jsxs("button",{type:"button",onClick:()=>{O(),_l(C.id)},className:`${on} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${mn} bg-destructive/15 text-destructive`,children:a.jsx(Ji,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):a.jsxs("button",{type:"button",onClick:()=>{O(),Xs({sessionId:C.id,source:"tab-menu",closeMode:"auto"})},className:`${on} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${mn} bg-destructive/15 text-destructive`,children:a.jsx(vs,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.close")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!Ne&&a.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:()=>{O()},children:e("tab.longPressTip")})]}),!Ne&&a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:O,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")})})]})]})})(),xt&&Yt&&jt&&(()=>{const C=_e.find(kn=>kn.id===xt);if(!C)return null;const B=br.get(C.id),{primary:ee}=ka(C,B?.activeProgram??null,B?.cwd??null,go,B?.shellTitle??null,B?.promptState??null),Ne=C.customName?C.name:ee,lt=kn=>{const Fi=kn.trim();Fi?Fi!==Ne&&Bn(C.id,Fi):Ls(C.id),tt(null),at(null)},Dt=300,mr=160,on=Yt.x,mn=Yt.y,In=Math.min(Math.max(on-Dt/2,12),window.innerWidth-Dt-12),So=mn+mr+20>window.innerHeight?Math.max(mn-mr-12,12):mn+12;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{tt(null),at(null)},"aria-label":e("common.cancel")}),a.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:`${In}px`,top:`${So}px`},children:[a.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),a.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ee}),B?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:B.cwd})]}),a.jsxs("form",{className:"px-3 py-2.5",onSubmit:kn=>{kn.preventDefault();const Fi=new FormData(kn.currentTarget).get("session-name");lt(typeof Fi=="string"?Fi:"")},children:[a.jsx("input",{ref:kn=>{Us.current=kn,kn&&!Lr.current&&(Lr.current=!0,kn.focus({preventScroll:!0}),kn.select())},type:"text",name:"session-name",defaultValue:Ne,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:kn=>{kn.key==="Escape"&&(kn.stopPropagation(),tt(null),at(null))}}),a.jsxs("div",{className:"mt-2.5 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{tt(null),at(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")}),a.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")})]})]})]})]})})(),xt&&!jt&&(()=>{const C=_e.find(Dt=>Dt.id===xt);if(!C)return null;const B=br.get(C.id),{primary:ee}=ka(C,B?.activeProgram??null,B?.cwd??null,go,B?.shellTitle??null,B?.promptState??null),Ne=C.customName?C.name:ee,lt=Dt=>{const mr=Dt.trim();mr?mr!==Ne&&Bn(C.id,mr):Ls(C.id),tt(null)};return a.jsxs(a.Fragment,{children:[a.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:()=>tt(null),"aria-label":e("common.cancel")}),a.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(${s} + 3.5rem)`},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),a.jsxs("form",{className:"px-4 py-3",onSubmit:Dt=>{Dt.preventDefault();const mr=new FormData(Dt.currentTarget).get("session-name");lt(typeof mr=="string"?mr:"")},children:[a.jsx("input",{ref:Dt=>{Us.current=Dt,Dt&&!Lr.current&&(Lr.current=!0,Dt.focus({preventScroll:!0}),Dt.select())},type:"text",name:"session-name",defaultValue:Ne,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:Dt=>{Dt.key==="Escape"&&(Dt.stopPropagation(),tt(null))}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>tt(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")}),a.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")})]})]})]})]})})(),ne&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>je(!1)}),a.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:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),a.jsx("button",{type:"button",onClick:()=>je(!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:a.jsx(vs,{size:18})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[a.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:Z==="denied"?e("settings.notificationsDenied"):Wl()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),Wl()&&!lx()&&a.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),a.jsx("button",{type:"button",onClick:()=>{xr()},disabled:!Wl()||Z==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":k,children:a.jsx(Wa,{checked:k,disabled:!Wl()||Z==="denied"})})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[a.jsxs("span",{className:`rounded-full px-2 py-0.5 ${Z==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",Vs()?e("settings.notificationsPermissionSystem"):Z]}),a.jsx("button",{type:"button",disabled:!k||Z!=="granted"||rt==="checking",onClick:()=>{Jr()},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(rt==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),Vs()?.openNotificationSettings&&a.jsx("button",{type:"button",onClick:()=>{Vs()?.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")})]}),rt!=="idle"&&rt!=="checking"&&a.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${rt==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(rt==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),a.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(([C,B,ee])=>{const Ne=F===C;return a.jsxs("button",{type:"button",disabled:!k,onClick:()=>ur(C),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${Ne&&k?"bg-primary/15 text-primary":k?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ee,children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold",children:B}),a.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ee})]},C)})})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),a.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),a.jsx("button",{type:"button",disabled:!k,onClick:()=>ln(!R),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":R&&k,children:a.jsx(Wa,{checked:R&&k,disabled:!k})})]}),a.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),a.jsx("button",{type:"button",disabled:!k,onClick:()=>pn(!P),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":P&&k,children:a.jsx(Wa,{checked:P&&k,disabled:!k})})]})]}),a.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),Li&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>pi(!1)}),a.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:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),a.jsx("button",{type:"button",onClick:()=>pi(!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:a.jsx(vs,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a.jsx(ZB,{presets:nt,selectedPresetId:kr,onSelectPreset:Gn,onUpdatePreset:(C,B)=>{vr(ee=>M0(ee.map(Ne=>Ne.id===C?B(Ne):Ne)))},onAddPreset:()=>{const C=`preset-${Date.now()}`;vr(B=>M0([...B,{id:C,label:`Preset ${B.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),Gn(C)},onRemovePreset:C=>{vr(B=>M0(B.filter(ee=>ee.id!==C)))},onResetDefaults:()=>{vr(Kc()),Gn("default")}})})]})]}),ks&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>no(!1)}),a.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:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("button",{type:"button",onClick:()=>no(!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:a.jsx(vs,{size:18})})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[a.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),a.jsx(KB,{}),a.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),a.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),a.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:_e.map(C=>{const B=br.get(C.id),ee=B?.activeProgramRaw??null,Ne=B?.activeProgram??null;return a.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[a.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:C.name}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[a.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",Ne||"—"]}),a.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[a.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ee||"—"]})]},`raw-${C.id}`)})}),a.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:C,label:B,hint:ee})=>a.jsxs("div",{children:[a.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:B}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:ee}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[xe[C].map(Ne=>a.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:[Ne,a.jsx("button",{type:"button",onClick:()=>{const lt={...xe,[C]:xe[C].filter(Dt=>Dt!==Ne)};Je(lt),C==="shellNames"&&(go=new Set(lt.shellNames)),cm(lt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},Ne)),a.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:Ne=>{if(Ne.key!=="Enter")return;const lt=Ne.target.value.trim().toLowerCase();if(!lt||xe[C].includes(lt))return;const Dt={...xe,[C]:[...xe[C],lt]};Je(Dt),C==="shellNames"&&(go=new Set(Dt.shellNames)),Ne.target.value="",cm(Dt).catch(()=>{})}})]})]},C)),a.jsx("button",{type:"button",onClick:()=>{Mv().then(C=>{Je(C),go=new Set(C.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")})]}),a.jsxs("div",{className:"mt-3",children:[a.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),mi.map((C,B)=>a.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("input",{type:"checkbox",checked:C.enabled!==!1,onChange:ee=>{const Ne=mi.map((lt,Dt)=>Dt===B?{...lt,enabled:ee.target.checked}:lt);Ks(Ne),Un(lo,Ne),j(!0),f0(Ne).then(lt=>{Ks(lt),Un(lo,lt)}).catch(()=>{}).finally(()=>j(!1))}}),a.jsxs("select",{value:C.matchType,onChange:ee=>{const Ne=mi.map((lt,Dt)=>Dt===B?{...lt,matchType:ee.target.value}:lt);Ks(Ne),Un(lo,Ne),j(!0),f0(Ne).then(lt=>{Ks(lt),Un(lo,lt)}).catch(()=>{}).finally(()=>j(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[a.jsx("option",{value:"includes",children:"includes"}),a.jsx("option",{value:"exact",children:"exact"}),a.jsx("option",{value:"prefix",children:"prefix"}),a.jsx("option",{value:"regex",children:"regex"})]}),a.jsx("input",{value:C.pattern,onChange:ee=>{const Ne=mi.map((lt,Dt)=>Dt===B?{...lt,pattern:ee.target.value}:lt);Ks(Ne),Un(lo,Ne)},onBlur:()=>{j(!0),f0(mi).then(ee=>{Ks(ee),Un(lo,ee)}).catch(()=>{}).finally(()=>j(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),a.jsx("input",{value:C.output,onChange:ee=>{const Ne=mi.map((lt,Dt)=>Dt===B?{...lt,output:ee.target.value}:lt);Ks(Ne),Un(lo,Ne)},onBlur:()=>{j(!0),f0(mi).then(ee=>{Ks(ee),Un(lo,ee)}).catch(()=>{}).finally(()=>j(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),a.jsx("button",{type:"button",onClick:()=>{const ee=mi.filter((Ne,lt)=>lt!==B);Ks(ee),Un(lo,ee),j(!0),f0(ee).then(Ne=>{Ks(Ne),Un(lo,Ne)}).catch(()=>{}).finally(()=>j(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},C.id)),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{const C=[...mi,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];Ks(C),Un(lo,C),j(!0),f0(C).then(B=>{Ks(B),Un(lo,B)}).catch(()=>{}).finally(()=>j(!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")}),a.jsx("button",{type:"button",onClick:()=>{j(!0),Nv().then(C=>{Ks(C),Un(lo,C)}).catch(()=>{}).finally(()=>j(!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")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Q?e("settings.saving"):r0?`${mi.length} rules`:"…"})]})]})]})]})]})]}),gs&&a.jsx(zB,{isOpen:gs,onClose:()=>as(!1)}),!ki&&a.jsx(A5,{isOpen:Cn,drawerWidthPx:Ts,onClose:()=>An("left-sidebar"),onOpen:$s,sessions:_e,activeSessionId:wt,sessionStates:br,onNewSession:C=>Yo(C),recoverableTmuxSessions:o0,recoverableTmuxSessionsLoading:As,onRefreshRecoverableTmuxSessions:()=>{ma()},onCloseSession:_l,onSplitSession:i0,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:Qt,onSetSplitLayout:pu,onReorderSplitWorkspace:ec,onRenameSplitWorkspace:mu,onCombineSplitSessions:gu,onReorderSessions:Co,onSessionMenu:ja,onOpenSettings:qo,onOpenQuota:()=>as(!0),updateState:Te,updateActionPending:Ge,onConfirmUpdateRestart:dr,onRetryUpdate:js,tmuxAvailable:Fr.available,defaultSessionMode:es,runningSessionButtonEnabled:Vr,onRunningSessionButtonEnabledChange:Fs,onTogglePinned:jt?Wo:void 0}),!l0&&a.jsx(T5,{isOpen:ns,drawerWidthPx:wn,onClose:()=>An("right-sidebar"),onOpen:Ho,rightSidebarFilePreviewOpen:Pt,rightSidebarFilePreviewCloseSignal:Se,onOpenRightSidebarFilePreview:Ma,onCloseRightSidebarFilePreview:Si,rightSidebarRepoPickerOpen:Ue,rightSidebarRepoPickerCloseSignal:Ke,onOpenRightSidebarRepoPicker:To,onCloseRightSidebarRepoPicker:Xa,markdownOutlineOpen:We,markdownOutlineCloseSignal:ir,onOpenMarkdownOutline:fa,onCloseMarkdownOutline:Na,markdownImageLightboxOpen:dt,markdownImageLightboxCloseSignal:Et,onOpenMarkdownImageLightbox:Da,onCloseMarkdownImageLightbox:Ys,onTogglePinned:jt?to:void 0}),Ve&&!u&&a.jsx("button",{type:"button",onClick:_i,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:a.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:[a.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),a.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."}),a.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),lr&&a.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 ${lr.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:lr.tone==="error"?"alert":"status",children:[lr.tone==="success"?a.jsx(k0,{size:14,className:"shrink-0 text-[color:var(--success)]"}):a.jsx(gd,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:lr.message}),a.jsx("button",{type:"button",onClick:()=>Zt(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:a.jsx(vs,{size:12})})]}),c&&a.jsxs(a.Fragment,{children:[!jt&&a.jsx(N9,{onClose:()=>h(!1)}),a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),a.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),a.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(Qe,null,2)})]})]})]}),ic=Er?null:a.jsxs("div",{className:"termdock-boot z-modal-panel",role:"status","aria-live":"polite",children:[a.jsx("div",{className:"termdock-boot-spinner","aria-hidden":"true"}),a.jsx("span",{children:"Loading Termdock"})]});return jt?a.jsxs("div",{className:"w-screen h-full flex flex-row",children:[ki&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{width:Mn,flexShrink:0,height:"100%"},children:a.jsx(A5,{isOpen:Cn,drawerWidthPx:Mn,onClose:ua,onOpen:$s,sessions:_e,activeSessionId:wt,sessionStates:br,onNewSession:C=>Yo(C),recoverableTmuxSessions:o0,recoverableTmuxSessionsLoading:As,onRefreshRecoverableTmuxSessions:()=>{ma()},onCloseSession:_l,onSplitSession:i0,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:Qt,onSetSplitLayout:pu,onReorderSplitWorkspace:ec,onRenameSplitWorkspace:mu,onCombineSplitSessions:gu,onReorderSessions:Co,onSessionMenu:ja,onOpenSettings:qo,onOpenQuota:()=>as(!0),updateState:Te,updateActionPending:Ge,onConfirmUpdateRestart:dr,onRetryUpdate:js,tmuxAvailable:Fr.available,defaultSessionMode:es,runningSessionButtonEnabled:Vr,onRunningSessionButtonEnabledChange:Fs,pinned:!0,onTogglePinned:Wo})}),a.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:zs})]}),a.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[bu,l0&&a.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Il},children:[a.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:Ka}),a.jsx("div",{style:{width:Ll,flexShrink:0,height:"100%"},children:a.jsx(T5,{isOpen:!0,drawerWidthPx:Ll,onClose:da,onOpen:Ho,pinned:!0,onTogglePinned:to,rightSidebarFilePreviewOpen:Pt,rightSidebarFilePreviewCloseSignal:Se,onOpenRightSidebarFilePreview:Ma,onCloseRightSidebarFilePreview:Si,rightSidebarRepoPickerOpen:Ue,rightSidebarRepoPickerCloseSignal:Ke,onOpenRightSidebarRepoPicker:To,onCloseRightSidebarRepoPicker:Xa,markdownOutlineOpen:We,markdownOutlineCloseSignal:ir,onOpenMarkdownOutline:fa,onCloseMarkdownOutline:Na,markdownImageLightboxOpen:dt,markdownImageLightboxCloseSignal:Et,onOpenMarkdownImageLightbox:Da,onCloseMarkdownImageLightbox:Ys})})]})]}),ic]}):a.jsxs(a.Fragment,{children:[bu,ic]})}const ij=Object.freeze(Object.defineProperty({__proto__:null,default:gQ},Symbol.toStringTag,{value:"Module"}));export{ij as A,Wc as C,Gc as D,hB as F,V8 as L,X8 as M,i9 as P,hs as R,xd as S,bS as T,e8 as a,Xv as b,K5 as c,_8 as d,Np as e,a9 as f,Vc as g,qc as h,hm as i,rx as j,$6 as k,b9 as l,A9 as m,Ji as n,o3 as o,rj as p,Og as q,X_ as r,K_ as s,np as t,nj as u,sj as v,$9 as w};